]> git.draconx.ca Git - gob-dx.git/blob - src/test.gob
Release 0.92.4
[gob-dx.git] / src / test.gob
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 */
5
6 requires 0.92.1
7
8 %headertop{
9 /* this should go on the very top of the header */
10 %}
11 %ht{
12 /* this should go on the very top of the header as well */
13 %}
14 %ph{
15 /* this should go into the private header */
16 %}
17 %privateheader{
18 /* this should go into the private header as well*/
19 %}
20
21
22 %{
23 #include <stdio.h>
24 /* the next line is not mandatory, but if gob finds an include in one of
25    the %{ %} sections above the class definitions, it will not put it in
26    the file itself.  So you can this way select where the include file is
27    at */
28 #include "gtk-weird-button.h"
29 #include "gtk-weird-button-private.h"
30
31 /* this is to test if the lexer won't get confused by requires inside
32    some c code
33 requires 99.99.99
34 */
35
36 static void jjjj(void);
37 %}
38
39 %h{
40 void bubu(void);
41 %}
42 %header{
43 /* this should be in the header, just under bubu prototype */
44 %}
45
46 class Gtk:Weird:Button from Gtk:Button {
47         public int i;
48         argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
49         argument POINTER (type GtkObject *) some_object
50                 set { /* set some_object */ }
51                 get { /* get some_object */
52                         ARG=NULL; };
53         argument (CONSTRUCT) LONG (type long) write_only_long
54                 set { /* set write_only_long */ };
55         argument POINTER (type char *) read_only_string
56                 get { /* get readonly_long */
57                         ARG = g_strdup("BLAH"); };
58         private int j;
59         public GtkWidget * h;
60         public char *bleh;
61         public double array[23][18];
62         protected unsigned long int wagawaga;
63         public int wagawaga_should_be_after_this_in_the_header;
64
65         init(object) {
66                 object->i=0;
67         }
68         class_init(klass);
69
70         /**
71          * new:
72          * @j: foo
73          *
74          * budliky budliky
75          *
76          * Returns: new object
77          */
78         public GtkWidget * new(int j (check > 0)) {
79                 GtkWidget *ret;
80                 ret = GTK_WIDGET (GET_NEW);
81
82                 SELF(ret)->_priv->j = j;
83
84                 return ret;
85         }
86         private int blah(self, Gtk:Widget * wid (check null type),
87                          int h (check > 0)) onerror -1 {
88                 gtk_container_add(GTK_CONTAINER(self),wid);
89
90                 gtk_object_set(GTK_OBJECT(self),
91                                GTK_WEIRD_BUTTON_ARG_I(99),
92                                NULL);
93                 return h;
94         }
95         /**
96          * bleh:
97          * @self: foo
98          * @wid: foo
99          * @h: foo
100          *
101          * budliky budliky 2
102          *
103          * Returns: new object
104          **/
105         signal last INT (POINTER, INT)
106         int bleh(self, Gtk:Widget * wid (check null type),
107                         int h (check > 0)) {
108                 return blah(self,wid,h);
109         }
110         /**
111          * gtk_weird_button_bleh2:
112          * @self: foo
113          * @wid: foo
114          * @h: foo
115          *
116          * budliky budliky 3
117          *
118          * Returns: new object */
119         signal last INT (POINTER, INT)
120         int bleh2(self, Gtk:Widget * wid (check null type),
121                         int h (check > 0)) {
122                 /* testing multiple marshaller support */
123                 return 0;
124         }
125         /* this should not get documented as it's nonstandard */
126         /**
127          * bloh:
128
129          ******/
130
131         /* Here we are testing how the gtk-doc extraction code error handeling
132            it should just ingore these */
133         /**
134           */
135
136         /** */
137         /**
138          *
139          * bubu
140          *********/
141         /**
142          *
143          * bubu
144          **zblunk*******/
145         /**
146          *
147          * bubu
148          *zblunk*******//**//**/
149         signal first NONE (NONE)
150         void bloh(self);
151         virtual void * bah(self, int h (check > 0)) onerror NULL {
152                 beh(self,h);
153                 return NULL;
154         }
155         virtual int beh(self, int h (check > 0));
156         override(Gtk:Container) void add(Gtk:Container * self (check null type),
157                                          Gtk:Widget * wid (check null type)) {
158                 PARENT_HANDLER(self,wid);
159         }
160         public int consttest(self, const gchar *text, ...)
161         {
162                 return 25;
163         }
164         signal private first NONE (NONE)
165         void googlegoogle(self)
166         {
167                 puts("TEST1");
168                 googlegoogle2(self);
169         }
170         signal first private NONE (NONE)
171         void googlegoogle2(self)
172         {
173                 int array[5][8][9]={{{0}}};
174                 puts("TEST2");
175                 testprivvirtual(self,array);
176         }
177         private signal first NONE (NONE)
178         void googlegoogle3(self)
179         {
180                 puts("TEST3");
181         }
182         protected signal first NONE (NONE)
183         void googlegoogle4(self)
184         {
185                 puts("TEST4");
186         }
187         virtual private
188         void testprivvirtual(self, int some_array[5][8][9])
189         {
190                 puts("TEST3");
191                 googlegoogle(self);
192         }
193         private virtual
194         void testprivvirtual2(self, int some_array[5][8][9])
195         {
196                 /* nothing here */
197         }
198         public virtual
199         void testpublicvirtual(self, int some_array[5][8][9])
200         {
201                 /* nothing here */
202         }
203         protected virtual
204         void testprotectedvirtual(self, int some_array[5][8][9])
205         {
206                 /* nothing here */
207         }
208         signal first NONE (POINTER)
209         void testarrsignal(self, long arr[8])
210         {
211                 /* foo */
212         }
213
214         /* testing empty func */
215         public void foofoofoo(self) {}
216         /* testing empty func 2 */
217         public void foofoofoo2(self);
218         /* testing empty func 3 */
219         public void foofoofoo3(self) {   }
220         /* testing empty func 4 */
221         public void foofoofoo4(self)
222         {
223         }
224
225         override (Gtk:Widget)
226         int event(Gtk:Widget *self (check null type),
227                   GdkEvent *event (check null)) onerror FALSE
228         {
229                 int ret;
230                 /* some code */
231                 ret = PARENT_HANDLER(self,event);
232                 /* some code */
233                 return ret;
234         }
235         override(Gtk:Container)
236         void
237         remove(Gtk:Container * self (check null type),
238                Gtk:Widget * wid (check null type));
239
240         protected
241         int foobar(self) {
242                 /* just an empty function */
243                 return 5;
244         }
245
246         signal last NONE(CHAR,UCHAR,BOOL,INT,UINT,LONG,ULONG,FLOAT,DOUBLE,
247                          STRING,ENUM,FLAGS,BOXED,POINTER,OBJECT)
248         void
249         testargs(self, gchar a, guchar b, gboolean c, gint d, guint e, glong f,
250                  gulong g, gfloat h, gdouble i, gchar * j, gint k,
251                  guint l, gpointer m, gpointer o, GtkObject *p)
252         {
253                 /* ugh, testing casting */
254         }
255
256         public signal (NO_HOOKS) last INT (INT)
257         int testflags(self, int w (check > 0)) {
258                 /*foo*/
259                 return w;
260         }
261 }
262
263 %{
264
265 static void
266 jjjj(void)
267 {
268 }
269
270 void
271 bubu(void)
272 {
273         jjjj();
274 }
275
276 %}