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 * 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(G:Object) void add(Gtk:Container * self (check null type),
355 Gtk:Widget * wid (check null type)) {
356 PARENT_HANDLER(self,wid);
358 public int consttest(self, const gchar *text, ...)
363 public int consttest2(self, gchar const *text, ...)
368 public int consttest3(self, G:Object const *wid (check null type))
373 public int consttest4(const self)
377 public int consttest5(self const)
381 virtual int consttest6(const self)
385 virtual int consttest7(self const)
389 public int consttest8(self)
391 Self const *selfconst1, *selfconst2;
392 selfconst1 = SELF_CONST(self);
393 selfconst2 = TEST_OBJECT_CONST(self);
396 public int consttest9(const self, int i, double b)
402 public int consttest10(self const, int i, double b)
408 signal private first NONE (NONE)
409 void googlegoogle(self)
412 self_googlegoogle2(self);
414 signal first private NONE (NONE)
415 void googlegoogle2(self)
417 int array[5][8][9]={{{0}}};
420 self_testprivvirtual(foo, array);
422 private signal first NONE (NONE)
423 void googlegoogle3(self)
427 protected signal first NONE (NONE)
428 void googlegoogle4(self)
432 protected signal first NONE (NONE)
433 void googlegoogle_const1(const self)
437 protected signal first NONE (NONE)
438 void googlegoogle_const2(self const)
443 void testprivvirtual(self, int some_array[5][8][9])
446 self_googlegoogle(self);
447 if (some_array[0]) return;
450 void testprivvirtual2(self, const int some_array[5][8][9])
453 if (some_array[0]) return;
456 void testpublicvirtual(self, int const some_array[5][8][9])
459 if (some_array[0]) return;
462 void testprotectedvirtual(self, int some_array[5][8][9])
465 if (some_array[0]) return;
467 signal first NONE (POINTER, ENUM)
468 void testarrsignal(self, long arr[8], Buble:Enum foo)
475 /* testing empty func */
476 public void foofoofoo(self) {}
477 /* testing empty func 2 */
478 public void foofoofoo2(self);
479 /* testing empty func 3 */
480 public void foofoofoo3(self) { }
481 /* testing empty func 4 */
482 public void foofoofoo4(self)
486 // override (Gtk:Widget)
487 // int event(Gtk:Widget *self (check null type),
488 // GdkEvent *event (check null)) onerror FALSE
492 // ret = PARENT_HANDLER(self,event);
496 // override(Gtk:Container)
498 // remove(Gtk:Container * self (check null type),
499 // Gtk:Widget * wid (check null type));
501 // override(Gtk:Object)
503 // destroy(Gtk:Object * self (check null type))
506 // PARENT_HANDLER(self);
511 /* just an empty function */
515 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
516 STRING,ENUM,POINTER,OBJECT)
518 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
519 gulong g, gfloat h, gdouble i, gchar * j, gint k,
520 gpointer o, GObject *p)
523 a = b = c = d = e = f = g = 0;
524 o = p = (GObject *)NULL;
526 /* ugh, testing casting */
529 public signal (NO_HOOKS) last INT (INT)
530 int testflags(self, int w (check > 0)) defreturn -99 {
536 signal BOOLEAN (NONE)
538 test_none_thing (self)
543 /* some more enum testing */
544 public BubleEnum buble;
548 enum_type = Buble:Enum,
549 default_value = BUBLE_STANDARD,
556 public int long const t4;
557 public const int long t5;
558 public const char * const t6;
559 public char const * const t7;
560 public enum _gob__enum_t const * const t8;
561 public union _gob__union_t t9;
562 public union _gob__union_t * const * const * t10;
563 public struct _gob__struct_t * const * const * t11;
564 public const struct _gob__struct_t * const * const * t13;
565 public const enum _gob__enum_t * const * const * t14;
566 public enum _gob__enum_t t15;
567 public gchar const t16;
568 public const gchar * const t17;
569 public const gchar t18;
571 /* testing method with no arguments */
572 public void method_with_no_arguments (void)
577 /* testing calling the above method */
578 public void foo (self) {
579 self_method_with_no_arguments ();
582 /* this is to test custom get_type */
586 static guint type = 0;
589 static const GtkTypeInfo info = {
591 sizeof (GtkWeirdButton),
592 sizeof (GtkWeirdButtonClass),
593 (GtkClassInitFunc) gtk_weird_button_class_init,
594 (GtkObjectInitFunc) gtk_weird_button_init,
597 (GtkClassInitFunc) NULL
600 type = gtk_type_unique (gtk_button_get_type(), &info);
607 /* testing empty statements */