pdecvar.pas 54 KB

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