pdecl.pas 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Does declaration (but not type) parsing for Free Pascal
  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 pdecl;
  19. interface
  20. uses
  21. globtype,tokens,globals,symtable;
  22. procedure parameter_dec(aktprocdef:pabstractprocdef);
  23. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  24. { reads the declaration blocks }
  25. procedure read_declarations(islibrary : boolean);
  26. { reads declarations in the interface part of a unit }
  27. procedure read_interface_declarations;
  28. implementation
  29. uses
  30. cobjects,scanner,
  31. symconst,aasm,tree,pass_1,strings,
  32. files,types,verbose,systems,import,
  33. cpubase
  34. {$ifndef newcg}
  35. ,tccnv
  36. {$endif newcg}
  37. {$ifdef GDB}
  38. ,gdb
  39. {$endif GDB}
  40. { parser specific stuff }
  41. ,pbase,ptconst,pexpr,ptype,psub,pexports
  42. { processor specific stuff }
  43. { codegen }
  44. {$ifdef newcg}
  45. ,cgbase
  46. {$else}
  47. ,hcodegen
  48. {$endif}
  49. ,hcgdata
  50. ;
  51. procedure parameter_dec(aktprocdef:pabstractprocdef);
  52. {
  53. handle_procvar needs the same changes
  54. }
  55. var
  56. is_procvar : boolean;
  57. sc : Pstringcontainer;
  58. s : string;
  59. storetokenpos : tfileposinfo;
  60. tt : ttype;
  61. hvs,
  62. vs : Pvarsym;
  63. hs1,hs2 : string;
  64. varspez : Tvarspez;
  65. inserthigh : boolean;
  66. begin
  67. { parsing a proc or procvar ? }
  68. is_procvar:=(aktprocdef^.deftype=procvardef);
  69. consume(_LKLAMMER);
  70. inc(testcurobject);
  71. repeat
  72. if try_to_consume(_VAR) then
  73. varspez:=vs_var
  74. else
  75. if try_to_consume(_CONST) then
  76. varspez:=vs_const
  77. else
  78. varspez:=vs_value;
  79. inserthigh:=false;
  80. tt.reset;
  81. if idtoken=_SELF then
  82. begin
  83. { only allowed in procvars and class methods }
  84. if is_procvar or
  85. (assigned(procinfo^._class) and procinfo^._class^.is_class) then
  86. begin
  87. if not is_procvar then
  88. begin
  89. {$ifndef UseNiceNames}
  90. hs2:=hs2+'$'+'self';
  91. {$else UseNiceNames}
  92. hs2:=hs2+tostr(length('self'))+'self';
  93. {$endif UseNiceNames}
  94. vs:=new(Pvarsym,initdef('@',procinfo^._class));
  95. vs^.varspez:=vs_var;
  96. { insert the sym in the parasymtable }
  97. pprocdef(aktprocdef)^.parast^.insert(vs);
  98. {$ifdef INCLUDEOK}
  99. include(aktprocdef^.procoptions,po_containsself);
  100. {$else}
  101. aktprocdef^.procoptions:=aktprocdef^.procoptions+[po_containsself];
  102. {$endif}
  103. inc(procinfo^.selfpointer_offset,vs^.address);
  104. end;
  105. consume(idtoken);
  106. consume(_COLON);
  107. single_type(tt,hs1,false);
  108. aktprocdef^.concatpara(tt,vs_value);
  109. { check the types for procedures only }
  110. if not is_procvar then
  111. CheckTypes(tt.def,procinfo^._class);
  112. end
  113. else
  114. consume(_ID);
  115. end
  116. else
  117. begin
  118. { read identifiers }
  119. sc:=idlist;
  120. {$ifdef fixLeaksOnError}
  121. strContStack.push(sc);
  122. {$endif fixLeaksOnError}
  123. { read type declaration, force reading for value and const paras }
  124. if (token=_COLON) or (varspez=vs_value) then
  125. begin
  126. consume(_COLON);
  127. { check for an open array }
  128. if token=_ARRAY then
  129. begin
  130. consume(_ARRAY);
  131. consume(_OF);
  132. { define range and type of range }
  133. tt.setdef(new(Parraydef,init(0,-1,s32bitdef)));
  134. { array of const ? }
  135. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  136. begin
  137. consume(_CONST);
  138. srsym:=nil;
  139. getsymonlyin(systemunit,'TVARREC');
  140. if not assigned(srsym) then
  141. InternalError(1234124);
  142. Parraydef(tt.def)^.elementtype:=ptypesym(srsym)^.restype;
  143. Parraydef(tt.def)^.IsArrayOfConst:=true;
  144. hs1:='array_of_const';
  145. end
  146. else
  147. begin
  148. { define field type }
  149. single_type(parraydef(tt.def)^.elementtype,hs1,false);
  150. hs1:='array_of_'+hs1;
  151. end;
  152. inserthigh:=true;
  153. end
  154. { open string ? }
  155. else if (varspez=vs_var) and
  156. (
  157. (
  158. ((token=_STRING) or (idtoken=_SHORTSTRING)) and
  159. (cs_openstring in aktmoduleswitches) and
  160. not(cs_ansistrings in aktlocalswitches)
  161. ) or
  162. (idtoken=_OPENSTRING)) then
  163. begin
  164. consume(token);
  165. tt.setdef(openshortstringdef);
  166. hs1:='openstring';
  167. inserthigh:=true;
  168. end
  169. { everything else }
  170. else
  171. single_type(tt,hs1,false);
  172. end
  173. else
  174. begin
  175. {$ifndef UseNiceNames}
  176. hs1:='$$$';
  177. {$else UseNiceNames}
  178. hs1:='var';
  179. {$endif UseNiceNames}
  180. tt.setdef(cformaldef);
  181. end;
  182. if not is_procvar then
  183. hs2:=pprocdef(aktprocdef)^.mangledname;
  184. storetokenpos:=tokenpos;
  185. while not sc^.empty do
  186. begin
  187. s:=sc^.get_with_tokeninfo(tokenpos);
  188. aktprocdef^.concatpara(tt,varspez);
  189. { For proc vars we only need the definitions }
  190. if not is_procvar then
  191. begin
  192. {$ifndef UseNiceNames}
  193. hs2:=hs2+'$'+hs1;
  194. {$else UseNiceNames}
  195. hs2:=hs2+tostr(length(hs1))+hs1;
  196. {$endif UseNiceNames}
  197. vs:=new(pvarsym,init(s,tt));
  198. vs^.varspez:=varspez;
  199. { we have to add this to avoid var param to be in registers !!!}
  200. if (varspez in [vs_var,vs_const]) and push_addr_param(tt.def) then
  201. include(vs^.varoptions,vo_regable);
  202. { insert the sym in the parasymtable }
  203. pprocdef(aktprocdef)^.parast^.insert(vs);
  204. { do we need a local copy? Then rename the varsym, do this after the
  205. insert so the dup id checking is done correctly }
  206. if (varspez=vs_value) and
  207. push_addr_param(tt.def) and
  208. not(is_open_array(tt.def) or is_array_of_const(tt.def)) then
  209. pprocdef(aktprocdef)^.parast^.rename(vs^.name,'val'+vs^.name);
  210. { also need to push a high value? }
  211. if inserthigh then
  212. begin
  213. hvs:=new(Pvarsym,initdef('high'+s,s32bitdef));
  214. hvs^.varspez:=vs_const;
  215. pprocdef(aktprocdef)^.parast^.insert(hvs);
  216. end;
  217. end;
  218. end;
  219. {$ifdef fixLeaksOnError}
  220. if PStringContainer(strContStack.pop) <> sc then
  221. writeln('problem with strContStack in pdecl (1)');
  222. {$endif fixLeaksOnError}
  223. dispose(sc,done);
  224. tokenpos:=storetokenpos;
  225. end;
  226. { set the new mangled name }
  227. if not is_procvar then
  228. pprocdef(aktprocdef)^.setmangledname(hs2);
  229. until not try_to_consume(_SEMICOLON);
  230. dec(testcurobject);
  231. consume(_RKLAMMER);
  232. end;
  233. const
  234. variantrecordlevel : longint = 0;
  235. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  236. { reads the filed of a record into a }
  237. { symtablestack, if record=false }
  238. { variants are forbidden, so this procedure }
  239. { can be used to read object fields }
  240. { if absolute is true, ABSOLUTE and file }
  241. { types are allowed }
  242. { => the procedure is also used to read }
  243. { a sequence of variable declaration }
  244. procedure insert_syms(st : psymtable;sc : pstringcontainer;tt : ttype;is_threadvar : boolean);
  245. { inserts the symbols of sc in st with def as definition or sym as ptypesym, sc is disposed }
  246. var
  247. s : string;
  248. filepos : tfileposinfo;
  249. ss : pvarsym;
  250. begin
  251. filepos:=tokenpos;
  252. while not sc^.empty do
  253. begin
  254. s:=sc^.get_with_tokeninfo(tokenpos);
  255. ss:=new(pvarsym,init(s,tt));
  256. if is_threadvar then
  257. {$ifdef INCLUDEOK}
  258. include(ss^.varoptions,vo_is_thread_var);
  259. {$else}
  260. ss^.varoptions:=ss^.varoptions+[vo_is_thread_var];
  261. {$endif}
  262. st^.insert(ss);
  263. { static data fields are inserted in the globalsymtable }
  264. if (st^.symtabletype=objectsymtable) and
  265. (sp_static in current_object_option) then
  266. begin
  267. s:=lower(st^.name^)+'_'+s;
  268. st^.defowner^.owner^.insert(new(pvarsym,init(s,tt)));
  269. end;
  270. end;
  271. {$ifdef fixLeaksOnError}
  272. if strContStack.pop <> sc then
  273. writeln('problem with strContStack in pdecl (2)');
  274. {$endif fixLeaksOnError}
  275. dispose(sc,done);
  276. tokenpos:=filepos;
  277. end;
  278. var
  279. sc : pstringcontainer;
  280. s : stringid;
  281. old_block_type : tblock_type;
  282. declarepos,storetokenpos : tfileposinfo;
  283. symdone : boolean;
  284. { to handle absolute }
  285. abssym : pabsolutesym;
  286. l : longint;
  287. code : integer;
  288. { c var }
  289. newtype : ptypesym;
  290. is_dll,
  291. is_gpc_name,is_cdecl,extern_aktvarsym,export_aktvarsym : boolean;
  292. old_current_object_option : tsymoptions;
  293. dll_name,
  294. C_name : string;
  295. tt,casetype : ttype;
  296. { Delphi initialized vars }
  297. pconstsym : ptypedconstsym;
  298. { maxsize contains the max. size of a variant }
  299. { startvarrec contains the start of the variant part of a record }
  300. maxsize,startvarrec : longint;
  301. pt : ptree;
  302. begin
  303. old_block_type:=block_type;
  304. block_type:=bt_type;
  305. is_gpc_name:=false;
  306. { Force an expected ID error message }
  307. if not (token in [_ID,_CASE,_END]) then
  308. consume(_ID);
  309. { read vars }
  310. while (token=_ID) and
  311. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  312. begin
  313. C_name:=orgpattern;
  314. sc:=idlist;
  315. {$ifdef fixLeaksOnError}
  316. strContStack.push(sc);
  317. {$endif fixLeaksOnError}
  318. consume(_COLON);
  319. if (m_gpc in aktmodeswitches) and
  320. not(is_record or is_object or is_threadvar) and
  321. (token=_ID) and (orgpattern='__asmname__') then
  322. begin
  323. consume(_ID);
  324. C_name:=pattern;
  325. if token=_CCHAR then
  326. consume(_CCHAR)
  327. else
  328. consume(_CSTRING);
  329. Is_gpc_name:=true;
  330. end;
  331. { this is needed for Delphi mode at least
  332. but should be OK for all modes !! (PM) }
  333. ignore_equal:=true;
  334. read_type(tt,'');
  335. if (variantrecordlevel>0) and tt.def^.needs_inittable then
  336. Message(parser_e_cant_use_inittable_here);
  337. ignore_equal:=false;
  338. symdone:=false;
  339. if is_gpc_name then
  340. begin
  341. storetokenpos:=tokenpos;
  342. s:=sc^.get_with_tokeninfo(tokenpos);
  343. if not sc^.empty then
  344. Message(parser_e_absolute_only_one_var);
  345. {$ifdef fixLeaksOnError}
  346. if strContStack.pop <> sc then
  347. writeln('problem with strContStack in pdecl (3)');
  348. {$endif fixLeaksOnError}
  349. dispose(sc,done);
  350. aktvarsym:=new(pvarsym,init_C(s,target_os.Cprefix+C_name,tt));
  351. {$ifdef INCLUDEOK}
  352. include(aktvarsym^.varoptions,vo_is_external);
  353. {$else}
  354. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  355. {$endif}
  356. symtablestack^.insert(aktvarsym);
  357. tokenpos:=storetokenpos;
  358. symdone:=true;
  359. end;
  360. { check for absolute }
  361. if not symdone and
  362. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  363. begin
  364. consume(_ABSOLUTE);
  365. { only allowed for one var }
  366. s:=sc^.get_with_tokeninfo(declarepos);
  367. if not sc^.empty then
  368. Message(parser_e_absolute_only_one_var);
  369. {$ifdef fixLeaksOnError}
  370. if strContStack.pop <> sc then
  371. writeln('problem with strContStack in pdecl (4)');
  372. {$endif fixLeaksOnError}
  373. dispose(sc,done);
  374. { parse the rest }
  375. if token=_ID then
  376. begin
  377. getsym(pattern,true);
  378. consume(_ID);
  379. { support unit.variable }
  380. if srsym^.typ=unitsym then
  381. begin
  382. consume(_POINT);
  383. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  384. consume(_ID);
  385. end;
  386. { we should check the result type of srsym }
  387. if not (srsym^.typ in [varsym,typedconstsym]) then
  388. Message(parser_e_absolute_only_to_var_or_const);
  389. storetokenpos:=tokenpos;
  390. tokenpos:=declarepos;
  391. abssym:=new(pabsolutesym,init(s,tt));
  392. abssym^.abstyp:=tovar;
  393. abssym^.ref:=srsym;
  394. symtablestack^.insert(abssym);
  395. tokenpos:=storetokenpos;
  396. end
  397. else
  398. if (token=_CSTRING) or (token=_CCHAR) then
  399. begin
  400. storetokenpos:=tokenpos;
  401. tokenpos:=declarepos;
  402. abssym:=new(pabsolutesym,init(s,tt));
  403. s:=pattern;
  404. consume(token);
  405. abssym^.abstyp:=toasm;
  406. abssym^.asmname:=stringdup(s);
  407. symtablestack^.insert(abssym);
  408. tokenpos:=storetokenpos;
  409. end
  410. else
  411. { absolute address ?!? }
  412. if token=_INTCONST then
  413. begin
  414. if (target_info.target=target_i386_go32v2) then
  415. begin
  416. storetokenpos:=tokenpos;
  417. tokenpos:=declarepos;
  418. abssym:=new(pabsolutesym,init(s,tt));
  419. abssym^.abstyp:=toaddr;
  420. abssym^.absseg:=false;
  421. s:=pattern;
  422. consume(_INTCONST);
  423. val(s,abssym^.address,code);
  424. if token=_COLON then
  425. begin
  426. consume(token);
  427. s:=pattern;
  428. consume(_INTCONST);
  429. val(s,l,code);
  430. abssym^.address:=abssym^.address shl 4+l;
  431. abssym^.absseg:=true;
  432. end;
  433. symtablestack^.insert(abssym);
  434. tokenpos:=storetokenpos;
  435. end
  436. else
  437. Message(parser_e_absolute_only_to_var_or_const);
  438. end
  439. else
  440. Message(parser_e_absolute_only_to_var_or_const);
  441. symdone:=true;
  442. end;
  443. { Handling of Delphi typed const = initialized vars ! }
  444. { When should this be rejected ?
  445. - in parasymtable
  446. - in record or object
  447. - ... (PM) }
  448. if (m_delphi in aktmodeswitches) and (token=_EQUAL) and
  449. not (symtablestack^.symtabletype in [parasymtable]) and
  450. not is_record and not is_object then
  451. begin
  452. storetokenpos:=tokenpos;
  453. s:=sc^.get_with_tokeninfo(tokenpos);
  454. if not sc^.empty then
  455. Message(parser_e_initialized_only_one_var);
  456. pconstsym:=new(ptypedconstsym,inittype(s,tt,false));
  457. symtablestack^.insert(pconstsym);
  458. tokenpos:=storetokenpos;
  459. consume(_EQUAL);
  460. readtypedconst(tt.def,pconstsym,false);
  461. symdone:=true;
  462. end;
  463. { for a record there doesn't need to be a ; before the END or ) }
  464. if not((is_record or is_object) and (token in [_END,_RKLAMMER])) then
  465. consume(_SEMICOLON);
  466. { procvar handling }
  467. if (tt.def^.deftype=procvardef) and (tt.def^.typesym=nil) then
  468. begin
  469. newtype:=new(ptypesym,init('unnamed',tt));
  470. parse_var_proc_directives(psym(newtype));
  471. newtype^.restype.def:=nil;
  472. tt.def^.typesym:=nil;
  473. dispose(newtype,done);
  474. end;
  475. { Check for variable directives }
  476. if not symdone and (token=_ID) then
  477. begin
  478. { Check for C Variable declarations }
  479. if (m_cvar_support in aktmodeswitches) and
  480. not(is_record or is_object or is_threadvar) and
  481. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  482. begin
  483. { only allowed for one var }
  484. s:=sc^.get_with_tokeninfo(declarepos);
  485. if not sc^.empty then
  486. Message(parser_e_absolute_only_one_var);
  487. {$ifdef fixLeaksOnError}
  488. if strContStack.pop <> sc then
  489. writeln('problem with strContStack in pdecl (5)');
  490. {$endif fixLeaksOnError}
  491. dispose(sc,done);
  492. { defaults }
  493. is_dll:=false;
  494. is_cdecl:=false;
  495. extern_aktvarsym:=false;
  496. export_aktvarsym:=false;
  497. { cdecl }
  498. if idtoken=_CVAR then
  499. begin
  500. consume(_CVAR);
  501. consume(_SEMICOLON);
  502. is_cdecl:=true;
  503. C_name:=target_os.Cprefix+C_name;
  504. end;
  505. { external }
  506. if idtoken=_EXTERNAL then
  507. begin
  508. consume(_EXTERNAL);
  509. extern_aktvarsym:=true;
  510. end;
  511. { export }
  512. if idtoken in [_EXPORT,_PUBLIC] then
  513. begin
  514. consume(_ID);
  515. if extern_aktvarsym or
  516. (symtablestack^.symtabletype in [parasymtable,localsymtable]) then
  517. Message(parser_e_not_external_and_export)
  518. else
  519. export_aktvarsym:=true;
  520. end;
  521. { external and export need a name after when no cdecl is used }
  522. if not is_cdecl then
  523. begin
  524. { dll name ? }
  525. if (extern_aktvarsym) and (idtoken<>_NAME) then
  526. begin
  527. is_dll:=true;
  528. dll_name:=get_stringconst;
  529. end;
  530. consume(_NAME);
  531. C_name:=get_stringconst;
  532. end;
  533. { consume the ; when export or external is used }
  534. if extern_aktvarsym or export_aktvarsym then
  535. consume(_SEMICOLON);
  536. { insert in the symtable }
  537. storetokenpos:=tokenpos;
  538. tokenpos:=declarepos;
  539. if is_dll then
  540. aktvarsym:=new(pvarsym,init_dll(s,tt))
  541. else
  542. aktvarsym:=new(pvarsym,init_C(s,C_name,tt));
  543. { set some vars options }
  544. if export_aktvarsym then
  545. begin
  546. inc(aktvarsym^.refs);
  547. {$ifdef INCLUDEOK}
  548. include(aktvarsym^.varoptions,vo_is_exported);
  549. {$else}
  550. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_exported];
  551. {$endif}
  552. end;
  553. if extern_aktvarsym then
  554. {$ifdef INCLUDEOK}
  555. include(aktvarsym^.varoptions,vo_is_external);
  556. {$else}
  557. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  558. {$endif}
  559. { insert in the stack/datasegment }
  560. symtablestack^.insert(aktvarsym);
  561. tokenpos:=storetokenpos;
  562. { now we can insert it in the import lib if its a dll, or
  563. add it to the externals }
  564. if extern_aktvarsym then
  565. begin
  566. if is_dll then
  567. begin
  568. if not(current_module^.uses_imports) then
  569. begin
  570. current_module^.uses_imports:=true;
  571. importlib^.preparelib(current_module^.modulename^);
  572. end;
  573. importlib^.importvariable(aktvarsym^.mangledname,dll_name,C_name)
  574. end
  575. end;
  576. symdone:=true;
  577. end
  578. else
  579. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  580. begin
  581. {$ifdef INCLUDEOK}
  582. include(current_object_option,sp_static);
  583. {$else}
  584. current_object_option:=current_object_option+[sp_static];
  585. {$endif}
  586. insert_syms(symtablestack,sc,tt,false);
  587. {$ifdef INCLUDEOK}
  588. exclude(current_object_option,sp_static);
  589. {$else}
  590. current_object_option:=current_object_option-[sp_static];
  591. {$endif}
  592. consume(_STATIC);
  593. consume(_SEMICOLON);
  594. symdone:=true;
  595. end;
  596. end;
  597. { insert it in the symtable, if not done yet }
  598. if not symdone then
  599. begin
  600. { save object option, because we can turn of the sp_published }
  601. old_current_object_option:=current_object_option;
  602. if (sp_published in current_object_option) and
  603. (not((tt.def^.deftype=objectdef) and (pobjectdef(tt.def)^.is_class))) then
  604. begin
  605. Message(parser_e_cant_publish_that);
  606. exclude(current_object_option,sp_published);
  607. end
  608. else
  609. if (sp_published in current_object_option) and
  610. not(oo_can_have_published in pobjectdef(tt.def)^.objectoptions) then
  611. begin
  612. Message(parser_e_only_publishable_classes_can__be_published);
  613. exclude(current_object_option,sp_published);
  614. end;
  615. insert_syms(symtablestack,sc,tt,is_threadvar);
  616. current_object_option:=old_current_object_option;
  617. end;
  618. end;
  619. { Check for Case }
  620. if is_record and (token=_CASE) then
  621. begin
  622. maxsize:=0;
  623. consume(_CASE);
  624. s:=pattern;
  625. getsym(s,false);
  626. { may be only a type: }
  627. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  628. read_type(casetype,'')
  629. else
  630. begin
  631. consume(_ID);
  632. consume(_COLON);
  633. read_type(casetype,'');
  634. symtablestack^.insert(new(pvarsym,init(s,casetype)));
  635. end;
  636. if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
  637. Message(type_e_ordinal_expr_expected);
  638. consume(_OF);
  639. startvarrec:=symtablestack^.datasize;
  640. repeat
  641. repeat
  642. pt:=comp_expr(true);
  643. do_firstpass(pt);
  644. if not(pt^.treetype=ordconstn) then
  645. Message(cg_e_illegal_expression);
  646. disposetree(pt);
  647. if token=_COMMA then
  648. consume(_COMMA)
  649. else
  650. break;
  651. until false;
  652. consume(_COLON);
  653. { read the vars }
  654. consume(_LKLAMMER);
  655. inc(variantrecordlevel);
  656. if token<>_RKLAMMER then
  657. read_var_decs(true,false,false);
  658. dec(variantrecordlevel);
  659. consume(_RKLAMMER);
  660. { calculates maximal variant size }
  661. maxsize:=max(maxsize,symtablestack^.datasize);
  662. { the items of the next variant are overlayed }
  663. symtablestack^.datasize:=startvarrec;
  664. if (token<>_END) and (token<>_RKLAMMER) then
  665. consume(_SEMICOLON)
  666. else
  667. break;
  668. until (token=_END) or (token=_RKLAMMER);
  669. { at last set the record size to that of the biggest variant }
  670. symtablestack^.datasize:=maxsize;
  671. end;
  672. block_type:=old_block_type;
  673. end;
  674. procedure const_dec;
  675. var
  676. name : stringid;
  677. p : ptree;
  678. tt : ttype;
  679. sym : psym;
  680. storetokenpos,filepos : tfileposinfo;
  681. old_block_type : tblock_type;
  682. ps : pconstset;
  683. pd : pbestreal;
  684. sp : pchar;
  685. skipequal : boolean;
  686. begin
  687. consume(_CONST);
  688. old_block_type:=block_type;
  689. block_type:=bt_const;
  690. repeat
  691. name:=pattern;
  692. filepos:=tokenpos;
  693. consume(_ID);
  694. case token of
  695. _EQUAL:
  696. begin
  697. consume(_EQUAL);
  698. p:=comp_expr(true);
  699. do_firstpass(p);
  700. storetokenpos:=tokenpos;
  701. tokenpos:=filepos;
  702. case p^.treetype of
  703. ordconstn:
  704. begin
  705. if is_constintnode(p) then
  706. symtablestack^.insert(new(pconstsym,init_def(name,constint,p^.value,nil)))
  707. else if is_constcharnode(p) then
  708. symtablestack^.insert(new(pconstsym,init_def(name,constchar,p^.value,nil)))
  709. else if is_constboolnode(p) then
  710. symtablestack^.insert(new(pconstsym,init_def(name,constbool,p^.value,nil)))
  711. else if p^.resulttype^.deftype=enumdef then
  712. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  713. else if p^.resulttype^.deftype=pointerdef then
  714. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  715. else internalerror(111);
  716. end;
  717. stringconstn:
  718. begin
  719. getmem(sp,p^.length+1);
  720. move(p^.value_str^,sp^,p^.length+1);
  721. symtablestack^.insert(new(pconstsym,init_string(name,conststring,sp,p^.length)));
  722. end;
  723. realconstn :
  724. begin
  725. new(pd);
  726. pd^:=p^.value_real;
  727. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd))));
  728. end;
  729. setconstn :
  730. begin
  731. new(ps);
  732. ps^:=p^.value_set^;
  733. symtablestack^.insert(new(pconstsym,init_def(name,constset,longint(ps),p^.resulttype)));
  734. end;
  735. pointerconstn :
  736. begin
  737. symtablestack^.insert(new(pconstsym,init_def(name,constpointer,p^.value,p^.resulttype)))
  738. end;
  739. niln :
  740. begin
  741. symtablestack^.insert(new(pconstsym,init_def(name,constnil,0,p^.resulttype)));
  742. end;
  743. else
  744. Message(cg_e_illegal_expression);
  745. end;
  746. tokenpos:=storetokenpos;
  747. consume(_SEMICOLON);
  748. disposetree(p);
  749. end;
  750. _COLON:
  751. begin
  752. { set the blocktype first so a consume also supports a
  753. caret, to support const s : ^string = nil }
  754. block_type:=bt_type;
  755. consume(_COLON);
  756. ignore_equal:=true;
  757. read_type(tt,'');
  758. ignore_equal:=false;
  759. block_type:=bt_const;
  760. skipequal:=false;
  761. { create symbol }
  762. storetokenpos:=tokenpos;
  763. tokenpos:=filepos;
  764. {$ifdef DELPHI_CONST_IN_RODATA}
  765. if m_delphi in aktmodeswitches then
  766. begin
  767. if assigned(readtypesym) then
  768. sym:=new(ptypedconstsym,initsym(name,readtypesym,true))
  769. else
  770. sym:=new(ptypedconstsym,init(name,def,true))
  771. end
  772. else
  773. {$endif DELPHI_CONST_IN_RODATA}
  774. begin
  775. sym:=new(ptypedconstsym,inittype(name,tt,false))
  776. end;
  777. tokenpos:=storetokenpos;
  778. symtablestack^.insert(sym);
  779. { procvar can have proc directives }
  780. if (tt.def^.deftype=procvardef) then
  781. begin
  782. { support p : procedure;stdcall=nil; }
  783. if (token=_SEMICOLON) then
  784. begin
  785. consume(_SEMICOLON);
  786. if is_proc_directive(token) then
  787. parse_var_proc_directives(sym)
  788. else
  789. begin
  790. Message(parser_e_proc_directive_expected);
  791. skipequal:=true;
  792. end;
  793. end
  794. else
  795. { support p : procedure stdcall=nil; }
  796. begin
  797. if is_proc_directive(token) then
  798. parse_var_proc_directives(sym);
  799. end;
  800. end;
  801. if not skipequal then
  802. begin
  803. { get init value }
  804. consume(_EQUAL);
  805. {$ifdef DELPHI_CONST_IN_RODATA}
  806. if m_delphi in aktmodeswitches then
  807. readtypedconst(tt.def,ptypedconstsym(sym),true)
  808. else
  809. {$endif DELPHI_CONST_IN_RODATA}
  810. readtypedconst(tt.def,ptypedconstsym(sym),false);
  811. consume(_SEMICOLON);
  812. end;
  813. end;
  814. else
  815. { generate an error }
  816. consume(_EQUAL);
  817. end;
  818. until token<>_ID;
  819. block_type:=old_block_type;
  820. end;
  821. procedure label_dec;
  822. var
  823. hl : pasmlabel;
  824. begin
  825. consume(_LABEL);
  826. if not(cs_support_goto in aktmoduleswitches) then
  827. Message(sym_e_goto_and_label_not_supported);
  828. repeat
  829. if not(token in [_ID,_INTCONST]) then
  830. consume(_ID)
  831. else
  832. begin
  833. getlabel(hl);
  834. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  835. consume(token);
  836. end;
  837. if token<>_SEMICOLON then consume(_COMMA);
  838. until not(token in [_ID,_INTCONST]);
  839. consume(_SEMICOLON);
  840. end;
  841. { search in symtablestack used, but not defined type }
  842. procedure resolve_type_forward(p : pnamedindexobject);{$ifndef FPC}far;{$endif}
  843. var
  844. hpd,pd : pdef;
  845. stpos : tfileposinfo;
  846. again : boolean;
  847. begin
  848. { Check only typesyms or record/object fields }
  849. case psym(p)^.typ of
  850. typesym :
  851. pd:=ptypesym(p)^.restype.def;
  852. varsym :
  853. if (psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  854. pd:=pvarsym(p)^.vartype.def
  855. else
  856. exit;
  857. else
  858. exit;
  859. end;
  860. repeat
  861. again:=false;
  862. case pd^.deftype of
  863. arraydef :
  864. begin
  865. { elementtype could also be defined using a forwarddef }
  866. pd:=parraydef(pd)^.elementtype.def;
  867. again:=true;
  868. end;
  869. pointerdef,
  870. classrefdef :
  871. begin
  872. { classrefdef inherits from pointerdef }
  873. hpd:=ppointerdef(pd)^.pointertype.def;
  874. { still a forward def ? }
  875. if hpd^.deftype=forwarddef then
  876. begin
  877. { try to resolve the forward }
  878. { get the correct position for it }
  879. stpos:=tokenpos;
  880. tokenpos:=pforwarddef(hpd)^.forwardpos;
  881. resolving_forward:=true;
  882. make_ref:=false;
  883. getsym(pforwarddef(hpd)^.tosymname,false);
  884. make_ref:=true;
  885. resolving_forward:=false;
  886. tokenpos:=stpos;
  887. { we don't need the forwarddef anymore, dispose it }
  888. dispose(hpd,done);
  889. { was a type sym found ? }
  890. if assigned(srsym) and
  891. (srsym^.typ=typesym) then
  892. begin
  893. ppointerdef(pd)^.pointertype.setsym(srsym);
  894. { avoid wrong unused warnings web bug 801 PM }
  895. inc(srsym^.refs);
  896. {$ifdef GDB}
  897. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  898. (psym(p)^.owner^.symtabletype in [globalsymtable,staticsymtable]) then
  899. begin
  900. ptypesym(p)^.isusedinstab := true;
  901. psym(p)^.concatstabto(debuglist);
  902. end;
  903. {$endif GDB}
  904. { we need a class type for classrefdef }
  905. if (pd^.deftype=classrefdef) and
  906. not((ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  907. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class) then
  908. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename);
  909. end
  910. else
  911. begin
  912. MessagePos1(psym(p)^.fileinfo,sym_e_forward_type_not_resolved,p^.name);
  913. { try to recover }
  914. ppointerdef(pd)^.pointertype.def:=generrordef;
  915. end;
  916. end;
  917. end;
  918. recorddef :
  919. precorddef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  920. objectdef :
  921. { Don't check objectdefs in objects/records, because these can't
  922. exist (anonymous objects aren't allowed) }
  923. if not(psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  924. pobjectdef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  925. end;
  926. until not again;
  927. end;
  928. { reads a type declaration to the symbol table }
  929. procedure type_dec;
  930. var
  931. typename : stringid;
  932. newtype : ptypesym;
  933. sym : psym;
  934. tt : ttype;
  935. defpos,storetokenpos : tfileposinfo;
  936. old_block_type : tblock_type;
  937. begin
  938. old_block_type:=block_type;
  939. block_type:=bt_type;
  940. consume(_TYPE);
  941. typecanbeforward:=true;
  942. repeat
  943. typename:=pattern;
  944. defpos:=tokenpos;
  945. consume(_ID);
  946. consume(_EQUAL);
  947. { support 'ttype=type word' syntax }
  948. if token=_TYPE then
  949. Consume(_TYPE);
  950. { is the type already defined? }
  951. getsym(typename,false);
  952. sym:=srsym;
  953. newtype:=nil;
  954. { found a symbol with this name? }
  955. if assigned(sym) then
  956. begin
  957. if (sym^.typ=typesym) then
  958. begin
  959. if (token=_CLASS) and
  960. (assigned(ptypesym(sym)^.restype.def)) and
  961. (ptypesym(sym)^.restype.def^.deftype=objectdef) and
  962. pobjectdef(ptypesym(sym)^.restype.def)^.is_class and
  963. (oo_is_forward in pobjectdef(ptypesym(sym)^.restype.def)^.objectoptions) then
  964. begin
  965. { we can ignore the result }
  966. { the definition is modified }
  967. object_dec(typename,pobjectdef(ptypesym(sym)^.restype.def));
  968. newtype:=ptypesym(sym);
  969. end;
  970. end;
  971. end;
  972. { no old type reused ? Then insert this new type }
  973. if not assigned(newtype) then
  974. begin
  975. read_type(tt,typename);
  976. storetokenpos:=tokenpos;
  977. tokenpos:=defpos;
  978. newtype:=new(ptypesym,init(typename,tt));
  979. symtablestack^.insert(newtype);
  980. tokenpos:=storetokenpos;
  981. end;
  982. if assigned(newtype^.restype.def) and
  983. (newtype^.restype.def^.deftype=procvardef) then
  984. begin
  985. if not is_proc_directive(token) then
  986. consume(_SEMICOLON);
  987. parse_var_proc_directives(psym(newtype));
  988. end
  989. else
  990. consume(_SEMICOLON);
  991. until token<>_ID;
  992. typecanbeforward:=false;
  993. symtablestack^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  994. block_type:=old_block_type;
  995. end;
  996. procedure var_dec;
  997. { parses variable declarations and inserts them in }
  998. { the top symbol table of symtablestack }
  999. begin
  1000. consume(_VAR);
  1001. read_var_decs(false,false,false);
  1002. end;
  1003. procedure threadvar_dec;
  1004. { parses thread variable declarations and inserts them in }
  1005. { the top symbol table of symtablestack }
  1006. begin
  1007. consume(_THREADVAR);
  1008. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  1009. message(parser_e_threadvars_only_sg);
  1010. read_var_decs(false,false,true);
  1011. end;
  1012. procedure resourcestring_dec;
  1013. var
  1014. name : stringid;
  1015. p : ptree;
  1016. storetokenpos,filepos : tfileposinfo;
  1017. old_block_type : tblock_type;
  1018. sp : pchar;
  1019. begin
  1020. consume(_RESOURCESTRING);
  1021. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  1022. message(parser_e_resourcestring_only_sg);
  1023. old_block_type:=block_type;
  1024. block_type:=bt_const;
  1025. repeat
  1026. name:=pattern;
  1027. filepos:=tokenpos;
  1028. consume(_ID);
  1029. case token of
  1030. _EQUAL:
  1031. begin
  1032. consume(_EQUAL);
  1033. p:=comp_expr(true);
  1034. do_firstpass(p);
  1035. storetokenpos:=tokenpos;
  1036. tokenpos:=filepos;
  1037. case p^.treetype of
  1038. ordconstn:
  1039. begin
  1040. if is_constcharnode(p) then
  1041. begin
  1042. getmem(sp,2);
  1043. sp[0]:=chr(p^.value);
  1044. sp[1]:=#0;
  1045. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,1)));
  1046. end
  1047. else
  1048. Message(cg_e_illegal_expression);
  1049. end;
  1050. stringconstn:
  1051. begin
  1052. getmem(sp,p^.length+1);
  1053. move(p^.value_str^,sp^,p^.length+1);
  1054. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,p^.length)));
  1055. end;
  1056. else
  1057. Message(cg_e_illegal_expression);
  1058. end;
  1059. tokenpos:=storetokenpos;
  1060. consume(_SEMICOLON);
  1061. disposetree(p);
  1062. end;
  1063. else consume(_EQUAL);
  1064. end;
  1065. until token<>_ID;
  1066. block_type:=old_block_type;
  1067. end;
  1068. procedure Not_supported_for_inline(t : ttoken);
  1069. begin
  1070. if assigned(aktprocsym) and
  1071. (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  1072. Begin
  1073. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  1074. Message(parser_w_inlining_disabled);
  1075. {$ifdef INCLUDEOK}
  1076. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  1077. {$else}
  1078. aktprocsym^.definition^.proccalloptions:=aktprocsym^.definition^.proccalloptions-[pocall_inline];
  1079. {$endif}
  1080. End;
  1081. end;
  1082. procedure read_declarations(islibrary : boolean);
  1083. begin
  1084. repeat
  1085. case token of
  1086. _LABEL:
  1087. begin
  1088. Not_supported_for_inline(token);
  1089. label_dec;
  1090. end;
  1091. _CONST:
  1092. begin
  1093. Not_supported_for_inline(token);
  1094. const_dec;
  1095. end;
  1096. _TYPE:
  1097. begin
  1098. Not_supported_for_inline(token);
  1099. type_dec;
  1100. end;
  1101. _VAR:
  1102. var_dec;
  1103. _THREADVAR:
  1104. threadvar_dec;
  1105. _CONSTRUCTOR,_DESTRUCTOR,
  1106. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  1107. begin
  1108. Not_supported_for_inline(token);
  1109. read_proc;
  1110. end;
  1111. _RESOURCESTRING:
  1112. resourcestring_dec;
  1113. _EXPORTS:
  1114. begin
  1115. Not_supported_for_inline(token);
  1116. { here we should be at lexlevel 1, no ? PM }
  1117. if (lexlevel<>main_program_level) or
  1118. (current_module^.is_unit) then
  1119. begin
  1120. Message(parser_e_syntax_error);
  1121. consume_all_until(_SEMICOLON);
  1122. end
  1123. else if islibrary or (target_info.target=target_i386_WIN32) then
  1124. read_exports;
  1125. end
  1126. else break;
  1127. end;
  1128. until false;
  1129. end;
  1130. procedure read_interface_declarations;
  1131. begin
  1132. {Since the body is now parsed at lexlevel 1, and the declarations
  1133. must be parsed at the same lexlevel we increase the lexlevel.}
  1134. inc(lexlevel);
  1135. repeat
  1136. case token of
  1137. _CONST : const_dec;
  1138. _TYPE : type_dec;
  1139. _VAR : var_dec;
  1140. _THREADVAR : threadvar_dec;
  1141. _RESOURCESTRING:
  1142. resourcestring_dec;
  1143. _FUNCTION,
  1144. _PROCEDURE,
  1145. _OPERATOR : read_proc;
  1146. else
  1147. break;
  1148. end;
  1149. until false;
  1150. dec(lexlevel);
  1151. end;
  1152. end.
  1153. {
  1154. $Log$
  1155. Revision 1.185 2000-06-11 06:59:36 peter
  1156. * support procvar directive without ; before the directives
  1157. Revision 1.184 2000/06/09 21:34:40 peter
  1158. * checking for dup id with para of methods fixed for delphi mode
  1159. Revision 1.183 2000/06/02 21:18:13 pierre
  1160. + set vo_is_exported for vars
  1161. Revision 1.182 2000/06/01 19:14:09 peter
  1162. * symtable.insert changed to procedure
  1163. Revision 1.181 2000/04/17 18:44:22 peter
  1164. * fixed forward resolving with redefined types
  1165. Revision 1.180 2000/02/09 13:22:56 peter
  1166. * log truncated
  1167. Revision 1.179 2000/01/20 12:29:02 pierre
  1168. * bug 801 fixed
  1169. Revision 1.178 2000/01/11 17:16:05 jonas
  1170. * removed a lot of memory leaks when an error is encountered (caused by
  1171. procinfo and pstringcontainers). There are still plenty left though :)
  1172. Revision 1.177 2000/01/10 11:14:19 peter
  1173. * fixed memory leak with options, you must use StopOptions instead of
  1174. Stop
  1175. * fixed memory leak with forward resolving, make_ref is now false
  1176. Revision 1.176 2000/01/07 01:14:28 peter
  1177. * updated copyright to 2000
  1178. Revision 1.175 1999/12/10 10:04:21 peter
  1179. * also check elementtype of arraydef for forwarddef
  1180. Revision 1.174 1999/12/01 12:42:32 peter
  1181. * fixed bug 698
  1182. * removed some notes about unused vars
  1183. Revision 1.173 1999/11/30 10:40:44 peter
  1184. + ttype, tsymlist
  1185. Revision 1.172 1999/11/29 15:18:27 pierre
  1186. + allow exports in win32 executables
  1187. Revision 1.171 1999/11/09 23:43:08 pierre
  1188. * better browser info
  1189. Revision 1.170 1999/11/09 23:06:45 peter
  1190. * esi_offset -> selfpointer_offset to be newcg compatible
  1191. * hcogegen -> cgbase fixes for newcg
  1192. Revision 1.169 1999/11/09 12:58:29 peter
  1193. * support absolute unit.variable
  1194. Revision 1.168 1999/11/06 14:34:21 peter
  1195. * truncated log to 20 revs
  1196. Revision 1.167 1999/10/26 12:30:44 peter
  1197. * const parameter is now checked
  1198. * better and generic check if a node can be used for assigning
  1199. * export fixes
  1200. * procvar equal works now (it never had worked at least from 0.99.8)
  1201. * defcoll changed to linkedlist with pparaitem so it can easily be
  1202. walked both directions
  1203. Revision 1.166 1999/10/22 10:39:34 peter
  1204. * split type reading from pdecl to ptype unit
  1205. * parameter_dec routine is now used for procedure and procvars
  1206. Revision 1.165 1999/10/21 16:41:41 florian
  1207. * problems with readln fixed: esi wasn't restored correctly when
  1208. reading ordinal fields of objects futher the register allocation
  1209. didn't take care of the extra register when reading ordinal values
  1210. * enumerations can now be used in constant indexes of properties
  1211. Revision 1.164 1999/10/14 14:57:52 florian
  1212. - removed the hcodegen use in the new cg, use cgbase instead
  1213. Revision 1.163 1999/10/06 17:39:14 peter
  1214. * fixed stabs writting for forward types
  1215. Revision 1.162 1999/10/03 19:44:42 peter
  1216. * removed objpasunit reference, tvarrec is now searched in systemunit
  1217. where it already was located
  1218. Revision 1.161 1999/10/01 11:18:02 peter
  1219. * class/record type forward checking fixed
  1220. Revision 1.159 1999/10/01 10:05:42 peter
  1221. + procedure directive support in const declarations, fixes bug 232
  1222. }