tcinl.pas 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  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. { otherwise you get a crash if you try ord on an expression containing }
  428. { an undeclared variable (JM) }
  429. if not assigned(p^.left^.resulttype) then
  430. exit;
  431. if (p^.left^.resulttype^.deftype=orddef) then
  432. if (porddef(p^.left^.resulttype)^.typ in [uchar,bool8bit]) then
  433. begin
  434. if porddef(p^.left^.resulttype)^.typ=bool8bit then
  435. begin
  436. hp:=gentypeconvnode(p^.left,u8bitdef);
  437. putnode(p);
  438. p:=hp;
  439. p^.convtyp:=tc_bool_2_int;
  440. p^.explizit:=true;
  441. firstpass(p);
  442. end
  443. else
  444. begin
  445. hp:=gentypeconvnode(p^.left,u8bitdef);
  446. putnode(p);
  447. p:=hp;
  448. p^.explizit:=true;
  449. firstpass(p);
  450. end;
  451. end
  452. { can this happen ? }
  453. else if (porddef(p^.left^.resulttype)^.typ=uvoid) then
  454. CGMessage(type_e_mismatch)
  455. else
  456. { all other orddef need no transformation }
  457. begin
  458. hp:=p^.left;
  459. putnode(p);
  460. p:=hp;
  461. end
  462. else if (p^.left^.resulttype^.deftype=enumdef) then
  463. begin
  464. hp:=gentypeconvnode(p^.left,s32bitdef);
  465. putnode(p);
  466. p:=hp;
  467. p^.explizit:=true;
  468. firstpass(p);
  469. end
  470. else
  471. begin
  472. { can anything else be ord() ?}
  473. CGMessage(type_e_mismatch);
  474. end;
  475. end;
  476. end;
  477. in_chr_byte:
  478. begin
  479. set_varstate(p^.left,true);
  480. hp:=gentypeconvnode(p^.left,cchardef);
  481. putnode(p);
  482. p:=hp;
  483. p^.explizit:=true;
  484. firstpass(p);
  485. end;
  486. in_length_string:
  487. begin
  488. set_varstate(p^.left,true);
  489. if is_ansistring(p^.left^.resulttype) then
  490. p^.resulttype:=s32bitdef
  491. else
  492. p^.resulttype:=u8bitdef;
  493. { we don't need string conversations here }
  494. if (p^.left^.treetype=typeconvn) and
  495. (p^.left^.left^.resulttype^.deftype=stringdef) then
  496. begin
  497. hp:=p^.left^.left;
  498. putnode(p^.left);
  499. p^.left:=hp;
  500. end;
  501. { check the type, must be string or char }
  502. if (p^.left^.resulttype^.deftype<>stringdef) and
  503. (not is_char(p^.left^.resulttype)) then
  504. CGMessage(type_e_mismatch);
  505. { evaluates length of constant strings direct }
  506. if (p^.left^.treetype=stringconstn) then
  507. begin
  508. hp:=genordinalconstnode(p^.left^.length,s32bitdef);
  509. disposetree(p);
  510. firstpass(hp);
  511. p:=hp;
  512. end
  513. { length of char is one allways }
  514. else if is_constcharnode(p^.left) then
  515. begin
  516. hp:=genordinalconstnode(1,s32bitdef);
  517. disposetree(p);
  518. firstpass(hp);
  519. p:=hp;
  520. end;
  521. end;
  522. in_assigned_x:
  523. begin
  524. set_varstate(p^.left,true);
  525. p^.resulttype:=booldef;
  526. p^.location.loc:=LOC_FLAGS;
  527. end;
  528. in_ofs_x,
  529. in_seg_x :
  530. set_varstate(p^.left,false);
  531. in_pred_x,
  532. in_succ_x:
  533. begin
  534. p^.resulttype:=p^.left^.resulttype;
  535. if is_64bitint(p^.resulttype) then
  536. begin
  537. if (p^.registers32<2) then
  538. p^.registers32:=2
  539. end
  540. else
  541. begin
  542. if (p^.registers32<1) then
  543. p^.registers32:=1;
  544. end;
  545. p^.location.loc:=LOC_REGISTER;
  546. set_varstate(p^.left,true);
  547. if not is_ordinal(p^.resulttype) then
  548. CGMessage(type_e_ordinal_expr_expected)
  549. else
  550. begin
  551. if (p^.resulttype^.deftype=enumdef) and
  552. (penumdef(p^.resulttype)^.has_jumps) then
  553. CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible)
  554. else
  555. if p^.left^.treetype=ordconstn then
  556. begin
  557. if p^.inlinenumber=in_succ_x then
  558. hp:=genordinalconstnode(p^.left^.value+1,p^.left^.resulttype)
  559. else
  560. hp:=genordinalconstnode(p^.left^.value-1,p^.left^.resulttype);
  561. disposetree(p);
  562. firstpass(hp);
  563. p:=hp;
  564. end;
  565. end;
  566. end;
  567. in_inc_x,
  568. in_dec_x:
  569. begin
  570. p^.resulttype:=voiddef;
  571. if assigned(p^.left) then
  572. begin
  573. firstcallparan(p^.left,nil,true);
  574. set_varstate(p^.left,true);
  575. if codegenerror then
  576. exit;
  577. { first param must be var }
  578. valid_for_assign(p^.left^.left,false);
  579. { check type }
  580. if (p^.left^.resulttype^.deftype in [enumdef,pointerdef]) or
  581. is_ordinal(p^.left^.resulttype) then
  582. begin
  583. { two paras ? }
  584. if assigned(p^.left^.right) then
  585. begin
  586. { insert a type conversion }
  587. { the second param is always longint }
  588. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,s32bitdef);
  589. { check the type conversion }
  590. firstpass(p^.left^.right^.left);
  591. { need we an additional register ? }
  592. if not(is_constintnode(p^.left^.right^.left)) and
  593. (p^.left^.right^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) and
  594. (p^.left^.right^.left^.registers32<=1) then
  595. inc(p^.registers32);
  596. { do we need an additional register to restore the first parameter? }
  597. if p^.left^.right^.left^.registers32>=p^.registers32 then
  598. inc(p^.registers32);
  599. if assigned(p^.left^.right^.right) then
  600. CGMessage(cg_e_illegal_expression);
  601. end;
  602. end
  603. else
  604. CGMessage(type_e_ordinal_expr_expected);
  605. end
  606. else
  607. CGMessage(type_e_mismatch);
  608. end;
  609. in_read_x,
  610. in_readln_x,
  611. in_write_x,
  612. in_writeln_x :
  613. begin
  614. { needs a call }
  615. procinfo^.flags:=procinfo^.flags or pi_do_call;
  616. p^.resulttype:=voiddef;
  617. { true, if readln needs an extra register }
  618. extra_register:=false;
  619. { we must know if it is a typed file or not }
  620. { but we must first do the firstpass for it }
  621. file_is_typed:=false;
  622. if assigned(p^.left) then
  623. begin
  624. dowrite:=(p^.inlinenumber in [in_write_x,in_writeln_x]);
  625. firstcallparan(p^.left,nil,true);
  626. set_varstate(p^.left,dowrite);
  627. { now we can check }
  628. hp:=p^.left;
  629. while assigned(hp^.right) do
  630. hp:=hp^.right;
  631. { if resulttype is not assigned, then automatically }
  632. { file is not typed. }
  633. if assigned(hp) and assigned(hp^.resulttype) then
  634. Begin
  635. if (hp^.resulttype^.deftype=filedef) and
  636. (pfiledef(hp^.resulttype)^.filetyp=ft_typed) then
  637. begin
  638. file_is_typed:=true;
  639. { test the type }
  640. hpp:=p^.left;
  641. while (hpp<>hp) do
  642. begin
  643. if (hpp^.left^.treetype=typen) then
  644. CGMessage(type_e_cant_read_write_type);
  645. if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typedfiletype.def) then
  646. CGMessage(type_e_mismatch);
  647. { generate the high() value for the shortstring }
  648. if ((not dowrite) and is_shortstring(hpp^.left^.resulttype)) or
  649. (is_chararray(hpp^.left^.resulttype)) then
  650. gen_high_tree(hpp,true);
  651. { read(ln) is call by reference (JM) }
  652. if not dowrite then
  653. make_not_regable(hpp^.left);
  654. hpp:=hpp^.right;
  655. end;
  656. end;
  657. end; { endif assigned(hp) }
  658. { insert type conversions for write(ln) }
  659. if (not file_is_typed) then
  660. begin
  661. hp:=p^.left;
  662. while assigned(hp) do
  663. begin
  664. if (hp^.left^.treetype=typen) then
  665. CGMessage(type_e_cant_read_write_type);
  666. if assigned(hp^.left^.resulttype) then
  667. begin
  668. isreal:=false;
  669. { support writeln(procvar) }
  670. if (hp^.left^.resulttype^.deftype=procvardef) then
  671. begin
  672. p1:=gencallnode(nil,nil);
  673. p1^.right:=hp^.left;
  674. p1^.resulttype:=pprocvardef(hp^.left^.resulttype)^.rettype.def;
  675. firstpass(p1);
  676. hp^.left:=p1;
  677. end;
  678. case hp^.left^.resulttype^.deftype of
  679. filedef :
  680. begin
  681. { only allowed as first parameter }
  682. if assigned(hp^.right) then
  683. CGMessage(type_e_cant_read_write_type);
  684. end;
  685. stringdef :
  686. begin
  687. { generate the high() value for the shortstring }
  688. if (not dowrite) and
  689. is_shortstring(hp^.left^.resulttype) then
  690. gen_high_tree(hp,true);
  691. end;
  692. pointerdef :
  693. begin
  694. if not is_pchar(hp^.left^.resulttype) then
  695. CGMessage(type_e_cant_read_write_type);
  696. end;
  697. floatdef :
  698. begin
  699. isreal:=true;
  700. end;
  701. orddef :
  702. begin
  703. case porddef(hp^.left^.resulttype)^.typ of
  704. uchar,
  705. u32bit,s32bit,
  706. u64bit,s64bit:
  707. ;
  708. u8bit,s8bit,
  709. u16bit,s16bit :
  710. if dowrite then
  711. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  712. bool8bit,
  713. bool16bit,
  714. bool32bit :
  715. if dowrite then
  716. hp^.left:=gentypeconvnode(hp^.left,booldef)
  717. else
  718. CGMessage(type_e_cant_read_write_type);
  719. else
  720. CGMessage(type_e_cant_read_write_type);
  721. end;
  722. if not(dowrite) and
  723. not(is_64bitint(hp^.left^.resulttype)) then
  724. extra_register:=true;
  725. end;
  726. arraydef :
  727. begin
  728. if is_chararray(hp^.left^.resulttype) then
  729. gen_high_tree(hp,true)
  730. else
  731. CGMessage(type_e_cant_read_write_type);
  732. end;
  733. else
  734. CGMessage(type_e_cant_read_write_type);
  735. end;
  736. { some format options ? }
  737. if hp^.is_colon_para then
  738. begin
  739. if hp^.right^.is_colon_para then
  740. begin
  741. frac_para:=hp;
  742. length_para:=hp^.right;
  743. hp:=hp^.right;
  744. hpp:=hp^.right;
  745. end
  746. else
  747. begin
  748. length_para:=hp;
  749. frac_para:=nil;
  750. hpp:=hp^.right;
  751. end;
  752. { can be nil if you use "write(e:0:6)" while e is undeclared (JM) }
  753. if assigned(hpp^.left^.resulttype) then
  754. isreal:=(hpp^.left^.resulttype^.deftype=floatdef)
  755. else exit;
  756. if (not is_integer(length_para^.left^.resulttype)) then
  757. CGMessage1(type_e_integer_expr_expected,length_para^.left^.resulttype^.typename)
  758. else
  759. length_para^.left:=gentypeconvnode(length_para^.left,s32bitdef);
  760. if assigned(frac_para) then
  761. begin
  762. if isreal then
  763. begin
  764. if (not is_integer(frac_para^.left^.resulttype)) then
  765. CGMessage1(type_e_integer_expr_expected,frac_para^.left^.resulttype^.typename)
  766. else
  767. frac_para^.left:=gentypeconvnode(frac_para^.left,s32bitdef);
  768. end
  769. else
  770. CGMessage(parser_e_illegal_colon_qualifier);
  771. end;
  772. { do the checking for the colon'd arg }
  773. hp:=length_para;
  774. end;
  775. end;
  776. hp:=hp^.right;
  777. end;
  778. end;
  779. { pass all parameters again for the typeconversions }
  780. if codegenerror then
  781. exit;
  782. firstcallparan(p^.left,nil,true);
  783. set_varstate(p^.left,true);
  784. { calc registers }
  785. left_right_max(p);
  786. if extra_register then
  787. inc(p^.registers32);
  788. end;
  789. end;
  790. in_settextbuf_file_x :
  791. begin
  792. { warning here p^.left is the callparannode
  793. not the argument directly }
  794. { p^.left^.left is text var }
  795. { p^.left^.right^.left is the buffer var }
  796. { firstcallparan(p^.left,nil);
  797. already done in firstcalln }
  798. { now we know the type of buffer }
  799. getsymonlyin(systemunit,'SETTEXTBUF');
  800. hp:=gencallnode(pprocsym(srsym),systemunit);
  801. hp^.left:=gencallparanode(
  802. genordinalconstnode(p^.left^.left^.resulttype^.size,s32bitdef),p^.left);
  803. putnode(p);
  804. p:=hp;
  805. firstpass(p);
  806. end;
  807. { the firstpass of the arg has been done in firstcalln ? }
  808. in_reset_typedfile,
  809. in_rewrite_typedfile :
  810. begin
  811. procinfo^.flags:=procinfo^.flags or pi_do_call;
  812. firstpass(p^.left);
  813. set_varstate(p^.left,true);
  814. p^.resulttype:=voiddef;
  815. end;
  816. in_str_x_string :
  817. begin
  818. procinfo^.flags:=procinfo^.flags or pi_do_call;
  819. p^.resulttype:=voiddef;
  820. { check the amount of parameters }
  821. if not(assigned(p^.left)) or
  822. not(assigned(p^.left^.right)) then
  823. begin
  824. CGMessage(parser_e_wrong_parameter_size);
  825. exit;
  826. end;
  827. { first pass just the string for first local use }
  828. hp:=p^.left^.right;
  829. p^.left^.right:=nil;
  830. firstcallparan(p^.left,nil,true);
  831. set_varstate(p^.left,false);
  832. { remove warning when result is passed }
  833. set_funcret_is_valid(p^.left^.left);
  834. p^.left^.right:=hp;
  835. firstcallparan(p^.left^.right,nil,true);
  836. set_varstate(p^.left^.right,true);
  837. hp:=p^.left;
  838. { valid string ? }
  839. if not assigned(hp) or
  840. (hp^.left^.resulttype^.deftype<>stringdef) or
  841. (hp^.right=nil) then
  842. CGMessage(cg_e_illegal_expression);
  843. { we need a var parameter }
  844. valid_for_assign(hp^.left,false);
  845. { generate the high() value for the shortstring }
  846. if is_shortstring(hp^.left^.resulttype) then
  847. gen_high_tree(hp,true);
  848. { !!!! check length of string }
  849. while assigned(hp^.right) do
  850. hp:=hp^.right;
  851. { check and convert the first param }
  852. if hp^.is_colon_para then
  853. CGMessage(cg_e_illegal_expression);
  854. isreal:=false;
  855. case hp^.resulttype^.deftype of
  856. orddef :
  857. begin
  858. case porddef(hp^.left^.resulttype)^.typ of
  859. u32bit,s32bit,
  860. s64bit,u64bit:
  861. ;
  862. u8bit,s8bit,
  863. u16bit,s16bit:
  864. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  865. else
  866. CGMessage(type_e_integer_or_real_expr_expected);
  867. end;
  868. end;
  869. floatdef :
  870. begin
  871. isreal:=true;
  872. end;
  873. else
  874. CGMessage(type_e_integer_or_real_expr_expected);
  875. end;
  876. { some format options ? }
  877. hpp:=p^.left^.right;
  878. if assigned(hpp) and hpp^.is_colon_para then
  879. begin
  880. firstpass(hpp^.left);
  881. set_varstate(hpp^.left,true);
  882. if (not is_integer(hpp^.left^.resulttype)) then
  883. CGMessage1(type_e_integer_expr_expected,hpp^.left^.resulttype^.typename)
  884. else
  885. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  886. hpp:=hpp^.right;
  887. if assigned(hpp) and hpp^.is_colon_para then
  888. begin
  889. if isreal then
  890. begin
  891. if (not is_integer(hpp^.left^.resulttype)) then
  892. CGMessage1(type_e_integer_expr_expected,hpp^.left^.resulttype^.typename)
  893. else
  894. begin
  895. firstpass(hpp^.left);
  896. set_varstate(hpp^.left,true);
  897. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  898. end;
  899. end
  900. else
  901. CGMessage(parser_e_illegal_colon_qualifier);
  902. end;
  903. end;
  904. { pass all parameters again for the typeconversions }
  905. if codegenerror then
  906. exit;
  907. firstcallparan(p^.left,nil,true);
  908. { calc registers }
  909. left_right_max(p);
  910. end;
  911. in_val_x :
  912. begin
  913. procinfo^.flags:=procinfo^.flags or pi_do_call;
  914. p^.resulttype:=voiddef;
  915. { check the amount of parameters }
  916. if not(assigned(p^.left)) or
  917. not(assigned(p^.left^.right)) then
  918. begin
  919. CGMessage(parser_e_wrong_parameter_size);
  920. exit;
  921. end;
  922. If Assigned(p^.left^.right^.right) Then
  923. {there is a "code" parameter}
  924. Begin
  925. { first pass just the code parameter for first local use}
  926. hp := p^.left^.right;
  927. p^.left^.right := nil;
  928. make_not_regable(p^.left^.left);
  929. firstcallparan(p^.left, nil,true);
  930. set_varstate(p^.left,false);
  931. if codegenerror then exit;
  932. p^.left^.right := hp;
  933. {code has to be a var parameter}
  934. if valid_for_assign(p^.left^.left,false) then
  935. begin
  936. if (p^.left^.left^.resulttype^.deftype <> orddef) or
  937. not(porddef(p^.left^.left^.resulttype)^.typ in
  938. [u16bit,s16bit,u32bit,s32bit]) then
  939. CGMessage(type_e_mismatch);
  940. end;
  941. hpp := p^.left^.right
  942. End
  943. Else hpp := p^.left;
  944. {now hpp = the destination value tree}
  945. { first pass just the destination parameter for first local use}
  946. hp:=hpp^.right;
  947. hpp^.right:=nil;
  948. {hpp = destination}
  949. make_not_regable(hpp^.left);
  950. firstcallparan(hpp,nil,true);
  951. set_varstate(hpp,false);
  952. if codegenerror then
  953. exit;
  954. { remove warning when result is passed }
  955. set_funcret_is_valid(hpp^.left);
  956. hpp^.right := hp;
  957. if valid_for_assign(hpp^.left,false) then
  958. begin
  959. If Not((hpp^.left^.resulttype^.deftype = floatdef) or
  960. ((hpp^.left^.resulttype^.deftype = orddef) And
  961. (POrdDef(hpp^.left^.resulttype)^.typ in
  962. [u32bit,s32bit,
  963. u8bit,s8bit,u16bit,s16bit,s64bit,u64bit]))) Then
  964. CGMessage(type_e_mismatch);
  965. end;
  966. {hp = source (String)}
  967. { count_ref := false; WHY ?? }
  968. firstcallparan(hp,nil,true);
  969. set_varstate(hp,true);
  970. if codegenerror then
  971. exit;
  972. { if not a stringdef then insert a type conv which
  973. does the other type checking }
  974. If (hp^.left^.resulttype^.deftype<>stringdef) then
  975. begin
  976. hp^.left:=gentypeconvnode(hp^.left,cshortstringdef);
  977. firstpass(hp);
  978. end;
  979. { calc registers }
  980. left_right_max(p);
  981. { val doesn't calculate the registers really }
  982. { correct, we need one register extra (FK) }
  983. if is_64bitint(hpp^.left^.resulttype) then
  984. inc(p^.registers32,2)
  985. else
  986. inc(p^.registers32,1);
  987. end;
  988. in_include_x_y,
  989. in_exclude_x_y:
  990. begin
  991. p^.resulttype:=voiddef;
  992. if assigned(p^.left) then
  993. begin
  994. firstcallparan(p^.left,nil,true);
  995. set_varstate(p^.left,true);
  996. p^.registers32:=p^.left^.registers32;
  997. p^.registersfpu:=p^.left^.registersfpu;
  998. {$ifdef SUPPORT_MMX}
  999. p^.registersmmx:=p^.left^.registersmmx;
  1000. {$endif SUPPORT_MMX}
  1001. { remove warning when result is passed }
  1002. set_funcret_is_valid(p^.left^.left);
  1003. { first param must be var }
  1004. valid_for_assign(p^.left^.left,false);
  1005. { check type }
  1006. if (p^.left^.resulttype^.deftype=setdef) then
  1007. begin
  1008. { two paras ? }
  1009. if assigned(p^.left^.right) then
  1010. begin
  1011. { insert a type conversion }
  1012. { to the type of the set elements }
  1013. p^.left^.right^.left:=gentypeconvnode(
  1014. p^.left^.right^.left,
  1015. psetdef(p^.left^.resulttype)^.elementtype.def);
  1016. { check the type conversion }
  1017. firstpass(p^.left^.right^.left);
  1018. { only three parameters are allowed }
  1019. if assigned(p^.left^.right^.right) then
  1020. CGMessage(cg_e_illegal_expression);
  1021. end;
  1022. end
  1023. else
  1024. CGMessage(type_e_mismatch);
  1025. end
  1026. else
  1027. CGMessage(type_e_mismatch);
  1028. end;
  1029. in_low_x,
  1030. in_high_x:
  1031. begin
  1032. set_varstate(p^.left,false);
  1033. { this fixes tests\webtbs\tbug879.pp (FK)
  1034. if p^.left^.treetype in [typen,loadn,subscriptn] then
  1035. begin
  1036. }
  1037. case p^.left^.resulttype^.deftype of
  1038. orddef,enumdef:
  1039. begin
  1040. do_lowhigh(p^.left^.resulttype);
  1041. firstpass(p);
  1042. end;
  1043. setdef:
  1044. begin
  1045. do_lowhigh(Psetdef(p^.left^.resulttype)^.elementtype.def);
  1046. firstpass(p);
  1047. end;
  1048. arraydef:
  1049. begin
  1050. if p^.inlinenumber=in_low_x then
  1051. begin
  1052. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.lowrange,
  1053. Parraydef(p^.left^.resulttype)^.rangetype.def);
  1054. disposetree(p);
  1055. p:=hp;
  1056. firstpass(p);
  1057. end
  1058. else
  1059. begin
  1060. if is_open_array(p^.left^.resulttype) or
  1061. is_array_of_const(p^.left^.resulttype) then
  1062. begin
  1063. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1064. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1065. disposetree(p);
  1066. p:=hp;
  1067. firstpass(p);
  1068. end
  1069. else
  1070. begin
  1071. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.highrange,
  1072. Parraydef(p^.left^.resulttype)^.rangetype.def);
  1073. disposetree(p);
  1074. p:=hp;
  1075. firstpass(p);
  1076. end;
  1077. end;
  1078. end;
  1079. stringdef:
  1080. begin
  1081. if p^.inlinenumber=in_low_x then
  1082. begin
  1083. hp:=genordinalconstnode(0,u8bitdef);
  1084. disposetree(p);
  1085. p:=hp;
  1086. firstpass(p);
  1087. end
  1088. else
  1089. begin
  1090. if is_open_string(p^.left^.resulttype) then
  1091. begin
  1092. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1093. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1094. disposetree(p);
  1095. p:=hp;
  1096. firstpass(p);
  1097. end
  1098. else
  1099. begin
  1100. hp:=genordinalconstnode(Pstringdef(p^.left^.resulttype)^.len,u8bitdef);
  1101. disposetree(p);
  1102. p:=hp;
  1103. firstpass(p);
  1104. end;
  1105. end;
  1106. end;
  1107. else
  1108. CGMessage(type_e_mismatch);
  1109. end;
  1110. {
  1111. end
  1112. else
  1113. CGMessage(type_e_varid_or_typeid_expected);
  1114. }
  1115. end;
  1116. in_cos_extended:
  1117. begin
  1118. if p^.left^.treetype in [ordconstn,realconstn] then
  1119. setconstrealvalue(cos(getconstrealvalue))
  1120. else
  1121. handleextendedfunction;
  1122. end;
  1123. in_sin_extended:
  1124. begin
  1125. if p^.left^.treetype in [ordconstn,realconstn] then
  1126. setconstrealvalue(sin(getconstrealvalue))
  1127. else
  1128. handleextendedfunction;
  1129. end;
  1130. in_arctan_extended:
  1131. begin
  1132. if p^.left^.treetype in [ordconstn,realconstn] then
  1133. setconstrealvalue(arctan(getconstrealvalue))
  1134. else
  1135. handleextendedfunction;
  1136. end;
  1137. in_pi:
  1138. if block_type=bt_const then
  1139. setconstrealvalue(pi)
  1140. else
  1141. begin
  1142. p^.location.loc:=LOC_FPU;
  1143. p^.resulttype:=s80floatdef;
  1144. end;
  1145. in_abs_extended:
  1146. begin
  1147. if p^.left^.treetype in [ordconstn,realconstn] then
  1148. setconstrealvalue(abs(getconstrealvalue))
  1149. else
  1150. handleextendedfunction;
  1151. end;
  1152. in_sqr_extended:
  1153. begin
  1154. if p^.left^.treetype in [ordconstn,realconstn] then
  1155. setconstrealvalue(sqr(getconstrealvalue))
  1156. else
  1157. handleextendedfunction;
  1158. end;
  1159. in_sqrt_extended:
  1160. begin
  1161. if p^.left^.treetype in [ordconstn,realconstn] then
  1162. begin
  1163. vr:=getconstrealvalue;
  1164. if vr<0.0 then
  1165. begin
  1166. CGMessage(type_e_wrong_math_argument);
  1167. setconstrealvalue(0);
  1168. end
  1169. else
  1170. setconstrealvalue(sqrt(vr));
  1171. end
  1172. else
  1173. handleextendedfunction;
  1174. end;
  1175. in_ln_extended:
  1176. begin
  1177. if p^.left^.treetype in [ordconstn,realconstn] then
  1178. begin
  1179. vr:=getconstrealvalue;
  1180. if vr<=0.0 then
  1181. begin
  1182. CGMessage(type_e_wrong_math_argument);
  1183. setconstrealvalue(0);
  1184. end
  1185. else
  1186. setconstrealvalue(ln(vr));
  1187. end
  1188. else
  1189. handleextendedfunction;
  1190. end;
  1191. {$ifdef SUPPORT_MMX}
  1192. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1193. begin
  1194. end;
  1195. {$endif SUPPORT_MMX}
  1196. in_assert_x_y :
  1197. begin
  1198. p^.resulttype:=voiddef;
  1199. if assigned(p^.left) then
  1200. begin
  1201. firstcallparan(p^.left,nil,true);
  1202. set_varstate(p^.left,true);
  1203. p^.registers32:=p^.left^.registers32;
  1204. p^.registersfpu:=p^.left^.registersfpu;
  1205. {$ifdef SUPPORT_MMX}
  1206. p^.registersmmx:=p^.left^.registersmmx;
  1207. {$endif SUPPORT_MMX}
  1208. { check type }
  1209. if is_boolean(p^.left^.resulttype) then
  1210. begin
  1211. { must always be a string }
  1212. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,cshortstringdef);
  1213. firstpass(p^.left^.right^.left);
  1214. end
  1215. else
  1216. CGMessage(type_e_mismatch);
  1217. end
  1218. else
  1219. CGMessage(type_e_mismatch);
  1220. { We've checked the whole statement for correctness, now we
  1221. can remove it if assertions are off }
  1222. if not(cs_do_assertion in aktlocalswitches) then
  1223. begin
  1224. disposetree(p^.left);
  1225. putnode(p);
  1226. { we need a valid node, so insert a nothingn }
  1227. p:=genzeronode(nothingn);
  1228. end;
  1229. end;
  1230. else
  1231. internalerror(8);
  1232. end;
  1233. end;
  1234. { generate an error if no resulttype is set }
  1235. if not assigned(p^.resulttype) then
  1236. p^.resulttype:=generrordef;
  1237. dec(parsing_para_level);
  1238. end;
  1239. {$ifdef fpc}
  1240. {$maxfpuregisters default}
  1241. {$endif fpc}
  1242. end.
  1243. {
  1244. $Log$
  1245. Revision 1.71 2000-03-22 17:34:53 jonas
  1246. * fix for webbug 886
  1247. Revision 1.70 2000/03/21 09:12:40 florian
  1248. * fixed bug 879: high and low take now any kind of expression
  1249. Revision 1.69 2000/02/18 13:52:38 jonas
  1250. * fixed crash when using undeclared variable in ord construct
  1251. Revision 1.68 2000/02/17 15:39:29 jonas
  1252. * fixed crashing bug when trying to write an undefined fp var with
  1253. formatting parameters
  1254. Revision 1.67 2000/02/17 14:53:43 florian
  1255. * some updates for the newcg
  1256. Revision 1.66 2000/02/13 14:21:51 jonas
  1257. * modifications to make the compiler functional when compiled with
  1258. -Or
  1259. Revision 1.65 2000/02/09 13:23:07 peter
  1260. * log truncated
  1261. Revision 1.64 2000/01/07 01:14:45 peter
  1262. * updated copyright to 2000
  1263. Revision 1.63 1999/12/30 15:02:10 peter
  1264. * fixed crash with undefined variable
  1265. Revision 1.62 1999/12/02 12:38:45 florian
  1266. + added support for succ/pred(<qword/int64>)
  1267. Revision 1.61 1999/11/30 10:40:58 peter
  1268. + ttype, tsymlist
  1269. Revision 1.60 1999/11/18 15:34:49 pierre
  1270. * Notes/Hints for local syms changed to
  1271. Set_varstate function
  1272. Revision 1.59 1999/11/17 17:05:07 pierre
  1273. * Notes/hints changes
  1274. Revision 1.58 1999/11/06 14:34:30 peter
  1275. * truncated log to 20 revs
  1276. Revision 1.57 1999/10/29 15:28:51 peter
  1277. * fixed assert, the tree is now disposed in firstpass if assertions
  1278. are off.
  1279. Revision 1.56 1999/10/26 12:30:46 peter
  1280. * const parameter is now checked
  1281. * better and generic check if a node can be used for assigning
  1282. * export fixes
  1283. * procvar equal works now (it never had worked at least from 0.99.8)
  1284. * defcoll changed to linkedlist with pparaitem so it can easily be
  1285. walked both directions
  1286. Revision 1.55 1999/10/22 14:37:31 peter
  1287. * error when properties are passed to var parameters
  1288. Revision 1.54 1999/10/21 16:41:41 florian
  1289. * problems with readln fixed: esi wasn't restored correctly when
  1290. reading ordinal fields of objects futher the register allocation
  1291. didn't take care of the extra register when reading ordinal values
  1292. * enumerations can now be used in constant indexes of properties
  1293. Revision 1.53 1999/09/28 20:48:27 florian
  1294. * fixed bug 610
  1295. + added $D- for TP in symtable.pas else it can't be compiled anymore
  1296. (too much symbols :()
  1297. Revision 1.52 1999/09/27 23:45:01 peter
  1298. * procinfo is now a pointer
  1299. * support for result setting in sub procedure
  1300. Revision 1.51 1999/09/15 20:35:46 florian
  1301. * small fix to operator overloading when in MMX mode
  1302. + the compiler uses now fldz and fld1 if possible
  1303. + some fixes to floating point registers
  1304. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1305. * .... ???
  1306. Revision 1.50 1999/09/07 14:05:11 pierre
  1307. * halt removed in do_lowhigh
  1308. Revision 1.49 1999/08/28 15:34:21 florian
  1309. * bug 519 fixed
  1310. Revision 1.48 1999/08/23 23:41:04 pierre
  1311. * in_inc_x register allocation corrected
  1312. Revision 1.47 1999/08/06 12:43:13 jonas
  1313. * fix for regvars with the val code
  1314. Revision 1.46 1999/08/05 16:53:23 peter
  1315. * V_Fatal=1, all other V_ are also increased
  1316. * Check for local procedure when assigning procvar
  1317. * fixed comment parsing because directives
  1318. * oldtp mode directives better supported
  1319. * added some messages to errore.msg
  1320. Revision 1.45 1999/08/04 00:23:40 florian
  1321. * renamed i386asm and i386base to cpuasm and cpubase
  1322. }