tree.pas 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. This units exports some routines to manage the parse tree
  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. {$ifdef tp}
  19. {$E+,N+}
  20. {$endif}
  21. unit tree;
  22. interface
  23. uses
  24. globtype,cobjects,symtable,aasm
  25. {$ifdef ag386bin}
  26. ,i386base
  27. {$else}
  28. ,i386
  29. {$endif}
  30. {$ifdef m68k}
  31. ,m68k
  32. {$endif}
  33. {$ifdef alpha}
  34. ,alpha
  35. {$endif}
  36. ;
  37. type
  38. pconstset = ^tconstset;
  39. tconstset = array[0..31] of byte;
  40. ttreetyp = (
  41. addn, {Represents the + operator.}
  42. muln, {Represents the * operator.}
  43. subn, {Represents the - operator.}
  44. divn, {Represents the div operator.}
  45. symdifn, {Represents the >< operator.}
  46. modn, {Represents the mod operator.}
  47. assignn, {Represents an assignment.}
  48. loadn, {Represents the use of a variabele.}
  49. rangen, {Represents a range (i.e. 0..9).}
  50. ltn, {Represents the < operator.}
  51. lten, {Represents the <= operator.}
  52. gtn, {Represents the > operator.}
  53. gten, {Represents the >= operator.}
  54. equaln, {Represents the = operator.}
  55. unequaln, {Represents the <> operator.}
  56. inn, {Represents the in operator.}
  57. orn, {Represents the or operator.}
  58. xorn, {Represents the xor operator.}
  59. shrn, {Represents the shr operator.}
  60. shln, {Represents the shl operator.}
  61. slashn, {Represents the / operator.}
  62. andn, {Represents the and operator.}
  63. subscriptn, {??? Field in a record/object?}
  64. derefn, {Dereferences a pointer.}
  65. addrn, {Represents the @ operator.}
  66. doubleaddrn, {Represents the @@ operator.}
  67. ordconstn, {Represents an ordinal value.}
  68. typeconvn, {Represents type-conversion/typecast.}
  69. calln, {Represents a call node.}
  70. callparan, {Represents a parameter.}
  71. realconstn, {Represents a real value.}
  72. fixconstn, {Represents a fixed value.}
  73. umminusn, {Represents a sign change (i.e. -2).}
  74. asmn, {Represents an assembler node }
  75. vecn, {Represents array indexing.}
  76. stringconstn, {Represents a string constant.}
  77. funcretn, {Represents the function result var.}
  78. selfn, {Represents the self parameter.}
  79. notn, {Represents the not operator.}
  80. inlinen, {Internal procedures (i.e. writeln).}
  81. niln, {Represents the nil pointer.}
  82. errorn, {This part of the tree could not be
  83. parsed because of a compiler error.}
  84. typen, {A type name. Used for i.e. typeof(obj).}
  85. hnewn, {The new operation, constructor call.}
  86. hdisposen, {The dispose operation with destructor call.}
  87. newn, {The new operation, constructor call.}
  88. simpledisposen, {The dispose operation.}
  89. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  90. setconstn, {A set constant (i.e. [1,2]).}
  91. blockn, {A block of statements.}
  92. statementn, {One statement in a block of nodes.}
  93. loopn, { used in genloopnode, must be converted }
  94. ifn, {An if statement.}
  95. breakn, {A break statement.}
  96. continuen, {A continue statement.}
  97. repeatn, {A repeat until block.}
  98. whilen, {A while do statement.}
  99. forn, {A for loop.}
  100. exitn, {An exit statement.}
  101. withn, {A with statement.}
  102. casen, {A case statement.}
  103. labeln, {A label.}
  104. goton, {A goto statement.}
  105. simplenewn, {The new operation.}
  106. tryexceptn, {A try except block.}
  107. raisen, {A raise statement.}
  108. switchesn, {??? Currently unused...}
  109. tryfinallyn, {A try finally statement.}
  110. onn, { for an on statement in exception code }
  111. isn, {Represents the is operator.}
  112. asn, {Represents the as typecast.}
  113. caretn, {Represents the ^ operator.}
  114. failn, {Represents the fail statement.}
  115. starstarn, {Represents the ** operator exponentiation }
  116. procinlinen, {Procedures that can be inlined }
  117. arrayconstructn, {Construction node for [...] parsing}
  118. arrayconstructrangen, {Range element to allow sets in array construction tree}
  119. { added for optimizations where we cannot suppress }
  120. nothingn,
  121. loadvmtn
  122. );
  123. {$ifndef OLDCNV}
  124. tconverttype = (
  125. tc_equal,
  126. tc_not_possible,
  127. tc_string_2_string,
  128. tc_char_2_string,
  129. tc_pchar_2_string,
  130. tc_cchar_2_pchar,
  131. tc_cstring_2_pchar,
  132. tc_ansistring_2_pchar,
  133. tc_string_2_chararray,
  134. tc_chararray_2_string,
  135. tc_array_2_pointer,
  136. tc_pointer_2_array,
  137. tc_int_2_int,
  138. tc_bool_2_int,
  139. tc_int_2_bool,
  140. tc_real_2_real,
  141. tc_int_2_real,
  142. tc_int_2_fix,
  143. tc_real_2_fix,
  144. tc_fix_2_real,
  145. tc_proc_2_procvar,
  146. tc_arrayconstructor_2_set,
  147. tc_load_smallset
  148. );
  149. {$else}
  150. tconverttype = (tc_equal,tc_not_possible,tc_u8bit_2_s32bit,
  151. tc_only_rangechecks32bit,tc_s8bit_2_s32bit,
  152. tc_u16bit_2_s32bit,tc_s16bit_2_s32bit,
  153. tc_s32bit_2_s16bit,tc_s32bit_2_u8bit,
  154. tc_s32bit_2_u16bit,tc_string_2_string,
  155. tc_cstring_2_pchar,tc_string_2_chararray,
  156. tc_array_2_pointer,tc_pointer_2_array,
  157. tc_char_2_string,tc_u8bit_2_s16bit,
  158. tc_u8bit_2_u16bit,tc_s8bit_2_s16bit,
  159. tc_s16bit_2_s8bit,tc_s16bit_2_u8bit,
  160. tc_u16bit_2_s8bit,tc_u16bit_2_u8bit,
  161. tc_s8bit_2_u16bit,tc_s32bit_2_s8bit,
  162. tc_s32bit_2_u32bit,tc_s16bit_2_u32bit,
  163. tc_s8bit_2_u32bit,tc_u16bit_2_u32bit,
  164. tc_u8bit_2_u32bit,tc_u32bit_2_s32bit,
  165. tc_u32bit_2_s8bit,tc_u32bit_2_u8bit,
  166. tc_u32bit_2_s16bit,tc_u32bit_2_u16bit,
  167. tc_bool_2_int,tc_int_2_bool,
  168. tc_int_2_real,tc_real_2_fix,
  169. tc_fix_2_real,tc_int_2_fix,tc_real_2_real,
  170. tc_chararray_2_string,
  171. tc_proc_2_procvar,tc_cchar_2_pchar,tc_load_smallset,
  172. tc_ansistring_2_pchar,tc_pchar_2_string,
  173. tc_arrayconstructor_2_set);
  174. {$endif}
  175. { allows to determine which elementes are to be replaced }
  176. tdisposetyp = (dt_nothing,dt_leftright,dt_left,dt_leftrighthigh,
  177. dt_mbleft,dt_typeconv,dt_inlinen,
  178. dt_mbleft_and_method,dt_loop,dt_case,dt_with,dt_onn);
  179. { different assignment types }
  180. tassigntyp = (at_normal,at_plus,at_minus,at_star,at_slash);
  181. pcaserecord = ^tcaserecord;
  182. tcaserecord = record
  183. { range }
  184. _low,_high : longint;
  185. { only used by gentreejmp }
  186. _at : plabel;
  187. { label of instruction }
  188. statement : plabel;
  189. { is this the first of an case entry, needed to release statement
  190. label (PFV) }
  191. firstlabel : boolean;
  192. { left and right tree node }
  193. less,greater : pcaserecord;
  194. end;
  195. ptree = ^ttree;
  196. ttree = record
  197. error : boolean;
  198. disposetyp : tdisposetyp;
  199. { is true, if the right and left operand are swaped }
  200. swaped : boolean;
  201. { the location of the result of this node }
  202. location : tlocation;
  203. { the number of registers needed to evalute the node }
  204. registers32,registersfpu : longint; { must be longint !!!! }
  205. {$ifdef SUPPORT_MMX}
  206. registersmmx : longint;
  207. {$endif SUPPORT_MMX}
  208. left,right : ptree;
  209. resulttype : pdef;
  210. fileinfo : tfileposinfo;
  211. localswitches : tlocalswitches;
  212. {$ifdef extdebug}
  213. firstpasscount : longint;
  214. {$endif extdebug}
  215. case treetype : ttreetyp of
  216. addn : (use_strconcat : boolean;string_typ : tstringtype);
  217. callparan : (is_colon_para : boolean;exact_match_found : boolean;hightree:ptree);
  218. assignn : (assigntyp : tassigntyp;concat_string : boolean);
  219. loadn : (symtableentry : psym;symtable : psymtable;
  220. is_absolute,is_first : boolean);
  221. calln : (symtableprocentry : psym;
  222. symtableproc : psymtable;procdefinition : pprocdef;
  223. methodpointer : ptree;
  224. no_check,unit_specific,
  225. return_value_used,static_call : boolean);
  226. ordconstn : (value : longint);
  227. realconstn : (value_real : bestreal;lab_real : plabel;realtyp : tait);
  228. fixconstn : (value_fix: longint);
  229. funcretn : (funcretprocinfo : pointer;retdef : pdef);
  230. subscriptn : (vs : pvarsym);
  231. vecn : (memindex,memseg:boolean;callunique : boolean);
  232. stringconstn : (value_str : pchar;length : longint; lab_str : plabel;stringtype : tstringtype);
  233. typeconvn : (convtyp : tconverttype;explizit : boolean);
  234. typen : (typenodetype : pdef);
  235. inlinen : (inlinenumber : byte;inlineconst:boolean);
  236. procinlinen : (inlineprocdef : pprocdef;
  237. retoffset,para_offset,para_size : longint);
  238. setconstn : (value_set : pconstset;lab_set:plabel);
  239. loopn : (t1,t2 : ptree;backward : boolean);
  240. asmn : (p_asm : paasmoutput;object_preserved : boolean);
  241. casen : (nodes : pcaserecord;elseblock : ptree);
  242. labeln,goton : (labelnr : plabel);
  243. withn : (withsymtable : pwithsymtable;tablecount : longint;
  244. pref : preference);
  245. onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
  246. arrayconstructn : (cargs,cargswap: boolean);
  247. end;
  248. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  249. function genlabelnode(t : ttreetyp;nr : plabel) : ptree;
  250. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  251. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  252. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  253. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  254. function genordinalconstnode(v : longint;def : pdef) : ptree;
  255. function genfixconstnode(v : longint;def : pdef) : ptree;
  256. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  257. function gentypenode(t : pdef) : ptree;
  258. function gencallparanode(expr,next : ptree) : ptree;
  259. function genrealconstnode(v : bestreal) : ptree;
  260. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  261. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  262. { allow pchar or string for defining a pchar node }
  263. function genstringconstnode(const s : string) : ptree;
  264. { length is required for ansistrings }
  265. function genpcharconstnode(s : pchar;length : longint) : ptree;
  266. { helper routine for conststring node }
  267. function getpcharcopy(p : ptree) : pchar;
  268. function genzeronode(t : ttreetyp) : ptree;
  269. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  270. function genprocinlinenode(callp,code : ptree) : ptree;
  271. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  272. function genenumnode(v : penumsym) : ptree;
  273. function genselfnode(_class : pdef) : ptree;
  274. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  275. function genloopnode(t : ttreetyp;l,r,n1: ptree;back : boolean) : ptree;
  276. function genasmnode(p_asm : paasmoutput) : ptree;
  277. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  278. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  279. function getcopy(p : ptree) : ptree;
  280. function equal_trees(t1,t2 : ptree) : boolean;
  281. procedure swaptree(p:Ptree);
  282. procedure disposetree(p : ptree);
  283. procedure putnode(p : ptree);
  284. function getnode : ptree;
  285. procedure clear_location(var loc : tlocation);
  286. procedure set_location(var destloc,sourceloc : tlocation);
  287. procedure swap_location(var destloc,sourceloc : tlocation);
  288. procedure set_file_line(from,_to : ptree);
  289. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  290. {$ifdef extdebug}
  291. procedure compare_trees(oldp,p : ptree);
  292. const
  293. maxfirstpasscount : longint = 0;
  294. {$endif extdebug}
  295. { sets the callunique flag, if the node is a vecn, }
  296. { takes care of type casts etc. }
  297. procedure set_unique(p : ptree);
  298. { gibt den ordinalen Werten der Node zurueck oder falls sie }
  299. { keinen ordinalen Wert hat, wird ein Fehler erzeugt }
  300. function get_ordinal_value(p : ptree) : longint;
  301. function is_constnode(p : ptree) : boolean;
  302. { true, if p is a pointer to a const int value }
  303. function is_constintnode(p : ptree) : boolean;
  304. function is_constboolnode(p : ptree) : boolean;
  305. function is_constrealnode(p : ptree) : boolean;
  306. function is_constcharnode(p : ptree) : boolean;
  307. function str_length(p : ptree) : longint;
  308. function is_emptyset(p : ptree):boolean;
  309. {$I innr.inc}
  310. implementation
  311. uses
  312. systems,
  313. globals,verbose,files,types;
  314. function getnode : ptree;
  315. var
  316. hp : ptree;
  317. begin
  318. new(hp);
  319. { makes error tracking easier }
  320. fillchar(hp^,sizeof(ttree),0);
  321. { reset }
  322. hp^.location.loc:=LOC_INVALID;
  323. { save local info }
  324. hp^.fileinfo:=aktfilepos;
  325. hp^.localswitches:=aktlocalswitches;
  326. getnode:=hp;
  327. end;
  328. procedure putnode(p : ptree);
  329. begin
  330. { clean up the contents of a node }
  331. case p^.treetype of
  332. asmn : if assigned(p^.p_asm) then
  333. dispose(p^.p_asm,done);
  334. stringconstn : begin
  335. ansistringdispose(p^.value_str,p^.length);
  336. end;
  337. setconstn : begin
  338. if assigned(p^.value_set) then
  339. dispose(p^.value_set);
  340. end;
  341. end;
  342. {$ifdef extdebug}
  343. if p^.firstpasscount>maxfirstpasscount then
  344. maxfirstpasscount:=p^.firstpasscount;
  345. {$endif extdebug}
  346. dispose(p);
  347. end;
  348. function getcopy(p : ptree) : ptree;
  349. var
  350. hp : ptree;
  351. begin
  352. hp:=getnode;
  353. hp^:=p^;
  354. case p^.disposetyp of
  355. dt_leftright :
  356. begin
  357. if assigned(p^.left) then
  358. hp^.left:=getcopy(p^.left);
  359. if assigned(p^.right) then
  360. hp^.right:=getcopy(p^.right);
  361. end;
  362. dt_leftrighthigh :
  363. begin
  364. if assigned(p^.left) then
  365. hp^.left:=getcopy(p^.left);
  366. if assigned(p^.right) then
  367. hp^.right:=getcopy(p^.right);
  368. if assigned(p^.hightree) then
  369. hp^.left:=getcopy(p^.hightree);
  370. end;
  371. dt_nothing : ;
  372. dt_left :
  373. if assigned(p^.left) then
  374. hp^.left:=getcopy(p^.left);
  375. dt_mbleft :
  376. if assigned(p^.left) then
  377. hp^.left:=getcopy(p^.left);
  378. dt_mbleft_and_method :
  379. begin
  380. if assigned(p^.left) then
  381. hp^.left:=getcopy(p^.left);
  382. hp^.methodpointer:=getcopy(p^.methodpointer);
  383. end;
  384. dt_loop :
  385. begin
  386. if assigned(p^.left) then
  387. hp^.left:=getcopy(p^.left);
  388. if assigned(p^.right) then
  389. hp^.right:=getcopy(p^.right);
  390. if assigned(p^.t1) then
  391. hp^.t1:=getcopy(p^.t1);
  392. if assigned(p^.t2) then
  393. hp^.t2:=getcopy(p^.t2);
  394. end;
  395. dt_typeconv : hp^.left:=getcopy(p^.left);
  396. dt_inlinen :
  397. if assigned(p^.left) then
  398. hp^.left:=getcopy(p^.left);
  399. else internalerror(11);
  400. end;
  401. { now check treetype }
  402. case p^.treetype of
  403. stringconstn : begin
  404. hp^.value_str:=getpcharcopy(p);
  405. hp^.length:=p^.length;
  406. end;
  407. setconstn : begin
  408. new(hp^.value_set);
  409. hp^.value_set:=p^.value_set;
  410. end;
  411. end;
  412. getcopy:=hp;
  413. end;
  414. procedure deletecaselabels(p : pcaserecord);
  415. begin
  416. if assigned(p^.greater) then
  417. deletecaselabels(p^.greater);
  418. if assigned(p^.less) then
  419. deletecaselabels(p^.less);
  420. freelabel(p^._at);
  421. if p^.firstlabel then
  422. freelabel(p^.statement);
  423. dispose(p);
  424. end;
  425. procedure swaptree(p:Ptree);
  426. var swapp:Ptree;
  427. begin
  428. swapp:=p^.right;
  429. p^.right:=p^.left;
  430. p^.left:=swapp;
  431. p^.swaped:=not(p^.swaped);
  432. end;
  433. procedure disposetree(p : ptree);
  434. var
  435. symt : pwithsymtable;
  436. i : longint;
  437. begin
  438. if not(assigned(p)) then
  439. exit;
  440. if not(p^.treetype in [addn..loadvmtn]) then
  441. internalerror(26219);
  442. case p^.disposetyp of
  443. dt_leftright :
  444. begin
  445. if assigned(p^.left) then
  446. disposetree(p^.left);
  447. if assigned(p^.right) then
  448. disposetree(p^.right);
  449. end;
  450. dt_leftrighthigh :
  451. begin
  452. if assigned(p^.left) then
  453. disposetree(p^.left);
  454. if assigned(p^.right) then
  455. disposetree(p^.right);
  456. if assigned(p^.hightree) then
  457. disposetree(p^.hightree);
  458. end;
  459. dt_case :
  460. begin
  461. if assigned(p^.left) then
  462. disposetree(p^.left);
  463. if assigned(p^.right) then
  464. disposetree(p^.right);
  465. if assigned(p^.nodes) then
  466. deletecaselabels(p^.nodes);
  467. if assigned(p^.elseblock) then
  468. disposetree(p^.elseblock);
  469. end;
  470. dt_nothing : ;
  471. dt_left :
  472. if assigned(p^.left) then
  473. disposetree(p^.left);
  474. dt_mbleft :
  475. if assigned(p^.left) then
  476. disposetree(p^.left);
  477. dt_mbleft_and_method :
  478. begin
  479. if assigned(p^.left) then disposetree(p^.left);
  480. disposetree(p^.methodpointer);
  481. end;
  482. dt_typeconv : disposetree(p^.left);
  483. dt_inlinen :
  484. if assigned(p^.left) then
  485. disposetree(p^.left);
  486. dt_loop :
  487. begin
  488. if assigned(p^.left) then
  489. disposetree(p^.left);
  490. if assigned(p^.right) then
  491. disposetree(p^.right);
  492. if assigned(p^.t1) then
  493. disposetree(p^.t1);
  494. if assigned(p^.t2) then
  495. disposetree(p^.t2);
  496. end;
  497. dt_onn:
  498. begin
  499. if assigned(p^.left) then
  500. disposetree(p^.left);
  501. if assigned(p^.right) then
  502. disposetree(p^.right);
  503. if assigned(p^.exceptsymtable) then
  504. dispose(p^.exceptsymtable,done);
  505. end;
  506. dt_with :
  507. begin
  508. if assigned(p^.left) then
  509. disposetree(p^.left);
  510. if assigned(p^.right) then
  511. disposetree(p^.right);
  512. symt:=p^.withsymtable;
  513. for i:=1 to p^.tablecount do
  514. begin
  515. if assigned(symt) then
  516. begin
  517. p^.withsymtable:=pwithsymtable(symt^.next);
  518. dispose(symt,done);
  519. end;
  520. symt:=p^.withsymtable;
  521. end;
  522. end;
  523. else internalerror(12);
  524. end;
  525. putnode(p);
  526. end;
  527. procedure set_file_line(from,_to : ptree);
  528. begin
  529. if assigned(from) then
  530. _to^.fileinfo:=from^.fileinfo;
  531. end;
  532. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  533. begin
  534. p^.fileinfo:=filepos;
  535. end;
  536. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  537. var
  538. p : ptree;
  539. begin
  540. p:=getnode;
  541. p^.disposetyp:=dt_with;
  542. p^.treetype:=withn;
  543. p^.left:=l;
  544. p^.right:=r;
  545. p^.registers32:=0;
  546. { p^.registers16:=0;
  547. p^.registers8:=0; }
  548. p^.registersfpu:=0;
  549. {$ifdef SUPPORT_MMX}
  550. p^.registersmmx:=0;
  551. {$endif SUPPORT_MMX}
  552. p^.resulttype:=nil;
  553. p^.withsymtable:=symtable;
  554. p^.tablecount:=count;
  555. p^.pref:=nil;
  556. set_file_line(l,p);
  557. genwithnode:=p;
  558. end;
  559. function genfixconstnode(v : longint;def : pdef) : ptree;
  560. var
  561. p : ptree;
  562. begin
  563. p:=getnode;
  564. p^.disposetyp:=dt_nothing;
  565. p^.treetype:=fixconstn;
  566. p^.registers32:=0;
  567. { p^.registers16:=0;
  568. p^.registers8:=0; }
  569. p^.registersfpu:=0;
  570. {$ifdef SUPPORT_MMX}
  571. p^.registersmmx:=0;
  572. {$endif SUPPORT_MMX}
  573. p^.resulttype:=def;
  574. p^.value:=v;
  575. genfixconstnode:=p;
  576. end;
  577. function gencallparanode(expr,next : ptree) : ptree;
  578. var
  579. p : ptree;
  580. begin
  581. p:=getnode;
  582. p^.disposetyp:=dt_leftrighthigh;
  583. p^.treetype:=callparan;
  584. p^.left:=expr;
  585. p^.right:=next;
  586. p^.registers32:=0;
  587. { p^.registers16:=0;
  588. p^.registers8:=0; }
  589. {$ifdef SUPPORT_MMX}
  590. p^.registersmmx:=0;
  591. {$endif SUPPORT_MMX}
  592. p^.registersfpu:=0;
  593. p^.resulttype:=nil;
  594. p^.exact_match_found:=false;
  595. p^.is_colon_para:=false;
  596. p^.hightree:=nil;
  597. set_file_line(expr,p);
  598. gencallparanode:=p;
  599. end;
  600. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  601. var
  602. p : ptree;
  603. begin
  604. p:=getnode;
  605. p^.disposetyp:=dt_leftright;
  606. p^.treetype:=t;
  607. p^.left:=l;
  608. p^.right:=r;
  609. p^.registers32:=0;
  610. { p^.registers16:=0;
  611. p^.registers8:=0; }
  612. p^.registersfpu:=0;
  613. {$ifdef SUPPORT_MMX}
  614. p^.registersmmx:=0;
  615. {$endif SUPPORT_MMX}
  616. p^.resulttype:=nil;
  617. gennode:=p;
  618. end;
  619. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  620. var
  621. p : ptree;
  622. begin
  623. p:=getnode;
  624. p^.disposetyp:=dt_case;
  625. p^.treetype:=casen;
  626. p^.left:=l;
  627. p^.right:=r;
  628. p^.nodes:=nodes;
  629. p^.registers32:=0;
  630. p^.registersfpu:=0;
  631. {$ifdef SUPPORT_MMX}
  632. p^.registersmmx:=0;
  633. {$endif SUPPORT_MMX}
  634. p^.resulttype:=nil;
  635. set_file_line(l,p);
  636. gencasenode:=p;
  637. end;
  638. function genloopnode(t : ttreetyp;l,r,n1 : ptree;back : boolean) : ptree;
  639. var
  640. p : ptree;
  641. begin
  642. p:=getnode;
  643. p^.disposetyp:=dt_loop;
  644. p^.treetype:=t;
  645. p^.left:=l;
  646. p^.right:=r;
  647. p^.t1:=n1;
  648. p^.t2:=nil;
  649. p^.registers32:=0;
  650. p^.backward:=back;
  651. { p^.registers16:=0;
  652. p^.registers8:=0; }
  653. p^.registersfpu:=0;
  654. {$ifdef SUPPORT_MMX}
  655. p^.registersmmx:=0;
  656. {$endif SUPPORT_MMX}
  657. p^.resulttype:=nil;
  658. set_file_line(l,p);
  659. genloopnode:=p;
  660. end;
  661. function genordinalconstnode(v : longint;def : pdef) : ptree;
  662. var
  663. p : ptree;
  664. begin
  665. p:=getnode;
  666. p^.disposetyp:=dt_nothing;
  667. p^.treetype:=ordconstn;
  668. p^.registers32:=0;
  669. { p^.registers16:=0;
  670. p^.registers8:=0; }
  671. p^.registersfpu:=0;
  672. {$ifdef SUPPORT_MMX}
  673. p^.registersmmx:=0;
  674. {$endif SUPPORT_MMX}
  675. p^.resulttype:=def;
  676. p^.value:=v;
  677. if p^.resulttype^.deftype=orddef then
  678. testrange(p^.resulttype,p^.value);
  679. genordinalconstnode:=p;
  680. end;
  681. function genenumnode(v : penumsym) : ptree;
  682. var
  683. p : ptree;
  684. begin
  685. p:=getnode;
  686. p^.disposetyp:=dt_nothing;
  687. p^.treetype:=ordconstn;
  688. p^.registers32:=0;
  689. { p^.registers16:=0;
  690. p^.registers8:=0; }
  691. p^.registersfpu:=0;
  692. {$ifdef SUPPORT_MMX}
  693. p^.registersmmx:=0;
  694. {$endif SUPPORT_MMX}
  695. p^.resulttype:=v^.definition;
  696. p^.value:=v^.value;
  697. testrange(p^.resulttype,p^.value);
  698. genenumnode:=p;
  699. end;
  700. function genrealconstnode(v : bestreal) : ptree;
  701. var
  702. p : ptree;
  703. begin
  704. p:=getnode;
  705. p^.disposetyp:=dt_nothing;
  706. p^.treetype:=realconstn;
  707. p^.registers32:=0;
  708. { p^.registers16:=0;
  709. p^.registers8:=0; }
  710. p^.registersfpu:=0;
  711. {$ifdef SUPPORT_MMX}
  712. p^.registersmmx:=0;
  713. {$endif SUPPORT_MMX}
  714. {$ifdef i386}
  715. p^.resulttype:=c64floatdef;
  716. p^.value_real:=v;
  717. { default value is double }
  718. p^.realtyp:=ait_real_64bit;
  719. {$endif}
  720. {$ifdef m68k}
  721. p^.resulttype:=new(pfloatdef,init(s32real));
  722. p^.value_real:=v;
  723. { default value is double }
  724. p^.realtyp:=ait_real_32bit;
  725. {$endif}
  726. p^.lab_real:=nil;
  727. genrealconstnode:=p;
  728. end;
  729. function genstringconstnode(const s : string) : ptree;
  730. var
  731. p : ptree;
  732. l : longint;
  733. begin
  734. p:=getnode;
  735. p^.disposetyp:=dt_nothing;
  736. p^.treetype:=stringconstn;
  737. p^.registers32:=0;
  738. { p^.registers16:=0;
  739. p^.registers8:=0; }
  740. p^.registersfpu:=0;
  741. {$ifdef SUPPORT_MMX}
  742. p^.registersmmx:=0;
  743. {$endif SUPPORT_MMX}
  744. l:=length(s);
  745. p^.length:=l;
  746. { stringdup write even past a #0 }
  747. getmem(p^.value_str,l+1);
  748. move(s[1],p^.value_str^,l);
  749. p^.value_str[l]:=#0;
  750. p^.lab_str:=nil;
  751. if cs_ansistrings in aktlocalswitches then
  752. begin
  753. p^.stringtype:=st_ansistring;
  754. p^.resulttype:=cansistringdef;
  755. end
  756. else
  757. begin
  758. p^.stringtype:=st_shortstring;
  759. p^.resulttype:=cshortstringdef;
  760. end;
  761. genstringconstnode:=p;
  762. end;
  763. function getpcharcopy(p : ptree) : pchar;
  764. var
  765. pc : pchar;
  766. begin
  767. pc:=nil;
  768. getmem(pc,p^.length+1);
  769. if pc=nil then
  770. Message(general_f_no_memory_left);
  771. move(p^.value_str^,pc^,p^.length+1);
  772. getpcharcopy:=pc;
  773. end;
  774. function genpcharconstnode(s : pchar;length : longint) : ptree;
  775. var
  776. p : ptree;
  777. begin
  778. p:=getnode;
  779. p^.disposetyp:=dt_nothing;
  780. p^.treetype:=stringconstn;
  781. p^.registers32:=0;
  782. { p^.registers16:=0;
  783. p^.registers8:=0; }
  784. p^.registersfpu:=0;
  785. {$ifdef SUPPORT_MMX}
  786. p^.registersmmx:=0;
  787. {$endif SUPPORT_MMX}
  788. p^.resulttype:=cshortstringdef;
  789. p^.length:=length;
  790. p^.value_str:=s;
  791. p^.lab_str:=nil;
  792. genpcharconstnode:=p;
  793. end;
  794. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  795. var
  796. p : ptree;
  797. begin
  798. p:=getnode;
  799. p^.disposetyp:=dt_left;
  800. p^.treetype:=t;
  801. p^.left:=l;
  802. p^.registers32:=0;
  803. { p^.registers16:=0;
  804. p^.registers8:=0; }
  805. p^.registersfpu:=0;
  806. {$ifdef SUPPORT_MMX}
  807. p^.registersmmx:=0;
  808. {$endif SUPPORT_MMX}
  809. p^.resulttype:=nil;
  810. gensinglenode:=p;
  811. end;
  812. function genasmnode(p_asm : paasmoutput) : ptree;
  813. var
  814. p : ptree;
  815. begin
  816. p:=getnode;
  817. p^.disposetyp:=dt_nothing;
  818. p^.treetype:=asmn;
  819. p^.registers32:=4;
  820. p^.p_asm:=p_asm;
  821. p^.object_preserved:=false;
  822. { p^.registers16:=0;
  823. p^.registers8:=0; }
  824. p^.registersfpu:=8;
  825. {$ifdef SUPPORT_MMX}
  826. p^.registersmmx:=8;
  827. {$endif SUPPORT_MMX}
  828. p^.resulttype:=nil;
  829. genasmnode:=p;
  830. end;
  831. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  832. var
  833. p : ptree;
  834. begin
  835. p:=getnode;
  836. p^.registers32:=0;
  837. { p^.registers16:=0;
  838. p^.registers8:=0; }
  839. p^.registersfpu:=0;
  840. {$ifdef SUPPORT_MMX}
  841. p^.registersmmx:=0;
  842. {$endif SUPPORT_MMX}
  843. p^.treetype:=loadn;
  844. p^.resulttype:=v^.definition;
  845. p^.symtableentry:=v;
  846. p^.symtable:=st;
  847. p^.is_first := False;
  848. { method pointer load nodes can use the left subtree }
  849. p^.disposetyp:=dt_left;
  850. p^.left:=nil;
  851. genloadnode:=p;
  852. end;
  853. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  854. var
  855. p : ptree;
  856. begin
  857. p:=getnode;
  858. p^.registers32:=0;
  859. { p^.registers16:=0;
  860. p^.registers8:=0; }
  861. p^.registersfpu:=0;
  862. {$ifdef SUPPORT_MMX}
  863. p^.registersmmx:=0;
  864. {$endif SUPPORT_MMX}
  865. p^.treetype:=loadn;
  866. p^.left:=nil;
  867. p^.resulttype:=v^.definition;
  868. p^.symtableentry:=v;
  869. p^.symtable:=st;
  870. p^.is_first := False;
  871. p^.disposetyp:=dt_nothing;
  872. genloadcallnode:=p;
  873. end;
  874. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  875. var
  876. p : ptree;
  877. begin
  878. p:=getnode;
  879. p^.registers32:=0;
  880. { p^.registers16:=0;
  881. p^.registers8:=0; }
  882. p^.registersfpu:=0;
  883. {$ifdef SUPPORT_MMX}
  884. p^.registersmmx:=0;
  885. {$endif SUPPORT_MMX}
  886. p^.treetype:=loadn;
  887. p^.left:=nil;
  888. p^.resulttype:=sym^.definition;
  889. p^.symtableentry:=pvarsym(sym);
  890. p^.symtable:=st;
  891. p^.disposetyp:=dt_nothing;
  892. gentypedconstloadnode:=p;
  893. end;
  894. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  895. var
  896. p : ptree;
  897. begin
  898. p:=getnode;
  899. p^.disposetyp:=dt_typeconv;
  900. p^.treetype:=typeconvn;
  901. p^.left:=node;
  902. p^.registers32:=0;
  903. { p^.registers16:=0;
  904. p^.registers8:=0; }
  905. p^.convtyp:=tc_equal;
  906. p^.registersfpu:=0;
  907. {$ifdef SUPPORT_MMX}
  908. p^.registersmmx:=0;
  909. {$endif SUPPORT_MMX}
  910. p^.resulttype:=t;
  911. p^.explizit:=false;
  912. set_file_line(node,p);
  913. gentypeconvnode:=p;
  914. end;
  915. function gentypenode(t : pdef) : ptree;
  916. var
  917. p : ptree;
  918. begin
  919. p:=getnode;
  920. p^.disposetyp:=dt_nothing;
  921. p^.treetype:=typen;
  922. p^.registers32:=0;
  923. { p^.registers16:=0;
  924. p^.registers8:=0; }
  925. p^.registersfpu:=0;
  926. {$ifdef SUPPORT_MMX}
  927. p^.registersmmx:=0;
  928. {$endif SUPPORT_MMX}
  929. p^.resulttype:=generrordef;
  930. p^.typenodetype:=t;
  931. gentypenode:=p;
  932. end;
  933. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  934. var
  935. p : ptree;
  936. begin
  937. p:=getnode;
  938. p^.registers32:=0;
  939. { p^.registers16:=0;
  940. p^.registers8:=0; }
  941. p^.registersfpu:=0;
  942. {$ifdef SUPPORT_MMX}
  943. p^.registersmmx:=0;
  944. {$endif SUPPORT_MMX}
  945. p^.treetype:=calln;
  946. p^.symtableprocentry:=v;
  947. p^.symtableproc:=st;
  948. p^.unit_specific:=false;
  949. p^.no_check:=false;
  950. p^.return_value_used:=true;
  951. p^.disposetyp := dt_leftright;
  952. p^.methodpointer:=nil;
  953. p^.left:=nil;
  954. p^.right:=nil;
  955. p^.procdefinition:=nil;
  956. gencallnode:=p;
  957. end;
  958. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  959. var
  960. p : ptree;
  961. begin
  962. p:=getnode;
  963. p^.registers32:=0;
  964. { p^.registers16:=0;
  965. p^.registers8:=0; }
  966. p^.registersfpu:=0;
  967. {$ifdef SUPPORT_MMX}
  968. p^.registersmmx:=0;
  969. {$endif SUPPORT_MMX}
  970. p^.treetype:=calln;
  971. p^.return_value_used:=true;
  972. p^.symtableprocentry:=v;
  973. p^.symtableproc:=st;
  974. p^.disposetyp:=dt_mbleft_and_method;
  975. p^.left:=nil;
  976. p^.right:=nil;
  977. p^.methodpointer:=mp;
  978. p^.procdefinition:=nil;
  979. genmethodcallnode:=p;
  980. end;
  981. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  982. var
  983. p : ptree;
  984. begin
  985. p:=getnode;
  986. p^.disposetyp:=dt_left;
  987. p^.treetype:=subscriptn;
  988. p^.left:=l;
  989. p^.registers32:=0;
  990. p^.vs:=varsym;
  991. { p^.registers16:=0;
  992. p^.registers8:=0; }
  993. p^.registersfpu:=0;
  994. {$ifdef SUPPORT_MMX}
  995. p^.registersmmx:=0;
  996. {$endif SUPPORT_MMX}
  997. p^.resulttype:=nil;
  998. gensubscriptnode:=p;
  999. end;
  1000. function genzeronode(t : ttreetyp) : ptree;
  1001. var
  1002. p : ptree;
  1003. begin
  1004. p:=getnode;
  1005. p^.disposetyp:=dt_nothing;
  1006. p^.treetype:=t;
  1007. p^.registers32:=0;
  1008. { p^.registers16:=0;
  1009. p^.registers8:=0; }
  1010. p^.registersfpu:=0;
  1011. {$ifdef SUPPORT_MMX}
  1012. p^.registersmmx:=0;
  1013. {$endif SUPPORT_MMX}
  1014. p^.resulttype:=nil;
  1015. genzeronode:=p;
  1016. end;
  1017. function genlabelnode(t : ttreetyp;nr : plabel) : ptree;
  1018. var
  1019. p : ptree;
  1020. begin
  1021. p:=getnode;
  1022. p^.disposetyp:=dt_nothing;
  1023. p^.treetype:=t;
  1024. p^.registers32:=0;
  1025. { p^.registers16:=0;
  1026. p^.registers8:=0; }
  1027. p^.registersfpu:=0;
  1028. {$ifdef SUPPORT_MMX}
  1029. p^.registersmmx:=0;
  1030. {$endif SUPPORT_MMX}
  1031. p^.resulttype:=nil;
  1032. { for security }
  1033. { nr^.is_used:=true;}
  1034. p^.labelnr:=nr;
  1035. genlabelnode:=p;
  1036. end;
  1037. function genselfnode(_class : pdef) : ptree;
  1038. var
  1039. p : ptree;
  1040. begin
  1041. p:=getnode;
  1042. p^.disposetyp:=dt_nothing;
  1043. p^.treetype:=selfn;
  1044. p^.registers32:=0;
  1045. { p^.registers16:=0;
  1046. p^.registers8:=0; }
  1047. p^.registersfpu:=0;
  1048. {$ifdef SUPPORT_MMX}
  1049. p^.registersmmx:=0;
  1050. {$endif SUPPORT_MMX}
  1051. p^.resulttype:=_class;
  1052. genselfnode:=p;
  1053. end;
  1054. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1055. var
  1056. p : ptree;
  1057. begin
  1058. p:=getnode;
  1059. p^.disposetyp:=dt_inlinen;
  1060. p^.treetype:=inlinen;
  1061. p^.left:=l;
  1062. p^.inlinenumber:=number;
  1063. p^.inlineconst:=is_const;
  1064. p^.registers32:=0;
  1065. { p^.registers16:=0;
  1066. p^.registers8:=0; }
  1067. p^.registersfpu:=0;
  1068. {$ifdef SUPPORT_MMX}
  1069. p^.registersmmx:=0;
  1070. {$endif SUPPORT_MMX}
  1071. p^.resulttype:=nil;
  1072. geninlinenode:=p;
  1073. end;
  1074. { uses the callnode to create the new procinline node }
  1075. function genprocinlinenode(callp,code : ptree) : ptree;
  1076. var
  1077. p : ptree;
  1078. begin
  1079. p:=getnode;
  1080. p^.disposetyp:=dt_left;
  1081. p^.treetype:=procinlinen;
  1082. p^.inlineprocdef:=callp^.procdefinition;
  1083. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1084. p^.para_offset:=0;
  1085. p^.para_size:=p^.inlineprocdef^.para_size;
  1086. if ret_in_param(p^.inlineprocdef^.retdef) then
  1087. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1088. { copy args }
  1089. p^.left:=getcopy(code);
  1090. p^.registers32:=code^.registers32;
  1091. p^.registersfpu:=code^.registersfpu;
  1092. {$ifdef SUPPORT_MMX}
  1093. p^.registersmmx:=0;
  1094. {$endif SUPPORT_MMX}
  1095. p^.resulttype:=p^.inlineprocdef^.retdef;
  1096. genprocinlinenode:=p;
  1097. end;
  1098. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1099. var
  1100. p : ptree;
  1101. begin
  1102. p:=getnode;
  1103. p^.disposetyp:=dt_nothing;
  1104. p^.treetype:=setconstn;
  1105. p^.registers32:=0;
  1106. p^.registersfpu:=0;
  1107. {$ifdef SUPPORT_MMX}
  1108. p^.registersmmx:=0;
  1109. {$endif SUPPORT_MMX}
  1110. p^.resulttype:=settype;
  1111. p^.left:=nil;
  1112. new(p^.value_set);
  1113. p^.value_set^:=s^;
  1114. gensetconstnode:=p;
  1115. end;
  1116. {$ifdef extdebug}
  1117. procedure compare_trees(oldp,p : ptree);
  1118. var
  1119. error_found : boolean;
  1120. begin
  1121. if oldp^.resulttype<>p^.resulttype then
  1122. begin
  1123. error_found:=true;
  1124. if is_equal(oldp^.resulttype,p^.resulttype) then
  1125. comment(v_debug,'resulttype fields are different but equal')
  1126. else
  1127. comment(v_warning,'resulttype fields are really different');
  1128. end;
  1129. if oldp^.treetype<>p^.treetype then
  1130. begin
  1131. comment(v_warning,'treetype field different');
  1132. error_found:=true;
  1133. end
  1134. else
  1135. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1136. if oldp^.error<>p^.error then
  1137. begin
  1138. comment(v_warning,'error field different');
  1139. error_found:=true;
  1140. end;
  1141. if oldp^.disposetyp<>p^.disposetyp then
  1142. begin
  1143. comment(v_warning,'disposetyp field different');
  1144. error_found:=true;
  1145. end;
  1146. { is true, if the right and left operand are swaped }
  1147. if oldp^.swaped<>p^.swaped then
  1148. begin
  1149. comment(v_warning,'swaped field different');
  1150. error_found:=true;
  1151. end;
  1152. { the location of the result of this node }
  1153. if oldp^.location.loc<>p^.location.loc then
  1154. begin
  1155. comment(v_warning,'location.loc field different');
  1156. error_found:=true;
  1157. end;
  1158. { the number of registers needed to evalute the node }
  1159. if oldp^.registers32<>p^.registers32 then
  1160. begin
  1161. comment(v_warning,'registers32 field different');
  1162. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1163. error_found:=true;
  1164. end;
  1165. if oldp^.registersfpu<>p^.registersfpu then
  1166. begin
  1167. comment(v_warning,'registersfpu field different');
  1168. error_found:=true;
  1169. end;
  1170. {$ifdef SUPPORT_MMX}
  1171. if oldp^.registersmmx<>p^.registersmmx then
  1172. begin
  1173. comment(v_warning,'registersmmx field different');
  1174. error_found:=true;
  1175. end;
  1176. {$endif SUPPORT_MMX}
  1177. if oldp^.left<>p^.left then
  1178. begin
  1179. comment(v_warning,'left field different');
  1180. error_found:=true;
  1181. end;
  1182. if oldp^.right<>p^.right then
  1183. begin
  1184. comment(v_warning,'right field different');
  1185. error_found:=true;
  1186. end;
  1187. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1188. begin
  1189. comment(v_warning,'fileinfo.line field different');
  1190. error_found:=true;
  1191. end;
  1192. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1193. begin
  1194. comment(v_warning,'fileinfo.column field different');
  1195. error_found:=true;
  1196. end;
  1197. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1198. begin
  1199. comment(v_warning,'fileinfo.fileindex field different');
  1200. error_found:=true;
  1201. end;
  1202. if oldp^.localswitches<>p^.localswitches then
  1203. begin
  1204. comment(v_warning,'localswitches field different');
  1205. error_found:=true;
  1206. end;
  1207. {$ifdef extdebug}
  1208. if oldp^.firstpasscount<>p^.firstpasscount then
  1209. begin
  1210. comment(v_warning,'firstpasscount field different');
  1211. error_found:=true;
  1212. end;
  1213. {$endif extdebug}
  1214. if oldp^.treetype=p^.treetype then
  1215. case oldp^.treetype of
  1216. addn :
  1217. begin
  1218. if oldp^.use_strconcat<>p^.use_strconcat then
  1219. begin
  1220. comment(v_warning,'use_strconcat field different');
  1221. error_found:=true;
  1222. end;
  1223. if oldp^.string_typ<>p^.string_typ then
  1224. begin
  1225. comment(v_warning,'stringtyp field different');
  1226. error_found:=true;
  1227. end;
  1228. end;
  1229. callparan :
  1230. {(is_colon_para : boolean;exact_match_found : boolean);}
  1231. begin
  1232. if oldp^.is_colon_para<>p^.is_colon_para then
  1233. begin
  1234. comment(v_warning,'use_strconcat field different');
  1235. error_found:=true;
  1236. end;
  1237. if oldp^.exact_match_found<>p^.exact_match_found then
  1238. begin
  1239. comment(v_warning,'exact_match_found field different');
  1240. error_found:=true;
  1241. end;
  1242. end;
  1243. assignn :
  1244. {(assigntyp : tassigntyp;concat_string : boolean);}
  1245. begin
  1246. if oldp^.assigntyp<>p^.assigntyp then
  1247. begin
  1248. comment(v_warning,'assigntyp field different');
  1249. error_found:=true;
  1250. end;
  1251. if oldp^.concat_string<>p^.concat_string then
  1252. begin
  1253. comment(v_warning,'concat_string field different');
  1254. error_found:=true;
  1255. end;
  1256. end;
  1257. loadn :
  1258. {(symtableentry : psym;symtable : psymtable;
  1259. is_absolute,is_first : boolean);}
  1260. begin
  1261. if oldp^.symtableentry<>p^.symtableentry then
  1262. begin
  1263. comment(v_warning,'symtableentry field different');
  1264. error_found:=true;
  1265. end;
  1266. if oldp^.symtable<>p^.symtable then
  1267. begin
  1268. comment(v_warning,'symtable field different');
  1269. error_found:=true;
  1270. end;
  1271. if oldp^.is_absolute<>p^.is_absolute then
  1272. begin
  1273. comment(v_warning,'is_absolute field different');
  1274. error_found:=true;
  1275. end;
  1276. if oldp^.is_first<>p^.is_first then
  1277. begin
  1278. comment(v_warning,'is_first field different');
  1279. error_found:=true;
  1280. end;
  1281. end;
  1282. calln :
  1283. {(symtableprocentry : pprocsym;
  1284. symtableproc : psymtable;procdefinition : pprocdef;
  1285. methodpointer : ptree;
  1286. no_check,unit_specific : boolean);}
  1287. begin
  1288. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1289. begin
  1290. comment(v_warning,'symtableprocentry field different');
  1291. error_found:=true;
  1292. end;
  1293. if oldp^.symtableproc<>p^.symtableproc then
  1294. begin
  1295. comment(v_warning,'symtableproc field different');
  1296. error_found:=true;
  1297. end;
  1298. if oldp^.procdefinition<>p^.procdefinition then
  1299. begin
  1300. comment(v_warning,'procdefinition field different');
  1301. error_found:=true;
  1302. end;
  1303. if oldp^.methodpointer<>p^.methodpointer then
  1304. begin
  1305. comment(v_warning,'methodpointer field different');
  1306. error_found:=true;
  1307. end;
  1308. if oldp^.no_check<>p^.no_check then
  1309. begin
  1310. comment(v_warning,'no_check field different');
  1311. error_found:=true;
  1312. end;
  1313. if oldp^.unit_specific<>p^.unit_specific then
  1314. begin
  1315. error_found:=true;
  1316. comment(v_warning,'unit_specific field different');
  1317. end;
  1318. end;
  1319. ordconstn :
  1320. begin
  1321. if oldp^.value<>p^.value then
  1322. begin
  1323. comment(v_warning,'value field different');
  1324. error_found:=true;
  1325. end;
  1326. end;
  1327. realconstn :
  1328. begin
  1329. if oldp^.value_real<>p^.value_real then
  1330. begin
  1331. comment(v_warning,'valued field different');
  1332. error_found:=true;
  1333. end;
  1334. if oldp^.lab_real<>p^.lab_real then
  1335. begin
  1336. comment(v_warning,'labnumber field different');
  1337. error_found:=true;
  1338. end;
  1339. if oldp^.realtyp<>p^.realtyp then
  1340. begin
  1341. comment(v_warning,'realtyp field different');
  1342. error_found:=true;
  1343. end;
  1344. end;
  1345. end;
  1346. if not error_found then
  1347. comment(v_warning,'did not find difference in trees');
  1348. end;
  1349. {$endif extdebug}
  1350. function equal_trees(t1,t2 : ptree) : boolean;
  1351. begin
  1352. if t1^.treetype=t2^.treetype then
  1353. begin
  1354. case t1^.treetype of
  1355. addn,
  1356. muln,
  1357. equaln,
  1358. orn,
  1359. xorn,
  1360. andn,
  1361. unequaln:
  1362. begin
  1363. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1364. equal_trees(t1^.right,t2^.right)) or
  1365. (equal_trees(t1^.right,t2^.left) and
  1366. equal_trees(t1^.left,t2^.right));
  1367. end;
  1368. subn,
  1369. divn,
  1370. modn,
  1371. assignn,
  1372. ltn,
  1373. lten,
  1374. gtn,
  1375. gten,
  1376. inn,
  1377. shrn,
  1378. shln,
  1379. slashn,
  1380. rangen:
  1381. begin
  1382. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1383. equal_trees(t1^.right,t2^.right));
  1384. end;
  1385. umminusn,
  1386. notn,
  1387. derefn,
  1388. addrn:
  1389. begin
  1390. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1391. end;
  1392. loadn:
  1393. begin
  1394. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1395. { not necessary
  1396. and (t1^.symtable=t2^.symtable)};
  1397. end;
  1398. {
  1399. subscriptn,
  1400. ordconstn,typeconvn,calln,callparan,
  1401. realconstn,asmn,vecn,
  1402. stringconstn,funcretn,selfn,
  1403. inlinen,niln,errorn,
  1404. typen,hnewn,hdisposen,newn,
  1405. disposen,setelen,setconstrn
  1406. }
  1407. else equal_trees:=false;
  1408. end;
  1409. end
  1410. else
  1411. equal_trees:=false;
  1412. end;
  1413. procedure set_unique(p : ptree);
  1414. begin
  1415. if assigned(p) then
  1416. begin
  1417. case p^.treetype of
  1418. vecn:
  1419. p^.callunique:=true;
  1420. typeconvn:
  1421. set_unique(p^.left);
  1422. end;
  1423. end;
  1424. end;
  1425. procedure clear_location(var loc : tlocation);
  1426. begin
  1427. loc.loc:=LOC_INVALID;
  1428. end;
  1429. {This is needed if you want to be able to delete the string with the nodes !!}
  1430. procedure set_location(var destloc,sourceloc : tlocation);
  1431. begin
  1432. destloc:= sourceloc;
  1433. end;
  1434. procedure swap_location(var destloc,sourceloc : tlocation);
  1435. var
  1436. swapl : tlocation;
  1437. begin
  1438. swapl := destloc;
  1439. destloc := sourceloc;
  1440. sourceloc := swapl;
  1441. end;
  1442. function get_ordinal_value(p : ptree) : longint;
  1443. begin
  1444. if p^.treetype=ordconstn then
  1445. get_ordinal_value:=p^.value
  1446. else
  1447. Message(type_e_ordinal_expr_expected);
  1448. end;
  1449. function is_constnode(p : ptree) : boolean;
  1450. begin
  1451. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1452. end;
  1453. function is_constintnode(p : ptree) : boolean;
  1454. begin
  1455. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1456. end;
  1457. function is_constcharnode(p : ptree) : boolean;
  1458. begin
  1459. is_constcharnode:=((p^.treetype=ordconstn) and
  1460. (p^.resulttype^.deftype=orddef) and
  1461. (porddef(p^.resulttype)^.typ=uchar));
  1462. end;
  1463. function is_constrealnode(p : ptree) : boolean;
  1464. begin
  1465. is_constrealnode:=(p^.treetype=realconstn);
  1466. end;
  1467. function is_constboolnode(p : ptree) : boolean;
  1468. begin
  1469. is_constboolnode:=((p^.treetype=ordconstn) and
  1470. (p^.resulttype^.deftype=orddef) and
  1471. (porddef(p^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit]));
  1472. end;
  1473. function str_length(p : ptree) : longint;
  1474. begin
  1475. str_length:=p^.length;
  1476. end;
  1477. function is_emptyset(p : ptree):boolean;
  1478. {
  1479. return true if set s is empty
  1480. }
  1481. var
  1482. i : longint;
  1483. begin
  1484. i:=0;
  1485. if p^.treetype=setconstn then
  1486. begin
  1487. while (i<32) and (p^.value_set^[i]=0) do
  1488. inc(i);
  1489. end;
  1490. is_emptyset:=(i=32);
  1491. end;
  1492. end.
  1493. {
  1494. $Log$
  1495. Revision 1.67 1999-02-25 21:02:56 peter
  1496. * ag386bin updates
  1497. + coff writer
  1498. Revision 1.66 1999/02/22 02:15:59 peter
  1499. * updates for ag386bin
  1500. Revision 1.65 1999/02/11 09:46:31 pierre
  1501. * fix for normal method calls inside static methods :
  1502. WARNING there were both parser and codegen errors !!
  1503. added static_call boolean to calln tree
  1504. Revision 1.64 1999/01/27 12:57:22 pierre
  1505. * memory leaks with hightree solved by adding a new disposetyp
  1506. dt_leftrighthigh
  1507. Revision 1.63 1999/01/27 00:14:00 florian
  1508. * "procedure of object"-stuff fixed
  1509. Revision 1.62 1999/01/21 22:10:52 peter
  1510. * fixed array of const
  1511. * generic platform independent high() support
  1512. Revision 1.61 1999/01/21 16:41:09 pierre
  1513. * fix for constructor inside with statements
  1514. Revision 1.60 1998/12/15 11:52:19 peter
  1515. * fixed dup release of statement label in case
  1516. Revision 1.59 1998/12/15 10:23:32 peter
  1517. + -iSO, -iSP, -iTO, -iTP
  1518. Revision 1.58 1998/12/11 00:04:02 peter
  1519. + globtype,tokens,version unit splitted from globals
  1520. Revision 1.57 1998/12/04 10:18:13 florian
  1521. * some stuff for procedures of object added
  1522. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1523. Revision 1.56 1998/12/02 16:23:32 jonas
  1524. * changed "if longintvar in set" to case or "if () or () .." statements
  1525. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1526. Revision 1.55 1998/11/29 12:40:20 peter
  1527. * newcnv -> not oldcnv
  1528. Revision 1.54 1998/11/26 13:10:44 peter
  1529. * new int - int conversion -dNEWCNV
  1530. * some function renamings
  1531. Revision 1.53 1998/11/24 12:52:42 peter
  1532. * sets are not written twice anymore
  1533. * optimize for emptyset+single element which uses a new routine from
  1534. set.inc FPC_SET_CREATE_ELEMENT
  1535. Revision 1.52 1998/11/23 17:51:58 pierre
  1536. * added checking before dispose of reference string
  1537. Revision 1.51 1998/11/13 10:15:53 peter
  1538. * fixed ptr() with constants
  1539. Revision 1.50 1998/11/10 10:09:20 peter
  1540. * va_list -> array of const
  1541. Revision 1.49 1998/11/05 12:03:07 peter
  1542. * released useansistring
  1543. * removed -Sv, its now available in fpc modes
  1544. Revision 1.48 1998/10/21 15:12:59 pierre
  1545. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1546. * removed the GPF for unexistant overloading
  1547. (firstcall was called with procedinition=nil !)
  1548. * changed typen to what Florian proposed
  1549. gentypenode(p : pdef) sets the typenodetype field
  1550. and resulttype is only set if inside bt_type block !
  1551. Revision 1.47 1998/10/20 08:07:07 pierre
  1552. * several memory corruptions due to double freemem solved
  1553. => never use p^.loc.location:=p^.left^.loc.location;
  1554. + finally I added now by default
  1555. that ra386dir translates global and unit symbols
  1556. + added a first field in tsymtable and
  1557. a nextsym field in tsym
  1558. (this allows to obtain ordered type info for
  1559. records and objects in gdb !)
  1560. Revision 1.46 1998/10/08 17:17:37 pierre
  1561. * current_module old scanner tagged as invalid if unit is recompiled
  1562. + added ppheap for better info on tracegetmem of heaptrc
  1563. (adds line column and file index)
  1564. * several memory leaks removed ith help of heaptrc !!
  1565. Revision 1.45 1998/10/05 21:33:33 peter
  1566. * fixed 161,165,166,167,168
  1567. Revision 1.44 1998/09/28 16:57:28 pierre
  1568. * changed all length(p^.value_str^) into str_length(p)
  1569. to get it work with and without ansistrings
  1570. * changed sourcefiles field of tmodule to a pointer
  1571. Revision 1.43 1998/09/27 10:16:28 florian
  1572. * type casts pchar<->ansistring fixed
  1573. * ansistring[..] calls does now an unique call
  1574. Revision 1.42 1998/09/23 12:03:59 peter
  1575. * overloading fix for array of const
  1576. Revision 1.41 1998/09/23 09:58:55 peter
  1577. * first working array of const things
  1578. Revision 1.40 1998/09/22 15:34:07 peter
  1579. + pchar -> string conversion
  1580. Revision 1.39 1998/09/21 08:45:27 pierre
  1581. + added vmt_offset in tobjectdef.write for fututre use
  1582. (first steps to have objects without vmt if no virtual !!)
  1583. + added fpu_used field for tabstractprocdef :
  1584. sets this level to 2 if the functions return with value in FPU
  1585. (is then set to correct value at parsing of implementation)
  1586. THIS MIGHT refuse some code with FPU expression too complex
  1587. that were accepted before and even in some cases
  1588. that don't overflow in fact
  1589. ( like if f : float; is a forward that finally in implementation
  1590. only uses one fpu register !!)
  1591. Nevertheless I think that it will improve security on
  1592. FPU operations !!
  1593. * most other changes only for UseBrowser code
  1594. (added symtable references for record and objects)
  1595. local switch for refs to args and local of each function
  1596. (static symtable still missing)
  1597. UseBrowser still not stable and probably broken by
  1598. the definition hash array !!
  1599. Revision 1.38 1998/09/16 01:06:47 carl
  1600. * crash bugfix in firstaddr
  1601. Revision 1.37 1998/09/08 10:38:04 pierre
  1602. * some variable fields inside conditionnal were not updated
  1603. Revision 1.36 1998/09/07 18:46:17 peter
  1604. * update smartlinking, uses getdatalabel
  1605. * renamed ptree.value vars to value_str,value_real,value_set
  1606. Revision 1.35 1998/09/04 08:42:11 peter
  1607. * updated some error messages
  1608. Revision 1.34 1998/09/01 17:39:54 peter
  1609. + internal constant functions
  1610. Revision 1.33 1998/08/28 12:51:44 florian
  1611. + ansistring to pchar type cast fixed
  1612. Revision 1.32 1998/08/28 10:54:25 peter
  1613. * fixed smallset generation from elements, it has never worked before!
  1614. Revision 1.31 1998/08/21 14:08:58 pierre
  1615. + TEST_FUNCRET now default (old code removed)
  1616. works also for m68k (at least compiles)
  1617. Revision 1.30 1998/08/18 09:24:47 pierre
  1618. * small warning position bug fixed
  1619. * support_mmx switches splitting was missing
  1620. * rhide error and warning output corrected
  1621. Revision 1.29 1998/08/14 18:18:48 peter
  1622. + dynamic set contruction
  1623. * smallsets are now working (always longint size)
  1624. Revision 1.28 1998/08/13 11:00:13 peter
  1625. * fixed procedure<>procedure construct
  1626. Revision 1.27 1998/08/10 14:50:35 peter
  1627. + localswitches, moduleswitches, globalswitches splitting
  1628. Revision 1.26 1998/08/10 09:57:19 peter
  1629. - Remove InitTree which was empty and obsolete
  1630. Revision 1.25 1998/08/02 16:42:02 florian
  1631. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  1632. disposed by dellexlevel
  1633. Revision 1.24 1998/07/30 11:18:23 florian
  1634. + first implementation of try ... except on .. do end;
  1635. * limitiation of 65535 bytes parameters for cdecl removed
  1636. Revision 1.23 1998/07/24 22:17:01 florian
  1637. * internal error 10 together with array access fixed. I hope
  1638. that's the final fix.
  1639. Revision 1.22 1998/07/20 10:23:05 florian
  1640. * better ansi string assignement
  1641. Revision 1.21 1998/07/14 21:46:56 peter
  1642. * updated messages file
  1643. Revision 1.20 1998/07/14 14:47:11 peter
  1644. * released NEWINPUT
  1645. Revision 1.19 1998/07/08 14:56:53 daniel
  1646. * Fixed $ifdef TP.
  1647. Revision 1.18 1998/07/07 11:20:18 peter
  1648. + NEWINPUT for a better inputfile and scanner object
  1649. Revision 1.17 1998/06/22 08:59:03 daniel
  1650. - Removed pool of nodes.
  1651. Revision 1.16 1998/06/12 14:50:49 peter
  1652. * removed the tree dependency to types.pas
  1653. * long_fil.pas support (not fully tested yet)
  1654. Revision 1.15 1998/06/06 08:39:07 peter
  1655. * it needs types
  1656. Revision 1.14 1998/06/05 14:37:40 pierre
  1657. * fixes for inline for operators
  1658. * inline procedure more correctly restricted
  1659. Revision 1.13 1998/06/04 09:55:49 pierre
  1660. * demangled name of procsym reworked to become independant of the mangling scheme
  1661. Revision 1.12 1998/06/03 22:49:06 peter
  1662. + wordbool,longbool
  1663. * rename bis,von -> high,low
  1664. * moved some systemunit loading/creating to psystem.pas
  1665. Revision 1.10 1998/05/20 09:42:38 pierre
  1666. + UseTokenInfo now default
  1667. * unit in interface uses and implementation uses gives error now
  1668. * only one error for unknown symbol (uses lastsymknown boolean)
  1669. the problem came from the label code !
  1670. + first inlined procedures and function work
  1671. (warning there might be allowed cases were the result is still wrong !!)
  1672. * UseBrower updated gives a global list of all position of all used symbols
  1673. with switch -gb
  1674. Revision 1.9 1998/05/12 10:47:00 peter
  1675. * moved printstatus to verb_def
  1676. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1677. prefix like error: warning: and is included in V_Default
  1678. * fixed some messages
  1679. * first time parameter scan is only for -v and -T
  1680. - removed old style messages
  1681. Revision 1.8 1998/05/07 00:17:01 peter
  1682. * smartlinking for sets
  1683. + consts labels are now concated/generated in hcodegen
  1684. * moved some cpu code to cga and some none cpu depended code from cga
  1685. to tree and hcodegen and cleanup of hcodegen
  1686. * assembling .. output reduced for smartlinking ;)
  1687. Revision 1.7 1998/05/06 15:04:21 pierre
  1688. + when trying to find source files of a ppufile
  1689. check the includepathlist for included files
  1690. the main file must still be in the same directory
  1691. Revision 1.6 1998/05/06 08:38:52 pierre
  1692. * better position info with UseTokenInfo
  1693. UseTokenInfo greatly simplified
  1694. + added check for changed tree after first time firstpass
  1695. (if we could remove all the cases were it happen
  1696. we could skip all firstpass if firstpasscount > 1)
  1697. Only with ExtDebug
  1698. Revision 1.5 1998/04/30 15:59:43 pierre
  1699. * GDB works again better :
  1700. correct type info in one pass
  1701. + UseTokenInfo for better source position
  1702. * fixed one remaining bug in scanner for line counts
  1703. * several little fixes
  1704. Revision 1.4 1998/04/29 10:34:08 pierre
  1705. + added some code for ansistring (not complete nor working yet)
  1706. * corrected operator overloading
  1707. * corrected nasm output
  1708. + started inline procedures
  1709. + added starstarn : use ** for exponentiation (^ gave problems)
  1710. + started UseTokenInfo cond to get accurate positions
  1711. Revision 1.3 1998/04/21 10:16:49 peter
  1712. * patches from strasbourg
  1713. * objects is not used anymore in the fpc compiled version
  1714. Revision 1.2 1998/04/07 22:45:05 florian
  1715. * bug0092, bug0115 and bug0121 fixed
  1716. + packed object/class/array
  1717. }