Re: IRIX patch for Glib-1.042



On Thu, Jun 03, 2004 at 04:25:08PM -0400, muppet wrote:

Albert Chin said:
2. C89 doesn't allow for non-static member initialization.

ugh!  this one will be quite annoying in Gtk2, where the same idiom
(initializing a  param_types array with *_TYPE_* macros which are often
function calls) is used in many, many places...

Patch for Gtk2-1.042 attached. Ugh indeed! This patch contains fixes
for C++ comments as well.

-- 
albert chin (china thewrittenword com)

-- snip snip
--- xs/GdkEvent.xs.orig 2004-06-03 08:41:58.086154000 -0500
+++ xs/GdkEvent.xs      2004-06-03 10:16:27.556016000 -0500
@@ -555,10 +555,9 @@
        SV * data
     PREINIT:
        GPerlCallback *callback;
-       GType params[] = {
-               GDK_TYPE_EVENT
-       };
+       GType params[1];
     CODE:
+       params[0] = GDK_TYPE_EVENT;
        if (SvOK (func)) {
                callback = gperl_callback_new (func, data,
                                               G_N_ELEMENTS (params),
--- xs/GdkWindow.xs.orig        2004-06-03 08:44:06.813289000 -0500
+++ xs/GdkWindow.xs     2004-06-03 10:16:36.779288000 -0500
@@ -108,9 +108,8 @@
 static GPerlCallback *
 gtk2perl_gdk_window_invalidate_maybe_recurse_func_create (SV * func, SV * data)
 {
-       GType param_types [] = {
-               GDK_TYPE_WINDOW,
-       };
+       GType param_types [1];
+       param_types[0] = GDK_TYPE_WINDOW;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, G_TYPE_BOOLEAN);
 }
--- xs/Gtk2.xs.orig     2004-06-03 09:31:04.161675000 -0500
+++ xs/Gtk2.xs  2004-06-03 09:31:33.945432000 -0500
@@ -77,7 +77,9 @@
 {
        guint id; 
        GPerlCallback * callback;
-       GType param_types[] = { GTK_TYPE_WIDGET, GDK_TYPE_EVENT };
+       GType param_types[2];
+       param_types[0] = GTK_TYPE_WIDGET;
+       param_types[1] = GDK_TYPE_EVENT;
        if (!key_snoopers)
                key_snoopers =
                        g_hash_table_new_full (g_direct_hash,
--- xs/GtkAccelMap.xs.orig      2004-06-03 09:36:46.078360000 -0500
+++ xs/GtkAccelMap.xs   2004-06-03 10:16:56.083658000 -0500
@@ -131,9 +131,12 @@
        SV * foreach_func
     PREINIT:
        GPerlCallback * callback = NULL;
-       GType types[] = { G_TYPE_STRING, G_TYPE_UINT, 
-                         GDK_TYPE_MODIFIER_TYPE, G_TYPE_BOOLEAN };
+       GType types[4];
     CODE:
+       types[0] = G_TYPE_STRING;
+       types[1] = G_TYPE_UINT;
+       types[2] = GDK_TYPE_MODIFIER_TYPE;
+       types[3] = G_TYPE_BOOLEAN;
        callback = gperl_callback_new (foreach_func, data, 4, types, 
                                       G_TYPE_NONE);
        gtk_accel_map_foreach 
@@ -147,9 +150,12 @@
        SV * foreach_func
     PREINIT:
        GPerlCallback * callback = NULL;
-       GType types[] = { G_TYPE_STRING, G_TYPE_UINT, 
-                         GDK_TYPE_MODIFIER_TYPE, G_TYPE_BOOLEAN };
+       GType types[4];
     CODE:
+       types[0] = G_TYPE_STRING;
+       types[1] = G_TYPE_UINT;
+       types[2] = GDK_TYPE_MODIFIER_TYPE;
+       types[3] = G_TYPE_BOOLEAN;
        callback = gperl_callback_new (foreach_func, data, 4, types, 
                                       G_TYPE_NONE);
        gtk_accel_map_foreach_unfiltered
--- xs/GtkContainer.xs.orig     2004-06-03 09:39:36.849450000 -0500
+++ xs/GtkContainer.xs  2004-06-03 09:39:50.432043000 -0500
@@ -85,8 +85,9 @@
        SV * callback_data
     PREINIT:
        GPerlCallback * real_callback;
-       GType param_types [] = { GTK_TYPE_WIDGET };
+       GType param_types [1];
     CODE:
+       param_types[0] = GTK_TYPE_WIDGET;
        real_callback = gperl_callback_new (callback, callback_data,
                                            1, param_types, G_TYPE_NONE);
        gtk_container_foreach (container, 
--- xs/GtkMenu.xs.orig  2004-06-03 09:43:46.856897000 -0500
+++ xs/GtkMenu.xs       2004-06-03 09:44:10.153615000 -0500
@@ -79,10 +79,9 @@
 static GPerlCallback *
 gtk2perl_menu_detach_func_create (SV *func, SV *data)
 {
-       GType param_types [] = {
-               GTK_TYPE_WIDGET,
-               GTK_TYPE_MENU
-       };
+       GType param_types [2];
+       param_types[0] = GTK_TYPE_WIDGET;
+       param_types[1] = GTK_TYPE_MENU;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, 0);
 }
--- xs/GtkTextTagTable.xs.orig  2004-06-03 09:49:36.331034000 -0500
+++ xs/GtkTextTagTable.xs       2004-06-03 09:49:47.386733000 -0500
@@ -57,8 +57,9 @@
         SV * callback_data
     PREINIT:
        GPerlCallback * real_callback;
-       GType param_types [] = { GTK_TYPE_TEXT_TAG };
+       GType param_types [1];
     CODE:
+       param_types[0] = GTK_TYPE_TEXT_TAG;
        real_callback = gperl_callback_new (callback, callback_data,
                                            1, param_types, G_TYPE_NONE);
        gtk_text_tag_table_foreach (table, 
--- xs/GtkTreeModel.xs.orig     2004-06-03 09:51:18.593337000 -0500
+++ xs/GtkTreeModel.xs  2004-06-03 10:40:14.501898000 -0500
@@ -186,8 +186,8 @@
        av_push (av, newSViv (PTR2IV (iter->user_data)));
        av_push (av, iter->user_data2 ? newRV (iter->user_data2) : &PL_sv_undef);
        av_push (av, iter->user_data3 ? newRV (iter->user_data3) : &PL_sv_undef);
-       //warn ("sv_from_iter : av %p  %x %x %x %x\n", av,
-       //      iter->stamp, iter->user_data, iter->user_data2, iter->user_data3);
+       /*warn ("sv_from_iter : av %p  %x %x %x %x\n", av,*/
+       /*      iter->stamp, iter->user_data, iter->user_data2, iter->user_data3);*/
        return newRV_noinc ((SV*)av);
 }
 
@@ -195,7 +195,7 @@
 iter_from_sv (GtkTreeIter * iter,
               SV * sv)
 {
-       //warn ("iter_from_sv 0x%x, 0x%x\n", iter, sv);
+       /*warn ("iter_from_sv 0x%x, 0x%x\n", iter, sv);*/
        if (sv && SvROK (sv) && SvTYPE (SvRV (sv)) == SVt_PVAV) {
                SV ** svp;
                AV * av = (AV*) SvRV (sv);
@@ -216,8 +216,8 @@
                        iter->user_data3 =  SvRV (*svp);
                else
                        iter->user_data3 = NULL;
-               //warn ("iter_from_sv 0x%p  %x %x %x %x\n", iter,
-               //      iter->stamp, iter->user_data, iter->user_data2, iter->user_data3);
+               /*warn ("iter_from_sv 0x%p  %x %x %x %x\n", iter,*/
+               /*      iter->stamp, iter->user_data, iter->user_data2, iter->user_data3);*/
                return TRUE;
        } else {
                iter->stamp = 0;
@@ -1001,12 +1001,11 @@
        SV * user_data
     PREINIT:
        GPerlCallback * callback;
-       GType types[] = {
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_TREE_PATH,
-               GTK_TYPE_TREE_ITER
-       };
+       GType types[3];
     CODE:
+       types[0] = GTK_TYPE_TREE_MODEL;
+       types[1] = GTK_TYPE_TREE_PATH;
+       types[2] = GTK_TYPE_TREE_ITER;
        callback = gperl_callback_new (func, user_data, G_N_ELEMENTS (types), types,
                                       G_TYPE_BOOLEAN);
        gtk_tree_model_foreach (model, gtk2perl_tree_model_foreach_func, callback);
--- xs/GtkTreeSelection.xs.orig 2004-06-03 09:53:00.580907000 -0500
+++ xs/GtkTreeSelection.xs      2004-06-03 09:54:07.586747000 -0500
@@ -26,12 +26,11 @@
 static GPerlCallback *
 gtk2perl_tree_selection_func_create (SV * func, SV * data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_SELECTION,
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_TREE_PATH,
-               G_TYPE_BOOLEAN
-       };
+       GType param_types [4];
+       param_types[0] = GTK_TYPE_TREE_SELECTION;
+       param_types[1] = GTK_TYPE_TREE_MODEL;
+       param_types[2] = GTK_TYPE_TREE_PATH;
+       param_types[3] = G_TYPE_BOOLEAN;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, G_TYPE_BOOLEAN);
 }
@@ -60,11 +59,10 @@
 static GPerlCallback *
 gtk2perl_tree_selection_foreach_func_create (SV * func, SV * data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_TREE_PATH,
-               GTK_TYPE_TREE_ITER
-       };
+       GType param_types [3];
+       param_types[0] = GTK_TYPE_TREE_MODEL;
+       param_types[1] = GTK_TYPE_TREE_PATH;
+       param_types[2] = GTK_TYPE_TREE_ITER;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, 0);
 }
--- xs/GtkTreeSortable.xs.orig  2004-06-03 09:54:53.139363000 -0500
+++ xs/GtkTreeSortable.xs       2004-06-03 09:55:19.176629000 -0500
@@ -24,11 +24,10 @@
 static GPerlCallback *
 new_sort_func (SV * sort_func, SV * user_data)
 {
-       GType param_types[] = {
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_TREE_ITER,
-               GTK_TYPE_TREE_ITER
-       };
+       GType param_types[3];
+       param_types[0] = GTK_TYPE_TREE_MODEL;
+       param_types[1] = GTK_TYPE_TREE_ITER;
+       param_types[2] = GTK_TYPE_TREE_ITER;
        return gperl_callback_new (sort_func, user_data,
                                   3, param_types, G_TYPE_INT);
 }
--- xs/GtkTreeView.xs.orig      2004-06-03 09:57:26.209072000 -0500
+++ xs/GtkTreeView.xs   2004-06-03 10:15:53.706063000 -0500
@@ -32,12 +32,11 @@
 static GPerlCallback *
 gtk2perl_tree_view_column_drop_func_create (SV * func, SV *data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_VIEW,
-               GTK_TYPE_TREE_VIEW_COLUMN,
-               GTK_TYPE_TREE_VIEW_COLUMN,
-               GTK_TYPE_TREE_VIEW_COLUMN
-       };
+       GType param_types [4];
+       param_types[0] = GTK_TYPE_TREE_VIEW;
+       param_types[1] = GTK_TYPE_TREE_VIEW_COLUMN;
+       param_types[2] = GTK_TYPE_TREE_VIEW_COLUMN;
+       param_types[3] = GTK_TYPE_TREE_VIEW_COLUMN;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, G_TYPE_BOOLEAN);
 }
@@ -65,10 +64,9 @@
 static GPerlCallback *
 gtk2perl_tree_view_mapping_func_create (SV * func, SV *data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_VIEW,
-               GTK_TYPE_TREE_PATH
-       };
+       GType param_types [2];
+       param_types[0] = GTK_TYPE_TREE_VIEW;
+       param_types[1] = GTK_TYPE_TREE_PATH;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, 0);
 }
@@ -85,12 +83,11 @@
 static GPerlCallback *
 gtk2perl_tree_view_search_equal_func_create (SV * func, SV *data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_INT,
-               G_TYPE_STRING,
-               GTK_TYPE_TREE_ITER
-       };
+       GType param_types [4];
+       param_types[0] = GTK_TYPE_TREE_MODEL;
+       param_types[1] = GTK_TYPE_INT;
+       param_types[2] = G_TYPE_STRING;
+       param_types[3] = GTK_TYPE_TREE_ITER;
        return gperl_callback_new (func, data, G_N_ELEMENTS (param_types),
                                   param_types, G_TYPE_BOOLEAN);
 }
--- xs/GtkTreeViewColumn.xs.orig        2004-06-03 10:00:20.947225000 -0500
+++ xs/GtkTreeViewColumn.xs     2004-06-03 10:01:01.584063000 -0500
@@ -33,12 +33,11 @@
 GPerlCallback *
 gtk2perl_tree_cell_data_func_create (SV * func, SV * data)
 {
-       GType param_types [] = {
-               GTK_TYPE_TREE_VIEW_COLUMN,
-               GTK_TYPE_CELL_RENDERER,
-               GTK_TYPE_TREE_MODEL,
-               GTK_TYPE_TREE_ITER
-       };
+       GType param_types [4];
+       param_types[0] = GTK_TYPE_TREE_VIEW_COLUMN;
+       param_types[1] = GTK_TYPE_CELL_RENDERER;
+       param_types[2] = GTK_TYPE_TREE_MODEL;
+       param_types[3] = GTK_TYPE_TREE_ITER;
        return gperl_callback_new (func, data, 
                                   G_N_ELEMENTS (param_types), param_types,
                                   0);
--- xs/GtkClipboard.xs.orig     2004-06-03 10:03:43.285361000 -0500
+++ xs/GtkClipboard.xs  2004-06-03 10:17:34.291439000 -0500
@@ -166,19 +166,21 @@
        GtkTargetEntry *targets = NULL;
        guint n_targets;
        GPerlCallback * get_callback;
-       GType get_param_types[] = {
-               GTK_TYPE_CLIPBOARD,
-               GTK_TYPE_SELECTION_DATA,
-               G_TYPE_UINT,
-               GPERL_TYPE_SV   /* since we're on the _data one */
-       };
+       GType get_param_types[4];
        GPerlCallback * clear_callback;
-       GType clear_param_types[] = {
-               GTK_TYPE_CLIPBOARD,
-               GPERL_TYPE_SV   /* since we're on the _data one */
-       };
+       GType clear_param_types[2];
        SV * real_user_data;
     CODE:
+       get_param_types[0] = GTK_TYPE_CLIPBOARD;
+       get_param_types[1] = GTK_TYPE_SELECTION_DATA;
+       get_param_types[2] = G_TYPE_UINT;
+       /* since we're on the _data one */
+       get_param_types[3] = GPERL_TYPE_SV;
+
+       clear_param_types[0] = GTK_TYPE_CLIPBOARD;
+       /* since we're on the _data one */
+       clear_param_types[1] = GPERL_TYPE_SV;
+
        GTK2PERL_STACK_ITEMS_TO_TARGET_ENTRY_ARRAY (4, targets, n_targets);
        /* WARNING: since we're piggybacking on the same callback for
         *    the _with_data and _with_owner forms, the user_data arg
@@ -233,18 +235,18 @@
        GtkTargetEntry *targets = NULL;
        guint n_targets = 0;
        GPerlCallback * get_callback;
-       GType get_param_types[] = {
-               GTK_TYPE_CLIPBOARD,
-               GTK_TYPE_SELECTION_DATA,
-               G_TYPE_UINT,
-               G_TYPE_OBJECT   /* since we're on the _owner one */
-       };
+       GType get_param_types[4];
        GPerlCallback * clear_callback;
-       GType clear_param_types[] = {
-               GTK_TYPE_CLIPBOARD,
-               G_TYPE_OBJECT   /* since we're on the _owner one */
-       };
+       GType clear_param_types[2];
     CODE:
+       get_param_types[0] = GTK_TYPE_CLIPBOARD;
+       get_param_types[1] = GTK_TYPE_SELECTION_DATA;
+       get_param_types[2] = G_TYPE_UINT;
+       /* since we're on the _owner one */
+       get_param_types[3] = G_TYPE_OBJECT;
+       clear_param_types[0] = GTK_TYPE_CLIPBOARD;
+       /* since we're on the _owner one */
+       clear_param_types[1] = G_TYPE_OBJECT;
        GTK2PERL_STACK_ITEMS_TO_TARGET_ENTRY_ARRAY (4, targets, n_targets);
        /* WARNING: since we're piggybacking on the same callback for
         *    the _with_data and _with_owner forms, the owner arg
@@ -307,8 +309,10 @@
        SV * user_data
     PREINIT:
        GPerlCallback * real_callback;
-       GType param_types[] = { GTK_TYPE_CLIPBOARD, GTK_TYPE_SELECTION_DATA };
+       GType param_types[2];
     CODE:
+       param_types[0] = GTK_TYPE_CLIPBOARD;
+       param_types[1] = GTK_TYPE_SELECTION_DATA;
        real_callback = gperl_callback_new (callback, user_data,
                                            2, param_types, G_TYPE_NONE);
        g_object_set_qdata_full (G_OBJECT (clipboard),
@@ -327,11 +331,10 @@
        SV * user_data
     PREINIT:
        GPerlCallback * real_callback;
-       GType param_types[] = {
-               GTK_TYPE_CLIPBOARD,
-               G_TYPE_STRING
-       };
+       GType param_types[2];
     CODE:
+       param_types[0] = GTK_TYPE_CLIPBOARD;
+       param_types[1] = G_TYPE_STRING;
        real_callback = gperl_callback_new (callback, user_data,
                                            2, param_types, G_TYPE_NONE);
        g_object_set_qdata_full (G_OBJECT (clipboard),
--- xs/GtkCellRenderer.xs.orig  2004-06-03 10:26:56.866880000 -0500
+++ xs/GtkCellRenderer.xs       2004-06-03 10:27:45.437922000 -0500
@@ -142,7 +142,7 @@
 
                PUTBACK;
                count = call_sv ((SV *)GvCV (slot), G_ARRAY);
-//             count = call_method ("GET_SIZE", G_ARRAY);
+               /* count = call_method ("GET_SIZE", G_ARRAY); */
                SPAGAIN;
                if (count != 4)
                        croak ("GET_SIZE must return four values -- "
@@ -192,7 +192,7 @@
 
                PUTBACK;
                call_sv ((SV *)GvCV (slot), G_VOID|G_DISCARD);
-//             call_method ("RENDER", G_VOID|G_DISCARD);
+               /* call_method ("RENDER", G_VOID|G_DISCARD); */
 
                FREETMPS;
                LEAVE;
@@ -229,7 +229,7 @@
 
                PUTBACK;
                call_sv ((SV*) GvCV (slot), G_SCALAR);
-//             call_method ("ACTIVATE", G_SCALAR);
+               /* call_method ("ACTIVATE", G_SCALAR); */
                SPAGAIN;
 
                retval = POPi;
@@ -274,7 +274,7 @@
 
                PUTBACK;
                call_sv ((SV*) GvCV (slot), G_SCALAR);
-//             call_method ("START_EDITING", G_SCALAR);
+               /* call_method ("START_EDITING", G_SCALAR); */
                SPAGAIN;
 
                sv = POPs;
@@ -498,7 +498,7 @@
        gint width;
        gint height;
     PPCODE:
-       //cell_area.width = cell_area.height = 0;
+       /*cell_area.width = cell_area.height = 0;*/
        gtk_cell_renderer_get_size(cell, widget, cell_area,
                &x_offset, &y_offset, &width, &height);
        EXTEND(SP,4);
@@ -575,8 +575,8 @@
        GtkCellRendererClass * class;
     CODE:
        PERL_UNUSED_VAR (ix);
-       //warn ("%s %s", ix == 1 ? "_install_overrides" : "_INSTALL_OVERRIDES",
-       //               package);
+       /*warn ("%s %s", ix == 1 ? "_install_overrides" : "_INSTALL_OVERRIDES",*/
+       /*               package);*/
        gtype = gperl_object_type_from_package (package);
        if (!gtype)
                croak ("package '%s' is not registered with Gtk2-Perl",



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