symbols.pas 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 by Daniel Mantione
  4. and other members of the Free Pascal development team
  5. This unit handles symbols
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. {$ifdef TP}
  20. {$N+,E+,F+}
  21. {$endif}
  22. unit symbols;
  23. interface
  24. uses symtable,aasm,objects,cobjects,defs,cpubase,tokens;
  25. {Note: It is forbidden to add the symtablt unit. A symbol should not now in
  26. which symtable it is.}
  27. {The tokens unit is only needed for the overloaded operators array. This
  28. array can better be moved into another unit.}
  29. type Ttypeprop=(sp_primary_typesym);
  30. Ttypepropset=set of Ttypeprop;
  31. Tobjprop=(sp_public,sp_private,sp_protected,sp_published,sp_static);
  32. Tobjpropset=set of Tobjprop;
  33. Tpropprop=(ppo_indexed,ppo_defaultproperty,
  34. ppo_stored,ppo_published,ppo_hasparameters);
  35. Tproppropset=set of Tpropprop;
  36. Tvarprop=(vo_regable,vo_fpuregable,vo_is_C_var,vo_is_external,
  37. vo_is_dll_var,vo_is_thread_var);
  38. Tvarpropset=set of Tvarprop;
  39. {State of a variable, if it's declared, assigned or used.}
  40. Tvarstate=(vs_none,vs_declared,vs_declared_and_first_found,
  41. vs_set_but_first_not_passed,vs_assigned,vs_used);
  42. Plabelsym=^Tlabelsym;
  43. Tlabelsym=object(Tsym)
  44. lab:Pasmlabel;
  45. defined:boolean;
  46. constructor init(const n:string;l:Pasmlabel);
  47. constructor load(var s:Tstream);
  48. function mangledname:string;virtual;
  49. procedure store(var s:Tstream);virtual;
  50. end;
  51. { Punitsym=^Tunitsym;
  52. Tunitsym=object(Tsym)
  53. unitsymtable : punitsymtable;
  54. prevsym : punitsym;
  55. refs : longint;
  56. constructor init(const n : string;ref : punitsymtable);
  57. constructor load(var s:Tstream);
  58. destructor done;virtual;
  59. procedure store(var s:Tstream);virtual;
  60. end;}
  61. Perrorsym=^Terrorsym;
  62. Terrorsym=object(tsym)
  63. constructor init;
  64. end;
  65. Pprocsym=^Tprocsym;
  66. Tprocsym=object(Tsym)
  67. definitions:Pobject; {Is Pprocdef when procedure not
  68. overloaded, or a Pcollection of
  69. Pprocdef when it is overloaded.
  70. Since most procedures are not
  71. overloaded, this saves a lot of
  72. memory.}
  73. objprop:Tobjpropset; {All overloaded procedures should
  74. have the same scope, so the object
  75. scope information is put in the
  76. symbol.}
  77. sub_of:Pprocsym;
  78. _class:Pobjectdef;
  79. constructor init(const n:string;Asub_of:Pprocsym);
  80. constructor load(var s:Tstream);
  81. function count:word;
  82. function firstthat(action:pointer):Pprocdef;
  83. procedure foreach(action:pointer);
  84. procedure insert(def:Pprocdef);
  85. function mangledname:string;virtual; {Causes internalerror.}
  86. {Writes all declarations.}
  87. procedure write_parameter_lists;
  88. {Tests, if all procedures definitions are defined and not
  89. just available as forward,}
  90. procedure check_forward;
  91. procedure store(var s:Tstream);virtual;
  92. procedure deref;virtual;
  93. procedure load_references;virtual;
  94. function write_references:boolean;virtual;
  95. destructor done;virtual;
  96. end;
  97. Ptypesym=^Ttypesym;
  98. Ttypesym=object(Tsym)
  99. definition:Pdef;
  100. forwardpointers:Pcollection; {Contains the forwardpointers.}
  101. properties:Ttypepropset;
  102. synonym:Ptypesym;
  103. constructor init(const n:string;d:Pdef);
  104. constructor load(var s:Tstream);
  105. { procedure addforwardpointer(p:Ppointerdef);}
  106. procedure deref;virtual;
  107. procedure store(var s:Tstream);virtual;
  108. procedure load_references;virtual;
  109. procedure updateforwarddef(p:pdef);
  110. function write_references:boolean;virtual;
  111. destructor done;virtual;
  112. end;
  113. Psyssym=^Tsyssym;
  114. Tsyssym=object(Tsym)
  115. number:longint;
  116. constructor init(const n:string;l:longint);
  117. constructor load(var s:Tstream);
  118. procedure store(var s:Tstream);virtual;
  119. end;
  120. Pmacrosym=^Tmacrosym;
  121. Tmacrosym=object(Tsym)
  122. defined,is_used:boolean;
  123. buftext:Pchar;
  124. buflen:longint;
  125. {Macros aren't written to PPU files !}
  126. constructor init(const n:string);
  127. destructor done;virtual;
  128. end;
  129. Penumsym=^Tenumsym;
  130. Tenumsym=object(tsym)
  131. value:longint;
  132. definition:Penumdef;
  133. nextenum:Penumsym;
  134. constructor init(const n:string;def:Penumdef;v:longint);
  135. constructor load(var s:Tstream);
  136. procedure store(var s:Tstream);virtual;
  137. procedure deref;virtual;
  138. procedure order;
  139. end;
  140. Pprogramsym=^Tprogramsym;
  141. Tprogramsym=object(Tsym)
  142. end;
  143. Pvarsym=^Tvarsym;
  144. Tvarsym=object(tsym)
  145. address:longint;
  146. localvarsym:Pvarsym;
  147. islocalcopy:boolean;
  148. definition:Pdef;
  149. refs:longint;
  150. properties:Tvarpropset;
  151. state:Tvarstate;
  152. objprop:Tobjpropset;
  153. _mangledname:Pstring;
  154. reg:Tregister; {If reg<>R_NO, then the variable is an register
  155. variable }
  156. constructor init(const n:string;p:Pdef);
  157. constructor init_dll(const n:string;p:Pdef);
  158. constructor init_C(const n,mangled:string;p:Pdef);
  159. constructor load(var s:Tstream);
  160. procedure concatdata(const n:string;len:longint);
  161. procedure deref;virtual;
  162. function getsize:longint;virtual;
  163. function mangledname:string;virtual;
  164. procedure insert_in_data;virtual;
  165. procedure setmangledname(const s:string);
  166. procedure store(var s:Tstream);virtual;
  167. destructor done;virtual;
  168. end;
  169. Pparamsym=^Tparamsym;
  170. Tparamsym=object(Tvarsym)
  171. varspez:Tvarspez;
  172. pushaddress:longint;
  173. constructor init(const n:string;p:Pdef;vs:Tvarspez);
  174. function getsize:longint;virtual;
  175. function getpushsize:longint;virtual;
  176. procedure insert_in_data;virtual;
  177. end;
  178. Ptypedconstsym=^Ttypedconstsym;
  179. Ttypedconstsym=object(Tsym)
  180. prefix:Pstring;
  181. definition:Pdef;
  182. is_really_const:boolean;
  183. constructor init(const n:string;p:Pdef;really_const:boolean);
  184. constructor load(var s:Tstream);
  185. destructor done;virtual;
  186. function mangledname:string;virtual;
  187. procedure store(var s:Tstream);virtual;
  188. procedure deref;virtual;
  189. function getsize:longint;
  190. procedure insert_in_data;virtual;
  191. end;
  192. Tconsttype=(constord,conststring,constreal,constbool,
  193. constint,constchar,constset,constnil);
  194. Pconstsym=^Tconstsym;
  195. Tconstsym=object(Tsym)
  196. definition:Pdef;
  197. consttype:Tconsttype;
  198. value,len:longint; {Len is needed for string length.}
  199. constructor init(const n:string;t:Tconsttype;v:longint);
  200. constructor init_def(const n:string;t:Tconsttype;v:longint;
  201. def:Pdef);
  202. constructor init_string(const n:string;t:Tconsttype;
  203. str:Pchar;l:longint);
  204. constructor load(var s:Tstream);
  205. procedure deref;virtual;
  206. procedure store(var s:Tstream);virtual;
  207. destructor done;virtual;
  208. end;
  209. absolutetyp = (tovar,toasm,toaddr);
  210. Pabsolutesym = ^tabsolutesym;
  211. Tabsolutesym = object(tvarsym)
  212. abstyp:absolutetyp;
  213. absseg:boolean;
  214. ref:Psym;
  215. asmname:Pstring;
  216. constructor load(var s:Tstream);
  217. procedure deref;virtual;
  218. function mangledname : string;virtual;
  219. procedure store(var s:Tstream);virtual;
  220. end;
  221. Pfuncretsym=^Tfuncretsym;
  222. Tfuncretsym=object(tsym)
  223. funcretprocinfo:pointer{Pprocinfo};
  224. definition:Pdef;
  225. address:longint;
  226. constructor init(const n:string;approcinfo:pointer{pprocinfo});
  227. constructor load(var s:Tstream);
  228. procedure insert_in_data;virtual;
  229. procedure store(var s:Tstream);virtual;
  230. procedure deref;virtual;
  231. end;
  232. Ppropertysym=^Tpropertysym;
  233. Tpropertysym=object(Tsym)
  234. properties:Tproppropset;
  235. definition:Pdef;
  236. objprop:Tobjpropset;
  237. rangedef:Pdef; {Type of the range for array properties.}
  238. {For record property's like property x read a.b.c, the
  239. collection contains a as first element, b as second element,
  240. and c as the third element.}
  241. readaccess,
  242. writeaccess,
  243. storedaccess:Pcollection;
  244. index,default:longint;
  245. constructor load(var s:Tstream);
  246. function getsize:longint;virtual;
  247. procedure store(var s:Tstream);virtual;
  248. procedure deref;virtual;
  249. end;
  250. const {Last and first operators which can be overloaded.}
  251. first_overloaded = _PLUS;
  252. last_overloaded = _ASSIGNMENT;
  253. overloaded_names : array [first_overloaded..
  254. last_overloaded] of string[16] =
  255. ('plus','minus','star','slash',
  256. 'equal','greater','lower','greater_or_equal',
  257. 'lower_or_equal','sym_diff','starstar','as',
  258. 'is','in','or','and',
  259. 'div','mod','shl','shr',
  260. 'xor','assign');
  261. var current_object_option:Tobjprop;
  262. current_type_option:Ttypepropset;
  263. aktprocsym:Pprocsym; {Pointer to the symbol for the
  264. currently parsed procedure.}
  265. aktprocdef:Pprocdef; {Pointer to the defnition for the
  266. currently parsed procedure.}
  267. aktvarsym:Pvarsym; {Pointer to the symbol for the
  268. currently read var, only used
  269. for variable directives.}
  270. overloaded_operators:array[first_overloaded..
  271. last_overloaded] of Pprocsym;
  272. { unequal is not equal}
  273. implementation
  274. uses callspec,verbose,globals,systems,globtype,types;
  275. {****************************************************************************
  276. Tlabelsym
  277. ****************************************************************************}
  278. constructor Tlabelsym.init(const n:string;l:Pasmlabel);
  279. begin
  280. inherited init(n);
  281. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  282. lab:=l;
  283. defined:=false;
  284. end;
  285. constructor Tlabelsym.load(var s:Tstream);
  286. begin
  287. inherited load(s);
  288. defined:=true;
  289. end;
  290. function Tlabelsym.mangledname:string;
  291. begin
  292. mangledname:=lab^.name;
  293. end;
  294. procedure Tlabelsym.store(var s:Tstream);
  295. begin
  296. inherited store(s);
  297. { current_ppu^.writeentry(iblabelsym);}
  298. end;
  299. {****************************************************************************
  300. Terrorsym
  301. ****************************************************************************}
  302. constructor terrorsym.init;
  303. begin
  304. inherited init('');
  305. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  306. end;
  307. {****************************************************************************
  308. Tprocsym
  309. ****************************************************************************}
  310. constructor Tprocsym.init(const n:string;Asub_of:Pprocsym);
  311. begin
  312. inherited init(n);
  313. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  314. sub_of:=Asub_of;
  315. end;
  316. constructor Tprocsym.load(var s:Tstream);
  317. begin
  318. inherited load(s);
  319. { definition:=Pprocdef(readdefref);}
  320. end;
  321. function Tprocsym.count:word;
  322. begin
  323. if typeof(definitions^)=typeof(Tcollection) then
  324. count:=Pcollection(definitions)^.count
  325. else
  326. count:=1;
  327. end;
  328. function Tprocsym.firstthat(action:pointer):Pprocdef;
  329. begin
  330. firstthat:=nil;
  331. if definitions<>nil then
  332. if typeof(definitions^)=typeof(Tcollection) then
  333. firstthat:=Pcollection(definitions)^.firstthat(action)
  334. else if boolean(byte(longint(callpointerlocal(action,
  335. previousframepointer,definitions)))) then
  336. firstthat:=Pprocdef(definitions);
  337. end;
  338. procedure Tprocsym.foreach(action:pointer);
  339. begin
  340. if definitions<>nil then
  341. begin
  342. if typeof(definitions^)=typeof(Tcollection) then
  343. Pcollection(definitions)^.foreach(action)
  344. else
  345. callpointerlocal(action,previousframepointer,definitions);
  346. end;
  347. end;
  348. procedure Tprocsym.insert(def:Pprocdef);
  349. function matchparas(item:pointer):boolean;{$IFDEF TP}far;{$ENDIF}
  350. begin
  351. matchparas:=equal_paras(Pprocdef(item)^.parameters,
  352. Pprocdef(def)^.parameters,false);
  353. end;
  354. var c:Pcollection;
  355. ovs:Pprocsym;
  356. ovd:Pprocdef;
  357. ve:Pvmtentry;
  358. errparam:string;
  359. begin
  360. if _class<>nil then
  361. begin
  362. {Update object information.}
  363. if po_virtualmethod in def^.options then
  364. include(_class^.options,oo_has_virtual);
  365. if po_abstractmethod in def^.options then
  366. include(_class^.options,oo_has_abstract);
  367. if def^.proctype=po_type_constructor then
  368. include(_class^.options,oo_has_constructor);
  369. if def^.proctype=po_type_destructor then
  370. include(_class^.options,oo_has_destructor);
  371. {Check if we are overriding an existing method.}
  372. ovs:=Pprocsym(_class^.childof^.search(name,true));
  373. ovd:=ovs^.firstthat(@matchparas);
  374. if ovd<>nil then
  375. begin
  376. errparam:=_class^.objname^+'.'+name;
  377. {If the old method is virtual and we are not, we
  378. refuse this for objects, and warn for classes.}
  379. if (po_virtualmethod in ovd^.options) then
  380. if (po_virtualmethod in Pprocdef(def)^.options) then
  381. if oo_is_class in _class^.options then
  382. message1(parser_w_should_use_override,errparam)
  383. else
  384. message1(parser_w_overloaded_are_not_both_virtual,errparam)
  385. else
  386. {Both are virtual.
  387. The flags have to match except abstract,
  388. assembler and override.}
  389. if (def^.calloptions<>ovd^.calloptions) or
  390. (def^.proctype<>ovd^.proctype) or
  391. ((def^.options-[po_abstractmethod,po_overridingmethod,po_assembler])<>
  392. (ovd^.options-[po_abstractmethod,po_overridingmethod,po_assembler])) then
  393. message1(parser_e_header_dont_match_forward,errparam);
  394. {Error if the return types aren't equal.}
  395. if not(is_equal(def^.retdef,ovd^.retdef)) and
  396. not(def^.retdef^.is_object(typeof(Tobjectdef)) and
  397. Pprocdef(ovd)^.retdef^.is_object(typeof(Tobjectdef)) and
  398. (oo_is_class in Pobjectdef(def^.retdef)^.options) and
  399. (oo_is_class in Pobjectdef(ovd^.retdef)^.options) and
  400. (pobjectdef(def^.retdef)^.is_related(pobjectdef(ovd^.retdef)))) then
  401. message1(parser_e_overloaded_methodes_not_same_ret,errparam);
  402. if po_virtualmethod in def^.options then
  403. begin
  404. if not(oo_has_constructor in _class^.options) then
  405. message1(parser_w_virtual_without_constructor,_class^.objname^);
  406. {We change the the vmt layout so we are called instead
  407. of our ancestor.}
  408. if sp_private in objprop then
  409. ve:=new(Plocalvmtentry,init(_class,def))
  410. else
  411. ve:=new(Pglobalvmtentry,init(_class,def));
  412. _class^.vmt_layout^.atput(ovd^.vmt_index,ve);
  413. def^.vmt_index:=ovd^.vmt_index;
  414. end;
  415. end
  416. else
  417. begin
  418. if not(oo_has_constructor in _class^.options) then
  419. message1(parser_w_virtual_without_constructor,_class^.objname^);
  420. {The method is not overridden; if it is virtual we should
  421. generate a vmt entry.}
  422. if po_virtualmethod in def^.options then
  423. begin
  424. if sp_private in objprop then
  425. ve:=new(Plocalvmtentry,init(_class,def))
  426. else
  427. ve:=new(Pglobalvmtentry,init(_class,def));
  428. _class^.vmt_layout^.insert(ve);
  429. def^.vmt_index:=_class^.vmt_layout^.count-1;
  430. end;
  431. end;
  432. end;
  433. if definitions=nil then
  434. definitions:=def
  435. else
  436. if typeof(definitions^)=typeof(Tcollection) then
  437. Pcollection(def)^.insert(def)
  438. else
  439. begin
  440. c:=new(Pcollection,init(8,4));
  441. c^.insert(definitions);
  442. definitions:=c;
  443. end;
  444. end;
  445. function Tprocsym.mangledname:string;
  446. {This function calls internalerror, because procsyms can be overloaded.
  447. Procedures should use the foreach to check for the right overloaded procsym
  448. and then call mangledname on that procsym.}
  449. begin
  450. internalerror($99080201);
  451. end;
  452. procedure Tprocsym.write_parameter_lists;
  453. {var p:Pprocdef;}
  454. begin
  455. (* p:=definition;
  456. while assigned(p) do
  457. begin
  458. {Force the error to be printed.}
  459. verbose.message1(sym_b_param_list,name+p^.demangled_paras);
  460. p:=p^.nextoverloaded;
  461. end;*)
  462. end;
  463. procedure tprocsym.check_forward;
  464. {var pd:Pprocdef;}
  465. begin
  466. (* pd:=definition;
  467. while assigned(pd) do
  468. begin
  469. if pd^.forwarddef then
  470. begin
  471. if assigned(pd^._class) then
  472. messagepos1(fileinfo,sym_e_forward_not_resolved,
  473. pd^._class^.objname^+'.'+name+
  474. demangledparas(pd^.demangled_paras))
  475. else
  476. messagepos1(fileinfo,sym_e_forward_not_resolved,
  477. name+pd^.demangled_paras);
  478. {Turn futher error messages off.}
  479. pd^.forwarddef:=false;
  480. end;
  481. pd:=pd^.nextoverloaded;
  482. end;*)
  483. end;
  484. procedure tprocsym.deref;
  485. {var t:ttoken;
  486. last:Pprocdef;}
  487. begin
  488. (*
  489. resolvedef(pdef(definition));
  490. if (definition^.options and pooperator) <> 0 then
  491. begin
  492. last:=definition;
  493. while assigned(last^.nextoverloaded) do
  494. last:=last^.nextoverloaded;
  495. for t:=first_overloaded to last_overloaded do
  496. if (name=overloaded_names[t]) then
  497. begin
  498. if assigned(overloaded_operators[t]) then
  499. last^.nextoverloaded:=overloaded_operators[t]^.definition;
  500. overloaded_operators[t]:=@self;
  501. end;
  502. end;*)
  503. end;
  504. procedure Tprocsym.store(var s:Tstream);
  505. begin
  506. inherited store(s);
  507. { writedefref(pdef(definition));
  508. current_ppu^.writeentry(ibprocsym);}
  509. end;
  510. procedure tprocsym.load_references;
  511. begin
  512. inherited load_references;
  513. end;
  514. function Tprocsym.write_references:boolean;
  515. {var prdef:Pprocdef;}
  516. begin
  517. (* write_references:=false;
  518. if not inherited write_references then
  519. exit;
  520. write_references:=true;
  521. prdef:=definition;
  522. while assigned(prdef) and (prdef^.owner=definition^.owner) do
  523. begin
  524. prdef^.write_references;
  525. prdef:=prdef^.nextoverloaded;
  526. end;*)
  527. end;
  528. destructor Tprocsym.done;
  529. begin
  530. {Don't check if errors !!}
  531. if errorcount=0 then
  532. check_forward;
  533. inherited done;
  534. end;
  535. {****************************************************************************
  536. Ttypesym
  537. ****************************************************************************}
  538. constructor Ttypesym.init(const n:string;d:Pdef);
  539. begin
  540. inherited init(n);
  541. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  542. definition:=d;
  543. if assigned(definition) then
  544. begin
  545. if definition^.sym<>nil then
  546. begin
  547. definition^.sym:=@self;
  548. properties:=[sp_primary_typesym];
  549. end
  550. else
  551. begin
  552. synonym:=Ptypesym(definition^.sym)^.synonym;
  553. Ptypesym(definition^.sym)^.synonym:=@self;
  554. end;
  555. end;
  556. end;
  557. constructor Ttypesym.load(var s:Tstream);
  558. begin
  559. inherited load(s);
  560. { definition:=readdefref;}
  561. end;
  562. {procedure Ttypesym.addforwardpointer(p:Ppointerdef);
  563. begin
  564. if forwardpointers=nil then
  565. new(forwardpointers,init(8,4));
  566. forwardpointers^.insert(p);
  567. end;}
  568. procedure ttypesym.deref;
  569. begin
  570. (* resolvedef(definition);
  571. if assigned(definition) then
  572. begin
  573. if properties=sp_primary_typesym then
  574. begin
  575. if definition^.sym<>@self then
  576. synonym:=definition^.sym;
  577. definition^.sym:=@self;
  578. end
  579. else
  580. begin
  581. if assigned(definition^.sym) then
  582. begin
  583. synonym:=definition^.sym^.synonym;
  584. if definition^.sym<>@self then
  585. definition^.sym^.synonym:=@self;
  586. end
  587. else
  588. definition^.sym:=@self;
  589. end;
  590. if (definition^.deftype=recorddef) and
  591. assigned(precdef(definition)^.symtable) and
  592. (definition^.sym=@self) then
  593. precdef(definition)^.symtable^.name:=stringdup('record '+name);
  594. end;*)
  595. end;
  596. procedure ttypesym.store(var s:Tstream);
  597. begin
  598. inherited store(s);
  599. { writedefref(definition);
  600. current_ppu^.writeentry(ibtypesym);}
  601. end;
  602. procedure ttypesym.load_references;
  603. begin
  604. inherited load_references;
  605. { if typeof(definition^)=typeof(Trecorddef) then
  606. Precdef(definition)^.symtable^.load_browser;
  607. if typeof(definition^)=typeof(Tobjectdef) then
  608. Pobjectdef(definition)^.publicsyms^.load_browser;}
  609. end;
  610. function ttypesym.write_references : boolean;
  611. begin
  612. (* if not inherited write_references then
  613. {Write address of this symbol if record or object
  614. even if no real refs are there
  615. because we need it for the symtable }
  616. if (definition^.deftype=recorddef) or
  617. (definition^.deftype=objectdef) then
  618. begin
  619. writesymref(@self);
  620. current_ppu^.writeentry(ibsymref);
  621. end;
  622. write_references:=true;
  623. if (definition^.deftype=recorddef) then
  624. precdef(definition)^.symtable^.write_browser;
  625. if (definition^.deftype=objectdef) then
  626. pobjectdef(definition)^.publicsyms^.write_browser;*)
  627. end;
  628. procedure ttypesym.updateforwarddef(p:pdef);
  629. var i:word;
  630. begin
  631. if definition<>nil then
  632. internalerror($99080203)
  633. else
  634. definition:=p;
  635. properties:=current_type_option;
  636. fileinfo:=tokenpos;
  637. if assigned(definition) and not(assigned(definition^.sym)) then
  638. definition^.sym:=@self;
  639. {Update all forwardpointers to this definition.}
  640. { for i:=1 to forwardpointers^.count do
  641. Ppointerdef(forwardpointers^.at(i))^.definition:=definition;}
  642. forwardpointers^.deleteall;
  643. dispose(forwardpointers,done);
  644. forwardpointers:=nil;
  645. end;
  646. destructor Ttypesym.done;
  647. var prevsym:Ptypesym;
  648. begin
  649. if assigned(definition) then
  650. begin
  651. prevsym:=Ptypesym(definition^.sym);
  652. if prevsym=@self then
  653. definition^.sym:=synonym;
  654. while assigned(prevsym) do
  655. begin
  656. if (prevsym^.synonym=@self) then
  657. begin
  658. prevsym^.synonym:=synonym;
  659. break;
  660. end;
  661. prevsym:=prevsym^.synonym;
  662. end;
  663. end;
  664. synonym:=nil;
  665. definition:=nil;
  666. inherited done;
  667. end;
  668. {****************************************************************************
  669. Tsyssym
  670. ****************************************************************************}
  671. constructor Tsyssym.init(const n:string;l:longint);
  672. begin
  673. inherited init(n);
  674. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  675. number:=l;
  676. end;
  677. constructor Tsyssym.load(var s:Tstream);
  678. begin
  679. inherited load(s);
  680. { number:=readlong;}
  681. end;
  682. procedure tsyssym.store(var s:Tstream);
  683. begin
  684. Tsym.store(s);
  685. { writelong(number);
  686. current_ppu^.writeentry(ibsyssym);}
  687. end;
  688. {****************************************************************************
  689. Tenumsym
  690. ****************************************************************************}
  691. constructor Tenumsym.init(const n:string;def:Penumdef;v:longint);
  692. begin
  693. inherited init(n);
  694. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  695. definition:=def;
  696. value:=v;
  697. if def^.minval>v then
  698. def^.setmin(v);
  699. if def^.maxval<v then
  700. def^.setmax(v);
  701. order;
  702. end;
  703. constructor Tenumsym.load(var s:Tstream);
  704. begin
  705. inherited load(s);
  706. { definition:=Penumdef(readdefref);
  707. value:=readlong;}
  708. end;
  709. procedure Tenumsym.deref;
  710. begin
  711. { resolvedef(pdef(definition));
  712. order;}
  713. end;
  714. procedure Tenumsym.order;
  715. var i:word;
  716. label inserted;
  717. begin
  718. {Keep the enum symbols ordered by value...}
  719. with definition^.symbols^ do
  720. begin
  721. {Most of the time, enums are defined in order, so we count down.}
  722. for i:=count-1 downto 0 do
  723. begin
  724. if Penumsym(at(i))^.value<value then
  725. begin
  726. atinsert(i+1,@self);
  727. {We have to use goto to keep the
  728. code efficient :( }
  729. goto inserted;
  730. end;
  731. end;
  732. atinsert(0,@self);
  733. inserted:
  734. end;
  735. end;
  736. procedure Tenumsym.store(var s:Tstream);
  737. begin
  738. inherited store(s);
  739. (* writedefref(definition);
  740. writelong(value);
  741. current_ppu^.writeentry(ibenumsym);*)
  742. end;
  743. {****************************************************************************
  744. Tmacrosym
  745. ****************************************************************************}
  746. constructor Tmacrosym.init(const n:string);
  747. begin
  748. inherited init(n);
  749. defined:=true;
  750. end;
  751. destructor Tmacrosym.done;
  752. begin
  753. if assigned(buftext) then
  754. freemem(buftext,buflen);
  755. inherited done;
  756. end;
  757. {****************************************************************************
  758. Tprogramsym
  759. ****************************************************************************}
  760. {****************************************************************************
  761. Tvarsym
  762. ****************************************************************************}
  763. constructor Tvarsym.init(const n:string;p:Pdef);
  764. begin
  765. inherited init(n);
  766. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  767. definition:=p;
  768. {Can we load the value into a register ? }
  769. if dp_regable in p^.properties then
  770. include(properties,vo_regable);
  771. reg:=R_NO;
  772. end;
  773. constructor Tvarsym.init_dll(const n:string;p:Pdef);
  774. begin
  775. init(n,p);
  776. include(properties,vo_is_dll_var);
  777. end;
  778. constructor Tvarsym.init_C(const n,mangled:string;p:Pdef);
  779. begin
  780. init(n,p);
  781. include(properties,vo_is_C_var);
  782. setmangledname(mangled);
  783. end;
  784. procedure Tvarsym.concatdata(const n:string;len:longint);
  785. begin
  786. end;
  787. constructor Tvarsym.load(var s:Tstream);
  788. begin
  789. inherited load(s);
  790. reg:=R_NO;
  791. { if read_member then
  792. address:=readlong
  793. else
  794. address:=0;
  795. definition:=readdefref;
  796. var_options:=readbyte;
  797. if (var_options and vo_is_C_var)<>0 then
  798. setmangledname(readstring);}
  799. end;
  800. function Tvarsym.getsize:longint;
  801. begin
  802. if definition<>nil then
  803. getsize:=definition^.size
  804. else
  805. getsize:=0;
  806. end;
  807. procedure Tvarsym.deref;
  808. begin
  809. { resolvedef(definition);}
  810. end;
  811. procedure Tvarsym.store(var s:Tstream);
  812. begin
  813. (* inherited store(s);
  814. if read_member then
  815. writelong(address);
  816. writedefref(definition);
  817. { symbols which are load are never candidates for a register,
  818. turn of the regable }
  819. writebyte(var_options and (not vo_regable));
  820. if (var_options and vo_is_C_var)<>0 then
  821. writestring(mangledname);
  822. current_ppu^.writeentry(ibvarsym);*)
  823. end;
  824. procedure Tvarsym.setmangledname(const s:string);
  825. begin
  826. _mangledname:=stringdup(s);
  827. end;
  828. function Tvarsym.mangledname:string;
  829. var prefix:string;
  830. begin
  831. if assigned(_mangledname) then
  832. mangledname:=_mangledname^
  833. else
  834. mangledname:=owner^.varsymprefix+name;
  835. end;
  836. procedure Tvarsym.insert_in_data;
  837. var l,ali,modulo:longint;
  838. storefilepos:Tfileposinfo;
  839. begin
  840. if (vo_is_external in properties) then
  841. begin
  842. {Handle static variables of objects especially }
  843. if read_member and (sp_static in objprop) then
  844. begin
  845. {The data field is generated in parser.pas
  846. with a tobject_FIELDNAME variable, so we do
  847. not need to do it in this procedure.}
  848. {This symbol can't be loaded to a register.}
  849. exclude(properties,vo_regable);
  850. end
  851. else
  852. if not(read_member) then
  853. begin
  854. storefilepos:=aktfilepos;
  855. aktfilepos:=tokenpos;
  856. if (vo_is_thread_var in properties) then
  857. l:=4
  858. else
  859. l:=getsize;
  860. address:=owner^.varsymtodata(@self,l);
  861. aktfilepos:=storefilepos;
  862. end;
  863. end;
  864. end;
  865. destructor Tvarsym.done;
  866. begin
  867. disposestr(_mangledname);
  868. inherited done;
  869. end;
  870. {****************************************************************************
  871. Tparamsym
  872. ****************************************************************************}
  873. constructor Tparamsym.init(const n:string;p:Pdef;vs:Tvarspez);
  874. begin
  875. inherited init(n,p);
  876. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  877. varspez:=vs;
  878. end;
  879. function Tparamsym.getsize:longint;
  880. begin
  881. if (definition<>nil) and (varspez=vs_value) then
  882. getsize:=definition^.size
  883. else
  884. getsize:=0;
  885. end;
  886. function Tparamsym.getpushsize:longint;
  887. begin
  888. if assigned(definition) then
  889. begin
  890. case varspez of
  891. vs_var:
  892. getpushsize:=target_os.size_of_pointer;
  893. vs_value,vs_const:
  894. if dp_pointer_param in definition^.properties then
  895. getpushsize:=target_os.size_of_pointer
  896. else
  897. getpushsize:=definition^.size;
  898. end;
  899. end
  900. else
  901. getpushsize:=0;
  902. end;
  903. procedure Tparamsym.insert_in_data;
  904. var storefilepos:Tfileposinfo;
  905. begin
  906. storefilepos:=aktfilepos;
  907. if not(read_member) then
  908. pushaddress:=owner^.varsymtodata(@self,getpushsize);
  909. if (varspez=vs_var) then
  910. address:=0
  911. else if (varspez=vs_value) then
  912. if dp_pointer_param in definition^.properties then
  913. begin
  914. {Allocate local space.}
  915. address:=owner^.datasize;
  916. inc(owner^.datasize,getsize);
  917. end
  918. else
  919. address:=pushaddress
  920. else
  921. {vs_const}
  922. if dp_pointer_param in definition^.properties then
  923. address:=0
  924. else
  925. address:=pushaddress;
  926. aktfilepos:=storefilepos;
  927. end;
  928. {****************************************************************************
  929. Ttypedconstsym
  930. *****************************************************************************}
  931. constructor Ttypedconstsym.init(const n:string;p:Pdef;really_const:boolean);
  932. begin
  933. inherited init(n);
  934. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  935. definition:=p;
  936. is_really_const:=really_const;
  937. prefix:=stringdup(procprefix);
  938. end;
  939. constructor Ttypedconstsym.load(var s:Tstream);
  940. begin
  941. inherited load(s);
  942. (* definition:=readdefref;
  943. {$ifdef DELPHI_CONST_IN_RODATA}
  944. is_really_const:=boolean(readbyte);
  945. {$else DELPHI_CONST_IN_RODATA}
  946. is_really_const:=false;
  947. {$endif DELPHI_CONST_IN_RODATA}
  948. prefix:=stringdup(readstring);*)
  949. end;
  950. procedure Ttypedconstsym.deref;
  951. begin
  952. { resolvedef(definition);}
  953. end;
  954. function Ttypedconstsym.mangledname:string;
  955. begin
  956. mangledname:='TC_'+prefix^+'_'+name;
  957. end;
  958. function Ttypedconstsym.getsize:longint;
  959. begin
  960. if assigned(definition) then
  961. getsize:=definition^.size
  962. else
  963. getsize:=0;
  964. end;
  965. procedure Ttypedconstsym.store(var s:Tstream);
  966. begin
  967. inherited store(s);
  968. (* writedefref(definition);
  969. writestring(prefix^);
  970. {$ifdef DELPHI_CONST_IN_RODATA}
  971. writebyte(byte(is_really_const));
  972. {$endif DELPHI_CONST_IN_RODATA}
  973. current_ppu^.writeentry(ibtypedconstsym);*)
  974. end;
  975. { for most symbol types ther is nothing to do at all }
  976. procedure Ttypedconstsym.insert_in_data;
  977. var constsegment:Paasmoutput;
  978. l,ali,modulo:longint;
  979. storefilepos:Tfileposinfo;
  980. begin
  981. storefilepos:=aktfilepos;
  982. aktfilepos:=tokenpos;
  983. owner^.tconstsymtodata(@self,getsize);
  984. aktfilepos:=storefilepos;
  985. end;
  986. destructor Ttypedconstsym.done;
  987. begin
  988. stringdispose(prefix);
  989. inherited done;
  990. end;
  991. {****************************************************************************
  992. TCONSTSYM
  993. ****************************************************************************}
  994. constructor Tconstsym.init(const n : string;t : tconsttype;v : longint);
  995. begin
  996. inherited init(n);
  997. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  998. consttype:=t;
  999. value:=v;
  1000. end;
  1001. constructor Tconstsym.init_def(const n:string;t:Tconsttype;
  1002. v:longint;def:Pdef);
  1003. begin
  1004. inherited init(n);
  1005. consttype:=t;
  1006. value:=v;
  1007. definition:=def;
  1008. end;
  1009. constructor Tconstsym.init_string(const n:string;t:Tconsttype;str:Pchar;l:longint);
  1010. begin
  1011. inherited init(n);
  1012. consttype:=t;
  1013. value:=longint(str);
  1014. len:=l;
  1015. end;
  1016. constructor Tconstsym.load(var s:Tstream);
  1017. var pd:Pbestreal;
  1018. ps:Pnormalset;
  1019. begin
  1020. inherited load(s);
  1021. (* consttype:=tconsttype(readbyte);
  1022. case consttype of
  1023. constint,
  1024. constbool,
  1025. constchar : value:=readlong;
  1026. constord :
  1027. begin
  1028. definition:=readdefref;
  1029. value:=readlong;
  1030. end;
  1031. conststring :
  1032. begin
  1033. len:=readlong;
  1034. getmem(pchar(value),len+1);
  1035. current_ppu^.getdata(pchar(value)^,len);
  1036. end;
  1037. constreal :
  1038. begin
  1039. new(pd);
  1040. pd^:=readreal;
  1041. value:=longint(pd);
  1042. end;
  1043. constset :
  1044. begin
  1045. definition:=readdefref;
  1046. new(ps);
  1047. readnormalset(ps^);
  1048. value:=longint(ps);
  1049. end;
  1050. constnil : ;
  1051. else
  1052. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttype)));
  1053. end;*)
  1054. end;
  1055. procedure Tconstsym.deref;
  1056. begin
  1057. { if consttype in [constord,constset] then
  1058. resolvedef(pdef(definition));}
  1059. end;
  1060. procedure Tconstsym.store(var s:Tstream);
  1061. begin
  1062. (* inherited store(s);
  1063. writebyte(byte(consttype));
  1064. case consttype of
  1065. constnil : ;
  1066. constint,
  1067. constbool,
  1068. constchar :
  1069. writelong(value);
  1070. constord :
  1071. begin
  1072. writedefref(definition);
  1073. writelong(value);
  1074. end;
  1075. conststring :
  1076. begin
  1077. writelong(len);
  1078. current_ppu^.putdata(pchar(value)^,len);
  1079. end;
  1080. constreal :
  1081. writereal(pbestreal(value)^);
  1082. constset :
  1083. begin
  1084. writedefref(definition);
  1085. writenormalset(pointer(value)^);
  1086. end;
  1087. else
  1088. internalerror(13);
  1089. end;
  1090. current_ppu^.writeentry(ibconstsym);*)
  1091. end;
  1092. destructor Tconstsym.done;
  1093. begin
  1094. case consttype of
  1095. conststring:
  1096. freemem(Pchar(value),len+1);
  1097. constreal:
  1098. dispose(Pbestreal(value));
  1099. constset:
  1100. dispose(Pnormalset(value));
  1101. end;
  1102. inherited done;
  1103. end;
  1104. {****************************************************************************
  1105. Tabsolutesym
  1106. ****************************************************************************}
  1107. constructor Tabsolutesym.load(var s:Tstream);
  1108. begin
  1109. inherited load(s);
  1110. (* typ:=absolutesym;
  1111. abstyp:=absolutetyp(readbyte);
  1112. case abstyp of
  1113. tovar :
  1114. begin
  1115. asmname:=stringdup(readstring);
  1116. ref:=srsym;
  1117. end;
  1118. toasm :
  1119. asmname:=stringdup(readstring);
  1120. toaddr :
  1121. begin
  1122. address:=readlong;
  1123. absseg:=boolean(readbyte);
  1124. end;
  1125. end;*)
  1126. end;
  1127. procedure tabsolutesym.store(var s:Tstream);
  1128. begin
  1129. inherited store(s);
  1130. (* writebyte(byte(varspez));
  1131. if read_member then
  1132. writelong(address);
  1133. writedefref(definition);
  1134. writebyte(var_options and (not vo_regable));
  1135. writebyte(byte(abstyp));
  1136. case abstyp of
  1137. tovar :
  1138. writestring(ref^.name);
  1139. toasm :
  1140. writestring(asmname^);
  1141. toaddr :
  1142. begin
  1143. writelong(address);
  1144. writebyte(byte(absseg));
  1145. end;
  1146. end;
  1147. current_ppu^.writeentry(ibabsolutesym);*)
  1148. end;
  1149. procedure tabsolutesym.deref;
  1150. begin
  1151. (* resolvedef(definition);
  1152. if (abstyp=tovar) and (asmname<>nil) then
  1153. begin
  1154. { search previous loaded symtables }
  1155. getsym(asmname^,false);
  1156. if not(assigned(srsym)) then
  1157. getsymonlyin(owner,asmname^);
  1158. if not(assigned(srsym)) then
  1159. srsym:=generrorsym;
  1160. ref:=srsym;
  1161. stringdispose(asmname);
  1162. end;*)
  1163. end;
  1164. function Tabsolutesym.mangledname : string;
  1165. begin
  1166. case abstyp of
  1167. tovar :
  1168. mangledname:=ref^.mangledname;
  1169. toasm :
  1170. mangledname:=asmname^;
  1171. toaddr :
  1172. mangledname:='$'+tostr(address);
  1173. else
  1174. internalerror(10002);
  1175. end;
  1176. end;
  1177. {****************************************************************************
  1178. Tfuncretsym
  1179. ****************************************************************************}
  1180. constructor Tfuncretsym.init(const n:string;approcinfo:pointer{pprocinfo});
  1181. begin
  1182. inherited init(n);
  1183. {$IFDEF TP}setparent(typeof(Tsym));{$ENDIF}
  1184. funcretprocinfo:=approcinfo;
  1185. { funcretdef:=Pprocinfo(approcinfo)^.retdef;}
  1186. { address valid for ret in param only }
  1187. { otherwise set by insert }
  1188. { address:=pprocinfo(approcinfo)^.retoffset;}
  1189. end;
  1190. constructor Tfuncretsym.load(var s:Tstream);
  1191. begin
  1192. inherited load(s);
  1193. { funcretdef:=readdefref;
  1194. address:=readlong;
  1195. funcretprocinfo:=nil;
  1196. typ:=funcretsym;}
  1197. end;
  1198. procedure Tfuncretsym.store(var s:Tstream);
  1199. begin
  1200. (*
  1201. Normally all references are
  1202. transfered to the function symbol itself !! PM *)
  1203. inherited store(s);
  1204. { writedefref(funcretdef);
  1205. writelong(address);
  1206. current_ppu^.writeentry(ibfuncretsym);}
  1207. end;
  1208. procedure Tfuncretsym.deref;
  1209. begin
  1210. {resolvedef(funcretdef);}
  1211. end;
  1212. procedure Tfuncretsym.insert_in_data;
  1213. var l:longint;
  1214. begin
  1215. {Allocate space in local if ret in acc or in fpu.}
  1216. { if dp_ret_in_acc in procinfo.retdef^.properties
  1217. or (procinfo.retdef^.deftype=floatdef) then
  1218. begin
  1219. l:=funcretdef^.size;
  1220. adress:=owner^.varsymtodata('',l);
  1221. procinfo.retoffset:=-owner^.datasize;
  1222. end;}
  1223. end;
  1224. {****************************************************************************
  1225. Tpropertysym
  1226. ****************************************************************************}
  1227. constructor tpropertysym.load(var s:Tstream);
  1228. begin
  1229. inherited load(s);
  1230. (* proptype:=readdefref;
  1231. options:=readlong;
  1232. index:=readlong;
  1233. default:=readlong;
  1234. { it's hack ... }
  1235. readaccesssym:=psym(stringdup(readstring));
  1236. writeaccesssym:=psym(stringdup(readstring));
  1237. storedsym:=psym(stringdup(readstring));
  1238. { now the defs: }
  1239. readaccessdef:=readdefref;
  1240. writeaccessdef:=readdefref;
  1241. storeddef:=readdefref;*)
  1242. end;
  1243. procedure Tpropertysym.deref;
  1244. begin
  1245. (* resolvedef(proptype);
  1246. resolvedef(readaccessdef);
  1247. resolvedef(writeaccessdef);
  1248. resolvedef(storeddef);
  1249. { solve the hack we did in load: }
  1250. if pstring(readaccesssym)^<>'' then
  1251. begin
  1252. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(readaccesssym)^);
  1253. if not(assigned(srsym)) then
  1254. srsym:=generrorsym;
  1255. end
  1256. else
  1257. srsym:=nil;
  1258. stringdispose(pstring(readaccesssym));
  1259. readaccesssym:=srsym;
  1260. if pstring(writeaccesssym)^<>'' then
  1261. begin
  1262. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(writeaccesssym)^);
  1263. if not(assigned(srsym)) then
  1264. srsym:=generrorsym;
  1265. end
  1266. else
  1267. srsym:=nil;
  1268. stringdispose(pstring(writeaccesssym));
  1269. writeaccesssym:=srsym;
  1270. if pstring(storedsym)^<>'' then
  1271. begin
  1272. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(storedsym)^);
  1273. if not(assigned(srsym)) then
  1274. srsym:=generrorsym;
  1275. end
  1276. else
  1277. srsym:=nil;
  1278. stringdispose(pstring(storedsym));
  1279. storedsym:=srsym;*)
  1280. end;
  1281. function Tpropertysym.getsize:longint;
  1282. begin
  1283. getsize:=0;
  1284. end;
  1285. procedure Tpropertysym.store(var s:Tstream);
  1286. begin
  1287. Tsym.store(s);
  1288. (* writedefref(proptype);
  1289. writelong(options);
  1290. writelong(index);
  1291. writelong(default);
  1292. if assigned(readaccesssym) then
  1293. writestring(readaccesssym^.name)
  1294. else
  1295. writestring('');
  1296. if assigned(writeaccesssym) then
  1297. writestring(writeaccesssym^.name)
  1298. else
  1299. writestring('');
  1300. if assigned(storedsym) then
  1301. writestring(storedsym^.name)
  1302. else
  1303. writestring('');
  1304. writedefref(readaccessdef);
  1305. writedefref(writeaccessdef);
  1306. writedefref(storeddef);
  1307. current_ppu^.writeentry(ibpropertysym);*)
  1308. end;
  1309. end.
  1310. {
  1311. $Log$
  1312. Revision 1.1 2000-07-13 06:30:13 michael
  1313. + Initial import
  1314. Revision 1.6 2000/03/16 12:52:48 daniel
  1315. * Changed names of procedures flags
  1316. * Changed VMT generation
  1317. Revision 1.5 2000/03/11 21:11:25 daniel
  1318. * Ported hcgdata to new symtable.
  1319. * Alignment code changed as suggested by Peter
  1320. + Usage of my is operator replacement, is_object
  1321. Revision 1.4 2000/03/01 11:43:56 daniel
  1322. * Some more work on the new symtable.
  1323. + Symtable stack unit 'symstack' added.
  1324. }