pdecvar.pas 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Parses variable declarations. Used for var statement and record
  5. definitions
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit pdecvar;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. symsym,symdef;
  24. function read_property_dec(aclass:tobjectdef):tpropertysym;
  25. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  26. implementation
  27. uses
  28. { common }
  29. cutils,cclasses,
  30. { global }
  31. globtype,globals,tokens,verbose,
  32. systems,
  33. { symtable }
  34. symconst,symbase,symtype,symtable,defutil,defcmp,
  35. fmodule,
  36. { pass 1 }
  37. node,pass_1,
  38. nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nmem,nutils,
  39. { codegen }
  40. ncgutil,
  41. { parser }
  42. scanner,
  43. pbase,pexpr,ptype,ptconst,pdecsub,
  44. { link }
  45. import
  46. {$ifdef Delphi}
  47. ,dmisc
  48. ,sysutils
  49. {$endif}
  50. ;
  51. function read_property_dec(aclass:tobjectdef):tpropertysym;
  52. { convert a node tree to symlist and return the last
  53. symbol }
  54. function parse_symlist(pl:tsymlist;var def:tdef):boolean;
  55. var
  56. idx : longint;
  57. sym : tsym;
  58. srsymtable : tsymtable;
  59. st : tsymtable;
  60. begin
  61. result:=true;
  62. def:=nil;
  63. if token=_ID then
  64. begin
  65. if assigned(aclass) then
  66. sym:=search_class_member(aclass,pattern)
  67. else
  68. searchsym(pattern,sym,srsymtable);
  69. if assigned(sym) then
  70. begin
  71. case sym.typ of
  72. varsym :
  73. begin
  74. pl.addsym(sl_load,sym);
  75. def:=tvarsym(sym).vartype.def;
  76. end;
  77. procsym :
  78. begin
  79. pl.addsym(sl_call,sym);
  80. end;
  81. end;
  82. end
  83. else
  84. begin
  85. Message1(parser_e_illegal_field_or_method,pattern);
  86. result:=false;
  87. end;
  88. consume(_ID);
  89. repeat
  90. case token of
  91. _ID,
  92. _SEMICOLON :
  93. begin
  94. break;
  95. end;
  96. _POINT :
  97. begin
  98. consume(_POINT);
  99. if assigned(def) then
  100. begin
  101. st:=def.getsymtable(gs_record);
  102. if assigned(st) then
  103. begin
  104. sym:=searchsymonlyin(st,pattern);
  105. if assigned(sym) then
  106. begin
  107. pl.addsym(sl_subscript,sym);
  108. case sym.typ of
  109. varsym :
  110. def:=tvarsym(sym).vartype.def;
  111. else
  112. begin
  113. Message1(sym_e_illegal_field,pattern);
  114. result:=false;
  115. end;
  116. end;
  117. end
  118. else
  119. begin
  120. Message1(sym_e_illegal_field,pattern);
  121. result:=false;
  122. end;
  123. end
  124. else
  125. begin
  126. Message(cg_e_invalid_qualifier);
  127. result:=false;
  128. end;
  129. end
  130. else
  131. begin
  132. Message(cg_e_invalid_qualifier);
  133. result:=false;
  134. end;
  135. consume(_ID);
  136. end;
  137. _LECKKLAMMER :
  138. begin
  139. consume(_LECKKLAMMER);
  140. repeat
  141. if def.deftype=arraydef then
  142. begin
  143. idx:=get_intconst;
  144. pl.addconst(sl_vec,idx);
  145. def:=tarraydef(def).elementtype.def;
  146. end
  147. else
  148. begin
  149. Message(cg_e_invalid_qualifier);
  150. result:=false;
  151. end;
  152. until not try_to_consume(_COMMA);
  153. consume(_RECKKLAMMER);
  154. end;
  155. else
  156. begin
  157. Message(parser_e_ill_property_access_sym);
  158. result:=false;
  159. break;
  160. end;
  161. end;
  162. until false;
  163. end
  164. else
  165. begin
  166. Message(parser_e_ill_property_access_sym);
  167. result:=false;
  168. end;
  169. end;
  170. var
  171. sym : tsym;
  172. p : tpropertysym;
  173. overriden : tsym;
  174. hs : string;
  175. varspez : tvarspez;
  176. s : string;
  177. tt : ttype;
  178. arraytype : ttype;
  179. def : tdef;
  180. pt : tnode;
  181. propname : stringid;
  182. sc : tsinglelist;
  183. oldregisterdef : boolean;
  184. readvs,
  185. hvs : tvarsym;
  186. readprocdef,
  187. writeprocdef : tprocvardef;
  188. begin
  189. { Generate temp procvardefs to search for matching read/write
  190. procedures. the readprocdef will store all definitions }
  191. oldregisterdef:=registerdef;
  192. registerdef:=false;
  193. readprocdef:=tprocvardef.create(normal_function_level);
  194. writeprocdef:=tprocvardef.create(normal_function_level);
  195. registerdef:=oldregisterdef;
  196. { make it method pointers }
  197. if assigned(aclass) then
  198. begin
  199. include(readprocdef.procoptions,po_methodpointer);
  200. include(writeprocdef.procoptions,po_methodpointer);
  201. end;
  202. if token<>_ID then
  203. begin
  204. consume(_ID);
  205. consume(_SEMICOLON);
  206. exit;
  207. end;
  208. { Generate propertysym and insert in symtablestack }
  209. p:=tpropertysym.create(orgpattern);
  210. symtablestack.insert(p);
  211. propname:=pattern;
  212. consume(_ID);
  213. { Set the symtablestack to the parast of readprop so
  214. temp defs will be destroyed after declaration }
  215. readprocdef.parast.next:=symtablestack;
  216. symtablestack:=readprocdef.parast;
  217. { property parameters ? }
  218. if token=_LECKKLAMMER then
  219. begin
  220. if (sp_published in current_object_option) then
  221. Message(parser_e_cant_publish_that_property);
  222. { create a list of the parameters }
  223. sc:=tsinglelist.create;
  224. consume(_LECKKLAMMER);
  225. inc(testcurobject);
  226. repeat
  227. if token=_VAR then
  228. begin
  229. consume(_VAR);
  230. varspez:=vs_var;
  231. end
  232. else if token=_CONST then
  233. begin
  234. consume(_CONST);
  235. varspez:=vs_const;
  236. end
  237. else if (idtoken=_OUT) and (m_out in aktmodeswitches) then
  238. begin
  239. consume(_OUT);
  240. varspez:=vs_out;
  241. end
  242. else
  243. varspez:=vs_value;
  244. sc.reset;
  245. repeat
  246. readvs:=tvarsym.create(orgpattern,varspez,generrortype);
  247. readprocdef.parast.insert(readvs);
  248. sc.insert(readvs);
  249. consume(_ID);
  250. until not try_to_consume(_COMMA);
  251. if token=_COLON then
  252. begin
  253. consume(_COLON);
  254. if token=_ARRAY then
  255. begin
  256. consume(_ARRAY);
  257. consume(_OF);
  258. { define range and type of range }
  259. tt.setdef(tarraydef.create(0,-1,s32inttype));
  260. { define field type }
  261. single_type(arraytype,s,false);
  262. tarraydef(tt.def).setelementtype(arraytype);
  263. end
  264. else
  265. single_type(tt,s,false);
  266. end
  267. else
  268. tt:=cformaltype;
  269. readvs:=tvarsym(sc.first);
  270. while assigned(readvs) do
  271. begin
  272. readprocdef.concatpara(nil,tt,readvs,nil,false);
  273. { also update the writeprocdef }
  274. hvs:=tvarsym.create(readvs.realname,vs_value,generrortype);
  275. writeprocdef.parast.insert(hvs);
  276. writeprocdef.concatpara(nil,tt,hvs,nil,false);
  277. readvs:=tvarsym(readvs.listnext);
  278. end;
  279. until not try_to_consume(_SEMICOLON);
  280. sc.free;
  281. dec(testcurobject);
  282. consume(_RECKKLAMMER);
  283. { the parser need to know if a property has parameters, the
  284. index parameter doesn't count (PFV) }
  285. if readprocdef.minparacount>0 then
  286. include(p.propoptions,ppo_hasparameters);
  287. end;
  288. { overriden property ? }
  289. { force property interface
  290. there is a property parameter
  291. a global property }
  292. if (token=_COLON) or (readprocdef.minparacount>0) or (aclass=nil) then
  293. begin
  294. consume(_COLON);
  295. single_type(p.proptype,hs,false);
  296. if (idtoken=_INDEX) then
  297. begin
  298. consume(_INDEX);
  299. pt:=comp_expr(true);
  300. if is_constnode(pt) and
  301. is_ordinal(pt.resulttype.def) and
  302. (not is_64bitint(pt.resulttype.def)) then
  303. p.index:=tordconstnode(pt).value
  304. else
  305. begin
  306. Message(parser_e_invalid_property_index_value);
  307. p.index:=0;
  308. end;
  309. p.indextype.setdef(pt.resulttype.def);
  310. include(p.propoptions,ppo_indexed);
  311. { concat a longint to the para templates }
  312. hvs:=tvarsym.create('$index',vs_value,p.indextype);
  313. readprocdef.parast.insert(hvs);
  314. readprocdef.concatpara(nil,p.indextype,hvs,nil,false);
  315. hvs:=tvarsym.create('$index',vs_value,p.indextype);
  316. writeprocdef.parast.insert(hvs);
  317. writeprocdef.concatpara(nil,p.indextype,hvs,nil,false);
  318. pt.free;
  319. end;
  320. end
  321. else
  322. begin
  323. { do an property override }
  324. overriden:=search_class_member(aclass.childof,propname);
  325. if assigned(overriden) and (overriden.typ=propertysym) then
  326. begin
  327. p.dooverride(tpropertysym(overriden));
  328. end
  329. else
  330. begin
  331. p.proptype:=generrortype;
  332. message(parser_e_no_property_found_to_override);
  333. end;
  334. end;
  335. if (sp_published in current_object_option) and
  336. not(p.proptype.def.is_publishable) then
  337. Message(parser_e_cant_publish_that_property);
  338. if try_to_consume(_READ) then
  339. begin
  340. p.readaccess.clear;
  341. if parse_symlist(p.readaccess,def) then
  342. begin
  343. sym:=p.readaccess.firstsym^.sym;
  344. case sym.typ of
  345. procsym :
  346. begin
  347. { read is function returning the type of the property }
  348. readprocdef.rettype:=p.proptype;
  349. { Insert hidden parameters }
  350. handle_calling_convention(readprocdef);
  351. calc_parast(readprocdef);
  352. { search procdefs matching readprocdef }
  353. p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.para,p.proptype.def,[cpo_allowdefaults]);
  354. if not assigned(p.readaccess.procdef) then
  355. Message(parser_e_ill_property_access_sym);
  356. end;
  357. varsym :
  358. begin
  359. if not assigned(def) then
  360. internalerror(200310071);
  361. if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
  362. begin
  363. { property parameters are allowed if this is
  364. an indexed property, because the index is then
  365. the parameter.
  366. Note: In the help of Kylix it is written
  367. that it isn't allowed, but the compiler accepts it (PFV) }
  368. if (ppo_hasparameters in p.propoptions) then
  369. Message(parser_e_ill_property_access_sym);
  370. end
  371. else
  372. IncompatibleTypes(def,p.proptype.def);
  373. end;
  374. else
  375. Message(parser_e_ill_property_access_sym);
  376. end;
  377. end;
  378. end;
  379. if try_to_consume(_WRITE) then
  380. begin
  381. p.writeaccess.clear;
  382. if parse_symlist(p.writeaccess,def) then
  383. begin
  384. sym:=p.writeaccess.firstsym^.sym;
  385. case sym.typ of
  386. procsym :
  387. begin
  388. { write is a procedure with an extra value parameter
  389. of the of the property }
  390. writeprocdef.rettype:=voidtype;
  391. hvs:=tvarsym.create('$value',vs_value,p.proptype);
  392. writeprocdef.parast.insert(hvs);
  393. writeprocdef.concatpara(nil,p.proptype,hvs,nil,false);
  394. { Insert hidden parameters }
  395. handle_calling_convention(writeprocdef);
  396. calc_parast(writeprocdef);
  397. { search procdefs matching writeprocdef }
  398. p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.para,writeprocdef.rettype.def,[cpo_allowdefaults]);
  399. if not assigned(p.writeaccess.procdef) then
  400. Message(parser_e_ill_property_access_sym);
  401. end;
  402. varsym :
  403. begin
  404. if not assigned(def) then
  405. internalerror(200310072);
  406. if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
  407. begin
  408. { property parameters are allowed if this is
  409. an indexed property, because the index is then
  410. the parameter.
  411. Note: In the help of Kylix it is written
  412. that it isn't allowed, but the compiler accepts it (PFV) }
  413. if (ppo_hasparameters in p.propoptions) then
  414. Message(parser_e_ill_property_access_sym);
  415. end
  416. else
  417. IncompatibleTypes(def,p.proptype.def);
  418. end;
  419. else
  420. Message(parser_e_ill_property_access_sym);
  421. end;
  422. end;
  423. end;
  424. if assigned(aclass) then
  425. begin
  426. include(p.propoptions,ppo_stored);
  427. if try_to_consume(_STORED) then
  428. begin
  429. p.storedaccess.clear;
  430. case token of
  431. _ID:
  432. begin
  433. { in the case that idtoken=_DEFAULT }
  434. { we have to do nothing except }
  435. { setting ppo_stored, it's the same }
  436. { as stored true }
  437. if idtoken<>_DEFAULT then
  438. begin
  439. if parse_symlist(p.storedaccess,def) then
  440. begin
  441. sym:=p.storedaccess.firstsym^.sym;
  442. case sym.typ of
  443. procsym :
  444. begin
  445. p.storedaccess.procdef:=Tprocsym(sym).search_procdef_nopara_boolret;
  446. if not assigned(p.storedaccess.procdef) then
  447. message(parser_e_ill_property_storage_sym);
  448. end;
  449. varsym :
  450. begin
  451. if not assigned(def) then
  452. internalerror(200310073);
  453. if (ppo_hasparameters in p.propoptions) or
  454. not(is_boolean(def)) then
  455. Message(parser_e_stored_property_must_be_boolean);
  456. end;
  457. else
  458. Message(parser_e_ill_property_access_sym);
  459. end;
  460. end;
  461. end;
  462. end;
  463. _FALSE:
  464. begin
  465. consume(_FALSE);
  466. exclude(p.propoptions,ppo_stored);
  467. end;
  468. _TRUE:
  469. consume(_TRUE);
  470. end;
  471. end;
  472. end;
  473. if try_to_consume(_DEFAULT) then
  474. begin
  475. if not(is_ordinal(p.proptype.def) or
  476. is_64bitint(p.proptype.def) or
  477. is_class(p.proptype.def) or
  478. is_single(p.proptype.def) or
  479. (p.proptype.def.deftype in [classrefdef,pointerdef]) or
  480. ((p.proptype.def.deftype=setdef) and
  481. (tsetdef(p.proptype.def).settype=smallset))) or
  482. ((p.proptype.def.deftype=arraydef) and
  483. (ppo_indexed in p.propoptions)) or
  484. (ppo_hasparameters in p.propoptions) then
  485. begin
  486. Message(parser_e_property_cant_have_a_default_value);
  487. { Error recovery }
  488. pt:=comp_expr(true);
  489. pt.free;
  490. end
  491. else
  492. begin
  493. { Get the result of the default, the firstpass is
  494. needed to support values like -1 }
  495. pt:=comp_expr(true);
  496. if (p.proptype.def.deftype=setdef) and
  497. (pt.nodetype=arrayconstructorn) then
  498. begin
  499. arrayconstructor_to_set(pt);
  500. do_resulttypepass(pt);
  501. end;
  502. inserttypeconv(pt,p.proptype);
  503. if not(is_constnode(pt)) then
  504. Message(parser_e_property_default_value_must_const);
  505. { Set default value }
  506. case pt.nodetype of
  507. setconstn :
  508. p.default:=plongint(tsetconstnode(pt).value_set)^;
  509. ordconstn :
  510. p.default:=tordconstnode(pt).value;
  511. niln :
  512. p.default:=0;
  513. realconstn:
  514. p.default:=longint(single(trealconstnode(pt).value_real));
  515. end;
  516. pt.free;
  517. end;
  518. end
  519. else if try_to_consume(_NODEFAULT) then
  520. begin
  521. p.default:=0;
  522. end;
  523. { remove temporary procvardefs }
  524. symtablestack:=symtablestack.next;
  525. readprocdef.free;
  526. writeprocdef.free;
  527. result:=p;
  528. end;
  529. const
  530. variantrecordlevel : longint = 0;
  531. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  532. { reads the filed of a record into a }
  533. { symtablestack, if record=false }
  534. { variants are forbidden, so this procedure }
  535. { can be used to read object fields }
  536. { if absolute is true, ABSOLUTE and file }
  537. { types are allowed }
  538. { => the procedure is also used to read }
  539. { a sequence of variable declaration }
  540. procedure insert_syms(sc : tsinglelist;tt : ttype;is_threadvar : boolean; addsymopts : tsymoptions);
  541. { inserts the symbols of sc in st with def as definition or sym as ttypesym, sc is disposed }
  542. var
  543. vs,vs2 : tvarsym;
  544. begin
  545. vs:=tvarsym(sc.first);
  546. while assigned(vs) do
  547. begin
  548. vs.vartype:=tt;
  549. { insert any additional hint directives }
  550. vs.symoptions := vs.symoptions + addsymopts;
  551. if (sp_static in current_object_option) then
  552. include(vs.symoptions,sp_static);
  553. if is_threadvar then
  554. include(vs.varoptions,vo_is_thread_var);
  555. { static data fields are inserted in the globalsymtable }
  556. if (symtablestack.symtabletype=objectsymtable) and
  557. (sp_static in current_object_option) then
  558. begin
  559. vs2:=tvarsym.create('$'+lower(symtablestack.name^)+'_'+vs.name,vs_value,tt);
  560. symtablestack.defowner.owner.insert(vs2);
  561. insertbssdata(vs2);
  562. end
  563. else
  564. begin
  565. { external data is not possible here }
  566. case symtablestack.symtabletype of
  567. globalsymtable,
  568. staticsymtable :
  569. insertbssdata(vs);
  570. recordsymtable,
  571. objectsymtable :
  572. tabstractrecordsymtable(symtablestack).insertfield(vs,false);
  573. end;
  574. end;
  575. vs:=tvarsym(vs.listnext);
  576. end;
  577. end;
  578. procedure read_default_value(sc : tsinglelist;tt : ttype;is_threadvar : boolean);
  579. var
  580. vs : tvarsym;
  581. tcsym : ttypedconstsym;
  582. begin
  583. vs:=tvarsym(sc.first);
  584. if assigned(vs.listnext) then
  585. Message(parser_e_initialized_only_one_var);
  586. if is_threadvar then
  587. Message(parser_e_initialized_not_for_threadvar);
  588. if symtablestack.symtabletype=localsymtable then
  589. begin
  590. consume(_EQUAL);
  591. tcsym:=ttypedconstsym.createtype('default'+vs.realname,tt,false);
  592. vs.defaultconstsym:=tcsym;
  593. symtablestack.insert(tcsym);
  594. insertconstdata(tcsym);
  595. readtypedconst(tt,tcsym,false);
  596. end
  597. else
  598. begin
  599. tcsym:=ttypedconstsym.createtype(vs.realname,tt,true);
  600. tcsym.fileinfo:=vs.fileinfo;
  601. symtablestack.replace(vs,tcsym);
  602. vs.free;
  603. insertconstdata(tcsym);
  604. consume(_EQUAL);
  605. readtypedconst(tt,tcsym,true);
  606. end;
  607. end;
  608. var
  609. sc : tsinglelist;
  610. old_block_type : tblock_type;
  611. symdone : boolean;
  612. { to handle absolute }
  613. abssym : tabsolutesym;
  614. { c var }
  615. newtype : ttypesym;
  616. is_dll,
  617. is_gpc_name,is_cdecl,
  618. extern_var,export_var : boolean;
  619. old_current_object_option : tsymoptions;
  620. hs,sorg,C_name,dll_name : string;
  621. tt,casetype : ttype;
  622. { maxsize contains the max. size of a variant }
  623. { startvarrec contains the start of the variant part of a record }
  624. maxsize, startvarrecsize : longint;
  625. usedalign,
  626. maxalignment,startvarrecalign : byte;
  627. hp,pt : tnode;
  628. vs,vs2 : tvarsym;
  629. srsym : tsym;
  630. oldsymtablestack,
  631. srsymtable : tsymtable;
  632. unionsymtable : trecordsymtable;
  633. offset : longint;
  634. uniondef : trecorddef;
  635. unionsym : tvarsym;
  636. uniontype : ttype;
  637. dummysymoptions : tsymoptions;
  638. begin
  639. old_current_object_option:=current_object_option;
  640. { all variables are public if not in a object declaration }
  641. if not is_object then
  642. current_object_option:=[sp_public];
  643. old_block_type:=block_type;
  644. block_type:=bt_type;
  645. is_gpc_name:=false;
  646. { Force an expected ID error message }
  647. if not (token in [_ID,_CASE,_END]) then
  648. consume(_ID);
  649. { read vars }
  650. sc:=tsinglelist.create;
  651. while (token=_ID) and
  652. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  653. begin
  654. sorg:=orgpattern;
  655. sc.reset;
  656. repeat
  657. vs:=tvarsym.create(orgpattern,vs_value,generrortype);
  658. symtablestack.insert(vs);
  659. if assigned(vs.owner) then
  660. sc.insert(vs)
  661. else
  662. vs.free;
  663. consume(_ID);
  664. until not try_to_consume(_COMMA);
  665. consume(_COLON);
  666. if (m_gpc in aktmodeswitches) and
  667. not(is_record or is_object or is_threadvar) and
  668. (token=_ID) and (orgpattern='__asmname__') then
  669. begin
  670. consume(_ID);
  671. C_name:=get_stringconst;
  672. Is_gpc_name:=true;
  673. end;
  674. { this is needed for Delphi mode at least
  675. but should be OK for all modes !! (PM) }
  676. ignore_equal:=true;
  677. if is_record or is_object then
  678. begin
  679. { for records, don't search the recordsymtable for
  680. the symbols of the types }
  681. oldsymtablestack:=symtablestack;
  682. symtablestack:=symtablestack.next;
  683. read_type(tt,'',false);
  684. symtablestack:=oldsymtablestack;
  685. end
  686. else
  687. read_type(tt,'',false);
  688. { Process procvar directives }
  689. if (tt.def.deftype=procvardef) and
  690. (tt.def.typesym=nil) and
  691. is_proc_directive(token,true) then
  692. begin
  693. newtype:=ttypesym.create('unnamed',tt);
  694. parse_var_proc_directives(tsym(newtype));
  695. newtype.restype.def:=nil;
  696. tt.def.typesym:=nil;
  697. newtype.free;
  698. end;
  699. { types that use init/final are not allowed in variant parts, but
  700. classes are allowed }
  701. if (variantrecordlevel>0) and
  702. (tt.def.needs_inittable and not is_class(tt.def)) then
  703. Message(parser_e_cant_use_inittable_here);
  704. ignore_equal:=false;
  705. symdone:=false;
  706. if is_gpc_name then
  707. begin
  708. vs:=tvarsym(sc.first);
  709. if assigned(vs.listnext) then
  710. Message(parser_e_absolute_only_one_var);
  711. vs.vartype:=tt;
  712. include(vs.varoptions,vo_is_C_var);
  713. vs.set_mangledname(target_info.Cprefix+sorg);
  714. include(vs.varoptions,vo_is_external);
  715. symdone:=true;
  716. end;
  717. { check for absolute }
  718. if not symdone and
  719. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  720. begin
  721. consume(_ABSOLUTE);
  722. abssym:=nil;
  723. { only allowed for one var }
  724. vs:=tvarsym(sc.first);
  725. if assigned(vs.listnext) then
  726. Message(parser_e_absolute_only_one_var);
  727. { parse the rest }
  728. pt:=expr;
  729. { check allowed absolute types }
  730. if (pt.nodetype=stringconstn) or
  731. (is_constcharnode(pt)) then
  732. begin
  733. abssym:=tabsolutesym.create(vs.realname,tt);
  734. abssym.fileinfo:=vs.fileinfo;
  735. if pt.nodetype=stringconstn then
  736. hs:=strpas(tstringconstnode(pt).value_str)
  737. else
  738. hs:=chr(tordconstnode(pt).value);
  739. consume(token);
  740. abssym.abstyp:=toasm;
  741. abssym.asmname:=stringdup(hs);
  742. { replace the varsym }
  743. symtablestack.replace(vs,abssym);
  744. vs.free;
  745. end
  746. { address }
  747. else if is_constintnode(pt) and
  748. ((target_info.system in [system_i386_go32v2,system_i386_watcom,
  749. system_i386_wdosx,system_i386_win32]) or
  750. (m_objfpc in aktmodeswitches) or
  751. (m_delphi in aktmodeswitches)) then
  752. begin
  753. abssym:=tabsolutesym.create(vs.realname,tt);
  754. abssym.fileinfo:=vs.fileinfo;
  755. abssym.abstyp:=toaddr;
  756. abssym.fieldoffset:=tordconstnode(pt).value;
  757. {$ifdef i386}
  758. abssym.absseg:=false;
  759. if (target_info.system in [system_i386_go32v2,system_i386_watcom]) and
  760. try_to_consume(_COLON) then
  761. begin
  762. pt.free;
  763. pt:=expr;
  764. if is_constintnode(pt) then
  765. begin
  766. abssym.fieldoffset:=abssym.fieldoffset shl 4+tordconstnode(pt).value;
  767. abssym.absseg:=true;
  768. end
  769. else
  770. Message(type_e_ordinal_expr_expected);
  771. end;
  772. {$endif i386}
  773. symtablestack.replace(vs,abssym);
  774. vs.free;
  775. end
  776. { variable }
  777. else
  778. begin
  779. { remove subscriptn before checking for loadn }
  780. hp:=pt;
  781. while (hp.nodetype in [subscriptn,typeconvn,vecn]) do
  782. hp:=tunarynode(hp).left;
  783. if (hp.nodetype=loadn) then
  784. begin
  785. { we should check the result type of loadn }
  786. if not (tloadnode(hp).symtableentry.typ in [varsym,typedconstsym]) then
  787. Message(parser_e_absolute_only_to_var_or_const);
  788. abssym:=tabsolutesym.create(vs.realname,tt);
  789. abssym.fileinfo:=vs.fileinfo;
  790. abssym.abstyp:=tovar;
  791. abssym.ref:=node_to_symlist(pt);
  792. symtablestack.replace(vs,abssym);
  793. vs.free;
  794. end
  795. else
  796. Message(parser_e_absolute_only_to_var_or_const);
  797. end;
  798. if assigned(abssym) then
  799. begin
  800. { try to consume the hint directives with absolute symbols }
  801. dummysymoptions:=[];
  802. try_consume_hintdirective(dummysymoptions);
  803. abssym.symoptions := abssym.symoptions + dummysymoptions;
  804. end;
  805. pt.free;
  806. symdone:=true;
  807. end;
  808. { Records and objects can't have default values }
  809. if is_record or is_object then
  810. begin
  811. { try to parse the hint directives }
  812. dummysymoptions:=[];
  813. try_consume_hintdirective(dummysymoptions);
  814. { for a record there doesn't need to be a ; before the END or ) }
  815. if not(token in [_END,_RKLAMMER]) then
  816. consume(_SEMICOLON);
  817. end
  818. else
  819. begin
  820. { Process procvar directives before = and ; }
  821. if (tt.def.deftype=procvardef) and
  822. (tt.def.typesym=nil) and
  823. is_proc_directive(token,true) then
  824. begin
  825. newtype:=ttypesym.create('unnamed',tt);
  826. parse_var_proc_directives(tsym(newtype));
  827. newtype.restype.def:=nil;
  828. tt.def.typesym:=nil;
  829. newtype.free;
  830. end;
  831. { try to parse the hint directives }
  832. dummysymoptions:=[];
  833. try_consume_hintdirective(dummysymoptions);
  834. { Handling of Delphi typed const = initialized vars ! }
  835. { When should this be rejected ?
  836. - in parasymtable
  837. - in record or object
  838. - ... (PM) }
  839. if (token=_EQUAL) and
  840. not(m_tp7 in aktmodeswitches) and
  841. not(symtablestack.symtabletype in [parasymtable]) and
  842. not is_record and
  843. not is_object then
  844. begin
  845. read_default_value(sc,tt,is_threadvar);
  846. { for locals we've created typedconstsym with a different name }
  847. if symtablestack.symtabletype<>localsymtable then
  848. symdone:=true;
  849. end;
  850. consume(_SEMICOLON);
  851. end;
  852. { Add calling convention for procvars }
  853. if (tt.def.deftype=procvardef) and
  854. (tt.def.typesym=nil) then
  855. begin
  856. { Parse procvar directives after ; }
  857. if is_proc_directive(token,true) then
  858. begin
  859. newtype:=ttypesym.create('unnamed',tt);
  860. parse_var_proc_directives(tsym(newtype));
  861. newtype.restype.def:=nil;
  862. tt.def.typesym:=nil;
  863. newtype.free;
  864. end;
  865. { Add calling convention for procvar }
  866. handle_calling_convention(tprocvardef(tt.def));
  867. calc_parast(tprocvardef(tt.def));
  868. { Handling of Delphi typed const = initialized vars ! }
  869. if (token=_EQUAL) and
  870. not(m_tp7 in aktmodeswitches) and
  871. not(symtablestack.symtabletype in [parasymtable]) and
  872. not is_record and
  873. not is_object then
  874. begin
  875. read_default_value(sc,tt,is_threadvar);
  876. consume(_SEMICOLON);
  877. symdone:=true;
  878. end;
  879. end;
  880. { Check for variable directives }
  881. if not symdone and (token=_ID) then
  882. begin
  883. { Check for C Variable declarations }
  884. if (m_cvar_support in aktmodeswitches) and
  885. not(is_record or is_object or is_threadvar) and
  886. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  887. begin
  888. { only allowed for one var }
  889. vs:=tvarsym(sc.first);
  890. if assigned(vs.listnext) then
  891. Message(parser_e_absolute_only_one_var);
  892. { set type of the var }
  893. vs.vartype:=tt;
  894. vs.symoptions := vs.symoptions + dummysymoptions;
  895. { defaults }
  896. is_dll:=false;
  897. is_cdecl:=false;
  898. extern_var:=false;
  899. export_var:=false;
  900. C_name:=sorg;
  901. { cdecl }
  902. if idtoken=_CVAR then
  903. begin
  904. consume(_CVAR);
  905. consume(_SEMICOLON);
  906. is_cdecl:=true;
  907. C_name:=target_info.Cprefix+sorg;
  908. end;
  909. { external }
  910. if idtoken=_EXTERNAL then
  911. begin
  912. consume(_EXTERNAL);
  913. extern_var:=true;
  914. end;
  915. { export }
  916. if idtoken in [_EXPORT,_PUBLIC] then
  917. begin
  918. consume(_ID);
  919. if extern_var or
  920. (symtablestack.symtabletype in [parasymtable,localsymtable]) then
  921. Message(parser_e_not_external_and_export)
  922. else
  923. export_var:=true;
  924. end;
  925. { external and export need a name after when no cdecl is used }
  926. if not is_cdecl then
  927. begin
  928. { dll name ? }
  929. if (extern_var) and (idtoken<>_NAME) then
  930. begin
  931. is_dll:=true;
  932. dll_name:=get_stringconst;
  933. end;
  934. consume(_NAME);
  935. C_name:=get_stringconst;
  936. end;
  937. { consume the ; when export or external is used }
  938. if extern_var or export_var then
  939. consume(_SEMICOLON);
  940. { set some vars options }
  941. if is_dll then
  942. include(vs.varoptions,vo_is_dll_var)
  943. else
  944. include(vs.varoptions,vo_is_C_var);
  945. vs.set_mangledname(C_Name);
  946. if export_var then
  947. begin
  948. inc(vs.refs);
  949. include(vs.varoptions,vo_is_exported);
  950. end;
  951. if extern_var then
  952. include(vs.varoptions,vo_is_external);
  953. { insert in the datasegment when it is not external }
  954. if (not extern_var) then
  955. insertbssdata(vs);
  956. { now we can insert it in the import lib if its a dll, or
  957. add it to the externals }
  958. if extern_var then
  959. begin
  960. if is_dll then
  961. begin
  962. if not(current_module.uses_imports) then
  963. begin
  964. current_module.uses_imports:=true;
  965. importlib.preparelib(current_module.modulename^);
  966. end;
  967. importlib.importvariable(vs,C_name,dll_name);
  968. end
  969. else
  970. if target_info.DllScanSupported then
  971. current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
  972. end;
  973. symdone:=true;
  974. end
  975. else
  976. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  977. begin
  978. include(current_object_option,sp_static);
  979. insert_syms(sc,tt,false,dummysymoptions);
  980. exclude(current_object_option,sp_static);
  981. consume(_STATIC);
  982. consume(_SEMICOLON);
  983. symdone:=true;
  984. end;
  985. end;
  986. { insert it in the symtable, if not done yet }
  987. if not symdone then
  988. begin
  989. { save object option, because we can turn of the sp_published }
  990. if (sp_published in current_object_option) and
  991. not(is_class(tt.def)) then
  992. begin
  993. Message(parser_e_cant_publish_that);
  994. exclude(current_object_option,sp_published);
  995. { recover by changing access type to public }
  996. vs2:=tvarsym(sc.first);
  997. while assigned (vs2) do
  998. begin
  999. exclude(vs2.symoptions,sp_published);
  1000. include(vs2.symoptions,sp_public);
  1001. vs2:=tvarsym(vs2.listnext);
  1002. end;
  1003. end
  1004. else
  1005. if (sp_published in current_object_option) and
  1006. not(oo_can_have_published in tobjectdef(tt.def).objectoptions) then
  1007. begin
  1008. Message(parser_e_only_publishable_classes_can__be_published);
  1009. exclude(current_object_option,sp_published);
  1010. end;
  1011. insert_syms(sc,tt,is_threadvar,dummysymoptions);
  1012. current_object_option:=old_current_object_option;
  1013. end;
  1014. end;
  1015. { Check for Case }
  1016. if is_record and (token=_CASE) then
  1017. begin
  1018. maxsize:=0;
  1019. maxalignment:=0;
  1020. consume(_CASE);
  1021. sorg:=orgpattern;
  1022. hs:=pattern;
  1023. searchsym(hs,srsym,srsymtable);
  1024. { may be only a type: }
  1025. if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
  1026. begin
  1027. { for records, don't search the recordsymtable for
  1028. the symbols of the types }
  1029. oldsymtablestack:=symtablestack;
  1030. symtablestack:=symtablestack.next;
  1031. read_type(casetype,'',true);
  1032. symtablestack:=oldsymtablestack;
  1033. end
  1034. else
  1035. begin
  1036. consume(_ID);
  1037. consume(_COLON);
  1038. { for records, don't search the recordsymtable for
  1039. the symbols of the types }
  1040. oldsymtablestack:=symtablestack;
  1041. symtablestack:=symtablestack.next;
  1042. read_type(casetype,'',true);
  1043. symtablestack:=oldsymtablestack;
  1044. vs:=tvarsym.create(sorg,vs_value,casetype);
  1045. tabstractrecordsymtable(symtablestack).insertfield(vs,true);
  1046. end;
  1047. if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
  1048. Message(type_e_ordinal_expr_expected);
  1049. consume(_OF);
  1050. UnionSymtable:=trecordsymtable.create(aktpackrecords);
  1051. Unionsymtable.next:=symtablestack;
  1052. registerdef:=false;
  1053. UnionDef:=trecorddef.create(unionsymtable);
  1054. uniondef.isunion:=true;
  1055. if assigned(symtablestack.defowner) then
  1056. Uniondef.owner:=symtablestack.defowner.owner;
  1057. registerdef:=true;
  1058. startvarrecsize:=UnionSymtable.datasize;
  1059. startvarrecalign:=UnionSymtable.fieldalignment;
  1060. symtablestack:=UnionSymtable;
  1061. repeat
  1062. repeat
  1063. pt:=comp_expr(true);
  1064. if not(pt.nodetype=ordconstn) then
  1065. Message(cg_e_illegal_expression);
  1066. pt.free;
  1067. if token=_COMMA then
  1068. consume(_COMMA)
  1069. else
  1070. break;
  1071. until false;
  1072. consume(_COLON);
  1073. { read the vars }
  1074. consume(_LKLAMMER);
  1075. inc(variantrecordlevel);
  1076. if token<>_RKLAMMER then
  1077. read_var_decs(true,false,false);
  1078. dec(variantrecordlevel);
  1079. consume(_RKLAMMER);
  1080. { calculates maximal variant size }
  1081. maxsize:=max(maxsize,unionsymtable.datasize);
  1082. maxalignment:=max(maxalignment,unionsymtable.fieldalignment);
  1083. { the items of the next variant are overlayed }
  1084. unionsymtable.datasize:=startvarrecsize;
  1085. unionsymtable.fieldalignment:=startvarrecalign;
  1086. if (token<>_END) and (token<>_RKLAMMER) then
  1087. consume(_SEMICOLON)
  1088. else
  1089. break;
  1090. until (token=_END) or (token=_RKLAMMER);
  1091. { at last set the record size to that of the biggest variant }
  1092. unionsymtable.datasize:=maxsize;
  1093. unionsymtable.fieldalignment:=maxalignment;
  1094. uniontype.def:=uniondef;
  1095. uniontype.sym:=nil;
  1096. UnionSym:=tvarsym.create('$case',vs_value,uniontype);
  1097. symtablestack:=symtablestack.next;
  1098. { Align the offset where the union symtable is added }
  1099. if (trecordsymtable(symtablestack).usefieldalignment=-1) then
  1100. usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
  1101. else
  1102. usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.recordalignmax);
  1103. offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
  1104. trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
  1105. if maxalignment>trecordsymtable(symtablestack).fieldalignment then
  1106. trecordsymtable(symtablestack).fieldalignment:=maxalignment;
  1107. trecordsymtable(symtablestack).insertunionst(Unionsymtable,offset);
  1108. Unionsym.owner:=nil;
  1109. unionsym.free;
  1110. uniondef.owner:=nil;
  1111. uniondef.free;
  1112. end;
  1113. block_type:=old_block_type;
  1114. current_object_option:=old_current_object_option;
  1115. { free the list }
  1116. sc.free;
  1117. end;
  1118. end.
  1119. {
  1120. $Log$
  1121. Revision 1.68 2004-02-26 16:10:23 peter
  1122. * another procvar directive fix, this time for initialized vars
  1123. Revision 1.67 2004/02/20 21:55:59 peter
  1124. * procvar cleanup
  1125. Revision 1.66 2004/02/17 15:57:49 peter
  1126. - fix rtti generation for properties containing sl_vec
  1127. - fix crash when overloaded operator is not available
  1128. - fix record alignment for C style variant records
  1129. Revision 1.65 2004/02/12 15:54:03 peter
  1130. * make extcycle is working again
  1131. Revision 1.64 2004/02/03 22:32:54 peter
  1132. * renamed xNNbittype to xNNinttype
  1133. * renamed registers32 to registersint
  1134. * replace some s32bit,u32bit with torddef([su]inttype).def.typ
  1135. Revision 1.63 2004/01/31 17:45:17 peter
  1136. * Change several $ifdef i386 to x86
  1137. * Change several OS_32 to OS_INT/OS_ADDR
  1138. Revision 1.62 2004/01/29 16:51:29 peter
  1139. * fixed alignment calculation for variant records
  1140. * fixed alignment padding of records
  1141. Revision 1.61 2004/01/28 22:16:31 peter
  1142. * more record alignment fixes
  1143. Revision 1.60 2004/01/28 20:30:18 peter
  1144. * record alignment splitted in fieldalignment and recordalignment,
  1145. the latter is used when this record is inserted in another record.
  1146. Revision 1.59 2003/12/10 16:37:01 peter
  1147. * global property support for fpc modes
  1148. Revision 1.58 2003/11/23 17:05:15 peter
  1149. * register calling is left-right
  1150. * parameter ordering
  1151. * left-right calling inserts result parameter last
  1152. Revision 1.57 2003/10/28 15:36:01 peter
  1153. * absolute to object field supported, fixes tb0458
  1154. Revision 1.56 2003/10/05 12:55:37 peter
  1155. * allow absolute with value for win32,wdos
  1156. Revision 1.55 2003/10/03 14:45:09 peter
  1157. * more proc directive for procvar fixes
  1158. Revision 1.54 2003/10/02 21:13:09 peter
  1159. * procvar directive parsing fixes
  1160. Revision 1.53 2003/10/02 15:12:07 peter
  1161. * fix type parsing in records
  1162. Revision 1.52 2003/10/01 19:05:33 peter
  1163. * searchsym_type to search for type definitions. It ignores
  1164. records,objects and parameters
  1165. Revision 1.51 2003/09/23 17:56:05 peter
  1166. * locals and paras are allocated in the code generation
  1167. * tvarsym.localloc contains the location of para/local when
  1168. generating code for the current procedure
  1169. Revision 1.50 2003/09/07 14:14:51 florian
  1170. * proper error recovering from invalid published fields
  1171. Revision 1.49 2003/09/05 17:41:12 florian
  1172. * merged Wiktor's Watcom patches in 1.1
  1173. Revision 1.48 2003/07/02 22:18:04 peter
  1174. * paraloc splitted in callerparaloc,calleeparaloc
  1175. * sparc calling convention updates
  1176. Revision 1.47 2003/05/09 17:47:03 peter
  1177. * self moved to hidden parameter
  1178. * removed hdisposen,hnewn,selfn
  1179. Revision 1.46 2003/04/25 20:59:33 peter
  1180. * removed funcretn,funcretsym, function result is now in varsym
  1181. and aliases for result and function name are added using absolutesym
  1182. * vs_hidden parameter for funcret passed in parameter
  1183. * vs_hidden fixes
  1184. * writenode changed to printnode and released from extdebug
  1185. * -vp option added to generate a tree.log with the nodetree
  1186. * nicer printnode for statements, callnode
  1187. Revision 1.45 2003/03/17 18:56:02 peter
  1188. * fix crash with duplicate id
  1189. Revision 1.44 2003/01/02 11:14:02 michael
  1190. + Patch from peter to support initial values for local variables
  1191. Revision 1.43 2002/12/27 15:22:20 peter
  1192. * don't allow initialized threadvars
  1193. Revision 1.42 2002/12/07 14:04:59 carl
  1194. * convert some vars from longint -> byte
  1195. Revision 1.41 2002/11/29 22:31:19 carl
  1196. + unimplemented hint directive added
  1197. * hint directive parsing implemented
  1198. * warning on these directives
  1199. Revision 1.40 2002/11/25 17:43:21 peter
  1200. * splitted defbase in defutil,symutil,defcmp
  1201. * merged isconvertable and is_equal into compare_defs(_ext)
  1202. * made operator search faster by walking the list only once
  1203. Revision 1.39 2002/11/15 16:29:31 peter
  1204. * made tasmsymbol.refs private (merged)
  1205. Revision 1.38 2002/11/15 01:58:53 peter
  1206. * merged changes from 1.0.7 up to 04-11
  1207. - -V option for generating bug report tracing
  1208. - more tracing for option parsing
  1209. - errors for cdecl and high()
  1210. - win32 import stabs
  1211. - win32 records<=8 are returned in eax:edx (turned off by default)
  1212. - heaptrc update
  1213. - more info for temp management in .s file with EXTDEBUG
  1214. Revision 1.37 2002/10/05 15:18:43 carl
  1215. * fix heap leaks
  1216. Revision 1.36 2002/10/05 12:43:26 carl
  1217. * fixes for Delphi 6 compilation
  1218. (warning : Some features do not work under Delphi)
  1219. Revision 1.35 2002/10/04 20:53:05 carl
  1220. * bugfix of crash
  1221. Revision 1.34 2002/10/03 21:22:01 carl
  1222. * don't make the vars regable if they are absolute and their definitions
  1223. are not the same.
  1224. Revision 1.33 2002/09/16 18:08:45 peter
  1225. * fix setting of sp_static
  1226. Revision 1.32 2002/09/09 17:34:15 peter
  1227. * tdicationary.replace added to replace and item in a dictionary. This
  1228. is only allowed for the same name
  1229. * varsyms are inserted in symtable before the types are parsed. This
  1230. fixes the long standing "var longint : longint" bug
  1231. - consume_idlist and idstringlist removed. The loops are inserted
  1232. at the callers place and uses the symtable for duplicate id checking
  1233. Revision 1.31 2002/08/25 19:25:20 peter
  1234. * sym.insert_in_data removed
  1235. * symtable.insertvardata/insertconstdata added
  1236. * removed insert_in_data call from symtable.insert, it needs to be
  1237. called separatly. This allows to deref the address calculation
  1238. * procedures now calculate the parast addresses after the procedure
  1239. directives are parsed. This fixes the cdecl parast problem
  1240. * push_addr_param has an extra argument that specifies if cdecl is used
  1241. or not
  1242. Revision 1.30 2002/07/29 21:23:44 florian
  1243. * more fixes for the ppc
  1244. + wrappers for the tcnvnode.first_* stuff introduced
  1245. Revision 1.29 2002/07/26 21:15:40 florian
  1246. * rewrote the system handling
  1247. Revision 1.28 2002/07/20 11:57:55 florian
  1248. * types.pas renamed to defbase.pas because D6 contains a types
  1249. unit so this would conflicts if D6 programms are compiled
  1250. + Willamette/SSE2 instructions to assembler added
  1251. Revision 1.27 2002/06/10 13:41:26 jonas
  1252. * fixed bug 1985
  1253. Revision 1.26 2002/05/18 13:34:12 peter
  1254. * readded missing revisions
  1255. Revision 1.25 2002/05/16 19:46:43 carl
  1256. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1257. + try to fix temp allocation (still in ifdef)
  1258. + generic constructor calls
  1259. + start of tassembler / tmodulebase class cleanup
  1260. Revision 1.23 2002/04/21 18:57:24 peter
  1261. * fixed memleaks when file can't be opened
  1262. }