2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-07-02 11:07:41 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-07-02 11:07:41 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-07-02 11:07:41 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-07-02 11:07:41 +00:00
|
|
|
*/
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if 0
|
2008-09-09 14:40:52 +00:00
|
|
|
#define DEBUG_MARSHALL 0 /* No need to define this until you need it */
|
|
|
|
#define DEBUG_SCRIPTS 0
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
#include <string.h>
|
2001-07-22 22:18:01 +00:00
|
|
|
|
2006-10-19 13:08:47 +00:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2004-08-31 17:54:46 +00:00
|
|
|
#include <gtk/gtk.h>
|
2003-07-02 11:07:41 +00:00
|
|
|
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
#include "libgimp/gimp.h"
|
2003-07-02 11:07:41 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#include "tinyscheme/scheme-private.h"
|
|
|
|
#if USE_DL
|
|
|
|
#include "tinyscheme/dynload.h"
|
|
|
|
#endif
|
|
|
|
#include "ftx/ftx.h"
|
2003-11-26 17:14:58 +00:00
|
|
|
|
2004-08-31 17:54:46 +00:00
|
|
|
#include "script-fu-types.h"
|
|
|
|
|
2004-07-14 16:03:58 +00:00
|
|
|
#include "script-fu-console.h"
|
2004-08-31 17:54:46 +00:00
|
|
|
#include "script-fu-interface.h"
|
2008-09-10 23:10:15 +00:00
|
|
|
#include "script-fu-regex.h"
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
#include "script-fu-scripts.h"
|
|
|
|
#include "script-fu-server.h"
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#include "scheme-wrapper.h"
|
2003-07-02 11:07:41 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#undef cons
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
static void ts_init_constants (scheme *sc);
|
|
|
|
static void ts_init_enum (scheme *sc,
|
|
|
|
GType enum_type);
|
|
|
|
static void ts_init_procedures (scheme *sc,
|
|
|
|
gboolean register_scipts);
|
|
|
|
static void convert_string (gchar *str);
|
|
|
|
static pointer script_fu_marshal_procedure_call (scheme *sc,
|
|
|
|
pointer a,
|
|
|
|
gboolean permissive);
|
|
|
|
static pointer script_fu_marshal_procedure_call_strict (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
static pointer script_fu_marshal_procedure_call_permissive (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
|
|
|
|
static pointer script_fu_register_call (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
static pointer script_fu_menu_register_call (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
static pointer script_fu_quit_call (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
static pointer script_fu_nil_call (scheme *sc,
|
|
|
|
pointer a);
|
|
|
|
|
|
|
|
static gboolean ts_load_file (const gchar *dirname,
|
|
|
|
const gchar *basename);
|
2008-09-11 18:00:18 +00:00
|
|
|
|
|
|
|
typedef struct
|
2007-06-20 10:54:28 +00:00
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
gint value;
|
2008-09-11 18:00:18 +00:00
|
|
|
} NamedConstant;
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2017-07-14 13:10:46 +02:00
|
|
|
static const NamedConstant script_constants[] =
|
2006-10-19 13:51:42 +00:00
|
|
|
{
|
2006-10-20 17:55:14 +00:00
|
|
|
/* Useful values from libgimpbase/gimplimits.h */
|
|
|
|
{ "MIN-IMAGE-SIZE", GIMP_MIN_IMAGE_SIZE },
|
|
|
|
{ "MAX-IMAGE-SIZE", GIMP_MAX_IMAGE_SIZE },
|
|
|
|
{ "MIN-RESOLUTION", GIMP_MIN_RESOLUTION },
|
|
|
|
{ "MAX-RESOLUTION", GIMP_MAX_RESOLUTION },
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* Useful misc stuff */
|
|
|
|
{ "TRUE", TRUE },
|
|
|
|
{ "FALSE", FALSE },
|
|
|
|
|
2007-06-20 10:54:28 +00:00
|
|
|
/* Builtin units */
|
|
|
|
{ "UNIT-PIXEL", GIMP_UNIT_PIXEL },
|
|
|
|
{ "UNIT-INCH", GIMP_UNIT_INCH },
|
|
|
|
{ "UNIT-MM", GIMP_UNIT_MM },
|
|
|
|
{ "UNIT-POINT", GIMP_UNIT_POINT },
|
|
|
|
{ "UNIT-PICA", GIMP_UNIT_PICA },
|
|
|
|
|
2006-11-01 17:14:17 +00:00
|
|
|
/* Script-Fu types */
|
2006-10-16 01:08:54 +00:00
|
|
|
{ "SF-IMAGE", SF_IMAGE },
|
|
|
|
{ "SF-DRAWABLE", SF_DRAWABLE },
|
|
|
|
{ "SF-LAYER", SF_LAYER },
|
|
|
|
{ "SF-CHANNEL", SF_CHANNEL },
|
2006-11-16 01:29:49 +00:00
|
|
|
{ "SF-VECTORS", SF_VECTORS },
|
2006-10-16 01:08:54 +00:00
|
|
|
{ "SF-COLOR", SF_COLOR },
|
|
|
|
{ "SF-TOGGLE", SF_TOGGLE },
|
|
|
|
{ "SF-VALUE", SF_VALUE },
|
|
|
|
{ "SF-STRING", SF_STRING },
|
|
|
|
{ "SF-FILENAME", SF_FILENAME },
|
|
|
|
{ "SF-DIRNAME", SF_DIRNAME },
|
|
|
|
{ "SF-ADJUSTMENT", SF_ADJUSTMENT },
|
|
|
|
{ "SF-FONT", SF_FONT },
|
|
|
|
{ "SF-PATTERN", SF_PATTERN },
|
|
|
|
{ "SF-BRUSH", SF_BRUSH },
|
|
|
|
{ "SF-GRADIENT", SF_GRADIENT },
|
|
|
|
{ "SF-OPTION", SF_OPTION },
|
|
|
|
{ "SF-PALETTE", SF_PALETTE },
|
|
|
|
{ "SF-TEXT", SF_TEXT },
|
|
|
|
{ "SF-ENUM", SF_ENUM },
|
2007-04-12 15:56:57 +00:00
|
|
|
{ "SF-DISPLAY", SF_DISPLAY },
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2006-11-01 17:14:17 +00:00
|
|
|
/* For SF-ADJUSTMENT */
|
2006-10-16 01:08:54 +00:00
|
|
|
{ "SF-SLIDER", SF_SLIDER },
|
|
|
|
{ "SF-SPINNER", SF_SPINNER },
|
|
|
|
|
|
|
|
{ NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static scheme sc;
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
|
2003-08-26 18:12:42 +00:00
|
|
|
void
|
2014-08-03 21:49:20 +02:00
|
|
|
tinyscheme_init (GList *path,
|
|
|
|
gboolean register_scripts)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
|
|
|
/* init the interpreter */
|
2008-09-11 18:00:18 +00:00
|
|
|
if (! scheme_init (&sc))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_message ("Could not initialize TinyScheme!");
|
|
|
|
return;
|
|
|
|
}
|
2006-06-12 10:25:29 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
scheme_set_input_port_file (&sc, stdin);
|
2007-08-30 00:21:20 +00:00
|
|
|
scheme_set_output_port_file (&sc, stdout);
|
|
|
|
ts_register_output_func (ts_stdout_output_func, NULL);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
/* Initialize the TinyScheme extensions */
|
2007-08-30 00:21:20 +00:00
|
|
|
init_ftx (&sc);
|
2008-09-11 13:33:58 +00:00
|
|
|
script_fu_regex_init (&sc);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* register in the interpreter the gimp functions and types. */
|
2008-09-11 18:00:18 +00:00
|
|
|
ts_init_constants (&sc);
|
|
|
|
ts_init_procedures (&sc, register_scripts);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2006-10-19 13:51:42 +00:00
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
2014-08-03 21:49:20 +02:00
|
|
|
for (list = path; list; list = g_list_next (list))
|
2006-10-19 13:51:42 +00:00
|
|
|
{
|
2014-08-03 21:49:20 +02:00
|
|
|
gchar *dir = g_file_get_path (list->data);
|
|
|
|
|
|
|
|
if (ts_load_file (dir, "script-fu.init"))
|
2006-10-19 13:51:42 +00:00
|
|
|
{
|
2006-10-19 15:25:02 +00:00
|
|
|
/* To improve compatibility with older Script-Fu scripts,
|
|
|
|
* load script-fu-compat.init from the same directory.
|
|
|
|
*/
|
2014-08-03 21:49:20 +02:00
|
|
|
ts_load_file (dir, "script-fu-compat.init");
|
2006-10-19 15:25:02 +00:00
|
|
|
|
2008-11-19 08:17:28 +00:00
|
|
|
/* To improve compatibility with older GIMP version,
|
|
|
|
* load plug-in-compat.init from the same directory.
|
|
|
|
*/
|
2014-08-03 21:49:20 +02:00
|
|
|
ts_load_file (dir, "plug-in-compat.init");
|
|
|
|
|
|
|
|
g_free (dir);
|
2006-10-19 15:25:02 +00:00
|
|
|
|
2006-10-19 13:51:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-08-03 21:49:20 +02:00
|
|
|
|
|
|
|
g_free (dir);
|
2006-10-19 13:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (list == NULL)
|
|
|
|
g_printerr ("Unable to read initialization file script-fu.init\n");
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
}
|
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
/* Create an SF-RUN-MODE constant for use in scripts.
|
|
|
|
* It is set to the run mode state determined by GIMP.
|
|
|
|
*/
|
2006-10-16 01:08:54 +00:00
|
|
|
void
|
2008-09-11 18:00:18 +00:00
|
|
|
ts_set_run_mode (GimpRunMode run_mode)
|
2007-09-27 19:54:28 +00:00
|
|
|
{
|
|
|
|
pointer symbol;
|
|
|
|
|
|
|
|
symbol = sc.vptr->mk_symbol (&sc, "SF-RUN-MODE");
|
|
|
|
sc.vptr->scheme_define (&sc, sc.global_env, symbol,
|
|
|
|
sc.vptr->mk_integer (&sc, run_mode));
|
2008-09-11 13:33:58 +00:00
|
|
|
sc.vptr->setimmutable (symbol);
|
2007-09-27 19:54:28 +00:00
|
|
|
}
|
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
void
|
|
|
|
ts_set_print_flag (gint print_flag)
|
|
|
|
{
|
|
|
|
sc.print_output = print_flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ts_print_welcome (void)
|
|
|
|
{
|
|
|
|
ts_output_string (TS_OUTPUT_NORMAL,
|
2011-12-05 17:04:07 -05:00
|
|
|
"Welcome to TinyScheme, Version 1.40\n", -1);
|
2008-09-11 18:00:18 +00:00
|
|
|
ts_output_string (TS_OUTPUT_NORMAL,
|
|
|
|
"Copyright (c) Dimitrios Souflis\n", -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ts_interpret_stdin (void)
|
|
|
|
{
|
|
|
|
scheme_load_file (&sc, stdin);
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
ts_interpret_string (const gchar *expr)
|
|
|
|
{
|
|
|
|
#if DEBUG_SCRIPTS
|
|
|
|
sc.print_output = 1;
|
|
|
|
sc.tracing = 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sc.vptr->load_string (&sc, (char *) expr);
|
|
|
|
|
|
|
|
return sc.retcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
ts_get_success_msg (void)
|
|
|
|
{
|
|
|
|
if (sc.vptr->is_string (sc.value))
|
|
|
|
return sc.vptr->string_value (sc.value);
|
|
|
|
|
|
|
|
return "Success";
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ts_stdout_output_func (TsOutputType type,
|
|
|
|
const char *string,
|
|
|
|
int len,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (len < 0)
|
|
|
|
len = strlen (string);
|
|
|
|
fprintf (stdout, "%.*s", len, string);
|
2009-05-28 21:06:53 +02:00
|
|
|
fflush (stdout);
|
2008-09-11 18:00:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ts_gstring_output_func (TsOutputType type,
|
|
|
|
const char *string,
|
|
|
|
int len,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GString *gstr = (GString *) user_data;
|
|
|
|
|
|
|
|
g_string_append_len (gstr, string, len);
|
|
|
|
}
|
2007-09-28 14:20:35 +00:00
|
|
|
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
/* private functions */
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2003-10-16 12:47:33 +00:00
|
|
|
/*
|
|
|
|
* Below can be found the functions responsible for registering the
|
|
|
|
* gimp functions and types against the scheme interpreter.
|
|
|
|
*/
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
static void
|
2008-09-11 18:00:18 +00:00
|
|
|
ts_init_constants (scheme *sc)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
2004-10-25 19:29:00 +00:00
|
|
|
const gchar **enum_type_names;
|
|
|
|
gint n_enum_type_names;
|
|
|
|
gint i;
|
2006-10-16 01:08:54 +00:00
|
|
|
pointer symbol;
|
2017-01-09 16:00:10 +01:00
|
|
|
GQuark quark;
|
2004-10-25 19:29:00 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-directory");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, gimp_directory ()));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-data-directory");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, gimp_data_directory ()));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-plug-in-directory");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, gimp_plug_in_directory ()));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2004-09-22 17:31:44 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-locale-directory");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, gimp_locale_directory ()));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2004-09-22 17:31:44 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-sysconf-directory");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, gimp_sysconf_directory ()));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2003-08-26 18:12:42 +00:00
|
|
|
|
2004-10-25 19:29:00 +00:00
|
|
|
enum_type_names = gimp_enums_get_type_names (&n_enum_type_names);
|
2017-01-09 16:00:10 +01:00
|
|
|
quark = g_quark_from_static_string ("gimp-compat-enum");
|
2004-10-25 19:29:00 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_enum_type_names; i++)
|
|
|
|
{
|
|
|
|
const gchar *enum_name = enum_type_names[i];
|
|
|
|
GType enum_type = g_type_from_name (enum_name);
|
|
|
|
|
2017-01-09 16:00:10 +01:00
|
|
|
ts_init_enum (sc, enum_type);
|
2004-10-25 19:29:00 +00:00
|
|
|
|
2017-01-09 16:00:10 +01:00
|
|
|
enum_type = (GType) g_type_get_qdata (enum_type, quark);
|
2004-10-25 19:29:00 +00:00
|
|
|
|
2017-01-09 16:00:10 +01:00
|
|
|
if (enum_type)
|
|
|
|
ts_init_enum (sc, enum_type);
|
2004-10-25 19:29:00 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* Constants used in the register block of scripts */
|
|
|
|
for (i = 0; script_constants[i].name != NULL; ++i)
|
2006-10-20 09:54:05 +00:00
|
|
|
{
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, script_constants[i].name);
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_integer (sc,
|
|
|
|
script_constants[i].value));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-20 09:54:05 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
/* Define string constant for use in building paths to files/directories */
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "DIR-SEPARATOR");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, G_DIR_SEPARATOR_S));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2011-11-18 09:39:03 +01:00
|
|
|
/* Define string constant for use in building search paths */
|
|
|
|
symbol = sc->vptr->mk_symbol (sc, "SEARCHPATH-SEPARATOR");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_string (sc, G_SEARCHPATH_SEPARATOR_S));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* These constants are deprecated and will be removed at a later date. */
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-dir");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->mk_string (sc, gimp_directory ()));
|
2008-09-11 18:00:18 +00:00
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-data-dir");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->mk_string (sc, gimp_data_directory ()));
|
2008-09-11 18:00:18 +00:00
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-plugin-dir");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->mk_string (sc, gimp_plug_in_directory ()));
|
2008-09-11 18:00:18 +00:00
|
|
|
sc->vptr->setimmutable (symbol);
|
2017-01-09 16:00:10 +01:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2017-01-09 16:00:10 +01:00
|
|
|
static void
|
|
|
|
ts_init_enum (scheme *sc,
|
|
|
|
GType enum_type)
|
|
|
|
{
|
|
|
|
GEnumClass *enum_class = g_type_class_ref (enum_type);
|
|
|
|
GEnumValue *value;
|
|
|
|
|
|
|
|
for (value = enum_class->values; value->value_name; value++)
|
2006-10-20 09:54:05 +00:00
|
|
|
{
|
2017-01-09 16:00:10 +01:00
|
|
|
if (g_str_has_prefix (value->value_name, "GIMP_"))
|
|
|
|
{
|
|
|
|
gchar *scheme_name;
|
|
|
|
pointer symbol;
|
|
|
|
|
|
|
|
scheme_name = g_strdup (value->value_name + strlen ("GIMP_"));
|
|
|
|
convert_string (scheme_name);
|
|
|
|
|
|
|
|
symbol = sc->vptr->mk_symbol (sc, scheme_name);
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_integer (sc, value->value));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
|
|
|
|
|
|
|
g_free (scheme_name);
|
|
|
|
}
|
2006-10-20 09:54:05 +00:00
|
|
|
}
|
2017-01-09 16:00:10 +01:00
|
|
|
|
|
|
|
g_type_class_unref (enum_class);
|
2006-10-16 01:08:54 +00:00
|
|
|
}
|
2005-02-17 00:24:31 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
static void
|
2008-09-11 18:00:18 +00:00
|
|
|
ts_init_procedures (scheme *sc,
|
|
|
|
gboolean register_scripts)
|
2006-10-16 01:08:54 +00:00
|
|
|
{
|
2008-09-19 12:15:26 +00:00
|
|
|
gchar **proc_list;
|
|
|
|
gint num_procs;
|
|
|
|
gint i;
|
|
|
|
pointer symbol;
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
#if USE_DL
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc,"load-extension");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc, scm_load_ext));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "script-fu-register");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc,
|
|
|
|
register_scripts ?
|
|
|
|
script_fu_register_call :
|
|
|
|
script_fu_nil_call));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
|
|
|
|
|
|
|
symbol = sc->vptr->mk_symbol (sc, "script-fu-menu-register");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc,
|
|
|
|
register_scripts ?
|
|
|
|
script_fu_menu_register_call :
|
|
|
|
script_fu_nil_call));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
|
|
|
|
|
|
|
symbol = sc->vptr->mk_symbol (sc, "script-fu-quit");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc, script_fu_quit_call));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
/* register the database execution procedure */
|
2008-09-11 18:00:18 +00:00
|
|
|
symbol = sc->vptr->mk_symbol (sc, "gimp-proc-db-call");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc,
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
script_fu_marshal_procedure_call_strict));
|
|
|
|
sc->vptr->setimmutable (symbol);
|
|
|
|
|
|
|
|
/* register the internal database execution procedure; see comment below */
|
|
|
|
symbol = sc->vptr->mk_symbol (sc, "-gimp-proc-db-call");
|
|
|
|
sc->vptr->scheme_define (sc, sc->global_env, symbol,
|
|
|
|
sc->vptr->mk_foreign_func (sc,
|
|
|
|
script_fu_marshal_procedure_call_permissive));
|
2008-09-11 18:00:18 +00:00
|
|
|
sc->vptr->setimmutable (symbol);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
proc_list = gimp_pdb_query_procedures (gimp_get_pdb (),
|
|
|
|
".*", ".*", ".*", ".*",
|
|
|
|
".*", ".*", ".*", ".*",
|
|
|
|
&num_procs);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
/* Register each procedure as a scheme func */
|
|
|
|
for (i = 0; i < num_procs; i++)
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
gchar *buff;
|
|
|
|
|
|
|
|
/* Build a define that will call the foreign function.
|
|
|
|
* The Scheme statement was suggested by Simon Budig.
|
|
|
|
*
|
|
|
|
* We call the procedure through -gimp-proc-db-call, which is a more
|
|
|
|
* permissive version of gimp-proc-db-call, that accepts (and ignores)
|
|
|
|
* any number of arguments for nullary procedures, for backward
|
|
|
|
* compatibility.
|
|
|
|
*/
|
|
|
|
buff = g_strdup_printf (" (define (%s . args)"
|
|
|
|
" (apply -gimp-proc-db-call \"%s\" args))",
|
|
|
|
proc_list[i], proc_list[i]);
|
2008-09-11 18:00:18 +00:00
|
|
|
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
/* Execute the 'define' */
|
|
|
|
sc->vptr->load_string (sc, buff);
|
2008-09-11 18:00:18 +00:00
|
|
|
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
g_free (buff);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2012-11-27 21:16:26 +01:00
|
|
|
g_strfreev (proc_list);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
|
|
|
|
2008-11-19 08:17:28 +00:00
|
|
|
static gboolean
|
|
|
|
ts_load_file (const gchar *dirname,
|
|
|
|
const gchar *basename)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
|
|
|
FILE *fin;
|
|
|
|
|
|
|
|
filename = g_build_filename (dirname, basename, NULL);
|
|
|
|
|
|
|
|
fin = g_fopen (filename, "rb");
|
|
|
|
|
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
if (fin)
|
|
|
|
{
|
|
|
|
scheme_load_file (&sc, fin);
|
|
|
|
fclose (fin);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
static void
|
|
|
|
convert_string (gchar *str)
|
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
if (*str == '_') *str = '-';
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* This is called by the Scheme interpreter to allow calls to GIMP functions */
|
|
|
|
static pointer
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
script_fu_marshal_procedure_call (scheme *sc,
|
|
|
|
pointer a,
|
|
|
|
gboolean permissive)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
GimpProcedure *procedure;
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *values = NULL;
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
gchar *proc_name;
|
2019-08-12 20:11:45 +02:00
|
|
|
GParamSpec **arg_specs;
|
|
|
|
gint n_arg_specs;
|
2008-09-19 09:47:10 +00:00
|
|
|
gchar error_str[1024];
|
2003-02-14 22:33:22 +00:00
|
|
|
gint i;
|
|
|
|
gint success = TRUE;
|
2006-10-16 01:08:54 +00:00
|
|
|
pointer return_val = sc->NIL;
|
2007-10-21 20:39:01 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2007-10-21 20:39:01 +00:00
|
|
|
/* These three #defines are from Tinyscheme (tinyscheme/scheme.c) */
|
|
|
|
#define T_MASKTYPE 31
|
|
|
|
#define typeflag(p) ((p)->_flag)
|
|
|
|
#define type(p) (typeflag(p)&T_MASKTYPE)
|
|
|
|
|
2008-09-19 12:15:26 +00:00
|
|
|
static const char *ts_types[] =
|
|
|
|
{
|
2008-09-09 14:22:44 +00:00
|
|
|
"T_NONE",
|
|
|
|
"T_STRING", "T_NUMBER", "T_SYMBOL", "T_PROC",
|
|
|
|
"T_PAIR", "T_CLOSURE", "T_CONTINUATION", "T_FOREIGN",
|
|
|
|
"T_CHARACTER", "T_PORT", "T_VECTOR", "T_MACRO",
|
|
|
|
"T_PROMISE", "T_ENVIRONMENT","T_ARRAY"
|
|
|
|
};
|
|
|
|
|
|
|
|
g_printerr ("\nIn %s()\n", G_STRFUNC);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* Make sure there are arguments */
|
2006-10-16 01:08:54 +00:00
|
|
|
if (a == sc->NIL)
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc,
|
2007-09-27 10:27:46 +00:00
|
|
|
"Procedure argument marshaller was called with no arguments. "
|
2007-08-31 19:35:26 +00:00
|
|
|
"The procedure to be executed and the arguments it requires "
|
2007-09-27 10:27:46 +00:00
|
|
|
"(possibly none) must be specified.", 0);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* The PDB procedure name is the argument or first argument of the list */
|
|
|
|
if (sc->vptr->is_pair (a))
|
|
|
|
proc_name = g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
else
|
2006-10-16 01:08:54 +00:00
|
|
|
proc_name = g_strdup (sc->vptr->string_value (a));
|
|
|
|
|
|
|
|
#ifdef DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" proc name: %s\n", proc_name);
|
|
|
|
g_printerr (" parms rcvd: %d\n", sc->vptr->list_length (sc, a)-1);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* report the current command */
|
2004-08-31 17:54:46 +00:00
|
|
|
script_fu_interface_report_cc (proc_name);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* Attempt to fetch the procedure from the database */
|
2019-08-12 20:11:45 +02:00
|
|
|
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), proc_name);
|
|
|
|
|
|
|
|
if (! procedure)
|
2004-10-04 22:00:16 +00:00
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
#ifdef DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" Invalid procedure name\n");
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2004-10-04 22:00:16 +00:00
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Invalid procedure name %s specified", proc_name);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2004-10-04 22:00:16 +00:00
|
|
|
}
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
arg_specs = gimp_procedure_get_arguments (procedure, &n_arg_specs);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* Check the supplied number of arguments */
|
2019-08-12 20:11:45 +02:00
|
|
|
if ((n_arg_specs > 0 || ! permissive) &&
|
|
|
|
(sc->vptr->list_length (sc, a) - 1) != n_arg_specs)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" Invalid number of arguments (expected %d but received %d)",
|
|
|
|
nparams, (sc->vptr->list_length (sc, a) - 1));
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2003-08-26 18:12:42 +00:00
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2006-10-24 18:55:09 +00:00
|
|
|
"Invalid number of arguments for %s (expected %d but received %d)",
|
2019-08-12 20:11:45 +02:00
|
|
|
proc_name, n_arg_specs, (sc->vptr->list_length (sc, a) - 1));
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Marshall the supplied arguments */
|
2019-08-12 20:11:45 +02:00
|
|
|
args = gimp_value_array_new (n_arg_specs);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (i = 0; i < n_arg_specs; i++)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
GParamSpec *arg_spec = arg_specs[i];
|
|
|
|
GValue value = G_VALUE_INIT;
|
|
|
|
gint32 n_elements;
|
|
|
|
pointer vector;
|
|
|
|
gint j;
|
2008-09-09 14:22:44 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
a = sc->vptr->pair_cdr (a);
|
|
|
|
|
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:40:52 +00:00
|
|
|
{
|
|
|
|
const gchar *type_name;
|
|
|
|
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE,
|
|
|
|
params[i].type,
|
|
|
|
&type_name, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
g_printerr (" param %d - expecting type %s (%d)\n",
|
|
|
|
i + 1, type_name, params[i].type);
|
|
|
|
g_printerr (" passed arg is type %s (%d)\n",
|
|
|
|
ts_types[ type(sc->vptr->pair_car (a)) ],
|
|
|
|
type(sc->vptr->pair_car (a)));
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-06-12 10:25:29 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (arg_spec));
|
2006-06-08 15:14:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (G_VALUE_HOLDS_INT (&value))
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (a)))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_int (&value,
|
|
|
|
sc->vptr->ivalue (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" int32 arg is '%d'\n", args[i].data.d_int32);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_UINT (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (a)))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_uint (&value,
|
|
|
|
sc->vptr->ivalue (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2019-08-12 20:11:45 +02:00
|
|
|
g_printerr (" int8 arg is '%u'\n", args[i].data.d_int8);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_DOUBLE (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (a)))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_double (&value,
|
|
|
|
sc->vptr->rvalue (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2019-08-12 20:11:45 +02:00
|
|
|
g_printerr (" float arg is '%f'\n", args[i].data.d_float);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_ENUM (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (a)))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_enum (&value,
|
|
|
|
sc->vptr->ivalue (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2019-08-12 20:11:45 +02:00
|
|
|
g_printerr (" enum arg is '%d'\n", args[i].data.d_int32);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_BOOLEAN (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (a)))
|
|
|
|
success = FALSE;
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (success)
|
|
|
|
{
|
|
|
|
g_value_set_boolean (&value,
|
|
|
|
sc->vptr->ivalue (sc->vptr->pair_car (a)));
|
|
|
|
#if DEBUG_MARSHALL
|
|
|
|
g_printerr (" bool arg is '%d'\n", args[i].data.d_int32);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_STRING (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_string (sc->vptr->pair_car (a)))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_string (&value,
|
|
|
|
sc->vptr->string_value (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" string arg is '%s'\n", args[i].data.d_string);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT32_ARRAY (&value))
|
|
|
|
{
|
2006-11-09 23:03:55 +00:00
|
|
|
vector = sc->vptr->pair_car (a);
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_vector (vector))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
gint32 *array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
2007-09-28 14:20:35 +00:00
|
|
|
if (n_elements < 0 ||
|
|
|
|
n_elements > sc->vptr->vector_length (vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"INT32 vector (argument %d) for function %s has "
|
|
|
|
"size of %ld but expected size of %d",
|
2007-09-28 14:20:35 +00:00
|
|
|
i+1, proc_name,
|
|
|
|
sc->vptr->vector_length (vector), n_elements);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (gint32, n_elements);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
|
|
|
pointer v_element = sc->vptr->vector_elem (vector, j);
|
|
|
|
|
|
|
|
/* FIXME: Check values in vector stay within range for each type. */
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_number (v_element))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Item %d in vector is not a number (argument %d for function %s)",
|
2006-11-09 23:03:55 +00:00
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_free (array);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array[j] = (gint32) sc->vptr->ivalue (v_element);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2004-10-04 22:00:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_take_int32_array (&value, array, n_elements);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->vector_length (vector);
|
|
|
|
g_printerr (" int32 vector has %ld elements\n", count);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
g_printerr (" ");
|
|
|
|
for (j = 0; j < count; ++j)
|
|
|
|
g_printerr (" %ld",
|
|
|
|
sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
|
|
|
|
g_printerr ("\n");
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT16_ARRAY (&value))
|
|
|
|
{
|
2006-11-09 23:03:55 +00:00
|
|
|
vector = sc->vptr->pair_car (a);
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_vector (vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-11-09 23:03:55 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
gint16 *array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
|
|
|
if (n_elements < 0 ||
|
|
|
|
n_elements > sc->vptr->vector_length (vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"INT16 vector (argument %d) for function %s has "
|
|
|
|
"size of %ld but expected size of %d",
|
|
|
|
i+1, proc_name, sc->vptr->vector_length (vector), n_elements);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (gint16, n_elements);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
|
|
|
pointer v_element = sc->vptr->vector_elem (vector, j);
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_number (v_element))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Item %d in vector is not a number (argument %d for function %s)",
|
2006-11-09 23:03:55 +00:00
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_free (array);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array[j] = (gint16) sc->vptr->ivalue (v_element);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_take_int16_array (&value, array, n_elements);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->vector_length (vector);
|
|
|
|
g_printerr (" int16 vector has %ld elements\n", count);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
g_printerr (" ");
|
|
|
|
for (j = 0; j < count; ++j)
|
|
|
|
g_printerr (" %ld",
|
|
|
|
sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
|
|
|
|
g_printerr ("\n");
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT8_ARRAY (&value))
|
|
|
|
{
|
2006-11-09 23:03:55 +00:00
|
|
|
vector = sc->vptr->pair_car (a);
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_vector (vector))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
guint8 *array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
2007-09-28 14:20:35 +00:00
|
|
|
if (n_elements < 0 ||
|
|
|
|
n_elements > sc->vptr->vector_length (vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"INT8 vector (argument %d) for function %s has "
|
|
|
|
"size of %ld but expected size of %d",
|
2007-09-28 14:20:35 +00:00
|
|
|
i+1, proc_name,
|
|
|
|
sc->vptr->vector_length (vector), n_elements);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2004-10-04 22:00:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (guint8, n_elements);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
|
|
|
pointer v_element = sc->vptr->vector_elem (vector, j);
|
|
|
|
|
2007-05-15 16:45:51 +00:00
|
|
|
if (!sc->vptr->is_number (v_element))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Item %d in vector is not a number (argument %d for function %s)",
|
2006-11-09 23:03:55 +00:00
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_free (array);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array[j] = (guint8) sc->vptr->ivalue (v_element);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_take_int8_array (&value, array, n_elements);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->vector_length (vector);
|
|
|
|
g_printerr (" int8 vector has %ld elements\n", count);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
g_printerr (" ");
|
|
|
|
for (j = 0; j < count; ++j)
|
|
|
|
g_printerr (" %ld",
|
|
|
|
sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
|
|
|
|
g_printerr ("\n");
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_FLOAT_ARRAY (&value))
|
|
|
|
{
|
2006-11-09 23:03:55 +00:00
|
|
|
vector = sc->vptr->pair_car (a);
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_vector (vector))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
gdouble *array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
2007-09-28 14:20:35 +00:00
|
|
|
if (n_elements < 0 ||
|
|
|
|
n_elements > sc->vptr->vector_length (vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"FLOAT vector (argument %d) for function %s has "
|
|
|
|
"size of %ld but expected size of %d",
|
2007-09-28 14:20:35 +00:00
|
|
|
i+1, proc_name,
|
|
|
|
sc->vptr->vector_length (vector), n_elements);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2004-10-04 22:00:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (gdouble, n_elements);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
|
|
|
pointer v_element = sc->vptr->vector_elem (vector, j);
|
|
|
|
|
|
|
|
if (!sc->vptr->is_number (v_element))
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Item %d in vector is not a number (argument %d for function %s)",
|
2006-11-09 23:03:55 +00:00
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_free (array);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array[j] = (gfloat) sc->vptr->rvalue (v_element);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_take_float_array (&value, array, n_elements);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->vector_length (vector);
|
|
|
|
g_printerr (" float vector has %ld elements\n", count);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
g_printerr (" ");
|
|
|
|
for (j = 0; j < count; ++j)
|
|
|
|
g_printerr (" %f",
|
|
|
|
sc->vptr->rvalue ( sc->vptr->vector_elem (vector, j) ));
|
|
|
|
g_printerr ("\n");
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_STRING_ARRAY (&value))
|
|
|
|
{
|
2007-10-21 20:39:01 +00:00
|
|
|
vector = sc->vptr->pair_car (a); /* vector is pointing to a list */
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_list (sc, vector))
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
gchar **array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
2007-09-28 14:20:35 +00:00
|
|
|
if (n_elements < 0 ||
|
2007-10-21 20:39:01 +00:00
|
|
|
n_elements > sc->vptr->list_length (sc, vector))
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"STRING vector (argument %d) for function %s has "
|
2007-10-21 20:39:01 +00:00
|
|
|
"length of %d but expected length of %d",
|
2007-09-28 14:20:35 +00:00
|
|
|
i+1, proc_name,
|
2007-10-21 20:39:01 +00:00
|
|
|
sc->vptr->list_length (sc, vector), n_elements);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2005-12-18 19:27:21 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (gchar *, n_elements + 1);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
2007-10-21 20:39:01 +00:00
|
|
|
pointer v_element = sc->vptr->pair_car (vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
|
|
|
if (!sc->vptr->is_string (v_element))
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Item %d in vector is not a string (argument %d for function %s)",
|
2006-11-09 23:03:55 +00:00
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_strfreev (array);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array[j] = g_strdup (sc->vptr->string_value (v_element));
|
2007-10-21 20:39:01 +00:00
|
|
|
|
|
|
|
vector = sc->vptr->pair_cdr (vector);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_take_string_array (&value, array, n_elements);
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->list_length ( sc, sc->vptr->pair_car (a) );
|
|
|
|
g_printerr (" string vector has %ld elements\n", count);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
g_printerr (" ");
|
|
|
|
for (j = 0; j < count; ++j)
|
|
|
|
g_printerr (" \"%s\"",
|
|
|
|
args[i].data.d_stringarray[j]);
|
|
|
|
g_printerr ("\n");
|
|
|
|
}
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_RGB (&value))
|
|
|
|
{
|
|
|
|
GimpRGB color;
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (sc->vptr->is_string (sc->vptr->pair_car (a)))
|
2006-06-08 14:09:44 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! gimp_rgb_parse_css (&color,
|
2006-10-16 01:08:54 +00:00
|
|
|
sc->vptr->string_value (sc->vptr->pair_car (a)),
|
|
|
|
-1))
|
2006-06-08 14:09:44 +00:00
|
|
|
success = FALSE;
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_rgb_set_alpha (&color, 1.0);
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" (%s)\n",
|
|
|
|
sc->vptr->string_value (sc->vptr->pair_car (a)));
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-06-08 14:09:44 +00:00
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
else if (sc->vptr->is_list (sc, sc->vptr->pair_car (a)) &&
|
|
|
|
sc->vptr->list_length (sc, sc->vptr->pair_car (a)) == 3)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
pointer color_list;
|
2014-10-31 12:13:07 -04:00
|
|
|
guchar r = 0, g = 0, b = 0;
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
color_list = sc->vptr->pair_car (a);
|
2014-10-31 12:13:07 -04:00
|
|
|
if (sc->vptr->is_number (sc->vptr->pair_car (color_list)))
|
|
|
|
r = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
else
|
|
|
|
success = FALSE;
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
color_list = sc->vptr->pair_cdr (color_list);
|
2014-10-31 12:13:07 -04:00
|
|
|
if (sc->vptr->is_number (sc->vptr->pair_car (color_list)))
|
|
|
|
g = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
else
|
|
|
|
success = FALSE;
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
color_list = sc->vptr->pair_cdr (color_list);
|
2014-10-31 12:13:07 -04:00
|
|
|
if (sc->vptr->is_number (sc->vptr->pair_car (color_list)))
|
|
|
|
b = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
else
|
|
|
|
success = FALSE;
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
2014-10-31 12:13:07 -04:00
|
|
|
if (success)
|
2019-08-12 20:11:45 +02:00
|
|
|
{
|
|
|
|
gimp_rgba_set_uchar (&color, r, g, b, 255);
|
|
|
|
gimp_value_set_rgb (&value, &color);
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2014-10-31 12:13:07 -04:00
|
|
|
if (success)
|
|
|
|
g_printerr (" (%d %d %d)\n", r, g, b);
|
|
|
|
else
|
|
|
|
g_printerr (" COLOR list contains non-numbers\n");
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2004-04-08 16:05:27 +00:00
|
|
|
}
|
2006-06-08 14:09:44 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_RGB_ARRAY (&value))
|
|
|
|
{
|
2008-07-14 14:09:16 +00:00
|
|
|
vector = sc->vptr->pair_car (a);
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_vector (vector))
|
2008-07-14 14:09:16 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2008-07-14 14:09:16 +00:00
|
|
|
if (success)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
GimpRGB *array;
|
|
|
|
|
|
|
|
n_elements = g_value_get_int (gimp_value_array_index (args, i - 1));
|
|
|
|
|
2008-07-14 14:09:16 +00:00
|
|
|
if (n_elements < 0 ||
|
|
|
|
n_elements > sc->vptr->vector_length (vector))
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"COLOR vector (argument %d) for function %s has "
|
|
|
|
"size of %ld but expected size of %d",
|
|
|
|
i+1, proc_name,
|
|
|
|
sc->vptr->vector_length (vector), n_elements);
|
|
|
|
return foreign_error (sc, error_str, 0);
|
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
array = g_new0 (GimpRGB, n_elements);
|
2008-07-14 14:09:16 +00:00
|
|
|
|
|
|
|
for (j = 0; j < n_elements; j++)
|
|
|
|
{
|
|
|
|
pointer v_element = sc->vptr->vector_elem (vector, j);
|
|
|
|
pointer color_list;
|
|
|
|
guchar r, g, b;
|
|
|
|
|
|
|
|
if (! (sc->vptr->is_list (sc,
|
|
|
|
sc->vptr->pair_car (v_element)) &&
|
|
|
|
sc->vptr->list_length (sc,
|
|
|
|
sc->vptr->pair_car (v_element)) == 3))
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Item %d in vector is not a color "
|
|
|
|
"(argument %d for function %s)",
|
|
|
|
j+1, i+1, proc_name);
|
2019-08-12 20:11:45 +02:00
|
|
|
g_free (array);
|
2008-07-14 14:09:16 +00:00
|
|
|
return foreign_error (sc, error_str, vector);
|
|
|
|
}
|
|
|
|
|
|
|
|
color_list = sc->vptr->pair_car (v_element);
|
|
|
|
r = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
color_list = sc->vptr->pair_cdr (color_list);
|
|
|
|
g = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
color_list = sc->vptr->pair_cdr (color_list);
|
|
|
|
b = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
|
|
|
|
0, 255);
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_rgba_set_uchar (&array[i], r, g, b, 255);
|
2008-07-14 14:09:16 +00:00
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
|
|
|
|
gimp_value_take_rgb_array (&value, array, n_elements);
|
|
|
|
|
2008-07-14 14:09:16 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
|
|
|
glong count = sc->vptr->vector_length (vector);
|
|
|
|
g_printerr (" color vector has %ld elements\n", count);
|
|
|
|
}
|
2008-07-14 14:09:16 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_PARASITE (&value))
|
|
|
|
{
|
|
|
|
if (! sc->vptr->is_list (sc, sc->vptr->pair_car (a)) ||
|
2006-10-16 01:08:54 +00:00
|
|
|
sc->vptr->list_length (sc, sc->vptr->pair_car (a)) != 3)
|
2004-04-08 16:05:27 +00:00
|
|
|
success = FALSE;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
if (success)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
GimpParasite parasite;
|
|
|
|
pointer temp_val;
|
2008-09-19 12:15:26 +00:00
|
|
|
|
2004-04-08 16:05:27 +00:00
|
|
|
/* parasite->name */
|
2008-09-19 12:15:26 +00:00
|
|
|
temp_val = sc->vptr->pair_car (a);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_string (sc->vptr->pair_car (temp_val)))
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
parasite.name =
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->string_value (sc->vptr->pair_car (temp_val));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" name '%s'\n", args[i].data.d_parasite.name);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2004-04-08 16:05:27 +00:00
|
|
|
|
|
|
|
/* parasite->flags */
|
2008-09-19 12:15:26 +00:00
|
|
|
temp_val = sc->vptr->pair_cdr (temp_val);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! sc->vptr->is_number (sc->vptr->pair_car (temp_val)))
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
parasite.flags =
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->ivalue (sc->vptr->pair_car (temp_val));
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" flags %d", args[i].data.d_parasite.flags);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
/* parasite->data */
|
2008-09-19 12:15:26 +00:00
|
|
|
temp_val = sc->vptr->pair_cdr (temp_val);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2008-09-19 12:15:26 +00:00
|
|
|
if (!sc->vptr->is_string (sc->vptr->pair_car (temp_val)))
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
parasite.data =
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->string_value (sc->vptr->pair_car (temp_val));
|
2019-08-12 20:11:45 +02:00
|
|
|
parasite.size = strlen (parasite.data);
|
2008-09-19 12:15:26 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (", size %d\n", args[i].data.d_parasite.size);
|
|
|
|
g_printerr (" data '%s'\n", (char *)args[i].data.d_parasite.data);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
g_value_set_boxed (&value, ¶site);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (G_VALUE_TYPE (&value) == GIMP_TYPE_PDB_STATUS_TYPE)
|
|
|
|
{
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc,
|
|
|
|
"Status is for return types, not arguments",
|
|
|
|
sc->vptr->pair_car (a));
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-04-08 16:05:27 +00:00
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
2019-08-12 20:11:45 +02:00
|
|
|
"Argument %d for %s is an unknown type %s",
|
|
|
|
i+1, proc_name, g_type_name (G_VALUE_TYPE (&value)));
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2004-04-08 16:05:27 +00:00
|
|
|
}
|
2006-10-24 18:55:09 +00:00
|
|
|
|
|
|
|
/* Break out of loop before i gets updated when error was detected */
|
|
|
|
if (! success)
|
|
|
|
break;
|
2019-08-12 20:11:45 +02:00
|
|
|
|
|
|
|
gimp_value_array_append (args, &value);
|
|
|
|
g_value_unset (&value);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (success)
|
2008-09-09 14:22:44 +00:00
|
|
|
{
|
2012-10-07 17:04:54 +02:00
|
|
|
/* refuse to refresh scripts from a script, better than crashing
|
|
|
|
* see bug #575830
|
|
|
|
*/
|
|
|
|
if (strcmp (proc_name, "script-fu-refresh-scripts"))
|
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2012-10-07 17:04:54 +02:00
|
|
|
g_printerr (" calling %s...", proc_name);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2019-08-12 20:11:45 +02:00
|
|
|
values = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
proc_name, args);
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2012-10-07 17:04:54 +02:00
|
|
|
g_printerr (" done.\n");
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2012-10-07 17:04:54 +02:00
|
|
|
}
|
2008-09-09 14:22:44 +00:00
|
|
|
}
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
else
|
2006-11-09 23:03:55 +00:00
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" Invalid type for argument %d\n", i+1);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2006-11-09 23:03:55 +00:00
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Invalid type for argument %d to %s",
|
|
|
|
i+1, proc_name);
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
2006-11-09 23:03:55 +00:00
|
|
|
}
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* Check the return status */
|
|
|
|
if (! values)
|
|
|
|
{
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" Did not return status\n");
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
g_snprintf (error_str, sizeof(error_str),
|
2007-09-27 10:27:46 +00:00
|
|
|
"Procedure execution of %s did not return a status",
|
|
|
|
proc_name);
|
2003-08-26 18:12:42 +00:00
|
|
|
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:40:52 +00:00
|
|
|
{
|
|
|
|
const gchar *status_name;
|
|
|
|
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_PDB_STATUS_TYPE,
|
|
|
|
values[0].data.d_status,
|
|
|
|
&status_name, NULL, NULL, NULL);
|
|
|
|
g_printerr (" return value is %s\n", status_name);
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
switch (g_value_get_enum (gimp_value_array_index (values, 0)))
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
|
|
|
case GIMP_PDB_EXECUTION_ERROR:
|
2019-08-12 20:11:45 +02:00
|
|
|
if (gimp_value_array_length (values) > 1 &&
|
|
|
|
G_VALUE_HOLDS_STRING (gimp_value_array_index (values, 1)))
|
2008-09-10 20:33:50 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Procedure execution of %s failed: %s",
|
2019-08-12 20:11:45 +02:00
|
|
|
proc_name,
|
|
|
|
g_value_get_string (gimp_value_array_index (values, 1)));
|
2008-09-10 20:33:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Procedure execution of %s failed",
|
|
|
|
proc_name);
|
|
|
|
}
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_CALLING_ERROR:
|
2019-08-12 20:11:45 +02:00
|
|
|
if (gimp_value_array_length (values) > 1 &&
|
|
|
|
G_VALUE_HOLDS_STRING (gimp_value_array_index (values, 1)))
|
2008-09-10 20:33:50 +00:00
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Procedure execution of %s failed on invalid input arguments: %s",
|
2019-08-12 20:11:45 +02:00
|
|
|
proc_name,
|
|
|
|
g_value_get_string (gimp_value_array_index (values, 1)));
|
2008-09-10 20:33:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Procedure execution of %s failed on invalid input arguments",
|
|
|
|
proc_name);
|
|
|
|
}
|
2007-08-31 19:35:26 +00:00
|
|
|
return foreign_error (sc, error_str, 0);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_SUCCESS:
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:22:44 +00:00
|
|
|
g_printerr (" values returned: %d\n", nvalues-1);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2019-08-12 20:11:45 +02:00
|
|
|
for (i = gimp_value_array_length (values) - 2; i >= 0; --i)
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
GValue *value = gimp_value_array_index (values, i + 1);
|
|
|
|
gint j;
|
2008-09-09 14:22:44 +00:00
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
#if DEBUG_MARSHALL
|
2008-09-09 14:40:52 +00:00
|
|
|
{
|
|
|
|
const gchar *type_name;
|
|
|
|
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE,
|
|
|
|
return_vals[i].type,
|
|
|
|
&type_name, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
g_printerr (" value %d is type %s (%d)\n",
|
|
|
|
i, type_name, return_vals[i].type);
|
|
|
|
}
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2019-08-12 20:11:45 +02:00
|
|
|
if (G_VALUE_HOLDS_INT (value))
|
2004-04-08 16:05:27 +00:00
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
gint v = g_value_get_int (value);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_integer (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_UINT (value))
|
|
|
|
{
|
|
|
|
guint v = g_value_get_uint (value);
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_integer (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_DOUBLE (value))
|
|
|
|
{
|
|
|
|
gdouble v = g_value_get_double (value);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_real (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_ENUM (value))
|
|
|
|
{
|
|
|
|
gint v = g_value_get_enum (value);
|
2004-10-04 22:00:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_integer (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_BOOLEAN (value))
|
|
|
|
{
|
|
|
|
gboolean v = g_value_get_boolean (value);
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_integer (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (G_VALUE_HOLDS_STRING (value))
|
|
|
|
{
|
|
|
|
const gchar *v = g_value_get_string (value);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (! v)
|
|
|
|
v = "";
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, sc->vptr->mk_string (sc, v),
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT32_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const gint32 *v = gimp_value_get_int32_array (value);
|
|
|
|
pointer vector = sc->vptr->mk_vector (sc, n);
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
sc->vptr->set_vector_elem (vector, j,
|
|
|
|
sc->vptr->mk_integer (sc, v[j]));
|
|
|
|
}
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, vector, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT16_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const gint16 *v = gimp_value_get_int16_array (value);
|
|
|
|
pointer vector = sc->vptr->mk_vector (sc, n);
|
2006-11-09 23:03:55 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
sc->vptr->set_vector_elem (vector, j,
|
|
|
|
sc->vptr->mk_integer (sc, v[j]));
|
|
|
|
}
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, vector, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_INT8_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const guint8 *v = gimp_value_get_int8_array (value);
|
|
|
|
pointer vector = sc->vptr->mk_vector (sc, n);
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
sc->vptr->set_vector_elem (vector, j,
|
|
|
|
sc->vptr->mk_integer (sc, v[j]));
|
|
|
|
}
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, vector, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_FLOAT_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const gdouble *v = gimp_value_get_float_array (value);
|
|
|
|
pointer vector = sc->vptr->mk_vector (sc, n);
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
sc->vptr->set_vector_elem (vector, j,
|
|
|
|
sc->vptr->mk_real (sc, v[j]));
|
|
|
|
}
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, vector, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_STRING_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const gchar **v = gimp_value_get_string_array (value);
|
|
|
|
pointer list = sc->NIL;
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = n - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
list = sc->vptr->cons (sc,
|
|
|
|
sc->vptr->mk_string (sc,
|
|
|
|
v[j] ?
|
|
|
|
v[j] : ""),
|
|
|
|
list);
|
|
|
|
}
|
2004-04-08 16:05:27 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, list, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_RGB (value))
|
|
|
|
{
|
|
|
|
GimpRGB v;
|
|
|
|
guchar r, g, b;
|
|
|
|
gpointer temp_val;
|
|
|
|
|
|
|
|
gimp_value_get_rgb (value, &v);
|
|
|
|
gimp_rgb_get_uchar (&v, &r, &g, &b);
|
|
|
|
|
|
|
|
temp_val = sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_integer (sc, r),
|
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->mk_integer (sc, g),
|
2019-08-12 20:11:45 +02:00
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_integer (sc, b),
|
|
|
|
sc->NIL)));
|
2008-07-14 14:09:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc,
|
|
|
|
temp_val,
|
|
|
|
return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_RGB_ARRAY (value))
|
|
|
|
{
|
|
|
|
gint32 n = g_value_get_int
|
|
|
|
(gimp_value_array_index (values, i));
|
|
|
|
const GimpRGB *v = gimp_value_get_rgb_array (value);
|
|
|
|
pointer vector = sc->vptr->mk_vector (sc, n);
|
2008-07-14 14:09:16 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
guchar r, g, b;
|
|
|
|
pointer temp_val;
|
|
|
|
|
|
|
|
gimp_rgb_get_uchar (&v[j], &r, &g, &b);
|
|
|
|
|
|
|
|
temp_val = sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_integer (sc, r),
|
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_integer (sc, g),
|
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
2008-09-19 12:15:26 +00:00
|
|
|
sc->vptr->mk_integer (sc, b),
|
|
|
|
sc->NIL)));
|
2019-08-12 20:11:45 +02:00
|
|
|
sc->vptr->set_vector_elem (vector, j, temp_val);
|
|
|
|
}
|
2009-08-07 15:13:12 -04:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
return_val = sc->vptr->cons (sc, vector, return_val);
|
|
|
|
}
|
|
|
|
else if (GIMP_VALUE_HOLDS_PARASITE (value))
|
|
|
|
{
|
|
|
|
GimpParasite *v = g_value_get_boxed (value);
|
2008-09-19 12:15:26 +00:00
|
|
|
|
2019-08-12 20:11:45 +02:00
|
|
|
if (v->name == NULL)
|
|
|
|
{
|
|
|
|
return_val = foreign_error (sc, "Error: null parasite", 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gchar *data = g_strndup (v->data, v->size);
|
|
|
|
gint char_cnt = g_utf8_strlen (data, v->size);
|
|
|
|
pointer temp_val;
|
|
|
|
|
|
|
|
/* don't move the mk_foo() calls outside this function call,
|
|
|
|
* otherwise they might be garbage collected away!
|
|
|
|
*/
|
|
|
|
temp_val = sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_string (sc, v->name),
|
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_integer (sc, v->flags),
|
|
|
|
sc->vptr->cons
|
|
|
|
(sc,
|
|
|
|
sc->vptr->mk_counted_string (sc,
|
|
|
|
data,
|
|
|
|
char_cnt),
|
|
|
|
sc->NIL)));
|
|
|
|
|
|
|
|
return_val = sc->vptr->cons (sc,
|
|
|
|
temp_val,
|
|
|
|
return_val);
|
|
|
|
g_free (data);
|
2006-10-16 01:08:54 +00:00
|
|
|
|
|
|
|
#if DEBUG_MARSHALL
|
2019-08-12 20:11:45 +02:00
|
|
|
g_printerr (" name '%s'\n", p->name);
|
|
|
|
g_printerr (" flags %d", p->flags);
|
|
|
|
g_printerr (", size %d\n", p->size);
|
|
|
|
g_printerr (" data '%.*s'\n",
|
2008-09-19 12:15:26 +00:00
|
|
|
p->size, (gchar *) p->data);
|
2006-10-16 01:08:54 +00:00
|
|
|
#endif
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (G_VALUE_TYPE (&value) == GIMP_TYPE_PDB_STATUS_TYPE)
|
|
|
|
{
|
2007-09-27 10:27:46 +00:00
|
|
|
return foreign_error (sc, "Procedure execution returned multiple status values", 0);
|
2019-08-12 20:11:45 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_snprintf (error_str, sizeof (error_str),
|
|
|
|
"Unknown return type %s",
|
|
|
|
g_type_name (G_VALUE_TYPE (value)));
|
|
|
|
return foreign_error (sc, error_str, 0);
|
2004-04-08 16:05:27 +00:00
|
|
|
}
|
|
|
|
}
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
case GIMP_PDB_PASS_THROUGH:
|
|
|
|
case GIMP_PDB_CANCEL: /* should we do something here? */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-09-19 12:15:26 +00:00
|
|
|
/* If we have no return value(s) from PDB call, return
|
|
|
|
* either TRUE or FALSE to indicate if call succeeded.
|
|
|
|
*/
|
2006-11-18 22:30:23 +00:00
|
|
|
if (return_val == sc->NIL)
|
|
|
|
{
|
2019-08-12 20:11:45 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (values, 0)) ==
|
|
|
|
GIMP_PDB_SUCCESS)
|
2008-09-19 12:15:26 +00:00
|
|
|
return_val = sc->vptr->cons (sc, sc->T, sc->NIL);
|
2006-11-18 22:30:23 +00:00
|
|
|
else
|
2008-09-19 12:15:26 +00:00
|
|
|
return_val = sc->vptr->cons (sc, sc->F, sc->NIL);
|
2006-11-18 22:30:23 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 22:00:16 +00:00
|
|
|
/* free the proc name */
|
|
|
|
g_free (proc_name);
|
|
|
|
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
/* free up the executed procedure return values */
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_array_unref (values);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* free up arguments and values */
|
2019-08-12 20:11:45 +02:00
|
|
|
gimp_value_array_unref (args);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
|
|
|
|
/* if we're in server mode, listen for additional commands for 10 ms */
|
|
|
|
if (script_fu_server_get_mode ())
|
|
|
|
script_fu_server_listen (10);
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_WIN32
|
|
|
|
/* This seems to help a lot on Windoze. */
|
|
|
|
while (gtk_events_pending ())
|
|
|
|
gtk_main_iteration ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return return_val;
|
2007-09-28 14:20:35 +00:00
|
|
|
}
|
|
|
|
|
plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure. This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.
Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time. We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:28:34 -04:00
|
|
|
static pointer
|
|
|
|
script_fu_marshal_procedure_call_strict (scheme *sc,
|
|
|
|
pointer a)
|
|
|
|
{
|
|
|
|
return script_fu_marshal_procedure_call (sc, a, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static pointer
|
|
|
|
script_fu_marshal_procedure_call_permissive (scheme *sc,
|
|
|
|
pointer a)
|
|
|
|
{
|
|
|
|
return script_fu_marshal_procedure_call (sc, a, TRUE);
|
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
static pointer
|
2008-09-09 14:22:44 +00:00
|
|
|
script_fu_register_call (scheme *sc,
|
|
|
|
pointer a)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
2008-09-11 18:00:18 +00:00
|
|
|
return script_fu_add_script (sc, a);
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
static pointer
|
2008-09-09 14:22:44 +00:00
|
|
|
script_fu_menu_register_call (scheme *sc,
|
|
|
|
pointer a)
|
2004-11-17 15:24:07 +00:00
|
|
|
{
|
2008-09-11 18:00:18 +00:00
|
|
|
return script_fu_add_menu (sc, a);
|
2004-11-17 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
static pointer
|
2008-09-09 14:22:44 +00:00
|
|
|
script_fu_quit_call (scheme *sc,
|
|
|
|
pointer a)
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
{
|
|
|
|
script_fu_server_quit ();
|
|
|
|
|
2006-10-16 01:08:54 +00:00
|
|
|
scheme_deinit (sc);
|
|
|
|
|
|
|
|
return sc->NIL;
|
new code to call the script_fuc_text_console pdb function. remove batch
2001-07-17 Mathieu Lacage <mathieu@gnome.org>
* app/batch.c: new code to call the script_fuc_text_console pdb function.
* app/main.c: (main): remove batch command code.
* plug-ins/script-fu/Makefile.am: add siod-wrapper.h/c
* plug-ins/script-fu/script-fu-console.c:
(script_fu_cc_key_function),
(script_fu_open_siod_console),
(script_fu_close_siod_console):
* plug-ins/script-fu/script-fu-scripts.h:
* plug-ins/script-fu/script-fu-server.c:
(script_fu_server_quit),
(script_fu_server_get_mode),
(execute_command):
Replace all direct calls to the scheme interpreter with calls to the siod-wrapper.
* plug-ins/script-fu/script-fu-console.h: remove run_eval.
* plug-ins/script-fu/script-fu-server.h:
* plug-ins/script-fu/script-fu-text-console.c:
(script_fu_text_console_run),
(read_command),
(script_fu_text_console_interface):
The actual new text console.
* plug-ins/script-fu/script-fu-text-console.h: header.
* plug-ins/script-fu/script-fu.c:
(script_fu_quit),
(script_fu_query),
(script_fu_run): rename to better words.
move most of the code to siod-wrapper.c/h
* plug-ins/script-fu/siod-wrapper.c:
(siod_get_output_file),
(siod_set_output_file),
(siod_get_verbose_level),
(siod_set_verbose_level),
(siod_print_welcome),
(siod_interpret_string),
(siod_get_error_msg),
(siod_get_success_msg),
(siod_init),
(init_procedures),
(init_constants),
(convert_string),
(sputs_fcn),
(lprin1s),
(marshall_proc_db_call),
(script_fu_register_call),
(script_fu_quit_call):
All the funcitons dealing with the internals of the scheme interpreter.
* plug-ins/script-fu/siod-wrapper.h: the header.
2001-07-17 22:53:21 +00:00
|
|
|
}
|
2008-09-11 18:00:18 +00:00
|
|
|
|
|
|
|
static pointer
|
|
|
|
script_fu_nil_call (scheme *sc,
|
|
|
|
pointer a)
|
|
|
|
{
|
|
|
|
return sc->NIL;
|
|
|
|
}
|