home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / src / h / typedefs.h < prev    next >
Text File  |  2002-01-18  |  2KB  |  93 lines

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