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 destroywith g_object_unref;
112 argument POINTER testingobj objectlink;
114 classwide int foo = 20;
115 argument INT foo link;
117 public G:Object * testingobj2
120 g_object_unref(G_OBJECT(VAR));
122 argument POINTER (type G:Object *) testingobj2 objectlink;
124 argument POINTER (type GObject *) some_object
125 set { /* set some_object */ }
126 get { /* get some_object */
128 argument (CONSTRUCT) LONG (type long) write_only_long
129 set { /* set write_only_long */ };
130 argument POINTER (type char *) read_only_string
131 get { /* get readonly_long */
132 ARG = g_strdup("BLAH"); };
134 private char a_property;
135 property CHAR a_property
142 set { self->_priv->a_property = g_value_get_char (VAL); }
143 get { g_value_set_char (VAL, self->_priv->a_property); };
145 property OBJECT foobarblahllll1
148 object_type = Gtk:Button)
150 property OBJECT foobarblahllll2
153 object_type = G:Object)
156 private double dblnum;
157 property DOUBLE dblnum
163 flags = CONSTRUCT|CONSTRUCT_ONLY,
167 private char *b_property;
168 property STRING b_property
170 blurb = _("Blurb b"),
171 default_value = "default",
177 private Test:Object *objectproperty;
178 property OBJECT objectproperty (nick = "object",
179 blurb = "obj property",
180 object_type = Test:Object,
183 private Test:Enum enum_property;
184 property ENUM enum_property (nick = "enumprop",
186 enum_type = Test:Enum,
189 private Some:Flags flags_property;
190 property ENUM flags_property (nick = "flagsprop",
192 flags_type = Some:Flags,
198 public double array[23][18];
199 protected unsigned long int wagawaga;
200 public int wagawaga_should_be_after_this_in_the_header;
213 * Returns: new object
215 public GObject * new(int j (check > 0)) {
217 ret = G_OBJECT (GET_NEW);
219 SELF(ret)->_priv->j = j;
223 private int blah(self, G:Object * wid (check null type),
224 int h (check > 0)) onerror -1 {
225 g_object_set (G_OBJECT (self),
226 TEST_OBJECT_PROP_I (99),
238 * Returns: new object
240 signal last STRING (POINTER, INT)
241 char * bleh(self, G:Object * wid (check null type),
243 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
248 test_handler (self, GObject *w, int h, gpointer data)
254 * gtk_weird_button_bleh2:
261 * Returns: new object */
262 signal last INT (POINTER, INT)
263 int bleh2(self, const G:Object * wid (check null type),
266 test_object_connect__bleh (self, self_test_handler, NULL);
267 self_connect__bleh (self, self_test_handler, NULL);
268 test_object_connect_after__bleh (self, self_test_handler, NULL);
269 self_connect_after__bleh (self, self_test_handler, NULL);
270 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
271 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
273 /* testing multiple marshaller support */
276 /* this should not get documented as it's nonstandard */
282 /* Here we are testing how the gtk-doc extraction code error handeling
283 it should just ingore these */
299 *zblunk*******//**//**/
300 signal first NONE (NONE)
302 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
306 virtual int beh(self, int h (check > 0));
307 /*override(G:Object) void add(Gtk:Container * self (check null type),
308 Gtk:Widget * wid (check null type)) {
309 PARENT_HANDLER(self,wid);
311 public int consttest(self, const gchar *text, ...)
315 public int consttest2(self, gchar const *text, ...)
319 public int consttest3(self, G:Object const *wid (check null type))
323 public int consttest4(const self)
327 public int consttest5(self const)
331 virtual int consttest6(const self)
335 virtual int consttest7(self const)
339 public int consttest8(self)
341 Self const *selfconst1, *selfconst2;
342 selfconst1 = SELF_CONST(self);
343 selfconst2 = TEST_OBJECT_CONST(self);
346 public int consttest9(const self, int i, double b)
350 public int consttest10(self const, int i, double b)
354 signal private first NONE (NONE)
355 void googlegoogle(self)
358 self_googlegoogle2(self);
360 signal first private NONE (NONE)
361 void googlegoogle2(self)
363 int array[5][8][9]={{{0}}};
366 self_testprivvirtual(foo, array);
368 private signal first NONE (NONE)
369 void googlegoogle3(self)
373 protected signal first NONE (NONE)
374 void googlegoogle4(self)
378 protected signal first NONE (NONE)
379 void googlegoogle_const1(const self)
383 protected signal first NONE (NONE)
384 void googlegoogle_const2(self const)
389 void testprivvirtual(self, int some_array[5][8][9])
392 self_googlegoogle(self);
395 void testprivvirtual2(self, const int some_array[5][8][9])
400 void testpublicvirtual(self, int const some_array[5][8][9])
405 void testprotectedvirtual(self, int some_array[5][8][9])
409 signal first NONE (POINTER)
410 void testarrsignal(self, long arr[8])
415 /* testing empty func */
416 public void foofoofoo(self) {}
417 /* testing empty func 2 */
418 public void foofoofoo2(self);
419 /* testing empty func 3 */
420 public void foofoofoo3(self) { }
421 /* testing empty func 4 */
422 public void foofoofoo4(self)
426 // override (Gtk:Widget)
427 // int event(Gtk:Widget *self (check null type),
428 // GdkEvent *event (check null)) onerror FALSE
432 // ret = PARENT_HANDLER(self,event);
436 // override(Gtk:Container)
438 // remove(Gtk:Container * self (check null type),
439 // Gtk:Widget * wid (check null type));
441 // override(Gtk:Object)
443 // destroy(Gtk:Object * self (check null type))
446 // PARENT_HANDLER(self);
451 /* just an empty function */
455 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
456 STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT)
458 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
459 gulong g, gfloat h, gdouble i, gchar * j, gint k,
460 guint l, gpointer m, gpointer o, GObject *p)
462 /* ugh, testing casting */
465 public signal (NO_HOOKS) last INT (INT)
466 int testflags(self, int w (check > 0)) defreturn -99 {
472 signal BOOLEAN (NONE)
474 test_none_thing (self)
483 public int long const t4;
484 public const int long t5;
485 public const char * const t6;
486 public char const * const t7;
487 public enum _gob__enum_t const * const t8;
488 public union _gob__union_t t9;
489 public union _gob__union_t * const * const * t10;
490 public struct _gob__struct_t * const * const * t11;
491 public const struct _gob__struct_t * const * const * t13;
492 public const enum _gob__enum_t * const * const * t14;
493 public enum _gob__enum_t t15;
494 public gchar const t16;
495 public const gchar * const t17;
496 public const gchar t18;
498 /* testing method with no arguments */
499 public void method_with_no_arguments (void)
504 /* testing calling the above method */
505 public void foo (self) {
506 self_method_with_no_arguments ();
509 /* this is to test custom get_type */
513 static guint type = 0;
516 static const GtkTypeInfo info = {
518 sizeof (GtkWeirdButton),
519 sizeof (GtkWeirdButtonClass),
520 (GtkClassInitFunc) gtk_weird_button_class_init,
521 (GtkObjectInitFunc) gtk_weird_button_init,
524 (GtkClassInitFunc) NULL
527 type = gtk_type_unique (gtk_button_get_type(), &info);
534 /* testing empty statements */