pstatmnt.pas 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. { reads a block }
  22. function block(islibrary : boolean) : ptree;
  23. { reads an assembler block }
  24. function assembler_block : ptree;
  25. implementation
  26. uses
  27. globtype,systems,tokens,
  28. strings,cobjects,globals,files,verbose,
  29. symconst,symtable,aasm,pass_1,types,scanner,
  30. {$ifdef newcg}
  31. cgbase,
  32. {$else}
  33. hcodegen,
  34. {$endif}
  35. ppu
  36. ,pbase,pexpr,pdecl,cpubase,cpuasm
  37. {$ifdef i386}
  38. ,tgeni386
  39. {$ifndef NoRa386Int}
  40. ,ra386int
  41. {$endif NoRa386Int}
  42. {$ifndef NoRa386Att}
  43. ,ra386att
  44. {$endif NoRa386Att}
  45. {$ifndef NoRa386Dir}
  46. ,ra386dir
  47. {$endif NoRa386Dir}
  48. {$endif i386}
  49. {$ifdef m68k}
  50. ,tgen68k
  51. {$ifndef NoRa68kMot}
  52. ,ra68kmot
  53. {$endif NoRa68kMot}
  54. {$endif m68k}
  55. {$ifdef alpha}
  56. ,tgeni386 { this is a dummy!! }
  57. {$endif alpha}
  58. {$ifdef powerpc}
  59. ,tgeni386 { this is a dummy!! }
  60. {$endif powerpc}
  61. ;
  62. const
  63. statement_level : longint = 0;
  64. function statement : ptree;forward;
  65. function if_statement : ptree;
  66. var
  67. ex,if_a,else_a : ptree;
  68. begin
  69. consume(_IF);
  70. ex:=comp_expr(true);
  71. consume(_THEN);
  72. if token<>_ELSE then
  73. if_a:=statement
  74. else
  75. if_a:=nil;
  76. if try_to_consume(_ELSE) then
  77. else_a:=statement
  78. else
  79. else_a:=nil;
  80. if_statement:=genloopnode(ifn,ex,if_a,else_a,false);
  81. end;
  82. { creates a block (list) of statements, til the next END token }
  83. function statements_til_end : ptree;
  84. var
  85. first,last : ptree;
  86. begin
  87. first:=nil;
  88. while token<>_END do
  89. begin
  90. if first=nil then
  91. begin
  92. last:=gennode(statementn,nil,statement);
  93. first:=last;
  94. end
  95. else
  96. begin
  97. last^.left:=gennode(statementn,nil,statement);
  98. last:=last^.left;
  99. end;
  100. if not try_to_consume(_SEMICOLON) then
  101. break;
  102. emptystats;
  103. end;
  104. consume(_END);
  105. statements_til_end:=gensinglenode(blockn,first);
  106. end;
  107. function case_statement : ptree;
  108. var
  109. { contains the label number of currently parsed case block }
  110. aktcaselabel : pasmlabel;
  111. firstlabel : boolean;
  112. root : pcaserecord;
  113. { the typ of the case expression }
  114. casedef : pdef;
  115. procedure newcaselabel(l,h : longint;first:boolean);
  116. var
  117. hcaselabel : pcaserecord;
  118. procedure insertlabel(var p : pcaserecord);
  119. begin
  120. if p=nil then p:=hcaselabel
  121. else
  122. if (p^._low>hcaselabel^._low) and
  123. (p^._low>hcaselabel^._high) then
  124. if (hcaselabel^.statement = p^.statement) and
  125. (p^._low = hcaselabel^._high + 1) then
  126. begin
  127. p^._low := hcaselabel^._low;
  128. dispose(hcaselabel);
  129. end
  130. else
  131. insertlabel(p^.less)
  132. else
  133. if (p^._high<hcaselabel^._low) and
  134. (p^._high<hcaselabel^._high) then
  135. if (hcaselabel^.statement = p^.statement) and
  136. (p^._high+1 = hcaselabel^._low) then
  137. begin
  138. p^._high := hcaselabel^._high;
  139. dispose(hcaselabel);
  140. end
  141. else
  142. insertlabel(p^.greater)
  143. else Message(parser_e_double_caselabel);
  144. end;
  145. begin
  146. new(hcaselabel);
  147. hcaselabel^.less:=nil;
  148. hcaselabel^.greater:=nil;
  149. hcaselabel^.statement:=aktcaselabel;
  150. hcaselabel^.firstlabel:=first;
  151. getlabel(hcaselabel^._at);
  152. hcaselabel^._low:=l;
  153. hcaselabel^._high:=h;
  154. insertlabel(root);
  155. end;
  156. var
  157. code,caseexpr,p,instruc,elseblock : ptree;
  158. hl1,hl2 : longint;
  159. casedeferror : boolean;
  160. begin
  161. consume(_CASE);
  162. caseexpr:=comp_expr(true);
  163. { determines result type }
  164. cleartempgen;
  165. do_firstpass(caseexpr);
  166. casedeferror:=false;
  167. casedef:=caseexpr^.resulttype;
  168. if (not assigned(casedef)) or
  169. not(is_ordinal(casedef) or is_64bitint(casedef)) then
  170. begin
  171. Message(type_e_ordinal_expr_expected);
  172. { set error flag so no rangechecks are done }
  173. casedeferror:=true;
  174. end;
  175. consume(_OF);
  176. inc(statement_level);
  177. root:=nil;
  178. instruc:=nil;
  179. repeat
  180. getlabel(aktcaselabel);
  181. firstlabel:=true;
  182. { may be an instruction has more case labels }
  183. repeat
  184. p:=expr;
  185. cleartempgen;
  186. do_firstpass(p);
  187. hl1:=0;
  188. hl2:=0;
  189. if (p^.treetype=rangen) then
  190. begin
  191. { type checking for case statements }
  192. if is_subequal(casedef, p^.left^.resulttype) and
  193. is_subequal(casedef, p^.right^.resulttype) then
  194. begin
  195. hl1:=get_ordinal_value(p^.left);
  196. hl2:=get_ordinal_value(p^.right);
  197. if hl1>hl2 then
  198. Message(parser_e_case_lower_less_than_upper_bound);
  199. if not casedeferror then
  200. begin
  201. testrange(casedef,hl1);
  202. testrange(casedef,hl2);
  203. end;
  204. end
  205. else
  206. Message(parser_e_case_mismatch);
  207. newcaselabel(hl1,hl2,firstlabel);
  208. end
  209. else
  210. begin
  211. { type checking for case statements }
  212. if not is_subequal(casedef, p^.resulttype) then
  213. Message(parser_e_case_mismatch);
  214. hl1:=get_ordinal_value(p);
  215. if not casedeferror then
  216. testrange(casedef,hl1);
  217. newcaselabel(hl1,hl1,firstlabel);
  218. end;
  219. disposetree(p);
  220. if token=_COMMA then
  221. consume(_COMMA)
  222. else
  223. break;
  224. firstlabel:=false;
  225. until false;
  226. consume(_COLON);
  227. { handles instruction block }
  228. p:=gensinglenode(labeln,statement);
  229. p^.labelnr:=aktcaselabel;
  230. { concats instruction }
  231. instruc:=gennode(statementn,instruc,p);
  232. if not((token=_ELSE) or (token=_OTHERWISE) or (token=_END)) then
  233. consume(_SEMICOLON);
  234. until (token=_ELSE) or (token=_OTHERWISE) or (token=_END);
  235. if (token=_ELSE) or (token=_OTHERWISE) then
  236. begin
  237. if not try_to_consume(_ELSE) then
  238. consume(_OTHERWISE);
  239. elseblock:=statements_til_end;
  240. end
  241. else
  242. begin
  243. elseblock:=nil;
  244. consume(_END);
  245. end;
  246. dec(statement_level);
  247. code:=gencasenode(caseexpr,instruc,root);
  248. code^.elseblock:=elseblock;
  249. case_statement:=code;
  250. end;
  251. function repeat_statement : ptree;
  252. var
  253. first,last,p_e : ptree;
  254. begin
  255. consume(_REPEAT);
  256. first:=nil;
  257. inc(statement_level);
  258. while token<>_UNTIL do
  259. begin
  260. if first=nil then
  261. begin
  262. last:=gennode(statementn,nil,statement);
  263. first:=last;
  264. end
  265. else
  266. begin
  267. last^.left:=gennode(statementn,nil,statement);
  268. last:=last^.left;
  269. end;
  270. if not try_to_consume(_SEMICOLON) then
  271. break;
  272. emptystats;
  273. end;
  274. consume(_UNTIL);
  275. dec(statement_level);
  276. first:=gensinglenode(blockn,first);
  277. p_e:=comp_expr(true);
  278. repeat_statement:=genloopnode(repeatn,p_e,first,nil,false);
  279. end;
  280. function while_statement : ptree;
  281. var
  282. p_e,p_a : ptree;
  283. begin
  284. consume(_WHILE);
  285. p_e:=comp_expr(true);
  286. consume(_DO);
  287. p_a:=statement;
  288. while_statement:=genloopnode(whilen,p_e,p_a,nil,false);
  289. end;
  290. function for_statement : ptree;
  291. var
  292. p_e,tovalue,p_a : ptree;
  293. backward : boolean;
  294. begin
  295. { parse loop header }
  296. consume(_FOR);
  297. p_e:=expr;
  298. if token=_DOWNTO then
  299. begin
  300. consume(_DOWNTO);
  301. backward:=true;
  302. end
  303. else
  304. begin
  305. consume(_TO);
  306. backward:=false;
  307. end;
  308. tovalue:=comp_expr(true);
  309. consume(_DO);
  310. { ... now the instruction }
  311. p_a:=statement;
  312. for_statement:=genloopnode(forn,p_e,tovalue,p_a,backward);
  313. end;
  314. function _with_statement : ptree;
  315. var
  316. right,p : ptree;
  317. i,levelcount : longint;
  318. withsymtable,symtab : psymtable;
  319. obj : pobjectdef;
  320. {$ifdef tp}
  321. hp : ptree;
  322. {$endif}
  323. begin
  324. p:=comp_expr(true);
  325. do_firstpass(p);
  326. set_varstate(p,false);
  327. right:=nil;
  328. if (not codegenerror) and
  329. (p^.resulttype^.deftype in [objectdef,recorddef]) then
  330. begin
  331. case p^.resulttype^.deftype of
  332. objectdef : begin
  333. obj:=pobjectdef(p^.resulttype);
  334. withsymtable:=new(pwithsymtable,init);
  335. withsymtable^.symsearch:=obj^.symtable^.symsearch;
  336. withsymtable^.defowner:=obj;
  337. symtab:=withsymtable;
  338. if (p^.treetype=loadn) and
  339. (p^.symtable=aktprocsym^.definition^.localst) then
  340. pwithsymtable(symtab)^.direct_with:=true;
  341. {symtab^.withnode:=p; not yet allocated !! }
  342. pwithsymtable(symtab)^.withrefnode:=p;
  343. levelcount:=1;
  344. obj:=obj^.childof;
  345. while assigned(obj) do
  346. begin
  347. symtab^.next:=new(pwithsymtable,init);
  348. symtab:=symtab^.next;
  349. symtab^.symsearch:=obj^.symtable^.symsearch;
  350. if (p^.treetype=loadn) and
  351. (p^.symtable=aktprocsym^.definition^.localst) then
  352. pwithsymtable(symtab)^.direct_with:=true;
  353. {symtab^.withnode:=p; not yet allocated !! }
  354. pwithsymtable(symtab)^.withrefnode:=p;
  355. symtab^.defowner:=obj;
  356. obj:=obj^.childof;
  357. inc(levelcount);
  358. end;
  359. symtab^.next:=symtablestack;
  360. symtablestack:=withsymtable;
  361. end;
  362. recorddef : begin
  363. symtab:=precorddef(p^.resulttype)^.symtable;
  364. levelcount:=1;
  365. withsymtable:=new(pwithsymtable,init);
  366. withsymtable^.symsearch:=symtab^.symsearch;
  367. withsymtable^.next:=symtablestack;
  368. if (p^.treetype=loadn) and
  369. (p^.symtable=aktprocsym^.definition^.localst) then
  370. pwithsymtable(withsymtable)^.direct_with:=true;
  371. {symtab^.withnode:=p; not yet allocated !! }
  372. pwithsymtable(withsymtable)^.withrefnode:=p;
  373. withsymtable^.defowner:=obj;
  374. symtablestack:=withsymtable;
  375. end;
  376. end;
  377. if token=_COMMA then
  378. begin
  379. consume(_COMMA);
  380. right:=_with_statement{$ifndef tp}(){$endif};
  381. end
  382. else
  383. begin
  384. consume(_DO);
  385. if token<>_SEMICOLON then
  386. right:=statement
  387. else
  388. right:=nil;
  389. end;
  390. for i:=1 to levelcount do
  391. symtablestack:=symtablestack^.next;
  392. _with_statement:=genwithnode(pwithsymtable(withsymtable),p,right,levelcount);
  393. end
  394. else
  395. begin
  396. Message(parser_e_false_with_expr);
  397. { try to recover from error }
  398. if token=_COMMA then
  399. begin
  400. consume(_COMMA);
  401. {$ifdef tp}
  402. hp:=_with_statement;
  403. {$else}
  404. _with_statement();
  405. {$endif}
  406. end
  407. else
  408. begin
  409. consume(_DO);
  410. { ignore all }
  411. if token<>_SEMICOLON then
  412. statement;
  413. end;
  414. _with_statement:=nil;
  415. end;
  416. end;
  417. function with_statement : ptree;
  418. begin
  419. consume(_WITH);
  420. with_statement:=_with_statement;
  421. end;
  422. function raise_statement : ptree;
  423. var
  424. p1,p2 : ptree;
  425. begin
  426. p1:=nil;
  427. p2:=nil;
  428. consume(_RAISE);
  429. if not(token in [_SEMICOLON,_END]) then
  430. begin
  431. p1:=comp_expr(true);
  432. if (idtoken=_AT) then
  433. begin
  434. consume(_ID);
  435. p2:=comp_expr(true);
  436. end;
  437. end
  438. else
  439. begin
  440. if (block_type<>bt_except) then
  441. Message(parser_e_no_reraise_possible);
  442. end;
  443. raise_statement:=gennode(raisen,p1,p2);
  444. end;
  445. function try_statement : ptree;
  446. var
  447. p_try_block,p_finally_block,first,last,
  448. p_default,p_specific,hp : ptree;
  449. ot : pobjectdef;
  450. sym : pvarsym;
  451. old_block_type : tblock_type;
  452. exceptsymtable : psymtable;
  453. objname : stringid;
  454. begin
  455. procinfo^.flags:=procinfo^.flags or
  456. pi_uses_exceptions;
  457. p_default:=nil;
  458. p_specific:=nil;
  459. { read statements to try }
  460. consume(_TRY);
  461. first:=nil;
  462. inc(statement_level);
  463. while (token<>_FINALLY) and (token<>_EXCEPT) do
  464. begin
  465. if first=nil then
  466. begin
  467. last:=gennode(statementn,nil,statement);
  468. first:=last;
  469. end
  470. else
  471. begin
  472. last^.left:=gennode(statementn,nil,statement);
  473. last:=last^.left;
  474. end;
  475. if not try_to_consume(_SEMICOLON) then
  476. break;
  477. emptystats;
  478. end;
  479. p_try_block:=gensinglenode(blockn,first);
  480. if try_to_consume(_FINALLY) then
  481. begin
  482. p_finally_block:=statements_til_end;
  483. try_statement:=gennode(tryfinallyn,p_try_block,p_finally_block);
  484. dec(statement_level);
  485. end
  486. else
  487. begin
  488. consume(_EXCEPT);
  489. old_block_type:=block_type;
  490. block_type:=bt_except;
  491. p_specific:=nil;
  492. if token=_ON then
  493. { catch specific exceptions }
  494. begin
  495. repeat
  496. consume(_ON);
  497. if token=_ID then
  498. begin
  499. getsym(pattern,false);
  500. objname:=pattern;
  501. consume(_ID);
  502. { is a explicit name for the exception given ? }
  503. if try_to_consume(_COLON) then
  504. begin
  505. getsym(pattern,true);
  506. consume(_ID);
  507. if srsym^.typ=unitsym then
  508. begin
  509. consume(_POINT);
  510. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  511. consume(_ID);
  512. end;
  513. if (srsym^.typ=typesym) and
  514. (ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  515. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class then
  516. ot:=pobjectdef(ptypesym(srsym)^.restype.def)
  517. else
  518. begin
  519. ot:=pobjectdef(generrordef);
  520. if (srsym^.typ=typesym) then
  521. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename)
  522. else
  523. Message1(type_e_class_type_expected,ot^.typename);
  524. end;
  525. sym:=new(pvarsym,initdef(objname,ot));
  526. exceptsymtable:=new(psymtable,init(stt_exceptsymtable));
  527. exceptsymtable^.insert(sym);
  528. { insert the exception symtable stack }
  529. exceptsymtable^.next:=symtablestack;
  530. symtablestack:=exceptsymtable;
  531. end
  532. else
  533. begin
  534. { only exception type }
  535. if srsym^.typ=unitsym then
  536. begin
  537. consume(_POINT);
  538. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  539. consume(_ID);
  540. end;
  541. if (srsym^.typ=typesym) and
  542. (ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  543. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class then
  544. ot:=pobjectdef(ptypesym(srsym)^.restype.def)
  545. else
  546. begin
  547. ot:=pobjectdef(generrordef);
  548. if (srsym^.typ=typesym) then
  549. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename)
  550. else
  551. Message1(type_e_class_type_expected,ot^.typename);
  552. end;
  553. exceptsymtable:=nil;
  554. end;
  555. end
  556. else
  557. consume(_ID);
  558. consume(_DO);
  559. hp:=gennode(onn,nil,statement);
  560. if ot^.deftype=errordef then
  561. begin
  562. disposetree(hp);
  563. hp:=genzeronode(errorn);
  564. end;
  565. if p_specific=nil then
  566. begin
  567. last:=hp;
  568. p_specific:=last;
  569. end
  570. else
  571. begin
  572. last^.left:=hp;
  573. last:=last^.left;
  574. end;
  575. { set the informations }
  576. last^.excepttype:=ot;
  577. last^.exceptsymtable:=exceptsymtable;
  578. last^.disposetyp:=dt_onn;
  579. { remove exception symtable }
  580. if assigned(exceptsymtable) then
  581. dellexlevel;
  582. if not try_to_consume(_SEMICOLON) then
  583. break;
  584. emptystats;
  585. until (token=_END) or(token=_ELSE);
  586. if token=_ELSE then
  587. { catch the other exceptions }
  588. begin
  589. consume(_ELSE);
  590. p_default:=statements_til_end;
  591. end
  592. else
  593. consume(_END);
  594. end
  595. else
  596. { catch all exceptions }
  597. begin
  598. p_default:=statements_til_end;
  599. end;
  600. dec(statement_level);
  601. block_type:=old_block_type;
  602. try_statement:=genloopnode(tryexceptn,p_try_block,p_specific,p_default,false);
  603. end;
  604. end;
  605. function exit_statement : ptree;
  606. var
  607. p : ptree;
  608. begin
  609. consume(_EXIT);
  610. if try_to_consume(_LKLAMMER) then
  611. begin
  612. p:=comp_expr(true);
  613. consume(_RKLAMMER);
  614. if (block_type=bt_except) then
  615. Message(parser_e_exit_with_argument_not__possible);
  616. if procinfo^.returntype.def=pdef(voiddef) then
  617. Message(parser_e_void_function);
  618. end
  619. else
  620. p:=nil;
  621. p:=gensinglenode(exitn,p);
  622. p^.resulttype:=procinfo^.returntype.def;
  623. exit_statement:=p;
  624. end;
  625. function _asm_statement : ptree;
  626. var
  627. asmstat : ptree;
  628. Marker : Pai;
  629. begin
  630. Inside_asm_statement:=true;
  631. case aktasmmode of
  632. asmmode_none : ; { just be there to allow to a compile without
  633. any assembler readers }
  634. {$ifdef i386}
  635. {$ifndef NoRA386Att}
  636. asmmode_i386_att:
  637. asmstat:=ra386att.assemble;
  638. {$endif NoRA386Att}
  639. {$ifndef NoRA386Int}
  640. asmmode_i386_intel:
  641. asmstat:=ra386int.assemble;
  642. {$endif NoRA386Int}
  643. {$ifndef NoRA386Dir}
  644. asmmode_i386_direct:
  645. begin
  646. if not target_asm.allowdirect then
  647. Message(parser_f_direct_assembler_not_allowed);
  648. if (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  649. Begin
  650. Message1(parser_w_not_supported_for_inline,'direct asm');
  651. Message(parser_w_inlining_disabled);
  652. {$ifdef INCLUDEOK}
  653. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  654. {$else}
  655. aktprocsym^.definition^.proccalloptions:=aktprocsym^.definition^.proccalloptions-[pocall_inline];
  656. {$endif}
  657. End;
  658. asmstat:=ra386dir.assemble;
  659. end;
  660. {$endif NoRA386Dir}
  661. {$endif}
  662. {$ifdef m68k}
  663. {$ifndef NoRA68kMot}
  664. asmmode_m68k_mot:
  665. asmstat:=ra68kmot.assemble;
  666. {$endif NoRA68kMot}
  667. {$endif}
  668. else
  669. Message(parser_f_assembler_reader_not_supported);
  670. end;
  671. { Read first the _ASM statement }
  672. consume(_ASM);
  673. {$ifndef newcg}
  674. { END is read }
  675. if try_to_consume(_LECKKLAMMER) then
  676. begin
  677. { it's possible to specify the modified registers }
  678. asmstat^.object_preserved:=true;
  679. if token<>_RECKKLAMMER then
  680. repeat
  681. { uppercase, because it's a CSTRING }
  682. uppervar(pattern);
  683. {$ifdef i386}
  684. if pattern='EAX' then
  685. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  686. else if pattern='EBX' then
  687. usedinproc:=usedinproc or ($80 shr byte(R_EBX))
  688. else if pattern='ECX' then
  689. usedinproc:=usedinproc or ($80 shr byte(R_ECX))
  690. else if pattern='EDX' then
  691. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  692. else if pattern='ESI' then
  693. begin
  694. usedinproc:=usedinproc or ($80 shr byte(R_ESI));
  695. asmstat^.object_preserved:=false;
  696. end
  697. else if pattern='EDI' then
  698. usedinproc:=usedinproc or ($80 shr byte(R_EDI))
  699. {$endif i386}
  700. {$ifdef m68k}
  701. if pattern='D0' then
  702. usedinproc:=usedinproc or ($800 shr word(R_D0))
  703. else if pattern='D1' then
  704. usedinproc:=usedinproc or ($800 shr word(R_D1))
  705. else if pattern='D6' then
  706. usedinproc:=usedinproc or ($800 shr word(R_D6))
  707. else if pattern='A0' then
  708. usedinproc:=usedinproc or ($800 shr word(R_A0))
  709. else if pattern='A1' then
  710. usedinproc:=usedinproc or ($800 shr word(R_A1))
  711. {$endif m68k}
  712. else consume(_RECKKLAMMER);
  713. consume(_CSTRING);
  714. if not try_to_consume(_COMMA) then
  715. break;
  716. until false;
  717. consume(_RECKKLAMMER);
  718. end
  719. else usedinproc:=$ff;
  720. {$endif newcg}
  721. { mark the start and the end of the assembler block for the optimizer }
  722. If Assigned(AsmStat^.p_asm) Then
  723. Begin
  724. Marker := New(Pai_Marker, Init(AsmBlockStart));
  725. AsmStat^.p_asm^.Insert(Marker);
  726. Marker := New(Pai_Marker, Init(AsmBlockEnd));
  727. AsmStat^.p_asm^.Concat(Marker);
  728. End;
  729. Inside_asm_statement:=false;
  730. _asm_statement:=asmstat;
  731. end;
  732. function new_dispose_statement : ptree;
  733. var
  734. p,p2 : ptree;
  735. ht : ttoken;
  736. again : boolean; { dummy for do_proc_call }
  737. {destrukname : stringid;}
  738. sym : psym;
  739. classh : pobjectdef;
  740. pd,pd2 : pdef;
  741. destructorpos,storepos : tfileposinfo;
  742. tt : ttreetyp;
  743. begin
  744. ht:=token;
  745. if try_to_consume(_NEW) then
  746. tt:=hnewn
  747. else
  748. begin
  749. consume(_DISPOSE);
  750. tt:=hdisposen;
  751. end;
  752. consume(_LKLAMMER);
  753. p:=comp_expr(true);
  754. { calc return type }
  755. cleartempgen;
  756. do_firstpass(p);
  757. set_varstate(p,tt=hdisposen);
  758. {var o:Pobject;
  759. begin
  760. new(o,init); (*Also a valid new statement*)
  761. end;}
  762. if try_to_consume(_COMMA) then
  763. begin
  764. { extended syntax of new and dispose }
  765. { function styled new is handled in factor }
  766. { destructors have no parameters }
  767. {destrukname:=pattern;}
  768. destructorpos:=tokenpos;
  769. consume(_ID);
  770. pd:=p^.resulttype;
  771. if pd=nil then
  772. pd:=generrordef;
  773. pd2:=pd;
  774. if (pd^.deftype<>pointerdef) then
  775. begin
  776. Message1(type_e_pointer_type_expected,pd^.typename);
  777. p:=factor(false);
  778. consume(_RKLAMMER);
  779. new_dispose_statement:=genzeronode(errorn);
  780. exit;
  781. end;
  782. { first parameter must be an object or class }
  783. if ppointerdef(pd)^.pointertype.def^.deftype<>objectdef then
  784. begin
  785. Message(parser_e_pointer_to_class_expected);
  786. new_dispose_statement:=factor(false);
  787. consume_all_until(_RKLAMMER);
  788. consume(_RKLAMMER);
  789. exit;
  790. end;
  791. { check, if the first parameter is a pointer to a _class_ }
  792. classh:=pobjectdef(ppointerdef(pd)^.pointertype.def);
  793. if classh^.is_class then
  794. begin
  795. Message(parser_e_no_new_or_dispose_for_classes);
  796. new_dispose_statement:=factor(false);
  797. consume_all_until(_RKLAMMER);
  798. consume(_RKLAMMER);
  799. exit;
  800. end;
  801. { search cons-/destructor, also in parent classes }
  802. storepos:=tokenpos;
  803. tokenpos:=destructorpos;
  804. sym:=search_class_member(classh,pattern);
  805. tokenpos:=storepos;
  806. { the second parameter of new/dispose must be a call }
  807. { to a cons-/destructor }
  808. if (not assigned(sym)) or (sym^.typ<>procsym) then
  809. begin
  810. Message(parser_e_expr_have_to_be_destructor_call);
  811. new_dispose_statement:=genzeronode(errorn);
  812. end
  813. else
  814. begin
  815. p2:=gensinglenode(tt,p);
  816. if ht=_NEW then
  817. begin
  818. { Constructors can take parameters.}
  819. p2^.resulttype:=ppointerdef(pd)^.pointertype.def;
  820. do_member_read(false,sym,p2,pd,again);
  821. end
  822. else
  823. { destructors can't.}
  824. p2:=genmethodcallnode(pprocsym(sym),srsymtable,p2);
  825. { we need the real called method }
  826. cleartempgen;
  827. do_firstpass(p2);
  828. if not codegenerror then
  829. begin
  830. if (ht=_NEW) and (p2^.procdefinition^.proctypeoption<>potype_constructor) then
  831. Message(parser_e_expr_have_to_be_constructor_call);
  832. if (ht=_DISPOSE) and (p2^.procdefinition^.proctypeoption<>potype_destructor) then
  833. Message(parser_e_expr_have_to_be_destructor_call);
  834. if ht=_NEW then
  835. begin
  836. p2:=gennode(assignn,getcopy(p),gensinglenode(newn,p2));
  837. p2^.right^.resulttype:=pd2;
  838. end;
  839. end;
  840. new_dispose_statement:=p2;
  841. end;
  842. end
  843. else
  844. begin
  845. if p^.resulttype=nil then
  846. p^.resulttype:=generrordef;
  847. if (p^.resulttype^.deftype<>pointerdef) then
  848. Begin
  849. Message1(type_e_pointer_type_expected,p^.resulttype^.typename);
  850. new_dispose_statement:=genzeronode(errorn);
  851. end
  852. else
  853. begin
  854. if (ppointerdef(p^.resulttype)^.pointertype.def^.deftype=objectdef) and
  855. (oo_has_vmt in pobjectdef(ppointerdef(p^.resulttype)^.pointertype.def)^.objectoptions) then
  856. Message(parser_w_use_extended_syntax_for_objects);
  857. if (ppointerdef(p^.resulttype)^.pointertype.def^.deftype=orddef) and
  858. (porddef(ppointerdef(p^.resulttype)^.pointertype.def)^.typ=uvoid) then
  859. if (m_tp in aktmodeswitches) or
  860. (m_delphi in aktmodeswitches) then
  861. Message(parser_w_no_new_dispose_on_void_pointers)
  862. else
  863. Message(parser_e_no_new_dispose_on_void_pointers);
  864. case ht of
  865. _NEW : new_dispose_statement:=gensinglenode(simplenewn,p);
  866. _DISPOSE : new_dispose_statement:=gensinglenode(simpledisposen,p);
  867. end;
  868. end;
  869. end;
  870. consume(_RKLAMMER);
  871. end;
  872. function statement_block(starttoken : ttoken) : ptree;
  873. var
  874. first,last : ptree;
  875. filepos : tfileposinfo;
  876. begin
  877. first:=nil;
  878. filepos:=tokenpos;
  879. consume(starttoken);
  880. inc(statement_level);
  881. while not(token in [_END,_FINALIZATION]) do
  882. begin
  883. if first=nil then
  884. begin
  885. last:=gennode(statementn,nil,statement);
  886. first:=last;
  887. end
  888. else
  889. begin
  890. last^.left:=gennode(statementn,nil,statement);
  891. last:=last^.left;
  892. end;
  893. if (token in [_END,_FINALIZATION]) then
  894. break
  895. else
  896. begin
  897. { if no semicolon, then error and go on }
  898. if token<>_SEMICOLON then
  899. begin
  900. consume(_SEMICOLON);
  901. consume_all_until(_SEMICOLON);
  902. end;
  903. consume(_SEMICOLON);
  904. end;
  905. emptystats;
  906. end;
  907. { don't consume the finalization token, it is consumed when
  908. reading the finalization block, but allow it only after
  909. an initalization ! }
  910. if (starttoken<>_INITIALIZATION) or (token<>_FINALIZATION) then
  911. consume(_END);
  912. dec(statement_level);
  913. last:=gensinglenode(blockn,first);
  914. set_tree_filepos(last,filepos);
  915. statement_block:=last;
  916. end;
  917. function statement : ptree;
  918. var
  919. p : ptree;
  920. code : ptree;
  921. labelnr : pasmlabel;
  922. filepos : tfileposinfo;
  923. sr : plabelsym;
  924. label
  925. ready;
  926. begin
  927. filepos:=tokenpos;
  928. case token of
  929. _GOTO : begin
  930. if not(cs_support_goto in aktmoduleswitches)then
  931. Message(sym_e_goto_and_label_not_supported);
  932. consume(_GOTO);
  933. if (token<>_INTCONST) and (token<>_ID) then
  934. begin
  935. Message(sym_e_label_not_found);
  936. code:=genzeronode(errorn);
  937. end
  938. else
  939. begin
  940. getsym(pattern,true);
  941. consume(token);
  942. if srsym^.typ<>labelsym then
  943. begin
  944. Message(sym_e_id_is_no_label_id);
  945. code:=genzeronode(errorn);
  946. end
  947. else
  948. begin
  949. code:=genlabelnode(goton,plabelsym(srsym)^.lab);
  950. code^.labsym:=plabelsym(srsym);
  951. { set flag that this label is used }
  952. plabelsym(srsym)^.used:=true;
  953. end;
  954. end;
  955. end;
  956. _BEGIN : code:=statement_block(_BEGIN);
  957. _IF : code:=if_statement;
  958. _CASE : code:=case_statement;
  959. _REPEAT : code:=repeat_statement;
  960. _WHILE : code:=while_statement;
  961. _FOR : code:=for_statement;
  962. _NEW,_DISPOSE : code:=new_dispose_statement;
  963. _WITH : code:=with_statement;
  964. _TRY : code:=try_statement;
  965. _RAISE : code:=raise_statement;
  966. { semicolons,else until and end are ignored }
  967. _SEMICOLON,
  968. _ELSE,
  969. _UNTIL,
  970. _END:
  971. code:=genzeronode(niln);
  972. _FAIL : begin
  973. { internalerror(100); }
  974. if (aktprocsym^.definition^.proctypeoption<>potype_constructor) then
  975. Message(parser_e_fail_only_in_constructor);
  976. consume(_FAIL);
  977. code:=genzeronode(failn);
  978. end;
  979. _EXIT : code:=exit_statement;
  980. _ASM : begin
  981. code:=_asm_statement;
  982. end;
  983. _EOF : begin
  984. Message(scan_f_end_of_file);
  985. end;
  986. else
  987. begin
  988. if (token in [_INTCONST,_ID]) then
  989. begin
  990. getsym(pattern,true);
  991. lastsymknown:=true;
  992. lastsrsym:=srsym;
  993. { it is NOT necessarily the owner
  994. it can be a withsymtable !!! }
  995. lastsrsymtable:=srsymtable;
  996. if assigned(srsym) and (srsym^.typ=labelsym) then
  997. begin
  998. consume(token);
  999. consume(_COLON);
  1000. { we must preserve srsym to set code later }
  1001. sr:=plabelsym(srsym);
  1002. if sr^.defined then
  1003. Message(sym_e_label_already_defined);
  1004. sr^.defined:=true;
  1005. { statement modifies srsym }
  1006. labelnr:=sr^.lab;
  1007. lastsymknown:=false;
  1008. { the pointer to the following instruction }
  1009. { isn't a very clean way }
  1010. code:=gensinglenode(labeln,statement{$ifndef tp}(){$endif});
  1011. code^.labelnr:=labelnr;
  1012. sr^.code:=code;
  1013. { sorry, but there is a jump the easiest way }
  1014. goto ready;
  1015. end;
  1016. end;
  1017. p:=expr;
  1018. if not(p^.treetype in [calln,assignn,breakn,inlinen,
  1019. continuen]) then
  1020. Message(cg_e_illegal_expression);
  1021. { specify that we don't use the value returned by the call }
  1022. { Question : can this be also improtant
  1023. for inlinen ??
  1024. it is used for :
  1025. - dispose of temp stack space
  1026. - dispose on FPU stack }
  1027. if p^.treetype=calln then
  1028. p^.return_value_used:=false;
  1029. code:=p;
  1030. end;
  1031. end;
  1032. ready:
  1033. if assigned(code) then
  1034. set_tree_filepos(code,filepos);
  1035. statement:=code;
  1036. end;
  1037. function block(islibrary : boolean) : ptree;
  1038. var
  1039. funcretsym : pfuncretsym;
  1040. storepos : tfileposinfo;
  1041. begin
  1042. if procinfo^.returntype.def<>pdef(voiddef) then
  1043. begin
  1044. { if the current is a function aktprocsym is non nil }
  1045. { and there is a local symtable set }
  1046. storepos:=tokenpos;
  1047. tokenpos:=aktprocsym^.fileinfo;
  1048. funcretsym:=new(pfuncretsym,init(aktprocsym^.name,procinfo));
  1049. { insert in local symtable }
  1050. symtablestack^.insert(funcretsym);
  1051. tokenpos:=storepos;
  1052. if ret_in_acc(procinfo^.returntype.def) or (procinfo^.returntype.def^.deftype=floatdef) then
  1053. procinfo^.return_offset:=-funcretsym^.address;
  1054. procinfo^.funcretsym:=funcretsym;
  1055. { insert result also if support is on }
  1056. if (m_result in aktmodeswitches) then
  1057. begin
  1058. procinfo^.resultfuncretsym:=new(pfuncretsym,init('RESULT',procinfo));
  1059. symtablestack^.insert(procinfo^.resultfuncretsym);
  1060. end;
  1061. end;
  1062. read_declarations(islibrary);
  1063. { temporary space is set, while the BEGIN of the procedure }
  1064. if (symtablestack^.symtabletype=localsymtable) then
  1065. procinfo^.firsttemp_offset := -symtablestack^.datasize
  1066. else
  1067. procinfo^.firsttemp_offset := 0;
  1068. { space for the return value }
  1069. { !!!!! this means that we can not set the return value
  1070. in a subfunction !!!!! }
  1071. { because we don't know yet where the address is }
  1072. if procinfo^.returntype.def<>pdef(voiddef) then
  1073. begin
  1074. if ret_in_acc(procinfo^.returntype.def) or (procinfo^.returntype.def^.deftype=floatdef) then
  1075. { if (procinfo^.retdef^.deftype=orddef) or
  1076. (procinfo^.retdef^.deftype=pointerdef) or
  1077. (procinfo^.retdef^.deftype=enumdef) or
  1078. (procinfo^.retdef^.deftype=procvardef) or
  1079. (procinfo^.retdef^.deftype=floatdef) or
  1080. (
  1081. (procinfo^.retdef^.deftype=setdef) and
  1082. (psetdef(procinfo^.retdef)^.settype=smallset)
  1083. ) then }
  1084. begin
  1085. { the space has been set in the local symtable }
  1086. procinfo^.return_offset:=-funcretsym^.address;
  1087. if ((procinfo^.flags and pi_operator)<>0) and
  1088. assigned(opsym) then
  1089. {opsym^.address:=procinfo^.call_offset; is wrong PM }
  1090. opsym^.address:=-procinfo^.return_offset;
  1091. { eax is modified by a function }
  1092. {$ifndef newcg}
  1093. {$ifdef i386}
  1094. usedinproc:=usedinproc or ($80 shr byte(R_EAX));
  1095. if is_64bitint(procinfo^.returntype.def) then
  1096. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  1097. {$endif}
  1098. {$ifdef m68k}
  1099. usedinproc:=usedinproc or ($800 shr word(R_D0));
  1100. if is_64bitint(procinfo^.retdef) then
  1101. usedinproc:=usedinproc or ($800 shr byte(R_D1))
  1102. {$endif}
  1103. {$endif newcg}
  1104. end;
  1105. end;
  1106. {Unit initialization?.}
  1107. if (lexlevel=unit_init_level) and (current_module^.is_unit)
  1108. or islibrary then
  1109. begin
  1110. if (token=_END) then
  1111. begin
  1112. consume(_END);
  1113. block:=nil;
  1114. end
  1115. else
  1116. begin
  1117. if token=_INITIALIZATION then
  1118. begin
  1119. current_module^.flags:=current_module^.flags or uf_init;
  1120. block:=statement_block(_INITIALIZATION);
  1121. end
  1122. else if (token=_FINALIZATION) then
  1123. begin
  1124. if (current_module^.flags and uf_finalize)<>0 then
  1125. block:=statement_block(_FINALIZATION)
  1126. else
  1127. begin
  1128. { can we allow no INITIALIZATION for DLL ??
  1129. I think it should work PM }
  1130. block:=nil;
  1131. exit;
  1132. end;
  1133. end
  1134. else
  1135. begin
  1136. current_module^.flags:=current_module^.flags or uf_init;
  1137. block:=statement_block(_BEGIN);
  1138. end;
  1139. end;
  1140. end
  1141. else
  1142. block:=statement_block(_BEGIN);
  1143. end;
  1144. function assembler_block : ptree;
  1145. begin
  1146. read_declarations(false);
  1147. { temporary space is set, while the BEGIN of the procedure }
  1148. if symtablestack^.symtabletype=localsymtable then
  1149. procinfo^.firsttemp_offset := -symtablestack^.datasize
  1150. else
  1151. procinfo^.firsttemp_offset := 0;
  1152. { assembler code does not allocate }
  1153. { space for the return value }
  1154. if procinfo^.returntype.def<>pdef(voiddef) then
  1155. begin
  1156. if ret_in_acc(procinfo^.returntype.def) then
  1157. begin
  1158. { in assembler code the result should be directly in %eax
  1159. procinfo^.retoffset:=procinfo^.firsttemp-procinfo^.retdef^.size;
  1160. procinfo^.firsttemp:=procinfo^.retoffset; }
  1161. {$ifndef newcg}
  1162. {$ifdef i386}
  1163. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  1164. {$endif}
  1165. {$ifdef m68k}
  1166. usedinproc:=usedinproc or ($800 shr word(R_D0))
  1167. {$endif}
  1168. {$endif newcg}
  1169. end
  1170. {
  1171. else if not is_fpu(procinfo^.retdef) then
  1172. should we allow assembler functions of big elements ?
  1173. YES (FK)!!
  1174. Message(parser_e_asm_incomp_with_function_return);
  1175. }
  1176. end;
  1177. { set the framepointer to esp for assembler functions }
  1178. { but only if the are no local variables }
  1179. { added no parameter also (PM) }
  1180. { disable for methods, because self pointer is expected }
  1181. { at -8(%ebp) (JM) }
  1182. if not(assigned(procinfo^._class)) and
  1183. (po_assembler in aktprocsym^.definition^.procoptions) and
  1184. (aktprocsym^.definition^.localst^.datasize=0) and
  1185. (aktprocsym^.definition^.parast^.datasize=0) and
  1186. not(ret_in_param(aktprocsym^.definition^.rettype.def)) then
  1187. begin
  1188. procinfo^.framepointer:=stack_pointer;
  1189. { set the right value for parameters }
  1190. dec(aktprocsym^.definition^.parast^.address_fixup,target_os.size_of_pointer);
  1191. dec(procinfo^.call_offset,target_os.size_of_pointer);
  1192. end;
  1193. { force the asm statement }
  1194. if token<>_ASM then
  1195. consume(_ASM);
  1196. procinfo^.Flags := procinfo^.Flags Or pi_is_assembler;
  1197. assembler_block:=_asm_statement;
  1198. { becuase the END is already read we need to get the
  1199. last_endtoken_filepos here (PFV) }
  1200. last_endtoken_filepos:=tokenpos;
  1201. end;
  1202. end.
  1203. {
  1204. $Log$
  1205. Revision 1.118 2000-01-07 01:14:31 peter
  1206. * updated copyright to 2000
  1207. Revision 1.117 1999/12/22 01:01:52 peter
  1208. - removed freelabel()
  1209. * added undefined label detection in internal assembler, this prevents
  1210. a lot of ld crashes and wrong .o files
  1211. * .o files aren't written anymore if errors have occured
  1212. * inlining of assembler labels is now correct
  1213. Revision 1.116 1999/12/14 09:58:42 florian
  1214. + compiler checks now if a goto leaves an exception block
  1215. Revision 1.115 1999/12/01 22:43:17 peter
  1216. * fixed sigsegv with casedef=nil
  1217. Revision 1.114 1999/12/01 12:42:32 peter
  1218. * fixed bug 698
  1219. * removed some notes about unused vars
  1220. Revision 1.113 1999/11/30 10:40:45 peter
  1221. + ttype, tsymlist
  1222. Revision 1.112 1999/11/20 01:19:10 pierre
  1223. * DLL index used for win32 target with DEF file
  1224. + DLL initialization/finalization support
  1225. Revision 1.111 1999/11/18 15:34:48 pierre
  1226. * Notes/Hints for local syms changed to
  1227. Set_varstate function
  1228. Revision 1.110 1999/11/17 17:05:02 pierre
  1229. * Notes/hints changes
  1230. Revision 1.109 1999/11/15 22:00:48 peter
  1231. * labels used but not defined give error instead of warning, the warning
  1232. is now only with declared but not defined and not used.
  1233. Revision 1.108 1999/11/10 00:24:02 pierre
  1234. * more browser details
  1235. Revision 1.107 1999/11/09 13:02:46 peter
  1236. * fixed 'raise end;'
  1237. Revision 1.106 1999/11/06 14:34:23 peter
  1238. * truncated log to 20 revs
  1239. Revision 1.105 1999/10/22 10:39:35 peter
  1240. * split type reading from pdecl to ptype unit
  1241. * parameter_dec routine is now used for procedure and procvars
  1242. Revision 1.104 1999/10/14 14:57:54 florian
  1243. - removed the hcodegen use in the new cg, use cgbase instead
  1244. Revision 1.103 1999/09/27 23:44:56 peter
  1245. * procinfo is now a pointer
  1246. * support for result setting in sub procedure
  1247. Revision 1.102 1999/09/16 23:05:54 florian
  1248. * m68k compiler is again compilable (only gas writer, no assembler reader)
  1249. Revision 1.101 1999/09/10 18:48:09 florian
  1250. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1251. * most things for stored properties fixed
  1252. Revision 1.100 1999/09/07 14:12:36 jonas
  1253. * framepointer cannot be changed to esp for methods
  1254. Revision 1.99 1999/08/26 21:10:08 peter
  1255. * better error recovery for case
  1256. Revision 1.98 1999/08/05 16:53:05 peter
  1257. * V_Fatal=1, all other V_ are also increased
  1258. * Check for local procedure when assigning procvar
  1259. * fixed comment parsing because directives
  1260. * oldtp mode directives better supported
  1261. * added some messages to errore.msg
  1262. Revision 1.97 1999/08/04 13:02:59 jonas
  1263. * all tokens now start with an underscore
  1264. * PowerPC compiles!!
  1265. Revision 1.96 1999/08/04 00:23:19 florian
  1266. * renamed i386asm and i386base to cpuasm and cpubase
  1267. Revision 1.95 1999/08/03 22:03:03 peter
  1268. * moved bitmask constants to sets
  1269. * some other type/const renamings
  1270. Revision 1.94 1999/08/03 17:09:39 florian
  1271. * the alpha compiler can be compiled now
  1272. Revision 1.93 1999/08/02 21:28:59 florian
  1273. * the main branch psub.pas is now used for
  1274. newcg compiler
  1275. Revision 1.92 1999/07/26 09:42:14 florian
  1276. * bugs 494-496 fixed
  1277. Revision 1.91 1999/06/30 22:16:22 florian
  1278. * use of is_ordinal checked: often a qword/int64 isn't allowed (case/for ...)
  1279. * small qword problems fixed
  1280. Revision 1.90 1999/06/22 16:24:43 pierre
  1281. * local browser stuff corrected
  1282. Revision 1.89 1999/06/17 13:19:54 pierre
  1283. * merged from 0_99_12 branch
  1284. Revision 1.88.2.1 1999/06/17 12:51:46 pierre
  1285. * changed is_assignment_overloaded into
  1286. function assignment_overloaded : pprocdef
  1287. to allow overloading of assignment with only different result type
  1288. Revision 1.88 1999/06/15 13:19:46 pierre
  1289. * better uninitialized var tests for TP mode
  1290. Revision 1.87 1999/05/27 19:44:50 peter
  1291. * removed oldasm
  1292. * plabel -> pasmlabel
  1293. * -a switches to source writing automaticly
  1294. * assembler readers OOPed
  1295. * asmsymbol automaticly external
  1296. * jumptables and other label fixes for asm readers
  1297. }