tree.pas 62 KB

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