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 {
87 class Test:Object from G:Object
88 (interface Gtk:Tree:Model)
89 /* We can add more interfaces by adding more lines like the above */
90 /* Note that there must exist a GtkTreeModelIface structure */
93 /* function implemented for the Gtk:Tree:Model interface */
94 interface Gtk:Tree:Model
95 private GtkTreeModelFlags
96 get_flags (Gtk:Tree:Model *self (check null type))
99 return (GtkTreeModelFlags)0;
104 public int test_array[TEST_ARRAY];
106 argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
108 public int testing = 1;
109 argument INT testing link;
111 public char * testingstring = {g_strdup("test")}
113 argument POINTER testingstring stringlink;
115 public Test:Object * testingobj
116 unrefwith g_object_unref;
117 argument POINTER testingobj objectlink;
119 public Test:Object * testingobjfoo
120 unref { if (VAR) g_object_unref (VAR); };
121 argument POINTER testingobjfoo objectlink;
123 classwide int foo = 20;
124 argument INT foo link;
126 public G:Object * testingobj2
129 g_object_unref(G_OBJECT(VAR));
131 argument POINTER (type G:Object *) testingobj2 objectlink;
133 argument POINTER (type GObject *) some_object
134 set { /* set some_object */ }
135 get { /* get some_object */
137 argument (CONSTRUCT) LONG (type long) write_only_long
138 set { /* set write_only_long */ };
139 argument POINTER (type char *) read_only_string
140 get { /* get readonly_long */
141 ARG = g_strdup("BLAH"); };
143 private char a_property;
144 property CHAR a_property
151 set { self->_priv->a_property = g_value_get_char (VAL); }
152 get { g_value_set_char (VAL, self->_priv->a_property); };
154 property OBJECT foobarblahllll1
157 object_type = Gtk:Button)
159 property OBJECT foobarblahllll2
162 object_type = G:Object)
165 private double dblnum;
166 property DOUBLE dblnum
172 flags = CONSTRUCT|CONSTRUCT_ONLY,
176 private char *b_property;
177 property STRING b_property
179 blurb = _("Blurb b"),
180 default_value = "default",
186 private Test:Object *objectproperty;
187 property OBJECT objectproperty (nick = "object",
188 blurb = "obj property",
189 object_type = Test:Object,
192 private Test:Enum enum_property;
193 property ENUM enum_property (nick = "enumprop",
195 enum_type = Test:Enum,
198 private Some:Flags flags_property;
199 property ENUM flags_property (nick = "flagsprop",
201 flags_type = Some:Flags,
204 private PackageBoxed *prop;
205 property BOXED prop (nick="prop",
207 boxed_type=Package:Boxed,
209 /* testing old semantics */
210 private PackageBoxed *prop2;
211 property BOXED prop2 (nick="prop2",
213 boxed_type=PACKAGE_TYPE_BOXED,
220 public double array[23][18];
221 protected unsigned long int wagawaga;
222 public int wagawaga_should_be_after_this_in_the_header;
235 * Returns: new object
237 public GObject * new(int j (check > 0)) {
239 ret = G_OBJECT (GET_NEW);
241 SELF(ret)->_priv->j = j;
245 private int blah(self, G:Object * wid (check null type),
246 int h (check > 0)) onerror -1 {
247 g_object_set (G_OBJECT (self),
248 TEST_OBJECT_PROP_I (99),
260 * Returns: new object
262 signal last STRING (POINTER, INT)
263 char * bleh(self, G:Object * wid (check null type),
265 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
270 test_handler (self, GObject *w, int h, gpointer data)
276 * gtk_weird_button_bleh2:
283 * Returns: new object */
284 signal last INT (POINTER, INT)
285 int bleh2(self, const G:Object * wid (check null type),
288 test_object_connect__bleh (self, self_test_handler, NULL);
289 self_connect__bleh (self, self_test_handler, NULL);
290 test_object_connect_after__bleh (self, self_test_handler, NULL);
291 self_connect_after__bleh (self, self_test_handler, NULL);
292 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
293 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
295 /* testing multiple marshaller support */
298 /* this should not get documented as it's nonstandard */
304 /* Here we are testing how the gtk-doc extraction code error handeling
305 it should just ingore these */
321 *zblunk*******//**//**/
322 signal first NONE (NONE)
324 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
328 virtual int beh(self, int h (check > 0));
329 /*override(G:Object) void add(Gtk:Container * self (check null type),
330 Gtk:Widget * wid (check null type)) {
331 PARENT_HANDLER(self,wid);
333 public int consttest(self, const gchar *text, ...)
337 public int consttest2(self, gchar const *text, ...)
341 public int consttest3(self, G:Object const *wid (check null type))
345 public int consttest4(const self)
349 public int consttest5(self const)
353 virtual int consttest6(const self)
357 virtual int consttest7(self const)
361 public int consttest8(self)
363 Self const *selfconst1, *selfconst2;
364 selfconst1 = SELF_CONST(self);
365 selfconst2 = TEST_OBJECT_CONST(self);
368 public int consttest9(const self, int i, double b)
372 public int consttest10(self const, int i, double b)
376 signal private first NONE (NONE)
377 void googlegoogle(self)
380 self_googlegoogle2(self);
382 signal first private NONE (NONE)
383 void googlegoogle2(self)
385 int array[5][8][9]={{{0}}};
388 self_testprivvirtual(foo, array);
390 private signal first NONE (NONE)
391 void googlegoogle3(self)
395 protected signal first NONE (NONE)
396 void googlegoogle4(self)
400 protected signal first NONE (NONE)
401 void googlegoogle_const1(const self)
405 protected signal first NONE (NONE)
406 void googlegoogle_const2(self const)
411 void testprivvirtual(self, int some_array[5][8][9])
414 self_googlegoogle(self);
417 void testprivvirtual2(self, const int some_array[5][8][9])
422 void testpublicvirtual(self, int const some_array[5][8][9])
427 void testprotectedvirtual(self, int some_array[5][8][9])
431 signal first NONE (POINTER)
432 void testarrsignal(self, long arr[8])
437 /* testing empty func */
438 public void foofoofoo(self) {}
439 /* testing empty func 2 */
440 public void foofoofoo2(self);
441 /* testing empty func 3 */
442 public void foofoofoo3(self) { }
443 /* testing empty func 4 */
444 public void foofoofoo4(self)
448 // override (Gtk:Widget)
449 // int event(Gtk:Widget *self (check null type),
450 // GdkEvent *event (check null)) onerror FALSE
454 // ret = PARENT_HANDLER(self,event);
458 // override(Gtk:Container)
460 // remove(Gtk:Container * self (check null type),
461 // Gtk:Widget * wid (check null type));
463 // override(Gtk:Object)
465 // destroy(Gtk:Object * self (check null type))
468 // PARENT_HANDLER(self);
473 /* just an empty function */
477 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
478 STRING,ENUM,POINTER,OBJECT)
480 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
481 gulong g, gfloat h, gdouble i, gchar * j, gint k,
482 gpointer o, GObject *p)
484 /* ugh, testing casting */
487 public signal (NO_HOOKS) last INT (INT)
488 int testflags(self, int w (check > 0)) defreturn -99 {
494 signal BOOLEAN (NONE)
496 test_none_thing (self)
505 public int long const t4;
506 public const int long t5;
507 public const char * const t6;
508 public char const * const t7;
509 public enum _gob__enum_t const * const t8;
510 public union _gob__union_t t9;
511 public union _gob__union_t * const * const * t10;
512 public struct _gob__struct_t * const * const * t11;
513 public const struct _gob__struct_t * const * const * t13;
514 public const enum _gob__enum_t * const * const * t14;
515 public enum _gob__enum_t t15;
516 public gchar const t16;
517 public const gchar * const t17;
518 public const gchar t18;
520 /* testing method with no arguments */
521 public void method_with_no_arguments (void)
526 /* testing calling the above method */
527 public void foo (self) {
528 self_method_with_no_arguments ();
531 /* this is to test custom get_type */
535 static guint type = 0;
538 static const GtkTypeInfo info = {
540 sizeof (GtkWeirdButton),
541 sizeof (GtkWeirdButtonClass),
542 (GtkClassInitFunc) gtk_weird_button_class_init,
543 (GtkObjectInitFunc) gtk_weird_button_init,
546 (GtkClassInitFunc) NULL
549 type = gtk_type_unique (gtk_button_get_type(), &info);
556 /* testing empty statements */