[gimp] ScriptFu: build shared libgimp-scriptfu-3.0.so separate from executable script-fu
- From: Lloyd Konneker <lkonneker src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] ScriptFu: build shared libgimp-scriptfu-3.0.so separate from executable script-fu
- Date: Sun, 12 Jun 2022 10:57:28 +0000 (UTC)
commit 5cc3becf16d04ace47d29c0675360a3642c86bc2
Author: lloyd konneker <konnekerl gmail com>
Date: Sun May 29 15:48:51 2022 -0400
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
configure.ac | 5 +-
plug-ins/script-fu/Makefile.am | 57 +++------
plug-ins/script-fu/libscriptfu/.gitignore | 5 +
plug-ins/script-fu/libscriptfu/Makefile.am | 139 ++++++++++++++++++++
plug-ins/script-fu/libscriptfu/README | 45 +++++++
.../script-fu/{ => libscriptfu}/ftx/.gitignore | 0
plug-ins/script-fu/{ => libscriptfu}/ftx/LICENSE | 0
.../script-fu/{ => libscriptfu}/ftx/Makefile.am | 5 +-
plug-ins/script-fu/{ => libscriptfu}/ftx/README | 0
.../{ => libscriptfu}/ftx/ftx-functions.txt | 0
plug-ins/script-fu/{ => libscriptfu}/ftx/ftx.c | 0
plug-ins/script-fu/{ => libscriptfu}/ftx/ftx.h | 0
.../script-fu/{ => libscriptfu}/ftx/listhome.scm | 0
.../script-fu/{ => libscriptfu}/ftx/meson.build | 2 +-
plug-ins/script-fu/libscriptfu/meson.build | 59 +++++++++
.../script-fu/{ => libscriptfu}/scheme-marshal.c | 0
.../script-fu/{ => libscriptfu}/scheme-marshal.h | 0
.../script-fu/{ => libscriptfu}/scheme-wrapper.c | 1 -
.../script-fu/{ => libscriptfu}/scheme-wrapper.h | 0
.../script-fu/{ => libscriptfu}/script-fu-compat.c | 0
.../script-fu/{ => libscriptfu}/script-fu-compat.h | 0
.../script-fu/{ => libscriptfu}/script-fu-enums.h | 0
.../script-fu/{ => libscriptfu}/script-fu-errors.c | 0
.../script-fu/{ => libscriptfu}/script-fu-errors.h | 0
.../{ => libscriptfu}/script-fu-interface.c | 0
.../{ => libscriptfu}/script-fu-interface.h | 0
.../script-fu/{ => libscriptfu}/script-fu-intl.h | 0
plug-ins/script-fu/libscriptfu/script-fu-lib.c | 141 +++++++++++++++++++++
plug-ins/script-fu/libscriptfu/script-fu-lib.h | 44 +++++++
.../script-fu/{ => libscriptfu}/script-fu-regex.c | 0
.../script-fu/{ => libscriptfu}/script-fu-regex.h | 0
.../script-fu/{ => libscriptfu}/script-fu-script.c | 0
.../script-fu/{ => libscriptfu}/script-fu-script.h | 0
.../{ => libscriptfu}/script-fu-scripts.c | 0
.../{ => libscriptfu}/script-fu-scripts.h | 0
.../script-fu/{ => libscriptfu}/script-fu-types.h | 0
.../script-fu/{ => libscriptfu}/script-fu-utils.c | 0
.../script-fu/{ => libscriptfu}/script-fu-utils.h | 0
plug-ins/script-fu/libscriptfu/script-fu.def | 14 ++
.../{ => libscriptfu}/tinyscheme/.gitignore | 0
.../{ => libscriptfu}/tinyscheme/BUILDING | 0
.../script-fu/{ => libscriptfu}/tinyscheme/CHANGES | 0
.../script-fu/{ => libscriptfu}/tinyscheme/COPYING | 0
.../{ => libscriptfu}/tinyscheme/Makefile.am | 5 +-
.../{ => libscriptfu}/tinyscheme/Manual.txt | 0
.../tinyscheme/MiniSCHEMETribute.txt | 0
.../script-fu/{ => libscriptfu}/tinyscheme/README | 0
.../{ => libscriptfu}/tinyscheme/dynload.c | 0
.../{ => libscriptfu}/tinyscheme/dynload.h | 0
.../{ => libscriptfu}/tinyscheme/hack.txt | 0
.../{ => libscriptfu}/tinyscheme/init.scm | 0
.../{ => libscriptfu}/tinyscheme/meson.build | 2 +
.../{ => libscriptfu}/tinyscheme/opdefines.h | 0
.../{ => libscriptfu}/tinyscheme/scheme-private.h | 0
.../{ => libscriptfu}/tinyscheme/scheme.c | 0
.../{ => libscriptfu}/tinyscheme/scheme.h | 0
plug-ins/script-fu/meson.build | 46 ++++---
plug-ins/script-fu/script-fu-console.c | 33 ++---
plug-ins/script-fu/script-fu-eval.c | 8 +-
plug-ins/script-fu/script-fu-server.c | 16 +--
plug-ins/script-fu/script-fu-text-console.c | 10 +-
plug-ins/script-fu/script-fu.c | 29 ++---
po-script-fu/POTFILES.in | 4 +-
63 files changed, 544 insertions(+), 126 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 67bca33170..6b49d84b5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/plug-ins/script-fu/Makefile.am b/plug-ins/script-fu/Makefile.am
index bc5e0f829b..ed978ddaa4 100644
--- a/plug-ins/script-fu/Makefile.am
+++ b/plug-ins/script-fu/Makefile.am
@@ -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
-
-LDADD = \
+ 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
+
+# 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) \
diff --git a/plug-ins/script-fu/libscriptfu/.gitignore b/plug-ins/script-fu/libscriptfu/.gitignore
new file mode 100644
index 0000000000..aaccc7a5bb
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/.gitignore
@@ -0,0 +1,5 @@
+/.deps
+/Makefile.in
+/Makefile
+/libscriptfu.a
+/libscriptfu*.so
diff --git a/plug-ins/script-fu/libscriptfu/Makefile.am b/plug-ins/script-fu/libscriptfu/Makefile.am
new file mode 100644
index 0000000000..4f8c329a4f
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/Makefile.am
@@ -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
diff --git a/plug-ins/script-fu/libscriptfu/README b/plug-ins/script-fu/libscriptfu/README
new file mode 100644
index 0000000000..090bce27cd
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/README
@@ -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.
diff --git a/plug-ins/script-fu/ftx/.gitignore b/plug-ins/script-fu/libscriptfu/ftx/.gitignore
similarity index 100%
rename from plug-ins/script-fu/ftx/.gitignore
rename to plug-ins/script-fu/libscriptfu/ftx/.gitignore
diff --git a/plug-ins/script-fu/ftx/LICENSE b/plug-ins/script-fu/libscriptfu/ftx/LICENSE
similarity index 100%
rename from plug-ins/script-fu/ftx/LICENSE
rename to plug-ins/script-fu/libscriptfu/ftx/LICENSE
diff --git a/plug-ins/script-fu/ftx/Makefile.am b/plug-ins/script-fu/libscriptfu/ftx/Makefile.am
similarity index 62%
rename from plug-ins/script-fu/ftx/Makefile.am
rename to plug-ins/script-fu/libscriptfu/ftx/Makefile.am
index 46537bf266..f55048d34b 100644
--- a/plug-ins/script-fu/ftx/Makefile.am
+++ b/plug-ins/script-fu/libscriptfu/ftx/Makefile.am
@@ -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 \
diff --git a/plug-ins/script-fu/ftx/README b/plug-ins/script-fu/libscriptfu/ftx/README
similarity index 100%
rename from plug-ins/script-fu/ftx/README
rename to plug-ins/script-fu/libscriptfu/ftx/README
diff --git a/plug-ins/script-fu/ftx/ftx-functions.txt b/plug-ins/script-fu/libscriptfu/ftx/ftx-functions.txt
similarity index 100%
rename from plug-ins/script-fu/ftx/ftx-functions.txt
rename to plug-ins/script-fu/libscriptfu/ftx/ftx-functions.txt
diff --git a/plug-ins/script-fu/ftx/ftx.c b/plug-ins/script-fu/libscriptfu/ftx/ftx.c
similarity index 100%
rename from plug-ins/script-fu/ftx/ftx.c
rename to plug-ins/script-fu/libscriptfu/ftx/ftx.c
diff --git a/plug-ins/script-fu/ftx/ftx.h b/plug-ins/script-fu/libscriptfu/ftx/ftx.h
similarity index 100%
rename from plug-ins/script-fu/ftx/ftx.h
rename to plug-ins/script-fu/libscriptfu/ftx/ftx.h
diff --git a/plug-ins/script-fu/ftx/listhome.scm b/plug-ins/script-fu/libscriptfu/ftx/listhome.scm
similarity index 100%
rename from plug-ins/script-fu/ftx/listhome.scm
rename to plug-ins/script-fu/libscriptfu/ftx/listhome.scm
diff --git a/plug-ins/script-fu/ftx/meson.build b/plug-ins/script-fu/libscriptfu/ftx/meson.build
similarity index 71%
rename from plug-ins/script-fu/ftx/meson.build
rename to plug-ins/script-fu/libscriptfu/ftx/meson.build
index b5117c784e..091b733b5a 100644
--- a/plug-ins/script-fu/ftx/meson.build
+++ b/plug-ins/script-fu/libscriptfu/ftx/meson.build
@@ -1,7 +1,7 @@
scriptfu_ftx = static_library('scriptfu-ftx',
'ftx.c',
- include_directories: [ rootInclude, scriptfu_incdir, ],
+ include_directories: [ rootInclude, libscriptfuInclude, ],
dependencies: [
glib,
],
diff --git a/plug-ins/script-fu/libscriptfu/meson.build b/plug-ins/script-fu/libscriptfu/meson.build
new file mode 100644
index 0000000000..a7f1ecf03a
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/meson.build
@@ -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,
+)
diff --git a/plug-ins/script-fu/scheme-marshal.c b/plug-ins/script-fu/libscriptfu/scheme-marshal.c
similarity index 100%
rename from plug-ins/script-fu/scheme-marshal.c
rename to plug-ins/script-fu/libscriptfu/scheme-marshal.c
diff --git a/plug-ins/script-fu/scheme-marshal.h b/plug-ins/script-fu/libscriptfu/scheme-marshal.h
similarity index 100%
rename from plug-ins/script-fu/scheme-marshal.h
rename to plug-ins/script-fu/libscriptfu/scheme-marshal.h
diff --git a/plug-ins/script-fu/scheme-wrapper.c b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c
similarity index 99%
rename from plug-ins/script-fu/scheme-wrapper.c
rename to plug-ins/script-fu/libscriptfu/scheme-wrapper.c
index 1e2d6c13f8..5cc2d5605c 100644
--- a/plug-ins/script-fu/scheme-wrapper.c
+++ b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c
@@ -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"
diff --git a/plug-ins/script-fu/scheme-wrapper.h b/plug-ins/script-fu/libscriptfu/scheme-wrapper.h
similarity index 100%
rename from plug-ins/script-fu/scheme-wrapper.h
rename to plug-ins/script-fu/libscriptfu/scheme-wrapper.h
diff --git a/plug-ins/script-fu/script-fu-compat.c b/plug-ins/script-fu/libscriptfu/script-fu-compat.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-compat.c
rename to plug-ins/script-fu/libscriptfu/script-fu-compat.c
diff --git a/plug-ins/script-fu/script-fu-compat.h b/plug-ins/script-fu/libscriptfu/script-fu-compat.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-compat.h
rename to plug-ins/script-fu/libscriptfu/script-fu-compat.h
diff --git a/plug-ins/script-fu/script-fu-enums.h b/plug-ins/script-fu/libscriptfu/script-fu-enums.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-enums.h
rename to plug-ins/script-fu/libscriptfu/script-fu-enums.h
diff --git a/plug-ins/script-fu/script-fu-errors.c b/plug-ins/script-fu/libscriptfu/script-fu-errors.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-errors.c
rename to plug-ins/script-fu/libscriptfu/script-fu-errors.c
diff --git a/plug-ins/script-fu/script-fu-errors.h b/plug-ins/script-fu/libscriptfu/script-fu-errors.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-errors.h
rename to plug-ins/script-fu/libscriptfu/script-fu-errors.h
diff --git a/plug-ins/script-fu/script-fu-interface.c b/plug-ins/script-fu/libscriptfu/script-fu-interface.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-interface.c
rename to plug-ins/script-fu/libscriptfu/script-fu-interface.c
diff --git a/plug-ins/script-fu/script-fu-interface.h b/plug-ins/script-fu/libscriptfu/script-fu-interface.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-interface.h
rename to plug-ins/script-fu/libscriptfu/script-fu-interface.h
diff --git a/plug-ins/script-fu/script-fu-intl.h b/plug-ins/script-fu/libscriptfu/script-fu-intl.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-intl.h
rename to plug-ins/script-fu/libscriptfu/script-fu-intl.h
diff --git a/plug-ins/script-fu/libscriptfu/script-fu-lib.c b/plug-ins/script-fu/libscriptfu/script-fu-lib.c
new file mode 100644
index 0000000000..2685c7cbb7
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/script-fu-lib.c
@@ -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);
+}
diff --git a/plug-ins/script-fu/libscriptfu/script-fu-lib.h b/plug-ins/script-fu/libscriptfu/script-fu-lib.h
new file mode 100644
index 0000000000..1a22f04e3c
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/script-fu-lib.h
@@ -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__ */
diff --git a/plug-ins/script-fu/script-fu-regex.c b/plug-ins/script-fu/libscriptfu/script-fu-regex.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-regex.c
rename to plug-ins/script-fu/libscriptfu/script-fu-regex.c
diff --git a/plug-ins/script-fu/script-fu-regex.h b/plug-ins/script-fu/libscriptfu/script-fu-regex.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-regex.h
rename to plug-ins/script-fu/libscriptfu/script-fu-regex.h
diff --git a/plug-ins/script-fu/script-fu-script.c b/plug-ins/script-fu/libscriptfu/script-fu-script.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-script.c
rename to plug-ins/script-fu/libscriptfu/script-fu-script.c
diff --git a/plug-ins/script-fu/script-fu-script.h b/plug-ins/script-fu/libscriptfu/script-fu-script.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-script.h
rename to plug-ins/script-fu/libscriptfu/script-fu-script.h
diff --git a/plug-ins/script-fu/script-fu-scripts.c b/plug-ins/script-fu/libscriptfu/script-fu-scripts.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-scripts.c
rename to plug-ins/script-fu/libscriptfu/script-fu-scripts.c
diff --git a/plug-ins/script-fu/script-fu-scripts.h b/plug-ins/script-fu/libscriptfu/script-fu-scripts.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-scripts.h
rename to plug-ins/script-fu/libscriptfu/script-fu-scripts.h
diff --git a/plug-ins/script-fu/script-fu-types.h b/plug-ins/script-fu/libscriptfu/script-fu-types.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-types.h
rename to plug-ins/script-fu/libscriptfu/script-fu-types.h
diff --git a/plug-ins/script-fu/script-fu-utils.c b/plug-ins/script-fu/libscriptfu/script-fu-utils.c
similarity index 100%
rename from plug-ins/script-fu/script-fu-utils.c
rename to plug-ins/script-fu/libscriptfu/script-fu-utils.c
diff --git a/plug-ins/script-fu/script-fu-utils.h b/plug-ins/script-fu/libscriptfu/script-fu-utils.h
similarity index 100%
rename from plug-ins/script-fu/script-fu-utils.h
rename to plug-ins/script-fu/libscriptfu/script-fu-utils.h
diff --git a/plug-ins/script-fu/libscriptfu/script-fu.def b/plug-ins/script-fu/libscriptfu/script-fu.def
new file mode 100644
index 0000000000..7e617eecb9
--- /dev/null
+++ b/plug-ins/script-fu/libscriptfu/script-fu.def
@@ -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
diff --git a/plug-ins/script-fu/tinyscheme/.gitignore b/plug-ins/script-fu/libscriptfu/tinyscheme/.gitignore
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/.gitignore
rename to plug-ins/script-fu/libscriptfu/tinyscheme/.gitignore
diff --git a/plug-ins/script-fu/tinyscheme/BUILDING b/plug-ins/script-fu/libscriptfu/tinyscheme/BUILDING
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/BUILDING
rename to plug-ins/script-fu/libscriptfu/tinyscheme/BUILDING
diff --git a/plug-ins/script-fu/tinyscheme/CHANGES b/plug-ins/script-fu/libscriptfu/tinyscheme/CHANGES
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/CHANGES
rename to plug-ins/script-fu/libscriptfu/tinyscheme/CHANGES
diff --git a/plug-ins/script-fu/tinyscheme/COPYING b/plug-ins/script-fu/libscriptfu/tinyscheme/COPYING
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/COPYING
rename to plug-ins/script-fu/libscriptfu/tinyscheme/COPYING
diff --git a/plug-ins/script-fu/tinyscheme/Makefile.am b/plug-ins/script-fu/libscriptfu/tinyscheme/Makefile.am
similarity index 74%
rename from plug-ins/script-fu/tinyscheme/Makefile.am
rename to plug-ins/script-fu/libscriptfu/tinyscheme/Makefile.am
index 49ce6431ea..d82d4a123a 100644
--- a/plug-ins/script-fu/tinyscheme/Makefile.am
+++ b/plug-ins/script-fu/libscriptfu/tinyscheme/Makefile.am
@@ -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 \
diff --git a/plug-ins/script-fu/tinyscheme/Manual.txt b/plug-ins/script-fu/libscriptfu/tinyscheme/Manual.txt
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/Manual.txt
rename to plug-ins/script-fu/libscriptfu/tinyscheme/Manual.txt
diff --git a/plug-ins/script-fu/tinyscheme/MiniSCHEMETribute.txt
b/plug-ins/script-fu/libscriptfu/tinyscheme/MiniSCHEMETribute.txt
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/MiniSCHEMETribute.txt
rename to plug-ins/script-fu/libscriptfu/tinyscheme/MiniSCHEMETribute.txt
diff --git a/plug-ins/script-fu/tinyscheme/README b/plug-ins/script-fu/libscriptfu/tinyscheme/README
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/README
rename to plug-ins/script-fu/libscriptfu/tinyscheme/README
diff --git a/plug-ins/script-fu/tinyscheme/dynload.c b/plug-ins/script-fu/libscriptfu/tinyscheme/dynload.c
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/dynload.c
rename to plug-ins/script-fu/libscriptfu/tinyscheme/dynload.c
diff --git a/plug-ins/script-fu/tinyscheme/dynload.h b/plug-ins/script-fu/libscriptfu/tinyscheme/dynload.h
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/dynload.h
rename to plug-ins/script-fu/libscriptfu/tinyscheme/dynload.h
diff --git a/plug-ins/script-fu/tinyscheme/hack.txt b/plug-ins/script-fu/libscriptfu/tinyscheme/hack.txt
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/hack.txt
rename to plug-ins/script-fu/libscriptfu/tinyscheme/hack.txt
diff --git a/plug-ins/script-fu/tinyscheme/init.scm b/plug-ins/script-fu/libscriptfu/tinyscheme/init.scm
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/init.scm
rename to plug-ins/script-fu/libscriptfu/tinyscheme/init.scm
diff --git a/plug-ins/script-fu/tinyscheme/meson.build b/plug-ins/script-fu/libscriptfu/tinyscheme/meson.build
similarity index 83%
rename from plug-ins/script-fu/tinyscheme/meson.build
rename to plug-ins/script-fu/libscriptfu/tinyscheme/meson.build
index 45981df8db..139a0abe02 100644
--- a/plug-ins/script-fu/tinyscheme/meson.build
+++ b/plug-ins/script-fu/libscriptfu/tinyscheme/meson.build
@@ -1,4 +1,6 @@
+# No include_directories('.') here; use libscriptfuInclude
+
scriptfu_tinyscheme = static_library('scriptfu-tinyscheme',
'scheme.c',
include_directories: [ rootInclude, ],
diff --git a/plug-ins/script-fu/tinyscheme/opdefines.h b/plug-ins/script-fu/libscriptfu/tinyscheme/opdefines.h
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/opdefines.h
rename to plug-ins/script-fu/libscriptfu/tinyscheme/opdefines.h
diff --git a/plug-ins/script-fu/tinyscheme/scheme-private.h
b/plug-ins/script-fu/libscriptfu/tinyscheme/scheme-private.h
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/scheme-private.h
rename to plug-ins/script-fu/libscriptfu/tinyscheme/scheme-private.h
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/libscriptfu/tinyscheme/scheme.c
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/scheme.c
rename to plug-ins/script-fu/libscriptfu/tinyscheme/scheme.c
diff --git a/plug-ins/script-fu/tinyscheme/scheme.h b/plug-ins/script-fu/libscriptfu/tinyscheme/scheme.h
similarity index 100%
rename from plug-ins/script-fu/tinyscheme/scheme.h
rename to plug-ins/script-fu/libscriptfu/tinyscheme/scheme.h
diff --git a/plug-ins/script-fu/meson.build b/plug-ins/script-fu/meson.build
index 1a2fb4ccb2..4b8caccb83 100644
--- a/plug-ins/script-fu/meson.build
+++ b/plug-ins/script-fu/meson.build
@@ -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,
)
diff --git a/plug-ins/script-fu/script-fu-console.c b/plug-ins/script-fu/script-fu-console.c
index c1b98909ca..199c5fd744 100644
--- a/plug-ins/script-fu/script-fu-console.c
+++ b/plug-ins/script-fu/script-fu-console.c
@@ -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);
diff --git a/plug-ins/script-fu/script-fu-eval.c b/plug-ins/script-fu/script-fu-eval.c
index ec160992dd..f709d38b94 100644
--- a/plug-ins/script-fu/script-fu-eval.c
+++ b/plug-ins/script-fu/script-fu-eval.c
@@ -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;
diff --git a/plug-ins/script-fu/script-fu-server.c b/plug-ins/script-fu/script-fu-server.c
index 8ae9397cf7..3a39f09c29 100644
--- a/plug-ins/script-fu/script-fu-server.c
+++ b/plug-ins/script-fu/script-fu-server.c
@@ -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);
diff --git a/plug-ins/script-fu/script-fu-text-console.c b/plug-ins/script-fu/script-fu-text-console.c
index 4747bee960..0eebbe43bb 100644
--- a/plug-ins/script-fu/script-fu-text-console.c
+++ b/plug-ins/script-fu/script-fu-text-console.c
@@ -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);
diff --git a/plug-ins/script-fu/script-fu.c b/plug-ins/script-fu/script-fu.c
index 795700cc22..faea2c5274 100644
--- a/plug-ins/script-fu/script-fu.c
+++ b/plug-ins/script-fu/script-fu.c
@@ -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);
}
diff --git a/po-script-fu/POTFILES.in b/po-script-fu/POTFILES.in
index 03eba796a8..65826ba99d 100644
--- a/po-script-fu/POTFILES.in
+++ b/po-script-fu/POTFILES.in
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]