pdecl.pas 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Does declaration 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. interface
  20. uses
  21. globals,symtable;
  22. var
  23. { pointer to the last read type symbol, (for "forward" }
  24. { types) }
  25. lasttypesym : ptypesym;
  26. { hack, which allows to use the current parsed }
  27. { object type as function argument type }
  28. testcurobject : byte;
  29. curobjectname : stringid;
  30. { reads a string type with optional length }
  31. { and returns a pointer to the string }
  32. { definition }
  33. function stringtype : pdef;
  34. { reads a string, file type or a type id and returns a name and }
  35. { pdef }
  36. function single_type(var s : string) : pdef;
  37. { reads the declaration blocks }
  38. procedure read_declarations(islibrary : boolean);
  39. { reads declarations in the interface part of a unit }
  40. procedure read_interface_declarations;
  41. implementation
  42. uses
  43. cobjects,scanner,aasm,tree,pass_1,
  44. files,types,hcodegen,verbose,systems
  45. {$ifdef GDB}
  46. ,gdb
  47. {$endif GDB}
  48. { parser specific stuff }
  49. ,pbase,ptconst,pexpr,psub,pexports
  50. { processor specific stuff }
  51. {$ifdef i386}
  52. ,i386
  53. {$endif}
  54. {$ifdef m68k}
  55. ,m68k
  56. {$endif}
  57. ;
  58. function read_type(const name : stringid) : pdef;forward;
  59. procedure const_dec;
  60. var
  61. name : stringid;
  62. p : ptree;
  63. def : pdef;
  64. sym : psym;
  65. ps : pconstset;
  66. pd : pdouble;
  67. begin
  68. consume(_CONST);
  69. repeat
  70. name:=pattern;
  71. consume(ID);
  72. case token of
  73. EQUAL:
  74. begin
  75. consume(EQUAL);
  76. p:=comp_expr(true);
  77. do_firstpass(p);
  78. case p^.treetype of
  79. ordconstn:
  80. begin
  81. if is_constintnode(p) then
  82. symtablestack^.insert(new(pconstsym,init(name,constint,p^.value,nil)))
  83. else if is_constcharnode(p) then
  84. symtablestack^.insert(new(pconstsym,init(name,constchar,p^.value,nil)))
  85. else if is_constboolnode(p) then
  86. symtablestack^.insert(new(pconstsym,init(name,constbool,p^.value,nil)))
  87. else if p^.resulttype^.deftype=enumdef then
  88. symtablestack^.insert(new(pconstsym,init(name,constord,p^.value,p^.resulttype)))
  89. else internalerror(111);
  90. end;
  91. stringconstn:
  92. {values is disposed with p so I need a copy !}
  93. symtablestack^.insert(new(pconstsym,init(name,conststring,longint(stringdup(p^.values^)),nil)));
  94. realconstn : begin
  95. new(pd);
  96. pd^:=p^.valued;
  97. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd),nil)));
  98. end;
  99. setconstrn : begin
  100. new(ps);
  101. ps^:=p^.constset^;
  102. symtablestack^.insert(new(pconstsym,init(name,
  103. constseta,longint(ps),p^.resulttype)));
  104. end;
  105. else Message(cg_e_illegal_expression);
  106. end;
  107. consume(SEMICOLON);
  108. end;
  109. COLON:
  110. begin
  111. { this was missed, so const s : ^string = nil gives an
  112. error (FK)
  113. }
  114. block_type:=bt_type;
  115. consume(COLON);
  116. ignore_equal:=true;
  117. def:=read_type('');
  118. block_type:=bt_general;
  119. ignore_equal:=false;
  120. sym:=new(ptypedconstsym,init(name,def));
  121. symtablestack^.insert(sym);
  122. consume(EQUAL);
  123. readtypedconst(def,ptypedconstsym(sym));
  124. consume(SEMICOLON);
  125. end;
  126. else consume(EQUAL);
  127. end;
  128. until token<>ID;
  129. end;
  130. procedure label_dec;
  131. var
  132. hl : plabel;
  133. begin
  134. consume(_LABEL);
  135. if not(cs_support_goto in aktswitches) then
  136. Message(sym_e_goto_and_label_not_supported);
  137. repeat
  138. if not(token in [ID,INTCONST]) then
  139. consume(ID)
  140. else
  141. begin
  142. getlabel(hl);
  143. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  144. consume(token);
  145. end;
  146. if token<>SEMICOLON then consume(COMMA);
  147. until not(token in [ID,INTCONST]);
  148. consume(SEMICOLON);
  149. end;
  150. procedure read_var_decs(is_record,is_object:boolean);
  151. { reads the filed of a record into a }
  152. { symtablestack, if record=false }
  153. { variants are forbidden, so this procedure }
  154. { can be used to read object fields }
  155. { if absolute is true, ABSOLUTE and file }
  156. { types are allowed }
  157. { => the procedure is also used to read }
  158. { a sequence of variable declaration }
  159. var
  160. sc : pstringcontainer;
  161. s : stringid;
  162. old_block_type : tblock_type;
  163. filepos : tfileposinfo;
  164. symdone : boolean;
  165. { to handle absolute }
  166. abssym : pabsolutesym;
  167. {$ifdef i386}
  168. l : longint;
  169. code : word;
  170. {$endif i386}
  171. { c var }
  172. Csym : pvarsym;
  173. is_cdecl,extern_Csym,export_Csym : boolean;
  174. C_name : string;
  175. { case }
  176. p,casedef : pdef;
  177. { maxsize contains the max. size of a variant }
  178. { startvarrec contains the start of the variant part of a record }
  179. maxsize,startvarrec : longint;
  180. pt : ptree;
  181. begin
  182. old_block_type:=block_type;
  183. block_type:=bt_type;
  184. { Force an expected ID error message }
  185. if not (token in [ID,_CASE,_END]) then
  186. consume(ID);
  187. { read vars }
  188. while (token=ID) and
  189. not(is_object and
  190. ((pattern='PUBLIC') or (pattern='PRIVATE') or
  191. (pattern='PUBLISHED') or (pattern='PROTECTED'))) do
  192. begin
  193. C_name:=orgpattern;
  194. sc:=idlist;
  195. consume(COLON);
  196. p:=read_type('');
  197. symdone:=false;
  198. { check for absolute }
  199. if (token=ID) and (pattern='ABSOLUTE') and not(is_record or is_object) then
  200. begin
  201. consume(ID);
  202. { only allowed for one var }
  203. s:=sc^.get_with_tokeninfo(filepos);
  204. if not sc^.empty then
  205. Message(parser_e_absolute_only_one_var);
  206. dispose(sc,done);
  207. { parse the rest }
  208. if token=ID then
  209. begin
  210. getsym(pattern,true);
  211. consume(ID);
  212. { we should check the result type of srsym }
  213. if not (srsym^.typ in [varsym,typedconstsym]) then
  214. Message(parser_e_absolute_only_to_var_or_const);
  215. abssym:=new(pabsolutesym,init(s,p));
  216. abssym^.typ:=absolutesym;
  217. abssym^.abstyp:=tovar;
  218. abssym^.ref:=srsym;
  219. {$ifdef NEWINPUT}
  220. abssym^.fileinfo:=filepos;
  221. {$else}
  222. abssym^.line_no:=filepos.line;
  223. {$endif}
  224. symtablestack^.insert(abssym);
  225. end
  226. else
  227. if token=CSTRING then
  228. begin
  229. abssym:=new(pabsolutesym,init(s,p));
  230. s:=pattern;
  231. consume(CSTRING);
  232. abssym^.typ:=absolutesym;
  233. abssym^.abstyp:=toasm;
  234. abssym^.asmname:=stringdup(s);
  235. {$ifdef NEWINPUT}
  236. abssym^.fileinfo:=filepos;
  237. {$else}
  238. abssym^.line_no:=filepos.line;
  239. {$endif}
  240. symtablestack^.insert(abssym);
  241. end
  242. else
  243. { absolute address ?!? }
  244. if token=INTCONST then
  245. begin
  246. {$ifdef i386}
  247. if (target_info.target=target_GO32V2) then
  248. begin
  249. abssym:=new(pabsolutesym,init(s,p));
  250. abssym^.typ:=absolutesym;
  251. abssym^.abstyp:=toaddr;
  252. abssym^.absseg:=false;
  253. {$ifdef NEWINPUT}
  254. abssym^.fileinfo:=filepos;
  255. {$else}
  256. abssym^.line_no:=filepos.line;
  257. {$endif}
  258. s:=pattern;
  259. consume(INTCONST);
  260. val(s,abssym^.address,code);
  261. if token=COLON then
  262. begin
  263. consume(token);
  264. s:=pattern;
  265. consume(INTCONST);
  266. val(s,l,code);
  267. abssym^.address:=abssym^.address shl 4+l;
  268. abssym^.absseg:=true;
  269. end;
  270. symtablestack^.insert(abssym);
  271. end
  272. else
  273. {$endif i386}
  274. Message(parser_e_absolute_only_to_var_or_const);
  275. end
  276. else
  277. Message(parser_e_absolute_only_to_var_or_const);
  278. symdone:=true;
  279. end;
  280. { for a record there doesn't need to be a ; before the END or ) }
  281. if not((is_record or is_object) and (token in [_END,RKLAMMER])) then
  282. consume(SEMICOLON);
  283. { Check for variable directives }
  284. if (token=ID) then
  285. begin
  286. { Check for C Variable declarations }
  287. if support_c_var and
  288. not(is_record or is_object) and
  289. ((pattern='EXPORT') or
  290. (pattern='EXTERNAL') or
  291. (pattern='CDECL')) then
  292. begin
  293. { only allowed for one var }
  294. s:=sc^.get_with_tokeninfo(filepos);
  295. if not sc^.empty then
  296. Message(parser_e_absolute_only_one_var);
  297. dispose(sc,done);
  298. { defaults }
  299. is_cdecl:=false;
  300. extern_csym:=false;
  301. export_Csym:=false;
  302. { cdecl }
  303. if pattern='CDECL' then
  304. begin
  305. consume(ID);
  306. consume(SEMICOLON);
  307. is_cdecl:=true;
  308. end;
  309. { external }
  310. if pattern='EXTERNAL' then
  311. begin
  312. consume(ID);
  313. extern_csym:=true;
  314. end;
  315. { export }
  316. if pattern='EXPORT' then
  317. begin
  318. consume(ID);
  319. if extern_csym then
  320. Comment(V_Error,'can''t use both EXPORT and EXTERNAL')
  321. else
  322. export_Csym:=true;
  323. end;
  324. { external and export need a name after when no cdecl is used }
  325. if not is_cdecl then
  326. begin
  327. if (token=ID) and (pattern='NAME') then
  328. consume(ID)
  329. else
  330. Comment(V_Error,'NAME keyword expected');
  331. C_name:=pattern;
  332. { allow also char }
  333. if token=CCHAR then
  334. consume(CCHAR)
  335. else
  336. consume(CSTRING);
  337. end;
  338. { consume the ; when export or external is used }
  339. if extern_csym or export_csym then
  340. consume(SEMICOLON);
  341. { insert in the symtable }
  342. Csym:=new(pvarsym,init_C(s,C_name,p));
  343. if extern_Csym then
  344. begin
  345. Csym^.var_options:=Csym^.var_options or vo_is_external;
  346. { correct type ?? }
  347. externals^.concat(new(pai_external,init(Csym^.mangledname,EXT_NEAR)));
  348. end;
  349. symtablestack^.insert(Csym);
  350. symdone:=true;
  351. end
  352. else
  353. if (is_object) and (cs_static_keyword in aktswitches) and (pattern='STATIC') then
  354. begin
  355. current_object_option:=current_object_option or sp_static;
  356. insert_syms(symtablestack,sc,p);
  357. current_object_option:=current_object_option - sp_static;
  358. consume(ID);
  359. consume(SEMICOLON);
  360. symdone:=true;
  361. end;
  362. end;
  363. { insert it in the symtable, if not done yet }
  364. if not symdone then
  365. insert_syms(symtablestack,sc,p);
  366. end;
  367. { Check for Case }
  368. if is_record and (token=_CASE) then
  369. begin
  370. maxsize:=0;
  371. consume(_CASE);
  372. s:=pattern;
  373. getsym(s,false);
  374. { may be only a type: }
  375. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  376. casedef:=read_type('')
  377. else
  378. begin
  379. consume(ID);
  380. consume(COLON);
  381. casedef:=read_type('');
  382. symtablestack^.insert(new(pvarsym,init(s,casedef)));
  383. end;
  384. if not is_ordinal(casedef) then
  385. Message(parser_e_ordinal_expected);
  386. consume(_OF);
  387. startvarrec:=symtablestack^.datasize;
  388. repeat
  389. repeat
  390. pt:=comp_expr(true);
  391. do_firstpass(pt);
  392. if not(pt^.treetype=ordconstn) then
  393. Message(cg_e_illegal_expression);
  394. disposetree(pt);
  395. if token=COMMA then
  396. consume(COMMA)
  397. else
  398. break;
  399. until false;
  400. consume(COLON);
  401. { read the vars }
  402. consume(LKLAMMER);
  403. if token<>RKLAMMER then
  404. read_var_decs(true,false);
  405. consume(RKLAMMER);
  406. { calculates maximal variant size }
  407. maxsize:=max(maxsize,symtablestack^.datasize);
  408. { the items of the next variant are overlayed }
  409. symtablestack^.datasize:=startvarrec;
  410. if token<>_END then
  411. consume(SEMICOLON);
  412. until token=_END;
  413. { at last set the record size to that of the biggest variant }
  414. symtablestack^.datasize:=maxsize;
  415. end;
  416. block_type:=old_block_type;
  417. end;
  418. function stringtype : pdef;
  419. { reads a string type with optional length }
  420. { and returns a pointer to the string }
  421. { definition }
  422. var
  423. p : ptree;
  424. d : pdef;
  425. begin
  426. consume(_STRING);
  427. if token=LECKKLAMMER then
  428. begin
  429. consume(LECKKLAMMER);
  430. p:=comp_expr(true);
  431. do_firstpass(p);
  432. if not is_constintnode(p) then
  433. Message(cg_e_illegal_expression);
  434. {$ifndef UseAnsiString}
  435. if (p^.value<1) or (p^.value>255) then
  436. begin
  437. Message(parser_e_string_too_long);
  438. p^.value:=255;
  439. end;
  440. consume(RECKKLAMMER);
  441. if p^.value<>255 then
  442. d:=new(pstringdef,init(p^.value))
  443. {$ifndef GDB}
  444. else d:=new(pstringdef,init(255));
  445. {$else GDB}
  446. else d:=globaldef('STRING');
  447. {$endif GDB}
  448. {$else UseAnsiString}
  449. if p^.value>255 then
  450. d:=new(pstringdef,ansiinit(p^.value))
  451. else if p^.value<>255 then
  452. d:=new(pstringdef,init(p^.value))
  453. {$ifndef GDB}
  454. else d:=new(pstringdef,init(255));
  455. {$else GDB}
  456. else d:=globaldef('STRING');
  457. {$endif GDB}
  458. consume(RECKKLAMMER);
  459. {$endif UseAnsiString}
  460. disposetree(p);
  461. end
  462. { should string without suffix be an ansistring also
  463. in ansistring mode ?? (PM) }
  464. {$ifndef GDB}
  465. else d:=new(pstringdef,init(255));
  466. {$else GDB}
  467. else d:=globaldef('STRING');
  468. {$endif GDB}
  469. stringtype:=d;
  470. end;
  471. function id_type(var s : string) : pdef;
  472. { reads a type definition and returns a pointer }
  473. { to a appropriating pdef, s gets the name of }
  474. { the type to allow name mangling }
  475. begin
  476. s:=pattern;
  477. consume(ID);
  478. { classes can be used also in classes }
  479. if (curobjectname=pattern) and aktobjectdef^.isclass then
  480. begin
  481. id_type:=aktobjectdef;
  482. exit;
  483. end;
  484. { objects can be parameters }
  485. if (testcurobject=2) and (curobjectname=pattern) then
  486. begin
  487. id_type:=aktobjectdef;
  488. exit;
  489. end;
  490. getsym(s,true);
  491. if assigned(srsym) then
  492. begin
  493. if srsym^.typ=unitsym then
  494. begin
  495. consume(POINT);
  496. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  497. s:=pattern;
  498. consume(ID);
  499. end;
  500. if srsym^.typ<>typesym then
  501. begin
  502. Message(sym_e_type_id_expected);
  503. lasttypesym:=ptypesym(srsym);
  504. id_type:=generrordef;
  505. exit;
  506. end;
  507. end;
  508. lasttypesym:=ptypesym(srsym);
  509. id_type:=ptypesym(srsym)^.definition;
  510. end;
  511. function single_type(var s : string) : pdef;
  512. { reads a string, file type or a type id and returns a name and }
  513. { pdef }
  514. var
  515. hs : string;
  516. begin
  517. case token of
  518. _STRING:
  519. begin
  520. single_type:=stringtype;
  521. s:='STRING';
  522. lasttypesym:=nil;
  523. end;
  524. _FILE:
  525. begin
  526. consume(_FILE);
  527. if token=_OF then
  528. begin
  529. consume(_OF);
  530. single_type:=new(pfiledef,init(ft_typed,single_type(hs)));
  531. s:='FILE$OF$'+hs;
  532. end
  533. else
  534. begin
  535. { single_type:=new(pfiledef,init(ft_untyped,nil));}
  536. single_type:=cfiledef;
  537. s:='FILE';
  538. end;
  539. lasttypesym:=nil;
  540. end;
  541. else single_type:=id_type(s);
  542. end;
  543. end;
  544. function object_dec(const n : stringid;fd : pobjectdef) : pdef;
  545. { this function parses an object or class declaration }
  546. var
  547. actmembertype : symprop;
  548. there_is_a_destructor : boolean;
  549. is_a_class : boolean;
  550. childof : pobjectdef;
  551. aktclass : pobjectdef;
  552. procedure constructor_head;
  553. begin
  554. consume(_CONSTRUCTOR);
  555. { must be at same level as in implementation }
  556. _proc_head(poconstructor);
  557. if (cs_checkconsname in aktswitches) and (aktprocsym^.name<>'INIT') then
  558. Message(parser_e_constructorname_must_be_init);
  559. consume(SEMICOLON);
  560. begin
  561. if (aktclass^.options and oois_class)<>0 then
  562. begin
  563. { CLASS constructors return the created instance }
  564. aktprocsym^.definition^.retdef:=aktclass;
  565. end
  566. else
  567. begin
  568. { OBJECT constructors return a boolean }
  569. {$IfDef GDB}
  570. {GDB doesn't like unnamed types !}
  571. aktprocsym^.definition^.retdef:=
  572. globaldef('boolean');
  573. {$Else GDB}
  574. aktprocsym^.definition^.retdef:=
  575. new(porddef,init(bool8bit,0,1));
  576. {$Endif GDB}
  577. end;
  578. end;
  579. end;
  580. procedure property_dec;
  581. var
  582. sym : psym;
  583. propertyparas : pdefcoll;
  584. { returns the matching procedure to access a property }
  585. function get_procdef : pprocdef;
  586. var
  587. p : pprocdef;
  588. begin
  589. p:=pprocsym(sym)^.definition;
  590. get_procdef:=nil;
  591. while assigned(p) do
  592. begin
  593. if equal_paras(p^.para1,propertyparas,true) then
  594. break;
  595. p:=p^.nextoverloaded;
  596. end;
  597. get_procdef:=p;
  598. end;
  599. var
  600. hp2,datacoll : pdefcoll;
  601. p,p2 : ppropertysym;
  602. overriden : psym;
  603. hs : string;
  604. code : word;
  605. varspez : tvarspez;
  606. sc : pstringcontainer;
  607. hp : pdef;
  608. s : string;
  609. filepos : tfileposinfo;
  610. pp : pprocdef;
  611. begin
  612. { check for a class }
  613. if (aktclass^.options and oois_class=0) then
  614. Message(parser_e_syntax_error);
  615. consume(_PROPERTY);
  616. if token=ID then
  617. begin
  618. p:=new(ppropertysym,init(pattern));
  619. consume(ID);
  620. propertyparas:=nil;
  621. datacoll:=nil;
  622. { property parameters ? }
  623. if token=LECKKLAMMER then
  624. begin
  625. { create a list of the parameters in propertyparas }
  626. consume(LECKKLAMMER);
  627. inc(testcurobject);
  628. repeat
  629. if token=_VAR then
  630. begin
  631. consume(_VAR);
  632. varspez:=vs_var;
  633. end
  634. else if token=_CONST then
  635. begin
  636. consume(_CONST);
  637. varspez:=vs_const;
  638. end
  639. else varspez:=vs_value;
  640. sc:=idlist;
  641. if token=COLON then
  642. begin
  643. consume(COLON);
  644. if token=_ARRAY then
  645. begin
  646. {
  647. if (varspez<>vs_const) and
  648. (varspez<>vs_var) then
  649. begin
  650. varspez:=vs_const;
  651. Message(parser_e_illegal_open_parameter);
  652. end;
  653. }
  654. consume(_ARRAY);
  655. consume(_OF);
  656. { define range and type of range }
  657. hp:=new(parraydef,init(0,-1,s32bitdef));
  658. { define field type }
  659. parraydef(hp)^.definition:=single_type(s);
  660. end
  661. else
  662. hp:=single_type(s);
  663. end
  664. else
  665. hp:=new(pformaldef,init);
  666. s:=sc^.get_with_tokeninfo(filepos);
  667. while s<>'' do
  668. begin
  669. new(hp2);
  670. hp2^.paratyp:=varspez;
  671. hp2^.data:=hp;
  672. hp2^.next:=propertyparas;
  673. propertyparas:=hp2;
  674. s:=sc^.get_with_tokeninfo(filepos);
  675. end;
  676. dispose(sc,done);
  677. if token=SEMICOLON then consume(SEMICOLON)
  678. else break;
  679. until false;
  680. dec(testcurobject);
  681. consume(RECKKLAMMER);
  682. end;
  683. { overriden property ? }
  684. { force property interface, if there is a property parameter }
  685. if (token=COLON) or assigned(propertyparas) then
  686. begin
  687. consume(COLON);
  688. p^.proptype:=single_type(hs);
  689. if (token=ID) and (pattern='INDEX') then
  690. begin
  691. consume(ID);
  692. p^.options:=p^.options or ppo_indexed;
  693. if token=INTCONST then
  694. val(pattern,p^.index,code);
  695. consume(INTCONST);
  696. { concat a longint to the para template }
  697. new(hp2);
  698. hp2^.paratyp:=vs_value;
  699. hp2^.data:=s32bitdef;
  700. hp2^.next:=propertyparas;
  701. propertyparas:=hp2;
  702. end;
  703. end
  704. else
  705. begin
  706. { do an property override }
  707. overriden:=search_class_member(aktclass,pattern);
  708. if assigned(overriden) and (overriden^.typ=propertysym) then
  709. begin
  710. { take the whole info: }
  711. p^.options:=ppropertysym(overriden)^.options;
  712. p^.index:=ppropertysym(overriden)^.index;
  713. p^.proptype:=ppropertysym(overriden)^.proptype;
  714. p^.writeaccesssym:=ppropertysym(overriden)^.writeaccesssym;
  715. p^.readaccesssym:=ppropertysym(overriden)^.readaccesssym;
  716. p^.writeaccessdef:=ppropertysym(overriden)^.writeaccessdef;
  717. p^.readaccessdef:=ppropertysym(overriden)^.readaccessdef;
  718. end
  719. else
  720. begin
  721. p^.proptype:=generrordef;
  722. message(parser_e_no_property_found_to_override);
  723. end;
  724. end;
  725. { create data defcoll to allow correct parameter checks }
  726. new(datacoll);
  727. datacoll^.paratyp:=vs_value;
  728. datacoll^.data:=p^.proptype;
  729. datacoll^.next:=nil;
  730. if (token=ID) and (pattern='READ') then
  731. begin
  732. consume(ID);
  733. sym:=search_class_member(aktclass,pattern);
  734. if not(assigned(sym)) then
  735. Message1(sym_e_unknown_id,pattern)
  736. else
  737. begin
  738. { varsym aren't allowed for an indexed property
  739. or an property with parameters }
  740. if ((sym^.typ=varsym) and
  741. { not necessary, an index forces propertyparas
  742. to be assigned
  743. }
  744. { (((p^.options and ppo_indexed)<>0) or }
  745. assigned(propertyparas)) or
  746. not(sym^.typ in [varsym,procsym]) then
  747. Message(parser_e_ill_property_access_sym);
  748. { search the matching definition }
  749. if sym^.typ=procsym then
  750. begin
  751. pp:=get_procdef;
  752. if not(assigned(pp)) or
  753. not(is_equal(pp^.retdef,p^.proptype)) then
  754. Message(parser_e_ill_property_access_sym);
  755. p^.readaccessdef:=pp;
  756. end
  757. else if sym^.typ=varsym then
  758. begin
  759. if not(is_equal(pvarsym(sym)^.definition,
  760. p^.proptype)) then
  761. Message(parser_e_ill_property_access_sym);
  762. end;
  763. p^.readaccesssym:=sym;
  764. end;
  765. consume(ID);
  766. end;
  767. if (token=ID) and (pattern='WRITE') then
  768. begin
  769. consume(ID);
  770. sym:=search_class_member(aktclass,pattern);
  771. if not(assigned(sym)) then
  772. Message1(sym_e_unknown_id,pattern)
  773. else
  774. begin
  775. if ((sym^.typ=varsym) and
  776. assigned(propertyparas)) or
  777. not(sym^.typ in [varsym,procsym]) then
  778. Message(parser_e_ill_property_access_sym);
  779. { search the matching definition }
  780. if sym^.typ=procsym then
  781. begin
  782. { insert data entry to check access method }
  783. datacoll^.next:=propertyparas;
  784. propertyparas:=datacoll;
  785. pp:=get_procdef;
  786. { ... and remove it }
  787. propertyparas:=propertyparas^.next;
  788. if not(assigned(pp)) then
  789. Message(parser_e_ill_property_access_sym);
  790. p^.writeaccessdef:=pp;
  791. end
  792. else if sym^.typ=varsym then
  793. begin
  794. if not(is_equal(pvarsym(sym)^.definition,
  795. p^.proptype)) then
  796. Message(parser_e_ill_property_access_sym);
  797. end;
  798. p^.writeaccesssym:=sym;
  799. end;
  800. consume(ID);
  801. end;
  802. if (token=ID) and (pattern='STORED') then
  803. begin
  804. consume(ID);
  805. { !!!!!!!! }
  806. end;
  807. if (token=ID) and (pattern='DEFAULT') then
  808. begin
  809. consume(ID);
  810. { !!!!!!! storage }
  811. consume(SEMICOLON);
  812. end
  813. else if (token=ID) and (pattern='NODEFAULT') then
  814. begin
  815. consume(ID);
  816. { !!!!!!!! }
  817. end;
  818. symtablestack^.insert(p);
  819. { default property ? }
  820. consume(SEMICOLON);
  821. if (token=ID) and (pattern='DEFAULT') then
  822. begin
  823. consume(ID);
  824. p2:=search_default_property(aktclass);
  825. if assigned(p2) then
  826. message1(parser_e_only_one_default_property,
  827. pobjectdef(p2^.owner^.defowner)^.name^)
  828. else
  829. begin
  830. p^.options:=p^.options or ppo_defaultproperty;
  831. if not(assigned(propertyparas)) then
  832. message(parser_e_property_need_paras);
  833. end;
  834. consume(SEMICOLON);
  835. end;
  836. { clean up }
  837. if assigned(datacoll) then
  838. dispose(datacoll);
  839. end
  840. else
  841. begin
  842. consume(ID);
  843. consume(SEMICOLON);
  844. end;
  845. end;
  846. procedure destructor_head;
  847. begin
  848. consume(_DESTRUCTOR);
  849. _proc_head(podestructor);
  850. if (cs_checkconsname in aktswitches) and (aktprocsym^.name<>'DONE') then
  851. Message(parser_e_destructorname_must_be_done);
  852. consume(SEMICOLON);
  853. if assigned(aktprocsym^.definition^.para1) then
  854. Message(parser_e_no_paras_for_destructor);
  855. { no return value }
  856. aktprocsym^.definition^.retdef:=voiddef;
  857. end;
  858. var
  859. hs : string;
  860. pcrd : pclassrefdef;
  861. hp1 : pdef;
  862. oldprocsym : Pprocsym;
  863. oldparse_only : boolean;
  864. begin
  865. {Nowadays aktprocsym may already have a value, so we need to save
  866. it.}
  867. oldprocsym:=aktprocsym;
  868. { forward is resolved }
  869. if assigned(fd) then
  870. fd^.options:=fd^.options and not(oo_isforward);
  871. there_is_a_destructor:=false;
  872. actmembertype:=sp_public;
  873. { objects and class types can't be declared local }
  874. if (symtablestack^.symtabletype<>globalsymtable) and
  875. (symtablestack^.symtabletype<>staticsymtable) then
  876. Message(parser_e_no_local_objects);
  877. { distinguish classes and objects }
  878. if token=_OBJECT then
  879. begin
  880. is_a_class:=false;
  881. consume(_OBJECT)
  882. end
  883. else
  884. begin
  885. is_a_class:=true;
  886. consume(_CLASS);
  887. if not(assigned(fd)) and (token=_OF) then
  888. begin
  889. { a hack, but it's easy to handle }
  890. { class reference type }
  891. consume(_OF);
  892. if typecanbeforward then
  893. forwardsallowed:=true;
  894. hp1:=single_type(hs);
  895. { accept hp1, if is a forward def ...}
  896. if ((lasttypesym<>nil)
  897. and ((lasttypesym^.properties and sp_forwarddef)<>0)) or
  898. { or a class
  899. (if the foward defined type is a class is checked, when
  900. the forward is resolved)
  901. }
  902. ((hp1^.deftype=objectdef) and (
  903. (pobjectdef(hp1)^.options and oois_class)<>0)) then
  904. begin
  905. pcrd:=new(pclassrefdef,init(hp1));
  906. object_dec:=pcrd;
  907. {I add big troubles here
  908. with var p : ^byte in graph.putimage
  909. because a save_forward was called and
  910. no resolve forward
  911. => so the definition was rewritten after
  912. having been disposed !!
  913. Strange problems appeared !!!!}
  914. {Anyhow forwards should only be allowed
  915. inside a type statement ??
  916. don't you think so }
  917. if (lasttypesym<>nil)
  918. and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  919. lasttypesym^.forwardpointer:=ppointerdef(pcrd);
  920. forwardsallowed:=false;
  921. end
  922. else
  923. begin
  924. Message(parser_e_class_type_expected);
  925. object_dec:=new(perrordef,init);
  926. end;
  927. exit;
  928. end
  929. { forward class }
  930. else if not(assigned(fd)) and (token=SEMICOLON) then
  931. begin
  932. { also anonym objects aren't allow (o : object a : longint; end;) }
  933. if n='' then
  934. Message(parser_e_no_anonym_objects);
  935. if n='TOBJECT' then
  936. begin
  937. aktclass:=new(pobjectdef,init(n,nil));
  938. class_tobject:=aktclass;
  939. end
  940. else
  941. aktclass:=new(pobjectdef,init(n,class_tobject));
  942. aktclass^.options:=aktclass^.options or oois_class or oo_isforward;
  943. object_dec:=aktclass;
  944. exit;
  945. end;
  946. end;
  947. { also anonym objects aren't allow (o : object a : longint; end;) }
  948. if n='' then
  949. Message(parser_e_no_anonym_objects);
  950. { read the parent class }
  951. if token=LKLAMMER then
  952. begin
  953. consume(LKLAMMER);
  954. { does not allow objects.tobject !! }
  955. {if token<>ID then
  956. consume(ID);
  957. getsym(pattern,true);}
  958. childof:=pobjectdef(id_type(pattern));
  959. if (childof^.deftype<>objectdef) then
  960. begin
  961. Message(parser_e_class_type_expected);
  962. childof:=nil;
  963. end;
  964. { a mix of class and object isn't allowed }
  965. if (((childof^.options and oois_class)<>0) and not is_a_class) or
  966. (((childof^.options and oois_class)=0) and is_a_class) then
  967. Message(parser_e_mix_of_classes_and_objects);
  968. if assigned(fd) then
  969. begin
  970. { the forward of the child must be resolved to get
  971. correct field addresses
  972. }
  973. if (childof^.options and oo_isforward)<>0 then
  974. Message1(parser_forward_declaration_must_be_resolved,childof^.name^);
  975. fd^.childof:=childof;
  976. aktclass:=fd;
  977. { ajust the size, because the child could be also
  978. forward defined
  979. }
  980. aktclass^.publicsyms^.datasize:=
  981. aktclass^.publicsyms^.datasize-4+childof^.publicsyms^.datasize;
  982. end
  983. else
  984. aktclass:=new(pobjectdef,init(n,childof));
  985. consume(RKLAMMER);
  986. end
  987. { if no parent class, then a class get tobject as parent }
  988. else if is_a_class then
  989. begin
  990. { is the current class tobject? }
  991. { so you could define your own tobject }
  992. if n='TOBJECT' then
  993. begin
  994. if assigned(fd) then
  995. aktclass:=fd
  996. else
  997. aktclass:=new(pobjectdef,init(n,nil));
  998. class_tobject:=aktclass;
  999. end
  1000. else
  1001. begin
  1002. childof:=class_tobject;
  1003. if assigned(fd) then
  1004. begin
  1005. { the forward of the child must be resolved to get
  1006. correct field addresses
  1007. }
  1008. if (childof^.options and oo_isforward)<>0 then
  1009. Message1(parser_forward_declaration_must_be_resolved,childof^.name^);
  1010. aktclass:=fd;
  1011. aktclass^.childof:=childof;
  1012. { ajust the size, because the child could be also
  1013. forward defined
  1014. }
  1015. aktclass^.publicsyms^.datasize:=
  1016. aktclass^.publicsyms^.datasize-4+childof^.publicsyms^.datasize;
  1017. end
  1018. else
  1019. aktclass:=new(pobjectdef,init(n,childof));
  1020. end;
  1021. end
  1022. else aktclass:=new(pobjectdef,init(n,nil));
  1023. { set the class attribute }
  1024. if is_a_class then
  1025. begin
  1026. aktclass^.options:=aktclass^.options or oois_class;
  1027. if (cs_generate_rtti in aktswitches) or
  1028. (assigned(aktclass^.childof) and
  1029. ((aktclass^.childof^.options and oo_can_have_published)<>0)
  1030. ) then
  1031. aktclass^.options:=aktclass^.options or oo_can_have_published;
  1032. end;
  1033. aktobjectdef:=aktclass;
  1034. { default access is public }
  1035. actmembertype:=sp_public;
  1036. aktclass^.publicsyms^.next:=symtablestack;
  1037. symtablestack:=aktclass^.publicsyms;
  1038. procinfo._class:=aktclass;
  1039. testcurobject:=1;
  1040. curobjectname:=n;
  1041. { short class declaration ? }
  1042. if (not is_a_class) or (token<>SEMICOLON) then
  1043. begin
  1044. { Parse componenten }
  1045. repeat
  1046. if actmembertype=sp_private then
  1047. aktclass^.options:=aktclass^.options or oo_hasprivate;
  1048. if actmembertype=sp_protected then
  1049. aktclass^.options:=aktclass^.options or oo_hasprotected;
  1050. case token of
  1051. ID : begin
  1052. if (pattern='PRIVATE') then
  1053. begin
  1054. consume(ID);
  1055. actmembertype:=sp_private;
  1056. current_object_option:=sp_private;
  1057. end
  1058. else
  1059. if (pattern='PROTECTED') then
  1060. begin
  1061. consume(ID);
  1062. current_object_option:=sp_protected;
  1063. actmembertype:=sp_protected;
  1064. end
  1065. else
  1066. if (pattern='PUBLIC') then
  1067. begin
  1068. consume(ID);
  1069. current_object_option:=sp_public;
  1070. actmembertype:=sp_public;
  1071. end
  1072. else
  1073. if (pattern='PUBLISHED') then
  1074. begin
  1075. if (aktclass^.options and oo_can_have_published)=0 then
  1076. Message(parser_e_cant_have_published);
  1077. consume(ID);
  1078. current_object_option:=sp_published;
  1079. actmembertype:=sp_published;
  1080. end
  1081. else
  1082. read_var_decs(false,true);
  1083. end;
  1084. _PROPERTY : property_dec;
  1085. _PROCEDURE,
  1086. _FUNCTION,
  1087. _CLASS : begin
  1088. oldparse_only:=parse_only;
  1089. parse_only:=true;
  1090. proc_head;
  1091. parse_only:=oldparse_only;
  1092. if (token=ID) then
  1093. begin
  1094. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1095. begin
  1096. if actmembertype=sp_private then
  1097. Message(parser_w_priv_meth_not_virtual);
  1098. consume(ID);
  1099. consume(SEMICOLON);
  1100. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1101. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1102. end
  1103. else
  1104. if (pattern='OVERRIDE') then
  1105. begin
  1106. consume(ID);
  1107. consume(SEMICOLON);
  1108. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1109. pooverridingmethod or povirtualmethod;
  1110. end;
  1111. { Delphi II extension }
  1112. if (pattern='ABSTRACT') then
  1113. begin
  1114. consume(ID);
  1115. consume(SEMICOLON);
  1116. if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
  1117. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
  1118. else
  1119. Message(parser_e_only_virtual_methods_abstract);
  1120. { the method is defined }
  1121. aktprocsym^.definition^.forwarddef:=false;
  1122. end;
  1123. if (cs_static_keyword in aktswitches) and (pattern='STATIC') then
  1124. begin
  1125. consume(ID);
  1126. consume(SEMICOLON);
  1127. aktprocsym^.properties:=aktprocsym^.properties or sp_static;
  1128. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or postaticmethod;
  1129. end;
  1130. end;
  1131. end;
  1132. _CONSTRUCTOR : begin
  1133. if actmembertype<>sp_public then
  1134. Message(parser_w_constructor_should_be_public);
  1135. oldparse_only:=parse_only;
  1136. parse_only:=true;
  1137. constructor_head;
  1138. parse_only:=oldparse_only;
  1139. if (token=ID) then
  1140. begin
  1141. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1142. begin
  1143. consume(ID);
  1144. consume(SEMICOLON);
  1145. if not(aktclass^.isclass) then
  1146. Message(parser_e_constructor_cannot_be_not_virtual)
  1147. else
  1148. begin
  1149. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1150. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1151. end;
  1152. end
  1153. else
  1154. if (pattern='OVERRIDE') then
  1155. begin
  1156. consume(ID);
  1157. consume(SEMICOLON);
  1158. if (aktclass^.options and oois_class=0) then
  1159. Message(parser_e_constructor_cannot_be_not_virtual)
  1160. else
  1161. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1162. pooverridingmethod or povirtualmethod;
  1163. end;
  1164. end;
  1165. end;
  1166. _DESTRUCTOR : begin
  1167. if there_is_a_destructor then
  1168. Message(parser_n_only_one_destructor);
  1169. there_is_a_destructor:=true;
  1170. if actmembertype<>sp_public then
  1171. Message(parser_w_destructor_should_be_public);
  1172. oldparse_only:=parse_only;
  1173. parse_only:=true;
  1174. destructor_head;
  1175. parse_only:=oldparse_only;
  1176. if (token=ID) then
  1177. begin
  1178. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1179. begin
  1180. consume(ID);
  1181. consume(SEMICOLON);
  1182. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1183. end
  1184. else
  1185. if (pattern='OVERRIDE') then
  1186. begin
  1187. consume(ID);
  1188. consume(SEMICOLON);
  1189. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1190. pooverridingmethod or povirtualmethod;
  1191. end;
  1192. end;
  1193. end;
  1194. _END : begin
  1195. consume(_END);
  1196. break;
  1197. end;
  1198. else
  1199. consume(ID); { Give a ident expected message, like tp7 }
  1200. end;
  1201. until false;
  1202. current_object_option:=sp_public;
  1203. end;
  1204. testcurobject:=0;
  1205. curobjectname:='';
  1206. if (cs_smartlink in aktswitches) then
  1207. datasegment^.concat(new(pai_cut,init));
  1208. {$ifdef GDB}
  1209. { generate the VMT }
  1210. if cs_debuginfo in aktswitches then
  1211. begin
  1212. do_count_dbx:=true;
  1213. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1214. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1215. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1216. end;
  1217. {$endif GDB}
  1218. datasegment^.concat(new(pai_symbol,init_global(aktclass^.vmt_mangledname)));
  1219. { determine the size with publicsyms^.datasize, because }
  1220. { size gives back 4 for CLASSes }
  1221. datasegment^.concat(new(pai_const,init_32bit(aktclass^.publicsyms^.datasize)));
  1222. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.publicsyms^.datasize)));
  1223. { write pointer to parent VMT, this isn't implemented in TP }
  1224. { but this is not used in FPC ? (PM) }
  1225. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1226. if assigned(aktclass^.childof) then
  1227. begin
  1228. datasegment^.concat(new(pai_const,init_symbol(strpnew(aktclass^.childof^.vmt_mangledname))));
  1229. if aktclass^.childof^.owner^.symtabletype=unitsymtable then
  1230. concat_external(aktclass^.childof^.vmt_mangledname,EXT_NEAR);
  1231. end
  1232. else
  1233. datasegment^.concat(new(pai_const,init_32bit(0)));
  1234. { this generates the entries }
  1235. genvmt(aktclass);
  1236. { restore old state }
  1237. symtablestack:=symtablestack^.next;
  1238. procinfo._class:=nil;
  1239. {Restore the aktprocsym.}
  1240. aktprocsym:=oldprocsym;
  1241. object_dec:=aktclass;
  1242. end;
  1243. { reads a record declaration }
  1244. function record_dec : pdef;
  1245. var
  1246. symtable : psymtable;
  1247. begin
  1248. symtable:=new(psymtable,init(recordsymtable));
  1249. symtable^.next:=symtablestack;
  1250. symtablestack:=symtable;
  1251. consume(_RECORD);
  1252. read_var_decs(true,false);
  1253. { may be scale record size to a size of n*4 ? }
  1254. if ((symtablestack^.datasize mod aktpackrecords)<>0) then
  1255. inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
  1256. consume(_END);
  1257. symtablestack:=symtable^.next;
  1258. record_dec:=new(precdef,init(symtable));
  1259. end;
  1260. { search in symtablestack used, but not defined type }
  1261. procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
  1262. begin
  1263. if (p^.typ=typesym) and ((p^.properties and sp_forwarddef)<>0) then
  1264. Message(sym_e_type_id_not_defined);
  1265. end;
  1266. { reads a type definition and returns a pointer to it }
  1267. function read_type(const name : stringid) : pdef;
  1268. function handle_procvar:Pprocvardef;
  1269. var
  1270. sc : pstringcontainer;
  1271. s : string;
  1272. p : pdef;
  1273. varspez : tvarspez;
  1274. procvardef : pprocvardef;
  1275. begin
  1276. procvardef:=new(pprocvardef,init);
  1277. if token=LKLAMMER then
  1278. begin
  1279. consume(LKLAMMER);
  1280. inc(testcurobject);
  1281. repeat
  1282. if token=_VAR then
  1283. begin
  1284. consume(_VAR);
  1285. varspez:=vs_var;
  1286. end
  1287. else if token=_CONST then
  1288. begin
  1289. consume(_CONST);
  1290. varspez:=vs_const;
  1291. end
  1292. else varspez:=vs_value;
  1293. sc:=idlist;
  1294. if token=COLON then
  1295. begin
  1296. consume(COLON);
  1297. if token=_ARRAY then
  1298. begin
  1299. {
  1300. if (varspez<>vs_const) and
  1301. (varspez<>vs_var) then
  1302. begin
  1303. varspez:=vs_const;
  1304. Message(parser_e_illegal_open_parameter);
  1305. end;
  1306. }
  1307. consume(_ARRAY);
  1308. consume(_OF);
  1309. { define range and type of range }
  1310. p:=new(parraydef,init(0,-1,s32bitdef));
  1311. { define field type }
  1312. parraydef(p)^.definition:=single_type(s);
  1313. end
  1314. else
  1315. p:=single_type(s);
  1316. end
  1317. else
  1318. p:=new(pformaldef,init);
  1319. s:=sc^.get;
  1320. while s<>'' do
  1321. begin
  1322. procvardef^.concatdef(p,varspez);
  1323. s:=sc^.get;
  1324. end;
  1325. dispose(sc,done);
  1326. if token=SEMICOLON then consume(SEMICOLON)
  1327. else break;
  1328. until false;
  1329. dec(testcurobject);
  1330. consume(RKLAMMER);
  1331. end;
  1332. handle_procvar:=procvardef;
  1333. end;
  1334. var
  1335. hp1,p : pdef;
  1336. aufdef : penumdef;
  1337. aufsym : penumsym;
  1338. ap : parraydef;
  1339. s : stringid;
  1340. l,v,oldaktpackrecords : longint;
  1341. hs : string;
  1342. procedure expr_type;
  1343. var
  1344. pt1,pt2 : ptree;
  1345. begin
  1346. { use of current parsed object ? }
  1347. if (token=ID) and (testcurobject=2) and (curobjectname=pattern) then
  1348. begin
  1349. consume(ID);
  1350. p:=aktobjectdef;
  1351. exit;
  1352. end;
  1353. { we can't accept a equal in type }
  1354. pt1:=comp_expr(not(ignore_equal));
  1355. if (pt1^.treetype=typen) and (token<>POINTPOINT) then
  1356. begin
  1357. { a simple type renaming }
  1358. p:=pt1^.resulttype;
  1359. end
  1360. else
  1361. begin
  1362. { range type }
  1363. consume(POINTPOINT);
  1364. { range type declaration }
  1365. do_firstpass(pt1);
  1366. pt2:=comp_expr(not(ignore_equal));
  1367. do_firstpass(pt2);
  1368. { valid expression ? }
  1369. if (pt1^.treetype<>ordconstn) or
  1370. (pt2^.treetype<>ordconstn) then
  1371. Begin
  1372. Message(sym_e_error_in_type_def);
  1373. { Here we create a node type with a range of 0 }
  1374. { To make sure that no crashes will occur later }
  1375. { on in the compiler. }
  1376. p:=new(porddef,init(uauto,0,0));
  1377. end
  1378. else
  1379. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1380. disposetree(pt2);
  1381. end;
  1382. disposetree(pt1);
  1383. end;
  1384. var
  1385. pt : ptree;
  1386. procedure array_dec;
  1387. begin
  1388. consume(_ARRAY);
  1389. consume(LECKKLAMMER);
  1390. p:=nil;
  1391. repeat
  1392. { read the expression and check it }
  1393. pt:=expr;
  1394. if pt^.treetype=typen then
  1395. begin
  1396. if pt^.resulttype^.deftype=enumdef then
  1397. begin
  1398. if p=nil then
  1399. begin
  1400. ap:=new(parraydef,
  1401. init(0,penumdef(pt^.resulttype)^.max,pt^.resulttype));
  1402. p:=ap;
  1403. end
  1404. else
  1405. begin
  1406. ap^.definition:=new(parraydef,
  1407. init(0,penumdef(pt^.resulttype)^.max,pt^.resulttype));
  1408. ap:=parraydef(ap^.definition);
  1409. end;
  1410. end
  1411. else if pt^.resulttype^.deftype=orddef then
  1412. begin
  1413. case porddef(pt^.resulttype)^.typ of
  1414. s8bit,u8bit,s16bit,u16bit,s32bit :
  1415. begin
  1416. if p=nil then
  1417. begin
  1418. ap:=new(parraydef,init(porddef(pt^.resulttype)^.low,
  1419. porddef(pt^.resulttype)^.high,pt^.resulttype));
  1420. p:=ap;
  1421. end
  1422. else
  1423. begin
  1424. ap^.definition:=new(parraydef,init(porddef(pt^.resulttype)^.low,
  1425. porddef(pt^.resulttype)^.high,pt^.resulttype));
  1426. ap:=parraydef(ap^.definition);
  1427. end;
  1428. end;
  1429. bool8bit:
  1430. begin
  1431. if p=nil then
  1432. begin
  1433. ap:=new(parraydef,init(0,1,pt^.resulttype));
  1434. p:=ap;
  1435. end
  1436. else
  1437. begin
  1438. ap^.definition:=new(parraydef,init(0,1,pt^.resulttype));
  1439. ap:=parraydef(ap^.definition);
  1440. end;
  1441. end;
  1442. uchar:
  1443. begin
  1444. if p=nil then
  1445. begin
  1446. ap:=new(parraydef,init(0,255,pt^.resulttype));
  1447. p:=ap;
  1448. end
  1449. else
  1450. begin
  1451. ap^.definition:=new(parraydef,init(0,255,pt^.resulttype));
  1452. ap:=parraydef(ap^.definition);
  1453. end;
  1454. end;
  1455. else Message(sym_e_error_in_type_def);
  1456. end;
  1457. end
  1458. else Message(sym_e_error_in_type_def);
  1459. end
  1460. else
  1461. begin
  1462. do_firstpass(pt);
  1463. if (pt^.treetype<>rangen) or
  1464. (pt^.left^.treetype<>ordconstn) then
  1465. Message(sym_e_error_in_type_def);
  1466. { force the registration of the ranges }
  1467. {$ifndef GDB}
  1468. if pt^.right^.resulttype=pdef(s32bitdef) then
  1469. pt^.right^.resulttype:=new(porddef,init(
  1470. s32bit,$80000000,$7fffffff));
  1471. {$endif GDB}
  1472. if p=nil then
  1473. begin
  1474. ap:=new(parraydef,init(pt^.left^.value,pt^.right^.value,pt^.right^.resulttype));
  1475. p:=ap;
  1476. end
  1477. else
  1478. begin
  1479. ap^.definition:=new(parraydef,init(pt^.left^.value,pt^.right^.value,pt^.right^.resulttype));
  1480. ap:=parraydef(ap^.definition);
  1481. end;
  1482. end;
  1483. disposetree(pt);
  1484. if token=COMMA then consume(COMMA)
  1485. else break;
  1486. until false;
  1487. consume(RECKKLAMMER);
  1488. consume(_OF);
  1489. hp1:=read_type('');
  1490. { if no error, set element type }
  1491. if assigned(ap) then
  1492. ap^.definition:=hp1;
  1493. end;
  1494. begin
  1495. case token of
  1496. _STRING,_FILE:
  1497. p:=single_type(hs);
  1498. LKLAMMER:
  1499. begin
  1500. consume(LKLAMMER);
  1501. l:=-1;
  1502. aufsym := Nil;
  1503. aufdef:=new(penumdef,init);
  1504. repeat
  1505. s:=pattern;
  1506. consume(ID);
  1507. if token=ASSIGNMENT then
  1508. begin
  1509. consume(ASSIGNMENT);
  1510. v:=get_intconst;
  1511. { please leave that a note, allows type save }
  1512. { declarations in the win32 units ! }
  1513. if v<=l then
  1514. Message(parser_n_duplicate_enum);
  1515. l:=v;
  1516. end
  1517. else
  1518. inc(l);
  1519. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  1520. if token=COMMA then
  1521. consume(COMMA)
  1522. else
  1523. break;
  1524. until false;
  1525. aufdef^.max:=l;
  1526. p:=aufdef;
  1527. consume(RKLAMMER);
  1528. end;
  1529. _ARRAY:
  1530. array_dec;
  1531. _SET:
  1532. begin
  1533. consume(_SET);
  1534. consume(_OF);
  1535. hp1:=read_type('');
  1536. case hp1^.deftype of
  1537. enumdef : p:=new(psetdef,init(hp1,penumdef(hp1)^.max));
  1538. orddef : begin
  1539. case porddef(hp1)^.typ of
  1540. uchar : p:=new(psetdef,init(hp1,255));
  1541. u8bit,s8bit,u16bit,s16bit,s32bit :
  1542. begin
  1543. if (porddef(hp1)^.low>=0) then
  1544. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  1545. else Message(sym_e_ill_type_decl_set);
  1546. end;
  1547. else Message(sym_e_ill_type_decl_set);
  1548. end;
  1549. end;
  1550. else Message(sym_e_ill_type_decl_set);
  1551. end;
  1552. end;
  1553. CARET:
  1554. begin
  1555. consume(CARET);
  1556. { forwards allowed only inside TYPE statements }
  1557. if typecanbeforward then
  1558. forwardsallowed:=true;
  1559. hp1:=single_type(hs);
  1560. p:=new(ppointerdef,init(hp1));
  1561. {I add big troubles here
  1562. with var p : ^byte in graph.putimage
  1563. because a save_forward was called and
  1564. no resolve forward
  1565. => so the definition was rewritten after
  1566. having been disposed !!
  1567. Strange problems appeared !!!!}
  1568. {Anyhow forwards should only be allowed
  1569. inside a type statement ??
  1570. don't you think so }
  1571. if (lasttypesym<>nil)
  1572. and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  1573. lasttypesym^.forwardpointer:=ppointerdef(p);
  1574. forwardsallowed:=false;
  1575. end;
  1576. _RECORD:
  1577. p:=record_dec;
  1578. _PACKED:
  1579. begin
  1580. consume(_PACKED);
  1581. if token=_ARRAY then
  1582. array_dec
  1583. else
  1584. begin
  1585. oldaktpackrecords:=aktpackrecords;
  1586. aktpackrecords:=1;
  1587. if token in [_CLASS,_OBJECT] then
  1588. p:=object_dec(name,nil)
  1589. else
  1590. p:=record_dec;
  1591. aktpackrecords:=oldaktpackrecords;
  1592. end;
  1593. end;
  1594. _CLASS,
  1595. _OBJECT:
  1596. p:=object_dec(name,nil);
  1597. _PROCEDURE:
  1598. begin
  1599. consume(_PROCEDURE);
  1600. p:=handle_procvar;
  1601. if token=_OF then
  1602. begin
  1603. consume(_OF);
  1604. consume(_OBJECT);
  1605. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1606. end;
  1607. end;
  1608. _FUNCTION:
  1609. begin
  1610. consume(_FUNCTION);
  1611. p:=handle_procvar;
  1612. consume(COLON);
  1613. pprocvardef(p)^.retdef:=single_type(hs);
  1614. if token=_OF then
  1615. begin
  1616. consume(_OF);
  1617. consume(_OBJECT);
  1618. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1619. end;
  1620. end;
  1621. else
  1622. expr_type;
  1623. end;
  1624. read_type:=p;
  1625. end;
  1626. { reads a type declaration to the symbol table }
  1627. procedure type_dec;
  1628. var
  1629. typename : stringid;
  1630. newtype : ptypesym;
  1631. {$ifdef dummy}
  1632. olddef,newdef : pdef;
  1633. s : string;
  1634. {$endif dummy}
  1635. begin
  1636. block_type:=bt_type;
  1637. consume(_TYPE);
  1638. typecanbeforward:=true;
  1639. repeat
  1640. typename:=pattern;
  1641. consume(ID);
  1642. consume(EQUAL);
  1643. { here you loose the strictness of pascal
  1644. for which a redefinition like
  1645. childtype = parenttype;
  1646. child2type = parenttype;
  1647. does not make the two child types equal !!
  1648. here all vars from childtype and child2type
  1649. get the definition of parenttype !! }
  1650. {$ifdef testequaltype}
  1651. if (token = ID) or (token=_FILE) or (token=_STRING) then
  1652. begin
  1653. olddef := single_type(s);
  1654. { make a clone of olddef }
  1655. { is that ok ??? }
  1656. getmem(newdef,SizeOf(olddef));
  1657. move(olddef^,newdef^,SizeOf(olddef));
  1658. newtype:=new(ptypesym,init(typename,newdef));
  1659. symtablestack^.insert(newtype);
  1660. end
  1661. else
  1662. {$endif testequaltype}
  1663. begin
  1664. getsym(typename,false);
  1665. { check if it is the definition of a forward defined class }
  1666. if assigned(srsym) and (token=_CLASS) and
  1667. (srsym^.typ=typesym) and
  1668. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  1669. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_isforward)<>0) and
  1670. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oois_class)<>0) then
  1671. begin
  1672. { we can ignore the result }
  1673. { the definition is modified }
  1674. object_dec(typename,pobjectdef(ptypesym(srsym)^.definition));
  1675. newtype:=ptypesym(srsym);
  1676. end
  1677. else
  1678. begin
  1679. newtype:=new(ptypesym,init(typename,read_type(typename)));
  1680. { load newtype with the new pointer to the inserted type
  1681. because it can be an already defined forwarded type !! }
  1682. newtype:=ptypesym(symtablestack^.insert(newtype));
  1683. end;
  1684. end;
  1685. consume(SEMICOLON);
  1686. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  1687. parse_var_proc_directives(newtype);
  1688. until token<>ID;
  1689. typecanbeforward:=false;
  1690. {$ifdef tp}
  1691. symtablestack^.foreach(testforward_types);
  1692. {$else}
  1693. symtablestack^.foreach(@testforward_types);
  1694. {$endif}
  1695. resolve_forwards;
  1696. block_type:=bt_general;
  1697. end;
  1698. procedure var_dec;
  1699. { parses varaible declarations and inserts them in }
  1700. { the top symbol table of symtablestack }
  1701. begin
  1702. consume(_VAR);
  1703. read_var_decs(false,false);
  1704. end;
  1705. procedure Not_supported_for_inline(t : ttoken);
  1706. begin
  1707. if assigned(aktprocsym) and
  1708. ((aktprocsym^.definition^.options and poinline)<>0) then
  1709. Begin
  1710. Comment(V_Warning,tokenstring(t)+' not yet supported inside inline procedure/function ');
  1711. Comment(V_Warning,'inlining disabled');
  1712. aktprocsym^.definition^.options:= aktprocsym^.definition^.options and not poinline;
  1713. End;
  1714. end;
  1715. procedure read_declarations(islibrary : boolean);
  1716. begin
  1717. repeat
  1718. case token of
  1719. _LABEL:
  1720. begin
  1721. Not_supported_for_inline(token);
  1722. label_dec;
  1723. end;
  1724. _CONST:
  1725. begin
  1726. Not_supported_for_inline(token);
  1727. const_dec;
  1728. end;
  1729. _TYPE:
  1730. begin
  1731. Not_supported_for_inline(token);
  1732. type_dec;
  1733. end;
  1734. _VAR:
  1735. var_dec;
  1736. _CONSTRUCTOR,_DESTRUCTOR,
  1737. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  1738. begin
  1739. Not_supported_for_inline(token);
  1740. unter_dec;
  1741. end;
  1742. _EXPORTS:
  1743. begin
  1744. { here we should be at lexlevel 1, no ? PM }
  1745. Not_supported_for_inline(token);
  1746. if islibrary then
  1747. read_exports
  1748. else
  1749. break;
  1750. end
  1751. else break;
  1752. end;
  1753. until false;
  1754. end;
  1755. procedure read_interface_declarations;
  1756. begin
  1757. {Since the body is now parsed at lexlevel 1, and the declarations
  1758. must be parsed at the same lexlevel we increase the lexlevel.}
  1759. inc(lexlevel);
  1760. repeat
  1761. case token of
  1762. _CONST : const_dec;
  1763. _TYPE : type_dec;
  1764. _VAR : var_dec;
  1765. _FUNCTION,
  1766. _PROCEDURE,
  1767. _OPERATOR : unter_dec;
  1768. else
  1769. break;
  1770. end;
  1771. until false;
  1772. dec(lexlevel);
  1773. end;
  1774. end.
  1775. {
  1776. $Log$
  1777. Revision 1.30 1998-07-10 00:00:00 peter
  1778. * fixed ttypesym bug finally
  1779. * fileinfo in the symtable and better using for unused vars
  1780. Revision 1.29 1998/06/25 14:04:21 peter
  1781. + internal inc/dec
  1782. Revision 1.28 1998/06/24 12:26:45 peter
  1783. * stricter var parsing like tp7 and some optimizes with directive
  1784. parsing
  1785. Revision 1.27 1998/06/12 16:15:34 pierre
  1786. * external name 'C_var';
  1787. export name 'intern_C_var';
  1788. cdecl;
  1789. cdecl;external;
  1790. are now supported only with -Sv switch
  1791. Revision 1.25 1998/06/09 16:01:45 pierre
  1792. + added procedure directive parsing for procvars
  1793. (accepted are popstack cdecl and pascal)
  1794. + added C vars with the following syntax
  1795. var C calias 'true_c_name';(can be followed by external)
  1796. reason is that you must add the Cprefix
  1797. which is target dependent
  1798. Revision 1.24 1998/06/05 14:37:32 pierre
  1799. * fixes for inline for operators
  1800. * inline procedure more correctly restricted
  1801. Revision 1.23 1998/06/04 23:51:50 peter
  1802. * m68k compiles
  1803. + .def file creation moved to gendef.pas so it could also be used
  1804. for win32
  1805. Revision 1.22 1998/06/03 22:48:59 peter
  1806. + wordbool,longbool
  1807. * rename bis,von -> high,low
  1808. * moved some systemunit loading/creating to psystem.pas
  1809. Revision 1.21 1998/06/03 22:14:19 florian
  1810. * problem with sizes of classes fixed (if the anchestor was declared
  1811. forward, the compiler doesn't update the child classes size)
  1812. Revision 1.20 1998/05/28 14:35:54 peter
  1813. * nicer error message when no id is used after var
  1814. Revision 1.19 1998/05/23 01:21:19 peter
  1815. + aktasmmode, aktoptprocessor, aktoutputformat
  1816. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1817. + $LIBNAME to set the library name where the unit will be put in
  1818. * splitted cgi386 a bit (codeseg to large for bp7)
  1819. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1820. Revision 1.18 1998/05/20 09:42:35 pierre
  1821. + UseTokenInfo now default
  1822. * unit in interface uses and implementation uses gives error now
  1823. * only one error for unknown symbol (uses lastsymknown boolean)
  1824. the problem came from the label code !
  1825. + first inlined procedures and function work
  1826. (warning there might be allowed cases were the result is still wrong !!)
  1827. * UseBrower updated gives a global list of all position of all used symbols
  1828. with switch -gb
  1829. Revision 1.17 1998/05/11 13:07:55 peter
  1830. + $ifdef NEWPPU for the new ppuformat
  1831. + $define GDB not longer required
  1832. * removed all warnings and stripped some log comments
  1833. * no findfirst/findnext anymore to remove smartlink *.o files
  1834. Revision 1.16 1998/05/05 12:05:42 florian
  1835. * problems with properties fixed
  1836. * crash fixed: i:=l when i and l are undefined, was a problem with
  1837. implementation of private/protected
  1838. Revision 1.15 1998/05/01 09:01:23 florian
  1839. + correct semantics of private and protected
  1840. * small fix in variable scope:
  1841. a id can be used in a parameter list of a method, even it is used in
  1842. an anchestor class as field id
  1843. Revision 1.14 1998/05/01 07:43:56 florian
  1844. + basics for rtti implemented
  1845. + switch $m (generate rtti for published sections)
  1846. Revision 1.13 1998/04/30 15:59:41 pierre
  1847. * GDB works again better :
  1848. correct type info in one pass
  1849. + UseTokenInfo for better source position
  1850. * fixed one remaining bug in scanner for line counts
  1851. * several little fixes
  1852. Revision 1.12 1998/04/29 10:33:57 pierre
  1853. + added some code for ansistring (not complete nor working yet)
  1854. * corrected operator overloading
  1855. * corrected nasm output
  1856. + started inline procedures
  1857. + added starstarn : use ** for exponentiation (^ gave problems)
  1858. + started UseTokenInfo cond to get accurate positions
  1859. Revision 1.11 1998/04/28 11:45:52 florian
  1860. * make it compilable with TP
  1861. + small COM problems solved to compile classes.pp
  1862. Revision 1.10 1998/04/27 23:10:28 peter
  1863. + new scanner
  1864. * $makelib -> if smartlink
  1865. * small filename fixes pmodule.setfilename
  1866. * moved import from files.pas -> import.pas
  1867. Revision 1.9 1998/04/10 21:36:56 florian
  1868. + some stuff to support method pointers (procedure of object) added
  1869. (declaration, parameter handling)
  1870. Revision 1.8 1998/04/10 15:39:48 florian
  1871. * more fixes to get classes.pas compiled
  1872. Revision 1.7 1998/04/09 23:02:15 florian
  1873. * small problems solved to get remake3 work
  1874. Revision 1.6 1998/04/09 22:16:35 florian
  1875. * problem with previous REGALLOC solved
  1876. * improved property support
  1877. Revision 1.5 1998/04/08 14:59:20 florian
  1878. * problem with new expr_type solved
  1879. Revision 1.4 1998/04/08 10:26:09 florian
  1880. * correct error handling of virtual constructors
  1881. * problem with new type declaration handling fixed
  1882. Revision 1.3 1998/04/07 22:45:05 florian
  1883. * bug0092, bug0115 and bug0121 fixed
  1884. + packed object/class/array
  1885. Revision 1.2 1998/04/05 13:58:35 peter
  1886. * fixed the -Ss bug
  1887. + warning for Virtual constructors
  1888. * helppages updated with -TGO32V1
  1889. }