Browse Prior Art Database

APL2 using C Routines with Multiple Output or Input/Output Parameters

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

Publishing Venue

IBM

Related People

Beaty, KA: AUTHOR [+2]

Abstract

APL2* can define and use functions written in C as external functions. The problem addressed by this disclosure is how to map the function arguments so that the basic way of parameter passing employed by these two environments is not violated in the user's mind, i.e., the rules governing calls to APL2 functions written in APL2 should also extend to APL2 functions written in C.

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

APL2 using C Routines with Multiple Output or Input/Output Parameters

       APL2* can define and use functions written in C as
external functions.  The problem addressed by this disclosure is how
to map the function arguments so that the basic way of parameter
passing employed by these two environments is not violated in the
user's mind, i.e., the rules governing calls to APL2 functions
written in APL2 should also extend to APL2 functions written in C.

      There are many aspects to this problem.  Some of them are:
       .   APL2 passes all parameters by value, whereas C allows
calls by reference as well.  How to map the one scheme to the other
is the question.
       .   C parameters may employ a whole chain of indirect
references to the value.  How can this chain be set up.
       .   Data conversions

      All of these have been dealt with elsewhere.  The topic for
this article is:
       .   How to map a C function returning multiple values to an
APL2 function, i.e., what is the APL2 equivalent of the C function:
                result = Cfn(input, inout, output);

      The solution is to use the APL2's general array to hold the
composite return, and to employ stranded assignment to break up the
return.  The example from the problem statement can be reformulated
in APL2 as:
                (result inout output) E APLfn(input, inout);
Implementing the external function calls in thi...