pdecvar.pas 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  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 (is_dll) and
  961. (target_info.system = system_powerpc_darwin) then
  962. C_Name := target_info.Cprefix+C_Name;
  963. vs.set_mangledname(C_Name);
  964. if export_var then
  965. begin
  966. inc(vs.refs);
  967. include(vs.varoptions,vo_is_exported);
  968. end;
  969. if extern_var then
  970. include(vs.varoptions,vo_is_external);
  971. { insert in the datasegment when it is not external }
  972. if (not extern_var) then
  973. insertbssdata(vs);
  974. { now we can insert it in the import lib if its a dll, or
  975. add it to the externals }
  976. if extern_var then
  977. begin
  978. if is_dll then
  979. begin
  980. if not(current_module.uses_imports) then
  981. begin
  982. current_module.uses_imports:=true;
  983. importlib.preparelib(current_module.modulename^);
  984. end;
  985. importlib.importvariable(vs,C_name,dll_name);
  986. end
  987. else
  988. if target_info.DllScanSupported then
  989. current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
  990. end;
  991. symdone:=true;
  992. end
  993. else
  994. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  995. begin
  996. include(current_object_option,sp_static);
  997. insert_syms(sc,tt,false,dummysymoptions);
  998. exclude(current_object_option,sp_static);
  999. consume(_STATIC);
  1000. consume(_SEMICOLON);
  1001. symdone:=true;
  1002. end;
  1003. end;
  1004. { insert it in the symtable, if not done yet }
  1005. if not symdone then
  1006. begin
  1007. { save object option, because we can turn of the sp_published }
  1008. if (sp_published in current_object_option) and
  1009. not(is_class(tt.def)) then
  1010. begin
  1011. Message(parser_e_cant_publish_that);
  1012. exclude(current_object_option,sp_published);
  1013. { recover by changing access type to public }
  1014. vs2:=tvarsym(sc.first);
  1015. while assigned (vs2) do
  1016. begin
  1017. exclude(vs2.symoptions,sp_published);
  1018. include(vs2.symoptions,sp_public);
  1019. vs2:=tvarsym(vs2.listnext);
  1020. end;
  1021. end
  1022. else
  1023. if (sp_published in current_object_option) and
  1024. not(oo_can_have_published in tobjectdef(tt.def).objectoptions) then
  1025. begin
  1026. Message(parser_e_only_publishable_classes_can__be_published);
  1027. exclude(current_object_option,sp_published);
  1028. end;
  1029. insert_syms(sc,tt,is_threadvar,dummysymoptions);
  1030. current_object_option:=old_current_object_option;
  1031. end;
  1032. end;
  1033. { Check for Case }
  1034. if is_record and (token=_CASE) then
  1035. begin
  1036. maxsize:=0;
  1037. maxalignment:=0;
  1038. consume(_CASE);
  1039. sorg:=orgpattern;
  1040. hs:=pattern;
  1041. searchsym(hs,srsym,srsymtable);
  1042. { may be only a type: }
  1043. if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
  1044. begin
  1045. { for records, don't search the recordsymtable for
  1046. the symbols of the types }
  1047. oldsymtablestack:=symtablestack;
  1048. symtablestack:=symtablestack.next;
  1049. read_type(casetype,'',true);
  1050. symtablestack:=oldsymtablestack;
  1051. end
  1052. else
  1053. begin
  1054. consume(_ID);
  1055. consume(_COLON);
  1056. { for records, don't search the recordsymtable for
  1057. the symbols of the types }
  1058. oldsymtablestack:=symtablestack;
  1059. symtablestack:=symtablestack.next;
  1060. read_type(casetype,'',true);
  1061. symtablestack:=oldsymtablestack;
  1062. vs:=tvarsym.create(sorg,vs_value,casetype);
  1063. tabstractrecordsymtable(symtablestack).insertfield(vs,true);
  1064. end;
  1065. if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
  1066. Message(type_e_ordinal_expr_expected);
  1067. consume(_OF);
  1068. UnionSymtable:=trecordsymtable.create(aktpackrecords);
  1069. Unionsymtable.next:=symtablestack;
  1070. registerdef:=false;
  1071. UnionDef:=trecorddef.create(unionsymtable);
  1072. uniondef.isunion:=true;
  1073. if assigned(symtablestack.defowner) then
  1074. Uniondef.owner:=symtablestack.defowner.owner;
  1075. registerdef:=true;
  1076. startvarrecsize:=UnionSymtable.datasize;
  1077. startvarrecalign:=UnionSymtable.fieldalignment;
  1078. symtablestack:=UnionSymtable;
  1079. repeat
  1080. repeat
  1081. pt:=comp_expr(true);
  1082. if not(pt.nodetype=ordconstn) then
  1083. Message(cg_e_illegal_expression);
  1084. pt.free;
  1085. if token=_COMMA then
  1086. consume(_COMMA)
  1087. else
  1088. break;
  1089. until false;
  1090. consume(_COLON);
  1091. { read the vars }
  1092. consume(_LKLAMMER);
  1093. inc(variantrecordlevel);
  1094. if token<>_RKLAMMER then
  1095. read_var_decs(true,false,false);
  1096. dec(variantrecordlevel);
  1097. consume(_RKLAMMER);
  1098. { calculates maximal variant size }
  1099. maxsize:=max(maxsize,unionsymtable.datasize);
  1100. maxalignment:=max(maxalignment,unionsymtable.fieldalignment);
  1101. { the items of the next variant are overlayed }
  1102. unionsymtable.datasize:=startvarrecsize;
  1103. unionsymtable.fieldalignment:=startvarrecalign;
  1104. if (token<>_END) and (token<>_RKLAMMER) then
  1105. consume(_SEMICOLON)
  1106. else
  1107. break;
  1108. until (token=_END) or (token=_RKLAMMER);
  1109. { at last set the record size to that of the biggest variant }
  1110. unionsymtable.datasize:=maxsize;
  1111. unionsymtable.fieldalignment:=maxalignment;
  1112. uniontype.def:=uniondef;
  1113. uniontype.sym:=nil;
  1114. UnionSym:=tvarsym.create('$case',vs_value,uniontype);
  1115. symtablestack:=symtablestack.next;
  1116. { Align the offset where the union symtable is added }
  1117. if (trecordsymtable(symtablestack).usefieldalignment=-1) then
  1118. usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
  1119. else
  1120. usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.recordalignmax);
  1121. offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
  1122. trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
  1123. if maxalignment>trecordsymtable(symtablestack).fieldalignment then
  1124. trecordsymtable(symtablestack).fieldalignment:=maxalignment;
  1125. trecordsymtable(symtablestack).insertunionst(Unionsymtable,offset);
  1126. Unionsym.owner:=nil;
  1127. unionsym.free;
  1128. uniondef.owner:=nil;
  1129. uniondef.free;
  1130. end;
  1131. block_type:=old_block_type;
  1132. current_object_option:=old_current_object_option;
  1133. { free the list }
  1134. sc.free;
  1135. end;
  1136. end.
  1137. {
  1138. $Log$
  1139. Revision 1.71 2004-03-05 22:17:11 jonas
  1140. * fixed importing of variables from shared libraries, but disabled
  1141. PIC support for now. You have to save/restore r31 when you us it! :)
  1142. Also, it's not necessary to support the imported variables
  1143. Revision 1.70 2004/03/05 21:13:22 jonas
  1144. * fixed wrong name mangling for imported variables under Darwin
  1145. Revision 1.69 2004/03/04 17:24:42 peter
  1146. * support enums in property array ranges
  1147. Revision 1.68 2004/02/26 16:10:23 peter
  1148. * another procvar directive fix, this time for initialized vars
  1149. Revision 1.67 2004/02/20 21:55:59 peter
  1150. * procvar cleanup
  1151. Revision 1.66 2004/02/17 15:57:49 peter
  1152. - fix rtti generation for properties containing sl_vec
  1153. - fix crash when overloaded operator is not available
  1154. - fix record alignment for C style variant records
  1155. Revision 1.65 2004/02/12 15:54:03 peter
  1156. * make extcycle is working again
  1157. Revision 1.64 2004/02/03 22:32:54 peter
  1158. * renamed xNNbittype to xNNinttype
  1159. * renamed registers32 to registersint
  1160. * replace some s32bit,u32bit with torddef([su]inttype).def.typ
  1161. Revision 1.63 2004/01/31 17:45:17 peter
  1162. * Change several $ifdef i386 to x86
  1163. * Change several OS_32 to OS_INT/OS_ADDR
  1164. Revision 1.62 2004/01/29 16:51:29 peter
  1165. * fixed alignment calculation for variant records
  1166. * fixed alignment padding of records
  1167. Revision 1.61 2004/01/28 22:16:31 peter
  1168. * more record alignment fixes
  1169. Revision 1.60 2004/01/28 20:30:18 peter
  1170. * record alignment splitted in fieldalignment and recordalignment,
  1171. the latter is used when this record is inserted in another record.
  1172. Revision 1.59 2003/12/10 16:37:01 peter
  1173. * global property support for fpc modes
  1174. Revision 1.58 2003/11/23 17:05:15 peter
  1175. * register calling is left-right
  1176. * parameter ordering
  1177. * left-right calling inserts result parameter last
  1178. Revision 1.57 2003/10/28 15:36:01 peter
  1179. * absolute to object field supported, fixes tb0458
  1180. Revision 1.56 2003/10/05 12:55:37 peter
  1181. * allow absolute with value for win32,wdos
  1182. Revision 1.55 2003/10/03 14:45:09 peter
  1183. * more proc directive for procvar fixes
  1184. Revision 1.54 2003/10/02 21:13:09 peter
  1185. * procvar directive parsing fixes
  1186. Revision 1.53 2003/10/02 15:12:07 peter
  1187. * fix type parsing in records
  1188. Revision 1.52 2003/10/01 19:05:33 peter
  1189. * searchsym_type to search for type definitions. It ignores
  1190. records,objects and parameters
  1191. Revision 1.51 2003/09/23 17:56:05 peter
  1192. * locals and paras are allocated in the code generation
  1193. * tvarsym.localloc contains the location of para/local when
  1194. generating code for the current procedure
  1195. Revision 1.50 2003/09/07 14:14:51 florian
  1196. * proper error recovering from invalid published fields
  1197. Revision 1.49 2003/09/05 17:41:12 florian
  1198. * merged Wiktor's Watcom patches in 1.1
  1199. Revision 1.48 2003/07/02 22:18:04 peter
  1200. * paraloc splitted in callerparaloc,calleeparaloc
  1201. * sparc calling convention updates
  1202. Revision 1.47 2003/05/09 17:47:03 peter
  1203. * self moved to hidden parameter
  1204. * removed hdisposen,hnewn,selfn
  1205. Revision 1.46 2003/04/25 20:59:33 peter
  1206. * removed funcretn,funcretsym, function result is now in varsym
  1207. and aliases for result and function name are added using absolutesym
  1208. * vs_hidden parameter for funcret passed in parameter
  1209. * vs_hidden fixes
  1210. * writenode changed to printnode and released from extdebug
  1211. * -vp option added to generate a tree.log with the nodetree
  1212. * nicer printnode for statements, callnode
  1213. Revision 1.45 2003/03/17 18:56:02 peter
  1214. * fix crash with duplicate id
  1215. Revision 1.44 2003/01/02 11:14:02 michael
  1216. + Patch from peter to support initial values for local variables
  1217. Revision 1.43 2002/12/27 15:22:20 peter
  1218. * don't allow initialized threadvars
  1219. Revision 1.42 2002/12/07 14:04:59 carl
  1220. * convert some vars from longint -> byte
  1221. Revision 1.41 2002/11/29 22:31:19 carl
  1222. + unimplemented hint directive added
  1223. * hint directive parsing implemented
  1224. * warning on these directives
  1225. Revision 1.40 2002/11/25 17:43:21 peter
  1226. * splitted defbase in defutil,symutil,defcmp
  1227. * merged isconvertable and is_equal into compare_defs(_ext)
  1228. * made operator search faster by walking the list only once
  1229. Revision 1.39 2002/11/15 16:29:31 peter
  1230. * made tasmsymbol.refs private (merged)
  1231. Revision 1.38 2002/11/15 01:58:53 peter
  1232. * merged changes from 1.0.7 up to 04-11
  1233. - -V option for generating bug report tracing
  1234. - more tracing for option parsing
  1235. - errors for cdecl and high()
  1236. - win32 import stabs
  1237. - win32 records<=8 are returned in eax:edx (turned off by default)
  1238. - heaptrc update
  1239. - more info for temp management in .s file with EXTDEBUG
  1240. Revision 1.37 2002/10/05 15:18:43 carl
  1241. * fix heap leaks
  1242. Revision 1.36 2002/10/05 12:43:26 carl
  1243. * fixes for Delphi 6 compilation
  1244. (warning : Some features do not work under Delphi)
  1245. Revision 1.35 2002/10/04 20:53:05 carl
  1246. * bugfix of crash
  1247. Revision 1.34 2002/10/03 21:22:01 carl
  1248. * don't make the vars regable if they are absolute and their definitions
  1249. are not the same.
  1250. Revision 1.33 2002/09/16 18:08:45 peter
  1251. * fix setting of sp_static
  1252. Revision 1.32 2002/09/09 17:34:15 peter
  1253. * tdicationary.replace added to replace and item in a dictionary. This
  1254. is only allowed for the same name
  1255. * varsyms are inserted in symtable before the types are parsed. This
  1256. fixes the long standing "var longint : longint" bug
  1257. - consume_idlist and idstringlist removed. The loops are inserted
  1258. at the callers place and uses the symtable for duplicate id checking
  1259. Revision 1.31 2002/08/25 19:25:20 peter
  1260. * sym.insert_in_data removed
  1261. * symtable.insertvardata/insertconstdata added
  1262. * removed insert_in_data call from symtable.insert, it needs to be
  1263. called separatly. This allows to deref the address calculation
  1264. * procedures now calculate the parast addresses after the procedure
  1265. directives are parsed. This fixes the cdecl parast problem
  1266. * push_addr_param has an extra argument that specifies if cdecl is used
  1267. or not
  1268. Revision 1.30 2002/07/29 21:23:44 florian
  1269. * more fixes for the ppc
  1270. + wrappers for the tcnvnode.first_* stuff introduced
  1271. Revision 1.29 2002/07/26 21:15:40 florian
  1272. * rewrote the system handling
  1273. Revision 1.28 2002/07/20 11:57:55 florian
  1274. * types.pas renamed to defbase.pas because D6 contains a types
  1275. unit so this would conflicts if D6 programms are compiled
  1276. + Willamette/SSE2 instructions to assembler added
  1277. Revision 1.27 2002/06/10 13:41:26 jonas
  1278. * fixed bug 1985
  1279. Revision 1.26 2002/05/18 13:34:12 peter
  1280. * readded missing revisions
  1281. Revision 1.25 2002/05/16 19:46:43 carl
  1282. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1283. + try to fix temp allocation (still in ifdef)
  1284. + generic constructor calls
  1285. + start of tassembler / tmodulebase class cleanup
  1286. Revision 1.23 2002/04/21 18:57:24 peter
  1287. * fixed memleaks when file can't be opened
  1288. }