node.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. {
  2. $Id$
  3. Copyright (c) 2000 by Florian Klaempfl
  4. Basic node handling
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit node;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cobjects,cclasses,
  23. globtype,globals,
  24. cpubase,
  25. aasm,
  26. symtype;
  27. type
  28. pconstset = ^tconstset;
  29. tconstset = array[0..31] of byte;
  30. tnodetype = (
  31. addn, {Represents the + operator.}
  32. muln, {Represents the * operator.}
  33. subn, {Represents the - operator.}
  34. divn, {Represents the div operator.}
  35. symdifn, {Represents the >< operator.}
  36. modn, {Represents the mod operator.}
  37. assignn, {Represents an assignment.}
  38. loadn, {Represents the use of a variabele.}
  39. rangen, {Represents a range (i.e. 0..9).}
  40. ltn, {Represents the < operator.}
  41. lten, {Represents the <= operator.}
  42. gtn, {Represents the > operator.}
  43. gten, {Represents the >= operator.}
  44. equaln, {Represents the = operator.}
  45. unequaln, {Represents the <> operator.}
  46. inn, {Represents the in operator.}
  47. orn, {Represents the or operator.}
  48. xorn, {Represents the xor operator.}
  49. shrn, {Represents the shr operator.}
  50. shln, {Represents the shl operator.}
  51. slashn, {Represents the / operator.}
  52. andn, {Represents the and operator.}
  53. subscriptn, {??? Field in a record/object?}
  54. derefn, {Dereferences a pointer.}
  55. addrn, {Represents the @ operator.}
  56. doubleaddrn, {Represents the @@ operator.}
  57. ordconstn, {Represents an ordinal value.}
  58. typeconvn, {Represents type-conversion/typecast.}
  59. calln, {Represents a call node.}
  60. callparan, {Represents a parameter.}
  61. realconstn, {Represents a real value.}
  62. fixconstn, {Represents a fixed value.}
  63. unaryminusn, {Represents a sign change (i.e. -2).}
  64. asmn, {Represents an assembler node }
  65. vecn, {Represents array indexing.}
  66. pointerconstn,
  67. stringconstn, {Represents a string constant.}
  68. funcretn, {Represents the function result var.}
  69. selfn, {Represents the self parameter.}
  70. notn, {Represents the not operator.}
  71. inlinen, {Internal procedures (i.e. writeln).}
  72. niln, {Represents the nil pointer.}
  73. errorn, {This part of the tree could not be
  74. parsed because of a compiler error.}
  75. typen, {A type name. Used for i.e. typeof(obj).}
  76. hnewn, {The new operation, constructor call.}
  77. hdisposen, {The dispose operation with destructor call.}
  78. newn, {The new operation, constructor call.}
  79. simpledisposen, {The dispose operation.}
  80. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  81. setconstn, {A set constant (i.e. [1,2]).}
  82. blockn, {A block of statements.}
  83. statementn, {One statement in a block of nodes.}
  84. loopn, { used in genloopnode, must be converted }
  85. ifn, {An if statement.}
  86. breakn, {A break statement.}
  87. continuen, {A continue statement.}
  88. repeatn, {A repeat until block.}
  89. whilen, {A while do statement.}
  90. forn, {A for loop.}
  91. exitn, {An exit statement.}
  92. withn, {A with statement.}
  93. casen, {A case statement.}
  94. labeln, {A label.}
  95. goton, {A goto statement.}
  96. simplenewn, {The new operation.}
  97. tryexceptn, {A try except block.}
  98. raisen, {A raise statement.}
  99. switchesn, {??? Currently unused...}
  100. tryfinallyn, {A try finally statement.}
  101. onn, { for an on statement in exception code }
  102. isn, {Represents the is operator.}
  103. asn, {Represents the as typecast.}
  104. caretn, {Represents the ^ operator.}
  105. failn, {Represents the fail statement.}
  106. starstarn, {Represents the ** operator exponentiation }
  107. procinlinen, {Procedures that can be inlined }
  108. arrayconstructorn, {Construction node for [...] parsing}
  109. arrayconstructorrangen, {Range element to allow sets in array construction tree}
  110. { added for optimizations where we cannot suppress }
  111. nothingn,
  112. loadvmtn
  113. );
  114. { all boolean field of ttree are now collected in flags }
  115. tnodeflags = (
  116. nf_needs_truefalselabel,
  117. nf_swapable, { tbinop operands can be swaped }
  118. nf_swaped, { tbinop operands are swaped }
  119. nf_error,
  120. { flags used by tcallnode }
  121. nf_no_check,
  122. nf_unit_specific,
  123. nf_return_value_used,
  124. nf_static_call,
  125. { flags used by loop nodes }
  126. nf_backward, { set if it is a for ... downto ... do loop }
  127. nf_varstate, { do we need to parse childs to set var state }
  128. { taddrnode }
  129. nf_procvarload,
  130. { tvecnode }
  131. nf_memindex,
  132. nf_memseg,
  133. nf_callunique,
  134. { twithnode }
  135. nf_islocal,
  136. { tloadnode }
  137. nf_absolute,
  138. nf_first,
  139. { tassignmentnode }
  140. nf_concat_string,
  141. { tfuncretnode }
  142. nf_is_first_funcret, { 20th }
  143. { tarrayconstructnode }
  144. nf_cargs,
  145. nf_cargswap,
  146. nf_forcevaria,
  147. nf_novariaallowed,
  148. { ttypeconvnode }
  149. nf_explizit,
  150. { tinlinenode }
  151. nf_inlineconst,
  152. { general }
  153. nf_isproperty,
  154. nf_varstateset,
  155. { tasmnode }
  156. nf_object_preserved,
  157. { taddnode }
  158. nf_use_strconcat
  159. );
  160. tnodeflagset = set of tnodeflags;
  161. const
  162. { contains the flags which must be equal for the equality }
  163. { of nodes }
  164. flagsequal : tnodeflagset = [nf_error,nf_static_call,nf_backward];
  165. type
  166. tnodelist = class
  167. end;
  168. { later (for the newcg) tnode will inherit from tlinkedlist_item }
  169. tnode = class
  170. nodetype : tnodetype;
  171. { the location of the result of this node }
  172. location : tlocation;
  173. { the parent node of this is node }
  174. { this field is set by concattolist }
  175. parent : tnode;
  176. { there are some properties about the node stored }
  177. flags : tnodeflagset;
  178. { the number of registers needed to evalute the node }
  179. registers32,registersfpu : longint; { must be longint !!!! }
  180. {$ifdef SUPPORT_MMX}
  181. registersmmx,registerskni : longint;
  182. {$endif SUPPORT_MMX}
  183. resulttype : pdef;
  184. fileinfo : tfileposinfo;
  185. localswitches : tlocalswitches;
  186. {$ifdef extdebug}
  187. maxfirstpasscount,
  188. firstpasscount : longint;
  189. {$endif extdebug}
  190. list : taasmoutput;
  191. constructor create(tt : tnodetype);
  192. { this constructor is only for creating copies of class }
  193. { the fields are copied by getcopy }
  194. constructor createforcopy;
  195. destructor destroy;override;
  196. { toggles the flag }
  197. procedure toggleflag(f : tnodeflags);
  198. { the 1.1 code generator may override pass_1 }
  199. { and it need not to implement det_* then }
  200. { 1.1: pass_1 returns a value<>0 if the node has been transformed }
  201. { 2.0: runs det_resulttype and det_temp }
  202. function pass_1 : tnode;virtual;
  203. { dermines the resulttype of the node }
  204. procedure det_resulttype;virtual;abstract;
  205. { dermines the number of necessary temp. locations to evaluate
  206. the node }
  207. procedure det_temp;virtual;abstract;
  208. procedure pass_2;virtual;abstract;
  209. { comparing of nodes }
  210. function isequal(p : tnode) : boolean;
  211. { to implement comparisation, override this method }
  212. function docompare(p : tnode) : boolean;virtual;
  213. { gets a copy of the node }
  214. function getcopy : tnode;virtual;
  215. procedure insertintolist(l : tnodelist);virtual;
  216. {$ifdef EXTDEBUG}
  217. { writes a node for debugging purpose, shouldn't be called }
  218. { direct, because there is no test for nil, use writenode }
  219. { to write a complete tree }
  220. procedure dowrite;virtual;
  221. procedure dowritenodetype;virtual;
  222. {$endif EXTDEBUG}
  223. procedure concattolist(l : tlinkedlist);virtual;
  224. function ischild(p : tnode) : boolean;virtual;
  225. procedure set_file_line(from : tnode);
  226. procedure set_tree_filepos(const filepos : tfileposinfo);
  227. end;
  228. { this node is the anchestor for all nodes with at least }
  229. { one child, you have to use it if you want to use }
  230. { true- and falselabel }
  231. tparentnode = class(tnode)
  232. {$ifdef newcg}
  233. falselabel,truelabel : pasmlabel;
  234. {$endif newcg}
  235. end;
  236. tnodeclass = class of tnode;
  237. punarynode = ^tunarynode;
  238. tunarynode = class(tparentnode)
  239. left : tnode;
  240. constructor create(tt : tnodetype;l : tnode);
  241. destructor destroy;override;
  242. procedure concattolist(l : tlinkedlist);override;
  243. function ischild(p : tnode) : boolean;override;
  244. procedure det_resulttype;override;
  245. procedure det_temp;override;
  246. function docompare(p : tnode) : boolean;override;
  247. function getcopy : tnode;override;
  248. procedure insertintolist(l : tnodelist);override;
  249. procedure left_max;
  250. {$ifdef extdebug}
  251. procedure dowrite;override;
  252. {$endif extdebug}
  253. end;
  254. pbinarynode = ^tbinarynode;
  255. tbinarynode = class(tunarynode)
  256. right : tnode;
  257. constructor create(tt : tnodetype;l,r : tnode);
  258. destructor destroy;override;
  259. procedure concattolist(l : tlinkedlist);override;
  260. function ischild(p : tnode) : boolean;override;
  261. procedure det_resulttype;override;
  262. procedure det_temp;override;
  263. function docompare(p : tnode) : boolean;override;
  264. procedure swapleftright;
  265. function getcopy : tnode;override;
  266. procedure insertintolist(l : tnodelist);override;
  267. procedure left_right_max;
  268. {$ifdef extdebug}
  269. procedure dowrite;override;
  270. {$endif extdebug}
  271. end;
  272. pbinopnode = ^tbinopnode;
  273. tbinopnode = class(tbinarynode)
  274. constructor create(tt : tnodetype;l,r : tnode);virtual;
  275. function docompare(p : tnode) : boolean;override;
  276. end;
  277. {$ifdef EXTDEBUG}
  278. var
  279. writenodeindention : string;
  280. procedure writenode(t:tnode);
  281. {$endif EXTDEBUG}
  282. implementation
  283. uses
  284. cutils;
  285. {****************************************************************************
  286. TNODE
  287. ****************************************************************************}
  288. constructor tnode.create(tt : tnodetype);
  289. begin
  290. inherited create;
  291. nodetype:=tt;
  292. { this allows easier error tracing }
  293. location.loc:=LOC_INVALID;
  294. { save local info }
  295. fileinfo:=aktfilepos;
  296. localswitches:=aktlocalswitches;
  297. resulttype:=nil;
  298. registers32:=0;
  299. registersfpu:=0;
  300. {$ifdef SUPPORT_MMX}
  301. registersmmx:=0;
  302. {$endif SUPPORT_MMX}
  303. flags:=[];
  304. end;
  305. constructor tnode.createforcopy;
  306. begin
  307. end;
  308. procedure tnode.toggleflag(f : tnodeflags);
  309. begin
  310. if f in flags then
  311. exclude(flags,f)
  312. else
  313. include(flags,f);
  314. end;
  315. destructor tnode.destroy;
  316. begin
  317. { reference info }
  318. {if (location.loc in [LOC_MEM,LOC_REFERENCE]) and
  319. assigned(location.reference.symbol) then
  320. dispose(location.reference.symbol,done);}
  321. {$ifdef EXTDEBUG}
  322. if firstpasscount>maxfirstpasscount then
  323. maxfirstpasscount:=firstpasscount;
  324. {$endif EXTDEBUG}
  325. end;
  326. function tnode.pass_1 : tnode;
  327. begin
  328. pass_1:=nil;
  329. if not(assigned(resulttype)) then
  330. det_resulttype;
  331. det_temp;
  332. end;
  333. procedure tnode.concattolist(l : tlinkedlist);
  334. begin
  335. {$ifdef newcg}
  336. //!!!!!!! l^.concat(self);
  337. {$warning fixme}
  338. {$endif newcg}
  339. end;
  340. function tnode.ischild(p : tnode) : boolean;
  341. begin
  342. ischild:=false;
  343. end;
  344. {$ifdef EXTDEBUG}
  345. procedure tnode.dowrite;
  346. begin
  347. dowritenodetype;
  348. end;
  349. procedure tnode.dowritenodetype;
  350. const nodetype2str : array[tnodetype] of string[20] = (
  351. 'addn',
  352. 'muln',
  353. 'subn',
  354. 'divn',
  355. 'symdifn',
  356. 'modn',
  357. 'assignn',
  358. 'loadn',
  359. 'rangen',
  360. 'ltn',
  361. 'lten',
  362. 'gtn',
  363. 'gten',
  364. 'equaln',
  365. 'unequaln',
  366. 'inn',
  367. 'orn',
  368. 'xorn',
  369. 'shrn',
  370. 'shln',
  371. 'slashn',
  372. 'andn',
  373. 'subscriptn',
  374. 'derefn',
  375. 'addrn',
  376. 'doubleaddrn',
  377. 'ordconstn',
  378. 'typeconvn',
  379. 'calln',
  380. 'callparan',
  381. 'realconstn',
  382. 'fixconstn',
  383. 'umminusn',
  384. 'asmn',
  385. 'vecn',
  386. 'pointerconstn',
  387. 'stringconstn',
  388. 'funcretn',
  389. 'selfn',
  390. 'notn',
  391. 'inlinen',
  392. 'niln',
  393. 'errorn',
  394. 'typen',
  395. 'hnewn',
  396. 'hdisposen',
  397. 'newn',
  398. 'simpledisposen',
  399. 'setelementn',
  400. 'setconstn',
  401. 'blockn',
  402. 'statementn',
  403. 'loopn',
  404. 'ifn',
  405. 'breakn',
  406. 'continuen',
  407. 'repeatn',
  408. 'whilen',
  409. 'forn',
  410. 'exitn',
  411. 'withn',
  412. 'casen',
  413. 'labeln',
  414. 'goton',
  415. 'simplenewn',
  416. 'tryexceptn',
  417. 'raisen',
  418. 'switchesn',
  419. 'tryfinallyn',
  420. 'onn',
  421. 'isn',
  422. 'asn',
  423. 'caretn',
  424. 'failn',
  425. 'starstarn',
  426. 'procinlinen',
  427. 'arrayconstructn',
  428. 'arrayconstructrangen',
  429. 'nothingn',
  430. 'loadvmtn');
  431. begin
  432. write(writenodeindention,'(',nodetype2str[nodetype]);
  433. end;
  434. {$endif EXTDEBUG}
  435. function tnode.isequal(p : tnode) : boolean;
  436. begin
  437. isequal:=assigned(p) and (p.nodetype=nodetype) and
  438. (flags*flagsequal=p.flags*flagsequal) and
  439. docompare(p);
  440. end;
  441. function tnode.docompare(p : tnode) : boolean;
  442. begin
  443. docompare:=true;
  444. end;
  445. function tnode.getcopy : tnode;
  446. var
  447. p : tnode;
  448. begin
  449. { this is quite tricky because we need a node of the current }
  450. { node type and not one of tnode! }
  451. p:=tnodeclass(classtype).createforcopy;
  452. p.nodetype:=nodetype;
  453. p.location:=location;
  454. p.parent:=parent;
  455. p.flags:=flags;
  456. p.registers32:=registers32;
  457. p.registersfpu:=registersfpu;
  458. {$ifdef SUPPORT_MMX}
  459. p.registersmmx:=registersmmx;
  460. p.registerskni:=registerskni;
  461. {$endif SUPPORT_MMX}
  462. p.resulttype:=resulttype;
  463. p.fileinfo:=fileinfo;
  464. p.localswitches:=localswitches;
  465. {$ifdef extdebug}
  466. p.firstpasscount:=firstpasscount;
  467. {$endif extdebug}
  468. p.list:=list;
  469. getcopy:=p;
  470. end;
  471. procedure tnode.insertintolist(l : tnodelist);
  472. begin
  473. end;
  474. procedure tnode.set_file_line(from : tnode);
  475. begin
  476. if assigned(from) then
  477. fileinfo:=from.fileinfo;
  478. end;
  479. procedure tnode.set_tree_filepos(const filepos : tfileposinfo);
  480. begin
  481. fileinfo:=filepos;
  482. end;
  483. {****************************************************************************
  484. TUNARYNODE
  485. ****************************************************************************}
  486. constructor tunarynode.create(tt : tnodetype;l : tnode);
  487. begin
  488. inherited create(tt);
  489. left:=l;
  490. end;
  491. destructor tunarynode.destroy;
  492. begin
  493. left.free;
  494. inherited destroy;
  495. end;
  496. function tunarynode.docompare(p : tnode) : boolean;
  497. begin
  498. docompare:=(inherited docompare(p)) and
  499. left.isequal(tunarynode(p).left);
  500. end;
  501. function tunarynode.getcopy : tnode;
  502. var
  503. p : tunarynode;
  504. begin
  505. p:=tunarynode(inherited getcopy);
  506. if assigned(left) then
  507. p.left:=left.getcopy
  508. else
  509. p.left:=nil;
  510. getcopy:=p;
  511. end;
  512. procedure tunarynode.insertintolist(l : tnodelist);
  513. begin
  514. end;
  515. {$ifdef extdebug}
  516. procedure tunarynode.dowrite;
  517. begin
  518. inherited dowrite;
  519. writeln(',');
  520. writenodeindention:=writenodeindention+' ';
  521. writenode(left);
  522. write(')');
  523. delete(writenodeindention,1,4);
  524. end;
  525. {$endif}
  526. procedure tunarynode.left_max;
  527. begin
  528. registers32:=left.registers32;
  529. registersfpu:=left.registersfpu;
  530. {$ifdef SUPPORT_MMX}
  531. registersmmx:=left.registersmmx;
  532. {$endif SUPPORT_MMX}
  533. end;
  534. procedure tunarynode.concattolist(l : tlinkedlist);
  535. begin
  536. left.parent:=self;
  537. left.concattolist(l);
  538. inherited concattolist(l);
  539. end;
  540. function tunarynode.ischild(p : tnode) : boolean;
  541. begin
  542. ischild:=p=left;
  543. end;
  544. procedure tunarynode.det_resulttype;
  545. begin
  546. left.det_resulttype;
  547. end;
  548. procedure tunarynode.det_temp;
  549. begin
  550. left.det_temp;
  551. end;
  552. {****************************************************************************
  553. TBINARYNODE
  554. ****************************************************************************}
  555. constructor tbinarynode.create(tt : tnodetype;l,r : tnode);
  556. begin
  557. inherited create(tt,l);
  558. right:=r
  559. end;
  560. destructor tbinarynode.destroy;
  561. begin
  562. right.free;
  563. inherited destroy;
  564. end;
  565. procedure tbinarynode.concattolist(l : tlinkedlist);
  566. begin
  567. { we could change that depending on the number of }
  568. { required registers }
  569. left.parent:=self;
  570. left.concattolist(l);
  571. left.parent:=self;
  572. left.concattolist(l);
  573. inherited concattolist(l);
  574. end;
  575. function tbinarynode.ischild(p : tnode) : boolean;
  576. begin
  577. ischild:=(p=right) or (p=right);
  578. end;
  579. procedure tbinarynode.det_resulttype;
  580. begin
  581. left.det_resulttype;
  582. right.det_resulttype;
  583. end;
  584. procedure tbinarynode.det_temp;
  585. begin
  586. left.det_temp;
  587. right.det_temp;
  588. end;
  589. function tbinarynode.docompare(p : tnode) : boolean;
  590. begin
  591. docompare:=left.isequal(tbinarynode(p).left) and
  592. right.isequal(tbinarynode(p).right);
  593. end;
  594. function tbinarynode.getcopy : tnode;
  595. var
  596. p : tbinarynode;
  597. begin
  598. p:=tbinarynode(inherited getcopy);
  599. if assigned(right) then
  600. p.right:=right.getcopy
  601. else
  602. p.right:=nil;
  603. getcopy:=p;
  604. end;
  605. procedure tbinarynode.insertintolist(l : tnodelist);
  606. begin
  607. end;
  608. procedure tbinarynode.swapleftright;
  609. var
  610. swapp : tnode;
  611. begin
  612. swapp:=right;
  613. right:=left;
  614. left:=
  615. swapp;
  616. if nf_swaped in flags then
  617. exclude(flags,nf_swaped)
  618. else
  619. include(flags,nf_swaped);
  620. end;
  621. procedure tbinarynode.left_right_max;
  622. begin
  623. if assigned(left) then
  624. begin
  625. if assigned(right) then
  626. begin
  627. registers32:=max(left.registers32,right.registers32);
  628. registersfpu:=max(left.registersfpu,right.registersfpu);
  629. {$ifdef SUPPORT_MMX}
  630. registersmmx:=max(left.registersmmx,right.registersmmx);
  631. {$endif SUPPORT_MMX}
  632. end
  633. else
  634. begin
  635. registers32:=left.registers32;
  636. registersfpu:=left.registersfpu;
  637. {$ifdef SUPPORT_MMX}
  638. registersmmx:=left.registersmmx;
  639. {$endif SUPPORT_MMX}
  640. end;
  641. end;
  642. end;
  643. {$ifdef extdebug}
  644. procedure tbinarynode.dowrite;
  645. begin
  646. inherited dowrite;
  647. writeln(',');
  648. writenodeindention:=writenodeindention+' ';
  649. writenode(right);
  650. write(')');
  651. delete(writenodeindention,1,4);
  652. end;
  653. {$endif}
  654. {****************************************************************************
  655. TBINOPYNODE
  656. ****************************************************************************}
  657. constructor tbinopnode.create(tt : tnodetype;l,r : tnode);
  658. begin
  659. inherited create(tt,l,r);
  660. end;
  661. function tbinopnode.docompare(p : tnode) : boolean;
  662. begin
  663. docompare:=(inherited docompare(p)) or
  664. ((nf_swapable in flags) and
  665. left.isequal(tbinopnode(p).right) and
  666. right.isequal(tbinopnode(p).left));
  667. end;
  668. {****************************************************************************
  669. WRITENODE
  670. ****************************************************************************}
  671. {$ifdef EXTDEBUG}
  672. procedure writenode(t:tnode);
  673. begin
  674. if assigned(t) then
  675. t.dowrite
  676. else
  677. write(writenodeindention,'nil');
  678. if writenodeindention='' then
  679. writeln;
  680. end;
  681. {$endif EXTDEBUG}
  682. end.
  683. {
  684. $Log$
  685. Revision 1.11 2000-12-25 00:07:26 peter
  686. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  687. tlinkedlist objects)
  688. Revision 1.10 2000/11/29 00:30:34 florian
  689. * unused units removed from uses clause
  690. * some changes for widestrings
  691. Revision 1.9 2000/10/31 22:02:49 peter
  692. * symtable splitted, no real code changes
  693. Revision 1.8 2000/10/01 19:48:24 peter
  694. * lot of compile updates for cg11
  695. Revision 1.7 2000/09/30 16:08:45 peter
  696. * more cg11 updates
  697. Revision 1.6 2000/09/28 19:49:52 florian
  698. *** empty log message ***
  699. Revision 1.5 2000/09/27 18:14:31 florian
  700. * fixed a lot of syntax errors in the n*.pas stuff
  701. Revision 1.4 2000/09/24 15:06:19 peter
  702. * use defines.inc
  703. Revision 1.3 2000/09/22 21:45:35 florian
  704. * some updates e.g. getcopy added
  705. Revision 1.2 2000/09/20 21:52:38 florian
  706. * removed a lot of errors
  707. Revision 1.1 2000/08/26 12:27:35 florian
  708. * initial release
  709. }