pike.git
/
src
/
docode.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/docode.c:1:
/*\ ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License) ||| See the files COPYING and DISCLAIMER for more information. \*/ /**/ #include "global.h"
-
RCSID("$Id: docode.c,v 1.
116
2001/06/
11
18
:
50
:
52
grubba Exp $");
+
RCSID("$Id: docode.c,v 1.
117
2001/06/
13
21
:
53
:
25
grubba Exp $");
#include "las.h" #include "program.h" #include "pike_types.h" #include "stralloc.h" #include "interpret.h" #include "constants.h" #include "array.h" #include "pike_macros.h" #include "pike_error.h" #include "pike_memory.h"
pike.git/src/docode.c:1190:
emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1)); } } free_node(foo); POP_AND_DONT_CLEANUP; return 1; } case F_ARG_LIST: case F_COMMA_EXPR:
+
{
+
node *root = n;
+
node *parent = n->parent;
+
+
/* Avoid a bit of recursion by traversing the graph... */
+
n->parent = NULL;
tmp1 = 0;
-
/*
Avoid
a
bit
of
recursion
by
looping...
*/
-
do
{
+
next_car:
+
while
(CAR(n)
&&
+
((CAR(n)->token == F_ARG_LIST) ||
+
(CAR(n)->token == F_COMMA_EXPR)))
{
+
CAR(n)->parent = n;
+
n = CAR(n);
+
}
+
/* CAR(n) is not F_ARG_LIST or F_COMMA_EXPR */
tmp1 += do_docode(CAR(n), (INT16)(flags & ~WANT_LVALUE));
-
}
while
((n
=
CDR(n))
&&
-
((n->token == F_ARG_LIST) || (n->token == F_COMMA_EXPR)));
-
tmp1 += do_docode(n, flags);
+
+
do {
+
if (
CDR(n))
{
+
if
((
CDR(
n
)
->token == F_ARG_LIST) ||
+
(
CDR(
n
)
->token == F_COMMA_EXPR))
{
+
/* Note: Parent points to the closest preceding CAR node
+
* on the way to the root.
+
*/
+
CDR(n
)
->parent = n->parent
;
+
n = CDR(n);
+
goto next_car;
+
}
+
/* CDR(n) is not F_ARG_LIST or F_COMMA_EXPR */
+
if (n->parent) {
+
tmp1 += do_docode(
CDR(
n
)
,
(INT16)(
flags
& ~WANT_LVALUE
)
)
;
+
} else {
+
tmp1 += do_docode(CDR(n), flags);
+
}
+
}
+
/* Retrace */
+
/* Note: n->parent is always a visited CAR node on the
+
* way to the root.
+
*/
+
n = n->parent;
+
} while (n);
+
+
/* Restore root->parent. */
+
root->parent = parent;
+
}
return DO_NOT_WARN((INT32)tmp1); /* Switch: * So far all switches are implemented with a binsearch lookup. * It stores the case values in the programs area for constants. * It also has a jump-table in the program itself, for every index in * the array of cases, there is 2 indexes in the jumptable, and one extra. * The first entry in the jumptable is used if you call switch with * a value that is ranked lower than all the indexes in the array of