tcinl.pas 56 KB

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