Ada - Fortran interface checking

Introduction
============

	This test suite is used for testing Ada-Fortran interfacing. Its
contain three parts:

(1) Tests of basic type parameter passing: 
	Check integer, Real, Double Precision, Complex, Complex*16
   Character, String and logical.

(2) Tests of Matrix arguments:
	Check imatrices with component types Integer, Real, Double Precision,
        Complex, Complex*16 and Logical.

(3) Tests of Function parameters.

***********************************************************************
	Make sure these tests run correctly, before attempting any
        more serious use of lapada.
***********************************************************************

Requirement:
===========
	gnat - Version 3.04 or higher
	gcc  - 2.7.2 or higher

	Fortran compiler

These tests work successfully on:

   SUN (SunOS, Solaris) using f77.
   Linux using g77.

Please let us know of other successful (and unsuccessful) uses on other
systems.
	
Testing:
========

(1) Modify Makefile to match your Fortran compiler and library as
            required (FORTRAN and LIBF lines).

(2) run make

If make fails :
---------------

The most likely errors at this point may be the following:
		 
a)  - Undefined symbol for a Fortran function name when linking
  (gnatbl).  This is caused by fortran compiler, which may be generating
  different linker names. Determine from object file the external name of
  the Fortran function, and modify the Import pragma accordingly,
  Normally the compiler generates external name by  adding an underscore
  to the function or subroutine name:  Fortran subroutine name "ifinc" is
  changed into "ifinc_" by F77, but this convention is not universal.
  
  Do the following:

	 % f77 -c ifinc.f
    or  
        % g77 -c ifinc.f 

    Then 
	 % nm ifinc.o

  to list the symbols. One of them should be

		00000000 T ifinc_

  but it may have a different suffix (the original name ifinc should be
  recognizable). If it is different from what is specified in the pragma,
  modify accordingly. Recall that in:

	     pragma Import (Fortran, IF_INC,"ifinc_");
		
  the third parameter is the real symbolic name that created by
  foreign compiler. 


b) Undefined symbol, in fortran code.
   Check the library path, and library option as required by Fortran.

   The library path may be defined by LD_LIBRARY_PATH environment
   variable (SUN ld) or by  -L option (Gnu ld). Check ld manual. Check
   whether Fortran needs some other library. For example. F77 on SUN
   requires specification of libm, which is not the one used by  gcc.

c) Undefined symbol, "main". Try to link with static option, by
adding  
	% gnatbl cxbi.ali cfinc.o -lf2c -static
		 


If no compilation or link errors:
---------------------------------

(3) run testing

 	  % make testing

	The output of testing will be in Test.Out.  

Expected Output
===============

You need to examine the output line by line. The correct result is the
following:

(1) Tests of basic type parameter passing.

	These tests contain
	  cxbi cxbs cxbd cxbc cxbz cxbch cxbsh cxbl.

Result should be:

 Ada send: in(1) and in/out(3) should be gotten by Fortran with same value.
 Ada receives: out(2) and in/out(3) should be the same value that is
 sent by  Fortran

 For floting point types, small differences may show up because of
differences in the accuracy of floating I/O.
 
 For more discussion on issues of parameter passing issue, read MODE.txt

(2) Tests of  matrix arguments.

 fortran store matrices in column-major order, in contrast with most
other languages (including Ada). The Ada95 pragma Convention (Fortran...)
specifies that multidimensional arrays should be stored in  column-major
order. This is verified by this series of tests.

	These tests include 
	  cxbim cxbsm cxbdm cxbcm cxbzm cxblm.

For integer matrix the result should be

       1111       1212       1313
       2121       2222       2323
       3131       3232       3333


For floating point matrix, all elements should be 1.0.

For logical matrix the output should be: 

	Ada logical array
	FFF
	TFF
	TTF

	back from Fortran
	TTT
	FTT
	FFT

(3) Testing for function passing.

	Several LAPACK Driver routines take a (pointer to a) function
as an argument. On the Ada calling side, the argument is an access_To_
function. These tests define their own access types, which the user
can also find in labase.ads.

	these tests include
	  cxbfun1 cxbfun3

Currently these only test funtions that return logical type.
The output should be:

	 1.00000E+00 1.00000E+00 T
	 1.10000E+00 1.00000E+00 F


Under Gnat 3.04, cxbfun1 and cxbfun3 are not working correctly in  all
cases:  functions that take Complex_Star_16 (double complex) parameters
are not functional.

