symconst.pas 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. );
  132. tpropertyoptions=set of tpropertyoption;
  133. { options for variables }
  134. tvaroption=(vo_none,
  135. vo_regable,
  136. vo_is_C_var,
  137. vo_is_external,
  138. vo_is_dll_var,
  139. vo_is_thread_var,
  140. vo_fpuregable,
  141. vo_is_const { variable is declared as const (parameter) and can't be written to }
  142. );
  143. tvaroptions=set of tvaroption;
  144. { definition contains the informations about a type }
  145. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  146. stringdef,enumdef,procdef,objectdef,errordef,
  147. filedef,formaldef,setdef,procvardef,floatdef,
  148. classrefdef,forwarddef);
  149. { possible types for symtable entries }
  150. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
  151. constsym,enumsym,typedconstsym,errorsym,syssym,
  152. labelsym,absolutesym,propertysym,funcretsym,
  153. macrosym);
  154. { State of the variable, if it's declared, assigned or used }
  155. tvarstate=(vs_none,
  156. vs_declared,vs_declared_and_first_found,
  157. vs_set_but_first_not_passed,vs_assigned,vs_used
  158. );
  159. const
  160. { relevant options for assigning a proc or a procvar to a procvar }
  161. po_compatibility_options = [
  162. po_classmethod,
  163. po_staticmethod,
  164. po_methodpointer,
  165. po_containsself,
  166. po_interrupt,
  167. po_iocheck,
  168. po_exports
  169. ];
  170. const
  171. SymTypeName : array[tsymtyp] of string[12] =
  172. ('abstractsym','variable','type','proc','unit','program',
  173. 'const','enum','typed const','errorsym','system sym',
  174. 'label','absolute','property','funcret',
  175. 'macrosym');
  176. implementation
  177. end.
  178. {
  179. $Log$
  180. Revision 1.6 1999-11-17 17:05:04 pierre
  181. * Notes/hints changes
  182. Revision 1.5 1999/11/07 23:16:49 florian
  183. * finally bug 517 solved ...
  184. Revision 1.4 1999/10/26 12:30:45 peter
  185. * const parameter is now checked
  186. * better and generic check if a node can be used for assigning
  187. * export fixes
  188. * procvar equal works now (it never had worked at least from 0.99.8)
  189. * defcoll changed to linkedlist with pparaitem so it can easily be
  190. walked both directions
  191. Revision 1.3 1999/10/01 08:02:48 peter
  192. * forward type declaration rewritten
  193. Revision 1.2 1999/08/04 13:45:29 florian
  194. + floating point register variables !!
  195. * pairegalloc is now generated for register variables
  196. Revision 1.1 1999/08/03 22:03:14 peter
  197. * moved bitmask constants to sets
  198. * some other type/const renamings
  199. }