next up previous
Next: Subprogram invocation mechanism Up: The translation approaches Previous: Naming conventions

How to produce a class

A primary difference between object oriented language and procedural language is the former introduces the powerful concept of class. Many other differences are derived from it. Class is a basic concept in Java [3], but it does not exist in FORTRAN 77 [6]. Although the direction of this difference does not present major difficulty for our job, since class is a more general concept than procedure, some details have to be taken care.

In order to successfully convert a FORTRAN source to Java source, classes has to be produced. But how to do it? At least two approaches can be considered.

Less .class file will be generated and higher performance will be achieved (due to less dynamic run-time loadings) if the first method is used, but some difficulties will be brought into function/subroutine invocation and parameter passing, which we do not have a clear idea yet. So the second method has been adopted. Besides, the name rules specified above are observed with this method.

As an example, the following FORTRAN subroutine

    subroutine signMeUp(price, price1) 
    integer price, price1
    price = price1 + 1
    return
    end

will be converted into:

    class signMeUp_c {
       static int price_cv;   
       static int price1_cv; 
       public static signMeUp(int price,int price1) {
          price=price1+1 ;
          price_cv = price;
          price1_cv = price1;
          return;
       }
    }

As we see, two extra class variables are produced. Their use is to solve argument passing problem as described below.




Tue Dec 1 01:57:28 EST 1998