tccal.pas 55 KB

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