[net.lang] Pascal to fortran, help needed

schuh@geowhiz.UUCP (David Schuh) (01/20/86)

*** REPLACE THIS LINE WITH YOUR MESSAGE ***

Help:
	I have to translate a nicely structured pascal program to
FORTRAN 77.  Not being a fortran hack (barly know it, but hate it)
I could use some advice:

[Note that it must be f77]

1)  Is there any way to get GLOBAL parameters (constants in normal lingo)
    I dont think PARAMETER's can be put in COMMON statements.
2)  value procedure arguments (as opposed to call by reference).
	One book says many implimentations of f77  will alow you to
	enclose the variable in parens in the call statement, which will
	cause it to be evaluated and passed by value.  Unfortunatly
	IBM Professional Fortran does not do this.  I really would like
	the comfort of value arguments.
3)  Is the only way to get Global variables is to use the common statment?
4)  translating records to fortran is tedious but reseonably strateforward
	but ... for instance with the record below would you 
	1)   declare a multidemension array 5 X deepest, and let the fieldnames
		 be global constants. hence Result_type_var(CDFTOWERS,x) = y?
		 Space inefficient.
	2)   Declare 1 X combined_length, and use the field names as offsets.
		 THis method is certainly more space efficient but strikes me as
		 more dangerous.
	3)   make each field its own variable?
		 THis doesnt appeal to me at all,  The project guidlines specify
		 a minimum use of COMMON areas and many procedures have many 
		 record arguments.  I have no desire to have argument lists
		 3 lines long.

I'd appreciate any answers to these questions from those of you in the
know.

Compilers Im using, IBM professional Fortran, Vax fortran.

program Htest (input, output);
const
    MAX_CDF_TOWERS = 15;
    WIRE_COUNT   = 28;
    DELAYED      = 2;
    STANDARD     = 1;
    REG1         = 0;
    REG2         = 1;
		.
		.
		.
Type
	MiniTower_type = array[0..WIRE_COUNT] of integer;
	CDFTower_type = array[1..MAX_CDF_TOWERS] of integer;
	Trigger_type = array[1..6] of boolean;

	Result_type  = record
		MiniTowers : MiniTower_type;
		CDFTowers  : CDFTower_type;
		Trigger    : Trigger_type;
		MCarry_out ,
		RCarry_out : boolean;
	end;
          .
		  .
		  .
var
{Global variables}
{Input parameter variables}
    PRINT        : integer;
    START        : integer;
    HOPU_OFFSET  : integer;
    HALF_RANGE   : integer;
		 .
		 .

Please respond by mail or net as you see fit.
But should probably be posted to net.F77 and not .pc or .lang

david schuh
!uwvax!geowhiz!schuh

mff@wuphys.UUCP (Swamp Thing) (01/24/86)

In article <348@geowhiz.UUCP> schuh@geowhiz.UUCP (David Schuh) writes:
>Not being a fortran hack (barly know it, but hate it)
>I could use some advice:
>

Now there's an unbiased opinion!  How do you know you hate something if you
don't know anything about it?



						Mark F. Flynn
						Department of Physics
						Washington University
						St. Louis, MO  63130
						ihnp4!wuphys!mff

------------------------------------------------------------------------------

"There is no dark side of the moon, really.
 Matter of fact, it's all dark."

				P. Floyd