coerceRValueCode {RGtkBindingGenerator}R Documentation

Generate R code to coerce R object to type.

Description

This generates R code which checks and potentially coerces an argument to an S function to the appropriate type as required by C code to which the argument will be passed.

Usage

coerceRValueCode(type, name, defs)
getPrimitiveTypeAs(x)

Arguments

type the target type to which the variable name is to be converted.
name the name of the S variable to be used in the generated converstion code
defs the collection of class, enumeration, etc. definitions collected from the .defs files in which to find information about the types.
x the name of the primitive S type. This is then used to index the table PrimitveTypeCoercion by name.

Details

This is not extensible, but instead uses a collection of if-else statements to determine how to convert the variable to the appropriate type. It checks for primitives, enumerations, a string array and then punts by assuming gtkCheckInherits will suffice.

Value

A list giving the name of the variable and the code to coerce it.

name the value of the name argument converted to an S variable name using nameToS
coerce the string giving the code to convert to the variable to the appropriate form.


getPrimitiveTypeAs returns the name of the S function that converts the primitive S value to the appropriate type.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/RGtk http://www.omegahat.org/GtkAutoBindingGen http://www.gtk.org

See Also

genCode nameToS

Examples

 data(GtkDefs)
 coerceRValueCode("GtkWidget", "w",  GtkDefs)

[Package RGtkBindingGenerator version 0.3 Index]