1 /* $Id: expr.h,v 1.6 1994/06/24 10:59:50 ceriel Exp $ */
3 /* expression operators. Do not change values, as they are used as
11 #define E_DIV 5 /* equal to truncated quotient */
12 #define E_MOD 6 /* x = (x E_DIV y) * y + x E_MOD y,
15 #define E_ZDIV 7 /* quotient rounded to 0 */
16 #define E_ZMOD 8 /* remainder of E_ZDIV */
17 #define E_IN 9 /* set membership */
29 #define E_BAND 21 /* bitwise and */
30 #define E_BOR 22 /* bitwise or */
33 #define E_DERSELECT 25 /* -> in C */
38 /* long get_int(char *buf, long size, int class)
39 Returns the value of size 'size', residing in 'buf', of 'class'
40 T_INTEGER, T_UNSIGNED, or T_ENUM.
42 extern long get_int();
44 /* int put_int(char *buf, long size, long value)
45 Stores the value 'value' of size 'size' in 'buf'.
49 /* double get_real(char *buf, long size)
50 Returns the real value of size 'size', residing in 'buf'.
51 T_INTEGER, T_UNSIGNED, or T_ENUM.
53 extern double get_real();
55 /* int put_real(char *buf, long size, double value)
56 Stores the value 'value' of size 'size' in 'buf'.
58 extern int put_real();
60 /* int eval_cond(p_tree p)
61 This routine evaluates the conditional expression indicated by p
62 and returns 1 if it evaluates to TRUE, or 0 if it could not be
63 evaluated for some reason or if it evalutes to FALSE.
64 If the expression cannot be evaluated, an error message is given.
66 extern int eval_cond();
68 /* int eval_desig(p_tree p, t_addr *pbuf, long **psize, p_type *ptp)
69 This routine evaluates the expression indicated by p, which should
70 result in a designator. The result of the expression is an address
71 which is to be found in *pbuf. *psize will contain the size of the
72 designated object, and *ptp its type.
73 If the expression cannot be evaluated or does not result in a
74 designator, 0 is returned and an error message is given.
75 Otherwise, 1 is returned.
77 extern int eval_desig();
79 /* int eval_expr(p_tree p, char **pbuf, long **psize, p_type *ptp)
80 This routine evaluates the expression indicated by p.
81 The result of the expression is left in *pbuf.
82 *psize will contain the size of the value, and *ptp its type.
83 If the expression cannot be evaluated, 0 is returned and an error
84 message is given. Otherwise, 1 is returned.
86 extern int eval_expr();
88 /* int convert(char **pbuf, long *psize, p_type *ptp, p_type tp, long size)
89 This routine tries to convert the value in pbuf of size psize
90 and type ptp to type tp with size size. It returns 0 if this fails,
91 while producing an error message. Otherwise, it returns 1 and
92 the resulting value, type and size are left in pbuf, ptp, and