types.pas 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 by Florian Klaempfl
  4. This unit provides some help routines for type handling
  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 types;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cclasses,
  23. cpuinfo,
  24. node,
  25. symbase,symtype,symdef,symsym;
  26. type
  27. tmmxtype = (mmxno,mmxu8bit,mmxs8bit,mmxu16bit,mmxs16bit,
  28. mmxu32bit,mmxs32bit,mmxfixed16,mmxsingle);
  29. const
  30. { true if we must never copy this parameter }
  31. never_copy_const_param : boolean = false;
  32. {*****************************************************************************
  33. Basic type functions
  34. *****************************************************************************}
  35. { returns true, if def defines an ordinal type }
  36. function is_ordinal(def : tdef) : boolean;
  37. { returns the min. value of the type }
  38. function get_min_value(def : tdef) : longint;
  39. { returns true, if def defines an ordinal type }
  40. function is_integer(def : tdef) : boolean;
  41. { true if p is a boolean }
  42. function is_boolean(def : tdef) : boolean;
  43. { true if p is a char }
  44. function is_char(def : tdef) : boolean;
  45. { true if p is a widechar }
  46. function is_widechar(def : tdef) : boolean;
  47. { true if p is a void}
  48. function is_void(def : tdef) : boolean;
  49. { true if p is a smallset def }
  50. function is_smallset(p : tdef) : boolean;
  51. { returns true, if def defines a signed data type (only for ordinal types) }
  52. function is_signed(def : tdef) : boolean;
  53. {*****************************************************************************
  54. Array helper functions
  55. *****************************************************************************}
  56. { true, if p points to a zero based (non special like open or
  57. dynamic array def, mainly this is used to see if the array
  58. is convertable to a pointer }
  59. function is_zero_based_array(p : tdef) : boolean;
  60. { true if p points to an open array def }
  61. function is_open_array(p : tdef) : boolean;
  62. { true if p points to a dynamic array def }
  63. function is_dynamic_array(p : tdef) : boolean;
  64. { true, if p points to an array of const def }
  65. function is_array_constructor(p : tdef) : boolean;
  66. { true, if p points to a variant array }
  67. function is_variant_array(p : tdef) : boolean;
  68. { true, if p points to an array of const }
  69. function is_array_of_const(p : tdef) : boolean;
  70. { true, if p points any kind of special array }
  71. function is_special_array(p : tdef) : boolean;
  72. { true if p is a char array def }
  73. function is_chararray(p : tdef) : boolean;
  74. { true if p is a wide char array def }
  75. function is_widechararray(p : tdef) : boolean;
  76. {*****************************************************************************
  77. String helper functions
  78. *****************************************************************************}
  79. { true if p points to an open string def }
  80. function is_open_string(p : tdef) : boolean;
  81. { true if p is an ansi string def }
  82. function is_ansistring(p : tdef) : boolean;
  83. { true if p is a long string def }
  84. function is_longstring(p : tdef) : boolean;
  85. { true if p is a wide string def }
  86. function is_widestring(p : tdef) : boolean;
  87. { true if p is a short string def }
  88. function is_shortstring(p : tdef) : boolean;
  89. { true if p is a pchar def }
  90. function is_pchar(p : tdef) : boolean;
  91. { true if p is a pwidechar def }
  92. function is_pwidechar(p : tdef) : boolean;
  93. { true if p is a voidpointer def }
  94. function is_voidpointer(p : tdef) : boolean;
  95. { returns true, if def uses FPU }
  96. function is_fpu(def : tdef) : boolean;
  97. { true if the return value is in EAX }
  98. function ret_in_acc(def : tdef) : boolean;
  99. { true if uses a parameter as return value }
  100. function ret_in_param(def : tdef) : boolean;
  101. { true, if def is a 64 bit int type }
  102. function is_64bitint(def : tdef) : boolean;
  103. function push_high_param(def : tdef) : boolean;
  104. { true if a parameter is too large to copy and only the address is pushed }
  105. function push_addr_param(def : tdef) : boolean;
  106. { true, if def1 and def2 are semantical the same }
  107. function is_equal(def1,def2 : tdef) : boolean;
  108. { checks for type compatibility (subgroups of type) }
  109. { used for case statements... probably missing stuff }
  110. { to use on other types }
  111. function is_subequal(def1, def2: tdef): boolean;
  112. type
  113. tconverttype = (
  114. tc_equal,
  115. tc_not_possible,
  116. tc_string_2_string,
  117. tc_char_2_string,
  118. tc_pchar_2_string,
  119. tc_cchar_2_pchar,
  120. tc_cstring_2_pchar,
  121. tc_ansistring_2_pchar,
  122. tc_string_2_chararray,
  123. tc_chararray_2_string,
  124. tc_array_2_pointer,
  125. tc_pointer_2_array,
  126. tc_int_2_int,
  127. tc_int_2_bool,
  128. tc_bool_2_bool,
  129. tc_bool_2_int,
  130. tc_real_2_real,
  131. tc_int_2_real,
  132. tc_proc_2_procvar,
  133. tc_arrayconstructor_2_set,
  134. tc_load_smallset,
  135. tc_cord_2_pointer,
  136. tc_intf_2_string,
  137. tc_intf_2_guid,
  138. tc_class_2_intf,
  139. tc_char_2_char,
  140. tc_normal_2_smallset
  141. );
  142. function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
  143. { Returns:
  144. 0 - Not convertable
  145. 1 - Convertable
  146. 2 - Convertable, but not first choice }
  147. function isconvertable(def_from,def_to : tdef;
  148. var doconv : tconverttype;
  149. fromtreetype : tnodetype;
  150. explicit : boolean) : byte;
  151. { same as is_equal, but with error message if failed }
  152. function CheckTypes(def1,def2 : tdef) : boolean;
  153. function equal_constsym(sym1,sym2:tconstsym):boolean;
  154. { true, if two parameter lists are equal }
  155. { if acp is cp_none, all have to match exactly }
  156. { if acp is cp_value_equal_const call by value }
  157. { and call by const parameter are assumed as }
  158. { equal }
  159. { if acp is cp_all the var const or nothing are considered equal }
  160. type
  161. compare_type = ( cp_none, cp_value_equal_const, cp_all);
  162. function equal_paras(paralist1,paralist2 : tlinkedlist; acp : compare_type) : boolean;
  163. { true if a type can be allowed for another one
  164. in a func var }
  165. function convertable_paras(paralist1,paralist2 : tlinkedlist; acp : compare_type) : boolean;
  166. { true if a function can be assigned to a procvar }
  167. function proc_to_procvar_equal(def1:tprocdef;def2:tprocvardef) : boolean;
  168. { if l isn't in the range of def a range check error (if not explicit) is generated and
  169. the value is placed within the range }
  170. procedure testrange(def : tdef;var l : tconstexprint;explicit:boolean);
  171. { returns the range of def }
  172. procedure getrange(def : tdef;var l : longint;var h : longint);
  173. { some type helper routines for MMX support }
  174. function is_mmx_able_array(p : tdef) : boolean;
  175. { returns the mmx type }
  176. function mmx_type(p : tdef) : tmmxtype;
  177. { returns true, if sym needs an entry in the proplist of a class rtti }
  178. function needs_prop_entry(sym : tsym) : boolean;
  179. implementation
  180. uses
  181. globtype,globals,systems,tokens,verbose,
  182. symconst,symtable,nld;
  183. function needs_prop_entry(sym : tsym) : boolean;
  184. begin
  185. needs_prop_entry:=(sp_published in tsym(sym).symoptions) and
  186. (sym.typ in [propertysym,varsym]);
  187. end;
  188. function equal_constsym(sym1,sym2:tconstsym):boolean;
  189. var
  190. p1,p2,pend : pchar;
  191. begin
  192. equal_constsym:=false;
  193. if sym1.consttyp<>sym2.consttyp then
  194. exit;
  195. case sym1.consttyp of
  196. constint,
  197. constbool,
  198. constchar,
  199. constord :
  200. equal_constsym:=(sym1.valueord=sym2.valueord);
  201. constpointer :
  202. equal_constsym:=(sym1.valueordptr=sym2.valueordptr);
  203. conststring,constresourcestring :
  204. begin
  205. if sym1.len=sym2.len then
  206. begin
  207. p1:=pchar(sym1.valueptr);
  208. p2:=pchar(sym2.valueptr);
  209. pend:=p1+sym1.len;
  210. while (p1<pend) do
  211. begin
  212. if p1^<>p2^ then
  213. break;
  214. inc(p1);
  215. inc(p2);
  216. end;
  217. if (p1=pend) then
  218. equal_constsym:=true;
  219. end;
  220. end;
  221. constreal :
  222. equal_constsym:=(pbestreal(sym1.valueptr)^=pbestreal(sym2.valueptr)^);
  223. constset :
  224. equal_constsym:=(pnormalset(sym1.valueptr)^=pnormalset(sym2.valueptr)^);
  225. constnil :
  226. equal_constsym:=true;
  227. end;
  228. end;
  229. { compare_type = ( cp_none, cp_value_equal_const, cp_all); }
  230. function equal_paras(paralist1,paralist2 : TLinkedList; acp : compare_type) : boolean;
  231. var
  232. def1,def2 : TParaItem;
  233. begin
  234. def1:=TParaItem(paralist1.first);
  235. def2:=TParaItem(paralist2.first);
  236. while (assigned(def1)) and (assigned(def2)) do
  237. begin
  238. case acp of
  239. cp_value_equal_const :
  240. begin
  241. if not(is_equal(def1.paratype.def,def2.paratype.def)) or
  242. ((def1.paratyp<>def2.paratyp) and
  243. ((def1.paratyp in [vs_var,vs_out]) or
  244. (def2.paratyp in [vs_var,vs_out])
  245. )
  246. ) then
  247. begin
  248. equal_paras:=false;
  249. exit;
  250. end;
  251. end;
  252. cp_all :
  253. begin
  254. if not(is_equal(def1.paratype.def,def2.paratype.def)) or
  255. (def1.paratyp<>def2.paratyp) then
  256. begin
  257. equal_paras:=false;
  258. exit;
  259. end;
  260. end;
  261. cp_none :
  262. begin
  263. if not(is_equal(def1.paratype.def,def2.paratype.def)) then
  264. begin
  265. equal_paras:=false;
  266. exit;
  267. end;
  268. { also check default value if both have it declared }
  269. if assigned(def1.defaultvalue) and
  270. assigned(def2.defaultvalue) then
  271. begin
  272. if not equal_constsym(tconstsym(def1.defaultvalue),tconstsym(def2.defaultvalue)) then
  273. begin
  274. equal_paras:=false;
  275. exit;
  276. end;
  277. end;
  278. end;
  279. end;
  280. def1:=TParaItem(def1.next);
  281. def2:=TParaItem(def2.next);
  282. end;
  283. if (def1=nil) and (def2=nil) then
  284. equal_paras:=true
  285. else
  286. equal_paras:=false;
  287. end;
  288. function convertable_paras(paralist1,paralist2 : TLinkedList;acp : compare_type) : boolean;
  289. var
  290. def1,def2 : TParaItem;
  291. doconv : tconverttype;
  292. begin
  293. def1:=TParaItem(paralist1.first);
  294. def2:=TParaItem(paralist2.first);
  295. while (assigned(def1)) and (assigned(def2)) do
  296. begin
  297. case acp of
  298. cp_value_equal_const :
  299. begin
  300. if (isconvertable(def1.paratype.def,def2.paratype.def,doconv,callparan,false)=0) or
  301. ((def1.paratyp<>def2.paratyp) and
  302. ((def1.paratyp in [vs_out,vs_var]) or
  303. (def2.paratyp in [vs_out,vs_var])
  304. )
  305. ) then
  306. begin
  307. convertable_paras:=false;
  308. exit;
  309. end;
  310. end;
  311. cp_all :
  312. begin
  313. if (isconvertable(def1.paratype.def,def2.paratype.def,doconv,callparan,false)=0) or
  314. (def1.paratyp<>def2.paratyp) then
  315. begin
  316. convertable_paras:=false;
  317. exit;
  318. end;
  319. end;
  320. cp_none :
  321. begin
  322. if (isconvertable(def1.paratype.def,def2.paratype.def,doconv,callparan,false)=0) then
  323. begin
  324. convertable_paras:=false;
  325. exit;
  326. end;
  327. end;
  328. end;
  329. def1:=TParaItem(def1.next);
  330. def2:=TParaItem(def2.next);
  331. end;
  332. if (def1=nil) and (def2=nil) then
  333. convertable_paras:=true
  334. else
  335. convertable_paras:=false;
  336. end;
  337. { true if a function can be assigned to a procvar }
  338. function proc_to_procvar_equal(def1:tprocdef;def2:tprocvardef) : boolean;
  339. const
  340. po_comp = po_compatibility_options-[po_methodpointer,po_classmethod];
  341. var
  342. ismethod : boolean;
  343. begin
  344. proc_to_procvar_equal:=false;
  345. if not(assigned(def1)) or not(assigned(def2)) then
  346. exit;
  347. { check for method pointer }
  348. ismethod:=assigned(def1.owner) and
  349. (def1.owner.symtabletype=objectsymtable);
  350. { I think methods of objects are also not compatible }
  351. { with procedure variables! (FK)
  352. and
  353. assigned(def1.owner.defowner) and
  354. (tobjectdef(def1.owner.defowner)^.is_class); }
  355. if (ismethod and not (po_methodpointer in def2.procoptions)) or
  356. (not(ismethod) and (po_methodpointer in def2.procoptions)) then
  357. begin
  358. Message(type_e_no_method_and_procedure_not_compatible);
  359. exit;
  360. end;
  361. { check return value and para's and options, methodpointer is already checked
  362. parameters may also be convertable }
  363. if is_equal(def1.rettype.def,def2.rettype.def) and
  364. (equal_paras(def1.para,def2.para,cp_all) or
  365. convertable_paras(def1.para,def2.para,cp_all)) and
  366. ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) then
  367. proc_to_procvar_equal:=true
  368. else
  369. proc_to_procvar_equal:=false;
  370. end;
  371. { returns true, if def uses FPU }
  372. function is_fpu(def : tdef) : boolean;
  373. begin
  374. is_fpu:=(def.deftype=floatdef);
  375. end;
  376. { true if p is an ordinal }
  377. function is_ordinal(def : tdef) : boolean;
  378. var
  379. dt : tbasetype;
  380. begin
  381. case def.deftype of
  382. orddef :
  383. begin
  384. dt:=torddef(def).typ;
  385. is_ordinal:=dt in [uchar,uwidechar,
  386. u8bit,u16bit,u32bit,u64bit,
  387. s8bit,s16bit,s32bit,s64bit,
  388. bool8bit,bool16bit,bool32bit];
  389. end;
  390. enumdef :
  391. is_ordinal:=true;
  392. else
  393. is_ordinal:=false;
  394. end;
  395. end;
  396. { returns the min. value of the type }
  397. function get_min_value(def : tdef) : longint;
  398. begin
  399. case def.deftype of
  400. orddef:
  401. get_min_value:=torddef(def).low;
  402. enumdef:
  403. get_min_value:=tenumdef(def).min;
  404. else
  405. get_min_value:=0;
  406. end;
  407. end;
  408. { true if p is an integer }
  409. function is_integer(def : tdef) : boolean;
  410. begin
  411. is_integer:=(def.deftype=orddef) and
  412. (torddef(def).typ in [uauto,u8bit,u16bit,u32bit,u64bit,
  413. s8bit,s16bit,s32bit,s64bit]);
  414. end;
  415. { true if p is a boolean }
  416. function is_boolean(def : tdef) : boolean;
  417. begin
  418. is_boolean:=(def.deftype=orddef) and
  419. (torddef(def).typ in [bool8bit,bool16bit,bool32bit]);
  420. end;
  421. { true if p is a void }
  422. function is_void(def : tdef) : boolean;
  423. begin
  424. is_void:=(def.deftype=orddef) and
  425. (torddef(def).typ=uvoid);
  426. end;
  427. { true if p is a char }
  428. function is_char(def : tdef) : boolean;
  429. begin
  430. is_char:=(def.deftype=orddef) and
  431. (torddef(def).typ=uchar);
  432. end;
  433. { true if p is a wchar }
  434. function is_widechar(def : tdef) : boolean;
  435. begin
  436. is_widechar:=(def.deftype=orddef) and
  437. (torddef(def).typ=uwidechar);
  438. end;
  439. { true if p is signed (integer) }
  440. function is_signed(def : tdef) : boolean;
  441. var
  442. dt : tbasetype;
  443. begin
  444. case def.deftype of
  445. orddef :
  446. begin
  447. dt:=torddef(def).typ;
  448. is_signed:=(dt in [s8bit,s16bit,s32bit,s64bit]);
  449. end;
  450. enumdef :
  451. is_signed:=tenumdef(def).min < 0;
  452. arraydef :
  453. is_signed:=is_signed(tarraydef(def).rangetype.def);
  454. else
  455. is_signed:=false;
  456. end;
  457. end;
  458. { true, if p points to an open array def }
  459. function is_open_string(p : tdef) : boolean;
  460. begin
  461. is_open_string:=(p.deftype=stringdef) and
  462. (tstringdef(p).string_typ=st_shortstring) and
  463. (tstringdef(p).len=0);
  464. end;
  465. { true, if p points to a zero based array def }
  466. function is_zero_based_array(p : tdef) : boolean;
  467. begin
  468. is_zero_based_array:=(p.deftype=arraydef) and
  469. (tarraydef(p).lowrange=0) and
  470. not(is_special_array(p));
  471. end;
  472. { true if p points to a dynamic array def }
  473. function is_dynamic_array(p : tdef) : boolean;
  474. begin
  475. is_dynamic_array:=(p.deftype=arraydef) and
  476. tarraydef(p).IsDynamicArray;
  477. end;
  478. { true, if p points to an open array def }
  479. function is_open_array(p : tdef) : boolean;
  480. begin
  481. { check for s32bittype is needed, because for u32bit the high
  482. range is also -1 ! (PFV) }
  483. is_open_array:=(p.deftype=arraydef) and
  484. (tarraydef(p).rangetype.def=s32bittype.def) and
  485. (tarraydef(p).lowrange=0) and
  486. (tarraydef(p).highrange=-1) and
  487. not(tarraydef(p).IsConstructor) and
  488. not(tarraydef(p).IsVariant) and
  489. not(tarraydef(p).IsArrayOfConst) and
  490. not(tarraydef(p).IsDynamicArray);
  491. end;
  492. { true, if p points to an array of const def }
  493. function is_array_constructor(p : tdef) : boolean;
  494. begin
  495. is_array_constructor:=(p.deftype=arraydef) and
  496. (tarraydef(p).IsConstructor);
  497. end;
  498. { true, if p points to a variant array }
  499. function is_variant_array(p : tdef) : boolean;
  500. begin
  501. is_variant_array:=(p.deftype=arraydef) and
  502. (tarraydef(p).IsVariant);
  503. end;
  504. { true, if p points to an array of const }
  505. function is_array_of_const(p : tdef) : boolean;
  506. begin
  507. is_array_of_const:=(p.deftype=arraydef) and
  508. (tarraydef(p).IsArrayOfConst);
  509. end;
  510. { true, if p points to a special array }
  511. function is_special_array(p : tdef) : boolean;
  512. begin
  513. is_special_array:=(p.deftype=arraydef) and
  514. ((tarraydef(p).IsVariant) or
  515. (tarraydef(p).IsArrayOfConst) or
  516. (tarraydef(p).IsConstructor) or
  517. is_open_array(p)
  518. );
  519. end;
  520. { true if p is an ansi string def }
  521. function is_ansistring(p : tdef) : boolean;
  522. begin
  523. is_ansistring:=(p.deftype=stringdef) and
  524. (tstringdef(p).string_typ=st_ansistring);
  525. end;
  526. { true if p is an long string def }
  527. function is_longstring(p : tdef) : boolean;
  528. begin
  529. is_longstring:=(p.deftype=stringdef) and
  530. (tstringdef(p).string_typ=st_longstring);
  531. end;
  532. { true if p is an wide string def }
  533. function is_widestring(p : tdef) : boolean;
  534. begin
  535. is_widestring:=(p.deftype=stringdef) and
  536. (tstringdef(p).string_typ=st_widestring);
  537. end;
  538. { true if p is an short string def }
  539. function is_shortstring(p : tdef) : boolean;
  540. begin
  541. is_shortstring:=(p.deftype=stringdef) and
  542. (tstringdef(p).string_typ=st_shortstring);
  543. end;
  544. { true if p is a char array def }
  545. function is_chararray(p : tdef) : boolean;
  546. begin
  547. is_chararray:=(p.deftype=arraydef) and
  548. is_equal(tarraydef(p).elementtype.def,cchartype.def) and
  549. not(is_special_array(p));
  550. end;
  551. { true if p is a widechar array def }
  552. function is_widechararray(p : tdef) : boolean;
  553. begin
  554. is_widechararray:=(p.deftype=arraydef) and
  555. is_equal(tarraydef(p).elementtype.def,cwidechartype.def) and
  556. not(is_special_array(p));
  557. end;
  558. { true if p is a pchar def }
  559. function is_pchar(p : tdef) : boolean;
  560. begin
  561. is_pchar:=(p.deftype=pointerdef) and
  562. (is_equal(tpointerdef(p).pointertype.def,cchartype.def) or
  563. (is_zero_based_array(tpointerdef(p).pointertype.def) and
  564. is_chararray(tpointerdef(p).pointertype.def)));
  565. end;
  566. { true if p is a pchar def }
  567. function is_pwidechar(p : tdef) : boolean;
  568. begin
  569. is_pwidechar:=(p.deftype=pointerdef) and
  570. (is_equal(tpointerdef(p).pointertype.def,cwidechartype.def) or
  571. (is_zero_based_array(tpointerdef(p).pointertype.def) and
  572. is_widechararray(tpointerdef(p).pointertype.def)));
  573. end;
  574. { true if p is a voidpointer def }
  575. function is_voidpointer(p : tdef) : boolean;
  576. begin
  577. is_voidpointer:=(p.deftype=pointerdef) and
  578. (tpointerdef(p).pointertype.def.deftype=orddef) and
  579. (torddef(tpointerdef(p).pointertype.def).typ=uvoid);
  580. end;
  581. { true if p is a smallset def }
  582. function is_smallset(p : tdef) : boolean;
  583. begin
  584. is_smallset:=(p.deftype=setdef) and
  585. (tsetdef(p).settype=smallset);
  586. end;
  587. { true if the return value is in accumulator (EAX for i386), D0 for 68k }
  588. function ret_in_acc(def : tdef) : boolean;
  589. begin
  590. ret_in_acc:=(def.deftype in [orddef,pointerdef,enumdef,classrefdef]) or
  591. ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_ansistring,st_widestring])) or
  592. ((def.deftype=procvardef) and not(po_methodpointer in tprocvardef(def).procoptions)) or
  593. ((def.deftype=objectdef) and not is_object(def)) or
  594. ((def.deftype=setdef) and (tsetdef(def).settype=smallset));
  595. end;
  596. { true, if def is a 64 bit int type }
  597. function is_64bitint(def : tdef) : boolean;
  598. begin
  599. is_64bitint:=(def.deftype=orddef) and (torddef(def).typ in [u64bit,s64bit])
  600. end;
  601. { true if uses a parameter as return value }
  602. function ret_in_param(def : tdef) : boolean;
  603. begin
  604. ret_in_param:=(def.deftype in [arraydef,recorddef]) or
  605. ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_shortstring,st_longstring])) or
  606. ((def.deftype=procvardef) and (po_methodpointer in tprocvardef(def).procoptions)) or
  607. ((def.deftype=objectdef) and is_object(def)) or
  608. ((def.deftype=setdef) and (tsetdef(def).settype<>smallset));
  609. end;
  610. function push_high_param(def : tdef) : boolean;
  611. begin
  612. push_high_param:=is_open_array(def) or
  613. is_open_string(def) or
  614. is_array_of_const(def);
  615. end;
  616. { true if a parameter is too large to copy and only the address is pushed }
  617. function push_addr_param(def : tdef) : boolean;
  618. begin
  619. push_addr_param:=false;
  620. if never_copy_const_param then
  621. push_addr_param:=true
  622. else
  623. begin
  624. case def.deftype of
  625. variantdef,
  626. formaldef :
  627. push_addr_param:=true;
  628. recorddef :
  629. push_addr_param:=(def.size>target_info.size_of_pointer);
  630. arraydef :
  631. push_addr_param:=((tarraydef(def).highrange>=tarraydef(def).lowrange) and (def.size>target_info.size_of_pointer)) or
  632. is_open_array(def) or
  633. is_array_of_const(def) or
  634. is_array_constructor(def);
  635. objectdef :
  636. push_addr_param:=is_object(def);
  637. stringdef :
  638. push_addr_param:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
  639. procvardef :
  640. push_addr_param:=(po_methodpointer in tprocvardef(def).procoptions);
  641. setdef :
  642. push_addr_param:=(tsetdef(def).settype<>smallset);
  643. end;
  644. end;
  645. end;
  646. { if l isn't in the range of def a range check error (if not explicit) is generated and
  647. the value is placed within the range }
  648. procedure testrange(def : tdef;var l : tconstexprint;explicit:boolean);
  649. var
  650. lv,hv: longint;
  651. error: boolean;
  652. begin
  653. error := false;
  654. { for 64 bit types we need only to check if it is less than }
  655. { zero, if def is a qword node }
  656. if is_64bitint(def) then
  657. begin
  658. if (l<0) and (torddef(def).typ=u64bit) then
  659. begin
  660. { don't zero the result, because it may come from hex notation
  661. like $ffffffffffffffff! (JM)
  662. l:=0; }
  663. if not explicit then
  664. begin
  665. if (cs_check_range in aktlocalswitches) then
  666. Message(parser_e_range_check_error)
  667. else
  668. Message(parser_w_range_check_error);
  669. end;
  670. error := true;
  671. end;
  672. end
  673. else
  674. begin
  675. getrange(def,lv,hv);
  676. if (def.deftype=orddef) and
  677. (torddef(def).typ=u32bit) then
  678. begin
  679. if (l < cardinal(lv)) or
  680. (l > cardinal(hv)) then
  681. begin
  682. if not explicit then
  683. begin
  684. if (cs_check_range in aktlocalswitches) then
  685. Message(parser_e_range_check_error)
  686. else
  687. Message(parser_w_range_check_error);
  688. end;
  689. error := true;
  690. end;
  691. end
  692. else if (l<lv) or (l>hv) then
  693. begin
  694. if not explicit then
  695. begin
  696. if ((def.deftype=enumdef) and
  697. { delphi allows range check errors in
  698. enumeration type casts FK }
  699. not(m_delphi in aktmodeswitches)) or
  700. (cs_check_range in aktlocalswitches) then
  701. Message(parser_e_range_check_error)
  702. else
  703. Message(parser_w_range_check_error);
  704. end;
  705. error := true;
  706. end;
  707. end;
  708. if error then
  709. begin
  710. { Fix the value to fit in the allocated space for this type of variable }
  711. case def.size of
  712. 1: l := l and $ff;
  713. 2: l := l and $ffff;
  714. { work around sign extension bug (to be fixed) (JM) }
  715. 4: l := l and (int64($fffffff) shl 4 + $f);
  716. end;
  717. { do sign extension if necessary (JM) }
  718. if is_signed(def) then
  719. begin
  720. case def.size of
  721. 1: l := shortint(l);
  722. 2: l := smallint(l);
  723. 4: l := longint(l);
  724. end;
  725. end;
  726. end;
  727. end;
  728. { return the range from def in l and h }
  729. procedure getrange(def : tdef;var l : longint;var h : longint);
  730. begin
  731. case def.deftype of
  732. orddef :
  733. begin
  734. l:=torddef(def).low;
  735. h:=torddef(def).high;
  736. end;
  737. enumdef :
  738. begin
  739. l:=tenumdef(def).min;
  740. h:=tenumdef(def).max;
  741. end;
  742. arraydef :
  743. begin
  744. l:=tarraydef(def).lowrange;
  745. h:=tarraydef(def).highrange;
  746. end;
  747. else
  748. internalerror(987);
  749. end;
  750. end;
  751. function mmx_type(p : tdef) : tmmxtype;
  752. begin
  753. mmx_type:=mmxno;
  754. if is_mmx_able_array(p) then
  755. begin
  756. if tarraydef(p).elementtype.def.deftype=floatdef then
  757. case tfloatdef(tarraydef(p).elementtype.def).typ of
  758. s32real:
  759. mmx_type:=mmxsingle;
  760. end
  761. else
  762. case torddef(tarraydef(p).elementtype.def).typ of
  763. u8bit:
  764. mmx_type:=mmxu8bit;
  765. s8bit:
  766. mmx_type:=mmxs8bit;
  767. u16bit:
  768. mmx_type:=mmxu16bit;
  769. s16bit:
  770. mmx_type:=mmxs16bit;
  771. u32bit:
  772. mmx_type:=mmxu32bit;
  773. s32bit:
  774. mmx_type:=mmxs32bit;
  775. end;
  776. end;
  777. end;
  778. function is_mmx_able_array(p : tdef) : boolean;
  779. begin
  780. {$ifdef SUPPORT_MMX}
  781. if (cs_mmx_saturation in aktlocalswitches) then
  782. begin
  783. is_mmx_able_array:=(p.deftype=arraydef) and
  784. not(is_special_array(p)) and
  785. (
  786. (
  787. (tarraydef(p).elementtype.def.deftype=orddef) and
  788. (
  789. (
  790. (tarraydef(p).lowrange=0) and
  791. (tarraydef(p).highrange=1) and
  792. (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
  793. )
  794. or
  795. (
  796. (tarraydef(p).lowrange=0) and
  797. (tarraydef(p).highrange=3) and
  798. (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
  799. )
  800. )
  801. )
  802. or
  803. (
  804. (
  805. (tarraydef(p).elementtype.def.deftype=floatdef) and
  806. (
  807. (tarraydef(p).lowrange=0) and
  808. (tarraydef(p).highrange=1) and
  809. (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
  810. )
  811. )
  812. )
  813. );
  814. end
  815. else
  816. begin
  817. is_mmx_able_array:=(p.deftype=arraydef) and
  818. (
  819. (
  820. (tarraydef(p).elementtype.def.deftype=orddef) and
  821. (
  822. (
  823. (tarraydef(p).lowrange=0) and
  824. (tarraydef(p).highrange=1) and
  825. (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
  826. )
  827. or
  828. (
  829. (tarraydef(p).lowrange=0) and
  830. (tarraydef(p).highrange=3) and
  831. (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
  832. )
  833. or
  834. (
  835. (tarraydef(p).lowrange=0) and
  836. (tarraydef(p).highrange=7) and
  837. (torddef(tarraydef(p).elementtype.def).typ in [u8bit,s8bit])
  838. )
  839. )
  840. )
  841. or
  842. (
  843. (tarraydef(p).elementtype.def.deftype=floatdef) and
  844. (
  845. (tarraydef(p).lowrange=0) and
  846. (tarraydef(p).highrange=1) and
  847. (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
  848. )
  849. )
  850. );
  851. end;
  852. {$else SUPPORT_MMX}
  853. is_mmx_able_array:=false;
  854. {$endif SUPPORT_MMX}
  855. end;
  856. function is_equal(def1,def2 : tdef) : boolean;
  857. var
  858. b : boolean;
  859. hd : tdef;
  860. begin
  861. { both types must exists }
  862. if not (assigned(def1) and assigned(def2)) then
  863. begin
  864. is_equal:=false;
  865. exit;
  866. end;
  867. { be sure, that if there is a stringdef, that this is def1 }
  868. if def2.deftype=stringdef then
  869. begin
  870. hd:=def1;
  871. def1:=def2;
  872. def2:=hd;
  873. end;
  874. b:=false;
  875. { both point to the same definition ? }
  876. if def1=def2 then
  877. b:=true
  878. else
  879. { pointer with an equal definition are equal }
  880. if (def1.deftype=pointerdef) and (def2.deftype=pointerdef) then
  881. begin
  882. { check if both are farpointer }
  883. if (tpointerdef(def1).is_far=tpointerdef(def2).is_far) then
  884. begin
  885. { here a problem detected in tabsolutesym }
  886. { the types can be forward type !! }
  887. if assigned(def1.typesym) and (tpointerdef(def1).pointertype.def.deftype=forwarddef) then
  888. b:=(def1.typesym=def2.typesym)
  889. else
  890. b:=tpointerdef(def1).pointertype.def=tpointerdef(def2).pointertype.def;
  891. end
  892. else
  893. b:=false;
  894. end
  895. else
  896. { ordinals are equal only when the ordinal type is equal }
  897. if (def1.deftype=orddef) and (def2.deftype=orddef) then
  898. begin
  899. case torddef(def1).typ of
  900. u8bit,u16bit,u32bit,
  901. s8bit,s16bit,s32bit:
  902. b:=((torddef(def1).typ=torddef(def2).typ) and
  903. (torddef(def1).low=torddef(def2).low) and
  904. (torddef(def1).high=torddef(def2).high));
  905. uvoid,uchar,uwidechar,
  906. bool8bit,bool16bit,bool32bit:
  907. b:=(torddef(def1).typ=torddef(def2).typ);
  908. end;
  909. end
  910. else
  911. if (def1.deftype=floatdef) and (def2.deftype=floatdef) then
  912. b:=tfloatdef(def1).typ=tfloatdef(def2).typ
  913. else
  914. { strings with the same length are equal }
  915. if (def1.deftype=stringdef) and (def2.deftype=stringdef) and
  916. (tstringdef(def1).string_typ=tstringdef(def2).string_typ) then
  917. begin
  918. b:=not(is_shortstring(def1)) or
  919. (tstringdef(def1).len=tstringdef(def2).len);
  920. end
  921. else
  922. if (def1.deftype=formaldef) and (def2.deftype=formaldef) then
  923. b:=true
  924. { file types with the same file element type are equal }
  925. { this is a problem for assign !! }
  926. { changed to allow if one is untyped }
  927. { all typed files are equal to the special }
  928. { typed file that has voiddef as elemnt type }
  929. { but must NOT match for text file !!! }
  930. else
  931. if (def1.deftype=filedef) and (def2.deftype=filedef) then
  932. b:=(tfiledef(def1).filetyp=tfiledef(def2).filetyp) and
  933. ((
  934. ((tfiledef(def1).typedfiletype.def=nil) and
  935. (tfiledef(def2).typedfiletype.def=nil)) or
  936. (
  937. (tfiledef(def1).typedfiletype.def<>nil) and
  938. (tfiledef(def2).typedfiletype.def<>nil) and
  939. is_equal(tfiledef(def1).typedfiletype.def,tfiledef(def2).typedfiletype.def)
  940. ) or
  941. ( (tfiledef(def1).typedfiletype.def=tdef(voidtype.def)) or
  942. (tfiledef(def2).typedfiletype.def=tdef(voidtype.def))
  943. )))
  944. { sets with the same element base type are equal }
  945. else
  946. if (def1.deftype=setdef) and (def2.deftype=setdef) then
  947. begin
  948. if assigned(tsetdef(def1).elementtype.def) and
  949. assigned(tsetdef(def2).elementtype.def) then
  950. b:=is_subequal(tsetdef(def1).elementtype.def,tsetdef(def2).elementtype.def)
  951. else
  952. { empty set is compatible with everything }
  953. b:=true;
  954. end
  955. else
  956. if (def1.deftype=procvardef) and (def2.deftype=procvardef) then
  957. begin
  958. { poassembler isn't important for compatibility }
  959. { if a method is assigned to a methodpointer }
  960. { is checked before }
  961. b:=(tprocvardef(def1).proctypeoption=tprocvardef(def2).proctypeoption) and
  962. (tprocvardef(def1).proccalloption=tprocvardef(def2).proccalloption) and
  963. ((tprocvardef(def1).procoptions * po_compatibility_options)=
  964. (tprocvardef(def2).procoptions * po_compatibility_options)) and
  965. is_equal(tprocvardef(def1).rettype.def,tprocvardef(def2).rettype.def) and
  966. equal_paras(tprocvardef(def1).para,tprocvardef(def2).para,cp_all);
  967. end
  968. else
  969. if (def1.deftype=arraydef) and (def2.deftype=arraydef) then
  970. begin
  971. if is_dynamic_array(def1) and is_dynamic_array(def2) then
  972. b:=is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def)
  973. else
  974. if is_array_of_const(def1) or is_array_of_const(def2) then
  975. begin
  976. b:=(is_array_of_const(def1) and is_array_of_const(def2)) or
  977. (is_array_of_const(def1) and is_array_constructor(def2)) or
  978. (is_array_of_const(def2) and is_array_constructor(def1));
  979. end
  980. else
  981. if is_open_array(def1) or is_open_array(def2) then
  982. begin
  983. b:=is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
  984. end
  985. else
  986. begin
  987. b:=not(m_tp in aktmodeswitches) and
  988. not(m_delphi in aktmodeswitches) and
  989. (tarraydef(def1).lowrange=tarraydef(def2).lowrange) and
  990. (tarraydef(def1).highrange=tarraydef(def2).highrange) and
  991. is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def) and
  992. is_equal(tarraydef(def1).rangetype.def,tarraydef(def2).rangetype.def);
  993. end;
  994. end
  995. else
  996. if (def1.deftype=classrefdef) and (def2.deftype=classrefdef) then
  997. begin
  998. { similar to pointerdef: }
  999. if assigned(def1.typesym) and (tclassrefdef(def1).pointertype.def.deftype=forwarddef) then
  1000. b:=(def1.typesym=def2.typesym)
  1001. else
  1002. b:=is_equal(tclassrefdef(def1).pointertype.def,tclassrefdef(def2).pointertype.def);
  1003. end;
  1004. is_equal:=b;
  1005. end;
  1006. function is_subequal(def1, def2: tdef): boolean;
  1007. var
  1008. basedef1,basedef2 : tenumdef;
  1009. Begin
  1010. is_subequal := false;
  1011. if assigned(def1) and assigned(def2) then
  1012. Begin
  1013. if (def1.deftype = orddef) and (def2.deftype = orddef) then
  1014. Begin
  1015. { see p.47 of Turbo Pascal 7.01 manual for the separation of types }
  1016. { range checking for case statements is done with testrange }
  1017. case torddef(def1).typ of
  1018. u8bit,u16bit,u32bit,
  1019. s8bit,s16bit,s32bit,s64bit,u64bit :
  1020. is_subequal:=(torddef(def2).typ in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
  1021. bool8bit,bool16bit,bool32bit :
  1022. is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit]);
  1023. uchar :
  1024. is_subequal:=(torddef(def2).typ=uchar);
  1025. uwidechar :
  1026. is_subequal:=(torddef(def2).typ=uwidechar);
  1027. end;
  1028. end
  1029. else
  1030. Begin
  1031. { I assume that both enumerations are equal when the first }
  1032. { pointers are equal. }
  1033. { I changed this to assume that the enums are equal }
  1034. { if the basedefs are equal (FK) }
  1035. if (def1.deftype=enumdef) and (def2.deftype=enumdef) then
  1036. Begin
  1037. { get both basedefs }
  1038. basedef1:=tenumdef(def1);
  1039. while assigned(basedef1.basedef) do
  1040. basedef1:=basedef1.basedef;
  1041. basedef2:=tenumdef(def2);
  1042. while assigned(basedef2.basedef) do
  1043. basedef2:=basedef2.basedef;
  1044. is_subequal:=basedef1=basedef2;
  1045. {
  1046. if tenumdef(def1).firstenum = tenumdef(def2).firstenum then
  1047. is_subequal := TRUE;
  1048. }
  1049. end;
  1050. end;
  1051. end; { endif assigned ... }
  1052. end;
  1053. function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
  1054. var
  1055. passproc : tprocdef;
  1056. convtyp : tconverttype;
  1057. begin
  1058. assignment_overloaded:=nil;
  1059. if assigned(overloaded_operators[_ASSIGNMENT]) then
  1060. passproc:=overloaded_operators[_ASSIGNMENT].definition
  1061. else
  1062. exit;
  1063. { look for an exact match first }
  1064. while passproc<>nil do
  1065. begin
  1066. if is_equal(passproc.rettype.def,to_def) and
  1067. (TParaItem(passproc.Para.first).paratype.def=from_def) then
  1068. begin
  1069. assignment_overloaded:=passproc;
  1070. exit;
  1071. end;
  1072. passproc:=passproc.nextoverloaded;
  1073. end;
  1074. passproc:=overloaded_operators[_ASSIGNMENT].definition;
  1075. { .... then look for an equal match }
  1076. while passproc<>nil do
  1077. begin
  1078. if is_equal(passproc.rettype.def,to_def) and
  1079. is_equal(TParaItem(passproc.Para.first).paratype.def,from_def) then
  1080. begin
  1081. assignment_overloaded:=passproc;
  1082. exit;
  1083. end;
  1084. passproc:=passproc.nextoverloaded;
  1085. end;
  1086. passproc:=overloaded_operators[_ASSIGNMENT].definition;
  1087. { .... then for convert level 1 }
  1088. while passproc<>nil do
  1089. begin
  1090. if is_equal(passproc.rettype.def,to_def) and
  1091. (isconvertable(from_def,TParaItem(passproc.Para.first).paratype.def,convtyp,ordconstn,false)=1) then
  1092. begin
  1093. assignment_overloaded:=passproc;
  1094. exit;
  1095. end;
  1096. passproc:=passproc.nextoverloaded;
  1097. end;
  1098. end;
  1099. { Returns:
  1100. 0 - Not convertable
  1101. 1 - Convertable
  1102. 2 - Convertable, but not first choice }
  1103. function isconvertable(def_from,def_to : tdef;
  1104. var doconv : tconverttype;
  1105. fromtreetype : tnodetype;
  1106. explicit : boolean) : byte;
  1107. { Tbasetype: uauto,uvoid,uchar,
  1108. u8bit,u16bit,u32bit,
  1109. s8bit,s16bit,s32,
  1110. bool8bit,bool16bit,bool32bit,
  1111. u64bit,s64bitint,uwidechar }
  1112. type
  1113. tbasedef=(bvoid,bchar,bint,bbool);
  1114. const
  1115. basedeftbl:array[tbasetype] of tbasedef =
  1116. (bvoid,bvoid,bchar,
  1117. bint,bint,bint,
  1118. bint,bint,bint,
  1119. bbool,bbool,bbool,bint,bint,bchar);
  1120. basedefconverts : array[tbasedef,tbasedef] of tconverttype =
  1121. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  1122. (tc_not_possible,tc_char_2_char,tc_not_possible,tc_not_possible),
  1123. (tc_not_possible,tc_not_possible,tc_int_2_int,tc_int_2_bool),
  1124. (tc_not_possible,tc_not_possible,tc_bool_2_int,tc_bool_2_bool));
  1125. var
  1126. b : byte;
  1127. hd1,hd2 : tdef;
  1128. hct : tconverttype;
  1129. begin
  1130. { safety check }
  1131. if not(assigned(def_from) and assigned(def_to)) then
  1132. begin
  1133. isconvertable:=0;
  1134. exit;
  1135. end;
  1136. { tp7 procvar def support, in tp7 a procvar is always called, if the
  1137. procvar is passed explicit a addrn would be there }
  1138. if (m_tp_procvar in aktmodeswitches) and
  1139. (def_from.deftype=procvardef) and
  1140. (fromtreetype=loadn) then
  1141. begin
  1142. def_from:=tprocvardef(def_from).rettype.def;
  1143. end;
  1144. { we walk the wanted (def_to) types and check then the def_from
  1145. types if there is a conversion possible }
  1146. b:=0;
  1147. case def_to.deftype of
  1148. orddef :
  1149. begin
  1150. case def_from.deftype of
  1151. orddef :
  1152. begin
  1153. doconv:=basedefconverts[basedeftbl[torddef(def_from).typ],basedeftbl[torddef(def_to).typ]];
  1154. b:=1;
  1155. if (doconv=tc_not_possible) or
  1156. ((doconv=tc_int_2_bool) and
  1157. (not explicit) and
  1158. (not is_boolean(def_from))) or
  1159. ((doconv=tc_bool_2_int) and
  1160. (not explicit) and
  1161. (not is_boolean(def_to))) then
  1162. b:=0;
  1163. end;
  1164. enumdef :
  1165. begin
  1166. { needed for char(enum) }
  1167. if explicit then
  1168. begin
  1169. doconv:=tc_int_2_int;
  1170. b:=1;
  1171. end;
  1172. end;
  1173. end;
  1174. end;
  1175. stringdef :
  1176. begin
  1177. case def_from.deftype of
  1178. stringdef :
  1179. begin
  1180. doconv:=tc_string_2_string;
  1181. b:=1;
  1182. end;
  1183. orddef :
  1184. begin
  1185. { char to string}
  1186. if is_char(def_from) or
  1187. is_widechar(def_from) then
  1188. begin
  1189. doconv:=tc_char_2_string;
  1190. b:=1;
  1191. end;
  1192. end;
  1193. arraydef :
  1194. begin
  1195. { array of char to string, the length check is done by the firstpass of this node }
  1196. if is_chararray(def_from) or
  1197. (is_equal(tarraydef(def_from).elementtype.def,cchartype.def) and
  1198. is_open_array(def_from)) then
  1199. begin
  1200. doconv:=tc_chararray_2_string;
  1201. if is_open_array(def_from) or
  1202. (is_shortstring(def_to) and
  1203. (def_from.size <= 255)) or
  1204. (is_ansistring(def_to) and
  1205. (def_from.size > 255)) then
  1206. b:=1
  1207. else
  1208. b:=2;
  1209. end;
  1210. end;
  1211. pointerdef :
  1212. begin
  1213. { pchar can be assigned to short/ansistrings,
  1214. but not in tp7 compatible mode }
  1215. if is_pchar(def_from) and not(m_tp7 in aktmodeswitches) then
  1216. begin
  1217. doconv:=tc_pchar_2_string;
  1218. { trefer ansistrings because pchars can overflow shortstrings, }
  1219. { but only if ansistrings are the default (JM) }
  1220. if (is_shortstring(def_to) and
  1221. not(cs_ansistrings in aktlocalswitches)) or
  1222. (is_ansistring(def_to) and
  1223. (cs_ansistrings in aktlocalswitches)) then
  1224. b:=1
  1225. else
  1226. b:=2;
  1227. end;
  1228. end;
  1229. end;
  1230. end;
  1231. floatdef :
  1232. begin
  1233. case def_from.deftype of
  1234. orddef :
  1235. begin { ordinal to real }
  1236. if is_integer(def_from) then
  1237. begin
  1238. doconv:=tc_int_2_real;
  1239. b:=1;
  1240. end;
  1241. end;
  1242. floatdef :
  1243. begin { 2 float types ? }
  1244. if tfloatdef(def_from).typ=tfloatdef(def_to).typ then
  1245. doconv:=tc_equal
  1246. else
  1247. doconv:=tc_real_2_real;
  1248. b:=1;
  1249. end;
  1250. end;
  1251. end;
  1252. enumdef :
  1253. begin
  1254. if (def_from.deftype=enumdef) then
  1255. begin
  1256. if explicit then
  1257. begin
  1258. b:=1;
  1259. doconv:=tc_int_2_int;
  1260. end
  1261. else
  1262. begin
  1263. hd1:=def_from;
  1264. while assigned(tenumdef(hd1).basedef) do
  1265. hd1:=tenumdef(hd1).basedef;
  1266. hd2:=def_to;
  1267. while assigned(tenumdef(hd2).basedef) do
  1268. hd2:=tenumdef(hd2).basedef;
  1269. if (hd1=hd2) then
  1270. begin
  1271. b:=1;
  1272. { because of packenum they can have different sizes! (JM) }
  1273. doconv:=tc_int_2_int;
  1274. end;
  1275. end;
  1276. end;
  1277. end;
  1278. arraydef :
  1279. begin
  1280. { open array is also compatible with a single element of its base type }
  1281. if is_open_array(def_to) and
  1282. is_equal(tarraydef(def_to).elementtype.def,def_from) then
  1283. begin
  1284. doconv:=tc_equal;
  1285. b:=1;
  1286. end
  1287. else
  1288. begin
  1289. case def_from.deftype of
  1290. arraydef :
  1291. begin
  1292. { array constructor -> open array }
  1293. if is_open_array(def_to) and
  1294. is_array_constructor(def_from) then
  1295. begin
  1296. if is_void(tarraydef(def_from).elementtype.def) or
  1297. is_equal(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
  1298. begin
  1299. doconv:=tc_equal;
  1300. b:=1;
  1301. end
  1302. else
  1303. if isconvertable(tarraydef(def_from).elementtype.def,
  1304. tarraydef(def_to).elementtype.def,hct,arrayconstructorn,false)<>0 then
  1305. begin
  1306. doconv:=hct;
  1307. b:=2;
  1308. end;
  1309. end
  1310. else
  1311. { array of tvarrec -> array of const }
  1312. if is_array_of_const(def_to) and
  1313. is_equal(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
  1314. begin
  1315. doconv:=tc_equal;
  1316. b:=1;
  1317. end;
  1318. end;
  1319. pointerdef :
  1320. begin
  1321. if is_zero_based_array(def_to) and
  1322. is_equal(tpointerdef(def_from).pointertype.def,tarraydef(def_to).elementtype.def) then
  1323. begin
  1324. doconv:=tc_pointer_2_array;
  1325. b:=1;
  1326. end;
  1327. end;
  1328. stringdef :
  1329. begin
  1330. { string to char array }
  1331. if (not is_special_array(def_to)) and
  1332. is_char(tarraydef(def_to).elementtype.def) then
  1333. begin
  1334. doconv:=tc_string_2_chararray;
  1335. b:=1;
  1336. end;
  1337. end;
  1338. recorddef :
  1339. begin
  1340. { tvarrec -> array of constconst }
  1341. if is_array_of_const(def_to) and
  1342. is_equal(def_from,tarraydef(def_to).elementtype.def) then
  1343. begin
  1344. doconv:=tc_equal;
  1345. b:=1;
  1346. end;
  1347. end;
  1348. end;
  1349. end;
  1350. end;
  1351. pointerdef :
  1352. begin
  1353. case def_from.deftype of
  1354. stringdef :
  1355. begin
  1356. { string constant (which can be part of array constructor)
  1357. to zero terminated string constant }
  1358. if (fromtreetype in [arrayconstructorn,stringconstn]) and
  1359. is_pchar(def_to) or is_pwidechar(def_to) then
  1360. begin
  1361. doconv:=tc_cstring_2_pchar;
  1362. b:=1;
  1363. end;
  1364. end;
  1365. orddef :
  1366. begin
  1367. { char constant to zero terminated string constant }
  1368. if (fromtreetype=ordconstn) then
  1369. begin
  1370. if is_equal(def_from,cchartype.def) and
  1371. is_pchar(def_to) then
  1372. begin
  1373. doconv:=tc_cchar_2_pchar;
  1374. b:=1;
  1375. end
  1376. else
  1377. if is_integer(def_from) then
  1378. begin
  1379. doconv:=tc_cord_2_pointer;
  1380. b:=1;
  1381. end;
  1382. end;
  1383. end;
  1384. arraydef :
  1385. begin
  1386. { chararray to pointer }
  1387. if is_zero_based_array(def_from) and
  1388. is_equal(tarraydef(def_from).elementtype.def,tpointerdef(def_to).pointertype.def) then
  1389. begin
  1390. doconv:=tc_array_2_pointer;
  1391. b:=1;
  1392. end;
  1393. end;
  1394. pointerdef :
  1395. begin
  1396. { child class pointer can be assigned to anchestor pointers }
  1397. if (
  1398. (tpointerdef(def_from).pointertype.def.deftype=objectdef) and
  1399. (tpointerdef(def_to).pointertype.def.deftype=objectdef) and
  1400. tobjectdef(tpointerdef(def_from).pointertype.def).is_related(
  1401. tobjectdef(tpointerdef(def_to).pointertype.def))
  1402. ) or
  1403. { all pointers can be assigned to void-pointer }
  1404. is_equal(tpointerdef(def_to).pointertype.def,voidtype.def) or
  1405. { in my opnion, is this not clean pascal }
  1406. { well, but it's handy to use, it isn't ? (FK) }
  1407. is_equal(tpointerdef(def_from).pointertype.def,voidtype.def) then
  1408. begin
  1409. { but don't allow conversion between farpointer-pointer }
  1410. if (tpointerdef(def_to).is_far=tpointerdef(def_from).is_far) then
  1411. begin
  1412. doconv:=tc_equal;
  1413. b:=1;
  1414. end;
  1415. end;
  1416. end;
  1417. procvardef :
  1418. begin
  1419. { procedure variable can be assigned to an void pointer }
  1420. { Not anymore. Use the @ operator now.}
  1421. if not(m_tp_procvar in aktmodeswitches) and
  1422. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  1423. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  1424. begin
  1425. doconv:=tc_equal;
  1426. b:=1;
  1427. end;
  1428. end;
  1429. classrefdef,
  1430. objectdef :
  1431. begin
  1432. { class types and class reference type
  1433. can be assigned to void pointers }
  1434. if (
  1435. is_class_or_interface(def_from) or
  1436. (def_from.deftype=classrefdef)
  1437. ) and
  1438. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  1439. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  1440. begin
  1441. doconv:=tc_equal;
  1442. b:=1;
  1443. end;
  1444. end;
  1445. end;
  1446. end;
  1447. setdef :
  1448. begin
  1449. { automatic arrayconstructor -> set conversion }
  1450. if is_array_constructor(def_from) then
  1451. begin
  1452. doconv:=tc_arrayconstructor_2_set;
  1453. b:=1;
  1454. end;
  1455. end;
  1456. procvardef :
  1457. begin
  1458. { proc -> procvar }
  1459. if (def_from.deftype=procdef) and
  1460. (m_tp_procvar in aktmodeswitches) then
  1461. begin
  1462. doconv:=tc_proc_2_procvar;
  1463. if proc_to_procvar_equal(tprocdef(def_from),tprocvardef(def_to)) then
  1464. b:=1;
  1465. end
  1466. else
  1467. { for example delphi allows the assignement from pointers }
  1468. { to procedure variables }
  1469. if (m_pointer_2_procedure in aktmodeswitches) and
  1470. (def_from.deftype=pointerdef) and
  1471. (tpointerdef(def_from).pointertype.def.deftype=orddef) and
  1472. (torddef(tpointerdef(def_from).pointertype.def).typ=uvoid) then
  1473. begin
  1474. doconv:=tc_equal;
  1475. b:=1;
  1476. end
  1477. else
  1478. { nil is compatible with procvars }
  1479. if (fromtreetype=niln) then
  1480. begin
  1481. doconv:=tc_equal;
  1482. b:=1;
  1483. end;
  1484. end;
  1485. objectdef :
  1486. begin
  1487. { object pascal objects }
  1488. if (def_from.deftype=objectdef) and
  1489. tobjectdef(def_from).is_related(tobjectdef(def_to)) then
  1490. begin
  1491. doconv:=tc_equal;
  1492. b:=1;
  1493. end
  1494. else
  1495. { Class/interface specific }
  1496. if is_class_or_interface(def_to) then
  1497. begin
  1498. { void pointer also for delphi mode }
  1499. if (m_delphi in aktmodeswitches) and
  1500. is_voidpointer(def_from) then
  1501. begin
  1502. doconv:=tc_equal;
  1503. b:=1;
  1504. end
  1505. else
  1506. { nil is compatible with class instances and interfaces }
  1507. if (fromtreetype=niln) then
  1508. begin
  1509. doconv:=tc_equal;
  1510. b:=1;
  1511. end
  1512. { classes can be assigned to interfaces }
  1513. else if is_interface(def_to) and
  1514. is_class(def_from) and
  1515. assigned(tobjectdef(def_from).implementedinterfaces) and
  1516. (tobjectdef(def_from).implementedinterfaces.searchintf(def_to)<>-1) then
  1517. begin
  1518. doconv:=tc_class_2_intf;
  1519. b:=1;
  1520. end
  1521. { Interface 2 GUID handling }
  1522. else if (def_to=tdef(rec_tguid)) and
  1523. (fromtreetype=typen) and
  1524. is_interface(def_from) and
  1525. tobjectdef(def_from).isiidguidvalid then
  1526. begin
  1527. b:=1;
  1528. doconv:=tc_equal;
  1529. end;
  1530. end;
  1531. end;
  1532. classrefdef :
  1533. begin
  1534. { class reference types }
  1535. if (def_from.deftype=classrefdef) then
  1536. begin
  1537. doconv:=tc_equal;
  1538. if tobjectdef(tclassrefdef(def_from).pointertype.def).is_related(
  1539. tobjectdef(tclassrefdef(def_to).pointertype.def)) then
  1540. b:=1;
  1541. end
  1542. else
  1543. { nil is compatible with class references }
  1544. if (fromtreetype=niln) then
  1545. begin
  1546. doconv:=tc_equal;
  1547. b:=1;
  1548. end;
  1549. end;
  1550. filedef :
  1551. begin
  1552. { typed files are all equal to the abstract file type
  1553. name TYPEDFILE in system.pp in is_equal in types.pas
  1554. the problem is that it sholud be also compatible to FILE
  1555. but this would leed to a problem for ASSIGN RESET and REWRITE
  1556. when trying to find the good overloaded function !!
  1557. so all file function are doubled in system.pp
  1558. this is not very beautiful !!}
  1559. if (def_from.deftype=filedef) and
  1560. (
  1561. (
  1562. (tfiledef(def_from).filetyp = ft_typed) and
  1563. (tfiledef(def_to).filetyp = ft_typed) and
  1564. (
  1565. (tfiledef(def_from).typedfiletype.def = tdef(voidtype.def)) or
  1566. (tfiledef(def_to).typedfiletype.def = tdef(voidtype.def))
  1567. )
  1568. ) or
  1569. (
  1570. (
  1571. (tfiledef(def_from).filetyp = ft_untyped) and
  1572. (tfiledef(def_to).filetyp = ft_typed)
  1573. ) or
  1574. (
  1575. (tfiledef(def_from).filetyp = ft_typed) and
  1576. (tfiledef(def_to).filetyp = ft_untyped)
  1577. )
  1578. )
  1579. ) then
  1580. begin
  1581. doconv:=tc_equal;
  1582. b:=1;
  1583. end
  1584. end;
  1585. recorddef :
  1586. begin
  1587. { interface -> guid }
  1588. if is_interface(def_from) and
  1589. (def_to=rec_tguid) then
  1590. begin
  1591. doconv:=tc_intf_2_guid;
  1592. b:=1;
  1593. end
  1594. else
  1595. begin
  1596. { assignment overwritten ?? }
  1597. if assignment_overloaded(def_from,def_to)<>nil then
  1598. b:=2;
  1599. end;
  1600. end;
  1601. else
  1602. begin
  1603. { assignment overwritten ?? }
  1604. if assignment_overloaded(def_from,def_to)<>nil then
  1605. b:=2;
  1606. end;
  1607. end;
  1608. isconvertable:=b;
  1609. end;
  1610. function CheckTypes(def1,def2 : tdef) : boolean;
  1611. var
  1612. s1,s2 : string;
  1613. begin
  1614. if not is_equal(def1,def2) then
  1615. begin
  1616. { Crash prevention }
  1617. if (not assigned(def1)) or (not assigned(def2)) then
  1618. Message(type_e_mismatch)
  1619. else
  1620. begin
  1621. s1:=def1.typename;
  1622. s2:=def2.typename;
  1623. if (s1<>'<unknown type>') and (s2<>'<unknown type>') then
  1624. Message2(type_e_not_equal_types,def1.typename,def2.typename)
  1625. else
  1626. Message(type_e_mismatch);
  1627. end;
  1628. CheckTypes:=false;
  1629. end
  1630. else
  1631. CheckTypes:=true;
  1632. end;
  1633. end.
  1634. {
  1635. $Log$
  1636. Revision 1.53 2001-10-25 21:22:40 peter
  1637. * calling convention rewrite
  1638. Revision 1.52 2001/10/22 21:21:09 peter
  1639. * allow enum(enum)
  1640. Revision 1.51 2001/10/22 15:13:49 jonas
  1641. * allow typeconversion of open array-of-char to string
  1642. Revision 1.50 2001/10/20 19:28:39 peter
  1643. * interface 2 guid support
  1644. * guid constants support
  1645. Revision 1.49 2001/10/17 22:41:05 florian
  1646. * several widechar fixes, case works now
  1647. Revision 1.48 2001/10/16 17:15:44 jonas
  1648. * auto-converting from int64 to real is again allowed for all modes
  1649. (it's allowed in Delphi too)
  1650. Revision 1.47 2001/09/03 13:27:41 jonas
  1651. * compilerproc implementation of set addition/substraction/...
  1652. * changed the declaration of some set helpers somewhat to accomodate the
  1653. above change
  1654. * i386 still uses the old code for comparisons of sets, because its
  1655. helpers return the results in the flags
  1656. * dummy tc_normal_2_small_set type conversion because I need the original
  1657. resulttype of the set add nodes
  1658. NOTE: you have to start a cycle with 1.0.5!
  1659. Revision 1.46 2001/09/02 21:15:34 peter
  1660. * don't allow int64->real for delphi mode
  1661. Revision 1.45 2001/08/19 21:11:21 florian
  1662. * some bugs fix:
  1663. - overload; with external procedures fixed
  1664. - better selection of routine to do an overloaded
  1665. type case
  1666. - ... some more
  1667. Revision 1.44 2001/07/08 21:00:16 peter
  1668. * various widestring updates, it works now mostly without charset
  1669. mapping supported
  1670. Revision 1.43 2001/06/29 14:16:57 jonas
  1671. * fixed inconsistent handling of procvars in FPC mode (sometimes @ was
  1672. required to assign the address of a procedure to a procvar, sometimes
  1673. not. Now it is always required) (merged)
  1674. Revision 1.42 2001/05/08 21:06:33 florian
  1675. * some more support for widechars commited especially
  1676. regarding type casting and constants
  1677. Revision 1.41 2001/04/22 22:46:49 florian
  1678. * more variant support
  1679. Revision 1.40 2001/04/18 22:02:00 peter
  1680. * registration of targets and assemblers
  1681. Revision 1.39 2001/04/13 01:22:17 peter
  1682. * symtable change to classes
  1683. * range check generation and errors fixed, make cycle DEBUG=1 works
  1684. * memory leaks fixed
  1685. Revision 1.38 2001/04/04 21:30:47 florian
  1686. * applied several fixes to get the DD8 Delphi Unit compiled
  1687. e.g. "forward"-interfaces are working now
  1688. Revision 1.37 2001/04/02 21:20:35 peter
  1689. * resulttype rewrite
  1690. Revision 1.36 2001/03/23 00:16:07 florian
  1691. + some stuff to compile FreeCLX added
  1692. Revision 1.35 2001/03/03 12:38:33 jonas
  1693. + support for arraydefs in is_signed (for their rangetype, used in rangechecks)
  1694. Revision 1.34 2001/02/26 19:44:55 peter
  1695. * merged generic m68k updates from fixes branch
  1696. Revision 1.33 2001/02/26 12:47:46 jonas
  1697. * fixed bug in type checking for compatibility of set elements (merged)
  1698. * released fix in options.pas from Carl also for FPC (merged)
  1699. Revision 1.32 2001/02/20 21:44:25 peter
  1700. * tvarrec -> array of const fixed
  1701. Revision 1.31 2001/01/22 11:20:15 jonas
  1702. * fixed web bug 1363 (merged)
  1703. Revision 1.30 2001/01/08 21:43:38 peter
  1704. * string isn't compatible with array of char
  1705. Revision 1.29 2000/12/25 00:07:30 peter
  1706. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1707. tlinkedlist objects)
  1708. Revision 1.28 2000/12/22 22:38:12 peter
  1709. * fixed bug #1286
  1710. Revision 1.27 2000/12/20 15:59:40 jonas
  1711. - removed obsolete special case for range checking of cardinal constants
  1712. at compile time
  1713. Revision 1.26 2000/12/11 19:13:54 jonas
  1714. * fixed range checking of cardinal constants
  1715. * fixed range checking of "qword constants" (they don't really exist,
  1716. but values > high(int64) were set to zero if assigned to qword)
  1717. Revision 1.25 2000/12/08 14:06:11 jonas
  1718. * fix for web bug 1245: arrays of char with size >255 are now passed to
  1719. overloaded procedures which expect ansistrings instead of shortstrings
  1720. if possible
  1721. * pointer to array of chars (when using $t+) are now also considered
  1722. pchars
  1723. Revision 1.24 2000/11/20 15:52:47 jonas
  1724. * testrange now always cuts a constant to the size of the destination
  1725. if a rangeerror occurred
  1726. * changed an "and $ffffffff" to "and (int64($fffffff) shl 4 + $f" to
  1727. work around the constant evaluation problem we currently have
  1728. Revision 1.23 2000/11/13 14:42:41 jonas
  1729. * fix in testrange so that 64bit constants are properly truncated when
  1730. assigned to 32bit vars
  1731. Revision 1.22 2000/11/13 11:30:55 florian
  1732. * some bugs with interfaces and NIL fixed
  1733. Revision 1.21 2000/11/12 23:24:12 florian
  1734. * interfaces are basically running
  1735. Revision 1.20 2000/11/11 16:13:31 peter
  1736. * farpointer and normal pointer aren't compatible
  1737. Revision 1.19 2000/11/06 22:30:30 peter
  1738. * more fixes
  1739. Revision 1.18 2000/11/04 14:25:22 florian
  1740. + merged Attila's changes for interfaces, not tested yet
  1741. Revision 1.17 2000/10/31 22:30:13 peter
  1742. * merged asm result patch part 2
  1743. Revision 1.16 2000/10/31 22:02:55 peter
  1744. * symtable splitted, no real code changes
  1745. Revision 1.15 2000/10/21 18:16:12 florian
  1746. * a lot of changes:
  1747. - basic dyn. array support
  1748. - basic C++ support
  1749. - some work for interfaces done
  1750. ....
  1751. Revision 1.14 2000/10/14 10:14:56 peter
  1752. * moehrendorf oct 2000 rewrite
  1753. Revision 1.13 2000/10/01 19:48:26 peter
  1754. * lot of compile updates for cg11
  1755. Revision 1.12 2000/09/30 16:08:46 peter
  1756. * more cg11 updates
  1757. Revision 1.11 2000/09/24 15:06:32 peter
  1758. * use defines.inc
  1759. Revision 1.10 2000/09/18 12:31:15 jonas
  1760. * fixed bug in push_addr_param for arrays (merged from fixes branch)
  1761. Revision 1.9 2000/09/10 20:16:21 peter
  1762. * array of const isn't equal with array of <type> (merged)
  1763. Revision 1.8 2000/08/19 19:51:03 peter
  1764. * fixed bug with comparing constsym strings
  1765. Revision 1.7 2000/08/16 13:06:07 florian
  1766. + support of 64 bit integer constants
  1767. Revision 1.6 2000/08/13 13:07:18 peter
  1768. * equal_paras now also checks default parameter value
  1769. Revision 1.5 2000/08/12 06:49:22 florian
  1770. + case statement for int64/qword implemented
  1771. Revision 1.4 2000/08/08 19:26:41 peter
  1772. * equal_constsym() needed for default para
  1773. Revision 1.3 2000/07/13 12:08:28 michael
  1774. + patched to 1.1.0 with former 1.09patch from peter
  1775. Revision 1.2 2000/07/13 11:32:53 michael
  1776. + removed logs
  1777. }