tree.pas 64 KB

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