pstatmnt.pas 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. Does the parsing of the statements
  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 pstatmnt;
  19. interface
  20. uses tree;
  21. var
  22. { true, if we are in a except block }
  23. in_except_block : boolean;
  24. { reads a block }
  25. function block(islibrary : boolean) : ptree;
  26. { reads an assembler block }
  27. function assembler_block : ptree;
  28. implementation
  29. uses
  30. globtype,systems,tokens,
  31. strings,cobjects,globals,files,verbose,
  32. symtable,aasm,pass_1,types,scanner,hcodegen,ppu
  33. ,pbase,pexpr,pdecl
  34. {$ifdef i386}
  35. ,i386,tgeni386
  36. {$ifndef NoRa386Int}
  37. ,ra386int
  38. {$endif NoRa386Int}
  39. {$ifndef NoRa386Att}
  40. ,ra386att
  41. {$endif NoRa386Att}
  42. {$ifndef NoRa386Dir}
  43. ,ra386dir
  44. {$endif NoRa386Dir}
  45. {$endif i386}
  46. {$ifdef m68k}
  47. ,m68k,tgen68k
  48. {$ifndef NoRa68kMot}
  49. ,ra68kmot
  50. {$endif NoRa68kMot}
  51. {$endif m68k}
  52. ;
  53. const
  54. statement_level : longint = 0;
  55. function statement : ptree;forward;
  56. function if_statement : ptree;
  57. var
  58. ex,if_a,else_a : ptree;
  59. begin
  60. consume(_IF);
  61. ex:=comp_expr(true);
  62. consume(_THEN);
  63. if token<>_ELSE then
  64. if_a:=statement
  65. else
  66. if_a:=nil;
  67. if token=_ELSE then
  68. begin
  69. consume(_ELSE);
  70. else_a:=statement;
  71. end
  72. else
  73. else_a:=nil;
  74. if_statement:=genloopnode(ifn,ex,if_a,else_a,false);
  75. end;
  76. { creates a block (list) of statements, til the next END token }
  77. function statements_til_end : ptree;
  78. var
  79. first,last : ptree;
  80. begin
  81. first:=nil;
  82. while token<>_END do
  83. begin
  84. if first=nil then
  85. begin
  86. last:=gennode(statementn,nil,statement);
  87. first:=last;
  88. end
  89. else
  90. begin
  91. last^.left:=gennode(statementn,nil,statement);
  92. last:=last^.left;
  93. end;
  94. if token<>SEMICOLON then
  95. break
  96. else
  97. consume(SEMICOLON);
  98. while token=SEMICOLON do
  99. consume(SEMICOLON);
  100. end;
  101. consume(_END);
  102. statements_til_end:=gensinglenode(blockn,first);
  103. end;
  104. function case_statement : ptree;
  105. var
  106. { contains the label number of currently parsed case block }
  107. aktcaselabel : plabel;
  108. firstlabel : boolean;
  109. root : pcaserecord;
  110. { the typ of the case expression }
  111. casedef : pdef;
  112. procedure newcaselabel(l,h : longint;first:boolean);
  113. var
  114. hcaselabel : pcaserecord;
  115. procedure insertlabel(var p : pcaserecord);
  116. begin
  117. if p=nil then p:=hcaselabel
  118. else
  119. if (p^._low>hcaselabel^._low) and
  120. (p^._low>hcaselabel^._high) then
  121. if (hcaselabel^.statement = p^.statement) and
  122. (p^._low = hcaselabel^._high + 1) then
  123. begin
  124. p^._low := hcaselabel^._low;
  125. freelabel(hcaselabel^._at);
  126. dispose(hcaselabel);
  127. end
  128. else
  129. insertlabel(p^.less)
  130. else
  131. if (p^._high<hcaselabel^._low) and
  132. (p^._high<hcaselabel^._high) then
  133. if (hcaselabel^.statement = p^.statement) and
  134. (p^._high+1 = hcaselabel^._low) then
  135. begin
  136. p^._high := hcaselabel^._high;
  137. freelabel(hcaselabel^._at);
  138. dispose(hcaselabel);
  139. end
  140. else
  141. insertlabel(p^.greater)
  142. else Message(parser_e_double_caselabel);
  143. end;
  144. begin
  145. new(hcaselabel);
  146. hcaselabel^.less:=nil;
  147. hcaselabel^.greater:=nil;
  148. hcaselabel^.statement:=aktcaselabel;
  149. hcaselabel^.firstlabel:=first;
  150. getlabel(hcaselabel^._at);
  151. hcaselabel^._low:=l;
  152. hcaselabel^._high:=h;
  153. insertlabel(root);
  154. end;
  155. var
  156. code,caseexpr,p,instruc,elseblock : ptree;
  157. hl1,hl2 : longint;
  158. begin
  159. consume(_CASE);
  160. caseexpr:=comp_expr(true);
  161. { determines result type }
  162. cleartempgen;
  163. do_firstpass(caseexpr);
  164. casedef:=caseexpr^.resulttype;
  165. if not(is_ordinal(casedef)) then
  166. Message(type_e_ordinal_expr_expected);
  167. consume(_OF);
  168. inc(statement_level);
  169. root:=nil;
  170. instruc:=nil;
  171. repeat
  172. getlabel(aktcaselabel);
  173. firstlabel:=true;
  174. { may be an instruction has more case labels }
  175. repeat
  176. p:=expr;
  177. cleartempgen;
  178. do_firstpass(p);
  179. if (p^.treetype=rangen) then
  180. begin
  181. { type checking for case statements }
  182. if not is_subequal(casedef, p^.left^.resulttype) then
  183. Message(parser_e_case_mismatch);
  184. { type checking for case statements }
  185. if not is_subequal(casedef, p^.right^.resulttype) then
  186. Message(parser_e_case_mismatch);
  187. hl1:=get_ordinal_value(p^.left);
  188. hl2:=get_ordinal_value(p^.right);
  189. testrange(casedef,hl1);
  190. testrange(casedef,hl2);
  191. if hl1>hl2 then
  192. Message(parser_e_case_lower_less_than_upper_bound);
  193. newcaselabel(hl1,hl2,firstlabel);
  194. end
  195. else
  196. begin
  197. { type checking for case statements }
  198. if not is_subequal(casedef, p^.resulttype) then
  199. Message(parser_e_case_mismatch);
  200. hl1:=get_ordinal_value(p);
  201. testrange(casedef,hl1);
  202. newcaselabel(hl1,hl1,firstlabel);
  203. end;
  204. disposetree(p);
  205. if token=COMMA then
  206. consume(COMMA)
  207. else
  208. break;
  209. firstlabel:=false;
  210. until false;
  211. consume(COLON);
  212. { handles instruction block }
  213. p:=gensinglenode(labeln,statement);
  214. p^.labelnr:=aktcaselabel;
  215. { concats instruction }
  216. instruc:=gennode(statementn,instruc,p);
  217. if not((token=_ELSE) or (token=_OTHERWISE) or (token=_END)) then
  218. consume(SEMICOLON);
  219. until (token=_ELSE) or (token=_OTHERWISE) or (token=_END);
  220. if (token=_ELSE) or (token=_OTHERWISE) then
  221. begin
  222. if token=_ELSE then consume(_ELSE)
  223. else consume(_OTHERWISE);
  224. elseblock:=statements_til_end;
  225. end
  226. else
  227. begin
  228. elseblock:=nil;
  229. consume(_END);
  230. end;
  231. dec(statement_level);
  232. code:=gencasenode(caseexpr,instruc,root);
  233. code^.elseblock:=elseblock;
  234. case_statement:=code;
  235. end;
  236. function repeat_statement : ptree;
  237. var
  238. first,last,p_e : ptree;
  239. begin
  240. consume(_REPEAT);
  241. first:=nil;
  242. inc(statement_level);
  243. while token<>_UNTIL do
  244. begin
  245. if first=nil then
  246. begin
  247. last:=gennode(statementn,nil,statement);
  248. first:=last;
  249. end
  250. else
  251. begin
  252. last^.left:=gennode(statementn,nil,statement);
  253. last:=last^.left;
  254. end;
  255. if token<>SEMICOLON then
  256. break;
  257. consume(SEMICOLON);
  258. while token=SEMICOLON do
  259. consume(SEMICOLON);
  260. end;
  261. consume(_UNTIL);
  262. dec(statement_level);
  263. first:=gensinglenode(blockn,first);
  264. p_e:=comp_expr(true);
  265. repeat_statement:=genloopnode(repeatn,p_e,first,nil,false);
  266. end;
  267. function while_statement : ptree;
  268. var
  269. p_e,p_a : ptree;
  270. begin
  271. consume(_WHILE);
  272. p_e:=comp_expr(true);
  273. consume(_DO);
  274. p_a:=statement;
  275. while_statement:=genloopnode(whilen,p_e,p_a,nil,false);
  276. end;
  277. function for_statement : ptree;
  278. var
  279. p_e,tovalue,p_a : ptree;
  280. backward : boolean;
  281. begin
  282. { parse loop header }
  283. consume(_FOR);
  284. p_e:=expr;
  285. if token=_DOWNTO then
  286. begin
  287. consume(_DOWNTO);
  288. backward:=true;
  289. end
  290. else
  291. begin
  292. consume(_TO);
  293. backward:=false;
  294. end;
  295. tovalue:=comp_expr(true);
  296. consume(_DO);
  297. { ... now the instruction }
  298. p_a:=statement;
  299. for_statement:=genloopnode(forn,p_e,tovalue,p_a,backward);
  300. end;
  301. function _with_statement : ptree;
  302. var
  303. right,hp,p : ptree;
  304. i,levelcount : longint;
  305. withsymtable,symtab : psymtable;
  306. obj : pobjectdef;
  307. begin
  308. Must_be_valid:=false;
  309. p:=comp_expr(true);
  310. do_firstpass(p);
  311. right:=nil;
  312. if (not codegenerror) and
  313. (p^.resulttype^.deftype in [objectdef,recorddef]) then
  314. begin
  315. case p^.resulttype^.deftype of
  316. objectdef : begin
  317. obj:=pobjectdef(p^.resulttype);
  318. withsymtable:=new(pwithsymtable,init);
  319. withsymtable^.root:=obj^.publicsyms^.root;
  320. withsymtable^.defowner:=obj;
  321. symtab:=withsymtable;
  322. levelcount:=1;
  323. obj:=obj^.childof;
  324. while assigned(obj) do
  325. begin
  326. symtab^.next:=new(pwithsymtable,init);
  327. symtab:=symtab^.next;
  328. symtab^.root:=obj^.publicsyms^.root;
  329. symtab^.defowner:=obj;
  330. obj:=obj^.childof;
  331. inc(levelcount);
  332. end;
  333. symtab^.next:=symtablestack;
  334. symtablestack:=withsymtable;
  335. end;
  336. recorddef : begin
  337. symtab:=precdef(p^.resulttype)^.symtable;
  338. levelcount:=1;
  339. withsymtable:=new(pwithsymtable,init);
  340. withsymtable^.root:=symtab^.root;
  341. withsymtable^.next:=symtablestack;
  342. withsymtable^.defowner:=obj;
  343. symtablestack:=withsymtable;
  344. end;
  345. end;
  346. if token=COMMA then
  347. begin
  348. consume(COMMA);
  349. {$ifdef tp}
  350. right:=_with_statement;
  351. {$else}
  352. right:=_with_statement();
  353. {$endif}
  354. end
  355. else
  356. begin
  357. consume(_DO);
  358. if token<>SEMICOLON then
  359. right:=statement
  360. else
  361. right:=nil;
  362. end;
  363. for i:=1 to levelcount do
  364. symtablestack:=symtablestack^.next;
  365. _with_statement:=genwithnode(pwithsymtable(withsymtable),p,right,levelcount);
  366. end
  367. else
  368. begin
  369. Message(parser_e_false_with_expr);
  370. { try to recover from error }
  371. if token=COMMA then
  372. begin
  373. consume(COMMA);
  374. {$ifdef tp}
  375. hp:=_with_statement;
  376. {$else}
  377. hp:=_with_statement();
  378. {$endif}
  379. end
  380. else
  381. begin
  382. consume(_DO);
  383. { ignore all }
  384. if token<>SEMICOLON then
  385. statement;
  386. end;
  387. _with_statement:=nil;
  388. end;
  389. end;
  390. function with_statement : ptree;
  391. begin
  392. consume(_WITH);
  393. with_statement:=_with_statement;
  394. end;
  395. function raise_statement : ptree;
  396. var
  397. p1,p2 : ptree;
  398. begin
  399. p1:=nil;
  400. p2:=nil;
  401. consume(_RAISE);
  402. if token<>SEMICOLON then
  403. begin
  404. p1:=comp_expr(true);
  405. if (token=ID) and (pattern='AT') then
  406. begin
  407. consume(ID);
  408. p2:=comp_expr(true);
  409. end;
  410. end
  411. else
  412. begin
  413. if not(in_except_block) then
  414. Message(parser_e_no_reraise_possible);
  415. end;
  416. raise_statement:=gennode(raisen,p1,p2);
  417. end;
  418. function try_statement : ptree;
  419. var
  420. p_try_block,p_finally_block,first,last,
  421. p_default,p_specific,hp : ptree;
  422. ot : pobjectdef;
  423. sym : pvarsym;
  424. old_in_except_block : boolean;
  425. exceptsymtable : psymtable;
  426. objname : stringid;
  427. begin
  428. procinfo.flags:=procinfo.flags or
  429. pi_uses_exceptions;
  430. p_default:=nil;
  431. p_specific:=nil;
  432. { read statements to try }
  433. consume(_TRY);
  434. first:=nil;
  435. inc(statement_level);
  436. while (token<>_FINALLY) and (token<>_EXCEPT) do
  437. begin
  438. if first=nil then
  439. begin
  440. last:=gennode(statementn,nil,statement);
  441. first:=last;
  442. end
  443. else
  444. begin
  445. last^.left:=gennode(statementn,nil,statement);
  446. last:=last^.left;
  447. end;
  448. if token<>SEMICOLON then
  449. break;
  450. consume(SEMICOLON);
  451. emptystats;
  452. end;
  453. p_try_block:=gensinglenode(blockn,first);
  454. if token=_FINALLY then
  455. begin
  456. consume(_FINALLY);
  457. p_finally_block:=statements_til_end;
  458. try_statement:=gennode(tryfinallyn,p_try_block,p_finally_block);
  459. dec(statement_level);
  460. end
  461. else
  462. begin
  463. consume(_EXCEPT);
  464. old_in_except_block:=in_except_block;
  465. in_except_block:=true;
  466. p_specific:=nil;
  467. if token=_ON then
  468. { catch specific exceptions }
  469. begin
  470. repeat
  471. consume(_ON);
  472. if token=ID then
  473. begin
  474. getsym(pattern,false);
  475. objname:=pattern;
  476. consume(ID);
  477. { is a explicit name for the exception given ? }
  478. if token=COLON then
  479. begin
  480. consume(COLON);
  481. getsym(pattern,true);
  482. consume(ID);
  483. if srsym^.typ=unitsym then
  484. begin
  485. consume(POINT);
  486. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  487. consume(ID);
  488. end;
  489. if (srsym^.typ=typesym) and
  490. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  491. pobjectdef(ptypesym(srsym)^.definition)^.isclass then
  492. ot:=pobjectdef(ptypesym(srsym)^.definition)
  493. else
  494. begin
  495. message(type_e_class_type_expected);
  496. ot:=pobjectdef(generrordef);
  497. end;
  498. sym:=new(pvarsym,init(objname,ot));
  499. exceptsymtable:=new(psymtable,init(stt_exceptsymtable));
  500. exceptsymtable^.insert(sym);
  501. { insert the exception symtable stack }
  502. exceptsymtable^.next:=symtablestack;
  503. symtablestack:=exceptsymtable;
  504. end
  505. else
  506. begin
  507. { only exception type }
  508. if srsym^.typ=unitsym then
  509. begin
  510. consume(POINT);
  511. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  512. consume(ID);
  513. end;
  514. if (srsym^.typ=typesym) and
  515. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  516. pobjectdef(ptypesym(srsym)^.definition)^.isclass then
  517. ot:=pobjectdef(ptypesym(srsym)^.definition)
  518. else
  519. begin
  520. message(type_e_class_type_expected);
  521. ot:=pobjectdef(generrordef);
  522. end;
  523. exceptsymtable:=nil;
  524. end;
  525. end
  526. else
  527. consume(ID);
  528. consume(_DO);
  529. hp:=gennode(onn,nil,statement);
  530. if ot^.deftype=errordef then
  531. begin
  532. disposetree(hp);
  533. hp:=genzeronode(errorn);
  534. end;
  535. if p_specific=nil then
  536. begin
  537. last:=hp;
  538. p_specific:=last;
  539. end
  540. else
  541. begin
  542. last^.left:=hp;
  543. last:=last^.left;
  544. end;
  545. { set the informations }
  546. last^.excepttype:=ot;
  547. last^.exceptsymtable:=exceptsymtable;
  548. last^.disposetyp:=dt_onn;
  549. { remove exception symtable }
  550. if assigned(exceptsymtable) then
  551. dellexlevel;
  552. if token<>SEMICOLON then
  553. break;
  554. consume(SEMICOLON);
  555. emptystats;
  556. until (token=_END) or(token=_ELSE);
  557. if token=_ELSE then
  558. { catch the other exceptions }
  559. begin
  560. consume(_ELSE);
  561. p_default:=statements_til_end;
  562. end
  563. else
  564. consume(_END);
  565. end
  566. else
  567. { catch all exceptions }
  568. begin
  569. p_default:=statements_til_end;
  570. end;
  571. dec(statement_level);
  572. in_except_block:=old_in_except_block;
  573. try_statement:=genloopnode(tryexceptn,p_try_block,p_specific,p_default,false);
  574. end;
  575. end;
  576. function exit_statement : ptree;
  577. var
  578. p : ptree;
  579. begin
  580. consume(_EXIT);
  581. if token=LKLAMMER then
  582. begin
  583. consume(LKLAMMER);
  584. p:=comp_expr(true);
  585. consume(RKLAMMER);
  586. if procinfo.retdef=pdef(voiddef) then
  587. Message(parser_e_void_function)
  588. else
  589. procinfo.funcret_is_valid:=true;
  590. end
  591. else
  592. p:=nil;
  593. exit_statement:=gensinglenode(exitn,p);
  594. end;
  595. function _asm_statement : ptree;
  596. var
  597. asmstat : ptree;
  598. Marker : Pai;
  599. begin
  600. if (aktprocsym^.definition^.options and poinline)<>0 then
  601. Begin
  602. Message1(parser_w_not_supported_for_inline,'asm statement');
  603. Message(parser_w_inlining_disabled);
  604. aktprocsym^.definition^.options:= aktprocsym^.definition^.options and not poinline;
  605. End;
  606. case aktasmmode of
  607. {$ifdef i386}
  608. {$ifndef NoRA386Att}
  609. asmmode_i386_att:
  610. asmstat:=ra386att.assemble;
  611. {$endif NoRA386Att}
  612. {$ifndef NoRA386Int}
  613. asmmode_i386_intel:
  614. asmstat:=ra386int.assemble;
  615. {$endif NoRA386Int}
  616. {$ifndef NoRA386Dir}
  617. asmmode_i386_direct:
  618. asmstat:=ra386dir.assemble;
  619. {$endif NoRA386Dir}
  620. {$endif}
  621. {$ifdef m68k}
  622. {$ifndef NoRA68kMot}
  623. asmmode_m68k_mot:
  624. asmstat:=ra68kmot.assemble;
  625. {$endif NoRA68kMot}
  626. {$endif}
  627. else
  628. Message(parser_f_assembler_reader_not_supported);
  629. end;
  630. { Read first the _ASM statement }
  631. consume(_ASM);
  632. { END is read }
  633. if token=LECKKLAMMER then
  634. begin
  635. { it's possible to specify the modified registers }
  636. consume(LECKKLAMMER);
  637. asmstat^.object_preserved:=true;
  638. if token<>RECKKLAMMER then
  639. repeat
  640. { uppercase, because it's a CSTRING }
  641. uppervar(pattern);
  642. {$ifdef i386}
  643. if pattern='EAX' then
  644. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  645. else if pattern='EBX' then
  646. usedinproc:=usedinproc or ($80 shr byte(R_EBX))
  647. else if pattern='ECX' then
  648. usedinproc:=usedinproc or ($80 shr byte(R_ECX))
  649. else if pattern='EDX' then
  650. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  651. else if pattern='ESI' then
  652. begin
  653. usedinproc:=usedinproc or ($80 shr byte(R_ESI));
  654. asmstat^.object_preserved:=false;
  655. end
  656. else if pattern='EDI' then
  657. usedinproc:=usedinproc or ($80 shr byte(R_EDI))
  658. {$endif i386}
  659. {$ifdef m68k}
  660. if pattern='D0' then
  661. usedinproc:=usedinproc or ($800 shr word(R_D0))
  662. else if pattern='D1' then
  663. usedinproc:=usedinproc or ($800 shr word(R_D1))
  664. else if pattern='D6' then
  665. usedinproc:=usedinproc or ($800 shr word(R_D6))
  666. else if pattern='A0' then
  667. usedinproc:=usedinproc or ($800 shr word(R_A0))
  668. else if pattern='A1' then
  669. usedinproc:=usedinproc or ($800 shr word(R_A1))
  670. {$endif m68k}
  671. else consume(RECKKLAMMER);
  672. consume(CSTRING);
  673. if token=COMMA then consume(COMMA)
  674. else break;
  675. until false;
  676. consume(RECKKLAMMER);
  677. end
  678. else usedinproc:=$ff;
  679. { mark the start and the end of the assembler block for the optimizer }
  680. If Assigned(AsmStat^.p_asm) Then
  681. Begin
  682. Marker := New(Pai_Marker, Init(AsmBlockStart));
  683. AsmStat^.p_asm^.Insert(Marker);
  684. Marker := New(Pai_Marker, Init(AsmBlockEnd));
  685. AsmStat^.p_asm^.Concat(Marker);
  686. End;
  687. _asm_statement:=asmstat;
  688. end;
  689. function new_dispose_statement : ptree;
  690. var
  691. p,p2 : ptree;
  692. ht : ttoken;
  693. store_allow : boolean;
  694. again : boolean; { dummy for do_proc_call }
  695. destrukname : stringid;
  696. sym : psym;
  697. classh : pobjectdef;
  698. pd,pd2 : pdef;
  699. store_valid : boolean;
  700. tt : ttreetyp;
  701. begin
  702. ht:=token;
  703. if token=_NEW then consume(_NEW)
  704. else consume(_DISPOSE);
  705. if ht=_NEW then
  706. tt:=hnewn
  707. else
  708. tt:=hdisposen;
  709. consume(LKLAMMER);
  710. p:=comp_expr(true);
  711. { calc return type }
  712. cleartempgen;
  713. Store_valid := Must_be_valid;
  714. Must_be_valid := False;
  715. do_firstpass(p);
  716. Must_be_valid := Store_valid;
  717. {var o:Pobject;
  718. begin
  719. new(o,init); (*Also a valid new statement*)
  720. end;}
  721. if token=COMMA then
  722. begin
  723. { extended syntax of new and dispose }
  724. { function styled new is handled in factor }
  725. consume(COMMA);
  726. { destructors have no parameters }
  727. destrukname:=pattern;
  728. consume(ID);
  729. pd:=p^.resulttype;
  730. pd2:=pd;
  731. if (p^.resulttype = nil) or (pd^.deftype<>pointerdef) then
  732. begin
  733. Message(type_e_pointer_type_expected);
  734. p:=factor(false);
  735. consume(RKLAMMER);
  736. new_dispose_statement:=genzeronode(errorn);
  737. exit;
  738. end;
  739. { first parameter must be an object or class }
  740. if ppointerdef(pd)^.definition^.deftype<>objectdef then
  741. begin
  742. Message(parser_e_pointer_to_class_expected);
  743. new_dispose_statement:=factor(false);
  744. consume_all_until(RKLAMMER);
  745. consume(RKLAMMER);
  746. exit;
  747. end;
  748. { check, if the first parameter is a pointer to a _class_ }
  749. classh:=pobjectdef(ppointerdef(pd)^.definition);
  750. if (classh^.options and oo_is_class)<>0 then
  751. begin
  752. Message(parser_e_no_new_or_dispose_for_classes);
  753. new_dispose_statement:=factor(false);
  754. { while token<>RKLAMMER do
  755. consume(token); }
  756. consume_all_until(RKLAMMER);
  757. consume(RKLAMMER);
  758. exit;
  759. end;
  760. { search cons-/destructor, also in parent classes }
  761. sym:=nil;
  762. while assigned(classh) do
  763. begin
  764. store_allow:=allow_only_static;
  765. allow_only_static:=false;
  766. sym:=classh^.publicsyms^.search(pattern);
  767. allow_only_static:=store_allow;
  768. srsymtable:=classh^.publicsyms;
  769. if assigned(sym) then
  770. break;
  771. classh:=classh^.childof;
  772. end;
  773. { the second parameter of new/dispose must be a call }
  774. { to a cons-/destructor }
  775. if (not assigned(sym)) or (sym^.typ<>procsym) then
  776. begin
  777. Message(parser_e_expr_have_to_be_destructor_call);
  778. new_dispose_statement:=genzeronode(errorn);
  779. end
  780. else
  781. begin
  782. p2:=gensinglenode(tt,p);
  783. if ht=_NEW then
  784. begin
  785. { Constructors can take parameters.}
  786. p2^.resulttype:=ppointerdef(pd)^.definition;
  787. do_member_read(false,sym,p2,pd,again);
  788. end
  789. else
  790. { destructors can't.}
  791. p2:=genmethodcallnode(pprocsym(sym),srsymtable,p2);
  792. { we need the real called method }
  793. cleartempgen;
  794. do_firstpass(p2);
  795. if not codegenerror then
  796. begin
  797. if (ht=_NEW) and ((p2^.procdefinition^.options and poconstructor)=0) then
  798. Message(parser_e_expr_have_to_be_constructor_call);
  799. if (ht=_DISPOSE) and ((p2^.procdefinition^.options and podestructor)=0) then
  800. Message(parser_e_expr_have_to_be_destructor_call);
  801. if ht=_NEW then
  802. begin
  803. p2:=gennode(assignn,getcopy(p),gensinglenode(newn,p2));
  804. p2^.right^.resulttype:=pd2;
  805. end;
  806. end;
  807. new_dispose_statement:=p2;
  808. end;
  809. end
  810. else
  811. begin
  812. if (p^.resulttype=nil) or (p^.resulttype^.deftype<>pointerdef) then
  813. Begin
  814. Message(type_e_pointer_type_expected);
  815. new_dispose_statement:=genzeronode(errorn);
  816. end
  817. else
  818. begin
  819. if (ppointerdef(p^.resulttype)^.definition^.deftype=objectdef) then
  820. Message(parser_w_use_extended_syntax_for_objects);
  821. case ht of
  822. _NEW : new_dispose_statement:=gensinglenode(simplenewn,p);
  823. _DISPOSE : new_dispose_statement:=gensinglenode(simpledisposen,p);
  824. end;
  825. end;
  826. end;
  827. consume(RKLAMMER);
  828. end;
  829. function statement_block(starttoken : ttoken) : ptree;
  830. var
  831. first,last : ptree;
  832. filepos : tfileposinfo;
  833. begin
  834. first:=nil;
  835. filepos:=tokenpos;
  836. consume(starttoken);
  837. inc(statement_level);
  838. while not(token in [_END,_FINALIZATION]) do
  839. begin
  840. if first=nil then
  841. begin
  842. last:=gennode(statementn,nil,statement);
  843. first:=last;
  844. end
  845. else
  846. begin
  847. last^.left:=gennode(statementn,nil,statement);
  848. last:=last^.left;
  849. end;
  850. if (token in [_END,_FINALIZATION]) then
  851. break
  852. else
  853. begin
  854. { if no semicolon, then error and go on }
  855. if token<>SEMICOLON then
  856. begin
  857. consume(SEMICOLON);
  858. consume_all_until(SEMICOLON);
  859. end;
  860. consume(SEMICOLON);
  861. end;
  862. emptystats;
  863. end;
  864. { don't consume the finalization token, it is consumed when
  865. reading the finalization block, but allow it only after
  866. an initalization ! }
  867. if (starttoken<>_INITIALIZATION) or (token<>_FINALIZATION) then
  868. consume(_END);
  869. dec(statement_level);
  870. last:=gensinglenode(blockn,first);
  871. set_tree_filepos(last,filepos);
  872. statement_block:=last;
  873. end;
  874. function statement : ptree;
  875. var
  876. p : ptree;
  877. code : ptree;
  878. labelnr : plabel;
  879. filepos : tfileposinfo;
  880. label
  881. ready;
  882. begin
  883. filepos:=tokenpos;
  884. case token of
  885. _GOTO : begin
  886. if not(cs_support_goto in aktmoduleswitches)then
  887. Message(sym_e_goto_and_label_not_supported);
  888. consume(_GOTO);
  889. if (token<>INTCONST) and (token<>ID) then
  890. begin
  891. Message(sym_e_label_not_found);
  892. code:=genzeronode(errorn);
  893. end
  894. else
  895. begin
  896. getsym(pattern,true);
  897. consume(token);
  898. if srsym^.typ<>labelsym then
  899. begin
  900. Message(sym_e_id_is_no_label_id);
  901. code:=genzeronode(errorn);
  902. end
  903. else
  904. code:=genlabelnode(goton,
  905. plabelsym(srsym)^.number);
  906. end;
  907. end;
  908. _BEGIN : code:=statement_block(_BEGIN);
  909. _IF : code:=if_statement;
  910. _CASE : code:=case_statement;
  911. _REPEAT : code:=repeat_statement;
  912. _WHILE : code:=while_statement;
  913. _FOR : code:=for_statement;
  914. _NEW,_DISPOSE : code:=new_dispose_statement;
  915. _WITH : code:=with_statement;
  916. _TRY : code:=try_statement;
  917. _RAISE : code:=raise_statement;
  918. { semicolons,else until and end are ignored }
  919. SEMICOLON,
  920. _ELSE,
  921. _UNTIL,
  922. _END:
  923. code:=genzeronode(niln);
  924. _FAIL : begin
  925. { internalerror(100); }
  926. if (aktprocsym^.definition^.options and poconstructor)=0 then
  927. Message(parser_e_fail_only_in_constructor);
  928. consume(_FAIL);
  929. code:=genzeronode(failn);
  930. end;
  931. _EXIT : code:=exit_statement;
  932. _ASM : begin
  933. code:=_asm_statement;
  934. end;
  935. _EOF : begin
  936. Message(scan_f_end_of_file);
  937. end;
  938. else
  939. begin
  940. if (token=INTCONST) or
  941. ((token=ID) and
  942. not((m_result in aktmodeswitches) and
  943. (pattern='RESULT'))) then
  944. begin
  945. getsym(pattern,true);
  946. lastsymknown:=true;
  947. lastsrsym:=srsym;
  948. { it is NOT necessarily the owner
  949. it can be a withsymtable !!! }
  950. lastsrsymtable:=srsymtable;
  951. if assigned(srsym) and (srsym^.typ=labelsym) then
  952. begin
  953. consume(token);
  954. consume(COLON);
  955. if plabelsym(srsym)^.defined then
  956. Message(sym_e_label_already_defined);
  957. plabelsym(srsym)^.defined:=true;
  958. { statement modifies srsym }
  959. labelnr:=plabelsym(srsym)^.number;
  960. lastsymknown:=false;
  961. { the pointer to the following instruction }
  962. { isn't a very clean way }
  963. {$ifdef tp}
  964. code:=gensinglenode(labeln,statement);
  965. {$else}
  966. code:=gensinglenode(labeln,statement());
  967. {$endif}
  968. code^.labelnr:=labelnr;
  969. { sorry, but there is a jump the easiest way }
  970. goto ready;
  971. end;
  972. end;
  973. p:=expr;
  974. if not(p^.treetype in [calln,assignn,breakn,inlinen,
  975. continuen]) then
  976. Message(cg_e_illegal_expression);
  977. { specify that we don't use the value returned by the call }
  978. { Question : can this be also improtant
  979. for inlinen ??
  980. it is used for :
  981. - dispose of temp stack space
  982. - dispose on FPU stack }
  983. if p^.treetype=calln then
  984. p^.return_value_used:=false;
  985. code:=p;
  986. end;
  987. end;
  988. ready:
  989. if assigned(code) then
  990. set_tree_filepos(code,filepos);
  991. statement:=code;
  992. end;
  993. function block(islibrary : boolean) : ptree;
  994. var
  995. funcretsym : pfuncretsym;
  996. begin
  997. if procinfo.retdef<>pdef(voiddef) then
  998. begin
  999. { if the current is a function aktprocsym is non nil }
  1000. { and there is a local symtable set }
  1001. funcretsym:=new(pfuncretsym,init(aktprocsym^.name,@procinfo));
  1002. { insert in local symtable }
  1003. symtablestack^.insert(funcretsym);
  1004. if ret_in_acc(procinfo.retdef) or (procinfo.retdef^.deftype=floatdef) then
  1005. procinfo.retoffset:=-funcretsym^.address;
  1006. procinfo.funcretsym:=funcretsym;
  1007. end;
  1008. read_declarations(islibrary);
  1009. { temporary space is set, while the BEGIN of the procedure }
  1010. if (symtablestack^.symtabletype=localsymtable) then
  1011. procinfo.firsttemp := -symtablestack^.datasize
  1012. else procinfo.firsttemp := 0;
  1013. { space for the return value }
  1014. { !!!!! this means that we can not set the return value
  1015. in a subfunction !!!!! }
  1016. { because we don't know yet where the address is }
  1017. if procinfo.retdef<>pdef(voiddef) then
  1018. begin
  1019. if ret_in_acc(procinfo.retdef) or (procinfo.retdef^.deftype=floatdef) then
  1020. { if (procinfo.retdef^.deftype=orddef) or
  1021. (procinfo.retdef^.deftype=pointerdef) or
  1022. (procinfo.retdef^.deftype=enumdef) or
  1023. (procinfo.retdef^.deftype=procvardef) or
  1024. (procinfo.retdef^.deftype=floatdef) or
  1025. (
  1026. (procinfo.retdef^.deftype=setdef) and
  1027. (psetdef(procinfo.retdef)^.settype=smallset)
  1028. ) then }
  1029. begin
  1030. { the space has been set in the local symtable }
  1031. procinfo.retoffset:=-funcretsym^.address;
  1032. if (procinfo.flags and pi_operator)<>0 then
  1033. {opsym^.address:=procinfo.call_offset; is wrong PM }
  1034. opsym^.address:=-procinfo.retoffset;
  1035. { eax is modified by a function }
  1036. {$ifdef i386}
  1037. usedinproc:=usedinproc or ($80 shr byte(R_EAX));
  1038. if is_64bitint(procinfo.retdef) then
  1039. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  1040. {$endif}
  1041. {$ifdef m68k}
  1042. usedinproc:=usedinproc or ($800 shr word(R_D0))
  1043. if is_64bitint(procinfo.retdef) then
  1044. usedinproc:=usedinproc or ($800 shr byte(R_D1))
  1045. {$endif}
  1046. end;
  1047. end;
  1048. {Unit initialization?.}
  1049. if (lexlevel=unit_init_level) and (current_module^.is_unit) then
  1050. if (token=_END) then
  1051. begin
  1052. consume(_END);
  1053. block:=nil;
  1054. end
  1055. else
  1056. begin
  1057. if token=_INITIALIZATION then
  1058. begin
  1059. current_module^.flags:=current_module^.flags or uf_init;
  1060. block:=statement_block(_INITIALIZATION);
  1061. end
  1062. else if (token=_FINALIZATION) then
  1063. begin
  1064. if (current_module^.flags and uf_finalize)<>0 then
  1065. block:=statement_block(_FINALIZATION)
  1066. else
  1067. begin
  1068. block:=nil;
  1069. exit;
  1070. end;
  1071. end
  1072. else
  1073. begin
  1074. current_module^.flags:=current_module^.flags or uf_init;
  1075. block:=statement_block(_BEGIN);
  1076. end;
  1077. end
  1078. else
  1079. block:=statement_block(_BEGIN);
  1080. end;
  1081. function assembler_block : ptree;
  1082. begin
  1083. read_declarations(false);
  1084. { temporary space is set, while the BEGIN of the procedure }
  1085. if symtablestack^.symtabletype=localsymtable then
  1086. procinfo.firsttemp := -symtablestack^.datasize
  1087. else procinfo.firsttemp := 0;
  1088. { assembler code does not allocate }
  1089. { space for the return value }
  1090. if procinfo.retdef<>pdef(voiddef) then
  1091. begin
  1092. if ret_in_acc(procinfo.retdef) then
  1093. begin
  1094. { in assembler code the result should be directly in %eax
  1095. procinfo.retoffset:=procinfo.firsttemp-procinfo.retdef^.size;
  1096. procinfo.firsttemp:=procinfo.retoffset; }
  1097. {$ifdef i386}
  1098. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  1099. {$endif}
  1100. {$ifdef m68k}
  1101. usedinproc:=usedinproc or ($800 shr word(R_D0))
  1102. {$endif}
  1103. end
  1104. {
  1105. else if not is_fpu(procinfo.retdef) then
  1106. should we allow assembler functions of big elements ?
  1107. YES (FK)!!
  1108. Message(parser_e_asm_incomp_with_function_return);
  1109. }
  1110. end;
  1111. { set the framepointer to esp for assembler functions }
  1112. { but only if the are no local variables }
  1113. { added no parameter also (PM) }
  1114. if ((aktprocsym^.definition^.options and poassembler)<>0) and
  1115. (aktprocsym^.definition^.localst^.datasize=0) and
  1116. (aktprocsym^.definition^.parast^.datasize=0) and
  1117. not(ret_in_param(aktprocsym^.definition^.retdef)) then
  1118. begin
  1119. {$ifdef i386}
  1120. procinfo.framepointer:=R_ESP;
  1121. {$endif}
  1122. {$ifdef m68k}
  1123. procinfo.framepointer:=R_SP;
  1124. {$endif}
  1125. { set the right value for parameters }
  1126. dec(aktprocsym^.definition^.parast^.call_offset,target_os.size_of_pointer);
  1127. dec(procinfo.call_offset,target_os.size_of_pointer);
  1128. end;
  1129. { force the asm statement }
  1130. if token<>_ASM then
  1131. consume(_ASM);
  1132. Procinfo.Flags := ProcInfo.Flags Or pi_is_assembler;
  1133. assembler_block:=_asm_statement;
  1134. { becuase the END is already read we need to get the
  1135. last_endtoken_filepos here (PFV) }
  1136. last_endtoken_filepos:=tokenpos;
  1137. end;
  1138. end.
  1139. {
  1140. $Log$
  1141. Revision 1.64 1999-02-11 09:46:26 pierre
  1142. * fix for normal method calls inside static methods :
  1143. WARNING there were both parser and codegen errors !!
  1144. added static_call boolean to calln tree
  1145. Revision 1.63 1999/02/09 15:45:47 florian
  1146. + complex results for assembler functions, fixes bug0155
  1147. Revision 1.62 1999/01/27 13:06:57 pierre
  1148. * memory leak in case optimization fixed
  1149. Revision 1.61 1999/01/25 22:49:09 peter
  1150. * more fixes for the on bug with unknown id
  1151. Revision 1.60 1999/01/23 23:29:38 florian
  1152. * first running version of the new code generator
  1153. * when compiling exceptions under Linux fixed
  1154. Revision 1.59 1999/01/21 16:41:02 pierre
  1155. * fix for constructor inside with statements
  1156. Revision 1.58 1999/01/05 08:20:07 florian
  1157. * mainly problem with invalid case ranges fixed (reported by Jonas)
  1158. Revision 1.57 1998/12/29 18:48:15 jonas
  1159. + optimize pascal code surrounding assembler blocks
  1160. Revision 1.56 1998/12/23 22:52:56 peter
  1161. * fixed new(x) crash if x contains an error
  1162. Revision 1.55 1998/12/16 12:30:59 jonas
  1163. * released CaseRange
  1164. Revision 1.54 1998/12/15 22:32:24 jonas
  1165. + convert consecutive case labels to a single range (-dCaseRange)
  1166. Revision 1.53 1998/12/15 11:52:18 peter
  1167. * fixed dup release of statement label in case
  1168. Revision 1.52 1998/12/11 00:03:37 peter
  1169. + globtype,tokens,version unit splitted from globals
  1170. Revision 1.51 1998/12/10 09:47:24 florian
  1171. + basic operations with int64/qord (compiler with -dint64)
  1172. + rtti of enumerations extended: names are now written
  1173. Revision 1.50 1998/11/13 15:40:25 pierre
  1174. + added -Se in Makefile cvstest target
  1175. + lexlevel cleanup
  1176. normal_function_level main_program_level and unit_init_level defined
  1177. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  1178. (test added in code !)
  1179. * -Un option was wrong
  1180. * _FAIL and _SELF only keyword inside
  1181. constructors and methods respectively
  1182. Revision 1.49 1998/11/12 12:55:17 pierre
  1183. * fix for bug0176 and bug0177
  1184. Revision 1.48 1998/11/05 23:43:24 peter
  1185. * fixed assembler directive and then not an ASM statement
  1186. Revision 1.47 1998/10/30 16:20:22 peter
  1187. * fixed dispose(destructor) crash when destructor didn't exists
  1188. Revision 1.46 1998/10/20 08:06:53 pierre
  1189. * several memory corruptions due to double freemem solved
  1190. => never use p^.loc.location:=p^.left^.loc.location;
  1191. + finally I added now by default
  1192. that ra386dir translates global and unit symbols
  1193. + added a first field in tsymtable and
  1194. a nextsym field in tsym
  1195. (this allows to obtain ordered type info for
  1196. records and objects in gdb !)
  1197. Revision 1.45 1998/10/19 08:55:01 pierre
  1198. * wrong stabs info corrected once again !!
  1199. + variable vmt offset with vmt field only if required
  1200. implemented now !!!
  1201. Revision 1.44 1998/10/13 13:10:27 peter
  1202. * new style for m68k/i386 infos and enums
  1203. Revision 1.43 1998/10/08 13:46:22 peter
  1204. * added eof message
  1205. * fixed unit init section parsing with finalize
  1206. Revision 1.42 1998/09/26 17:45:38 peter
  1207. + idtoken and only one token table
  1208. Revision 1.41 1998/09/24 23:49:15 peter
  1209. + aktmodeswitches
  1210. Revision 1.40 1998/09/23 21:53:04 florian
  1211. * the following doesn't work: on texception do, was a parser error, fixed
  1212. Revision 1.39 1998/09/21 10:26:07 peter
  1213. * merged fix
  1214. Revision 1.38.2.1 1998/09/21 10:24:43 peter
  1215. * fixed error recovery with with
  1216. Revision 1.38 1998/09/04 08:42:04 peter
  1217. * updated some error messages
  1218. Revision 1.37 1998/08/21 14:08:52 pierre
  1219. + TEST_FUNCRET now default (old code removed)
  1220. works also for m68k (at least compiles)
  1221. Revision 1.36 1998/08/20 21:36:41 peter
  1222. * fixed 'with object do' bug
  1223. Revision 1.35 1998/08/20 09:26:42 pierre
  1224. + funcret setting in underproc testing
  1225. compile with _dTEST_FUNCRET
  1226. Revision 1.34 1998/08/17 10:10:09 peter
  1227. - removed OLDPPU
  1228. Revision 1.33 1998/08/12 19:39:30 peter
  1229. * fixed some crashes
  1230. Revision 1.32 1998/08/10 14:50:17 peter
  1231. + localswitches, moduleswitches, globalswitches splitting
  1232. Revision 1.31 1998/08/02 16:41:59 florian
  1233. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  1234. disposed by dellexlevel
  1235. Revision 1.30 1998/07/30 16:07:10 florian
  1236. * try ... expect <statement> end; works now
  1237. Revision 1.29 1998/07/30 13:30:37 florian
  1238. * final implemenation of exception support, maybe it needs
  1239. some fixes :)
  1240. Revision 1.28 1998/07/30 11:18:18 florian
  1241. + first implementation of try ... except on .. do end;
  1242. * limitiation of 65535 bytes parameters for cdecl removed
  1243. Revision 1.27 1998/07/28 21:52:55 florian
  1244. + implementation of raise and try..finally
  1245. + some misc. exception stuff
  1246. Revision 1.26 1998/07/27 21:57:14 florian
  1247. * fix to allow tv like stream registration:
  1248. @tmenu.load doesn't work if load had parameters or if load was only
  1249. declared in an anchestor class of tmenu
  1250. Revision 1.25 1998/07/14 21:46:53 peter
  1251. * updated messages file
  1252. Revision 1.24 1998/07/10 10:48:42 peter
  1253. * fixed realnumber scanning
  1254. * [] after asmblock was not uppercased anymore
  1255. Revision 1.23 1998/06/25 08:48:18 florian
  1256. * first version of rtti support
  1257. Revision 1.22 1998/06/24 14:48:36 peter
  1258. * ifdef newppu -> ifndef oldppu
  1259. Revision 1.21 1998/06/24 14:06:34 peter
  1260. * fixed the name changes
  1261. Revision 1.20 1998/06/23 14:00:16 peter
  1262. * renamed RA* units
  1263. Revision 1.19 1998/06/08 22:59:50 peter
  1264. * smartlinking works for win32
  1265. * some defines to exclude some compiler parts
  1266. Revision 1.18 1998/06/05 14:37:35 pierre
  1267. * fixes for inline for operators
  1268. * inline procedure more correctly restricted
  1269. Revision 1.17 1998/06/04 09:55:43 pierre
  1270. * demangled name of procsym reworked to become independant of the mangling scheme
  1271. Revision 1.16 1998/06/02 17:03:04 pierre
  1272. * with node corrected for objects
  1273. * small bugs for SUPPORT_MMX fixed
  1274. Revision 1.15 1998/05/30 14:31:06 peter
  1275. + $ASMMODE
  1276. Revision 1.14 1998/05/29 09:58:14 pierre
  1277. * OPR_REGISTER for 1 arg was missing in ratti386.pas
  1278. (probably a merging problem)
  1279. * errors at start of line were lost
  1280. Revision 1.13 1998/05/28 17:26:50 peter
  1281. * fixed -R switch, it didn't work after my previous akt/init patch
  1282. * fixed bugs 110,130,136
  1283. Revision 1.12 1998/05/21 19:33:33 peter
  1284. + better procedure directive handling and only one table
  1285. Revision 1.11 1998/05/20 09:42:35 pierre
  1286. + UseTokenInfo now default
  1287. * unit in interface uses and implementation uses gives error now
  1288. * only one error for unknown symbol (uses lastsymknown boolean)
  1289. the problem came from the label code !
  1290. + first inlined procedures and function work
  1291. (warning there might be allowed cases were the result is still wrong !!)
  1292. * UseBrower updated gives a global list of all position of all used symbols
  1293. with switch -gb
  1294. Revision 1.10 1998/05/11 13:07:56 peter
  1295. + $ifdef NEWPPU for the new ppuformat
  1296. + $define GDB not longer required
  1297. * removed all warnings and stripped some log comments
  1298. * no findfirst/findnext anymore to remove smartlink *.o files
  1299. Revision 1.9 1998/05/06 08:38:46 pierre
  1300. * better position info with UseTokenInfo
  1301. UseTokenInfo greatly simplified
  1302. + added check for changed tree after first time firstpass
  1303. (if we could remove all the cases were it happen
  1304. we could skip all firstpass if firstpasscount > 1)
  1305. Only with ExtDebug
  1306. Revision 1.8 1998/05/05 12:05:42 florian
  1307. * problems with properties fixed
  1308. * crash fixed: i:=l when i and l are undefined, was a problem with
  1309. implementation of private/protected
  1310. Revision 1.7 1998/05/01 16:38:46 florian
  1311. * handling of private and protected fixed
  1312. + change_keywords_to_tp implemented to remove
  1313. keywords which aren't supported by tp
  1314. * break and continue are now symbols of the system unit
  1315. + widestring, longstring and ansistring type released
  1316. Revision 1.6 1998/04/30 15:59:42 pierre
  1317. * GDB works again better :
  1318. correct type info in one pass
  1319. + UseTokenInfo for better source position
  1320. * fixed one remaining bug in scanner for line counts
  1321. * several little fixes
  1322. Revision 1.5 1998/04/29 10:33:59 pierre
  1323. + added some code for ansistring (not complete nor working yet)
  1324. * corrected operator overloading
  1325. * corrected nasm output
  1326. + started inline procedures
  1327. + added starstarn : use ** for exponentiation (^ gave problems)
  1328. + started UseTokenInfo cond to get accurate positions
  1329. Revision 1.4 1998/04/08 16:58:05 pierre
  1330. * several bugfixes
  1331. ADD ADC and AND are also sign extended
  1332. nasm output OK (program still crashes at end
  1333. and creates wrong assembler files !!)
  1334. procsym types sym in tdef removed !!
  1335. }