Browse code

- fixed statements in ifs w/o {} (now if (cond) a(); else b(); should work) - fixed debug config printing (backports from unstable)

Andrei Pelinescu-Onciul authored on 06/12/2005 12:17:17
Showing 3 changed files
... ...
@@ -59,7 +59,7 @@ MAIN_NAME=ser
59 59
 VERSION = 0
60 60
 PATCHLEVEL = 9
61 61
 SUBLEVEL = 5
62
-EXTRAVERSION = -pre2
62
+EXTRAVERSION = -pre3
63 63
 
64 64
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
65 65
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -58,6 +58,7 @@
58 58
  *              (andrei)
59 59
  * 2004-10-19  added FROM_URI, TO_URI (andrei)
60 60
  * 2004-11-30  added force_send_socket (andrei)
61
+ * 2005-11-16  fixed if (cond) cmd; (andrei)
61 62
  */
62 63
 
63 64
 
... ...
@@ -288,7 +289,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
288 289
 
289 290
 /*non-terminals */
290 291
 %type <expr> exp exp_elem /*, condition*/
291
-%type <action> action actions cmd if_cmd stm
292
+%type <action> action actions cmd if_cmd stm exp_stm
292 293
 %type <ipaddr> ipv4 ipv6 ipv6addr ip
293 294
 %type <ipnet> ipnet
294 295
 %type <strval> host
... ...
@@ -321,7 +322,6 @@ statement:	assign_stm
321 322
 		| {rt=REQUEST_ROUTE;} route_stm 
322 323
 		| {rt=FAILURE_ROUTE;} failure_route_stm
323 324
 		| {rt=ONREPLY_ROUTE;} onreply_route_stm
324
-
325 325
 		| CR	/* null statement*/
326 326
 	;
327 327
 
... ...
@@ -960,7 +960,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem(	$2, STRING_ST,
960 960
 		| MYSELF error	{ $$=0; 
961 961
 							yyerror ("invalid operator, == or != expected");
962 962
 						}
963
-		| stm				{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 ); }
963
+		| exp_stm			{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 );  }
964 964
 		| NUMBER		{$$=mk_elem( NO_OP, NUMBER_ST, NUMBER_O, (void*)$1 ); }
965 965
 	;
966 966
 
... ...
@@ -1005,11 +1005,15 @@ host:	ID				{ $$=$1; }
1005 1005
 	;
1006 1006
 
1007 1007
 
1008
-stm:		cmd						{ $$=$1; }
1008
+exp_stm:	cmd						{ $$=$1; }
1009 1009
 		|	if_cmd					{ $$=$1; }
1010 1010
 		|	LBRACE actions RBRACE	{ $$=$2; }
1011 1011
 	;
1012 1012
 
1013
+stm:		action					{ $$=$1; }
1014
+		|	LBRACE actions	RBRACE	{ $$=$2; }
1015
+	;
1016
+
1013 1017
 actions:	actions action	{$$=append_action($1, $2); }
1014 1018
 		| action			{$$=$1;}
1015 1019
 		| actions error { $$=0; yyerror("bad command"); }
... ...
@@ -162,10 +162,12 @@ void print_expr(struct expr* exp)
162 162
 			case DSTIP_O:
163 163
 				DBG("dstip");
164 164
 				break;
165
+			case DSTPORT_O:
166
+				DBG("dstport");
167
+				break;
165 168
 			case NUMBER_O:
166 169
 				break;
167 170
 			case ACTION_O:
168
-				print_action((struct action*) exp->r.param);
169 171
 				break;
170 172
 			default:
171 173
 				DBG("UNKNOWN");
... ...
@@ -179,6 +181,21 @@ void print_expr(struct expr* exp)
179 181
 				break;
180 182
 			case NO_OP:
181 183
 				break;
184
+			case GT_OP:
185
+				DBG(">");
186
+				break;
187
+			case GTE_OP:
188
+				DBG(">=");
189
+				break;
190
+			case LT_OP:
191
+				DBG("<");
192
+				break;
193
+			case LTE_OP:
194
+				DBG("<=");
195
+				break;
196
+			case DIFF_OP:
197
+				DBG("!=");
198
+				break;
182 199
 			default:
183 200
 				DBG("<UNKNOWN>");
184 201
 		}