def.H 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /* I D E N T I F I E R D E S C R I P T O R S T R U C T U R E */
  2. struct constant {
  3. struct node *co_const; /* result of a constant expression */
  4. #define con_const df_value.df_constant.co_const
  5. };
  6. struct variable {
  7. arith va_off; /* address of variable */
  8. char *va_name; /* name of variable if given */
  9. #define var_off df_value.df_variable.va_off
  10. #define var_name df_value.df_variable.va_name
  11. };
  12. struct bound {
  13. struct type *bo_type; /* type of conformant array */
  14. #define bnd_type df_value.df_bound.bo_type
  15. };
  16. struct enumval {
  17. unsigned int en_val; /* value of this enumeration literal */
  18. struct def *en_next; /* next enumeration literal */
  19. #define enm_val df_value.df_enum.en_val
  20. #define enm_next df_value.df_enum.en_next
  21. };
  22. struct field {
  23. arith fd_off;
  24. unsigned short fd_flags;
  25. #define F_SELECTOR 0x1 /* set if field is a variant selector */
  26. #define F_PACKED 0x2 /* set if record is packed */
  27. #define fld_off df_value.df_field.fd_off
  28. #define fld_flags df_value.df_field.fd_flags
  29. };
  30. struct lab {
  31. struct lab *lb_next; /* list of goto statements to this label */
  32. int lb_level; /* level of nesting */
  33. label lb_no; /* instruction label */
  34. label lb_descr; /* label of goto descriptor */
  35. #define lab_next df_value.df_label.lb_next
  36. #define lab_level df_value.df_label.lb_level
  37. #define lab_no df_value.df_label.lb_no
  38. #define lab_descr df_value.df_label.lb_descr
  39. };
  40. /* ALLOCDEF "lab" 10 */
  41. struct forwtype {
  42. struct forwtype *f_next;
  43. struct node *f_node;
  44. struct type *f_type;
  45. };
  46. /* ALLOCDEF "forwtype" 50 */
  47. struct dfproc { /* used for procedures and functions */
  48. struct scopelist *pc_vis; /* scope of this procedure/function */
  49. char *pc_name; /* internal name */
  50. arith pc_res; /* offset of function result */
  51. #define prc_vis df_value.df_proc.pc_vis
  52. #define prc_name df_value.df_proc.pc_name
  53. #define prc_res df_value.df_proc.pc_res
  54. };
  55. struct def { /* list of definitions for a name */
  56. struct def *df_next; /* next definition in definitions chain */
  57. struct def *df_nextinscope;
  58. /* link all definitions in a scope */
  59. struct idf *df_idf; /* link back to the name */
  60. struct scope *df_scope; /* scope in which this definition resides */
  61. long df_kind; /* the kind of this definition: */
  62. #define D_PROCEDURE 0x00001 /* procedure */
  63. #define D_FUNCTION 0x00002 /* function */
  64. #define D_TYPE 0x00004 /* a type */
  65. #define D_CONST 0x00008 /* a constant */
  66. #define D_ENUM 0x00010 /* an enumeration literal */
  67. #define D_FIELD 0x00020 /* a field in a record */
  68. #define D_PROGRAM 0x00040 /* the program */
  69. #define D_VARIABLE 0x00080 /* a variable */
  70. #define D_PARAMETER 0x00100 /* program parameter */
  71. #define D_FORWTYPE 0x00200 /* forward type */
  72. #define D_FTYPE 0x00400 /* resolved forward type */
  73. #define D_FWPROCEDURE 0x00800 /* forward procedure */
  74. #define D_FWFUNCTION 0x01000 /* forward function */
  75. #define D_LABEL 0x02000 /* a label */
  76. #define D_LBOUND 0x04000 /* lower bound identifier in conformant array */
  77. #define D_UBOUND 0x08000 /* upper bound identifier in conformant array */
  78. #define D_FORWARD 0x10000 /* directive "forward" */
  79. #define D_EXTERN 0x20000 /* directive "extern" */
  80. #define D_ERROR 0x40000 /* a compiler generated definition for an
  81. * undefined variable
  82. */
  83. #define D_VALUE (D_FUNCTION | D_CONST | D_ENUM | D_FIELD | D_VARIABLE\
  84. | D_FWFUNCTION | D_LBOUND | D_UBOUND)
  85. #define D_ROUTINE (D_FUNCTION | D_FWFUNCTION | D_PROCEDURE | D_FWPROCEDURE)
  86. unsigned short df_flags;
  87. #define D_NOREG 0x01 /* set if it may not reside in a register */
  88. #define D_VALPAR 0x02 /* set if it is a value parameter */
  89. #define D_VARPAR 0x04 /* set if it is a var parameter */
  90. #define D_LOOPVAR 0x08 /* set if it is a contol-variable */
  91. #define D_EXTERNAL 0x10 /* set if proc/func is external declared */
  92. #define D_PROGPAR 0x20 /* set if input/output was mentioned in
  93. * the program-heading
  94. */
  95. struct type *df_type;
  96. union {
  97. struct constant df_constant;
  98. struct variable df_variable;
  99. struct bound df_bound;
  100. struct enumval df_enum;
  101. struct field df_field;
  102. struct lab df_label;
  103. struct forwtype *df_fwtype;
  104. struct dfproc df_proc;
  105. int df_reqname; /* define for required name */
  106. } df_value;
  107. #define df_fortype df_value.df_fwtype
  108. };
  109. /* ALLOCDEF "def" 50 */
  110. extern struct def
  111. *define(),
  112. *MkDef(),
  113. *DeclProc(),
  114. *DeclFunc();
  115. extern struct def
  116. *lookup(),
  117. *lookfor();
  118. #define NULLDEF ((struct def *) 0)