defcmp.pas 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Compare definitions and parameter lists
  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 defcmp;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cclasses,
  23. cpuinfo,
  24. globtype,globals,tokens,
  25. node,
  26. symconst,symbase,symtype,symdef;
  27. type
  28. { if acp is cp_all the var const or nothing are considered equal }
  29. compare_type = ( cp_none, cp_value_equal_const, cp_all,cp_procvar);
  30. tconverttype = (
  31. tc_equal,
  32. tc_not_possible,
  33. tc_string_2_string,
  34. tc_char_2_string,
  35. tc_char_2_chararray,
  36. tc_pchar_2_string,
  37. tc_cchar_2_pchar,
  38. tc_cstring_2_pchar,
  39. tc_ansistring_2_pchar,
  40. tc_string_2_chararray,
  41. tc_chararray_2_string,
  42. tc_array_2_pointer,
  43. tc_pointer_2_array,
  44. tc_int_2_int,
  45. tc_int_2_bool,
  46. tc_bool_2_bool,
  47. tc_bool_2_int,
  48. tc_real_2_real,
  49. tc_int_2_real,
  50. tc_real_2_currency,
  51. tc_proc_2_procvar,
  52. tc_arrayconstructor_2_set,
  53. tc_load_smallset,
  54. tc_cord_2_pointer,
  55. tc_intf_2_string,
  56. tc_intf_2_guid,
  57. tc_class_2_intf,
  58. tc_char_2_char,
  59. tc_normal_2_smallset,
  60. tc_dynarray_2_openarray,
  61. tc_pwchar_2_string,
  62. tc_variant_2_dynarray,
  63. tc_dynarray_2_variant
  64. );
  65. function compare_defs_ext(def_from,def_to : tdef;
  66. fromtreetype : tnodetype;
  67. explicit : boolean;
  68. check_operator : boolean;
  69. var doconv : tconverttype;
  70. var operatorpd : tprocdef):tequaltype;
  71. { Returns if the type def_from can be converted to def_to or if both types are equal }
  72. function compare_defs(def_from,def_to:tdef;fromtreetype:tnodetype):tequaltype;
  73. { Returns true, if def1 and def2 are semantically the same }
  74. function equal_defs(def_from,def_to:tdef):boolean;
  75. { Checks for type compatibility (subgroups of type)
  76. used for case statements... probably missing stuff
  77. to use on other types }
  78. function is_subequal(def1, def2: tdef): boolean;
  79. function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
  80. {# true, if two parameter lists are equal
  81. if acp is cp_none, all have to match exactly
  82. if acp is cp_value_equal_const call by value
  83. and call by const parameter are assumed as
  84. equal
  85. allowdefaults indicates if default value parameters
  86. are allowed (in this case, the search order will first
  87. search for a routine with default parameters, before
  88. searching for the same definition with no parameters)
  89. }
  90. function compare_paras(paralist1,paralist2 : TLinkedList; acp : compare_type;allowdefaults,ignorehidden:boolean):tequaltype;
  91. { True if a function can be assigned to a procvar }
  92. { changed first argument type to pabstractprocdef so that it can also be }
  93. { used to test compatibility between two pprocvardefs (JM) }
  94. function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;methoderr:boolean):tequaltype;
  95. implementation
  96. uses
  97. verbose,systems,
  98. symtable,symsym,
  99. defutil,symutil;
  100. function assignment_overloaded(from_def,to_def:tdef):tprocdef;
  101. begin
  102. if assigned(overloaded_operators[_ASSIGNMENT]) then
  103. assignment_overloaded:=overloaded_operators[_ASSIGNMENT].search_procdef_assignment_operator(from_def,to_def)
  104. else
  105. assignment_overloaded:=nil;
  106. end;
  107. function compare_defs_ext(def_from,def_to : tdef;
  108. fromtreetype : tnodetype;
  109. explicit : boolean;
  110. check_operator : boolean;
  111. var doconv : tconverttype;
  112. var operatorpd : tprocdef):tequaltype;
  113. { Tbasetype:
  114. uvoid,
  115. u8bit,u16bit,u32bit,u64bit,
  116. s8bit,s16bit,s32bit,s64bit,
  117. bool8bit,bool16bit,bool32bit,
  118. uchar,uwidechar }
  119. type
  120. tbasedef=(bvoid,bchar,bint,bbool);
  121. const
  122. basedeftbl:array[tbasetype] of tbasedef =
  123. (bvoid,
  124. bint,bint,bint,bint,
  125. bint,bint,bint,bint,
  126. bbool,bbool,bbool,
  127. bchar,bchar,bint);
  128. basedefconvertsimplicit : array[tbasedef,tbasedef] of tconverttype =
  129. { void, char, int, bool }
  130. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  131. (tc_not_possible,tc_char_2_char,tc_not_possible,tc_not_possible),
  132. (tc_not_possible,tc_not_possible,tc_int_2_int,tc_not_possible),
  133. (tc_not_possible,tc_not_possible,tc_not_possible,tc_bool_2_bool));
  134. basedefconvertsexplicit : array[tbasedef,tbasedef] of tconverttype =
  135. { void, char, int, bool }
  136. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  137. (tc_not_possible,tc_char_2_char,tc_int_2_int,tc_int_2_bool),
  138. (tc_not_possible,tc_int_2_int,tc_int_2_int,tc_int_2_bool),
  139. (tc_not_possible,tc_bool_2_int,tc_bool_2_int,tc_bool_2_bool));
  140. var
  141. subeq,eq : tequaltype;
  142. hd1,hd2 : tdef;
  143. hct : tconverttype;
  144. hd3 : tobjectdef;
  145. hpd : tprocdef;
  146. begin
  147. { safety check }
  148. if not(assigned(def_from) and assigned(def_to)) then
  149. begin
  150. compare_defs_ext:=te_incompatible;
  151. exit;
  152. end;
  153. { same def? then we've an exact match }
  154. if def_from=def_to then
  155. begin
  156. compare_defs_ext:=te_exact;
  157. exit;
  158. end;
  159. { we walk the wanted (def_to) types and check then the def_from
  160. types if there is a conversion possible }
  161. eq:=te_incompatible;
  162. doconv:=tc_not_possible;
  163. case def_to.deftype of
  164. orddef :
  165. begin
  166. case def_from.deftype of
  167. orddef :
  168. begin
  169. if (torddef(def_from).typ=torddef(def_to).typ) then
  170. begin
  171. case torddef(def_from).typ of
  172. uchar,uwidechar,
  173. u8bit,u16bit,u32bit,u64bit,
  174. s8bit,s16bit,s32bit,s64bit:
  175. begin
  176. if (torddef(def_from).low=torddef(def_to).low) and
  177. (torddef(def_from).high=torddef(def_to).high) then
  178. eq:=te_equal
  179. else
  180. begin
  181. doconv:=tc_int_2_int;
  182. eq:=te_convert_l1;
  183. end;
  184. end;
  185. uvoid,
  186. bool8bit,bool16bit,bool32bit:
  187. eq:=te_equal;
  188. else
  189. internalerror(200210061);
  190. end;
  191. end
  192. else
  193. begin
  194. if explicit then
  195. doconv:=basedefconvertsexplicit[basedeftbl[torddef(def_from).typ],basedeftbl[torddef(def_to).typ]]
  196. else
  197. doconv:=basedefconvertsimplicit[basedeftbl[torddef(def_from).typ],basedeftbl[torddef(def_to).typ]];
  198. if (doconv=tc_not_possible) then
  199. eq:=te_incompatible
  200. else
  201. { "punish" bad type conversions :) (JM) }
  202. if (not is_in_limit(def_from,def_to)) and
  203. (def_from.size > def_to.size) then
  204. eq:=te_convert_l3
  205. else
  206. eq:=te_convert_l1;
  207. end;
  208. end;
  209. enumdef :
  210. begin
  211. { needed for char(enum) }
  212. if explicit then
  213. begin
  214. doconv:=tc_int_2_int;
  215. eq:=te_convert_l1;
  216. end;
  217. end;
  218. floatdef :
  219. begin
  220. if is_currency(def_to) then
  221. begin
  222. doconv:=tc_real_2_currency;
  223. eq:=te_convert_l2;
  224. end;
  225. end;
  226. classrefdef,
  227. procvardef,
  228. pointerdef :
  229. begin
  230. if explicit then
  231. begin
  232. eq:=te_convert_l1;
  233. if (fromtreetype=niln) then
  234. begin
  235. { will be handled by the constant folding }
  236. doconv:=tc_equal;
  237. end
  238. else
  239. doconv:=tc_int_2_int;
  240. end;
  241. end;
  242. end;
  243. end;
  244. stringdef :
  245. begin
  246. case def_from.deftype of
  247. stringdef :
  248. begin
  249. { Constant string }
  250. if (fromtreetype=stringconstn) then
  251. begin
  252. if (tstringdef(def_from).string_typ=tstringdef(def_to).string_typ) then
  253. eq:=te_equal
  254. else
  255. begin
  256. doconv:=tc_string_2_string;
  257. { Don't prefer conversions from widestring to a
  258. normal string as we can loose information }
  259. if tstringdef(def_from).string_typ=st_widestring then
  260. eq:=te_convert_l1
  261. else
  262. begin
  263. if tstringdef(def_to).string_typ=st_widestring then
  264. eq:=te_convert_l1
  265. else
  266. eq:=te_equal; { we can change the stringconst node }
  267. end;
  268. end;
  269. end
  270. else
  271. { Same string type, for shortstrings also the length must match }
  272. if (tstringdef(def_from).string_typ=tstringdef(def_to).string_typ) and
  273. ((tstringdef(def_from).string_typ<>st_shortstring) or
  274. (tstringdef(def_from).len=tstringdef(def_to).len)) then
  275. eq:=te_equal
  276. else
  277. begin
  278. doconv:=tc_string_2_string;
  279. { Prefer conversions to shortstring over other
  280. conversions. This is compatible with Delphi (PFV) }
  281. if tstringdef(def_to).string_typ=st_shortstring then
  282. eq:=te_convert_l2
  283. else
  284. eq:=te_convert_l3;
  285. end;
  286. end;
  287. orddef :
  288. begin
  289. { char to string}
  290. if is_char(def_from) or
  291. is_widechar(def_from) then
  292. begin
  293. doconv:=tc_char_2_string;
  294. eq:=te_convert_l1;
  295. end;
  296. end;
  297. arraydef :
  298. begin
  299. { array of char to string, the length check is done by the firstpass of this node }
  300. if is_chararray(def_from) or
  301. (is_char(tarraydef(def_from).elementtype.def) and
  302. is_open_array(def_from)) then
  303. begin
  304. doconv:=tc_chararray_2_string;
  305. if is_open_array(def_from) or
  306. (is_shortstring(def_to) and
  307. (def_from.size <= 255)) or
  308. (is_ansistring(def_to) and
  309. (def_from.size > 255)) then
  310. eq:=te_convert_l1
  311. else
  312. eq:=te_convert_l2;
  313. end;
  314. end;
  315. pointerdef :
  316. begin
  317. { pchar can be assigned to short/ansistrings,
  318. but not in tp7 compatible mode }
  319. if not(m_tp7 in aktmodeswitches) then
  320. begin
  321. if is_pchar(def_from) then
  322. begin
  323. doconv:=tc_pchar_2_string;
  324. { prefer ansistrings because pchars can overflow shortstrings, }
  325. { but only if ansistrings are the default (JM) }
  326. if (is_shortstring(def_to) and
  327. not(cs_ansistrings in aktlocalswitches)) or
  328. (is_ansistring(def_to) and
  329. (cs_ansistrings in aktlocalswitches)) then
  330. eq:=te_convert_l1
  331. else
  332. eq:=te_convert_l2;
  333. end
  334. else if is_pwidechar(def_from) then
  335. begin
  336. doconv:=tc_pwchar_2_string;
  337. { prefer ansistrings because pchars can overflow shortstrings, }
  338. { but only if ansistrings are the default (JM) }
  339. if is_widestring(def_to) then
  340. eq:=te_convert_l1
  341. else
  342. eq:=te_convert_l3;
  343. end;
  344. end;
  345. end;
  346. end;
  347. end;
  348. floatdef :
  349. begin
  350. case def_from.deftype of
  351. orddef :
  352. begin { ordinal to real }
  353. if is_integer(def_from) or
  354. is_currency(def_from) then
  355. begin
  356. doconv:=tc_int_2_real;
  357. eq:=te_convert_l1;
  358. end;
  359. end;
  360. floatdef :
  361. begin
  362. if tfloatdef(def_from).typ=tfloatdef(def_to).typ then
  363. eq:=te_equal
  364. else
  365. begin
  366. doconv:=tc_real_2_real;
  367. eq:=te_convert_l1;
  368. end;
  369. end;
  370. end;
  371. end;
  372. enumdef :
  373. begin
  374. case def_from.deftype of
  375. enumdef :
  376. begin
  377. if explicit then
  378. begin
  379. eq:=te_convert_l1;
  380. doconv:=tc_int_2_int;
  381. end
  382. else
  383. begin
  384. hd1:=def_from;
  385. while assigned(tenumdef(hd1).basedef) do
  386. hd1:=tenumdef(hd1).basedef;
  387. hd2:=def_to;
  388. while assigned(tenumdef(hd2).basedef) do
  389. hd2:=tenumdef(hd2).basedef;
  390. if (hd1=hd2) then
  391. begin
  392. eq:=te_convert_l1;
  393. { because of packenum they can have different sizes! (JM) }
  394. doconv:=tc_int_2_int;
  395. end;
  396. end;
  397. end;
  398. orddef :
  399. begin
  400. if explicit then
  401. begin
  402. eq:=te_convert_l1;
  403. doconv:=tc_int_2_int;
  404. end;
  405. end;
  406. end;
  407. end;
  408. arraydef :
  409. begin
  410. { open array is also compatible with a single element of its base type }
  411. if is_open_array(def_to) and
  412. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  413. begin
  414. doconv:=tc_equal;
  415. eq:=te_convert_l1;
  416. end
  417. else
  418. begin
  419. case def_from.deftype of
  420. arraydef :
  421. begin
  422. { to dynamic array }
  423. if is_dynamic_array(def_to) then
  424. begin
  425. { dynamic array -> dynamic array }
  426. if is_dynamic_array(def_from) and
  427. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  428. eq:=te_equal;
  429. end
  430. else
  431. { to open array }
  432. if is_open_array(def_to) then
  433. begin
  434. { array constructor -> open array }
  435. if is_array_constructor(def_from) then
  436. begin
  437. if is_void(tarraydef(def_from).elementtype.def) then
  438. begin
  439. doconv:=tc_equal;
  440. eq:=te_convert_l1;
  441. end
  442. else
  443. begin
  444. subeq:=compare_defs_ext(tarraydef(def_from).elementtype.def,
  445. tarraydef(def_to).elementtype.def,
  446. arrayconstructorn,false,true,hct,hpd);
  447. if (subeq>=te_equal) then
  448. begin
  449. doconv:=tc_equal;
  450. eq:=te_convert_l1;
  451. end
  452. else
  453. if (subeq>te_incompatible) then
  454. begin
  455. doconv:=hct;
  456. eq:=te_convert_l2;
  457. end;
  458. end;
  459. end
  460. else
  461. { dynamic array -> open array }
  462. if is_dynamic_array(def_from) and
  463. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  464. begin
  465. doconv:=tc_dynarray_2_openarray;
  466. eq:=te_convert_l2;
  467. end
  468. else
  469. { array -> open array }
  470. if equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  471. eq:=te_equal;
  472. end
  473. else
  474. { to array of const }
  475. if is_array_of_const(def_to) then
  476. begin
  477. if is_array_of_const(def_from) or
  478. is_array_constructor(def_from) then
  479. begin
  480. eq:=te_equal;
  481. end
  482. else
  483. { array of tvarrec -> array of const }
  484. if equal_defs(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
  485. begin
  486. doconv:=tc_equal;
  487. eq:=te_convert_l1;
  488. end;
  489. end
  490. else
  491. { other arrays }
  492. begin
  493. { open array -> array }
  494. if is_open_array(def_from) and
  495. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  496. begin
  497. eq:=te_equal
  498. end
  499. else
  500. { array -> array }
  501. if not(m_tp7 in aktmodeswitches) and
  502. not(m_delphi in aktmodeswitches) and
  503. (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
  504. (tarraydef(def_from).highrange=tarraydef(def_to).highrange) and
  505. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) and
  506. equal_defs(tarraydef(def_from).rangetype.def,tarraydef(def_to).rangetype.def) then
  507. begin
  508. eq:=te_equal
  509. end;
  510. end;
  511. end;
  512. pointerdef :
  513. begin
  514. { nil is compatible with dyn. arrays }
  515. if is_dynamic_array(def_to) and
  516. (fromtreetype=niln) then
  517. begin
  518. doconv:=tc_equal;
  519. eq:=te_convert_l1;
  520. end
  521. else
  522. if is_zero_based_array(def_to) and
  523. equal_defs(tpointerdef(def_from).pointertype.def,tarraydef(def_to).elementtype.def) then
  524. begin
  525. doconv:=tc_pointer_2_array;
  526. eq:=te_convert_l1;
  527. end;
  528. end;
  529. stringdef :
  530. begin
  531. { string to char array }
  532. if (not is_special_array(def_to)) and
  533. is_char(tarraydef(def_to).elementtype.def) then
  534. begin
  535. doconv:=tc_string_2_chararray;
  536. eq:=te_convert_l1;
  537. end;
  538. end;
  539. orddef:
  540. begin
  541. if is_chararray(def_to) and
  542. is_char(def_from) then
  543. begin
  544. doconv:=tc_char_2_chararray;
  545. eq:=te_convert_l2;
  546. end;
  547. end;
  548. recorddef :
  549. begin
  550. { tvarrec -> array of const }
  551. if is_array_of_const(def_to) and
  552. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  553. begin
  554. doconv:=tc_equal;
  555. eq:=te_convert_l1;
  556. end;
  557. end;
  558. variantdef :
  559. begin
  560. if is_dynamic_array(def_to) then
  561. begin
  562. doconv:=tc_variant_2_dynarray;
  563. eq:=te_convert_l1;
  564. end;
  565. end;
  566. end;
  567. end;
  568. end;
  569. pointerdef :
  570. begin
  571. case def_from.deftype of
  572. stringdef :
  573. begin
  574. { string constant (which can be part of array constructor)
  575. to zero terminated string constant }
  576. if (fromtreetype in [arrayconstructorn,stringconstn]) and
  577. (is_pchar(def_to) or is_pwidechar(def_to)) then
  578. begin
  579. doconv:=tc_cstring_2_pchar;
  580. eq:=te_convert_l1;
  581. end
  582. else
  583. if explicit then
  584. begin
  585. { pchar(ansistring) }
  586. if is_pchar(def_to) and
  587. is_ansistring(def_from) then
  588. begin
  589. doconv:=tc_ansistring_2_pchar;
  590. eq:=te_convert_l1;
  591. end
  592. else
  593. { pwidechar(ansistring) }
  594. if is_pwidechar(def_to) and
  595. is_widestring(def_from) then
  596. begin
  597. doconv:=tc_ansistring_2_pchar;
  598. eq:=te_convert_l1;
  599. end;
  600. end;
  601. end;
  602. orddef :
  603. begin
  604. { char constant to zero terminated string constant }
  605. if (fromtreetype=ordconstn) then
  606. begin
  607. if is_char(def_from) and
  608. is_pchar(def_to) then
  609. begin
  610. doconv:=tc_cchar_2_pchar;
  611. eq:=te_convert_l1;
  612. end
  613. else
  614. if is_integer(def_from) then
  615. begin
  616. doconv:=tc_cord_2_pointer;
  617. eq:=te_convert_l1;
  618. end;
  619. end;
  620. if (eq=te_incompatible) and
  621. explicit then
  622. begin
  623. doconv:=tc_int_2_int;
  624. eq:=te_convert_l1;
  625. end;
  626. end;
  627. arraydef :
  628. begin
  629. { chararray to pointer }
  630. if is_zero_based_array(def_from) and
  631. equal_defs(tarraydef(def_from).elementtype.def,tpointerdef(def_to).pointertype.def) then
  632. begin
  633. doconv:=tc_array_2_pointer;
  634. eq:=te_convert_l1;
  635. end;
  636. end;
  637. pointerdef :
  638. begin
  639. { check for far pointers }
  640. if (tpointerdef(def_from).is_far<>tpointerdef(def_to).is_far) then
  641. begin
  642. eq:=te_incompatible;
  643. end
  644. else
  645. { the types can be forward type, handle before normal type check !! }
  646. if assigned(def_to.typesym) and
  647. (tpointerdef(def_to).pointertype.def.deftype=forwarddef) then
  648. begin
  649. if (def_from.typesym=def_to.typesym) then
  650. eq:=te_equal
  651. end
  652. else
  653. { same types }
  654. if (tpointerdef(def_from).pointertype.def=tpointerdef(def_to).pointertype.def) then
  655. begin
  656. eq:=te_equal
  657. end
  658. else
  659. { child class pointer can be assigned to anchestor pointers }
  660. if (
  661. (tpointerdef(def_from).pointertype.def.deftype=objectdef) and
  662. (tpointerdef(def_to).pointertype.def.deftype=objectdef) and
  663. tobjectdef(tpointerdef(def_from).pointertype.def).is_related(
  664. tobjectdef(tpointerdef(def_to).pointertype.def))
  665. ) or
  666. { all pointers can be assigned to/from void-pointer }
  667. is_void(tpointerdef(def_to).pointertype.def) or
  668. is_void(tpointerdef(def_from).pointertype.def) then
  669. begin
  670. doconv:=tc_equal;
  671. { give pwidechar a penalty }
  672. if is_pwidechar(def_to) then
  673. eq:=te_convert_l2
  674. else
  675. eq:=te_convert_l1;
  676. end;
  677. end;
  678. procvardef :
  679. begin
  680. { procedure variable can be assigned to an void pointer }
  681. { Not anymore. Use the @ operator now.}
  682. if not(m_tp_procvar in aktmodeswitches) and
  683. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  684. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  685. begin
  686. doconv:=tc_equal;
  687. eq:=te_convert_l1;
  688. end;
  689. end;
  690. classrefdef,
  691. objectdef :
  692. begin
  693. { class types and class reference type
  694. can be assigned to void pointers }
  695. if (
  696. is_class_or_interface(def_from) or
  697. (def_from.deftype=classrefdef)
  698. ) and
  699. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  700. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  701. begin
  702. doconv:=tc_equal;
  703. eq:=te_convert_l1;
  704. end;
  705. end;
  706. end;
  707. end;
  708. setdef :
  709. begin
  710. case def_from.deftype of
  711. setdef :
  712. begin
  713. if assigned(tsetdef(def_from).elementtype.def) and
  714. assigned(tsetdef(def_to).elementtype.def) then
  715. begin
  716. { sets with the same element base type are equal }
  717. if is_subequal(tsetdef(def_from).elementtype.def,tsetdef(def_to).elementtype.def) then
  718. eq:=te_equal;
  719. end
  720. else
  721. { empty set is compatible with everything }
  722. eq:=te_equal;
  723. end;
  724. arraydef :
  725. begin
  726. { automatic arrayconstructor -> set conversion }
  727. if is_array_constructor(def_from) then
  728. begin
  729. doconv:=tc_arrayconstructor_2_set;
  730. eq:=te_convert_l1;
  731. end;
  732. end;
  733. end;
  734. end;
  735. procvardef :
  736. begin
  737. case def_from.deftype of
  738. procdef :
  739. begin
  740. { proc -> procvar }
  741. if (m_tp_procvar in aktmodeswitches) then
  742. begin
  743. subeq:=proc_to_procvar_equal(tprocdef(def_from),tprocvardef(def_to),true);
  744. if subeq>te_incompatible then
  745. begin
  746. doconv:=tc_proc_2_procvar;
  747. eq:=te_convert_l1;
  748. end;
  749. end;
  750. end;
  751. procvardef :
  752. begin
  753. { procvar -> procvar }
  754. eq:=proc_to_procvar_equal(tprocvardef(def_from),tprocvardef(def_to),true);
  755. end;
  756. pointerdef :
  757. begin
  758. { nil is compatible with procvars }
  759. if (fromtreetype=niln) then
  760. begin
  761. doconv:=tc_equal;
  762. eq:=te_convert_l1;
  763. end
  764. else
  765. { for example delphi allows the assignement from pointers }
  766. { to procedure variables }
  767. if (m_pointer_2_procedure in aktmodeswitches) and
  768. (tpointerdef(def_from).pointertype.def.deftype=orddef) and
  769. (torddef(tpointerdef(def_from).pointertype.def).typ=uvoid) then
  770. begin
  771. doconv:=tc_equal;
  772. eq:=te_convert_l1;
  773. end;
  774. end;
  775. end;
  776. end;
  777. objectdef :
  778. begin
  779. { object pascal objects }
  780. if (def_from.deftype=objectdef) and
  781. (tobjectdef(def_from).is_related(tobjectdef(def_to)) or
  782. tobjectdef(def_to).is_related(tobjectdef(def_from))) then
  783. begin
  784. doconv:=tc_equal;
  785. eq:=te_convert_l1;
  786. end
  787. else
  788. { Class/interface specific }
  789. if is_class_or_interface(def_to) then
  790. begin
  791. { void pointer also for delphi mode }
  792. if (m_delphi in aktmodeswitches) and
  793. is_voidpointer(def_from) then
  794. begin
  795. doconv:=tc_equal;
  796. eq:=te_convert_l1;
  797. end
  798. else
  799. { nil is compatible with class instances and interfaces }
  800. if (fromtreetype=niln) then
  801. begin
  802. doconv:=tc_equal;
  803. eq:=te_convert_l1;
  804. end
  805. { classes can be assigned to interfaces }
  806. else if is_interface(def_to) and
  807. is_class(def_from) and
  808. assigned(tobjectdef(def_from).implementedinterfaces) then
  809. begin
  810. { we've to search in parent classes as well }
  811. hd3:=tobjectdef(def_from);
  812. while assigned(hd3) do
  813. begin
  814. if hd3.implementedinterfaces.searchintf(def_to)<>-1 then
  815. begin
  816. doconv:=tc_class_2_intf;
  817. eq:=te_convert_l1;
  818. break;
  819. end;
  820. hd3:=hd3.childof;
  821. end;
  822. end
  823. { Interface 2 GUID handling }
  824. else if (def_to=tdef(rec_tguid)) and
  825. (fromtreetype=typen) and
  826. is_interface(def_from) and
  827. assigned(tobjectdef(def_from).iidguid) then
  828. begin
  829. eq:=te_convert_l1;
  830. doconv:=tc_equal;
  831. end;
  832. end;
  833. end;
  834. classrefdef :
  835. begin
  836. { similar to pointerdef wrt forwards }
  837. if assigned(def_to.typesym) and
  838. (tclassrefdef(def_to).pointertype.def.deftype=forwarddef) then
  839. begin
  840. if (def_from.typesym=def_to.typesym) then
  841. eq:=te_equal;
  842. end
  843. else
  844. { class reference types }
  845. if (def_from.deftype=classrefdef) then
  846. begin
  847. if equal_defs(tclassrefdef(def_from).pointertype.def,tclassrefdef(def_to).pointertype.def) then
  848. begin
  849. eq:=te_equal;
  850. end
  851. else
  852. begin
  853. doconv:=tc_equal;
  854. if explicit or
  855. tobjectdef(tclassrefdef(def_from).pointertype.def).is_related(
  856. tobjectdef(tclassrefdef(def_to).pointertype.def)) then
  857. eq:=te_convert_l1;
  858. end;
  859. end
  860. else
  861. { nil is compatible with class references }
  862. if (fromtreetype=niln) then
  863. begin
  864. doconv:=tc_equal;
  865. eq:=te_convert_l1;
  866. end;
  867. end;
  868. filedef :
  869. begin
  870. { typed files are all equal to the abstract file type
  871. name TYPEDFILE in system.pp in is_equal in types.pas
  872. the problem is that it sholud be also compatible to FILE
  873. but this would leed to a problem for ASSIGN RESET and REWRITE
  874. when trying to find the good overloaded function !!
  875. so all file function are doubled in system.pp
  876. this is not very beautiful !!}
  877. if (def_from.deftype=filedef) then
  878. begin
  879. if (tfiledef(def_from).filetyp=tfiledef(def_to).filetyp) then
  880. begin
  881. if
  882. (
  883. (tfiledef(def_from).typedfiletype.def=nil) and
  884. (tfiledef(def_to).typedfiletype.def=nil)
  885. ) or
  886. (
  887. (tfiledef(def_from).typedfiletype.def<>nil) and
  888. (tfiledef(def_to).typedfiletype.def<>nil) and
  889. equal_defs(tfiledef(def_from).typedfiletype.def,tfiledef(def_to).typedfiletype.def)
  890. ) or
  891. (
  892. (tfiledef(def_from).filetyp = ft_typed) and
  893. (tfiledef(def_to).filetyp = ft_typed) and
  894. (
  895. (tfiledef(def_from).typedfiletype.def = tdef(voidtype.def)) or
  896. (tfiledef(def_to).typedfiletype.def = tdef(voidtype.def))
  897. )
  898. ) then
  899. begin
  900. eq:=te_equal;
  901. end;
  902. end
  903. else
  904. if ((tfiledef(def_from).filetyp = ft_untyped) and
  905. (tfiledef(def_to).filetyp = ft_typed)) or
  906. ((tfiledef(def_from).filetyp = ft_typed) and
  907. (tfiledef(def_to).filetyp = ft_untyped)) then
  908. begin
  909. doconv:=tc_equal;
  910. eq:=te_convert_l1;
  911. end;
  912. end;
  913. end;
  914. recorddef :
  915. begin
  916. { interface -> guid }
  917. if is_interface(def_from) and
  918. (def_to=rec_tguid) then
  919. begin
  920. doconv:=tc_intf_2_guid;
  921. eq:=te_convert_l1;
  922. end;
  923. end;
  924. formaldef :
  925. begin
  926. doconv:=tc_equal;
  927. if (def_from.deftype=formaldef) then
  928. eq:=te_equal
  929. else
  930. { Just about everything can be converted to a formaldef...}
  931. if not (def_from.deftype in [abstractdef,errordef]) then
  932. eq:=te_convert_l1;
  933. end;
  934. end;
  935. { if we didn't find an appropriate type conversion yet and
  936. there is a variant involved then we search also the := operator }
  937. if (eq=te_incompatible) and
  938. check_operator and
  939. ((def_from.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef]) or
  940. (def_to.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef])) then
  941. begin
  942. operatorpd:=assignment_overloaded(def_from,def_to);
  943. if assigned(operatorpd) then
  944. eq:=te_convert_operator;
  945. end;
  946. { update convtype for te_equal when it is not yet set }
  947. if (eq=te_equal) and
  948. (doconv=tc_not_possible) then
  949. doconv:=tc_equal;
  950. compare_defs_ext:=eq;
  951. end;
  952. function equal_defs(def_from,def_to:tdef):boolean;
  953. var
  954. convtyp : tconverttype;
  955. pd : tprocdef;
  956. begin
  957. { Compare defs with nothingn and no explicit typecasts and
  958. searching for overloaded operators is not needed }
  959. equal_defs:=(compare_defs_ext(def_from,def_to,nothingn,false,false,convtyp,pd)>=te_equal);
  960. end;
  961. function compare_defs(def_from,def_to:tdef;fromtreetype:tnodetype):tequaltype;
  962. var
  963. doconv : tconverttype;
  964. pd : tprocdef;
  965. begin
  966. compare_defs:=compare_defs_ext(def_from,def_to,fromtreetype,false,true,doconv,pd);
  967. end;
  968. function is_subequal(def1, def2: tdef): boolean;
  969. var
  970. basedef1,basedef2 : tenumdef;
  971. Begin
  972. is_subequal := false;
  973. if assigned(def1) and assigned(def2) then
  974. Begin
  975. if (def1.deftype = orddef) and (def2.deftype = orddef) then
  976. Begin
  977. { see p.47 of Turbo Pascal 7.01 manual for the separation of types }
  978. { range checking for case statements is done with testrange }
  979. case torddef(def1).typ of
  980. u8bit,u16bit,u32bit,u64bit,
  981. s8bit,s16bit,s32bit,s64bit :
  982. is_subequal:=(torddef(def2).typ in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
  983. bool8bit,bool16bit,bool32bit :
  984. is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit]);
  985. uchar :
  986. is_subequal:=(torddef(def2).typ=uchar);
  987. uwidechar :
  988. is_subequal:=(torddef(def2).typ=uwidechar);
  989. end;
  990. end
  991. else
  992. Begin
  993. { Check if both basedefs are equal }
  994. if (def1.deftype=enumdef) and (def2.deftype=enumdef) then
  995. Begin
  996. { get both basedefs }
  997. basedef1:=tenumdef(def1);
  998. while assigned(basedef1.basedef) do
  999. basedef1:=basedef1.basedef;
  1000. basedef2:=tenumdef(def2);
  1001. while assigned(basedef2.basedef) do
  1002. basedef2:=basedef2.basedef;
  1003. is_subequal:=(basedef1=basedef2);
  1004. end;
  1005. end;
  1006. end;
  1007. end;
  1008. function compare_paras(paralist1,paralist2 : TLinkedList; acp : compare_type;allowdefaults,ignorehidden:boolean):tequaltype;
  1009. var
  1010. currpara1,
  1011. currpara2 : TParaItem;
  1012. eq,lowesteq : tequaltype;
  1013. hpd : tprocdef;
  1014. convtype : tconverttype;
  1015. begin
  1016. compare_paras:=te_incompatible;
  1017. { we need to parse the list from left-right so the
  1018. not-default parameters are checked first }
  1019. lowesteq:=high(tequaltype);
  1020. currpara1:=TParaItem(paralist1.first);
  1021. currpara2:=TParaItem(paralist2.first);
  1022. if ignorehidden then
  1023. begin
  1024. while assigned(currpara1) and currpara1.is_hidden do
  1025. currpara1:=tparaitem(currpara1.next);
  1026. while assigned(currpara2) and currpara2.is_hidden do
  1027. currpara2:=tparaitem(currpara2.next);
  1028. end;
  1029. while (assigned(currpara1)) and (assigned(currpara2)) do
  1030. begin
  1031. eq:=te_incompatible;
  1032. { Unique types must match exact }
  1033. if ((df_unique in currpara1.paratype.def.defoptions) or (df_unique in currpara2.paratype.def.defoptions)) and
  1034. (currpara1.paratype.def<>currpara2.paratype.def) then
  1035. exit;
  1036. { Handle hidden parameters separately, because self is
  1037. defined as voidpointer for methodpointers }
  1038. if (currpara1.is_hidden or
  1039. currpara2.is_hidden) then
  1040. begin
  1041. { both must be hidden }
  1042. if currpara1.is_hidden<>currpara2.is_hidden then
  1043. exit;
  1044. eq:=te_equal;
  1045. if not(vo_is_self in tvarsym(currpara1.parasym).varoptions) and
  1046. not(vo_is_self in tvarsym(currpara2.parasym).varoptions) then
  1047. begin
  1048. if (currpara1.paratyp<>currpara2.paratyp) then
  1049. exit;
  1050. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1051. end;
  1052. end
  1053. else
  1054. begin
  1055. case acp of
  1056. cp_value_equal_const :
  1057. begin
  1058. if (
  1059. (currpara1.paratyp<>currpara2.paratyp) and
  1060. ((currpara1.paratyp in [vs_var,vs_out]) or
  1061. (currpara2.paratyp in [vs_var,vs_out]))
  1062. ) then
  1063. exit;
  1064. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1065. end;
  1066. cp_all :
  1067. begin
  1068. if (currpara1.paratyp<>currpara2.paratyp) then
  1069. exit;
  1070. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1071. end;
  1072. cp_procvar :
  1073. begin
  1074. if (currpara1.paratyp<>currpara2.paratyp) then
  1075. exit;
  1076. eq:=compare_defs_ext(currpara1.paratype.def,currpara2.paratype.def,nothingn,
  1077. false,true,convtype,hpd);
  1078. if (eq>te_incompatible) and
  1079. (eq<te_equal) and
  1080. not(
  1081. (convtype in [tc_equal,tc_int_2_int]) and
  1082. (currpara1.paratype.def.size=currpara2.paratype.def.size)
  1083. ) then
  1084. begin
  1085. eq:=te_incompatible;
  1086. end;
  1087. end;
  1088. else
  1089. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1090. end;
  1091. end;
  1092. { check type }
  1093. if eq=te_incompatible then
  1094. exit;
  1095. if eq<lowesteq then
  1096. lowesteq:=eq;
  1097. { also check default value if both have it declared }
  1098. if assigned(currpara1.defaultvalue) and
  1099. assigned(currpara2.defaultvalue) then
  1100. begin
  1101. if not equal_constsym(tconstsym(currpara1.defaultvalue),tconstsym(currpara2.defaultvalue)) then
  1102. exit;
  1103. end;
  1104. currpara1:=TParaItem(currpara1.next);
  1105. currpara2:=TParaItem(currpara2.next);
  1106. if ignorehidden then
  1107. begin
  1108. while assigned(currpara1) and currpara1.is_hidden do
  1109. currpara1:=tparaitem(currpara1.next);
  1110. while assigned(currpara2) and currpara2.is_hidden do
  1111. currpara2:=tparaitem(currpara2.next);
  1112. end;
  1113. end;
  1114. { when both lists are empty then the parameters are equal. Also
  1115. when one list is empty and the other has a parameter with default
  1116. value assigned then the parameters are also equal }
  1117. if ((currpara1=nil) and (currpara2=nil)) or
  1118. (allowdefaults and
  1119. ((assigned(currpara1) and assigned(currpara1.defaultvalue)) or
  1120. (assigned(currpara2) and assigned(currpara2.defaultvalue)))) then
  1121. compare_paras:=lowesteq;
  1122. end;
  1123. function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;methoderr:boolean):tequaltype;
  1124. var
  1125. eq : tequaltype;
  1126. po_comp : tprocoptions;
  1127. begin
  1128. proc_to_procvar_equal:=te_incompatible;
  1129. if not(assigned(def1)) or not(assigned(def2)) then
  1130. exit;
  1131. { check for method pointer }
  1132. if (def1.is_methodpointer xor def2.is_methodpointer) or
  1133. (def1.is_addressonly xor def2.is_addressonly) then
  1134. begin
  1135. if methoderr then
  1136. Message(type_e_no_method_and_procedure_not_compatible);
  1137. exit;
  1138. end;
  1139. { check return value and options, methodpointer is already checked }
  1140. po_comp:=[po_staticmethod,po_interrupt,
  1141. po_iocheck,po_varargs];
  1142. if (m_delphi in aktmodeswitches) then
  1143. exclude(po_comp,po_varargs);
  1144. if ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) and
  1145. equal_defs(def1.rettype.def,def2.rettype.def) then
  1146. begin
  1147. { return equal type based on the parameters, but a proc->procvar
  1148. is never exact, so map an exact match of the parameters to
  1149. te_equal }
  1150. eq:=compare_paras(def1.para,def2.para,cp_procvar,false,false);
  1151. if eq=te_exact then
  1152. eq:=te_equal;
  1153. proc_to_procvar_equal:=eq;
  1154. end;
  1155. end;
  1156. end.
  1157. {
  1158. $Log$
  1159. Revision 1.32 2003-10-10 17:48:13 peter
  1160. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1161. * tregisteralloctor renamed to trgobj
  1162. * removed rgobj from a lot of units
  1163. * moved location_* and reference_* to cgobj
  1164. * first things for mmx register allocation
  1165. Revision 1.31 2003/10/07 21:14:32 peter
  1166. * compare_paras() has a parameter to ignore hidden parameters
  1167. * cross unit overload searching ignores hidden parameters when
  1168. comparing parameter lists. Now function(string):string is
  1169. not overriden with procedure(string) which has the same visible
  1170. parameter list
  1171. Revision 1.30 2003/10/05 13:05:05 peter
  1172. * when comparing hidden parameters both must be hidden
  1173. Revision 1.29 2003/10/05 12:57:11 peter
  1174. * set correct conversion for subranges
  1175. Revision 1.28 2003/09/09 21:03:17 peter
  1176. * basics for x86 register calling
  1177. Revision 1.27 2003/06/03 21:02:08 peter
  1178. * allow pointer(int64) in all modes
  1179. Revision 1.26 2003/05/26 21:17:17 peter
  1180. * procinlinenode removed
  1181. * aktexit2label removed, fast exit removed
  1182. + tcallnode.inlined_pass_2 added
  1183. Revision 1.25 2003/05/15 18:58:53 peter
  1184. * removed selfpointer_offset, vmtpointer_offset
  1185. * tvarsym.adjusted_address
  1186. * address in localsymtable is now in the real direction
  1187. * removed some obsolete globals
  1188. Revision 1.24 2003/05/09 17:47:02 peter
  1189. * self moved to hidden parameter
  1190. * removed hdisposen,hnewn,selfn
  1191. Revision 1.23 2003/04/23 20:16:04 peter
  1192. + added currency support based on int64
  1193. + is_64bit for use in cg units instead of is_64bitint
  1194. * removed cgmessage from n386add, replace with internalerrors
  1195. Revision 1.22 2003/04/23 11:37:33 peter
  1196. * po_comp for proc to procvar fixed
  1197. Revision 1.21 2003/04/10 17:57:52 peter
  1198. * vs_hidden released
  1199. Revision 1.20 2003/03/20 17:52:18 peter
  1200. * fix compare for unique types, they are allowed when they match
  1201. exact
  1202. Revision 1.19 2003/01/16 22:13:51 peter
  1203. * convert_l3 convertlevel added. This level is used for conversions
  1204. where information can be lost like converting widestring->ansistring
  1205. or dword->byte
  1206. Revision 1.18 2003/01/15 01:44:32 peter
  1207. * merged methodpointer fixes from 1.0.x
  1208. Revision 1.17 2003/01/09 21:43:39 peter
  1209. * constant string conversion fixed, it's now equal to both
  1210. shortstring, ansistring and the typeconvnode will return
  1211. te_equal but still return convtype to change the constnode
  1212. Revision 1.16 2003/01/05 22:42:13 peter
  1213. * use int_to_int conversion for pointer/procvar/classref to int
  1214. Revision 1.15 2003/01/05 15:54:15 florian
  1215. + added proper support of type = type <type>; for simple types
  1216. Revision 1.14 2003/01/03 17:16:04 peter
  1217. * fixed assignment operator checking for typecast
  1218. Revision 1.13 2002/12/29 18:15:19 peter
  1219. * varargs is not checked in proc->procvar for delphi
  1220. Revision 1.12 2002/12/29 14:57:50 peter
  1221. * unit loading changed to first register units and load them
  1222. afterwards. This is needed to support uses xxx in yyy correctly
  1223. * unit dependency check fixed
  1224. Revision 1.11 2002/12/27 15:26:12 peter
  1225. * procvar compare with 2 ints did not check the integer size
  1226. Revision 1.10 2002/12/23 22:22:16 peter
  1227. * don't allow implicit bool->int conversion
  1228. Revision 1.9 2002/12/18 21:37:36 peter
  1229. * allow classref-classref always when explicit
  1230. Revision 1.8 2002/12/15 22:37:53 peter
  1231. * give conversions from pointer to pwidechar a penalty (=prefer pchar)
  1232. Revision 1.7 2002/12/11 22:40:12 peter
  1233. * proc->procvar is never an exact match, convert exact parameters
  1234. to equal for the whole proc to procvar conversion level
  1235. Revision 1.6 2002/12/06 17:49:44 peter
  1236. * prefer string-shortstring over other string-string conversions
  1237. Revision 1.5 2002/12/05 14:27:26 florian
  1238. * some variant <-> dyn. array stuff
  1239. Revision 1.4 2002/12/01 22:07:41 carl
  1240. * warning of portabilitiy problems with parasize / localsize
  1241. + some added documentation
  1242. Revision 1.3 2002/11/27 15:33:46 peter
  1243. * the never ending story of tp procvar hacks
  1244. Revision 1.2 2002/11/27 02:32:14 peter
  1245. * fix cp_procvar compare
  1246. Revision 1.1 2002/11/25 17:43:16 peter
  1247. * splitted defbase in defutil,symutil,defcmp
  1248. * merged isconvertable and is_equal into compare_defs(_ext)
  1249. * made operator search faster by walking the list only once
  1250. }