• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 typedef int Boolean;
3 
4 typedef unsigned char univ;
5 typedef unsigned short int Uint16;
6 typedef unsigned char Uint8;
7 typedef int Sint32;
8 typedef void *hdlno;
9 typedef Sint32 fontno;
10 typedef short int Sint16;
11 
12 struct save_restore_link {
13   struct hdl *next;  /* next modified handle */
14   struct hdl *prev;  /* previous modified handle */
15 };
16 
17 /*
18 ** The first five entries entries must match "bakhdl" below.
19 */
20 typedef struct hdl {
21     univ *raw;		/* composite object value */
22     Uint16 dim;		/* # items in composite object (formerly "cnt") */
23     char cat;		/* object category (a.k.a. type) + non-gc status bits */
24     char acc_lev;	/* object attributes, save level modified or created */
25     struct save_restore_link svlink;
26     Uint8 coded_depth;	/*   0 ==> at some depth > 253;
27 			     1 ==> not on stack;
28 			     2 ==> at dictstak[0];
29 			     3 ==> at dictstak[1];
30 			   255 ==> at dictstack[253]
31 			   (see macros below)
32 			*/
33     char stat_rootlev;	/* status bits + object creation savelevel */
34     Uint8 handlev;      /* VM level of this handle; used to maintain freelist */
35     Uint8 fastlev;	/* coded save level for faster OBsave() logic:
36 			 *   0 ==> (acc_lev == 0x10)  PreScript,    ROM
37 			 *   1 ==> (acc_lev == 0x00)  savelevel  0, RAM
38 			 *   2 ==> (acc_lev == 0x01)  savelevel  1
39 			 *  16 ==> (acc_lev == 0x0F)  savelevel 15 (last)
40 			 *  17 ==>		      global level 1
41 			 */
42     union {
43       /*
44       ** In a string, array, or packedarray subinterval handle,
45       ** "superset" points to the parent string handle.
46       **/
47       struct hdl *superset;  /* see above */
48       struct hdl *gclink;    /* next composite to be scanned */
49       struct hdl *nextfree;  /* next handle on freelist */
50     } u;
51 } HDL;
52 
53 #define INI_HDLCNT	742
54 
55 struct hdl localhand[INI_HDLCNT];
56 
57 #define QUADINIT(tp,at) \
58     ((((unsigned long)(at)<<8)&0x0000ff00) | \
59      ((unsigned long)(tp)&0x000000ff))
60 
61 #define 	COMPOSGROUP		0x10
62 #define		CT_PAKARRY	0x0D
63 #define		PAKARRYTYPE		(COMPOSGROUP| CT_PAKARRY)
64 
65 #define 	EXECATTR	01
66 #define 	READONLY	04
67 
68 #define LCL_i(hnum) ((unsigned long)&localhand[hnum])
69 #define JOBXHDL 117
70 
71 struct compositeOB {
72 	unsigned long   type_attr_pos;    /* force .ALIGN 4 */
73 	unsigned long   hdl;
74 };
75 
76 static const struct compositeOB
77   do_jobx_i = {QUADINIT (PAKARRYTYPE, EXECATTR | READONLY), LCL_i(JOBXHDL)};
78 
79 #define 	OPERGROUP		0x20
80 #define		ABORTTYPE		(OPERGROUP | 0x0C)
81 #define		MACHCALLTYPE	(OPERGROUP | 0x0D)
82 
83 #define STOP_CALL	1	/* --stop-- operator */
84 
85 
86 struct filerep {
87     Sint16 des;
88     Sint16 assoc;
89 } ;
90 
91 struct stoprep {
92     Uint16 userjob;	/* True if in user job at "stopped" operator */
93     Uint16 saverr;	/* If true, any error is saved for machcall return */
94 } ;
95 
96 struct dhdr1rep {
97     Uint16 entmax;	/* Maximum entry count    */
98     Uint16 entcnt;	/* Current entry count */
99 } ;
100 
101 struct dhdr2rep {
102     Uint16 sorted;	/* Total sorted entries   */
103     Uint16 sortable;	/* Total sortable entries */
104 } ;
105 
106 typedef struct ob {
107     Uint8 type;
108     Uint8 attr;
109     Uint16 pos;
110     union {
111 	Sint32        boolrepr;
112 	Sint32        intrepr;
113 	float         realrepr;
114 	hdlno         hdl;
115 	struct stoprep stoprepr;
116 	struct filerep filrepr;
117 	struct tok   *namrepr;
118 	const struct par *oprrepr;
119 	fontno        fontrepr;
120 	Sint16        savrepr;
121 	void          (*machcallhandler)(int, int);
122 	void          (*aborthandler)(int);
123 	void         *voidprepr;
124 	struct dhdr1rep dhdr1repr;
125 	struct dhdr2rep dhdr2repr;
126     } un;
127 } OB;
128 
129 /* get type field from object */
130 #define OBtype(obp) ((obp)->type)
131 
132 /* get hdl entry from object */
133 #define OBhdl(obp) ((obp)->un.hdl)
134 
135 /* get pos field from object */
136 #define OBpos(obp) ((obp)->pos)
137 
138 OB *execptr;
139 
140 /*
141 * Clean the execution stack back to the outermost user job level
142 * or until the stack is completely empty.
143 */
clean_exec_stack(Boolean early_end)144 int clean_exec_stack (Boolean early_end)
145 {
146     OB  *pobr;
147     hdlno jobhdl;
148 
149     jobhdl  = OBhdl((OB *)&do_jobx_i);
150 
151     pobr = execptr - 1;
152 
153     if (OBhdl(pobr) == jobhdl)
154 	{
155 	    return 1;
156 
157 	}
158 
159     return (0);
160 
161 }
162 
main()163 int main()
164 {
165 }
166