ptype.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Does parsing types for Free Pascal
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit ptype;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globtype,symtype;
  23. const
  24. { forward types should only be possible inside a TYPE statement }
  25. typecanbeforward : boolean = false;
  26. var
  27. { hack, which allows to use the current parsed }
  28. { object type as function argument type }
  29. testcurobject : byte;
  30. curobjectname : stringid;
  31. { reads a string, file type or a type id and returns a name and }
  32. { tdef }
  33. procedure single_type(var tt:ttype;var s : string;isforwarddef:boolean);
  34. procedure read_type(var tt:ttype;const name : stringid;parseprocvardir:boolean);
  35. { reads a type definition }
  36. { to a appropriating tdef, s gets the name of }
  37. { the type to allow name mangling }
  38. procedure id_type(var tt : ttype;var s : string;isforwarddef:boolean);
  39. implementation
  40. uses
  41. { common }
  42. cutils,
  43. { global }
  44. globals,tokens,verbose,
  45. systems,
  46. { target }
  47. paramgr,
  48. { symtable }
  49. symconst,symbase,symdef,symsym,symtable,
  50. defutil,defcmp,
  51. { pass 1 }
  52. node,
  53. nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
  54. { parser }
  55. scanner,
  56. pbase,pexpr,pdecsub,pdecvar,pdecobj;
  57. procedure id_type(var tt : ttype;var s : string;isforwarddef:boolean);
  58. { reads a type definition }
  59. { to a appropriating tdef, s gets the name of }
  60. { the type to allow name mangling }
  61. var
  62. is_unit_specific : boolean;
  63. pos : tfileposinfo;
  64. srsym : tsym;
  65. srsymtable : tsymtable;
  66. sorg : stringid;
  67. begin
  68. s:=pattern;
  69. sorg:=orgpattern;
  70. pos:=akttokenpos;
  71. { classes can be used also in classes }
  72. if (curobjectname=pattern) and is_class_or_interface(aktobjectdef) then
  73. begin
  74. tt.setdef(aktobjectdef);
  75. consume(_ID);
  76. exit;
  77. end;
  78. { objects can be parameters }
  79. if (testcurobject=2) and (curobjectname=pattern) then
  80. begin
  81. tt.setdef(aktobjectdef);
  82. consume(_ID);
  83. exit;
  84. end;
  85. { try to load the symbol to see if it's a unitsym. Use the
  86. special searchsym_type that ignores records,objects and
  87. parameters }
  88. is_unit_specific:=false;
  89. searchsym_type(s,srsym,srsymtable);
  90. consume(_ID);
  91. if assigned(srsym) and
  92. (srsym.typ=unitsym) then
  93. begin
  94. is_unit_specific:=true;
  95. consume(_POINT);
  96. if srsym.owner.unitid=0 then
  97. begin
  98. srsym:=searchsymonlyin(tunitsym(srsym).unitsymtable,pattern);
  99. pos:=akttokenpos;
  100. s:=pattern;
  101. end
  102. else
  103. srsym:=nil;
  104. consume(_ID);
  105. end;
  106. { Types are first defined with an error def before assigning
  107. the real type so check if it's an errordef. if so then
  108. give an error. Only check for typesyms in the current symbol
  109. table as forwarddef are not resolved directly }
  110. if assigned(srsym) and
  111. (srsym.typ=typesym) and
  112. (srsym.owner=symtablestack) and
  113. (ttypesym(srsym).restype.def.deftype=errordef) then
  114. begin
  115. Message1(type_e_type_is_not_completly_defined,ttypesym(srsym).realname);
  116. tt:=generrortype;
  117. exit;
  118. end;
  119. { are we parsing a possible forward def ? }
  120. if isforwarddef and
  121. not(is_unit_specific) then
  122. begin
  123. tt.setdef(tforwarddef.create(s,pos));
  124. exit;
  125. end;
  126. { unknown sym ? }
  127. if not assigned(srsym) then
  128. begin
  129. Message1(sym_e_id_not_found,sorg);
  130. tt:=generrortype;
  131. exit;
  132. end;
  133. { type sym ? }
  134. if (srsym.typ<>typesym) then
  135. begin
  136. Message(type_e_type_id_expected);
  137. tt:=generrortype;
  138. exit;
  139. end;
  140. { Give an error when referring to an errordef }
  141. if (ttypesym(srsym).restype.def.deftype=errordef) then
  142. begin
  143. Message(sym_e_error_in_type_def);
  144. tt:=generrortype;
  145. exit;
  146. end;
  147. { Use the definitions for current unit, because
  148. they can be refered from the parameters and symbols are not
  149. loaded at that time. Only write the definition when the
  150. symbol is the real owner of the definition (not a redefine) }
  151. if (ttypesym(srsym).owner.unitid=0) and
  152. ((ttypesym(srsym).restype.def.typesym=nil) or
  153. (srsym=ttypesym(srsym).restype.def.typesym)) then
  154. tt.setdef(ttypesym(srsym).restype.def)
  155. else
  156. tt.setsym(srsym);
  157. end;
  158. procedure single_type(var tt:ttype;var s : string;isforwarddef:boolean);
  159. { reads a string, file type or a type id and returns a name and }
  160. { tdef }
  161. var
  162. hs : string;
  163. t2 : ttype;
  164. begin
  165. case token of
  166. _STRING:
  167. begin
  168. string_dec(tt);
  169. s:='STRING';
  170. end;
  171. _FILE:
  172. begin
  173. consume(_FILE);
  174. if token=_OF then
  175. begin
  176. consume(_OF);
  177. single_type(t2,hs,false);
  178. tt.setdef(tfiledef.createtyped(t2));
  179. s:='FILE$OF$'+hs;
  180. end
  181. else
  182. begin
  183. tt:=cfiletype;
  184. s:='FILE';
  185. end;
  186. end;
  187. _ID:
  188. begin
  189. id_type(tt,s,isforwarddef);
  190. end;
  191. else
  192. begin
  193. message(type_e_type_id_expected);
  194. s:='<unknown>';
  195. tt:=generrortype;
  196. end;
  197. end;
  198. end;
  199. { reads a record declaration }
  200. function record_dec : tdef;
  201. var
  202. symtable : tsymtable;
  203. storetypecanbeforward : boolean;
  204. old_object_option : tsymoptions;
  205. begin
  206. { create recdef }
  207. symtable:=trecordsymtable.create(aktpackrecords);
  208. record_dec:=trecorddef.create(symtable);
  209. { update symtable stack }
  210. symtable.next:=symtablestack;
  211. symtablestack:=symtable;
  212. { parse record }
  213. consume(_RECORD);
  214. old_object_option:=current_object_option;
  215. current_object_option:=[sp_public];
  216. storetypecanbeforward:=typecanbeforward;
  217. { for tp7 don't allow forward types }
  218. if m_tp7 in aktmodeswitches then
  219. typecanbeforward:=false;
  220. read_var_decs(true,false,false);
  221. consume(_END);
  222. typecanbeforward:=storetypecanbeforward;
  223. current_object_option:=old_object_option;
  224. { make the record size aligned }
  225. trecordsymtable(symtablestack).addalignmentpadding;
  226. { restore symtable stack }
  227. symtablestack:=symtable.next;
  228. end;
  229. { reads a type definition and returns a pointer to it }
  230. procedure read_type(var tt : ttype;const name : stringid;parseprocvardir:boolean);
  231. var
  232. pt : tnode;
  233. tt2 : ttype;
  234. aktenumdef : tenumdef;
  235. ap : tarraydef;
  236. s : stringid;
  237. l,v : TConstExprInt;
  238. oldaktpackrecords : longint;
  239. hs : string;
  240. defpos,storepos : tfileposinfo;
  241. procedure expr_type;
  242. var
  243. pt1,pt2 : tnode;
  244. lv,hv : TConstExprInt;
  245. begin
  246. { use of current parsed object ? }
  247. if (token=_ID) and (testcurobject=2) and (curobjectname=pattern) then
  248. begin
  249. consume(_ID);
  250. tt.setdef(aktobjectdef);
  251. exit;
  252. end;
  253. { classes can be used also in classes }
  254. if (curobjectname=pattern) and is_class_or_interface(aktobjectdef) then
  255. begin
  256. tt.setdef(aktobjectdef);
  257. consume(_ID);
  258. exit;
  259. end;
  260. { we can't accept a equal in type }
  261. pt1:=comp_expr(not(ignore_equal));
  262. if (token=_POINTPOINT) then
  263. begin
  264. consume(_POINTPOINT);
  265. { get high value of range }
  266. pt2:=comp_expr(not(ignore_equal));
  267. { make both the same type }
  268. inserttypeconv(pt1,pt2.resulttype);
  269. { both must be evaluated to constants now }
  270. if (pt1.nodetype=ordconstn) and
  271. (pt2.nodetype=ordconstn) then
  272. begin
  273. lv:=tordconstnode(pt1).value;
  274. hv:=tordconstnode(pt2).value;
  275. { Check bounds }
  276. if hv<lv then
  277. Message(cg_e_upper_lower_than_lower)
  278. else
  279. begin
  280. { All checks passed, create the new def }
  281. case pt1.resulttype.def.deftype of
  282. enumdef :
  283. tt.setdef(tenumdef.create_subrange(tenumdef(pt1.resulttype.def),lv,hv));
  284. orddef :
  285. begin
  286. if is_char(pt1.resulttype.def) then
  287. tt.setdef(torddef.create(uchar,lv,hv))
  288. else
  289. if is_boolean(pt1.resulttype.def) then
  290. tt.setdef(torddef.create(bool8bit,l,hv))
  291. else
  292. tt.setdef(torddef.create(range_to_basetype(lv,hv),lv,hv));
  293. end;
  294. end;
  295. end;
  296. end
  297. else
  298. Message(sym_e_error_in_type_def);
  299. pt2.free;
  300. end
  301. else
  302. begin
  303. { a simple type renaming }
  304. if (pt1.nodetype=typen) then
  305. tt:=ttypenode(pt1).resulttype
  306. else
  307. Message(sym_e_error_in_type_def);
  308. end;
  309. pt1.free;
  310. end;
  311. procedure array_dec;
  312. var
  313. lowval,
  314. highval : longint;
  315. arraytype : ttype;
  316. ht : ttype;
  317. procedure setdefdecl(const t:ttype);
  318. begin
  319. case t.def.deftype of
  320. enumdef :
  321. begin
  322. lowval:=tenumdef(t.def).min;
  323. highval:=tenumdef(t.def).max;
  324. if tenumdef(t.def).has_jumps then
  325. Message(type_e_array_index_enums_with_assign_not_possible);
  326. arraytype:=t;
  327. end;
  328. orddef :
  329. begin
  330. if torddef(t.def).typ in [uchar,
  331. u8bit,u16bit,
  332. s8bit,s16bit,s32bit,
  333. bool8bit,bool16bit,bool32bit,
  334. uwidechar] then
  335. begin
  336. lowval:=torddef(t.def).low;
  337. highval:=torddef(t.def).high;
  338. arraytype:=t;
  339. end
  340. else
  341. Message1(parser_e_type_cant_be_used_in_array_index,t.def.gettypename);
  342. end;
  343. else
  344. Message(sym_e_error_in_type_def);
  345. end;
  346. end;
  347. begin
  348. consume(_ARRAY);
  349. { open array? }
  350. if token=_LECKKLAMMER then
  351. begin
  352. consume(_LECKKLAMMER);
  353. { defaults }
  354. arraytype:=generrortype;
  355. lowval:=longint($80000000);
  356. highval:=$7fffffff;
  357. tt.reset;
  358. repeat
  359. { read the expression and check it, check apart if the
  360. declaration is an enum declaration because that needs to
  361. be parsed by readtype (PFV) }
  362. if token=_LKLAMMER then
  363. begin
  364. read_type(ht,'',true);
  365. setdefdecl(ht);
  366. end
  367. else
  368. begin
  369. pt:=expr;
  370. if pt.nodetype=typen then
  371. setdefdecl(pt.resulttype)
  372. else
  373. begin
  374. if (pt.nodetype=rangen) then
  375. begin
  376. if (trangenode(pt).left.nodetype=ordconstn) and
  377. (trangenode(pt).right.nodetype=ordconstn) then
  378. begin
  379. lowval:=tordconstnode(trangenode(pt).left).value;
  380. highval:=tordconstnode(trangenode(pt).right).value;
  381. if highval<lowval then
  382. begin
  383. Message(parser_e_array_lower_less_than_upper_bound);
  384. highval:=lowval;
  385. end;
  386. arraytype:=trangenode(pt).right.resulttype;
  387. end
  388. else
  389. Message(type_e_cant_eval_constant_expr);
  390. end
  391. else
  392. Message(sym_e_error_in_type_def)
  393. end;
  394. pt.free;
  395. end;
  396. { create arraydef }
  397. if not assigned(tt.def) then
  398. begin
  399. ap:=tarraydef.create(lowval,highval,arraytype);
  400. tt.setdef(ap);
  401. end
  402. else
  403. begin
  404. ap.elementtype.setdef(tarraydef.create(lowval,highval,arraytype));
  405. ap:=tarraydef(ap.elementtype.def);
  406. end;
  407. if token=_COMMA then
  408. consume(_COMMA)
  409. else
  410. break;
  411. until false;
  412. consume(_RECKKLAMMER);
  413. end
  414. else
  415. begin
  416. ap:=tarraydef.create(0,-1,s32bittype);
  417. ap.IsDynamicArray:=true;
  418. tt.setdef(ap);
  419. end;
  420. consume(_OF);
  421. read_type(tt2,'',true);
  422. { if no error, set element type }
  423. if assigned(ap) then
  424. ap.setelementtype(tt2);
  425. end;
  426. var
  427. p : tnode;
  428. pd : tabstractprocdef;
  429. is_func,
  430. enumdupmsg : boolean;
  431. newtype : ttypesym;
  432. begin
  433. tt.reset;
  434. case token of
  435. _STRING,_FILE:
  436. begin
  437. single_type(tt,hs,false);
  438. end;
  439. _LKLAMMER:
  440. begin
  441. consume(_LKLAMMER);
  442. { allow negativ value_str }
  443. l:=-1;
  444. enumdupmsg:=false;
  445. aktenumdef:=tenumdef.create;
  446. repeat
  447. s:=orgpattern;
  448. defpos:=akttokenpos;
  449. consume(_ID);
  450. { only allow assigning of specific numbers under fpc mode }
  451. if not(m_tp7 in aktmodeswitches) and
  452. (
  453. { in fpc mode also allow := to be compatible
  454. with previous 1.0.x versions }
  455. ((m_fpc in aktmodeswitches) and
  456. try_to_consume(_ASSIGNMENT)) or
  457. try_to_consume(_EQUAL)
  458. ) then
  459. begin
  460. p:=comp_expr(true);
  461. if (p.nodetype=ordconstn) then
  462. begin
  463. { we expect an integer or an enum of the
  464. same type }
  465. if is_integer(p.resulttype.def) or
  466. is_char(p.resulttype.def) or
  467. equal_defs(p.resulttype.def,aktenumdef) then
  468. v:=tordconstnode(p).value
  469. else
  470. IncompatibleTypes(p.resulttype.def,s32bittype.def);
  471. end
  472. else
  473. Message(cg_e_illegal_expression);
  474. p.free;
  475. { please leave that a note, allows type save }
  476. { declarations in the win32 units ! }
  477. if (v<=l) and (not enumdupmsg) then
  478. begin
  479. Message(parser_n_duplicate_enum);
  480. enumdupmsg:=true;
  481. end;
  482. l:=v;
  483. end
  484. else
  485. inc(l);
  486. storepos:=akttokenpos;
  487. akttokenpos:=defpos;
  488. constsymtable.insert(tenumsym.create(s,aktenumdef,l));
  489. akttokenpos:=storepos;
  490. until not try_to_consume(_COMMA);
  491. tt.setdef(aktenumdef);
  492. consume(_RKLAMMER);
  493. end;
  494. _ARRAY:
  495. begin
  496. array_dec;
  497. end;
  498. _SET:
  499. begin
  500. consume(_SET);
  501. consume(_OF);
  502. read_type(tt2,'',true);
  503. if assigned(tt2.def) then
  504. begin
  505. case tt2.def.deftype of
  506. { don't forget that min can be negativ PM }
  507. enumdef :
  508. if tenumdef(tt2.def).min>=0 then
  509. tt.setdef(tsetdef.create(tt2,tenumdef(tt2.def).max))
  510. else
  511. Message(sym_e_ill_type_decl_set);
  512. orddef :
  513. begin
  514. case torddef(tt2.def).typ of
  515. uchar :
  516. tt.setdef(tsetdef.create(tt2,255));
  517. u8bit,u16bit,u32bit,
  518. s8bit,s16bit,s32bit :
  519. begin
  520. if (torddef(tt2.def).low>=0) then
  521. tt.setdef(tsetdef.create(tt2,torddef(tt2.def).high))
  522. else
  523. Message(sym_e_ill_type_decl_set);
  524. end;
  525. else
  526. Message(sym_e_ill_type_decl_set);
  527. end;
  528. end;
  529. else
  530. Message(sym_e_ill_type_decl_set);
  531. end;
  532. end
  533. else
  534. tt:=generrortype;
  535. end;
  536. _CARET:
  537. begin
  538. consume(_CARET);
  539. single_type(tt2,hs,typecanbeforward);
  540. tt.setdef(tpointerdef.create(tt2));
  541. end;
  542. _RECORD:
  543. begin
  544. tt.setdef(record_dec);
  545. end;
  546. _PACKED:
  547. begin
  548. consume(_PACKED);
  549. if token=_ARRAY then
  550. array_dec
  551. else
  552. begin
  553. oldaktpackrecords:=aktpackrecords;
  554. aktpackrecords:=1;
  555. if token in [_CLASS,_OBJECT] then
  556. tt.setdef(object_dec(name,nil))
  557. else
  558. tt.setdef(record_dec);
  559. aktpackrecords:=oldaktpackrecords;
  560. end;
  561. end;
  562. _CLASS,
  563. _CPPCLASS,
  564. _INTERFACE,
  565. _OBJECT:
  566. begin
  567. tt.setdef(object_dec(name,nil));
  568. end;
  569. _PROCEDURE,
  570. _FUNCTION:
  571. begin
  572. is_func:=(token=_FUNCTION);
  573. consume(token);
  574. pd:=tprocvardef.create(normal_function_level);
  575. if token=_LKLAMMER then
  576. parse_parameter_dec(pd);
  577. if is_func then
  578. begin
  579. consume(_COLON);
  580. single_type(pd.rettype,hs,false);
  581. end;
  582. if token=_OF then
  583. begin
  584. consume(_OF);
  585. consume(_OBJECT);
  586. include(pd.procoptions,po_methodpointer);
  587. end;
  588. tt.def:=pd;
  589. { possible proc directives }
  590. if parseprocvardir then
  591. begin
  592. if is_proc_directive(token,true) then
  593. begin
  594. newtype:=ttypesym.create('unnamed',tt);
  595. parse_var_proc_directives(tsym(newtype));
  596. newtype.restype.def:=nil;
  597. tt.def.typesym:=nil;
  598. newtype.free;
  599. end;
  600. { Add implicit hidden parameters and function result }
  601. handle_calling_convention(pd);
  602. calc_parast(pd);
  603. end;
  604. end;
  605. else
  606. expr_type;
  607. end;
  608. if tt.def=nil then
  609. tt:=generrortype;
  610. end;
  611. end.
  612. {
  613. $Log$
  614. Revision 1.63 2004-01-29 16:51:29 peter
  615. * fixed alignment calculation for variant records
  616. * fixed alignment padding of records
  617. Revision 1.62 2004/01/28 22:16:31 peter
  618. * more record alignment fixes
  619. Revision 1.61 2004/01/28 20:30:18 peter
  620. * record alignment splitted in fieldalignment and recordalignment,
  621. the latter is used when this record is inserted in another record.
  622. Revision 1.60 2003/10/21 18:16:13 peter
  623. * IncompatibleTypes() added that will include unit names when
  624. the typenames are the same
  625. Revision 1.59 2003/10/03 14:45:09 peter
  626. * more proc directive for procvar fixes
  627. Revision 1.58 2003/10/02 21:13:09 peter
  628. * procvar directive parsing fixes
  629. Revision 1.57 2003/10/01 19:05:33 peter
  630. * searchsym_type to search for type definitions. It ignores
  631. records,objects and parameters
  632. Revision 1.56 2003/09/23 17:56:06 peter
  633. * locals and paras are allocated in the code generation
  634. * tvarsym.localloc contains the location of para/local when
  635. generating code for the current procedure
  636. Revision 1.55 2003/05/15 18:58:53 peter
  637. * removed selfpointer_offset, vmtpointer_offset
  638. * tvarsym.adjusted_address
  639. * address in localsymtable is now in the real direction
  640. * removed some obsolete globals
  641. Revision 1.54 2003/05/09 17:47:03 peter
  642. * self moved to hidden parameter
  643. * removed hdisposen,hnewn,selfn
  644. Revision 1.53 2003/04/27 11:21:34 peter
  645. * aktprocdef renamed to current_procdef
  646. * procinfo renamed to current_procinfo
  647. * procinfo will now be stored in current_module so it can be
  648. cleaned up properly
  649. * gen_main_procsym changed to create_main_proc and release_main_proc
  650. to also generate a tprocinfo structure
  651. * fixed unit implicit initfinal
  652. Revision 1.52 2003/04/27 07:29:51 peter
  653. * current_procdef cleanup, current_procdef is now always nil when parsing
  654. a new procdef declaration
  655. * aktprocsym removed
  656. * lexlevel removed, use symtable.symtablelevel instead
  657. * implicit init/final code uses the normal genentry/genexit
  658. * funcret state checking updated for new funcret handling
  659. Revision 1.51 2003/04/25 20:59:34 peter
  660. * removed funcretn,funcretsym, function result is now in varsym
  661. and aliases for result and function name are added using absolutesym
  662. * vs_hidden parameter for funcret passed in parameter
  663. * vs_hidden fixes
  664. * writenode changed to printnode and released from extdebug
  665. * -vp option added to generate a tree.log with the nodetree
  666. * nicer printnode for statements, callnode
  667. Revision 1.50 2003/01/05 15:54:15 florian
  668. + added proper support of type = type <type>; for simple types
  669. Revision 1.49 2003/01/03 23:50:41 peter
  670. * also allow = in fpc mode to assign enums
  671. Revision 1.48 2003/01/02 19:49:00 peter
  672. * update self parameter only for methodpointer and methods
  673. Revision 1.47 2002/12/21 13:07:34 peter
  674. * type redefine fix for tb0437
  675. Revision 1.46 2002/11/25 17:43:23 peter
  676. * splitted defbase in defutil,symutil,defcmp
  677. * merged isconvertable and is_equal into compare_defs(_ext)
  678. * made operator search faster by walking the list only once
  679. Revision 1.45 2002/09/27 21:13:29 carl
  680. * low-highval always checked if limit ober 2GB is reached (to avoid overflow)
  681. Revision 1.44 2002/09/10 16:26:39 peter
  682. * safety check for typesym added for incomplete type def check
  683. Revision 1.43 2002/09/09 19:34:07 peter
  684. * check for incomplete types in the current symtable when parsing
  685. forwarddef. Maybe this shall be delphi/tp only
  686. Revision 1.42 2002/07/20 11:57:56 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.41 2002/05/18 13:34:16 peter
  691. * readded missing revisions
  692. Revision 1.40 2002/05/16 19:46:44 carl
  693. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  694. + try to fix temp allocation (still in ifdef)
  695. + generic constructor calls
  696. + start of tassembler / tmodulebase class cleanup
  697. Revision 1.38 2002/05/12 16:53:10 peter
  698. * moved entry and exitcode to ncgutil and cgobj
  699. * foreach gets extra argument for passing local data to the
  700. iterator function
  701. * -CR checks also class typecasts at runtime by changing them
  702. into as
  703. * fixed compiler to cycle with the -CR option
  704. * fixed stabs with elf writer, finally the global variables can
  705. be watched
  706. * removed a lot of routines from cga unit and replaced them by
  707. calls to cgobj
  708. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  709. u32bit then the other is typecasted also to u32bit without giving
  710. a rangecheck warning/error.
  711. * fixed pascal calling method with reversing also the high tree in
  712. the parast, detected by tcalcst3 test
  713. Revision 1.37 2002/04/19 15:46:03 peter
  714. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  715. in most cases and not written to the ppu
  716. * add mangeledname_prefix() routine to generate the prefix of
  717. manglednames depending on the current procedure, object and module
  718. * removed static procprefix since the mangledname is now build only
  719. on demand from tprocdef.mangledname
  720. Revision 1.36 2002/04/16 16:12:47 peter
  721. * give error when using enums with jumps as array index
  722. * allow char as enum value
  723. Revision 1.35 2002/04/04 19:06:04 peter
  724. * removed unused units
  725. * use tlocation.size in cg.a_*loc*() routines
  726. Revision 1.34 2002/01/24 18:25:49 peter
  727. * implicit result variable generation for assembler routines
  728. * removed m_tp modeswitch, use m_tp7 or not(m_fpc) instead
  729. Revision 1.33 2002/01/15 16:13:34 jonas
  730. * fixed web bugs 1758 and 1760
  731. Revision 1.32 2002/01/06 12:08:15 peter
  732. * removed uauto from orddef, use new range_to_basetype generating
  733. the correct ordinal type for a range
  734. }