pdecvar.pas 54 KB

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