Browse Prior Art Database

Map a C Data Structure to an APL2 Nested Array

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

Publishing Venue

IBM

Related People

Beaty, KA: AUTHOR [+2]

Abstract

If APL2* is to make full use of its external interface capabilities to call programs written in the C language, it must be able to deal with C data structures in an intelligent manner.

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

Map a C Data Structure to an APL2 Nested Array

       If APL2* is to make full use of its external interface
capabilities to call programs written in the C language, it must be
able to deal with C data structures in an intelligent manner.

      The solution to this problem is to map the C data structures to
an equivalent APL2 nested array.  The APL2 nested array is not a
mirror image of a C data structure, but it is the APL2 equivalent of
dealing with complicated, complex or mixed data.

      The mapping takes place on an element-for-element basis:
       .   For each element found in the C data structure, add a
corresponding element to the APL2 nested array.
       .   For referenced elements in the C data structure, follow
the chain of references until the value is reached, and store the
value in the APL2 array.
       .   C's structures within structures are mapped to arrays
nested within arrays.

      The following C data structure will serve as an example.  The
structure is defined and initialized in one go.

      In APL2, an equivalent setup would amount to:
           test E 1 'John' (2 3)

      The major benefit to this solution is that is shows that C data
structures can be mapped to the APL2 environment.  This is a vital
requirement, if APL2 is to be able to use C functions as external
routines, due to the widespread use of data structures within any C
function.

      Another benefit is that A...