General
Name
General — library initialization and miscellaneous functions.
Synopsis
Description
This section describes the MzMisc initialization functions and miscellaneous utility
functions.
Details
typdef struct _mz_proxy {
Scheme_Type type
void *object
} mz_proxy
|
Wrapper for new scheme objects
|
type
|
scheme object.type |
|
object
|
pointer to the wrapped object. |
Creates a scheme object wrapper for object
|
type
|
scheme object type. |
|
object
|
pointer to the wrapped object. |
|
Returns
|
a new scheme object that wraps object. |
Example: Creating a new type of scheme object
Scheme_Type new_type;
Scheme_Object *new_object;
new_type = mz_make_type( "<SomeNewType>" );
new_object = mz_make_proxy( new_type, some_func() );
|
#define |
*MZ_PROXY_VAL |
(proxy) |
Returns the object being wrapped by the proxy
|
proxy
|
wrapped object |
|
Returns
|
the object being wrapped by the proxy |
Used to end static primitive definition array
Example: Ending primitives
static mz_prim my_primitives[] = {
{ &my_names[1], some_func, 0, 0 },
MZ_PRIM_END
};
|
Forward declaration for scheme primitives
Example: Declaring primitives
MZ_PRIM_DECL( some_func );
|
Used to end static primitive definition array
|
a
|
array of strings |
|
i
|
index into array |
|
Returns
|
the string at i in a |
Definition for scheme procedure
|
name
|
function name |
|
func
|
the fuction |
|
min
|
minimum number of parameters |
|
max
|
maximum number of parameters |
Example: Creating primitives
static char *my_names[] = {
"some_func_name",
NULL
};
typedef enum {
SOME_FUNC
} MyNamesIndex;
MZ_PRIM_DECL( some_func );
#define MY_NAME(i) MZ_NAME(my_names, i)
#define SOME_FUNC_NAME MY_NAME( SOME_FUNC )
static mz_prim my_primitives[] = {
{ &( SOME_FUNC_NAME ), some_func, 0, 0 },
MZ_PRIM_END
};
Scheme_Object *some_func(int argc, char *argv[]) {
return scheme_make_string( "blah" );
}
|
Last modified: Wed Mar 19 20:16:34 EST 2003