Beispiel #1
0
static void
seed_libxml_define_stuff ()
{
  SeedObject node_proto;

  seed_class_definition xml_doc_class_def = seed_empty_class;
  seed_class_definition xml_node_class_def = seed_empty_class;
  seed_class_definition xml_attr_class_def = seed_empty_class;
  seed_class_definition xml_xpath_class_def = seed_empty_class;
  seed_class_definition xml_xpathobj_class_def = seed_empty_class;

  xml_doc_class_def.class_name="XMLDocument";
  xml_doc_class_def.static_functions = doc_funcs;
  xml_doc_class_def.static_values = doc_values;
  xml_doc_class_def.finalize = seed_xml_doc_finalize;
  xml_doc_class = seed_create_class (&xml_doc_class_def);

  xml_node_class_def.class_name="XMLNode";
  xml_node_class_def.static_functions = node_funcs;
  xml_node_class_def.static_values = node_values;
  xml_node_class_def.finalize = seed_xml_node_finalize;
  xml_node_class_def.initialize = seed_xml_node_init;
  xml_node_class = seed_create_class (&xml_node_class_def);

  xml_attr_class_def.class_name="XMLAttribute";
  xml_attr_class_def.static_functions = attr_funcs;
  xml_attr_class_def.static_values = attr_values;
  xml_attr_class_def.finalize = seed_xml_node_finalize;
  xml_attr_class_def.initialize = seed_xml_node_init;
  xml_attr_class = seed_create_class (&xml_attr_class_def);

  xml_xpath_class_def.class_name = "XMLXPathContext";
  xml_xpath_class_def.finalize = seed_xml_xpath_finalize;
  xml_xpath_class_def.static_functions = xpath_funcs;
  xml_xpath_class = seed_create_class (&xml_xpath_class_def);

  xml_xpathobj_class_def.class_name = "XMLXPathObj";
  xml_xpathobj_class_def.finalize = seed_xml_xpathobj_finalize;
  xml_xpathobj_class_def.static_values = xpathobj_values;
  xml_xpathobj_class = seed_create_class (&xml_xpathobj_class_def);

  seed_create_function (eng->context, "parseFile",
			(SeedFunctionCallback) seed_xml_parse_file,
			namespace_ref);
  seed_create_function (eng->context, "parseString",
			(SeedFunctionCallback) seed_xml_parse_string,
			namespace_ref);

  node_proto = seed_object_get_prototype (eng->context,
					  seed_make_object (eng->context,
							    xml_node_class,
							    NULL));
  seed_make_object (eng->context, xml_node_class, NULL);
  seed_object_set_property (eng->context, namespace_ref, "_nodeProto", node_proto);
  seed_simple_evaluate (eng->context, "imports.extensions.xml", NULL);
}
Beispiel #2
0
SeedObject sqlite_construct_database(SeedContext ctx,
				     SeedObject constructor,
				     size_t argument_count,
				     const SeedValue arguments[],
				     SeedException * exception)
{
  SeedObject ret;
  gchar *file;
  sqlite3 *db;
  int rc;

  if (argument_count != 1)
    {
      seed_make_exception(ctx, exception, "ArgumentError",
			  "sqlite.Database constructor expected 1 argument");
      return (SeedObject) seed_make_null(ctx);
    }
  file = seed_value_to_string(ctx, arguments[0], exception);

  rc = sqlite3_open(file, &db);

  g_free(file);

  ret = seed_make_object(ctx, sqlite_class, db);
  seed_object_set_property(ctx, ret, "status",
			   seed_value_from_int(ctx, rc, exception));

  return ret;
}
Beispiel #3
0
static int seed_sqlite_exec_callback(SeedObject function,
				     int argc,
				     gchar ** argv, gchar ** azColName)
{
  SeedGlobalContext ctx;
  SeedObject hash;
  int i;

  if (!function)
    return 0;

  ctx = seed_context_create(eng->group, NULL);

  hash = seed_make_object(ctx, 0, 0);
  for (i = 0; i < argc; i++)
    {
      seed_object_set_property(ctx, hash,
			       azColName[i],
			       seed_value_from_string(ctx, argv[i], 0));
    }

  seed_object_call(ctx, function, 0, 1, &hash, 0);

  seed_context_unref(ctx);

  return 0;
}
Beispiel #4
0
static SeedValue
seed_xml_xpath_eval (SeedContext ctx,
		     SeedObject function,
		     SeedObject this_object,
		     gsize argument_count,
		     const SeedValue arguments[],
		     SeedException * exception)
{
  xmlXPathObjectPtr xpath_obj;
  xmlXPathContextPtr xpath_ctx;
  guchar *xpath;

  if (argument_count != 1)
    {
      seed_make_exception (ctx, exception,
			   "ArgumentError",
			   "xpathEval expected 1 argument, got %zd",
			   argument_count);
      return seed_make_null (ctx);
    }
  xpath_ctx = XML_XPATH_PRIV (this_object);

  xpath = (guchar *)seed_value_to_string (ctx, arguments[0], exception);
  xpath_obj = xmlXPathEval (xpath, xpath_ctx);
  g_free (xpath);

  return seed_make_object (ctx, xml_xpathobj_class, xpath_obj);
}
Beispiel #5
0
SeedObject
seed_module_init(SeedEngine *local_eng)
{
	SeedGlobalContext ctx = local_eng->context;

	seed_class_definition gettext_ns_class_def = seed_empty_class;
    gettext_ns_class_def.static_functions = gettext_funcs;

	SeedClass gettext_ns_class = seed_create_class(&gettext_ns_class_def);

	ns_ref = seed_make_object (ctx, gettext_ns_class, NULL);
	seed_value_protect (ctx, ns_ref);

	/* define enums for setlocale. Where to put them?  */

	DEFINE_ENUM_MEMBER(ns_ref, LC_CTYPE);
	DEFINE_ENUM_MEMBER(ns_ref, LC_NUMERIC);
	DEFINE_ENUM_MEMBER(ns_ref, LC_TIME);
	DEFINE_ENUM_MEMBER(ns_ref, LC_COLLATE);
	DEFINE_ENUM_MEMBER(ns_ref, LC_MONETARY);
	DEFINE_ENUM_MEMBER(ns_ref, LC_MESSAGES);
	DEFINE_ENUM_MEMBER(ns_ref, LC_ALL);
	DEFINE_ENUM_MEMBER(ns_ref, LC_PAPER);
	DEFINE_ENUM_MEMBER(ns_ref, LC_NAME);
	DEFINE_ENUM_MEMBER(ns_ref, LC_ADDRESS);
	DEFINE_ENUM_MEMBER(ns_ref, LC_TELEPHONE);
	DEFINE_ENUM_MEMBER(ns_ref, LC_MEASUREMENT);
	DEFINE_ENUM_MEMBER(ns_ref, LC_IDENTIFICATION);
	DEFINE_ENUM_MEMBER(ns_ref, LC_CTYPE);

	return ns_ref;
}
Beispiel #6
0
SeedObject
seed_module_init(SeedEngine *local_eng)
{
  SeedObject library_constructor;
  seed_class_definition ffi_library_def = seed_empty_class;
  seed_class_definition ffi_function_def = seed_empty_class;

  ffi_library_def.class_name = "FFILibrary";
  ffi_library_def.finalize = seed_ffi_library_finalize;
  ffi_library_def.get_property = seed_ffi_library_get_property;
  
  ffi_function_def.class_name = "FFIFunction";
  ffi_function_def.finalize = seed_ffi_function_finalize;
  ffi_function_def.static_values = ffi_function_values;
  ffi_function_def.call_as_function = seed_ffi_function_call;
  
  ffi_library_class = seed_create_class (&ffi_library_def);
  ffi_function_class = seed_create_class (&ffi_function_def);

  eng = local_eng;
  namespace_ref = seed_make_object (eng->context, NULL, NULL);
  
  library_constructor = seed_make_constructor (eng->context, ffi_library_class, seed_ffi_construct_library);
  seed_object_set_property (eng->context, namespace_ref, "Library", library_constructor);
  
  return namespace_ref;
}
Beispiel #7
0
SeedObject
seed_module_init(SeedEngine * local_eng)
{
  SeedObject db_constructor;
  seed_class_definition sqlite_class_def = seed_empty_class;

  eng = local_eng;

  namespace_ref = seed_make_object(eng->context, 0, 0);

  define_errors(eng);

  sqlite_class_def.class_name = "Database";
  sqlite_class_def.finalize = sqlite_database_finalize;
  sqlite_class_def.static_functions = database_funcs;

  sqlite_class = seed_create_class(&sqlite_class_def);

  db_constructor = seed_make_constructor(eng->context,
					 sqlite_class,
					 sqlite_construct_database);
  seed_object_set_property(eng->context,
			   namespace_ref, "Database", db_constructor);

  return namespace_ref;
}
Beispiel #8
0
SeedObject seed_construct_pipe(SeedContext ctx,
			       SeedObject constructor,
			       size_t argument_count,
			       const SeedValue arguments[],
			       SeedException * exception)
{
  SeedObject jsone, jstwo, jsret;
  int fd1[2], fd2[2];
  pipe_priv *priv_one, *priv_two;
  
  CHECK_ARG_COUNT("multiprocessing.pipe constructor", 0);

  if (pipe(fd1) < 0)
    {
      perror("Pipe failed. Make me a javascript exception");
      return seed_make_null(ctx);
    }
  if (pipe(fd2) < 0)
    {
      perror("Pipe failed. Make me a javascript exception");
      return seed_make_null(ctx);
    }

  priv_one = g_new0(pipe_priv, 1);
  priv_two = g_new0(pipe_priv, 1);

  priv_one->read = g_io_channel_unix_new(fd1[0]);
  priv_one->write = g_io_channel_unix_new(fd2[1]);
  priv_two->read = g_io_channel_unix_new(fd2[0]);
  priv_two->write = g_io_channel_unix_new(fd1[1]);

  g_io_channel_set_close_on_unref(priv_one->read, TRUE);
  g_io_channel_set_close_on_unref(priv_one->write, TRUE);
  g_io_channel_set_close_on_unref(priv_two->read, TRUE);
  g_io_channel_set_close_on_unref(priv_two->write, TRUE);

  jsret = seed_make_object(ctx, 0, 0);
  jsone = seed_make_object(ctx, pipe_class, priv_one);
  jstwo = seed_make_object(ctx, pipe_class, priv_two);

  seed_object_set_property_at_index(ctx, jsret, 0, jsone, exception);
  seed_object_set_property_at_index(ctx, jsret, 1, jstwo, exception);

  return jsret;
}
Beispiel #9
0
SeedObject
seed_module_init(SeedEngine *local_eng)
{
  eng = local_eng;
  namespace_ref = seed_make_object (eng->context, NULL, NULL);
  seed_value_protect (eng->context, namespace_ref);

  seed_libxml_define_stuff();

  return namespace_ref;
}
Beispiel #10
0
static SeedObject
seed_make_xml_doc (SeedContext ctx,
		    xmlDocPtr doc)
{
  SeedObject ret;
  if (doc->_private)
    return (SeedObject) doc->_private;
  ret = seed_make_object (ctx, xml_doc_class, doc);
  doc->_private = ret;
  return ret;
}
Beispiel #11
0
void
seed_define_cairo_matrix (SeedContext ctx,
			  SeedObject namespace_ref)
{
  seed_class_definition matrix_def = seed_empty_class;

  matrix_def.class_name = "Matrix";
  matrix_def.static_functions = matrix_funcs;
  seed_matrix_class = seed_create_class (&matrix_def);

  seed_object_set_property (ctx, namespace_ref, "Matrix", seed_make_object (ctx, seed_matrix_class, NULL));
}
Beispiel #12
0
static SeedObject
seed_make_xml_attr (SeedContext ctx,
		    xmlAttrPtr attr)
{
 SeedObject ret;
  if (attr == NULL)
    return seed_make_null (ctx);
  if (attr->_private)
    return (SeedObject) attr->_private;
  ret = seed_make_object (ctx, xml_attr_class, attr);
  attr->_private = ret;
  return ret;
}
Beispiel #13
0
static SeedObject
seed_make_xml_node (SeedContext ctx,
		xmlNodePtr node)
{
  SeedObject ret;
  if (node == NULL)
    return seed_make_null (ctx);
  if (node->_private)
    return (SeedObject) node->_private;
  ret = seed_make_object (ctx, xml_node_class, node);
  node->_private = ret;
  return ret;
}
Beispiel #14
0
SeedObject
seed_object_from_cairo_pattern (SeedContext ctx, cairo_pattern_t *pat)
{
  SeedObject jsobj;

  jsobj = cairo_pattern_get_user_data (pat, seed_get_cairo_key());
  if (jsobj)
    return jsobj;

  jsobj = seed_make_object (ctx, seed_cairo_pattern_class, pat);
  cairo_pattern_set_user_data (pat, seed_get_cairo_key(), jsobj, seed_cairo_destroy_func);
  return jsobj;
}
static SeedObject
seed_object_from_cairo_pdf_surface (SeedContext ctx, cairo_surface_t *surf)
{
  SeedObject jsobj;

  jsobj = cairo_surface_get_user_data (surf, seed_get_cairo_key());
  if (jsobj)
    return jsobj;

  jsobj = seed_make_object (ctx, seed_cairo_pdf_surface_class, surf);
  cairo_surface_set_user_data (surf, seed_get_cairo_key(), jsobj, seed_cairo_destroy_func);
  return jsobj;
}
Beispiel #16
0
SeedObject
seed_module_init(SeedEngine * local_eng)
{
  seed_class_definition readline_ns_class_def = seed_empty_class;
  readline_ns_class_def.static_functions = readline_funcs;
  
  SeedClass readline_ns_class = seed_create_class(&readline_ns_class_def);

  eng = local_eng;

  namespace_ref = seed_make_object(eng->context, readline_ns_class, 0);

  return namespace_ref;
}
Beispiel #17
0
SeedObject
seed_module_init(SeedEngine *eng)
{
  SeedObject gtkbuilder_proto;

  gtkbuilder_proto = seed_simple_evaluate (eng->context,
					   "imports.gi.Gtk.Builder.prototype",
					   NULL);
  seed_create_function (eng->context,
			"connect_signals",
			seed_gtk_builder_connect_signals,
			gtkbuilder_proto);

  return seed_make_object (eng->context, NULL, NULL);
}
Beispiel #18
0
static SeedObject
seed_ffi_construct_library (SeedContext ctx,
			    SeedObject constructor,
			    size_t argument_count,
			    const SeedValue arguments[],
			    SeedException *exception)
{
  GModule *mod;
  SeedObject ret;
  gchar *filename;
  seed_ffi_library_priv *priv;
  
  if (argument_count != 1 && argument_count != 0)
    {
      seed_make_exception (ctx, exception, 
			   "ArgumentError", 
			   "ffi.Library constructor expects 1 argument (filename, or none to use NULL GModule), got %zd", 
			   argument_count);
      return seed_make_null (ctx);
    }
  if (argument_count == 1)
    filename = seed_value_to_string (ctx, arguments[0], exception);
  else
    filename = NULL;
  
  mod = g_module_open (filename, G_MODULE_BIND_LOCAL | G_MODULE_BIND_LAZY);
  if (!mod)
    {
      seed_make_exception (ctx, exception, "GModuleError",
			   "Opening module (%s) failed with: %s",
			   filename, g_module_error ());
      g_free (filename);
      return seed_make_null (ctx);
    }
  
  priv = g_slice_alloc (sizeof (seed_ffi_library_priv));
  priv->mod = mod;
  
  // TODO: Value destroy function.
  priv->symbols = g_hash_table_new_full (g_str_hash, g_str_equal, 
					 g_free, NULL);
  
  ret = seed_make_object (ctx, ffi_library_class, priv);
  
  g_free (filename);
  
  return ret;
}
Beispiel #19
0
static SeedObject
seed_ffi_make_function (SeedContext ctx, SeedObject module_obj, gpointer symbol, const gchar *name, GHashTable *symbols)
{
  SeedValue ret;
  seed_ffi_function_priv *priv = 
    g_slice_alloc0 (sizeof (seed_ffi_function_priv));
  
  priv->symbol = symbol;
  priv->module_obj = module_obj;
  priv->name = g_strdup (name);
  
  ret = seed_make_object (ctx, ffi_function_class, priv);
  seed_value_protect (ctx, ret);

  g_hash_table_insert (symbols, g_strdup (name), ret);
  return ret;
}
Beispiel #20
0
static SeedValue
seed_xml_construct_xpath_context (SeedContext ctx,
				  SeedObject function,
				  SeedObject this_object,
				  gsize argument_count,
				  const SeedValue arguments[],
				  SeedException * exception)
{
  xmlXPathContextPtr xpath;
  xmlDocPtr doc;

  doc = XML_DOC_PRIV (this_object);
  xpath = xmlXPathNewContext (doc);

  seed_value_protect (ctx, this_object);

  return seed_make_object (ctx, xml_xpath_class, xpath);
}
Beispiel #21
0
SeedObject
gjs_compat_define_gi_stuff(SeedEngine* eng)
{
    SeedContext context = eng->context;
    SeedObject module;
    gboolean ret;

    module = seed_make_object(context, seed_create_class(&system_def), NULL);

    SeedValue seed = seed_object_get_property(context, eng->global, "Seed");
    SeedValue argv = seed_object_get_property(context, seed, "argv");

    ret = seed_object_set_property(
      context, module, "version",
      (SeedValue) seed_value_from_int(context, GJS_COMPAT_VERSION, NULL));

    return module;
}
Beispiel #22
0
static SeedObject
exports_new (SeedContext ctx,
	     DBusBusType which_bus)
{
  SeedObject exports;
  SeedObject global;

  global = seed_context_get_global_object (ctx);
  if (!seed_js_exports_class)
    {
      seed_class_definition def = seed_empty_class;
      def.initialize = exports_constructor;
      def.finalize = exports_finalize;

      seed_js_exports_class = seed_create_class (&def);
    }
  exports = seed_make_object (ctx, seed_js_exports_class, NULL);

  return exports;
}
Beispiel #23
0
SeedObject
seed_module_init(SeedEngine * local_eng)
{
  SeedObject pipe_constructor;
  seed_class_definition pipe_class_def = seed_empty_class;
  eng = local_eng;

  namespace_ref = seed_make_object(eng->context, 0, 0);

  pipe_class_def.class_name = "Pipe";
  pipe_class_def.static_functions = pipe_funcs;
  pipe_class_def.finalize = pipe_finalize;

  pipe_class = seed_create_class(&pipe_class_def);

  pipe_constructor = seed_make_constructor(eng->context,
					   0, seed_construct_pipe);

  seed_object_set_property(eng->context,
			   namespace_ref, "Pipe", pipe_constructor);

  return namespace_ref;
}
static PeasExtension *
peas_plugin_loader_seed_create_extension (PeasPluginLoader *loader,
                                          PeasPluginInfo   *info,
                                          GType             exten_type,
                                          guint             n_parameters,
                                          GParameter       *parameters)
{
  PeasPluginLoaderSeed *sloader = PEAS_PLUGIN_LOADER_SEED (loader);
  SeedInfo *sinfo;
  SeedValue extension_ctor, extension;
  guint i, j;
  SeedValue value;
  GValue gvalue = { 0 };
  GArray *interfaces;
  gchar **property_names;

  sinfo = (SeedInfo *) g_hash_table_lookup (sloader->loaded_plugins, info);

  /* FIXME: instantiate new object and pass the parameters */
  extension_ctor = seed_object_get_property (sinfo->context,
                                             sinfo->extensions,
                                             g_type_name (exten_type));
  if (!extension_ctor ||
      seed_value_is_undefined (sinfo->context, extension_ctor) ||
      seed_value_is_null (sinfo->context, extension_ctor))
    return NULL;

  if (!seed_value_is_object (sinfo->context, extension_ctor))
    {
      g_warning ("Extension '%s' in plugin '%s' is not a Seed object",
                 g_type_name (exten_type), peas_plugin_info_get_module_name (info));
      return NULL;
    }

  /* Instantiate the ctor object into a new specific object. */
  extension = JSObjectCallAsConstructor (sinfo->context, extension_ctor, 0, NULL, NULL);

  if (extension == NULL)
    {
#ifndef PEAS_DISABLE_DEPRECATED_FEATURES
      gchar **property_names;

      g_warning ("DEPRECATION WARNING: Extension '%s' in plugin '%s' is not a valid "
                 "constructor function. Support for extension initialization by array "
                 "copy will be dropped soon.",
                 g_type_name (exten_type), peas_plugin_info_get_module_name (info));

      extension = seed_make_object (sinfo->context, NULL, NULL);
      property_names = seed_object_copy_property_names (sinfo->context,
                                                        extension_ctor);
      for (i = 0; property_names[i] != NULL; i++)
        {
          SeedValue value;
          value = seed_object_get_property (sinfo->context,
                                            extension_ctor,
                                            property_names[i]);
          seed_object_set_property (sinfo->context,
                                    extension,
                                    property_names[i],
                                    value);
        }

        g_strfreev (property_names);
#else
      g_warning ("Extension '%s' in plugin '%s' is not a valid constructor",
                 g_type_name (exten_type), peas_plugin_info_get_module_name (info));
      return NULL;
#endif
    }

  /* Set the properties as well, cannot use
   * g_object_set_property() because it may be construct-only
   */
  for (i = 0; i < n_parameters; i++)
    {
      gchar *key;

      /* We want to normalize the property names to have a '_' instead of the
       * conventional '-', to make them accessible through this.property_name */
      key = g_strdup (parameters[i].name);
      for (j = 0; key[j] != '\0'; j++)
        {
          if (key[j] == '-')
            key[j] = '_';
        }

      value = seed_value_from_gvalue (sinfo->context,
                                      &parameters[i].value,
                                      NULL);
      seed_object_set_property (sinfo->context,
                                extension,
                                key,
                                value);

      g_free (key);
    }

  /* Set the plugin info as an attribute of the instance */
  g_value_init (&gvalue, PEAS_TYPE_PLUGIN_INFO);
  g_value_set_boxed (&gvalue, info);

  value = seed_value_from_gvalue (sinfo->context, &gvalue, NULL);
  seed_object_set_property (sinfo->context, extension, "plugin_info", value);

  g_value_unset (&gvalue);


  /* Do not add exten_type as it will be added below */
  interfaces = g_array_new (TRUE, FALSE, sizeof (GType));

  property_names = seed_object_copy_property_names (sinfo->context,
                                                    sinfo->extensions);

  for (i = 0; property_names[i] != NULL; ++i)
    {
      gchar *property_name = property_names[i];
      SeedValue *prop_extension_ctor;
      GType the_type;

      prop_extension_ctor = seed_object_get_property (sinfo->context,
                                                      sinfo->extensions,
                                                      property_name);

      if (prop_extension_ctor != extension_ctor)
        continue;

      if (!seed_value_is_object (sinfo->context, extension_ctor))
        {
          g_warning ("Extension '%s' in plugin '%s' is not a Seed object",
                     property_name, peas_plugin_info_get_module_name (info));
          continue;
        }

      the_type = peas_gi_get_type_from_name (property_name);

      if (the_type == G_TYPE_INVALID)
        {
          g_warning ("Could not find GType for '%s', "
                     "did you forget to import it?", property_name);
        }
      else
        {
          g_array_append_val (interfaces, the_type);
        }
    }

  g_array_sort (interfaces, (GCompareFunc) prerequisites_sort);

  g_strfreev (property_names);

  return peas_extension_seed_new (exten_type,
                                  (GType *) g_array_free (interfaces, FALSE),
                                  sinfo->context, extension);
}
Beispiel #25
0
SeedObject
seed_module_init(SeedEngine * eng)
{
  g_print("Hello Seed Module World\n");
  return seed_make_object (eng->context, NULL, NULL);
}
Beispiel #26
0
void
seed_define_cairo_enums (SeedContext ctx,
			 SeedObject namespace_ref)
{
  SeedObject content_holder, format_holder, antialias_holder, fillrule_holder,
    linecap_holder, linejoin_holder, operator_holder, status_holder;

  content_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Content", content_holder);
  ENUM_MEMBER(content_holder, "COLOR", CAIRO_CONTENT_COLOR);
  ENUM_MEMBER(content_holder, "ALPHA", CAIRO_CONTENT_ALPHA);
  ENUM_MEMBER(content_holder, "COLOR_ALPHA", CAIRO_CONTENT_COLOR_ALPHA);

  format_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Format", format_holder);
  ENUM_MEMBER(format_holder, "ARGB32", CAIRO_FORMAT_ARGB32);
  ENUM_MEMBER(format_holder, "RGB23", CAIRO_FORMAT_RGB24);
  ENUM_MEMBER(format_holder, "A8", CAIRO_FORMAT_A8);
  ENUM_MEMBER(format_holder, "A1", CAIRO_FORMAT_A1);

  antialias_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Antialias", antialias_holder);
  ENUM_MEMBER(antialias_holder, "DEFAULT", CAIRO_ANTIALIAS_DEFAULT);
  ENUM_MEMBER(antialias_holder, "NONE", CAIRO_ANTIALIAS_NONE);
  ENUM_MEMBER(antialias_holder, "GRAY", CAIRO_ANTIALIAS_GRAY);
  ENUM_MEMBER(antialias_holder, "SUBPIXEL", CAIRO_ANTIALIAS_SUBPIXEL);

  fillrule_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Fillrule", fillrule_holder);
  ENUM_MEMBER(fillrule_holder, "WINDING", CAIRO_FILL_RULE_WINDING);
  ENUM_MEMBER(fillrule_holder, "EVEN_ODD", CAIRO_FILL_RULE_EVEN_ODD);

  linecap_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Linecap", linecap_holder);
  ENUM_MEMBER(linecap_holder, "BUTT", CAIRO_LINE_CAP_BUTT);
  ENUM_MEMBER(linecap_holder, "ROUND", CAIRO_LINE_CAP_ROUND);
  ENUM_MEMBER(linecap_holder, "SQUARE", CAIRO_LINE_CAP_SQUARE);

  linejoin_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Linejoin", linejoin_holder);
  ENUM_MEMBER(linejoin_holder, "MITER", CAIRO_LINE_JOIN_MITER);
  ENUM_MEMBER(linejoin_holder, "ROUND", CAIRO_LINE_JOIN_ROUND);
  ENUM_MEMBER(linejoin_holder, "BEVEL", CAIRO_LINE_JOIN_BEVEL);


  operator_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Operator", operator_holder);
  ENUM_MEMBER(operator_holder, "CLEAR", CAIRO_OPERATOR_CLEAR);
  ENUM_MEMBER(operator_holder, "SOURCE", CAIRO_OPERATOR_SOURCE);
  ENUM_MEMBER(operator_holder, "OVER", CAIRO_OPERATOR_OVER);
  ENUM_MEMBER(operator_holder, "IN", CAIRO_OPERATOR_IN);
  ENUM_MEMBER(operator_holder, "OUT", CAIRO_OPERATOR_OUT);
  ENUM_MEMBER(operator_holder, "ATOP", CAIRO_OPERATOR_ATOP);
  ENUM_MEMBER(operator_holder, "DEST", CAIRO_OPERATOR_DEST);
  ENUM_MEMBER(operator_holder, "DEST_OVER", CAIRO_OPERATOR_DEST_OVER);
  ENUM_MEMBER(operator_holder, "DEST_IN", CAIRO_OPERATOR_DEST_IN);
  ENUM_MEMBER(operator_holder, "DEST_OUT", CAIRO_OPERATOR_DEST_OUT);
  ENUM_MEMBER(operator_holder, "DEST_ATOP", CAIRO_OPERATOR_DEST_ATOP);
  ENUM_MEMBER(operator_holder, "XOR", CAIRO_OPERATOR_XOR);
  ENUM_MEMBER(operator_holder, "ADD", CAIRO_OPERATOR_ADD);
  ENUM_MEMBER(operator_holder, "SATURATE", CAIRO_OPERATOR_SATURATE);

  status_holder = seed_make_object (ctx, NULL, NULL);
  seed_object_set_property (ctx, namespace_ref, "Status", status_holder);
  ENUM_MEMBER(status_holder, "SUCCESS", CAIRO_STATUS_SUCCESS);
  ENUM_MEMBER(status_holder, "NO_MEMORY", CAIRO_STATUS_NO_MEMORY);
  ENUM_MEMBER(status_holder, "INVALID_RESTORE", CAIRO_STATUS_INVALID_RESTORE);
  ENUM_MEMBER(status_holder, "INVALID_POP_GROUP", CAIRO_STATUS_INVALID_POP_GROUP);
  ENUM_MEMBER(status_holder, "NO_CURRENT_POINT", CAIRO_STATUS_NO_CURRENT_POINT);
  ENUM_MEMBER(status_holder, "INVALID_MATRIX", CAIRO_STATUS_INVALID_MATRIX);
  ENUM_MEMBER(status_holder, "INVALID_STATUS", CAIRO_STATUS_INVALID_STATUS);
  ENUM_MEMBER(status_holder, "NULL_POINTER", CAIRO_STATUS_NULL_POINTER);
  ENUM_MEMBER(status_holder, "INVALID_STRING", CAIRO_STATUS_INVALID_STRING);
  ENUM_MEMBER(status_holder, "INVALID_PATH_DATA", CAIRO_STATUS_INVALID_PATH_DATA);
  ENUM_MEMBER(status_holder, "READ_ERROR", CAIRO_STATUS_READ_ERROR);
  ENUM_MEMBER(status_holder, "WRITE_ERROR", CAIRO_STATUS_WRITE_ERROR);
  ENUM_MEMBER(status_holder, "SURFACE_FINISHED", CAIRO_STATUS_SURFACE_FINISHED);
  ENUM_MEMBER(status_holder, "SURFACE_TYPE_MISMATCH", CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
  ENUM_MEMBER(status_holder, "PATTERN_TYPE_MISMATCH", CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
  ENUM_MEMBER(status_holder, "INVALID_CONTENT", CAIRO_STATUS_INVALID_CONTENT);
  ENUM_MEMBER(status_holder, "INVALID_FORMAT", CAIRO_STATUS_INVALID_FORMAT);
  ENUM_MEMBER(status_holder, "INVALID_VISUAL", CAIRO_STATUS_INVALID_VISUAL);
  ENUM_MEMBER(status_holder, "FILE_NOT_FOUND", CAIRO_STATUS_FILE_NOT_FOUND);
  ENUM_MEMBER(status_holder, "INVALID_DASH", CAIRO_STATUS_INVALID_DASH);
  ENUM_MEMBER(status_holder, "INVALID_DSC_COMMENT", CAIRO_STATUS_INVALID_DSC_COMMENT);
  ENUM_MEMBER(status_holder, "INVALID_INDEX", CAIRO_STATUS_INVALID_INDEX);
  ENUM_MEMBER(status_holder, "CLIP_NOT_REPRESENTABLE", CAIRO_STATUS_CLIP_NOT_REPRESENTABLE);
  ENUM_MEMBER(status_holder, "TEMP_FILE_ERROR", CAIRO_STATUS_TEMP_FILE_ERROR);
  ENUM_MEMBER(status_holder, "INVALID_STRIDE", CAIRO_STATUS_INVALID_STRIDE);
  ENUM_MEMBER(status_holder, "FONT_TYPE_MISMATCH", CAIRO_STATUS_FONT_TYPE_MISMATCH);
  ENUM_MEMBER(status_holder, "USER_FONT_IMMUTABLE", CAIRO_STATUS_USER_FONT_IMMUTABLE);
  ENUM_MEMBER(status_holder, "USER_FONT_ERROR", CAIRO_STATUS_USER_FONT_ERROR);
  ENUM_MEMBER(status_holder, "NEGATIVE_COUNT", CAIRO_STATUS_NEGATIVE_COUNT);
  ENUM_MEMBER(status_holder, "INVALID_CLUSTERS", CAIRO_STATUS_INVALID_CLUSTERS);
  ENUM_MEMBER(status_holder, "INVALID_SLANT", CAIRO_STATUS_INVALID_SLANT);
  ENUM_MEMBER(status_holder, "INVALID_WEIGHT", CAIRO_STATUS_INVALID_WEIGHT);

  seed_create_function (ctx, "to_string", seed_cairo_status_to_string, status_holder);
}