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.8 1999/11/26 13:13:47 bnv
8 * Added: Windows CE support
9 * Changed: To use the new macros.
11 * Revision 1.7 1999/06/10 14:08:35 bnv
12 * When a called procedure with local variables returne a variable
13 * the variable contents was freed first before copied to the RESULT.
15 * Revision 1.6 1999/05/14 12:31:22 bnv
18 * Revision 1.5 1999/03/15 15:21:36 bnv
19 * Corrected to handle the error_trace
21 * Revision 1.4 1999/03/15 09:01:57 bnv
22 * Corrected: error_trace
24 * Revision 1.3 1999/03/10 16:53:32 bnv
27 * Revision 1.2 1999/03/01 10:54:37 bnv
28 * Corrected: To clean correctly the RxStck after an interpret_mn
30 * Revision 1.1 1998/07/02 17:34:50 bnv
35 #define __INTERPRET_C__
55 # define MAX_EVENT_COUNT 50
58 /* ---------------- global variables ------------------ */
59 int _trace
; /* if trace is enabled */
60 PLstr RxStck
[STCK_SIZE
]; /* Array of PLstr */
61 int RxStckTop
; /* top item of stack */
62 Lstr _tmpstr
[STCK_SIZE
]; /* temporary strings */
64 /*extern int _interrupt;*/ /* if any interrupt is pending */
65 /*void ProcessInterrupt();*/
67 /* ---------------- Local variables ------------------- */
68 static Scope VarScope
; /* Variables Scope */
69 static PLstr ToParse
; /* Parsing variables */
74 SourceEnd
; /* Length of string+1 */
77 static jmp_buf old_error
; /* keep old value of errortrap */
79 extern Lstr stemvaluenotfound
; /* from variable.c */
82 # define DEBUGDISPLAY0(a) if (__debug__) printf("\t%u\t%s\n",inst_ip,(a))
83 # define DEBUGDISPLAY0nl(a) if (__debug__) printf("\t%u\t%s\t",inst_ip,(a))
84 # define DEBUGDISPLAY(a) if (__debug__) {printf("\t%u\t%s\t\"",inst_ip,(a)); \
85 Lprint(STDOUT,RxStck[RxStckTop]); printf("\"\n"); }
86 # define DEBUGDISPLAYi(a,b) if (__debug__) {printf("\t%u\t%s\t\"",inst_ip,(a)); \
87 Lprint(STDOUT,(b)); printf("\"\n"); }
88 # define DEBUGDISPLAY2(a) if (__debug__) {printf("\t%u\t%s\t\"",inst_ip,(a)); \
89 Lprint(STDOUT,RxStck[RxStckTop-1]); printf("\",\""); \
90 Lprint(STDOUT,RxStck[RxStckTop]);printf("\"\n"); }
92 int instr_cnt
[256]; /* instruction counter */
94 # define DEBUGDISPLAY0(a)
95 # define DEBUGDISPLAY0nl(a)
96 # define DEBUGDISPLAY(a)
97 # define DEBUGDISPLAYi(a,b)
98 # define DEBUGDISPLAY2(a)
101 #define CHKERROR if (RxStckTop==STCK_SIZE-1) Lerror(ERR_STORAGE_EXHAUSTED,0)
102 #define INCSTACK { RxStckTop++; CHKERROR; }
103 #define POP_C_POP_B_PEEK_A { POP(C); POP(B); PEEK(A); }
104 #define PEEK(x) x = &(RxStck[RxStckTop])
105 #define PEEKR(x,r) x = &(RxStck[RxStckTop-(r)])
106 #define POP(x) x = &(RxStck[RxStckTop--])
107 #define PUSH(x) {x = &(RxStck[++RxStckTop]); CHKERROR; }
110 # define PLEAF(x) { x = (PBinLeaf)(*(dword*)Rxcip); \
111 Rxcip += sizeof(dword); }
112 # define INCWORD(x) (x) += sizeof(word)
113 # define INCDWORD(x) (x) += sizeof(dword)
116 # define PLEAF(x) x = (PBinLeaf)(*Rxcip++)
117 # define INCWORD(x) (x)++
118 # define INCDWORD(x) (x)++
122 /* ---------------- RxProcResize ---------------- */
126 size_t oldsize
=_Proc_size
;
128 _Proc_size
+= PROC_INC
;
129 _Proc
= (RxProc
*) REALLOC( _Proc
, _Proc_size
* sizeof(RxProc
) );
130 MEMSET(_Proc
+oldsize
,0,PROC_INC
*sizeof(RxProc
));
133 /* ------------- I_trigger_space -------------- */
135 I_trigger_space( void )
137 /* normalise to 0 .. len-1 */
138 DataStart
= BreakEnd
-1;
140 /* skip leading spaces */
141 LSKIPBLANKS(*ToParse
,DataStart
);
144 BreakStart
= DataStart
;
145 LSKIPWORD(*ToParse
,BreakStart
);
147 /* skip trailing spaces */
148 BreakEnd
= BreakStart
;
149 LSKIPBLANKS(*ToParse
,BreakEnd
);
151 /* again in rexx strings 1..len */
155 } /* I_trigger_space */
157 /* ------------- I_trigger_litteral -------------- */
159 I_trigger_litteral(const PLstr lit
)
163 PatternPos
= (int)Lpos(lit
,ToParse
,DataStart
);
165 BreakStart
= PatternPos
;
166 BreakEnd
= PatternPos
+ LLEN(*lit
);
167 } else { /* the rest of the source is selected */
168 DataStart
= BreakEnd
;
169 BreakStart
= SourceEnd
;
170 BreakEnd
= SourceEnd
;
172 } /* I_trigger_litteral */
174 /* ----------------- I_LoadOption ---------------- */
176 I_LoadOption( const PLstr value
, const int opt
)
181 case environment_opt
:
182 Lstrcpy(value
,_Proc
[_rx_proc
].env
);
186 Licpy(value
,_Proc
[_rx_proc
].digits
);
190 Licpy(value
,_Proc
[_rx_proc
].fuzz
);
194 Lscpy(value
,(_Proc
[_rx_proc
].form
)?"SCIENTIFIC":"ENGINEERING");
202 Lscpy(value
,VERSION
);
210 switch (_Proc
[_rx_proc
].calltype
) {
212 Lscpy(value
,"PROCEDURE");
215 Lscpy(value
,"FUNCTION");
218 Lscpy(value
,"COMMAND");
223 Lstrcpy(value
,&(CompileClause
[0].fptr
)->filename
);
227 Lscpy(value
,_prgname
);
241 Lerror(ERR_INTERPRETER_FAILURE
,0);
245 /* ----------------- I_StoreOption --------------- */
247 I_StoreOption( const PLstr value
, const int opt
)
252 case environment_opt
:
253 if (LLEN(*value
) > 250)
254 Lerror(ERR_ENVIRON_TOO_LONG
,1,value
);
255 if (_Proc
[_rx_proc
].env
== _Proc
[_rx_proc
-1].env
)
256 LPMALLOC(_Proc
[_rx_proc
].env
);
257 Lstrcpy(_Proc
[_rx_proc
].env
,value
);
262 if (_Proc
[_rx_proc
].trace
&
263 (normal_trace
| off_trace
| error_trace
))
272 _Proc
[_rx_proc
].digits
= LMAXNUMERICDIGITS
;
276 Lerror(ERR_INVALID_INTEGER
,5,value
);
277 _Proc
[_rx_proc
].digits
= (int)l
;
279 lNumericDigits
= MIN(_Proc
[_rx_proc
].digits
,LMAXNUMERICDIGITS
);
280 if (_Proc
[_rx_proc
].digits
<= _Proc
[_rx_proc
].fuzz
)
281 Lerror(ERR_INVALID_RESULT
,1);
286 _Proc
[_rx_proc
].fuzz
= 0;
290 Lerror(ERR_INVALID_INTEGER
,6,value
);
291 _Proc
[_rx_proc
].fuzz
= (int)l
;
293 if (_Proc
[_rx_proc
].digits
<= _Proc
[_rx_proc
].fuzz
)
294 Lerror(ERR_INVALID_RESULT
,1);
298 _Proc
[_rx_proc
].form
= (int)Lrdint(value
);
302 case set_signal_name_opt
:
303 switch (LSTR(*value
)[0]) {
305 _Proc
[_rx_proc
].condition
|= SC_ERROR
;
306 if (opt
==set_signal_name_opt
)
307 _Proc
[_rx_proc
].lbl_error
= RxStck
[RxStckTop
-1];
309 _Proc
[_rx_proc
].lbl_error
= &(ErrorStr
->key
);
312 _Proc
[_rx_proc
].condition
|= SC_HALT
;
313 if (opt
==set_signal_name_opt
)
314 _Proc
[_rx_proc
].lbl_halt
= RxStck
[RxStckTop
-1];
316 _Proc
[_rx_proc
].lbl_halt
= &(HaltStr
->key
);
319 if (LSTR(*value
)[2]=='V') {
320 _Proc
[_rx_proc
].condition
|= SC_NOVALUE
;
321 if (opt
==set_signal_name_opt
)
322 _Proc
[_rx_proc
].lbl_novalue
= RxStck
[RxStckTop
-1];
324 _Proc
[_rx_proc
].lbl_novalue
= &(NoValueStr
->key
);
326 _Proc
[_rx_proc
].condition
|= SC_NOTREADY
;
327 if (opt
==set_signal_name_opt
)
328 _Proc
[_rx_proc
].lbl_notready
= RxStck
[RxStckTop
-1];
330 _Proc
[_rx_proc
].lbl_notready
= &(NotReadyStr
->key
);
334 _Proc
[_rx_proc
].condition
|= SC_SYNTAX
;
335 if (opt
==set_signal_name_opt
)
336 _Proc
[_rx_proc
].lbl_syntax
= RxStck
[RxStckTop
-1];
338 _Proc
[_rx_proc
].lbl_syntax
= &(SyntaxStr
->key
);
341 Lerror(ERR_INTERPRETER_FAILURE
,0);
345 case unset_signal_opt
:
346 switch (LSTR(*value
)[0]) {
348 _Proc
[_rx_proc
].condition
&= ~SC_ERROR
;
351 _Proc
[_rx_proc
].condition
&= ~SC_HALT
;
354 if (LSTR(*value
)[2]=='V')
355 _Proc
[_rx_proc
].condition
&= ~SC_NOVALUE
;
357 _Proc
[_rx_proc
].condition
&= ~SC_NOTREADY
;
360 _Proc
[_rx_proc
].condition
&= ~SC_SYNTAX
;
363 Lerror(ERR_INTERPRETER_FAILURE
,0);
368 Lerror(ERR_INTERPRETER_FAILURE
,0);
370 } /* I_StoreOption */
372 /* ---------------- I_MakeIntArgs ---------------- */
373 /* prepare arguments for an internal function call */
374 /* returns stack position after call */
379 I_MakeIntArgs( const int na
, const int realarg
, const word existarg
)
382 word bp
; /* bit position */
387 /* must doit reverse */
388 MEMSET(Rxarg
.a
,0,sizeof(Rxarg
.a
));
390 Rxarg
.r
= RxStck
[RxStckTop
-realarg
];
392 st
= RxStckTop
; /* stack position of arguments */
393 for (i
=na
-1; i
>=0; i
--) {
395 if (Rxarg
.r
== RxStck
[st
]) {
396 Lstrcpy(&(_tmpstr
[st
]),RxStck
[st
]);
397 Rxarg
.a
[i
] = &_tmpstr
[st
];
399 Rxarg
.a
[i
] = RxStck
[st
];
405 } /* I_MakeIntArgs */
407 /* ---------------- I_MakeArgs ---------------- */
408 /* prepare arguments for a call to a func */
413 I_MakeArgs( const int calltype
, const int na
, const word existarg
)
416 word bp
; /* bit position */
420 _rx_proc
++; /* increase program items */
422 if (_rx_proc
==_Proc_size
) RxProcResize();
425 /* initialise pr structure */
426 /* use the old values */
427 MEMCPY(pr
,_Proc
+_rx_proc
-1,sizeof(*pr
));
428 pr
->calltype
= calltype
;
429 pr
->ip
= (size_t)((byte huge
*)Rxcip
- (byte huge
*)Rxcodestart
);
430 pr
->stacktop
= RxStckTop
;
432 /* setup arguments */
438 /* must doit reverse */
439 MEMSET(arg
->a
,0,sizeof(arg
->a
));
441 st
= RxStckTop
; /* stack position of arguments */
442 for (i
=na
-1; i
>=0; i
--) {
444 arg
->a
[i
] = RxStck
[st
];
452 if (calltype
==CT_FUNCTION
)
458 /* -------------- I_CallFunction ---------------- */
460 I_CallFunction( void )
462 PBinLeaf leaf
,litleaf
;
464 int ct
,nargs
,realarg
,st
;
465 CTYPE existarg
, line
;
472 /* --- read the arguments here --- */
473 PLEAF(leaf
); /* function number */
474 nargs
= *(Rxcip
++); /* number of args */
475 realarg
= *(Rxcip
++); /* real arguments */
476 existarg
= *(CWORD
*)Rxcip
; /* existing arguments */
478 line
= *(CWORD
*)Rxcip
; /* SIGL line */
480 ct
= *(Rxcip
++); /* call type */
481 func
= (RxFunc
*)(leaf
->value
);
486 for (i
=0; i
<LLEN(leaf
->key
); i
++)
487 putchar(LSTR(leaf
->key
)[i
]);
488 printf(" NoArgs=%d, Exist=%lX Type=%s\n",
489 nargs
, existarg
,(func
->type
==FT_BUILTIN
)?"builtin":"other");
493 if (func
->type
== FT_BUILTIN
) {
494 nargs
= I_MakeIntArgs(nargs
,realarg
,existarg
);
495 (func
->builtin
->func
)(func
->builtin
->opt
);
496 if (ct
==CT_PROCEDURE
) {
497 RxVarSet(VarScope
,ResultStr
,Rxarg
.r
);
498 RxStckTop
= nargs
-1; /* clear stack */
503 if (func
->label
== UNKNOWN_LABEL
) {
505 /* try an external function */
507 /// First check to see if this prg exist with
508 /// the extension of the calling program
509 /// but this should be done in compiling time..
511 st
= RxStckTop
-realarg
;
514 Lstrcpy(&cmd
,&(leaf
->key
));
515 while (st
<=RxStckTop
) {
517 Lstrcat(&cmd
,RxStck
[st
++]);
519 RxRedirectCmd(&cmd
,FALSE
,TRUE
,res
);
521 RxStckTop
-= realarg
;
523 Lerror(ERR_INVALID_FUNCTION
,0);
528 RxSetSpecialVar(SIGLVAR
,line
);
529 I_MakeArgs(ct
,nargs
,existarg
);
530 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+func
->label
);
531 Rxcip
++; /* skip the newclause_mn */
532 if (_trace
) TraceClause();
534 /* handle proc_mn code */
535 if (*Rxcip
== proc_mn
) {
538 /* give a unique program id */
539 /* we might have a problem after 2*32 routine calls!! */
541 _Proc
[_rx_proc
].id
= _procidcnt
;
545 inst_ip
= (size_t)((byte huge
*)Rxcip
- (byte huge
*)Rxcodestart
);
547 DEBUGDISPLAY0nl("PROC ");
549 _Proc
[_rx_proc
].scope
= RxScopeMalloc();
550 VarScope
= _Proc
[_rx_proc
].scope
;
552 /* handle exposed variables */
553 exposed
= *(Rxcip
++);
555 if (__debug__
&& exposed
>0)
558 for (;exposed
>0;exposed
--) {
559 PLEAF(litleaf
); /* Get pointer to variable */
563 Lprint(STDOUT
,&(litleaf
->key
));
566 RxVarExpose(VarScope
,litleaf
);
576 } /* I_CallFunction */
578 /* ---------------- I_ReturnProc -------------- */
579 /* restore arguments after a procedure return */
583 /* fix ip and stack */
584 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ _Proc
[_rx_proc
].ip
);
585 RxStckTop
= _Proc
[_rx_proc
].stack
;
588 /* free everything that it is new */
589 if (VarScope
!=_Proc
[_rx_proc
-1].scope
) {
590 RxScopeFree(VarScope
);
594 if (_Proc
[_rx_proc
].env
!= _Proc
[_rx_proc
-1].env
)
595 LPFREE(_Proc
[_rx_proc
].env
);
598 /* load previous data and exit */
600 Rx_id
= _Proc
[_rx_proc
].id
;
601 VarScope
= _Proc
[_rx_proc
].scope
;
602 lNumericDigits
= _Proc
[_rx_proc
].digits
;
604 if (_Proc
[_rx_proc
].trace
& (normal_trace
| off_trace
| error_trace
))
610 /* ------------ RxInitInterStr -------------- */
616 _rx_proc
++; /* increase program items */
617 if (_rx_proc
==_Proc_size
) RxProcResize();
620 /* program id is the same */
621 MEMCPY(pr
,_Proc
+_rx_proc
-1,sizeof(*pr
));
622 pr
->calltype
= CT_INTERPRET
;
623 pr
->ip
= (size_t)((byte huge
*)Rxcip
- (byte huge
*)Rxcodestart
);
624 pr
->codelen
= LLEN(*_code
);
625 pr
->clauselen
= CompileCurClause
;
626 pr
->stack
= RxStckTop
-1; /* before temporary str */
627 pr
->stacktop
= RxStckTop
;
629 /* setup arguments */
631 MEMSET(pr
->arg
.a
,0,sizeof(pr
->arg
.a
));
634 /* --- save state --- */
635 MEMCPY(old_error
,_error_trap
,sizeof(_error_trap
));
636 SIGNAL(SIGINT
,SIG_IGN
);
638 /* compile the program */
639 RxInitCompile(rxfile
,RxStck
[RxStckTop
]);
642 /* --- restore state --- */
643 MEMCPY(_error_trap
,old_error
,sizeof(_error_trap
));
644 SIGNAL(SIGINT
,RxHaltTrap
);
646 /* might have changed position */
647 Rxcodestart
= (CIPTYPE
*)LSTR(*_code
);
648 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ pr
->codelen
);
650 /* check for an error in compilation */
652 /* --- load previous data and exit ---- */
653 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ pr
->ip
);
655 Rx_id
= _Proc
[_rx_proc
].id
;
656 VarScope
= _Proc
[_rx_proc
].scope
;
658 RxSetSpecialVar(RCVAR
,RxReturnCode
);
659 RxSignalCondition(SC_SYNTAX
);
661 } /* RxInitInterStr */
663 /* ------------ RxDoneInterStr -------------- */
665 RxDoneInterStr( void )
667 /* fix ip and stack */
668 if (_Proc
[_rx_proc
].calltype
== CT_INTERACTIVE
) {
669 if (_Proc
[_rx_proc
].trace
&
670 (normal_trace
| off_trace
| error_trace
))
676 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ _Proc
[_rx_proc
].ip
);
677 RxStckTop
= _Proc
[_rx_proc
].stack
;
679 /* fixup code length, cut the interpretation code */
680 LLEN(*_code
) = _Proc
[_rx_proc
].codelen
;
681 CompileCurClause
= _Proc
[_rx_proc
].clauselen
;
682 if (_Proc
[_rx_proc
].env
!= _Proc
[_rx_proc
-1].env
) {
683 Lstrcpy(_Proc
[_rx_proc
-1].env
, _Proc
[_rx_proc
].env
);
684 LPFREE(_Proc
[_rx_proc
].env
);
687 /* --- load previous data and exit ---- */
689 Rx_id
= _Proc
[_rx_proc
].id
;
691 _Proc
[_rx_proc
].trace
= _Proc
[_rx_proc
+1].trace
;
692 _Proc
[_rx_proc
].interactive_trace
= _Proc
[_rx_proc
+1].interactive_trace
;
693 VarScope
= _Proc
[_rx_proc
].scope
;
694 } /* RxDoneInterStr */
696 /* ---------------- RxInitInterpret --------------- */
698 RxInitInterpret( void )
703 MEMSET(instr_cnt
,sizeof(instr_cnt
),0);
705 MEMSET(RxStck
,0,(STCK_SIZE
)*sizeof(PLstr
));
707 MEMSET(_tmpstr
,0,(STCK_SIZE
)*sizeof(Lstr
));
708 for (i
=0; i
<STCK_SIZE
;i
++) {
709 Lfx(&(_tmpstr
[i
]),0);
710 if (!LSTR(_tmpstr
[i
])) Lerror(ERR_STORAGE_EXHAUSTED
,0);
712 } /* RxInitInterpret */
714 /* ---------------- RxDoneInterpret --------------- */
716 RxDoneInterpret( void )
721 fout
= fopen("instr.cnt","w");
722 fprintf(fout
,"Instr\tCount\n");
723 for (i
=0; i
<pow_mn
; i
++) /* pow is the last command */
724 fprintf(fout
,"%d\t%d\n",i
,instr_cnt
[i
]);
728 fprintf(STDERR
,"interpret: Something left in stack %d\n", RxStckTop
);
732 for (i
=0; i
<STCK_SIZE
; i
++) {
734 if (__debug__
&& LLEN(_tmpstr
[i
])) {
735 fprintf(STDERR
,"Freeing... %d: \"",i
);
736 Lprint(STDERR
,&(_tmpstr
[i
]));
737 fprintf(STDERR
,"\"\n");
740 LFREESTR(_tmpstr
[i
]);
742 } /* RxDoneInterpret */
744 /* ---------------- RxInterpret --------------- */
752 int jc
, errno
, subno
, found
;
753 PBinLeaf litleaf
,leaf
;
764 Rx_id
= _Proc
[_rx_proc
].id
;
766 Rxcodestart
= (CIPTYPE
*)LSTR(*_code
);
767 VarScope
= _Proc
[_rx_proc
].scope
;
768 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ _Proc
[_rx_proc
].ip
);
769 _Proc
[_rx_proc
].stack
= RxStckTop
;
771 if (_Proc
[_rx_proc
].trace
& (normal_trace
| off_trace
| error_trace
))
776 SIGNAL(SIGINT
,RxHaltTrap
);
778 if ((jc
=setjmp(_error_trap
))!=0) {
783 goto interpreter_fin
;
785 /* else if (jc==JMP_CONTINUE) .... CONTINUE code */
787 /* exit from interpret, if we are in any */
789 while (_Proc
[_rx_proc
].calltype
==CT_INTERPRET
)
794 RxStckTop
= _Proc
[_rx_proc
].stacktop
;
804 switch (l2u
[(byte
)cmd
]) {
806 printf("Memory allocated=%ld\n",
811 printf("Stack is empty\n");
813 for (i
=RxStckTop
; i
>=0; i
--) {
815 Lprint(STDOUT
,RxStck
[i
]);
820 goto interpreter_fin
;
826 printf("Stck:%d\t",RxStckTop
+1);
827 inst_ip
= (size_t)((byte huge
*)Rxcip
- (byte huge
*)Rxcodestart
);
829 instr_cnt
[(int)*Rxcip
]++;
831 switch (*(Rxcip
++)) {
833 * [mnemonic] <type>[value]...
838 /* START A NEW COMMAND */
840 DEBUGDISPLAY0("NEWCLAUSE");
841 if (_trace
) TraceClause();
843 /* Check for messages in the event queue */
844 if (++event_count
== MAX_EVENT_COUNT
) {
846 /* Peek the stacked events */
848 /*// if (_interrupt) ProcessInterrupt(); */
853 /* POP = NO OPERATION */
855 DEBUGDISPLAY0("NOP");
859 /* push a litteral to stack */
862 RxStck
[RxStckTop
] = (PLstr
)(*(dword
*)Rxcip
);
865 DEBUGDISPLAY("PUSH");
871 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
873 DEBUGDISPLAY0("PUSHTMP");
877 /* pop NUM stack items */
879 DEBUGDISPLAY0("POP");
880 RxStckTop
-= *(Rxcip
++);
884 /* duplicate RELative stck item */
887 RxStck
[RxStckTop
] = RxStck
[RxStckTop
-*(Rxcip
++)-1];
893 /* copy (Lstrcpy) top item */
894 /* to previous one */
896 DEBUGDISPLAY("COPY");
897 Lstrcpy(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
902 /* if top item is not a pointer */
903 /* to a tmp var then copy the */
904 /* value to a tmp var */
906 /* copy to temporary only if different */
907 if (RxStck
[RxStckTop
] != &(_tmpstr
[RxStckTop
])) {
908 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
909 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
911 DEBUGDISPLAY("COPY2TMP");
914 /* PATCH w[rel] b[code] */
915 /* patch CODE string to RELative pos with CODE */
917 w
= *(CWORD
*)Rxcip
; INCWORD(Rxcip
);
918 *(CIPTYPE
*)((byte huge
*)Rxcodestart
+ w
) = *(Rxcip
++);
919 DEBUGDISPLAY0("PATCH");
922 /* RAISE b[cond] b[errno] b[subno] */
923 /* raise an error condition */
927 DEBUGDISPLAY("RAISE");
928 Lerror(errno
,subno
,RxStck
[RxStckTop
]);
932 /* push an ARGument to stck */
935 na
= *(Rxcip
++); /* argument to push */
936 if (_Proc
[_rx_proc
].arg
.a
[na
])
937 RxStck
[RxStckTop
] = _Proc
[_rx_proc
].arg
.a
[na
];
939 LZEROSTR(_tmpstr
[RxStckTop
]);
940 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
942 DEBUGDISPLAY("LOADARG");
950 nf
= *(Rxcip
++); /* option to load */
952 /// Maybe only pointer to Option!!!
954 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
955 I_LoadOption(RxStck
[RxStckTop
],nf
);
956 DEBUGDISPLAY("LOADOPT");
959 /* STOREOPT [data] */
960 /* store an option */
962 DEBUGDISPLAY("STOREOPT");
963 nf
= *(Rxcip
++); /* option to store */
964 I_StoreOption(RxStck
[RxStckTop
],nf
);
969 /* push a VARiable to stck */
971 INCSTACK
; /* make space */
972 PLEAF(litleaf
); /* get variable ptr */
973 DEBUGDISPLAYi("LOAD",&(litleaf
->key
));
975 inf
= (IdentInfo
*)(litleaf
->value
);
977 /* check to see if we have allready its position */
978 if (inf
->id
== Rx_id
) {
980 RxStck
[RxStckTop
] = LEAFVAL(leaf
);
982 leaf
= RxVarFind(VarScope
, litleaf
, &found
);
984 RxStck
[RxStckTop
] = LEAFVAL(leaf
);
987 /* Lstrcpy to a temp variable */
988 Lstrcpy(&(_tmpstr
[RxStckTop
]),&stemvaluenotfound
);
989 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
991 _Proc
[_rx_proc
].condition
& SC_NOVALUE
)
992 RxSignalCondition(SC_NOVALUE
);
994 if (_Proc
[_rx_proc
].condition
& SC_NOVALUE
)
995 RxSignalCondition(SC_NOVALUE
);
996 RxStck
[RxStckTop
] = &(litleaf
->key
);
1003 /* store top stck item to VARiable */
1004 case create_mn
: /* assigmnent */
1006 PLEAF(litleaf
); /* Get pointer to variable */
1007 DEBUGDISPLAYi("CREATE",&(litleaf
->key
));
1009 inf
= (IdentInfo
*)(litleaf
->value
);
1010 if (inf
->id
== Rx_id
) {
1011 leaf
= inf
->leaf
[0];
1012 RxStck
[RxStckTop
] = LEAFVAL(leaf
);
1014 leaf
= RxVarFind(VarScope
,litleaf
,&found
);
1017 RxStck
[RxStckTop
] = LEAFVAL(leaf
);
1019 leaf
= RxVarAdd(VarScope
,
1023 RxStck
[RxStckTop
] = LEAFVAL(leaf
);
1026 inf
->leaf
[0] = leaf
;
1036 PLEAF(litleaf
); /* Get pointer to variable */
1037 DEBUGDISPLAYi("DROP",&(litleaf
->key
));
1039 inf
= (IdentInfo
*)(litleaf
->value
);
1040 if (inf
->id
== Rx_id
) {
1041 leaf
= inf
->leaf
[0];
1042 RxVarDel(VarScope
,litleaf
,leaf
);
1044 leaf
= RxVarFind(VarScope
,litleaf
,&found
);
1046 RxVarDel(VarScope
,litleaf
,leaf
);
1051 /* indirect drop, from stack */
1052 /* asssume that is UPPER case tmp */
1054 DEBUGDISPLAY("DROP_IND");
1055 RxVarDelInd(VarScope
,RxStck
[RxStckTop
]);
1060 PLEAF(litleaf
); /* Get pointer to stem */
1061 DEBUGDISPLAYi("ASSIGNSTEM",&(litleaf
->key
));
1062 inf
= (IdentInfo
*)(litleaf
->value
);
1063 if (inf
->id
== Rx_id
) {
1064 leaf
= inf
->leaf
[0];
1065 RxScopeAssign(leaf
);
1067 leaf
= RxVarFind(VarScope
,litleaf
,&found
);
1069 RxScopeAssign(leaf
);
1073 /* BYINIT [patchpos] */
1075 w
= *(CWORD
*)Rxcip
; INCWORD(Rxcip
);
1076 DEBUGDISPLAY("BYINIT");
1077 /* copy to temporary only if different */
1078 if (RxStck
[RxStckTop
] != &(_tmpstr
[RxStckTop
])) {
1079 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
1080 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1082 /* patch comparision code */
1083 if (Llt(RxStck
[RxStckTop
],&(ZeroStr
->key
)))
1084 *(CIPTYPE
*)((byte huge
*)Rxcodestart
+ w
) = tle_mn
;
1086 *(CIPTYPE
*)((byte huge
*)Rxcodestart
+ w
) = tge_mn
;
1090 /* Initialise a FOR loop*/
1092 DEBUGDISPLAY("FORINIT");
1093 /* copy to temporary only if different */
1094 if (RxStck
[RxStckTop
] != &(_tmpstr
[RxStckTop
])) {
1095 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
1096 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1098 L2INT(RxStck
[RxStckTop
]); /* it is in temporary */
1099 if (Llt(RxStck
[RxStckTop
],&(ZeroStr
->key
)))
1100 Lerror(ERR_INVALID_INTEGER
,3,RxStck
[RxStckTop
]);
1105 DEBUGDISPLAY("DECFOR");
1106 a
= RxStck
[RxStckTop
-*(Rxcip
++)];
1107 if (Leq(a
,&(ZeroStr
->key
)))
1108 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ *(CWORD
*)Rxcip
);
1115 //// Beware might lose something when number is like ' 10 '
1118 /* change to integer */
1120 DEBUGDISPLAY("TOINT");
1121 L2INT(RxStck
[RxStckTop
]);
1125 /* upper top stack */
1127 DEBUGDISPLAY("LOWER");
1128 Llower(RxStck
[RxStckTop
]);
1132 /* upper top stack */
1134 DEBUGDISPLAY("UPPER");
1135 Lupper(RxStck
[RxStckTop
]);
1138 /* SIGNAL p[label] */
1139 /* clear stack and jmp to LABEL pos */
1142 RxStckTop
= _Proc
[_rx_proc
].stacktop
;
1146 func
= (RxFunc
*)(leaf
->value
);
1147 DEBUGDISPLAYi("SIGNAL",&(leaf
->key
));
1149 if (func
->label
==UNKNOWN_LABEL
)
1150 Lerror(ERR_UNEXISTENT_LABEL
,1,&(leaf
->key
));
1152 Rxcip
=(CIPTYPE
*)((byte huge
*)Rxcodestart
+func
->label
);
1155 /* SIGNALVAL [address] */
1156 /* get address from stack */
1158 DEBUGDISPLAY("SIGNALEVAL");
1161 RxStckTop
= _Proc
[_rx_proc
].stacktop
;
1163 /* search for label */
1164 L2STR(RxStck
[RxStckTop
]);
1165 leaf
= BinFind(&_labels
,RxStck
[RxStckTop
--]);
1166 if (leaf
==NULL
|| ((RxFunc
*)(leaf
->value
))->label
== UNKNOWN_LABEL
)
1167 Lerror(ERR_UNEXISTENT_LABEL
,1,RxStck
[RxStckTop
+1]);
1168 func
= (RxFunc
*)(leaf
->value
);
1170 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ (size_t)(func
->label
));
1174 /* unconditional jump to POSition */
1176 DEBUGDISPLAY0nl("JMP");
1177 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ *(CWORD
*)Rxcip
);
1180 printf("%d\n",(byte huge
*)Rxcip
-(byte huge
*)Rxcodestart
);
1185 /* jump if top is 0 to POSition */
1187 DEBUGDISPLAY0nl("JF");
1190 w
= *(CWORD
*)Rxcip
;
1191 if (!Lbool(RxStck
[RxStckTop
]))
1192 printf("%ld *\n",w
);
1197 if (!Lbool(RxStck
[RxStckTop
--]))
1198 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ *(CWORD
*)Rxcip
);
1204 /* jump if top is 1 to POSition */
1206 DEBUGDISPLAY0nl("JT");
1209 w
= *(CWORD
*)Rxcip
;
1210 if (Lbool(RxStck
[RxStckTop
]))
1211 printf("%ld *\n",w
);
1216 if (Lbool(RxStck
[RxStckTop
--]))
1217 Rxcip
= (CIPTYPE
*)((byte huge
*)Rxcodestart
+ *(CWORD
*)Rxcip
);
1222 /* CALL p[label] b[noargs] w[existarg] */
1223 /* create new stack and jmp to LABEL pos*/
1225 DEBUGDISPLAY0nl("CALL");
1226 if (I_CallFunction())
1231 /* clear stack and return */
1232 /* if first prg then exit */
1234 DEBUGDISPLAY0("RETURN");
1235 if (_Proc
[_rx_proc
].calltype
== CT_FUNCTION
)
1236 Lerror(ERR_NO_DATA_RETURNED
,0);
1237 if (_rx_proc
==0) { /* root program */
1239 goto interpreter_fin
;
1245 /* move top of stack to correct */
1246 /* position of return arg and */
1249 DEBUGDISPLAY0("RETURNF");
1250 if (_rx_proc
==0) { /* Root program */
1251 RxReturnCode
= (int)Lrdint(RxStck
[RxStckTop
--]);
1252 goto interpreter_fin
;
1254 if (_Proc
[_rx_proc
].calltype
!= CT_PROCEDURE
)
1256 // It is possible to do a DUP in the compile code of returnf
1258 Lstrcpy(_Proc
[_rx_proc
].arg
.r
, RxStck
[RxStckTop
]);
1260 /* is the Variable space private? */
1261 /* proc: PROCEDURE */
1262 if (VarScope
!=_Proc
[_rx_proc
-1].scope
)
1264 if (RxStck
[RxStckTop
] != &(_tmpstr
[RxStckTop
]))
1266 Lstrcpy(&(_tmpstr
[RxStckTop
]),
1269 &(_tmpstr
[RxStckTop
]);
1271 /* point the return data */
1272 a
= RxStck
[RxStckTop
];
1277 if (_Proc
[_rx_proc
+1].calltype
== CT_PROCEDURE
)
1278 /* Assign the the RESULT variable */
1279 RxVarSet(VarScope
,ResultStr
,a
);
1282 /* INTERPRET [string] */
1284 DEBUGDISPLAY("INTERPRET");
1285 /* copy to a temporary var */
1286 if (RxStck
[RxStckTop
] != &(_tmpstr
[RxStckTop
])) {
1287 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
1288 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1294 DEBUGDISPLAY0("INTER_END");
1300 DEBUGDISPLAY0("ERROR-PROC");
1301 Lerror(ERR_UNEXPECTED_PROC
,1);
1305 /* display TOP item */
1307 DEBUGDISPLAY("SAY");
1308 Lprint(STDOUT
,RxStck
[RxStckTop
--]);
1313 /* execute a system call*/
1315 DEBUGDISPLAY2("SYSTEM");
1316 L2STR(RxStck
[RxStckTop
]);
1317 LASCIIZ(*(RxStck
[RxStckTop
]));
1318 RxExecuteCmd(RxStck
[RxStckTop
],RxStck
[RxStckTop
-1]);
1323 /* exit prg with RC */
1325 DEBUGDISPLAY("EXIT");
1326 RxReturnCode
= (int)Lrdint(RxStck
[RxStckTop
--]);
1327 /* free everything from stack */
1331 goto interpreter_fin
;
1334 /* Initialise PARSING */
1336 DEBUGDISPLAY("PARSE");
1337 /* Do not remove from stack */
1338 ToParse
= RxStck
[RxStckTop
];
1340 DataStart
= BreakStart
= BreakEnd
= 1;
1341 SourceEnd
= LLEN(*ToParse
)+1;
1345 /* Parse to stack */
1347 DEBUGDISPLAY0("PVAR");
1348 if (BreakEnd
<=DataStart
)
1349 DataEnd
= SourceEnd
;
1351 DataEnd
= BreakStart
;
1353 if (DataEnd
!=DataStart
)
1354 _Lsubstr(RxStck
[RxStckTop
--],ToParse
,DataStart
,DataEnd
-DataStart
);
1356 LZEROSTR(*(RxStck
[RxStckTop
]));
1361 TraceInstruction(*Rxcip
);
1366 /*** goto chk4trace; ***/
1369 /* Parse to hyperspace */
1371 /* Only for debugging */
1372 DEBUGDISPLAY0("PDOT");
1376 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1377 if (BreakEnd
<=DataStart
)
1378 DataEnd
= SourceEnd
;
1380 DataEnd
= BreakStart
;
1381 if (DataEnd
!=DataStart
)
1382 _Lsubstr(RxStck
[RxStckTop
],ToParse
,DataStart
,DataEnd
-DataStart
);
1384 LZEROSTR(*(RxStck
[RxStckTop
]));
1385 TraceInstruction(*Rxcip
);
1386 RxStckTop
--; /* free space */
1392 /* trigger a space */
1394 DEBUGDISPLAY0("TR_SPACE");
1399 /* trigger a litteral from stck */
1401 DEBUGDISPLAY("TR_LIT");
1402 DataStart
= BreakEnd
;
1403 I_trigger_litteral(RxStck
[RxStckTop
--]);
1407 /* trigger ABSolute position */
1409 DEBUGDISPLAY("TR_ABS");
1413 DataStart
= BreakEnd
;
1414 BreakStart
= (size_t)LINT(*(RxStck
[RxStckTop
--]));
1416 /* check for boundaries */
1417 BreakStart
= RANGE(1,BreakStart
,SourceEnd
);
1418 BreakEnd
= BreakStart
;
1422 /* trigger RELative position */
1424 DEBUGDISPLAY("TR_REL");
1429 DataStart
= BreakStart
;
1430 BreakStart
= DataStart
+ (size_t)LINT(*(RxStck
[RxStckTop
--]));
1432 /* check for boundaries */
1433 BreakStart
= RANGE(1,BreakStart
,SourceEnd
);
1434 BreakEnd
= BreakStart
;
1438 /* trigger to END of data */
1440 DEBUGDISPLAY0("TR_END");
1441 DataStart
= BreakEnd
;
1442 BreakStart
= SourceEnd
;
1443 BreakEnd
= SourceEnd
;
1447 /* queue stck to Rexx queue */
1449 DEBUGDISPLAY("RX_PUSH");
1450 LPMALLOC(a
); /* duplicate variable */
1452 Lstrcpy(a
,RxStck
[RxStckTop
--]);
1457 /* push stck to Rexx queue */
1459 DEBUGDISPLAY("RX_PUSH");
1460 LPMALLOC(a
); /* duplicate variable */
1462 Lstrcpy(a
,RxStck
[RxStckTop
--]);
1467 /* pull stck from Rexx queue */
1470 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1472 /* delete empty stacks */
1473 while (StackQueued()==0 && StackList
.items
>1)
1475 if (StackQueued()>0) {
1476 a
= PullFromStack();
1477 Lstrcpy(RxStck
[RxStckTop
],a
);
1479 while (StackQueued()==0 && StackList
.items
>1)
1482 Lread(STDIN
,RxStck
[RxStckTop
],LREADLINE
);
1484 DEBUGDISPLAY("RX_PULL");
1488 /* read data from extrnal queue */
1489 case rx_external_mn
:
1491 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1492 Lread(STDIN
,RxStck
[RxStckTop
],LREADLINE
);
1493 DEBUGDISPLAY("RX_EXTERNAL");
1497 DEBUGDISPLAY2("EQ");
1498 a
= RxStck
[RxStckTop
-2];
1500 Leq(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1505 DEBUGDISPLAY2("NE");
1506 a
= RxStck
[RxStckTop
-2];
1508 Lne(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1513 DEBUGDISPLAY2("GT");
1514 a
= RxStck
[RxStckTop
-2];
1516 Lgt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1521 DEBUGDISPLAY2("GE");
1522 a
= RxStck
[RxStckTop
-2];
1524 Lge(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1529 DEBUGDISPLAY2("LT");
1530 a
= RxStck
[RxStckTop
-2];
1532 Llt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1537 DEBUGDISPLAY2("LE");
1538 a
= RxStck
[RxStckTop
-2];
1540 Lle(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1545 DEBUGDISPLAY2("DEQ");
1546 a
= RxStck
[RxStckTop
-2];
1548 Ldeq(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1553 DEBUGDISPLAY2("DNE");
1554 a
= RxStck
[RxStckTop
-2];
1556 Ldne(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1561 DEBUGDISPLAY2("DGT");
1562 a
= RxStck
[RxStckTop
-2];
1564 Ldgt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1569 DEBUGDISPLAY2("DGE");
1570 a
= RxStck
[RxStckTop
-2];
1572 Ldge(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1577 DEBUGDISPLAY2("DLT");
1578 a
= RxStck
[RxStckTop
-2];
1580 Ldlt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1585 DEBUGDISPLAY2("DLE");
1586 a
= RxStck
[RxStckTop
-2];
1588 Ldle(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1593 DEBUGDISPLAY2("TEQ");
1594 a
= &(_tmpstr
[RxStckTop
-1]);
1596 Leq(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1598 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1602 DEBUGDISPLAY2("TNE");
1603 a
= &(_tmpstr
[RxStckTop
-1]);
1605 Lne(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1607 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1611 DEBUGDISPLAY2("TDEQ");
1612 a
= &(_tmpstr
[RxStckTop
-1]);
1614 Ldeq(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1616 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1620 DEBUGDISPLAY2("TNDE");
1621 a
= &(_tmpstr
[RxStckTop
-1]);
1623 Ldne(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1625 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1629 DEBUGDISPLAY2("TGT");
1630 a
= &(_tmpstr
[RxStckTop
-1]);
1632 Lgt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1634 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1638 DEBUGDISPLAY2("TGE");
1639 a
= &(_tmpstr
[RxStckTop
-1]);
1641 Lge(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1643 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1647 DEBUGDISPLAY2("TLT");
1648 a
= &(_tmpstr
[RxStckTop
-1]);
1650 Llt(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1652 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1656 DEBUGDISPLAY2("TLE");
1657 a
= &(_tmpstr
[RxStckTop
-1]);
1659 Lle(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]));
1661 RxStck
[RxStckTop
] = &_tmpstr
[RxStckTop
];
1665 DEBUGDISPLAY("NOT");
1666 a
= RxStck
[RxStckTop
-1];
1667 LICPY(*a
,!Lbool(RxStck
[RxStckTop
]));
1672 DEBUGDISPLAY2("AND");
1673 a
= RxStck
[RxStckTop
-2];
1675 Lbool(RxStck
[RxStckTop
-1]) & Lbool(RxStck
[RxStckTop
]));
1680 DEBUGDISPLAY2("OR");
1681 a
= RxStck
[RxStckTop
-2];
1683 Lbool(RxStck
[RxStckTop
-1]) | Lbool(RxStck
[RxStckTop
]));
1688 DEBUGDISPLAY2("XOR");
1689 a
= RxStck
[RxStckTop
-2];
1691 Lbool(RxStck
[RxStckTop
-1]) ^ Lbool(RxStck
[RxStckTop
]));
1696 DEBUGDISPLAY2("CONCAT");
1697 a
= RxStck
[RxStckTop
-2];
1698 if (a
!=RxStck
[RxStckTop
]) {
1699 Lstrcpy(a
,RxStck
[RxStckTop
-1]);
1700 Lstrcat(a
,RxStck
[RxStckTop
]);
1702 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
1703 Lstrcpy(a
,RxStck
[RxStckTop
-1]);
1704 Lstrcat(a
,&(_tmpstr
[RxStckTop
]));
1710 DEBUGDISPLAY2("BCONCAT");
1711 a
= RxStck
[RxStckTop
-2];
1712 if (a
==RxStck
[RxStckTop
]) {
1713 Lstrcpy(&(_tmpstr
[RxStckTop
]),RxStck
[RxStckTop
]);
1714 RxStck
[RxStckTop
] = &(_tmpstr
[RxStckTop
]);
1716 Lstrcpy(a
,RxStck
[RxStckTop
-1]);
1718 LSTR(*a
)[LLEN(*a
)] = ' ';
1720 Lstrcat(a
,RxStck
[RxStckTop
]);
1725 DEBUGDISPLAY("NEG");
1726 Lneg(RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1731 DEBUGDISPLAY("INC");
1732 Linc(RxStck
[RxStckTop
--]);
1736 DEBUGDISPLAY("DEC");
1737 Ldec(RxStck
[RxStckTop
--]);
1741 DEBUGDISPLAY2("ADD");
1742 Ladd(RxStck
[RxStckTop
-2],
1743 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1748 DEBUGDISPLAY2("SUB");
1749 Lsub(RxStck
[RxStckTop
-2],
1750 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1755 DEBUGDISPLAY2("MUL");
1756 Lmult(RxStck
[RxStckTop
-2],
1757 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1762 DEBUGDISPLAY2("DIV");
1763 Ldiv(RxStck
[RxStckTop
-2],
1764 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1769 DEBUGDISPLAY2("IDIV");
1770 Lintdiv(RxStck
[RxStckTop
-2],
1771 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1776 DEBUGDISPLAY2("MOD");
1777 Lmod(RxStck
[RxStckTop
-2],
1778 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1783 DEBUGDISPLAY2("POW");
1784 Lexpose(RxStck
[RxStckTop
-2],
1785 RxStck
[RxStckTop
-1],RxStck
[RxStckTop
]);
1790 DEBUGDISPLAY0("error, unknown mnemonic");
1793 fprintf(STDERR
,"Opcode found=%ld (0x%02lX)\n",(long)*Rxcip
,(unsigned long)*Rxcip
);
1795 PUTS("Opcode found=0x"); PUTINT(*Rxcip
,0,16);
1797 Lerror(ERR_INTERPRETER_FAILURE
,0);
1800 if (_trace
) TraceInstruction(*Rxcip
);
1801 Rxcip
++; /* skip trace byte */
1804 SIGNAL(SIGINT
,SIG_IGN
);
1805 return RxReturnCode
;