1 /* this is a TEST file, it's VERY VERY ugly, it's just supposed to test
2 the parser of gob and somewhat test some output as well, you can
3 look in here to see a whole array of different syntax options, but
4 don't expect this to be an easy to read file */
13 /* this should go on the very top of the header */
17 /* this should go on the very top of the header as well */
20 /* this should go into the private header */
23 /* this should go into the private header as well*/
30 /* the next line is not mandatory, but if gob finds an include in one of
31 the %{ %} sections above the class definitions, it will not put it in
32 the file itself. So you can this way select where the include file is
34 #include "test-object.h"
35 #include "test-object-private.h"
37 /* this is to test if the lexer won't get confused by requires inside
42 static void jjjj(void);
52 struct _gob__struct_t {
61 #define PACKAGE_TYPE_BOXED 1
62 typedef void * PackageBoxed;
66 /* this should be in the header, just under bubu prototype */
82 error TEST_OBJECT_ERROR {
95 class Test:Object from /*G:Object*/ Gtk:Container
96 (interface Gtk:Tree:Model)
97 /* We can add more interfaces by adding more lines like the above */
98 /* Note that there must exist a GtkTreeModelIface structure */
101 /* function implemented for the Gtk:Tree:Model interface */
102 interface Gtk:Tree:Model
103 private GtkTreeModelFlags
104 get_flags (Gtk:Tree:Model *self (check null type))
107 return (GtkTreeModelFlags)0;
112 public int test_array[TEST_ARRAY];
114 argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
116 public int testing = 1;
117 argument INT testing link;
119 public char * testingstring = {g_strdup("test")}
121 argument POINTER testingstring stringlink;
123 public Test:Object * testingobj
124 unrefwith g_object_unref;
125 argument POINTER testingobj objectlink;
127 public Test:Object * testingobjllll
128 unrefwith gtk_widget_destroy;
129 argument POINTER testingobjllll objectlink;
131 public Test:Object * testingobjfoo
132 unref { if (VAR) g_object_unref (VAR); };
133 argument POINTER testingobjfoo objectlink;
135 classwide int foo = 20;
136 argument INT foo link;
138 public G:Object * testingobj2
141 g_object_unref(G_OBJECT(VAR));
143 argument POINTER (type G:Object *) testingobj2 objectlink;
145 argument POINTER (type GObject *) some_object
146 set { /* set some_object */ }
147 get { /* get some_object */
149 argument (CONSTRUCT) LONG (type long) write_only_long
150 set { /* set write_only_long */ };
151 argument POINTER (type char *) read_only_string
152 get { /* get readonly_long */
153 ARG = g_strdup("BLAH"); };
155 private char a_property;
156 property CHAR a_property
163 set { self->_priv->a_property = g_value_get_char (VAL); }
164 get { g_value_set_char (VAL, self->_priv->a_property); };
166 property OBJECT foobarblahllll1
169 object_type = Gtk:Button)
171 property OBJECT foobarblahllll2
174 object_type = G:Object)
177 private double dblnum;
178 property DOUBLE dblnum
184 flags = CONSTRUCT|CONSTRUCT_ONLY,
188 private char *b_property;
189 property STRING b_property
191 blurb = _("Blurb b"),
192 default_value = "default",
198 private Test:Object *objectproperty;
199 property OBJECT objectproperty (nick = "object",
200 blurb = "obj property",
201 object_type = Test:Object,
204 private Test:Enum enum_property;
205 property ENUM enum_property (nick = "enumprop",
207 enum_type = Test:Enum,
210 private Some:Flags flags_property;
211 property FLAGS flags_property (nick = "flagsprop",
213 flags_type = Some:Flags,
216 private PackageBoxed prop;
217 property BOXED prop (nick="prop",
219 boxed_type=Package:Boxed,
221 /* testing old semantics */
222 private PackageBoxed prop2;
223 property BOXED prop2 (nick="prop2",
225 boxed_type=PACKAGE_TYPE_BOXED,
228 private char ov_prop;
229 property CHAR ov_prop
232 set { self->_priv->ov_prop = g_value_get_char (VAL); }
233 get { g_value_set_char (VAL, self->_priv->ov_prop); };
239 public double array[23][18];
240 protected unsigned long int wagawaga;
241 public int wagawaga_should_be_after_this_in_the_header;
254 * Returns: new object
256 public GObject * new(int j (check > 0)) {
258 ret = G_OBJECT (GET_NEW);
260 SELF(ret)->_priv->j = j;
264 private int blah(self, G:Object * wid (check null type),
265 int h (check > 0)) onerror -1 {
266 g_object_set (G_OBJECT (self),
267 TEST_OBJECT_PROP_I (99),
279 * Returns: new object
281 signal last STRING (POINTER, INT)
282 char * bleh(self, G:Object * wid (check null type),
284 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
289 test_handler (self, GObject *w, int h, gpointer data)
298 * gtk_weird_button_bleh2:
305 * Returns: new object */
306 signal last INT (POINTER, INT)
307 int bleh2(self, const G:Object * wid (check null type),
310 test_object_connect__bleh (self, self_test_handler, NULL);
311 self_connect__bleh (self, self_test_handler, NULL);
312 test_object_connect_after__bleh (self, self_test_handler, NULL);
313 self_connect_after__bleh (self, self_test_handler, NULL);
314 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
315 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
320 /* testing multiple marshaller support */
323 /* this should not get documented as it's nonstandard */
329 /* Here we are testing how the gtk-doc extraction code error handeling
330 it should just ingore these */
346 *zblunk*******//**//**/
347 signal first NONE (NONE)
349 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
353 virtual int beh(self, int h (check > 0));
354 override(Gtk:Container)
355 void add(Gtk:Container * self (check null type),
356 Gtk:Widget * wid (check null type)) {
357 PARENT_HANDLER(self,wid);
361 void dispatch_properties_changed (G:Object *object,
371 public int consttest(self, const gchar *text, ...)
376 public int consttest2(self, gchar const *text, ...)
381 public int consttest3(self, G:Object const *wid (check null type))
386 public int consttest4(const self)
390 public int consttest5(self const)
394 virtual int consttest6(const self)
398 virtual int consttest7(self const)
402 public int consttest8(self)
404 Self const *selfconst1, *selfconst2;
405 selfconst1 = SELF_CONST(self);
406 selfconst2 = TEST_OBJECT_CONST(self);
409 public int consttest9(const self, int i, double b)
415 public int consttest10(self const, int i, double b)
421 signal private first NONE (NONE)
422 void googlegoogle(self)
425 self_googlegoogle2(self);
427 signal first private NONE (NONE)
428 void googlegoogle2(self)
430 int array[5][8][9]={{{0}}};
433 self_testprivvirtual(foo, array);
435 private signal first NONE (NONE)
436 void googlegoogle3(self)
440 protected signal first NONE (NONE)
441 void googlegoogle4(self)
445 protected signal first NONE (NONE)
446 void googlegoogle_const1(const self)
450 protected signal first NONE (NONE)
451 void googlegoogle_const2(self const)
456 void testprivvirtual(self, int some_array[5][8][9])
459 self_googlegoogle(self);
460 if (some_array[0]) return;
463 void testprivvirtual2(self, const int some_array[5][8][9])
466 if (some_array[0]) return;
469 void testpublicvirtual(self, int const some_array[5][8][9])
472 if (some_array[0]) return;
475 void testprotectedvirtual(self, int some_array[5][8][9])
478 if (some_array[0]) return;
480 signal first NONE (POINTER, ENUM)
481 void testarrsignal(self, long arr[8], Buble:Enum foo)
488 /* testing empty func */
489 public void foofoofoo(self) {}
490 /* testing empty func 2 */
491 public void foofoofoo2(self);
492 /* testing empty func 3 */
493 public void foofoofoo3(self) { }
494 /* testing empty func 4 */
495 public void foofoofoo4(self)
499 // override (Gtk:Widget)
500 // int event(Gtk:Widget *self (check null type),
501 // GdkEvent *event (check null)) onerror FALSE
505 // ret = PARENT_HANDLER(self,event);
509 // override(Gtk:Container)
511 // remove(Gtk:Container * self (check null type),
512 // Gtk:Widget * wid (check null type));
514 // override(Gtk:Object)
516 // destroy(Gtk:Object * self (check null type))
519 // PARENT_HANDLER(self);
524 /* just an empty function */
528 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
529 STRING,ENUM,POINTER,OBJECT)
531 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
532 gulong g, gfloat h, gdouble i, gchar * j, gint k,
533 gpointer o, GObject *p)
536 a = b = c = d = e = f = g = 0;
537 o = p = (GObject *)NULL;
539 /* ugh, testing casting */
542 public signal (NO_HOOKS) last INT (INT)
543 int testflags(self, int w (check > 0)) defreturn -99 {
549 signal BOOLEAN (NONE)
551 test_none_thing (self)
556 /* some more enum testing */
557 public BubleEnum buble;
561 enum_type = Buble:Enum,
562 default_value = BUBLE_STANDARD,
569 public int long const t4;
570 public const int long t5;
571 public const char * const t6;
572 public char const * const t7;
573 public enum _gob__enum_t const * const t8;
574 public union _gob__union_t t9;
575 public union _gob__union_t * const * const * t10;
576 public struct _gob__struct_t * const * const * t11;
577 public const struct _gob__struct_t * const * const * t13;
578 public const enum _gob__enum_t * const * const * t14;
579 public enum _gob__enum_t t15;
580 public gchar const t16;
581 public const gchar * const t17;
582 public const gchar t18;
584 /* testing method with no arguments */
585 public void method_with_no_arguments (void)
590 /* testing calling the above method */
591 public void foo (self) {
592 self_method_with_no_arguments ();
595 /* this is to test custom get_type */
599 static guint type = 0;
602 static const GtkTypeInfo info = {
604 sizeof (GtkWeirdButton),
605 sizeof (GtkWeirdButtonClass),
606 (GtkClassInitFunc) gtk_weird_button_class_init,
607 (GtkObjectInitFunc) gtk_weird_button_init,
610 (GtkClassInitFunc) NULL
613 type = gtk_type_unique (gtk_button_get_type(), &info);
620 /* testing empty statements */