From b0478b90b0074e09b2d87ebe64da666fce1f5e3b Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Fri, 12 Nov 1999 05:57:59 +0100
Subject: [PATCH] Use RETURN_THIS() and my_pop_n_elems

Rev: src/post_modules/GTK/source/gdkatom.pre:1.2
Rev: src/post_modules/GTK/source/gdkbitmap.pre:1.2
Rev: src/post_modules/GTK/source/gdkcolor.pre:1.2
Rev: src/post_modules/GTK/source/gdkdragcontext.pre:1.2
Rev: src/post_modules/GTK/source/gdkimage.pre:1.2
Rev: src/post_modules/GTK/source/gdkrectangle.pre:1.2
Rev: src/post_modules/GTK/source/gdkregion.pre:1.2
Rev: src/post_modules/GTK/source/gdkwindow.pre:1.3
Rev: src/post_modules/GTK/source/global.pre:1.2
Rev: src/post_modules/GTK/source/gtkaccelgroup.pre:1.2
Rev: src/post_modules/GTK/source/gtkadjustment.pre:1.2
Rev: src/post_modules/GTK/source/gtkbox.pre:1.2
Rev: src/post_modules/GTK/source/gtkbuttonbox.pre:1.2
Rev: src/post_modules/GTK/source/gtkclist.pre:1.2
Rev: src/post_modules/GTK/source/gtkcontainer.pre:1.2
Rev: src/post_modules/GTK/source/gtkctree.pre:1.2
Rev: src/post_modules/GTK/source/gtkcurve.pre:1.2
Rev: src/post_modules/GTK/source/gtkimage.pre:1.2
Rev: src/post_modules/GTK/source/gtklist.pre:1.2
Rev: src/post_modules/GTK/source/gtkmenushell.pre:1.2
Rev: src/post_modules/GTK/source/gtknotebook.pre:1.2
Rev: src/post_modules/GTK/source/gtkobject.pre:1.2
Rev: src/post_modules/GTK/source/gtkpixmap.pre:1.2
Rev: src/post_modules/GTK/source/gtkradiomenuitem.pre:1.2
Rev: src/post_modules/GTK/source/gtkselectiondata.pre:1.3
Rev: src/post_modules/GTK/source/gtksheet.pre:1.2
Rev: src/post_modules/GTK/source/gtksocket.pre:1.2
Rev: src/post_modules/GTK/source/gtktext.pre:1.2
Rev: src/post_modules/GTK/source/gtkwidget.pre:1.2
---
 src/post_modules/GTK/source/gdkatom.pre       |  2 +-
 src/post_modules/GTK/source/gdkbitmap.pre     |  2 +-
 src/post_modules/GTK/source/gdkcolor.pre      |  2 +-
 .../GTK/source/gdkdragcontext.pre             |  2 +-
 src/post_modules/GTK/source/gdkimage.pre      |  2 +-
 src/post_modules/GTK/source/gdkrectangle.pre  |  4 +-
 src/post_modules/GTK/source/gdkregion.pre     | 44 +++++------
 src/post_modules/GTK/source/gdkwindow.pre     | 10 +--
 src/post_modules/GTK/source/global.pre        | 76 +++++++++++++++++--
 src/post_modules/GTK/source/gtkaccelgroup.pre |  2 +-
 src/post_modules/GTK/source/gtkadjustment.pre |  2 +-
 src/post_modules/GTK/source/gtkbox.pre        |  2 +-
 src/post_modules/GTK/source/gtkbuttonbox.pre  |  4 +-
 src/post_modules/GTK/source/gtkclist.pre      | 16 ++--
 src/post_modules/GTK/source/gtkcontainer.pre  |  2 +-
 src/post_modules/GTK/source/gtkctree.pre      | 22 +++---
 src/post_modules/GTK/source/gtkcurve.pre      |  2 +-
 src/post_modules/GTK/source/gtkimage.pre      |  4 +-
 src/post_modules/GTK/source/gtklist.pre       |  2 +-
 src/post_modules/GTK/source/gtkmenushell.pre  |  2 +-
 src/post_modules/GTK/source/gtknotebook.pre   |  2 +-
 src/post_modules/GTK/source/gtkobject.pre     |  4 +-
 src/post_modules/GTK/source/gtkpixmap.pre     |  4 +-
 .../GTK/source/gtkradiomenuitem.pre           |  2 +-
 .../GTK/source/gtkselectiondata.pre           |  8 +-
 src/post_modules/GTK/source/gtksheet.pre      | 12 +--
 src/post_modules/GTK/source/gtksocket.pre     |  4 +-
 src/post_modules/GTK/source/gtktext.pre       |  2 +-
 src/post_modules/GTK/source/gtkwidget.pre     |  4 +-
 29 files changed, 154 insertions(+), 92 deletions(-)

diff --git a/src/post_modules/GTK/source/gdkatom.pre b/src/post_modules/GTK/source/gdkatom.pre
index 8b5fbc4c54..7da1ef000f 100644
--- a/src/post_modules/GTK/source/gdkatom.pre
+++ b/src/post_modules/GTK/source/gdkatom.pre
@@ -17,6 +17,6 @@ NAME_ARGS(atom_name, only_if_exists);
 FUNCTION(get_name, "function(void:string)");
 // Returns the name of the atom.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_text( gdk_atom_name( (GdkAtom)THIS->obj ) );
 }
diff --git a/src/post_modules/GTK/source/gdkbitmap.pre b/src/post_modules/GTK/source/gdkbitmap.pre
index 1622d82b32..690140fa9e 100644
--- a/src/post_modules/GTK/source/gdkbitmap.pre
+++ b/src/post_modules/GTK/source/gdkbitmap.pre
@@ -32,7 +32,7 @@ NAME_ARGS(image|xsize, void|ysize, void|xbitmapdata);
   THIS->obj = (void *)gdk_bitmap_create_from_data(0, d, x, y);
   if(!THIS->obj)
     error("Failed to create bitmap\n");
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(destroy, "function(void:void)");
diff --git a/src/post_modules/GTK/source/gdkcolor.pre b/src/post_modules/GTK/source/gdkcolor.pre
index 3f75513435..3bff682c86 100644
--- a/src/post_modules/GTK/source/gdkcolor.pre
+++ b/src/post_modules/GTK/source/gdkcolor.pre
@@ -85,7 +85,7 @@ FUNCTION(image_color_object, "function(void:object)");
            ((GdkColor *)THIS->obj)->green,
            ((GdkColor *)THIS->obj)->blue );
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   pgtk_get_image_module();
   pgtk_index_stack( "Color" );
   pgtk_index_stack(colorname);
diff --git a/src/post_modules/GTK/source/gdkdragcontext.pre b/src/post_modules/GTK/source/gdkdragcontext.pre
index 212943a310..37fd79ae05 100644
--- a/src/post_modules/GTK/source/gdkdragcontext.pre
+++ b/src/post_modules/GTK/source/gdkdragcontext.pre
@@ -9,7 +9,7 @@ FUNCTION(get_source_widget, "function(void:object)");
 // Return the drag source widget.
 RETURNS(GTK.Widget);
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_gtkobjectclass(gtk_drag_get_source_widget(((GdkDragContext *)THIS->obj)),
                       pgtk_widget_program);
 }
diff --git a/src/post_modules/GTK/source/gdkimage.pre b/src/post_modules/GTK/source/gdkimage.pre
index 3ecf4fbd63..63b096387e 100644
--- a/src/post_modules/GTK/source/gdkimage.pre
+++ b/src/post_modules/GTK/source/gdkimage.pre
@@ -133,7 +133,7 @@ NAME_ARGS(x,y);
   int x, y;
   get_all_args("get_pixel", args, "%d%d", &x, &y);
   if(!THIS->obj) error("No image.\n");
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( gdk_image_get_pixel( (void *)THIS->obj, x, y ) );
 }
 FUNCTION(set_pixel, "function(int,int,int:object)")
diff --git a/src/post_modules/GTK/source/gdkrectangle.pre b/src/post_modules/GTK/source/gdkrectangle.pre
index 251ae39cb0..01b38ab3a2 100644
--- a/src/post_modules/GTK/source/gdkrectangle.pre
+++ b/src/post_modules/GTK/source/gdkrectangle.pre
@@ -32,7 +32,7 @@ NAME_ARGS(type);
 
   if(!strcmp(type, "mapping"))
   {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_text( "x" );
     push_int( r->x );
     push_text( "y" );
@@ -43,7 +43,7 @@ NAME_ARGS(type);
     push_int( r->height );
     f_aggregate_mapping( 8 );
   } else if(!strcmp(type, "array")) {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int( r->x );
     push_int( r->y );
     push_int( r->width );
diff --git a/src/post_modules/GTK/source/gdkregion.pre b/src/post_modules/GTK/source/gdkregion.pre
index 12b614e1dc..ff0402c4a6 100644
--- a/src/post_modules/GTK/source/gdkregion.pre
+++ b/src/post_modules/GTK/source/gdkregion.pre
@@ -1,4 +1,16 @@
 PROGRAM(GdkRegion);
+
+static void return_gdkregion( int n, void *r )
+{
+  struct object *o;
+  my_pop_n_elems( n );
+  o = low_clone( pgtk_GdkRegion_program );
+  call_c_initializers( o );
+  ((struct object_wrapper *)o->storage)->obj = r;
+  push_object( o );
+}
+
+
 FUNCTION(create, "function(void:void)");
 // Create a new (empty) region
 // 
@@ -23,12 +35,12 @@ NAME_ARGS(victim);
   r = get_gdkobject( o, Region );
   if(!r)
   {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int(0);
     return;
   } else {
     int eq = gdk_region_equal( (GdkRegion *)THIS->obj, r );
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int(eq);
   }
 }
@@ -39,7 +51,7 @@ NAME_ARGS(x,y);
 {
   int x, y;
   get_all_args( "point_in", args, "%d%d", &x, &y );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( gdk_region_point_in( (GdkRegion *)THIS->obj, x, y ) );
 }
 
@@ -56,7 +68,7 @@ NAME_ARGS(rectangle);
     error("Bad argument 1 to GDK.rect_in( GDK.Rectangle r )\n");
   } else {
     int b = gdk_region_rect_in((GdkRegion *)THIS->obj,  r);
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int( b );
   }
 }
@@ -106,11 +118,7 @@ NAME_ARGS(with);
     r = gdk_regions_union( (GdkRegion *)THIS->obj, v);
   else
     error("Bad argument to union: Not Region or Rectangle\n");
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -130,11 +138,7 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to intersect: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -154,11 +158,7 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to subtract: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -178,10 +178,6 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to xor: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
diff --git a/src/post_modules/GTK/source/gdkwindow.pre b/src/post_modules/GTK/source/gdkwindow.pre
index 856446e9e8..2609ab4898 100644
--- a/src/post_modules/GTK/source/gdkwindow.pre
+++ b/src/post_modules/GTK/source/gdkwindow.pre
@@ -42,14 +42,14 @@ NAME_ARGS(XWindowID|parent,void|atrributes);
 FUNCTION(is_viewable, "function(void:int)");
 // Return 1 if the window is mapped.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(gdk_window_is_viewable( (GdkWindow *)THIS->obj ));
 }
 
 FUNCTION(is_visible, "function(void:int)");
 // Return 1 if the window, or a part of the window, is visible right now.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(gdk_window_is_visible( (GdkWindow *)THIS->obj ));
 }
 
@@ -245,7 +245,7 @@ RETURNS(array(GDK.Window));
     n++;
     l = l->next;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   f_aggregate(n);
 }
 
@@ -476,7 +476,7 @@ NAME_ARGS( property, offset, delete_when_done );
                        &retdata ))
   {
     struct object *o;
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_text( "type" );
     push_text( gdk_atom_name( actual_property_type ) );
     push_text( "width" );
@@ -500,7 +500,7 @@ NAME_ARGS( property, offset, delete_when_done );
     f_aggregate_mapping( 6 );
     return;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 }
 
diff --git a/src/post_modules/GTK/source/global.pre b/src/post_modules/GTK/source/global.pre
index df2425f960..6127edd034 100644
--- a/src/post_modules/GTK/source/global.pre
+++ b/src/post_modules/GTK/source/global.pre
@@ -33,7 +33,7 @@ NAME_ARGS(rc);
   char *s;
   get_all_args("parse_rc", args, "%s", &s );
   gtk_rc_parse_string( s );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 /*   gtk_widget_propagate_default_style(); */
 }
@@ -46,7 +46,7 @@ FUNCTION(root_window, "function(void:object)");
 RETURNS(GDK.Window);
 // Returns the root window of the current display (as a GDK.Window)
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(pgtk_root_window) 
   {
     ref_push_object( pgtk_root_window );
@@ -151,6 +151,7 @@ NAME_ARGS(argv, do_not_parse_rc);
   g_log_set_handler("Glib",G_LOG_LEVEL_ERROR,  (void *)do_error, NULL );
   g_log_set_handler("Glib",G_LOG_LEVEL_WARNING,(void *)do_error, NULL );
   g_log_set_handler("Glib",G_LOG_LEVEL_MESSAGE,(void *)do_error, NULL );
+  gtk_set_locale();
   gtk_init( &argc, &data );
   g_log_set_handler("Gdk",G_LOG_LEVEL_CRITICAL,(void *)do_error, NULL );
   g_log_set_handler("Gdk",G_LOG_LEVEL_ERROR,   (void *)do_error, NULL );
@@ -195,7 +196,7 @@ NAME_ARGS(argv, do_not_parse_rc);
 # error Fixme. This needs some work.
 #endif  
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   /*
    * Now it's time to return the leftovers.
    */
@@ -210,7 +211,7 @@ FUNCTION(flush, "function(void:void)")
 {
   gdk_flush();
   while(g_main_iteration( 0 ) );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(0);
 }
 
@@ -218,7 +219,7 @@ FUNCTION(low_flush, "function(void:void)")
 // Flush X. Not normally needed.
 {
   XFlush( GDK_DISPLAY() );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( 0 );
 }
 
@@ -232,3 +233,68 @@ NAME_ARGS(argc,no_pgtkrc);
 }
 
 
+FUNCTION(main, "function(void:void)");
+// Start GTK in blocking mode.<br>
+// Doing this disables asynchronous I/O in pike.<br>
+// You can return -1 from main in pike to run GTK (and the rest of
+// pike) in asynchrounous mode.
+{
+  gtk_main();
+}
+
+FUNCTION(main_quit, "function(void:void)");
+// Exit from the gtk_main function on the next iteration.
+{
+  gtk_main_quit();
+}
+
+FUNCTION(main_level, "function(void:int)");
+// Return the current recursion depth.
+{
+  push_int( gtk_main_level() );
+}
+
+FUNCTION(main_iteration_do, "function(int:void)");
+NAME_ARGS(block);
+// Run one iteration in the mainloop. If block is true, wait for an
+// event before returning.
+{
+  int n;
+  get_all_args( "gtk_main_iteration_do", args, "%d", &n );
+  gtk_main_iteration_do( n );
+}
+
+FUNCTION(true, "function(void:int)");
+// Always returns true.
+// To be used as a signal function.
+{
+  push_int( 1 );
+}
+
+FUNCTION(false, "function(void:int)");
+// Always returns false.
+// To be used as a signal function.
+{
+  push_int( 0 );
+}
+
+FUNCTION(grab_add, "function(object:void)");
+ARGS(GTK.Widget);
+NAME_ARGS(widget);
+{
+  struct object *o;
+  get_all_args( "gtk_grab_add", args, "%o", &o );
+  gtk_grab_add( GTK_WIDGET( get_gtkobject( o ) ) );
+  my_pop_n_elems( args );
+}
+
+FUNCTION(grab_remove, "function(object:void)");
+ARGS(GTK.Widget);
+NAME_ARGS(widget);
+{
+  struct object *o;
+  get_all_args( "gtk_grab_remove", args, "%o", &o );
+  gtk_grab_remove( GTK_WIDGET( get_gtkobject( o ) ) );
+  my_pop_n_elems( args );
+}
+
diff --git a/src/post_modules/GTK/source/gtkaccelgroup.pre b/src/post_modules/GTK/source/gtkaccelgroup.pre
index b2acf4f906..804f017149 100644
--- a/src/post_modules/GTK/source/gtkaccelgroup.pre
+++ b/src/post_modules/GTK/source/gtkaccelgroup.pre
@@ -50,7 +50,7 @@ RETURNS(GTK.AccelGroup);
 /* { */
 /*   int k, mod; */
 /*   get_all_args("check", args, "%d%d", &k, &mod ); */
-/*   pop_n_elems(args); */
+/*   my_pop_n_elems(args); */
 /*   push_int( gtk_accelerator_table_check( (void *)THIS->obj, k, mod ) ); */
 /* } */
 /* FUNCTION(set_mod_mask, "function(int:object)") */
diff --git a/src/post_modules/GTK/source/gtkadjustment.pre b/src/post_modules/GTK/source/gtkadjustment.pre
index 506058ce00..d2487d2c1f 100644
--- a/src/post_modules/GTK/source/gtkadjustment.pre
+++ b/src/post_modules/GTK/source/gtkadjustment.pre
@@ -40,7 +40,7 @@ NAME_ARGS(value,lower,upper,step_increment,page_increment,page_size);
   if(!THIS->obj) 
     error("Failed to initiate adjustment\n");
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 }
 COMPLEX_FUNCTION(set_value, float);
diff --git a/src/post_modules/GTK/source/gtkbox.pre b/src/post_modules/GTK/source/gtkbox.pre
index 5337e0a5e2..0cae677d5e 100644
--- a/src/post_modules/GTK/source/gtkbox.pre
+++ b/src/post_modules/GTK/source/gtkbox.pre
@@ -56,7 +56,7 @@ RETURNS("mapping(string:int)");
   gtk_box_query_child_packing( GTK_BOX( THIS->obj ), 
                                GTK_WIDGET( get_gtkobject( o ) ),
                                &ex, &fi, &pa, &ty );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_constant_text( "expand" );
   push_int( ex );
   push_constant_text( "fill" );
diff --git a/src/post_modules/GTK/source/gtkbuttonbox.pre b/src/post_modules/GTK/source/gtkbuttonbox.pre
index 0bb77fd258..7d549ac815 100644
--- a/src/post_modules/GTK/source/gtkbuttonbox.pre
+++ b/src/post_modules/GTK/source/gtkbuttonbox.pre
@@ -27,7 +27,7 @@ FUNCTION(get_child_size, "function(void:mapping)");
 // Return the child size as ([ "x":xsize, "y":ysize ]) 
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_button_box_get_child_size( GTK_BUTTON_BOX( THIS->obj ), &x, &y );
   push_constant_text( "x" );
   push_int( x );
@@ -39,7 +39,7 @@ FUNCTION(get_child_ipadding, "function(void:mapping)");
 // Return the default inter-child padding ([ "x":xpadding, "y":ypadding ]) 
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_button_box_get_child_ipadding( GTK_BUTTON_BOX( THIS->obj ), &x, &y );
   push_constant_text( "x" );
   push_int( x );
diff --git a/src/post_modules/GTK/source/gtkclist.pre b/src/post_modules/GTK/source/gtkclist.pre
index 25e0b2460e..176ef682ad 100644
--- a/src/post_modules/GTK/source/gtkclist.pre
+++ b/src/post_modules/GTK/source/gtkclist.pre
@@ -168,7 +168,7 @@ NAME_ARGS( row, column );
   gchar *p = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_clist_get_text( GTK_CLIST( THIS->obj ), x, y, &p );
   if(p)
     push_text(p);
@@ -210,7 +210,7 @@ NAME_ARGS( row, column );
   GdkBitmap *b = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_clist_get_pixmap( GTK_CLIST( THIS->obj ), x, y, &p, &b );
   push_text( "pixmap" );
   if(p)
@@ -273,7 +273,7 @@ NAME_ARGS( row, column );
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
   gtk_clist_get_pixtext( GTK_CLIST( THIS->obj ), x, y, &t, &s, &p, &b );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
   push_text( "spacing" );
   push_int( s );
@@ -424,7 +424,7 @@ NAME_ARGS(row);
   get_all_args( "get_row_data", args, "%d", &row );
 
   o = gtk_clist_get_row_data( GTK_CLIST( THIS->obj ), row );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(o)
     ref_push_object( o );
   else
@@ -440,7 +440,7 @@ NAME_ARGS(data);
   struct object *o;
   get_all_args( "find_row_from_data", args, "%o", &o );
   row = gtk_clist_find_row_from_data( GTK_CLIST( THIS->obj ), o );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( row );
 }
 
@@ -471,7 +471,7 @@ RETURNS(mapping(string:int));
   get_all_args( "get_selection_info", args, "%d%d", &x, &y );
   gtk_clist_get_selection_info( GTK_CLIST( THIS->obj ), x, y, &r, &c );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_text( "row" );
   push_int( r );
   push_text( "column" );
@@ -499,7 +499,7 @@ NAME_ARGS(row);
   GtkStyle *style;
   int row;
   get_all_args("get_foreground", args, "%d", &row );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if (row < 0 || row >= clist->rows)
     error("Invalid row.\n");
   clist_row = (g_list_nth (clist->row_list, row))->data;
@@ -529,7 +529,7 @@ NAME_ARGS(row);
   GtkStyle *style;
   int row;
   get_all_args("get_background", args, "%d", &row );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if (row < 0 || row >= clist->rows)
     error("Invalid row.\n");
   clist_row = (g_list_nth (clist->row_list, row))->data;
diff --git a/src/post_modules/GTK/source/gtkcontainer.pre b/src/post_modules/GTK/source/gtkcontainer.pre
index b5c2f03474..05fe29018d 100644
--- a/src/post_modules/GTK/source/gtkcontainer.pre
+++ b/src/post_modules/GTK/source/gtkcontainer.pre
@@ -46,7 +46,7 @@ RETURNS(array(GTK.Widget));
 {
   GList *g;
   int n = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   g = gtk_container_children( GTK_CONTAINER( THIS->obj ) );
   while(g)
   {
diff --git a/src/post_modules/GTK/source/gtkctree.pre b/src/post_modules/GTK/source/gtkctree.pre
index 2ae3ccadd6..c33316f160 100644
--- a/src/post_modules/GTK/source/gtkctree.pre
+++ b/src/post_modules/GTK/source/gtkctree.pre
@@ -103,7 +103,7 @@ RETURNS(GTK.CTreeNode);
                                    is_leaf,
                                    expanded);
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( sibling, pgtk_CTreeNode_program );
 }
 
@@ -201,7 +201,7 @@ NAME_ARGS(data,root);
   if(root)
     root_node = get_pgdkobject( root, pgtk_CTreeNode_program );
   row = gtk_ctree_find_by_row_data( GTK_CTREE( THIS->obj ), root_node, o );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 
   if(row == NULL)
     push_int( 0 );
@@ -293,7 +293,7 @@ NAME_ARGS( node, column );
   gchar *p = NULL;
   get_all_args( "get_*", args, "%o%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_ctree_node_get_text( GTK_CTREE( THIS->obj ), 
                            get_pgdkobject(x,pgtk_CTreeNode_program), 
                            y, &p );
@@ -314,7 +314,7 @@ NAME_ARGS( row, column );
   GdkBitmap *b = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_ctree_node_get_pixmap( GTK_CTREE( THIS->obj ), 
                              get_pgdkobject(x,pgtk_CTreeNode_program),
                              y, &p, &b );
@@ -355,7 +355,7 @@ NAME_ARGS( row, column );
   gtk_ctree_node_get_pixtext( GTK_CTREE( THIS->obj ), 
                               get_pgdkobject(x,pgtk_CTreeNode_program),
                               y, &t, &s, &p, &b );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
   push_text( "spacing" );
   push_int( s );
@@ -455,7 +455,7 @@ NAME_ARGS(node);
 
   o = gtk_ctree_node_get_row_data( GTK_CTREE( THIS->obj ),  
                                    get_pgdkobject(row,pgtk_CTreeNode_program));
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(o)
     ref_push_object( o );
   else
@@ -513,7 +513,7 @@ RETURNS(GTK.CTreeRow);
 // <b>DEPRECATED</b>, all CTreeRow functions are also available
 // directly in this object.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_ROW( THIS->obj ), pgtk_CTreeRow_program );
 }
 
@@ -521,7 +521,7 @@ FUNCTION(parent, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the parent node
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE(GTK_CTREE_ROW( THIS->obj )->parent), 
                    pgtk_CTreeNode_program );
 }
@@ -530,7 +530,7 @@ FUNCTION(child, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the first child node
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE(GTK_CTREE_ROW( THIS->obj )->children), 
                    pgtk_CTreeNode_program );
 }
@@ -540,7 +540,7 @@ FUNCTION(next, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the next sibling (the next on the same  level)
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE_NEXT( THIS->obj ), pgtk_CTreeNode_program );
 }
 
@@ -548,7 +548,7 @@ FUNCTION(prev, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the previous sibling (the next on the same level)
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE_PREV( THIS->obj ), pgtk_CTreeNode_program );
 }
 
diff --git a/src/post_modules/GTK/source/gtkcurve.pre b/src/post_modules/GTK/source/gtkcurve.pre
index cfb1e79449..14069f4967 100644
--- a/src/post_modules/GTK/source/gtkcurve.pre
+++ b/src/post_modules/GTK/source/gtkcurve.pre
@@ -13,7 +13,7 @@ NAME_ARGS(num_points);
   int num_points, q=0;
   gfloat *vector;
   get_all_args("get_vector", args, "%d", &num_points);
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   vector = malloc(sizeof(gfloat) * num_points);
   gtk_curve_get_vector( GTK_CURVE(THIS->obj), num_points, vector );
   while(q < num_points)
diff --git a/src/post_modules/GTK/source/gtkimage.pre b/src/post_modules/GTK/source/gtkimage.pre
index 8538b51e98..92d5638778 100644
--- a/src/post_modules/GTK/source/gtkimage.pre
+++ b/src/post_modules/GTK/source/gtkimage.pre
@@ -32,7 +32,7 @@ NAME_ARGS(image,mask);
   }
   THIS->obj = GTK_OBJECT( gtk_image_new( img, mask ) );
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(set, "function(object,object|void:object)")
@@ -72,7 +72,7 @@ FUNCTION(get, "function(void:mapping)");
 {
   GdkImage *v;
   GdkBitmap *m;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_image_get( GTK_IMAGE( THIS->obj ), &v, &m );
   push_text( "image" );
   if(v)
diff --git a/src/post_modules/GTK/source/gtklist.pre b/src/post_modules/GTK/source/gtklist.pre
index 37bce8affb..997d284a06 100644
--- a/src/post_modules/GTK/source/gtklist.pre
+++ b/src/post_modules/GTK/source/gtklist.pre
@@ -10,7 +10,7 @@ RETURNS(array(GTK.Widget));
 {
   GList *s = GTK_LIST( THIS->obj )->selection;
   int j = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   while( s )
   {
     push_gtkobjectclass( (void *)s->data, pgtk_list_item_program );
diff --git a/src/post_modules/GTK/source/gtkmenushell.pre b/src/post_modules/GTK/source/gtkmenushell.pre
index 14eba8f93f..8765083917 100644
--- a/src/post_modules/GTK/source/gtkmenushell.pre
+++ b/src/post_modules/GTK/source/gtkmenushell.pre
@@ -49,7 +49,7 @@ RETURNS(array(GTK.MenuItem));
 {
   GList *g;
   int n = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   g = GTK_MENU_SHELL( THIS->obj )->children;
   while(g)
   {
diff --git a/src/post_modules/GTK/source/gtknotebook.pre b/src/post_modules/GTK/source/gtknotebook.pre
index ea036a350d..29fd3a9ce2 100644
--- a/src/post_modules/GTK/source/gtknotebook.pre
+++ b/src/post_modules/GTK/source/gtknotebook.pre
@@ -118,7 +118,7 @@ NAME_ARGS(page);
                                         &expand,
                                         &fill,
                                         &pack_type );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_text( "expand" );
   push_int( expand );
   push_text( "fill" );
diff --git a/src/post_modules/GTK/source/gtkobject.pre b/src/post_modules/GTK/source/gtkobject.pre
index 18d7f90fe8..c8fa919262 100644
--- a/src/post_modules/GTK/source/gtkobject.pre
+++ b/src/post_modules/GTK/source/gtkobject.pre
@@ -14,7 +14,7 @@ FUNCTION(destroy, "function(void:void)");
     gtk_object_destroy( THIS->obj );
     THIS->obj = NULL;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(0);
 }
 
@@ -104,7 +104,7 @@ NAME_ARGS(signal_name,callback_function,callback_arg);
   id = gtk_signal_connect_full(THIS->obj, a, 0, 
                                (void *)pgtk_signal_func_wrapper, b,
 			       (void *)pgtk_free_signal_data, FALSE, FALSE);
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( id );
 }
 
diff --git a/src/post_modules/GTK/source/gtkpixmap.pre b/src/post_modules/GTK/source/gtkpixmap.pre
index 722ea43faa..e1185c112e 100644
--- a/src/post_modules/GTK/source/gtkpixmap.pre
+++ b/src/post_modules/GTK/source/gtkpixmap.pre
@@ -40,7 +40,7 @@ NAME_ARGS(pixmap,mask);
     mask = get_gdkobject( b, Bitmap );
   THIS->obj = GTK_OBJECT( gtk_pixmap_new( img, mask ) );
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(set, "function(object,object|void:object)")
@@ -76,7 +76,7 @@ FUNCTION(get, "function(void:mapping)");
 //            "pixmap_insensitive":insensitive version of the pixmap <br>
 //          ]) <br>
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
 
   push_text( "pixmap" );
diff --git a/src/post_modules/GTK/source/gtkradiomenuitem.pre b/src/post_modules/GTK/source/gtkradiomenuitem.pre
index 4ccca62a8d..8a914082f9 100644
--- a/src/post_modules/GTK/source/gtkradiomenuitem.pre
+++ b/src/post_modules/GTK/source/gtkradiomenuitem.pre
@@ -27,7 +27,7 @@ NAME_ARGS(title,groupmember);
     THIS->obj=GTK_OBJECT(gtk_radio_menu_item_new_with_label(mylist,label));
   else
     THIS->obj=GTK_OBJECT(gtk_radio_menu_item_new(mylist));
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   pgtk__init_this_object();
 }
 
diff --git a/src/post_modules/GTK/source/gtkselectiondata.pre b/src/post_modules/GTK/source/gtkselectiondata.pre
index aa85dfe91e..5f7401a283 100644
--- a/src/post_modules/GTK/source/gtkselectiondata.pre
+++ b/src/post_modules/GTK/source/gtkselectiondata.pre
@@ -8,7 +8,7 @@ FUNCTION(data, "function(void:string)");
 // or 32 bits per character).
 {
   int length = ((GtkSelectionData *)THIS->obj)->length;
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(length < 0)
   {
     push_int(0);
@@ -37,7 +37,7 @@ FUNCTION(format, "function(void:int)");
 // Returns the selction format.<br>
 // The format is the number of bits per character.
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( ((GtkSelectionData *)THIS->obj)->format );
 }
 
@@ -47,7 +47,7 @@ FUNCTION(length, "function(void:int)");
 // The size of the data in characters (as returned by data()) is not
 // nessasarily the same.
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( ((GtkSelectionData *)THIS->obj)->length );
 }
 
@@ -68,7 +68,7 @@ NAME_ARGS(data);
 }
 
 
-#define RETURN_GDKATOM(X) pop_n_elems(args); push_pgdkobject( ((void *)((GtkSelectionData *)THIS->obj)->X), pgtk_Gdk_Atom_program );
+#define RETURN_GDKATOM(X) my_pop_n_elems(args); push_pgdkobject( ((void *)((GtkSelectionData *)THIS->obj)->X), pgtk_Gdk_Atom_program );
 
 
 FUNCTION(target, "function(void:object)");
diff --git a/src/post_modules/GTK/source/gtksheet.pre b/src/post_modules/GTK/source/gtksheet.pre
index e8c377e7d4..1aaf40d80d 100644
--- a/src/post_modules/GTK/source/gtksheet.pre
+++ b/src/post_modules/GTK/source/gtksheet.pre
@@ -126,7 +126,7 @@ FUNCTION(get_attributes, "function(int,int:mapping)");
   int x, y;
   GtkSheetCellAttr attr;
   get_all_args( "get_attributes", args, "%d%d", &x, &y );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if( gtk_sheet_get_attributes( GTK_SHEET(THIS->obj),x,y, &attr ) )
   {
     push_text("justification"); 
@@ -203,7 +203,7 @@ FUNCTION(select_range, "function(void:mapping)");
 NAME_ARGS(x0,y0,x1,y1);
 {
   GtkSheetRange r;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_select_range( GTK_SHEET( THIS->obj ), &r );
   push_text( "x0" ); push_int( r.col0 );
   push_text( "y0" ); push_int( r.row0 );
@@ -215,7 +215,7 @@ FUNCTION(unselect_range, "function(void:mapping)");
 NAME_ARGS(x0,y0,x1,y1);
 {
   GtkSheetRange r;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_unselect_range( GTK_SHEET( THIS->obj ), &r );
   push_text( "x0" ); push_int( r.col0 );
   push_text( "y0" ); push_int( r.row0 );
@@ -227,7 +227,7 @@ int COMPLEX_FUNCTION(set_active_cell, int, int);
 FUNCTION(get_active_cell, "function(void:mapping)");
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_get_active_cell( GTK_SHEET(THIS->obj), &x, &y );
   push_text( "row" ); push_int( x );
   push_text( "col" ); push_int( y );
@@ -239,7 +239,7 @@ string COMPLEX_FUNCTION(cell_get_text, int, int);
 COMPLEX_FUNCTION(cell_clear, int, int);
 FUNCTION(clear, "function(void:object)");
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_range_clear(GTK_SHEET(THIS->obj), NULL);
   RETURN_THIS();
 }
@@ -258,7 +258,7 @@ FUNCTION(get_pixel_info, "function(int,int:mapping)");
   int x, y, r, c;
   get_all_args( "get_pixel_info", args, "%d%d", &x, &y );
   
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_get_pixel_info( GTK_SHEET(THIS->obj),x,y, &r, &c );
   push_text( "row" ); push_int( r );
   push_text( "col" ); push_int( c );
diff --git a/src/post_modules/GTK/source/gtksocket.pre b/src/post_modules/GTK/source/gtksocket.pre
index 582a8c74a0..6e2346e571 100644
--- a/src/post_modules/GTK/source/gtksocket.pre
+++ b/src/post_modules/GTK/source/gtksocket.pre
@@ -30,14 +30,14 @@ FUNCTION(id, "function(void:int)");
 {
   if( !GTK_WIDGET( THIS->obj )->window )
     error("You must realize this widget before calling this function.\n");
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int(GDK_WINDOW_XWINDOW( GTK_WIDGET( THIS->obj )->window ));
 }
 
 FUNCTION(has_plug, "function(void:int)");
 // Returns true if this socket is occupied
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if( GTK_SOCKET( THIS->obj )->plug_window 
       || gtk_container_children( GTK_CONTAINER( THIS->obj )) )
     push_int( 1 );
diff --git a/src/post_modules/GTK/source/gtktext.pre b/src/post_modules/GTK/source/gtktext.pre
index c5daf850b7..19ccea873f 100644
--- a/src/post_modules/GTK/source/gtktext.pre
+++ b/src/post_modules/GTK/source/gtktext.pre
@@ -118,7 +118,7 @@ FUNCTION(get_text, "function(void:string)")
 {
   struct pike_string *res;
   unsigned int i;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   res = begin_shared_string( gtk_text_get_length( GTK_TEXT( THIS->obj ) ) );
   for(i=0; i<(unsigned int)res->len; i++)
     res->str[i] = GTK_TEXT_INDEX( GTK_TEXT( THIS->obj ), i );
diff --git a/src/post_modules/GTK/source/gtkwidget.pre b/src/post_modules/GTK/source/gtkwidget.pre
index bc5a273f35..4055ea8eba 100644
--- a/src/post_modules/GTK/source/gtkwidget.pre
+++ b/src/post_modules/GTK/source/gtkwidget.pre
@@ -136,7 +136,7 @@ FUNCTION(get_gdkwindow, "function(void:object)");
 RETURNS(GDK.Window);
 // Return the GDK.Window associated with this widget, if any.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if(GTK_WIDGET(THIS->obj)->window)
   {
     struct object *o;
@@ -613,7 +613,7 @@ NAME_ARGS(mask);
 // GTK.Visible.
 RETURNS(GTK.Widget);
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( GTK_WIDGET_FLAGS(GTK_WIDGET(THIS->obj)) | sp[-1].u.integer );
 }
 
-- 
GitLab