ScriptFu: build shared libgimp-scriptfu-3.0.so separate from executable script-fu

Changes are mostly to the dir structures and build system for ScriptFu.
Some changes to the outer plugin source to call the library.

Why: so that other executables (future gimp-scheme-interpreter,
or a future separated script-fu-server) can exist in separate directories,
and share the library in memory (when built shared.)

Whether the library is built shared and installed on its own
(versus static and not installed)
is a compile time option (both automake LibTool and meson abstract it away)
The default is shared and installed, say as libgimp-scriptfu-3.0.so.

Installed alongside other shared libraries (e.g. wherever libgimp is installed)
to simplify packaging.

A preliminary refactoring which helps enable MR gimp!647
This commit is contained in:
lloyd konneker 2022-05-29 15:48:51 -04:00
parent 9486334030
commit 5cc3becf16
63 changed files with 543 additions and 125 deletions

View File

@ -3151,10 +3151,11 @@ plug-ins/python/Makefile
plug-ins/python/python-console/Makefile
plug-ins/screenshot/Makefile
plug-ins/script-fu/Makefile
plug-ins/script-fu/ftx/Makefile
plug-ins/script-fu/libscriptfu/Makefile
plug-ins/script-fu/libscriptfu/ftx/Makefile
plug-ins/script-fu/libscriptfu/tinyscheme/Makefile
plug-ins/script-fu/scripts/Makefile
plug-ins/script-fu/scripts/images/Makefile
plug-ins/script-fu/tinyscheme/Makefile
plug-ins/selection-to-path/Makefile
plug-ins/twain/Makefile
plug-ins/common/Makefile

View File

@ -22,8 +22,8 @@ libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la $(libm)
libtinyscheme=tinyscheme/libtinyscheme.a $(libm)
libftx=ftx/libftx.a
# link to libscriptfu
libgimp_scriptfu = $(top_builddir)/plug-ins/script-fu/libscriptfu/libgimp-scriptfu-$(GIMP_API_VERSION).la
if HAVE_WINDRES
include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
@ -35,6 +35,8 @@ AM_CPPFLAGS = \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir) \
-I$(srcdir)/libscriptfu \
-DG_LOG_DOMAIN=\"scriptfu\" \
-DSTANDALONE=0 \
-DUSE_INTERFACE=1 \
-DUSE_STRLWR=0
@ -50,47 +52,28 @@ AM_LDFLAGS = \
$(framework_cocoa) \
$(xnone)
SUBDIRS = tinyscheme ftx scripts
SUBDIRS = libscriptfu scripts
libexecdir = $(gimpplugindir)/plug-ins/script-fu
libexec_PROGRAMS = script-fu
script_fu_SOURCES = \
script-fu-types.h \
script-fu-enums.h \
script-fu.c \
\
script-fu.c \
script-fu-console.c \
script-fu-console.h \
script-fu-eval.c \
script-fu-eval.h \
script-fu-interface.c \
script-fu-interface.h \
script-fu-text-console.h \
script-fu-text-console.c \
script-fu-intl.h \
script-fu-regex.c \
script-fu-regex.h \
script-fu-script.c \
script-fu-script.h \
script-fu-scripts.c \
script-fu-scripts.h \
script-fu-server.c \
script-fu-server.h \
script-fu-utils.c \
script-fu-utils.h \
script-fu-errors.c \
script-fu-errors.h \
script-fu-compat.c \
script-fu-compat.h \
scheme-marshal.c \
scheme-marshal.h \
scheme-wrapper.c \
scheme-wrapper.h
script-fu-console.c \
script-fu-console.h \
script-fu-eval.c \
script-fu-eval.h \
script-fu-text-console.h \
script-fu-text-console.c \
script-fu-server.c \
script-fu-server.h
LDADD = \
# link with libgimp-scriptfu and the usual gimp suspects
# LibTool will add rpath to private shared libgimp-scriptfu in gimppluginsdir/lib
script_fu_LDADD = \
$(libgimp_scriptfu) \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpconfig) \
@ -98,8 +81,6 @@ LDADD = \
$(libgimp) \
$(libgimpcolor) \
$(libgimpbase) \
$(libtinyscheme) \
$(libftx) \
$(GTK_LIBS) \
$(SOCKET_LIBS) \
$(WINSOCK_LIBS) \

View File

@ -0,0 +1,5 @@
/.deps
/Makefile.in
/Makefile
/libscriptfu.a
/libscriptfu*.so

View File

@ -0,0 +1,139 @@
## Process this file with automake to produce Makefile.in
# Derived from libgimp/Makefile.am and modules/Makefile.am
if PLATFORM_WIN32
no_undefined = -no-undefined
endif
if PLATFORM_OSX
xobjective_c = "-xobjective-c"
xobjective_cxx = "-xobjective-c++"
xnone = "-xnone"
framework_cocoa = -framework Cocoa
endif
if OS_WIN32
mwindows = -mwindows
else
libm = -lm
endif
if OS_WIN32
if HAVE_EXCHNDL
exchndl = -lexchndl
endif
scriptfu_def = script-fu.def
libgimp_scriptfu_export_symbols = -export-symbols $(srcdir)/script-fu.def
install-libtool-import-lib:
$(INSTALL) .libs/libgimp-scriptfu-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
$(INSTALL) $(srcdir)/script-fu.def $(DESTDIR)$(libdir)
uninstall-libtool-import-lib:
-rm $(DESTDIR)$(libdir)/libgimp-scriptfu-$(GIMP_API_VERSION).dll.a
-rm $(DESTDIR)$(libdir)/script-fu.def
else
install-libtool-import-lib:
uninstall-libtool-import-lib:
endif
if MS_LIB_AVAILABLE
noinst_DATA = gimp-scriptfu-$(GIMP_API_VERSION).lib
install-ms-lib:
$(INSTALL) gimp-scriptfu-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gimp-scriptfu-$(GIMP_API_VERSION).lib
gimp-scriptfu-@GIMP_API_VERSION@.lib: script-fu.def
lib -name:libgimp-scriptfu-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:script-fu.def -out:$@
else
install-ms-lib:
uninstall-ms-lib:
endif
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir) \
-DG_LOG_DOMAIN=\"scriptfu\" \
-DSTANDALONE=0 \
-DUSE_INTERFACE=1 \
-DUSE_STRLWR=0
AM_CFLAGS = \
$(xobjective_c)
AM_CXXFLAGS = \
$(xobjective_cxx)
AM_LDFLAGS = \
-version-info $(LT_VERSION_INFO) \
$(no_undefined) \
$(libgimp_scriptfu_export_symbols) \
$(mwindows) \
$(framework_cocoa) \
$(xnone)
# make convenience libraries
SUBDIRS = tinyscheme ftx
libtinyscheme = tinyscheme/libtinyscheme.la $(libm)
libftx = ftx/libftx.la
# FUTURE: install to private dir "lib" near other GIMP plugin executables
# Not doing this because it complicates packaging
# Instead, this library installs in same place as libgimp
# libdir = $(gimpplugindir)/lib
# Declare target, this library
lib_LTLIBRARIES = libgimp-scriptfu-@GIMP_API_VERSION@.la
# declare sources, independent of static versus shared
libgimp_scriptfu_@GIMP_API_VERSION@_la_SOURCES = \
script-fu-types.h \
script-fu-enums.h \
script-fu-interface.c \
script-fu-interface.h \
script-fu-intl.h \
script-fu-regex.c \
script-fu-regex.h \
script-fu-script.c \
script-fu-script.h \
script-fu-scripts.c \
script-fu-scripts.h \
script-fu-utils.c \
script-fu-utils.h \
script-fu-errors.c \
script-fu-errors.h \
script-fu-compat.c \
script-fu-compat.h \
scheme-marshal.c \
scheme-marshal.h \
scheme-wrapper.c \
scheme-wrapper.h \
script-fu-lib.c \
script-fu-lib.h
EXTRA_libgimp_scriptfu_@GIMP_API_VERSION@_la_DEPENDENCIES = $(scriptfu_def)
libgimp_scriptfu_@GIMP_API_VERSION@_la_LIBADD = \
$(libtinyscheme) \
$(libftx) \
$(exchndl)
# libgimp-scriptfu depends on many other libraries, but we don't declare deps
# until exist more than just the script-fu executable using the lib
EXTRA_DIST = \
script-fu.def
install-data-local: install-ms-lib install-libtool-import-lib
uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib

View File

@ -0,0 +1,45 @@
About libscriptfu
libscriptfu is part of GIMP.
It is not generally useful except by GIMP.
The libscriptfu library is used by plugin executables,
and the PDB procedures they create,
all part of the "ScriptFu" machinery.
The libscriptfu library is not intended for third-party developers,
only for core GIMP developers.
Headers for libscriptfu might not be installed.
This directory contains three libraries: libscriptfu, tinyscheme, and ftx.
The tinyscheme library contains a TinyScheme interpreter.
The ftx library extends the TinyScheme interpreter,
adding file functions to the Scheme language.
The libscriptfu library contains both the tinyscheme and ftx libraries.
The libscriptfu library wraps the TinyScheme interpreter,
specializing it for GIMP.
The script-fu executable uses the libscriptfu library,
to interpret Scheme scripts that GIMP users refer to as "plug-ins."
These libraries depend on other libraries, e.g. math, libgimp, glib, etc.
Coupling between the executables and the libraries should be in one direction:
source for the inner libs should not include headers from the outer executables.
This lets you more easily update the inner libraries
(which originated elsewhere and might be maintained elsewhere),
and change the outer executables
(which are subject to change by GIMP developers.)
Example (which may change):
The script-fu executable is a plugin file that implements PDB procedures:
extension-script-fu, script-fu-console, script-fu-text-console, script-fu-eval,
and script-fu-server.
Each of those PDB procedures runs as a separate process.
Each of those processes uses libscriptfu.
The main PDB procedure is extension-script-fu, which is a long-lived process.
It is a PDB procedure of PDBProcedureType EXTENSION.
It interprets the Scheme scripts that user's call "plug-ins."
Rarely two of the PDB procedure processes run concurrently.
When they do, and libscriptfu is built as a shared library,
the read-only, code portion of the library is only loaded in memory once.

View File

@ -5,9 +5,10 @@ AM_CFLAGS = \
-I$(srcdir)/.. \
$(GLIB_CFLAGS)
noinst_LIBRARIES = libftx.a
# Is "libtool convenience" not installed and not versioned
noinst_LTLIBRARIES = libftx.la
libftx_a_SOURCES = ftx.c ftx.h
libftx_la_SOURCES = ftx.c ftx.h
EXTRA_DIST = \
LICENSE \

View File

@ -1,7 +1,7 @@
scriptfu_ftx = static_library('scriptfu-ftx',
'ftx.c',
include_directories: [ rootInclude, scriptfu_incdir, ],
include_directories: [ rootInclude, libscriptfuInclude, ],
dependencies: [
glib,
],

View File

@ -0,0 +1,59 @@
libscriptfuInclude = include_directories('.')
subdir('tinyscheme')
subdir('ftx')
libscriptfu_sources = [
'scheme-wrapper.c',
'scheme-marshal.c',
'script-fu-interface.c',
'script-fu-regex.c',
'script-fu-script.c',
'script-fu-scripts.c',
'script-fu-utils.c',
'script-fu-errors.c',
'script-fu-compat.c',
'script-fu-lib.c',
]
# !! just "library(...)" which means shared versus static depends on configuration of project.
# Meson defaults to shared, but you can reconfigure to static.
# This library is not generally useful except by core GIMP developers.
# Dependencies:
# libscriptfu uses Gtk (which libgimpui_dep references)
# FUTURE: libscriptfu should use libgimpui but not Gtk directly
# libscriptfu does not use sockets (unlike the outer script-fu or script-fu-server)
# link_whole means the entire ftx and tinyscheme static libraries are in
# this library, whether or not they are used (see meson docs.)
# FUTURE: install private to gimp, in 'lib' subdir parallel to 'modules' subdir
# Not doing this because it complicates packaging
# Instead, this library installs in same place as libgimp
# install_dir: gimpplugindir / 'lib',
libscriptfu = library('gimp-scriptfu-'+ gimp_api_version,
libscriptfu_sources,
include_directories: [
rootInclude,
appInclude,
],
c_args: [
'-DG_LOG_DOMAIN="scriptfu"',
'-DSTANDALONE=0',
'-DUSE_INTERFACE=1',
'-DUSE_STRLWR=0',
],
dependencies: [
libgimpui_dep,
math,
],
link_whole: [
scriptfu_tinyscheme,
scriptfu_ftx,
],
vs_module_defs: 'script-fu.def',
version: so_version,
install: true,
)

View File

@ -36,7 +36,6 @@
#include "script-fu-types.h"
#include "script-fu-console.h"
#include "script-fu-interface.h"
#include "script-fu-regex.h"
#include "script-fu-scripts.h"

View File

@ -0,0 +1,141 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <libgimp/gimp.h>
/* FIXME script-fu-types.h refers to GtkAdjustment. */
#include <libgimp/gimpui.h>
#include "script-fu-lib.h"
#include "script-fu-types.h" /* SFScript */
#include "scheme-wrapper.h" /* tinyscheme_init etc, */
#include "script-fu-scripts.h" /* script_fu_find_scripts */
#include "script-fu-interface.h" /* script_fu_interface_is_active */
/*
* The purpose here is a small, clean API to the exported functions of the library,
* hiding internal types of the library
* and hiding functions not static but not exported.
*
* Some are simple delegation to scheme_wrapper functions,
* but others adapt
* and some call functions not in scheme_wrapper.c
*/
/*
* Return whether extension-script-fu has an open dialog.
* extension-script-fu is a single process.
* It cannot have concurrent dialogs open in the GIMP app.
*
* Other plugins implementing PLUGIN type PDB procedures
* in their own process (e.g. gimp-scheme-interpreter) do not need this.
*/
gboolean
script_fu_extension_is_busy (void)
{
return script_fu_interface_is_active ();
}
/*
* Find files at given paths, load them into the interpreter,
* and register them as PDB procs of type TEMPORARY,
* owned by the PDB proc of type PLUGIN for the given plugin.
*/
void
script_fu_find_and_register_scripts ( GimpPlugIn *plugin,
GList *paths)
{
script_fu_find_scripts (plugin, paths);
}
void
script_fu_init_embedded_interpreter ( GList *paths,
gboolean allow_register,
GimpRunMode run_mode)
{
tinyscheme_init (paths, allow_register);
ts_set_run_mode (run_mode);
}
void
script_fu_set_print_flag (gboolean should_print)
{
ts_set_print_flag (should_print);
}
/*
* Make tinyscheme begin writing output to given gstring.
*/
void
script_fu_redirect_output_to_gstr (GString *output)
{
ts_register_output_func (ts_gstring_output_func, output);
}
void
script_fu_redirect_output_to_stdout (void)
{
ts_register_output_func (ts_stdout_output_func, NULL);
}
void
script_fu_print_welcome (void)
{
ts_print_welcome ();
}
gboolean
script_fu_interpret_string (const gchar *text)
{
/*converting from enum to boolean */
return (gboolean) ts_interpret_string (text);
}
void
script_fu_set_run_mode (GimpRunMode run_mode)
{
ts_set_run_mode (run_mode);
}
const gchar *
script_fu_get_success_msg (void)
{
return ts_get_success_msg ();
}
void
script_fu_run_read_eval_print_loop (void)
{
ts_interpret_stdin ();
}
void
script_fu_register_quit_callback (void (*func) (void))
{
ts_register_quit_callback (func);
}
void
script_fu_register_post_command_callback (void (*func) (void))
{
ts_register_post_command_callback (func);
}

View File

@ -0,0 +1,44 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __SCRIPT_FU_LIB_H__
#define __SCRIPT_FU_LIB_H__
gboolean script_fu_extension_is_busy (void);
void script_fu_find_and_register_scripts (GimpPlugIn *plugin,
GList *paths);
void script_fu_set_run_mode (GimpRunMode run_mode);
void script_fu_init_embedded_interpreter (GList *paths,
gboolean allow_register,
GimpRunMode run_mode);
void script_fu_set_print_flag (gboolean should_print);
void script_fu_redirect_output_to_gstr (GString *output);
void script_fu_redirect_output_to_stdout (void);
void script_fu_print_welcome (void);
gboolean script_fu_interpret_string (const gchar *text);
const gchar *script_fu_get_success_msg (void);
void script_fu_run_read_eval_print_loop (void);
void script_fu_register_quit_callback (void (*func) (void));
void script_fu_register_post_command_callback (void (*func) (void));
#endif /* __SCRIPT_FU_LIB_H__ */

View File

@ -0,0 +1,14 @@
EXPORTS
script_fu_extension_is_busy
script_fu_find_and_register_scripts
script_fu_set_run_mode
script_fu_init_embedded_interpreter
script_fu_set_print_flag
script_fu_redirect_output_to_gstr
script_fu_redirect_output_to_stdout
script_fu_print_welcome
script_fu_interpret_string
script_fu_get_success_msg
script_fu_run_read_eval_print_loop
script_fu_register_quit_callback
script_fu_register_post_command_callback

View File

@ -9,9 +9,10 @@ AM_CFLAGS = \
-I$(top_srcdir) \
$(GLIB_CFLAGS)
noinst_LIBRARIES = libtinyscheme.a
# Is "libtool convenience" not installed and not versioned
noinst_LTLIBRARIES = libtinyscheme.la
libtinyscheme_a_SOURCES = \
libtinyscheme_la_SOURCES = \
scheme.c \
opdefines.h \
scheme-private.h \

View File

@ -1,4 +1,6 @@
# No include_directories('.') here; use libscriptfuInclude
scriptfu_tinyscheme = static_library('scriptfu-tinyscheme',
'scheme.c',
include_directories: [ rootInclude, ],

View File

@ -1,34 +1,33 @@
scriptfu_incdir = include_directories('.')
subdir('tinyscheme')
subdir('ftx')
# Build the one executable that defines five PDB procs.
# The executable is not versioned since installed private in /plug-ins
# Not define include_directories; no higher gimp source references scriptfu
subdir('libscriptfu')
subdir('scripts')
plugin_name = 'script-fu'
executable_name = 'script-fu'
# script-fu.c registers registers many PDB procs in the PDB.
# Four source files implement the PDB procedures of type PLUGIN, of similar names.
# script-fu.c also implements PDB procedure of type EXTENSION "extension-script-fu"
plugin_sources = [
'scheme-wrapper.c',
'scheme-marshal.c',
'script-fu-console.c',
'script-fu-eval.c',
'script-fu-interface.c',
'script-fu-regex.c',
'script-fu-script.c',
'script-fu-scripts.c',
'script-fu-server.c',
'script-fu-text-console.c',
'script-fu-utils.c',
'script-fu.c',
'script-fu-errors.c',
'script-fu-compat.c'
]
if platform_windows
plugin_sources += windows.compile_resources(
gimp_plugins_rc,
args: [
'--define', 'ORIGINALFILENAME_STR="@0@"'.format(plugin_name+'.exe'),
'--define', 'INTERNALNAME_STR="@0@"' .format(plugin_name),
'--define', 'ORIGINALFILENAME_STR="@0@"'.format(executable_name+'.exe'),
'--define', 'INTERNALNAME_STR="@0@"' .format(executable_name),
'--define', 'TOP_SRCDIR="@0@"' .format(meson.source_root()),
],
include_directories: [
@ -37,22 +36,29 @@ if platform_windows
)
endif
executable(plugin_name,
# Several components use Gtk
# script-fu-server uses sockets
# libscriptfu is installed to standard place; no rpath necessary
executable(executable_name,
plugin_sources,
libscriptfu,
dependencies: [
libgimpui_dep,
math,
winsock,
],
c_args: [
'-DG_LOG_DOMAIN="scriptfu"',
'-DSTANDALONE=0',
'-DUSE_INTERFACE=1',
'-DUSE_STRLWR=0',
],
link_whole: [
scriptfu_tinyscheme,
scriptfu_ftx,
include_directories: [
libscriptfuInclude,
],
link_with : libscriptfu,
install: true,
install_dir: gimpplugindir / 'plug-ins' / plugin_name,
install_dir: gimpplugindir / 'plug-ins' / executable_name,
)

View File

@ -27,9 +27,9 @@
#include <gdk/gdkkeysyms.h>
#include "scheme-wrapper.h"
#include "script-fu-console.h"
#include "script-fu-lib.h"
#include "script-fu-intl.h"
@ -82,7 +82,7 @@ static gboolean script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event,
ConsoleInterface *console);
static void script_fu_output_to_console (TsOutputType type,
static void script_fu_output_to_console (gboolean is_error,
const gchar *text,
gint len,
gpointer user_data);
@ -101,7 +101,7 @@ script_fu_console_run (GimpProcedure *procedure,
GtkWidget *scrolled_window;
GtkWidget *hbox;
ts_set_print_flag (1);
script_fu_set_print_flag (1);
gimp_ui_init ("script-fu");
@ -473,7 +473,7 @@ script_fu_console_scroll_end (GtkWidget *view)
}
static void
script_fu_output_to_console (TsOutputType type,
script_fu_output_to_console (gboolean is_error_msg,
const gchar *text,
gint len,
gpointer user_data)
@ -489,7 +489,7 @@ script_fu_output_to_console (TsOutputType type,
gtk_text_buffer_get_end_iter (buffer, &cursor);
if (type == TS_OUTPUT_NORMAL)
if (! is_error_msg)
{
gtk_text_buffer_insert (buffer, &cursor, text, len);
}
@ -532,6 +532,7 @@ script_fu_cc_key_function (GtkWidget *widget,
gint direction = 0;
GtkTextIter cursor;
GString *output;
gboolean is_error;
switch (event->keyval)
{
@ -566,25 +567,17 @@ script_fu_cc_key_function (GtkWidget *widget,
gtk_entry_set_text (GTK_ENTRY (console->cc), "");
output = g_string_new (NULL);
ts_register_output_func (ts_gstring_output_func, output);
script_fu_redirect_output_to_gstr (output);
gimp_plug_in_set_pdb_error_handler (gimp_get_plug_in (),
GIMP_PDB_ERROR_HANDLER_PLUGIN);
if (ts_interpret_string (list->data) != 0)
{
script_fu_output_to_console (TS_OUTPUT_ERROR,
output->str,
output->len,
console);
}
else
{
script_fu_output_to_console (TS_OUTPUT_NORMAL,
output->str,
output->len,
console);
}
is_error = script_fu_interpret_string (list->data);
script_fu_output_to_console (is_error,
output->str,
output->len,
console);
gimp_plug_in_set_pdb_error_handler (gimp_get_plug_in (),
GIMP_PDB_ERROR_HANDLER_INTERNAL);

View File

@ -19,9 +19,9 @@
#include "libgimp/gimp.h"
#include "scheme-wrapper.h"
#include "script-fu-eval.h"
#include "script-fu-lib.h"
#include "script-fu-intl.h"
@ -34,13 +34,13 @@ script_fu_eval_run (GimpProcedure *procedure,
GString *output = g_string_new (NULL);
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
ts_set_run_mode (run_mode);
ts_register_output_func (ts_gstring_output_func, output);
script_fu_set_run_mode (run_mode);
script_fu_redirect_output_to_gstr (output);
switch (run_mode)
{
case GIMP_RUN_NONINTERACTIVE:
if (ts_interpret_string (code) != 0)
if (script_fu_interpret_string (code) != 0)
status = GIMP_PDB_EXECUTION_ERROR;
break;

View File

@ -97,8 +97,8 @@ typedef short sa_family_t; /* Not defined by winsock */
#include "libgimp/gimpui.h"
#include "script-fu-intl.h"
#include "script-fu-lib.h"
#include "scheme-wrapper.h"
#include "script-fu-server.h"
#ifdef G_OS_WIN32
@ -284,11 +284,11 @@ script_fu_server_run (GimpProcedure *procedure,
port = GIMP_VALUES_GET_INT (args, 2);
logfile = GIMP_VALUES_GET_STRING (args, 3);
ts_set_run_mode (run_mode);
ts_set_print_flag (1);
script_fu_set_run_mode (run_mode);
script_fu_set_print_flag (1);
ts_register_quit_callback (script_fu_server_quit);
ts_register_post_command_callback (script_fu_server_post_command);
script_fu_register_quit_callback (script_fu_server_quit);
script_fu_register_post_command_callback (script_fu_server_post_command);
switch (run_mode)
{
@ -603,10 +603,10 @@ execute_command (SFCommand *cmd)
timer = g_timer_new ();
response = g_string_new (NULL);
ts_register_output_func (ts_gstring_output_func, response);
script_fu_redirect_output_to_gstr (response);
/* run the command */
if (ts_interpret_string (cmd->command) != 0)
if (script_fu_interpret_string (cmd->command) != 0)
{
error = TRUE;
@ -617,7 +617,7 @@ execute_command (SFCommand *cmd)
error = FALSE;
if (response->len == 0)
g_string_assign (response, ts_get_success_msg ());
g_string_assign (response, script_fu_get_success_msg ());
total_time = g_timer_elapsed (timer, NULL);
time (&clocknow);

View File

@ -26,25 +26,23 @@
#include "libgimp/gimp.h"
#include "scheme-wrapper.h"
#include "script-fu-text-console.h"
#include "script-fu-intl.h"
#include "script-fu-lib.h"
GimpValueArray *
script_fu_text_console_run (GimpProcedure *procedure,
const GimpValueArray *args)
{
/* Enable Script-Fu output */
ts_register_output_func (ts_stdout_output_func, NULL);
script_fu_redirect_output_to_stdout ();
ts_print_welcome ();
script_fu_print_welcome ();
gimp_plug_in_set_pdb_error_handler (gimp_procedure_get_plug_in (procedure),
GIMP_PDB_ERROR_HANDLER_PLUGIN);
/* Run the interface */
ts_interpret_stdin ();
script_fu_run_read_eval_print_loop ();
gimp_plug_in_set_pdb_error_handler (gimp_procedure_get_plug_in (procedure),
GIMP_PDB_ERROR_HANDLER_INTERNAL);

View File

@ -20,22 +20,14 @@
#include <string.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "tinyscheme/scheme.h"
#include "script-fu-types.h"
#include "script-fu-console.h"
#include "script-fu-eval.h"
#include "script-fu-interface.h"
#include "script-fu-scripts.h"
#include "script-fu-server.h"
#include "script-fu-text-console.h"
#include "scheme-wrapper.h"
#include "script-fu-intl.h"
#include "libscriptfu/script-fu-lib.h"
#include "libscriptfu/script-fu-intl.h"
typedef struct _ScriptFu ScriptFu;
@ -371,19 +363,16 @@ script_fu_run_init (GimpProcedure *procedure,
/* Setup auxiliary temporary procedures for the base extension */
script_fu_extension_init (plug_in);
/* Init the interpreter and register scripts */
tinyscheme_init (path, TRUE);
/* Init the interpreter, allow register scripts */
script_fu_init_embedded_interpreter (path, TRUE, run_mode);
}
else
{
/* Init the interpreter */
tinyscheme_init (path, FALSE);
/* Init the interpreter, not allow register scripts */
script_fu_init_embedded_interpreter (path, FALSE, run_mode);
}
ts_set_run_mode (run_mode);
/* Load all of the available scripts */
script_fu_find_scripts (plug_in, path);
script_fu_find_and_register_scripts (plug_in, path);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
}
@ -479,7 +468,7 @@ script_fu_refresh_proc (GimpProcedure *procedure,
const GimpValueArray *args,
gpointer run_data)
{
if (script_fu_interface_is_active ())
if (script_fu_extension_is_busy ())
{
g_message (_("You can not use \"Refresh Scripts\" while a "
"Script-Fu dialog box is open. Please close "
@ -494,7 +483,7 @@ script_fu_refresh_proc (GimpProcedure *procedure,
/* Reload all of the available scripts */
GList *path = script_fu_search_path ();
script_fu_find_scripts (gimp_procedure_get_plug_in (procedure), path);
script_fu_find_and_register_scripts (gimp_procedure_get_plug_in (procedure), path);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
}

View File

@ -6,9 +6,9 @@
plug-ins/script-fu/script-fu.c
plug-ins/script-fu/script-fu-console.c
plug-ins/script-fu/script-fu-eval.c
plug-ins/script-fu/script-fu-interface.c
plug-ins/script-fu/script-fu-scripts.c
plug-ins/script-fu/script-fu-server.c
plug-ins/script-fu/libscriptfu/script-fu-interface.c
plug-ins/script-fu/libscriptfu/script-fu-scripts.c
plug-ins/script-fu/script-fu-text-console.c
plug-ins/script-fu/scripts/add-bevel.scm
plug-ins/script-fu/scripts/addborder.scm