2
0

tcinl.pas 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Type checking and register allocation for inline nodes
  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 tcinl;
  19. interface
  20. uses
  21. tree;
  22. procedure firstinline(var p : ptree);
  23. implementation
  24. uses
  25. cobjects,verbose,globals,systems,
  26. globtype,
  27. symconst,symtable,aasm,types,
  28. htypechk,pass_1,
  29. tccal,cpubase
  30. {$ifdef newcg}
  31. ,cgbase
  32. ,tgobj
  33. ,tgcpu
  34. {$else newcg}
  35. ,hcodegen
  36. {$ifdef i386}
  37. ,tgeni386
  38. {$endif}
  39. {$endif newcg}
  40. ;
  41. {*****************************************************************************
  42. FirstInLine
  43. *****************************************************************************}
  44. {$ifdef fpc}
  45. {$maxfpuregisters 0}
  46. {$endif fpc}
  47. procedure firstinline(var p : ptree);
  48. var
  49. vl,vl2 : longint;
  50. vr : bestreal;
  51. p1,hp,hpp : ptree;
  52. {$ifndef NOCOLONCHECK}
  53. frac_para,length_para : ptree;
  54. {$endif ndef NOCOLONCHECK}
  55. extra_register,
  56. isreal,
  57. dowrite,
  58. file_is_typed : boolean;
  59. procedure do_lowhigh(adef : pdef);
  60. var
  61. v : longint;
  62. enum : penumsym;
  63. begin
  64. case Adef^.deftype of
  65. orddef:
  66. begin
  67. if p^.inlinenumber=in_low_x then
  68. v:=porddef(Adef)^.low
  69. else
  70. v:=porddef(Adef)^.high;
  71. hp:=genordinalconstnode(v,adef);
  72. firstpass(hp);
  73. disposetree(p);
  74. p:=hp;
  75. end;
  76. enumdef:
  77. begin
  78. enum:=Penumdef(Adef)^.firstenum;
  79. if p^.inlinenumber=in_high_x then
  80. while enum^.nextenum<>nil do
  81. enum:=enum^.nextenum;
  82. hp:=genenumnode(enum);
  83. disposetree(p);
  84. p:=hp;
  85. end;
  86. else
  87. internalerror(87);
  88. end;
  89. end;
  90. function getconstrealvalue : bestreal;
  91. begin
  92. case p^.left^.treetype of
  93. ordconstn:
  94. getconstrealvalue:=p^.left^.value;
  95. realconstn:
  96. getconstrealvalue:=p^.left^.value_real;
  97. else
  98. internalerror(309992);
  99. end;
  100. end;
  101. procedure setconstrealvalue(r : bestreal);
  102. var
  103. hp : ptree;
  104. begin
  105. hp:=genrealconstnode(r,bestrealdef^);
  106. disposetree(p);
  107. p:=hp;
  108. firstpass(p);
  109. end;
  110. procedure handleextendedfunction;
  111. begin
  112. p^.location.loc:=LOC_FPU;
  113. p^.resulttype:=s80floatdef;
  114. { redo firstpass for varstate status PM }
  115. set_varstate(p^.left,true);
  116. if (p^.left^.resulttype^.deftype<>floatdef) or
  117. (pfloatdef(p^.left^.resulttype)^.typ<>s80real) then
  118. begin
  119. p^.left:=gentypeconvnode(p^.left,s80floatdef);
  120. firstpass(p^.left);
  121. end;
  122. p^.registers32:=p^.left^.registers32;
  123. p^.registersfpu:=p^.left^.registersfpu;
  124. {$ifdef SUPPORT_MMX}
  125. p^.registersmmx:=p^.left^.registersmmx;
  126. {$endif SUPPORT_MMX}
  127. end;
  128. begin
  129. { if we handle writeln; p^.left contains no valid address }
  130. if assigned(p^.left) then
  131. begin
  132. if p^.left^.treetype=callparan then
  133. firstcallparan(p^.left,nil,false)
  134. else
  135. firstpass(p^.left);
  136. left_right_max(p);
  137. set_location(p^.location,p^.left^.location);
  138. end;
  139. inc(parsing_para_level);
  140. { handle intern constant functions in separate case }
  141. if p^.inlineconst then
  142. begin
  143. hp:=nil;
  144. { no parameters? }
  145. if not assigned(p^.left) then
  146. begin
  147. case p^.inlinenumber of
  148. in_const_pi :
  149. hp:=genrealconstnode(pi,bestrealdef^);
  150. else
  151. internalerror(89);
  152. end;
  153. end
  154. else
  155. { process constant expression with parameter }
  156. begin
  157. vl:=0;
  158. vl2:=0; { second parameter Ex: ptr(vl,vl2) }
  159. vr:=0;
  160. isreal:=false;
  161. case p^.left^.treetype of
  162. realconstn :
  163. begin
  164. isreal:=true;
  165. vr:=p^.left^.value_real;
  166. end;
  167. ordconstn :
  168. vl:=p^.left^.value;
  169. callparan :
  170. begin
  171. { both exists, else it was not generated }
  172. vl:=p^.left^.left^.value;
  173. vl2:=p^.left^.right^.left^.value;
  174. end;
  175. else
  176. CGMessage(cg_e_illegal_expression);
  177. end;
  178. case p^.inlinenumber of
  179. in_const_trunc :
  180. begin
  181. if isreal then
  182. begin
  183. if (vr>=2147483648.0) or (vr<=-2147483649.0) then
  184. begin
  185. CGMessage(parser_e_range_check_error);
  186. hp:=genordinalconstnode(1,s32bitdef)
  187. end
  188. else
  189. hp:=genordinalconstnode(trunc(vr),s32bitdef)
  190. end
  191. else
  192. hp:=genordinalconstnode(trunc(vl),s32bitdef);
  193. end;
  194. in_const_round :
  195. begin
  196. if isreal then
  197. begin
  198. if (vr>=2147483647.5) or (vr<=-2147483648.5) then
  199. begin
  200. CGMessage(parser_e_range_check_error);
  201. hp:=genordinalconstnode(1,s32bitdef)
  202. end
  203. else
  204. hp:=genordinalconstnode(round(vr),s32bitdef)
  205. end
  206. else
  207. hp:=genordinalconstnode(round(vl),s32bitdef);
  208. end;
  209. in_const_frac :
  210. begin
  211. if isreal then
  212. hp:=genrealconstnode(frac(vr),bestrealdef^)
  213. else
  214. hp:=genrealconstnode(frac(vl),bestrealdef^);
  215. end;
  216. in_const_int :
  217. begin
  218. if isreal then
  219. hp:=genrealconstnode(int(vr),bestrealdef^)
  220. else
  221. hp:=genrealconstnode(int(vl),bestrealdef^);
  222. end;
  223. in_const_abs :
  224. begin
  225. if isreal then
  226. hp:=genrealconstnode(abs(vr),bestrealdef^)
  227. else
  228. hp:=genordinalconstnode(abs(vl),p^.left^.resulttype);
  229. end;
  230. in_const_sqr :
  231. begin
  232. if isreal then
  233. hp:=genrealconstnode(sqr(vr),bestrealdef^)
  234. else
  235. hp:=genordinalconstnode(sqr(vl),p^.left^.resulttype);
  236. end;
  237. in_const_odd :
  238. begin
  239. if isreal then
  240. CGMessage1(type_e_integer_expr_expected,p^.left^.resulttype^.typename)
  241. else
  242. hp:=genordinalconstnode(byte(odd(vl)),booldef);
  243. end;
  244. in_const_swap_word :
  245. begin
  246. if isreal then
  247. CGMessage1(type_e_integer_expr_expected,p^.left^.resulttype^.typename)
  248. else
  249. hp:=genordinalconstnode((vl and $ff) shl 8+(vl shr 8),p^.left^.resulttype);
  250. end;
  251. in_const_swap_long :
  252. begin
  253. if isreal then
  254. CGMessage(type_e_mismatch)
  255. else
  256. hp:=genordinalconstnode((vl and $ffff) shl 16+(vl shr 16),p^.left^.resulttype);
  257. end;
  258. in_const_ptr :
  259. begin
  260. if isreal then
  261. CGMessage(type_e_mismatch)
  262. else
  263. hp:=genordinalconstnode((vl2 shl 16) or vl,voidpointerdef);
  264. end;
  265. in_const_sqrt :
  266. begin
  267. if isreal then
  268. begin
  269. if vr<0.0 then
  270. CGMessage(type_e_wrong_math_argument)
  271. else
  272. hp:=genrealconstnode(sqrt(vr),bestrealdef^)
  273. end
  274. else
  275. begin
  276. if vl<0 then
  277. CGMessage(type_e_wrong_math_argument)
  278. else
  279. hp:=genrealconstnode(sqrt(vl),bestrealdef^);
  280. end;
  281. end;
  282. in_const_arctan :
  283. begin
  284. if isreal then
  285. hp:=genrealconstnode(arctan(vr),bestrealdef^)
  286. else
  287. hp:=genrealconstnode(arctan(vl),bestrealdef^);
  288. end;
  289. in_const_cos :
  290. begin
  291. if isreal then
  292. hp:=genrealconstnode(cos(vr),bestrealdef^)
  293. else
  294. hp:=genrealconstnode(cos(vl),bestrealdef^);
  295. end;
  296. in_const_sin :
  297. begin
  298. if isreal then
  299. hp:=genrealconstnode(sin(vr),bestrealdef^)
  300. else
  301. hp:=genrealconstnode(sin(vl),bestrealdef^);
  302. end;
  303. in_const_exp :
  304. begin
  305. if isreal then
  306. hp:=genrealconstnode(exp(vr),bestrealdef^)
  307. else
  308. hp:=genrealconstnode(exp(vl),bestrealdef^);
  309. end;
  310. in_const_ln :
  311. begin
  312. if isreal then
  313. begin
  314. if vr<=0.0 then
  315. CGMessage(type_e_wrong_math_argument)
  316. else
  317. hp:=genrealconstnode(ln(vr),bestrealdef^)
  318. end
  319. else
  320. begin
  321. if vl<=0 then
  322. CGMessage(type_e_wrong_math_argument)
  323. else
  324. hp:=genrealconstnode(ln(vl),bestrealdef^);
  325. end;
  326. end;
  327. else
  328. internalerror(88);
  329. end;
  330. end;
  331. disposetree(p);
  332. if hp=nil then
  333. hp:=genzeronode(errorn);
  334. firstpass(hp);
  335. p:=hp;
  336. end
  337. else
  338. begin
  339. case p^.inlinenumber of
  340. in_lo_qword,
  341. in_hi_qword,
  342. in_lo_long,
  343. in_hi_long,
  344. in_lo_word,
  345. in_hi_word:
  346. begin
  347. set_varstate(p^.left,true);
  348. if p^.registers32<1 then
  349. p^.registers32:=1;
  350. if p^.inlinenumber in [in_lo_word,in_hi_word] then
  351. p^.resulttype:=u8bitdef
  352. else if p^.inlinenumber in [in_lo_qword,in_hi_qword] then
  353. begin
  354. p^.resulttype:=u32bitdef;
  355. if (m_tp in aktmodeswitches) or
  356. (m_delphi in aktmodeswitches) then
  357. CGMessage(type_w_maybe_wrong_hi_lo);
  358. end
  359. else
  360. begin
  361. p^.resulttype:=u16bitdef;
  362. if (m_tp in aktmodeswitches) or
  363. (m_delphi in aktmodeswitches) then
  364. CGMessage(type_w_maybe_wrong_hi_lo);
  365. end;
  366. p^.location.loc:=LOC_REGISTER;
  367. if not is_integer(p^.left^.resulttype) then
  368. CGMessage(type_e_mismatch)
  369. else
  370. begin
  371. if p^.left^.treetype=ordconstn then
  372. begin
  373. case p^.inlinenumber of
  374. in_lo_word : hp:=genordinalconstnode(p^.left^.value and $ff,p^.left^.resulttype);
  375. in_hi_word : hp:=genordinalconstnode(p^.left^.value shr 8,p^.left^.resulttype);
  376. in_lo_long : hp:=genordinalconstnode(p^.left^.value and $ffff,p^.left^.resulttype);
  377. in_hi_long : hp:=genordinalconstnode(p^.left^.value shr 16,p^.left^.resulttype);
  378. in_lo_qword : hp:=genordinalconstnode(p^.left^.value and $ffffffff,p^.left^.resulttype);
  379. in_hi_qword : hp:=genordinalconstnode(p^.left^.value shr 32,p^.left^.resulttype);
  380. end;
  381. disposetree(p);
  382. firstpass(hp);
  383. p:=hp;
  384. end;
  385. end;
  386. end;
  387. in_sizeof_x:
  388. begin
  389. set_varstate(p^.left,false);
  390. if push_high_param(p^.left^.resulttype) then
  391. begin
  392. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  393. hp:=gennode(addn,genloadnode(pvarsym(srsym),p^.left^.symtable),
  394. genordinalconstnode(1,s32bitdef));
  395. if (p^.left^.resulttype^.deftype=arraydef) and
  396. (parraydef(p^.left^.resulttype)^.elesize<>1) then
  397. hp:=gennode(muln,hp,genordinalconstnode(parraydef(p^.left^.resulttype)^.elesize,s32bitdef));
  398. disposetree(p);
  399. p:=hp;
  400. firstpass(p);
  401. end;
  402. if p^.registers32<1 then
  403. p^.registers32:=1;
  404. p^.resulttype:=s32bitdef;
  405. p^.location.loc:=LOC_REGISTER;
  406. end;
  407. in_typeof_x:
  408. begin
  409. set_varstate(p^.left,false);
  410. if p^.registers32<1 then
  411. p^.registers32:=1;
  412. p^.location.loc:=LOC_REGISTER;
  413. p^.resulttype:=voidpointerdef;
  414. end;
  415. in_ord_x:
  416. begin
  417. set_varstate(p^.left,true);
  418. if (p^.left^.treetype=ordconstn) then
  419. begin
  420. hp:=genordinalconstnode(p^.left^.value,s32bitdef);
  421. disposetree(p);
  422. p:=hp;
  423. firstpass(p);
  424. end
  425. else
  426. begin
  427. if (p^.left^.resulttype^.deftype=orddef) then
  428. if (porddef(p^.left^.resulttype)^.typ in [uchar,bool8bit]) then
  429. begin
  430. if porddef(p^.left^.resulttype)^.typ=bool8bit then
  431. begin
  432. hp:=gentypeconvnode(p^.left,u8bitdef);
  433. putnode(p);
  434. p:=hp;
  435. p^.convtyp:=tc_bool_2_int;
  436. p^.explizit:=true;
  437. firstpass(p);
  438. end
  439. else
  440. begin
  441. hp:=gentypeconvnode(p^.left,u8bitdef);
  442. putnode(p);
  443. p:=hp;
  444. p^.explizit:=true;
  445. firstpass(p);
  446. end;
  447. end
  448. { can this happen ? }
  449. else if (porddef(p^.left^.resulttype)^.typ=uvoid) then
  450. CGMessage(type_e_mismatch)
  451. else
  452. { all other orddef need no transformation }
  453. begin
  454. hp:=p^.left;
  455. putnode(p);
  456. p:=hp;
  457. end
  458. else if (p^.left^.resulttype^.deftype=enumdef) then
  459. begin
  460. hp:=gentypeconvnode(p^.left,s32bitdef);
  461. putnode(p);
  462. p:=hp;
  463. p^.explizit:=true;
  464. firstpass(p);
  465. end
  466. else
  467. begin
  468. { can anything else be ord() ?}
  469. CGMessage(type_e_mismatch);
  470. end;
  471. end;
  472. end;
  473. in_chr_byte:
  474. begin
  475. set_varstate(p^.left,true);
  476. hp:=gentypeconvnode(p^.left,cchardef);
  477. putnode(p);
  478. p:=hp;
  479. p^.explizit:=true;
  480. firstpass(p);
  481. end;
  482. in_length_string:
  483. begin
  484. set_varstate(p^.left,true);
  485. if is_ansistring(p^.left^.resulttype) then
  486. p^.resulttype:=s32bitdef
  487. else
  488. p^.resulttype:=u8bitdef;
  489. { we don't need string conversations here }
  490. if (p^.left^.treetype=typeconvn) and
  491. (p^.left^.left^.resulttype^.deftype=stringdef) then
  492. begin
  493. hp:=p^.left^.left;
  494. putnode(p^.left);
  495. p^.left:=hp;
  496. end;
  497. { check the type, must be string or char }
  498. if (p^.left^.resulttype^.deftype<>stringdef) and
  499. (not is_char(p^.left^.resulttype)) then
  500. CGMessage(type_e_mismatch);
  501. { evaluates length of constant strings direct }
  502. if (p^.left^.treetype=stringconstn) then
  503. begin
  504. hp:=genordinalconstnode(p^.left^.length,s32bitdef);
  505. disposetree(p);
  506. firstpass(hp);
  507. p:=hp;
  508. end
  509. { length of char is one allways }
  510. else if is_constcharnode(p^.left) then
  511. begin
  512. hp:=genordinalconstnode(1,s32bitdef);
  513. disposetree(p);
  514. firstpass(hp);
  515. p:=hp;
  516. end;
  517. end;
  518. in_assigned_x:
  519. begin
  520. set_varstate(p^.left,true);
  521. p^.resulttype:=booldef;
  522. p^.location.loc:=LOC_FLAGS;
  523. end;
  524. in_ofs_x,
  525. in_seg_x :
  526. set_varstate(p^.left,false);
  527. in_pred_x,
  528. in_succ_x:
  529. begin
  530. p^.resulttype:=p^.left^.resulttype;
  531. if is_64bitint(p^.resulttype) then
  532. begin
  533. if (p^.registers32<2) then
  534. p^.registers32:=2
  535. end
  536. else
  537. begin
  538. if (p^.registers32<1) then
  539. p^.registers32:=1;
  540. end;
  541. p^.location.loc:=LOC_REGISTER;
  542. set_varstate(p^.left,true);
  543. if not is_ordinal(p^.resulttype) then
  544. CGMessage(type_e_ordinal_expr_expected)
  545. else
  546. begin
  547. if (p^.resulttype^.deftype=enumdef) and
  548. (penumdef(p^.resulttype)^.has_jumps) then
  549. CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible)
  550. else
  551. if p^.left^.treetype=ordconstn then
  552. begin
  553. if p^.inlinenumber=in_succ_x then
  554. hp:=genordinalconstnode(p^.left^.value+1,p^.left^.resulttype)
  555. else
  556. hp:=genordinalconstnode(p^.left^.value-1,p^.left^.resulttype);
  557. disposetree(p);
  558. firstpass(hp);
  559. p:=hp;
  560. end;
  561. end;
  562. end;
  563. in_inc_x,
  564. in_dec_x:
  565. begin
  566. p^.resulttype:=voiddef;
  567. if assigned(p^.left) then
  568. begin
  569. firstcallparan(p^.left,nil,true);
  570. set_varstate(p^.left,true);
  571. if codegenerror then
  572. exit;
  573. { first param must be var }
  574. valid_for_assign(p^.left^.left,false);
  575. { check type }
  576. if (p^.left^.resulttype^.deftype in [enumdef,pointerdef]) or
  577. is_ordinal(p^.left^.resulttype) then
  578. begin
  579. { two paras ? }
  580. if assigned(p^.left^.right) then
  581. begin
  582. { insert a type conversion }
  583. { the second param is always longint }
  584. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,s32bitdef);
  585. { check the type conversion }
  586. firstpass(p^.left^.right^.left);
  587. { need we an additional register ? }
  588. if not(is_constintnode(p^.left^.right^.left)) and
  589. (p^.left^.right^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) and
  590. (p^.left^.right^.left^.registers32<=1) then
  591. inc(p^.registers32);
  592. { do we need an additional register to restore the first parameter? }
  593. if p^.left^.right^.left^.registers32>=p^.registers32 then
  594. inc(p^.registers32);
  595. if assigned(p^.left^.right^.right) then
  596. CGMessage(cg_e_illegal_expression);
  597. end;
  598. end
  599. else
  600. CGMessage(type_e_ordinal_expr_expected);
  601. end
  602. else
  603. CGMessage(type_e_mismatch);
  604. end;
  605. in_read_x,
  606. in_readln_x,
  607. in_write_x,
  608. in_writeln_x :
  609. begin
  610. { needs a call }
  611. procinfo^.flags:=procinfo^.flags or pi_do_call;
  612. p^.resulttype:=voiddef;
  613. { true, if readln needs an extra register }
  614. extra_register:=false;
  615. { we must know if it is a typed file or not }
  616. { but we must first do the firstpass for it }
  617. file_is_typed:=false;
  618. if assigned(p^.left) then
  619. begin
  620. dowrite:=(p^.inlinenumber in [in_write_x,in_writeln_x]);
  621. firstcallparan(p^.left,nil,true);
  622. set_varstate(p^.left,dowrite);
  623. { now we can check }
  624. hp:=p^.left;
  625. while assigned(hp^.right) do
  626. hp:=hp^.right;
  627. { if resulttype is not assigned, then automatically }
  628. { file is not typed. }
  629. if assigned(hp) and assigned(hp^.resulttype) then
  630. Begin
  631. if (hp^.resulttype^.deftype=filedef) and
  632. (pfiledef(hp^.resulttype)^.filetyp=ft_typed) then
  633. begin
  634. file_is_typed:=true;
  635. { test the type }
  636. hpp:=p^.left;
  637. while (hpp<>hp) do
  638. begin
  639. if (hpp^.left^.treetype=typen) then
  640. CGMessage(type_e_cant_read_write_type);
  641. if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typedfiletype.def) then
  642. CGMessage(type_e_mismatch);
  643. { generate the high() value for the shortstring }
  644. if ((not dowrite) and is_shortstring(hpp^.left^.resulttype)) or
  645. (is_chararray(hpp^.left^.resulttype)) then
  646. gen_high_tree(hpp,true);
  647. hpp:=hpp^.right;
  648. end;
  649. end;
  650. end; { endif assigned(hp) }
  651. { insert type conversions for write(ln) }
  652. if (not file_is_typed) then
  653. begin
  654. hp:=p^.left;
  655. while assigned(hp) do
  656. begin
  657. if (hp^.left^.treetype=typen) then
  658. CGMessage(type_e_cant_read_write_type);
  659. if assigned(hp^.left^.resulttype) then
  660. begin
  661. isreal:=false;
  662. { support writeln(procvar) }
  663. if (hp^.left^.resulttype^.deftype=procvardef) then
  664. begin
  665. p1:=gencallnode(nil,nil);
  666. p1^.right:=hp^.left;
  667. p1^.resulttype:=pprocvardef(hp^.left^.resulttype)^.rettype.def;
  668. firstpass(p1);
  669. hp^.left:=p1;
  670. end;
  671. case hp^.left^.resulttype^.deftype of
  672. filedef :
  673. begin
  674. { only allowed as first parameter }
  675. if assigned(hp^.right) then
  676. CGMessage(type_e_cant_read_write_type);
  677. end;
  678. stringdef :
  679. begin
  680. { generate the high() value for the shortstring }
  681. if (not dowrite) and
  682. is_shortstring(hp^.left^.resulttype) then
  683. gen_high_tree(hp,true);
  684. end;
  685. pointerdef :
  686. begin
  687. if not is_pchar(hp^.left^.resulttype) then
  688. CGMessage(type_e_cant_read_write_type);
  689. end;
  690. floatdef :
  691. begin
  692. isreal:=true;
  693. end;
  694. orddef :
  695. begin
  696. case porddef(hp^.left^.resulttype)^.typ of
  697. uchar,
  698. u32bit,s32bit,
  699. u64bit,s64bit:
  700. ;
  701. u8bit,s8bit,
  702. u16bit,s16bit :
  703. if dowrite then
  704. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  705. bool8bit,
  706. bool16bit,
  707. bool32bit :
  708. if dowrite then
  709. hp^.left:=gentypeconvnode(hp^.left,booldef)
  710. else
  711. CGMessage(type_e_cant_read_write_type);
  712. else
  713. CGMessage(type_e_cant_read_write_type);
  714. end;
  715. if not(dowrite) and
  716. not(is_64bitint(hp^.left^.resulttype)) then
  717. extra_register:=true;
  718. end;
  719. arraydef :
  720. begin
  721. if is_chararray(hp^.left^.resulttype) then
  722. gen_high_tree(hp,true)
  723. else
  724. CGMessage(type_e_cant_read_write_type);
  725. end;
  726. else
  727. CGMessage(type_e_cant_read_write_type);
  728. end;
  729. { some format options ? }
  730. if hp^.is_colon_para then
  731. begin
  732. if hp^.right^.is_colon_para then
  733. begin
  734. frac_para:=hp;
  735. length_para:=hp^.right;
  736. hp:=hp^.right;
  737. hpp:=hp^.right;
  738. end
  739. else
  740. begin
  741. length_para:=hp;
  742. frac_para:=nil;
  743. hpp:=hp^.right;
  744. end;
  745. { can be nil if you use "write(e:0:6)" while e is undeclared (JM) }
  746. if assigned(hpp^.left^.resulttype) then
  747. isreal:=(hpp^.left^.resulttype^.deftype=floatdef)
  748. else exit;
  749. if (not is_integer(length_para^.left^.resulttype)) then
  750. CGMessage1(type_e_integer_expr_expected,length_para^.left^.resulttype^.typename)
  751. else
  752. length_para^.left:=gentypeconvnode(length_para^.left,s32bitdef);
  753. if assigned(frac_para) then
  754. begin
  755. if isreal then
  756. begin
  757. if (not is_integer(frac_para^.left^.resulttype)) then
  758. CGMessage1(type_e_integer_expr_expected,frac_para^.left^.resulttype^.typename)
  759. else
  760. frac_para^.left:=gentypeconvnode(frac_para^.left,s32bitdef);
  761. end
  762. else
  763. CGMessage(parser_e_illegal_colon_qualifier);
  764. end;
  765. { do the checking for the colon'd arg }
  766. hp:=length_para;
  767. end;
  768. end;
  769. hp:=hp^.right;
  770. end;
  771. end;
  772. { pass all parameters again for the typeconversions }
  773. if codegenerror then
  774. exit;
  775. firstcallparan(p^.left,nil,true);
  776. set_varstate(p^.left,true);
  777. { calc registers }
  778. left_right_max(p);
  779. if extra_register then
  780. inc(p^.registers32);
  781. end;
  782. end;
  783. in_settextbuf_file_x :
  784. begin
  785. { warning here p^.left is the callparannode
  786. not the argument directly }
  787. { p^.left^.left is text var }
  788. { p^.left^.right^.left is the buffer var }
  789. { firstcallparan(p^.left,nil);
  790. already done in firstcalln }
  791. { now we know the type of buffer }
  792. getsymonlyin(systemunit,'SETTEXTBUF');
  793. hp:=gencallnode(pprocsym(srsym),systemunit);
  794. hp^.left:=gencallparanode(
  795. genordinalconstnode(p^.left^.left^.resulttype^.size,s32bitdef),p^.left);
  796. putnode(p);
  797. p:=hp;
  798. firstpass(p);
  799. end;
  800. { the firstpass of the arg has been done in firstcalln ? }
  801. in_reset_typedfile,
  802. in_rewrite_typedfile :
  803. begin
  804. procinfo^.flags:=procinfo^.flags or pi_do_call;
  805. firstpass(p^.left);
  806. set_varstate(p^.left,true);
  807. p^.resulttype:=voiddef;
  808. end;
  809. in_str_x_string :
  810. begin
  811. procinfo^.flags:=procinfo^.flags or pi_do_call;
  812. p^.resulttype:=voiddef;
  813. { check the amount of parameters }
  814. if not(assigned(p^.left)) or
  815. not(assigned(p^.left^.right)) then
  816. begin
  817. CGMessage(parser_e_wrong_parameter_size);
  818. exit;
  819. end;
  820. { first pass just the string for first local use }
  821. hp:=p^.left^.right;
  822. p^.left^.right:=nil;
  823. firstcallparan(p^.left,nil,true);
  824. set_varstate(p^.left,false);
  825. { remove warning when result is passed }
  826. set_funcret_is_valid(p^.left^.left);
  827. p^.left^.right:=hp;
  828. firstcallparan(p^.left^.right,nil,true);
  829. set_varstate(p^.left^.right,true);
  830. hp:=p^.left;
  831. { valid string ? }
  832. if not assigned(hp) or
  833. (hp^.left^.resulttype^.deftype<>stringdef) or
  834. (hp^.right=nil) then
  835. CGMessage(cg_e_illegal_expression);
  836. { we need a var parameter }
  837. valid_for_assign(hp^.left,false);
  838. { generate the high() value for the shortstring }
  839. if is_shortstring(hp^.left^.resulttype) then
  840. gen_high_tree(hp,true);
  841. { !!!! check length of string }
  842. while assigned(hp^.right) do
  843. hp:=hp^.right;
  844. { check and convert the first param }
  845. if hp^.is_colon_para then
  846. CGMessage(cg_e_illegal_expression);
  847. isreal:=false;
  848. case hp^.resulttype^.deftype of
  849. orddef :
  850. begin
  851. case porddef(hp^.left^.resulttype)^.typ of
  852. u32bit,s32bit,
  853. s64bit,u64bit:
  854. ;
  855. u8bit,s8bit,
  856. u16bit,s16bit:
  857. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  858. else
  859. CGMessage(type_e_integer_or_real_expr_expected);
  860. end;
  861. end;
  862. floatdef :
  863. begin
  864. isreal:=true;
  865. end;
  866. else
  867. CGMessage(type_e_integer_or_real_expr_expected);
  868. end;
  869. { some format options ? }
  870. hpp:=p^.left^.right;
  871. if assigned(hpp) and hpp^.is_colon_para then
  872. begin
  873. firstpass(hpp^.left);
  874. set_varstate(hpp^.left,true);
  875. if (not is_integer(hpp^.left^.resulttype)) then
  876. CGMessage1(type_e_integer_expr_expected,hpp^.left^.resulttype^.typename)
  877. else
  878. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  879. hpp:=hpp^.right;
  880. if assigned(hpp) and hpp^.is_colon_para then
  881. begin
  882. if isreal then
  883. begin
  884. if (not is_integer(hpp^.left^.resulttype)) then
  885. CGMessage1(type_e_integer_expr_expected,hpp^.left^.resulttype^.typename)
  886. else
  887. begin
  888. firstpass(hpp^.left);
  889. set_varstate(hpp^.left,true);
  890. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  891. end;
  892. end
  893. else
  894. CGMessage(parser_e_illegal_colon_qualifier);
  895. end;
  896. end;
  897. { pass all parameters again for the typeconversions }
  898. if codegenerror then
  899. exit;
  900. firstcallparan(p^.left,nil,true);
  901. { calc registers }
  902. left_right_max(p);
  903. end;
  904. in_val_x :
  905. begin
  906. procinfo^.flags:=procinfo^.flags or pi_do_call;
  907. p^.resulttype:=voiddef;
  908. { check the amount of parameters }
  909. if not(assigned(p^.left)) or
  910. not(assigned(p^.left^.right)) then
  911. begin
  912. CGMessage(parser_e_wrong_parameter_size);
  913. exit;
  914. end;
  915. If Assigned(p^.left^.right^.right) Then
  916. {there is a "code" parameter}
  917. Begin
  918. { first pass just the code parameter for first local use}
  919. hp := p^.left^.right;
  920. p^.left^.right := nil;
  921. make_not_regable(p^.left^.left);
  922. firstcallparan(p^.left, nil,true);
  923. set_varstate(p^.left,false);
  924. if codegenerror then exit;
  925. p^.left^.right := hp;
  926. {code has to be a var parameter}
  927. if valid_for_assign(p^.left^.left,false) then
  928. begin
  929. if (p^.left^.left^.resulttype^.deftype <> orddef) or
  930. not(porddef(p^.left^.left^.resulttype)^.typ in
  931. [u16bit,s16bit,u32bit,s32bit]) then
  932. CGMessage(type_e_mismatch);
  933. end;
  934. hpp := p^.left^.right
  935. End
  936. Else hpp := p^.left;
  937. {now hpp = the destination value tree}
  938. { first pass just the destination parameter for first local use}
  939. hp:=hpp^.right;
  940. hpp^.right:=nil;
  941. {hpp = destination}
  942. make_not_regable(hpp^.left);
  943. firstcallparan(hpp,nil,true);
  944. set_varstate(hpp,false);
  945. if codegenerror then
  946. exit;
  947. { remove warning when result is passed }
  948. set_funcret_is_valid(hpp^.left);
  949. hpp^.right := hp;
  950. if valid_for_assign(hpp^.left,false) then
  951. begin
  952. If Not((hpp^.left^.resulttype^.deftype = floatdef) or
  953. ((hpp^.left^.resulttype^.deftype = orddef) And
  954. (POrdDef(hpp^.left^.resulttype)^.typ in
  955. [u32bit,s32bit,
  956. u8bit,s8bit,u16bit,s16bit,s64bit,u64bit]))) Then
  957. CGMessage(type_e_mismatch);
  958. end;
  959. {hp = source (String)}
  960. { count_ref := false; WHY ?? }
  961. firstcallparan(hp,nil,true);
  962. set_varstate(hp,true);
  963. if codegenerror then
  964. exit;
  965. { if not a stringdef then insert a type conv which
  966. does the other type checking }
  967. If (hp^.left^.resulttype^.deftype<>stringdef) then
  968. begin
  969. hp^.left:=gentypeconvnode(hp^.left,cshortstringdef);
  970. firstpass(hp);
  971. end;
  972. { calc registers }
  973. left_right_max(p);
  974. { val doesn't calculate the registers really }
  975. { correct, we need one register extra (FK) }
  976. if is_64bitint(hpp^.left^.resulttype) then
  977. inc(p^.registers32,2)
  978. else
  979. inc(p^.registers32,1);
  980. end;
  981. in_include_x_y,
  982. in_exclude_x_y:
  983. begin
  984. p^.resulttype:=voiddef;
  985. if assigned(p^.left) then
  986. begin
  987. firstcallparan(p^.left,nil,true);
  988. set_varstate(p^.left,true);
  989. p^.registers32:=p^.left^.registers32;
  990. p^.registersfpu:=p^.left^.registersfpu;
  991. {$ifdef SUPPORT_MMX}
  992. p^.registersmmx:=p^.left^.registersmmx;
  993. {$endif SUPPORT_MMX}
  994. { remove warning when result is passed }
  995. set_funcret_is_valid(p^.left^.left);
  996. { first param must be var }
  997. valid_for_assign(p^.left^.left,false);
  998. { check type }
  999. if (p^.left^.resulttype^.deftype=setdef) then
  1000. begin
  1001. { two paras ? }
  1002. if assigned(p^.left^.right) then
  1003. begin
  1004. { insert a type conversion }
  1005. { to the type of the set elements }
  1006. p^.left^.right^.left:=gentypeconvnode(
  1007. p^.left^.right^.left,
  1008. psetdef(p^.left^.resulttype)^.elementtype.def);
  1009. { check the type conversion }
  1010. firstpass(p^.left^.right^.left);
  1011. { only three parameters are allowed }
  1012. if assigned(p^.left^.right^.right) then
  1013. CGMessage(cg_e_illegal_expression);
  1014. end;
  1015. end
  1016. else
  1017. CGMessage(type_e_mismatch);
  1018. end
  1019. else
  1020. CGMessage(type_e_mismatch);
  1021. end;
  1022. in_low_x,
  1023. in_high_x:
  1024. begin
  1025. set_varstate(p^.left,false);
  1026. if p^.left^.treetype in [typen,loadn,subscriptn] then
  1027. begin
  1028. case p^.left^.resulttype^.deftype of
  1029. orddef,enumdef:
  1030. begin
  1031. do_lowhigh(p^.left^.resulttype);
  1032. firstpass(p);
  1033. end;
  1034. setdef:
  1035. begin
  1036. do_lowhigh(Psetdef(p^.left^.resulttype)^.elementtype.def);
  1037. firstpass(p);
  1038. end;
  1039. arraydef:
  1040. begin
  1041. if p^.inlinenumber=in_low_x then
  1042. begin
  1043. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.lowrange,
  1044. Parraydef(p^.left^.resulttype)^.rangetype.def);
  1045. disposetree(p);
  1046. p:=hp;
  1047. firstpass(p);
  1048. end
  1049. else
  1050. begin
  1051. if is_open_array(p^.left^.resulttype) or
  1052. is_array_of_const(p^.left^.resulttype) then
  1053. begin
  1054. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1055. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1056. disposetree(p);
  1057. p:=hp;
  1058. firstpass(p);
  1059. end
  1060. else
  1061. begin
  1062. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.highrange,
  1063. Parraydef(p^.left^.resulttype)^.rangetype.def);
  1064. disposetree(p);
  1065. p:=hp;
  1066. firstpass(p);
  1067. end;
  1068. end;
  1069. end;
  1070. stringdef:
  1071. begin
  1072. if p^.inlinenumber=in_low_x then
  1073. begin
  1074. hp:=genordinalconstnode(0,u8bitdef);
  1075. disposetree(p);
  1076. p:=hp;
  1077. firstpass(p);
  1078. end
  1079. else
  1080. begin
  1081. if is_open_string(p^.left^.resulttype) then
  1082. begin
  1083. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1084. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1085. disposetree(p);
  1086. p:=hp;
  1087. firstpass(p);
  1088. end
  1089. else
  1090. begin
  1091. hp:=genordinalconstnode(Pstringdef(p^.left^.resulttype)^.len,u8bitdef);
  1092. disposetree(p);
  1093. p:=hp;
  1094. firstpass(p);
  1095. end;
  1096. end;
  1097. end;
  1098. else
  1099. CGMessage(type_e_mismatch);
  1100. end;
  1101. end
  1102. else
  1103. CGMessage(type_e_varid_or_typeid_expected);
  1104. end;
  1105. in_cos_extended:
  1106. begin
  1107. if p^.left^.treetype in [ordconstn,realconstn] then
  1108. setconstrealvalue(cos(getconstrealvalue))
  1109. else
  1110. handleextendedfunction;
  1111. end;
  1112. in_sin_extended:
  1113. begin
  1114. if p^.left^.treetype in [ordconstn,realconstn] then
  1115. setconstrealvalue(sin(getconstrealvalue))
  1116. else
  1117. handleextendedfunction;
  1118. end;
  1119. in_arctan_extended:
  1120. begin
  1121. if p^.left^.treetype in [ordconstn,realconstn] then
  1122. setconstrealvalue(arctan(getconstrealvalue))
  1123. else
  1124. handleextendedfunction;
  1125. end;
  1126. in_pi:
  1127. if block_type=bt_const then
  1128. setconstrealvalue(pi)
  1129. else
  1130. begin
  1131. p^.location.loc:=LOC_FPU;
  1132. p^.resulttype:=s80floatdef;
  1133. end;
  1134. in_abs_extended:
  1135. begin
  1136. if p^.left^.treetype in [ordconstn,realconstn] then
  1137. setconstrealvalue(abs(getconstrealvalue))
  1138. else
  1139. handleextendedfunction;
  1140. end;
  1141. in_sqr_extended:
  1142. begin
  1143. if p^.left^.treetype in [ordconstn,realconstn] then
  1144. setconstrealvalue(sqr(getconstrealvalue))
  1145. else
  1146. handleextendedfunction;
  1147. end;
  1148. in_sqrt_extended:
  1149. begin
  1150. if p^.left^.treetype in [ordconstn,realconstn] then
  1151. begin
  1152. vr:=getconstrealvalue;
  1153. if vr<0.0 then
  1154. begin
  1155. CGMessage(type_e_wrong_math_argument);
  1156. setconstrealvalue(0);
  1157. end
  1158. else
  1159. setconstrealvalue(sqrt(vr));
  1160. end
  1161. else
  1162. handleextendedfunction;
  1163. end;
  1164. in_ln_extended:
  1165. begin
  1166. if p^.left^.treetype in [ordconstn,realconstn] then
  1167. begin
  1168. vr:=getconstrealvalue;
  1169. if vr<=0.0 then
  1170. begin
  1171. CGMessage(type_e_wrong_math_argument);
  1172. setconstrealvalue(0);
  1173. end
  1174. else
  1175. setconstrealvalue(ln(vr));
  1176. end
  1177. else
  1178. handleextendedfunction;
  1179. end;
  1180. {$ifdef SUPPORT_MMX}
  1181. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1182. begin
  1183. end;
  1184. {$endif SUPPORT_MMX}
  1185. in_assert_x_y :
  1186. begin
  1187. p^.resulttype:=voiddef;
  1188. if assigned(p^.left) then
  1189. begin
  1190. firstcallparan(p^.left,nil,true);
  1191. set_varstate(p^.left,true);
  1192. p^.registers32:=p^.left^.registers32;
  1193. p^.registersfpu:=p^.left^.registersfpu;
  1194. {$ifdef SUPPORT_MMX}
  1195. p^.registersmmx:=p^.left^.registersmmx;
  1196. {$endif SUPPORT_MMX}
  1197. { check type }
  1198. if is_boolean(p^.left^.resulttype) then
  1199. begin
  1200. { must always be a string }
  1201. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,cshortstringdef);
  1202. firstpass(p^.left^.right^.left);
  1203. end
  1204. else
  1205. CGMessage(type_e_mismatch);
  1206. end
  1207. else
  1208. CGMessage(type_e_mismatch);
  1209. { We've checked the whole statement for correctness, now we
  1210. can remove it if assertions are off }
  1211. if not(cs_do_assertion in aktlocalswitches) then
  1212. begin
  1213. disposetree(p^.left);
  1214. putnode(p);
  1215. { we need a valid node, so insert a nothingn }
  1216. p:=genzeronode(nothingn);
  1217. end;
  1218. end;
  1219. else
  1220. internalerror(8);
  1221. end;
  1222. end;
  1223. { generate an error if no resulttype is set }
  1224. if not assigned(p^.resulttype) then
  1225. p^.resulttype:=generrordef;
  1226. dec(parsing_para_level);
  1227. end;
  1228. {$ifdef fpc}
  1229. {$maxfpuregisters default}
  1230. {$endif fpc}
  1231. end.
  1232. {
  1233. $Log$
  1234. Revision 1.68 2000-02-17 15:39:29 jonas
  1235. * fixed crashing bug when trying to write an undefined fp var with
  1236. formatting parameters
  1237. Revision 1.67 2000/02/17 14:53:43 florian
  1238. * some updates for the newcg
  1239. Revision 1.66 2000/02/13 14:21:51 jonas
  1240. * modifications to make the compiler functional when compiled with
  1241. -Or
  1242. Revision 1.65 2000/02/09 13:23:07 peter
  1243. * log truncated
  1244. Revision 1.64 2000/01/07 01:14:45 peter
  1245. * updated copyright to 2000
  1246. Revision 1.63 1999/12/30 15:02:10 peter
  1247. * fixed crash with undefined variable
  1248. Revision 1.62 1999/12/02 12:38:45 florian
  1249. + added support for succ/pred(<qword/int64>)
  1250. Revision 1.61 1999/11/30 10:40:58 peter
  1251. + ttype, tsymlist
  1252. Revision 1.60 1999/11/18 15:34:49 pierre
  1253. * Notes/Hints for local syms changed to
  1254. Set_varstate function
  1255. Revision 1.59 1999/11/17 17:05:07 pierre
  1256. * Notes/hints changes
  1257. Revision 1.58 1999/11/06 14:34:30 peter
  1258. * truncated log to 20 revs
  1259. Revision 1.57 1999/10/29 15:28:51 peter
  1260. * fixed assert, the tree is now disposed in firstpass if assertions
  1261. are off.
  1262. Revision 1.56 1999/10/26 12:30:46 peter
  1263. * const parameter is now checked
  1264. * better and generic check if a node can be used for assigning
  1265. * export fixes
  1266. * procvar equal works now (it never had worked at least from 0.99.8)
  1267. * defcoll changed to linkedlist with pparaitem so it can easily be
  1268. walked both directions
  1269. Revision 1.55 1999/10/22 14:37:31 peter
  1270. * error when properties are passed to var parameters
  1271. Revision 1.54 1999/10/21 16:41:41 florian
  1272. * problems with readln fixed: esi wasn't restored correctly when
  1273. reading ordinal fields of objects futher the register allocation
  1274. didn't take care of the extra register when reading ordinal values
  1275. * enumerations can now be used in constant indexes of properties
  1276. Revision 1.53 1999/09/28 20:48:27 florian
  1277. * fixed bug 610
  1278. + added $D- for TP in symtable.pas else it can't be compiled anymore
  1279. (too much symbols :()
  1280. Revision 1.52 1999/09/27 23:45:01 peter
  1281. * procinfo is now a pointer
  1282. * support for result setting in sub procedure
  1283. Revision 1.51 1999/09/15 20:35:46 florian
  1284. * small fix to operator overloading when in MMX mode
  1285. + the compiler uses now fldz and fld1 if possible
  1286. + some fixes to floating point registers
  1287. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1288. * .... ???
  1289. Revision 1.50 1999/09/07 14:05:11 pierre
  1290. * halt removed in do_lowhigh
  1291. Revision 1.49 1999/08/28 15:34:21 florian
  1292. * bug 519 fixed
  1293. Revision 1.48 1999/08/23 23:41:04 pierre
  1294. * in_inc_x register allocation corrected
  1295. Revision 1.47 1999/08/06 12:43:13 jonas
  1296. * fix for regvars with the val code
  1297. Revision 1.46 1999/08/05 16:53:23 peter
  1298. * V_Fatal=1, all other V_ are also increased
  1299. * Check for local procedure when assigning procvar
  1300. * fixed comment parsing because directives
  1301. * oldtp mode directives better supported
  1302. * added some messages to errore.msg
  1303. Revision 1.45 1999/08/04 00:23:40 florian
  1304. * renamed i386asm and i386base to cpuasm and cpubase
  1305. }