Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Nessus: commits

libnasl/nasl exec.c,1.18,1.19 nasl_grammar.y,1.9,1.10 nasl_tree.c,1.12,1.13 nasl_tree.h,1.10,1.11

 

 

Nessus commits RSS feed   Index | Next | Previous | View Threaded


mikhail at nessus

Jan 24, 2003, 5:27 AM

Post #1 of 1 (15 views)
Permalink
libnasl/nasl exec.c,1.18,1.19 nasl_grammar.y,1.9,1.10 nasl_tree.c,1.12,1.13 nasl_tree.h,1.10,1.11

Update of /usr/local/cvs/libnasl/nasl
In directory raccoon.nessus.org:/tmp/cvs-serv42885/nasl

Modified Files:
exec.c nasl_grammar.y nasl_tree.c nasl_tree.h
Log Message:
Implement %= operator

Index: exec.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/exec.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- exec.c 24 Jan 2003 11:57:58 -0000 1.18
+++ exec.c 24 Jan 2003 12:27:55 -0000 1.19
@@ -526,6 +526,13 @@

fprintf(fp, ")");
break;

+ case NODE_MODULO_EQ:
+ nasl_dump_expr(fp, c->link[0]);
+ fprintf(fp, "%= (");
+ nasl_dump_expr(fp, c->link[1]);
+ fprintf(fp, ")");
+ break;
+
case NODE_L_SHIFT_EQ:
nasl_dump_expr(fp, c->link[0]);
fprintf(fp, " <<= (");
@@ -611,6 +618,7 @@

case NODE_MINUS_EQ:
case NODE_MULT_EQ:
case NODE_DIV_EQ:
+ case NODE_MODULO_EQ:
case NODE_R_SHIFT_EQ:
case NODE_R_USHIFT_EQ:
case NODE_L_SHIFT_EQ:
@@ -946,6 +954,16 @@

tc1 = nasl_exec(lexic, st->link[0]);
tc2 = nasl_exec(lexic, st->link[1]);
tc3 = alloc_expr_cell(0, EXPR_DIV, tc1, tc2);
+ ret2 = nasl_exec(lexic, tc3);
+ ret = nasl_affect(tc1, ret2);
+ deref_cell(tc3); /* Frees tc1 and tc2 */
+ deref_cell(ret);
+ return ret2;
+
+ case NODE_MODULO_EQ:
+ tc1 = nasl_exec(lexic, st->link[0]);
+ tc2 = nasl_exec(lexic, st->link[1]);
+ tc3 = alloc_expr_cell(0, EXPR_MODULO, tc1, tc2);
ret2 = nasl_exec(lexic, tc3);
ret = nasl_affect(tc1, ret2);
deref_cell(tc3); /* Frees tc1 and tc2 */

Index: nasl_grammar.y
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl_grammar.y,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- nasl_grammar.y 24 Jan 2003 11:57:58 -0000 1.9
+++ nasl_grammar.y 24 Jan 2003 12:27:55 -0000 1.10
@@ -80,6 +80,7 @@

%token MINUS_EQ
%token MULT_EQ
%token DIV_EQ
+%token MODULO_EQ
%token L_SHIFT_EQ
%token R_SHIFT_EQ
%token R_USHIFT_EQ
<a href="0061.html#0225qlink1">@@ -102,7 +103,7 @@

%type <str> identifier string

/* Priority of all operators */
-%right '=' PLUS_EQ MINUS_EQ MULT_EQ DIV_EQ L_SHIFT_EQ R_SHIFT_EQ R_USHIFT_EQ
+%right '=' PLUS_EQ MINUS_EQ MULT_EQ DIV_EQ MODULO_EQ L_SHIFT_EQ R_SHIFT_EQ R_USHIFT_EQ
%left OR
%left AND
%nonassoc '<' '>' EQ NEQ SUPEQ INFEQ MATCH
@@ -316,6 +317,7 @@

| lvalue MINUS_EQ expr { $$ = alloc_expr_cell(LNB, NODE_MINUS_EQ, $1, $3); }
| lvalue MULT_EQ expr { $$ = alloc_expr_cell(LNB, NODE_MULT_EQ, $1, $3); }
| lvalue DIV_EQ expr { $$ = alloc_expr_cell(LNB, NODE_DIV_EQ, $1, $3); }
+ | lvalue MODULO_EQ expr { $$ = alloc_expr_cell(LNB, NODE_MODULO_EQ, $1, $3); }
| lvalue R_SHIFT_EQ expr { $$ = alloc_expr_cell(LNB, NODE_R_SHIFT_EQ, $1, $3); }
| lvalue R_USHIFT_EQ expr { $$ = alloc_expr_cell(LNB, NODE_R_USHIFT_EQ, $1, $3); }
| lvalue L_SHIFT_EQ expr { $$ = alloc_expr_cell(LNB, NODE_L_SHIFT_EQ, $1, $3); }
@@ -513,6 +515,7 @@

ST_MINUS,
ST_MULT,
ST_DIV,
+ ST_MODULO,
ST_R_SHIFT,
ST_R_USHIFT,
ST_L_SHIFT,
@@ -573,6 +576,8 @@

st = ST_MULT;
else if (c == '/')
st = ST_DIV;
+ else if (c == '%')
+ st = ST_MODULO;
else if (c == '>')
st = ST_SUP;
else if (c == '<')
@@ -940,6 +945,15 @@

if (c == '\n')
ctx->line_nb --;
return '/';
+
+ case ST_MODULO:
+ if (c == '=')
+ return MODULO_EQ;
+
+ ungetc(c, fp);
+ if (c == '\n')
+ ctx->line_nb --;
+ return '%';

}


Index: nasl_tree.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl_tree.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- nasl_tree.c 24 Jan 2003 11:57:58 -0000 1.12
+++ nasl_tree.c 24 Jan 2003 12:27:55 -0000 1.13
@@ -198,6 +198,8 @@

"NODE_MINUS_EQ",
"NODE_MULT_EQ",
"NODE_DIV_EQ",
+ "NODE_MODULO_EQ",
+
"NODE_L_SHIFT_EQ",
"NODE_R_SHIFT_EQ",
"NODE_R_USHIFT_EQ",

Index: nasl_tree.h
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl_tree.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- nasl_tree.h 24 Jan 2003 12:17:36 -0000 1.10
+++ nasl_tree.h 24 Jan 2003 12:27:55 -0000 1.11
<a href="0043.html#0225qlink2">@@ -55,6 +55,8 @@

NODE_MINUS_EQ,
NODE_MULT_EQ,
NODE_DIV_EQ,
+ NODE_MODULO_EQ,
+
NODE_L_SHIFT_EQ,

Nessus commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.