pdecvar.pas 56 KB

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