#include "config.h" #include /* needed instead of gegl.h to be able to do full introspection*/ #include FILE *file = NULL; void collapse_all (GType type); void expand_all (GType type); static gchar *collapsibles_html = " "; static gchar *escape (const gchar *string) { gchar buf[4095]=""; const gchar *p=string; gint i=0; while (p && *p) { switch (*p) { case '<': buf[i++]='&'; buf[i++]='l'; buf[i++]='t'; buf[i++]=';'; break; case '>': buf[i++]='&'; buf[i++]='g'; buf[i++]='t'; buf[i++]=';'; break; case '&': buf[i++]='&'; buf[i++]='a'; buf[i++]='m'; buf[i++]='p'; buf[i++]=';'; break; default: buf[i++]=*p; } p++; buf[i]='\0'; } return g_strdup (buf); } void introspect_overview (GType type, gint indent); void introspect (GType type, gint indent); gint stuff (gint argc, gchar **argv); static void introspection (void) { file = stdout; fprintf (file, "\n" ""); fprintf (file, "GObject class introspection%s\n", collapsibles_html); fprintf (file, "
\n"); fprintf (file, "
\n"); fprintf (file, "\n"); fprintf (file, "
\n"); fprintf (file, " - / + "); introspect_overview (G_TYPE_OBJECT,0); fprintf (file, "
\n"); introspect (G_TYPE_OBJECT,0); fprintf (file, "
\n"); } gint main (gint argc, gchar **argv) { stuff (argc, argv); introspection (); return 0; } static void list_subclasses (GType type) { GType *children; guint count; gint no; if (!type) return; children=g_type_children (type, &count); if (!children) return; if (count) { fprintf (file, "

subclasses

\n"); fprintf (file, "
\n"); for (no=0; no%s
\n", g_type_name (children[no]), g_type_name (children[no])); } fprintf (file, "
\n"); } g_free (children); } static void list_superclasses (GType type) { GString *str = g_string_new (""); gboolean last=TRUE; while (type != 0) { if (!last) g_string_prepend (str, "/"); g_string_prepend (str, ""); g_string_prepend (str, g_type_name (type)); g_string_prepend (str, "'>"); g_string_prepend (str, g_type_name (type)); g_string_prepend (str, "\n"); list_properties (type, 0); fprintf (file, "\n"); } void collapse_all (GType type) { GType *children; guint count; gint no; if (!type) return; fprintf (file, "hide(\"x_%s\");", g_type_name(type)); children=g_type_children (type, &count); if (!children) return; for (no=0; no\n"); fprintf (file, "

%s

\n", g_type_name (type), g_type_name (type)); list_superclasses (type); details_for_type (type); list_subclasses (type); children=g_type_children (type, &count); if (!children) return; for (no=0; no\n" "\n" "
", g_type_name (type), g_type_name (type), g_type_name (type) ); children=g_type_children (type, &count); list_properties_simple (type); if (!children) return; for (no=0; no
"); g_free (children); } gint stuff (gint argc, gchar **argv) { g_thread_init (NULL); gegl_init (&argc, &argv); { GeglNode *gegl = g_object_new (GEGL_TYPE_NODE, NULL); GeglNode *save = gegl_node_new_child (gegl, "operation", "gegl:png-save", "path", "/dev/null", NULL); GeglNode *crop = gegl_node_new_child (gegl, "operation", "gegl:crop", "x", 0.0, "y", 0.0, "width", 50.0, "height", 50.0, NULL); GeglNode *png_load = gegl_node_new_child (gegl, "operation", "gegl:checkerboard", NULL); /* connect operations */ gegl_node_link_many (png_load, crop, save, NULL); /* then the whole output region */ gegl_node_process (save); g_object_unref (gegl); } return 0; }