gimp r26911 - in trunk: . plug-ins/script-fu



Author: mitch
Date: Tue Sep  9 14:40:52 2008
New Revision: 26911
URL: http://svn.gnome.org/viewvc/gimp?rev=26911&view=rev

Log:
2008-09-09  Michael Natterer  <mitch gimp org>

	* plug-ins/script-fu/scheme-wrapper.c
	(script_fu_marshal_procedure_call): remove debug arrays to map the
	values of registered enums to strings. Look up the strings
	registered with the type system instead.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/script-fu/scheme-wrapper.c

Modified: trunk/plug-ins/script-fu/scheme-wrapper.c
==============================================================================
--- trunk/plug-ins/script-fu/scheme-wrapper.c	(original)
+++ trunk/plug-ins/script-fu/scheme-wrapper.c	Tue Sep  9 14:40:52 2008
@@ -17,8 +17,8 @@
  */
 
 #if 0
-#define DEBUG_MARSHALL       0  /* No need to define this until you need it */
-#define DEBUG_SCRIPTS        0
+#define DEBUG_MARSHALL 0  /* No need to define this until you need it */
+#define DEBUG_SCRIPTS  0
 #endif
 
 #include "config.h"
@@ -616,17 +616,6 @@
 #define typeflag(p) ((p)->_flag)
 #define type(p)     (typeflag(p)&T_MASKTYPE)
 
-  static const char *ret_types[] = {
-    "GIMP_PDB_INT32",       "GIMP_PDB_INT16",     "GIMP_PDB_INT8",
-    "GIMP_PDB_FLOAT",       "GIMP_PDB_STRING",    "GIMP_PDB_INT32ARRAY",
-    "GIMP_PDB_INT16ARRAY",  "GIMP_PDB_INT8ARRAY", "GIMP_PDB_FLOATARRAY",
-    "GIMP_PDB_STRINGARRAY", "GIMP_PDB_COLOR",     "GIMP_PDB_REGION",
-    "GIMP_PDB_DISPLAY",     "GIMP_PDB_IMAGE",     "GIMP_PDB_LAYER",
-    "GIMP_PDB_CHANNEL",     "GIMP_PDB_DRAWABLE",  "GIMP_PDB_SELECTION",
-    "GIMP_PDB_COLORARRY",   "GIMP_PDB_VECTORS",   "GIMP_PDB_PARASITE",
-    "GIMP_PDB_STATUS",      "GIMP_PDB_END"
-  };
-
   static const char *ts_types[] = {
     "T_NONE",
     "T_STRING",    "T_NUMBER",     "T_SYMBOL",       "T_PROC",
@@ -635,12 +624,6 @@
     "T_PROMISE",   "T_ENVIRONMENT","T_ARRAY"
   };
 
-  static const char *status_types[] = {
-    "GIMP_PDB_EXECUTION_ERROR", "GIMP_PDB_CALLING_ERROR",
-    "GIMP_PDB_PASS_THROUGH",    "GIMP_PDB_SUCCESS",
-    "GIMP_PDB_CANCEL"
-  };
-
   g_printerr ("\nIn %s()\n", G_STRFUNC);
 #endif
 
@@ -724,11 +707,19 @@
       a = sc->vptr->pair_cdr (a);
 
 #if DEBUG_MARSHALL
-      g_printerr ("    param %d - expecting type %s (%d)\n",
-                  i+1, ret_types[ params[i].type ], params[i].type);
-      g_printerr ("      passed arg is type %s (%d)\n",
-                  ts_types[ type(sc->vptr->pair_car (a)) ],
-                  type(sc->vptr->pair_car (a)));
+      {
+        const gchar *type_name;
+
+        gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE,
+                             params[i].type,
+                             &type_name, NULL, NULL, NULL);
+
+        g_printerr ("    param %d - expecting type %s (%d)\n",
+                    i + 1, type_name, params[i].type);
+        g_printerr ("      passed arg is type %s (%d)\n",
+                    ts_types[ type(sc->vptr->pair_car (a)) ],
+                    type(sc->vptr->pair_car (a)));
+      }
 #endif
 
       args[i].type = params[i].type;
@@ -1305,8 +1296,14 @@
     }
 
 #if DEBUG_MARSHALL
-  g_printerr ("    return value is %s\n",
-              status_types[ values[0].data.d_status ]);
+  {
+    const gchar *status_name;
+
+    gimp_enum_get_value (GIMP_TYPE_PDB_STATUS_TYPE,
+                         values[0].data.d_status,
+                         &status_name, NULL, NULL, NULL);
+    g_printerr ("    return value is %s\n", status_name);
+  }
 #endif
 
   switch (values[0].data.d_status)
@@ -1335,8 +1332,16 @@
           gint         j;
 
 #if DEBUG_MARSHALL
-          g_printerr ("      value %d is type %s (%d)\n",
-                      i, ret_types[ return_vals[i].type ], return_vals[i].type);
+          {
+            const gchar *type_name;
+
+            gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE,
+                                 return_vals[i].type,
+                                 &type_name, NULL, NULL, NULL);
+
+            g_printerr ("      value %d is type %s (%d)\n",
+                        i, type_name, return_vals[i].type);
+          }
 #endif
           switch (return_vals[i].type)
             {



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