getExportTable {Slcc}R Documentation

Generate table of C routines for use in S via .C and .Call

Description

These functions handle the creation of C code that registers C routines with S that can be accessed via .C and .Call (and potentially .External

getExportTable is the top-level function that process the C source files and determines information about the parameters for the arguments.

createExportTable does the actual C code generation given the routines being exported. This can be used directly when changing the way the routines to be exported is determined.

Usage

getExportTable(fileNames, which, libraryName = "")
createExportTable(exports, varName = "", elFun=function(el) {
                                   paste("  { \"", el$name, 
                                         "\", (DLFUNC) &", 
                                         el$name, ", ", 
                                         length(el$type$parameters), "}", 
                                         sep="")
                                     })

Arguments

fileNames a character vector giving the names of the C files in which to find routines.
which an optional list of routine names, which if specified, limits the set of ``exported'' routines to the names in this vector.
libraryName the name of the library (or package), used to better describe the C variables storing the information about the exported routines
exports a list of routines, usually retrieved from lcc, defining the routines that are to be listed in the export table.
varName the name of the C variable to assign the array of routine registration information, usually the library name appended with the type of routine (e.g. C, Call, Fortran, etc.)
elFun a function which is used to generate the C code text defining each element in the routine registration array, allowing one to perform different mappings.

Details

This is an initial example of using the lcc mechanism. It will be enhanced with more controls for specifying which routines are to be used.

Value

createExportTable
getExportTable returns the value from calling createExportTable.

Author(s)

Duncan Temple Lang (duncan@research.bell-labs.com)

References

http://www.omegahat.org/Slcc, http://www.cs.princeton.edu/software/lcc/

See Also

Examples