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*/
29 /* the next line is not mandatory, but if gob finds an include in one of
30 the %{ %} sections above the class definitions, it will not put it in
31 the file itself. So you can this way select where the include file is
33 #include "test-object.h"
34 #include "test-object-private.h"
36 /* this is to test if the lexer won't get confused by requires inside
41 static void jjjj(void);
51 struct _gob__struct_t {
60 /* this should be in the header, just under bubu prototype */
64 class Test:Object from G:Object {
66 public int test_array[TEST_ARRAY];
68 argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
70 public int testing = 1;
71 argument INT testing link;
73 public char * testingstring = {g_strdup("test")}
75 argument POINTER testingstring stringlink;
77 public Test:Object * testingobj
78 destroywith g_object_unref;
79 argument POINTER testingobj objectlink;
81 classwide int foo = 20;
82 argument INT foo link;
84 public G:Object * testingobj2
87 g_object_unref(G_OBJECT(VAR));
89 argument POINTER (type G:Object *) testingobj2 objectlink;
91 argument POINTER (type GObject *) some_object
92 set { /* set some_object */ }
93 get { /* get some_object */
95 argument (CONSTRUCT) LONG (type long) write_only_long
96 set { /* set write_only_long */ };
97 argument POINTER (type char *) read_only_string
98 get { /* get readonly_long */
99 ARG = g_strdup("BLAH"); };
101 private char a_property;
102 property CHAR a_property
109 set { self->_priv->a_property = g_value_get_char (VAL); }
110 get { g_value_set_char (VAL, self->_priv->a_property); };
113 private char *b_property;
114 property STRING b_property
116 blurb = _("Blurb b"),
117 default_value = "default",
127 public double array[23][18];
128 protected unsigned long int wagawaga;
129 public int wagawaga_should_be_after_this_in_the_header;
142 * Returns: new object
144 public GObject * new(int j (check > 0)) {
146 ret = G_OBJECT (GET_NEW);
148 SELF(ret)->_priv->j = j;
152 private int blah(self, G:Object * wid (check null type),
153 int h (check > 0)) onerror -1 {
154 g_object_set (G_OBJECT (self),
155 TEST_OBJECT_PROP_I (99),
167 * Returns: new object
169 signal last STRING (POINTER, INT)
170 char * bleh(self, G:Object * wid (check null type),
172 return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
177 test_handler (self, GObject *w, int h, gpointer data)
183 * gtk_weird_button_bleh2:
190 * Returns: new object */
191 signal last INT (POINTER, INT)
192 int bleh2(self, const G:Object * wid (check null type),
194 /*gtk_signal_connect (GTK_OBJECT (self),
195 GTK_WEIRD_BUTTON_SIGNAL_BLEH (test_handler),
198 /* testing multiple marshaller support */
201 /* this should not get documented as it's nonstandard */
207 /* Here we are testing how the gtk-doc extraction code error handeling
208 it should just ingore these */
224 *zblunk*******//**//**/
225 signal first NONE (NONE)
227 virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 {
231 virtual int beh(self, int h (check > 0));
232 /*override(G:Object) void add(Gtk:Container * self (check null type),
233 Gtk:Widget * wid (check null type)) {
234 PARENT_HANDLER(self,wid);
236 public int consttest(self, const gchar *text, ...)
240 public int consttest2(self, gchar const *text, ...)
244 public int consttest3(self, G:Object const *wid (check null type))
248 public int consttest4(const self)
252 public int consttest5(self const)
256 virtual int consttest6(const self)
260 virtual int consttest7(self const)
264 public int consttest8(self)
266 Self const *selfconst1, *selfconst2;
267 selfconst1 = SELF_CONST(self);
268 selfconst2 = TEST_OBJECT_CONST(self);
271 public int consttest9(const self, int i, double b)
275 public int consttest10(self const, int i, double b)
279 signal private first NONE (NONE)
280 void googlegoogle(self)
283 self_googlegoogle2(self);
285 signal first private NONE (NONE)
286 void googlegoogle2(self)
288 int array[5][8][9]={{{0}}};
291 self_testprivvirtual(foo, array);
293 private signal first NONE (NONE)
294 void googlegoogle3(self)
298 protected signal first NONE (NONE)
299 void googlegoogle4(self)
303 protected signal first NONE (NONE)
304 void googlegoogle_const1(const self)
308 protected signal first NONE (NONE)
309 void googlegoogle_const2(self const)
314 void testprivvirtual(self, int some_array[5][8][9])
317 self_googlegoogle(self);
320 void testprivvirtual2(self, const int some_array[5][8][9])
325 void testpublicvirtual(self, int const some_array[5][8][9])
330 void testprotectedvirtual(self, int some_array[5][8][9])
334 signal first NONE (POINTER)
335 void testarrsignal(self, long arr[8])
340 /* testing empty func */
341 public void foofoofoo(self) {}
342 /* testing empty func 2 */
343 public void foofoofoo2(self);
344 /* testing empty func 3 */
345 public void foofoofoo3(self) { }
346 /* testing empty func 4 */
347 public void foofoofoo4(self)
351 // override (Gtk:Widget)
352 // int event(Gtk:Widget *self (check null type),
353 // GdkEvent *event (check null)) onerror FALSE
357 // ret = PARENT_HANDLER(self,event);
361 // override(Gtk:Container)
363 // remove(Gtk:Container * self (check null type),
364 // Gtk:Widget * wid (check null type));
366 // override(Gtk:Object)
368 // destroy(Gtk:Object * self (check null type))
371 // PARENT_HANDLER(self);
376 /* just an empty function */
380 signal last NONE(CHAR,UCHAR,BOOLEAN,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
381 STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT)
383 testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
384 gulong g, gfloat h, gdouble i, gchar * j, gint k,
385 guint l, gpointer m, gpointer o, GObject *p)
387 /* ugh, testing casting */
390 public signal (NO_HOOKS) last INT (INT)
391 int testflags(self, int w (check > 0)) defreturn -99 {
397 signal BOOLEAN (NONE)
399 test_none_thing (self)
408 public int long const t4;
409 public const int long t5;
410 public const char * const t6;
411 public char const * const t7;
412 public enum _gob__enum_t const * const t8;
413 public union _gob__union_t t9;
414 public union _gob__union_t * const * const * t10;
415 public struct _gob__struct_t * const * const * t11;
416 public const struct _gob__struct_t * const * const * t13;
417 public const enum _gob__enum_t * const * const * t14;
418 public enum _gob__enum_t t15;
419 public gchar const t16;
420 public const gchar * const t17;
421 public const gchar t18;
423 /* testing method with no arguments */
424 public void method_with_no_arguments (void)
429 /* testing calling the above method */
430 public void foo (self) {
431 self_method_with_no_arguments ();
434 /* this is to test custom get_type */
438 static guint type = 0;
441 static const GtkTypeInfo info = {
443 sizeof (GtkWeirdButton),
444 sizeof (GtkWeirdButtonClass),
445 (GtkClassInitFunc) gtk_weird_button_class_init,
446 (GtkObjectInitFunc) gtk_weird_button_init,
449 (GtkClassInitFunc) NULL
452 type = gtk_type_unique (gtk_button_get_type(), &info);
459 /* testing empty statements */