home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / pccts.zip / lang / c / type.h < prev   
C/C++ Source or Header  |  1992-12-08  |  2KB  |  103 lines

  1. /* S y m b o l  l e v e l s */
  2. #define GLOBAL        1
  3. #define PARAMETER    2
  4. #define LOCAL        3
  5.  
  6. /* T y p e s */
  7. #define tNone        0x0000
  8. #define tInt        0x0001
  9. #define tFloat        0x0002
  10. #define tChar        0x0004
  11. #define tShort        0x0008
  12. #define tLong        0x0010
  13. #define tDouble        0x0020
  14. #define tVoid        0x0040
  15. #define tUnsigned    0x0080
  16. #define tEllipsis    0x0100
  17. #define tUnion        0x0200
  18. #define tStruct        0x0400
  19. #define tEnum        0x0800
  20. #define tTypeName    0x1000
  21. #define tSigned        0x2000
  22.  
  23. /* T y p e  q u a l i f i e r s */
  24. #define cvNone        0x0000
  25. #define cvConst        0x0001
  26. #define cvVolatile    0x0002
  27.  
  28. /* S t o r a g e  c l a s s e s */
  29. #define scNone        0x0000
  30. #define scAuto        0x0001
  31. #define scRegister    0x0002
  32. #define scStatic    0x0004
  33. #define scExtern    0x0008
  34. #define scTypedef    0x0010
  35.  
  36.  
  37. /* A S T  n o d e s */
  38.  
  39. /* type-tree nodes */
  40. #define BaseTypeQ    1
  41. #define PointerQ    2
  42. #define ArrayQ        3
  43. #define FunctionQ    4
  44. #define FieldQ        5
  45. #define SymQ        6
  46.  
  47. /* expr-tree nodes */
  48. #define ENode        10
  49.  
  50.  
  51. #define AST_FIELDS    int nodeType;        \
  52.                     union {                \
  53.                         qPointer p;        \
  54.                         qArray a;        \
  55.                         qFunction f;    \
  56.                         qField fi;        \
  57.                         qSym s;            \
  58.                         ExprNode e;        \
  59.                         qBaseType t;    \
  60.                     } data;
  61.  
  62. typedef struct _eNode {
  63.             int token;
  64.         } ExprNode;
  65.  
  66. typedef struct _eOperator {
  67.             int token;
  68.         } eOperator;
  69.  
  70. typedef struct _qSym {
  71.             char *name;
  72.             void *init;
  73.         } qSym;
  74.  
  75. typedef struct _qField {
  76.             char *name;
  77.         } qField;
  78.  
  79. typedef struct _qPointer {
  80.             int cv;
  81.         } qPointer;
  82.  
  83. typedef struct _qArray {
  84.             struct _ast *dim;
  85.         } qArray;
  86.  
  87. /* don't need this right now */
  88. typedef struct _qFunction {
  89.             void *code;
  90.         } qFunction;
  91.  
  92. typedef struct _qBaseType {
  93.             char *name;    /* type/struct/union name */
  94.             int cv;
  95.             int sc;
  96.             int type;
  97.         } qBaseType;
  98.  
  99. /* how to create a default node */
  100. #define zzcr_ast(ast, attr, tok, text)                \
  101.             (ast)->data.e.token = tok;                \
  102.             (ast)->nodeType = ENode;
  103.