CTYPEDEFINE Define C Type
Section: FreeMat External Interface
ctypedefinefunction allows you to define C types for use with FreeMat. Three variants of C types can be used. You can use structures, enumerations, and aliases (typedefs). All three are defined through a single function
ctypedefine. The general syntax for its use is
typeclass is the variant of the type (legal values are
'enum'). The second argument is the
name of the C type. The remaining arguments depend on what the
class of the typedef is.
To define a C structure, use the
'struct' type class. The usage
in this case is:
typename must be a valid identifier string. Each of
field arguments is also a valid identifier string that
describe in order, the elements of the C structure. The
typespecs. They can be of three types:
- Built in types, e.g.
'double'to name a couple of examples.
- C types that have previously been defined with a call to
'mytype'has already been defined through a call to
- Arrays of either built in types or previously defined C types
with the length of the array coded as an integer in square brackets,
'enum'type class. The usage in this case is: ctypedefine('enum',typename,name1,value1,name2,value2,...) @] The argument
typenamemust be a valid identifier string. Each of the
namearguments must also be valid identifier strings that describe the possible values that the enumeration can take an, and their corresponding integer values. Note that the names should be unique. The behavior of the various
cenumfunctions is undefined if the names are not unique. To define a C alias (or typedef), use the following form of
aliased_typename is the type that is being aliased to.