mirror of https://github.com/GNOME/gimp.git
write comment to top of gimprc.
2001-12-28 Sven Neumann <sven@gimp.org> * app/config/gimprc.c: write comment to top of gimprc. * app/core/gimpscanconvert.c: removed redundant CLAMP statements. * app/plug-in/plug-in-rc.[ch] * app/plug-in/plug-in.c: rewrote pluginrc scanner and moved the code that writes the pluginrc into plug-in-rc.c.
This commit is contained in:
parent
e43620f8cb
commit
64424f6c1e
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2001-12-28 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/config/gimprc.c: write comment to top of gimprc.
|
||||||
|
|
||||||
|
* app/core/gimpscanconvert.c: removed redundant CLAMP statements.
|
||||||
|
|
||||||
|
* app/plug-in/plug-in-rc.[ch]
|
||||||
|
* app/plug-in/plug-in.c: rewrote pluginrc scanner and moved the code
|
||||||
|
that writes the pluginrc into plug-in-rc.c.
|
||||||
|
|
||||||
2001-12-28 Sven Neumann <sven@gimp.org>
|
2001-12-28 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/tools/gimpmagnifytool.c: calculate mouse movement in screen
|
* app/tools/gimpmagnifytool.c: calculate mouse movement in screen
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -49,6 +50,7 @@ static gboolean gimp_rc_deserialize (GObject *object,
|
||||||
static void gimp_rc_serialize_changed_properties (GimpRc *new,
|
static void gimp_rc_serialize_changed_properties (GimpRc *new,
|
||||||
GimpRc *old,
|
GimpRc *old,
|
||||||
gint fd);
|
gint fd);
|
||||||
|
static void gimp_rc_write_header (gint fd);
|
||||||
static gboolean gimp_values_equal (const GValue *a,
|
static gboolean gimp_values_equal (const GValue *a,
|
||||||
const GValue *b);
|
const GValue *b);
|
||||||
|
|
||||||
|
@ -145,6 +147,7 @@ gimp_rc_write_changes (GimpRc *new,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gimp_rc_write_header (fd);
|
||||||
gimp_rc_serialize_changed_properties (new, old, fd);
|
gimp_rc_serialize_changed_properties (new, old, fd);
|
||||||
gimp_config_serialize_unknown_tokens (G_OBJECT (new), fd);
|
gimp_config_serialize_unknown_tokens (G_OBJECT (new), fd);
|
||||||
|
|
||||||
|
@ -216,7 +219,31 @@ gimp_rc_serialize_changed_properties (GimpRc *new,
|
||||||
g_free (property_specs);
|
g_free (property_specs);
|
||||||
g_string_free (str, TRUE);
|
g_string_free (str, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_rc_write_header (gint fd)
|
||||||
|
{
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
const gchar *top =
|
||||||
|
"# This is your personal gimprc file. Any variable defined in this file\n"
|
||||||
|
"# takes precedence over the value defined in the system-wide gimprc:\n"
|
||||||
|
"# ";
|
||||||
|
const gchar *bottom =
|
||||||
|
"\n"
|
||||||
|
"# Most values can be set automatically within the GIMP, if you press\n"
|
||||||
|
"# the \"Save\" button after changing some options in the Preferences\n"
|
||||||
|
"# dialog.\n\n";
|
||||||
|
|
||||||
|
filename = g_build_filename (gimp_sysconf_directory (), "gimprc", NULL);
|
||||||
|
|
||||||
|
write (fd, top, strlen (top));
|
||||||
|
write (fd, filename, strlen (filename));
|
||||||
|
write (fd, bottom, strlen (bottom));
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_values_equal (const GValue *a,
|
gimp_values_equal (const GValue *a,
|
||||||
const GValue *b)
|
const GValue *b)
|
||||||
|
|
|
@ -84,7 +84,7 @@ main (int argc,
|
||||||
gimp_config_foreach_unknown_token (G_OBJECT (gimprc),
|
gimp_config_foreach_unknown_token (G_OBJECT (gimprc),
|
||||||
output_unknown_token, &header);
|
output_unknown_token, &header);
|
||||||
|
|
||||||
g_print ("\n Testing gimp_rc_write_changes() ... ");
|
g_print ("\n\nTesting gimp_rc_write_changes() ... \n\n");
|
||||||
|
|
||||||
gimprc2 = gimp_rc_new ();
|
gimprc2 = gimp_rc_new ();
|
||||||
g_object_set (G_OBJECT (gimprc2), "show-tips", FALSE, NULL);
|
g_object_set (G_OBJECT (gimprc2), "show-tips", FALSE, NULL);
|
||||||
|
|
|
@ -252,7 +252,7 @@ gimp_scan_convert_to_channel (GimpScanConvert *sc,
|
||||||
guchar *b;
|
guchar *b;
|
||||||
gint *vals;
|
gint *vals;
|
||||||
gint val;
|
gint val;
|
||||||
gint x, x2, w;
|
gint x, w;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
|
||||||
antialias = sc->antialias;
|
antialias = sc->antialias;
|
||||||
|
@ -312,11 +312,7 @@ gimp_scan_convert_to_channel (GimpScanConvert *sc,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* bounds checking */
|
w = GPOINTER_TO_INT (list->data) - x;
|
||||||
x = CLAMP (x, 0, widtha);
|
|
||||||
x2 = CLAMP (GPOINTER_TO_INT (list->data), 0, widtha);
|
|
||||||
|
|
||||||
w = x2 - x;
|
|
||||||
|
|
||||||
if (w > 0)
|
if (w > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
@ -37,6 +38,11 @@
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All functions return G_TOKEN_LEFT_PAREN on success,
|
||||||
|
* or the GTokenType they would have expected but didn't get.
|
||||||
|
*/
|
||||||
|
|
||||||
static GTokenType plug_in_def_deserialize (GScanner *scanner);
|
static GTokenType plug_in_def_deserialize (GScanner *scanner);
|
||||||
static GTokenType plug_in_proc_def_deserialize (GScanner *scanner,
|
static GTokenType plug_in_proc_def_deserialize (GScanner *scanner,
|
||||||
PlugInProcDef *proc_def);
|
PlugInProcDef *proc_def);
|
||||||
|
@ -47,16 +53,23 @@ static GTokenType plug_in_locale_def_deserialize (GScanner *scanner,
|
||||||
static GTokenType plug_in_help_def_deserialize (GScanner *scanner,
|
static GTokenType plug_in_help_def_deserialize (GScanner *scanner,
|
||||||
PlugInDef *plug_in_def);
|
PlugInDef *plug_in_def);
|
||||||
|
|
||||||
static inline GTokenType parse_string (GScanner *scanner,
|
static inline gboolean parse_token (GScanner *scanner,
|
||||||
gchar **dest);
|
GTokenType token);
|
||||||
static inline GTokenType parse_int (GScanner *scanner,
|
static inline gboolean parse_string (GScanner *scanner,
|
||||||
gint *dest);
|
gchar **dest);
|
||||||
|
static inline gboolean parse_string_no_validate (GScanner *scanner,
|
||||||
|
gchar **dest);
|
||||||
|
static inline gboolean parse_int (GScanner *scanner,
|
||||||
|
gint *dest);
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
PLUG_IN_DEF,
|
||||||
PROC_DEF,
|
PROC_DEF,
|
||||||
LOCALE_DEF,
|
LOCALE_DEF,
|
||||||
HELP_DEF
|
HELP_DEF,
|
||||||
|
PROC_ARG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,36 +95,53 @@ plug_in_rc_parse (const gchar *filename)
|
||||||
g_scanner_input_file (scanner, fd);
|
g_scanner_input_file (scanner, fd);
|
||||||
scanner->input_name = filename;
|
scanner->input_name = filename;
|
||||||
|
|
||||||
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
|
"plug-in-def", GINT_TO_POINTER (PLUG_IN_DEF));
|
||||||
g_scanner_scope_add_symbol (scanner, 0,
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
"proc-def", GINT_TO_POINTER (PROC_DEF));
|
"proc-def", GINT_TO_POINTER (PROC_DEF));
|
||||||
g_scanner_scope_add_symbol (scanner, 0,
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
"locale-def", GINT_TO_POINTER (LOCALE_DEF));
|
"locale-def", GINT_TO_POINTER (LOCALE_DEF));
|
||||||
g_scanner_scope_add_symbol (scanner, 0,
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
"help-def", GINT_TO_POINTER (HELP_DEF));
|
"help-def", GINT_TO_POINTER (HELP_DEF));
|
||||||
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
|
"proc-arg", GINT_TO_POINTER (PROC_ARG));
|
||||||
|
|
||||||
token = g_scanner_peek_next_token (scanner);
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
|
|
||||||
while (token != G_TOKEN_EOF)
|
do
|
||||||
{
|
{
|
||||||
if ((token = g_scanner_get_next_token (scanner)) != G_TOKEN_LEFT_PAREN)
|
if (g_scanner_get_next_token (scanner) != token)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_IDENTIFIER ||
|
token = g_scanner_get_next_token (scanner);
|
||||||
strcmp (scanner->value.v_identifier, "plug-in-def") != 0)
|
|
||||||
|
switch (token)
|
||||||
{
|
{
|
||||||
|
case G_TOKEN_LEFT_PAREN:
|
||||||
token = G_TOKEN_SYMBOL;
|
token = G_TOKEN_SYMBOL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case G_TOKEN_SYMBOL:
|
||||||
|
if (scanner->value.v_symbol == PLUG_IN_DEF)
|
||||||
|
token = plug_in_def_deserialize (scanner);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_TOKEN_RIGHT_PAREN:
|
||||||
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* do nothing */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((token = plug_in_def_deserialize (scanner)) != G_TOKEN_NONE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
token = g_scanner_peek_next_token (scanner);
|
|
||||||
}
|
}
|
||||||
|
while (token != G_TOKEN_EOF);
|
||||||
if (token != G_TOKEN_EOF)
|
|
||||||
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
|
if (token != G_TOKEN_LEFT_PAREN)
|
||||||
_("fatal parse error"), TRUE);
|
{
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
|
||||||
|
_("fatal parse error"), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
g_scanner_destroy (scanner);
|
g_scanner_destroy (scanner);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
@ -122,78 +152,90 @@ plug_in_rc_parse (const gchar *filename)
|
||||||
static GTokenType
|
static GTokenType
|
||||||
plug_in_def_deserialize (GScanner *scanner)
|
plug_in_def_deserialize (GScanner *scanner)
|
||||||
{
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
PlugInDef *plug_in_def;
|
PlugInDef *plug_in_def;
|
||||||
GTokenType token;
|
PlugInProcDef *proc_def;
|
||||||
|
GTokenType token;
|
||||||
|
|
||||||
if ((token = parse_string (scanner, &name)) != G_TOKEN_NONE)
|
if (!parse_string (scanner, &name))
|
||||||
return token;
|
return G_TOKEN_STRING;
|
||||||
|
|
||||||
plug_in_def = plug_in_def_new (name);
|
plug_in_def = plug_in_def_new (name);
|
||||||
|
|
||||||
if ((token = parse_int (scanner, (gint *) &plug_in_def->mtime))
|
if (!parse_int (scanner, (gint *) &plug_in_def->mtime))
|
||||||
!= G_TOKEN_NONE)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
token = g_scanner_peek_next_token (scanner);
|
|
||||||
while (token == G_TOKEN_LEFT_PAREN)
|
|
||||||
{
|
{
|
||||||
g_scanner_get_next_token (scanner);
|
plug_in_def_free (plug_in_def, TRUE);
|
||||||
|
return G_TOKEN_INT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((token = g_scanner_get_next_token (scanner)) != G_TOKEN_SYMBOL)
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
goto error;
|
|
||||||
|
|
||||||
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
|
do
|
||||||
|
{
|
||||||
|
if (g_scanner_peek_next_token (scanner) != token)
|
||||||
|
break;
|
||||||
|
|
||||||
|
token = g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
switch (token)
|
||||||
{
|
{
|
||||||
case PROC_DEF:
|
case G_TOKEN_LEFT_PAREN:
|
||||||
{
|
token = G_TOKEN_SYMBOL;
|
||||||
PlugInProcDef *proc_def = g_new0 (PlugInProcDef, 1);
|
break;
|
||||||
|
|
||||||
|
case G_TOKEN_SYMBOL:
|
||||||
|
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
|
||||||
|
{
|
||||||
|
case PROC_DEF:
|
||||||
|
proc_def = g_new0 (PlugInProcDef, 1);
|
||||||
|
token = plug_in_proc_def_deserialize (scanner, proc_def);
|
||||||
|
|
||||||
|
if (token == G_TOKEN_LEFT_PAREN)
|
||||||
|
{
|
||||||
|
plug_in_def_add_proc_def (plug_in_def, proc_def);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plug_in_proc_def_destroy (proc_def, FALSE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOCALE_DEF:
|
||||||
|
token = plug_in_locale_def_deserialize (scanner, plug_in_def);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HELP_DEF:
|
||||||
|
token = plug_in_help_def_deserialize (scanner, plug_in_def);
|
||||||
|
break;
|
||||||
|
|
||||||
if ((token = plug_in_proc_def_deserialize (scanner, proc_def))
|
default:
|
||||||
!= G_TOKEN_NONE)
|
break;
|
||||||
{
|
}
|
||||||
plug_in_proc_def_destroy (proc_def, FALSE);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plug_in_def_add_proc_def (plug_in_def, proc_def);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOCALE_DEF:
|
case G_TOKEN_RIGHT_PAREN:
|
||||||
if ((token = plug_in_locale_def_deserialize (scanner, plug_in_def))
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
!= G_TOKEN_NONE)
|
|
||||||
goto error;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HELP_DEF:
|
|
||||||
if ((token = plug_in_help_def_deserialize (scanner, plug_in_def))
|
|
||||||
!= G_TOKEN_NONE)
|
|
||||||
goto error;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token != G_TOKEN_NONE)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
token = g_scanner_peek_next_token (scanner);
|
|
||||||
}
|
}
|
||||||
|
while (token != G_TOKEN_EOF);
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) == G_TOKEN_RIGHT_PAREN)
|
if (token == G_TOKEN_LEFT_PAREN)
|
||||||
{
|
{
|
||||||
plug_in_def_add (plug_in_def);
|
token = G_TOKEN_RIGHT_PAREN;
|
||||||
return G_TOKEN_NONE;
|
|
||||||
|
if (parse_token (scanner, token))
|
||||||
|
{
|
||||||
|
plug_in_def_add (plug_in_def);
|
||||||
|
return G_TOKEN_LEFT_PAREN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
token = G_TOKEN_RIGHT_PAREN;
|
|
||||||
|
|
||||||
error:
|
|
||||||
plug_in_def_free (plug_in_def, TRUE);
|
plug_in_def_free (plug_in_def, TRUE);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,57 +246,47 @@ plug_in_proc_def_deserialize (GScanner *scanner,
|
||||||
GTokenType token;
|
GTokenType token;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.name))
|
if (!parse_string (scanner, &proc_def->db_info.name))
|
||||||
!= G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
if (!parse_int (scanner, (gint *) &proc_def->db_info.proc_type))
|
||||||
if ((token = parse_int (scanner, (gint *) &proc_def->db_info.proc_type))
|
return G_TOKEN_INT;
|
||||||
!= G_TOKEN_NONE)
|
if (!parse_string (scanner, &proc_def->db_info.blurb))
|
||||||
return token;
|
return G_TOKEN_STRING;
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.blurb))
|
if (!parse_string (scanner, &proc_def->db_info.help))
|
||||||
!= G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
if (!parse_string (scanner, &proc_def->db_info.author))
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.help))
|
return G_TOKEN_STRING;
|
||||||
!= G_TOKEN_NONE)
|
if (!parse_string (scanner, &proc_def->db_info.copyright))
|
||||||
return token;
|
return G_TOKEN_STRING;
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.author))
|
if (!parse_string (scanner, &proc_def->db_info.date))
|
||||||
!= G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
if (!parse_string (scanner, &proc_def->menu_path))
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.copyright))
|
return G_TOKEN_STRING;
|
||||||
!= G_TOKEN_NONE)
|
if (!parse_string (scanner, &proc_def->extensions))
|
||||||
return token;
|
return G_TOKEN_STRING;
|
||||||
if ((token = parse_string (scanner, &proc_def->db_info.date))
|
if (!parse_string (scanner, &proc_def->prefixes))
|
||||||
!= G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
if (!parse_string_no_validate (scanner, &proc_def->magics))
|
||||||
|
return G_TOKEN_STRING;
|
||||||
if ((token = parse_string (scanner, &proc_def->menu_path)) != G_TOKEN_NONE)
|
if (!parse_string (scanner, &proc_def->image_types))
|
||||||
return token;
|
return G_TOKEN_STRING;
|
||||||
if ((token = parse_string (scanner, &proc_def->extensions)) != G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
if ((token = parse_string (scanner, &proc_def->prefixes)) != G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
if ((token = parse_string (scanner, &proc_def->magics)) != G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
if ((token = parse_string (scanner, &proc_def->image_types)) != G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
|
|
||||||
proc_def->image_types_val =
|
proc_def->image_types_val =
|
||||||
plug_in_image_types_parse (proc_def->image_types);
|
plug_in_image_types_parse (proc_def->image_types);
|
||||||
|
|
||||||
if ((token = parse_int (scanner, &proc_def->db_info.num_args))
|
if (!parse_int (scanner, (gint *) &proc_def->db_info.num_args))
|
||||||
!= G_TOKEN_NONE)
|
return G_TOKEN_INT;
|
||||||
return token;
|
if (!parse_int (scanner, (gint *) &proc_def->db_info.num_values))
|
||||||
if ((token = parse_int (scanner, &proc_def->db_info.num_values))
|
return G_TOKEN_INT;
|
||||||
!= G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
|
|
||||||
if (proc_def->db_info.num_args > 0)
|
if (proc_def->db_info.num_args > 0)
|
||||||
proc_def->db_info.args = g_new0 (ProcArg, proc_def->db_info.num_args);
|
proc_def->db_info.args = g_new0 (ProcArg, proc_def->db_info.num_args);
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
for (i = 0; i < proc_def->db_info.num_args; i++)
|
||||||
{
|
{
|
||||||
if ((token = plug_in_proc_arg_deserialize (scanner,
|
token = plug_in_proc_arg_deserialize (scanner,
|
||||||
&proc_def->db_info.args[i]))
|
&proc_def->db_info.args[i]);
|
||||||
!= G_TOKEN_NONE)
|
if (token != G_TOKEN_LEFT_PAREN)
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,104 +295,292 @@ plug_in_proc_def_deserialize (GScanner *scanner,
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
for (i = 0; i < proc_def->db_info.num_values; i++)
|
||||||
{
|
{
|
||||||
if ((token = plug_in_proc_arg_deserialize (scanner,
|
token = plug_in_proc_arg_deserialize (scanner,
|
||||||
&proc_def->db_info.values[i]))
|
&proc_def->db_info.values[i]);
|
||||||
!= G_TOKEN_NONE)
|
if (token != G_TOKEN_LEFT_PAREN)
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_RIGHT_PAREN)
|
if (!parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
||||||
return G_TOKEN_RIGHT_PAREN;
|
return G_TOKEN_RIGHT_PAREN;
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GTokenType
|
static GTokenType
|
||||||
plug_in_proc_arg_deserialize (GScanner *scanner,
|
plug_in_proc_arg_deserialize (GScanner *scanner,
|
||||||
ProcArg *arg)
|
ProcArg *arg)
|
||||||
{
|
{
|
||||||
GTokenType token;
|
if (!parse_token (scanner, G_TOKEN_LEFT_PAREN))
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_LEFT_PAREN)
|
|
||||||
return G_TOKEN_LEFT_PAREN;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_IDENTIFIER)
|
if (!parse_token (scanner, G_TOKEN_SYMBOL) ||
|
||||||
|
GPOINTER_TO_INT (scanner->value.v_symbol) != PROC_ARG)
|
||||||
return G_TOKEN_SYMBOL;
|
return G_TOKEN_SYMBOL;
|
||||||
|
|
||||||
if (strcmp (scanner->value.v_identifier, "proc-arg") != 0)
|
if (!parse_int (scanner, (gint *) &arg->arg_type))
|
||||||
return G_TOKEN_SYMBOL;
|
return G_TOKEN_INT;
|
||||||
|
if (!parse_string (scanner, &arg->name))
|
||||||
if ((token = parse_int (scanner, (gint *) &arg->arg_type)) != G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
if (!parse_string (scanner, &arg->description))
|
||||||
if ((token = parse_string (scanner, &arg->name)) != G_TOKEN_NONE)
|
return G_TOKEN_STRING;
|
||||||
return token;
|
|
||||||
if ((token = parse_string (scanner, &arg->description)) != G_TOKEN_NONE)
|
|
||||||
return token;
|
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_RIGHT_PAREN)
|
if (!parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
||||||
return G_TOKEN_RIGHT_PAREN;
|
return G_TOKEN_RIGHT_PAREN;
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GTokenType
|
static GTokenType
|
||||||
plug_in_locale_def_deserialize (GScanner *scanner,
|
plug_in_locale_def_deserialize (GScanner *scanner,
|
||||||
PlugInDef *plug_in_def)
|
PlugInDef *plug_in_def)
|
||||||
{
|
{
|
||||||
if (parse_string (scanner, &plug_in_def->locale_domain) != G_TOKEN_NONE)
|
if (!parse_string (scanner, &plug_in_def->locale_domain))
|
||||||
return G_TOKEN_STRING;
|
return G_TOKEN_STRING;
|
||||||
|
|
||||||
if (parse_string (scanner, &plug_in_def->locale_path) != G_TOKEN_NONE)
|
parse_string (scanner, &plug_in_def->locale_path);
|
||||||
{
|
|
||||||
if (scanner->token == G_TOKEN_RIGHT_PAREN)
|
|
||||||
return G_TOKEN_NONE;
|
|
||||||
else
|
|
||||||
return G_TOKEN_RIGHT_PAREN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_RIGHT_PAREN)
|
if (!parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
||||||
return G_TOKEN_RIGHT_PAREN;
|
return G_TOKEN_RIGHT_PAREN;
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GTokenType
|
static GTokenType
|
||||||
plug_in_help_def_deserialize (GScanner *scanner,
|
plug_in_help_def_deserialize (GScanner *scanner,
|
||||||
PlugInDef *plug_in_def)
|
PlugInDef *plug_in_def)
|
||||||
{
|
{
|
||||||
if (parse_string (scanner, &plug_in_def->locale_domain) != G_TOKEN_NONE)
|
if (!parse_string (scanner, &plug_in_def->help_path))
|
||||||
return G_TOKEN_STRING;
|
return G_TOKEN_STRING;
|
||||||
|
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_RIGHT_PAREN)
|
if (!parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
||||||
return G_TOKEN_RIGHT_PAREN;
|
return G_TOKEN_RIGHT_PAREN;
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* helper functions */
|
/* helper functions */
|
||||||
|
|
||||||
static inline GTokenType
|
|
||||||
|
static inline gboolean
|
||||||
|
parse_token (GScanner *scanner,
|
||||||
|
GTokenType token)
|
||||||
|
{
|
||||||
|
if (g_scanner_peek_next_token (scanner) != token)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
parse_string (GScanner *scanner,
|
parse_string (GScanner *scanner,
|
||||||
gchar **dest)
|
gchar **dest)
|
||||||
{
|
{
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_STRING)
|
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
|
||||||
return G_TOKEN_STRING;
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
if (*scanner->value.v_string)
|
||||||
|
{
|
||||||
|
if (!g_utf8_validate (scanner->value.v_string, -1, NULL))
|
||||||
|
{
|
||||||
|
g_scanner_warn (scanner, _("invalid UTF-8 string"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dest = g_strdup (scanner->value.v_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
parse_string_no_validate (GScanner *scanner,
|
||||||
|
gchar **dest)
|
||||||
|
{
|
||||||
|
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
if (*scanner->value.v_string)
|
if (*scanner->value.v_string)
|
||||||
*dest = g_strdup (scanner->value.v_string);
|
*dest = g_strdup (scanner->value.v_string);
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GTokenType
|
static inline gboolean
|
||||||
parse_int (GScanner *scanner,
|
parse_int (GScanner *scanner,
|
||||||
gint *dest)
|
gint *dest)
|
||||||
{
|
{
|
||||||
if (g_scanner_get_next_token (scanner) != G_TOKEN_INT)
|
if (g_scanner_peek_next_token (scanner) != G_TOKEN_INT)
|
||||||
return G_TOKEN_INT;
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
*dest = scanner->value.v_int;
|
*dest = scanner->value.v_int;
|
||||||
return G_TOKEN_NONE;
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* serialize functions */
|
||||||
|
|
||||||
|
static void
|
||||||
|
plug_in_write_rc_string (FILE *fp,
|
||||||
|
gchar *str)
|
||||||
|
{
|
||||||
|
fputc ('"', fp);
|
||||||
|
|
||||||
|
if (str)
|
||||||
|
while (*str)
|
||||||
|
{
|
||||||
|
if (*str == '\n')
|
||||||
|
{
|
||||||
|
fputc ('\\', fp);
|
||||||
|
fputc ('n', fp);
|
||||||
|
}
|
||||||
|
else if (*str == '\r')
|
||||||
|
{
|
||||||
|
fputc ('\\', fp);
|
||||||
|
fputc ('r', fp);
|
||||||
|
}
|
||||||
|
else if (*str == '\032') /* ^Z is problematic on Windows */
|
||||||
|
{
|
||||||
|
fputc ('\\', fp);
|
||||||
|
fputc ('z', fp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((*str == '"') || (*str == '\\'))
|
||||||
|
fputc ('\\', fp);
|
||||||
|
fputc (*str, fp);
|
||||||
|
}
|
||||||
|
str += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fputc ('"', fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
plug_in_rc_write (GSList *plug_in_defs,
|
||||||
|
const gchar *filename)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
PlugInDef *plug_in_def;
|
||||||
|
PlugInProcDef *proc_def;
|
||||||
|
GSList *list;
|
||||||
|
GSList *tmp2;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (filename != NULL, FALSE);
|
||||||
|
|
||||||
|
fp = fopen (filename, "w");
|
||||||
|
if (!fp)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (list = plug_in_defs; list; list = list->next)
|
||||||
|
{
|
||||||
|
plug_in_def = list->data;
|
||||||
|
|
||||||
|
if (plug_in_def->proc_defs)
|
||||||
|
{
|
||||||
|
fprintf (fp, "(plug-in-def ");
|
||||||
|
plug_in_write_rc_string (fp, plug_in_def->prog);
|
||||||
|
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
||||||
|
|
||||||
|
tmp2 = plug_in_def->proc_defs;
|
||||||
|
if (tmp2)
|
||||||
|
fprintf (fp, "\n");
|
||||||
|
|
||||||
|
while (tmp2)
|
||||||
|
{
|
||||||
|
proc_def = tmp2->data;
|
||||||
|
tmp2 = tmp2->next;
|
||||||
|
|
||||||
|
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
||||||
|
proc_def->db_info.name, proc_def->db_info.proc_type);
|
||||||
|
fprintf (fp, "\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->menu_path);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->extensions);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->prefixes);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->magics);
|
||||||
|
fprintf (fp, "\n\t\t");
|
||||||
|
plug_in_write_rc_string (fp, proc_def->image_types);
|
||||||
|
fprintf (fp, "\n\t\t%d %d\n",
|
||||||
|
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
||||||
|
|
||||||
|
for (i = 0; i < proc_def->db_info.num_args; i++)
|
||||||
|
{
|
||||||
|
fprintf (fp, "\t\t(proc-arg %d ",
|
||||||
|
proc_def->db_info.args[i].arg_type);
|
||||||
|
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
||||||
|
|
||||||
|
fprintf (fp, ")%s",
|
||||||
|
(proc_def->db_info.num_values ||
|
||||||
|
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < proc_def->db_info.num_values; i++)
|
||||||
|
{
|
||||||
|
fprintf (fp, "\t\t(proc-arg %d ",
|
||||||
|
proc_def->db_info.values[i].arg_type);
|
||||||
|
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
||||||
|
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
||||||
|
|
||||||
|
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (fp, ")");
|
||||||
|
|
||||||
|
if (tmp2)
|
||||||
|
fprintf (fp, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plug_in_def->locale_domain)
|
||||||
|
{
|
||||||
|
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
||||||
|
if (plug_in_def->locale_path)
|
||||||
|
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
||||||
|
else
|
||||||
|
fprintf (fp, ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plug_in_def->help_path)
|
||||||
|
{
|
||||||
|
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (fp, ")\n");
|
||||||
|
|
||||||
|
if (list->next)
|
||||||
|
fprintf (fp, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
|
|
||||||
gboolean plug_in_rc_parse (const gchar *filename);
|
gboolean plug_in_rc_parse (const gchar *filename);
|
||||||
|
gboolean plug_in_rc_write (GSList *proc_defs,
|
||||||
|
const gchar *filename);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __PLUG_IN_RC_H__ */
|
#endif /* __PLUG_IN_RC_H__ */
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -162,7 +160,6 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
|
||||||
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
|
||||||
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
|
||||||
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
|
||||||
static void plug_in_write_rc (const gchar *filename);
|
|
||||||
static void plug_in_init_file (const gchar *filename,
|
static void plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data);
|
gpointer loader_data);
|
||||||
static void plug_in_query (PlugInDef *plug_in_def);
|
static void plug_in_query (PlugInDef *plug_in_def);
|
||||||
|
@ -415,7 +412,7 @@ plug_in_init (Gimp *gimp,
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print (_("writing \"%s\"\n"), filename);
|
g_print (_("writing \"%s\"\n"), filename);
|
||||||
|
|
||||||
plug_in_write_rc (filename);
|
plug_in_rc_write (plug_in_defs, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
@ -650,15 +647,9 @@ plug_in_def_new (const gchar *prog)
|
||||||
|
|
||||||
g_return_val_if_fail (prog != NULL, NULL);
|
g_return_val_if_fail (prog != NULL, NULL);
|
||||||
|
|
||||||
plug_in_def = g_new (PlugInDef, 1);
|
plug_in_def = g_new0 (PlugInDef, 1);
|
||||||
|
|
||||||
plug_in_def->prog = g_strdup (prog);
|
plug_in_def->prog = g_strdup (prog);
|
||||||
plug_in_def->proc_defs = NULL;
|
|
||||||
plug_in_def->locale_domain = NULL;
|
|
||||||
plug_in_def->locale_path = NULL;
|
|
||||||
plug_in_def->help_path = NULL;
|
|
||||||
plug_in_def->mtime = 0;
|
|
||||||
plug_in_def->query = FALSE;
|
|
||||||
|
|
||||||
return plug_in_def;
|
return plug_in_def;
|
||||||
}
|
}
|
||||||
|
@ -671,12 +662,9 @@ plug_in_def_free (PlugInDef *plug_in_def,
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_free (plug_in_def->prog);
|
g_free (plug_in_def->prog);
|
||||||
if (plug_in_def->locale_domain)
|
g_free (plug_in_def->locale_domain);
|
||||||
g_free (plug_in_def->locale_domain);
|
g_free (plug_in_def->locale_path);
|
||||||
if (plug_in_def->locale_path)
|
g_free (plug_in_def->help_path);
|
||||||
g_free (plug_in_def->locale_path);
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
g_free (plug_in_def->help_path);
|
|
||||||
|
|
||||||
if (free_proc_defs)
|
if (free_proc_defs)
|
||||||
{
|
{
|
||||||
|
@ -2306,156 +2294,6 @@ plug_in_pop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc_string (FILE *fp,
|
|
||||||
gchar *str)
|
|
||||||
{
|
|
||||||
fputc ('"', fp);
|
|
||||||
|
|
||||||
if (str)
|
|
||||||
while (*str)
|
|
||||||
{
|
|
||||||
if (*str == '\n')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('n', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\r')
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('r', fp);
|
|
||||||
}
|
|
||||||
else if (*str == '\032') /* ^Z is problematic on Windows */
|
|
||||||
{
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc ('z', fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*str == '"') || (*str == '\\'))
|
|
||||||
fputc ('\\', fp);
|
|
||||||
fputc (*str, fp);
|
|
||||||
}
|
|
||||||
str += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('"', fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
plug_in_write_rc (const gchar *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
PlugInDef *plug_in_def;
|
|
||||||
PlugInProcDef *proc_def;
|
|
||||||
GSList *tmp;
|
|
||||||
GSList *tmp2;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
|
||||||
if (!fp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = plug_in_defs;
|
|
||||||
while (tmp)
|
|
||||||
{
|
|
||||||
plug_in_def = tmp->data;
|
|
||||||
tmp = tmp->next;
|
|
||||||
|
|
||||||
if (plug_in_def->proc_defs)
|
|
||||||
{
|
|
||||||
fprintf (fp, "(plug-in-def ");
|
|
||||||
plug_in_write_rc_string (fp, plug_in_def->prog);
|
|
||||||
fprintf (fp, " %ld", (long) plug_in_def->mtime);
|
|
||||||
tmp2 = plug_in_def->proc_defs;
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
|
|
||||||
while (tmp2)
|
|
||||||
{
|
|
||||||
proc_def = tmp2->data;
|
|
||||||
tmp2 = tmp2->next;
|
|
||||||
|
|
||||||
fprintf (fp, "\t(proc-def \"%s\" %d\n",
|
|
||||||
proc_def->db_info.name, proc_def->db_info.proc_type);
|
|
||||||
fprintf (fp, "\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.blurb);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.help);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.author);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.copyright);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.date);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->menu_path);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->extensions);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->prefixes);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->magics);
|
|
||||||
fprintf (fp, "\n\t\t");
|
|
||||||
plug_in_write_rc_string (fp, proc_def->image_types);
|
|
||||||
fprintf (fp, "\n\t\t%d %d\n",
|
|
||||||
proc_def->db_info.num_args, proc_def->db_info.num_values);
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_args; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.args[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.args[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s",
|
|
||||||
(proc_def->db_info.num_values ||
|
|
||||||
(i < (proc_def->db_info.num_args - 1))) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < proc_def->db_info.num_values; i++)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\t\t(proc-arg %d ",
|
|
||||||
proc_def->db_info.values[i].arg_type);
|
|
||||||
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].name);
|
|
||||||
plug_in_write_rc_string (fp, proc_def->db_info.values[i].description);
|
|
||||||
|
|
||||||
fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")");
|
|
||||||
|
|
||||||
if (tmp2)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->locale_domain)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain);
|
|
||||||
if (plug_in_def->locale_path)
|
|
||||||
fprintf (fp, " \"%s\")", plug_in_def->locale_path);
|
|
||||||
else
|
|
||||||
fprintf (fp, ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plug_in_def->help_path)
|
|
||||||
{
|
|
||||||
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (fp, ")\n");
|
|
||||||
|
|
||||||
if (tmp)
|
|
||||||
fprintf (fp, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plug_in_init_file (const gchar *filename,
|
plug_in_init_file (const gchar *filename,
|
||||||
gpointer loader_data)
|
gpointer loader_data)
|
||||||
|
|
Loading…
Reference in New Issue