Commit 1ff78e15 authored by Kevin Cozens's avatar Kevin Cozens Committed by Kevin Cozens

This commit breaks Tiny-Fu. It sets up the basic structure needed to run

2007-11-04  Kevin Cozens  <kcozens@cvs.gnome.org>

	This commit breaks Tiny-Fu. It sets up the basic structure needed
	to run Scheme scripts as plug-ins. The TinyScheme interpreter gets
	called but the tiny-fu extension which ties Scheme and GIMP together
	needs work.

	* TODO: Added notes about version 2.0 of Tiny-Fu.

	* autogen.sh: Added LIBTOOL support needed to build extensions for
	TinyScheme.

	* configure.in: Added setting of GIMP_PLUGINDIR. Display a summary
	of enable/disabled features, and GIMP directories when the script
	finishes.

	* Makefile.am: Added targets to create and install the tiny-fu.env
	and tiny-fu.interp files.

	* ftx/Makefile.am:
	* re/Makefile.am:
	* tiny-fu/Makefile.am: Build ftx, re, and tiny-fu as run-time
	loadable extensions for TinyScheme.

	* tiny-fu/tiny-fu.c: Added init_tiny_fu() and tiny_fu_main_init()
	as first steps of making this a TinyScheme extension.

	* tinyscheme/Makefile.am: Updated to build as standalone Scheme
	interpreter. Now installs under GIMP_LIBDIR/tiny-fu.

	* scripts/Makefile.am: During testing, only installs test scripts.
	Install init scripts under GIMP_LIBDIR/tiny-fu. Install regular
	scripts to the plug-ins directory.

	* scripts/images/Makefile.am: Install under plug-ins directory.

	* tinyscheme/scheme.c: Change to directory specified by TINYFUPATH
	to find init scripts and loadable extensions. Updated program usage
	information. Check for "-gimp" when parsing command line arguments.

	* scripts/script-fu.init: Added calls to load script-fu-compat.init
	and the tiny_fu extension.

svn path=/trunk/; revision=391
parent 8fe48436
2007-11-02 Kevin Cozens <kcozens@pc.localdomain>
2007-11-04 Kevin Cozens <kcozens@cvs.gnome.org>
This commit breaks Tiny-Fu. It sets up the basic structure needed
to run Scheme scripts as plug-ins. The TinyScheme interpreter gets
called but the tiny-fu extension which ties Scheme and GIMP together
needs work.
* TODO: Added notes about version 2.0 of Tiny-Fu.
* autogen.sh: Added LIBTOOL support needed to build extensions for
TinyScheme.
* configure.in: Added setting of GIMP_PLUGINDIR. Display a summary
of enable/disabled features, and GIMP directories when the script
finishes.
* Makefile.am: Added targets to create and install the tiny-fu.env
and tiny-fu.interp files.
* ftx/Makefile.am:
* re/Makefile.am:
* tiny-fu/Makefile.am: Build ftx, re, and tiny-fu as run-time
loadable extensions for TinyScheme.
* tiny-fu/tiny-fu.c: Added init_tiny_fu() and tiny_fu_main_init()
as first steps of making this a TinyScheme extension.
* tinyscheme/Makefile.am: Updated to build as standalone Scheme
interpreter. Now installs under GIMP_LIBDIR/tiny-fu.
* scripts/Makefile.am: During testing, only installs test scripts.
Install init scripts under GIMP_LIBDIR/tiny-fu. Install regular
scripts to the plug-ins directory.
* scripts/images/Makefile.am: Install under plug-ins directory.
* tinyscheme/scheme.c: Change to directory specified by TINYFUPATH
to find init scripts and loadable extensions. Updated program usage
information. Check for "-gimp" when parsing command line arguments.
* scripts/script-fu.init: Added calls to load script-fu-compat.init
and the tiny_fu extension.
2007-11-03 Kevin Cozens <kcozens@cvs.gnome.org>
* configure.in:
* Makefile.am:
* scripts/Makefile.am:
* scripts/images/Makefile.am:
* tiny-fu/Makefile.am:
* tinyscheme/Makefile.am:
2007-11-02 Kevin Cozens <kcozens@cvs.gnome.org>
* NEWS: Updated.
......@@ -7,7 +61,7 @@
* configure.in: Bumped version number to 1.9.0 to mark starting
point of development for Tiny-Fu version 2.
2007-11-02 Kevin Cozens <kcozens@pc.localdomain>
2007-11-02 Kevin Cozens <kcozens@cvs.gnome.org>
This release marks the end of development on version 1 of Tiny-Fu.
......
......@@ -8,6 +8,40 @@ SUBDIRS = \
tiny-fu \
scripts
if PLATFORM_WIN32
no_undefined = -no-undefined
path_separator = ;
else
path_separator = :
endif
tinyfubase = tiny-fu
tinyfudir = $(GIMP_LIBDIR)/$(tinyfubase)
tinyfuenvdir = $(GIMP_LIBDIR)/environ
tinyfuinterpdir = $(GIMP_LIBDIR)/interpreters
TINYSCHEME_BIN = $(tinyfudir)/tinyscheme
tinyfuenvfile = $(tinyfuenvdir)/tiny-fu.env
tinyfuinterpfile = $(tinyfuinterpdir)/tiny-fu.interp
install-env-file:
$(mkinstalldirs) '$(DESTDIR)$(tinyfuenvdir)'
echo '$(path_separator) TINYFUPATH=$${gimp_plug_in_dir}/$(tinyfubase)' > '$(DESTDIR)$(tinyfuenvfile)'
echo '$(path_separator) TINYSCHEMEINIT=$${gimp_plug_in_dir}/$(tinyfubase)/script-fu.init' >> '$(DESTDIR)$(tinyfuenvfile)'
install-interp-file:
$(mkinstalldirs) '$(DESTDIR)$(tinyfuinterpdir)'
echo 'tinyscheme=$(TINYSCHEME_BIN)' > '$(DESTDIR)$(tinyfuinterpfile)'
echo ':TinyScheme:E::scm::tinyscheme:' >> '$(DESTDIR)$(tinyfuinterpfile)'
install-data-local: install-env-file install-interp-file
uninstall-local:
rm -f '$(DESTDIR)$(tinyfuenvfile)' '$(DESTDIR)$(tinyfuinterpfile)'
EXTRA_DIST = \
AUTHORS \
ChangeLog \
......
NOTES for Tiny-Fu version 2:
- TinyScheme needs some fixing to command line argument parsing. It appears
to be running a script before the command line arguments were put in *args*.
- TinyScheme should stop trying to load files named on the command line as
soon as it encounters a command line argument which starts with a hyphen.
- It should set the current directory using the TINYFUPATH env var.
- Can't use a C based program as an interpreter plug-in?
The first argument becomes the name of the C program and the second is the
name of the script to be run. The first argument should be the name of the
script.
- Should Makefile's be using PLATFORM_WIN32 or OS_WIN32?
Command line parameters:
script_name -gimp read_fd write_fd -query 1
The last parameter is the stack trace mode. The values are:
0 - Never
1 - Query
2 - Always
-------------------------------------------------------------------------------
- If there is no data in the clipboard, make the "paste-as-..." scripts show
"There is no image data in the clipboard to paste." (bug #374854)
- A line beginning with a ; just before some close brackets will result in
......
......@@ -18,11 +18,14 @@ ACLOCAL=${ACLOCAL-aclocal-1.9}
AUTOCONF=${AUTOCONF-autoconf}
AUTOHEADER=${AUTOHEADER-autoheader}
AUTOMAKE=${AUTOMAKE-automake-1.9}
LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
AUTOCONF_REQUIRED_VERSION=2.54
AUTOMAKE_REQUIRED_VERSION=1.8.3
GLIB_REQUIRED_VERSION=2.2.0
INTLTOOL_REQUIRED_VERSION=0.31
LIBTOOL_REQUIRED_VERSION=1.4
LIBTOOL_WIN32=1.5
srcdir=`dirname $0`
......@@ -79,6 +82,36 @@ echo
DIE=0
OS=`uname -s`
case $OS in
*YGWIN* | *INGW*)
echo "Looks like Win32, you will need libtool $LIBTOOL_WIN32 or newer."
echo
LIBTOOL_REQUIRED_VERSION=$LIBTOOL_WIN32
;;
esac
echo -n "checking for libtool >= $LIBTOOL_REQUIRED_VERSION ... "
if ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1; then
LIBTOOLIZE=$LIBTOOLIZE
elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
LIBTOOLIZE=glibtoolize
else
echo
echo " You must have libtool installed to compile $PROJECT."
echo " Install the appropriate package for your distribution,"
echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
echo
DIE=1
fi
if test x$LIBTOOLIZE != x; then
VER=`$LIBTOOLIZE --version \
| grep libtool | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
check_version $VER $LIBTOOL_REQUIRED_VERSION
fi
echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
if ($AUTOCONF --version) < /dev/null > /dev/null 2>&1; then
VER=`$AUTOCONF --version | head -n 1 \
......@@ -212,6 +245,8 @@ if test $RC -ne 0; then
exit $RC
fi
$LIBTOOLIZE --force || exit $?
# optionally feature autoheader
($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 && $AUTOHEADER || exit 1
......
......@@ -59,17 +59,26 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The gettext translation domain.])
AC_ISC_POSIX
dnl Initialize libtool
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_RANLIB
AM_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
AM_MAINTAINER_MODE
###############
# Generic stuff
###############
dnl Checks for programs.
AC_ISC_POSIX
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
###########################
# Check target architecture
......@@ -281,6 +290,7 @@ fi
GIMP_DATADIR=`$PKG_CONFIG --variable=gimpdatadir gimp-2.0`
GIMP_LIBDIR=`$PKG_CONFIG --variable=gimplibdir gimp-2.0`
GIMP_PLUGINDIR="$GIMP_LIBDIR/plug-ins"
# GNU format message catalogs go into $datadir/locale,
# standard location is $libdir/locale. DATADIRNAME set accordingly.
......@@ -292,6 +302,7 @@ fi
AC_SUBST(GIMP_DATADIR)
AC_SUBST(GIMP_LIBDIR)
AC_SUBST(GIMP_PLUGINDIR)
AC_SUBST(GIMP_LOCALEDIR)
......@@ -307,3 +318,14 @@ po/Makefile.in
])
AC_OUTPUT
dnl Print a summary of features enabled/disabled:
AC_MSG_RESULT([
Building $plugin_name with prefix=$prefix
GIMP directories:
GIMP_DATADIR: $GIMP_DATADIR
GIMP_LIBDIR: $GIMP_LIBDIR
GIMP_PLUGINDIR: $GIMP_PLUGINDIR
GIMP_LOCALEDIR: $GIMP_LOCALEDIR
]);
## Process this file with automake to produce Makefile.in
AM_CFLAGS = \
if OS_WIN32
mwindows = -mwindows
no_undefined = -no-undefined
endif
AM_CFLAGS = \
-DUSE_INTERFACE=1 \
-I$(top_srcdir) \
$(GIMP_CFLAGS)
noinst_LIBRARIES = libftx.a
ftx_ladir = $(GIMP_LIBDIR)/tiny-fu
ftx_la_LTLIBRARIES = ftx.la
ftx_la_SOURCES = ftx.c ftx.h
libftx_a_SOURCES = ftx.c ftx.h
ftx_la_LDFLAGS = \
-module \
-avoid-version \
$(no_undefined) \
$(mwindows)
EXTRA_DIST = \
LICENSE \
......
## Process this file with automake to produce Makefile.in
if OS_WIN32
mwindows = -mwindows
no_undefined = -no-undefined
endif
AM_CFLAGS = \
-DSTANDALONE=1 \
-DUSE_INTERFACE=1 \
-I$(top_srcdir) \
$(GIMP_CFLAGS)
noinst_LIBRARIES = libre.a
re_ladir = $(GIMP_LIBDIR)/tiny-fu
libre_a_SOURCES = \
re_la_LTLIBRARIES = re.la
re_la_SOURCES = \
cclass.h \
cname.h \
debug.c \
......@@ -26,6 +34,12 @@ libre_a_SOURCES = \
split.h \
utils.h
re_la_LDFLAGS = \
-module \
-avoid-version \
$(no_undefined) \
$(mwindows)
#engine.c and engine.ih are listed below rather than above since the
#file is #include'ed in the source files and not compiled separately.
EXTRA_DIST = \
......
......@@ -2,11 +2,15 @@
SUBDIRS = images
scriptdatadir = $(GIMP_DATADIR)/scripts
initscriptsdir = $(GIMP_LIBDIR)/tiny-fu
scriptsdir = $(GIMP_PLUGINDIR)
initscripts = \
script-fu.init \
script-fu-compat.init
scripts = \
script-fu.init \
script-fu-compat.init \
3d-outline.scm \
3dTruchet.scm \
add-bevel.scm \
......@@ -113,10 +117,12 @@ test_scripts = \
if TINY_FU_UNSTABLE
scriptdata_DATA = $(scripts) $(test_scripts)
initscripts_DATA = $(initscripts)
#scripts_SCRIPTS = $(scripts) $(test_scripts)
scripts_SCRIPTS = $(test_scripts)
else
scriptdata_DATA = $(scripts)
scripts_SCRIPTS = $(scripts)
endif
EXTRA_DIST = $(scripts) $(test_scripts)
EXTRA_DIST = $(initscripts) $(scripts) $(test_scripts)
## Process this file with automake to produce Makefile.in
imagesdatadir = $(GIMP_DATADIR)/scripts/images
imagesdatadir = $(GIMP_PLUGINDIR)/images
imagesdata_DATA = \
beavis.jpg \
......
......@@ -582,3 +582,11 @@
(else (error "cond-expand : unknown operator" (car condition)))))))
(gc-verbose #f)
(load "script-fu-compat.init")
(load-extension "tiny_fu")
;There is no function available to the TinyScheme API to access *args*
;to allow full initialization to be done when the extension is loaded
;so will call the main init routine and pass the command line arguments.
(tiny-fu-init *args*)
## Process this file with automake to produce Makefile.in
libtinyscheme=$(top_builddir)/tinyscheme/libtinyscheme.a
libftx=$(top_builddir)/ftx/libftx.a
libre=$(top_builddir)/re/libre.a
if OS_WIN32
mwindows = -mwindows
WINSOCK_LIBS = -lws2_32
no_undefined = -no-undefined
endif
AM_CFLAGS = \
-DSTANDALONE=0 \
-DUSE_INTERFACE=1 \
-DUSE_STRLWR=0 \
-I$(top_srcdir) \
$(GIMP_CFLAGS)
AM_LDFLAGS = $(mwindows)
libexecdir = $(GIMP_LIBDIR)/plug-ins
tiny_fu_ladir = $(GIMP_LIBDIR)/tiny-fu
libexec_PROGRAMS = tiny-fu
tiny_fu_la_LTLIBRARIES = tiny_fu.la
tiny_fu_SOURCES = \
tiny_fu_la_SOURCES = \
tiny-fu-types.h \
tiny-fu-enums.h \
tiny-fu-console.c \
......@@ -40,13 +34,13 @@ tiny_fu_SOURCES = \
ts-wrapper.c \
ts-wrapper.h
AM_CPPFLAGS = \
-DLOCALEDIR=\""$(GIMP_LOCALEDIR)"\"
tiny_fu_la_LDFLAGS = \
-module \
-avoid-version \
$(no_undefined) \
$(mwindows)
LDADD = \
$(libtinyscheme) \
$(libftx) \
$(libre) \
tiny_fu_la_LIBADD = \
$(GIMP_LIBS) \
$(WINSOCK_LIBS) \
$(INTLLIBS)
......@@ -24,6 +24,13 @@
#include <libgimp/gimpui.h>
#include "tinyscheme/scheme.h"
#include "tinyscheme/scheme-private.h"
#if defined(_WIN32)
#define EXPORT __declspec( dllexport )
#else
#define EXPORT
#endif
#include "tiny-fu-types.h"
......@@ -40,6 +47,8 @@
/* Declare local functions. */
static pointer tiny_fu_main_init (scheme *sc, pointer args);
static void script_fu_query (void);
static void script_fu_run (const gchar *name,
gint nparams,
......@@ -67,6 +76,41 @@ const GimpPlugInInfo PLUG_IN_INFO =
MAIN ()
/* This routine is called to initialize the Tiny-Fu extension. */
/* The parameters passed to TinyScheme can be found in *args*. */
EXPORT void
init_tiny_fu (scheme *sc)
{
printf ("Loaded Tiny-Fu extension\n");
sc->vptr->scheme_define (sc, sc->global_env,
sc->vptr->mk_symbol(sc,"tiny-fu-init"),
sc->vptr->mk_foreign_func(sc, tiny_fu_main_init));
}
pointer
tiny_fu_main_init (scheme *sc, pointer args)
{
int len;
int i;
char *s;
len = sc->vptr->list_length (sc, args);
for (i = 0; i < len; ++i)
{
s = g_strdup (sc->vptr->string_value (sc->vptr->pair_car (args)));
printf (" arg %d: %s\n", i, s);
g_free (s);
args = sc->vptr->pair_cdr (args);
}
return sc->T;
}
static void
script_fu_query (void)
{
......
## Process this file with automake to produce Makefile.in
AM_CFLAGS = \
-DSTANDALONE=0 \
-DSTANDALONE=1 \
-DUSE_INTERFACE=1 \
-DUSE_MATH=1 \
-DUSE_ASCII_NAMES=0 \
-DUSE_STRLWR=0 \
-I$(top_srcdir) \
$(GIMP_CFLAGS)
-DUSE_DL=1 \
-DSUN_DL=1 \
$(GLIB_CFLAGS)
noinst_LIBRARIES = libtinyscheme.a
libexecdir = $(GIMP_LIBDIR)/tiny-fu
libtinyscheme_a_SOURCES = \
libexec_PROGRAMS = tinyscheme
tinyscheme_SOURCES = \
dynload.c \
scheme.c \
opdefines.h \
scheme-private.h \
scheme.h
LDADD = -ldl -lm
EXTRA_DIST = \
BUILDING \
CHANGES \
......
......@@ -4776,11 +4776,21 @@ int main(int argc, char **argv) {
int retcode;
int isfile=1;
/* Only do this when building TinyScheme for use in GIMP */
printf ("TINYFUPATH is %s\n", getenv("TINYFUPATH"));
chdir (getenv("TINYFUPATH"));
if(argc==1) {
printf(banner);
}
if(argc==2 && strcmp(argv[1],"-?")==0) {
printf("Usage: %s [-? | <file1> <file2> ... | -1 <file> <arg1> <arg2> ...]\n\tUse - as filename for stdin.\n",argv[0]);
printf("Usage: tinyscheme -?\n");
printf("or: tinyscheme [<file1> <file2> ...]\n");
printf("followed by\n");
printf(" -1 <file> [<arg1> <arg2> ...]\n");
printf(" -c <Scheme commands> [<arg1> <arg2> ...]\n");
printf("assuming that the executable is named tinyscheme.\n");
printf("Use - as filename for stdin.\n");
return 1;
}
if(!scheme_init(&sc)) {
......@@ -4802,7 +4812,8 @@ int main(int argc, char **argv) {
do {
if(strcmp(file_name,"-")==0) {
fin=stdin;
} else if(strcmp(file_name,"-1")==0 || strcmp(file_name,"-c")==0) {
} else if(strcmp(file_name,"-1")==0 || strcmp(file_name,"-c")==0 ||
strcmp(file_name,"-gimp")==0) {
pointer args=sc.NIL;
isfile=file_name[1]=='1';
file_name=*argv++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment