pstatmnt.pas 52 KB

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