tcinl.pas 60 KB

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