mirror of https://github.com/GNOME/gimp.git
(erich) lots of changes to gimptcl
1) better integration to automake/autoconf/configure... The rules are: * by default look at -ltcl and -ltk * you can specify --with-tcl and --with-tk to use different versions, e.g. you can use --with-tcl=tcl80 and --with-tk=tk80 to use them. * if your system has a dl library, it uses it, otherwise not. This may cause problems if you have a -ldl, but your tcl library doesn't need it :( There'll probably be a --with-tcldl=no someday 2) make a few arrays bigger, particularily in the PDB interface. 3) type most of the numeric returns from the PDB, e.g. a proc that returns a layer now returns `layer-#' instead of just `#'. This may cause problems for scripts that get an array and then iterate over it. (as in gimp-list-images or similar) 4) consolio is now based on Jeff Hobbs `tkcon', much better than the older one. And the license is much less restrictive. 5) The switch to tkcon unveiled several errors with the internal packages, so I fixed most of them. Now sub-interpreters can use the same PDB interface as the ``parent'' interp. I should be able to make something akin to the script-fu mechanism out of this... (someday)
This commit is contained in:
parent
9709409660
commit
f430950e74
11
configure.in
11
configure.in
|
@ -150,9 +150,14 @@ dnl Test for libmpeg
|
|||
|
||||
dnl Test for libtcl
|
||||
if test -z "$LIBTCL_LIB"; then
|
||||
AC_CHECK_LIB(tcl, Tcl_Init,
|
||||
GIMPTCL='gimptcl'; LIBTCL_LIB='-ltcl -ltk',
|
||||
AC_MSG_WARN(*** gimptcl plug-in will not be built ***), -lm -ldl)
|
||||
AC_CHECK_LIB(dl, dlopen, DL_LIBRARY=-ldl)
|
||||
AC_ARG_WITH(tcl, --with-{tcl/tk} use this tcl/tk library,
|
||||
AC_CHECK_LIB($with_tcl, Tcl_Init,
|
||||
GIMPTCL='gimptcl'; LIBTCL_LIB="-l$with_tcl -l$with_tk $DL_LIBRARY",
|
||||
AC_MSG_WARN(*** gimptcl plug-in will not be built ***), -lm),
|
||||
AC_CHECK_LIB(tcl, Tcl_StaticPackage,
|
||||
GIMPTCL='gimptcl'; LIBTCL_LIB="-ltcl -ltk $DL_LIBRARY",
|
||||
AC_MSG_WARN(*** gimptcl plug-in will not be built ***), -lm))
|
||||
fi
|
||||
|
||||
dnl Test for libxdelta
|
||||
|
|
|
@ -15,6 +15,7 @@ SUBDIRS = \
|
|||
dgimp \
|
||||
fuse \
|
||||
gflare \
|
||||
@GIMPTCL@ \
|
||||
refract \
|
||||
script-fu \
|
||||
struc \
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ../..
|
||||
prefix = /usr
|
||||
prefix = /usr/X11R6/
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
|
@ -55,18 +49,18 @@ POST_INSTALL = true
|
|||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = i486-pc-linux-gnu
|
||||
host_triplet = i486-pc-linux-gnu
|
||||
host_alias = i386-unknown-freebsd3.0
|
||||
host_triplet = i386-unknown-freebsd3.0
|
||||
CC = gcc
|
||||
CPP = gcc -E
|
||||
EMACS = /usr/bin/emacs
|
||||
EMACS =
|
||||
GIMPTCL = gimptcl
|
||||
JPEG = jpeg
|
||||
LD = /usr/lib/gcc-lib/i386-linux/egcs-2.90.18/ld
|
||||
LD = /usr/bin/ld
|
||||
LIBJPEG_LIB = -ljpeg
|
||||
LIBMPEG_LIB =
|
||||
LIBMPEG_LIB = -lmpeg
|
||||
LIBPNG_LIB = -lpng -lz
|
||||
LIBTCL_LIB = -ltcl -ltk
|
||||
LIBTCL_LIB = -ltcl80 -ltk80
|
||||
LIBTIFF_LIB = -ltiff
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIBXDELTA_LIB =
|
||||
|
@ -74,8 +68,8 @@ LIBXPM_LIB = -lXpm
|
|||
LN_S = ln -s
|
||||
MAINT = #M#
|
||||
MAKEINFO = makeinfo
|
||||
MPEG =
|
||||
NM = /usr/bin/nm -B
|
||||
MPEG = mpeg
|
||||
NM = /usr/bin/nm -p
|
||||
PACKAGE = gimp
|
||||
PNG = png
|
||||
RANLIB = ranlib
|
||||
|
@ -111,11 +105,11 @@ INCLUDES= \
|
|||
-I$(top_srcdir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
-ltcl -ltk \
|
||||
-lgimp \
|
||||
-ltcl80 -ltk80 \
|
||||
$(X_LIBS) \
|
||||
-lc \
|
||||
-lm -ldl
|
||||
-lm
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -123,16 +117,16 @@ PROGRAMS = $(libexec_PROGRAMS)
|
|||
|
||||
|
||||
DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I../..
|
||||
CPPFLAGS =
|
||||
CPPFLAGS = -I/usr/local/include -I/usr/local/include/tcl8.0 -I/usr/local/include/tk8.0
|
||||
LDFLAGS = -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXext -lX11 -lm
|
||||
LIBS =
|
||||
LIBS = -L/usr/local/lib
|
||||
X_CFLAGS = -I/usr/X11R6/include
|
||||
X_LIBS = -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXext -lX11 -lm
|
||||
X_EXTRA_LIBS =
|
||||
X_PRE_LIBS = -lSM -lICE
|
||||
gimptcl_OBJECTS = gtclMain.o gtcl_misc.o gtclConst.o gtclPDB.o
|
||||
gimptcl_LDADD = $(LDADD)
|
||||
gimptcl_DEPENDENCIES = $(top_builddir)/libgimp/libgimp.la
|
||||
gimptcl_DEPENDENCIES =
|
||||
gimptcl_LDFLAGS =
|
||||
CFLAGS = -I/usr/X11R6/include -g -O2 -Wall
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
|
@ -155,15 +149,15 @@ default: all
|
|||
$(srcdir)/Makefile.in: #M# Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gimptcl/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
#Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
# cd $(top_builddir) \
|
||||
# && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libexecPROGRAMS:
|
||||
|
||||
clean-libexecPROGRAMS:
|
||||
-test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS)
|
||||
test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS)
|
||||
|
||||
distclean-libexecPROGRAMS:
|
||||
|
||||
|
@ -189,12 +183,12 @@ uninstall-libexecPROGRAMS:
|
|||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core
|
||||
rm -f *.o core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
|
@ -202,10 +196,10 @@ maintainer-clean-compile:
|
|||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs
|
||||
rm -rf .libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
|
@ -238,7 +232,7 @@ check-recursive installcheck-recursive info-recursive dvi-recursive:
|
|||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; for subdir in $(SUBDIRS); do rev="$$subdir $$rev"; done; \
|
||||
rev=''; for subdir in $(SUBDIRS); do rev="$$rev $$subdir"; done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
|
@ -269,7 +263,7 @@ mostlyclean-tags:
|
|||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
|
@ -284,11 +278,11 @@ distdir: $(DISTFILES)
|
|||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
|
@ -323,19 +317,19 @@ installdirs: installdirs-recursive
|
|||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-libexecPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
@ -357,8 +351,8 @@ mostlyclean: mostlyclean-recursive mostlyclean-am
|
|||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
rm -f config.status
|
||||
rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
|
|
|
@ -28,7 +28,7 @@ LDADD = \
|
|||
@LIBTCL_LIB@ \
|
||||
$(X_LIBS) \
|
||||
-lc \
|
||||
-lm -ldl
|
||||
-lm
|
||||
|
||||
gtclenums.h: ${top_srcdir}/libgimp/gimpenums.h gtclEnums.h
|
||||
misc/enum.pl ${top_srcdir}/libgimp/gimpenums.h gtclEnums.h >$@
|
||||
|
|
|
@ -12,9 +12,9 @@ proc Shadow_Sphere {radius sphere_color bg_color light shadow} {
|
|||
set w [expr $radius * 3.52]
|
||||
set h [expr $radius * 2.40]
|
||||
|
||||
set img [gimp-image-new $w $h $RGB]
|
||||
set img [gimp-image-new $w $h RGB]
|
||||
set drawable [gimp-layer-new $img $w $h \
|
||||
$RGB_IMAGE "Sphere" 100 $NORMAL]
|
||||
RGB_IMAGE "Sphere" 100 NORMAL]
|
||||
|
||||
set radians [expr ($light * 3.1415926) / 180]
|
||||
set cx [expr $w / 2]
|
||||
|
@ -35,7 +35,7 @@ proc Shadow_Sphere {radius sphere_color bg_color light shadow} {
|
|||
|
||||
if {((($light >= 45) && ($light <= 75))
|
||||
|| (($light <= 135) && ($light >= 105)))
|
||||
&& ($shadow == $TRUE)} {
|
||||
&& ($shadow == 1)} {
|
||||
set shadow_w [expr ($radius * 2.5) * (cos(3.1415926 * $radians))]
|
||||
set shadow_h [expr $radius * 0.5]
|
||||
set shadow_x $cx
|
||||
|
@ -45,20 +45,20 @@ proc Shadow_Sphere {radius sphere_color bg_color light shadow} {
|
|||
set shadow_w [expr -$shadow_w]
|
||||
}
|
||||
gimp-ellipse-select $img $shadow_x $shadow_y \
|
||||
$shadow_w $shadow_h $REPLACE $TRUE $TRUE 7.5
|
||||
gimp-bucket-fill $img $drawable $BG_BUCKET_FILL \
|
||||
$MULTIPLY 100 0 $FALSE 0 0
|
||||
$shadow_w $shadow_h REPLACE TRUE $TRUE 7.5
|
||||
gimp-bucket-fill $img $drawable BG_BUCKET_FILL \
|
||||
MULTIPLY 100 0 FALSE 0 0
|
||||
|
||||
}
|
||||
gimp-ellipse-select $img [expr $cx - $radius] \
|
||||
[expr $cy - $radius] [expr 2 * $radius] [expr 2 * $radius] \
|
||||
$REPLACE $TRUE $FALSE 0
|
||||
gimp-blend $img $drawable $FG_BG_RGB $NORMAL $RADIAL 100 \
|
||||
$offset $light_x $light_y $light_end_x $light_end_y
|
||||
REPLACE TRUE FALSE 0
|
||||
gimp-blend $img $drawable FG_BG_RGB NORMAL RADIAL 100 \
|
||||
$offset FALSE FALSE 0 0 $light_x $light_y $light_end_x $light_end_y
|
||||
gimp-selection-none $img
|
||||
gimp-image-enable-undo $img
|
||||
gimp-display-new $img
|
||||
return $img
|
||||
}
|
||||
|
||||
#Shadow_Sphere 100 {255 0 0} {255 255 255} 135 $TRUE
|
||||
Shadow_Sphere 100 {255 0 0} {255 255 255} 45 FALSE
|
||||
|
|
|
@ -34,6 +34,8 @@ int Gtcl_QueryDBProc(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
|||
int Gtcl_QueryDB(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
||||
int Gtcl_InstallProc(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
||||
int Gtcl_GimpMain(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
||||
int Gtcl_SetData(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
||||
int Gtcl_GetData(ClientData data, Tcl_Interp *interp, int ac, char *av[]);
|
||||
|
||||
int Argv_to_GParam(Tcl_Interp *interp, char *name, int ac, char **av,
|
||||
GParam *parr);
|
||||
|
@ -46,6 +48,7 @@ void cvtfrom (char *str);
|
|||
void cvtto (char *str);
|
||||
|
||||
extern char *GtclConst;
|
||||
extern char *GtclProcs;
|
||||
|
||||
#define debugging 1
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ int
|
|||
Gtcl_ConstInit(Tcl_Interp *interp){
|
||||
char t[30], t1[30];
|
||||
|
||||
Tcl_PkgProvide(interp, "GtclConstant", "1.0");
|
||||
/* the auto-generated ones from <gimpenums.h> */
|
||||
#include "gtclenums.h"
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ GPlugInInfo PLUG_IN_INFO = {
|
|||
int
|
||||
main(int ac, char *av[]){
|
||||
char *tcllib_p, *tcllib;
|
||||
char *tklib_p, *tklib;
|
||||
|
||||
/* fprintf(stderr, "gimptcl: %d %s\n", ac, av[1]);*/
|
||||
|
||||
|
@ -74,16 +73,8 @@ main(int ac, char *av[]){
|
|||
free(tcllib);
|
||||
free(tcllib_p);
|
||||
|
||||
if (Tk_Init(theInterp) == TCL_OK) {
|
||||
tklib_p = Tcl_GetVar(theInterp, "tk_library", TCL_GLOBAL_ONLY);
|
||||
tklib = malloc(strlen(tklib_p)+10);
|
||||
sprintf(tklib, "%s/init.tcl", tklib_p);
|
||||
Tcl_EvalFile(theInterp, tklib);
|
||||
free(tklib_p);
|
||||
free(tklib);
|
||||
}
|
||||
|
||||
Gimptcl_Init(theInterp);
|
||||
Tcl_StaticPackage(theInterp, "Gimptcl", Gimptcl_Init, Gimptcl_Init);
|
||||
|
||||
Tcl_EvalFile(theInterp, av[1]);
|
||||
|
||||
|
@ -95,6 +86,11 @@ main(int ac, char *av[]){
|
|||
*/
|
||||
int
|
||||
Gimptcl_Init(Tcl_Interp *interp){
|
||||
char debuglevelvar[] = "DebugLevel";
|
||||
char GimpTclProcsVar[] = "GimpTclProcs";
|
||||
|
||||
Tcl_PkgProvide(interp, "Gimptcl", "1.0");
|
||||
|
||||
Tcl_CreateCommand(interp, "gimp-run-procedure", Gtcl_GimpRunProc,
|
||||
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(interp, "gimp-query-dbproc", Gtcl_QueryDBProc,
|
||||
|
@ -103,19 +99,26 @@ Gimptcl_Init(Tcl_Interp *interp){
|
|||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
Tcl_CreateCommand(interp, "gimp-install-procedure", Gtcl_InstallProc,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
Tcl_CreateCommand(interp, "gimp-set-data", Gtcl_SetData,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
Tcl_CreateCommand(interp, "gimp-get-data", Gtcl_GetData,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
#ifdef SHLIB_METHOD
|
||||
Tcl_CreateCommand(interp, "gimp-main", Gtcl_GimpMain,
|
||||
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
|
||||
#endif
|
||||
Tcl_LinkVar(interp, "DebugLevel", (char *)&debuglevel,
|
||||
Tcl_LinkVar(interp, debuglevelvar, (char *)&debuglevel,
|
||||
TCL_LINK_INT);
|
||||
Tcl_LinkVar(interp, GimpTclProcsVar, (char *)&GtclProcs,
|
||||
TCL_LINK_STRING |TCL_LINK_READ_ONLY);
|
||||
|
||||
/*
|
||||
* we have to belay adding PDB and Const to the interp
|
||||
* we have to delay adding PDB and Const to the interp
|
||||
* until gtcl_run is called, because we need
|
||||
* gimp_main to setup the IPC to the PDB.
|
||||
*/
|
||||
|
||||
theInterp=interp;
|
||||
if (!theInterp)
|
||||
theInterp=interp;
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
@ -185,6 +188,8 @@ gtcl_run(char *name, int nparm, GParam *p, int *nrv, GParam **rv){
|
|||
/* ok, add in our constants and the full PDB */
|
||||
Gtcl_PDBInit(theInterp);
|
||||
Gtcl_ConstInit(theInterp);
|
||||
Tcl_StaticPackage(theInterp, "GtclConstant", Gtcl_ConstInit, Gtcl_ConstInit);
|
||||
Tcl_StaticPackage(theInterp, "GtclPDB", Gtcl_PDBInit, Gtcl_PDBInit);
|
||||
|
||||
Tcl_Eval(theInterp, "info procs gimptcl_run");
|
||||
if (strcmp(theInterp->result, "gimptcl_run")!=0){
|
||||
|
@ -204,6 +209,17 @@ gtcl_run(char *name, int nparm, GParam *p, int *nrv, GParam **rv){
|
|||
free(pars);
|
||||
sprintf(cmd, "gimptcl_run %s", t);
|
||||
Tcl_Free(t);
|
||||
if (p[0].data.d_int32 == RUN_INTERACTIVE) {
|
||||
if (Tk_Init(theInterp) == TCL_OK) {
|
||||
} else {
|
||||
fprintf (stderr, "error in Tk_Init(): %s\n", theInterp->result);
|
||||
}
|
||||
#if TK_MAJOR_VERSION == 8
|
||||
Tcl_StaticPackage(theInterp, "Tk", Tk_Init, Tk_SafeInit);
|
||||
#else
|
||||
Tcl_StaticPackage(theInterp, "Tk", Tk_Init, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(Tcl_Eval(theInterp, cmd)==TCL_ERROR){
|
||||
fprintf(stderr, "Error in gtcl_run:%s\n", theInterp->result);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <libgimp/gimp.h>
|
||||
#include "gtcl.h"
|
||||
|
||||
char *GtclProcs = NULL;
|
||||
|
||||
static char *proc_types[] = {
|
||||
"undefined",
|
||||
"plug-in",
|
||||
|
@ -84,16 +86,20 @@ Gtcl_PDBInit(Tcl_Interp *interp){
|
|||
int nreturn_vals;
|
||||
GParamDef *params, *return_vals;
|
||||
int num_procs, i, j;
|
||||
char whole_proc[2048];
|
||||
char arglist[400];
|
||||
char carglist[400];
|
||||
char whole_proc[4096];
|
||||
char arglist[1024];
|
||||
char carglist[1024];
|
||||
char **theproc_list;
|
||||
|
||||
Tcl_PkgProvide(interp, "GtclPDB", "1.0");
|
||||
gimp_query_database (".*", ".*", ".*", ".*", ".*", ".*", ".*",
|
||||
&num_procs, &proc_list);
|
||||
theproc_list = (char **)malloc(num_procs * sizeof(char *));
|
||||
|
||||
for (i = 0; i < num_procs; i++) {
|
||||
memset(whole_proc, 0, 2048);
|
||||
memset(arglist, 0, 400);
|
||||
memset(carglist, 0, 400);
|
||||
memset(whole_proc, 0, sizeof(whole_proc));
|
||||
memset(arglist, 0, sizeof(arglist));
|
||||
memset(carglist, 0, (sizeof(carglist)));
|
||||
proc_name = strdup (proc_list[i]);
|
||||
/* fprintf(stderr, "(proc %d/%d %s)\n", i, num_procs, proc_name);*/
|
||||
/* lookup the procedure */
|
||||
|
@ -102,19 +108,25 @@ Gtcl_PDBInit(Tcl_Interp *interp){
|
|||
&nparams, &nreturn_vals,
|
||||
¶ms, &return_vals) == TRUE) {
|
||||
cvtfrom(proc_name);
|
||||
theproc_list[i] = (char *)malloc(strlen(proc_name)+1);
|
||||
strcpy(theproc_list[i], proc_name);
|
||||
/* fprintf(stderr, "adding %d `%s' -> `%s' %d\n", i, proc_name,
|
||||
theproc_list[i], strlen(proc_name)); */
|
||||
sprintf(carglist, "gimp-run-procedure %s ", proc_name);
|
||||
for(j=0;j<nparams;j++){
|
||||
if (strcmp(params[j].name, "run_mode")==0){
|
||||
strcat(carglist, "1 ");
|
||||
} else {
|
||||
strcat(arglist, params[j].name);
|
||||
char vname[30];
|
||||
sprintf(vname, "%s%d", params[j].name, j);
|
||||
strcat(arglist, vname);
|
||||
strcat(arglist, " ");
|
||||
strcat(carglist, "$");
|
||||
strcat(carglist, params[j].name);
|
||||
strcat(carglist, vname);
|
||||
strcat(carglist, " ");
|
||||
}
|
||||
}
|
||||
sprintf(whole_proc, "proc %s {%s} {\n global GimpPDBCmd\n set GimpPDBCmd %s\n update\n return [%s]\n}\n\n",
|
||||
sprintf(whole_proc, "proc {%s} {%s} {\n global env\n set env(GimpPDBCmd) %s\n update\n return [%s]\n}\n\n",
|
||||
proc_name, arglist, proc_name, carglist);
|
||||
#if 0
|
||||
fprintf(stderr, "%s", whole_proc);
|
||||
|
@ -132,6 +144,11 @@ Gtcl_PDBInit(Tcl_Interp *interp){
|
|||
|
||||
}
|
||||
}
|
||||
GtclProcs = Tcl_Merge(num_procs, theproc_list);
|
||||
/* fprintf(stderr, "%s", GtclProcs);*/
|
||||
for(i=0;i<num_procs;i++) free(theproc_list[i]);
|
||||
free(theproc_list);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
@ -148,6 +165,12 @@ Gtcl_GimpRunProc(ClientData data, Tcl_Interp *interp, int ac, char *av[]){
|
|||
char *p_name;
|
||||
int i;
|
||||
|
||||
if (ac < 2) {
|
||||
Tcl_SetResult(interp, "gimp-run-procedure: too few arguments",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
rv_a=(char **)NULL;
|
||||
p_name = strdup(av[1]);
|
||||
|
||||
|
@ -439,6 +462,42 @@ Gtcl_GimpMain(ClientData data, Tcl_Interp *interp, int argc, char *argv[]){
|
|||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* get/set runtime data from the gimp program
|
||||
* for running with last args
|
||||
*/
|
||||
int
|
||||
Gtcl_SetData(ClientData data, Tcl_Interp *interp, int ac, char *av[]){
|
||||
if(ac!=3){
|
||||
Tcl_SetResult(interp, "gimp-set-data: wrong # args:\n",
|
||||
TCL_STATIC);
|
||||
Tcl_AppendResult(interp, "usage: ", av[0],
|
||||
" <key> <value>", (char *)NULL);
|
||||
return(TCL_ERROR);
|
||||
}
|
||||
gimp_set_data(av[1], av[2], strlen(av[2]));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int
|
||||
Gtcl_GetData(ClientData data, Tcl_Interp *interp, int ac, char *av[]){
|
||||
char tmp[1024];
|
||||
|
||||
memset(tmp, 0, 1024);
|
||||
|
||||
if(ac!=2){
|
||||
Tcl_SetResult(interp, "gimp-get-data: wrong # args:\n",
|
||||
TCL_STATIC);
|
||||
Tcl_AppendResult(interp, "usage: ", av[0],
|
||||
" <key>", (char *)NULL);
|
||||
return(TCL_ERROR);
|
||||
}
|
||||
gimp_get_data(av[1], tmp);
|
||||
|
||||
Tcl_SetResult(interp, tmp, TCL_VOLATILE);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* static conveninence functions...
|
||||
*/
|
||||
|
|
|
@ -277,13 +277,28 @@ Argv_to_GParam(Tcl_Interp *interp, char *name, int ac, char **av,
|
|||
break;
|
||||
|
||||
case PARAM_DISPLAY:
|
||||
sscanf(av[i], "display-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (display)%d ", pc->data.d_int32));
|
||||
break;
|
||||
case PARAM_IMAGE:
|
||||
sscanf(av[i], "image-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (image)%d ", pc->data.d_int32));
|
||||
break;
|
||||
case PARAM_LAYER:
|
||||
sscanf(av[i], "layer-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (layer)%d ", pc->data.d_int32));
|
||||
break;
|
||||
case PARAM_CHANNEL:
|
||||
sscanf(av[i], "channel-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (channel)%d ", pc->data.d_int32));
|
||||
break;
|
||||
case PARAM_DRAWABLE:
|
||||
sscanf(av[i], "layer-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (drawable)%d ", pc->data.d_int32));
|
||||
break;
|
||||
case PARAM_SELECTION:
|
||||
pc->data.d_int32 = strtol(av[i], (char **)NULL, 0);
|
||||
DPRINTF(2,(stderr, " (dsp,img,lay,chan,drw,sel)%d ", pc->data.d_int32));
|
||||
sscanf(av[i], "selection-%d", &pc->data.d_int32);
|
||||
DPRINTF(2,(stderr, " (selection)%d ", pc->data.d_int32));
|
||||
break;
|
||||
|
||||
case PARAM_BOUNDARY:
|
||||
|
@ -332,7 +347,10 @@ GParam_to_Argv(Tcl_Interp *interp, char *p_name, int p_nrv,
|
|||
sprintf(t, "%g", vals[i].data.d_float);
|
||||
break;
|
||||
case PARAM_STRING:
|
||||
strcpy(t,vals[i].data.d_string);
|
||||
if(vals[i].data.d_string)
|
||||
strcpy(t,vals[i].data.d_string);
|
||||
else
|
||||
sprintf(t,"(null)");
|
||||
break;
|
||||
case PARAM_INT32ARRAY: {
|
||||
char **ar, *t1;
|
||||
|
@ -415,12 +433,22 @@ GParam_to_Argv(Tcl_Interp *interp, char *p_name, int p_nrv,
|
|||
return TCL_ERROR;
|
||||
break;
|
||||
case PARAM_DISPLAY:
|
||||
sprintf(t, "display-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_IMAGE:
|
||||
sprintf(t, "image-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_LAYER:
|
||||
sprintf(t, "layer-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_CHANNEL:
|
||||
sprintf(t, "channel-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_DRAWABLE:
|
||||
sprintf(t, "layer-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_SELECTION:
|
||||
sprintf(t, "%d", vals[i].data.d_int32);
|
||||
sprintf(t, "selection-%d", vals[i].data.d_int32);
|
||||
break;
|
||||
case PARAM_BOUNDARY:
|
||||
Tcl_SetResult(interp, "Unsupported return type: Boundary",
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ../../..
|
||||
prefix = /usr
|
||||
prefix = /usr/X11R6/
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
|
@ -55,18 +49,18 @@ POST_INSTALL = true
|
|||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = i486-pc-linux-gnu
|
||||
host_triplet = i486-pc-linux-gnu
|
||||
host_alias = i386-unknown-freebsd3.0
|
||||
host_triplet = i386-unknown-freebsd3.0
|
||||
CC = gcc
|
||||
CPP = gcc -E
|
||||
EMACS = /usr/bin/emacs
|
||||
EMACS =
|
||||
GIMPTCL = gimptcl
|
||||
JPEG = jpeg
|
||||
LD = /usr/lib/gcc-lib/i386-linux/egcs-2.90.18/ld
|
||||
LD = /usr/bin/ld
|
||||
LIBJPEG_LIB = -ljpeg
|
||||
LIBMPEG_LIB =
|
||||
LIBMPEG_LIB = -lmpeg
|
||||
LIBPNG_LIB = -lpng -lz
|
||||
LIBTCL_LIB = -ltcl -ltk
|
||||
LIBTCL_LIB = -ltcl75 -ltk41
|
||||
LIBTIFF_LIB = -ltiff
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIBXDELTA_LIB =
|
||||
|
@ -74,8 +68,8 @@ LIBXPM_LIB = -lXpm
|
|||
LN_S = ln -s
|
||||
MAINT = #M#
|
||||
MAKEINFO = makeinfo
|
||||
MPEG =
|
||||
NM = /usr/bin/nm -B
|
||||
MPEG = mpeg
|
||||
NM = /usr/bin/nm -p
|
||||
PACKAGE = gimp
|
||||
PNG = png
|
||||
RANLIB = ranlib
|
||||
|
@ -111,9 +105,9 @@ default: all
|
|||
$(srcdir)/Makefile.in: #M# Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gimptcl/scripts/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
#Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
# cd $(top_builddir) \
|
||||
# && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-pluginlibSCRIPTS: $(pluginlib_SCRIPTS)
|
||||
|
@ -145,7 +139,6 @@ subdir = plug-ins/gimptcl/scripts
|
|||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu plug-ins/gimptcl/scripts/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
|
@ -179,26 +172,26 @@ installdirs:
|
|||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
rm -f config.status
|
||||
rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,32 +0,0 @@
|
|||
This software is copyrighted by the Regents of the University of
|
||||
California, Sun Microsystems, Inc., and other parties. The following
|
||||
terms apply to all files associated with the software unless explicitly
|
||||
disclaimed in individual files.
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
||||
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
||||
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
||||
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
||||
|
||||
RESTRICTED RIGHTS: Use, duplication or disclosure by the government
|
||||
is subject to the restrictions as set forth in subparagraph (c) (1) (ii)
|
||||
of the Rights in Technical Data and Computer Software Clause as DFARS
|
||||
252.227-7013 and FAR 52.227-19.
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/libexec/gimptcl
|
||||
#!/usr/X11R6//libexec/gimptcl
|
||||
# -*-Mode: Tcl;-*-
|
||||
##################################################
|
||||
# file: pdb-help.tcl
|
||||
|
@ -273,3 +273,7 @@ proc pdb-help-init {} {
|
|||
|
||||
show_proc "pdb_help"
|
||||
}
|
||||
|
||||
if {![string compare [interp slave] ""]} {
|
||||
uplevel \#0 gimptcl_run 1
|
||||
}
|
||||
|
|
|
@ -273,3 +273,7 @@ proc pdb-help-init {} {
|
|||
|
||||
show_proc "pdb_help"
|
||||
}
|
||||
|
||||
if {![string compare [interp slave] ""]} {
|
||||
uplevel \#0 gimptcl_run 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue