coerceRValueCode {RGtkBindingGenerator} | R Documentation |
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.
coerceRValueCode(type, name, defs) getPrimitiveTypeAs(x)
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. |
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.
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.
Duncan Temple Lang
http://www.omegahat.org/RGtk http://www.omegahat.org/GtkAutoBindingGen http://www.gtk.org
data(GtkDefs) coerceRValueCode("GtkWidget", "w", GtkDefs)