Add VERSION_CODE and print normal version
[debian/pforth] / csrc / pf_guts.h
1 /* @(#) pf_guts.h 98/01/28 1.4 */
2 #ifndef _pf_guts_h
3 #define _pf_guts_h
4
5 /***************************************************************
6 ** Include file for PForth, a Forth based on 'C'
7 **
8 ** Author: Phil Burk
9 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
10 **
11 ** Permission to use, copy, modify, and/or distribute this
12 ** software for any purpose with or without fee is hereby granted.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
15 ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
16 ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
17 ** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
18 ** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
19 ** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20 ** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 **
23 ***************************************************************/
24
25 /*
26 ** PFORTH_VERSION changes when PForth is modified and released.
27 ** See README file for version info.
28 */
29 #define PFORTH_VERSION_CODE 29
30 #define PFORTH_VERSION_NAME "2.0.0"
31
32 /*
33 ** PFORTH_FILE_VERSION changes when incompatible changes are made
34 ** in the ".dic" file format.
35 **
36 ** FV3 - 950225 - Use ABS_TO_CODEREL for CodePtr. See file "pf_save.c".
37 ** FV4 - 950309 - Added NameSize and CodeSize to pfSaveForth().
38 ** FV5 - 950316 - Added Floats and reserved words.
39 ** FV6 - 961213 - Added ID_LOCAL_PLUSSTORE, ID_COLON_P, etc.
40 ** FV7 - 971203 - Added ID_FILL, (1LOCAL@),  etc., ran out of reserved, resorted.
41 ** FV8 - 980818 - Added Endian flag.
42 ** FV9 - 20100503 - Added support for 64-bit CELL.
43 ** FV10 - 20170103 - Added ID_FILE_FLUSH ID_FILE_RENAME ID_FILE_RESIZE
44 */
45 #define PF_FILE_VERSION (10)   /* Bump this whenever primitives added. */
46 #define PF_EARLIEST_FILE_VERSION (9)  /* earliest one still compatible */
47
48 /***************************************************************
49 ** Sizes and other constants
50 ***************************************************************/
51
52 #define TIB_SIZE (256)
53
54 #ifndef FALSE
55     #define FALSE (0)
56 #endif
57 #ifndef TRUE
58     #define TRUE (1)
59 #endif
60
61 #define FFALSE (0)
62 #define FTRUE (-1)
63 #define BLANK (' ')
64
65 #define FLAG_PRECEDENCE (0x80)
66 #define FLAG_IMMEDIATE  (0x40)
67 #define FLAG_SMUDGE     (0x20)
68 #define MASK_NAME_SIZE  (0x1F)
69
70 /* Debug TRACE flags */
71 #define TRACE_INNER     (0x0002)
72 #define TRACE_COMPILE   (0x0004)
73 #define TRACE_SPECIAL   (0x0008)
74
75 /* Numeric types returned by NUMBER? */
76 #define NUM_TYPE_BAD    (0)
77 #define NUM_TYPE_SINGLE (1)
78 #define NUM_TYPE_DOUBLE (2)
79 #define NUM_TYPE_FLOAT  (3)
80
81 #define CREATE_BODY_OFFSET  (3*sizeof(cell_t))
82
83 /***************************************************************
84 ** Primitive Token IDS
85 ** Do NOT change the order of these IDs or dictionary files will break!
86 ***************************************************************/
87 enum cforth_primitive_ids
88 {
89     ID_EXIT = 0,  /* ID_EXIT must always be zero. */
90 /* Do NOT change the order of these IDs or dictionary files will break! */
91     ID_1MINUS,
92     ID_1PLUS,
93     ID_2DUP,
94     ID_2LITERAL,
95     ID_2LITERAL_P,
96     ID_2MINUS,
97     ID_2OVER,
98     ID_2PLUS,
99     ID_2SWAP,
100     ID_2_R_FETCH,
101     ID_2_R_FROM,
102     ID_2_TO_R,
103     ID_ACCEPT_P,
104     ID_ALITERAL,
105     ID_ALITERAL_P,
106     ID_ALLOCATE,
107     ID_AND,
108     ID_ARSHIFT,
109     ID_BAIL,
110     ID_BODY_OFFSET,
111     ID_BRANCH,
112     ID_BYE,
113     ID_CALL_C,
114     ID_CFETCH,
115     ID_CMOVE,
116     ID_CMOVE_UP,
117     ID_COLON,
118     ID_COLON_P,
119     ID_COMPARE,
120     ID_COMP_EQUAL,
121     ID_COMP_GREATERTHAN,
122     ID_COMP_LESSTHAN,
123     ID_COMP_NOT_EQUAL,
124     ID_COMP_U_GREATERTHAN,
125     ID_COMP_U_LESSTHAN,
126     ID_COMP_ZERO_EQUAL,
127     ID_COMP_ZERO_GREATERTHAN,
128     ID_COMP_ZERO_LESSTHAN,
129     ID_COMP_ZERO_NOT_EQUAL,
130     ID_CR,
131     ID_CREATE,
132     ID_CREATE_P,
133     ID_CSTORE,
134     ID_DEFER,
135     ID_DEFER_P,
136     ID_DEPTH,
137     ID_DIVIDE,
138     ID_DOT,
139     ID_DOTS,
140     ID_DO_P,
141     ID_DROP,
142     ID_DUMP,
143     ID_DUP,
144     ID_D_MINUS,
145     ID_D_MTIMES,
146     ID_D_MUSMOD,
147     ID_D_PLUS,
148     ID_D_UMSMOD,
149     ID_D_UMTIMES,
150     ID_EMIT,
151     ID_EMIT_P,
152     ID_EOL,
153     ID_ERRORQ_P,
154     ID_EXECUTE,
155     ID_FETCH,
156     ID_FILE_CLOSE,
157     ID_FILE_CREATE,
158     ID_FILE_OPEN,
159     ID_FILE_POSITION,
160     ID_FILE_READ,
161     ID_FILE_REPOSITION,
162     ID_FILE_RO,
163     ID_FILE_RW,
164     ID_FILE_SIZE,
165     ID_FILE_WRITE,
166     ID_FILL,
167     ID_FIND,
168     ID_FINDNFA,
169     ID_FLUSHEMIT,
170     ID_FREE,
171     ID_HERE,
172     ID_NUMBERQ_P,
173     ID_I,
174     ID_INCLUDE_FILE,
175     ID_J,
176     ID_KEY,
177     ID_LEAVE_P,
178     ID_LITERAL,
179     ID_LITERAL_P,
180     ID_LOADSYS,
181     ID_LOCAL_COMPILER,
182     ID_LOCAL_ENTRY,
183     ID_LOCAL_EXIT,
184     ID_LOCAL_FETCH,
185     ID_LOCAL_FETCH_1,
186     ID_LOCAL_FETCH_2,
187     ID_LOCAL_FETCH_3,
188     ID_LOCAL_FETCH_4,
189     ID_LOCAL_FETCH_5,
190     ID_LOCAL_FETCH_6,
191     ID_LOCAL_FETCH_7,
192     ID_LOCAL_FETCH_8,
193     ID_LOCAL_PLUSSTORE,
194     ID_LOCAL_STORE,
195     ID_LOCAL_STORE_1,
196     ID_LOCAL_STORE_2,
197     ID_LOCAL_STORE_3,
198     ID_LOCAL_STORE_4,
199     ID_LOCAL_STORE_5,
200     ID_LOCAL_STORE_6,
201     ID_LOCAL_STORE_7,
202     ID_LOCAL_STORE_8,
203     ID_LOOP_P,
204     ID_LSHIFT,
205     ID_MAX,
206     ID_MIN,
207     ID_MINUS,
208     ID_NAME_TO_PREVIOUS,
209     ID_NAME_TO_TOKEN,
210     ID_NOOP,
211     ID_NUMBERQ,
212     ID_OR,
213     ID_OVER,
214     ID_PICK,
215     ID_PLUS,
216     ID_PLUSLOOP_P,
217     ID_PLUS_STORE,
218     ID_QDO_P,
219     ID_QDUP,
220     ID_QTERMINAL,
221     ID_QUIT_P,
222     ID_REFILL,
223     ID_RESIZE,
224     ID_SOURCE_LINE_NUMBER_FETCH, /* used to be ID_RESTORE_INPUT */
225     ID_ROLL,
226     ID_ROT,
227     ID_RP_FETCH,
228     ID_RP_STORE,
229     ID_RSHIFT,
230     ID_R_DROP,
231     ID_R_FETCH,
232     ID_R_FROM,
233     ID_SAVE_FORTH_P,
234     ID_SOURCE_LINE_NUMBER_STORE, /* used to be ID_SAVE_INPUT */
235     ID_SCAN,
236     ID_SEMICOLON,
237     ID_SKIP,
238     ID_SOURCE,
239     ID_SOURCE_ID,
240     ID_SOURCE_ID_POP,
241     ID_SOURCE_ID_PUSH,
242     ID_SOURCE_SET,
243     ID_SP_FETCH,
244     ID_SP_STORE,
245     ID_STORE,
246     ID_SWAP,
247     ID_TEST1,
248     ID_TEST2,
249     ID_TEST3,
250     ID_TICK,
251     ID_TIMES,
252     ID_TO_R,
253     ID_TYPE,
254     ID_TYPE_P,
255     ID_VAR_BASE,
256     ID_VAR_CODE_BASE,
257     ID_VAR_CODE_LIMIT,
258     ID_VAR_CONTEXT,
259     ID_VAR_DP,
260     ID_VAR_ECHO,
261     ID_VAR_HEADERS_BASE,
262     ID_VAR_HEADERS_LIMIT,
263     ID_VAR_HEADERS_PTR,
264     ID_VAR_NUM_TIB,
265     ID_VAR_OUT,
266     ID_VAR_RETURN_CODE,
267     ID_VAR_SOURCE_ID,
268     ID_VAR_STATE,
269     ID_VAR_TO_IN,
270     ID_VAR_TRACE_FLAGS,
271     ID_VAR_TRACE_LEVEL,
272     ID_VAR_TRACE_STACK,
273     ID_VLIST,
274     ID_WORD,
275     ID_WORD_FETCH,
276     ID_WORD_STORE,
277     ID_XOR,
278     ID_ZERO_BRANCH,
279     ID_CATCH,
280     ID_THROW,
281     ID_INTERPRET,
282     ID_FILE_WO,
283     ID_FILE_BIN,
284     /* Added to support 64 bit operation. */
285     ID_CELL,
286     ID_CELLS,
287     /* DELETE-FILE */
288     ID_FILE_DELETE,
289     ID_FILE_FLUSH,     /* FLUSH-FILE */
290     ID_FILE_RENAME,    /* (RENAME-FILE) */
291     ID_FILE_RESIZE,    /* RESIZE-FILE */
292     ID_SLEEP_P,        /* (SLEEP) V2.0.0 */
293     ID_VAR_BYE_CODE,   /* BYE-CODE */
294     ID_VERSION_CODE,
295 /* If you add a word here, take away one reserved word below. */
296 #ifdef PF_SUPPORT_FP
297 /* Only reserve space if we are adding FP so that we can detect
298 ** unsupported primitives when loading dictionary.
299 */
300     ID_RESERVED03,
301     ID_RESERVED04,
302     ID_RESERVED05,
303     ID_RESERVED06,
304     ID_RESERVED07,
305     ID_RESERVED08,
306     ID_RESERVED09,
307     ID_FP_D_TO_F,
308     ID_FP_FSTORE,
309     ID_FP_FTIMES,
310     ID_FP_FPLUS,
311     ID_FP_FMINUS,
312     ID_FP_FSLASH,
313     ID_FP_F_ZERO_LESS_THAN,
314     ID_FP_F_ZERO_EQUALS,
315     ID_FP_F_LESS_THAN,
316     ID_FP_F_TO_D,
317     ID_FP_FFETCH,
318     ID_FP_FDEPTH,
319     ID_FP_FDROP,
320     ID_FP_FDUP,
321     ID_FP_FLITERAL,
322     ID_FP_FLITERAL_P,
323     ID_FP_FLOAT_PLUS,
324     ID_FP_FLOATS,
325     ID_FP_FLOOR,
326     ID_FP_FMAX,
327     ID_FP_FMIN,
328     ID_FP_FNEGATE,
329     ID_FP_FOVER,
330     ID_FP_FROT,
331     ID_FP_FROUND,
332     ID_FP_FSWAP,
333     ID_FP_FSTAR_STAR,
334     ID_FP_FABS,
335     ID_FP_FACOS,
336     ID_FP_FACOSH,
337     ID_FP_FALOG,
338     ID_FP_FASIN,
339     ID_FP_FASINH,
340     ID_FP_FATAN,
341     ID_FP_FATAN2,
342     ID_FP_FATANH,
343     ID_FP_FCOS,
344     ID_FP_FCOSH,
345     ID_FP_FLN,
346     ID_FP_FLNP1,
347     ID_FP_FLOG,
348     ID_FP_FSIN,
349     ID_FP_FSINCOS,
350     ID_FP_FSINH,
351     ID_FP_FSQRT,
352     ID_FP_FTAN,
353     ID_FP_FTANH,
354     ID_FP_FPICK,
355 #endif
356 /* Add new IDs by replacing reserved IDs or extending FP routines. */
357 /* Do NOT change the order of these IDs or dictionary files will break! */
358     NUM_PRIMITIVES     /* This must always be LAST */
359 };
360
361
362
363 /***************************************************************
364 ** THROW Codes
365 ***************************************************************/
366 /* ANSI standard definitions needed by pForth */
367 #define THROW_ABORT            (-1)
368 #define THROW_ABORT_QUOTE      (-2)
369 #define THROW_STACK_OVERFLOW   (-3)
370 #define THROW_STACK_UNDERFLOW  (-4)
371 #define THROW_UNDEFINED_WORD  (-13)
372 #define THROW_EXECUTING       (-14)
373 #define THROW_PAIRS           (-22)
374 #define THROW_FLOAT_STACK_UNDERFLOW  ( -45)
375 #define THROW_QUIT            (-56)
376 #define THROW_FLUSH_FILE      (-68)
377 #define THROW_RESIZE_FILE     (-74)
378
379 /* THROW codes unique to pForth */
380 #define THROW_BYE            (-256) /* Exit program. */
381 #define THROW_SEMICOLON      (-257) /* Error detected at ; */
382 #define THROW_DEFERRED       (-258) /* Not a deferred word. Used in system.fth */
383
384 /***************************************************************
385 ** Structures
386 ***************************************************************/
387
388 typedef struct pfTaskData_s
389 {
390     cell_t   *td_StackPtr;       /* Primary data stack */
391     cell_t   *td_StackBase;
392     cell_t   *td_StackLimit;
393     cell_t   *td_ReturnPtr;      /* Return stack */
394     cell_t   *td_ReturnBase;
395     cell_t   *td_ReturnLimit;
396 #ifdef PF_SUPPORT_FP
397     PF_FLOAT  *td_FloatStackPtr;
398     PF_FLOAT  *td_FloatStackBase;
399     PF_FLOAT  *td_FloatStackLimit;
400 #endif
401     cell_t   *td_InsPtr;          /* Instruction pointer, "PC" */
402     FileStream   *td_InputStream;
403 /* Terminal. */
404     char    td_TIB[TIB_SIZE];   /* Buffer for terminal input. */
405     cell_t    td_IN;              /* Index into Source */
406     cell_t    td_SourceNum;       /* #TIB after REFILL */
407     char   *td_SourcePtr;       /* Pointer to TIB or other source. */
408     cell_t   td_LineNumber;      /* Incremented on every refill. */
409     cell_t    td_OUT;             /* Current output column. */
410 } pfTaskData_t;
411
412 typedef struct pfNode
413 {
414     struct pfNode *n_Next;
415     struct pfNode *n_Prev;
416 } pfNode;
417
418 /* Structure of header entry in dictionary. These will be stored in dictionary specific endian format*/
419 typedef struct cfNameLinks
420 {
421     cell_t       cfnl_PreviousName;   /* name relative address of previous */
422     ExecToken  cfnl_ExecToken;      /* Execution token for word. */
423 /* Followed by variable length name field. */
424 } cfNameLinks;
425
426 #define PF_DICF_ALLOCATED_SEGMENTS  ( 0x0001)
427 typedef struct pfDictionary_s
428 {
429     pfNode  dic_Node;
430     ucell_t  dic_Flags;
431 /* Headers contain pointers to names and dictionary. */
432
433     ucell_t dic_HeaderBaseUnaligned;
434
435     ucell_t dic_HeaderBase;
436     ucell_t dic_HeaderPtr;
437     ucell_t dic_HeaderLimit;
438 /* Code segment contains tokenized code and data. */
439     ucell_t dic_CodeBaseUnaligned;
440     ucell_t dic_CodeBase;
441     union
442     {
443         cell_t  *Cell;
444         uint8_t *Byte;
445     } dic_CodePtr;
446     ucell_t dic_CodeLimit;
447 } pfDictionary_t;
448
449 /* Save state of include when nesting files. */
450 typedef struct IncludeFrame
451 {
452     FileStream   *inf_FileID;
453     cell_t         inf_LineNumber;
454     cell_t         inf_SourceNum;
455     cell_t         inf_IN;
456     char          inf_SaveTIB[TIB_SIZE];
457 } IncludeFrame;
458
459 #define MAX_INCLUDE_DEPTH (16)
460
461 /***************************************************************
462 ** Prototypes
463 ***************************************************************/
464
465 #ifdef __cplusplus
466 extern "C" {
467 #endif
468
469 ThrowCode pfCatch( ExecToken XT );
470
471 #ifdef __cplusplus
472 }
473 #endif
474
475 /***************************************************************
476 ** External Globals
477 ***************************************************************/
478 extern pfTaskData_t *gCurrentTask;
479 extern pfDictionary_t *gCurrentDictionary;
480 extern char          gScratch[TIB_SIZE];
481 extern cell_t         gNumPrimitives;
482
483 extern ExecToken     gLocalCompiler_XT;      /* CFA of (LOCAL) compiler. */
484 extern ExecToken     gNumberQ_XT;         /* XT of NUMBER? */
485 extern ExecToken     gQuitP_XT;           /* XT of (QUIT) */
486 extern ExecToken     gAcceptP_XT;         /* XT of ACCEPT */
487
488 #define DEPTH_AT_COLON_INVALID (-100)
489 extern cell_t         gDepthAtColon;
490
491 /* Global variables. */
492 extern cell_t        gVarContext;    /* Points to last name field. */
493 extern cell_t        gVarState;      /* 1 if compiling. */
494 extern cell_t        gVarBase;       /* Numeric Base. */
495 extern cell_t        gVarByeCode;    /* BYE-CODE returned on exit */
496 extern cell_t        gVarEcho;       /* Echo input from file. */
497 extern cell_t        gVarEchoAccept; /* Echo input from ACCEPT. */
498 extern cell_t        gVarTraceLevel;
499 extern cell_t        gVarTraceStack;
500 extern cell_t        gVarTraceFlags;
501 extern cell_t        gVarQuiet;      /* Suppress unnecessary messages, OK, etc. */
502 extern cell_t        gVarReturnCode; /* Returned to caller of Forth, eg. UNIX shell. */
503
504 extern IncludeFrame  gIncludeStack[MAX_INCLUDE_DEPTH];
505 extern cell_t         gIncludeIndex;
506 /***************************************************************
507 ** Macros
508 ***************************************************************/
509
510
511 /* Endian specific macros for creating target dictionaries for machines with
512
513 ** different endian-ness.
514
515 */
516
517 #if defined(PF_BIG_ENDIAN_DIC)
518
519 #define WRITE_FLOAT_DIC             WriteFloatBigEndian
520 #define WRITE_CELL_DIC(addr,data)   WriteCellBigEndian((uint8_t *)(addr),(ucell_t)(data))
521 #define WRITE_SHORT_DIC(addr,data)  Write16BigEndian((uint8_t *)(addr),(uint16_t)(data))
522 #define READ_FLOAT_DIC              ReadFloatBigEndian
523 #define READ_CELL_DIC(addr)         ReadCellBigEndian((const uint8_t *)(addr))
524 #define READ_SHORT_DIC(addr)        Read16BigEndian((const uint8_t *)(addr))
525
526 #elif defined(PF_LITTLE_ENDIAN_DIC)
527
528 #define WRITE_FLOAT_DIC             WriteFloatLittleEndian
529 #define WRITE_CELL_DIC(addr,data)   WriteCellLittleEndian((uint8_t *)(addr),(ucell_t)(data))
530 #define WRITE_SHORT_DIC(addr,data)  Write16LittleEndian((uint8_t *)(addr),(uint16_t)(data))
531 #define READ_FLOAT_DIC              ReadFloatLittleEndian
532 #define READ_CELL_DIC(addr)         ReadCellLittleEndian((const uint8_t *)(addr))
533 #define READ_SHORT_DIC(addr)        Read16LittleEndian((const uint8_t *)(addr))
534
535 #else
536
537 #define WRITE_FLOAT_DIC(addr,data)  { *((PF_FLOAT *)(addr)) = (PF_FLOAT)(data); }
538 #define WRITE_CELL_DIC(addr,data)   { *((cell_t *)(addr)) = (cell_t)(data); }
539 #define WRITE_SHORT_DIC(addr,data)  { *((int16_t *)(addr)) = (int16_t)(data); }
540 #define READ_FLOAT_DIC(addr)        ( *((PF_FLOAT *)(addr)) )
541 #define READ_CELL_DIC(addr)         ( *((const ucell_t *)(addr)) )
542 #define READ_SHORT_DIC(addr)        ( *((const uint16_t *)(addr)) )
543
544 #endif
545
546
547 #define HEADER_HERE (gCurrentDictionary->dic_HeaderPtr.Cell)
548 #define CODE_HERE (gCurrentDictionary->dic_CodePtr.Cell)
549 #define CODE_COMMA( N ) WRITE_CELL_DIC(CODE_HERE++,(N))
550 #define NAME_BASE (gCurrentDictionary->dic_HeaderBase)
551 #define CODE_BASE (gCurrentDictionary->dic_CodeBase)
552 #define NAME_SIZE (gCurrentDictionary->dic_HeaderLimit - gCurrentDictionary->dic_HeaderBase)
553 #define CODE_SIZE (gCurrentDictionary->dic_CodeLimit - gCurrentDictionary->dic_CodeBase)
554
555 #define IN_CODE_DIC(addr) ( ( ((uint8_t *)(addr)) >= gCurrentDictionary->dic_CodeBase)   && ( ((uint8_t *)(addr)) < gCurrentDictionary->dic_CodeLimit) )
556
557 #define IN_NAME_DIC(addr) ( ( ((uint8_t *)(addr)) >= gCurrentDictionary->dic_HeaderBase) && ( ((uint8_t *)(addr)) < gCurrentDictionary->dic_HeaderLimit) )
558 #define IN_DICS(addr) (IN_CODE_DIC(addr) || IN_NAME_DIC(addr))
559
560 /* Address conversion */
561 #define ABS_TO_NAMEREL( a ) ((cell_t)  (((ucell_t) a) - NAME_BASE ))
562 #define ABS_TO_CODEREL( a ) ((cell_t)  (((ucell_t) a) - CODE_BASE ))
563 #define NAMEREL_TO_ABS( a ) ((ucell_t) (((cell_t) a) + NAME_BASE))
564 #define CODEREL_TO_ABS( a ) ((ucell_t) (((cell_t) a) + CODE_BASE))
565
566 /* The check for >0 is only needed for CLONE testing. !!! */
567 #define IsTokenPrimitive(xt) ((xt<gNumPrimitives) && (xt>=0))
568
569 #define FREE_VAR(v) { if (v) { pfFreeMem((void *)(v)); v = 0; } }
570
571 #define DATA_STACK_DEPTH (gCurrentTask->td_StackBase - gCurrentTask->td_StackPtr)
572 #define DROP_DATA_STACK (gCurrentTask->td_StackPtr++)
573 #define POP_DATA_STACK (*gCurrentTask->td_StackPtr++)
574 #define PUSH_DATA_STACK(x) {*(--(gCurrentTask->td_StackPtr)) = (cell_t) x; }
575
576 /* Force Quad alignment. */
577 #define QUADUP(x) (((x)+3)&~3)
578
579 #ifndef MIN
580 #define MIN(a,b)  ( ((a)<(b)) ? (a) : (b) )
581 #endif
582 #ifndef MAX
583 #define MAX(a,b)  ( ((a)>(b)) ? (a) : (b) )
584 #endif
585
586 #ifndef TOUCH
587     #define TOUCH(argument) ((void)argument)
588 #endif
589
590 /***************************************************************
591 ** I/O related macros
592 ***************************************************************/
593
594 #define EMIT(c)  ioEmit(c)
595 #define EMIT_CR  EMIT('\n');
596
597 #define MSG(cs)   pfMessage(cs)
598 #define ERR(x)    MSG(x)
599
600 #define DBUG(x)  /* PRT(x) */
601 #define DBUGX(x) /* DBUG(x) */
602
603 #define MSG_NUM_D(msg,num) { MSG(msg); ffDot((cell_t) num); EMIT_CR; }
604 #define MSG_NUM_H(msg,num) { MSG(msg); ffDotHex((cell_t) num); EMIT_CR; }
605
606 #define DBUG_NUM_D(msg,num) { pfDebugMessage(msg); pfDebugPrintDecimalNumber((cell_t) num); pfDebugMessage("\n"); }
607
608 #endif  /* _pf_guts_h */