tccal.pas 53 KB

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