![]() |
![]() |
![]() |
Seed Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
typedef SeedClass; enum SeedType; enum SeedPropertyAttributes; enum SeedClassAttributes; SeedEngine * seed_init (gint *argc, gchar ***argv); void seed_engine_set_search_path (SeedEngine *eng, const gchar *path); gchar ** seed_engine_get_search_path (SeedEngine *eng); typedef SeedContext; typedef SeedGlobalContext; typedef SeedContextGroup; SeedGlobalContext seed_context_create (SeedContextGroup group, SeedClass global_class); SeedGlobalContext seed_context_ref (SeedGlobalContext ctx); void seed_context_unref (SeedGlobalContext ctx); SeedScript; SeedScript * seed_make_script (SeedContext ctx, const gchar *js, const gchar *source_url, gint line_number); SeedValue seed_evaluate (SeedContext ctx, SeedScript *s, SeedObject this); SeedValue seed_simple_evaluate (SeedContext ctx, gchar *source); SeedScript * seed_script_new_from_file (SeedContext ctx, gchar *file); SeedException seed_script_exception (SeedScript *s); void seed_create_function (SeedContext ctx, gchar *name, SeedFunctionCallback callback, SeedObject object); SeedClass seed_create_class (seed_class_definition *def); SeedObject seed_make_constructor (SeedContext ctx, SeedClass class, SeedObjectCallAsConstructorCallbackconstructor ); typedef SeedObject; SeedValue seed_object_call (SeedContext ctx, SeedObject object, SeedObject this, gsize argument_count, const SeedValue arguments[], SeedException *exception); void seed_object_set_property_at_index (SeedContext ctx, SeedObject object, gint index, SeedValue value, SeedException *exception); gpointer seed_object_get_private (SeedObject object); void seed_object_set_private (SeedObject object, gpointer value); SeedValue seed_object_get_property (SeedContext ctx, SeedObject object, const gchar *name); gboolean seed_object_set_property (SeedContext ctx, SeedObject object, const gchar *name, SeedValue value); SeedValue seed_make_null (SeedContext ctx); SeedObject seed_make_object (SeedContext ctx, SeedClass class, gpointer private); gpointer seed_pointer_get_pointer (SeedContext ctx, SeedValue pointer); void (*SeedFunctionCallback) (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception); SeedObject (*SeedModuleInitCallback) (SeedEngine *eng); void (*SeedObjectInitializeCallback) (SeedContext ctx, SeedObject object); void (*SeedObjectFinalizeCallback) (SeedObject object); gboolean (*SeedObjectHasPropertyCallback) (SeedContext ctx, SeedObject object, SeedString string); SeedValue (*SeedObjectGetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedException *e); gboolean (*SeedObjectSetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e); gboolean (*SeedObjectDeletePropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e); void (*SeedObjectGetPropertyNamesCallback) (void); SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception); gboolean (*SeedObjectHasInstanceCallback) (SeedContext ctx, SeedObject constructor, SeedObject instance_p, SeedException *exception); SeedValue (*SeedObjectConvertToTypeCallback) (SeedContext ctx, SeedObject object, SeedType type, SeedException *exception); SeedValue (*SeedObjectCallAsConstructorCallback) (SeedContext ctx, SeedObject constructor, gsize argument_count, const SeedValue arguments[], SeedException *exception); void seed_signal_connect (SeedContext ctx, GObject *object, const gchar *signal, const gchar *script);
typedef enum { SEED_TYPE_UNDEFINED, SEED_TYPE_NULL, SEED_TYPE_BOOLEAN, SEED_TYPE_NUMBER, SEED_TYPE_STRING, SEED_TYPE_OBJECT } SeedType;
typedef enum { SEED_PROPERTY_ATTRIBUTE_NONE = 0, SEED_PROPERTY_ATTRIBUTE_READ_ONLY = 1 << 1, SEED_PROPERTY_ATTRIBUTE_DONT_ENUM = 1 << 2, SEED_PROPERTY_ATTRIBUTE_DONT_DELETE = 1 << 3 } SeedPropertyAttributes;
typedef enum { SEED_CLASS_ATTRIBUTE_NONE = 0, SEED_CLASS_ATTRIBUTE_NO_SHARED_PROTOTYPE = 1 << 1 } SeedClassAttributes;
SeedEngine * seed_init (gint *argc, gchar ***argv);
Initializes a new SeedEngine.
|
A reference to the number of arguments remaining to parse. |
|
A reference to an array of string arguments remaining to parse. |
Returns : |
The newly created and initialized SeedEngine. |
void seed_engine_set_search_path (SeedEngine *eng, const gchar *path);
Sets the default search path for Seed.include.
|
A SeedEngine, on which to set the path. |
|
A const gchar*, a colon separated string containing the path to set |
gchar ** seed_engine_get_search_path (SeedEngine *eng);
|
A SeedEngine, to get the currently set search path. |
Returns : |
A null-terminated array of strings containing the paths. |
SeedGlobalContext seed_context_create (SeedContextGroup group, SeedClass global_class);
|
A SeedContextGroup in which to create the new context, or NULL to
create it in the default context group.
|
|
The SeedClass to use to create the global object, or NULL to
create it with the default class.
|
Returns : |
A new SeedContext. |
SeedGlobalContext seed_context_ref (SeedGlobalContext ctx);
Increments the reference count of ctx
.
|
A SeedContext. |
Returns : |
ctx
|
void seed_context_unref (SeedGlobalContext ctx);
Decrements the reference count of ctx
.
|
A SeedContext. |
SeedScript * seed_make_script (SeedContext ctx, const gchar *js, const gchar *source_url, gint line_number);
Creates a new SeedScript instance with js
as the contents, then
checks for proper syntax.
|
A SeedContext. |
|
A string representing the contents of the script. |
|
The filename of the script, for reference in errors, or NULL .
|
|
The line number of the beginning of the script, for reference
in error messages, or NULL .
|
Returns : |
The newly created SeedScript. |
SeedValue seed_evaluate (SeedContext ctx, SeedScript *s, SeedObject this);
Evaluates a SeedScript with this
as the global "this" object.
|
A SeedContext. |
|
A SeedScript to evaluate. |
|
The object which should be assigned to the "this" global. |
Returns : |
The SeedValue returned by evaluating the script. |
SeedValue seed_simple_evaluate (SeedContext ctx, gchar *source);
Evaluates a string of JavaScript.
|
A SeedContext. |
|
A string representing the JavaScript to evaluate. |
Returns : |
The SeedValue returned by evaluating the script. |
SeedScript * seed_script_new_from_file (SeedContext ctx, gchar *file);
Uses seed_make_script()
to create a SeedScript from the contents of file
.
|
A SeedContext. |
|
The filename of the script to load. |
Returns : |
The newly created SeedScript. |
SeedException seed_script_exception (SeedScript *s);
|
A SeedScript. |
Returns : |
A JSValueRef representing the exception of s .
|
void seed_create_function (SeedContext ctx, gchar *name, SeedFunctionCallback callback, SeedObject object);
|
|
|
|
|
|
|
SeedClass seed_create_class (seed_class_definition *def);
|
A JSClassDefinition. |
Returns : |
A SeedClass, described by def .
|
SeedObject seed_make_constructor (SeedContext ctx, SeedClass class, SeedObjectCallAsConstructorCallbackconstructor );
|
A SeedContext. |
|
A SeedClass to use as the default for constructed objects. |
|
|
Returns : |
A SeedObject, which is a constructor function. |
SeedValue seed_object_call (SeedContext ctx, SeedObject object, SeedObject this, gsize argument_count, const SeedValue arguments[], SeedException *exception);
Calls object
as a function.
|
A SeedContext. |
|
A SeedObject to call. |
|
The SeedObject to use as the 'this' object inside the called function. |
|
The number of arguments in the arguments array.
|
|
An array (argument_count long) of SeedValues to pass in as the
function's arguments.
|
|
A reference to a SeedValue in which to store any exceptions.
Pass NULL to ignore exceptions.
|
Returns : |
The SeedValue returned by the called function, or NULL if an
exception occurs or the object is not a function.
|
void seed_object_set_property_at_index (SeedContext ctx, SeedObject object, gint index, SeedValue value, SeedException *exception);
Sets the property index
on object
to value
.
|
A SeedContext. |
|
A SeedObject on which to set the property. |
|
The index of the property to set. |
|
The SeedValue to use as the property's value. |
|
A reference to a SeedValue in which to store any exceptions.
Pass NULL to ignore exceptions.
|
gpointer seed_object_get_private (SeedObject object);
|
A SeedObject. |
Returns : |
A pointer to the private data of object .
|
void seed_object_set_private (SeedObject object, gpointer value);
Sets the private data of object
to value
.
|
A SeedObject. |
|
A gpointer to set the private data of object to.
|
SeedValue seed_object_get_property (SeedContext ctx, SeedObject object, const gchar *name);
|
A SeedContext |
|
A SeedObject |
|
The property to get, should be a valid JavaScript identifier |
Returns : |
The value of the property or NULL
|
gboolean seed_object_set_property (SeedContext ctx, SeedObject object, const gchar *name, SeedValue value);
|
A SeedContext |
|
A SeedObject |
|
The property to set, should be a valid JavaScript identifier |
|
The value to set the property to. |
Returns : |
TRUE on success, FALSE otherwise.
|
SeedValue seed_make_null (SeedContext ctx);
|
A SeedContext. |
Returns : |
A SeedValue representing NULL .
|
SeedObject seed_make_object (SeedContext ctx, SeedClass class, gpointer private);
|
The SeedContext in which to create the new object. |
|
The SeedClass to use to create the new object, or NULL to use the
default object class.
|
|
The initial private data of the new object. |
Returns : |
A new SeedObject. |
gpointer seed_pointer_get_pointer (SeedContext ctx, SeedValue pointer);
|
|
|
|
Returns : |
void (*SeedFunctionCallback) (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception);
|
|
|
|
|
|
|
|
|
|
|
void (*SeedObjectInitializeCallback) (SeedContext ctx, SeedObject object);
|
|
|
gboolean (*SeedObjectHasPropertyCallback) (SeedContext ctx, SeedObject object, SeedString string);
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectGetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedException *e);
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectSetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e);
|
|
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectDeletePropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e);
|
|
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception);
|
|
|
|
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectHasInstanceCallback) (SeedContext ctx, SeedObject constructor, SeedObject instance_p, SeedException *exception);
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectConvertToTypeCallback) (SeedContext ctx, SeedObject object, SeedType type, SeedException *exception);
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectCallAsConstructorCallback) (SeedContext ctx, SeedObject constructor, gsize argument_count, const SeedValue arguments[], SeedException *exception);
|
|
|
|
|
|
|
|
|
|
Returns : |
void seed_signal_connect (SeedContext ctx, GObject *object, const gchar *signal, const gchar *script);