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); };
146 private char *b_property;
147 property STRING b_property
149 blurb = _("Blurb b"),
150 default_value = "default",
160 public double array[23][18];
161 protected unsigned long int wagawaga;
162 public int wagawaga_should_be_after_this_in_the_header;
175 * Returns: new object
177 public GObject * new(int j (check > 0)) {
179 ret = G_OBJECT (GET_NEW);
181 SELF(ret)->_priv->j = j;
185 private int blah(self, G:Object * wid (check null type),
186 int h (check > 0)) onerror -1 {
187 g_object_set (G_OBJECT (self),
188 TEST_OBJECT_PROP_I (99),
200 * Returns: new object
202 signal last STRING (POINTER, INT)
203 char * bleh(self, G:Object * wid (check null type),
205 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
210 test_handler (self, GObject *w, int h, gpointer data)
216 * gtk_weird_button_bleh2:
223 * Returns: new object */
224 signal last INT (POINTER, INT)
225 int bleh2(self, const G:Object * wid (check null type),
228 test_object_connect__bleh (self, self_test_handler, NULL);
229 self_connect__bleh (self, self_test_handler, NULL);
230 test_object_connect_after__bleh (self, self_test_handler, NULL);
231 self_connect_after__bleh (self, self_test_handler, NULL);
232 test_object_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
233 self_connect_data__bleh (self, self_test_handler, NULL, NULL, 0);
235 /* testing multiple marshaller support */
238 /* this should not get documented as it's nonstandard */
244 /* Here we are testing how the gtk-doc extraction code error handeling
245 it should just ingore these */
261 *zblunk*******//**//**/
262 signal first NONE (NONE)
264 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
268 virtual int beh(self, int h (check > 0));
269 /*override(G:Object) void add(Gtk:Container * self (check null type),
270 Gtk:Widget * wid (check null type)) {
271 PARENT_HANDLER(self,wid);
273 public int consttest(self, const gchar *text, ...)
277 public int consttest2(self, gchar const *text, ...)
281 public int consttest3(self, G:Object const *wid (check null type))
285 public int consttest4(const self)
289 public int consttest5(self const)
293 virtual int consttest6(const self)
297 virtual int consttest7(self const)
301 public int consttest8(self)
303 Self const *selfconst1, *selfconst2;
304 selfconst1 = SELF_CONST(self);
305 selfconst2 = TEST_OBJECT_CONST(self);
308 public int consttest9(const self, int i, double b)
312 public int consttest10(self const, int i, double b)
316 signal private first NONE (NONE)
317 void googlegoogle(self)
320 self_googlegoogle2(self);
322 signal first private NONE (NONE)
323 void googlegoogle2(self)
325 int array[5][8][9]={{{0}}};
328 self_testprivvirtual(foo, array);
330 private signal first NONE (NONE)
331 void googlegoogle3(self)
335 protected signal first NONE (NONE)
336 void googlegoogle4(self)
340 protected signal first NONE (NONE)
341 void googlegoogle_const1(const self)
345 protected signal first NONE (NONE)
346 void googlegoogle_const2(self const)
351 void testprivvirtual(self, int some_array[5][8][9])
354 self_googlegoogle(self);
357 void testprivvirtual2(self, const int some_array[5][8][9])
362 void testpublicvirtual(self, int const some_array[5][8][9])
367 void testprotectedvirtual(self, int some_array[5][8][9])
371 signal first NONE (POINTER)
372 void testarrsignal(self, long arr[8])
377 /* testing empty func */
378 public void foofoofoo(self) {}
379 /* testing empty func 2 */
380 public void foofoofoo2(self);
381 /* testing empty func 3 */
382 public void foofoofoo3(self) { }
383 /* testing empty func 4 */
384 public void foofoofoo4(self)
388 // override (Gtk:Widget)
389 // int event(Gtk:Widget *self (check null type),
390 // GdkEvent *event (check null)) onerror FALSE
394 // ret = PARENT_HANDLER(self,event);
398 // override(Gtk:Container)
400 // remove(Gtk:Container * self (check null type),
401 // Gtk:Widget * wid (check null type));
403 // override(Gtk:Object)
405 // destroy(Gtk:Object * self (check null type))
408 // PARENT_HANDLER(self);
413 /* just an empty function */
417 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
418 STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT)
420 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
421 gulong g, gfloat h, gdouble i, gchar * j, gint k,
422 guint l, gpointer m, gpointer o, GObject *p)
424 /* ugh, testing casting */
427 public signal (NO_HOOKS) last INT (INT)
428 int testflags(self, int w (check > 0)) defreturn -99 {
434 signal BOOLEAN (NONE)
436 test_none_thing (self)
445 public int long const t4;
446 public const int long t5;
447 public const char * const t6;
448 public char const * const t7;
449 public enum _gob__enum_t const * const t8;
450 public union _gob__union_t t9;
451 public union _gob__union_t * const * const * t10;
452 public struct _gob__struct_t * const * const * t11;
453 public const struct _gob__struct_t * const * const * t13;
454 public const enum _gob__enum_t * const * const * t14;
455 public enum _gob__enum_t t15;
456 public gchar const t16;
457 public const gchar * const t17;
458 public const gchar t18;
460 /* testing method with no arguments */
461 public void method_with_no_arguments (void)
466 /* testing calling the above method */
467 public void foo (self) {
468 self_method_with_no_arguments ();
471 /* this is to test custom get_type */
475 static guint type = 0;
478 static const GtkTypeInfo info = {
480 sizeof (GtkWeirdButton),
481 sizeof (GtkWeirdButtonClass),
482 (GtkClassInitFunc) gtk_weird_button_class_init,
483 (GtkObjectInitFunc) gtk_weird_button_init,
486 (GtkClassInitFunc) NULL
489 type = gtk_type_unique (gtk_button_get_type(), &info);
496 /* testing empty statements */