pdecl.pas 51 KB

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