[gimp-perl] Delete obsolete exception-handling scheme remnants.



commit 254e33f55e683b1ed71a19324f5a242abe555ac0
Author: Ed J <edj src gnome org>
Date:   Thu May 15 01:01:17 2014 +0100

    Delete obsolete exception-handling scheme remnants.

 Gimp.pm     |   28 +---------------------------
 Gimp/Lib.xs |   12 ++----------
 Net/Net.pm  |    8 +-------
 TODO        |    1 -
 4 files changed, 4 insertions(+), 45 deletions(-)
---
diff --git a/Gimp.pm b/Gimp.pm
index 382799d..ae9f51f 100644
--- a/Gimp.pm
+++ b/Gimp.pm
@@ -5,8 +5,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD %EXPORT_TAGS @EXPORT_FAIL
             $interface_pkg $interface_type
             @PREFIXES
             $function $basename $spawn_opts
-            $in_quit $no_SIG
-            $host $in_top);
+            $host);
 use subs qw(init end lock unlock);
 
 BEGIN {
@@ -126,10 +125,7 @@ sub gtk_init() {
 # section on command-line handling/interface selection
 
 ($basename = $0) =~ s/^.*[\\\/]//;
-
 $spawn_opts = "";
-
-$in_quit=0;
 ($function)=$0=~/([^\/\\]+)$/;
 
 $Gimp::verbose=0 unless defined $Gimp::verbose;
@@ -167,22 +163,6 @@ EOF
 
 # section on error-handling
 
-# this needs to be improved
-sub quiet_die {
-   $in_top ? exit(1) : die "IGNORE THIS MESSAGE\n";
-}
-
-unless($no_SIG) {
-   $SIG{__DIE__} = sub {
-      if ($^S || !defined $^S || $in_quit) {
-         die $_[0];
-      } else {
-         warn $_[0];
-         initialized() ? &quiet_die : exit quiet_main();
-      }
-   };
-}
-
 # section on callbacks
 
 my %callback;
@@ -221,7 +201,6 @@ sub callback {
     die __"required callback 'query' not found for $function\n" unless @cb;
     for (@cb) { &$_ }
   } elsif ($type eq "-quit") {
-    local $in_quit = 1;
     @cb = cbchain(qw(quit));
     for (@cb) { &$_ }
   }
@@ -242,11 +221,6 @@ sub main {
    &{"$interface_pkg\::gimp_main"};
 }
 
-# same as main, but callbacks are ignored
-sub quiet_main {
-   main;
-}
-
 # section on interface_pkg
 
 if ($interface_type=~/^lib$/i) {
diff --git a/Gimp/Lib.xs b/Gimp/Lib.xs
index 28491da..92a753e 100644
--- a/Gimp/Lib.xs
+++ b/Gimp/Lib.xs
@@ -442,6 +442,7 @@ dump_params (int nparams, GimpParam *args, GimpParamDef *params)
          case GIMP_PDB_STRING:         trace_printf ("\"%s\"", args[i].data.d_string ? args[i].data.d_string 
: "[null]"); break;
          case GIMP_PDB_DISPLAY:        trace_printf ("%d", args[i].data.d_display); break;
          case GIMP_PDB_IMAGE:          trace_printf ("%d", args[i].data.d_image); break;
+         case GIMP_PDB_ITEM:           trace_printf ("%d", args[i].data.d_item); break;
          case GIMP_PDB_LAYER:          trace_printf ("%d", args[i].data.d_layer); break;
          case GIMP_PDB_CHANNEL:        trace_printf ("%d", args[i].data.d_channel); break;
          case GIMP_PDB_DRAWABLE:       trace_printf ("%d", args[i].data.d_drawable); break;
@@ -1208,16 +1209,7 @@ static void pii_run(const gchar *name,
   SPAGAIN;
 
   if (SvTRUE (ERRSV)) {
-    if (strEQ ("IGNORE THIS MESSAGE\n", SvPV_nolen (ERRSV))) {
-      nreturn_vals = 1;
-      return_vals = g_new (GimpParam, nreturn_vals);
-      return_vals->type = GIMP_PDB_STATUS;
-      return_vals->data.d_status = GIMP_PDB_SUCCESS;
-      *xnreturn_vals = nreturn_vals;
-      *xreturn_vals = return_vals;
-    } else {
-      err_msg = g_strdup (SvPV_nolen (ERRSV));
-    }
+    err_msg = g_strdup (SvPV_nolen (ERRSV));
   } else {
     char errmsg [MAX_STRING];
     errmsg [0] = 0;
diff --git a/Net/Net.pm b/Net/Net.pm
index 10e3c3b..4084971 100644
--- a/Net/Net.pm
+++ b/Net/Net.pm
@@ -194,7 +194,6 @@ sub try_connect {
 }
 
 sub gimp_init {
-   $Gimp::in_top=1;
    warn "$$-gimp_init(@_)" if $Gimp::verbose;
    if (@_) {
       $server_fh = try_connect ($_[0]);
@@ -207,16 +206,13 @@ sub gimp_init {
    }
    defined $server_fh or croak __"could not connect to the gimp server (make sure Perl-Server is running)";
    { my $fh = select $server_fh; $|=1; select $fh }
-
    my @r = response;
-
    die __"expected perl-server at other end of socket, got @r\n"
       unless $r[0] eq "PERL-SERVER";
    shift @r;
    die __"expected protocol version $PROTOCOL_VERSION, but server uses $r[0]\n"
       unless $r[0] eq $PROTOCOL_VERSION;
    shift @r;
-
    for(@r) {
       if($_ eq "AUTH") {
          die __"server requests authorization, but no authorization available\n"
@@ -226,7 +222,6 @@ sub gimp_init {
          print __"authorization ok, but: $r[1]\n" if $Gimp::verbose and $r[1];
       }
    }
-
    $initialized = 1;
    warn "$$-Finished gimp_init(@_)" if $Gimp::verbose;
 }
@@ -244,9 +239,8 @@ sub gimp_end {
 
 sub gimp_main {
    no strict 'refs';
-   $Gimp::in_top=0;
    eval { Gimp::callback("-net") };
-   if($@ && $@ ne "IGNORE THIS MESSAGE\n") {
+   if ($@) {
       chomp(my $exception = $@);
       warn "$0 exception: $exception\n";
       gimp_end;
diff --git a/TODO b/TODO
index e0b83cf..72a6559 100644
--- a/TODO
+++ b/TODO
@@ -19,7 +19,6 @@ Items as of 2014-04-29 (by Ed J)
   - gimp/plug-ins/script-fu/script-fu-console.c
   base on this:
   http://gtk2-perl.sourceforge.net/doc/gtk2-perl-study-guide/x3661.html
-* "IGNORE THIS MESSAGE" - $in_top - whole quiet_die probably needs to go too
 * PS flags are obsolete - replace with verbose - set_trace may also be obsolete
 * interactive collab image-editing:
   http://users.telenet.be/blendix/verse/#gimp_plugin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]