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
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 * testingobjfoo
128 unref { if (VAR) g_object_unref (VAR); };
129 argument POINTER testingobjfoo objectlink;
131 classwide int foo = 20;
132 argument INT foo link;
134 public G:Object * testingobj2
137 g_object_unref(G_OBJECT(VAR));
139 argument POINTER (type G:Object *) testingobj2 objectlink;
141 argument POINTER (type GObject *) some_object
142 set { /* set some_object */ }
143 get { /* get some_object */
145 argument (CONSTRUCT) LONG (type long) write_only_long
146 set { /* set write_only_long */ };
147 argument POINTER (type char *) read_only_string
148 get { /* get readonly_long */
149 ARG = g_strdup("BLAH"); };
151 private char a_property;
152 property CHAR a_property
159 set { self->_priv->a_property = g_value_get_char (VAL); }
160 get { g_value_set_char (VAL, self->_priv->a_property); };
162 property OBJECT foobarblahllll1
165 object_type = Gtk:Button)
167 property OBJECT foobarblahllll2
170 object_type = G:Object)
173 private double dblnum;
174 property DOUBLE dblnum
180 flags = CONSTRUCT|CONSTRUCT_ONLY,
184 private char *b_property;
185 property STRING b_property
187 blurb = _("Blurb b"),
188 default_value = "default",
194 private Test:Object *objectproperty;
195 property OBJECT objectproperty (nick = "object",
196 blurb = "obj property",
197 object_type = Test:Object,
200 private Test:Enum enum_property;
201 property ENUM enum_property (nick = "enumprop",
203 enum_type = Test:Enum,
206 private Some:Flags flags_property;
207 property FLAGS flags_property (nick = "flagsprop",
209 flags_type = Some:Flags,
212 private PackageBoxed prop;
213 property BOXED prop (nick="prop",
215 boxed_type=Package:Boxed,
217 /* testing old semantics */
218 private PackageBoxed prop2;
219 property BOXED prop2 (nick="prop2",
221 boxed_type=PACKAGE_TYPE_BOXED,
228 public double array[23][18];
229 protected unsigned long int wagawaga;
230 public int wagawaga_should_be_after_this_in_the_header;
243 * Returns: new object
245 public GObject * new(int j (check > 0)) {
247 ret = G_OBJECT (GET_NEW);
249 SELF(ret)->_priv->j = j;
253 private int blah(self, G:Object * wid (check null type),
254 int h (check > 0)) onerror -1 {
255 g_object_set (G_OBJECT (self),
256 TEST_OBJECT_PROP_I (99),
268 * Returns: new object
270 signal last STRING (POINTER, INT)
271 char * bleh(self, G:Object * wid (check null type),
273 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
278 test_handler (self, GObject *w, int h, gpointer data)
287 * gtk_weird_button_bleh2:
294 * Returns: new object */
295 signal last INT (POINTER, INT)
296 int bleh2(self, const G:Object * wid (check null type),
299 test_object_connect__bleh (self, self_test_handler, NULL);
300 self_connect__bleh (self, self_test_handler, NULL);
301 test_object_connect_after__bleh (self, self_test_handler, NULL);
302 self_connect_after__bleh (self, self_test_handler, NULL);
303 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
304 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
309 /* testing multiple marshaller support */
312 /* this should not get documented as it's nonstandard */
318 /* Here we are testing how the gtk-doc extraction code error handeling
319 it should just ingore these */
335 *zblunk*******//**//**/
336 signal first NONE (NONE)
338 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
342 virtual int beh(self, int h (check > 0));
343 /*override(G:Object) void add(Gtk:Container * self (check null type),
344 Gtk:Widget * wid (check null type)) {
345 PARENT_HANDLER(self,wid);
347 public int consttest(self, const gchar *text, ...)
352 public int consttest2(self, gchar const *text, ...)
357 public int consttest3(self, G:Object const *wid (check null type))
362 public int consttest4(const self)
366 public int consttest5(self const)
370 virtual int consttest6(const self)
374 virtual int consttest7(self const)
378 public int consttest8(self)
380 Self const *selfconst1, *selfconst2;
381 selfconst1 = SELF_CONST(self);
382 selfconst2 = TEST_OBJECT_CONST(self);
385 public int consttest9(const self, int i, double b)
391 public int consttest10(self const, int i, double b)
397 signal private first NONE (NONE)
398 void googlegoogle(self)
401 self_googlegoogle2(self);
403 signal first private NONE (NONE)
404 void googlegoogle2(self)
406 int array[5][8][9]={{{0}}};
409 self_testprivvirtual(foo, array);
411 private signal first NONE (NONE)
412 void googlegoogle3(self)
416 protected signal first NONE (NONE)
417 void googlegoogle4(self)
421 protected signal first NONE (NONE)
422 void googlegoogle_const1(const self)
426 protected signal first NONE (NONE)
427 void googlegoogle_const2(self const)
432 void testprivvirtual(self, int some_array[5][8][9])
435 self_googlegoogle(self);
436 if (some_array[0]) return;
439 void testprivvirtual2(self, const int some_array[5][8][9])
442 if (some_array[0]) return;
445 void testpublicvirtual(self, int const some_array[5][8][9])
448 if (some_array[0]) return;
451 void testprotectedvirtual(self, int some_array[5][8][9])
454 if (some_array[0]) return;
456 signal first NONE (POINTER, ENUM)
457 void testarrsignal(self, long arr[8], Buble:Enum foo)
464 /* testing empty func */
465 public void foofoofoo(self) {}
466 /* testing empty func 2 */
467 public void foofoofoo2(self);
468 /* testing empty func 3 */
469 public void foofoofoo3(self) { }
470 /* testing empty func 4 */
471 public void foofoofoo4(self)
475 // override (Gtk:Widget)
476 // int event(Gtk:Widget *self (check null type),
477 // GdkEvent *event (check null)) onerror FALSE
481 // ret = PARENT_HANDLER(self,event);
485 // override(Gtk:Container)
487 // remove(Gtk:Container * self (check null type),
488 // Gtk:Widget * wid (check null type));
490 // override(Gtk:Object)
492 // destroy(Gtk:Object * self (check null type))
495 // PARENT_HANDLER(self);
500 /* just an empty function */
504 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
505 STRING,ENUM,POINTER,OBJECT)
507 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
508 gulong g, gfloat h, gdouble i, gchar * j, gint k,
509 gpointer o, GObject *p)
512 a = b = c = d = e = f = g = 0;
513 o = p = (GObject *)NULL;
515 /* ugh, testing casting */
518 public signal (NO_HOOKS) last INT (INT)
519 int testflags(self, int w (check > 0)) defreturn -99 {
525 signal BOOLEAN (NONE)
527 test_none_thing (self)
532 /* some more enum testing */
533 public BubleEnum buble;
537 enum_type = Buble:Enum,
538 default_value = BUBLE_STANDARD,
545 public int long const t4;
546 public const int long t5;
547 public const char * const t6;
548 public char const * const t7;
549 public enum _gob__enum_t const * const t8;
550 public union _gob__union_t t9;
551 public union _gob__union_t * const * const * t10;
552 public struct _gob__struct_t * const * const * t11;
553 public const struct _gob__struct_t * const * const * t13;
554 public const enum _gob__enum_t * const * const * t14;
555 public enum _gob__enum_t t15;
556 public gchar const t16;
557 public const gchar * const t17;
558 public const gchar t18;
560 /* testing method with no arguments */
561 public void method_with_no_arguments (void)
566 /* testing calling the above method */
567 public void foo (self) {
568 self_method_with_no_arguments ();
571 /* this is to test custom get_type */
575 static guint type = 0;
578 static const GtkTypeInfo info = {
580 sizeof (GtkWeirdButton),
581 sizeof (GtkWeirdButtonClass),
582 (GtkClassInitFunc) gtk_weird_button_class_init,
583 (GtkObjectInitFunc) gtk_weird_button_init,
586 (GtkClassInitFunc) NULL
589 type = gtk_type_unique (gtk_button_get_type(), &info);
596 /* testing empty statements */