see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann
1999-05-16 20:01:15 +00:00
parent 04efab712a
commit f032ea1c9e
12 changed files with 116 additions and 49 deletions

View File

@ -1,5 +1,12 @@
Revision history for Gimp-Perl extension. Revision history for Gimp-Perl extension.
- removed compatibility code from Lib.xs.
- call the XS version of gimp_progress_init when only
one argument is given.
- re-added PARASITE_*-constants (including UNDOABLE variants).
- :auto is NO LONGER the default for the import method(!).
(NOT YET).
1.083 Wed May 12 03:36:10 CEST 1999 1.083 Wed May 12 03:36:10 CEST 1999
- took a modified enums.pl to autogenerate constants. Some constants - took a modified enums.pl to autogenerate constants. Some constants
have changed: have changed:

View File

@ -13,7 +13,7 @@ use subs qw(init end lock unlock canonicalize_color);
require DynaLoader; require DynaLoader;
@ISA=qw(DynaLoader); @ISA=qw(DynaLoader);
$VERSION = 1.083; $VERSION = 1.084;
@_param = qw( @_param = qw(
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE
@ -46,8 +46,9 @@ $VERSION = 1.083;
'REPEAT_TRIANGULAR', 'BG_BUCKET_FILL', 'FG_BUCKET_FILL', 'PATTERN_BUCKET_FILL', 'REPEAT_TRIANGULAR', 'BG_BUCKET_FILL', 'FG_BUCKET_FILL', 'PATTERN_BUCKET_FILL',
#ENUM_NAME# #ENUM_NAME#
'STATUS_CALLING_ERROR', 'STATUS_EXECUTION_ERROR', 'STATUS_PASS_THROUGH', 'STATUS_CALLING_ERROR', 'STATUS_EXECUTION_ERROR', 'STATUS_PASS_THROUGH',
'STATUS_SUCCESS', 'PARASITE_PERSISTANT', 'PARASITE_ATTACH_PARENT', 'STATUS_SUCCESS', 'PARASITE_PERSISTENT', 'PARASITE_ATTACH_PARENT',
'PARASITE_PARENT_PERSISTENT', 'PARASITE_ATTACH_GRANDPARENT', 'PARASITE_GRANDPARENT_PERSISTENT', 'PARASITE_PARENT_PERSISTENT', 'PARASITE_ATTACH_GRANDPARENT', 'PARASITE_GRANDPARENT_PERSISTENT',
'PARASITE_UNDOABLE', 'PARASITE_PARENT_UNDOABLE', 'PARASITE_GRANDPARENT_UNDOABLE',
'TRACE_NONE', 'TRACE_CALL', 'TRACE_TYPE', 'TRACE_NAME', 'TRACE_DESC', 'TRACE_ALL', 'TRACE_NONE', 'TRACE_CALL', 'TRACE_TYPE', 'TRACE_NAME', 'TRACE_DESC', 'TRACE_ALL',
); );
@ -102,7 +103,7 @@ sub import($;@) {
# make a quick but dirty guess ;) # make a quick but dirty guess ;)
@_=(@_procs,':auto') unless @_; @_=(@_procs,':consts',':auto') unless @_;
for(@_) { for(@_) {
if ($_ eq ":auto") { if ($_ eq ":auto") {
@ -517,7 +518,7 @@ sub new($$$$$$$$) {
package Gimp::Parasite; package Gimp::Parasite;
sub is_type($$) { $_[0]->[0] eq $_[1] } sub is_type($$) { $_[0]->[0] eq $_[1] }
sub is_persistant($) { $_[0]->[1] & PARASITE_PERSISTANT } sub is_persistant($) { $_[0]->[1] & &Gimp::PARASITE_PERSISTANT }
sub is_error($) { !defined $_[0]->[0] } sub is_error($) { !defined $_[0]->[0] }
sub has_flag($$) { $_[0]->[1] & $_[1] } sub has_flag($$) { $_[0]->[1] & $_[1] }
sub copy($) { [@{$_[0]}] } sub copy($) { [@{$_[0]}] }
@ -567,7 +568,7 @@ decision I believe...
=head2 IMPORT TAGS =head2 IMPORT TAGS
If you don't specify any import tags, Gimp assumes :consts If you don't specify any import tags, Gimp assumes C<qw/:consts main xlfd_size/>
which is usually what you want. which is usually what you want.
=over 4 =over 4
@ -588,7 +589,7 @@ All constants from gimpenums.h (BG_IMAGE_FILL, RUN_NONINTERACTIVE, NORMAL_MODE,
=back =back
The default (unless '' is specified) is C<main xlfd_size :auto>. The default (unless '' is specified) is C<main xlfd_size :consts>.
=head1 GETTING STARTED =head1 GETTING STARTED

View File

@ -81,6 +81,17 @@ BOOT:
newCONSTSUB(stash,"PARAM_STRINGARRAY",newSViv(PARAM_STRINGARRAY)); newCONSTSUB(stash,"PARAM_STRINGARRAY",newSViv(PARAM_STRINGARRAY));
#if GIMP_PARASITE #if GIMP_PARASITE
newCONSTSUB(stash,"PARAM_PARASITE",newSViv(PARAM_PARASITE)); newCONSTSUB(stash,"PARAM_PARASITE",newSViv(PARAM_PARASITE));
newCONSTSUB(stash,"PARASITE_PERSISTENT",newSViv(PARASITE_PERSISTENT));
newCONSTSUB(stash,"PARASITE_UNDOABLE",newSViv(PARASITE_UNDOABLE));
newCONSTSUB(stash,"PARASITE_ATTACH_PARENT",newSViv(PARASITE_ATTACH_PARENT));
newCONSTSUB(stash,"PARASITE_PARENT_PERSISTENT",newSViv(PARASITE_PARENT_PERSISTENT));
newCONSTSUB(stash,"PARASITE_PARENT_UNDOABLE",newSViv(PARASITE_PARENT_UNDOABLE));
newCONSTSUB(stash,"PARASITE_ATTACH_GRANDPARENT",newSViv(PARASITE_ATTACH_GRANDPARENT));
newCONSTSUB(stash,"PARASITE_GRANDPARENT_PERSISTENT",newSViv(PARASITE_GRANDPARENT_PERSISTENT));
newCONSTSUB(stash,"PARASITE_GRANDPARENT_UNDOABLE",newSViv(PARASITE_GRANDPARENT_UNDOABLE));
#endif #endif
newCONSTSUB(stash,"PROC_EXTENSION",newSViv(PROC_EXTENSION)); newCONSTSUB(stash,"PROC_EXTENSION",newSViv(PROC_EXTENSION));

View File

@ -588,7 +588,7 @@ sub net {
my $this = this_script; my $this = this_script;
my(%map,@args); my(%map,@args);
my($interact)=1; my($interact)=1;
my $params = $this->[8]; my $params = $this->[9];
for(@{$this->[11]}) { for(@{$this->[11]}) {
return unless fu_feature_present($_,$this->[1]); return unless fu_feature_present($_,$this->[1]);
@ -1098,7 +1098,7 @@ sub save_image($$) {
# provide some clues ;) # provide some clues ;)
sub print_switches { sub print_switches {
my($this)=@_; my($this)=@_;
for(@{$this->[8]}) { for(@{$this->[9]}) {
my $type=$pf_type2string{$_->[0]}; my $type=$pf_type2string{$_->[0]};
my $key=mangle_key($_->[1]); my $key=mangle_key($_->[1]);
printf " -%-25s %s%s\n","$key $type",$_->[2],defined $_->[3] ? " [$_->[3]]" : ""; printf " -%-25s %s%s\n","$key $type",$_->[2],defined $_->[3] ? " [$_->[3]]" : "";

View File

@ -38,10 +38,13 @@ bootstrap Gimp::Lib $VERSION;
# various functions for 1.0 compatibility # various functions for 1.0 compatibility
sub gimp_progress_init { sub gimp_progress_init {
push @_,-1 if @_<2; if (@_<2) {
goto &_gimp_call_procedure;
} else {
eval { gimp_call_procedure "gimp_progress_init",@_ }; eval { gimp_call_procedure "gimp_progress_init",@_ };
gimp_call_procedure "gimp_progress_init",shift if $@; gimp_call_procedure "gimp_progress_init",shift if $@;
} }
}
# functions to "autobless" where the autobless mechanism # functions to "autobless" where the autobless mechanism
# does not work. # does not work.

View File

@ -29,15 +29,6 @@
#include "XSUB.h" #include "XSUB.h"
#include "ppport.h" #include "ppport.h"
/* I actually do care a bit about older perls... */
#ifndef ERRSV
# define ERRSV perl_get_sv("@",FALSE)
#endif
/* And also for newer perls... */
#ifndef dTHR
# define dTHR (void)0
#endif
/* dirty is used in gimp.h AND in perl < 5.005 or with PERL_POLLUTE. */ /* dirty is used in gimp.h AND in perl < 5.005 or with PERL_POLLUTE. */
#ifdef dirty #ifdef dirty
# undef dirty # undef dirty
@ -1834,6 +1825,19 @@ gimp_patterns_get_pattern_data(name)
PROTOTYPES: ENABLE PROTOTYPES: ENABLE
void
_gimp_progress_init (message)
gchar * message
CODE:
gimp_progress_init (message);
#ifdef GIMP_HAVE_DEFAULT_DISPLAY
DISPLAY
gimp_default_display()
#endif
# functions using different calling conventions: # functions using different calling conventions:
#void #void
#gimp_channel_get_color(channel_ID, red, green, blue) #gimp_channel_get_color(channel_ID, red, green, blue)

View File

@ -91,7 +91,7 @@ other way to access the raw pixeldata in Gimp.
Some exmaples: Some exmaples:
$region = $drawable->pixel_rgn (0,0, 100,100, 1,0); $region = $drawable->get->pixel_rgn (0,0, 100,100, 1,0);
$pixel = $region->get_pixel (5,7); # fetches the pixel from (5|7) $pixel = $region->get_pixel (5,7); # fetches the pixel from (5|7)
print $pixel; # outputs something like print $pixel; # outputs something like
# [255, 127, 0], i.e. in # [255, 127, 0], i.e. in
@ -108,6 +108,6 @@ Marc Lehmann <pcg@goof.com>
=head1 SEE ALSO =head1 SEE ALSO
perl(1), Gimp(1). L<Gimp::Pixel>, perl(1), Gimp(1).
=cut =cut

View File

@ -273,14 +273,19 @@ close C;
print "ok\n"; print "ok\n";
$GIMP_INC_NOUI = "-I../../ $GIMP_INC_NOUI" if $IN_GIMP; $GIMP_INC_NOUI = "-I../../ $GIMP_INC_NOUI" if $IN_GIMP;
@DIRS= 'Gimp'; @DIRS= 'Gimp';
if ($IN_GIMP) {
$build_module = $IN_GIMP || $ENV{GIMP_PERL_MODULE_INC};
print "building embedded perl module... ";
if ($build_module) {
print "yes\n";
$dont_embed = "false"; $dont_embed = "false";
push(@DIRS,'nolib'); push(@DIRS,'nolib');
print "configuring in embed/Makefile...\n"; print "configuring in embed/Makefile...\n";
system("cd embed && perl Makefile.PL"); system("cd embed && perl Makefile.PL");
} else { } else {
print "no\n";
$dont_embed = "true"; $dont_embed = "true";
} }

View File

@ -10,38 +10,44 @@ make test TEST_VERBOSE=1
bugs bugs
* disable module build (EMBEDMYALLOC)
* turn -1 into undef and vice versa.
* not calling unload -> coredump
* $Config{cc} might not understand Gimps CFLAGS (-mpentium). * $Config{cc} might not understand Gimps CFLAGS (-mpentium).
* do NOT modinstall with older gimp versions (!!!!!!!!!) [DONE] * do NOT modinstall with older gimp versions (!!!!!!!!!)
[DONE] * make parasiterc ascii-only !!!!
* improve examples/example-*.pl * improve examples/example-*.pl
* install in /usr/local (???? why? more options??) [KILL] * install in /usr/local (???? why? more options??)
* install even without Gtk? NO! [DONE] * install even without Gtk? NO!
[KILL] * perl_fu_webify in homepage-logo.pl
* wait for working gimp_file_load (or do it myself?) * wait for working gimp_file_load (or do it myself?)
* get rid of xs_exit. please please fuck me plenty. * get rid of xs_exit. please please fuck me plenty.
* do not install scm2scm and scm2perl on 56.004 [KILL] * do not install scm2scm and scm2perl on 56.004
* create gimpstyle.pod * create gimpstyle.pod
* get rid of ':auto'
important issues important issues
* pdb_proc_renameto
* gimp_progress_init (1 & 2 args)
* gimp_default_display (...) for libgimp
* Gimp::Module for modules (!)
* gimp_progress_close
* PerlCC configurable options for Perl-Server startup, Gipm_host etc.
* implement CALLBACKS via the Perl-Server
* PF_COORDS (just as Light Effects/FlareFX) * PF_COORDS (just as Light Effects/FlareFX)
* PF_PREVIEW(!) * PF_PREVIEW(!)
[PF_FILE] * PF_FILE [DONE] * --use-interp=perl|script-fu
* --use-interp=perl|script-fu
* change set_usize to something else.. * change set_usize to something else..
* Gimp::IO (?) * Gimp::IO (?)
* Gimp::Fu import after Gimp? use Gimp::main for Gimp::Fu?? * Gimp::Fu import after Gimp? use Gimp::main for Gimp::Fu??
* generic config query mechanism [DONE] * generic config query mechanism
* install scripts in share/ * install scripts in share/
* register dummy function to calm gimp down * register dummy function to calm gimp down (really??)
* config options & paths in module(!) [DONE] * config options & paths in module(!)
* Gimp::Module for modules (!)
* gimp->object_id, drawable_object_id remove! * gimp->object_id, drawable_object_id remove!
* gimp_display_image
* vamp up homepage * vamp up homepage
* --ui and --noui for Gimp::Fu * --ui and --noui for Gimp::Fu
* Gimp::ping * Gimp::ping
* clean up PKG_ANY vs. PKG_REAL_DRAWABLE [KILL] * clean up PKG_ANY vs. PKG_REAL_DRAWABLE
* allow plug-ins to register with only a drawable argument(!) * allow plug-ins to register with only a drawable argument(!)
(fix this in Gimp) (fix this in Gimp)
* gradient button * gradient button

View File

@ -50,7 +50,7 @@ WriteMakefile(
INSTALLDIRS => 'perl', INSTALLDIRS => 'perl',
INSTALLARCHLIB => '/tmp', INSTALLARCHLIB => '/tmp',
OBJECT => 'perlmod$(OBJ_EXT) perlxsi$(OBJ_EXT)', OBJECT => 'perlmod$(OBJ_EXT) perlxsi$(OBJ_EXT)',
INC => "$INC1 $GIMP_INC_NOUI $_ccopts $_gccflags $CPPFLAGS $CFLAGS $DEFS".($IN_GIMP ? " -DIN_GIMP" : ""), INC => "$INC1 $GIMP_INC_NOUI $_ccopts $_gccflags $CPPFLAGS $CFLAGS $DEFS $ENV{GIMP_PERL_MODULE_INC}".($IN_GIMP ? " -DIN_GIMP" : ""),
DEFINE => "$DEFINE1", DEFINE => "$DEFINE1",
macro => \%cfg, macro => \%cfg,
dynamic_lib => { OTHERLDFLAGS => "$LDFLAGS $LIBS $_ldopts $_gldflags" }, dynamic_lib => { OTHERLDFLAGS => "$LDFLAGS $LIBS $_ldopts $_gldflags" },

View File

@ -16,6 +16,14 @@ static GimpModuleInfo info = {
"1999-04-14" "1999-04-14"
}; };
void ERR(char *msg)
{
STRLEN dc;
dTHR;
fprintf (stderr, "(Perl module error, please report!) %s: %s\n", msg, SvPV(ERRSV,dc));
}
static PerlInterpreter *interp; static PerlInterpreter *interp;
static int perl_init(void) static int perl_init(void)
@ -30,13 +38,29 @@ static int perl_init(void)
if (interp) if (interp)
{ {
perl_construct(interp); perl_construct(interp);
{
dTHR; /* NOT earlier! */
perl_parse(interp, xs_init, 3, embedding, NULL); perl_parse(interp, xs_init, 3, embedding, NULL);
perl_eval_pv ("require Gimp::Module", TRUE); perl_eval_pv ("require Gimp::Module", TRUE);
res = perl_eval_pv ("Gimp::Module::_init()", TRUE); if (SvTRUE (ERRSV))
{
ERR ("error during require Gimp::Module, perl NOT initialized!");
return GIMP_MODULE_UNLOAD;
}
res = perl_eval_pv ("Gimp::Module::_init()", FALSE);
if (SvTRUE (ERRSV))
{
ERR ("error during require Gimp::Module::_init(), perl NOT initialized!");
return GIMP_MODULE_UNLOAD;
}
if (res && SvIOK (res)) if (res && SvIOK (res))
return SvIV (res); return SvIV (res);
} }
}
return GIMP_MODULE_UNLOAD; return GIMP_MODULE_UNLOAD;
} }
@ -46,10 +70,16 @@ static int perl_init(void)
static void perl_deinit(void) static void perl_deinit(void)
{ {
dTHR;
if (interp) if (interp)
{ {
perl_run(interp); perl_run(interp);
perl_eval_pv ("Gimp::Module::_deinit()", TRUE); perl_eval_pv ("Gimp::Module::_deinit()", FALSE);
if (SvTRUE (ERRSV))
ERR ("error during require Gimp::Module::_init()");
PL_perl_destruct_level = 0; PL_perl_destruct_level = 0;
perl_destruct(interp); perl_destruct(interp);
perl_free(interp); perl_free(interp);
@ -79,7 +109,7 @@ module_unload (void *shutdown_data,
void *completed_data) void *completed_data)
{ {
perl_deinit (); perl_deinit ();
/* perl is unloadable, *sigh* */ /* perl is unloadable (atexit & friends), *sigh* */
/* completed_cb (completed_data); */ /* completed_cb (completed_data); */
} }

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
use Gimp::Feature qw(gtk perl-5.005); use Gimp::Feature qw(gtk perl-5.005);
use Gimp 1.06; use Gimp 1.06 ':auto';
use Gimp::Fu; use Gimp::Fu;
use Gtk; use Gtk;
BEGIN { eval "use Image::Magick 1.45"; $@ and Gimp::Feature::missing ("Image::Magick version 1.45 or higher") }; BEGIN { eval "use Image::Magick 1.45"; $@ and Gimp::Feature::missing ("Image::Magick version 1.45 or higher") };