|  |  |  | Seed Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <seed/seed.h> typedef SeedValue; enum SeedType; SeedValue seed_make_undefined (SeedContext ctx); SeedValue seed_make_null (SeedContext ctx); gboolean seed_value_to_boolean (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_boolean (SeedContext ctx,gboolean val,SeedException *exception); guint seed_value_to_uint (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_uint (SeedContext ctx,guint val,SeedException *exception); gint seed_value_to_int (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_int (SeedContext ctx,gint val,SeedException *exception); gchar seed_value_to_char (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_char (SeedContext ctx,gchar val,SeedException *exception); guchar seed_value_to_uchar (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_uchar (SeedContext ctx,guchar val,SeedException *exception); glong seed_value_to_long (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_long (SeedContext ctx,glong val,SeedException *exception); gulong seed_value_to_ulong (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_ulong (SeedContext ctx,gulong val,SeedException *exception); gint64 seed_value_to_int64 (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_int64 (SeedContext ctx,gint64 val,SeedException *exception); guint64 seed_value_to_uint64 (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_uint64 (SeedContext ctx,guint64 val,SeedException *exception); gfloat seed_value_to_float (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_float (SeedContext ctx,gfloat val,SeedException *exception); gdouble seed_value_to_double (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_double (SeedContext ctx,gdouble val,SeedException *exception); gchar * seed_value_to_string (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_string (SeedContext ctx,const gchar *val,SeedException *exception); SeedValue seed_value_from_binary_string (SeedContext ctx,const gchar *bytes,gint n_bytes,SeedException *exception); GObject * seed_value_to_object (SeedContext ctx,SeedValue val,SeedException *exception); SeedValue seed_value_from_object (SeedContext ctx,GObject *val,SeedException *exception); gchar * seed_value_to_filename (SeedContext ctx,SeedValue val,SeedValue *exception); SeedValue seed_value_from_filename (SeedContext ctx,SeedValue val,SeedValue *exception); gboolean seed_value_to_format (SeedContext ctx,const gchar *format,SeedValue *values,SeedValue *exception,...); gpointer seed_pointer_get_pointer (SeedContext ctx,SeedValue pointer); SeedValue seed_make_pointer (SeedContext ctx,gpointer pointer); typedef SeedString; SeedString seed_string_ref (SeedString string); void seed_string_unref (SeedString string); gsize seed_string_get_maximum_size (SeedString string); gsize seed_string_to_utf8_buffer (SeedString string,gchar *buffer,size_t buffer_size); gboolean seed_string_is_equal (SeedString a,SeedString b); gboolean seed_string_is_equal_utf8 (SeedString a,const gchar *b);
typedef enum
{
  SEED_TYPE_UNDEFINED,
  SEED_TYPE_NULL,
  SEED_TYPE_BOOLEAN,
  SEED_TYPE_NUMBER,
  SEED_TYPE_STRING,
  SEED_TYPE_OBJECT
} SeedType;
SeedValue           seed_make_undefined                 (SeedContext ctx);
Note that this function returns a valid SeedValue, representing the undefined JavaScript value, and not an undefined SeedValue.
| 
 | A valid SeedContext | 
| Returns : | A SeedValue of the 'undefined' type. | 
SeedValue           seed_make_null                      (SeedContext ctx);
Note that this function returns a valid SeedValue, representing the null JavaScript value, and not a null SeedValue.
| 
 | A valid SeedContext | 
| Returns : | A SeedValue of the 'null' type. | 
gboolean seed_value_to_boolean (SeedContext ctx,SeedValue val,SeedException *exception);
Converts the given SeedValue into a gboolean. Keep in mind that this will not convert a JavaScript number type, only a boolean.
SeedValue seed_value_from_boolean (SeedContext ctx,gboolean val,SeedException *exception);
guint seed_value_to_uint (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_uint (SeedContext ctx,guint val,SeedException *exception);
gint seed_value_to_int (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_int (SeedContext ctx,gint val,SeedException *exception);
gchar seed_value_to_char (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_char (SeedContext ctx,gchar val,SeedException *exception);
guchar seed_value_to_uchar (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_uchar (SeedContext ctx,guchar val,SeedException *exception);
glong seed_value_to_long (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_long (SeedContext ctx,glong val,SeedException *exception);
gulong seed_value_to_ulong (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_ulong (SeedContext ctx,gulong val,SeedException *exception);
gint64 seed_value_to_int64 (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_int64 (SeedContext ctx,gint64 val,SeedException *exception);
guint64 seed_value_to_uint64 (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_uint64 (SeedContext ctx,guint64 val,SeedException *exception);
gfloat seed_value_to_float (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_float (SeedContext ctx,gfloat val,SeedException *exception);
gdouble seed_value_to_double (SeedContext ctx,SeedValue val,SeedException *exception);
SeedValue seed_value_from_double (SeedContext ctx,gdouble val,SeedException *exception);
gchar * seed_value_to_string (SeedContext ctx,SeedValue val,SeedException *exception);
Converts the given SeedValue into a gchar* string. Keep in mind that it's up to the caller to free the string.
If the SeedValue represents JavaScript's undefined value, this returns "[undefined]"; if it represents JavaScript's null value, this returns "[null]".
If the SeedValue is a number or a boolean, it is printed as a double, with the printf format string "%.15g".
If the SeedValue is an object, the string returned is that obtained by calling .toString() on said object.
SeedValue seed_value_from_string (SeedContext ctx,const gchar *val,SeedException *exception);
SeedValue seed_value_from_binary_string (SeedContext ctx,const gchar *bytes,gint n_bytes,SeedException *exception);
Converts a string representation of the given binary string into a SeedValue.
| 
 | A SeedContext. | 
| 
 | A string of bytes to represent as a string. | 
| 
 | The number of bytes from bytesto convert. | 
| 
 | A reference to a SeedValue in which to store any exceptions.
            Pass NULLto ignore exceptions. | 
| Returns : | A SeedValue which represents bytesas a string, orNULLif an exception is raised during the conversion. | 
GObject * seed_value_to_object (SeedContext ctx,SeedValue val,SeedException *exception);
Given a SeedValue which is wrapping a GObject, retrieve the wrapped GObject.
SeedValue seed_value_from_object (SeedContext ctx,GObject *val,SeedException *exception);
Wraps val in a SeedValue.
gchar * seed_value_to_filename (SeedContext ctx,SeedValue val,SeedValue *exception);
Converts the given SeedValue into a gchar*, properly converting to the character set used for filenames on the local machine.
SeedValue seed_value_from_filename (SeedContext ctx,SeedValue val,SeedValue *exception);
Converts the given gchar* filename into a SeedValue, respecting the character set used for filenames on the local machine.
gboolean seed_value_to_format (SeedContext ctx,const gchar *format,SeedValue *values,SeedValue *exception,...);
A convenience API for converting multiple values at once, the format string is composed of single characters specifying types, for example: i: gint u: guint o: GObject * s: gchar * f: gdouble c: gchar
and a valid format string could be "iuo".
This function may be in particular useful in converting arguments in a SeedFunctionCallback.
| 
 | A valid SeedContext | 
| 
 | Format string to use. | 
| 
 | The values to convert. | 
| 
 | Location to store an exception. | 
| 
 | A NULL-terminated list of locations to store the results of conversion. | 
| Returns : | Whether conversion was successful. | 
gpointer seed_pointer_get_pointer (SeedContext ctx,SeedValue pointer);
| 
 | |
| 
 | |
| Returns : | 
SeedValue seed_make_pointer (SeedContext ctx,gpointer pointer);
| 
 | |
| 
 | |
| Returns : | 
SeedString          seed_string_ref                     (SeedString string);
Increments the reference count of string.
| 
 | A SeedString. | 
| Returns : | string | 
void                seed_string_unref                   (SeedString string);
Decrements the reference count of string.
| 
 | A SeedString. | 
gsize               seed_string_get_maximum_size        (SeedString string);
| 
 | A SeedString. | 
| Returns : | The maximum number of bytes stringwill take up if converted
              to a null-terminated UTF8 string. | 
gsize seed_string_to_utf8_buffer (SeedString string,gchar *buffer,size_t buffer_size);
| 
 | A SeedString. | 
| 
 | An allocated string. | 
| 
 | The length of buffer, in bytes. | 
| Returns : | A the number of bytes copied into buffer. | 
gboolean seed_string_is_equal (SeedString a,SeedString b);
| 
 | The first SeedString to compare. | 
| 
 | The second SeedString to compare. | 
| Returns : | true, if a and b are equal, false otherwise. | 
gboolean seed_string_is_equal_utf8 (SeedString a,const gchar *b);
Tests the equality of a SeedString and a UTF-8 C-style string.
| 
 | The SeedString to compare. | 
| 
 | A gchar* to compare to. | 
| Returns : | true, if a and b are equal, false otherwise. |