pdecl.pas 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Does declaration (but not type) parsing for Free Pascal
  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 pdecl;
  19. {$define UseUnionSymtable}
  20. interface
  21. uses
  22. globtype,tokens,globals,symtable;
  23. procedure parameter_dec(aktprocdef:pabstractprocdef);
  24. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  25. { reads the declaration blocks }
  26. procedure read_declarations(islibrary : boolean);
  27. { reads declarations in the interface part of a unit }
  28. procedure read_interface_declarations;
  29. implementation
  30. uses
  31. cobjects,scanner,
  32. symconst,aasm,tree,pass_1,strings,
  33. files,types,verbose,systems,import,
  34. cpubase
  35. {$ifndef newcg}
  36. ,tccnv
  37. {$endif newcg}
  38. {$ifdef GDB}
  39. ,gdb
  40. {$endif GDB}
  41. { parser specific stuff }
  42. ,pbase,ptconst,pexpr,ptype,psub,pexports
  43. { processor specific stuff }
  44. { codegen }
  45. {$ifdef newcg}
  46. ,cgbase
  47. {$else}
  48. ,hcodegen
  49. {$endif}
  50. ,hcgdata
  51. ;
  52. function readconstant(const name:string;const filepos:tfileposinfo):pconstsym;
  53. var
  54. hp : pconstsym;
  55. p : ptree;
  56. ps : pconstset;
  57. pd : pbestreal;
  58. sp : pchar;
  59. storetokenpos : tfileposinfo;
  60. begin
  61. readconstant:=nil;
  62. if name='' then
  63. internalerror(9584582);
  64. hp:=nil;
  65. p:=comp_expr(true);
  66. do_firstpass(p);
  67. storetokenpos:=tokenpos;
  68. tokenpos:=filepos;
  69. case p^.treetype of
  70. ordconstn:
  71. begin
  72. if is_constintnode(p) then
  73. hp:=new(pconstsym,init_def(name,constint,p^.value,nil))
  74. else if is_constcharnode(p) then
  75. hp:=new(pconstsym,init_def(name,constchar,p^.value,nil))
  76. else if is_constboolnode(p) then
  77. hp:=new(pconstsym,init_def(name,constbool,p^.value,nil))
  78. else if p^.resulttype^.deftype=enumdef then
  79. hp:=new(pconstsym,init_def(name,constord,p^.value,p^.resulttype))
  80. else if p^.resulttype^.deftype=pointerdef then
  81. hp:=new(pconstsym,init_def(name,constord,p^.value,p^.resulttype))
  82. else internalerror(111);
  83. end;
  84. stringconstn:
  85. begin
  86. getmem(sp,p^.length+1);
  87. move(p^.value_str^,sp^,p^.length+1);
  88. hp:=new(pconstsym,init_string(name,conststring,sp,p^.length));
  89. end;
  90. realconstn :
  91. begin
  92. new(pd);
  93. pd^:=p^.value_real;
  94. hp:=new(pconstsym,init(name,constreal,longint(pd)));
  95. end;
  96. setconstn :
  97. begin
  98. new(ps);
  99. ps^:=p^.value_set^;
  100. hp:=new(pconstsym,init_def(name,constset,longint(ps),p^.resulttype));
  101. end;
  102. pointerconstn :
  103. begin
  104. hp:=new(pconstsym,init_def(name,constpointer,p^.value,p^.resulttype));
  105. end;
  106. niln :
  107. begin
  108. hp:=new(pconstsym,init_def(name,constnil,0,p^.resulttype));
  109. end;
  110. else
  111. Message(cg_e_illegal_expression);
  112. end;
  113. if assigned(hp) then
  114. symtablestack^.insert(hp);
  115. tokenpos:=storetokenpos;
  116. disposetree(p);
  117. readconstant:=hp;
  118. end;
  119. procedure parameter_dec(aktprocdef:pabstractprocdef);
  120. {
  121. handle_procvar needs the same changes
  122. }
  123. var
  124. is_procvar : boolean;
  125. sc : Pstringcontainer;
  126. s : string;
  127. hpos,
  128. storetokenpos : tfileposinfo;
  129. tt : ttype;
  130. hvs,
  131. vs : Pvarsym;
  132. hs1,hs2 : string;
  133. varspez : Tvarspez;
  134. inserthigh : boolean;
  135. pdefaultvalue : pconstsym;
  136. defaultrequired : boolean;
  137. begin
  138. { reset }
  139. defaultrequired:=false;
  140. { parsing a proc or procvar ? }
  141. is_procvar:=(aktprocdef^.deftype=procvardef);
  142. consume(_LKLAMMER);
  143. inc(testcurobject);
  144. repeat
  145. if try_to_consume(_VAR) then
  146. varspez:=vs_var
  147. else
  148. if try_to_consume(_CONST) then
  149. varspez:=vs_const
  150. else
  151. if try_to_consume(_OUT) then
  152. varspez:=vs_out
  153. else
  154. varspez:=vs_value;
  155. inserthigh:=false;
  156. pdefaultvalue:=nil;
  157. tt.reset;
  158. { self is only allowed in procvars and class methods }
  159. if (idtoken=_SELF) and
  160. (is_procvar or
  161. (assigned(procinfo^._class) and procinfo^._class^.is_class)) then
  162. begin
  163. if not is_procvar then
  164. begin
  165. {$ifndef UseNiceNames}
  166. hs2:=hs2+'$'+'self';
  167. {$else UseNiceNames}
  168. hs2:=hs2+tostr(length('self'))+'self';
  169. {$endif UseNiceNames}
  170. vs:=new(Pvarsym,initdef('@',procinfo^._class));
  171. vs^.varspez:=vs_var;
  172. { insert the sym in the parasymtable }
  173. pprocdef(aktprocdef)^.parast^.insert(vs);
  174. include(aktprocdef^.procoptions,po_containsself);
  175. inc(procinfo^.selfpointer_offset,vs^.address);
  176. end;
  177. consume(idtoken);
  178. consume(_COLON);
  179. single_type(tt,hs1,false);
  180. aktprocdef^.concatpara(tt,vs_value,nil);
  181. { check the types for procedures only }
  182. if not is_procvar then
  183. CheckTypes(tt.def,procinfo^._class);
  184. end
  185. else
  186. begin
  187. { read identifiers }
  188. sc:=idlist;
  189. {$ifdef fixLeaksOnError}
  190. strContStack.push(sc);
  191. {$endif fixLeaksOnError}
  192. { read type declaration, force reading for value and const paras }
  193. if (token=_COLON) or (varspez=vs_value) then
  194. begin
  195. consume(_COLON);
  196. { check for an open array }
  197. if token=_ARRAY then
  198. begin
  199. consume(_ARRAY);
  200. consume(_OF);
  201. { define range and type of range }
  202. tt.setdef(new(Parraydef,init(0,-1,s32bitdef)));
  203. { array of const ? }
  204. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  205. begin
  206. consume(_CONST);
  207. srsym:=nil;
  208. getsymonlyin(systemunit,'TVARREC');
  209. if not assigned(srsym) then
  210. InternalError(1234124);
  211. Parraydef(tt.def)^.elementtype:=ptypesym(srsym)^.restype;
  212. Parraydef(tt.def)^.IsArrayOfConst:=true;
  213. hs1:='array_of_const';
  214. end
  215. else
  216. begin
  217. { define field type }
  218. single_type(parraydef(tt.def)^.elementtype,hs1,false);
  219. hs1:='array_of_'+hs1;
  220. end;
  221. inserthigh:=true;
  222. end
  223. else
  224. begin
  225. { open string ? }
  226. if (varspez=vs_var) and
  227. (
  228. (
  229. ((token=_STRING) or (idtoken=_SHORTSTRING)) and
  230. (cs_openstring in aktmoduleswitches) and
  231. not(cs_ansistrings in aktlocalswitches)
  232. ) or
  233. (idtoken=_OPENSTRING)) then
  234. begin
  235. consume(token);
  236. tt.setdef(openshortstringdef);
  237. hs1:='openstring';
  238. inserthigh:=true;
  239. end
  240. else
  241. begin
  242. { everything else }
  243. single_type(tt,hs1,false);
  244. end;
  245. { default parameter }
  246. if (m_default_para in aktmodeswitches) then
  247. begin
  248. if try_to_consume(_EQUAL) then
  249. begin
  250. s:=sc^.get_with_tokeninfo(hpos);
  251. if not sc^.empty then
  252. Comment(V_Error,'default value only allowed for one parameter');
  253. sc^.insert_with_tokeninfo(s,hpos);
  254. s:=lower(aktprocsym^.name+'.'+s);
  255. pdefaultvalue:=ReadConstant(s,hpos);
  256. defaultrequired:=true;
  257. end
  258. else
  259. begin
  260. if defaultrequired then
  261. Comment(V_Error,'default parameter required');
  262. end;
  263. end;
  264. end;
  265. end
  266. else
  267. begin
  268. {$ifndef UseNiceNames}
  269. hs1:='$$$';
  270. {$else UseNiceNames}
  271. hs1:='var';
  272. {$endif UseNiceNames}
  273. tt.setdef(cformaldef);
  274. end;
  275. if not is_procvar then
  276. hs2:=pprocdef(aktprocdef)^.mangledname;
  277. storetokenpos:=tokenpos;
  278. while not sc^.empty do
  279. begin
  280. s:=sc^.get_with_tokeninfo(tokenpos);
  281. aktprocdef^.concatpara(tt,varspez,pdefaultvalue);
  282. { For proc vars we only need the definitions }
  283. if not is_procvar then
  284. begin
  285. {$ifndef UseNiceNames}
  286. hs2:=hs2+'$'+hs1;
  287. {$else UseNiceNames}
  288. hs2:=hs2+tostr(length(hs1))+hs1;
  289. {$endif UseNiceNames}
  290. vs:=new(pvarsym,init(s,tt));
  291. vs^.varspez:=varspez;
  292. { we have to add this to avoid var param to be in registers !!!}
  293. { I don't understand the comment above, }
  294. { but I suppose the comment is wrong and }
  295. { it means that the address of var parameters can be placed }
  296. { in a register (FK) }
  297. if (varspez in [vs_var,vs_const,vs_out]) and push_addr_param(tt.def) then
  298. include(vs^.varoptions,vo_regable);
  299. { insert the sym in the parasymtable }
  300. pprocdef(aktprocdef)^.parast^.insert(vs);
  301. { do we need a local copy? Then rename the varsym, do this after the
  302. insert so the dup id checking is done correctly }
  303. if (varspez=vs_value) and
  304. push_addr_param(tt.def) and
  305. not(is_open_array(tt.def) or is_array_of_const(tt.def)) then
  306. pprocdef(aktprocdef)^.parast^.rename(vs^.name,'val'+vs^.name);
  307. { also need to push a high value? }
  308. if inserthigh then
  309. begin
  310. hvs:=new(Pvarsym,initdef('high'+s,s32bitdef));
  311. hvs^.varspez:=vs_const;
  312. pprocdef(aktprocdef)^.parast^.insert(hvs);
  313. end;
  314. end;
  315. end;
  316. {$ifdef fixLeaksOnError}
  317. if PStringContainer(strContStack.pop) <> sc then
  318. writeln('problem with strContStack in pdecl (1)');
  319. {$endif fixLeaksOnError}
  320. dispose(sc,done);
  321. tokenpos:=storetokenpos;
  322. end;
  323. { set the new mangled name }
  324. if not is_procvar then
  325. pprocdef(aktprocdef)^.setmangledname(hs2);
  326. until not try_to_consume(_SEMICOLON);
  327. dec(testcurobject);
  328. consume(_RKLAMMER);
  329. end;
  330. const
  331. variantrecordlevel : longint = 0;
  332. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  333. { reads the filed of a record into a }
  334. { symtablestack, if record=false }
  335. { variants are forbidden, so this procedure }
  336. { can be used to read object fields }
  337. { if absolute is true, ABSOLUTE and file }
  338. { types are allowed }
  339. { => the procedure is also used to read }
  340. { a sequence of variable declaration }
  341. procedure insert_syms(st : psymtable;sc : pstringcontainer;tt : ttype;is_threadvar : boolean);
  342. { inserts the symbols of sc in st with def as definition or sym as ptypesym, sc is disposed }
  343. var
  344. s : string;
  345. filepos : tfileposinfo;
  346. ss : pvarsym;
  347. begin
  348. filepos:=tokenpos;
  349. while not sc^.empty do
  350. begin
  351. s:=sc^.get_with_tokeninfo(tokenpos);
  352. ss:=new(pvarsym,init(s,tt));
  353. if is_threadvar then
  354. include(ss^.varoptions,vo_is_thread_var);
  355. st^.insert(ss);
  356. { static data fields are inserted in the globalsymtable }
  357. if (st^.symtabletype=objectsymtable) and
  358. (sp_static in current_object_option) then
  359. begin
  360. s:=lower(st^.name^)+'_'+s;
  361. st^.defowner^.owner^.insert(new(pvarsym,init(s,tt)));
  362. end;
  363. end;
  364. {$ifdef fixLeaksOnError}
  365. if strContStack.pop <> sc then
  366. writeln('problem with strContStack in pdecl (2)');
  367. {$endif fixLeaksOnError}
  368. dispose(sc,done);
  369. tokenpos:=filepos;
  370. end;
  371. var
  372. sc : pstringcontainer;
  373. s : stringid;
  374. old_block_type : tblock_type;
  375. declarepos,storetokenpos : tfileposinfo;
  376. symdone : boolean;
  377. { to handle absolute }
  378. abssym : pabsolutesym;
  379. l : longint;
  380. code : integer;
  381. { c var }
  382. newtype : ptypesym;
  383. is_dll,
  384. is_gpc_name,is_cdecl,extern_aktvarsym,export_aktvarsym : boolean;
  385. old_current_object_option : tsymoptions;
  386. dll_name,
  387. C_name : string;
  388. tt,casetype : ttype;
  389. { Delphi initialized vars }
  390. pconstsym : ptypedconstsym;
  391. { maxsize contains the max. size of a variant }
  392. { startvarrec contains the start of the variant part of a record }
  393. maxsize,maxalignment,startvarrecalign,startvarrecsize : longint;
  394. pt : ptree;
  395. {$ifdef UseUnionSymtable}
  396. unionsymtable : psymtable;
  397. offset : longint;
  398. uniondef : precorddef;
  399. unionsym : pvarsym;
  400. uniontype : ttype;
  401. {$endif UseUnionSymtable}
  402. begin
  403. old_current_object_option:=current_object_option;
  404. { all variables are public if not in a object declaration }
  405. if not is_object then
  406. current_object_option:=[sp_public];
  407. old_block_type:=block_type;
  408. block_type:=bt_type;
  409. is_gpc_name:=false;
  410. { Force an expected ID error message }
  411. if not (token in [_ID,_CASE,_END]) then
  412. consume(_ID);
  413. { read vars }
  414. while (token=_ID) and
  415. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  416. begin
  417. C_name:=orgpattern;
  418. sc:=idlist;
  419. {$ifdef fixLeaksOnError}
  420. strContStack.push(sc);
  421. {$endif fixLeaksOnError}
  422. consume(_COLON);
  423. if (m_gpc in aktmodeswitches) and
  424. not(is_record or is_object or is_threadvar) and
  425. (token=_ID) and (orgpattern='__asmname__') then
  426. begin
  427. consume(_ID);
  428. C_name:=pattern;
  429. if token=_CCHAR then
  430. consume(_CCHAR)
  431. else
  432. consume(_CSTRING);
  433. Is_gpc_name:=true;
  434. end;
  435. { this is needed for Delphi mode at least
  436. but should be OK for all modes !! (PM) }
  437. ignore_equal:=true;
  438. read_type(tt,'');
  439. if (variantrecordlevel>0) and tt.def^.needs_inittable then
  440. Message(parser_e_cant_use_inittable_here);
  441. ignore_equal:=false;
  442. symdone:=false;
  443. if is_gpc_name then
  444. begin
  445. storetokenpos:=tokenpos;
  446. s:=sc^.get_with_tokeninfo(tokenpos);
  447. if not sc^.empty then
  448. Message(parser_e_absolute_only_one_var);
  449. {$ifdef fixLeaksOnError}
  450. if strContStack.pop <> sc then
  451. writeln('problem with strContStack in pdecl (3)');
  452. {$endif fixLeaksOnError}
  453. dispose(sc,done);
  454. aktvarsym:=new(pvarsym,init_C(s,target_os.Cprefix+C_name,tt));
  455. include(aktvarsym^.varoptions,vo_is_external);
  456. symtablestack^.insert(aktvarsym);
  457. tokenpos:=storetokenpos;
  458. symdone:=true;
  459. end;
  460. { check for absolute }
  461. if not symdone and
  462. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  463. begin
  464. consume(_ABSOLUTE);
  465. { only allowed for one var }
  466. s:=sc^.get_with_tokeninfo(declarepos);
  467. if not sc^.empty then
  468. Message(parser_e_absolute_only_one_var);
  469. {$ifdef fixLeaksOnError}
  470. if strContStack.pop <> sc then
  471. writeln('problem with strContStack in pdecl (4)');
  472. {$endif fixLeaksOnError}
  473. dispose(sc,done);
  474. { parse the rest }
  475. if token=_ID then
  476. begin
  477. getsym(pattern,true);
  478. consume(_ID);
  479. { support unit.variable }
  480. if srsym^.typ=unitsym then
  481. begin
  482. consume(_POINT);
  483. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  484. consume(_ID);
  485. end;
  486. { we should check the result type of srsym }
  487. if not (srsym^.typ in [varsym,typedconstsym,funcretsym]) then
  488. Message(parser_e_absolute_only_to_var_or_const);
  489. storetokenpos:=tokenpos;
  490. tokenpos:=declarepos;
  491. abssym:=new(pabsolutesym,init(s,tt));
  492. abssym^.abstyp:=tovar;
  493. abssym^.ref:=srsym;
  494. symtablestack^.insert(abssym);
  495. tokenpos:=storetokenpos;
  496. end
  497. else
  498. if (token=_CSTRING) or (token=_CCHAR) then
  499. begin
  500. storetokenpos:=tokenpos;
  501. tokenpos:=declarepos;
  502. abssym:=new(pabsolutesym,init(s,tt));
  503. s:=pattern;
  504. consume(token);
  505. abssym^.abstyp:=toasm;
  506. abssym^.asmname:=stringdup(s);
  507. symtablestack^.insert(abssym);
  508. tokenpos:=storetokenpos;
  509. end
  510. else
  511. { absolute address ?!? }
  512. if token=_INTCONST then
  513. begin
  514. if (target_info.target=target_i386_go32v2) then
  515. begin
  516. storetokenpos:=tokenpos;
  517. tokenpos:=declarepos;
  518. abssym:=new(pabsolutesym,init(s,tt));
  519. abssym^.abstyp:=toaddr;
  520. abssym^.absseg:=false;
  521. s:=pattern;
  522. consume(_INTCONST);
  523. val(s,abssym^.address,code);
  524. if token=_COLON then
  525. begin
  526. consume(token);
  527. s:=pattern;
  528. consume(_INTCONST);
  529. val(s,l,code);
  530. abssym^.address:=abssym^.address shl 4+l;
  531. abssym^.absseg:=true;
  532. end;
  533. symtablestack^.insert(abssym);
  534. tokenpos:=storetokenpos;
  535. end
  536. else
  537. Message(parser_e_absolute_only_to_var_or_const);
  538. end
  539. else
  540. Message(parser_e_absolute_only_to_var_or_const);
  541. symdone:=true;
  542. end;
  543. { Handling of Delphi typed const = initialized vars ! }
  544. { When should this be rejected ?
  545. - in parasymtable
  546. - in record or object
  547. - ... (PM) }
  548. if (m_delphi in aktmodeswitches) and (token=_EQUAL) and
  549. not (symtablestack^.symtabletype in [parasymtable]) and
  550. not is_record and not is_object then
  551. begin
  552. storetokenpos:=tokenpos;
  553. s:=sc^.get_with_tokeninfo(tokenpos);
  554. if not sc^.empty then
  555. Message(parser_e_initialized_only_one_var);
  556. pconstsym:=new(ptypedconstsym,inittype(s,tt,false));
  557. symtablestack^.insert(pconstsym);
  558. tokenpos:=storetokenpos;
  559. consume(_EQUAL);
  560. readtypedconst(tt.def,pconstsym,false);
  561. symdone:=true;
  562. end;
  563. { for a record there doesn't need to be a ; before the END or ) }
  564. if not((is_record or is_object) and (token in [_END,_RKLAMMER])) then
  565. consume(_SEMICOLON);
  566. { procvar handling }
  567. if (tt.def^.deftype=procvardef) and (tt.def^.typesym=nil) then
  568. begin
  569. newtype:=new(ptypesym,init('unnamed',tt));
  570. parse_var_proc_directives(psym(newtype));
  571. newtype^.restype.def:=nil;
  572. tt.def^.typesym:=nil;
  573. dispose(newtype,done);
  574. end;
  575. { Check for variable directives }
  576. if not symdone and (token=_ID) then
  577. begin
  578. { Check for C Variable declarations }
  579. if (m_cvar_support in aktmodeswitches) and
  580. not(is_record or is_object or is_threadvar) and
  581. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  582. begin
  583. { only allowed for one var }
  584. s:=sc^.get_with_tokeninfo(declarepos);
  585. if not sc^.empty then
  586. Message(parser_e_absolute_only_one_var);
  587. {$ifdef fixLeaksOnError}
  588. if strContStack.pop <> sc then
  589. writeln('problem with strContStack in pdecl (5)');
  590. {$endif fixLeaksOnError}
  591. dispose(sc,done);
  592. { defaults }
  593. is_dll:=false;
  594. is_cdecl:=false;
  595. extern_aktvarsym:=false;
  596. export_aktvarsym:=false;
  597. { cdecl }
  598. if idtoken=_CVAR then
  599. begin
  600. consume(_CVAR);
  601. consume(_SEMICOLON);
  602. is_cdecl:=true;
  603. C_name:=target_os.Cprefix+C_name;
  604. end;
  605. { external }
  606. if idtoken=_EXTERNAL then
  607. begin
  608. consume(_EXTERNAL);
  609. extern_aktvarsym:=true;
  610. end;
  611. { export }
  612. if idtoken in [_EXPORT,_PUBLIC] then
  613. begin
  614. consume(_ID);
  615. if extern_aktvarsym or
  616. (symtablestack^.symtabletype in [parasymtable,localsymtable]) then
  617. Message(parser_e_not_external_and_export)
  618. else
  619. export_aktvarsym:=true;
  620. end;
  621. { external and export need a name after when no cdecl is used }
  622. if not is_cdecl then
  623. begin
  624. { dll name ? }
  625. if (extern_aktvarsym) and (idtoken<>_NAME) then
  626. begin
  627. is_dll:=true;
  628. dll_name:=get_stringconst;
  629. end;
  630. consume(_NAME);
  631. C_name:=get_stringconst;
  632. end;
  633. { consume the ; when export or external is used }
  634. if extern_aktvarsym or export_aktvarsym then
  635. consume(_SEMICOLON);
  636. { insert in the symtable }
  637. storetokenpos:=tokenpos;
  638. tokenpos:=declarepos;
  639. if is_dll then
  640. aktvarsym:=new(pvarsym,init_dll(s,tt))
  641. else
  642. aktvarsym:=new(pvarsym,init_C(s,C_name,tt));
  643. { set some vars options }
  644. if export_aktvarsym then
  645. begin
  646. inc(aktvarsym^.refs);
  647. include(aktvarsym^.varoptions,vo_is_exported);
  648. end;
  649. if extern_aktvarsym then
  650. include(aktvarsym^.varoptions,vo_is_external);
  651. { insert in the stack/datasegment }
  652. symtablestack^.insert(aktvarsym);
  653. tokenpos:=storetokenpos;
  654. { now we can insert it in the import lib if its a dll, or
  655. add it to the externals }
  656. if extern_aktvarsym then
  657. begin
  658. if is_dll then
  659. begin
  660. if not(current_module^.uses_imports) then
  661. begin
  662. current_module^.uses_imports:=true;
  663. importlib^.preparelib(current_module^.modulename^);
  664. end;
  665. importlib^.importvariable(aktvarsym^.mangledname,dll_name,C_name)
  666. end
  667. end;
  668. symdone:=true;
  669. end
  670. else
  671. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  672. begin
  673. include(current_object_option,sp_static);
  674. insert_syms(symtablestack,sc,tt,false);
  675. exclude(current_object_option,sp_static);
  676. consume(_STATIC);
  677. consume(_SEMICOLON);
  678. symdone:=true;
  679. end;
  680. end;
  681. { insert it in the symtable, if not done yet }
  682. if not symdone then
  683. begin
  684. { save object option, because we can turn of the sp_published }
  685. if (sp_published in current_object_option) and
  686. (not((tt.def^.deftype=objectdef) and (pobjectdef(tt.def)^.is_class))) then
  687. begin
  688. Message(parser_e_cant_publish_that);
  689. exclude(current_object_option,sp_published);
  690. end
  691. else
  692. if (sp_published in current_object_option) and
  693. not(oo_can_have_published in pobjectdef(tt.def)^.objectoptions) then
  694. begin
  695. Message(parser_e_only_publishable_classes_can__be_published);
  696. exclude(current_object_option,sp_published);
  697. end;
  698. insert_syms(symtablestack,sc,tt,is_threadvar);
  699. current_object_option:=old_current_object_option;
  700. end;
  701. end;
  702. { Check for Case }
  703. if is_record and (token=_CASE) then
  704. begin
  705. maxsize:=0;
  706. maxalignment:=0;
  707. consume(_CASE);
  708. s:=pattern;
  709. getsym(s,false);
  710. { may be only a type: }
  711. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  712. read_type(casetype,'')
  713. else
  714. begin
  715. consume(_ID);
  716. consume(_COLON);
  717. read_type(casetype,'');
  718. symtablestack^.insert(new(pvarsym,init(s,casetype)));
  719. end;
  720. if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
  721. Message(type_e_ordinal_expr_expected);
  722. consume(_OF);
  723. {$ifdef UseUnionSymtable}
  724. UnionSymtable:=new(psymtable,init(recordsymtable));
  725. UnionSymtable^.next:=symtablestack;
  726. registerdef:=false;
  727. UnionDef:=new(precorddef,init(unionsymtable));
  728. registerdef:=true;
  729. symtablestack:=UnionSymtable;
  730. {$endif UseUnionSymtable}
  731. startvarrecsize:=symtablestack^.datasize;
  732. startvarrecalign:=symtablestack^.dataalignment;
  733. repeat
  734. repeat
  735. pt:=comp_expr(true);
  736. do_firstpass(pt);
  737. if not(pt^.treetype=ordconstn) then
  738. Message(cg_e_illegal_expression);
  739. disposetree(pt);
  740. if token=_COMMA then
  741. consume(_COMMA)
  742. else
  743. break;
  744. until false;
  745. consume(_COLON);
  746. { read the vars }
  747. consume(_LKLAMMER);
  748. inc(variantrecordlevel);
  749. if token<>_RKLAMMER then
  750. read_var_decs(true,false,false);
  751. dec(variantrecordlevel);
  752. consume(_RKLAMMER);
  753. { calculates maximal variant size }
  754. maxsize:=max(maxsize,symtablestack^.datasize);
  755. maxalignment:=max(maxalignment,symtablestack^.dataalignment);
  756. { the items of the next variant are overlayed }
  757. symtablestack^.datasize:=startvarrecsize;
  758. symtablestack^.dataalignment:=startvarrecalign;
  759. if (token<>_END) and (token<>_RKLAMMER) then
  760. consume(_SEMICOLON)
  761. else
  762. break;
  763. until (token=_END) or (token=_RKLAMMER);
  764. { at last set the record size to that of the biggest variant }
  765. symtablestack^.datasize:=maxsize;
  766. symtablestack^.dataalignment:=maxalignment;
  767. {$ifdef UseUnionSymtable}
  768. uniontype.def:=uniondef;
  769. uniontype.sym:=nil;
  770. UnionSym:=new(pvarsym,init('case',uniontype));
  771. symtablestack:=symtablestack^.next;
  772. { we do NOT call symtablestack^.insert
  773. on purpose PM }
  774. offset:=align_from_size(symtablestack^.datasize,maxalignment);
  775. symtablestack^.datasize:=offset+unionsymtable^.datasize;
  776. if maxalignment>symtablestack^.dataalignment then
  777. symtablestack^.dataalignment:=maxalignment;
  778. UnionSymtable^.Insert_in(symtablestack,offset);
  779. UnionSym^.owner:=nil;
  780. dispose(unionsym,done);
  781. dispose(uniondef,done);
  782. {$endif UseUnionSymtable}
  783. end;
  784. block_type:=old_block_type;
  785. current_object_option:=old_current_object_option;
  786. end;
  787. procedure const_dec;
  788. var
  789. name : stringid;
  790. tt : ttype;
  791. sym : psym;
  792. storetokenpos,filepos : tfileposinfo;
  793. old_block_type : tblock_type;
  794. skipequal : boolean;
  795. begin
  796. consume(_CONST);
  797. old_block_type:=block_type;
  798. block_type:=bt_const;
  799. repeat
  800. name:=pattern;
  801. filepos:=tokenpos;
  802. consume(_ID);
  803. case token of
  804. _EQUAL:
  805. begin
  806. consume(_EQUAL);
  807. readconstant(name,filepos);
  808. consume(_SEMICOLON);
  809. end;
  810. _COLON:
  811. begin
  812. { set the blocktype first so a consume also supports a
  813. caret, to support const s : ^string = nil }
  814. block_type:=bt_type;
  815. consume(_COLON);
  816. ignore_equal:=true;
  817. read_type(tt,'');
  818. ignore_equal:=false;
  819. block_type:=bt_const;
  820. skipequal:=false;
  821. { create symbol }
  822. storetokenpos:=tokenpos;
  823. tokenpos:=filepos;
  824. {$ifdef DELPHI_CONST_IN_RODATA}
  825. if m_delphi in aktmodeswitches then
  826. begin
  827. if assigned(readtypesym) then
  828. sym:=new(ptypedconstsym,initsym(name,readtypesym,true))
  829. else
  830. sym:=new(ptypedconstsym,init(name,def,true))
  831. end
  832. else
  833. {$endif DELPHI_CONST_IN_RODATA}
  834. begin
  835. sym:=new(ptypedconstsym,inittype(name,tt,false))
  836. end;
  837. tokenpos:=storetokenpos;
  838. symtablestack^.insert(sym);
  839. { procvar can have proc directives }
  840. if (tt.def^.deftype=procvardef) then
  841. begin
  842. { support p : procedure;stdcall=nil; }
  843. if (token=_SEMICOLON) then
  844. begin
  845. consume(_SEMICOLON);
  846. if is_proc_directive(token) then
  847. parse_var_proc_directives(sym)
  848. else
  849. begin
  850. Message(parser_e_proc_directive_expected);
  851. skipequal:=true;
  852. end;
  853. end
  854. else
  855. { support p : procedure stdcall=nil; }
  856. begin
  857. if is_proc_directive(token) then
  858. parse_var_proc_directives(sym);
  859. end;
  860. end;
  861. if not skipequal then
  862. begin
  863. { get init value }
  864. consume(_EQUAL);
  865. {$ifdef DELPHI_CONST_IN_RODATA}
  866. if m_delphi in aktmodeswitches then
  867. readtypedconst(tt.def,ptypedconstsym(sym),true)
  868. else
  869. {$endif DELPHI_CONST_IN_RODATA}
  870. readtypedconst(tt.def,ptypedconstsym(sym),false);
  871. consume(_SEMICOLON);
  872. end;
  873. end;
  874. else
  875. { generate an error }
  876. consume(_EQUAL);
  877. end;
  878. until token<>_ID;
  879. block_type:=old_block_type;
  880. end;
  881. procedure label_dec;
  882. var
  883. hl : pasmlabel;
  884. begin
  885. consume(_LABEL);
  886. if not(cs_support_goto in aktmoduleswitches) then
  887. Message(sym_e_goto_and_label_not_supported);
  888. repeat
  889. if not(token in [_ID,_INTCONST]) then
  890. consume(_ID)
  891. else
  892. begin
  893. if (cs_create_smart in aktmoduleswitches) then
  894. begin
  895. getdatalabel(hl);
  896. { we still want a warning if unused }
  897. hl^.refs:=0;
  898. end
  899. else
  900. getlabel(hl);
  901. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  902. consume(token);
  903. end;
  904. if token<>_SEMICOLON then consume(_COMMA);
  905. until not(token in [_ID,_INTCONST]);
  906. consume(_SEMICOLON);
  907. end;
  908. { search in symtablestack used, but not defined type }
  909. procedure resolve_type_forward(p : pnamedindexobject);{$ifndef FPC}far;{$endif}
  910. var
  911. hpd,pd : pdef;
  912. stpos : tfileposinfo;
  913. again : boolean;
  914. begin
  915. { Check only typesyms or record/object fields }
  916. case psym(p)^.typ of
  917. typesym :
  918. pd:=ptypesym(p)^.restype.def;
  919. varsym :
  920. if (psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  921. pd:=pvarsym(p)^.vartype.def
  922. else
  923. exit;
  924. else
  925. exit;
  926. end;
  927. repeat
  928. again:=false;
  929. case pd^.deftype of
  930. arraydef :
  931. begin
  932. { elementtype could also be defined using a forwarddef }
  933. pd:=parraydef(pd)^.elementtype.def;
  934. again:=true;
  935. end;
  936. pointerdef,
  937. classrefdef :
  938. begin
  939. { classrefdef inherits from pointerdef }
  940. hpd:=ppointerdef(pd)^.pointertype.def;
  941. { still a forward def ? }
  942. if hpd^.deftype=forwarddef then
  943. begin
  944. { try to resolve the forward }
  945. { get the correct position for it }
  946. stpos:=tokenpos;
  947. tokenpos:=pforwarddef(hpd)^.forwardpos;
  948. resolving_forward:=true;
  949. make_ref:=false;
  950. getsym(pforwarddef(hpd)^.tosymname,false);
  951. make_ref:=true;
  952. resolving_forward:=false;
  953. tokenpos:=stpos;
  954. { we don't need the forwarddef anymore, dispose it }
  955. dispose(hpd,done);
  956. { was a type sym found ? }
  957. if assigned(srsym) and
  958. (srsym^.typ=typesym) then
  959. begin
  960. ppointerdef(pd)^.pointertype.setsym(srsym);
  961. { avoid wrong unused warnings web bug 801 PM }
  962. inc(srsym^.refs);
  963. {$ifdef GDB}
  964. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  965. (psym(p)^.owner^.symtabletype in [globalsymtable,staticsymtable]) then
  966. begin
  967. ptypesym(p)^.isusedinstab := true;
  968. psym(p)^.concatstabto(debuglist);
  969. end;
  970. {$endif GDB}
  971. { we need a class type for classrefdef }
  972. if (pd^.deftype=classrefdef) and
  973. not((ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  974. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class) then
  975. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename);
  976. end
  977. else
  978. begin
  979. MessagePos1(psym(p)^.fileinfo,sym_e_forward_type_not_resolved,p^.name);
  980. { try to recover }
  981. ppointerdef(pd)^.pointertype.def:=generrordef;
  982. end;
  983. end;
  984. end;
  985. recorddef :
  986. precorddef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  987. objectdef :
  988. { Don't check objectdefs in objects/records, because these can't
  989. exist (anonymous objects aren't allowed) }
  990. if not(psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  991. pobjectdef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  992. end;
  993. until not again;
  994. end;
  995. { reads a type declaration to the symbol table }
  996. procedure type_dec;
  997. var
  998. typename : stringid;
  999. newtype : ptypesym;
  1000. sym : psym;
  1001. tt : ttype;
  1002. defpos,storetokenpos : tfileposinfo;
  1003. old_block_type : tblock_type;
  1004. begin
  1005. old_block_type:=block_type;
  1006. block_type:=bt_type;
  1007. consume(_TYPE);
  1008. typecanbeforward:=true;
  1009. repeat
  1010. typename:=pattern;
  1011. defpos:=tokenpos;
  1012. consume(_ID);
  1013. consume(_EQUAL);
  1014. { support 'ttype=type word' syntax }
  1015. if token=_TYPE then
  1016. Consume(_TYPE);
  1017. { is the type already defined? }
  1018. getsym(typename,false);
  1019. sym:=srsym;
  1020. newtype:=nil;
  1021. { found a symbol with this name? }
  1022. if assigned(sym) then
  1023. begin
  1024. if (sym^.typ=typesym) then
  1025. begin
  1026. if (token=_CLASS) and
  1027. (assigned(ptypesym(sym)^.restype.def)) and
  1028. (ptypesym(sym)^.restype.def^.deftype=objectdef) and
  1029. pobjectdef(ptypesym(sym)^.restype.def)^.is_class and
  1030. (oo_is_forward in pobjectdef(ptypesym(sym)^.restype.def)^.objectoptions) then
  1031. begin
  1032. { we can ignore the result }
  1033. { the definition is modified }
  1034. object_dec(typename,pobjectdef(ptypesym(sym)^.restype.def));
  1035. newtype:=ptypesym(sym);
  1036. end;
  1037. end;
  1038. end;
  1039. { no old type reused ? Then insert this new type }
  1040. if not assigned(newtype) then
  1041. begin
  1042. read_type(tt,typename);
  1043. storetokenpos:=tokenpos;
  1044. tokenpos:=defpos;
  1045. newtype:=new(ptypesym,init(typename,tt));
  1046. symtablestack^.insert(newtype);
  1047. tokenpos:=storetokenpos;
  1048. end;
  1049. if assigned(newtype^.restype.def) and
  1050. (newtype^.restype.def^.deftype=procvardef) then
  1051. begin
  1052. if not is_proc_directive(token) then
  1053. consume(_SEMICOLON);
  1054. parse_var_proc_directives(psym(newtype));
  1055. end
  1056. else
  1057. consume(_SEMICOLON);
  1058. until token<>_ID;
  1059. typecanbeforward:=false;
  1060. symtablestack^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  1061. block_type:=old_block_type;
  1062. end;
  1063. procedure var_dec;
  1064. { parses variable declarations and inserts them in }
  1065. { the top symbol table of symtablestack }
  1066. begin
  1067. consume(_VAR);
  1068. read_var_decs(false,false,false);
  1069. end;
  1070. procedure threadvar_dec;
  1071. { parses thread variable declarations and inserts them in }
  1072. { the top symbol table of symtablestack }
  1073. begin
  1074. consume(_THREADVAR);
  1075. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  1076. message(parser_e_threadvars_only_sg);
  1077. read_var_decs(false,false,true);
  1078. end;
  1079. procedure resourcestring_dec;
  1080. var
  1081. name : stringid;
  1082. p : ptree;
  1083. storetokenpos,filepos : tfileposinfo;
  1084. old_block_type : tblock_type;
  1085. sp : pchar;
  1086. begin
  1087. consume(_RESOURCESTRING);
  1088. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  1089. message(parser_e_resourcestring_only_sg);
  1090. old_block_type:=block_type;
  1091. block_type:=bt_const;
  1092. repeat
  1093. name:=pattern;
  1094. filepos:=tokenpos;
  1095. consume(_ID);
  1096. case token of
  1097. _EQUAL:
  1098. begin
  1099. consume(_EQUAL);
  1100. p:=comp_expr(true);
  1101. do_firstpass(p);
  1102. storetokenpos:=tokenpos;
  1103. tokenpos:=filepos;
  1104. case p^.treetype of
  1105. ordconstn:
  1106. begin
  1107. if is_constcharnode(p) then
  1108. begin
  1109. getmem(sp,2);
  1110. sp[0]:=chr(p^.value);
  1111. sp[1]:=#0;
  1112. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,1)));
  1113. end
  1114. else
  1115. Message(cg_e_illegal_expression);
  1116. end;
  1117. stringconstn:
  1118. begin
  1119. getmem(sp,p^.length+1);
  1120. move(p^.value_str^,sp^,p^.length+1);
  1121. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,p^.length)));
  1122. end;
  1123. else
  1124. Message(cg_e_illegal_expression);
  1125. end;
  1126. tokenpos:=storetokenpos;
  1127. consume(_SEMICOLON);
  1128. disposetree(p);
  1129. end;
  1130. else consume(_EQUAL);
  1131. end;
  1132. until token<>_ID;
  1133. block_type:=old_block_type;
  1134. end;
  1135. procedure Not_supported_for_inline(t : ttoken);
  1136. begin
  1137. if assigned(aktprocsym) and
  1138. (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  1139. Begin
  1140. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  1141. Message(parser_w_inlining_disabled);
  1142. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  1143. End;
  1144. end;
  1145. procedure read_declarations(islibrary : boolean);
  1146. begin
  1147. repeat
  1148. case token of
  1149. _LABEL:
  1150. begin
  1151. Not_supported_for_inline(token);
  1152. label_dec;
  1153. end;
  1154. _CONST:
  1155. begin
  1156. Not_supported_for_inline(token);
  1157. const_dec;
  1158. end;
  1159. _TYPE:
  1160. begin
  1161. Not_supported_for_inline(token);
  1162. type_dec;
  1163. end;
  1164. _VAR:
  1165. var_dec;
  1166. _THREADVAR:
  1167. threadvar_dec;
  1168. _CONSTRUCTOR,_DESTRUCTOR,
  1169. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  1170. begin
  1171. Not_supported_for_inline(token);
  1172. read_proc;
  1173. end;
  1174. _RESOURCESTRING:
  1175. resourcestring_dec;
  1176. _EXPORTS:
  1177. begin
  1178. Not_supported_for_inline(token);
  1179. { here we should be at lexlevel 1, no ? PM }
  1180. if (lexlevel<>main_program_level) or
  1181. (current_module^.is_unit) then
  1182. begin
  1183. Message(parser_e_syntax_error);
  1184. consume_all_until(_SEMICOLON);
  1185. end
  1186. else if islibrary or (target_info.target=target_i386_WIN32) then
  1187. read_exports;
  1188. end
  1189. else break;
  1190. end;
  1191. until false;
  1192. end;
  1193. procedure read_interface_declarations;
  1194. begin
  1195. {Since the body is now parsed at lexlevel 1, and the declarations
  1196. must be parsed at the same lexlevel we increase the lexlevel.}
  1197. inc(lexlevel);
  1198. repeat
  1199. case token of
  1200. _CONST : const_dec;
  1201. _TYPE : type_dec;
  1202. _VAR : var_dec;
  1203. _THREADVAR : threadvar_dec;
  1204. _RESOURCESTRING:
  1205. resourcestring_dec;
  1206. _FUNCTION,
  1207. _PROCEDURE,
  1208. _OPERATOR : read_proc;
  1209. else
  1210. break;
  1211. end;
  1212. until false;
  1213. dec(lexlevel);
  1214. end;
  1215. end.
  1216. {
  1217. $Log$
  1218. Revision 1.7 2000-08-13 08:42:59 peter
  1219. * support absolute refering to funcret (merged)
  1220. Revision 1.6 2000/08/02 19:49:59 peter
  1221. * first things for default parameters
  1222. Revision 1.5 2000/07/30 17:04:43 peter
  1223. * merged fixes
  1224. Revision 1.4 2000/07/14 05:11:49 michael
  1225. + Patch to 1.1
  1226. Revision 1.3 2000/07/13 12:08:26 michael
  1227. + patched to 1.1.0 with former 1.09patch from peter
  1228. Revision 1.2 2000/07/13 11:32:44 michael
  1229. + removed logs
  1230. }