Package: netsurf / 3.6-3.2

fix-nsgenbind-be.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
--- a/nsgenbind/src/nsgenbind-ast.c
+++ b/nsgenbind/src/nsgenbind-ast.c
@@ -132,6 +132,19 @@
         return nn;
 }
 
+struct genbind_node *
+genbind_new_number_node(enum genbind_node_type type,
+                        struct genbind_node *l,
+                        int number)
+{
+        struct genbind_node *nn;
+        nn = calloc(1, sizeof(struct genbind_node));
+        nn->type = type;
+        nn->l = l;
+        nn->r.number = number;
+        return nn;
+}
+
 
 /* exported interface defined in nsgenbind-ast.h */
 int
--- a/nsgenbind/src/nsgenbind-ast.h
+++ b/nsgenbind/src/nsgenbind-ast.h
@@ -71,7 +71,18 @@
 
 char *genbind_strapp(char *a, char *b);
 
+/**
+ * create a new node with value from pointer
+ */
 struct genbind_node *genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r);
+
+/**
+ * create a new number node
+ *
+ * Create a node with of number type
+ */
+struct genbind_node *genbind_new_number_node(enum genbind_node_type type, struct genbind_node *l, int number);
+
 struct genbind_node *genbind_node_link(struct genbind_node *tgt, struct genbind_node *src);
 
 struct genbind_node *genbind_node_prepend(struct genbind_node *list, struct genbind_node *inst);
--- a/nsgenbind/src/nsgenbind-parser.y
+++ b/nsgenbind/src/nsgenbind-parser.y
@@ -138,17 +138,17 @@
         }
 
         location_node = genbind_new_node(GENBIND_NODE_TYPE_FILE,
-                                genbind_new_node(GENBIND_NODE_TYPE_LINE,
-                                                 cdata_node,
-                                                 (void *)lineno),
+                                genbind_new_number_node(GENBIND_NODE_TYPE_LINE,
+                                                        cdata_node,
+                                                        lineno),
                                          strdup(filename));
 
         /* generate method node */
         method_node = genbind_new_node(GENBIND_NODE_TYPE_METHOD,
                                  NULL,
-                                 genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE,
+                                 genbind_new_number_node(GENBIND_NODE_TYPE_METHOD_TYPE,
                                                   location_node,
-                                                  (void *)methodtype));
+                                                  methodtype));
 
         class_node = genbind_node_find_type_ident(*genbind_ast,
                                                   NULL,
@@ -304,11 +304,11 @@
         {
                 $$ = genbind_new_node(GENBIND_NODE_TYPE_METHOD,
                         NULL,
-                        genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE,
+                        genbind_new_number_node(GENBIND_NODE_TYPE_METHOD_TYPE,
                                 genbind_new_node(GENBIND_NODE_TYPE_CDATA,
                                                  NULL,
                                                  $2),
-                                (void *)$1));
+                                $1));
         }
         ;
 
@@ -568,11 +568,11 @@
         TOK_PROPERTY Modifiers TOK_IDENTIFIER ';'
         {
                 $$ = genbind_new_node(GENBIND_NODE_TYPE_PROPERTY, NULL,
-                        genbind_new_node(GENBIND_NODE_TYPE_MODIFIER,
+                        genbind_new_number_node(GENBIND_NODE_TYPE_MODIFIER,
                                 genbind_new_node(GENBIND_NODE_TYPE_IDENT,
                                                  NULL,
                                                  $3),
-                                         (void *)$2));
+                                         $2));
         }
         |
         TOK_FLAGS ClassFlags ';'
@@ -584,11 +584,11 @@
         {
                 $$ = genbind_new_node(GENBIND_NODE_TYPE_METHOD,
                         NULL,
-                        genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE,
+                        genbind_new_number_node(GENBIND_NODE_TYPE_METHOD_TYPE,
                                 genbind_new_node(GENBIND_NODE_TYPE_CDATA,
                                                  NULL,
                                                  $2),
-                                (void *)$1));
+                                $1));
         }
         ;
 
--- a/nsgenbind/src/webidl-ast.c
+++ b/nsgenbind/src/webidl-ast.c
@@ -120,6 +120,7 @@
 
 
 struct webidl_node *
+/* exported interface documented in webidl-ast.h */
 webidl_node_new(enum webidl_node_type type,
 		struct webidl_node *l,
 		void *r)
@@ -128,7 +129,21 @@
 	nn = calloc(1, sizeof(struct webidl_node));
 	nn->type = type;
 	nn->l = l;
-	nn->r.text = r;
+	nn->r.value = r;
+	return nn;
+}
+
+/* exported interface documented in webidl-ast.h */
+struct webidl_node *
+webidl_new_number_node(enum webidl_node_type type,
+                       struct webidl_node *l,
+                       int number)
+{
+	struct webidl_node *nn;
+	nn = calloc(1, sizeof(struct webidl_node));
+	nn->type = type;
+	nn->l = l;
+	nn->r.number = number;
 	return nn;
 }
 
--- a/nsgenbind/src/webidl-ast.h
+++ b/nsgenbind/src/webidl-ast.h
@@ -92,8 +92,17 @@
 
 int webidl_cmp_node_type(struct webidl_node *node, void *ctx);
 
+/**
+ * create a new node with a pointer value
+ */
 struct webidl_node *webidl_node_new(enum webidl_node_type, struct webidl_node *l, void *r);
 
+/**
+ * create a new node with an integer value
+ */
+struct webidl_node *webidl_new_number_node(enum webidl_node_type type, struct webidl_node *l, int number);
+
+
 void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void *r);
 
 struct webidl_node *webidl_node_prepend(struct webidl_node *list, struct webidl_node *node);
--- a/nsgenbind/src/webidl-parser.y
+++ b/nsgenbind/src/webidl-parser.y
@@ -735,9 +735,9 @@
         |
         TOK_INT_LITERAL
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_INT,
-                                     NULL,
-                                     (void *)$1);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_LITERAL_INT,
+                                            NULL,
+                                            $1);
         }
         |
         TOK_NULL_LITERAL
@@ -750,16 +750,16 @@
 BooleanLiteral:
         TOK_TRUE
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL,
-                                     NULL,
-                                     (void *)true);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_LITERAL_BOOL,
+                                            NULL,
+                                            (int)true);
         }
         |
         TOK_FALSE
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL,
-                                     NULL,
-                                     (void *)false);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_LITERAL_BOOL,
+                                            NULL,
+                                            (int)false);
         }
         ;
 
@@ -846,16 +846,18 @@
 
                 /* deal with inherit modifier */
                 if ($1) {
-                        attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
+                        attribute = webidl_new_number_node(
+                                          WEBIDL_NODE_TYPE_MODIFIER,
                                           attribute,
-                                          (void *)WEBIDL_TYPE_MODIFIER_INHERIT);
+                                          WEBIDL_TYPE_MODIFIER_INHERIT);
                 }
 
                 /* deal with readonly modifier */
                 if ($2) {
-                        attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
+                        attribute = webidl_new_number_node(
+                                         WEBIDL_NODE_TYPE_MODIFIER,
                                          attribute,
-                                         (void *)WEBIDL_TYPE_MODIFIER_READONLY);
+                                         WEBIDL_TYPE_MODIFIER_READONLY);
                 }
 
                 $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE,
@@ -880,14 +882,16 @@
         {
                 struct webidl_node *attribute;
 
-                attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
-                                       $2, (void *)WEBIDL_TYPE_MODIFIER_STATIC);
+                attribute = webidl_new_number_node(WEBIDL_NODE_TYPE_MODIFIER,
+                                                   $2,
+                                                   WEBIDL_TYPE_MODIFIER_STATIC);
 
                 /* deal with readonly modifier */
                 if ($1) {
-                        attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
+                        attribute = webidl_new_number_node(
+                                         WEBIDL_NODE_TYPE_MODIFIER,
                                          attribute,
-                                         (void *)WEBIDL_TYPE_MODIFIER_READONLY);
+                                         WEBIDL_TYPE_MODIFIER_READONLY);
                 }
 
                 $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE,
@@ -900,8 +904,9 @@
                 struct webidl_node *operation;
 
                 /* add static modifier */
-                operation = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
-                                       $2, (void *)WEBIDL_TYPE_MODIFIER_STATIC);
+                operation = webidl_new_number_node(WEBIDL_NODE_TYPE_MODIFIER,
+                                                   $2,
+                                                   WEBIDL_TYPE_MODIFIER_STATIC);
 
                 /* put return type on the operation */
                 operation = webidl_node_prepend($1, operation);
@@ -1015,16 +1020,16 @@
 Special:
         TOK_GETTER
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL,
-                                     NULL,
-                                     (void *)WEBIDL_TYPE_SPECIAL_GETTER);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_SPECIAL,
+                                            NULL,
+                                            WEBIDL_TYPE_SPECIAL_GETTER);
         }
         |
         TOK_SETTER
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL,
-                                     NULL,
-                                     (void *)WEBIDL_TYPE_SPECIAL_SETTER);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_SPECIAL,
+                                            NULL,
+                                            WEBIDL_TYPE_SPECIAL_SETTER);
         }
         |
         TOK_CREATOR
@@ -1032,23 +1037,23 @@
                 /* second edition removed this special but the
                  * specifications still use it!
                  */
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL,
-                                     NULL,
-                                     (void *)WEBIDL_TYPE_SPECIAL_CREATOR);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_SPECIAL,
+                                            NULL,
+                                            WEBIDL_TYPE_SPECIAL_CREATOR);
         }
         |
         TOK_DELETER
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL,
-                                     NULL,
-                                     (void *)WEBIDL_TYPE_SPECIAL_DELETER);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_SPECIAL,
+                                            NULL,
+                                            WEBIDL_TYPE_SPECIAL_DELETER);
         }
         |
         TOK_LEGACYCALLER
         {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL,
-                                     NULL,
-                                     (void *)WEBIDL_TYPE_SPECIAL_LEGACYCALLER);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_SPECIAL,
+                                            NULL,
+                                            WEBIDL_TYPE_SPECIAL_LEGACYCALLER);
         }
         ;
 
@@ -1679,8 +1684,9 @@
         TOK_ANY TypeSuffixStartingWithArray
         {
                 /* todo deal with TypeSuffixStartingWithArray */
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE,
-                                     NULL, (void *)WEBIDL_TYPE_ANY);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                            NULL,
+                                            WEBIDL_TYPE_ANY);
         }
         ;
 
@@ -1742,29 +1748,39 @@
         |
         TOK_STRING TypeSuffix
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_STRING);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        $2,
+                                        WEBIDL_TYPE_STRING);
         }
         |
         TOK_IDENTIFIER TypeSuffix
         {
             struct webidl_node *type;
-            type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_USER);
+            type = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                          $2,
+                                          WEBIDL_TYPE_USER);
             $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1);
         }
         |
         TOK_SEQUENCE '<' Type '>' Null
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $3, (void *)WEBIDL_TYPE_SEQUENCE);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        $3,
+                                        WEBIDL_TYPE_SEQUENCE);
         }
         |
         TOK_OBJECT TypeSuffix
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_OBJECT);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        $2,
+                                        WEBIDL_TYPE_OBJECT);
         }
         |
         TOK_DATE TypeSuffix
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_DATE);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        $2,
+                                        WEBIDL_TYPE_DATE);
         }
         ;
 
@@ -1778,7 +1794,9 @@
         TOK_IDENTIFIER Null
         {
             struct webidl_node *type;
-            type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_USER);
+            type = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                          NULL,
+                                          WEBIDL_TYPE_USER);
             type = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1);
             $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
         }
@@ -1793,17 +1811,23 @@
         |
         TOK_BOOLEAN
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BOOL);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_BOOL);
         }
         |
         TOK_BYTE
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BYTE);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_BYTE);
         }
         |
         TOK_OCTET
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OCTET);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_OCTET);
         }
         ;
 
@@ -1811,9 +1835,9 @@
 UnrestrictedFloatType:
         TOK_UNRESTRICTED FloatType
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
-                                 $2,
-                                 (void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_MODIFIER,
+                                        $2,
+                                        WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
         }
         |
         FloatType
@@ -1823,12 +1847,16 @@
 FloatType:
         TOK_FLOAT
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_FLOAT);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_FLOAT);
         }
         |
         TOK_DOUBLE
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DOUBLE);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_DOUBLE);
         }
         ;
 
@@ -1836,9 +1864,9 @@
 UnsignedIntegerType:
         TOK_UNSIGNED IntegerType
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
-                                 $2,
-                                 (void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_MODIFIER,
+                                        $2,
+                                        WEBIDL_TYPE_MODIFIER_UNSIGNED);
         }
         |
         IntegerType
@@ -1848,15 +1876,21 @@
 IntegerType:
         TOK_SHORT
         {
-            $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_SHORT);
+            $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                        NULL,
+                                        WEBIDL_TYPE_SHORT);
         }
         |
         TOK_LONG OptionalLong
         {
             if ($2) {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONGLONG);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                            NULL,
+                                            WEBIDL_TYPE_LONGLONG);
             } else {
-                $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONG);
+                $$ = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                            NULL,
+                                            WEBIDL_TYPE_LONG);
             }
         }
         ;
@@ -1927,7 +1961,9 @@
         TOK_VOID
         {
             struct webidl_node *type;
-            type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID);
+            type = webidl_new_number_node(WEBIDL_NODE_TYPE_TYPE_BASE,
+                                          NULL,
+                                          WEBIDL_TYPE_VOID);
             $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
         }