types.pas 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  1. {
  2. $Id$
  3. Copyright (C) 1993-98 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. interface
  20. uses
  21. cobjects,globals,symtable,aasm;
  22. type
  23. tmmxtype = (mmxno,mmxu8bit,mmxs8bit,mmxu16bit,mmxs16bit,
  24. mmxu32bit,mmxs32bit,mmxfixed16,mmxsingle);
  25. { returns true, if def defines an ordinal type }
  26. function is_ordinal(def : pdef) : boolean;
  27. { returns the min. value of the type }
  28. function get_min_value(def : pdef) : longint;
  29. { returns true, if def defines an ordinal type }
  30. function is_integer(def : pdef) : boolean;
  31. { true if p is a boolean }
  32. function is_boolean(def : pdef) : boolean;
  33. { true if p is a char }
  34. function is_char(def : pdef) : boolean;
  35. { true if p points to an open string def }
  36. function is_open_string(p : pdef) : boolean;
  37. { true if p points to an open array def }
  38. function is_open_array(p : pdef) : boolean;
  39. { true, if p points to an array of const def }
  40. function is_array_constructor(p : pdef) : boolean;
  41. { true if p is an ansi string def }
  42. function is_ansistring(p : pdef) : boolean;
  43. { true if p is a long string def }
  44. function is_longstring(p : pdef) : boolean;
  45. { true if p is a wide string def }
  46. function is_widestring(p : pdef) : boolean;
  47. { true if p is a short string def }
  48. function is_shortstring(p : pdef) : boolean;
  49. { true if p is a char array def }
  50. function is_chararray(p : pdef) : boolean;
  51. { true if p is a pchar def }
  52. function is_pchar(p : pdef) : boolean;
  53. { true if p is a smallset def }
  54. function is_smallset(p : pdef) : boolean;
  55. { returns true, if def defines a signed data type (only for ordinal types) }
  56. function is_signed(def : pdef) : boolean;
  57. { returns true, if def uses FPU }
  58. function is_fpu(def : pdef) : boolean;
  59. { true if the return value is in EAX }
  60. function ret_in_acc(def : pdef) : boolean;
  61. { true if uses a parameter as return value }
  62. function ret_in_param(def : pdef) : boolean;
  63. { true, if def is a 64 bit int type }
  64. function is_64bitint(def : pdef) : boolean;
  65. function push_high_param(def : pdef) : boolean;
  66. { true if a parameter is too large to copy and only the address is pushed }
  67. function push_addr_param(def : pdef) : boolean;
  68. { true if we must never copy this parameter }
  69. const
  70. never_copy_const_param : boolean = false;
  71. { true, if def1 and def2 are semantical the same }
  72. function is_equal(def1,def2 : pdef) : boolean;
  73. { checks for type compatibility (subgroups of type) }
  74. { used for case statements... probably missing stuff }
  75. { to use on other types }
  76. function is_subequal(def1, def2: pdef): boolean;
  77. { true, if two parameter lists are equal }
  78. { if value_equal_const is true, call by value }
  79. { and call by const parameter are assumed as }
  80. { equal }
  81. function equal_paras(def1,def2 : pdefcoll;value_equal_const : boolean) : boolean;
  82. { true if a function can be assigned to a procvar }
  83. function proc_to_procvar_equal(def1,def2 : pabstractprocdef) : boolean;
  84. { if l isn't in the range of def a range check error is generated }
  85. procedure testrange(def : pdef;l : longint);
  86. { returns the range of def }
  87. procedure getrange(def : pdef;var l : longint;var h : longint);
  88. { generates a VMT for _class }
  89. procedure genvmt(_class : pobjectdef);
  90. { generates the message tables for a class }
  91. function genstrmsgtab(_class : pobjectdef) : plabel;
  92. function genintmsgtab(_class : pobjectdef) : plabel;
  93. { some type helper routines for MMX support }
  94. function is_mmx_able_array(p : pdef) : boolean;
  95. { returns the mmx type }
  96. function mmx_type(p : pdef) : tmmxtype;
  97. implementation
  98. uses
  99. strings,globtype,verbose;
  100. function equal_paras(def1,def2 : pdefcoll;value_equal_const : boolean) : boolean;
  101. begin
  102. while (assigned(def1)) and (assigned(def2)) do
  103. begin
  104. if value_equal_const then
  105. begin
  106. if not(is_equal(def1^.data,def2^.data)) or
  107. ((def1^.paratyp<>def2^.paratyp) and
  108. ((def1^.paratyp=vs_var) or
  109. (def1^.paratyp=vs_var)
  110. )
  111. ) then
  112. begin
  113. equal_paras:=false;
  114. exit;
  115. end;
  116. end
  117. else
  118. begin
  119. if not(is_equal(def1^.data,def2^.data)) or
  120. (def1^.paratyp<>def2^.paratyp) then
  121. begin
  122. equal_paras:=false;
  123. exit;
  124. end;
  125. end;
  126. def1:=def1^.next;
  127. def2:=def2^.next;
  128. end;
  129. if (def1=nil) and (def2=nil) then
  130. equal_paras:=true
  131. else
  132. equal_paras:=false;
  133. end;
  134. { true if a function can be assigned to a procvar }
  135. function proc_to_procvar_equal(def1,def2 : pabstractprocdef) : boolean;
  136. begin
  137. if is_equal(def1^.retdef,def2^.retdef) and
  138. equal_paras(def1^.para1,def2^.para1,false) and
  139. ((def1^.options and po_compatibility_options)=
  140. (def2^.options and po_compatibility_options)) then
  141. proc_to_procvar_equal:=true
  142. else
  143. proc_to_procvar_equal:=false;
  144. end;
  145. { returns true, if def uses FPU }
  146. function is_fpu(def : pdef) : boolean;
  147. begin
  148. is_fpu:=(def^.deftype=floatdef) and (pfloatdef(def)^.typ<>f32bit);
  149. end;
  150. { true if p is an ordinal }
  151. function is_ordinal(def : pdef) : boolean;
  152. var
  153. dt : tbasetype;
  154. begin
  155. case def^.deftype of
  156. orddef : begin
  157. dt:=porddef(def)^.typ;
  158. is_ordinal:=dt in [uchar,u8bit,u16bit,u32bit,u64bit,s8bit,s16bit,s32bit,
  159. s64bitint,bool8bit,bool16bit,bool32bit];
  160. end;
  161. enumdef : is_ordinal:=true;
  162. else
  163. is_ordinal:=false;
  164. end;
  165. end;
  166. { returns the min. value of the type }
  167. function get_min_value(def : pdef) : longint;
  168. begin
  169. case def^.deftype of
  170. orddef:
  171. get_min_value:=porddef(def)^.low;
  172. enumdef:
  173. get_min_value:=penumdef(def)^.min;
  174. else
  175. get_min_value:=0;
  176. end;
  177. end;
  178. { true if p is an integer }
  179. function is_integer(def : pdef) : boolean;
  180. begin
  181. is_integer:=(def^.deftype=orddef) and
  182. (porddef(def)^.typ in [uauto,u8bit,u16bit,u32bit,s8bit,s16bit,s32bit]);
  183. end;
  184. { true if p is a boolean }
  185. function is_boolean(def : pdef) : boolean;
  186. begin
  187. is_boolean:=(def^.deftype=orddef) and
  188. (porddef(def)^.typ in [bool8bit,bool16bit,bool32bit]);
  189. end;
  190. { true if p is a char }
  191. function is_char(def : pdef) : boolean;
  192. begin
  193. is_char:=(def^.deftype=orddef) and
  194. (porddef(def)^.typ=uchar);
  195. end;
  196. { true if p is signed (integer) }
  197. function is_signed(def : pdef) : boolean;
  198. var
  199. dt : tbasetype;
  200. begin
  201. case def^.deftype of
  202. orddef : begin
  203. dt:=porddef(def)^.typ;
  204. is_signed:=(dt in [s8bit,s16bit,s32bit]);
  205. end;
  206. enumdef : is_signed:=false;
  207. else
  208. is_signed:=false;
  209. end;
  210. end;
  211. { true, if p points to an open array def }
  212. function is_open_string(p : pdef) : boolean;
  213. begin
  214. is_open_string:=(p^.deftype=stringdef) and
  215. (pstringdef(p)^.string_typ=st_shortstring) and
  216. (pstringdef(p)^.len=0);
  217. end;
  218. { true, if p points to an open array def }
  219. function is_open_array(p : pdef) : boolean;
  220. begin
  221. is_open_array:=(p^.deftype=arraydef) and
  222. (parraydef(p)^.lowrange=0) and
  223. (parraydef(p)^.highrange=-1);
  224. end;
  225. { true, if p points to an array of const def }
  226. function is_array_constructor(p : pdef) : boolean;
  227. begin
  228. is_array_constructor:=(p^.deftype=arraydef) and
  229. (parraydef(p)^.IsConstructor);
  230. end;
  231. { true if p is an ansi string def }
  232. function is_ansistring(p : pdef) : boolean;
  233. begin
  234. is_ansistring:=(p^.deftype=stringdef) and
  235. (pstringdef(p)^.string_typ=st_ansistring);
  236. end;
  237. { true if p is an long string def }
  238. function is_longstring(p : pdef) : boolean;
  239. begin
  240. is_longstring:=(p^.deftype=stringdef) and
  241. (pstringdef(p)^.string_typ=st_longstring);
  242. end;
  243. { true if p is an wide string def }
  244. function is_widestring(p : pdef) : boolean;
  245. begin
  246. is_widestring:=(p^.deftype=stringdef) and
  247. (pstringdef(p)^.string_typ=st_widestring);
  248. end;
  249. { true if p is an short string def }
  250. function is_shortstring(p : pdef) : boolean;
  251. begin
  252. is_shortstring:=(p^.deftype=stringdef) and
  253. (pstringdef(p)^.string_typ=st_shortstring);
  254. end;
  255. { true if p is a char array def }
  256. function is_chararray(p : pdef) : boolean;
  257. begin
  258. is_chararray:=(p^.deftype=arraydef) and
  259. is_equal(parraydef(p)^.definition,cchardef);
  260. end;
  261. { true if p is a pchar def }
  262. function is_pchar(p : pdef) : boolean;
  263. begin
  264. is_pchar:=(p^.deftype=pointerdef) and
  265. is_equal(Ppointerdef(p)^.definition,cchardef);
  266. end;
  267. { true if p is a smallset def }
  268. function is_smallset(p : pdef) : boolean;
  269. begin
  270. is_smallset:=(p^.deftype=setdef) and
  271. (psetdef(p)^.settype=smallset);
  272. end;
  273. { true if the return value is in accumulator (EAX for i386), D0 for 68k }
  274. function ret_in_acc(def : pdef) : boolean;
  275. begin
  276. ret_in_acc:=(def^.deftype in [orddef,pointerdef,enumdef,classrefdef]) or
  277. ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_ansistring,st_widestring])) or
  278. ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)=0)) or
  279. ((def^.deftype=objectdef) and pobjectdef(def)^.isclass) or
  280. ((def^.deftype=setdef) and (psetdef(def)^.settype=smallset)) or
  281. ((def^.deftype=floatdef) and (pfloatdef(def)^.typ=f32bit));
  282. end;
  283. { true, if def is a 64 bit int type }
  284. function is_64bitint(def : pdef) : boolean;
  285. begin
  286. is_64bitint:=(def^.deftype=orddef) and (porddef(def)^.typ in [u64bit,s64bitint])
  287. end;
  288. { true if uses a parameter as return value }
  289. function ret_in_param(def : pdef) : boolean;
  290. begin
  291. ret_in_param:=(def^.deftype in [arraydef,recorddef]) or
  292. ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_shortstring,st_longstring])) or
  293. ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
  294. ((def^.deftype=objectdef) and not(pobjectdef(def)^.isclass)) or
  295. ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
  296. end;
  297. function push_high_param(def : pdef) : boolean;
  298. begin
  299. push_high_param:=is_open_array(def) or is_open_string(def);
  300. end;
  301. { true if a parameter is too large to copy and only the address is pushed }
  302. function push_addr_param(def : pdef) : boolean;
  303. begin
  304. push_addr_param:=never_copy_const_param or
  305. (def^.deftype in [arraydef,formaldef,recorddef]) or
  306. ((def^.deftype=objectdef) and not(pobjectdef(def)^.isclass)) or
  307. ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_shortstring,st_longstring])) or
  308. ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
  309. ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
  310. end;
  311. { test if l is in the range of def, outputs error if out of range }
  312. procedure testrange(def : pdef;l : longint);
  313. var
  314. lv,hv: longint;
  315. begin
  316. getrange(def,lv,hv);
  317. if (def^.deftype=orddef) and
  318. (porddef(def)^.typ=u32bit) then
  319. begin
  320. if lv<=hv then
  321. begin
  322. if (l<lv) or (l>hv) then
  323. begin
  324. if (cs_check_range in aktlocalswitches) then
  325. Message(parser_e_range_check_error)
  326. else
  327. Message(parser_w_range_check_error);
  328. end;
  329. end
  330. else
  331. { this happens with the wrap around problem }
  332. { if lv is positive and hv is over $7ffffff }
  333. { so it seems negative }
  334. begin
  335. if ((l>=0) and (l<lv)) or
  336. ((l<0) and (l>hv)) then
  337. begin
  338. if (cs_check_range in aktlocalswitches) then
  339. Message(parser_e_range_check_error)
  340. else
  341. Message(parser_w_range_check_error);
  342. end;
  343. end;
  344. end
  345. else if (l<lv) or (l>hv) then
  346. begin
  347. if (cs_check_range in aktlocalswitches) then
  348. Message(parser_e_range_check_error)
  349. else
  350. Message(parser_w_range_check_error);
  351. end;
  352. end;
  353. { return the range from def in l and h }
  354. procedure getrange(def : pdef;var l : longint;var h : longint);
  355. begin
  356. case def^.deftype of
  357. orddef : begin
  358. l:=porddef(def)^.low;
  359. h:=porddef(def)^.high;
  360. end;
  361. enumdef : begin
  362. l:=penumdef(def)^.min;
  363. h:=penumdef(def)^.max;
  364. end;
  365. else
  366. internalerror(987);
  367. end;
  368. end;
  369. function mmx_type(p : pdef) : tmmxtype;
  370. begin
  371. mmx_type:=mmxno;
  372. if is_mmx_able_array(p) then
  373. begin
  374. if parraydef(p)^.definition^.deftype=floatdef then
  375. case pfloatdef(parraydef(p)^.definition)^.typ of
  376. s32real:
  377. mmx_type:=mmxsingle;
  378. f16bit:
  379. mmx_type:=mmxfixed16
  380. end
  381. else
  382. case porddef(parraydef(p)^.definition)^.typ of
  383. u8bit:
  384. mmx_type:=mmxu8bit;
  385. s8bit:
  386. mmx_type:=mmxs8bit;
  387. u16bit:
  388. mmx_type:=mmxu16bit;
  389. s16bit:
  390. mmx_type:=mmxs16bit;
  391. u32bit:
  392. mmx_type:=mmxu32bit;
  393. s32bit:
  394. mmx_type:=mmxs32bit;
  395. end;
  396. end;
  397. end;
  398. function is_mmx_able_array(p : pdef) : boolean;
  399. begin
  400. {$ifdef SUPPORT_MMX}
  401. if (cs_mmx_saturation in aktlocalswitches) then
  402. begin
  403. is_mmx_able_array:=(p^.deftype=arraydef) and
  404. (
  405. (
  406. (parraydef(p)^.definition^.deftype=orddef) and
  407. (
  408. (
  409. (parraydef(p)^.lowrange=0) and
  410. (parraydef(p)^.highrange=1) and
  411. (porddef(parraydef(p)^.definition)^.typ in [u32bit,s32bit])
  412. )
  413. or
  414. (
  415. (parraydef(p)^.lowrange=0) and
  416. (parraydef(p)^.highrange=3) and
  417. (porddef(parraydef(p)^.definition)^.typ in [u16bit,s16bit])
  418. )
  419. )
  420. )
  421. or
  422. (
  423. (
  424. (parraydef(p)^.definition^.deftype=floatdef) and
  425. (
  426. (parraydef(p)^.lowrange=0) and
  427. (parraydef(p)^.highrange=3) and
  428. (pfloatdef(parraydef(p)^.definition)^.typ=f16bit)
  429. ) or
  430. (
  431. (parraydef(p)^.lowrange=0) and
  432. (parraydef(p)^.highrange=1) and
  433. (pfloatdef(parraydef(p)^.definition)^.typ=s32real)
  434. )
  435. )
  436. )
  437. );
  438. end
  439. else
  440. begin
  441. is_mmx_able_array:=(p^.deftype=arraydef) and
  442. (
  443. (
  444. (parraydef(p)^.definition^.deftype=orddef) and
  445. (
  446. (
  447. (parraydef(p)^.lowrange=0) and
  448. (parraydef(p)^.highrange=1) and
  449. (porddef(parraydef(p)^.definition)^.typ in [u32bit,s32bit])
  450. )
  451. or
  452. (
  453. (parraydef(p)^.lowrange=0) and
  454. (parraydef(p)^.highrange=3) and
  455. (porddef(parraydef(p)^.definition)^.typ in [u16bit,s16bit])
  456. )
  457. or
  458. (
  459. (parraydef(p)^.lowrange=0) and
  460. (parraydef(p)^.highrange=7) and
  461. (porddef(parraydef(p)^.definition)^.typ in [u8bit,s8bit])
  462. )
  463. )
  464. )
  465. or
  466. (
  467. (parraydef(p)^.definition^.deftype=floatdef) and
  468. (
  469. (
  470. (parraydef(p)^.lowrange=0) and
  471. (parraydef(p)^.highrange=3) and
  472. (pfloatdef(parraydef(p)^.definition)^.typ=f32bit)
  473. )
  474. or
  475. (
  476. (parraydef(p)^.lowrange=0) and
  477. (parraydef(p)^.highrange=1) and
  478. (pfloatdef(parraydef(p)^.definition)^.typ=s32real)
  479. )
  480. )
  481. )
  482. );
  483. end;
  484. {$else SUPPORT_MMX}
  485. is_mmx_able_array:=false;
  486. {$endif SUPPORT_MMX}
  487. end;
  488. function is_equal(def1,def2 : pdef) : boolean;
  489. var
  490. b : boolean;
  491. hd : pdef;
  492. hp1,hp2 : pdefcoll;
  493. begin
  494. { both types must exists }
  495. if not (assigned(def1) and assigned(def2)) then
  496. begin
  497. is_equal:=false;
  498. exit;
  499. end;
  500. { be sure, that if there is a stringdef, that this is def1 }
  501. if def2^.deftype=stringdef then
  502. begin
  503. hd:=def1;
  504. def1:=def2;
  505. def2:=hd;
  506. end;
  507. b:=false;
  508. { both point to the same definition ? }
  509. if def1=def2 then
  510. b:=true
  511. else
  512. { pointer with an equal definition are equal }
  513. if (def1^.deftype=pointerdef) and (def2^.deftype=pointerdef) then
  514. { here a problem detected in tabsolutesym }
  515. { the types can be forward type !! }
  516. begin
  517. if assigned(def1^.sym) and ((def1^.sym^.properties and sp_forwarddef)<>0) then
  518. b:=(def1^.sym=def2^.sym)
  519. else
  520. b:=ppointerdef(def1)^.definition=ppointerdef(def2)^.definition;
  521. end
  522. else
  523. { ordinals are equal only when the ordinal type is equal }
  524. if (def1^.deftype=orddef) and (def2^.deftype=orddef) then
  525. begin
  526. case porddef(def1)^.typ of
  527. u8bit,u16bit,u32bit,
  528. s8bit,s16bit,s32bit:
  529. b:=((porddef(def1)^.typ=porddef(def2)^.typ) and
  530. (porddef(def1)^.low=porddef(def2)^.low) and
  531. (porddef(def1)^.high=porddef(def2)^.high));
  532. uvoid,uchar,
  533. bool8bit,bool16bit,bool32bit:
  534. b:=(porddef(def1)^.typ=porddef(def2)^.typ);
  535. end;
  536. end
  537. else
  538. if (def1^.deftype=floatdef) and (def2^.deftype=floatdef) then
  539. b:=pfloatdef(def1)^.typ=pfloatdef(def2)^.typ
  540. else
  541. { strings with the same length are equal }
  542. if (def1^.deftype=stringdef) and (def2^.deftype=stringdef) and
  543. (pstringdef(def1)^.string_typ=pstringdef(def2)^.string_typ) then
  544. begin
  545. b:=not(is_shortstring(def1)) or
  546. (pstringdef(def1)^.len=pstringdef(def2)^.len);
  547. end
  548. { STRING[N] ist equivalent zu ARRAY[0..N] OF CHAR (N<256) }
  549. {
  550. else if ((def1^.deftype=stringdef) and (def2^.deftype=arraydef)) and
  551. (parraydef(def2)^.definition^.deftype=orddef) and
  552. (porddef(parraydef(def1)^.definition)^.typ=uchar) and
  553. (parraydef(def2)^.lowrange=0) and
  554. (parraydef(def2)^.highrange=pstringdef(def1)^.len) then
  555. b:=true }
  556. else
  557. if (def1^.deftype=formaldef) and (def2^.deftype=formaldef) then
  558. b:=true
  559. { file types with the same file element type are equal }
  560. { this is a problem for assign !! }
  561. { changed to allow if one is untyped }
  562. { all typed files are equal to the special }
  563. { typed file that has voiddef as elemnt type }
  564. { but must NOT match for text file !!! }
  565. else
  566. if (def1^.deftype=filedef) and (def2^.deftype=filedef) then
  567. b:=(pfiledef(def1)^.filetype=pfiledef(def2)^.filetype) and
  568. ((
  569. ((pfiledef(def1)^.typed_as=nil) and
  570. (pfiledef(def2)^.typed_as=nil)) or
  571. (
  572. (pfiledef(def1)^.typed_as<>nil) and
  573. (pfiledef(def2)^.typed_as<>nil) and
  574. is_equal(pfiledef(def1)^.typed_as,pfiledef(def2)^.typed_as)
  575. ) or
  576. ( (pfiledef(def1)^.typed_as=pdef(voiddef)) or
  577. (pfiledef(def2)^.typed_as=pdef(voiddef))
  578. )))
  579. { sets with the same element type are equal }
  580. else
  581. if (def1^.deftype=setdef) and (def2^.deftype=setdef) then
  582. begin
  583. if assigned(psetdef(def1)^.setof) and
  584. assigned(psetdef(def2)^.setof) then
  585. b:=(psetdef(def1)^.setof^.deftype=psetdef(def2)^.setof^.deftype)
  586. else
  587. b:=true;
  588. end
  589. else
  590. if (def1^.deftype=procvardef) and (def2^.deftype=procvardef) then
  591. begin
  592. { poassembler isn't important for compatibility }
  593. { if a method is assigned to a methodpointer }
  594. { is checked before }
  595. b:=((pprocvardef(def1)^.options and not(poassembler or pomethodpointer or
  596. povirtualmethod or pooverridingmethod))=
  597. (pprocvardef(def2)^.options and not(poassembler or pomethodpointer or
  598. povirtualmethod or pooverridingmethod))
  599. ) and
  600. is_equal(pprocvardef(def1)^.retdef,pprocvardef(def2)^.retdef);
  601. { now evalute the parameters }
  602. if b then
  603. begin
  604. hp1:=pprocvardef(def1)^.para1;
  605. hp2:=pprocvardef(def1)^.para1;
  606. while assigned(hp1) and assigned(hp2) do
  607. begin
  608. if not(is_equal(hp1^.data,hp2^.data)) or
  609. not(hp1^.paratyp=hp2^.paratyp) then
  610. begin
  611. b:=false;
  612. break;
  613. end;
  614. hp1:=hp1^.next;
  615. hp2:=hp2^.next;
  616. end;
  617. b:=(hp1=nil) and (hp2=nil);
  618. end;
  619. end
  620. else
  621. if (def1^.deftype=arraydef) and (def2^.deftype=arraydef) and
  622. (is_open_array(def1) or is_open_array(def2)) then
  623. begin
  624. if parraydef(def1)^.IsArrayOfConst or parraydef(def2)^.IsArrayOfConst then
  625. b:=true
  626. else
  627. b:=is_equal(parraydef(def1)^.definition,parraydef(def2)^.definition);
  628. end
  629. else
  630. if (def1^.deftype=classrefdef) and (def2^.deftype=classrefdef) then
  631. begin
  632. { similar to pointerdef: }
  633. if assigned(def1^.sym) and ((def1^.sym^.properties and sp_forwarddef)<>0) then
  634. b:=(def1^.sym=def2^.sym)
  635. else
  636. b:=is_equal(pclassrefdef(def1)^.definition,pclassrefdef(def2)^.definition);
  637. end;
  638. is_equal:=b;
  639. end;
  640. function is_subequal(def1, def2: pdef): boolean;
  641. Begin
  642. if assigned(def1) and assigned(def2) then
  643. Begin
  644. is_subequal := FALSE;
  645. if (def1^.deftype = orddef) and (def2^.deftype = orddef) then
  646. Begin
  647. { see p.47 of Turbo Pascal 7.01 manual for the separation of types }
  648. { range checking for case statements is done with testrange }
  649. case porddef(def1)^.typ of
  650. u8bit,u16bit,u32bit,
  651. s8bit,s16bit,s32bit : is_subequal:=(porddef(def2)^.typ in [s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
  652. bool8bit,bool16bit,bool32bit : is_subequal:=(porddef(def2)^.typ in [bool8bit,bool16bit,bool32bit]);
  653. uchar : is_subequal:=(porddef(def2)^.typ=uchar);
  654. end;
  655. end
  656. else
  657. Begin
  658. { I assume that both enumerations are equal when the first }
  659. { pointers are equal. }
  660. if (def1^.deftype = enumdef) and (def2^.deftype =enumdef) then
  661. Begin
  662. if penumdef(def1)^.first = penumdef(def2)^.first then
  663. is_subequal := TRUE;
  664. end;
  665. end;
  666. end; { endif assigned ... }
  667. end;
  668. type
  669. pprocdeftree = ^tprocdeftree;
  670. tprocdeftree = record
  671. p : pprocdef;
  672. nl : plabel;
  673. l,r : pprocdeftree;
  674. end;
  675. var
  676. root : pprocdeftree;
  677. count : longint;
  678. procedure insertstr(p : pprocdeftree;var at : pprocdeftree);
  679. var
  680. i : longint;
  681. begin
  682. if at=nil then
  683. begin
  684. at:=p;
  685. inc(count);
  686. end
  687. else
  688. begin
  689. i:=strcomp(p^.p^.messageinf.str,at^.p^.messageinf.str);
  690. if i<0 then
  691. insertstr(p,at^.l)
  692. else if i>0 then
  693. insertstr(p,at^.r)
  694. else
  695. Message1(parser_e_duplicate_message_label,strpas(p^.p^.messageinf.str));
  696. end;
  697. end;
  698. procedure disposeprocdeftree(p : pprocdeftree);
  699. begin
  700. if assigned(p^.l) then
  701. disposeprocdeftree(p^.l);
  702. if assigned(p^.r) then
  703. disposeprocdeftree(p^.r);
  704. dispose(p);
  705. end;
  706. procedure insertmsgstr(p : psym);{$ifndef FPC}far;{$endif FPC}
  707. var
  708. hp : pprocdef;
  709. pt : pprocdeftree;
  710. begin
  711. if p^.typ=procsym then
  712. begin
  713. hp:=pprocsym(p)^.definition;
  714. while assigned(hp) do
  715. begin
  716. if (hp^.options and pomsgstr)<>0 then
  717. begin
  718. new(pt);
  719. pt^.p:=hp;
  720. pt^.l:=nil;
  721. pt^.r:=nil;
  722. insertstr(pt,root);
  723. end;
  724. hp:=hp^.nextoverloaded;
  725. end;
  726. end;
  727. end;
  728. procedure writenames(p : pprocdeftree);
  729. begin
  730. getlabel(p^.nl);
  731. if assigned(p^.l) then
  732. writenames(p^.l);
  733. datasegment^.concat(new(pai_label,init(p^.nl)));
  734. datasegment^.concat(new(pai_const,init_8bit(strlen(p^.p^.messageinf.str))));
  735. datasegment^.concat(new(pai_string,init_pchar(p^.p^.messageinf.str)));
  736. if assigned(p^.r) then
  737. writenames(p^.r);
  738. end;
  739. procedure writestrentry(p : pprocdeftree);
  740. begin
  741. if assigned(p^.l) then
  742. writestrentry(p^.l);
  743. { write name label }
  744. datasegment^.concat(new(pai_const_symbol,init(lab2str(p^.nl))));
  745. datasegment^.concat(new(pai_const_symbol,init(p^.p^.mangledname)));
  746. maybe_concat_external(p^.p^.owner,p^.p^.mangledname);
  747. if assigned(p^.r) then
  748. writestrentry(p^.r);
  749. end;
  750. function genstrmsgtab(_class : pobjectdef) : plabel;
  751. var
  752. r : plabel;
  753. begin
  754. root:=nil;
  755. count:=0;
  756. { insert all message handlers into a tree, sorted by name }
  757. _class^.publicsyms^.foreach(insertmsgstr);
  758. { write all names }
  759. if assigned(root) then
  760. writenames(root);
  761. { now start writing of the message string table }
  762. getlabel(r);
  763. datasegment^.concat(new(pai_label,init(r)));
  764. genstrmsgtab:=r;
  765. datasegment^.concat(new(pai_const,init_32bit(count)));
  766. if assigned(root) then
  767. begin
  768. writestrentry(root);
  769. disposeprocdeftree(root);
  770. end;
  771. end;
  772. procedure insertint(p : pprocdeftree;var at : pprocdeftree);
  773. var
  774. i : longint;
  775. begin
  776. if at=nil then
  777. begin
  778. at:=p;
  779. inc(count);
  780. end
  781. else
  782. begin
  783. i:=strcomp(p^.p^.messageinf.str,at^.p^.messageinf.str);
  784. if p^.p^.messageinf.i<at^.p^.messageinf.i then
  785. insertstr(p,at^.l)
  786. else if p^.p^.messageinf.i>at^.p^.messageinf.i then
  787. insertstr(p,at^.r)
  788. else
  789. Message1(parser_e_duplicate_message_label,tostr(p^.p^.messageinf.i));
  790. end;
  791. end;
  792. procedure writeintentry(p : pprocdeftree);
  793. begin
  794. if assigned(p^.l) then
  795. writeintentry(p^.l);
  796. { write name label }
  797. datasegment^.concat(new(pai_const,init_32bit(p^.p^.messageinf.i)));
  798. datasegment^.concat(new(pai_const_symbol,init(p^.p^.mangledname)));
  799. maybe_concat_external(p^.p^.owner,p^.p^.mangledname);
  800. if assigned(p^.r) then
  801. writeintentry(p^.r);
  802. end;
  803. procedure insertmsgint(p : psym);{$ifndef FPC}far;{$endif FPC}
  804. var
  805. hp : pprocdef;
  806. pt : pprocdeftree;
  807. begin
  808. if p^.typ=procsym then
  809. begin
  810. hp:=pprocsym(p)^.definition;
  811. while assigned(hp) do
  812. begin
  813. if (hp^.options and pomsgint)<>0 then
  814. begin
  815. new(pt);
  816. pt^.p:=hp;
  817. pt^.l:=nil;
  818. pt^.r:=nil;
  819. insertint(pt,root);
  820. end;
  821. hp:=hp^.nextoverloaded;
  822. end;
  823. end;
  824. end;
  825. function genintmsgtab(_class : pobjectdef) : plabel;
  826. var
  827. r : plabel;
  828. begin
  829. root:=nil;
  830. count:=0;
  831. { insert all message handlers into a tree, sorted by name }
  832. _class^.publicsyms^.foreach(insertmsgint);
  833. { now start writing of the message string table }
  834. getlabel(r);
  835. datasegment^.concat(new(pai_label,init(r)));
  836. genintmsgtab:=r;
  837. datasegment^.concat(new(pai_const,init_32bit(count)));
  838. if assigned(root) then
  839. begin
  840. writeintentry(root);
  841. disposeprocdeftree(root);
  842. end;
  843. end;
  844. type
  845. pprocdefcoll = ^tprocdefcoll;
  846. tprocdefcoll = record
  847. next : pprocdefcoll;
  848. data : pprocdef;
  849. end;
  850. psymcoll = ^tsymcoll;
  851. tsymcoll = record
  852. next : psymcoll;
  853. name : pstring;
  854. data : pprocdefcoll;
  855. end;
  856. var
  857. wurzel : psymcoll;
  858. nextvirtnumber : longint;
  859. _c : pobjectdef;
  860. has_constructor,has_virtual_method : boolean;
  861. procedure eachsym(sym : psym);{$ifndef FPC}far;{$endif FPC}
  862. var
  863. procdefcoll : pprocdefcoll;
  864. hp : pprocdef;
  865. symcoll : psymcoll;
  866. _name : string;
  867. stored : boolean;
  868. { creates a new entry in the procsym list }
  869. procedure newentry;
  870. begin
  871. { if not, generate a new symbol item }
  872. new(symcoll);
  873. symcoll^.name:=stringdup(sym^.name);
  874. symcoll^.next:=wurzel;
  875. symcoll^.data:=nil;
  876. wurzel:=symcoll;
  877. hp:=pprocsym(sym)^.definition;
  878. { inserts all definitions }
  879. while assigned(hp) do
  880. begin
  881. new(procdefcoll);
  882. procdefcoll^.data:=hp;
  883. procdefcoll^.next:=symcoll^.data;
  884. symcoll^.data:=procdefcoll;
  885. { if it's a virtual method }
  886. if (hp^.options and povirtualmethod)<>0 then
  887. begin
  888. { then it gets a number ... }
  889. hp^.extnumber:=nextvirtnumber;
  890. { and we inc the number }
  891. inc(nextvirtnumber);
  892. has_virtual_method:=true;
  893. end;
  894. if (hp^.options and poconstructor)<>0 then
  895. has_constructor:=true;
  896. { check, if a method should be overridden }
  897. if (hp^.options and pooverridingmethod)<>0 then
  898. Message1(parser_e_nothing_to_be_overridden,_c^.name^+'.'+_name);
  899. { next overloaded method }
  900. hp:=hp^.nextoverloaded;
  901. end;
  902. end;
  903. begin
  904. { put only sub routines into the VMT }
  905. if sym^.typ=procsym then
  906. begin
  907. _name:=sym^.name;
  908. symcoll:=wurzel;
  909. while assigned(symcoll) do
  910. begin
  911. { does the symbol already exist in the list ? }
  912. if _name=symcoll^.name^ then
  913. begin
  914. { walk through all defs of the symbol }
  915. hp:=pprocsym(sym)^.definition;
  916. while assigned(hp) do
  917. begin
  918. { compare with all stored definitions }
  919. procdefcoll:=symcoll^.data;
  920. stored:=false;
  921. while assigned(procdefcoll) do
  922. begin
  923. { compare parameters }
  924. if equal_paras(procdefcoll^.data^.para1,hp^.para1,false) and
  925. (
  926. ((procdefcoll^.data^.options and povirtualmethod)<>0) or
  927. ((hp^.options and povirtualmethod)<>0)
  928. ) then
  929. begin
  930. { wenn sie gleich sind }
  931. { und eine davon virtual deklariert ist }
  932. { Fehler falls nur eine VIRTUAL }
  933. if (procdefcoll^.data^.options and povirtualmethod)<>
  934. (hp^.options and povirtualmethod) then
  935. begin
  936. { in classes, we hide the old method }
  937. if _c^.isclass then
  938. begin
  939. { warn only if it is the first time,
  940. we hide the method }
  941. if _c=hp^._class then
  942. Message1(parser_w_should_use_override,_c^.name^+'.'+_name);
  943. newentry;
  944. exit;
  945. end
  946. else
  947. if _c=hp^._class then
  948. begin
  949. if (procdefcoll^.data^.options and povirtualmethod)<>0 then
  950. Message1(parser_w_overloaded_are_not_both_virtual,_c^.name^+'.'+_name)
  951. else
  952. Message1(parser_w_overloaded_are_not_both_non_virtual,
  953. _c^.name^+'.'+_name);
  954. newentry;
  955. exit;
  956. end;
  957. end;
  958. { check, if the overridden directive is set }
  959. { (povirtualmethod is set! }
  960. { class ? }
  961. if _c^.isclass and
  962. ((hp^.options and pooverridingmethod)=0) then
  963. begin
  964. { warn only if it is the first time,
  965. we hide the method }
  966. if _c=hp^._class then
  967. Message1(parser_w_should_use_override,_c^.name^+'.'+_name);
  968. newentry;
  969. exit;
  970. end;
  971. { error, if the return types aren't equal }
  972. if not(is_equal(procdefcoll^.data^.retdef,hp^.retdef)) and
  973. not((procdefcoll^.data^.retdef^.deftype=objectdef) and
  974. (hp^.retdef^.deftype=objectdef) and
  975. (pobjectdef(procdefcoll^.data^.retdef)^.isclass) and
  976. (pobjectdef(hp^.retdef)^.isclass) and
  977. (pobjectdef(hp^.retdef)^.isrelated(pobjectdef(procdefcoll^.data^.retdef)))) then
  978. Message1(parser_e_overloaded_methodes_not_same_ret,_c^.name^+'.'+_name);
  979. { the flags have to match }
  980. { except abstract and override }
  981. if (procdefcoll^.data^.options and not(poabstractmethod or pooverridingmethod))<>
  982. (hp^.options and not(poabstractmethod or pooverridingmethod)) then
  983. Message1(parser_e_header_dont_match_forward,_c^.name^+'.'+_name);
  984. { now set the number }
  985. hp^.extnumber:=procdefcoll^.data^.extnumber;
  986. { and exchange }
  987. procdefcoll^.data:=hp;
  988. stored:=true;
  989. end;
  990. procdefcoll:=procdefcoll^.next;
  991. end;
  992. { if it isn't saved in the list }
  993. { we create a new entry }
  994. if not(stored) then
  995. begin
  996. new(procdefcoll);
  997. procdefcoll^.data:=hp;
  998. procdefcoll^.next:=symcoll^.data;
  999. symcoll^.data:=procdefcoll;
  1000. { if the method is virtual ... }
  1001. if (hp^.options and povirtualmethod)<>0 then
  1002. begin
  1003. { ... it will get a number }
  1004. hp^.extnumber:=nextvirtnumber;
  1005. inc(nextvirtnumber);
  1006. end;
  1007. { check, if a method should be overridden }
  1008. if (hp^.options and pooverridingmethod)<>0 then
  1009. Message1(parser_e_nothing_to_be_overridden,_c^.name^+'.'+_name);
  1010. end;
  1011. hp:=hp^.nextoverloaded;
  1012. end;
  1013. exit;
  1014. end;
  1015. symcoll:=symcoll^.next;
  1016. end;
  1017. newentry;
  1018. end;
  1019. end;
  1020. procedure genvmt(_class : pobjectdef);
  1021. procedure do_genvmt(p : pobjectdef);
  1022. begin
  1023. { start with the base class }
  1024. if assigned(p^.childof) then
  1025. do_genvmt(p^.childof);
  1026. { walk through all public syms }
  1027. _c:=_class;
  1028. {$ifdef tp}
  1029. p^.publicsyms^.foreach(eachsym);
  1030. {$else}
  1031. p^.publicsyms^.foreach(@eachsym);
  1032. {$endif}
  1033. end;
  1034. var
  1035. symcoll : psymcoll;
  1036. procdefcoll : pprocdefcoll;
  1037. i : longint;
  1038. begin
  1039. wurzel:=nil;
  1040. nextvirtnumber:=0;
  1041. has_constructor:=false;
  1042. has_virtual_method:=false;
  1043. { generates a tree of all used methods }
  1044. do_genvmt(_class);
  1045. if has_virtual_method and not(has_constructor) then
  1046. Message1(parser_w_virtual_without_constructor,_class^.name^);
  1047. { generates the VMT }
  1048. { walk trough all numbers for virtual methods and search }
  1049. { the method }
  1050. for i:=0 to nextvirtnumber-1 do
  1051. begin
  1052. symcoll:=wurzel;
  1053. { walk trough all symbols }
  1054. while assigned(symcoll) do
  1055. begin
  1056. { walk trough all methods }
  1057. procdefcoll:=symcoll^.data;
  1058. while assigned(procdefcoll) do
  1059. begin
  1060. { writes the addresses to the VMT }
  1061. { but only this which are declared as virtual }
  1062. if procdefcoll^.data^.extnumber=i then
  1063. begin
  1064. if (procdefcoll^.data^.options and povirtualmethod)<>0 then
  1065. begin
  1066. { if a method is abstract, then is also the }
  1067. { class abstract and it's not allow to }
  1068. { generates an instance }
  1069. if (procdefcoll^.data^.options and poabstractmethod)<>0 then
  1070. begin
  1071. _class^.options:=_class^.options or oo_is_abstract;
  1072. datasegment^.concat(new(pai_const_symbol,
  1073. init('FPC_ABSTRACTERROR')));
  1074. end
  1075. else
  1076. begin
  1077. datasegment^.concat(new(pai_const_symbol,
  1078. init(procdefcoll^.data^.mangledname)));
  1079. maybe_concat_external(procdefcoll^.data^.owner,
  1080. procdefcoll^.data^.mangledname);
  1081. end;
  1082. end;
  1083. end;
  1084. procdefcoll:=procdefcoll^.next;
  1085. end;
  1086. symcoll:=symcoll^.next;
  1087. end;
  1088. end;
  1089. { disposes the above generated tree }
  1090. symcoll:=wurzel;
  1091. while assigned(symcoll) do
  1092. begin
  1093. wurzel:=symcoll^.next;
  1094. stringdispose(symcoll^.name);
  1095. procdefcoll:=symcoll^.data;
  1096. while assigned(procdefcoll) do
  1097. begin
  1098. symcoll^.data:=procdefcoll^.next;
  1099. dispose(procdefcoll);
  1100. procdefcoll:=symcoll^.data;
  1101. end;
  1102. dispose(symcoll);
  1103. symcoll:=wurzel;
  1104. end;
  1105. end;
  1106. end.
  1107. {
  1108. $Log$
  1109. Revision 1.54 1999-03-02 22:52:20 peter
  1110. * fixed char array, which can start with all possible values
  1111. Revision 1.53 1999/02/25 21:02:57 peter
  1112. * ag386bin updates
  1113. + coff writer
  1114. Revision 1.52 1999/02/24 09:51:44 florian
  1115. * wrong warning fixed, if a non-virtual method was hidden by a virtual
  1116. method (repoerted by Matthias Koeppe)
  1117. Revision 1.51 1999/02/22 23:33:31 florian
  1118. + message directive for integers added
  1119. Revision 1.50 1999/02/22 20:13:42 florian
  1120. + first implementation of message keyword
  1121. Revision 1.49 1999/02/16 00:45:30 peter
  1122. * fixed crashes by forgotten strpnew() for init_symbol
  1123. Revision 1.48 1999/02/09 23:03:08 florian
  1124. * check for duplicate field names in inherited classes/objects
  1125. * bug with self from the mailing list solved (the problem
  1126. was that classes were sometimes pushed wrong)
  1127. Revision 1.47 1999/01/27 00:14:01 florian
  1128. * "procedure of object"-stuff fixed
  1129. Revision 1.46 1999/01/21 22:10:54 peter
  1130. * fixed array of const
  1131. * generic platform independent high() support
  1132. Revision 1.45 1999/01/20 12:34:22 peter
  1133. * fixed typed file read/write
  1134. Revision 1.44 1999/01/15 11:33:03 pierre
  1135. * bug in mmx code removed
  1136. Revision 1.43 1998/12/30 13:41:20 peter
  1137. * released valuepara
  1138. Revision 1.42 1998/12/11 00:04:03 peter
  1139. + globtype,tokens,version unit splitted from globals
  1140. Revision 1.41 1998/12/10 09:47:33 florian
  1141. + basic operations with int64/qord (compiler with -dint64)
  1142. + rtti of enumerations extended: names are now written
  1143. Revision 1.40 1998/12/04 10:18:14 florian
  1144. * some stuff for procedures of object added
  1145. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1146. Revision 1.39 1998/11/27 14:50:55 peter
  1147. + open strings, $P switch support
  1148. Revision 1.38 1998/11/18 15:44:24 peter
  1149. * VALUEPARA for tp7 compatible value parameters
  1150. Revision 1.37 1998/11/13 10:15:50 peter
  1151. * fixed ptr() with constants
  1152. Revision 1.36 1998/11/10 10:09:21 peter
  1153. * va_list -> array of const
  1154. Revision 1.35 1998/10/19 08:55:13 pierre
  1155. * wrong stabs info corrected once again !!
  1156. + variable vmt offset with vmt field only if required
  1157. implemented now !!!
  1158. Revision 1.34 1998/10/12 09:50:06 florian
  1159. + support of <procedure var type>:=<pointer> in delphi mode added
  1160. Revision 1.33 1998/10/06 20:43:30 peter
  1161. * fixed set of bugs. like set of false..true set of #1..#255 and
  1162. set of #1..true which was allowed
  1163. Revision 1.32 1998/10/05 21:33:35 peter
  1164. * fixed 161,165,166,167,168
  1165. Revision 1.31 1998/09/23 09:58:56 peter
  1166. * first working array of const things
  1167. Revision 1.30 1998/09/22 15:40:58 peter
  1168. * some extra ifdef GDB
  1169. Revision 1.29 1998/09/16 12:37:31 michael
  1170. Added FPC_ prefix to abstracterror
  1171. Revision 1.28 1998/09/09 16:44:23 florian
  1172. * I hope, the case bug is fixed now
  1173. Revision 1.27 1998/09/07 17:37:07 florian
  1174. * first fixes for published properties
  1175. Revision 1.26 1998/09/04 12:24:31 florian
  1176. * bug0159 fixed
  1177. Revision 1.25 1998/09/04 09:06:36 florian
  1178. * bug0132 fixed
  1179. Revision 1.24 1998/09/04 08:36:49 peter
  1180. * fixed boolean:=integer which is not explicit
  1181. Revision 1.23 1998/09/01 17:39:55 peter
  1182. + internal constant functions
  1183. Revision 1.22 1998/09/01 12:53:28 peter
  1184. + aktpackenum
  1185. Revision 1.21 1998/08/19 00:42:45 peter
  1186. + subrange types for enums
  1187. + checking for bounds type with ranges
  1188. Revision 1.20 1998/08/18 14:17:14 pierre
  1189. * bug about assigning the return value of a function to
  1190. a procvar fixed : warning
  1191. assigning a proc to a procvar need @ in FPC mode !!
  1192. * missing file/line info restored
  1193. Revision 1.19 1998/08/18 09:24:48 pierre
  1194. * small warning position bug fixed
  1195. * support_mmx switches splitting was missing
  1196. * rhide error and warning output corrected
  1197. Revision 1.18 1998/08/14 18:18:49 peter
  1198. + dynamic set contruction
  1199. * smallsets are now working (always longint size)
  1200. Revision 1.17 1998/08/05 16:00:17 florian
  1201. * some fixes for ansi strings
  1202. Revision 1.16 1998/07/20 23:35:50 michael
  1203. Const ansistrings are not copied.
  1204. Revision 1.15 1998/07/18 22:54:32 florian
  1205. * some ansi/wide/longstring support fixed:
  1206. o parameter passing
  1207. o returning as result from functions
  1208. Revision 1.14 1998/06/12 14:50:50 peter
  1209. * removed the tree dependency to types.pas
  1210. * long_fil.pas support (not fully tested yet)
  1211. Revision 1.13 1998/06/03 22:49:07 peter
  1212. + wordbool,longbool
  1213. * rename bis,von -> high,low
  1214. * moved some systemunit loading/creating to psystem.pas
  1215. Revision 1.12 1998/05/12 10:47:00 peter
  1216. * moved printstatus to verb_def
  1217. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1218. prefix like error: warning: and is included in V_Default
  1219. * fixed some messages
  1220. * first time parameter scan is only for -v and -T
  1221. - removed old style messages
  1222. Revision 1.11 1998/05/01 16:38:46 florian
  1223. * handling of private and protected fixed
  1224. + change_keywords_to_tp implemented to remove
  1225. keywords which aren't supported by tp
  1226. * break and continue are now symbols of the system unit
  1227. + widestring, longstring and ansistring type released
  1228. Revision 1.10 1998/04/29 10:34:08 pierre
  1229. + added some code for ansistring (not complete nor working yet)
  1230. * corrected operator overloading
  1231. * corrected nasm output
  1232. + started inline procedures
  1233. + added starstarn : use ** for exponentiation (^ gave problems)
  1234. + started UseTokenInfo cond to get accurate positions
  1235. Revision 1.9 1998/04/21 10:16:49 peter
  1236. * patches from strasbourg
  1237. * objects is not used anymore in the fpc compiled version
  1238. Revision 1.8 1998/04/12 22:39:44 florian
  1239. * problem with read access to properties solved
  1240. * correct handling of hidding methods via virtual (COM)
  1241. * correct result type of constructor calls (COM), the resulttype
  1242. depends now on the type of the class reference
  1243. Revision 1.7 1998/04/10 21:36:56 florian
  1244. + some stuff to support method pointers (procedure of object) added
  1245. (declaration, parameter handling)
  1246. Revision 1.6 1998/04/10 15:39:49 florian
  1247. * more fixes to get classes.pas compiled
  1248. Revision 1.5 1998/04/09 23:02:16 florian
  1249. * small problems solved to get remake3 work
  1250. Revision 1.4 1998/04/08 16:58:09 pierre
  1251. * several bugfixes
  1252. ADD ADC and AND are also sign extended
  1253. nasm output OK (program still crashes at end
  1254. and creates wrong assembler files !!)
  1255. procsym types sym in tdef removed !!
  1256. Revision 1.3 1998/04/08 11:34:22 peter
  1257. * nasm works (linux only tested)
  1258. }