4 * Revision 1.1 2001/04/04 05:43:39 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.2 1999/11/26 13:13:47 bnv
8 * Changed: To use the new macros.
10 * Revision 1.1 1998/07/02 17:34:50 bnv
22 /* ----------- vrefp --------- */
23 /* variable reference position */
27 nextsymbol(); /* skip left parenthesis */
29 if (symbol
!= ident_sy
)
30 Lerror( ERR_STRING_EXPECTED
,7,&symbolstr
);
32 _CodeAddByte( load_mn
);
33 _CodeAddPtr( SYMBOLADD2LITS
);
34 TraceByte( nothing_middle
);
37 _mustbe(ri_parent
,ERR_INV_VAR_REFERENCE
,1);
40 /* -------- position ------- */
41 /* variable reference position */
47 if (symbol
==le_parent
)
50 if (symbol
==literal_sy
) {
51 type
= _Lisnum(&symbolstr
);
53 Lerror(ERR_INVALID_INTEGER
,4,&symbolstr
);
56 Lerror(ERR_INVALID_TEMPLATE
,2,&symbolstr
);
57 _CodeAddByte(push_mn
);
58 _CodeAddPtr(SYMBOLADD2LITS_KEY
);
59 TraceByte( nothing_middle
);
62 Lerror(ERR_INVALID_TEMPLATE
,2,&symbolstr
);
63 _CodeAddByte(toint_mn
);
66 /* -------------------------------------------------------------- */
67 /* template_list := template | [template] ',' [template_list] */
68 /* template := (trigger | target | Msg38.1)+ */
69 /* target := VAR_SYMBOL | '.' */
70 /* trigger := pattern | positional */
71 /* pattern := STRING | vrefp */
72 /* vrefp := '(' (VAR_SYMBOL | Msg19.7) (')' | Msg46.1) */
73 /* positional := absolute_pos | relative_pos */
74 /* absolute_pos := NUMBER | '=' position */
75 /* position := NUMBER | vrefp | Msg38.2 */
76 /* relative_pos := ('+' | '-') position */
77 /* -------------------------------------------------------------- */
81 void *target_ptr
=NULL
;
82 bool trigger
, dot
=FALSE
;
86 _CodeAddByte(parse_mn
);
87 while ((symbol
!=semicolon_sy
) && (symbol
!=comma_sy
)) {
92 if (target_ptr
|| dot
) {
95 _CodeAddByte(tr_space_mn
);
96 /* do not go to next symbol */
99 target_ptr
= SYMBOLADD2LITS
;
109 sign
= (symbol
==minus_sy
);
113 _CodeAddByte(neg_mn
);
114 TraceByte( nothing_middle
);
116 _CodeAddByte(tr_rel_mn
);
123 _CodeAddByte(push_mn
);
124 _CodeAddPtr(SYMBOLADD2LITS_KEY
);
125 TraceByte( nothing_middle
);
126 _CodeAddByte(tr_lit_mn
);
129 type
= _Lisnum(&symbolstr
);
131 Lerror(ERR_INVALID_INTEGER
,4,&symbolstr
);
133 if (type
==LSTRING_TY
)
134 Lerror(ERR_INVALID_TEMPLATE
,1,&symbolstr
);
136 _CodeAddByte(push_mn
);
137 _CodeAddPtr(SYMBOLADD2LITS_KEY
);
138 TraceByte( nothing_middle
);
139 _CodeAddByte(toint_mn
);
140 _CodeAddByte(tr_abs_mn
);
148 _CodeAddByte(tr_lit_mn
);
155 _CodeAddByte(toint_mn
);
156 _CodeAddByte(tr_abs_mn
);
160 Lerror(ERR_INVALID_TEMPLATE
,0);
161 } /* end of switch */
164 _CodeAddByte(create_mn
);
165 _CodeAddPtr(target_ptr
);
166 _CodeAddByte(pvar_mn
);
167 TraceByte( other_middle
);
171 _CodeAddByte(pdot_mn
);
172 TraceByte( dot_middle
);
178 if (target_ptr
) { /* assign the remaining part */
179 _CodeAddByte(tr_end_mn
);
180 _CodeAddByte(create_mn
);
181 _CodeAddPtr(target_ptr
);
182 _CodeAddByte(pvar_mn
);
183 TraceByte( other_middle
);
186 _CodeAddByte(tr_end_mn
);
187 _CodeAddByte(pdot_mn
);
188 TraceByte( dot_middle
);
191 _CodeAddByte(pop_mn
);