defcmp.pas 54 KB

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