
Via the makefile the different ftoc_xyz.h files are copied to ftoc_test.h 
(in $MIDASHOME/$MIDVERS/incl) and for each ftoc_xyz.h the module ftoc_test.c
(generated from ftoc_test.fc) is compiled again with this new include file,
and a new ftoc_xyz.exe (which is the for_test.exe with the include file 
ftoc_xyz.h) is built. 

Then the shell script ftoc_params (in ../exec) is executed which checks 
each of the ftoc_xyz.exe and, if all is o.k., it returns the corresponding 
ftoc_xyz.h file
which is then copied for good to ftoc.h for the Midas installation.
A message indicating which include file matched is displayed as well.

If there's no success, a warning message is displayed and one has to try
manually to find the mechanism how Fortran parameters are passed to the
C-stack by the compiler.

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

For testing an unknown Fortran / C parameter passing mechanism there
are two more executables available:
ftoc_test.exe, ftoc_stack.exe
which are compiled and linked via the "maketest" makefile:
$ make -f maketest

but it's better to compile it non-optimized:
$ make DEBUG=-g STRIP=echo C_OPT=  -f maketest 

ftoc_stack.fc (as well as ftoc_test.fc) includes file ftoc_test.h, 
so one should copy the most likely ftoc_xyz.h file to ftoc_test.h by hand.
OJO: ftoc_test.h was set to the last trial ftoc_xyz.h in the general make - 
so it usually has to be reset manually.
To display the parametrer stack common code for the different subroutines, 
which is stored in stack_dump.h is used within ftoc_stack.fc (all include (.h) 
files are in /midas/version/incl).
As Fortran front-end the module for_try.for contains the calls to
various subroutines of ftoc_test.fc with different calling sequences and 
parameters.

ftoc_test.fc also includes file ftoc_test.h (in /midas/version/incl) and
calls 3 different C routines (SSP1, SSP2, SSP3) checking the parameters
in the routines with the values passed in for_test.for. If all is o.k., a
status of 0 is returned.

To compile and link these modules, do:

$ make -f maketest basic
which creates ftoc_test.exe

$ make -f maketest stack 
which creates ftoc_stack.exe

$ ../exec/ftoc_stack.exe

should show the layout of the stack somewhat better for different subroutine 
calls.

Testing a new compiler setup involves then modifying the ftoc_test.h file
and also stack_dump.h.
The changes to ftoc_stack.fc would be mainly to toggle the flags (nogo) for
the different stack entries to avoid SEG faults through invalid pointers.
Then do the makes as indicated above, and keep trying ...

For more details, read ./doc/modules.txt.

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

on Solaris:
kbanse@dmdsol8b$ ../exec/ftoc_names.exe
-fl_
Note: Nonstandard floating-point mode enabled 
See the Numerical Computation Guide, ieee_sun(3M) 

on Linux:
somidas@pc004351> ../exec/ftoc_names.exe
-fl_





060228 KB

