symconst.pas 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. Symbol table constants
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit symconst;
  19. interface
  20. const
  21. def_alignment = 4;
  22. type
  23. { symbol options }
  24. tsymoption=(sp_none,
  25. sp_public,
  26. sp_private,
  27. sp_published,
  28. sp_protected,
  29. sp_static,
  30. sp_primary_typesym { this is for typesym, to know who is the primary symbol of a def }
  31. );
  32. tsymoptions=set of tsymoption;
  33. { flags for a definition }
  34. tdefoption=(df_none,
  35. df_need_rtti, { the definitions needs rtti }
  36. df_has_rtti { the rtti is generated }
  37. );
  38. tdefoptions=set of tdefoption;
  39. { base types for orddef }
  40. tbasetype = (
  41. uauto,uvoid,uchar,
  42. u8bit,u16bit,u32bit,
  43. s8bit,s16bit,s32bit,
  44. bool8bit,bool16bit,bool32bit,
  45. u64bit,s64bit
  46. );
  47. { float types }
  48. tfloattype = (
  49. s32real,s64real,s80real,
  50. s64comp,
  51. f16bit,f32bit
  52. );
  53. { string types }
  54. tstringtype = (
  55. st_shortstring, st_longstring, st_ansistring, st_widestring
  56. );
  57. { set types }
  58. tsettype = (
  59. normset,smallset,varset
  60. );
  61. { calling convention for tprocdef and tprocvardef }
  62. tproccalloption=(pocall_none,
  63. pocall_clearstack, { Use IBM flat calling convention. (Used by GCC.) }
  64. pocall_leftright, { Push parameters from left to right }
  65. pocall_cdecl, { procedure uses C styled calling }
  66. pocall_register, { procedure uses register (fastcall) calling }
  67. pocall_stdcall, { procedure uses stdcall call }
  68. pocall_safecall, { safe call calling conventions }
  69. pocall_palmossyscall, { procedure is a PalmOS system call }
  70. pocall_system,
  71. pocall_inline, { Procedure is an assembler macro }
  72. pocall_internproc, { Procedure has compiler magic}
  73. pocall_internconst { procedure has constant evaluator intern }
  74. );
  75. tproccalloptions=set of tproccalloption;
  76. { basic type for tprocdef and tprocvardef }
  77. tproctypeoption=(potype_none,
  78. potype_proginit, { Program initialization }
  79. potype_unitinit, { unit initialization }
  80. potype_unitfinalize, { unit finalization }
  81. potype_constructor, { Procedure is a constructor }
  82. potype_destructor, { Procedure is a destructor }
  83. potype_operator { Procedure defines an operator }
  84. );
  85. tproctypeoptions=set of tproctypeoption;
  86. { other options for tprocdef and tprocvardef }
  87. tprocoption=(po_none,
  88. po_classmethod, { class method }
  89. po_virtualmethod, { Procedure is a virtual method }
  90. po_abstractmethod, { Procedure is an abstract method }
  91. po_staticmethod, { static method }
  92. po_overridingmethod, { method with override directive }
  93. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  94. po_containsself, { self is passed explicit to the compiler }
  95. po_interrupt, { Procedure is an interrupt handler }
  96. po_iocheck, { IO checking should be done after a call to the procedure }
  97. po_assembler, { Procedure is written in assembler }
  98. po_msgstr, { method for string message handling }
  99. po_msgint, { method for int message handling }
  100. po_exports, { Procedure has export directive (needed for OS/2) }
  101. po_external, { Procedure is external (in other object or lib)}
  102. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  103. po_saveregisters { save all registers }
  104. );
  105. tprocoptions=set of tprocoption;
  106. { options for objects and classes }
  107. tobjectoption=(oo_none,
  108. oo_is_class,
  109. oo_is_forward, { the class is only a forward declared yet }
  110. oo_has_virtual, { the object/class has virtual methods }
  111. oo_has_private,
  112. oo_has_protected,
  113. oo_has_constructor, { the object/class has a constructor }
  114. oo_has_destructor, { the object/class has a destructor }
  115. oo_has_vmt, { the object/class has a vmt }
  116. oo_has_msgstr,
  117. oo_has_msgint,
  118. oo_has_abstract, { the object/class has an abstract method => no instances can be created }
  119. oo_can_have_published, { the class has rtti, i.e. you can publish properties }
  120. oo_cppvmt { the object/class uses an C++ compatible }
  121. { vmt, all members of the same class tree }
  122. { must use then a C++ compatible vmt }
  123. );
  124. tobjectoptions=set of tobjectoption;
  125. { options for properties }
  126. tpropertyoption=(ppo_none,
  127. ppo_indexed,
  128. ppo_defaultproperty,
  129. ppo_stored,
  130. ppo_hasparameters,
  131. ppo_is_override
  132. );
  133. tpropertyoptions=set of tpropertyoption;
  134. { options for variables }
  135. tvaroption=(vo_none,
  136. vo_regable,
  137. vo_is_C_var,
  138. vo_is_external,
  139. vo_is_dll_var,
  140. vo_is_thread_var,
  141. vo_fpuregable,
  142. vo_is_local_copy,
  143. vo_is_const { variable is declared as const (parameter) and can't be written to }
  144. );
  145. tvaroptions=set of tvaroption;
  146. { definition contains the informations about a type }
  147. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  148. stringdef,enumdef,procdef,objectdef,errordef,
  149. filedef,formaldef,setdef,procvardef,floatdef,
  150. classrefdef,forwarddef);
  151. { possible types for symtable entries }
  152. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
  153. constsym,enumsym,typedconstsym,errorsym,syssym,
  154. labelsym,absolutesym,propertysym,funcretsym,
  155. macrosym);
  156. { State of the variable, if it's declared, assigned or used }
  157. tvarstate=(vs_none,
  158. vs_declared,vs_declared_and_first_found,
  159. vs_set_but_first_not_passed,vs_assigned,vs_used
  160. );
  161. absolutetyp = (tovar,toasm,toaddr);
  162. tconsttyp = (constnone,
  163. constord,conststring,constreal,constbool,
  164. constint,constchar,constset,constpointer,constnil,
  165. constresourcestring
  166. );
  167. const
  168. { relevant options for assigning a proc or a procvar to a procvar }
  169. po_compatibility_options = [
  170. po_classmethod,
  171. po_staticmethod,
  172. po_methodpointer,
  173. po_containsself,
  174. po_interrupt,
  175. po_iocheck,
  176. po_exports
  177. ];
  178. const
  179. SymTypeName : array[tsymtyp] of string[12] =
  180. ('abstractsym','variable','type','proc','unit','program',
  181. 'const','enum','typed const','errorsym','system sym',
  182. 'label','absolute','property','funcret',
  183. 'macrosym');
  184. implementation
  185. end.
  186. {
  187. $Log$
  188. Revision 1.7 1999-11-30 10:40:54 peter
  189. + ttype, tsymlist
  190. Revision 1.6 1999/11/17 17:05:04 pierre
  191. * Notes/hints changes
  192. Revision 1.5 1999/11/07 23:16:49 florian
  193. * finally bug 517 solved ...
  194. Revision 1.4 1999/10/26 12:30:45 peter
  195. * const parameter is now checked
  196. * better and generic check if a node can be used for assigning
  197. * export fixes
  198. * procvar equal works now (it never had worked at least from 0.99.8)
  199. * defcoll changed to linkedlist with pparaitem so it can easily be
  200. walked both directions
  201. Revision 1.3 1999/10/01 08:02:48 peter
  202. * forward type declaration rewritten
  203. Revision 1.2 1999/08/04 13:45:29 florian
  204. + floating point register variables !!
  205. * pairegalloc is now generated for register variables
  206. Revision 1.1 1999/08/03 22:03:14 peter
  207. * moved bitmask constants to sets
  208. * some other type/const renamings
  209. }