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 /* this should be in the header, just under bubu prototype */
77 error TEST_OBJECT_ERROR {
82 class Test:Object from G:Object
83 (interface Gtk:Tree:Model)
84 /* We can add more interfaces by adding more lines like the above */
85 /* Note that there must exist a GtkTreeModelIface structure */
88 /* function implemented for the Gtk:Tree:Model interface */
89 interface Gtk:Tree:Model
90 private GtkTreeModelFlags
91 get_flags (Gtk:Tree:Model *self (check null type))
94 return (GtkTreeModelFlags)0;
99 public int test_array[TEST_ARRAY];
101 argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
103 public int testing = 1;
104 argument INT testing link;
106 public char * testingstring = {g_strdup("test")}
108 argument POINTER testingstring stringlink;
110 public Test:Object * testingobj
111 unrefwith g_object_unref;
112 argument POINTER testingobj objectlink;
114 public Test:Object * testingobjfoo
115 unref { if (VAR) g_object_unref (VAR); };
116 argument POINTER testingobjfoo objectlink;
118 classwide int foo = 20;
119 argument INT foo link;
121 public G:Object * testingobj2
124 g_object_unref(G_OBJECT(VAR));
126 argument POINTER (type G:Object *) testingobj2 objectlink;
128 argument POINTER (type GObject *) some_object
129 set { /* set some_object */ }
130 get { /* get some_object */
132 argument (CONSTRUCT) LONG (type long) write_only_long
133 set { /* set write_only_long */ };
134 argument POINTER (type char *) read_only_string
135 get { /* get readonly_long */
136 ARG = g_strdup("BLAH"); };
138 private char a_property;
139 property CHAR a_property
146 set { self->_priv->a_property = g_value_get_char (VAL); }
147 get { g_value_set_char (VAL, self->_priv->a_property); };
149 property OBJECT foobarblahllll1
152 object_type = Gtk:Button)
154 property OBJECT foobarblahllll2
157 object_type = G:Object)
160 private double dblnum;
161 property DOUBLE dblnum
167 flags = CONSTRUCT|CONSTRUCT_ONLY,
171 private char *b_property;
172 property STRING b_property
174 blurb = _("Blurb b"),
175 default_value = "default",
181 private Test:Object *objectproperty;
182 property OBJECT objectproperty (nick = "object",
183 blurb = "obj property",
184 object_type = Test:Object,
187 private Test:Enum enum_property;
188 property ENUM enum_property (nick = "enumprop",
190 enum_type = Test:Enum,
193 private Some:Flags flags_property;
194 property ENUM flags_property (nick = "flagsprop",
196 flags_type = Some:Flags,
202 public double array[23][18];
203 protected unsigned long int wagawaga;
204 public int wagawaga_should_be_after_this_in_the_header;
217 * Returns: new object
219 public GObject * new(int j (check > 0)) {
221 ret = G_OBJECT (GET_NEW);
223 SELF(ret)->_priv->j = j;
227 private int blah(self, G:Object * wid (check null type),
228 int h (check > 0)) onerror -1 {
229 g_object_set (G_OBJECT (self),
230 TEST_OBJECT_PROP_I (99),
242 * Returns: new object
244 signal last STRING (POINTER, INT)
245 char * bleh(self, G:Object * wid (check null type),
247 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
252 test_handler (self, GObject *w, int h, gpointer data)
258 * gtk_weird_button_bleh2:
265 * Returns: new object */
266 signal last INT (POINTER, INT)
267 int bleh2(self, const G:Object * wid (check null type),
270 test_object_connect__bleh (self, self_test_handler, NULL);
271 self_connect__bleh (self, self_test_handler, NULL);
272 test_object_connect_after__bleh (self, self_test_handler, NULL);
273 self_connect_after__bleh (self, self_test_handler, NULL);
274 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
275 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
277 /* testing multiple marshaller support */
280 /* this should not get documented as it's nonstandard */
286 /* Here we are testing how the gtk-doc extraction code error handeling
287 it should just ingore these */
303 *zblunk*******//**//**/
304 signal first NONE (NONE)
306 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
310 virtual int beh(self, int h (check > 0));
311 /*override(G:Object) void add(Gtk:Container * self (check null type),
312 Gtk:Widget * wid (check null type)) {
313 PARENT_HANDLER(self,wid);
315 public int consttest(self, const gchar *text, ...)
319 public int consttest2(self, gchar const *text, ...)
323 public int consttest3(self, G:Object const *wid (check null type))
327 public int consttest4(const self)
331 public int consttest5(self const)
335 virtual int consttest6(const self)
339 virtual int consttest7(self const)
343 public int consttest8(self)
345 Self const *selfconst1, *selfconst2;
346 selfconst1 = SELF_CONST(self);
347 selfconst2 = TEST_OBJECT_CONST(self);
350 public int consttest9(const self, int i, double b)
354 public int consttest10(self const, int i, double b)
358 signal private first NONE (NONE)
359 void googlegoogle(self)
362 self_googlegoogle2(self);
364 signal first private NONE (NONE)
365 void googlegoogle2(self)
367 int array[5][8][9]={{{0}}};
370 self_testprivvirtual(foo, array);
372 private signal first NONE (NONE)
373 void googlegoogle3(self)
377 protected signal first NONE (NONE)
378 void googlegoogle4(self)
382 protected signal first NONE (NONE)
383 void googlegoogle_const1(const self)
387 protected signal first NONE (NONE)
388 void googlegoogle_const2(self const)
393 void testprivvirtual(self, int some_array[5][8][9])
396 self_googlegoogle(self);
399 void testprivvirtual2(self, const int some_array[5][8][9])
404 void testpublicvirtual(self, int const some_array[5][8][9])
409 void testprotectedvirtual(self, int some_array[5][8][9])
413 signal first NONE (POINTER)
414 void testarrsignal(self, long arr[8])
419 /* testing empty func */
420 public void foofoofoo(self) {}
421 /* testing empty func 2 */
422 public void foofoofoo2(self);
423 /* testing empty func 3 */
424 public void foofoofoo3(self) { }
425 /* testing empty func 4 */
426 public void foofoofoo4(self)
430 // override (Gtk:Widget)
431 // int event(Gtk:Widget *self (check null type),
432 // GdkEvent *event (check null)) onerror FALSE
436 // ret = PARENT_HANDLER(self,event);
440 // override(Gtk:Container)
442 // remove(Gtk:Container * self (check null type),
443 // Gtk:Widget * wid (check null type));
445 // override(Gtk:Object)
447 // destroy(Gtk:Object * self (check null type))
450 // PARENT_HANDLER(self);
455 /* just an empty function */
459 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
460 STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT)
462 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
463 gulong g, gfloat h, gdouble i, gchar * j, gint k,
464 guint l, gpointer m, gpointer o, GObject *p)
466 /* ugh, testing casting */
469 public signal (NO_HOOKS) last INT (INT)
470 int testflags(self, int w (check > 0)) defreturn -99 {
476 signal BOOLEAN (NONE)
478 test_none_thing (self)
487 public int long const t4;
488 public const int long t5;
489 public const char * const t6;
490 public char const * const t7;
491 public enum _gob__enum_t const * const t8;
492 public union _gob__union_t t9;
493 public union _gob__union_t * const * const * t10;
494 public struct _gob__struct_t * const * const * t11;
495 public const struct _gob__struct_t * const * const * t13;
496 public const enum _gob__enum_t * const * const * t14;
497 public enum _gob__enum_t t15;
498 public gchar const t16;
499 public const gchar * const t17;
500 public const gchar t18;
502 /* testing method with no arguments */
503 public void method_with_no_arguments (void)
508 /* testing calling the above method */
509 public void foo (self) {
510 self_method_with_no_arguments ();
513 /* this is to test custom get_type */
517 static guint type = 0;
520 static const GtkTypeInfo info = {
522 sizeof (GtkWeirdButton),
523 sizeof (GtkWeirdButtonClass),
524 (GtkClassInitFunc) gtk_weird_button_class_init,
525 (GtkObjectInitFunc) gtk_weird_button_init,
528 (GtkClassInitFunc) NULL
531 type = gtk_type_unique (gtk_button_get_type(), &info);
538 /* testing empty statements */