Browse code

Introducing CONSUME_ALL flag: all the subsequent parameters are accepted without resolving or checking them Can be used to implement selects with more than one parameter

Miklos Tirpak authored on 11/01/2008 16:30:30
Showing 2 changed files
... ...
@@ -299,6 +299,17 @@ int resolve_select(select_t* s)
299 299
 		}
300 300
 
301 301
 		f = t->table[table_idx].new_f;
302
+
303
+		if (t->table[table_idx].flags & CONSUME_ALL) {
304
+			/* sanity checks */
305
+			if (t->table[table_idx].flags & NESTED)
306
+				WARN("resolve_select: CONSUME_ALL should not be set "
307
+					"together with NESTED flag!\n");
308
+			if ((t->table[table_idx].flags & FIXUP_CALL) == 0)
309
+				WARN("resolve_select: FIXUP_CALL should be defined "
310
+					"if CONSUME_ALL flag is set!\n");
311
+			break;
312
+		}
302 313
 	}
303 314
 
304 315
 	if (t->table[table_idx].flags & SEL_PARAM_EXPECTED) {
... ...
@@ -66,11 +66,16 @@
66 66
  */
67 67
 #define CONSUME_NEXT_INT 1<<11
68 68
 
69
+/* accept all the following parameters
70
+ * without checking them
71
+ */
72
+#define CONSUME_ALL	1<<12
73
+
69 74
 /* next parameter is optional (use with CONSUME_NEXT_STR or CONSUME_NEXT_INT
70 75
  * resolution is accepted even if there is no other parameter
71 76
  * or the parameter is of wrong type
72 77
  */
73
-#define OPTIONAL         1<<12
78
+#define OPTIONAL         1<<13
74 79
 
75 80
 /* left function is noted to be called
76 81
  * rigth function continues in resolution
... ...
@@ -83,14 +88,14 @@
83 83
  * the only one parameter passed between nested calls
84 84
  * is the result str*
85 85
  */
86
-#define NESTED		1<<13
86
+#define NESTED		1<<14
87 87
 
88 88
 /* "fixup call" would be done, when the structure is resolved to this node
89 89
  * which means call with res and msg NULL
90 90
  *
91 91
  * if the fixup call return value <0, the select resolution will fail
92 92
  */
93
-#define FIXUP_CALL	1<<14
93
+#define FIXUP_CALL	1<<15
94 94
 
95 95
 /*
96 96
  * Selector call parameter