tccal.pas 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Type checking and register allocation for call 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 tccal;
  19. interface
  20. uses
  21. symtable,tree;
  22. procedure gen_high_tree(p:ptree;openstring:boolean);
  23. procedure firstcallparan(var p : ptree;defcoll : pparaitem;do_count : boolean);
  24. procedure firstcalln(var p : ptree);
  25. procedure firstprocinline(var p : ptree);
  26. implementation
  27. uses
  28. globtype,systems,
  29. cobjects,verbose,globals,
  30. symconst,aasm,types,
  31. hcodegen,htypechk,pass_1,cpubase
  32. {$ifdef i386}
  33. ,tgeni386
  34. {$endif}
  35. {$ifdef m68k}
  36. ,tgen68k
  37. {$endif m68k}
  38. ;
  39. {*****************************************************************************
  40. FirstCallParaN
  41. *****************************************************************************}
  42. procedure gen_high_tree(p:ptree;openstring:boolean);
  43. var
  44. len : longint;
  45. st : psymtable;
  46. loadconst : boolean;
  47. begin
  48. if assigned(p^.hightree) then
  49. exit;
  50. len:=-1;
  51. loadconst:=true;
  52. case p^.left^.resulttype^.deftype of
  53. arraydef :
  54. begin
  55. if is_open_array(p^.left^.resulttype) or
  56. is_array_of_const(p^.left^.resulttype) then
  57. begin
  58. st:=p^.left^.symtable;
  59. getsymonlyin(st,'high'+pvarsym(p^.left^.symtableentry)^.name);
  60. p^.hightree:=genloadnode(pvarsym(srsym),st);
  61. loadconst:=false;
  62. end
  63. else
  64. begin
  65. { this is an empty constructor }
  66. len:=parraydef(p^.left^.resulttype)^.highrange-
  67. parraydef(p^.left^.resulttype)^.lowrange;
  68. end;
  69. end;
  70. stringdef :
  71. begin
  72. if openstring then
  73. begin
  74. if is_open_string(p^.left^.resulttype) then
  75. begin
  76. st:=p^.left^.symtable;
  77. getsymonlyin(st,'high'+pvarsym(p^.left^.symtableentry)^.name);
  78. p^.hightree:=genloadnode(pvarsym(srsym),st);
  79. loadconst:=false;
  80. end
  81. else
  82. len:=pstringdef(p^.left^.resulttype)^.len;
  83. end
  84. else
  85. { passing a string to an array of char }
  86. begin
  87. if (p^.left^.treetype=stringconstn) then
  88. begin
  89. len:=str_length(p^.left);
  90. if len>0 then
  91. dec(len);
  92. end
  93. else
  94. begin
  95. p^.hightree:=gennode(subn,geninlinenode(in_length_string,false,getcopy(p^.left)),
  96. genordinalconstnode(1,s32bitdef));
  97. firstpass(p^.hightree);
  98. p^.hightree:=gentypeconvnode(p^.hightree,s32bitdef);
  99. loadconst:=false;
  100. end;
  101. end;
  102. end;
  103. else
  104. len:=0;
  105. end;
  106. if loadconst then
  107. p^.hightree:=genordinalconstnode(len,s32bitdef);
  108. firstpass(p^.hightree);
  109. end;
  110. procedure firstcallparan(var p : ptree;defcoll : pparaitem;do_count : boolean);
  111. var
  112. old_get_para_resulttype : boolean;
  113. old_array_constructor : boolean;
  114. oldtype : pdef;
  115. {$ifdef extdebug}
  116. store_count_ref : boolean;
  117. {$endif def extdebug}
  118. {convtyp : tconverttype;}
  119. begin
  120. inc(parsing_para_level);
  121. {$ifdef extdebug}
  122. if do_count then
  123. begin
  124. store_count_ref:=count_ref;
  125. count_ref:=true;
  126. end;
  127. {$endif def extdebug}
  128. if assigned(p^.right) then
  129. begin
  130. if defcoll=nil then
  131. firstcallparan(p^.right,nil,do_count)
  132. else
  133. firstcallparan(p^.right,pparaitem(defcoll^.next),do_count);
  134. p^.registers32:=p^.right^.registers32;
  135. p^.registersfpu:=p^.right^.registersfpu;
  136. {$ifdef SUPPORT_MMX}
  137. p^.registersmmx:=p^.right^.registersmmx;
  138. {$endif}
  139. end;
  140. if defcoll=nil then
  141. begin
  142. old_array_constructor:=allow_array_constructor;
  143. old_get_para_resulttype:=get_para_resulttype;
  144. get_para_resulttype:=true;
  145. allow_array_constructor:=true;
  146. firstpass(p^.left);
  147. get_para_resulttype:=old_get_para_resulttype;
  148. allow_array_constructor:=old_array_constructor;
  149. if codegenerror then
  150. begin
  151. dec(parsing_para_level);
  152. exit;
  153. end;
  154. p^.resulttype:=p^.left^.resulttype;
  155. end
  156. { if we know the routine which is called, then the type }
  157. { conversions are inserted }
  158. else
  159. begin
  160. { Do we need arrayconstructor -> set conversion, then insert
  161. it here before the arrayconstructor node breaks the tree
  162. with its conversions of enum->ord }
  163. if (p^.left^.treetype=arrayconstructn) and
  164. (defcoll^.paratype.def^.deftype=setdef) then
  165. p^.left:=gentypeconvnode(p^.left,defcoll^.paratype.def);
  166. if do_count then
  167. begin
  168. { not completly proper, but avoids some warnings }
  169. if (defcoll^.paratyp=vs_var) then
  170. set_funcret_is_valid(p^.left);
  171. { protected has nothing to do with read/write
  172. if (defcoll^.paratyp=vs_var) then
  173. test_protected(p^.left);
  174. }
  175. set_varstate(p^.left,defcoll^.paratyp<>vs_var);
  176. { only process typeconvn and arrayconstructn, else it will
  177. break other trees }
  178. { But this is need to get correct varstate !! PM }
  179. old_array_constructor:=allow_array_constructor;
  180. old_get_para_resulttype:=get_para_resulttype;
  181. allow_array_constructor:=true;
  182. get_para_resulttype:=false;
  183. if (p^.left^.treetype in [arrayconstructn,typeconvn]) then
  184. firstpass(p^.left);
  185. if not assigned(p^.resulttype) then
  186. p^.resulttype:=p^.left^.resulttype;
  187. get_para_resulttype:=old_get_para_resulttype;
  188. allow_array_constructor:=old_array_constructor;
  189. end;
  190. { check if local proc/func is assigned to procvar }
  191. if p^.left^.resulttype^.deftype=procvardef then
  192. test_local_to_procvar(pprocvardef(p^.left^.resulttype),defcoll^.paratype.def);
  193. { property is not allowed as var parameter }
  194. if (defcoll^.paratyp=vs_var) and
  195. (p^.left^.isproperty) then
  196. CGMessagePos(p^.left^.fileinfo,type_e_argument_cant_be_assigned);
  197. { generate the high() value tree }
  198. if push_high_param(defcoll^.paratype.def) then
  199. gen_high_tree(p,is_open_string(defcoll^.paratype.def));
  200. if not(is_shortstring(p^.left^.resulttype) and
  201. is_shortstring(defcoll^.paratype.def)) and
  202. (defcoll^.paratype.def^.deftype<>formaldef) then
  203. begin
  204. if (defcoll^.paratyp=vs_var) and
  205. { allows conversion from word to integer and
  206. byte to shortint }
  207. (not(
  208. (p^.left^.resulttype^.deftype=orddef) and
  209. (defcoll^.paratype.def^.deftype=orddef) and
  210. (p^.left^.resulttype^.size=defcoll^.paratype.def^.size)
  211. ) and
  212. { an implicit pointer conversion is allowed }
  213. not(
  214. (p^.left^.resulttype^.deftype=pointerdef) and
  215. (defcoll^.paratype.def^.deftype=pointerdef)
  216. ) and
  217. { child classes can be also passed }
  218. not(
  219. (p^.left^.resulttype^.deftype=objectdef) and
  220. (defcoll^.paratype.def^.deftype=objectdef) and
  221. pobjectdef(p^.left^.resulttype)^.is_related(pobjectdef(defcoll^.paratype.def))
  222. ) and
  223. { passing a single element to a openarray of the same type }
  224. not(
  225. (is_open_array(defcoll^.paratype.def) and
  226. is_equal(parraydef(defcoll^.paratype.def)^.elementtype.def,p^.left^.resulttype))
  227. ) and
  228. { an implicit file conversion is also allowed }
  229. { from a typed file to an untyped one }
  230. not(
  231. (p^.left^.resulttype^.deftype=filedef) and
  232. (defcoll^.paratype.def^.deftype=filedef) and
  233. (pfiledef(defcoll^.paratype.def)^.filetyp = ft_untyped) and
  234. (pfiledef(p^.left^.resulttype)^.filetyp = ft_typed)
  235. ) and
  236. not(is_equal(p^.left^.resulttype,defcoll^.paratype.def))) then
  237. begin
  238. CGMessagePos2(p^.left^.fileinfo,parser_e_call_by_ref_without_typeconv,
  239. p^.left^.resulttype^.typename,defcoll^.paratype.def^.typename);
  240. end;
  241. { process cargs arrayconstructor }
  242. if is_array_constructor(p^.left^.resulttype) then
  243. begin
  244. if is_array_of_const(defcoll^.paratype.def) then
  245. begin
  246. if assigned(aktcallprocsym) and
  247. (pocall_cdecl in aktcallprocsym^.definition^.proccalloptions) and
  248. (po_external in aktcallprocsym^.definition^.procoptions) then
  249. p^.left^.cargs:=true;
  250. { force variant array }
  251. p^.left^.forcevaria:=true;
  252. end
  253. else
  254. begin
  255. p^.left^.novariaallowed:=true;
  256. p^.left^.constructdef:=parraydef(defcoll^.paratype.def)^.elementtype.def;
  257. end;
  258. old_array_constructor:=allow_array_constructor;
  259. allow_array_constructor:=true;
  260. firstpass(p^.left);
  261. allow_array_constructor:=old_array_constructor;
  262. end;
  263. { process open parameters }
  264. if push_high_param(defcoll^.paratype.def) then
  265. begin
  266. { insert type conv but hold the ranges of the array }
  267. oldtype:=p^.left^.resulttype;
  268. p^.left:=gentypeconvnode(p^.left,defcoll^.paratype.def);
  269. firstpass(p^.left);
  270. p^.left^.resulttype:=oldtype;
  271. end
  272. else
  273. begin
  274. p^.left:=gentypeconvnode(p^.left,defcoll^.paratype.def);
  275. firstpass(p^.left);
  276. end;
  277. if codegenerror then
  278. begin
  279. dec(parsing_para_level);
  280. exit;
  281. end;
  282. end;
  283. { check var strings }
  284. if (cs_strict_var_strings in aktlocalswitches) and
  285. is_shortstring(p^.left^.resulttype) and
  286. is_shortstring(defcoll^.paratype.def) and
  287. (defcoll^.paratyp=vs_var) and
  288. not(is_open_string(defcoll^.paratype.def)) and
  289. not(is_equal(p^.left^.resulttype,defcoll^.paratype.def)) then
  290. begin
  291. aktfilepos:=p^.left^.fileinfo;
  292. CGMessage(type_e_strict_var_string_violation);
  293. end;
  294. { Variablen for call by reference may not be copied }
  295. { into a register }
  296. { is this usefull here ? }
  297. { this was missing in formal parameter list }
  298. if (defcoll^.paratype.def=pdef(cformaldef)) then
  299. begin
  300. if defcoll^.paratyp=vs_var then
  301. begin
  302. if not valid_for_formal_var(p^.left) then
  303. begin
  304. aktfilepos:=p^.left^.fileinfo;
  305. CGMessage(parser_e_illegal_parameter_list);
  306. end;
  307. end;
  308. if defcoll^.paratyp=vs_const then
  309. begin
  310. if not valid_for_formal_const(p^.left) then
  311. begin
  312. aktfilepos:=p^.left^.fileinfo;
  313. CGMessage(parser_e_illegal_parameter_list);
  314. end;
  315. end;
  316. end;
  317. if defcoll^.paratyp=vs_var then
  318. begin
  319. set_unique(p^.left);
  320. make_not_regable(p^.left);
  321. end;
  322. p^.resulttype:=defcoll^.paratype.def;
  323. end;
  324. if p^.left^.registers32>p^.registers32 then
  325. p^.registers32:=p^.left^.registers32;
  326. if p^.left^.registersfpu>p^.registersfpu then
  327. p^.registersfpu:=p^.left^.registersfpu;
  328. {$ifdef SUPPORT_MMX}
  329. if p^.left^.registersmmx>p^.registersmmx then
  330. p^.registersmmx:=p^.left^.registersmmx;
  331. {$endif SUPPORT_MMX}
  332. dec(parsing_para_level);
  333. {$ifdef extdebug}
  334. if do_count then
  335. count_ref:=store_count_ref;
  336. {$endif def extdebug}
  337. end;
  338. {*****************************************************************************
  339. FirstCallN
  340. *****************************************************************************}
  341. procedure firstcalln(var p : ptree);
  342. type
  343. pprocdefcoll = ^tprocdefcoll;
  344. tprocdefcoll = record
  345. data : pprocdef;
  346. nextpara : pparaitem;
  347. firstpara : pparaitem;
  348. next : pprocdefcoll;
  349. end;
  350. var
  351. hp,procs,hp2 : pprocdefcoll;
  352. pd : pprocdef;
  353. oldcallprocsym : pprocsym;
  354. nextprocsym : pprocsym;
  355. def_from,def_to,conv_to : pdef;
  356. hpt,pt,inlinecode : ptree;
  357. exactmatch,inlined : boolean;
  358. paralength,lastpara : longint;
  359. lastparatype : pdef;
  360. pdc : pparaitem;
  361. {$ifdef TEST_PROCSYMS}
  362. symt : psymtable;
  363. {$endif TEST_PROCSYMS}
  364. { only Dummy }
  365. hcvt : tconverttype;
  366. regi : tregister;
  367. method_must_be_valid : boolean;
  368. label
  369. errorexit;
  370. { check if the resulttype from tree p is equal with def, needed
  371. for stringconstn and formaldef }
  372. function is_equal(p:ptree;def:pdef) : boolean;
  373. begin
  374. { safety check }
  375. if not (assigned(def) or assigned(p^.resulttype)) then
  376. begin
  377. is_equal:=false;
  378. exit;
  379. end;
  380. { all types can be passed to a formaldef }
  381. is_equal:=(def^.deftype=formaldef) or
  382. (types.is_equal(p^.resulttype,def))
  383. { to support ansi/long/wide strings in a proper way }
  384. { string and string[10] are assumed as equal }
  385. { when searching the correct overloaded procedure }
  386. or
  387. (
  388. (def^.deftype=stringdef) and (p^.resulttype^.deftype=stringdef) and
  389. (pstringdef(def)^.string_typ=pstringdef(p^.resulttype)^.string_typ)
  390. )
  391. or
  392. (
  393. (p^.left^.treetype=stringconstn) and
  394. (is_ansistring(p^.resulttype) and is_pchar(def))
  395. )
  396. or
  397. (
  398. (p^.left^.treetype=ordconstn) and
  399. (is_char(p^.resulttype) and (is_shortstring(def) or is_ansistring(def)))
  400. )
  401. { set can also be a not yet converted array constructor }
  402. or
  403. (
  404. (def^.deftype=setdef) and (p^.resulttype^.deftype=arraydef) and
  405. (parraydef(p^.resulttype)^.IsConstructor) and not(parraydef(p^.resulttype)^.IsVariant)
  406. )
  407. { in tp7 mode proc -> procvar is allowed }
  408. or
  409. (
  410. (m_tp_procvar in aktmodeswitches) and
  411. (def^.deftype=procvardef) and (p^.left^.treetype=calln) and
  412. (proc_to_procvar_equal(pprocdef(p^.left^.procdefinition),pprocvardef(def)))
  413. )
  414. ;
  415. end;
  416. function is_in_limit(def_from,def_to : pdef) : boolean;
  417. begin
  418. is_in_limit:=(def_from^.deftype = orddef) and
  419. (def_to^.deftype = orddef) and
  420. (porddef(def_from)^.low>porddef(def_to)^.low) and
  421. (porddef(def_from)^.high<porddef(def_to)^.high);
  422. end;
  423. var
  424. is_const : boolean;
  425. begin
  426. { release registers! }
  427. { if procdefinition<>nil then we called firstpass already }
  428. { it seems to be bad because of the registers }
  429. { at least we can avoid the overloaded search !! }
  430. procs:=nil;
  431. { made this global for disposing !! }
  432. oldcallprocsym:=aktcallprocsym;
  433. aktcallprocsym:=nil;
  434. inlined:=false;
  435. if assigned(p^.procdefinition) and
  436. (pocall_inline in p^.procdefinition^.proccalloptions) then
  437. begin
  438. inlinecode:=p^.right;
  439. if assigned(inlinecode) then
  440. begin
  441. inlined:=true;
  442. {$ifdef INCLUDEOK}
  443. exclude(p^.procdefinition^.proccalloptions,pocall_inline);
  444. {$else}
  445. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions-[pocall_inline];
  446. {$endif}
  447. end;
  448. p^.right:=nil;
  449. end;
  450. if assigned(p^.procdefinition) and
  451. (po_containsself in p^.procdefinition^.procoptions) then
  452. message(cg_e_cannot_call_message_direct);
  453. { procedure variable ? }
  454. if assigned(p^.right) then
  455. begin
  456. { procedure does a call }
  457. procinfo^.flags:=procinfo^.flags or pi_do_call;
  458. { calc the correture value for the register }
  459. {$ifdef i386}
  460. for regi:=R_EAX to R_EDI do
  461. inc(reg_pushes[regi],t_times*2);
  462. {$endif}
  463. {$ifdef m68k}
  464. for regi:=R_D0 to R_A6 do
  465. inc(reg_pushes[regi],t_times*2);
  466. {$endif}
  467. { calculate the type of the parameters }
  468. if assigned(p^.left) then
  469. begin
  470. firstcallparan(p^.left,nil,false);
  471. if codegenerror then
  472. goto errorexit;
  473. end;
  474. firstpass(p^.right);
  475. set_varstate(p^.right,true);
  476. { check the parameters }
  477. pdc:=pparaitem(pprocvardef(p^.right^.resulttype)^.para^.first);
  478. pt:=p^.left;
  479. while assigned(pdc) and assigned(pt) do
  480. begin
  481. pt:=pt^.right;
  482. pdc:=pparaitem(pdc^.next);
  483. end;
  484. if assigned(pt) or assigned(pdc) then
  485. begin
  486. if assigned(pt) then
  487. aktfilepos:=pt^.fileinfo;
  488. CGMessage(parser_e_illegal_parameter_list);
  489. end;
  490. { insert type conversions }
  491. if assigned(p^.left) then
  492. begin
  493. firstcallparan(p^.left,pparaitem(pprocvardef(p^.right^.resulttype)^.para^.first),true);
  494. if codegenerror then
  495. goto errorexit;
  496. end;
  497. p^.resulttype:=pprocvardef(p^.right^.resulttype)^.rettype.def;
  498. { this was missing, leads to a bug below if
  499. the procvar is a function }
  500. p^.procdefinition:=pabstractprocdef(p^.right^.resulttype);
  501. end
  502. else
  503. { not a procedure variable }
  504. begin
  505. { determine the type of the parameters }
  506. if assigned(p^.left) then
  507. begin
  508. firstcallparan(p^.left,nil,false);
  509. if codegenerror then
  510. goto errorexit;
  511. end;
  512. aktcallprocsym:=pprocsym(p^.symtableprocentry);
  513. { do we know the procedure to call ? }
  514. if not(assigned(p^.procdefinition)) then
  515. begin
  516. {$ifdef TEST_PROCSYMS}
  517. if (p^.unit_specific) or
  518. assigned(p^.methodpointer) then
  519. nextprocsym:=nil
  520. else while not assigned(procs) do
  521. begin
  522. symt:=p^.symtableproc;
  523. srsym:=nil;
  524. while assigned(symt^.next) and not assigned(srsym) do
  525. begin
  526. symt:=symt^.next;
  527. getsymonlyin(symt,actprocsym^.name);
  528. if assigned(srsym) then
  529. if srsym^.typ<>procsym then
  530. begin
  531. { reject all that is not a procedure }
  532. srsym:=nil;
  533. { don't search elsewhere }
  534. while assigned(symt^.next) do
  535. symt:=symt^.next;
  536. end;
  537. end;
  538. nextprocsym:=srsym;
  539. end;
  540. {$else TEST_PROCSYMS}
  541. nextprocsym:=nil;
  542. {$endif TEST_PROCSYMS}
  543. { determine length of parameter list }
  544. pt:=p^.left;
  545. paralength:=0;
  546. while assigned(pt) do
  547. begin
  548. inc(paralength);
  549. pt:=pt^.right;
  550. end;
  551. { link all procedures which have the same # of parameters }
  552. pd:=aktcallprocsym^.definition;
  553. while assigned(pd) do
  554. begin
  555. { only when the # of parameter are equal }
  556. if (pd^.para^.count=paralength) then
  557. begin
  558. new(hp);
  559. hp^.data:=pd;
  560. hp^.next:=procs;
  561. hp^.nextpara:=pparaitem(pd^.para^.first);
  562. hp^.firstpara:=pparaitem(pd^.para^.first);
  563. procs:=hp;
  564. end;
  565. pd:=pd^.nextoverloaded;
  566. end;
  567. { no procedures found? then there is something wrong
  568. with the parameter size }
  569. if not assigned(procs) then
  570. begin
  571. { in tp mode we can try to convert to procvar if
  572. there are no parameters specified }
  573. if not(assigned(p^.left)) and
  574. (m_tp_procvar in aktmodeswitches) then
  575. begin
  576. if (p^.symtableprocentry^.owner^.symtabletype=objectsymtable) and
  577. (pobjectdef(p^.symtableprocentry^.owner^.defowner)^.is_class) then
  578. hpt:=genloadmethodcallnode(pprocsym(p^.symtableprocentry),p^.symtableproc,
  579. getcopy(p^.methodpointer))
  580. else
  581. hpt:=genloadcallnode(pprocsym(p^.symtableprocentry),p^.symtableproc);
  582. disposetree(p);
  583. firstpass(hpt);
  584. p:=hpt;
  585. end
  586. else
  587. begin
  588. if assigned(p^.left) then
  589. aktfilepos:=p^.left^.fileinfo;
  590. CGMessage(parser_e_wrong_parameter_size);
  591. aktcallprocsym^.write_parameter_lists;
  592. end;
  593. goto errorexit;
  594. end;
  595. { now we can compare parameter after parameter }
  596. pt:=p^.left;
  597. { we start with the last parameter }
  598. lastpara:=paralength+1;
  599. lastparatype:=nil;
  600. while assigned(pt) do
  601. begin
  602. dec(lastpara);
  603. { walk all procedures and determine how this parameter matches and set:
  604. 1. pt^.exact_match_found if one parameter has an exact match
  605. 2. exactmatch if an equal or exact match is found
  606. 3. para^.argconvtyp to exact,equal or convertable
  607. (when convertable then also convertlevel is set)
  608. 4. pt^.convlevel1found if there is a convertlevel=1
  609. 5. pt^.convlevel2found if there is a convertlevel=2
  610. }
  611. exactmatch:=false;
  612. hp:=procs;
  613. while assigned(hp) do
  614. begin
  615. if is_equal(pt,hp^.nextpara^.paratype.def) then
  616. begin
  617. if hp^.nextpara^.paratype.def=pt^.resulttype then
  618. begin
  619. pt^.exact_match_found:=true;
  620. hp^.nextpara^.argconvtyp:=act_exact;
  621. end
  622. else
  623. hp^.nextpara^.argconvtyp:=act_equal;
  624. exactmatch:=true;
  625. end
  626. else
  627. begin
  628. hp^.nextpara^.argconvtyp:=act_convertable;
  629. hp^.nextpara^.convertlevel:=isconvertable(pt^.resulttype,hp^.nextpara^.paratype.def,
  630. hcvt,pt^.left^.treetype,false);
  631. case hp^.nextpara^.convertlevel of
  632. 1 : pt^.convlevel1found:=true;
  633. 2 : pt^.convlevel2found:=true;
  634. end;
  635. end;
  636. hp:=hp^.next;
  637. end;
  638. { If there was an exactmatch then delete all convertables }
  639. if exactmatch then
  640. begin
  641. hp:=procs;
  642. procs:=nil;
  643. while assigned(hp) do
  644. begin
  645. hp2:=hp^.next;
  646. { keep if not convertable }
  647. if (hp^.nextpara^.argconvtyp<>act_convertable) then
  648. begin
  649. hp^.next:=procs;
  650. procs:=hp;
  651. end
  652. else
  653. dispose(hp);
  654. hp:=hp2;
  655. end;
  656. end
  657. else
  658. { No exact match was found, remove all procedures that are
  659. not convertable (convertlevel=0) }
  660. begin
  661. hp:=procs;
  662. procs:=nil;
  663. while assigned(hp) do
  664. begin
  665. hp2:=hp^.next;
  666. { keep if not convertable }
  667. if (hp^.nextpara^.convertlevel<>0) then
  668. begin
  669. hp^.next:=procs;
  670. procs:=hp;
  671. end
  672. else
  673. begin
  674. { save the type for nice error message }
  675. lastparatype:=hp^.nextpara^.paratype.def;
  676. dispose(hp);
  677. end;
  678. hp:=hp2;
  679. end;
  680. end;
  681. { update nextpara for all procedures }
  682. hp:=procs;
  683. while assigned(hp) do
  684. begin
  685. hp^.nextpara:=pparaitem(hp^.nextpara^.next);
  686. hp:=hp^.next;
  687. end;
  688. { load next parameter or quit loop if no procs left }
  689. if assigned(procs) then
  690. pt:=pt^.right
  691. else
  692. break;
  693. end;
  694. { All parameters are checked, check if there are any
  695. procedures left }
  696. if not assigned(procs) then
  697. begin
  698. { there is an error, must be wrong type, because
  699. wrong size is already checked (PFV) }
  700. if (not assigned(lastparatype)) or
  701. (not assigned(pt)) or
  702. (not assigned(pt^.resulttype)) then
  703. internalerror(39393)
  704. else
  705. begin
  706. aktfilepos:=pt^.fileinfo;
  707. CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
  708. pt^.resulttype^.typename,lastparatype^.typename);
  709. end;
  710. aktcallprocsym^.write_parameter_lists;
  711. goto errorexit;
  712. end;
  713. { if there are several choices left then for orddef }
  714. { if a type is totally included in the other }
  715. { we don't fear an overflow , }
  716. { so we can do as if it is an exact match }
  717. { this will convert integer to longint }
  718. { rather than to words }
  719. { conversion of byte to integer or longint }
  720. {would still not be solved }
  721. if assigned(procs) and assigned(procs^.next) then
  722. begin
  723. hp:=procs;
  724. while assigned(hp) do
  725. begin
  726. hp^.nextpara:=hp^.firstpara;
  727. hp:=hp^.next;
  728. end;
  729. pt:=p^.left;
  730. while assigned(pt) do
  731. begin
  732. { matches a parameter of one procedure exact ? }
  733. exactmatch:=false;
  734. def_from:=pt^.resulttype;
  735. hp:=procs;
  736. while assigned(hp) do
  737. begin
  738. if not is_equal(pt,hp^.nextpara^.paratype.def) then
  739. begin
  740. def_to:=hp^.nextpara^.paratype.def;
  741. if ((def_from^.deftype=orddef) and (def_to^.deftype=orddef)) and
  742. (is_in_limit(def_from,def_to) or
  743. ((hp^.nextpara^.paratyp=vs_var) and
  744. (def_from^.size=def_to^.size))) then
  745. begin
  746. exactmatch:=true;
  747. conv_to:=def_to;
  748. end;
  749. end;
  750. hp:=hp^.next;
  751. end;
  752. { .... if yes, del all the other procedures }
  753. if exactmatch then
  754. begin
  755. { the first .... }
  756. while (assigned(procs)) and not(is_in_limit(def_from,procs^.nextpara^.paratype.def)) do
  757. begin
  758. hp:=procs^.next;
  759. dispose(procs);
  760. procs:=hp;
  761. end;
  762. { and the others }
  763. hp:=procs;
  764. while (assigned(hp)) and assigned(hp^.next) do
  765. begin
  766. if not(is_in_limit(def_from,hp^.next^.nextpara^.paratype.def)) then
  767. begin
  768. hp2:=hp^.next^.next;
  769. dispose(hp^.next);
  770. hp^.next:=hp2;
  771. end
  772. else
  773. begin
  774. def_to:=hp^.next^.nextpara^.paratype.def;
  775. if (conv_to^.size>def_to^.size) or
  776. ((porddef(conv_to)^.low<porddef(def_to)^.low) and
  777. (porddef(conv_to)^.high>porddef(def_to)^.high)) then
  778. begin
  779. hp2:=procs;
  780. procs:=hp;
  781. conv_to:=def_to;
  782. dispose(hp2);
  783. end
  784. else
  785. hp:=hp^.next;
  786. end;
  787. end;
  788. end;
  789. { update nextpara for all procedures }
  790. hp:=procs;
  791. while assigned(hp) do
  792. begin
  793. hp^.nextpara:=pparaitem(hp^.nextpara^.next);
  794. hp:=hp^.next;
  795. end;
  796. pt:=pt^.right;
  797. end;
  798. end;
  799. { let's try to eliminate equal if there is an exact match
  800. is there }
  801. if assigned(procs) and assigned(procs^.next) then
  802. begin
  803. { reset nextpara for all procs left }
  804. hp:=procs;
  805. while assigned(hp) do
  806. begin
  807. hp^.nextpara:=hp^.firstpara;
  808. hp:=hp^.next;
  809. end;
  810. pt:=p^.left;
  811. while assigned(pt) do
  812. begin
  813. if pt^.exact_match_found then
  814. begin
  815. hp:=procs;
  816. procs:=nil;
  817. while assigned(hp) do
  818. begin
  819. hp2:=hp^.next;
  820. { keep the exact matches, dispose the others }
  821. if (hp^.nextpara^.argconvtyp=act_exact) then
  822. begin
  823. hp^.next:=procs;
  824. procs:=hp;
  825. end
  826. else
  827. dispose(hp);
  828. hp:=hp2;
  829. end;
  830. end;
  831. { update nextpara for all procedures }
  832. hp:=procs;
  833. while assigned(hp) do
  834. begin
  835. hp^.nextpara:=pparaitem(hp^.nextpara^.next);
  836. hp:=hp^.next;
  837. end;
  838. pt:=pt^.right;
  839. end;
  840. end;
  841. { Check if there are convertlevel 1 and 2 differences
  842. left for the parameters, then discard all convertlevel
  843. 2 procedures. The value of convlevelXfound can still
  844. be used, because all convertables are still here or
  845. not }
  846. if assigned(procs) and assigned(procs^.next) then
  847. begin
  848. { reset nextpara for all procs left }
  849. hp:=procs;
  850. while assigned(hp) do
  851. begin
  852. hp^.nextpara:=hp^.firstpara;
  853. hp:=hp^.next;
  854. end;
  855. pt:=p^.left;
  856. while assigned(pt) do
  857. begin
  858. if pt^.convlevel1found and pt^.convlevel2found then
  859. begin
  860. hp:=procs;
  861. procs:=nil;
  862. while assigned(hp) do
  863. begin
  864. hp2:=hp^.next;
  865. { keep all not act_convertable and all convertlevels=1 }
  866. if (hp^.nextpara^.argconvtyp<>act_convertable) or
  867. (hp^.nextpara^.convertlevel=1) then
  868. begin
  869. hp^.next:=procs;
  870. procs:=hp;
  871. end
  872. else
  873. dispose(hp);
  874. hp:=hp2;
  875. end;
  876. end;
  877. { update nextpara for all procedures }
  878. hp:=procs;
  879. while assigned(hp) do
  880. begin
  881. hp^.nextpara:=pparaitem(hp^.nextpara^.next);
  882. hp:=hp^.next;
  883. end;
  884. pt:=pt^.right;
  885. end;
  886. end;
  887. if not(assigned(procs)) or assigned(procs^.next) then
  888. begin
  889. CGMessage(cg_e_cant_choose_overload_function);
  890. aktcallprocsym^.write_parameter_lists;
  891. goto errorexit;
  892. end;
  893. {$ifdef TEST_PROCSYMS}
  894. if (procs=nil) and assigned(nextprocsym) then
  895. begin
  896. p^.symtableprocentry:=nextprocsym;
  897. p^.symtableproc:=symt;
  898. end;
  899. end ; { of while assigned(p^.symtableprocentry) do }
  900. {$endif TEST_PROCSYMS}
  901. if make_ref then
  902. begin
  903. procs^.data^.lastref:=new(pref,init(procs^.data^.lastref,@p^.fileinfo));
  904. inc(procs^.data^.refcount);
  905. if procs^.data^.defref=nil then
  906. procs^.data^.defref:=procs^.data^.lastref;
  907. end;
  908. p^.procdefinition:=procs^.data;
  909. p^.resulttype:=procs^.data^.rettype.def;
  910. { big error for with statements
  911. p^.symtableproc:=p^.procdefinition^.owner;
  912. but neede for overloaded operators !! }
  913. if p^.symtableproc=nil then
  914. p^.symtableproc:=p^.procdefinition^.owner;
  915. p^.location.loc:=LOC_MEM;
  916. {$ifdef CHAINPROCSYMS}
  917. { object with method read;
  918. call to read(x) will be a usual procedure call }
  919. if assigned(p^.methodpointer) and
  920. (p^.procdefinition^._class=nil) then
  921. begin
  922. { not ok for extended }
  923. case p^.methodpointer^.treetype of
  924. typen,hnewn : fatalerror(no_para_match);
  925. end;
  926. disposetree(p^.methodpointer);
  927. p^.methodpointer:=nil;
  928. end;
  929. {$endif CHAINPROCSYMS}
  930. end; { end of procedure to call determination }
  931. is_const:=(pocall_internconst in p^.procdefinition^.proccalloptions) and
  932. ((block_type=bt_const) or
  933. (assigned(p^.left) and (p^.left^.left^.treetype in [realconstn,ordconstn])));
  934. { handle predefined procedures }
  935. if (pocall_internproc in p^.procdefinition^.proccalloptions) or is_const then
  936. begin
  937. if assigned(p^.left) then
  938. begin
  939. { settextbuf needs two args }
  940. if assigned(p^.left^.right) then
  941. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,p^.left)
  942. else
  943. begin
  944. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,p^.left^.left);
  945. putnode(p^.left);
  946. end;
  947. end
  948. else
  949. begin
  950. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,nil);
  951. end;
  952. putnode(p);
  953. firstpass(pt);
  954. p:=pt;
  955. goto errorexit;
  956. end
  957. else
  958. { no intern procedure => we do a call }
  959. { calc the correture value for the register }
  960. { handle predefined procedures }
  961. if (pocall_inline in p^.procdefinition^.proccalloptions) then
  962. begin
  963. if assigned(p^.methodpointer) then
  964. CGMessage(cg_e_unable_inline_object_methods);
  965. if assigned(p^.right) and (p^.right^.treetype<>procinlinen) then
  966. CGMessage(cg_e_unable_inline_procvar);
  967. { p^.treetype:=procinlinen; }
  968. if not assigned(p^.right) then
  969. begin
  970. if assigned(pprocdef(p^.procdefinition)^.code) then
  971. inlinecode:=genprocinlinenode(p,ptree(pprocdef(p^.procdefinition)^.code))
  972. else
  973. CGMessage(cg_e_no_code_for_inline_stored);
  974. if assigned(inlinecode) then
  975. begin
  976. { consider it has not inlined if called
  977. again inside the args }
  978. {$ifdef INCLUDEOK}
  979. exclude(p^.procdefinition^.proccalloptions,pocall_inline);
  980. {$else}
  981. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions-[pocall_inline];
  982. {$endif}
  983. firstpass(inlinecode);
  984. inlined:=true;
  985. end;
  986. end;
  987. end
  988. else
  989. procinfo^.flags:=procinfo^.flags or pi_do_call;
  990. if (po_interrupt in p^.procdefinition^.procoptions) then
  991. CGmessage1(cg_e_no_call_to_interrupt,p^.symtableprocentry^.name);
  992. { work trough all parameters to insert the type conversions }
  993. { !!! done now after internproc !! (PM) }
  994. if assigned(p^.left) then
  995. begin
  996. firstcallparan(p^.left,pparaitem(p^.procdefinition^.para^.first),true);
  997. end;
  998. {$ifdef i386}
  999. for regi:=R_EAX to R_EDI do
  1000. begin
  1001. if (pprocdef(p^.procdefinition)^.usedregisters and ($80 shr word(regi)))<>0 then
  1002. inc(reg_pushes[regi],t_times*2);
  1003. end;
  1004. {$endif}
  1005. {$ifdef m68k}
  1006. for regi:=R_D0 to R_A6 do
  1007. begin
  1008. if (pprocdef(p^.procdefinition)^.usedregisters and ($800 shr word(regi)))<>0 then
  1009. inc(reg_pushes[regi],t_times*2);
  1010. end;
  1011. {$endif}
  1012. end;
  1013. { ensure that the result type is set }
  1014. p^.resulttype:=p^.procdefinition^.rettype.def;
  1015. { get a register for the return value }
  1016. if (p^.resulttype<>pdef(voiddef)) then
  1017. begin
  1018. if (p^.procdefinition^.proctypeoption=potype_constructor) then
  1019. begin
  1020. { extra handling of classes }
  1021. { p^.methodpointer should be assigned! }
  1022. if assigned(p^.methodpointer) and assigned(p^.methodpointer^.resulttype) and
  1023. (p^.methodpointer^.resulttype^.deftype=classrefdef) then
  1024. begin
  1025. p^.location.loc:=LOC_REGISTER;
  1026. p^.registers32:=1;
  1027. { the result type depends on the classref }
  1028. p^.resulttype:=pclassrefdef(p^.methodpointer^.resulttype)^.pointertype.def;
  1029. end
  1030. { a object constructor returns the result with the flags }
  1031. else
  1032. p^.location.loc:=LOC_FLAGS;
  1033. end
  1034. else
  1035. begin
  1036. {$ifdef SUPPORT_MMX}
  1037. if (cs_mmx in aktlocalswitches) and
  1038. is_mmx_able_array(p^.resulttype) then
  1039. begin
  1040. p^.location.loc:=LOC_MMXREGISTER;
  1041. p^.registersmmx:=1;
  1042. end
  1043. else
  1044. {$endif SUPPORT_MMX}
  1045. if ret_in_acc(p^.resulttype) then
  1046. begin
  1047. p^.location.loc:=LOC_REGISTER;
  1048. if is_64bitint(p^.resulttype) then
  1049. p^.registers32:=2
  1050. else
  1051. p^.registers32:=1;
  1052. { wide- and ansistrings are returned in EAX }
  1053. { but they are imm. moved to a memory location }
  1054. if is_widestring(p^.resulttype) or
  1055. is_ansistring(p^.resulttype) then
  1056. begin
  1057. p^.location.loc:=LOC_MEM;
  1058. { this is wrong we still need one register PM
  1059. p^.registers32:=0; }
  1060. p^.registers32:=1;
  1061. end;
  1062. end
  1063. else if (p^.resulttype^.deftype=floatdef) then
  1064. begin
  1065. p^.location.loc:=LOC_FPU;
  1066. p^.registersfpu:=1;
  1067. end
  1068. else
  1069. p^.location.loc:=LOC_MEM;
  1070. end;
  1071. end;
  1072. { a fpu can be used in any procedure !! }
  1073. p^.registersfpu:=p^.procdefinition^.fpu_used;
  1074. { if this is a call to a method calc the registers }
  1075. if (p^.methodpointer<>nil) then
  1076. begin
  1077. case p^.methodpointer^.treetype of
  1078. { but only, if this is not a supporting node }
  1079. typen: ;
  1080. { we need one register for new return value PM }
  1081. hnewn : if p^.registers32=0 then
  1082. p^.registers32:=1;
  1083. else
  1084. begin
  1085. if (p^.procdefinition^.proctypeoption in [potype_constructor,potype_destructor]) and
  1086. assigned(p^.symtable) and (p^.symtable^.symtabletype=withsymtable) and
  1087. not pwithsymtable(p^.symtable)^.direct_with then
  1088. begin
  1089. CGmessage(cg_e_cannot_call_cons_dest_inside_with);
  1090. end; { Is accepted by Delphi !! }
  1091. { this is not a good reason to accept it in FPC if we produce
  1092. wrong code for it !!! (PM) }
  1093. { R.Assign is not a constructor !!! }
  1094. { but for R^.Assign, R must be valid !! }
  1095. if (p^.procdefinition^.proctypeoption=potype_constructor) or
  1096. ((p^.methodpointer^.treetype=loadn) and
  1097. (not(oo_has_virtual in pobjectdef(p^.methodpointer^.resulttype)^.objectoptions))) then
  1098. method_must_be_valid:=false
  1099. else
  1100. method_must_be_valid:=true;
  1101. firstpass(p^.methodpointer);
  1102. set_varstate(p^.methodpointer,method_must_be_valid);
  1103. { The object is already used ven if it is called once }
  1104. if (p^.methodpointer^.treetype=loadn) and
  1105. (p^.methodpointer^.symtableentry^.typ=varsym) then
  1106. pvarsym(p^.methodpointer^.symtableentry)^.varstate:=vs_used;
  1107. p^.registersfpu:=max(p^.methodpointer^.registersfpu,p^.registersfpu);
  1108. p^.registers32:=max(p^.methodpointer^.registers32,p^.registers32);
  1109. {$ifdef SUPPORT_MMX}
  1110. p^.registersmmx:=max(p^.methodpointer^.registersmmx,p^.registersmmx);
  1111. {$endif SUPPORT_MMX}
  1112. end;
  1113. end;
  1114. end;
  1115. if inlined then
  1116. p^.right:=inlinecode;
  1117. { determine the registers of the procedure variable }
  1118. { is this OK for inlined procs also ?? (PM) }
  1119. if assigned(p^.right) then
  1120. begin
  1121. p^.registersfpu:=max(p^.right^.registersfpu,p^.registersfpu);
  1122. p^.registers32:=max(p^.right^.registers32,p^.registers32);
  1123. {$ifdef SUPPORT_MMX}
  1124. p^.registersmmx:=max(p^.right^.registersmmx,p^.registersmmx);
  1125. {$endif SUPPORT_MMX}
  1126. end;
  1127. { determine the registers of the procedure }
  1128. if assigned(p^.left) then
  1129. begin
  1130. p^.registersfpu:=max(p^.left^.registersfpu,p^.registersfpu);
  1131. p^.registers32:=max(p^.left^.registers32,p^.registers32);
  1132. {$ifdef SUPPORT_MMX}
  1133. p^.registersmmx:=max(p^.left^.registersmmx,p^.registersmmx);
  1134. {$endif SUPPORT_MMX}
  1135. end;
  1136. errorexit:
  1137. { Reset some settings back }
  1138. if assigned(procs) then
  1139. dispose(procs);
  1140. if inlined then
  1141. {$ifdef INCLUDEOK}
  1142. include(p^.procdefinition^.proccalloptions,pocall_inline);
  1143. {$else}
  1144. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions+[pocall_inline];
  1145. {$endif}
  1146. aktcallprocsym:=oldcallprocsym;
  1147. end;
  1148. {*****************************************************************************
  1149. FirstProcInlineN
  1150. *****************************************************************************}
  1151. procedure firstprocinline(var p : ptree);
  1152. begin
  1153. { left contains the code in tree form }
  1154. { but it has already been firstpassed }
  1155. { so firstpass(p^.left); does not seem required }
  1156. { might be required later if we change the arg handling !! }
  1157. end;
  1158. end.
  1159. {
  1160. $Log$
  1161. Revision 1.74 1999-11-30 10:40:57 peter
  1162. + ttype, tsymlist
  1163. Revision 1.73 1999/11/18 15:34:49 pierre
  1164. * Notes/Hints for local syms changed to
  1165. Set_varstate function
  1166. Revision 1.72 1999/11/17 17:05:07 pierre
  1167. * Notes/hints changes
  1168. Revision 1.71 1999/11/06 14:34:29 peter
  1169. * truncated log to 20 revs
  1170. Revision 1.70 1999/10/26 12:30:46 peter
  1171. * const parameter is now checked
  1172. * better and generic check if a node can be used for assigning
  1173. * export fixes
  1174. * procvar equal works now (it never had worked at least from 0.99.8)
  1175. * defcoll changed to linkedlist with pparaitem so it can easily be
  1176. walked both directions
  1177. Revision 1.69 1999/10/22 14:37:30 peter
  1178. * error when properties are passed to var parameters
  1179. Revision 1.68 1999/10/13 10:35:27 peter
  1180. * var must match exactly error msg extended with got and expected type
  1181. * array constructor type check now gives error on wrong types
  1182. Revision 1.67 1999/10/12 15:50:54 pierre
  1183. * error if calling interrupt procedure
  1184. Revision 1.66 1999/09/27 23:45:00 peter
  1185. * procinfo is now a pointer
  1186. * support for result setting in sub procedure
  1187. Revision 1.65 1999/09/16 23:05:56 florian
  1188. * m68k compiler is again compilable (only gas writer, no assembler reader)
  1189. Revision 1.64 1999/09/14 07:59:48 florian
  1190. * finally!? fixed
  1191. with <function with result in temp> do
  1192. My last and also Peter's fix before were wrong :(
  1193. Revision 1.63 1999/09/10 18:48:11 florian
  1194. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1195. * most things for stored properties fixed
  1196. Revision 1.62 1999/08/23 23:42:52 pierre
  1197. * hnewn reg allocation corrected
  1198. Revision 1.61 1999/08/17 13:26:08 peter
  1199. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1200. variant.
  1201. Revision 1.60 1999/08/16 23:23:39 peter
  1202. * arrayconstructor -> openarray type conversions for element types
  1203. Revision 1.59 1999/08/13 21:33:16 peter
  1204. * support for array constructors extended and more error checking
  1205. Revision 1.58 1999/08/12 14:34:28 peter
  1206. * tp_procvar mode call->loadn fixed
  1207. Revision 1.57 1999/08/05 16:53:19 peter
  1208. * V_Fatal=1, all other V_ are also increased
  1209. * Check for local procedure when assigning procvar
  1210. * fixed comment parsing because directives
  1211. * oldtp mode directives better supported
  1212. * added some messages to errore.msg
  1213. Revision 1.56 1999/08/04 00:23:34 florian
  1214. * renamed i386asm and i386base to cpuasm and cpubase
  1215. Revision 1.55 1999/08/03 22:03:27 peter
  1216. * moved bitmask constants to sets
  1217. * some other type/const renamings
  1218. Revision 1.54 1999/07/01 21:33:58 peter
  1219. * merged
  1220. Revision 1.53 1999/06/29 14:02:33 peter
  1221. * merged file pos fixes
  1222. Revision 1.52 1999/06/29 12:16:22 pierre
  1223. * mereg from fixes-0_99_12
  1224. Revision 1.51.2.3 1999/07/01 21:32:01 peter
  1225. * procvar fixes again
  1226. }