summaryrefslogtreecommitdiff
path: root/src/h
diff options
context:
space:
mode:
Diffstat (limited to 'src/h')
-rw-r--r--src/h/config.h154
-rw-r--r--src/h/cpuconf.h16
-rw-r--r--src/h/fdefs.h52
-rw-r--r--src/h/features.h30
-rw-r--r--src/h/grttin.h57
-rw-r--r--src/h/header.h8
-rw-r--r--src/h/monitor.h213
-rw-r--r--src/h/mswin.h6
-rw-r--r--src/h/rexterns.h196
-rw-r--r--src/h/rmacros.h390
-rw-r--r--src/h/rproto.h141
-rw-r--r--src/h/rstructs.h207
-rw-r--r--src/h/rt.h1
-rw-r--r--src/h/sys.h16
-rw-r--r--src/h/typedefs.h62
-rw-r--r--src/h/version.h59
-rw-r--r--src/h/xwin.h6
17 files changed, 372 insertions, 1242 deletions
diff --git a/src/h/config.h b/src/h/config.h
index bc48ada..2045dd7 100644
--- a/src/h/config.h
+++ b/src/h/config.h
@@ -9,70 +9,14 @@
/*
* A number of symbols are defined here.
* Some enable or disable certain Icon features, for example:
- * NoCoexpr disables co-expressions
* LoadFunc enables dynamic loading
*
- * Other definitions may occur for different configurations. These include:
- * DeBug debugging code
- * MultiThread support for multiple programs under the interpreter
- *
* Many definitions reflect remnants of past research projects.
* Changing them to values not used in standard configurations
* may result in an unbuildable or nonfunctioning system.
*/
/*
- * If COMPILER is not defined, code for the interpreter is compiled.
- */
-
-#ifndef COMPILER
- #define COMPILER 0
-#endif
-
-/*
- * The following definitions serve to cast common conditionals is
- * a positive way, while allowing defaults for the cases that
- * occur most frequently. That is, if co-expressions are not supported,
- * NoCoexpr is defined in define.h, but if they are supported, no
- * definition is needed in define.h; nonetheless subsequent conditionals
- * can be cast as #ifdef Coexpr.
- */
-
-#ifndef NoCoexpr
- #undef Coexpr
- #define Coexpr
-#endif /* NoCoexpr */
-
-#ifdef NoCoexpr
- #undef MultiThread
- #undef EventMon
- #undef Eve
-#endif /* NoCoexpr */
-
-#if COMPILER
- #undef Eve
- #undef MultiThread
- #undef EventMon
-#endif /* COMPILER */
-
-#ifdef Eve
- #undef EventMon
- #undef MultiThread
- #define EventMon
- #define MultiThread
-#endif /* Eve */
-
-#ifndef NoLargeInts
- #undef LargeInts
- #define LargeInts
-#endif /* NoLargeInts */
-
-#ifdef EventMon
- #undef MultiThread
- #define MultiThread
-#endif /* EventMon */
-
-/*
* Graphics definitions.
*/
#ifdef Graphics
@@ -99,14 +43,9 @@
#undef Polling
#define Polling
- #ifndef ICONC_XLIB
- #ifdef WinGraphics
- #define ICONC_XLIB "-luser32 -lgdi32 -lcomdlg32 -lwinmm"
- #else /* WinGraphics */
- #define ICONC_XLIB "-L/usr/X11R6/lib -lX11"
- #endif /* WinGraphics */
- #endif /* ICONC_XLIB */
-
+#else /* Graphics */
+ #undef XWindows
+ #undef WinGraphics
#endif /* Graphics */
/*
@@ -123,15 +62,6 @@
* Other defaults.
*/
-#ifdef DeBug
- #undef DeBugTrans
- #undef DeBugLinker
- #undef DeBugIconx
- #define DeBugTrans
- #define DeBugLinker
- #define DeBugIconx
-#endif /* DeBug */
-
#ifndef MaxHdr
/*
* Maximum allowable BinaryHeader size.
@@ -141,7 +71,7 @@
#endif /* MaxHdr */
#ifndef MaxPath
- #define MaxPath 256
+ #define MaxPath 512
#endif /* MaxPath */
#ifndef SourceSuffix
@@ -206,18 +136,10 @@
#define DBSuffix ".db"
#endif /* DBSuffix */
-#ifndef PPInit
- #define PPInit ""
-#endif /* PPInit */
-
#ifndef PPDirectives
#define PPDirectives {"passthru", PpKeep},
#endif /* PPDirectives */
-#ifndef NoSrcColumnInfo
- #define SrcColumnInfo
-#endif /* NoSrcColumnInfo */
-
#ifndef ExecSuffix
#define ExecSuffix ""
#endif /* ExecSuffix */
@@ -226,66 +148,34 @@
#define CSuffix ".c"
#endif /* CSuffix */
-#ifndef HSuffix
- #define HSuffix ".h"
-#endif /* HSuffix */
-
-#ifndef ObjSuffix
- #define ObjSuffix ".o"
-#endif /* ObjSuffix */
-
-#ifndef LibSuffix
- #define LibSuffix ".a"
-#endif /* LibSuffix */
-
-#ifndef CComp
- #define CComp "cc"
-#endif /* CComp */
-
-#ifndef COpts
- #define COpts ""
-#endif /* COpts */
-
/*
* Note, size of the hash table is a power of 2:
*/
#define IHSize 128
#define IHasher(x) (((unsigned int)(unsigned long)(x))&(IHSize-1))
-#if COMPILER
-
- /*
- * Code for the compiler.
- */
- #undef MultiThread /* no way -- interpreter only */
- #undef EventMon /* presently not supported in the compiler */
-
-#else /* COMPILER */
-
- /*
- * Code for the interpreter.
- */
- #ifndef IcodeSuffix
- #define IcodeSuffix ""
- #endif /* IcodeSuffix */
-
- #ifndef IcodeASuffix
- #define IcodeASuffix ""
- #endif /* IcodeASuffix */
+/*
+ * Code for the interpreter.
+ */
+#ifndef IcodeSuffix
+ #define IcodeSuffix ""
+#endif /* IcodeSuffix */
- #ifndef U1Suffix
- #define U1Suffix ".u1"
- #endif /* U1Suffix */
+#ifndef IcodeASuffix
+ #define IcodeASuffix ""
+#endif /* IcodeASuffix */
- #ifndef U2Suffix
- #define U2Suffix ".u2"
- #endif /* U2Suffix */
+#ifndef U1Suffix
+ #define U1Suffix ".u1"
+#endif /* U1Suffix */
- #ifndef USuffix
- #define USuffix ".u"
- #endif /* USuffix */
+#ifndef U2Suffix
+ #define U2Suffix ".u2"
+#endif /* U2Suffix */
-#endif /* COMPILER */
+#ifndef USuffix
+ #define USuffix ".u"
+#endif /* USuffix */
/*
* Vsizeof is for use with variable-sized (i.e., indefinite)
diff --git a/src/h/cpuconf.h b/src/h/cpuconf.h
index 228ce6b..acd0194 100644
--- a/src/h/cpuconf.h
+++ b/src/h/cpuconf.h
@@ -4,10 +4,6 @@
* included before this file.
*/
-#ifndef CStateSize
- #define CStateSize 15 /* size of C state for co-expressions */
-#endif /* CStateSize */
-
/*
* The following definitions depend on the sizes of ints and pointers.
*/
@@ -215,11 +211,7 @@
#endif /* MinAbrSize */
#ifndef MStackSize
- #ifdef MultiThread
- #define MStackSize 20000 /* size of the main stack in words */
- #else /* MultiThread */
- #define MStackSize 10000 /* size of the main stack in words */
- #endif /* MultiThread */
+ #define MStackSize 10000 /* size of the main stack in words */
#endif /* MStackSize */
#ifndef StackSize
@@ -231,11 +223,7 @@
#endif /* QualLstSize */
#ifndef ActStkBlkEnts
- #ifdef Coexpr
- #define ActStkBlkEnts 25 /* number of entries in an astkblk */
- #else /* Coexpr */
- #define ActStkBlkEnts 1 /* number of entries in an astkblk */
- #endif /* Coexpr */
+ #define ActStkBlkEnts 25 /* number of entries in an astkblk */
#endif /* ActStkBlkEnts */
#ifndef RegionCushion
diff --git a/src/h/fdefs.h b/src/h/fdefs.h
index 8f35509..c5a36fc 100644
--- a/src/h/fdefs.h
+++ b/src/h/fdefs.h
@@ -20,6 +20,7 @@ FncDef(cset,1)
FncDef(delay,1)
FncDef(delete,2)
FncDefV(detab)
+FncDef(display,2)
FncDef(dtor,1)
FncDefV(entab)
FncDef(errorclear,0)
@@ -47,10 +48,12 @@ FncDef(map,3)
FncDef(match,4)
FncDef(member,1)
FncDef(move,1)
+FncDef(name,1)
FncDef(numeric,1)
FncDef(ord,1)
FncDef(pop,1)
FncDef(pos,1)
+FncDef(proc,2)
FncDef(pull,1)
FncDefV(push)
FncDefV(put)
@@ -81,6 +84,7 @@ FncDef(tan,1)
FncDef(trim,2)
FncDef(type,1)
FncDef(upto,4)
+FncDef(variable,1)
FncDef(where,1)
FncDefV(write)
FncDefV(writes)
@@ -91,18 +95,6 @@ FncDefV(writes)
FncDef(open,3)
#endif /* Graphics */
-#ifdef MultiThread
- FncDef(display,3)
- FncDef(name,2)
- FncDef(proc,3)
- FncDef(variable,3)
-#else /* MultiThread */
- FncDef(display,2)
- FncDef(name,1)
- FncDef(proc,2)
- FncDef(variable,1)
-#endif /* MultiThread */
-
/*
* Dynamic loading.
*/
@@ -111,13 +103,6 @@ FncDefV(writes)
#endif /* LoadFunc */
/*
- * External functions.
- */
-#ifdef ExternalFunctions
- FncDefV(callout)
-#endif /* ExternalFunctions */
-
-/*
* File attribute function.
*/
#ifdef FAttrib
@@ -134,16 +119,6 @@ FncDefV(writes)
#endif /* KeyboardFncs */
/*
- * Event processing functions.
- */
-#ifdef EventMon
- FncDef(EvGet,2)
- FncDef(event,3)
- FncDef(eventmask,2)
- FncDef(opmask,2)
-#endif /* EventMon */
-
-/*
* Graphics functions.
*/
#ifdef Graphics
@@ -211,22 +186,3 @@ FncDefV(writes)
FncDefV(WinSelectDialog)
#endif /* WinExtns */
#endif /* Graphics */
-
-#ifdef MultiThread
- /*
- * These functions are part of the MultiThread extensions.
- */
- FncDef(cofail,1)
- FncDef(globalnames,1)
- FncDef(fieldnames,1)
- FncDef(localnames,2)
- FncDef(staticnames,2)
- FncDef(paramnames,2)
- FncDef(structure,1)
- /*
- * These functions are inherent to MultiThread and multiple Icon programs
- */
- FncDefV(load)
- FncDef(parent,1)
- FncDef(keyword,2)
-#endif /* MultiThread */
diff --git a/src/h/features.h b/src/h/features.h
index 047b4df..b22633a 100644
--- a/src/h/features.h
+++ b/src/h/features.h
@@ -18,6 +18,14 @@
Feature(1, "_V9", 0) /* Version 9 (unconditional) */
+#if UNIX
+ Feature(1, "_UNIX", "UNIX")
+#endif /* UNIX */
+
+#if MACINTOSH
+ Feature(1, "_MACINTOSH", "Macintosh")
+#endif /* MACINTOSH */
+
#if MSWIN
Feature(1, "_MS_WINDOWS", "MS Windows")
#endif /* MSWIN */
@@ -26,15 +34,9 @@
Feature(1, "_CYGWIN", "Cygwin")
#endif /* CYGWIN */
-#if UNIX
- Feature(1, "_UNIX", "UNIX")
-#endif /* UNIX */
-
Feature(1, "_ASCII", "ASCII")
-#ifdef Coexpr
Feature(1, "_CO_EXPRESSIONS", "co-expressions")
-#endif /* Coexpr */
#ifdef LoadFunc
Feature(1, "_DYNAMIC_LOADING", "dynamic loading")
@@ -42,25 +44,15 @@
Feature(1, "", "environment variables")
-#ifdef EventMon
- Feature(1, "_EVENT_MONITOR", "event monitoring")
-#endif /* EventMon */
-
-#ifdef ExternalFunctions
- Feature(1, "_EXTERNAL_FUNCTIONS", "external functions")
-#endif /* ExternalFunctions */
+#ifdef LoadFunc
+ Feature(1, "_EXTERNAL_VALUES", "external values")
+#endif /* LoadFunc */
#ifdef KeyboardFncs
Feature(1, "_KEYBOARD_FUNCTIONS", "keyboard functions")
#endif /* KeyboardFncs */
-#ifdef LargeInts
Feature(largeints, "_LARGE_INTEGERS", "large integers")
-#endif /* LargeInts */
-
-#ifdef MultiThread
- Feature(1, "_MULTITASKING", "multiple programs")
-#endif /* MultiThread */
#ifdef Pipes
Feature(1, "_PIPES", "pipes")
diff --git a/src/h/grttin.h b/src/h/grttin.h
index 1247ca2..4a0be07 100644
--- a/src/h/grttin.h
+++ b/src/h/grttin.h
@@ -72,63 +72,6 @@
*/
#define Protect(notnull,orelse) do {if ((notnull)==NULL) orelse;} while(0)
-#ifdef EventMon
-/*
- * perform what amounts to "function inlining" of EVVal
- */
-#begdef EVVal(value,event)
- do {
- if (is:null(curpstate->eventmask)) break;
- else if (!Testb((word)event, curpstate->eventmask)) break;
- MakeInt(value, &(curpstate->parent->eventval));
- actparent(event);
- } while (0)
-#enddef /* EVVal */
-#begdef EVValD(dp,event)
- do {
- if (is:null(curpstate->eventmask)) break;
- else if (!Testb((word)event, curpstate->eventmask)) break;
- curpstate->parent->eventval = *(dp);
- actparent(event);
- } while (0)
-#enddef /* EVValD */
-#begdef EVValX(bp,event)
- do {
- struct progstate *parent = curpstate->parent;
- if (is:null(curpstate->eventmask)) break;
- else if (!Testb((word)event, curpstate->eventmask)) break;
- parent->eventval.dword = D_Coexpr;
- BlkLoc(parent->eventval) = (union block *)(bp);
- actparent(event);
- } while (0)
-#enddef /* EVValX */
-
-#define InterpEVVal(arg1,arg2) { ExInterp; EVVal(arg1,arg2); EntInterp; }
-#define InterpEVValD(arg1,arg2) { ExInterp; EVValD(arg1,arg2); EntInterp; }
-#define InterpEVValX(arg1,arg2) { ExInterp; EVValX(arg1,arg2); EntInterp; }
-
-/*
- * Macro with construction of event descriptor.
- */
-
-#begdef Desc_EVValD(bp, code, type)
- do {
- eventdesc.dword = type;
- eventdesc.vword.bptr = (union block *)(bp);
- EVValD(&eventdesc, code);
- } while (0)
-#enddef /* Desc_EVValD */
-
-#else /* EventMon */
- #define EVVal(arg1,arg2)
- #define EVValD(arg1,arg2)
- #define EVValX(arg1,arg2)
- #define InterpEVVal(arg1,arg2)
- #define InterpEVValD(arg1,arg2)
- #define InterpEVValX(arg1,arg2)
- #define Desc_EVValD(bp, code, type)
-#endif /* EventMon */
-
/*
* dummy typedefs for things defined in #include files
*/
diff --git a/src/h/header.h b/src/h/header.h
index 3b131f1..6c9e3f4 100644
--- a/src/h/header.h
+++ b/src/h/header.h
@@ -15,14 +15,6 @@ struct header {
word Strcons; /* location of identifier table */
word Filenms; /* location of ipc/file name table */
- #ifdef FieldTableCompression
- short FtabWidth; /* width of field table entries, 1 | 2 | 4 */
- short FoffWidth; /* width of field offset entries, 1 | 2 | 4 */
- word Nfields; /* number of field names */
- word Fo; /* The start of the Fo array */
- word Bm; /* The start of the Bm array */
- #endif /* FieldTableCompression */
-
word linenums; /* location of ipc/line number table */
word config[16]; /* icode version */
};
diff --git a/src/h/monitor.h b/src/h/monitor.h
deleted file mode 100644
index e359e9e..0000000
--- a/src/h/monitor.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * This file contains definitions for the various event codes and values
- * that go to make up event streams.
- */
-
-/*
- * Note: the blank character should *not* be used as an event code.
- */
-
-#ifdef EventMon
-
-/*
- * Allocation events use lowercase codes.
- */
-#define E_Lrgint '\114' /* Large integer allocation */
-#define E_Real '\144' /* Real allocation */
-#define E_Cset '\145' /* Cset allocation */
-#define E_File '\147' /* File allocation */
-#define E_Record '\150' /* Record allocation */
-#define E_Tvsubs '\151' /* Substring tv allocation */
-#define E_External '\152' /* External allocation */
-#define E_List '\153' /* List allocation */
-#define E_Lelem '\155' /* List element allocation */
-#define E_Table '\156' /* Table allocation */
-#define E_Telem '\157' /* Table element allocation */
-#define E_Tvtbl '\160' /* Table-element tv allocation */
-#define E_Set '\161' /* Set allocation */
-#define E_Selem '\164' /* Set element allocation */
-#define E_Slots '\167' /* Hash header allocation */
-#define E_Coexpr '\170' /* Co-expression allocation */
-#define E_Refresh '\171' /* Refresh allocation */
-#define E_Alien '\172' /* Alien allocation */
-#define E_Free '\132' /* Free region */
-#define E_String '\163' /* String allocation */
-
-/*
- * Some other monitoring codes.
- */
-#define E_BlkDeAlc '\055' /* Block deallocation */
-#define E_StrDeAlc '\176' /* String deallocation */
-
-/*
- * These are not "events"; they are provided for uniformity in tools
- * that deal with types.
- */
-#define E_Integer '\100' /* Integer value pseudo-event */
-#define E_Null '\044' /* Null value pseudo-event */
-#define E_Proc '\045' /* Procedure value pseudo-event */
-#define E_Kywdint '\136' /* Integer keyword value pseudo-event */
-#define E_Kywdpos '\046' /* Position value pseudo-event */
-#define E_Kywdsubj '\052' /* Subject value pseudo-event */
-
-/*
- * Codes for main sequence events
- */
-
- /*
- * Timing events
- */
-#define E_Tick '\056' /* Clock tick */
-
- /*
- * Code-location event
- */
-#define E_Loc '\174' /* Location change */
-#define E_Line '\355' /* Line change */
-
- /*
- * Virtual-machine instructions
- */
-#define E_Opcode '\117' /* Virtual-machine instruction */
-
- /*
- * Type-conversion events
- */
-#define E_Aconv '\111' /* Conversion attempt */
-#define E_Tconv '\113' /* Conversion target */
-#define E_Nconv '\116' /* Conversion not needed */
-#define E_Sconv '\121' /* Conversion success */
-#define E_Fconv '\112' /* Conversion failure */
-
- /*
- * Structure events
- */
-#define E_Lbang '\301' /* List generation */
-#define E_Lcreate '\302' /* List creation */
-#define E_Lget '\356' /* List get/pop -- only E_Lget used */
-#define E_Lpop '\356' /* List get/pop */
-#define E_Lpull '\304' /* List pull */
-#define E_Lpush '\305' /* List push */
-#define E_Lput '\306' /* List put */
-#define E_Lrand '\307' /* List random reference */
-#define E_Lref '\310' /* List reference */
-#define E_Lsub '\311' /* List subscript */
-#define E_Rbang '\312' /* Record generation */
-#define E_Rcreate '\313' /* Record creation */
-#define E_Rrand '\314' /* Record random reference */
-#define E_Rref '\315' /* Record reference */
-#define E_Rsub '\316' /* Record subscript */
-#define E_Sbang '\317' /* Set generation */
-#define E_Screate '\320' /* Set creation */
-#define E_Sdelete '\321' /* Set deletion */
-#define E_Sinsert '\322' /* Set insertion */
-#define E_Smember '\323' /* Set membership */
-#define E_Srand '\336' /* Set random reference */
-#define E_Sval '\324' /* Set value */
-#define E_Tbang '\325' /* Table generation */
-#define E_Tcreate '\326' /* Table creation */
-#define E_Tdelete '\327' /* Table deletion */
-#define E_Tinsert '\330' /* Table insertion */
-#define E_Tkey '\331' /* Table key generation */
-#define E_Tmember '\332' /* Table membership */
-#define E_Trand '\337' /* Table random reference */
-#define E_Tref '\333' /* Table reference */
-#define E_Tsub '\334' /* Table subscript */
-#define E_Tval '\335' /* Table value */
-
- /*
- * Scanning events
- */
-
-#define E_Snew '\340' /* Scanning environment creation */
-#define E_Sfail '\341' /* Scanning failure */
-#define E_Ssusp '\342' /* Scanning suspension */
-#define E_Sresum '\343' /* Scanning resumption */
-#define E_Srem '\344' /* Scanning environment removal */
-#define E_Spos '\346' /* Scanning position */
-
- /*
- * Assignment
- */
-
-#define E_Assign '\347' /* Assignment */
-#define E_Value '\350' /* Value assigned */
-
- /*
- * Sub-string assignment
- */
-
-#define E_Ssasgn '\354' /* Sub-string assignment */
- /*
- * Interpreter stack events
- */
-
-#define E_Intcall '\351' /* interpreter call */
-#define E_Intret '\352' /* interpreter return */
-#define E_Stack '\353' /* stack depth */
-
- /*
- * Expression events
- */
-#define E_Ecall '\143' /* Call of operation */
-#define E_Efail '\146' /* Failure from expression */
-#define E_Bsusp '\142' /* Suspension from operation */
-#define E_Esusp '\141' /* Suspension from alternation */
-#define E_Lsusp '\154' /* Suspension from limitation */
-#define E_Eresum '\165' /* Resumption of expression */
-#define E_Erem '\166' /* Removal of a suspended generator */
-
- /*
- * Co-expression events
- */
-
-#define E_Coact '\101' /* Co-expression activation */
-#define E_Coret '\102' /* Co-expression return */
-#define E_Cofail '\104' /* Co-expression failure */
-
- /*
- * Procedure events
- */
-
-#define E_Pcall '\103' /* Procedure call */
-#define E_Pfail '\106' /* Procedure failure */
-#define E_Pret '\122' /* Procedure return */
-#define E_Psusp '\123' /* Procedure suspension */
-#define E_Presum '\125' /* Procedure resumption */
-#define E_Prem '\126' /* Suspended procedure removal */
-
-#define E_Fcall '\072' /* Function call */
-#define E_Ffail '\115' /* Function failure */
-#define E_Fret '\120' /* Function return */
-#define E_Fsusp '\127' /* Function suspension */
-#define E_Fresum '\131' /* Function resumption */
-#define E_Frem '\133' /* Function suspension removal */
-
-#define E_Ocall '\134' /* Operator call */
-#define E_Ofail '\135' /* Operator failure */
-#define E_Oret '\140' /* Operator return */
-#define E_Osusp '\173' /* Operator suspension */
-#define E_Oresum '\175' /* Operator resumption */
-#define E_Orem '\177' /* Operator suspension removal */
-
- /*
- * Garbage collections
- */
-
-#define E_Collect '\107' /* Garbage collection */
-#define E_EndCollect '\360' /* End of garbage collection */
-#define E_TenureString '\361' /* Tenure a string region */
-#define E_TenureBlock '\362' /* Tenure a block region */
-
-/*
- * Termination Events
- */
-#define E_Error '\105' /* Run-time error */
-#define E_Exit '\130' /* Program exit */
-
- /*
- * I/O events
- */
-#define E_MXevent '\370' /* monitor input event */
-
-#endif /* EventMon */
diff --git a/src/h/mswin.h b/src/h/mswin.h
index 2734cb1..a16ab8a 100644
--- a/src/h/mswin.h
+++ b/src/h/mswin.h
@@ -132,8 +132,8 @@
}
#define EVQUEEMPTY(ws) (BlkLoc((ws)->listp)->list.size == 0)
-#define SHARED 0
-#define MUTABLE 1
+#define CSHARED 0
+#define CMUTABLE 1
#define MAXCOLORNAME 40
/*
* color structure, inspired by X code (xwin.h)
@@ -142,7 +142,7 @@ typedef struct wcolor {
int refcount;
char name[6+MAXCOLORNAME]; /* name for WAttrib & WColor reads */
SysColor c;
- int type; /* SHARED or MUTABLE */
+ int type; /* CSHARED or CMUTABLE */
} *wclrp;
/*
diff --git a/src/h/rexterns.h b/src/h/rexterns.h
index 804424c..026bdaa 100644
--- a/src/h/rexterns.h
+++ b/src/h/rexterns.h
@@ -56,133 +56,91 @@ extern struct tend_desc *tend; /* chain of tended descriptors */
/*
* Externals that are conditional on features.
*/
-#ifdef FncTrace
- extern struct descrip kywd_ftrc; /* descriptor for &ftrace */
-#endif /* FncTrace */
-
#ifdef Polling
extern int pollctr;
#endif /* Polling */
-#ifdef EventMon
- extern char typech[];
- extern word oldsum;
- extern struct descrip csetdesc; /* cset descriptor */
- extern struct descrip eventdesc; /* event descriptor */
- extern struct b_iproc mt_llist;
- extern struct descrip rzerodesc; /* real descriptor */
- extern struct b_real realzero; /* real zero block */
-#endif /* EventMon */
-
/*
- * Externals conditional on multithreading.
+ * Externals that were conditional on multithreading.
*/
- extern struct region rootstring;
- extern struct region rootblock;
-#ifndef MultiThread
- extern dptr glbl_argp; /* argument pointer */
- extern struct region *curstring;
- extern struct region *curblock;
- extern struct descrip k_current; /* &current */
- extern char *k_errortext; /* value of &errortext */
- extern int have_errval; /* &errorvalue has a legal value */
- extern int k_errornumber; /* value of &errornumber */
- extern int t_errornumber; /* tentative k_errornumber value */
- extern int t_have_val; /* tentative have_errval flag */
- extern struct b_file k_errout; /* value of &errout */
- extern struct b_file k_input; /* value of &input */
- extern struct b_file k_output; /* value of &output */
- extern struct descrip k_errorvalue; /* value of &errorvalue */
- extern struct descrip kywd_err; /* &error */
- extern struct descrip kywd_pos; /* descriptor for &pos */
- extern struct descrip kywd_prog; /* descriptor for &prog */
- extern struct descrip kywd_ran; /* descriptor for &random */
- extern struct descrip k_subject; /* &subject */
- extern struct descrip kywd_trc; /* descriptor for &trace */
- extern struct descrip k_eventcode; /* &eventcode */
- extern struct descrip k_eventsource; /* &eventsource */
- extern struct descrip k_eventvalue; /* &eventvalue */
- extern struct descrip k_main; /* value of &main */
- extern struct descrip t_errorvalue; /* tentative k_errorvalue value */
- extern uword blktotal; /* cumul total of all block allocs */
- extern uword strtotal; /* cumul total of all string allocs */
- extern word coll_tot; /* total number of collections */
- extern word coll_stat; /* collections from static reqests */
- extern word coll_str; /* collections from string requests */
- extern word coll_blk; /* collections from block requests */
- extern dptr globals; /* start of global variables */
- extern dptr eglobals; /* end of global variables */
- extern dptr gnames; /* start of global variable names */
- extern dptr egnames; /* end of global variable names */
- extern dptr estatics; /* end of static variables */
- extern int n_globals; /* number of global variables */
- extern int n_statics; /* number of static variables */
- extern struct b_coexpr *mainhead; /* &main */
-#endif /* MultiThread */
+extern struct region rootstring;
+extern struct region rootblock;
+extern dptr glbl_argp; /* argument pointer */
+extern struct region *curstring;
+extern struct region *curblock;
+extern struct descrip k_current; /* &current */
+extern char *k_errortext; /* value of &errortext */
+extern int have_errval; /* &errorvalue has a legal value */
+extern int k_errornumber; /* value of &errornumber */
+extern int t_errornumber; /* tentative k_errornumber value */
+extern int t_have_val; /* tentative have_errval flag */
+extern struct b_file k_errout; /* value of &errout */
+extern struct b_file k_input; /* value of &input */
+extern struct b_file k_output; /* value of &output */
+extern struct descrip k_errorvalue; /* value of &errorvalue */
+extern struct descrip kywd_err; /* &error */
+extern struct descrip kywd_pos; /* descriptor for &pos */
+extern struct descrip kywd_prog; /* descriptor for &prog */
+extern struct descrip kywd_ran; /* descriptor for &random */
+extern struct descrip k_subject; /* &subject */
+extern struct descrip kywd_trc; /* descriptor for &trace */
+extern struct descrip k_eventcode; /* &eventcode */
+extern struct descrip k_eventsource; /* &eventsource */
+extern struct descrip k_eventvalue; /* &eventvalue */
+extern struct descrip k_main; /* value of &main */
+extern struct descrip t_errorvalue; /* tentative k_errorvalue value */
+extern uword blktotal; /* cumul total of all block allocs */
+extern uword strtotal; /* cumul total of all string allocs */
+extern word coll_tot; /* total number of collections */
+extern word coll_stat; /* collections from static reqests */
+extern word coll_str; /* collections from string requests */
+extern word coll_blk; /* collections from block requests */
+extern dptr globals; /* start of global variables */
+extern dptr eglobals; /* end of global variables */
+extern dptr gnames; /* start of global variable names */
+extern dptr egnames; /* end of global variable names */
+extern dptr estatics; /* end of static variables */
+extern int n_globals; /* number of global variables */
+extern int n_statics; /* number of static variables */
+extern struct b_coexpr *mainhead; /* &main */
/*
- * Externals that differ between compiler and interpreter.
+ * External declarations that differed for the compiler.
*/
-#if !COMPILER
- /*
- * External declarations for the interpreter.
- */
-
- extern int ixinited; /* iconx has initialized */
- extern inst ipc; /* interpreter program counter */
- extern int ilevel; /* interpreter level */
- extern int ntended; /* number of active tended descriptors*/
- extern struct b_cset k_ascii; /* value of &ascii */
- extern struct b_cset k_cset; /* value of &cset */
- extern struct b_cset k_digits; /* value of &lcase */
- extern struct b_cset k_lcase; /* value of &lcase */
- extern struct b_cset k_letters; /* value of &letters */
- extern struct b_cset k_ucase; /* value of &ucase */
- extern struct descrip tended[]; /* tended descriptors */
- extern struct ef_marker *efp; /* expression frame pointer */
- extern struct gf_marker *gfp; /* generator frame pointer */
- extern struct pf_marker *pfp; /* procedure frame pointer */
- extern word *sp; /* interpreter stack pointer */
- extern word *stack; /* interpreter stack base */
- extern word *stackend; /* end of evaluation stack */
-
- extern struct pstrnm pntab[];
- extern int pnsize;
-
- #ifdef MultiThread
- extern struct progstate *curpstate;
- extern struct progstate rootpstate;
- extern int noMTevents; /* no MT events during GC */
- #else /* MultiThread */
- extern char *code; /* start of icode */
- extern char *ecode; /* end of icode */
- extern dptr statics; /* start of static variables */
- extern char *strcons; /* start of the string constants */
- extern dptr fnames; /* field names */
- extern dptr efnames; /* end of field names */
- extern word *records;
- extern int *ftabp; /* field table pointer */
- #ifdef FieldTableCompression
- extern word ftabwidth, foffwidth;
- extern unsigned char *ftabcp;
- extern short *ftabsp;
- #endif /* FieldTableCompression */
- extern dptr xargp;
- extern word xnargs;
-
- extern word lastop;
- #endif /* MultiThread */
-
-#else /* COMPILER */
-
- extern struct descrip statics[]; /* array of static variables */
- extern struct b_proc *builtins[]; /* pointers to builtin functions */
- extern int noerrbuf; /* error buffering */
- extern struct p_frame *pfp; /* procedure frame pointer */
- extern struct descrip trashcan; /* dummy descriptor, never read */
- extern int largeints; /* flag: large integers supported */
-
-#endif /* COMPILER */
+
+extern int ixinited; /* iconx has initialized */
+extern inst ipc; /* interpreter program counter */
+extern int ilevel; /* interpreter level */
+extern int ntended; /* number of active tended descriptors*/
+extern struct b_cset k_ascii; /* value of &ascii */
+extern struct b_cset k_cset; /* value of &cset */
+extern struct b_cset k_digits; /* value of &lcase */
+extern struct b_cset k_lcase; /* value of &lcase */
+extern struct b_cset k_letters; /* value of &letters */
+extern struct b_cset k_ucase; /* value of &ucase */
+extern struct descrip tended[]; /* tended descriptors */
+extern struct ef_marker *efp; /* expression frame pointer */
+extern struct gf_marker *gfp; /* generator frame pointer */
+extern struct pf_marker *pfp; /* procedure frame pointer */
+extern word *sp; /* interpreter stack pointer */
+extern word *stack; /* interpreter stack base */
+extern word *stackend; /* end of evaluation stack */
+
+extern struct pstrnm pntab[];
+extern int pnsize;
+
+extern char *code; /* start of icode */
+extern char *ecode; /* end of icode */
+extern dptr statics; /* start of static variables */
+extern char *strcons; /* start of the string constants */
+extern dptr fnames; /* field names */
+extern dptr efnames; /* end of field names */
+extern word *records;
+extern int *ftabp; /* field table pointer */
+extern dptr xargp;
+extern word xnargs;
+
+extern word lastop;
/*
* graphics
@@ -198,7 +156,6 @@ extern struct tend_desc *tend; /* chain of tended descriptors */
extern int win_highwater, canvas_serial, context_serial;
extern clock_t starttime; /* start time in milliseconds */
- #ifndef MultiThread
extern struct descrip kywd_xwin[];
extern struct descrip lastEventWin;
extern int lastEvFWidth, lastEvLeading, lastEvAscent;
@@ -208,7 +165,6 @@ extern struct tend_desc *tend; /* chain of tended descriptors */
extern struct descrip amperY;
extern struct descrip amperInterval;
extern uword xmod_control, xmod_shift, xmod_meta;
- #endif /* MultiThread */
#ifdef XWindows
extern struct _wdisplay * wdsplys;
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).
diff --git a/src/h/rproto.h b/src/h/rproto.h
index 3a5cc30..6394726 100644
--- a/src/h/rproto.h
+++ b/src/h/rproto.h
@@ -46,7 +46,7 @@ void coclean (word *old);
void coacttrace (struct b_coexpr *ccp,struct b_coexpr *ncp);
void cofailtrace (struct b_coexpr *ccp,struct b_coexpr *ncp);
void corettrace (struct b_coexpr *ccp,struct b_coexpr *ncp);
-int coswitch (word *old, word *new, int first);
+int coswitch (word *oldctx, word *newctx, int firsttime);
int cplist (dptr dp1,dptr dp2,word i,word j);
int cpset (dptr dp1,dptr dp2,word size);
void cpslots (dptr dp1,dptr slotptr,word i, word j);
@@ -116,7 +116,8 @@ int qtos (dptr dp,char *sbuf);
int radix (int sign, register int r, register char *s,
register char *end_s, union numeric *result);
char *reserve (int region, word nbytes);
-void retderef (dptr valp, word *low, word *high);
+void resolve (void);
+void retderef (dptr valp, word *low, word *high);
void segvtrap (int);
void stkdump (int);
word sub (word a,word b);
@@ -124,49 +125,31 @@ void syserr (char *s);
struct b_coexpr *topact (struct b_coexpr *ce);
void xmfree (void);
-#ifdef MultiThread
- void resolve (struct progstate *pstate);
- struct b_coexpr *loadicode (char *name, struct b_file *theInput,
- struct b_file *theOutput, struct b_file *theError,
- C_integer bs, C_integer ss, C_integer stk);
- void actparent (int eventcode);
- int mt_activate (dptr tvalp, dptr rslt, struct b_coexpr *ncp);
-#else /* MultiThread */
- void resolve (void);
-#endif /* MultiThread */
-
-#ifdef EventMon
- void EVAsgn (dptr dx);
-#endif /* EventMon */
-
-#ifdef ExternalFunctions
- dptr extcall (dptr x, int nargs, int *signal);
-#endif /* ExternalFunctions */
-
-#ifdef LargeInts
- struct b_bignum *alcbignum (word n);
- word bigradix (int sign, int r, char *s, char *x,
+/*
+ * for large integers
+ */
+struct b_bignum *alcbignum (word n);
+word bigradix (int sign, int r, char *s, char *x,
union numeric *result);
- double bigtoreal (dptr da);
- int realtobig (dptr da, dptr dx);
- int bigtos (dptr da, dptr dx);
- void bigprint (FILE *f, dptr da);
- int cpbignum (dptr da, dptr db);
- int bigadd (dptr da, dptr db, dptr dx);
- int bigsub (dptr da, dptr db, dptr dx);
- int bigmul (dptr da, dptr db, dptr dx);
- int bigdiv (dptr da, dptr db, dptr dx);
- int bigmod (dptr da, dptr db, dptr dx);
- int bigneg (dptr da, dptr dx);
- int bigpow (dptr da, dptr db, dptr dx);
- int bigpowri (double a, dptr db, dptr drslt);
- int bigand (dptr da, dptr db, dptr dx);
- int bigor (dptr da, dptr db, dptr dx);
- int bigxor (dptr da, dptr db, dptr dx);
- int bigshift (dptr da, dptr db, dptr dx);
- word bigcmp (dptr da, dptr db);
- int bigrand (dptr da, dptr dx);
-#endif /* LargeInts */
+double bigtoreal (dptr da);
+int realtobig (dptr da, dptr dx);
+int bigtos (dptr da, dptr dx);
+void bigprint (FILE *f, dptr da);
+int cpbignum (dptr da, dptr db);
+int bigadd (dptr da, dptr db, dptr dx);
+int bigsub (dptr da, dptr db, dptr dx);
+int bigmul (dptr da, dptr db, dptr dx);
+int bigdiv (dptr da, dptr db, dptr dx);
+int bigmod (dptr da, dptr db, dptr dx);
+int bigneg (dptr da, dptr dx);
+int bigpow (dptr da, dptr db, dptr dx);
+int bigpowri (double a, dptr db, dptr drslt);
+int bigand (dptr da, dptr db, dptr dx);
+int bigor (dptr da, dptr db, dptr dx);
+int bigxor (dptr da, dptr db, dptr dx);
+int bigshift (dptr da, dptr db, dptr dx);
+word bigcmp (dptr da, dptr db);
+int bigrand (dptr da, dptr dx);
#ifdef FAttrib
char *make_mode(mode_t st_mode);
@@ -385,10 +368,11 @@ void xmfree (void);
* Prototypes for the run-time system.
*/
-struct b_external *alcextrnl (int n);
+struct b_external *alcexternal (long nbytes, struct b_extlfuns *f, void *data);
struct b_record *alcrecd (int nflds,union block *recptr);
struct b_tvsubs *alcsubs (word len,word pos,dptr var);
int bfunc (void);
+struct descrip callextfunc (int (*)(int, dptr), dptr, dptr);
long ckadd (long i, long j);
long ckmul (long i, long j);
long cksub (long i, long j);
@@ -401,6 +385,10 @@ int cvcset (dptr dp,int * *cs,int *csbuf);
int cvnum (dptr dp,union numeric *result);
int cvreal (dptr dp,double *r);
void deref (dptr dp1, dptr dp2);
+int extlcmp (int argc, dptr argv);
+int extlcopy (int argc, dptr argv);
+int extlimage (int argc, dptr argv);
+int extlname (int argc, dptr argv);
void envset (void);
int eq (dptr dp1,dptr dp2);
int get_name (dptr dp1, dptr dp2);
@@ -432,50 +420,25 @@ int tvcmp4 (struct dpair *dp1,struct dpair *dp2);
int tvtbl_asgn (dptr dest, const dptr src);
void varargs (dptr argp, int nargs, dptr rslt);
-#ifdef MultiThread
- struct b_coexpr *alccoexp (long icodesize, long stacksize);
-#else /* MultiThread */
- struct b_coexpr *alccoexp (void);
-#endif /* MultiThread */
-
-#if COMPILER
-
- struct b_refresh *alcrefresh (int na, int nl, int nt, int wk_sz);
- void atrace (void);
- void ctrace (void);
- void failtrace (void);
- void initalloc (void);
- int invoke (int n, dptr args, dptr rslt, continuation c);
- void rtrace (void);
- void strace (void);
- void tracebk (struct p_frame *lcl_pfp, dptr argp);
- int xdisp (struct p_frame *fp, dptr dp, int n, FILE *f);
-
-#else /* COMPILER */
-
- struct b_refresh *alcrefresh (word *e, int nl, int nt);
- void atrace (dptr dp);
- void ctrace (dptr dp, int nargs, dptr arg);
- void failtrace (dptr dp);
- int invoke (int nargs, dptr *cargs, int *n);
- void rtrace (dptr dp, dptr rval);
- void strace (dptr dp, dptr rval);
- void tracebk (struct pf_marker *lcl_pfp, dptr argp);
- int xdisp (struct pf_marker *fp, dptr dp, int n, FILE *f);
+struct b_coexpr *alccoexp (void);
- #define Fargs dptr cargp
- int Obscan (int nargs, Fargs);
- int Ocreate (word *entryp, Fargs);
- int Oescan (int nargs, Fargs);
- int Ofield (int nargs, Fargs);
- int Olimit (int nargs, Fargs);
- int Ollist (int nargs, Fargs);
- int Omkrec (int nargs, Fargs);
+struct b_refresh *alcrefresh (word *e, int nl, int nt);
+void atrace (dptr dp);
+void ctrace (dptr dp, int nargs, dptr arg);
+void failtrace (dptr dp);
+int invoke (int nargs, dptr *cargs, int *n);
+void rtrace (dptr dp, dptr rval);
+void strace (dptr dp, dptr rval);
+void tracebk (struct pf_marker *lcl_pfp, dptr argp);
+int xdisp (struct pf_marker *fp, dptr dp, int n, FILE *f);
- #ifdef MultiThread
- void initalloc (word codesize, struct progstate *p);
- #else /* MultiThread */
- void initalloc (word codesize);
- #endif /* MultiThread */
+#define Fargs dptr cargp
+int Obscan (int nargs, Fargs);
+int Ocreate (word *entryp, Fargs);
+int Oescan (int nargs, Fargs);
+int Ofield (int nargs, Fargs);
+int Olimit (int nargs, Fargs);
+int Ollist (int nargs, Fargs);
+int Omkrec (int nargs, Fargs);
-#endif /* COMPILER */
+void initalloc (word codesize);
diff --git a/src/h/rstructs.h b/src/h/rstructs.h
index 5ee3fbb..9b32dd5 100644
--- a/src/h/rstructs.h
+++ b/src/h/rstructs.h
@@ -17,7 +17,6 @@ struct errtab {
/*
* Descriptor
*/
-
struct descrip { /* descriptor */
word dword; /* type field */
union {
@@ -33,7 +32,10 @@ struct sdescrip {
char *string; /* pointer to string */
};
-#ifdef LargeInts
+/*
+ * Heap Blocks
+ */
+
struct b_bignum { /* large integer block */
word title; /* T_Lrgint */
word blksize; /* block size */
@@ -41,7 +43,6 @@ struct b_bignum { /* large integer block */
int sign; /* sign; 0 positive, 1 negative */
DIGIT digits[1]; /* digits */
};
-#endif /* LargeInts */
struct b_real { /* real block */
word title; /* T_Real */
@@ -83,16 +84,11 @@ struct b_list { /* list-header block */
struct b_proc { /* procedure block */
word title; /* T_Proc */
word blksize; /* size of block */
-
- #if COMPILER
- int (*ccode)();
- #else /* COMPILER */
- union { /* entry points for */
- int (*ccode)(); /* C routines */
- uword ioff; /* and icode as offset */
- pointer icode; /* and icode as absolute pointer */
- } entryp;
- #endif /* COMPILER */
+ union { /* entry points for */
+ int (*ccode)(); /* C routines */
+ uword ioff; /* and icode as offset */
+ pointer icode; /* and icode as absolute pointer */
+ } entryp;
word nparam; /* number of parameters */
word ndynam; /* number of dynamic locals */
@@ -178,7 +174,9 @@ struct b_tvtbl { /* table element trapped variable block */
struct b_external { /* external block */
word title; /* T_External */
word blksize; /* size of block */
- word exdata[1]; /* words of external data */
+ word id; /* identification number */
+ struct b_extlfuns *funcs; /* dispatch table; distinguishes extl types */
+ word data[]; /* actual external data */
};
struct astkblk { /* co-expression activator-stack block */
@@ -225,6 +223,17 @@ struct dpair {
};
/*
+ * Structure for dispatching to user-provided C functions
+ * associated with external data. Any entry can be null.
+ */
+struct b_extlfuns {
+ int (*extlcmp) (int argc, dptr argv);
+ int (*extlcopy) (int argc, dptr argv);
+ int (*extlname) (int argc, dptr argv);
+ int (*extlimage)(int argc, dptr argv);
+ };
+
+/*
* Allocated memory region structure. Each program has linked lists of
* string and block regions.
*/
@@ -246,20 +255,6 @@ struct region {
};
#endif /* Double */
-#if COMPILER
-
-/*
- * Structures for the compiler.
- */
- struct p_frame {
- struct p_frame *old_pfp;
- struct descrip *old_argp;
- struct descrip *rslt;
- continuation succ_cont;
- struct tend_desc tend;
- };
- #endif /* COMPILER */
-
/*
* when debugging is enabled a debug struct is placed after the tended
* descriptors in the procedure frame.
@@ -273,46 +268,9 @@ struct debug {
union numeric { /* long integers or real numbers */
long integer;
double real;
- #ifdef LargeInts
- struct b_bignum *big;
- #endif /* LargeInts */
- };
-
-#if COMPILER
-struct b_coexpr { /* co-expression stack block */
- word title; /* T_Coexpr */
- word size; /* number of results produced */
- word id; /* identification number */
- struct b_coexpr *nextstk; /* pointer to next allocated stack */
- continuation fnc; /* function containing co-expression code */
- struct p_frame *es_pfp; /* current procedure frame pointer */
- dptr es_argp; /* current argument pointer */
- struct tend_desc *es_tend; /* current tended pointer */
- char *file_name; /* current file name */
- word line_num; /* current line_number */
- dptr tvalloc; /* where to place transmitted value */
- struct descrip freshblk; /* refresh block pointer */
- struct astkblk *es_actstk; /* pointer to activation stack structure */
- word cstate[CStateSize]; /* C state information */
- struct p_frame pf; /* initial procedure frame */
- };
-
-struct b_refresh { /* co-expression block */
- word title; /* T_Refresh */
- word blksize; /* size of block */
- word nlocals; /* number of local variables */
- word nargs; /* number of arguments */
- word ntemps; /* number of temporary descriptors */
- word wrk_size; /* size of non-descriptor work area */
- struct descrip elems[1]; /* locals and arguments */
+ struct b_bignum *big;
};
-#else /* COMPILER */
-
-/*
- * Structures for the interpreter.
- */
-
/*
* Declarations for entries in tables associating icode location with
* source program location.
@@ -327,105 +285,6 @@ struct ipc_line {
int line; /* line number */
};
-#ifdef MultiThread
-/*
- * Program state encapsulation. This consists of the VARIABLE parts of
- * many global structures.
- */
-struct progstate {
- long hsize; /* size of the icode */
- struct progstate *parent;
- struct descrip parentdesc; /* implicit "&parent" */
- struct descrip eventmask; /* implicit "&eventmask" */
- struct descrip opcodemask; /* implicit "&opcodemask" */
- struct descrip eventcode; /* &eventcode */
- struct descrip eventval; /* &eventval */
- struct descrip eventsource; /* &eventsource */
- dptr Glbl_argp; /* global argp */
-
- /*
- * trapped variable keywords' values
- */
- struct descrip Kywd_err;
- struct descrip Kywd_pos;
- struct descrip ksub;
- struct descrip Kywd_prog;
- struct descrip Kywd_ran;
- struct descrip Kywd_trc;
- struct b_coexpr *Mainhead;
- char *Code;
- char *Ecode;
- word *Records;
- int *Ftabp;
- #ifdef FieldTableCompression
- short Ftabwidth, Foffwidth;
- unsigned char *Ftabcp, *Focp;
- short *Ftabsp, *Fosp;
- int *Fo;
- char *Bm;
- #endif /* FieldTableCompression */
- dptr Fnames, Efnames;
- dptr Globals, Eglobals;
- dptr Gnames, Egnames;
- dptr Statics, Estatics;
- int NGlobals, NStatics;
- char *Strcons;
- struct ipc_fname *Filenms, *Efilenms;
- struct ipc_line *Ilines, *Elines;
- struct ipc_line * Current_line_ptr;
-
- #ifdef Graphics
- struct descrip AmperX, AmperY, AmperRow, AmperCol;/* &x, &y, &row, &col */
- struct descrip AmperInterval; /* &interval */
- struct descrip LastEventWin; /* last Event() win */
- int LastEvFWidth;
- int LastEvLeading;
- int LastEvAscent;
- uword PrevTimeStamp; /* previous timestamp */
- uword Xmod_Control, Xmod_Shift, Xmod_Meta; /* control,shift,meta */
- struct descrip Kywd_xwin[2]; /* &window + ... */
- #endif /* Graphics */
-
- #ifdef EventMon
- word Linenum, Column, Lastline, Lastcol;
- #endif /* EventMon */
-
- word Coexp_ser; /* this program's serial numbers */
- word List_ser;
- word Set_ser;
- word Table_ser;
-
- uword stringtotal; /* cumulative total allocation */
- uword blocktotal; /* cumulative total allocation */
- word colltot; /* total number of collections */
- word collstat; /* number of static collect requests */
- word collstr; /* number of string collect requests */
- word collblk; /* number of block collect requests */
- struct region *stringregion;
- struct region *blockregion;
-
- word Lastop;
-
- dptr Xargp;
- word Xnargs;
-
- struct descrip K_current;
- int K_errornumber;
- char *K_errortext;
- struct descrip K_errorvalue;
- int Have_errval;
- int T_errornumber;
- int T_have_val;
- struct descrip T_errorvalue;
-
- struct descrip K_main;
- struct b_file K_errout;
- struct b_file K_input;
- struct b_file K_output;
- };
-
-#endif /* MultiThread */
-
/*
* Frame markers
*/
@@ -445,11 +304,6 @@ struct pf_marker { /* procedure frame marker */
inst pf_ipc; /* saved ipc */
word pf_ilevel; /* saved ilevel */
dptr pf_scan; /* saved scanning environment */
-
- #ifdef MultiThread
- struct progstate *pf_prog;/* saved program state pointer */
- #endif /* MultiThread */
-
struct descrip pf_locals[1]; /* descriptors for locals */
};
@@ -511,12 +365,7 @@ struct b_coexpr { /* co-expression stack block */
dptr tvalloc; /* where to place transmitted value */
struct descrip freshblk; /* refresh block pointer */
struct astkblk *es_actstk; /* pointer to activation stack structure */
-
- #ifdef MultiThread
- struct progstate *program;
- #endif /* MultiThread */
-
- word cstate[CStateSize]; /* C state information */
+ word cstate[2]; /* was C state, now rswitch data */
};
struct b_refresh { /* co-expression block */
@@ -528,7 +377,6 @@ struct b_refresh { /* co-expression block */
struct descrip elems[1]; /* arguments and locals, including Arg0 */
};
-#endif /* COMPILER */
union block { /* general block */
struct b_real realblk;
@@ -548,8 +396,5 @@ union block { /* general block */
struct b_coexpr coexpr;
struct b_external externl;
struct b_slots slots;
-
- #ifdef LargeInts
- struct b_bignum bignumblk;
- #endif /* LargeInts */
+ struct b_bignum bignumblk;
};
diff --git a/src/h/rt.h b/src/h/rt.h
index 4531dc9..c9bf0d8 100644
--- a/src/h/rt.h
+++ b/src/h/rt.h
@@ -13,7 +13,6 @@
#include "../h/cstructs.h"
#include "../h/mproto.h"
#include "../h/cpuconf.h"
-#include "../h/monitor.h"
#include "../h/rmacros.h"
#include "../h/rstructs.h"
diff --git a/src/h/sys.h b/src/h/sys.h
index fecfd96..b858a7e 100644
--- a/src/h/sys.h
+++ b/src/h/sys.h
@@ -35,22 +35,22 @@
* Operating-system-dependent includes.
*/
#if MSWIN
- #include <windows.h>
- #include <sys/cygwin.h>
- #include <sys/select.h>
-
#ifdef WinGraphics
+ #include <windows.h>
+ #include <sys/cygwin.h>
+ #include <sys/select.h>
+
#define int_PASCAL int PASCAL
#define LRESULT_CALLBACK LRESULT CALLBACK
#define BOOL_CALLBACK BOOL CALLBACK
#include <mmsystem.h>
#include <process.h>
#include "../wincap/dibutil.h"
- #endif /* WinGraphics */
- #undef Type
- #undef lst1
- #undef lst2
+ #undef Type
+ #undef lst1
+ #undef lst2
+ #endif /* WinGraphics */
#endif /* MSWIN */
/*
diff --git a/src/h/typedefs.h b/src/h/typedefs.h
index 984af9a..041a1f7 100644
--- a/src/h/typedefs.h
+++ b/src/h/typedefs.h
@@ -39,43 +39,35 @@ typedef word C_integer;
*/
typedef int (*continuation) (void);
-#if !COMPILER
-
- /*
- * Typedefs for the interpreter.
- */
-
- /*
- * Icode consists of operators and arguments. Operators are small integers,
- * while arguments may be pointers. To conserve space in icode files on
- * computers with 16-bit ints, icode is written by the linker as a mixture
- * of ints and words (longs). When an icode file is read in and processed
- * by the interpreter, it looks like a C array of mixed ints and words.
- * Accessing this "nonstandard" structure is handled by a union of int and
- * word pointers and incrementing is done by incrementing the appropriate
- * member of the union (see the interpreter). This is a rather dubious
- * method and certainly not portable. A better way might be to address
- * icode with a char *, but the incrementing code might be inefficient
- * (at a place that experiences a lot of execution activity).
- *
- * For the moment, the dubious coding is isolated under control of the
- * size of integers.
- */
-
- #if IntBits != WordBits
+/*
+ * Icode consists of operators and arguments. Operators are small integers,
+ * while arguments may be pointers. To conserve space in icode files on
+ * computers with 16-bit ints, icode is written by the linker as a mixture
+ * of ints and words (longs). When an icode file is read in and processed
+ * by the interpreter, it looks like a C array of mixed ints and words.
+ * Accessing this "nonstandard" structure is handled by a union of int and
+ * word pointers and incrementing is done by incrementing the appropriate
+ * member of the union (see the interpreter). This is a rather dubious
+ * method and certainly not portable. A better way might be to address
+ * icode with a char *, but the incrementing code might be inefficient
+ * (at a place that experiences a lot of execution activity).
+ *
+ * For the moment, the dubious coding is isolated under control of the
+ * size of integers.
+ */
- typedef union {
- int *op;
- word *opnd;
- } inst;
+#if IntBits != WordBits
- #else /* IntBits != WordBits */
+ typedef union {
+ int *op;
+ word *opnd;
+ } inst;
- typedef union {
- word *op;
- word *opnd;
- } inst;
+#else /* IntBits != WordBits */
- #endif /* IntBits != WordBits */
+ typedef union {
+ word *op;
+ word *opnd;
+ } inst;
-#endif /* COMPILER */
+#endif /* IntBits != WordBits */
diff --git a/src/h/version.h b/src/h/version.h
index c3a8b8d..c7ac2a0 100644
--- a/src/h/version.h
+++ b/src/h/version.h
@@ -11,8 +11,8 @@
* Icon version number and date.
* These are the only two entries that change any more.
*/
-#define VersionNumber "9.4.3"
-#define VersionDate "November 14, 2005"
+#define VersionNumber "9.5.0"
+#define VersionDate "April 12, 2010"
/*
* Version number to insure format of data base matches version of iconc
@@ -20,47 +20,22 @@
*/
#define DVersion "9.0.00"
-#if COMPILER
-
- /*
- * &version
- */
- #define Version "Icon Version " VersionNumber "-C, " VersionDate
-
-#else /* COMPILER */
-
- /*
- * &version
- */
- #define Version "Icon Version " VersionNumber ", " VersionDate
-
- /*
- * Version numbers to be sure that ucode is compatible with the linker
- * and that icode is compatible with the run-time system.
- */
-
- #define UVersion "U9.0.00"
-
- #ifdef FieldTableCompression
-
- #if IntBits == 32
- #define IVersion "I9.2.00FT/32"
- #endif /* IntBits == 32 */
-
- #if IntBits == 64
- #define IVersion "I9.2.00FT/64"
- #endif /* IntBits == 64 */
-
- #else /* FieldTableCompression */
+/*
+ * &version
+ */
+#define Version "Icon Version " VersionNumber ", " VersionDate
- #if IntBits == 32
- #define IVersion "I9.0.00/32"
- #endif /* IntBits == 32 */
+/*
+ * Version numbers to be sure that ucode is compatible with the linker
+ * and that icode is compatible with the run-time system.
+ */
- #if IntBits == 64
- #define IVersion "I9.0.00/64"
- #endif /* IntBits == 64 */
+#define UVersion "U9.0.00"
- #endif /* FieldTableCompression */
+#if IntBits == 32
+ #define IVersion "I9.0.00/32"
+#endif /* IntBits == 32 */
-#endif /* COMPILER */
+#if IntBits == 64
+ #define IVersion "I9.0.00/64"
+#endif /* IntBits == 64 */
diff --git a/src/h/xwin.h b/src/h/xwin.h
index a8ff24c..2469747 100644
--- a/src/h/xwin.h
+++ b/src/h/xwin.h
@@ -74,8 +74,8 @@
#define WMAXCOLORS 256
#define MAXCOLORNAME 40
#define MAXDISPLAYNAME 64
-#define SHARED 0
-#define MUTABLE 1
+#define CSHARED 0
+#define CMUTABLE 1
#define NUMCURSORSYMS 78
/*
@@ -165,7 +165,7 @@
typedef struct wcolor {
unsigned long c; /* X pixel value */
int refcount; /* reference count */
- int type; /* SHARED or MUTABLE */
+ int type; /* CSHARED or CMUTABLE */
int next; /* next entry in hash chain */
unsigned short r, g, b; /* rgb for colorsearch */
char name[6+MAXCOLORNAME]; /* name for WAttrib & WColor reads */