ncal.pas 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This file implements the node for sub procedure calling
  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 ncal;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. node,
  23. symbase,symtype,symsym,symdef,symtable;
  24. type
  25. tcallnode = class(tbinarynode)
  26. { the symbol containing the definition of the procedure }
  27. { to call }
  28. symtableprocentry : tprocsym;
  29. { the symtable containing symtableprocentry }
  30. symtableproc : tsymtable;
  31. { the definition of the procedure to call }
  32. procdefinition : tabstractprocdef;
  33. methodpointer : tnode;
  34. { separately specified resulttype for some compilerprocs (e.g. }
  35. { you can't have a function with an "array of char" resulttype }
  36. { the RTL) (JM) }
  37. restype: ttype;
  38. restypeset: boolean;
  39. { only the processor specific nodes need to override this }
  40. { constructor }
  41. constructor create(l:tnode; v : tprocsym;st : tsymtable; mp : tnode);virtual;
  42. constructor createintern(const name: string; params: tnode);
  43. constructor createinternres(const name: string; params: tnode; const res: ttype);
  44. destructor destroy;override;
  45. function getcopy : tnode;override;
  46. procedure insertintolist(l : tnodelist);override;
  47. function pass_1 : tnode;override;
  48. function det_resulttype:tnode;override;
  49. function docompare(p: tnode): boolean; override;
  50. procedure set_procvar(procvar:tnode);
  51. end;
  52. tcallnodeclass = class of tcallnode;
  53. tcallparaflags = (
  54. { flags used by tcallparanode }
  55. cpf_exact_match_found,
  56. cpf_convlevel1found,
  57. cpf_convlevel2found,
  58. cpf_is_colon_para
  59. );
  60. tcallparanode = class(tbinarynode)
  61. callparaflags : set of tcallparaflags;
  62. hightree : tnode;
  63. { only the processor specific nodes need to override this }
  64. { constructor }
  65. constructor create(expr,next : tnode);virtual;
  66. destructor destroy;override;
  67. function getcopy : tnode;override;
  68. procedure insertintolist(l : tnodelist);override;
  69. procedure gen_high_tree(openstring:boolean);
  70. procedure get_paratype;
  71. procedure insert_typeconv(defcoll : tparaitem;do_count : boolean);
  72. procedure det_registers;
  73. procedure firstcallparan(defcoll : tparaitem;do_count : boolean);
  74. procedure secondcallparan(defcoll : tparaitem;
  75. push_from_left_to_right,inlined,is_cdecl : boolean;
  76. para_alignment,para_offset : longint);virtual;abstract;
  77. function docompare(p: tnode): boolean; override;
  78. end;
  79. tcallparanodeclass = class of tcallparanode;
  80. tprocinlinenode = class(tnode)
  81. inlinetree : tnode;
  82. inlineprocdef : tprocdef;
  83. retoffset,para_offset,para_size : longint;
  84. constructor create(callp,code : tnode);virtual;
  85. destructor destroy;override;
  86. function getcopy : tnode;override;
  87. procedure insertintolist(l : tnodelist);override;
  88. function pass_1 : tnode;override;
  89. function docompare(p: tnode): boolean; override;
  90. end;
  91. tprocinlinenodeclass = class of tprocinlinenode;
  92. function reverseparameters(p: tcallparanode): tcallparanode;
  93. var
  94. ccallnode : tcallnodeclass;
  95. ccallparanode : tcallparanodeclass;
  96. cprocinlinenode : tprocinlinenodeclass;
  97. implementation
  98. uses
  99. cutils,globtype,systems,
  100. verbose,globals,
  101. symconst,types,
  102. htypechk,pass_1,cpubase,
  103. ncnv,nld,ninl,nadd,ncon,
  104. tgcpu,cgbase
  105. ;
  106. {****************************************************************************
  107. HELPERS
  108. ****************************************************************************}
  109. function reverseparameters(p: tcallparanode): tcallparanode;
  110. var
  111. hp1, hp2: tcallparanode;
  112. begin
  113. hp1:=nil;
  114. while assigned(p) do
  115. begin
  116. { pull out }
  117. hp2:=p;
  118. p:=tcallparanode(p.right);
  119. { pull in }
  120. hp2.right:=hp1;
  121. hp1:=hp2;
  122. end;
  123. reverseparameters:=hp1;
  124. end;
  125. procedure search_class_overloads(aprocsym : tprocsym);
  126. { searches n in symtable of pd and all anchestors }
  127. var
  128. speedvalue : cardinal;
  129. srsym : tprocsym;
  130. s : string;
  131. found : boolean;
  132. srpdl,pdl : pprocdeflist;
  133. objdef : tobjectdef;
  134. begin
  135. if aprocsym.overloadchecked then
  136. exit;
  137. aprocsym.overloadchecked:=true;
  138. if (aprocsym.owner.symtabletype<>objectsymtable) then
  139. internalerror(200111021);
  140. objdef:=tobjectdef(aprocsym.owner.defowner);
  141. { we start in the parent }
  142. if not assigned(objdef.childof) then
  143. exit;
  144. objdef:=objdef.childof;
  145. s:=aprocsym.name;
  146. speedvalue:=getspeedvalue(s);
  147. while assigned(objdef) do
  148. begin
  149. srsym:=tprocsym(objdef.symtable.speedsearch(s,speedvalue));
  150. if assigned(srsym) then
  151. begin
  152. if (srsym.typ<>procsym) then
  153. internalerror(200111022);
  154. if srsym.is_visible_for_proc(aktprocdef) then
  155. begin
  156. srpdl:=srsym.defs;
  157. while assigned(srpdl) do
  158. begin
  159. found:=false;
  160. pdl:=aprocsym.defs;
  161. while assigned(pdl) do
  162. begin
  163. if equal_paras(pdl^.def.para,srpdl^.def.para,cp_value_equal_const) then
  164. begin
  165. found:=true;
  166. break;
  167. end;
  168. pdl:=pdl^.next;
  169. end;
  170. if not found then
  171. aprocsym.addprocdef(srpdl^.def);
  172. srpdl:=srpdl^.next;
  173. end;
  174. { we can stop if the overloads were already added
  175. for the found symbol }
  176. if srsym.overloadchecked then
  177. break;
  178. end;
  179. end;
  180. { next parent }
  181. objdef:=objdef.childof;
  182. end;
  183. end;
  184. {****************************************************************************
  185. TCALLPARANODE
  186. ****************************************************************************}
  187. constructor tcallparanode.create(expr,next : tnode);
  188. begin
  189. inherited create(callparan,expr,next);
  190. hightree:=nil;
  191. if assigned(expr) then
  192. expr.set_file_line(self);
  193. callparaflags:=[];
  194. end;
  195. destructor tcallparanode.destroy;
  196. begin
  197. hightree.free;
  198. inherited destroy;
  199. end;
  200. function tcallparanode.getcopy : tnode;
  201. var
  202. n : tcallparanode;
  203. begin
  204. n:=tcallparanode(inherited getcopy);
  205. n.callparaflags:=callparaflags;
  206. if assigned(hightree) then
  207. n.hightree:=hightree.getcopy
  208. else
  209. n.hightree:=nil;
  210. result:=n;
  211. end;
  212. procedure tcallparanode.insertintolist(l : tnodelist);
  213. begin
  214. end;
  215. procedure tcallparanode.get_paratype;
  216. var
  217. old_get_para_resulttype : boolean;
  218. old_array_constructor : boolean;
  219. begin
  220. inc(parsing_para_level);
  221. if assigned(right) then
  222. tcallparanode(right).get_paratype;
  223. old_array_constructor:=allow_array_constructor;
  224. old_get_para_resulttype:=get_para_resulttype;
  225. get_para_resulttype:=true;
  226. allow_array_constructor:=true;
  227. resulttypepass(left);
  228. get_para_resulttype:=old_get_para_resulttype;
  229. allow_array_constructor:=old_array_constructor;
  230. if codegenerror then
  231. resulttype:=generrortype
  232. else
  233. resulttype:=left.resulttype;
  234. dec(parsing_para_level);
  235. end;
  236. procedure tcallparanode.insert_typeconv(defcoll : tparaitem;do_count : boolean);
  237. var
  238. oldtype : ttype;
  239. {$ifdef extdebug}
  240. store_count_ref : boolean;
  241. {$endif def extdebug}
  242. begin
  243. inc(parsing_para_level);
  244. if not assigned(defcoll) then
  245. internalerror(200104261);
  246. {$ifdef extdebug}
  247. if do_count then
  248. begin
  249. store_count_ref:=count_ref;
  250. count_ref:=true;
  251. end;
  252. {$endif def extdebug}
  253. if assigned(right) then
  254. begin
  255. { if we are a para that belongs to varargs then keep
  256. the current defcoll }
  257. if (nf_varargs_para in flags) then
  258. tcallparanode(right).insert_typeconv(defcoll,do_count)
  259. else
  260. tcallparanode(right).insert_typeconv(tparaitem(defcoll.next),do_count);
  261. end;
  262. { Be sure to have the resulttype }
  263. if not assigned(left.resulttype.def) then
  264. resulttypepass(left);
  265. { Handle varargs directly, no typeconvs or typechecking needed }
  266. if (nf_varargs_para in flags) then
  267. begin
  268. { convert pascal to C types }
  269. case left.resulttype.def.deftype of
  270. stringdef :
  271. inserttypeconv(left,charpointertype);
  272. floatdef :
  273. inserttypeconv(left,s64floattype);
  274. end;
  275. set_varstate(left,true);
  276. resulttype:=left.resulttype;
  277. dec(parsing_para_level);
  278. exit;
  279. end;
  280. { Do we need arrayconstructor -> set conversion, then insert
  281. it here before the arrayconstructor node breaks the tree
  282. with its conversions of enum->ord }
  283. if (left.nodetype=arrayconstructorn) and
  284. (defcoll.paratype.def.deftype=setdef) then
  285. inserttypeconv(left,defcoll.paratype);
  286. { set some settings needed for arrayconstructor }
  287. if is_array_constructor(left.resulttype.def) then
  288. begin
  289. if is_array_of_const(defcoll.paratype.def) then
  290. begin
  291. if assigned(aktcallprocdef) and
  292. (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
  293. (po_external in aktcallprocdef.procoptions) then
  294. include(left.flags,nf_cargs);
  295. { force variant array }
  296. include(left.flags,nf_forcevaria);
  297. end
  298. else
  299. begin
  300. include(left.flags,nf_novariaallowed);
  301. { now that the resultting type is know we can insert the required
  302. typeconvs for the array constructor }
  303. tarrayconstructornode(left).force_type(tarraydef(defcoll.paratype.def).elementtype);
  304. end;
  305. end;
  306. { check if local proc/func is assigned to procvar }
  307. if left.resulttype.def.deftype=procvardef then
  308. test_local_to_procvar(tprocvardef(left.resulttype.def),defcoll.paratype.def);
  309. { generate the high() value tree }
  310. if not(assigned(aktcallprocdef) and
  311. (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
  312. (po_external in aktcallprocdef.procoptions)) and
  313. push_high_param(defcoll.paratype.def) then
  314. gen_high_tree(is_open_string(defcoll.paratype.def));
  315. { test conversions }
  316. if not(is_shortstring(left.resulttype.def) and
  317. is_shortstring(defcoll.paratype.def)) and
  318. (defcoll.paratype.def.deftype<>formaldef) then
  319. begin
  320. if (defcoll.paratyp in [vs_var,vs_out]) and
  321. { allows conversion from word to integer and
  322. byte to shortint, but only for TP7 compatibility }
  323. (not(
  324. (m_tp7 in aktmodeswitches) and
  325. (left.resulttype.def.deftype=orddef) and
  326. (defcoll.paratype.def.deftype=orddef) and
  327. (left.resulttype.def.size=defcoll.paratype.def.size)
  328. ) and
  329. { an implicit pointer conversion is allowed }
  330. not(
  331. (left.resulttype.def.deftype=pointerdef) and
  332. (defcoll.paratype.def.deftype=pointerdef)
  333. ) and
  334. { child classes can be also passed }
  335. not(
  336. (left.resulttype.def.deftype=objectdef) and
  337. (defcoll.paratype.def.deftype=objectdef) and
  338. tobjectdef(left.resulttype.def).is_related(tobjectdef(defcoll.paratype.def))
  339. ) and
  340. { passing a single element to a openarray of the same type }
  341. not(
  342. (is_open_array(defcoll.paratype.def) and
  343. is_equal(tarraydef(defcoll.paratype.def).elementtype.def,left.resulttype.def))
  344. ) and
  345. { an implicit file conversion is also allowed }
  346. { from a typed file to an untyped one }
  347. not(
  348. (left.resulttype.def.deftype=filedef) and
  349. (defcoll.paratype.def.deftype=filedef) and
  350. (tfiledef(defcoll.paratype.def).filetyp = ft_untyped) and
  351. (tfiledef(left.resulttype.def).filetyp = ft_typed)
  352. ) and
  353. not(is_equal(left.resulttype.def,defcoll.paratype.def))) then
  354. begin
  355. CGMessagePos2(left.fileinfo,parser_e_call_by_ref_without_typeconv,
  356. left.resulttype.def.typename,defcoll.paratype.def.typename);
  357. end;
  358. { Process open parameters }
  359. if push_high_param(defcoll.paratype.def) then
  360. begin
  361. { insert type conv but hold the ranges of the array }
  362. oldtype:=left.resulttype;
  363. inserttypeconv(left,defcoll.paratype);
  364. left.resulttype:=oldtype;
  365. end
  366. else
  367. begin
  368. inserttypeconv(left,defcoll.paratype);
  369. end;
  370. if codegenerror then
  371. begin
  372. dec(parsing_para_level);
  373. exit;
  374. end;
  375. end;
  376. { check var strings }
  377. if (cs_strict_var_strings in aktlocalswitches) and
  378. is_shortstring(left.resulttype.def) and
  379. is_shortstring(defcoll.paratype.def) and
  380. (defcoll.paratyp in [vs_out,vs_var]) and
  381. not(is_open_string(defcoll.paratype.def)) and
  382. not(is_equal(left.resulttype.def,defcoll.paratype.def)) then
  383. begin
  384. aktfilepos:=left.fileinfo;
  385. CGMessage(type_e_strict_var_string_violation);
  386. end;
  387. { Handle formal parameters separate }
  388. if (defcoll.paratype.def.deftype=formaldef) then
  389. begin
  390. case defcoll.paratyp of
  391. vs_var,
  392. vs_out :
  393. begin
  394. if not valid_for_formal_var(left) then
  395. CGMessagePos(left.fileinfo,parser_e_illegal_parameter_list);
  396. end;
  397. vs_const :
  398. begin
  399. if not valid_for_formal_const(left) then
  400. CGMessagePos(left.fileinfo,parser_e_illegal_parameter_list);
  401. end;
  402. end;
  403. end
  404. else
  405. begin
  406. { check if the argument is allowed }
  407. if (defcoll.paratyp in [vs_out,vs_var]) then
  408. valid_for_var(left);
  409. end;
  410. if defcoll.paratyp in [vs_var,vs_const] then
  411. begin
  412. { Causes problems with const ansistrings if also }
  413. { done for vs_const (JM) }
  414. if defcoll.paratyp = vs_var then
  415. set_unique(left);
  416. make_not_regable(left);
  417. end;
  418. { ansistrings out paramaters doesn't need to be }
  419. { unique, they are finalized }
  420. if defcoll.paratyp=vs_out then
  421. make_not_regable(left);
  422. if do_count then
  423. begin
  424. { not completly proper, but avoids some warnings }
  425. if (defcoll.paratyp in [vs_var,vs_out]) then
  426. set_funcret_is_valid(left);
  427. set_varstate(left,not(defcoll.paratyp in [vs_var,vs_out]));
  428. end;
  429. { must only be done after typeconv PM }
  430. resulttype:=defcoll.paratype;
  431. dec(parsing_para_level);
  432. {$ifdef extdebug}
  433. if do_count then
  434. count_ref:=store_count_ref;
  435. {$endif def extdebug}
  436. end;
  437. procedure tcallparanode.det_registers;
  438. var
  439. old_get_para_resulttype : boolean;
  440. old_array_constructor : boolean;
  441. begin
  442. if assigned(right) then
  443. begin
  444. tcallparanode(right).det_registers;
  445. registers32:=right.registers32;
  446. registersfpu:=right.registersfpu;
  447. {$ifdef SUPPORT_MMX}
  448. registersmmx:=right.registersmmx;
  449. {$endif}
  450. end;
  451. old_array_constructor:=allow_array_constructor;
  452. old_get_para_resulttype:=get_para_resulttype;
  453. get_para_resulttype:=true;
  454. allow_array_constructor:=true;
  455. firstpass(left);
  456. get_para_resulttype:=old_get_para_resulttype;
  457. allow_array_constructor:=old_array_constructor;
  458. if left.registers32>registers32 then
  459. registers32:=left.registers32;
  460. if left.registersfpu>registersfpu then
  461. registersfpu:=left.registersfpu;
  462. {$ifdef SUPPORT_MMX}
  463. if left.registersmmx>registersmmx then
  464. registersmmx:=left.registersmmx;
  465. {$endif SUPPORT_MMX}
  466. end;
  467. procedure tcallparanode.firstcallparan(defcoll : tparaitem;do_count : boolean);
  468. begin
  469. if not assigned(left.resulttype.def) then
  470. begin
  471. get_paratype;
  472. if assigned(defcoll) then
  473. insert_typeconv(defcoll,do_count);
  474. end;
  475. det_registers;
  476. end;
  477. procedure tcallparanode.gen_high_tree(openstring:boolean);
  478. var
  479. temp: tnode;
  480. len : integer;
  481. loadconst : boolean;
  482. begin
  483. if assigned(hightree) then
  484. exit;
  485. len:=-1;
  486. loadconst:=true;
  487. case left.resulttype.def.deftype of
  488. arraydef :
  489. begin
  490. { handle via a normal inline in_high_x node }
  491. loadconst := false;
  492. hightree := geninlinenode(in_high_x,false,left.getcopy);
  493. { only substract low(array) if it's <> 0 }
  494. temp := geninlinenode(in_low_x,false,left.getcopy);
  495. firstpass(temp);
  496. if (temp.nodetype <> ordconstn) or
  497. (tordconstnode(temp).value <> 0) then
  498. hightree := caddnode.create(subn,hightree,temp)
  499. else
  500. temp.free;
  501. end;
  502. stringdef :
  503. begin
  504. if openstring then
  505. begin
  506. { handle via a normal inline in_high_x node }
  507. loadconst := false;
  508. hightree := geninlinenode(in_high_x,false,left.getcopy);
  509. end
  510. else
  511. { passing a string to an array of char }
  512. begin
  513. if (left.nodetype=stringconstn) then
  514. begin
  515. len:=str_length(left);
  516. if len>0 then
  517. dec(len);
  518. end
  519. else
  520. begin
  521. hightree:=caddnode.create(subn,geninlinenode(in_length_x,false,left.getcopy),
  522. cordconstnode.create(1,s32bittype));
  523. loadconst:=false;
  524. end;
  525. end;
  526. end;
  527. else
  528. len:=0;
  529. end;
  530. if loadconst then
  531. hightree:=cordconstnode.create(len,s32bittype)
  532. else
  533. hightree:=ctypeconvnode.create(hightree,s32bittype);
  534. firstpass(hightree);
  535. end;
  536. function tcallparanode.docompare(p: tnode): boolean;
  537. begin
  538. docompare :=
  539. inherited docompare(p) and
  540. (callparaflags = tcallparanode(p).callparaflags) and
  541. hightree.isequal(tcallparanode(p).hightree);
  542. end;
  543. {****************************************************************************
  544. TCALLNODE
  545. ****************************************************************************}
  546. constructor tcallnode.create(l:tnode;v : tprocsym;st : tsymtable; mp : tnode);
  547. begin
  548. inherited create(calln,l,nil);
  549. symtableprocentry:=v;
  550. symtableproc:=st;
  551. include(flags,nf_return_value_used);
  552. methodpointer:=mp;
  553. procdefinition:=nil;
  554. restypeset := false;
  555. end;
  556. constructor tcallnode.createintern(const name: string; params: tnode);
  557. var
  558. srsym: tsym;
  559. symowner: tsymtable;
  560. begin
  561. if not (cs_compilesystem in aktmoduleswitches) then
  562. begin
  563. srsym := searchsymonlyin(systemunit,name);
  564. symowner := systemunit;
  565. end
  566. else
  567. begin
  568. searchsym(name,srsym,symowner);
  569. if not assigned(srsym) then
  570. searchsym(upper(name),srsym,symowner);
  571. end;
  572. if not assigned(srsym) or
  573. (srsym.typ <> procsym) then
  574. begin
  575. writeln('unknown compilerproc ',name);
  576. internalerror(200107271);
  577. end;
  578. self.create(params,tprocsym(srsym),symowner,nil);
  579. end;
  580. constructor tcallnode.createinternres(const name: string; params: tnode; const res: ttype);
  581. begin
  582. self.createintern(name,params);
  583. restype := res;
  584. restypeset := true;
  585. { both the normal and specified resulttype either have to be returned via a }
  586. { parameter or not, but no mixing (JM) }
  587. if ret_in_param(restype.def) xor ret_in_param(symtableprocentry.defs^.def.rettype.def) then
  588. internalerror(200108291);
  589. end;
  590. destructor tcallnode.destroy;
  591. begin
  592. methodpointer.free;
  593. inherited destroy;
  594. end;
  595. procedure tcallnode.set_procvar(procvar:tnode);
  596. begin
  597. right:=procvar;
  598. end;
  599. function tcallnode.getcopy : tnode;
  600. var
  601. n : tcallnode;
  602. begin
  603. n:=tcallnode(inherited getcopy);
  604. n.symtableprocentry:=symtableprocentry;
  605. n.symtableproc:=symtableproc;
  606. n.procdefinition:=procdefinition;
  607. n.restype := restype;
  608. n.restypeset := restypeset;
  609. if assigned(methodpointer) then
  610. n.methodpointer:=methodpointer.getcopy
  611. else
  612. n.methodpointer:=nil;
  613. result:=n;
  614. end;
  615. procedure tcallnode.insertintolist(l : tnodelist);
  616. begin
  617. end;
  618. function tcallnode.det_resulttype:tnode;
  619. type
  620. pprocdefcoll = ^tprocdefcoll;
  621. tprocdefcoll = record
  622. data : tprocdef;
  623. nextpara : tparaitem;
  624. firstpara : tparaitem;
  625. next : pprocdefcoll;
  626. end;
  627. var
  628. hp,procs,hp2 : pprocdefcoll;
  629. pd : pprocdeflist;
  630. oldcallprocdef : tprocdef;
  631. def_from,def_to,conv_to : tdef;
  632. hpt : tnode;
  633. pt : tcallparanode;
  634. exactmatch : boolean;
  635. paralength,lastpara : longint;
  636. lastparatype : tdef;
  637. pdc : tparaitem;
  638. { only Dummy }
  639. hcvt : tconverttype;
  640. label
  641. errorexit;
  642. { check if the resulttype.def from tree p is equal with def, needed
  643. for stringconstn and formaldef }
  644. function is_equal(p:tcallparanode;def:tdef) : boolean;
  645. begin
  646. { safety check }
  647. if not (assigned(def) or assigned(p.resulttype.def)) then
  648. begin
  649. is_equal:=false;
  650. exit;
  651. end;
  652. { all types can be passed to a formaldef }
  653. is_equal:=(def.deftype=formaldef) or
  654. (types.is_equal(p.resulttype.def,def))
  655. { integer constants are compatible with all integer parameters if
  656. the specified value matches the range }
  657. or
  658. (
  659. (tbinarynode(p).left.nodetype=ordconstn) and
  660. is_integer(p.resulttype.def) and
  661. is_integer(def) and
  662. (tordconstnode(p.left).value>=torddef(def).low) and
  663. (tordconstnode(p.left).value<=torddef(def).high)
  664. )
  665. { to support ansi/long/wide strings in a proper way }
  666. { string and string[10] are assumed as equal }
  667. { when searching the correct overloaded procedure }
  668. or
  669. (
  670. (def.deftype=stringdef) and (p.resulttype.def.deftype=stringdef) and
  671. (tstringdef(def).string_typ=tstringdef(p.resulttype.def).string_typ)
  672. )
  673. or
  674. (
  675. (p.left.nodetype=stringconstn) and
  676. (is_ansistring(p.resulttype.def) and is_pchar(def))
  677. )
  678. or
  679. (
  680. (p.left.nodetype=ordconstn) and
  681. (is_char(p.resulttype.def) and (is_shortstring(def) or is_ansistring(def)))
  682. )
  683. { set can also be a not yet converted array constructor }
  684. or
  685. (
  686. (def.deftype=setdef) and (p.resulttype.def.deftype=arraydef) and
  687. (tarraydef(p.resulttype.def).IsConstructor) and not(tarraydef(p.resulttype.def).IsVariant)
  688. )
  689. { in tp7 mode proc -> procvar is allowed }
  690. or
  691. (
  692. (m_tp_procvar in aktmodeswitches) and
  693. (def.deftype=procvardef) and (p.left.nodetype=calln) and
  694. (proc_to_procvar_equal(tprocdef(tcallnode(p.left).procdefinition),tprocvardef(def),false))
  695. )
  696. ;
  697. end;
  698. function is_in_limit(def_from,def_to : tdef) : boolean;
  699. begin
  700. is_in_limit:=(def_from.deftype = orddef) and
  701. (def_to.deftype = orddef) and
  702. (torddef(def_from).low>torddef(def_to).low) and
  703. (torddef(def_from).high<torddef(def_to).high);
  704. end;
  705. var
  706. i : longint;
  707. is_const : boolean;
  708. bestord : torddef;
  709. begin
  710. result:=nil;
  711. procs:=nil;
  712. oldcallprocdef:=aktcallprocdef;
  713. aktcallprocdef:=nil;
  714. { determine length of parameter list }
  715. pt:=tcallparanode(left);
  716. paralength:=0;
  717. while assigned(pt) do
  718. begin
  719. inc(paralength);
  720. pt:=tcallparanode(pt.right);
  721. end;
  722. { determine the type of the parameters }
  723. if assigned(left) then
  724. begin
  725. tcallparanode(left).get_paratype;
  726. if codegenerror then
  727. goto errorexit;
  728. end;
  729. { procedure variable ? }
  730. if assigned(right) then
  731. begin
  732. set_varstate(right,true);
  733. resulttypepass(right);
  734. if codegenerror then
  735. exit;
  736. procdefinition:=tabstractprocdef(right.resulttype.def);
  737. { check the amount of parameters }
  738. pdc:=tparaitem(procdefinition.Para.first);
  739. pt:=tcallparanode(left);
  740. lastpara:=paralength;
  741. while assigned(pdc) and assigned(pt) do
  742. begin
  743. { only goto next para if we're out of the varargs }
  744. if not(po_varargs in procdefinition.procoptions) or
  745. (lastpara<=procdefinition.maxparacount) then
  746. pdc:=tparaitem(pdc.next);
  747. pt:=tcallparanode(pt.right);
  748. dec(lastpara);
  749. end;
  750. if assigned(pt) or assigned(pdc) then
  751. begin
  752. if assigned(pt) then
  753. aktfilepos:=pt.fileinfo;
  754. CGMessage(parser_e_wrong_parameter_size);
  755. end;
  756. end
  757. else
  758. { not a procedure variable }
  759. begin
  760. { do we know the procedure to call ? }
  761. if not(assigned(procdefinition)) then
  762. begin
  763. { when the definition has overload directive set, we search for
  764. overloaded definitions }
  765. if (not symtableprocentry.overloadchecked) and
  766. (po_overload in symtableprocentry.defs^.def.procoptions) then
  767. begin
  768. { for methods search in the class tree }
  769. if (symtableprocentry.owner.symtabletype=objectsymtable) then
  770. search_class_overloads(symtableprocentry);
  771. end;
  772. { link all procedures which have the same # of parameters }
  773. pd:=symtableprocentry.defs;
  774. while assigned(pd) do
  775. begin
  776. { only when the # of parameter are supported by the
  777. procedure }
  778. if (paralength>=pd^.def.minparacount) and
  779. ((po_varargs in pd^.def.procoptions) or { varargs }
  780. (paralength<=pd^.def.maxparacount)) then
  781. begin
  782. new(hp);
  783. hp^.data:=pd^.def;
  784. hp^.next:=procs;
  785. hp^.firstpara:=tparaitem(pd^.def.Para.first);
  786. if not(po_varargs in pd^.def.procoptions) then
  787. begin
  788. { if not all parameters are given, then skip the
  789. default parameters }
  790. for i:=1 to pd^.def.maxparacount-paralength do
  791. hp^.firstpara:=tparaitem(hp^.firstPara.next);
  792. end;
  793. hp^.nextpara:=hp^.firstpara;
  794. procs:=hp;
  795. end;
  796. pd:=pd^.next;
  797. end;
  798. { no procedures found? then there is something wrong
  799. with the parameter size }
  800. if not assigned(procs) then
  801. begin
  802. { in tp mode we can try to convert to procvar if
  803. there are no parameters specified }
  804. if not(assigned(left)) and
  805. (m_tp_procvar in aktmodeswitches) then
  806. begin
  807. hpt:=cloadnode.create(tprocsym(symtableprocentry),symtableproc);
  808. if (symtableprocentry.owner.symtabletype=objectsymtable) and
  809. assigned(methodpointer) then
  810. tloadnode(hpt).set_mp(methodpointer.getcopy);
  811. resulttypepass(hpt);
  812. result:=hpt;
  813. end
  814. else
  815. begin
  816. if assigned(left) then
  817. aktfilepos:=left.fileinfo;
  818. CGMessage(parser_e_wrong_parameter_size);
  819. symtableprocentry.write_parameter_lists(nil);
  820. end;
  821. goto errorexit;
  822. end;
  823. { now we can compare parameter after parameter }
  824. pt:=tcallparanode(left);
  825. { we start with the last parameter }
  826. lastpara:=paralength+1;
  827. lastparatype:=nil;
  828. while assigned(pt) do
  829. begin
  830. dec(lastpara);
  831. { walk all procedures and determine how this parameter matches and set:
  832. 1. pt.exact_match_found if one parameter has an exact match
  833. 2. exactmatch if an equal or exact match is found
  834. 3. Para.argconvtyp to exact,equal or convertable
  835. (when convertable then also convertlevel is set)
  836. 4. pt.convlevel1found if there is a convertlevel=1
  837. 5. pt.convlevel2found if there is a convertlevel=2
  838. }
  839. exactmatch:=false;
  840. hp:=procs;
  841. while assigned(hp) do
  842. begin
  843. { varargs are always equal, but not exact }
  844. if (po_varargs in hp^.data.procoptions) and
  845. (lastpara>hp^.data.minparacount) then
  846. begin
  847. hp^.nextPara.argconvtyp:=act_equal;
  848. exactmatch:=true;
  849. end
  850. else
  851. begin
  852. if is_equal(pt,hp^.nextPara.paratype.def) then
  853. begin
  854. if hp^.nextPara.paratype.def=pt.resulttype.def then
  855. begin
  856. include(pt.callparaflags,cpf_exact_match_found);
  857. hp^.nextPara.argconvtyp:=act_exact;
  858. end
  859. else
  860. hp^.nextPara.argconvtyp:=act_equal;
  861. exactmatch:=true;
  862. end
  863. else
  864. begin
  865. hp^.nextPara.argconvtyp:=act_convertable;
  866. hp^.nextPara.convertlevel:=isconvertable(pt.resulttype.def,hp^.nextPara.paratype.def,
  867. hcvt,pt.left.nodetype,false);
  868. case hp^.nextPara.convertlevel of
  869. 1 : include(pt.callparaflags,cpf_convlevel1found);
  870. 2 : include(pt.callparaflags,cpf_convlevel2found);
  871. end;
  872. end;
  873. end;
  874. hp:=hp^.next;
  875. end;
  876. { If there was an exactmatch then delete all convertables }
  877. if exactmatch then
  878. begin
  879. hp:=procs;
  880. procs:=nil;
  881. while assigned(hp) do
  882. begin
  883. hp2:=hp^.next;
  884. { keep if not convertable }
  885. if (hp^.nextPara.argconvtyp<>act_convertable) then
  886. begin
  887. hp^.next:=procs;
  888. procs:=hp;
  889. end
  890. else
  891. dispose(hp);
  892. hp:=hp2;
  893. end;
  894. end
  895. else
  896. { No exact match was found, remove all procedures that are
  897. not convertable (convertlevel=0) }
  898. begin
  899. hp:=procs;
  900. procs:=nil;
  901. while assigned(hp) do
  902. begin
  903. hp2:=hp^.next;
  904. { keep if not convertable }
  905. if (hp^.nextPara.convertlevel<>0) then
  906. begin
  907. hp^.next:=procs;
  908. procs:=hp;
  909. end
  910. else
  911. begin
  912. { save the type for nice error message }
  913. lastparatype:=hp^.nextPara.paratype.def;
  914. dispose(hp);
  915. end;
  916. hp:=hp2;
  917. end;
  918. end;
  919. { update nextpara for all procedures }
  920. hp:=procs;
  921. while assigned(hp) do
  922. begin
  923. { only goto next para if we're out of the varargs }
  924. if not(po_varargs in hp^.data.procoptions) or
  925. (lastpara<=hp^.data.maxparacount) then
  926. hp^.nextpara:=tparaitem(hp^.nextPara.next);
  927. hp:=hp^.next;
  928. end;
  929. { load next parameter or quit loop if no procs left }
  930. if assigned(procs) then
  931. pt:=tcallparanode(pt.right)
  932. else
  933. break;
  934. end;
  935. { All parameters are checked, check if there are any
  936. procedures left }
  937. if not assigned(procs) then
  938. begin
  939. { there is an error, must be wrong type, because
  940. wrong size is already checked (PFV) }
  941. if (not assigned(lastparatype)) or
  942. (not assigned(pt)) or
  943. (not assigned(pt.resulttype.def)) then
  944. internalerror(39393)
  945. else
  946. begin
  947. aktfilepos:=pt.fileinfo;
  948. CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
  949. pt.resulttype.def.typename,lastparatype.typename);
  950. end;
  951. symtableprocentry.write_parameter_lists(nil);
  952. goto errorexit;
  953. end;
  954. { if there are several choices left then for orddef }
  955. { if a type is totally included in the other }
  956. { we don't fear an overflow , }
  957. { so we can do as if it is an exact match }
  958. { this will convert integer to longint }
  959. { rather than to words }
  960. { conversion of byte to integer or longint }
  961. { would still not be solved }
  962. if assigned(procs) and assigned(procs^.next) then
  963. begin
  964. hp:=procs;
  965. while assigned(hp) do
  966. begin
  967. hp^.nextpara:=hp^.firstpara;
  968. hp:=hp^.next;
  969. end;
  970. pt:=tcallparanode(left);
  971. while assigned(pt) do
  972. begin
  973. { matches a parameter of one procedure exact ? }
  974. exactmatch:=false;
  975. def_from:=pt.resulttype.def;
  976. hp:=procs;
  977. while assigned(hp) do
  978. begin
  979. if not is_equal(pt,hp^.nextPara.paratype.def) then
  980. begin
  981. def_to:=hp^.nextPara.paratype.def;
  982. if ((def_from.deftype=orddef) and (def_to.deftype=orddef)) and
  983. (is_in_limit(def_from,def_to) or
  984. ((hp^.nextPara.paratyp in [vs_var,vs_out]) and
  985. (def_from.size=def_to.size))) then
  986. begin
  987. exactmatch:=true;
  988. conv_to:=def_to;
  989. end;
  990. end;
  991. hp:=hp^.next;
  992. end;
  993. { .... if yes, del all the other procedures }
  994. if exactmatch then
  995. begin
  996. { the first .... }
  997. while (assigned(procs)) and not(is_in_limit(def_from,procs^.nextPara.paratype.def)) do
  998. begin
  999. hp:=procs^.next;
  1000. dispose(procs);
  1001. procs:=hp;
  1002. end;
  1003. { and the others }
  1004. hp:=procs;
  1005. while (assigned(hp)) and assigned(hp^.next) do
  1006. begin
  1007. if not(is_in_limit(def_from,hp^.next^.nextPara.paratype.def)) then
  1008. begin
  1009. hp2:=hp^.next^.next;
  1010. dispose(hp^.next);
  1011. hp^.next:=hp2;
  1012. end
  1013. else
  1014. begin
  1015. def_to:=hp^.next^.nextPara.paratype.def;
  1016. if (conv_to.size>def_to.size) or
  1017. ((torddef(conv_to).low<torddef(def_to).low) and
  1018. (torddef(conv_to).high>torddef(def_to).high)) then
  1019. begin
  1020. hp2:=procs;
  1021. procs:=hp;
  1022. conv_to:=def_to;
  1023. dispose(hp2);
  1024. end
  1025. else
  1026. hp:=hp^.next;
  1027. end;
  1028. end;
  1029. end;
  1030. { update nextpara for all procedures }
  1031. hp:=procs;
  1032. while assigned(hp) do
  1033. begin
  1034. hp^.nextpara:=tparaitem(hp^.nextPara.next);
  1035. hp:=hp^.next;
  1036. end;
  1037. pt:=tcallparanode(pt.right);
  1038. end;
  1039. end;
  1040. { let's try to eliminate equal if there is an exact match
  1041. is there }
  1042. if assigned(procs) and assigned(procs^.next) then
  1043. begin
  1044. { reset nextpara for all procs left }
  1045. hp:=procs;
  1046. while assigned(hp) do
  1047. begin
  1048. hp^.nextpara:=hp^.firstpara;
  1049. hp:=hp^.next;
  1050. end;
  1051. pt:=tcallparanode(left);
  1052. while assigned(pt) do
  1053. begin
  1054. if cpf_exact_match_found in pt.callparaflags then
  1055. begin
  1056. hp:=procs;
  1057. procs:=nil;
  1058. while assigned(hp) do
  1059. begin
  1060. hp2:=hp^.next;
  1061. { keep the exact matches, dispose the others }
  1062. if (hp^.nextPara.argconvtyp=act_exact) then
  1063. begin
  1064. hp^.next:=procs;
  1065. procs:=hp;
  1066. end
  1067. else
  1068. dispose(hp);
  1069. hp:=hp2;
  1070. end;
  1071. end;
  1072. { update nextpara for all procedures }
  1073. hp:=procs;
  1074. while assigned(hp) do
  1075. begin
  1076. hp^.nextpara:=tparaitem(hp^.nextPara.next);
  1077. hp:=hp^.next;
  1078. end;
  1079. pt:=tcallparanode(pt.right);
  1080. end;
  1081. end;
  1082. { Check if there are integer constant to integer
  1083. parameters then choose the best matching integer
  1084. parameter and remove the others, this is Delphi
  1085. compatible. 1 = byte, 256 = word, etc. }
  1086. if assigned(procs) and assigned(procs^.next) then
  1087. begin
  1088. { reset nextpara for all procs left }
  1089. hp:=procs;
  1090. while assigned(hp) do
  1091. begin
  1092. hp^.nextpara:=hp^.firstpara;
  1093. hp:=hp^.next;
  1094. end;
  1095. pt:=tcallparanode(left);
  1096. while assigned(pt) do
  1097. begin
  1098. bestord:=nil;
  1099. if (pt.left.nodetype=ordconstn) and
  1100. is_integer(pt.resulttype.def) then
  1101. begin
  1102. hp:=procs;
  1103. while assigned(hp) do
  1104. begin
  1105. def_to:=hp^.nextPara.paratype.def;
  1106. { to be sure, it couldn't be something else,
  1107. also the defs here are all in the range
  1108. so now find the closest range }
  1109. if not is_integer(def_to) then
  1110. internalerror(43297815);
  1111. if (not assigned(bestord)) or
  1112. ((torddef(def_to).low>bestord.low) or
  1113. (torddef(def_to).high<bestord.high)) then
  1114. bestord:=torddef(def_to);
  1115. hp:=hp^.next;
  1116. end;
  1117. end;
  1118. { if a bestmatch is found then remove the other
  1119. procs which don't match the bestord }
  1120. if assigned(bestord) then
  1121. begin
  1122. hp:=procs;
  1123. procs:=nil;
  1124. while assigned(hp) do
  1125. begin
  1126. hp2:=hp^.next;
  1127. { keep matching bestord, dispose the others }
  1128. if (torddef(hp^.nextPara.paratype.def)=bestord) then
  1129. begin
  1130. hp^.next:=procs;
  1131. procs:=hp;
  1132. end
  1133. else
  1134. dispose(hp);
  1135. hp:=hp2;
  1136. end;
  1137. end;
  1138. { update nextpara for all procedures }
  1139. hp:=procs;
  1140. while assigned(hp) do
  1141. begin
  1142. hp^.nextpara:=tparaitem(hp^.nextPara.next);
  1143. hp:=hp^.next;
  1144. end;
  1145. pt:=tcallparanode(pt.right);
  1146. end;
  1147. end;
  1148. { Check if there are convertlevel 1 and 2 differences
  1149. left for the parameters, then discard all convertlevel
  1150. 2 procedures. The value of convlevelXfound can still
  1151. be used, because all convertables are still here or
  1152. not }
  1153. if assigned(procs) and assigned(procs^.next) then
  1154. begin
  1155. { reset nextpara for all procs left }
  1156. hp:=procs;
  1157. while assigned(hp) do
  1158. begin
  1159. hp^.nextpara:=hp^.firstpara;
  1160. hp:=hp^.next;
  1161. end;
  1162. pt:=tcallparanode(left);
  1163. while assigned(pt) do
  1164. begin
  1165. if (cpf_convlevel1found in pt.callparaflags) and
  1166. (cpf_convlevel2found in pt.callparaflags) then
  1167. begin
  1168. hp:=procs;
  1169. procs:=nil;
  1170. while assigned(hp) do
  1171. begin
  1172. hp2:=hp^.next;
  1173. { keep all not act_convertable and all convertlevels=1 }
  1174. if (hp^.nextPara.argconvtyp<>act_convertable) or
  1175. (hp^.nextPara.convertlevel=1) then
  1176. begin
  1177. hp^.next:=procs;
  1178. procs:=hp;
  1179. end
  1180. else
  1181. dispose(hp);
  1182. hp:=hp2;
  1183. end;
  1184. end;
  1185. { update nextpara for all procedures }
  1186. hp:=procs;
  1187. while assigned(hp) do
  1188. begin
  1189. hp^.nextpara:=tparaitem(hp^.nextPara.next);
  1190. hp:=hp^.next;
  1191. end;
  1192. pt:=tcallparanode(pt.right);
  1193. end;
  1194. end;
  1195. if not(assigned(procs)) or assigned(procs^.next) then
  1196. begin
  1197. CGMessage(cg_e_cant_choose_overload_function);
  1198. symtableprocentry.write_parameter_lists(nil);
  1199. goto errorexit;
  1200. end;
  1201. if make_ref then
  1202. begin
  1203. procs^.data.lastref:=tref.create(procs^.data.lastref,@fileinfo);
  1204. inc(procs^.data.refcount);
  1205. if procs^.data.defref=nil then
  1206. procs^.data.defref:=procs^.data.lastref;
  1207. end;
  1208. procdefinition:=procs^.data;
  1209. { big error for with statements
  1210. symtableproc:=procdefinition.owner;
  1211. but neede for overloaded operators !! }
  1212. if symtableproc=nil then
  1213. symtableproc:=procdefinition.owner;
  1214. end; { end of procedure to call determination }
  1215. { add needed default parameters }
  1216. if assigned(procs) and
  1217. (paralength<procdefinition.maxparacount) then
  1218. begin
  1219. { add default parameters, just read back the skipped
  1220. paras starting from firstPara.previous, when not available
  1221. (all parameters are default) then start with the last
  1222. parameter and read backward (PFV) }
  1223. if not assigned(procs^.firstpara) then
  1224. pdc:=tparaitem(procs^.data.Para.last)
  1225. else
  1226. pdc:=tparaitem(procs^.firstPara.previous);
  1227. while assigned(pdc) do
  1228. begin
  1229. if not assigned(pdc.defaultvalue) then
  1230. internalerror(751349858);
  1231. left:=ccallparanode.create(genconstsymtree(tconstsym(pdc.defaultvalue)),left);
  1232. pdc:=tparaitem(pdc.previous);
  1233. end;
  1234. end;
  1235. end;
  1236. { handle predefined procedures }
  1237. is_const:=(procdefinition.proccalloption=pocall_internconst) and
  1238. ((block_type in [bt_const,bt_type]) or
  1239. (assigned(left) and (tcallparanode(left).left.nodetype in [realconstn,ordconstn])));
  1240. if (procdefinition.proccalloption=pocall_internproc) or is_const then
  1241. begin
  1242. if assigned(left) then
  1243. begin
  1244. { ptr and settextbuf needs two args }
  1245. if assigned(tcallparanode(left).right) then
  1246. begin
  1247. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,left);
  1248. left:=nil;
  1249. end
  1250. else
  1251. begin
  1252. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,tcallparanode(left).left);
  1253. tcallparanode(left).left:=nil;
  1254. end;
  1255. end
  1256. else
  1257. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,nil);
  1258. result:=hpt;
  1259. goto errorexit;
  1260. end;
  1261. { Calling a message method directly ? }
  1262. if assigned(procdefinition) and
  1263. (po_containsself in procdefinition.procoptions) then
  1264. message(cg_e_cannot_call_message_direct);
  1265. { ensure that the result type is set }
  1266. if not restypeset then
  1267. resulttype:=procdefinition.rettype
  1268. else
  1269. resulttype:=restype;
  1270. { get a register for the return value }
  1271. if (not is_void(resulttype.def)) then
  1272. begin
  1273. if ret_in_acc(resulttype.def) then
  1274. begin
  1275. { wide- and ansistrings are returned in EAX }
  1276. { but they are imm. moved to a memory location }
  1277. if is_widestring(resulttype.def) or
  1278. is_ansistring(resulttype.def) then
  1279. begin
  1280. { we use ansistrings so no fast exit here }
  1281. procinfo^.no_fast_exit:=true;
  1282. end;
  1283. end;
  1284. end;
  1285. { constructors return their current class type, not the type where the
  1286. constructor is declared, this can be different because of inheritance }
  1287. if (procdefinition.proctypeoption=potype_constructor) then
  1288. begin
  1289. if assigned(methodpointer) and
  1290. assigned(methodpointer.resulttype.def) and
  1291. (methodpointer.resulttype.def.deftype=classrefdef) then
  1292. resulttype:=tclassrefdef(methodpointer.resulttype.def).pointertype;
  1293. end;
  1294. { flag all callparanodes that belong to the varargs }
  1295. if (po_varargs in procdefinition.procoptions) then
  1296. begin
  1297. pt:=tcallparanode(left);
  1298. i:=paralength;
  1299. while (i>procdefinition.maxparacount) do
  1300. begin
  1301. include(tcallparanode(pt).flags,nf_varargs_para);
  1302. pt:=tcallparanode(pt.right);
  1303. dec(i);
  1304. end;
  1305. end;
  1306. { insert type conversions }
  1307. if assigned(left) then
  1308. begin
  1309. aktcallprocdef:=tprocdef(procdefinition);
  1310. tcallparanode(left).insert_typeconv(tparaitem(procdefinition.Para.first),true);
  1311. end;
  1312. errorexit:
  1313. { Reset some settings back }
  1314. if assigned(procs) then
  1315. dispose(procs);
  1316. aktcallprocdef:=oldcallprocdef;
  1317. end;
  1318. function tcallnode.pass_1 : tnode;
  1319. var
  1320. inlinecode : tnode;
  1321. inlined : boolean;
  1322. {$ifdef m68k}
  1323. regi : tregister;
  1324. {$endif}
  1325. method_must_be_valid : boolean;
  1326. label
  1327. errorexit;
  1328. begin
  1329. result:=nil;
  1330. inlined:=false;
  1331. { work trough all parameters to get the register requirements }
  1332. if assigned(left) then
  1333. tcallparanode(left).det_registers;
  1334. if assigned(procdefinition) and
  1335. (procdefinition.proccalloption=pocall_inline) then
  1336. begin
  1337. inlinecode:=right;
  1338. if assigned(inlinecode) then
  1339. inlined:=true;
  1340. right:=nil;
  1341. end;
  1342. { procedure variable ? }
  1343. if assigned(right) then
  1344. begin
  1345. firstpass(right);
  1346. { procedure does a call }
  1347. if not (block_type in [bt_const,bt_type]) then
  1348. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1349. {$ifndef newcg}
  1350. { calc the correct value for the register }
  1351. {$ifdef i386}
  1352. incrementregisterpushed($ff);
  1353. {$else}
  1354. incrementregisterpushed(ALL_REGISTERS);
  1355. {$endif}
  1356. {$endif newcg}
  1357. end
  1358. else
  1359. { not a procedure variable }
  1360. begin
  1361. location.loc:=LOC_MEM;
  1362. { calc the correture value for the register }
  1363. { handle predefined procedures }
  1364. if (procdefinition.proccalloption=pocall_inline) then
  1365. begin
  1366. if assigned(methodpointer) then
  1367. CGMessage(cg_e_unable_inline_object_methods);
  1368. if assigned(right) and (right.nodetype<>procinlinen) then
  1369. CGMessage(cg_e_unable_inline_procvar);
  1370. { nodetype:=procinlinen; }
  1371. if not assigned(right) then
  1372. begin
  1373. if assigned(tprocdef(procdefinition).code) then
  1374. inlinecode:=cprocinlinenode.create(self,tnode(tprocdef(procdefinition).code))
  1375. else
  1376. CGMessage(cg_e_no_code_for_inline_stored);
  1377. if assigned(inlinecode) then
  1378. begin
  1379. { consider it has not inlined if called
  1380. again inside the args }
  1381. procdefinition.proccalloption:=pocall_fpccall;
  1382. firstpass(inlinecode);
  1383. inlined:=true;
  1384. end;
  1385. end;
  1386. end
  1387. else
  1388. begin
  1389. if not (block_type in [bt_const,bt_type]) then
  1390. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1391. end;
  1392. {$ifndef newcg}
  1393. {$ifndef POWERPC}
  1394. { for the PowerPC standard calling conventions this information isn't necassary (FK) }
  1395. incrementregisterpushed(tprocdef(procdefinition).usedregisters);
  1396. {$endif POWERPC}
  1397. {$endif newcg}
  1398. end;
  1399. { get a register for the return value }
  1400. if (not is_void(resulttype.def)) then
  1401. begin
  1402. if (procdefinition.proctypeoption=potype_constructor) then
  1403. begin
  1404. { extra handling of classes }
  1405. { methodpointer should be assigned! }
  1406. if assigned(methodpointer) and
  1407. assigned(methodpointer.resulttype.def) and
  1408. (methodpointer.resulttype.def.deftype=classrefdef) then
  1409. begin
  1410. location.loc:=LOC_REGISTER;
  1411. registers32:=1;
  1412. end
  1413. { a object constructor returns the result with the flags }
  1414. else
  1415. location.loc:=LOC_FLAGS;
  1416. end
  1417. else
  1418. begin
  1419. {$ifdef SUPPORT_MMX}
  1420. if (cs_mmx in aktlocalswitches) and
  1421. is_mmx_able_array(resulttype.def) then
  1422. begin
  1423. location.loc:=LOC_MMXREGISTER;
  1424. registersmmx:=1;
  1425. end
  1426. else
  1427. {$endif SUPPORT_MMX}
  1428. if ret_in_acc(resulttype.def) then
  1429. begin
  1430. location.loc:=LOC_REGISTER;
  1431. if is_64bitint(resulttype.def) then
  1432. registers32:=2
  1433. else
  1434. registers32:=1;
  1435. { wide- and ansistrings are returned in EAX }
  1436. { but they are imm. moved to a memory location }
  1437. if is_widestring(resulttype.def) or
  1438. is_ansistring(resulttype.def) then
  1439. begin
  1440. location.loc:=LOC_MEM;
  1441. registers32:=1;
  1442. end;
  1443. end
  1444. else if (resulttype.def.deftype=floatdef) then
  1445. begin
  1446. location.loc:=LOC_FPU;
  1447. {$ifdef m68k}
  1448. if (cs_fp_emulation in aktmoduleswitches) or
  1449. (tfloatdef(resulttype.def).typ=s32real) then
  1450. registers32:=1
  1451. else
  1452. registersfpu:=1;
  1453. {$else not m68k}
  1454. registersfpu:=1;
  1455. {$endif not m68k}
  1456. end
  1457. else
  1458. location.loc:=LOC_MEM;
  1459. end;
  1460. end;
  1461. { a fpu can be used in any procedure !! }
  1462. registersfpu:=procdefinition.fpu_used;
  1463. { if this is a call to a method calc the registers }
  1464. if (methodpointer<>nil) then
  1465. begin
  1466. case methodpointer.nodetype of
  1467. { but only, if this is not a supporting node }
  1468. typen: ;
  1469. { we need one register for new return value PM }
  1470. hnewn : if registers32=0 then
  1471. registers32:=1;
  1472. else
  1473. begin
  1474. if (procdefinition.proctypeoption in [potype_constructor,potype_destructor]) and
  1475. assigned(symtableproc) and (symtableproc.symtabletype=withsymtable) and
  1476. not twithsymtable(symtableproc).direct_with then
  1477. begin
  1478. CGmessage(cg_e_cannot_call_cons_dest_inside_with);
  1479. end; { Is accepted by Delphi !! }
  1480. { this is not a good reason to accept it in FPC if we produce
  1481. wrong code for it !!! (PM) }
  1482. { R.Assign is not a constructor !!! }
  1483. { but for R^.Assign, R must be valid !! }
  1484. if (procdefinition.proctypeoption=potype_constructor) or
  1485. ((methodpointer.nodetype=loadn) and
  1486. (not(oo_has_virtual in tobjectdef(methodpointer.resulttype.def).objectoptions))) then
  1487. method_must_be_valid:=false
  1488. else
  1489. method_must_be_valid:=true;
  1490. firstpass(methodpointer);
  1491. set_varstate(methodpointer,method_must_be_valid);
  1492. { The object is already used ven if it is called once }
  1493. if (methodpointer.nodetype=loadn) and
  1494. (tloadnode(methodpointer).symtableentry.typ=varsym) then
  1495. tvarsym(tloadnode(methodpointer).symtableentry).varstate:=vs_used;
  1496. registersfpu:=max(methodpointer.registersfpu,registersfpu);
  1497. registers32:=max(methodpointer.registers32,registers32);
  1498. {$ifdef SUPPORT_MMX}
  1499. registersmmx:=max(methodpointer.registersmmx,registersmmx);
  1500. {$endif SUPPORT_MMX}
  1501. end;
  1502. end;
  1503. end;
  1504. if inlined then
  1505. right:=inlinecode;
  1506. { determine the registers of the procedure variable }
  1507. { is this OK for inlined procs also ?? (PM) }
  1508. if assigned(right) then
  1509. begin
  1510. registersfpu:=max(right.registersfpu,registersfpu);
  1511. registers32:=max(right.registers32,registers32);
  1512. {$ifdef SUPPORT_MMX}
  1513. registersmmx:=max(right.registersmmx,registersmmx);
  1514. {$endif SUPPORT_MMX}
  1515. end;
  1516. { determine the registers of the procedure }
  1517. if assigned(left) then
  1518. begin
  1519. registersfpu:=max(left.registersfpu,registersfpu);
  1520. registers32:=max(left.registers32,registers32);
  1521. {$ifdef SUPPORT_MMX}
  1522. registersmmx:=max(left.registersmmx,registersmmx);
  1523. {$endif SUPPORT_MMX}
  1524. end;
  1525. errorexit:
  1526. if inlined then
  1527. procdefinition.proccalloption:=pocall_inline;
  1528. end;
  1529. function tcallnode.docompare(p: tnode): boolean;
  1530. begin
  1531. docompare :=
  1532. inherited docompare(p) and
  1533. (symtableprocentry = tcallnode(p).symtableprocentry) and
  1534. (symtableproc = tcallnode(p).symtableproc) and
  1535. (procdefinition = tcallnode(p).procdefinition) and
  1536. (methodpointer.isequal(tcallnode(p).methodpointer)) and
  1537. ((restypeset and tcallnode(p).restypeset and
  1538. (is_equal(restype.def,tcallnode(p).restype.def))) or
  1539. (not restypeset and not tcallnode(p).restypeset));
  1540. end;
  1541. {****************************************************************************
  1542. TPROCINLINENODE
  1543. ****************************************************************************}
  1544. constructor tprocinlinenode.create(callp,code : tnode);
  1545. begin
  1546. inherited create(procinlinen);
  1547. inlineprocdef:=tcallnode(callp).symtableprocentry.defs^.def;
  1548. retoffset:=-target_info.size_of_pointer; { less dangerous as zero (PM) }
  1549. para_offset:=0;
  1550. para_size:=inlineprocdef.para_size(target_info.alignment.paraalign);
  1551. if ret_in_param(inlineprocdef.rettype.def) then
  1552. inc(para_size,target_info.size_of_pointer);
  1553. { copy args }
  1554. if assigned(code) then
  1555. inlinetree:=code.getcopy
  1556. else inlinetree := nil;
  1557. registers32:=code.registers32;
  1558. registersfpu:=code.registersfpu;
  1559. {$ifdef SUPPORT_MMX}
  1560. registersmmx:=code.registersmmx;
  1561. {$endif SUPPORT_MMX}
  1562. resulttype:=inlineprocdef.rettype;
  1563. end;
  1564. destructor tprocinlinenode.destroy;
  1565. begin
  1566. if assigned(inlinetree) then
  1567. inlinetree.free;
  1568. inherited destroy;
  1569. end;
  1570. function tprocinlinenode.getcopy : tnode;
  1571. var
  1572. n : tprocinlinenode;
  1573. begin
  1574. n:=tprocinlinenode(inherited getcopy);
  1575. if assigned(inlinetree) then
  1576. n.inlinetree:=inlinetree.getcopy
  1577. else
  1578. n.inlinetree:=nil;
  1579. n.inlineprocdef:=inlineprocdef;
  1580. n.retoffset:=retoffset;
  1581. n.para_offset:=para_offset;
  1582. n.para_size:=para_size;
  1583. getcopy:=n;
  1584. end;
  1585. procedure tprocinlinenode.insertintolist(l : tnodelist);
  1586. begin
  1587. end;
  1588. function tprocinlinenode.pass_1 : tnode;
  1589. begin
  1590. result:=nil;
  1591. { left contains the code in tree form }
  1592. { but it has already been firstpassed }
  1593. { so firstpass(left); does not seem required }
  1594. { might be required later if we change the arg handling !! }
  1595. end;
  1596. function tprocinlinenode.docompare(p: tnode): boolean;
  1597. begin
  1598. docompare :=
  1599. inherited docompare(p) and
  1600. inlinetree.isequal(tprocinlinenode(p).inlinetree) and
  1601. (inlineprocdef = tprocinlinenode(p).inlineprocdef);
  1602. end;
  1603. begin
  1604. ccallnode:=tcallnode;
  1605. ccallparanode:=tcallparanode;
  1606. cprocinlinenode:=tprocinlinenode;
  1607. end.
  1608. {
  1609. $Log$
  1610. Revision 1.61 2001-12-31 16:59:41 peter
  1611. * protected/private symbols parsing fixed
  1612. Revision 1.60 2001/12/11 13:21:36 jonas
  1613. * fixed to my previous patch: the hightree must always be converted to a
  1614. longint
  1615. Revision 1.59 2001/12/10 14:28:47 jonas
  1616. * gen_high_tree now uses an inline node of type in_high_x in most cases
  1617. so that it doesn't duplicate any code anymore from ninl.pas (and
  1618. dynamic array support was still missing)
  1619. Revision 1.58 2001/11/20 18:49:43 peter
  1620. * require overload for cross object overloading
  1621. Revision 1.57 2001/11/18 20:18:54 peter
  1622. * use cp_value_equal_const instead of cp_all
  1623. Revision 1.56 2001/11/18 18:43:13 peter
  1624. * overloading supported in child classes
  1625. * fixed parsing of classes with private and virtual and overloaded
  1626. so it is compatible with delphi
  1627. Revision 1.55 2001/11/02 23:16:50 peter
  1628. * removed obsolete chainprocsym and test_procsym code
  1629. Revision 1.54 2001/11/02 22:58:01 peter
  1630. * procsym definition rewrite
  1631. Revision 1.53 2001/10/28 17:22:25 peter
  1632. * allow assignment of overloaded procedures to procvars when we know
  1633. which procedure to take
  1634. Revision 1.51 2001/10/13 09:01:14 jonas
  1635. * fixed bug with using procedures as procvar parameters in TP/Delphi mode
  1636. Revision 1.50 2001/10/12 16:04:32 peter
  1637. * nested inline fix (merged)
  1638. Revision 1.49 2001/09/02 21:12:06 peter
  1639. * move class of definitions into type section for delphi
  1640. Revision 1.48 2001/08/30 15:39:59 jonas
  1641. * fixed docompare for the fields I added to tcallnode in my previous
  1642. commit
  1643. * removed nested comment warning
  1644. Revision 1.47 2001/08/29 12:18:07 jonas
  1645. + new createinternres() constructor for tcallnode to support setting a
  1646. custom resulttype
  1647. * compilerproc typeconversions now set the resulttype from the type
  1648. conversion for the generated call node, because the resulttype of
  1649. of the compilerproc helper isn't always exact (e.g. the ones that
  1650. return shortstrings, actually return a shortstring[x], where x is
  1651. specified by the typeconversion node)
  1652. * ti386callnode.pass_2 now always uses resulttype instead of
  1653. procsym.definition.rettype (so the custom resulttype, if any, is
  1654. always used). Note that this "rettype" stuff is only for use with
  1655. compilerprocs.
  1656. Revision 1.46 2001/08/28 13:24:46 jonas
  1657. + compilerproc implementation of most string-related type conversions
  1658. - removed all code from the compiler which has been replaced by
  1659. compilerproc implementations (using (ifdef hascompilerproc) is not
  1660. necessary in the compiler)
  1661. Revision 1.45 2001/08/26 13:36:39 florian
  1662. * some cg reorganisation
  1663. * some PPC updates
  1664. Revision 1.44 2001/08/24 13:47:27 jonas
  1665. * moved "reverseparameters" from ninl.pas to ncal.pas
  1666. + support for non-persistent temps in ttempcreatenode.create, for use
  1667. with typeconversion nodes
  1668. Revision 1.43 2001/08/23 14:28:35 jonas
  1669. + tempcreate/ref/delete nodes (allows the use of temps in the
  1670. resulttype and first pass)
  1671. * made handling of read(ln)/write(ln) processor independent
  1672. * moved processor independent handling for str and reset/rewrite-typed
  1673. from firstpass to resulttype pass
  1674. * changed names of helpers in text.inc to be generic for use as
  1675. compilerprocs + added "iocheck" directive for most of them
  1676. * reading of ordinals is done by procedures instead of functions
  1677. because otherwise FPC_IOCHECK overwrote the result before it could
  1678. be stored elsewhere (range checking still works)
  1679. * compilerprocs can now be used in the system unit before they are
  1680. implemented
  1681. * added note to errore.msg that booleans can't be read using read/readln
  1682. Revision 1.42 2001/08/19 21:11:20 florian
  1683. * some bugs fix:
  1684. - overload; with external procedures fixed
  1685. - better selection of routine to do an overloaded
  1686. type case
  1687. - ... some more
  1688. Revision 1.41 2001/08/13 12:41:56 jonas
  1689. * made code for str(x,y) completely processor independent
  1690. Revision 1.40 2001/08/06 21:40:46 peter
  1691. * funcret moved from tprocinfo to tprocdef
  1692. Revision 1.39 2001/08/01 15:07:29 jonas
  1693. + "compilerproc" directive support, which turns both the public and mangled
  1694. name to lowercase(declaration_name). This prevents a normal user from
  1695. accessing the routine, but they can still be easily looked up within
  1696. the compiler. This is used for helper procedures and should facilitate
  1697. the writing of more processor independent code in the code generator
  1698. itself (mostly written by Peter)
  1699. + new "createintern" constructor for tcal nodes to create a call to
  1700. helper exported using the "compilerproc" directive
  1701. + support for high(dynamic_array) using the the above new things
  1702. + definition of 'HASCOMPILERPROC' symbol (to be able to check in the
  1703. compiler and rtl whether the "compilerproc" directive is supported)
  1704. Revision 1.38 2001/07/30 20:52:25 peter
  1705. * fixed array constructor passing with type conversions
  1706. Revision 1.37 2001/07/09 21:15:40 peter
  1707. * Length made internal
  1708. * Add array support for Length
  1709. Revision 1.36 2001/07/01 20:16:15 peter
  1710. * alignmentinfo record added
  1711. * -Oa argument supports more alignment settings that can be specified
  1712. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  1713. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  1714. required alignment and the maximum usefull alignment. The final
  1715. alignment will be choosen per variable size dependent on these
  1716. settings
  1717. Revision 1.35 2001/06/04 18:08:19 peter
  1718. * procvar support for varargs
  1719. Revision 1.34 2001/06/04 11:48:02 peter
  1720. * better const to var checking
  1721. Revision 1.33 2001/05/20 12:09:31 peter
  1722. * fixed exit with ansistring return from function call, no_fast_exit
  1723. should be set in det_resulttype instead of pass_1
  1724. Revision 1.32 2001/04/26 21:55:05 peter
  1725. * defcoll must be assigned in insert_typeconv
  1726. Revision 1.31 2001/04/21 12:03:11 peter
  1727. * m68k updates merged from fixes branch
  1728. Revision 1.30 2001/04/18 22:01:54 peter
  1729. * registration of targets and assemblers
  1730. Revision 1.29 2001/04/13 23:52:29 peter
  1731. * don't allow passing signed-unsigned ords to var parameter, this
  1732. forbids smallint-word, shortint-byte, longint-cardinal mixtures.
  1733. It's still allowed in tp7 -So mode.
  1734. Revision 1.28 2001/04/13 22:22:59 peter
  1735. * call set_varstate for procvar calls
  1736. Revision 1.27 2001/04/13 01:22:08 peter
  1737. * symtable change to classes
  1738. * range check generation and errors fixed, make cycle DEBUG=1 works
  1739. * memory leaks fixed
  1740. Revision 1.26 2001/04/04 22:42:39 peter
  1741. * move constant folding into det_resulttype
  1742. Revision 1.25 2001/04/02 21:20:30 peter
  1743. * resulttype rewrite
  1744. Revision 1.24 2001/03/12 12:47:46 michael
  1745. + Patches from peter
  1746. Revision 1.23 2001/02/26 19:44:52 peter
  1747. * merged generic m68k updates from fixes branch
  1748. Revision 1.22 2001/01/08 21:46:46 peter
  1749. * don't push high value for open array with cdecl;external;
  1750. Revision 1.21 2000/12/31 11:14:10 jonas
  1751. + implemented/fixed docompare() mathods for all nodes (not tested)
  1752. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  1753. and constant strings/chars together
  1754. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  1755. when adding
  1756. Revision 1.20 2000/12/25 00:07:26 peter
  1757. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1758. tlinkedlist objects)
  1759. Revision 1.19 2000/12/17 14:35:12 peter
  1760. * fixed crash with procvar load in tp mode
  1761. Revision 1.18 2000/11/29 00:30:32 florian
  1762. * unused units removed from uses clause
  1763. * some changes for widestrings
  1764. Revision 1.17 2000/11/22 15:12:06 jonas
  1765. * fixed inline-related problems (partially "merges")
  1766. Revision 1.16 2000/11/11 16:14:52 peter
  1767. * fixed crash with settextbuf,ptr
  1768. Revision 1.15 2000/11/06 21:36:25 peter
  1769. * fixed var parameter varstate bug
  1770. Revision 1.14 2000/11/04 14:25:20 florian
  1771. + merged Attila's changes for interfaces, not tested yet
  1772. Revision 1.13 2000/10/31 22:02:47 peter
  1773. * symtable splitted, no real code changes
  1774. Revision 1.12 2000/10/21 18:16:11 florian
  1775. * a lot of changes:
  1776. - basic dyn. array support
  1777. - basic C++ support
  1778. - some work for interfaces done
  1779. ....
  1780. Revision 1.11 2000/10/21 14:35:27 peter
  1781. * readd to many remove p. for tcallnode.is_equal()
  1782. Revision 1.10 2000/10/14 21:52:55 peter
  1783. * fixed memory leaks
  1784. Revision 1.9 2000/10/14 10:14:50 peter
  1785. * moehrendorf oct 2000 rewrite
  1786. Revision 1.8 2000/10/01 19:48:24 peter
  1787. * lot of compile updates for cg11
  1788. Revision 1.7 2000/09/28 19:49:52 florian
  1789. *** empty log message ***
  1790. Revision 1.6 2000/09/27 18:14:31 florian
  1791. * fixed a lot of syntax errors in the n*.pas stuff
  1792. Revision 1.5 2000/09/24 21:15:34 florian
  1793. * some errors fix to get more stuff compilable
  1794. Revision 1.4 2000/09/24 20:17:44 florian
  1795. * more conversion work done
  1796. Revision 1.3 2000/09/24 15:06:19 peter
  1797. * use defines.inc
  1798. Revision 1.2 2000/09/20 21:52:38 florian
  1799. * removed a lot of errors
  1800. Revision 1.1 2000/09/20 20:52:16 florian
  1801. * initial revision
  1802. }