Browse Prior Art Database

Passing Data From Apl2 to C Using Fortran Linkage

IP.com Disclosure Number: IPCOM000108998D
Original Publication Date: 1992-Jul-01
Included in the Prior Art Database: 2005-Mar-23
Document File: 3 page(s) / 103K

Publishing Venue

IBM

Related People

Beaty, KA: AUTHOR [+2]

Abstract

This article deals with the problem of having a multitude of calls made from an APL2* environment to any external environment, of which C is a prime example. Each of these calls will require a separate entry in the call description table, if using normal techniques, leading to cluttering the workspace with a lot of external function names.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Passing Data From Apl2 to C Using Fortran Linkage

       This article deals with the problem of having a multitude
of calls made from an APL2* environment to any external environment,
of which C is a prime example.  Each of these calls will require a
separate entry in the call description table, if using normal
techniques, leading to cluttering the workspace with a lot of
external function names.

      There are three parts to the solution of this problem.  It is
the second part that forms the basic content of this article.
      1.   The first and most obvious part is to recognize that a lot
of calls employ identical parameter sequences.  Syntactically it is,
therefore, possible to combine a number of calls into a single
definition.  This single definition can then be used to transport the
data from APL2 to C and back, as long as it is possible to separate
the calls once the C environment has been reached.
      2.   A further reduction can be achieved by recognizing that
the parameter list always is a sequence of alternating vectors of
strings and vectors of numbers.  Using automata theory this can be
described by:
                (s*n*)*
           with "s" indicating a string, "n" a number, and "*"
indicating zero or more occurrences of the item.
           By using APL2's Processor 11 to connect to the external
environment, and by using Processor 11's Fortran linkage, this can be
mimicked.  Two things make this possible:
           a.   More than one numeric parameter can be passed in a
single parameter in the argument list.
                Since Fortran linkage (as well as regular OS linkage)
passes parameters by reference, it is possible to pass a vector of
unspecified length, not just a single number.  What distinguishes
Fortran linkage from standard OS-type linkage is that the total
length of each parameter is also available, as part of the parameter
list itself.  Since each numeric item has a fixed, common size, it is
possible to tell how many items were passed in a given parameter by a
simply dividing the length of the parameter by the size of a numeric
item.
           b.   Multiple adjacent strings can be passed by separating
them with an empty numeric vector, i.e., a vector of length zero.
                A parameter with length zero cannot be generated by a
normal C program.  This makes such a parameter a perfect filler
element. By being numeric, the parameter can be passed in the numeric
slots.  By using it multiple adjacent ...