1 /* Parse C expressions for CCCP.
2 Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998 Free Software Foundation.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding!
23 Written by Per Bothner 1994. */
25 /* Parse a C expression from text in a string */
31 #ifdef MULTIBYTE_CHARS
35 /* This is used for communicating lists of keywords with cccp.c. */
43 #ifndef CHAR_TYPE_SIZE
44 #define CHAR_TYPE_SIZE BITS_PER_UNIT
48 #define INT_TYPE_SIZE BITS_PER_WORD
51 #ifndef LONG_TYPE_SIZE
52 #define LONG_TYPE_SIZE BITS_PER_WORD
55 #ifndef WCHAR_TYPE_SIZE
56 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
59 #ifndef MAX_CHAR_TYPE_SIZE
60 #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
63 #ifndef MAX_INT_TYPE_SIZE
64 #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
67 #ifndef MAX_LONG_TYPE_SIZE
68 #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
71 #ifndef MAX_WCHAR_TYPE_SIZE
72 #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
75 #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
76 ? (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
77 : ~ (HOST_WIDE_INT) 0)
79 #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
80 ? ~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
81 : ~ (HOST_WIDE_INT) 0)
83 /* Yield nonzero if adding two numbers with A's and B's signs can yield a
84 number with SUM's sign, where A, B, and SUM are all C integers. */
85 #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
87 static void integer_overflow
PARAMS ((cpp_reader
*));
88 static long left_shift
PARAMS ((cpp_reader
*, long, int, unsigned long));
89 static long right_shift
PARAMS ((cpp_reader
*, long, int, unsigned long));
104 #define LEFT_OPERAND_REQUIRED 1
105 #define RIGHT_OPERAND_REQUIRED 2
107 /* SKIP_OPERAND is set for '&&' '||' '?' and ':' when the
108 following operand should be short-circuited instead of evaluated. */
109 #define SKIP_OPERAND 8
110 /*#define UNSIGNEDP 16*/
116 #ifndef HOST_BITS_PER_WIDE_INT
117 #define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
122 char rprio
; /* Priority of op (relative to it right operand). */
124 char unsignedp
; /* true if value should be treated as unsigned */
125 HOST_WIDE_INT value
; /* The value logically "right" of op. */
128 /* Take care of parsing a number (anything that starts with a digit).
129 LEN is the number of characters in it. */
131 /* maybe needs to actually deal with floating point numbers */
134 parse_number (pfile
, start
, olen
)
140 register char *p
= start
;
142 register unsigned long n
= 0, nd
, ULONG_MAX_over_base
;
143 register int base
= 10;
144 register int len
= olen
;
145 register int overflow
= 0;
146 register int digit
, largest_digit
= 0;
151 for (c
= 0; c
< len
; c
++)
153 /* It's a float since it contains a point. */
155 "floating point numbers not allowed in #if expressions");
160 if (len
>= 3 && (!strncmp (p
, "0x", 2) || !strncmp (p
, "0X", 2))) {
168 /* Some buggy compilers (e.g. MPW C) seem to need both casts. */
169 ULONG_MAX_over_base
= ((unsigned long) -1) / ((unsigned long) base
);
171 for (; len
> 0; len
--) {
174 if (c
>= '0' && c
<= '9')
176 else if (base
== 16 && c
>= 'a' && c
<= 'f')
177 digit
= c
- 'a' + 10;
178 else if (base
== 16 && c
>= 'A' && c
<= 'F')
179 digit
= c
- 'A' + 10;
181 /* `l' means long, and `u' means unsigned. */
183 if (c
== 'l' || c
== 'L')
186 cpp_error (pfile
, "two `l's in integer constant");
189 else if (c
== 'u' || c
== 'U')
192 cpp_error (pfile
, "two `u's in integer constant");
202 /* Don't look for any more digits after the suffixes. */
205 if (largest_digit
< digit
)
206 largest_digit
= digit
;
207 nd
= n
* base
+ digit
;
208 overflow
|= ULONG_MAX_over_base
< n
|| nd
< n
;
214 cpp_error (pfile
, "Invalid number in #if expression");
219 if (base
<= largest_digit
)
220 cpp_pedwarn (pfile
, "integer constant contains digits beyond the radix");
223 cpp_pedwarn (pfile
, "integer constant out of range");
225 /* If too big to be signed, consider it unsigned. */
226 if ((long) n
< 0 && ! op
.unsignedp
)
229 cpp_warning (pfile
, "integer constant is so large that it is unsigned");
243 static struct token tokentab2
[] = {
257 /* This is used to accumulate the value of a character literal. It is static
258 so that it only gets allocated once per compilation. */
259 static char *token_buffer
= NULL
;
261 /* Read one token. */
264 cpp_lex (pfile
, skip_evaluation
)
268 register HOST_WIDE_INT c
;
269 register struct token
*toktab
;
270 enum cpp_token token
;
272 U_CHAR
*tok_start
, *tok_end
;
277 old_written
= CPP_WRITTEN (pfile
);
278 cpp_skip_hspace (pfile
);
279 c
= CPP_BUF_PEEK (CPP_BUFFER (pfile
));
283 op
.value
= cpp_read_check_assertion (pfile
);
293 token
= cpp_get_token (pfile
);
294 tok_start
= pfile
->token_buffer
+ old_written
;
295 tok_end
= CPP_PWRITTEN (pfile
);
296 pfile
->limit
= tok_start
;
299 case CPP_EOF
: /* Should not happen ... */
304 if (CPP_BUFFER (pfile
)->fname
!= NULL
)
309 cpp_pop_buffer (pfile
);
311 case CPP_HSPACE
: case CPP_COMMENT
:
314 return parse_number (pfile
, tok_start
, tok_end
- tok_start
);
316 cpp_error (pfile
, "string constants not allowed in #if expressions");
320 /* This code for reading a character constant
321 handles multicharacter constants and wide characters.
322 It is mostly copied from c-lex.c. */
324 register int result
= 0;
325 register int num_chars
= 0;
326 unsigned width
= MAX_CHAR_TYPE_SIZE
;
329 U_CHAR
*ptr
= tok_start
;
331 /* We need to allocate this buffer dynamically since the size is not
332 a constant expression on all platforms. */
333 if (token_buffer
== NULL
)
335 #ifdef MULTIBYTE_CHARS
336 token_buffer
= xmalloc (MAX_LONG_TYPE_SIZE
/MAX_CHAR_TYPE_SIZE
339 token_buffer
= xmalloc (MAX_LONG_TYPE_SIZE
/MAX_CHAR_TYPE_SIZE
+ 1);
347 width
= MAX_WCHAR_TYPE_SIZE
;
348 #ifdef MULTIBYTE_CHARS
349 max_chars
= MB_CUR_MAX
;
355 max_chars
= MAX_LONG_TYPE_SIZE
/ width
;
358 while (ptr
< tok_end
&& ((c
= *ptr
++) != '\''))
362 c
= cpp_parse_escape (pfile
, (char **) &ptr
,
363 wide_flag
? MAX_WCHAR_TYPE_MASK
364 : MAX_CHAR_TYPE_MASK
);
365 if (width
< HOST_BITS_PER_INT
366 && (unsigned) c
>= (unsigned)(1 << width
))
368 "escape sequence out of range for character");
373 /* Merge character into result; ignore excess chars. */
374 if (num_chars
< max_chars
+ 1)
376 if (width
< HOST_BITS_PER_INT
)
377 result
= (result
<< width
) | (c
& ((1 << width
) - 1));
380 token_buffer
[num_chars
- 1] = c
;
384 token_buffer
[num_chars
] = 0;
387 cpp_error (pfile
, "malformatted character constant");
388 else if (num_chars
== 0)
389 cpp_error (pfile
, "empty character constant");
390 else if (num_chars
> max_chars
)
392 num_chars
= max_chars
;
393 cpp_error (pfile
, "character constant too long");
395 else if (num_chars
!= 1 && ! CPP_TRADITIONAL (pfile
))
396 cpp_warning (pfile
, "multi-character character constant");
398 /* If char type is signed, sign-extend the constant. */
401 int num_bits
= num_chars
* width
;
403 if (cpp_lookup (pfile
, (U_CHAR
*)"__CHAR_UNSIGNED__",
404 sizeof ("__CHAR_UNSIGNED__")-1, -1)
405 || ((result
>> (num_bits
- 1)) & 1) == 0)
407 = result
& ((unsigned long) ~0 >> (HOST_BITS_PER_LONG
- num_bits
));
410 = result
| ~((unsigned long) ~0 >> (HOST_BITS_PER_LONG
- num_bits
));
414 #ifdef MULTIBYTE_CHARS
415 /* Set the initial shift state and convert the next sequence. */
417 /* In all locales L'\0' is zero and mbtowc will return zero,
420 || (num_chars
== 1 && token_buffer
[0] != '\0'))
423 (void) mbtowc (NULL_PTR
, NULL_PTR
, 0);
424 if (mbtowc (& wc
, token_buffer
, num_chars
) == num_chars
)
427 cpp_pedwarn (pfile
,"Ignoring invalid multibyte character");
434 /* This is always a signed type. */
441 if (CPP_WARN_UNDEF (pfile
) && !skip_evaluation
)
442 cpp_warning (pfile
, "`%.*s' is not defined",
443 (int) (tok_end
- tok_start
), tok_start
);
444 return parse_number (pfile
, "0", 0);
447 /* See if it is a special token of length 2. */
448 if (tok_start
+ 2 == tok_end
)
450 for (toktab
= tokentab2
; toktab
->operator != NULL
; toktab
++)
451 if (tok_start
[0] == toktab
->operator[0]
452 && tok_start
[1] == toktab
->operator[1])
454 if (toktab
->token
== ERROR
)
456 char *buf
= (char *) alloca (40);
457 sprintf (buf
, "`%s' not allowed in operand of `#if'", tok_start
);
458 cpp_error (pfile
, buf
);
460 op
.op
= toktab
->token
;
471 /* Parse a C escape sequence. STRING_PTR points to a variable
472 containing a pointer to the string to parse. That pointer
473 is updated past the characters we use. The value of the
474 escape sequence is returned.
476 A negative value means the sequence \ newline was seen,
477 which is supposed to be equivalent to nothing at all.
479 If \ is followed by a null character, we return a negative
480 value and leave the string pointer pointing at the null character.
482 If \ is followed by 000, we return 0 and leave the string pointer
483 after the zeros. A value of 0 does not mean end of string. */
486 cpp_parse_escape (pfile
, string_ptr
, result_mask
)
489 HOST_WIDE_INT result_mask
;
491 register int c
= *(*string_ptr
)++;
500 if (CPP_OPTIONS (pfile
)->pedantic
)
501 cpp_pedwarn (pfile
, "non-ANSI-standard escape sequence, `\\%c'", c
);
506 return TARGET_NEWLINE
;
528 register HOST_WIDE_INT i
= c
- '0';
529 register int count
= 0;
532 c
= *(*string_ptr
)++;
533 if (c
>= '0' && c
<= '7')
534 i
= (i
<< 3) + c
- '0';
541 if (i
!= (i
& result_mask
))
544 cpp_pedwarn (pfile
, "octal escape sequence out of range");
550 register unsigned HOST_WIDE_INT i
= 0, overflow
= 0;
551 register int digits_found
= 0, digit
;
554 c
= *(*string_ptr
)++;
555 if (c
>= '0' && c
<= '9')
557 else if (c
>= 'a' && c
<= 'f')
558 digit
= c
- 'a' + 10;
559 else if (c
>= 'A' && c
<= 'F')
560 digit
= c
- 'A' + 10;
566 overflow
|= i
^ (i
<< 4 >> 4);
567 i
= (i
<< 4) + digit
;
571 cpp_error (pfile
, "\\x used with no following hex digits");
572 if (overflow
| (i
!= (i
& result_mask
)))
575 cpp_pedwarn (pfile
, "hex escape sequence out of range");
585 integer_overflow (pfile
)
588 if (CPP_PEDANTIC (pfile
))
589 cpp_pedwarn (pfile
, "integer overflow in preprocessor expression");
593 left_shift (pfile
, a
, unsignedp
, b
)
599 if (b
>= HOST_BITS_PER_LONG
)
601 if (! unsignedp
&& a
!= 0)
602 integer_overflow (pfile
);
606 return (unsigned long) a
<< b
;
611 integer_overflow (pfile
);
617 right_shift (pfile
, a
, unsignedp
, b
)
618 cpp_reader
*pfile ATTRIBUTE_UNUSED
;
623 if (b
>= HOST_BITS_PER_LONG
)
624 return unsignedp
? 0 : a
>> (HOST_BITS_PER_LONG
- 1);
626 return (unsigned long) a
>> b
;
631 /* These priorities are all even, so we can handle associatively. */
632 #define PAREN_INNER_PRIO 0
634 #define COND_PRIO (COMMA_PRIO+2)
635 #define OROR_PRIO (COND_PRIO+2)
636 #define ANDAND_PRIO (OROR_PRIO+2)
637 #define OR_PRIO (ANDAND_PRIO+2)
638 #define XOR_PRIO (OR_PRIO+2)
639 #define AND_PRIO (XOR_PRIO+2)
640 #define EQUAL_PRIO (AND_PRIO+2)
641 #define LESS_PRIO (EQUAL_PRIO+2)
642 #define SHIFT_PRIO (LESS_PRIO+2)
643 #define PLUS_PRIO (SHIFT_PRIO+2)
644 #define MUL_PRIO (PLUS_PRIO+2)
645 #define UNARY_PRIO (MUL_PRIO+2)
646 #define PAREN_OUTER_PRIO (UNARY_PRIO+2)
648 #define COMPARE(OP) \
650 top->value = (unsigned1 || unsigned2) \
651 ? (unsigned long) v1 OP (unsigned long) v2 : (v1 OP v2)
653 /* Parse and evaluate a C expression, reading from PFILE.
654 Returns the value of the expression. */
657 cpp_parse_expr (pfile
)
660 /* The implementation is an operator precedence parser,
661 i.e. a bottom-up parser, using a stack for not-yet-reduced tokens.
663 The stack base is 'stack', and the current stack pointer is 'top'.
664 There is a stack element for each operator (only),
665 and the most recently pushed operator is 'top->op'.
666 An operand (value) is stored in the 'value' field of the stack
667 element of the operator that precedes it.
668 In that case the 'flags' field has the HAVE_VALUE flag set. */
670 #define INIT_STACK_SIZE 20
671 struct operation init_stack
[INIT_STACK_SIZE
];
672 struct operation
*stack
= init_stack
;
673 struct operation
*limit
= stack
+ INIT_STACK_SIZE
;
674 register struct operation
*top
= stack
;
676 int skip_evaluation
= 0;
686 op
= cpp_lex (pfile
, skip_evaluation
);
688 /* See if the token is an operand, in which case go to set_value.
689 If the token is an operator, figure out its left and right
690 priorities, and then goto maybe_reduce. */
697 top
->value
= op
.value
;
698 top
->unsignedp
= op
.unsignedp
;
701 lprio
= 0; goto maybe_reduce
;
703 /* Is this correct if unary ? FIXME */
704 flags
= RIGHT_OPERAND_REQUIRED
;
705 lprio
= PLUS_PRIO
; rprio
= lprio
+ 1; goto maybe_reduce
;
707 flags
= RIGHT_OPERAND_REQUIRED
;
708 rprio
= UNARY_PRIO
; lprio
= rprio
+ 1; goto maybe_reduce
;
709 case '*': case '/': case '%':
710 lprio
= MUL_PRIO
; goto binop
;
711 case '<': case '>': case LEQ
: case GEQ
:
712 lprio
= LESS_PRIO
; goto binop
;
713 case EQUAL
: case NOTEQUAL
:
714 lprio
= EQUAL_PRIO
; goto binop
;
716 lprio
= SHIFT_PRIO
; goto binop
;
717 case '&': lprio
= AND_PRIO
; goto binop
;
718 case '^': lprio
= XOR_PRIO
; goto binop
;
719 case '|': lprio
= OR_PRIO
; goto binop
;
720 case ANDAND
: lprio
= ANDAND_PRIO
; goto binop
;
721 case OROR
: lprio
= OROR_PRIO
; goto binop
;
723 lprio
= COMMA_PRIO
; goto binop
;
725 lprio
= PAREN_OUTER_PRIO
; rprio
= PAREN_INNER_PRIO
;
728 lprio
= PAREN_INNER_PRIO
; rprio
= PAREN_OUTER_PRIO
;
731 lprio
= COND_PRIO
; rprio
= COND_PRIO
;
734 lprio
= COND_PRIO
+ 1; rprio
= COND_PRIO
;
737 flags
= LEFT_OPERAND_REQUIRED
|RIGHT_OPERAND_REQUIRED
;
741 cpp_error (pfile
, "invalid character in #if");
746 /* Push a value onto the stack. */
747 if (top
->flags
& HAVE_VALUE
)
749 cpp_error (pfile
, "syntax error in #if");
752 top
->flags
|= HAVE_VALUE
;
756 /* Push an operator, and check if we can reduce now. */
757 while (top
->rprio
> lprio
)
759 long v1
= top
[-1].value
, v2
= top
[0].value
;
760 int unsigned1
= top
[-1].unsignedp
, unsigned2
= top
[0].unsignedp
;
762 if ((top
[1].flags
& LEFT_OPERAND_REQUIRED
)
763 && ! (top
[0].flags
& HAVE_VALUE
))
765 cpp_error (pfile
, "syntax error - missing left operand");
768 if ((top
[1].flags
& RIGHT_OPERAND_REQUIRED
)
769 && ! (top
[1].flags
& HAVE_VALUE
))
771 cpp_error (pfile
, "syntax error - missing right operand");
774 /* top[0].value = (top[1].op)(v1, v2);*/
778 if (!(top
->flags
& HAVE_VALUE
))
781 top
->unsignedp
= unsigned2
;
782 top
->flags
|= HAVE_VALUE
;
786 top
->value
= v1
+ v2
;
787 top
->unsignedp
= unsigned1
|| unsigned2
;
788 if (! top
->unsignedp
&& ! skip_evaluation
789 && ! possible_sum_sign (v1
, v2
, top
->value
))
790 integer_overflow (pfile
);
794 if (!(top
->flags
& HAVE_VALUE
))
797 if (!skip_evaluation
&& (top
->value
& v2
) < 0 && !unsigned2
)
798 integer_overflow (pfile
);
799 top
->unsignedp
= unsigned2
;
800 top
->flags
|= HAVE_VALUE
;
804 top
->value
= v1
- v2
;
805 top
->unsignedp
= unsigned1
|| unsigned2
;
806 if (! top
->unsignedp
&& ! skip_evaluation
807 && ! possible_sum_sign (top
->value
, v2
, v1
))
808 integer_overflow (pfile
);
812 top
->unsignedp
= unsigned1
|| unsigned2
;
814 top
->value
= (unsigned long) v1
* v2
;
815 else if (!skip_evaluation
)
817 top
->value
= v1
* v2
;
819 && (top
->value
/ v1
!= v2
820 || (top
->value
& v1
& v2
) < 0))
821 integer_overflow (pfile
);
829 cpp_error (pfile
, "division by zero in #if");
832 top
->unsignedp
= unsigned1
|| unsigned2
;
834 top
->value
= (unsigned long) v1
/ v2
;
837 top
->value
= v1
/ v2
;
838 if ((top
->value
& v1
& v2
) < 0)
839 integer_overflow (pfile
);
847 cpp_error (pfile
, "division by zero in #if");
850 top
->unsignedp
= unsigned1
|| unsigned2
;
852 top
->value
= (unsigned long) v1
% v2
;
854 top
->value
= v1
% v2
;
857 if (top
->flags
& HAVE_VALUE
)
859 cpp_error (pfile
, "syntax error");
864 top
->flags
|= HAVE_VALUE
;
867 if (top
->flags
& HAVE_VALUE
)
869 cpp_error (pfile
, "syntax error");
873 top
->unsignedp
= unsigned2
;
874 top
->flags
|= HAVE_VALUE
;
876 case '<': COMPARE(<); break;
877 case '>': COMPARE(>); break;
878 case LEQ
: COMPARE(<=); break;
879 case GEQ
: COMPARE(>=); break;
881 top
->value
= (v1
== v2
);
885 top
->value
= (v1
!= v2
);
891 top
->unsignedp
= unsigned1
;
892 if (v2
< 0 && ! unsigned2
)
893 top
->value
= right_shift (pfile
, v1
, unsigned1
, -v2
);
895 top
->value
= left_shift (pfile
, v1
, unsigned1
, v2
);
900 top
->unsignedp
= unsigned1
;
901 if (v2
< 0 && ! unsigned2
)
902 top
->value
= left_shift (pfile
, v1
, unsigned1
, -v2
);
904 top
->value
= right_shift (pfile
, v1
, unsigned1
, v2
);
906 #define LOGICAL(OP) \
907 top->value = v1 OP v2;\
908 top->unsignedp = unsigned1 || unsigned2;
909 case '&': LOGICAL(&); break;
910 case '^': LOGICAL(^); break;
911 case '|': LOGICAL(|); break;
913 top
->value
= v1
&& v2
; top
->unsignedp
= 0;
914 if (!v1
) skip_evaluation
--;
917 top
->value
= v1
|| v2
; top
->unsignedp
= 0;
918 if (v1
) skip_evaluation
--;
921 if (CPP_PEDANTIC (pfile
))
922 cpp_pedwarn (pfile
, "comma operator in operand of `#if'");
924 top
->unsignedp
= unsigned2
;
927 cpp_error (pfile
, "syntax error in #if");
930 if (top
[0].op
!= '?')
933 "syntax error ':' without preceding '?'");
936 else if (! (top
[1].flags
& HAVE_VALUE
)
937 || !(top
[-1].flags
& HAVE_VALUE
)
938 || !(top
[0].flags
& HAVE_VALUE
))
940 cpp_error (pfile
, "bad syntax for ?: operator");
946 if (top
->value
) skip_evaluation
--;
947 top
->value
= top
->value
? v1
: v2
;
948 top
->unsignedp
= unsigned1
|| unsigned2
;
952 if ((top
[1].flags
& HAVE_VALUE
)
953 || ! (top
[0].flags
& HAVE_VALUE
)
955 || (top
[-1].flags
& HAVE_VALUE
))
957 cpp_error (pfile
, "mismatched parentheses in #if");
964 top
->unsignedp
= unsigned1
;
965 top
->flags
|= HAVE_VALUE
;
970 top
[1].op
>= ' ' && top
[1].op
<= '~'
971 ? "unimplemented operator '%c'\n"
972 : "unimplemented operator '\\%03o'\n",
979 cpp_error (pfile
, "internal error in #if expression");
980 if (stack
!= init_stack
)
986 /* Check for and handle stack overflow. */
989 struct operation
*new_stack
;
990 int old_size
= (char *) limit
- (char *) stack
;
991 int new_size
= 2 * old_size
;
992 if (stack
!= init_stack
)
993 new_stack
= (struct operation
*) xrealloc (stack
, new_size
);
996 new_stack
= (struct operation
*) xmalloc (new_size
);
997 bcopy ((char *) stack
, (char *) new_stack
, old_size
);
1000 top
= (struct operation
*) ((char *) new_stack
+ old_size
);
1001 limit
= (struct operation
*) ((char *) new_stack
+ new_size
);
1007 if ((op
.op
== OROR
&& top
[-1].value
)
1008 || (op
.op
== ANDAND
&& !top
[-1].value
)
1009 || (op
.op
== '?' && !top
[-1].value
))
1013 else if (op
.op
== ':')
1015 if (top
[-2].value
) /* Was condition true? */
1022 if (stack
!= init_stack
)
1024 skip_rest_of_line (pfile
);