diff options
Diffstat (limited to 'src/h/rmacros.h')
-rw-r--r-- | src/h/rmacros.h | 390 |
1 files changed, 121 insertions, 269 deletions
diff --git a/src/h/rmacros.h b/src/h/rmacros.h index cce26dd..ac9ca64 100644 --- a/src/h/rmacros.h +++ b/src/h/rmacros.h @@ -276,11 +276,7 @@ #define T_String -1 /* string -- for reference; not used */ #define T_Null 0 /* null value */ #define T_Integer 1 /* integer */ - -#ifdef LargeInts - #define T_Lrgint 2 /* long integer */ -#endif /* LargeInts */ - +#define T_Lrgint 2 /* long integer */ #define T_Real 3 /* real number */ #define T_Cset 4 /* cset */ #define T_File 5 /* file */ @@ -316,21 +312,13 @@ #define k_trace kywd_trc.vword.integr /* value of &trace */ #define k_dump kywd_dmp.vword.integr /* value of &dump */ -#ifdef FncTrace - #define k_ftrace kywd_ftrc.vword.integr /* value of &ftrace */ -#endif /* FncTrace */ - /* * Descriptor types and flags. */ #define D_Null (T_Null | D_Typecode) #define D_Integer (T_Integer | D_Typecode) - -#ifdef LargeInts - #define D_Lrgint (T_Lrgint | D_Typecode | F_Ptr) -#endif /* LargeInts */ - +#define D_Lrgint (T_Lrgint | D_Typecode | F_Ptr) #define D_Real (T_Real | D_Typecode | F_Ptr) #define D_Cset (T_Cset | D_Typecode | F_Ptr) #define D_File (T_File | D_Typecode | F_Ptr) @@ -402,284 +390,148 @@ #define blkend (curblock->end) #define blkfree (curblock->free) -#if COMPILER - - #ifdef Graphics - #define Poll() if (!pollctr--) pollctr = pollevent() - #else /* Graphics */ - #define Poll() - #endif /* Graphics */ - -#else /* COMPILER */ - - /* - * Definitions for the interpreter. - */ - - /* - * Codes returned by invoke to indicate action. - */ - #define I_Builtin 201 /* A built-in routine is to be invoked */ - #define I_Fail 202 /* goal-directed evaluation failed */ - #define I_Continue 203 /* Continue execution in the interp loop */ - #define I_Vararg 204 /* A function with a variable number of args */ - - /* - * Generator types. - */ - #define G_Csusp 1 - #define G_Esusp 2 - #define G_Psusp 3 - #define G_Fsusp 4 - #define G_Osusp 5 - - /* - * Evaluation stack overflow margin - */ - #define PerilDelta 100 +/* + * Codes returned by invoke to indicate action. + */ +#define I_Builtin 201 /* A built-in routine is to be invoked */ +#define I_Fail 202 /* goal-directed evaluation failed */ +#define I_Continue 203 /* Continue execution in the interp loop */ +#define I_Vararg 204 /* A function with a variable number of args */ - /* - * Macros for pushing values on the interpreter stack. - */ +/* + * Generator types. + */ +#define G_Csusp 1 +#define G_Esusp 2 +#define G_Psusp 3 +#define G_Fsusp 4 +#define G_Osusp 5 - /* - * Push descriptor. - */ - #define PushDescSP(SP,d) {*++SP=((d).dword); SP++; *SP =((d).vword.integr);} +/* + * Evaluation stack overflow margin + */ +#define PerilDelta 100 - /* - * Push null-valued descriptor. - */ - #define PushNullSP(SP) {*++SP = D_Null; SP++; *SP = 0;} +/* + * Macros for pushing values on the interpreter stack. + */ - /* - * Push word. - */ - #define PushValSP(SP,v) {*++SP = (word)(v);} +/* + * Push descriptor. + */ +#define PushDescSP(SP,d) {*++SP=((d).dword); SP++; *SP =((d).vword.integr);} - /* - * Shorter Versions of the Push*SP macros that assume sp points to the top - * of the stack. - */ - #define PushDesc(d) PushDescSP(sp,d) - #define PushNull PushNullSP(sp) - #define PushVal(x) PushValSP(sp,x) - #define PushAVal(x) PushValSP(sp,x) +/* + * Push null-valued descriptor. + */ +#define PushNullSP(SP) {*++SP = D_Null; SP++; *SP = 0;} - /* - * Macros related to function and operator definition. - */ +/* + * Push word. + */ +#define PushValSP(SP,v) {*++SP = (word)(v);} - /* - * Procedure block for a function. - */ +/* + * Shorter Versions of the Push*SP macros that assume sp points to the top + * of the stack. + */ +#define PushDesc(d) PushDescSP(sp,d) +#define PushNull PushNullSP(sp) +#define PushVal(x) PushValSP(sp,x) +#define PushAVal(x) PushValSP(sp,x) - #define FncBlock(f,nargs,deref) \ - struct b_iproc Cat(B,f) = {\ - T_Proc,\ - Vsizeof(struct b_proc),\ - Cat(Z,f),\ - nargs,\ - -1,\ - deref, 0,\ - {sizeof(Lit(f))-1,Lit(f)}}; +/* + * Macros related to function and operator definition. + */ - /* - * Procedure block for an operator. - */ - #define OpBlock(f,nargs,sname,xtrargs)\ - struct b_iproc Cat(B,f) = {\ - T_Proc,\ - Vsizeof(struct b_proc),\ - Cat(O,f),\ - nargs,\ - -1,\ - xtrargs,\ - 0,\ - {sizeof(sname)-1,sname}}; +/* + * Procedure block for a function. + */ - /* - * Operator declaration. - */ - #define OpDcl(nm,n,pn) OpBlock(nm,n,pn,0) Cat(O,nm)(cargp) register dptr cargp; +#define FncBlock(f,nargs,deref) \ + struct b_iproc Cat(B,f) = {\ + T_Proc,\ + Vsizeof(struct b_proc),\ + Cat(Z,f),\ + nargs,\ + -1,\ + deref, 0,\ + {sizeof(Lit(f))-1,Lit(f)}}; - /* - * Operator declaration with extra working argument. - */ - #define OpDclE(nm,n,pn) OpBlock(nm,-n,pn,0) Cat(O,nm)(cargp) register dptr cargp; +/* + * Procedure block for an operator. + */ +#define OpBlock(f,nargs,sname,xtrargs)\ + struct b_iproc Cat(B,f) = {\ + T_Proc,\ + Vsizeof(struct b_proc),\ + Cat(O,f),\ + nargs,\ + -1,\ + xtrargs,\ + 0,\ + {sizeof(sname)-1,sname}}; - /* - * Agent routine declaration. - */ - #define AgtDcl(nm) Cat(A,nm)(cargp) register dptr cargp; +/* + * Operator declaration. + */ +#define OpDcl(nm,n,pn) OpBlock(nm,n,pn,0) Cat(O,nm)(cargp) register dptr cargp; - /* - * Macros to access Icon arguments in C functions. - */ +/* + * Operator declaration with extra working argument. + */ +#define OpDclE(nm,n,pn) OpBlock(nm,-n,pn,0) Cat(O,nm)(cargp) register dptr cargp; - /* - * n-th argument. - */ - #define Arg(n) (cargp[n]) +/* + * Agent routine declaration. + */ +#define AgtDcl(nm) Cat(A,nm)(cargp) register dptr cargp; - /* - * Type field of n-th argument. - */ - #define ArgType(n) (cargp[n].dword) +/* + * Macros to access Icon arguments in C functions. + */ - /* - * Value field of n-th argument. - */ - #define ArgVal(n) (cargp[n].vword.integr) +/* + * n-th argument. + */ +#define Arg(n) (cargp[n]) - /* - * Specific arguments. - */ - #define Arg0 (cargp[0]) - #define Arg1 (cargp[1]) - #define Arg2 (cargp[2]) - #define Arg3 (cargp[3]) - #define Arg4 (cargp[4]) - #define Arg5 (cargp[5]) - #define Arg6 (cargp[6]) - #define Arg7 (cargp[7]) - #define Arg8 (cargp[8]) +/* + * Type field of n-th argument. + */ +#define ArgType(n) (cargp[n].dword) - /* - * Miscellaneous macro definitions. - */ +/* + * Value field of n-th argument. + */ +#define ArgVal(n) (cargp[n].vword.integr) - #ifdef MultiThread - #define glbl_argp (curpstate->Glbl_argp) - #define kywd_err (curpstate->Kywd_err) - #define kywd_pos (curpstate->Kywd_pos) - #define kywd_prog (curpstate->Kywd_prog) - #define kywd_ran (curpstate->Kywd_ran) - #define k_eventcode (curpstate->eventcode) - #define k_eventsource (curpstate->eventsource) - #define k_eventvalue (curpstate->eventval) - #define k_subject (curpstate->ksub) - #define kywd_trc (curpstate->Kywd_trc) - #define mainhead (curpstate->Mainhead) - #define code (curpstate->Code) - #define ecode (curpstate->Ecode) - #define records (curpstate->Records) - #define ftabp (curpstate->Ftabp) - #ifdef FieldTableCompression - #define ftabwidth (curpstate->Ftabwidth) - #define foffwidth (curpstate->Foffwidth) - #define ftabcp (curpstate->Ftabcp) - #define ftabsp (curpstate->Ftabsp) - #define focp (curpstate->Focp) - #define fosp (curpstate->Fosp) - #define fo (curpstate->Fo) - #define bm (curpstate->Bm) - #endif /* FieldTableCompression */ - #define fnames (curpstate->Fnames) - #define efnames (curpstate->Efnames) - #define globals (curpstate->Globals) - #define eglobals (curpstate->Eglobals) - #define gnames (curpstate->Gnames) - #define egnames (curpstate->Egnames) - #define statics (curpstate->Statics) - #define estatics (curpstate->Estatics) - #define n_globals (curpstate->NGlobals) - #define n_statics (curpstate->NStatics) - #define strcons (curpstate->Strcons) - #define filenms (curpstate->Filenms) - #define efilenms (curpstate->Efilenms) - #define ilines (curpstate->Ilines) - #define elines (curpstate->Elines) - #define current_line_ptr (curpstate->Current_line_ptr) - - #ifdef Graphics - #define amperX (curpstate->AmperX) - #define amperY (curpstate->AmperY) - #define amperRow (curpstate->AmperRow) - #define amperCol (curpstate->AmperCol) - #define amperInterval (curpstate->AmperInterval) - #define lastEventWin (curpstate->LastEventWin) - #define lastEvFWidth (curpstate->LastEvFWidth) - #define lastEvLeading (curpstate->LastEvLeading) - #define lastEvAscent (curpstate->LastEvAscent) - #define kywd_xwin (curpstate->Kywd_xwin) - #define xmod_control (curpstate->Xmod_Control) - #define xmod_shift (curpstate->Xmod_Shift) - #define xmod_meta (curpstate->Xmod_Meta) - #endif /* Graphics */ - - #ifdef EventMon - #define linenum (curpstate->Linenum) - #define column (curpstate->Column) - #define lastline (curpstate->Lastline) - #define lastcol (curpstate->Lastcol) - #endif /* EventMon */ - - #define coexp_ser (curpstate->Coexp_ser) - #define list_ser (curpstate->List_ser) - #define set_ser (curpstate->Set_ser) - #define table_ser (curpstate->Table_ser) - - #define curstring (curpstate->stringregion) - #define curblock (curpstate->blockregion) - #define strtotal (curpstate->stringtotal) - #define blktotal (curpstate->blocktotal) - - #define coll_tot (curpstate->colltot) - #define coll_stat (curpstate->collstat) - #define coll_str (curpstate->collstr) - #define coll_blk (curpstate->collblk) - - #define lastop (curpstate->Lastop) - #define lastopnd (curpstate->Lastopnd) - - #define xargp (curpstate->Xargp) - #define xnargs (curpstate->Xnargs) - - #define k_current (curpstate->K_current) - #define k_errornumber (curpstate->K_errornumber) - #define k_errortext (curpstate->K_errortext) - #define k_errorvalue (curpstate->K_errorvalue) - #define have_errval (curpstate->Have_errval) - #define t_errornumber (curpstate->T_errornumber) - #define t_have_val (curpstate->T_have_val) - #define t_errorvalue (curpstate->T_errorvalue) - - #define k_main (curpstate->K_main) - #define k_errout (curpstate->K_errout) - #define k_input (curpstate->K_input) - #define k_output (curpstate->K_output) - - #define ENTERPSTATE(p) if (((p)!=NULL)) { curpstate = (p); } - #endif /* MultiThread */ - -#endif /* COMPILER */ +/* + * Specific arguments. + */ +#define Arg0 (cargp[0]) +#define Arg1 (cargp[1]) +#define Arg2 (cargp[2]) +#define Arg3 (cargp[3]) +#define Arg4 (cargp[4]) +#define Arg5 (cargp[5]) +#define Arg6 (cargp[6]) +#define Arg7 (cargp[7]) +#define Arg8 (cargp[8]) /* * Constants controlling expression evaluation. */ -#if COMPILER - #define A_Resume -1 /* expression failed: resume a generator */ - #define A_Continue -2 /* expression returned: continue execution */ - #define A_FallThru -3 /* body function: fell through end of code */ - #define A_Coact 1 /* co-expression activation */ - #define A_Coret 2 /* co-expression return */ - #define A_Cofail 3 /* co-expression failure */ -#else /* COMPILER */ - #define A_Resume 1 /* routine failed */ - #define A_Pret_uw 2 /* interp unwind for Op_Pret */ - #define A_Unmark_uw 3 /* interp unwind for Op_Unmark */ - #define A_Pfail_uw 4 /* interp unwind for Op_Pfail */ - #define A_Lsusp_uw 5 /* interp unwind for Op_Lsusp */ - #define A_Eret_uw 6 /* interp unwind for Op_Eret */ - #define A_Continue 7 /* routine returned */ - #define A_Coact 8 /* co-expression activated */ - #define A_Coret 9 /* co-expression returned */ - #define A_Cofail 10 /* co-expression failed */ - #ifdef MultiThread - #define A_MTEvent 11 /* multithread event */ - #endif /* MultiThread */ -#endif /* COMPILER */ +#define A_Resume 1 /* routine failed */ +#define A_Pret_uw 2 /* interp unwind for Op_Pret */ +#define A_Unmark_uw 3 /* interp unwind for Op_Unmark */ +#define A_Pfail_uw 4 /* interp unwind for Op_Pfail */ +#define A_Lsusp_uw 5 /* interp unwind for Op_Lsusp */ +#define A_Eret_uw 6 /* interp unwind for Op_Eret */ +#define A_Continue 7 /* routine returned */ +#define A_Coact 8 /* co-expression activated */ +#define A_Coret 9 /* co-expression returned */ +#define A_Cofail 10 /* co-expression failed */ /* * Address of word containing cset bit b (c is a struct descrip of type Cset). |