static void run (const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) { static GimpParam values[1]; GimpPDBStatusType status = GIMP_PDB_SUCCESS; INIT_I18N (); /* make sure all the arguments are there */ if (nparams == 4) { if (! gimp_help_init (param[0].data.d_int32, param[1].data.d_stringarray, param[2].data.d_int32, param[3].data.d_stringarray)) { status = GIMP_PDB_CALLING_ERROR; } } else { g_printerr ("help: wrong number of arguments in procedure call.\n"); status = GIMP_PDB_CALLING_ERROR; } if (status == GIMP_PDB_SUCCESS) { main_loop = g_main_loop_new (NULL, FALSE); temp_proc_install (); gimp_extension_ack (); gimp_extension_enable (); g_main_loop_run (main_loop); g_main_loop_unref (main_loop); main_loop = NULL; gimp_uninstall_temp_proc (GIMP_HELP_TEMP_EXT_PROC); } values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; *nreturn_vals = 1; *return_vals = values; }
static void script_fu_run (const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) { GList *path; INIT_I18N(); path = script_fu_search_path (); /* Determine before we allow scripts to register themselves * whether this is the base, automatically installed script-fu extension */ if (strcmp (name, "extension-script-fu") == 0) { /* Setup auxiliary temporary procedures for the base extension */ script_fu_extension_init (); /* Init the interpreter and register scripts */ tinyscheme_init (path, TRUE); } else { /* Init the interpreter */ tinyscheme_init (path, FALSE); } if (param != NULL) ts_set_run_mode ((GimpRunMode) param[0].data.d_int32); /* Load all of the available scripts */ script_fu_find_scripts (path); g_list_free_full (path, (GDestroyNotify) g_object_unref); if (strcmp (name, "extension-script-fu") == 0) { /* * The main script-fu extension. */ static GimpParam values[1]; /* Acknowledge that the extension is properly initialized */ gimp_extension_ack (); /* Go into an endless loop */ while (TRUE) gimp_extension_process (0); /* Set return values; pointless because we never get out of the loop */ *nreturn_vals = 1; *return_vals = values; values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_SUCCESS; } else if (strcmp (name, "plug-in-script-fu-text-console") == 0) { /* * The script-fu text console for interactive Scheme development */ script_fu_text_console_run (name, nparams, param, nreturn_vals, return_vals); } else if (strcmp (name, "plug-in-script-fu-console") == 0) { /* * The script-fu console for interactive Scheme development */ script_fu_console_run (name, nparams, param, nreturn_vals, return_vals); } else if (strcmp (name, "plug-in-script-fu-server") == 0) { /* * The script-fu server for remote operation */ script_fu_server_run (name, nparams, param, nreturn_vals, return_vals); } else if (strcmp (name, "plug-in-script-fu-eval") == 0) { /* * A non-interactive "console" (for batch mode) */ script_fu_eval_run (name, nparams, param, nreturn_vals, return_vals); } }