pdecl.pas 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881
  1. {
  2. $Id$
  3. Copyright (c) 1993-99 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. interface
  20. uses
  21. globtype,tokens,globals,symtable;
  22. procedure parameter_dec(aktprocdef:pabstractprocdef);
  23. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  24. { reads the declaration blocks }
  25. procedure read_declarations(islibrary : boolean);
  26. { reads declarations in the interface part of a unit }
  27. procedure read_interface_declarations;
  28. implementation
  29. uses
  30. cobjects,scanner,
  31. symconst,aasm,tree,pass_1,strings,
  32. files,types,verbose,systems,import,
  33. cpubase
  34. {$ifndef newcg}
  35. ,tccnv
  36. {$endif newcg}
  37. {$ifdef GDB}
  38. ,gdb
  39. {$endif GDB}
  40. { parser specific stuff }
  41. ,pbase,ptconst,pexpr,ptype,psub,pexports
  42. { processor specific stuff }
  43. { codegen }
  44. {$ifdef newcg}
  45. ,cgbase
  46. {$else}
  47. ,hcodegen
  48. {$endif}
  49. ,hcgdata
  50. ;
  51. procedure parameter_dec(aktprocdef:pabstractprocdef);
  52. {
  53. handle_procvar needs the same changes
  54. }
  55. var
  56. is_procvar : boolean;
  57. sc : Pstringcontainer;
  58. s : string;
  59. storetokenpos : tfileposinfo;
  60. p : Pdef;
  61. hsym : psym;
  62. hvs,
  63. vs : Pvarsym;
  64. hs1,hs2 : string;
  65. varspez : Tvarspez;
  66. inserthigh : boolean;
  67. begin
  68. { parsing a proc or procvar ? }
  69. is_procvar:=(aktprocdef^.deftype=procvardef);
  70. consume(_LKLAMMER);
  71. inc(testcurobject);
  72. repeat
  73. if try_to_consume(_VAR) then
  74. varspez:=vs_var
  75. else
  76. if try_to_consume(_CONST) then
  77. varspez:=vs_const
  78. else
  79. varspez:=vs_value;
  80. inserthigh:=false;
  81. readtypesym:=nil;
  82. if idtoken=_SELF then
  83. begin
  84. { only allowed in procvars and class methods }
  85. if is_procvar or
  86. (assigned(procinfo^._class) and procinfo^._class^.is_class) then
  87. begin
  88. if not is_procvar then
  89. begin
  90. {$ifndef UseNiceNames}
  91. hs2:=hs2+'$'+'self';
  92. {$else UseNiceNames}
  93. hs2:=hs2+tostr(length('self'))+'self';
  94. {$endif UseNiceNames}
  95. vs:=new(Pvarsym,init('@',procinfo^._class));
  96. vs^.varspez:=vs_var;
  97. { insert the sym in the parasymtable }
  98. pprocdef(aktprocdef)^.parast^.insert(vs);
  99. {$ifdef INCLUDEOK}
  100. include(aktprocdef^.procoptions,po_containsself);
  101. {$else}
  102. aktprocdef^.procoptions:=aktprocdef^.procoptions+[po_containsself];
  103. {$endif}
  104. {$ifdef newcg}
  105. inc(procinfo^.selfpointer_offset,vs^.address);
  106. {$else newcg}
  107. inc(procinfo^.ESI_offset,vs^.address);
  108. {$endif newcg}
  109. end;
  110. consume(idtoken);
  111. consume(_COLON);
  112. p:=single_type(hs1,false);
  113. if assigned(readtypesym) then
  114. aktprocdef^.concattypesym(readtypesym,vs_value)
  115. else
  116. aktprocdef^.concatdef(p,vs_value);
  117. { check the types for procedures only }
  118. if not is_procvar then
  119. CheckTypes(p,procinfo^._class);
  120. end
  121. else
  122. consume(_ID);
  123. end
  124. else
  125. begin
  126. { read identifiers }
  127. sc:=idlist;
  128. { read type declaration, force reading for value and const paras }
  129. if (token=_COLON) or (varspez=vs_value) then
  130. begin
  131. consume(_COLON);
  132. { check for an open array }
  133. if token=_ARRAY then
  134. begin
  135. consume(_ARRAY);
  136. consume(_OF);
  137. { define range and type of range }
  138. p:=new(Parraydef,init(0,-1,s32bitdef));
  139. { array of const ? }
  140. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  141. begin
  142. consume(_CONST);
  143. srsym:=nil;
  144. getsymonlyin(systemunit,'TVARREC');
  145. if not assigned(srsym) then
  146. InternalError(1234124);
  147. Parraydef(p)^.definition:=ptypesym(srsym)^.definition;
  148. Parraydef(p)^.IsArrayOfConst:=true;
  149. hs1:='array_of_const';
  150. end
  151. else
  152. begin
  153. { define field type }
  154. Parraydef(p)^.definition:=single_type(hs1,false);
  155. hs1:='array_of_'+hs1;
  156. { we don't need the typesym anymore }
  157. readtypesym:=nil;
  158. end;
  159. inserthigh:=true;
  160. end
  161. { open string ? }
  162. else if (varspez=vs_var) and
  163. (
  164. (
  165. ((token=_STRING) or (idtoken=_SHORTSTRING)) and
  166. (cs_openstring in aktmoduleswitches) and
  167. not(cs_ansistrings in aktlocalswitches)
  168. ) or
  169. (idtoken=_OPENSTRING)) then
  170. begin
  171. consume(token);
  172. p:=openshortstringdef;
  173. hs1:='openstring';
  174. inserthigh:=true;
  175. end
  176. { everything else }
  177. else
  178. p:=single_type(hs1,false);
  179. end
  180. else
  181. begin
  182. {$ifndef UseNiceNames}
  183. hs1:='$$$';
  184. {$else UseNiceNames}
  185. hs1:='var';
  186. {$endif UseNiceNames}
  187. p:=cformaldef;
  188. end;
  189. if not is_procvar then
  190. hs2:=pprocdef(aktprocdef)^.mangledname;
  191. storetokenpos:=tokenpos;
  192. while not sc^.empty do
  193. begin
  194. s:=sc^.get_with_tokeninfo(tokenpos);
  195. if assigned(readtypesym) then
  196. aktprocdef^.concattypesym(readtypesym,varspez)
  197. else
  198. aktprocdef^.concatdef(p,varspez);
  199. { For proc vars we only need the definitions }
  200. if not is_procvar then
  201. begin
  202. {$ifndef UseNiceNames}
  203. hs2:=hs2+'$'+hs1;
  204. {$else UseNiceNames}
  205. hs2:=hs2+tostr(length(hs1))+hs1;
  206. {$endif UseNiceNames}
  207. if assigned(readtypesym) then
  208. vs:=new(Pvarsym,initsym(s,readtypesym))
  209. else
  210. vs:=new(Pvarsym,init(s,p));
  211. vs^.varspez:=varspez;
  212. { we have to add this to avoid var param to be in registers !!!}
  213. if (varspez in [vs_var,vs_const]) and push_addr_param(p) then
  214. {$ifdef INCLUDEOK}
  215. include(vs^.varoptions,vo_regable);
  216. {$else}
  217. vs^.varoptions:=vs^.varoptions+[vo_regable];
  218. {$endif}
  219. { search for duplicate ids in object members/methods }
  220. { but only the current class, I don't know why ... }
  221. { at least TP and Delphi do it in that way (FK) }
  222. if assigned(procinfo^._class) and
  223. (lexlevel=normal_function_level) then
  224. begin
  225. hsym:=procinfo^._class^.symtable^.search(vs^.name);
  226. if assigned(hsym) then
  227. DuplicateSym(hsym);
  228. end;
  229. { do we need a local copy? }
  230. if (varspez=vs_value) and
  231. push_addr_param(p) and
  232. not(is_open_array(p) or is_array_of_const(p)) then
  233. vs^.setname('val'+vs^.name);
  234. { insert the sym in the parasymtable }
  235. pprocdef(aktprocdef)^.parast^.insert(vs);
  236. { also need to push a high value? }
  237. if inserthigh then
  238. begin
  239. hvs:=new(Pvarsym,init('high'+s,s32bitdef));
  240. hvs^.varspez:=vs_const;
  241. pprocdef(aktprocdef)^.parast^.insert(hvs);
  242. end;
  243. end;
  244. end;
  245. dispose(sc,done);
  246. tokenpos:=storetokenpos;
  247. end;
  248. { set the new mangled name }
  249. if not is_procvar then
  250. pprocdef(aktprocdef)^.setmangledname(hs2);
  251. until not try_to_consume(_SEMICOLON);
  252. dec(testcurobject);
  253. consume(_RKLAMMER);
  254. end;
  255. const
  256. variantrecordlevel : longint = 0;
  257. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  258. { reads the filed of a record into a }
  259. { symtablestack, if record=false }
  260. { variants are forbidden, so this procedure }
  261. { can be used to read object fields }
  262. { if absolute is true, ABSOLUTE and file }
  263. { types are allowed }
  264. { => the procedure is also used to read }
  265. { a sequence of variable declaration }
  266. procedure insert_syms(st : psymtable;sc : pstringcontainer;def : pdef;sym:ptypesym;is_threadvar : boolean);
  267. { inserts the symbols of sc in st with def as definition or sym as ptypesym, sc is disposed }
  268. var
  269. s : string;
  270. filepos : tfileposinfo;
  271. ss : pvarsym;
  272. begin
  273. { can't have a definition and ttypesym }
  274. if assigned(def) and assigned(sym) then
  275. internalerror(5438257);
  276. filepos:=tokenpos;
  277. while not sc^.empty do
  278. begin
  279. s:=sc^.get_with_tokeninfo(tokenpos);
  280. if assigned(sym) then
  281. ss:=new(pvarsym,initsym(s,sym))
  282. else
  283. ss:=new(pvarsym,init(s,def));
  284. if is_threadvar then
  285. {$ifdef INCLUDEOK}
  286. include(ss^.varoptions,vo_is_thread_var);
  287. {$else}
  288. ss^.varoptions:=ss^.varoptions+[vo_is_thread_var];
  289. {$endif}
  290. st^.insert(ss);
  291. { static data fields are inserted in the globalsymtable }
  292. if (st^.symtabletype=objectsymtable) and
  293. (sp_static in current_object_option) then
  294. begin
  295. s:=lower(st^.name^)+'_'+s;
  296. st^.defowner^.owner^.insert(new(pvarsym,init(s,def)));
  297. end;
  298. end;
  299. dispose(sc,done);
  300. tokenpos:=filepos;
  301. end;
  302. var
  303. sc : pstringcontainer;
  304. s : stringid;
  305. old_block_type : tblock_type;
  306. declarepos,storetokenpos : tfileposinfo;
  307. symdone : boolean;
  308. { to handle absolute }
  309. abssym : pabsolutesym;
  310. l : longint;
  311. code : integer;
  312. { c var }
  313. newtype : ptypesym;
  314. is_dll,
  315. is_gpc_name,is_cdecl,extern_aktvarsym,export_aktvarsym : boolean;
  316. dll_name,
  317. C_name : string;
  318. { case }
  319. p,casedef : pdef;
  320. { Delphi initialized vars }
  321. pconstsym : ptypedconstsym;
  322. { maxsize contains the max. size of a variant }
  323. { startvarrec contains the start of the variant part of a record }
  324. maxsize,startvarrec : longint;
  325. pt : ptree;
  326. begin
  327. old_block_type:=block_type;
  328. block_type:=bt_type;
  329. is_gpc_name:=false;
  330. { Force an expected ID error message }
  331. if not (token in [_ID,_CASE,_END]) then
  332. consume(_ID);
  333. { read vars }
  334. while (token=_ID) and
  335. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  336. begin
  337. C_name:=orgpattern;
  338. sc:=idlist;
  339. consume(_COLON);
  340. if (m_gpc in aktmodeswitches) and
  341. not(is_record or is_object or is_threadvar) and
  342. (token=_ID) and (orgpattern='__asmname__') then
  343. begin
  344. consume(_ID);
  345. C_name:=pattern;
  346. if token=_CCHAR then
  347. consume(_CCHAR)
  348. else
  349. consume(_CSTRING);
  350. Is_gpc_name:=true;
  351. end;
  352. { this is needed for Delphi mode at least
  353. but should be OK for all modes !! (PM) }
  354. ignore_equal:=true;
  355. p:=read_type('');
  356. if (variantrecordlevel>0) and p^.needs_inittable then
  357. Message(parser_e_cant_use_inittable_here);
  358. ignore_equal:=false;
  359. symdone:=false;
  360. if is_gpc_name then
  361. begin
  362. storetokenpos:=tokenpos;
  363. s:=sc^.get_with_tokeninfo(tokenpos);
  364. if not sc^.empty then
  365. Message(parser_e_absolute_only_one_var);
  366. dispose(sc,done);
  367. aktvarsym:=new(pvarsym,init_C(s,target_os.Cprefix+C_name,p));
  368. {$ifdef INCLUDEOK}
  369. include(aktvarsym^.varoptions,vo_is_external);
  370. {$else}
  371. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  372. {$endif}
  373. symtablestack^.insert(aktvarsym);
  374. tokenpos:=storetokenpos;
  375. symdone:=true;
  376. end;
  377. { check for absolute }
  378. if not symdone and
  379. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  380. begin
  381. consume(_ABSOLUTE);
  382. { only allowed for one var }
  383. s:=sc^.get_with_tokeninfo(declarepos);
  384. if not sc^.empty then
  385. Message(parser_e_absolute_only_one_var);
  386. dispose(sc,done);
  387. { parse the rest }
  388. if token=_ID then
  389. begin
  390. getsym(pattern,true);
  391. consume(_ID);
  392. { we should check the result type of srsym }
  393. if not (srsym^.typ in [varsym,typedconstsym]) then
  394. Message(parser_e_absolute_only_to_var_or_const);
  395. storetokenpos:=tokenpos;
  396. tokenpos:=declarepos;
  397. abssym:=new(pabsolutesym,init(s,p));
  398. abssym^.abstyp:=tovar;
  399. abssym^.ref:=srsym;
  400. symtablestack^.insert(abssym);
  401. tokenpos:=storetokenpos;
  402. end
  403. else
  404. if (token=_CSTRING) or (token=_CCHAR) then
  405. begin
  406. storetokenpos:=tokenpos;
  407. tokenpos:=declarepos;
  408. abssym:=new(pabsolutesym,init(s,p));
  409. s:=pattern;
  410. consume(token);
  411. abssym^.abstyp:=toasm;
  412. abssym^.asmname:=stringdup(s);
  413. symtablestack^.insert(abssym);
  414. tokenpos:=storetokenpos;
  415. end
  416. else
  417. { absolute address ?!? }
  418. if token=_INTCONST then
  419. begin
  420. if (target_info.target=target_i386_go32v2) then
  421. begin
  422. storetokenpos:=tokenpos;
  423. tokenpos:=declarepos;
  424. abssym:=new(pabsolutesym,init(s,p));
  425. abssym^.abstyp:=toaddr;
  426. abssym^.absseg:=false;
  427. s:=pattern;
  428. consume(_INTCONST);
  429. val(s,abssym^.address,code);
  430. if token=_COLON then
  431. begin
  432. consume(token);
  433. s:=pattern;
  434. consume(_INTCONST);
  435. val(s,l,code);
  436. abssym^.address:=abssym^.address shl 4+l;
  437. abssym^.absseg:=true;
  438. end;
  439. symtablestack^.insert(abssym);
  440. tokenpos:=storetokenpos;
  441. end
  442. else
  443. Message(parser_e_absolute_only_to_var_or_const);
  444. end
  445. else
  446. Message(parser_e_absolute_only_to_var_or_const);
  447. symdone:=true;
  448. end;
  449. { Handling of Delphi typed const = initialized vars ! }
  450. { When should this be rejected ?
  451. - in parasymtable
  452. - in record or object
  453. - ... (PM) }
  454. if (m_delphi in aktmodeswitches) and (token=_EQUAL) and
  455. not (symtablestack^.symtabletype in [parasymtable]) and
  456. not is_record and not is_object then
  457. begin
  458. storetokenpos:=tokenpos;
  459. s:=sc^.get_with_tokeninfo(tokenpos);
  460. if not sc^.empty then
  461. Message(parser_e_initialized_only_one_var);
  462. if assigned(readtypesym) then
  463. pconstsym:=new(ptypedconstsym,initsym(s,readtypesym,false))
  464. else
  465. pconstsym:=new(ptypedconstsym,init(s,p,false));
  466. symtablestack^.insert(pconstsym);
  467. tokenpos:=storetokenpos;
  468. consume(_EQUAL);
  469. readtypedconst(p,pconstsym,false);
  470. symdone:=true;
  471. end;
  472. { for a record there doesn't need to be a ; before the END or ) }
  473. if not((is_record or is_object) and (token in [_END,_RKLAMMER])) then
  474. consume(_SEMICOLON);
  475. { procvar handling }
  476. if (p^.deftype=procvardef) and (p^.sym=nil) then
  477. begin
  478. newtype:=new(ptypesym,init('unnamed',p));
  479. parse_var_proc_directives(psym(newtype));
  480. newtype^.definition:=nil;
  481. p^.sym:=nil;
  482. dispose(newtype,done);
  483. end;
  484. { Check for variable directives }
  485. if not symdone and (token=_ID) then
  486. begin
  487. { Check for C Variable declarations }
  488. if (m_cvar_support in aktmodeswitches) and
  489. not(is_record or is_object or is_threadvar) and
  490. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  491. begin
  492. { only allowed for one var }
  493. s:=sc^.get_with_tokeninfo(declarepos);
  494. if not sc^.empty then
  495. Message(parser_e_absolute_only_one_var);
  496. dispose(sc,done);
  497. { defaults }
  498. is_dll:=false;
  499. is_cdecl:=false;
  500. extern_aktvarsym:=false;
  501. export_aktvarsym:=false;
  502. { cdecl }
  503. if idtoken=_CVAR then
  504. begin
  505. consume(_CVAR);
  506. consume(_SEMICOLON);
  507. is_cdecl:=true;
  508. C_name:=target_os.Cprefix+C_name;
  509. end;
  510. { external }
  511. if idtoken=_EXTERNAL then
  512. begin
  513. consume(_EXTERNAL);
  514. extern_aktvarsym:=true;
  515. end;
  516. { export }
  517. if idtoken in [_EXPORT,_PUBLIC] then
  518. begin
  519. consume(_ID);
  520. if extern_aktvarsym then
  521. Message(parser_e_not_external_and_export)
  522. else
  523. export_aktvarsym:=true;
  524. end;
  525. { external and export need a name after when no cdecl is used }
  526. if not is_cdecl then
  527. begin
  528. { dll name ? }
  529. if (extern_aktvarsym) and (idtoken<>_NAME) then
  530. begin
  531. is_dll:=true;
  532. dll_name:=get_stringconst;
  533. end;
  534. consume(_NAME);
  535. C_name:=get_stringconst;
  536. end;
  537. { consume the ; when export or external is used }
  538. if extern_aktvarsym or export_aktvarsym then
  539. consume(_SEMICOLON);
  540. { insert in the symtable }
  541. storetokenpos:=tokenpos;
  542. tokenpos:=declarepos;
  543. if is_dll then
  544. begin
  545. if assigned(readtypesym) then
  546. aktvarsym:=new(pvarsym,initsym_dll(s,readtypesym))
  547. else
  548. aktvarsym:=new(pvarsym,init_dll(s,p))
  549. end
  550. else
  551. begin
  552. if assigned(readtypesym) then
  553. aktvarsym:=new(pvarsym,initsym_C(s,C_name,readtypesym))
  554. else
  555. aktvarsym:=new(pvarsym,init_C(s,C_name,p));
  556. end;
  557. { set some vars options }
  558. if export_aktvarsym then
  559. inc(aktvarsym^.refs);
  560. if extern_aktvarsym then
  561. {$ifdef INCLUDEOK}
  562. include(aktvarsym^.varoptions,vo_is_external);
  563. {$else}
  564. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  565. {$endif}
  566. { insert in the stack/datasegment }
  567. symtablestack^.insert(aktvarsym);
  568. tokenpos:=storetokenpos;
  569. { now we can insert it in the import lib if its a dll, or
  570. add it to the externals }
  571. if extern_aktvarsym then
  572. begin
  573. if is_dll then
  574. begin
  575. if not(current_module^.uses_imports) then
  576. begin
  577. current_module^.uses_imports:=true;
  578. importlib^.preparelib(current_module^.modulename^);
  579. end;
  580. importlib^.importvariable(aktvarsym^.mangledname,dll_name,C_name)
  581. end
  582. end;
  583. symdone:=true;
  584. end
  585. else
  586. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  587. begin
  588. {$ifdef INCLUDEOK}
  589. include(current_object_option,sp_static);
  590. {$else}
  591. current_object_option:=current_object_option+[sp_static];
  592. {$endif}
  593. if assigned(readtypesym) then
  594. insert_syms(symtablestack,sc,nil,readtypesym,false)
  595. else
  596. insert_syms(symtablestack,sc,p,nil,false);
  597. {$ifdef INCLUDEOK}
  598. exclude(current_object_option,sp_static);
  599. {$else}
  600. current_object_option:=current_object_option-[sp_static];
  601. {$endif}
  602. consume(_STATIC);
  603. consume(_SEMICOLON);
  604. symdone:=true;
  605. end;
  606. end;
  607. { insert it in the symtable, if not done yet }
  608. if not symdone then
  609. begin
  610. if (sp_published in current_object_option) and
  611. (not((p^.deftype=objectdef) and (pobjectdef(p)^.is_class))) then
  612. Message(parser_e_cant_publish_that)
  613. else if (sp_published in current_object_option) and
  614. not(oo_can_have_published in pobjectdef(p)^.objectoptions) then
  615. Message(parser_e_only_publishable_classes_can__be_published);
  616. if assigned(readtypesym) then
  617. insert_syms(symtablestack,sc,nil,readtypesym,is_threadvar)
  618. else
  619. insert_syms(symtablestack,sc,p,nil,is_threadvar);
  620. end;
  621. end;
  622. { Check for Case }
  623. if is_record and (token=_CASE) then
  624. begin
  625. maxsize:=0;
  626. consume(_CASE);
  627. s:=pattern;
  628. getsym(s,false);
  629. { may be only a type: }
  630. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  631. casedef:=read_type('')
  632. else
  633. begin
  634. consume(_ID);
  635. consume(_COLON);
  636. casedef:=read_type('');
  637. symtablestack^.insert(new(pvarsym,init(s,casedef)));
  638. end;
  639. if not(is_ordinal(casedef)) or is_64bitint(casedef) then
  640. Message(type_e_ordinal_expr_expected);
  641. consume(_OF);
  642. startvarrec:=symtablestack^.datasize;
  643. repeat
  644. repeat
  645. pt:=comp_expr(true);
  646. do_firstpass(pt);
  647. if not(pt^.treetype=ordconstn) then
  648. Message(cg_e_illegal_expression);
  649. disposetree(pt);
  650. if token=_COMMA then
  651. consume(_COMMA)
  652. else
  653. break;
  654. until false;
  655. consume(_COLON);
  656. { read the vars }
  657. consume(_LKLAMMER);
  658. inc(variantrecordlevel);
  659. if token<>_RKLAMMER then
  660. read_var_decs(true,false,false);
  661. dec(variantrecordlevel);
  662. consume(_RKLAMMER);
  663. { calculates maximal variant size }
  664. maxsize:=max(maxsize,symtablestack^.datasize);
  665. { the items of the next variant are overlayed }
  666. symtablestack^.datasize:=startvarrec;
  667. if (token<>_END) and (token<>_RKLAMMER) then
  668. consume(_SEMICOLON)
  669. else
  670. break;
  671. until (token=_END) or (token=_RKLAMMER);
  672. { at last set the record size to that of the biggest variant }
  673. symtablestack^.datasize:=maxsize;
  674. end;
  675. block_type:=old_block_type;
  676. end;
  677. procedure const_dec;
  678. var
  679. name : stringid;
  680. p : ptree;
  681. def : pdef;
  682. sym : psym;
  683. storetokenpos,filepos : tfileposinfo;
  684. old_block_type : tblock_type;
  685. ps : pconstset;
  686. pd : pbestreal;
  687. sp : pchar;
  688. skipequal : boolean;
  689. begin
  690. consume(_CONST);
  691. old_block_type:=block_type;
  692. block_type:=bt_const;
  693. repeat
  694. name:=pattern;
  695. filepos:=tokenpos;
  696. consume(_ID);
  697. case token of
  698. _EQUAL:
  699. begin
  700. consume(_EQUAL);
  701. p:=comp_expr(true);
  702. do_firstpass(p);
  703. storetokenpos:=tokenpos;
  704. tokenpos:=filepos;
  705. case p^.treetype of
  706. ordconstn:
  707. begin
  708. if is_constintnode(p) then
  709. symtablestack^.insert(new(pconstsym,init_def(name,constint,p^.value,nil)))
  710. else if is_constcharnode(p) then
  711. symtablestack^.insert(new(pconstsym,init_def(name,constchar,p^.value,nil)))
  712. else if is_constboolnode(p) then
  713. symtablestack^.insert(new(pconstsym,init_def(name,constbool,p^.value,nil)))
  714. else if p^.resulttype^.deftype=enumdef then
  715. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  716. else if p^.resulttype^.deftype=pointerdef then
  717. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  718. else internalerror(111);
  719. end;
  720. stringconstn:
  721. begin
  722. getmem(sp,p^.length+1);
  723. move(p^.value_str^,sp^,p^.length+1);
  724. symtablestack^.insert(new(pconstsym,init_string(name,conststring,sp,p^.length)));
  725. end;
  726. realconstn :
  727. begin
  728. new(pd);
  729. pd^:=p^.value_real;
  730. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd))));
  731. end;
  732. setconstn :
  733. begin
  734. new(ps);
  735. ps^:=p^.value_set^;
  736. symtablestack^.insert(new(pconstsym,init_def(name,constset,longint(ps),p^.resulttype)));
  737. end;
  738. pointerconstn :
  739. begin
  740. symtablestack^.insert(new(pconstsym,init_def(name,constpointer,p^.value,p^.resulttype)))
  741. end;
  742. niln :
  743. begin
  744. symtablestack^.insert(new(pconstsym,init_def(name,constnil,0,p^.resulttype)));
  745. end;
  746. else
  747. Message(cg_e_illegal_expression);
  748. end;
  749. tokenpos:=storetokenpos;
  750. consume(_SEMICOLON);
  751. disposetree(p);
  752. end;
  753. _COLON:
  754. begin
  755. { set the blocktype first so a consume also supports a
  756. caret, to support const s : ^string = nil }
  757. block_type:=bt_type;
  758. consume(_COLON);
  759. ignore_equal:=true;
  760. def:=read_type('');
  761. ignore_equal:=false;
  762. block_type:=bt_const;
  763. skipequal:=false;
  764. { create symbol }
  765. storetokenpos:=tokenpos;
  766. tokenpos:=filepos;
  767. {$ifdef DELPHI_CONST_IN_RODATA}
  768. if m_delphi in aktmodeswitches then
  769. begin
  770. if assigned(readtypesym) then
  771. sym:=new(ptypedconstsym,initsym(name,readtypesym,true))
  772. else
  773. sym:=new(ptypedconstsym,init(name,def,true))
  774. end
  775. else
  776. {$endif DELPHI_CONST_IN_RODATA}
  777. begin
  778. if assigned(readtypesym) then
  779. sym:=new(ptypedconstsym,initsym(name,readtypesym,false))
  780. else
  781. sym:=new(ptypedconstsym,init(name,def,false))
  782. end;
  783. tokenpos:=storetokenpos;
  784. symtablestack^.insert(sym);
  785. { procvar can have proc directives }
  786. if (def^.deftype=procvardef) then
  787. begin
  788. { support p : procedure;stdcall=nil; }
  789. if (token=_SEMICOLON) then
  790. begin
  791. consume(_SEMICOLON);
  792. if is_proc_directive(token) then
  793. parse_var_proc_directives(sym)
  794. else
  795. begin
  796. Message(parser_e_proc_directive_expected);
  797. skipequal:=true;
  798. end;
  799. end
  800. else
  801. { support p : procedure stdcall=nil; }
  802. begin
  803. if is_proc_directive(token) then
  804. parse_var_proc_directives(sym);
  805. end;
  806. end;
  807. if not skipequal then
  808. begin
  809. { get init value }
  810. consume(_EQUAL);
  811. {$ifdef DELPHI_CONST_IN_RODATA}
  812. if m_delphi in aktmodeswitches then
  813. readtypedconst(def,ptypedconstsym(sym),true)
  814. else
  815. {$endif DELPHI_CONST_IN_RODATA}
  816. readtypedconst(def,ptypedconstsym(sym),false);
  817. consume(_SEMICOLON);
  818. end;
  819. end;
  820. else
  821. { generate an error }
  822. consume(_EQUAL);
  823. end;
  824. until token<>_ID;
  825. block_type:=old_block_type;
  826. end;
  827. procedure label_dec;
  828. var
  829. hl : pasmlabel;
  830. begin
  831. consume(_LABEL);
  832. if not(cs_support_goto in aktmoduleswitches) then
  833. Message(sym_e_goto_and_label_not_supported);
  834. repeat
  835. if not(token in [_ID,_INTCONST]) then
  836. consume(_ID)
  837. else
  838. begin
  839. getlabel(hl);
  840. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  841. consume(token);
  842. end;
  843. if token<>_SEMICOLON then consume(_COMMA);
  844. until not(token in [_ID,_INTCONST]);
  845. consume(_SEMICOLON);
  846. end;
  847. { search in symtablestack used, but not defined type }
  848. procedure resolve_type_forward(p : pnamedindexobject);{$ifndef FPC}far;{$endif}
  849. var
  850. hpd,pd : pdef;
  851. begin
  852. { Check only typesyms or record/object fields }
  853. case psym(p)^.typ of
  854. typesym :
  855. pd:=ptypesym(p)^.definition;
  856. varsym :
  857. if (psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  858. pd:=pvarsym(p)^.definition
  859. else
  860. exit;
  861. else
  862. exit;
  863. end;
  864. case pd^.deftype of
  865. pointerdef,
  866. classrefdef :
  867. begin
  868. { classrefdef inherits from pointerdef }
  869. hpd:=ppointerdef(pd)^.definition;
  870. { still a forward def ? }
  871. if hpd^.deftype=forwarddef then
  872. begin
  873. { try to resolve the forward }
  874. getsym(pforwarddef(hpd)^.tosymname,false);
  875. { we don't need the forwarddef anymore, dispose it }
  876. dispose(hpd,done);
  877. { was a type sym found ? }
  878. if assigned(srsym) and
  879. (srsym^.typ=typesym) then
  880. begin
  881. ppointerdef(pd)^.definition:=ptypesym(srsym)^.definition;
  882. {$ifdef GDB}
  883. if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
  884. (psym(p)^.owner^.symtabletype in [globalsymtable,staticsymtable]) then
  885. begin
  886. ptypesym(p)^.isusedinstab := true;
  887. psym(p)^.concatstabto(debuglist);
  888. end;
  889. {$endif GDB}
  890. { we need a class type for classrefdef }
  891. if (pd^.deftype=classrefdef) and
  892. not((ptypesym(srsym)^.definition^.deftype=objectdef) and
  893. pobjectdef(ptypesym(srsym)^.definition)^.is_class) then
  894. Message1(type_e_class_type_expected,ptypesym(srsym)^.definition^.typename);
  895. end
  896. else
  897. begin
  898. MessagePos1(psym(p)^.fileinfo,sym_e_forward_type_not_resolved,p^.name);
  899. { try to recover }
  900. ppointerdef(pd)^.definition:=generrordef;
  901. end;
  902. end;
  903. end;
  904. recorddef :
  905. precorddef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  906. objectdef :
  907. { Don't check objectdefs in objects/records, because these can't
  908. exist (anonymous objects aren't allowed) }
  909. if not(psym(p)^.owner^.symtabletype in [objectsymtable,recordsymtable]) then
  910. pobjectdef(pd)^.symtable^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  911. end;
  912. end;
  913. { reads a type declaration to the symbol table }
  914. procedure type_dec;
  915. var
  916. typename : stringid;
  917. newtype : ptypesym;
  918. sym : psym;
  919. old_block_type : tblock_type;
  920. begin
  921. old_block_type:=block_type;
  922. block_type:=bt_type;
  923. consume(_TYPE);
  924. typecanbeforward:=true;
  925. repeat
  926. typename:=pattern;
  927. consume(_ID);
  928. consume(_EQUAL);
  929. { support 'ttype=type word' syntax }
  930. if token=_TYPE then
  931. Consume(_TYPE);
  932. { is the type already defined? }
  933. getsym(typename,false);
  934. sym:=srsym;
  935. newtype:=nil;
  936. { found a symbol with this name? }
  937. if assigned(sym) then
  938. begin
  939. if (sym^.typ=typesym) then
  940. begin
  941. if (token=_CLASS) and
  942. (assigned(ptypesym(sym)^.definition)) and
  943. (ptypesym(sym)^.definition^.deftype=objectdef) and
  944. pobjectdef(ptypesym(sym)^.definition)^.is_class and
  945. (oo_is_forward in pobjectdef(ptypesym(sym)^.definition)^.objectoptions) then
  946. begin
  947. { we can ignore the result }
  948. { the definition is modified }
  949. object_dec(typename,pobjectdef(ptypesym(sym)^.definition));
  950. newtype:=ptypesym(sym);
  951. end;
  952. end;
  953. end;
  954. { no old type reused ? Then insert this new type }
  955. if not assigned(newtype) then
  956. begin
  957. newtype:=new(ptypesym,init(typename,read_type(typename)));
  958. newtype:=ptypesym(symtablestack^.insert(newtype));
  959. end;
  960. consume(_SEMICOLON);
  961. if assigned(newtype^.definition) and
  962. (newtype^.definition^.deftype=procvardef) then
  963. parse_var_proc_directives(psym(newtype));
  964. until token<>_ID;
  965. typecanbeforward:=false;
  966. symtablestack^.foreach({$ifndef TP}@{$endif}resolve_type_forward);
  967. block_type:=old_block_type;
  968. end;
  969. procedure var_dec;
  970. { parses varaible declarations and inserts them in }
  971. { the top symbol table of symtablestack }
  972. begin
  973. consume(_VAR);
  974. read_var_decs(false,false,false);
  975. end;
  976. procedure threadvar_dec;
  977. { parses thread variable declarations and inserts them in }
  978. { the top symbol table of symtablestack }
  979. begin
  980. consume(_THREADVAR);
  981. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  982. message(parser_e_threadvars_only_sg);
  983. read_var_decs(false,false,true);
  984. end;
  985. procedure resourcestring_dec;
  986. var
  987. name : stringid;
  988. p : ptree;
  989. storetokenpos,filepos : tfileposinfo;
  990. old_block_type : tblock_type;
  991. sp : pchar;
  992. begin
  993. consume(_RESOURCESTRING);
  994. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  995. message(parser_e_resourcestring_only_sg);
  996. old_block_type:=block_type;
  997. block_type:=bt_const;
  998. repeat
  999. name:=pattern;
  1000. filepos:=tokenpos;
  1001. consume(_ID);
  1002. case token of
  1003. _EQUAL:
  1004. begin
  1005. consume(_EQUAL);
  1006. p:=comp_expr(true);
  1007. do_firstpass(p);
  1008. storetokenpos:=tokenpos;
  1009. tokenpos:=filepos;
  1010. case p^.treetype of
  1011. ordconstn:
  1012. begin
  1013. if is_constcharnode(p) then
  1014. begin
  1015. getmem(sp,2);
  1016. sp[0]:=chr(p^.value);
  1017. sp[1]:=#0;
  1018. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,1)));
  1019. end
  1020. else
  1021. Message(cg_e_illegal_expression);
  1022. end;
  1023. stringconstn:
  1024. begin
  1025. getmem(sp,p^.length+1);
  1026. move(p^.value_str^,sp^,p^.length+1);
  1027. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,p^.length)));
  1028. end;
  1029. else
  1030. Message(cg_e_illegal_expression);
  1031. end;
  1032. tokenpos:=storetokenpos;
  1033. consume(_SEMICOLON);
  1034. disposetree(p);
  1035. end;
  1036. else consume(_EQUAL);
  1037. end;
  1038. until token<>_ID;
  1039. block_type:=old_block_type;
  1040. end;
  1041. procedure Not_supported_for_inline(t : ttoken);
  1042. begin
  1043. if assigned(aktprocsym) and
  1044. (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  1045. Begin
  1046. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  1047. Message(parser_w_inlining_disabled);
  1048. {$ifdef INCLUDEOK}
  1049. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  1050. {$else}
  1051. aktprocsym^.definition^.proccalloptions:=aktprocsym^.definition^.proccalloptions-[pocall_inline];
  1052. {$endif}
  1053. End;
  1054. end;
  1055. procedure read_declarations(islibrary : boolean);
  1056. begin
  1057. repeat
  1058. case token of
  1059. _LABEL:
  1060. begin
  1061. Not_supported_for_inline(token);
  1062. label_dec;
  1063. end;
  1064. _CONST:
  1065. begin
  1066. Not_supported_for_inline(token);
  1067. const_dec;
  1068. end;
  1069. _TYPE:
  1070. begin
  1071. Not_supported_for_inline(token);
  1072. type_dec;
  1073. end;
  1074. _VAR:
  1075. var_dec;
  1076. _THREADVAR:
  1077. threadvar_dec;
  1078. _CONSTRUCTOR,_DESTRUCTOR,
  1079. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  1080. begin
  1081. Not_supported_for_inline(token);
  1082. read_proc;
  1083. end;
  1084. _RESOURCESTRING:
  1085. resourcestring_dec;
  1086. _EXPORTS:
  1087. begin
  1088. Not_supported_for_inline(token);
  1089. { here we should be at lexlevel 1, no ? PM }
  1090. if (lexlevel<>main_program_level) or
  1091. (not islibrary and not DLLsource) then
  1092. begin
  1093. Message(parser_e_syntax_error);
  1094. consume_all_until(_SEMICOLON);
  1095. end
  1096. else if islibrary then
  1097. read_exports;
  1098. end
  1099. else break;
  1100. end;
  1101. until false;
  1102. end;
  1103. procedure read_interface_declarations;
  1104. begin
  1105. {Since the body is now parsed at lexlevel 1, and the declarations
  1106. must be parsed at the same lexlevel we increase the lexlevel.}
  1107. inc(lexlevel);
  1108. repeat
  1109. case token of
  1110. _CONST : const_dec;
  1111. _TYPE : type_dec;
  1112. _VAR : var_dec;
  1113. _THREADVAR : threadvar_dec;
  1114. _RESOURCESTRING:
  1115. resourcestring_dec;
  1116. _FUNCTION,
  1117. _PROCEDURE,
  1118. _OPERATOR : read_proc;
  1119. else
  1120. break;
  1121. end;
  1122. until false;
  1123. dec(lexlevel);
  1124. end;
  1125. end.
  1126. {
  1127. $Log$
  1128. Revision 1.167 1999-10-26 12:30:44 peter
  1129. * const parameter is now checked
  1130. * better and generic check if a node can be used for assigning
  1131. * export fixes
  1132. * procvar equal works now (it never had worked at least from 0.99.8)
  1133. * defcoll changed to linkedlist with pparaitem so it can easily be
  1134. walked both directions
  1135. Revision 1.166 1999/10/22 10:39:34 peter
  1136. * split type reading from pdecl to ptype unit
  1137. * parameter_dec routine is now used for procedure and procvars
  1138. Revision 1.165 1999/10/21 16:41:41 florian
  1139. * problems with readln fixed: esi wasn't restored correctly when
  1140. reading ordinal fields of objects futher the register allocation
  1141. didn't take care of the extra register when reading ordinal values
  1142. * enumerations can now be used in constant indexes of properties
  1143. Revision 1.164 1999/10/14 14:57:52 florian
  1144. - removed the hcodegen use in the new cg, use cgbase instead
  1145. Revision 1.163 1999/10/06 17:39:14 peter
  1146. * fixed stabs writting for forward types
  1147. Revision 1.162 1999/10/03 19:44:42 peter
  1148. * removed objpasunit reference, tvarrec is now searched in systemunit
  1149. where it already was located
  1150. Revision 1.161 1999/10/01 11:18:02 peter
  1151. * class/record type forward checking fixed
  1152. Revision 1.159 1999/10/01 10:05:42 peter
  1153. + procedure directive support in const declarations, fixes bug 232
  1154. Revision 1.158 1999/10/01 08:02:46 peter
  1155. * forward type declaration rewritten
  1156. Revision 1.157 1999/09/27 23:44:53 peter
  1157. * procinfo is now a pointer
  1158. * support for result setting in sub procedure
  1159. Revision 1.156 1999/09/26 21:30:19 peter
  1160. + constant pointer support which can happend with typecasting like
  1161. const p=pointer(1)
  1162. * better procvar parsing in typed consts
  1163. Revision 1.155 1999/09/20 16:38:59 peter
  1164. * cs_create_smart instead of cs_smartlink
  1165. * -CX is create smartlink
  1166. * -CD is create dynamic, but does nothing atm.
  1167. Revision 1.154 1999/09/15 22:09:24 florian
  1168. + rtti is now automatically generated for published classes, i.e.
  1169. they are handled like an implicit property
  1170. Revision 1.153 1999/09/14 11:09:08 florian
  1171. * per default a property is stored, fixed
  1172. Revision 1.152 1999/09/12 14:50:50 florian
  1173. + implemented creation of methodname/address tables
  1174. Revision 1.151 1999/09/12 08:48:09 florian
  1175. * bugs 593 and 607 fixed
  1176. * some other potential bugs with array constructors fixed
  1177. * for classes compiled in $M+ and it's childs, the default access method
  1178. is now published
  1179. * fixed copyright message (it is now 1993-99)
  1180. Revision 1.150 1999/09/10 20:57:33 florian
  1181. * some more fixes for stored properties
  1182. Revision 1.149 1999/09/10 18:48:07 florian
  1183. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1184. * most things for stored properties fixed
  1185. Revision 1.148 1999/09/08 21:06:06 michael
  1186. * Stored specifier for properties is now correctly parsed
  1187. Revision 1.147 1999/09/02 09:23:51 peter
  1188. * fixed double dispose of propsymlist
  1189. Revision 1.146 1999/09/01 13:44:56 florian
  1190. * fixed writing of class rtti: vmt offset were written wrong
  1191. Revision 1.145 1999/08/26 21:17:39 peter
  1192. * fixed crash when childof was nil
  1193. Revision 1.144 1999/08/14 00:38:53 peter
  1194. * hack to support property with record fields
  1195. Revision 1.143 1999/08/09 22:19:53 peter
  1196. * classes vmt changed to only positive addresses
  1197. * sharedlib creation is working
  1198. Revision 1.142 1999/08/05 16:53:02 peter
  1199. * V_Fatal=1, all other V_ are also increased
  1200. * Check for local procedure when assigning procvar
  1201. * fixed comment parsing because directives
  1202. * oldtp mode directives better supported
  1203. * added some messages to errore.msg
  1204. Revision 1.141 1999/08/04 13:02:51 jonas
  1205. * all tokens now start with an underscore
  1206. * PowerPC compiles!!
  1207. Revision 1.140 1999/08/04 00:23:11 florian
  1208. * renamed i386asm and i386base to cpuasm and cpubase
  1209. Revision 1.139 1999/08/03 22:02:56 peter
  1210. * moved bitmask constants to sets
  1211. * some other type/const renamings
  1212. Revision 1.138 1999/08/01 18:28:11 florian
  1213. * modifications for the new code generator
  1214. Revision 1.137 1999/07/29 20:54:02 peter
  1215. * write .size also
  1216. Revision 1.136 1999/07/27 23:42:11 peter
  1217. * indirect type referencing is now allowed
  1218. Revision 1.135 1999/07/23 16:05:23 peter
  1219. * alignment is now saved in the symtable
  1220. * C alignment added for records
  1221. * PPU version increased to solve .12 <-> .13 probs
  1222. Revision 1.134 1999/07/22 09:37:50 florian
  1223. + resourcestring implemented
  1224. + start of longstring support
  1225. Revision 1.133 1999/07/16 10:04:34 peter
  1226. * merged
  1227. Revision 1.132 1999/07/11 21:24:31 michael
  1228. + Fixed integer message table
  1229. Revision 1.131 1999/07/06 21:48:23 florian
  1230. * a lot bug fixes:
  1231. - po_external isn't any longer necessary for procedure compatibility
  1232. - m_tp_procvar is in -Sd now available
  1233. - error messages of procedure variables improved
  1234. - return values with init./finalization fixed
  1235. - data types with init./finalization aren't any longer allowed in variant
  1236. record
  1237. Revision 1.130 1999/07/05 20:25:39 peter
  1238. * merged
  1239. Revision 1.129 1999/07/02 13:02:26 peter
  1240. * merged
  1241. Revision 1.128 1999/06/30 22:16:19 florian
  1242. * use of is_ordinal checked: often a qword/int64 isn't allowed (case/for ...)
  1243. * small qword problems fixed
  1244. Revision 1.127.2.4 1999/07/11 21:48:01 michael
  1245. + merged dispatch fix
  1246. Revision 1.127.2.3 1999/07/07 07:53:22 michael
  1247. + Merged patches from florian
  1248. Revision 1.127.2.2 1999/07/05 20:03:27 peter
  1249. * removed warning/notes
  1250. Revision 1.127.2.1 1999/07/02 12:59:49 peter
  1251. * fixed parsing of message directive
  1252. Revision 1.127 1999/06/02 22:44:10 pierre
  1253. * previous wrong log corrected
  1254. Revision 1.126 1999/06/02 22:25:42 pierre
  1255. * changed $ifdef FPC @ into $ifndef TP
  1256. Revision 1.125 1999/06/01 19:27:53 peter
  1257. * better checks for procvar and methodpointer
  1258. Revision 1.124 1999/06/01 14:45:51 peter
  1259. * @procvar is now always needed for FPC
  1260. Revision 1.123 1999/05/27 19:44:45 peter
  1261. * removed oldasm
  1262. * plabel -> pasmlabel
  1263. * -a switches to source writing automaticly
  1264. * assembler readers OOPed
  1265. * asmsymbol automaticly external
  1266. * jumptables and other label fixes for asm readers
  1267. Revision 1.122 1999/05/21 20:08:22 florian
  1268. * hopefully the default property bug fixed
  1269. Revision 1.121 1999/05/21 13:55:04 peter
  1270. * NEWLAB for label as symbol
  1271. Revision 1.120 1999/05/20 22:19:52 pierre
  1272. * better stabs line info for vars
  1273. Revision 1.119 1999/05/19 12:41:56 florian
  1274. * made source compilable with TP (too long line)
  1275. * default values for set properties fixed
  1276. Revision 1.118 1999/05/18 14:15:51 peter
  1277. * containsself fixes
  1278. * checktypes()
  1279. Revision 1.117 1999/05/17 21:57:12 florian
  1280. * new temporary ansistring handling
  1281. Revision 1.116 1999/05/13 21:59:34 peter
  1282. * removed oldppu code
  1283. * warning if objpas is loaded from uses
  1284. * first things for new deref writing
  1285. Revision 1.115 1999/05/07 10:36:09 peter
  1286. * fixed crash
  1287. Revision 1.114 1999/05/04 21:44:54 florian
  1288. * changes to compile it with Delphi 4.0
  1289. Revision 1.113 1999/05/01 13:24:30 peter
  1290. * merged nasm compiler
  1291. * old asm moved to oldasm/
  1292. Revision 1.112 1999/04/28 06:02:07 florian
  1293. * changes of Bruessel:
  1294. + message handler can now take an explicit self
  1295. * typinfo fixed: sometimes the type names weren't written
  1296. * the type checking for pointer comparisations and subtraction
  1297. and are now more strict (was also buggy)
  1298. * small bug fix to link.pas to support compiling on another
  1299. drive
  1300. * probable bug in popt386 fixed: call/jmp => push/jmp
  1301. transformation didn't count correctly the jmp references
  1302. + threadvar support
  1303. * warning if ln/sqrt gets an invalid constant argument
  1304. Revision 1.111 1999/04/26 13:31:37 peter
  1305. * release storenumber,double_checksum
  1306. Revision 1.110 1999/04/25 22:42:16 pierre
  1307. + code for initialized vars in Delphi mode
  1308. Revision 1.109 1999/04/21 09:43:45 peter
  1309. * storenumber works
  1310. * fixed some typos in double_checksum
  1311. + incompatible types type1 and type2 message (with storenumber)
  1312. Revision 1.108 1999/04/17 13:16:19 peter
  1313. * fixes for storenumber
  1314. Revision 1.107 1999/04/14 09:14:50 peter
  1315. * first things to store the symbol/def number in the ppu
  1316. Revision 1.106 1999/04/07 15:31:15 pierre
  1317. * all formaldefs are now a sinlge definition
  1318. cformaldef (this was necessary for double_checksum)
  1319. + small part of double_checksum code
  1320. Revision 1.105 1999/03/26 00:05:34 peter
  1321. * released valintern
  1322. + deffile is now removed when compiling is finished
  1323. * ^( compiles now correct
  1324. + static directive
  1325. * shrd fixed
  1326. Revision 1.104 1999/03/24 23:17:13 peter
  1327. * fixed bugs 212,222,225,227,229,231,233
  1328. Revision 1.103 1999/03/22 22:10:25 florian
  1329. * typecanbeforward wasn't always restored in object_dec which
  1330. sometimes caused strange effects
  1331. Revision 1.102 1999/03/05 01:14:26 pierre
  1332. * bug0198 : call conventions for methods
  1333. not yet implemented is the control of same calling convention
  1334. for virtual and child's virtual
  1335. * msgstr and msgint only created if message was found
  1336. who implemented this by the way ?
  1337. it leaks lots of plabels !!!! (check with heaptrc !)
  1338. Revision 1.101 1999/02/25 21:02:41 peter
  1339. * ag386bin updates
  1340. + coff writer
  1341. Revision 1.100 1999/02/24 00:59:14 peter
  1342. * small updates for ag386bin
  1343. Revision 1.99 1999/02/22 23:33:29 florian
  1344. + message directive for integers added
  1345. Revision 1.98 1999/02/22 20:13:36 florian
  1346. + first implementation of message keyword
  1347. Revision 1.97 1999/02/22 02:44:10 peter
  1348. * ag386bin doesn't use i386.pas anymore
  1349. Revision 1.96 1999/02/17 14:20:40 pierre
  1350. * Reference specific bug in recompiling unit solved
  1351. Revision 1.95 1999/01/25 20:13:48 peter
  1352. * fixed crash with forward declared class of ...
  1353. Revision 1.94 1999/01/19 12:17:00 peter
  1354. * fixed constant strings > 255 chars
  1355. Revision 1.93 1999/01/15 13:08:23 peter
  1356. * error if upper<lower in array decl
  1357. Revision 1.92 1999/01/14 21:49:58 peter
  1358. * fixed forwardpointer problem with multiple forwards for the same
  1359. typesym. It now uses a linkedlist instead of a single pointer
  1360. Revision 1.91 1998/12/30 22:15:46 peter
  1361. + farpointer type
  1362. * absolutesym now also stores if its far
  1363. Revision 1.90 1998/12/15 17:16:00 peter
  1364. * fixed const s : ^string
  1365. * first things for const pchar : @string[1]
  1366. Revision 1.89 1998/12/11 00:03:30 peter
  1367. + globtype,tokens,version unit splitted from globals
  1368. Revision 1.88 1998/11/30 09:43:20 pierre
  1369. * some range check bugs fixed (still not working !)
  1370. + added DLL writing support for win32 (also accepts variables)
  1371. + TempAnsi for code that could be used for Temporary ansi strings
  1372. handling
  1373. Revision 1.87 1998/11/29 12:42:24 peter
  1374. * check for constants with array decl
  1375. Revision 1.86 1998/11/28 16:20:52 peter
  1376. + support for dll variables
  1377. Revision 1.85 1998/11/27 14:34:43 peter
  1378. * give error when string[0] decl is found
  1379. Revision 1.84 1998/11/17 10:40:15 peter
  1380. * H+ fixes
  1381. Revision 1.83 1998/11/16 11:28:59 pierre
  1382. * stackcheck removed for i386_win32
  1383. * exportlist does not crash at least !!
  1384. (was need for tests dir !)z
  1385. Revision 1.82 1998/11/16 10:18:07 peter
  1386. * fixes for ansistrings
  1387. Revision 1.81 1998/11/13 15:40:22 pierre
  1388. + added -Se in Makefile cvstest target
  1389. + lexlevel cleanup
  1390. normal_function_level main_program_level and unit_init_level defined
  1391. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  1392. (test added in code !)
  1393. * -Un option was wrong
  1394. * _FAIL and _SELF only keyword inside
  1395. constructors and methods respectively
  1396. Revision 1.80 1998/11/13 10:18:09 peter
  1397. + nil constants
  1398. Revision 1.79 1998/11/05 12:02:51 peter
  1399. * released useansistring
  1400. * removed -Sv, its now available in fpc modes
  1401. Revision 1.78 1998/10/27 13:45:33 pierre
  1402. * classes get a vmt allways
  1403. * better error info (tried to remove
  1404. several error strings introduced by the tpexcept handling)
  1405. Revision 1.77 1998/10/26 22:58:20 florian
  1406. * new introduded problem with classes fix, the parent class wasn't set
  1407. correct, if the class was defined forward before
  1408. Revision 1.76 1998/10/25 23:31:18 peter
  1409. * procvar parsing updated just like psub.pas routine
  1410. Revision 1.75 1998/10/21 08:39:59 florian
  1411. + ansistring operator +
  1412. + $h and string[n] for n>255 added
  1413. * small problem with TP fixed
  1414. Revision 1.74 1998/10/20 13:09:13 peter
  1415. * fixed object(unknown) crash
  1416. Revision 1.73 1998/10/19 08:54:56 pierre
  1417. * wrong stabs info corrected once again !!
  1418. + variable vmt offset with vmt field only if required
  1419. implemented now !!!
  1420. Revision 1.72 1998/10/16 13:12:51 pierre
  1421. * added vmt_offsets in destructors code also !!!
  1422. * vmt_offset code for m68k
  1423. Revision 1.71 1998/10/15 15:13:25 pierre
  1424. + added oo_hasconstructor and oo_hasdestructor
  1425. for objects options
  1426. Revision 1.70 1998/10/13 13:10:22 peter
  1427. * new style for m68k/i386 infos and enums
  1428. Revision 1.69 1998/10/09 12:07:49 pierre
  1429. * typo error for propertyparas dispose corrected
  1430. Revision 1.68 1998/10/09 11:47:54 pierre
  1431. * still more memory leaks fixes !!
  1432. Revision 1.67 1998/10/08 13:48:46 peter
  1433. * fixed memory leaks for do nothing source
  1434. * fixed unit interdependency
  1435. Revision 1.66 1998/10/06 20:43:31 peter
  1436. * fixed set of bugs. like set of false..true set of #1..#255 and
  1437. set of #1..true which was allowed
  1438. Revision 1.65 1998/10/05 22:43:35 peter
  1439. * commited the wrong file :(
  1440. Revision 1.64 1998/10/05 21:33:24 peter
  1441. * fixed 161,165,166,167,168
  1442. Revision 1.63 1998/10/05 13:57:13 peter
  1443. * crash preventions
  1444. Revision 1.62 1998/10/02 17:06:02 peter
  1445. * better error message for unresolved forward types
  1446. Revision 1.61 1998/10/02 09:23:24 peter
  1447. * fixed error msg with type l=<var>
  1448. * block_type bt_const is now set in read_const_dec
  1449. Revision 1.60 1998/09/30 07:40:33 florian
  1450. * better error recovering
  1451. Revision 1.59 1998/09/26 17:45:33 peter
  1452. + idtoken and only one token table
  1453. Revision 1.58 1998/09/25 00:04:01 florian
  1454. * problems when calling class methods fixed
  1455. Revision 1.57 1998/09/24 23:49:09 peter
  1456. + aktmodeswitches
  1457. Revision 1.56 1998/09/23 15:39:09 pierre
  1458. * browser bugfixes
  1459. was adding a reference when looking for the symbol
  1460. if -bSYM_NAME was used
  1461. Revision 1.55 1998/09/21 13:24:44 daniel
  1462. * Memory leak fixed.
  1463. Revision 1.54 1998/09/17 13:41:16 pierre
  1464. sizeof(TPOINT) problem
  1465. Revision 1.53.2.1 1998/09/17 13:12:09 pierre
  1466. * virtual destructor did not set oo_hasvirtual
  1467. (detected with the sizeof(TPoint) problem
  1468. * genloadcallnode was missing
  1469. Revision 1.53 1998/09/09 11:50:52 pierre
  1470. * forward def are not put in record or objects
  1471. + added check for forwards also in record and objects
  1472. * dummy parasymtable for unit initialization removed from
  1473. symtable stack
  1474. Revision 1.52 1998/09/07 23:10:22 florian
  1475. * a lot of stuff fixed regarding rtti and publishing of properties,
  1476. basics should now work
  1477. Revision 1.51 1998/09/07 19:33:22 florian
  1478. + some stuff for property rtti added:
  1479. - NameIndex of the TPropInfo record is now written correctly
  1480. - the DEFAULT/NODEFAULT keyword is supported now
  1481. - the default value and the storedsym/def are now written to
  1482. the PPU fiel
  1483. Revision 1.50 1998/09/07 18:46:08 peter
  1484. * update smartlinking, uses getdatalabel
  1485. * renamed ptree.value vars to value_str,value_real,value_set
  1486. Revision 1.49 1998/09/07 17:37:00 florian
  1487. * first fixes for published properties
  1488. Revision 1.48 1998/09/04 08:42:02 peter
  1489. * updated some error messages
  1490. Revision 1.47 1998/09/03 16:03:18 florian
  1491. + rtti generation
  1492. * init table generation changed
  1493. Revision 1.46 1998/09/01 17:39:48 peter
  1494. + internal constant functions
  1495. Revision 1.45 1998/08/31 12:20:28 peter
  1496. * fixed array_dec when unknown type was used
  1497. Revision 1.44 1998/08/28 10:57:01 peter
  1498. * removed warnings
  1499. Revision 1.43 1998/08/25 13:09:25 pierre
  1500. * corrected mangling sheme :
  1501. cvar add Cprefix to the mixed case name whereas
  1502. export or public use direct name
  1503. Revision 1.42 1998/08/25 12:42:41 pierre
  1504. * CDECL changed to CVAR for variables
  1505. specifications are read in structures also
  1506. + started adding GPC compatibility mode ( option -Sp)
  1507. * names changed to lowercase
  1508. Revision 1.41 1998/08/23 21:04:36 florian
  1509. + rtti generation for classes added
  1510. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  1511. Revision 1.40 1998/08/21 15:48:58 pierre
  1512. * more cdecl chagnes
  1513. - better line info
  1514. - changes the definition options of a procvar
  1515. if it is a unnamed type
  1516. Revision 1.39 1998/08/19 00:42:40 peter
  1517. + subrange types for enums
  1518. + checking for bounds type with ranges
  1519. Revision 1.38 1998/08/12 19:20:39 peter
  1520. + public is the same as export for c_vars
  1521. * a exported/public c_var incs now the refcount
  1522. Revision 1.37 1998/08/11 15:31:38 peter
  1523. * write extended to ppu file
  1524. * new version 0.99.7
  1525. Revision 1.36 1998/08/10 14:50:09 peter
  1526. + localswitches, moduleswitches, globalswitches splitting
  1527. Revision 1.35 1998/07/26 21:59:00 florian
  1528. + better support for switch $H
  1529. + index access to ansi strings added
  1530. + assigment of data (records/arrays) containing ansi strings
  1531. Revision 1.34 1998/07/20 22:17:15 florian
  1532. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1533. * there was a bug in record_var_dec which prevents the used
  1534. of nested variant records (for example drivers.tevent of tv)
  1535. Revision 1.33 1998/07/18 17:11:11 florian
  1536. + ansi string constants fixed
  1537. + switch $H partial implemented
  1538. Revision 1.32 1998/07/14 21:46:50 peter
  1539. * updated messages file
  1540. Revision 1.31 1998/07/14 14:46:53 peter
  1541. * released NEWINPUT
  1542. Revision 1.30 1998/07/10 00:00:00 peter
  1543. * fixed ttypesym bug finally
  1544. * fileinfo in the symtable and better using for unused vars
  1545. Revision 1.29 1998/06/25 14:04:21 peter
  1546. + internal inc/dec
  1547. Revision 1.28 1998/06/24 12:26:45 peter
  1548. * stricter var parsing like tp7 and some optimizes with directive
  1549. parsing
  1550. Revision 1.27 1998/06/12 16:15:34 pierre
  1551. * external name 'C_var';
  1552. export name 'intern_C_var';
  1553. cdecl;
  1554. cdecl;external;
  1555. are now supported only with -Sv switch
  1556. Revision 1.25 1998/06/09 16:01:45 pierre
  1557. + added procedure directive parsing for procvars
  1558. (accepted are popstack cdecl and pascal)
  1559. + added C vars with the following syntax
  1560. var C calias 'true_c_name';(can be followed by external)
  1561. reason is that you must add the Cprefix
  1562. which is target dependent
  1563. Revision 1.24 1998/06/05 14:37:32 pierre
  1564. * fixes for inline for operators
  1565. * inline procedure more correctly restricted
  1566. Revision 1.23 1998/06/04 23:51:50 peter
  1567. * m68k compiles
  1568. + .def file creation moved to gendef.pas so it could also be used
  1569. for win32
  1570. Revision 1.22 1998/06/03 22:48:59 peter
  1571. + wordbool,longbool
  1572. * rename bis,von -> high,low
  1573. * moved some systemunit loading/creating to psystem.pas
  1574. Revision 1.21 1998/06/03 22:14:19 florian
  1575. * problem with sizes of classes fixed (if the anchestor was declared
  1576. forward, the compiler doesn't update the child classes size)
  1577. Revision 1.20 1998/05/28 14:35:54 peter
  1578. * nicer error message when no id is used after var
  1579. Revision 1.19 1998/05/23 01:21:19 peter
  1580. + aktasmmode, aktoptprocessor, aktoutputformat
  1581. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1582. + $LIBNAME to set the library name where the unit will be put in
  1583. * splitted cgi386 a bit (codeseg to large for bp7)
  1584. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1585. Revision 1.18 1998/05/20 09:42:35 pierre
  1586. + UseTokenInfo now default
  1587. * unit in interface uses and implementation uses gives error now
  1588. * only one error for unknown symbol (uses lastsymknown boolean)
  1589. the problem came from the label code !
  1590. + first inlined procedures and function work
  1591. (warning there might be allowed cases were the result is still wrong !!)
  1592. * UseBrower updated gives a global list of all position of all used symbols
  1593. with switch -gb
  1594. Revision 1.17 1998/05/11 13:07:55 peter
  1595. + $ifdef NEWPPU for the new ppuformat
  1596. + $define GDB not longer required
  1597. * removed all warnings and stripped some log comments
  1598. * no findfirst/findnext anymore to remove smartlink *.o files
  1599. Revision 1.16 1998/05/05 12:05:42 florian
  1600. * problems with properties fixed
  1601. * crash fixed: i:=l when i and l are undefined, was a problem with
  1602. implementation of private/protected
  1603. Revision 1.15 1998/05/01 09:01:23 florian
  1604. + correct semantics of private and protected
  1605. * small fix in variable scope:
  1606. a id can be used in a parameter list of a method, even it is used in
  1607. an anchestor class as field id
  1608. Revision 1.14 1998/05/01 07:43:56 florian
  1609. + basics for rtti implemented
  1610. + switch $m (generate rtti for published sections)
  1611. Revision 1.13 1998/04/30 15:59:41 pierre
  1612. * GDB works again better :
  1613. correct type info in one pass
  1614. + UseTokenInfo for better source position
  1615. * fixed one remaining bug in scanner for line counts
  1616. * several little fixes
  1617. Revision 1.12 1998/04/29 10:33:57 pierre
  1618. + added some code for ansistring (not complete nor working yet)
  1619. * corrected operator overloading
  1620. * corrected nasm output
  1621. + started inline procedures
  1622. + added starstarn : use ** for exponentiation (^ gave problems)
  1623. + started UseTokenInfo cond to get accurate positions
  1624. Revision 1.11 1998/04/28 11:45:52 florian
  1625. * make it compilable with TP
  1626. + small COM problems solved to compile classes.pp
  1627. Revision 1.10 1998/04/27 23:10:28 peter
  1628. + new scanner
  1629. * $makelib -> if smartlink
  1630. * small filename fixes pmodule.setfilename
  1631. * moved import from files.pas -> import.pas
  1632. Revision 1.9 1998/04/10 21:36:56 florian
  1633. + some stuff to support method pointers (procedure of object) added
  1634. (declaration, parameter handling)
  1635. Revision 1.8 1998/04/10 15:39:48 florian
  1636. * more fixes to get classes.pas compiled
  1637. Revision 1.7 1998/04/09 23:02:15 florian
  1638. * small problems solved to get remake3 work
  1639. Revision 1.6 1998/04/09 22:16:35 florian
  1640. * problem with previous REGALLOC solved
  1641. * improved property support
  1642. Revision 1.5 1998/04/08 14:59:20 florian
  1643. * problem with new expr_type solved
  1644. Revision 1.4 1998/04/08 10:26:09 florian
  1645. * correct error handling of virtual constructors
  1646. * problem with new type declaration handling fixed
  1647. Revision 1.3 1998/04/07 22:45:05 florian
  1648. * bug0092, bug0115 and bug0121 fixed
  1649. + packed object/class/array
  1650. Revision 1.2 1998/04/05 13:58:35 peter
  1651. * fixed the -Ss bug
  1652. + warning for Virtual constructors
  1653. * helppages updated with -TGO32V1
  1654. }