home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / h / typedefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-10  |  2.4 KB  |  98 lines

  1. /*
  2.  * typdefs for the run-time system.
  3.  */
  4.  
  5. typedef AllocType msize;
  6. typedef int ALIGN;        /* pick most stringent type for alignment */
  7. #ifndef FixedRegions
  8. typedef union bhead HEADER;
  9. #endif                    /* FixedRegions */
  10. typedef unsigned int DIGIT;
  11.  
  12. /*
  13.  * Default sizing and such.
  14.  */
  15.  
  16. /*
  17.  * Set up typedefs and related definitions depending on whether or not
  18.  * ints and pointers are the same size.
  19.  */
  20.  
  21. #if IntBits == 16
  22. typedef long int word;
  23. typedef unsigned long int uword;
  24. #else                    /* IntBits == 16 */
  25. typedef int word;
  26. #ifdef CDC_VXVE
  27. typedef uword;
  28. #else                    /* IntBits == 16 */
  29. typedef unsigned int uword;
  30. #endif                    /* CDC_VXVE */
  31. #endif                    /* IntBits == 16 */
  32.  
  33. #ifdef StandardC
  34. #ifndef PointerDef
  35. typedef void *pointer;
  36. #endif                    /* PointerDef */
  37. #else                    /* StandardC */
  38. #ifndef PointerDef
  39. typedef char *pointer;
  40. #endif                    /* PointerDef */
  41. #endif                    /* StandardC */
  42.  
  43. /*
  44.  * Typedefs to make some things easier.
  45.  */
  46.  
  47. typedef int (*fptr)();
  48. typedef struct descrip *dptr;
  49.  
  50. typedef word C_integer;
  51.  
  52. /*
  53.  * A success continuation is referenced by a pointer to an integer function
  54.  *  that takes no arguments.
  55.  */
  56. typedef int (*continuation) Params((noargs));
  57.  
  58. #if !COMPILER
  59.  
  60. /*
  61.  * Typedefs for the interpreter.
  62.  */
  63.  
  64. /*
  65.  * Icode consists of operators and arguments.  Operators are small integers,
  66.  *  while arguments may be pointers.  To conserve space in icode files on
  67.  *  computers with 16-bit ints, icode is written by the linker as a mixture
  68.  *  of ints and words (longs).  When an icode file is read in and processed
  69.  *  by the interpreter, it looks like a C array of mixed ints and words.
  70.  *  Accessing this "nonstandard" structure is handled by a union of int and
  71.  *  word pointers and incrementing is done by incrementing the appropriate
  72.  *  member of the union (see the interpreter).  This is a rather dubious
  73.  *  method and certainly not portable.  A better way might be to address
  74.  *  icode with a char *, but the incrementing code might be inefficient
  75.  *  (at a place that experiences a lot of execution activity).
  76.  *
  77.  * For the moment, the dubious coding is isolated under control of the
  78.  *  size of integers.
  79.  */
  80.  
  81. #if IntBits == 16
  82.  
  83. typedef union {
  84.    int *op;
  85.    word *opnd;
  86.    } inst;
  87.  
  88. #else                    /* IntBits == 16 */
  89.  
  90. typedef union {
  91.    word *op;
  92.    word *opnd;
  93.    } inst;
  94.  
  95. #endif                    /* IntBits == 16 */
  96.  
  97. #endif                    /* COMPILER */
  98.