pdecvar.pas 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  23. implementation
  24. uses
  25. { common }
  26. cutils,cclasses,
  27. { global }
  28. globtype,globals,tokens,verbose,
  29. systems,
  30. { symtable }
  31. symconst,symbase,symtype,symdef,symsym,symtable,defutil,
  32. fmodule,
  33. { pass 1 }
  34. node,
  35. nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
  36. { codegen }
  37. ncgutil,
  38. { parser }
  39. scanner,
  40. pbase,pexpr,ptype,ptconst,pdecsub,
  41. { link }
  42. import
  43. {$ifdef Delphi}
  44. ,dmisc
  45. ,sysutils
  46. {$endif}
  47. ;
  48. const
  49. variantrecordlevel : longint = 0;
  50. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  51. { reads the filed of a record into a }
  52. { symtablestack, if record=false }
  53. { variants are forbidden, so this procedure }
  54. { can be used to read object fields }
  55. { if absolute is true, ABSOLUTE and file }
  56. { types are allowed }
  57. { => the procedure is also used to read }
  58. { a sequence of variable declaration }
  59. procedure insert_syms(sc : tsinglelist;tt : ttype;is_threadvar : boolean; addsymopts : tsymoptions);
  60. { inserts the symbols of sc in st with def as definition or sym as ttypesym, sc is disposed }
  61. var
  62. vs,vs2 : tvarsym;
  63. begin
  64. vs:=tvarsym(sc.first);
  65. while assigned(vs) do
  66. begin
  67. vs.vartype:=tt;
  68. { insert any additional hint directives }
  69. vs.symoptions := vs.symoptions + addsymopts;
  70. if (sp_static in current_object_option) then
  71. include(vs.symoptions,sp_static);
  72. if is_threadvar then
  73. include(vs.varoptions,vo_is_thread_var);
  74. { static data fields are inserted in the globalsymtable }
  75. if (symtablestack.symtabletype=objectsymtable) and
  76. (sp_static in current_object_option) then
  77. begin
  78. vs2:=tvarsym.create('$'+lower(symtablestack.name^)+'_'+vs.name,vs_value,tt);
  79. symtablestack.defowner.owner.insert(vs2);
  80. insertbssdata(vs2);
  81. end
  82. else
  83. begin
  84. { external data is not possible here }
  85. case symtablestack.symtabletype of
  86. globalsymtable,
  87. staticsymtable :
  88. insertbssdata(vs);
  89. recordsymtable,
  90. objectsymtable :
  91. tabstractrecordsymtable(symtablestack).insertfield(vs,false);
  92. end;
  93. end;
  94. vs:=tvarsym(vs.listnext);
  95. end;
  96. end;
  97. var
  98. sc : tsinglelist;
  99. old_block_type : tblock_type;
  100. oldsymtablestack : tsymtable;
  101. symdone : boolean;
  102. { to handle absolute }
  103. abssym : tabsolutesym;
  104. { c var }
  105. newtype : ttypesym;
  106. is_dll,
  107. is_gpc_name,is_cdecl,
  108. extern_var,export_var : boolean;
  109. old_current_object_option : tsymoptions;
  110. hs,sorg,C_name,dll_name : string;
  111. tt,casetype : ttype;
  112. { Delphi initialized vars }
  113. tconstsym : ttypedconstsym;
  114. { maxsize contains the max. size of a variant }
  115. { startvarrec contains the start of the variant part of a record }
  116. maxsize, startvarrecsize : longint;
  117. usedalign,
  118. minalignment,maxalignment,startvarrecalign : byte;
  119. pt : tnode;
  120. vs,vs2 : tvarsym;
  121. srsym : tsym;
  122. srsymtable : tsymtable;
  123. unionsymtable : trecordsymtable;
  124. offset : longint;
  125. uniondef : trecorddef;
  126. unionsym : tvarsym;
  127. uniontype : ttype;
  128. dummysymoptions : tsymoptions;
  129. begin
  130. old_current_object_option:=current_object_option;
  131. { all variables are public if not in a object declaration }
  132. if not is_object then
  133. current_object_option:=[sp_public];
  134. old_block_type:=block_type;
  135. block_type:=bt_type;
  136. is_gpc_name:=false;
  137. { Force an expected ID error message }
  138. if not (token in [_ID,_CASE,_END]) then
  139. consume(_ID);
  140. { read vars }
  141. sc:=tsinglelist.create;
  142. while (token=_ID) and
  143. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  144. begin
  145. sorg:=orgpattern;
  146. sc.reset;
  147. repeat
  148. vs:=tvarsym.create(orgpattern,vs_value,generrortype);
  149. symtablestack.insert(vs);
  150. if assigned(vs.owner) then
  151. sc.insert(vs)
  152. else
  153. vs.free;
  154. consume(_ID);
  155. until not try_to_consume(_COMMA);
  156. consume(_COLON);
  157. if (m_gpc in aktmodeswitches) and
  158. not(is_record or is_object or is_threadvar) and
  159. (token=_ID) and (orgpattern='__asmname__') then
  160. begin
  161. consume(_ID);
  162. C_name:=get_stringconst;
  163. Is_gpc_name:=true;
  164. end;
  165. { this is needed for Delphi mode at least
  166. but should be OK for all modes !! (PM) }
  167. ignore_equal:=true;
  168. if is_record then
  169. begin
  170. { for records, don't search the recordsymtable for
  171. the symbols of the types }
  172. oldsymtablestack:=symtablestack;
  173. symtablestack:=symtablestack.next;
  174. read_type(tt,'');
  175. symtablestack:=oldsymtablestack;
  176. end
  177. else
  178. read_type(tt,'');
  179. { types that use init/final are not allowed in variant parts, but
  180. classes are allowed }
  181. if (variantrecordlevel>0) and
  182. (tt.def.needs_inittable and not is_class(tt.def)) then
  183. Message(parser_e_cant_use_inittable_here);
  184. ignore_equal:=false;
  185. symdone:=false;
  186. if is_gpc_name then
  187. begin
  188. vs:=tvarsym(sc.first);
  189. if assigned(vs.listnext) then
  190. Message(parser_e_absolute_only_one_var);
  191. vs.vartype:=tt;
  192. include(vs.varoptions,vo_is_C_var);
  193. vs.set_mangledname(target_info.Cprefix+sorg);
  194. include(vs.varoptions,vo_is_external);
  195. symdone:=true;
  196. end;
  197. { check for absolute }
  198. if not symdone and
  199. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  200. begin
  201. consume(_ABSOLUTE);
  202. abssym:=nil;
  203. { only allowed for one var }
  204. vs:=tvarsym(sc.first);
  205. if assigned(vs.listnext) then
  206. Message(parser_e_absolute_only_one_var);
  207. { parse the rest }
  208. pt:=expr;
  209. { transform a procvar calln to loadn }
  210. if pt.nodetype=calln then
  211. load_procvar_from_calln(pt);
  212. { check allowed absolute types }
  213. if (pt.nodetype=stringconstn) or
  214. (is_constcharnode(pt)) then
  215. begin
  216. abssym:=tabsolutesym.create(vs.realname,tt);
  217. abssym.fileinfo:=vs.fileinfo;
  218. if pt.nodetype=stringconstn then
  219. hs:=strpas(tstringconstnode(pt).value_str)
  220. else
  221. hs:=chr(tordconstnode(pt).value);
  222. consume(token);
  223. abssym.abstyp:=toasm;
  224. abssym.asmname:=stringdup(hs);
  225. { replace the varsym }
  226. symtablestack.replace(vs,abssym);
  227. vs.free;
  228. end
  229. { variable }
  230. else if (pt.nodetype=loadn) then
  231. begin
  232. { we should check the result type of srsym }
  233. if not (tloadnode(pt).symtableentry.typ in [varsym,typedconstsym]) then
  234. Message(parser_e_absolute_only_to_var_or_const);
  235. abssym:=tabsolutesym.create(vs.realname,tt);
  236. abssym.fileinfo:=vs.fileinfo;
  237. abssym.abstyp:=tovar;
  238. abssym.ref:=tstoredsym(tloadnode(pt).symtableentry);
  239. symtablestack.replace(vs,abssym);
  240. vs.free;
  241. { the variable cannot be put into a register
  242. if the size definition is not the same.
  243. }
  244. if tloadnode(pt).symtableentry.typ = varsym then
  245. begin
  246. if abssym.vartype.def <>
  247. tvarsym(tloadnode(pt).symtableentry).vartype.def then
  248. tvarsym(tloadnode(pt).symtableentry).varoptions:=
  249. tvarsym(tloadnode(pt).symtableentry).varoptions-[vo_regable,vo_fpuregable]
  250. end;
  251. end
  252. { address }
  253. else if is_constintnode(pt) and
  254. ((target_info.system in [system_i386_go32v2,system_i386_watcom]) or
  255. (m_objfpc in aktmodeswitches) or
  256. (m_delphi in aktmodeswitches)) then
  257. begin
  258. abssym:=tabsolutesym.create(vs.realname,tt);
  259. abssym.fileinfo:=vs.fileinfo;
  260. abssym.abstyp:=toaddr;
  261. abssym.absseg:=false;
  262. abssym.fieldoffset:=tordconstnode(pt).value;
  263. if (target_info.system in [system_i386_go32v2,system_i386_watcom]) and
  264. try_to_consume(_COLON) then
  265. begin
  266. pt.free;
  267. pt:=expr;
  268. if is_constintnode(pt) then
  269. begin
  270. abssym.fieldoffset:=abssym.fieldoffset shl 4+tordconstnode(pt).value;
  271. abssym.absseg:=true;
  272. end
  273. else
  274. Message(type_e_ordinal_expr_expected);
  275. end;
  276. symtablestack.replace(vs,abssym);
  277. vs.free;
  278. end
  279. else
  280. Message(parser_e_absolute_only_to_var_or_const);
  281. if assigned(abssym) then
  282. begin
  283. { try to consume the hint directives with absolute symbols }
  284. dummysymoptions:=[];
  285. try_consume_hintdirective(dummysymoptions);
  286. abssym.symoptions := abssym.symoptions + dummysymoptions;
  287. end;
  288. pt.free;
  289. symdone:=true;
  290. end;
  291. { Handling of Delphi typed const = initialized vars ! }
  292. { When should this be rejected ?
  293. - in parasymtable
  294. - in record or object
  295. - ... (PM) }
  296. if (token=_EQUAL) and
  297. not(m_tp7 in aktmodeswitches) and
  298. not(symtablestack.symtabletype in [parasymtable]) and
  299. not is_record and
  300. not is_object then
  301. begin
  302. vs:=tvarsym(sc.first);
  303. if assigned(vs.listnext) then
  304. Message(parser_e_initialized_only_one_var);
  305. if is_threadvar then
  306. Message(parser_e_initialized_not_for_threadvar);
  307. if symtablestack.symtabletype=localsymtable then
  308. begin
  309. consume(_EQUAL);
  310. tconstsym:=ttypedconstsym.createtype('default'+vs.realname,tt,false);
  311. vs.defaultconstsym:=tconstsym;
  312. symtablestack.insert(tconstsym);
  313. insertconstdata(tconstsym);
  314. readtypedconst(tt,tconstsym,false);
  315. end
  316. else
  317. begin
  318. tconstsym:=ttypedconstsym.createtype(vs.realname,tt,true);
  319. tconstsym.fileinfo:=vs.fileinfo;
  320. symtablestack.replace(vs,tconstsym);
  321. vs.free;
  322. insertconstdata(tconstsym);
  323. consume(_EQUAL);
  324. readtypedconst(tt,tconstsym,true);
  325. symdone:=true;
  326. end;
  327. end;
  328. { if the symbol is not completely handled, then try to parse the
  329. hint directives }
  330. if not symdone then
  331. begin
  332. dummysymoptions:=[];
  333. try_consume_hintdirective(dummysymoptions);
  334. end;
  335. { for a record there doesn't need to be a ; before the END or ) }
  336. if not((is_record or is_object) and (token in [_END,_RKLAMMER])) then
  337. consume(_SEMICOLON);
  338. { procvar handling }
  339. if (tt.def.deftype=procvardef) and (tt.def.typesym=nil) then
  340. begin
  341. newtype:=ttypesym.create('unnamed',tt);
  342. parse_var_proc_directives(tsym(newtype));
  343. newtype.restype.def:=nil;
  344. tt.def.typesym:=nil;
  345. newtype.free;
  346. end;
  347. { Check for variable directives }
  348. if not symdone and (token=_ID) then
  349. begin
  350. { Check for C Variable declarations }
  351. if (m_cvar_support in aktmodeswitches) and
  352. not(is_record or is_object or is_threadvar) and
  353. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  354. begin
  355. { only allowed for one var }
  356. vs:=tvarsym(sc.first);
  357. if assigned(vs.listnext) then
  358. Message(parser_e_absolute_only_one_var);
  359. { set type of the var }
  360. vs.vartype:=tt;
  361. vs.symoptions := vs.symoptions + dummysymoptions;
  362. { defaults }
  363. is_dll:=false;
  364. is_cdecl:=false;
  365. extern_var:=false;
  366. export_var:=false;
  367. C_name:=sorg;
  368. { cdecl }
  369. if idtoken=_CVAR then
  370. begin
  371. consume(_CVAR);
  372. consume(_SEMICOLON);
  373. is_cdecl:=true;
  374. C_name:=target_info.Cprefix+sorg;
  375. end;
  376. { external }
  377. if idtoken=_EXTERNAL then
  378. begin
  379. consume(_EXTERNAL);
  380. extern_var:=true;
  381. end;
  382. { export }
  383. if idtoken in [_EXPORT,_PUBLIC] then
  384. begin
  385. consume(_ID);
  386. if extern_var or
  387. (symtablestack.symtabletype in [parasymtable,localsymtable]) then
  388. Message(parser_e_not_external_and_export)
  389. else
  390. export_var:=true;
  391. end;
  392. { external and export need a name after when no cdecl is used }
  393. if not is_cdecl then
  394. begin
  395. { dll name ? }
  396. if (extern_var) and (idtoken<>_NAME) then
  397. begin
  398. is_dll:=true;
  399. dll_name:=get_stringconst;
  400. end;
  401. consume(_NAME);
  402. C_name:=get_stringconst;
  403. end;
  404. { consume the ; when export or external is used }
  405. if extern_var or export_var then
  406. consume(_SEMICOLON);
  407. { set some vars options }
  408. if is_dll then
  409. include(vs.varoptions,vo_is_dll_var)
  410. else
  411. include(vs.varoptions,vo_is_C_var);
  412. vs.set_mangledname(C_Name);
  413. if export_var then
  414. begin
  415. inc(vs.refs);
  416. include(vs.varoptions,vo_is_exported);
  417. end;
  418. if extern_var then
  419. include(vs.varoptions,vo_is_external);
  420. { insert in the datasegment when it is not external }
  421. if (not extern_var) then
  422. insertbssdata(vs);
  423. { now we can insert it in the import lib if its a dll, or
  424. add it to the externals }
  425. if extern_var then
  426. begin
  427. if is_dll then
  428. begin
  429. if not(current_module.uses_imports) then
  430. begin
  431. current_module.uses_imports:=true;
  432. importlib.preparelib(current_module.modulename^);
  433. end;
  434. importlib.importvariable(vs,C_name,dll_name);
  435. end
  436. else
  437. if target_info.DllScanSupported then
  438. current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
  439. end;
  440. symdone:=true;
  441. end
  442. else
  443. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  444. begin
  445. include(current_object_option,sp_static);
  446. insert_syms(sc,tt,false,dummysymoptions);
  447. exclude(current_object_option,sp_static);
  448. consume(_STATIC);
  449. consume(_SEMICOLON);
  450. symdone:=true;
  451. end;
  452. end;
  453. { insert it in the symtable, if not done yet }
  454. if not symdone then
  455. begin
  456. { save object option, because we can turn of the sp_published }
  457. if (sp_published in current_object_option) and
  458. not(is_class(tt.def)) then
  459. begin
  460. Message(parser_e_cant_publish_that);
  461. exclude(current_object_option,sp_published);
  462. { recover by changing access type to public }
  463. vs2:=tvarsym(sc.first);
  464. while assigned (vs2) do
  465. begin
  466. exclude(vs2.symoptions,sp_published);
  467. include(vs2.symoptions,sp_public);
  468. vs2:=tvarsym(vs2.listnext);
  469. end;
  470. end
  471. else
  472. if (sp_published in current_object_option) and
  473. not(oo_can_have_published in tobjectdef(tt.def).objectoptions) then
  474. begin
  475. Message(parser_e_only_publishable_classes_can__be_published);
  476. exclude(current_object_option,sp_published);
  477. end;
  478. insert_syms(sc,tt,is_threadvar,dummysymoptions);
  479. current_object_option:=old_current_object_option;
  480. end;
  481. end;
  482. { Check for Case }
  483. if is_record and (token=_CASE) then
  484. begin
  485. maxsize:=0;
  486. maxalignment:=0;
  487. consume(_CASE);
  488. sorg:=orgpattern;
  489. hs:=pattern;
  490. searchsym(hs,srsym,srsymtable);
  491. { may be only a type: }
  492. if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
  493. begin
  494. { for records, don't search the recordsymtable for
  495. the symbols of the types }
  496. oldsymtablestack:=symtablestack;
  497. symtablestack:=symtablestack.next;
  498. read_type(casetype,'');
  499. symtablestack:=oldsymtablestack;
  500. end
  501. else
  502. begin
  503. consume(_ID);
  504. consume(_COLON);
  505. { for records, don't search the recordsymtable for
  506. the symbols of the types }
  507. oldsymtablestack:=symtablestack;
  508. symtablestack:=symtablestack.next;
  509. read_type(casetype,'');
  510. symtablestack:=oldsymtablestack;
  511. vs:=tvarsym.create(sorg,vs_value,casetype);
  512. tabstractrecordsymtable(symtablestack).insertfield(vs,true);
  513. end;
  514. if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
  515. Message(type_e_ordinal_expr_expected);
  516. consume(_OF);
  517. UnionSymtable:=trecordsymtable.create;
  518. Unionsymtable.next:=symtablestack;
  519. registerdef:=false;
  520. UnionDef:=trecorddef.create(unionsymtable);
  521. uniondef.isunion:=true;
  522. if assigned(symtablestack.defowner) then
  523. Uniondef.owner:=symtablestack.defowner.owner;
  524. registerdef:=true;
  525. startvarrecsize:=UnionSymtable.datasize;
  526. startvarrecalign:=UnionSymtable.dataalignment;
  527. symtablestack:=UnionSymtable;
  528. repeat
  529. repeat
  530. pt:=comp_expr(true);
  531. if not(pt.nodetype=ordconstn) then
  532. Message(cg_e_illegal_expression);
  533. pt.free;
  534. if token=_COMMA then
  535. consume(_COMMA)
  536. else
  537. break;
  538. until false;
  539. consume(_COLON);
  540. { read the vars }
  541. consume(_LKLAMMER);
  542. inc(variantrecordlevel);
  543. if token<>_RKLAMMER then
  544. read_var_decs(true,false,false);
  545. dec(variantrecordlevel);
  546. consume(_RKLAMMER);
  547. { calculates maximal variant size }
  548. maxsize:=max(maxsize,unionsymtable.datasize);
  549. maxalignment:=max(maxalignment,unionsymtable.dataalignment);
  550. { the items of the next variant are overlayed }
  551. unionsymtable.datasize:=startvarrecsize;
  552. unionsymtable.dataalignment:=startvarrecalign;
  553. if (token<>_END) and (token<>_RKLAMMER) then
  554. consume(_SEMICOLON)
  555. else
  556. break;
  557. until (token=_END) or (token=_RKLAMMER);
  558. { at last set the record size to that of the biggest variant }
  559. unionsymtable.datasize:=maxsize;
  560. unionsymtable.dataalignment:=maxalignment;
  561. uniontype.def:=uniondef;
  562. uniontype.sym:=nil;
  563. UnionSym:=tvarsym.create('$case',vs_value,uniontype);
  564. symtablestack:=symtablestack.next;
  565. { we do NOT call symtablestack.insert
  566. on purpose PM }
  567. if aktalignment.recordalignmax=-1 then
  568. begin
  569. {$ifdef i386}
  570. if maxalignment>2 then
  571. minalignment:=4
  572. else if maxalignment>1 then
  573. minalignment:=2
  574. else
  575. minalignment:=1;
  576. {$else}
  577. {$ifdef m68k}
  578. minalignment:=2;
  579. {$endif}
  580. minalignment:=1;
  581. {$endif}
  582. end
  583. else
  584. minalignment:=maxalignment;
  585. usedalign:=used_align(maxalignment,minalignment,maxalignment);
  586. offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
  587. trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
  588. if maxalignment>trecordsymtable(symtablestack).dataalignment then
  589. trecordsymtable(symtablestack).dataalignment:=maxalignment;
  590. Unionsymtable.Insert_in(trecordsymtable(symtablestack),offset);
  591. Unionsym.owner:=nil;
  592. unionsym.free;
  593. uniondef.owner:=nil;
  594. uniondef.free;
  595. end;
  596. block_type:=old_block_type;
  597. current_object_option:=old_current_object_option;
  598. { free the list }
  599. sc.free;
  600. end;
  601. end.
  602. {
  603. $Log$
  604. Revision 1.51 2003-09-23 17:56:05 peter
  605. * locals and paras are allocated in the code generation
  606. * tvarsym.localloc contains the location of para/local when
  607. generating code for the current procedure
  608. Revision 1.50 2003/09/07 14:14:51 florian
  609. * proper error recovering from invalid published fields
  610. Revision 1.49 2003/09/05 17:41:12 florian
  611. * merged Wiktor's Watcom patches in 1.1
  612. Revision 1.48 2003/07/02 22:18:04 peter
  613. * paraloc splitted in callerparaloc,calleeparaloc
  614. * sparc calling convention updates
  615. Revision 1.47 2003/05/09 17:47:03 peter
  616. * self moved to hidden parameter
  617. * removed hdisposen,hnewn,selfn
  618. Revision 1.46 2003/04/25 20:59:33 peter
  619. * removed funcretn,funcretsym, function result is now in varsym
  620. and aliases for result and function name are added using absolutesym
  621. * vs_hidden parameter for funcret passed in parameter
  622. * vs_hidden fixes
  623. * writenode changed to printnode and released from extdebug
  624. * -vp option added to generate a tree.log with the nodetree
  625. * nicer printnode for statements, callnode
  626. Revision 1.45 2003/03/17 18:56:02 peter
  627. * fix crash with duplicate id
  628. Revision 1.44 2003/01/02 11:14:02 michael
  629. + Patch from peter to support initial values for local variables
  630. Revision 1.43 2002/12/27 15:22:20 peter
  631. * don't allow initialized threadvars
  632. Revision 1.42 2002/12/07 14:04:59 carl
  633. * convert some vars from longint -> byte
  634. Revision 1.41 2002/11/29 22:31:19 carl
  635. + unimplemented hint directive added
  636. * hint directive parsing implemented
  637. * warning on these directives
  638. Revision 1.40 2002/11/25 17:43:21 peter
  639. * splitted defbase in defutil,symutil,defcmp
  640. * merged isconvertable and is_equal into compare_defs(_ext)
  641. * made operator search faster by walking the list only once
  642. Revision 1.39 2002/11/15 16:29:31 peter
  643. * made tasmsymbol.refs private (merged)
  644. Revision 1.38 2002/11/15 01:58:53 peter
  645. * merged changes from 1.0.7 up to 04-11
  646. - -V option for generating bug report tracing
  647. - more tracing for option parsing
  648. - errors for cdecl and high()
  649. - win32 import stabs
  650. - win32 records<=8 are returned in eax:edx (turned off by default)
  651. - heaptrc update
  652. - more info for temp management in .s file with EXTDEBUG
  653. Revision 1.37 2002/10/05 15:18:43 carl
  654. * fix heap leaks
  655. Revision 1.36 2002/10/05 12:43:26 carl
  656. * fixes for Delphi 6 compilation
  657. (warning : Some features do not work under Delphi)
  658. Revision 1.35 2002/10/04 20:53:05 carl
  659. * bugfix of crash
  660. Revision 1.34 2002/10/03 21:22:01 carl
  661. * don't make the vars regable if they are absolute and their definitions
  662. are not the same.
  663. Revision 1.33 2002/09/16 18:08:45 peter
  664. * fix setting of sp_static
  665. Revision 1.32 2002/09/09 17:34:15 peter
  666. * tdicationary.replace added to replace and item in a dictionary. This
  667. is only allowed for the same name
  668. * varsyms are inserted in symtable before the types are parsed. This
  669. fixes the long standing "var longint : longint" bug
  670. - consume_idlist and idstringlist removed. The loops are inserted
  671. at the callers place and uses the symtable for duplicate id checking
  672. Revision 1.31 2002/08/25 19:25:20 peter
  673. * sym.insert_in_data removed
  674. * symtable.insertvardata/insertconstdata added
  675. * removed insert_in_data call from symtable.insert, it needs to be
  676. called separatly. This allows to deref the address calculation
  677. * procedures now calculate the parast addresses after the procedure
  678. directives are parsed. This fixes the cdecl parast problem
  679. * push_addr_param has an extra argument that specifies if cdecl is used
  680. or not
  681. Revision 1.30 2002/07/29 21:23:44 florian
  682. * more fixes for the ppc
  683. + wrappers for the tcnvnode.first_* stuff introduced
  684. Revision 1.29 2002/07/26 21:15:40 florian
  685. * rewrote the system handling
  686. Revision 1.28 2002/07/20 11:57:55 florian
  687. * types.pas renamed to defbase.pas because D6 contains a types
  688. unit so this would conflicts if D6 programms are compiled
  689. + Willamette/SSE2 instructions to assembler added
  690. Revision 1.27 2002/06/10 13:41:26 jonas
  691. * fixed bug 1985
  692. Revision 1.26 2002/05/18 13:34:12 peter
  693. * readded missing revisions
  694. Revision 1.25 2002/05/16 19:46:43 carl
  695. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  696. + try to fix temp allocation (still in ifdef)
  697. + generic constructor calls
  698. + start of tassembler / tmodulebase class cleanup
  699. Revision 1.23 2002/04/21 18:57:24 peter
  700. * fixed memleaks when file can't be opened
  701. }