convertToCType {RGtkBindingGenerator}R Documentation

Generate code to convert from S to C and vice-versa

Description

These functions generate the code that marshall a value from S to C and from C to S by calling the appropriate conversion function. These generate a string which is responsible for converting the parameter identified by name and of type type to a C or S value.

convertToCType generates S code that is typically used to process arguments in S interface functions with the results passed on to the C routine.

convertToR generates C code that is used at the end of a C interface routine that connects a routine or object field in the defs files and an S language function.

Usage

convertToCType(name, type, defs)
convertToR(var, type, defs) 

Arguments

name the name of the parameter in the S function defining the S-to-C interface.
var same as name; the name of the parameter in the C routine defining the S-to-C interface.
type an object describing the target C type which is expected to be represented in the S argument.
defs the collection of all the definitions in which to find the type information.

Details

This is mainly hand-crafted piece of code consisting of numerous if-else clauses. It needs to be extended to handle lists, etc. and made more externally extensible by looking up tables or invoking generic functions allowing for methods.

Value

A string giving the code that performs the coercion and/or dereferencing of the S value to return a corresponding C value.

Author(s)

Duncan Temple Lang <duncan@research.bell-labs.com>

References

http://www.omegahat.org/RGtk, http://www.omegahat.org/RGtkBindingGenerator, http://www.gtk.org http://www.pygtk.org(?)

See Also

genCCode genFieldAccessors

Examples



[Package RGtkBindingGenerator version 0.3 Index]