pdecl.pas 117 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151
  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. globtype,tokens,globals,symtable;
  22. var
  23. { pointer to the last read type symbol, (for "forward" }
  24. { types) }
  25. lasttypesym : ptypesym;
  26. readtypesym : ptypesym; { ttypesym read by read_type }
  27. { hack, which allows to use the current parsed }
  28. { object type as function argument type }
  29. testcurobject : byte;
  30. curobjectname : stringid;
  31. { reads a string type with optional length }
  32. { and returns a pointer to the string }
  33. { definition }
  34. function stringtype : pdef;
  35. { reads a string, file type or a type id and returns a name and }
  36. { pdef }
  37. function single_type(var s : string) : pdef;
  38. { reads the declaration blocks }
  39. procedure read_declarations(islibrary : boolean);
  40. { reads declarations in the interface part of a unit }
  41. procedure read_interface_declarations;
  42. implementation
  43. uses
  44. cobjects,scanner,
  45. symconst,aasm,tree,pass_1,strings,
  46. files,types,verbose,systems,import,
  47. cpubase
  48. {$ifndef newcg}
  49. ,tccnv
  50. {$endif newcg}
  51. {$ifdef GDB}
  52. ,gdb
  53. {$endif GDB}
  54. { parser specific stuff }
  55. ,pbase,ptconst,pexpr,psub,pexports
  56. { processor specific stuff }
  57. { codegen }
  58. ,hcodegen,hcgdata
  59. ;
  60. function read_type(const name : stringid) : pdef;forward;
  61. { search in symtablestack used, but not defined type }
  62. procedure testforward_type(p : pnamedindexobject);{$ifndef FPC}far;{$endif}
  63. var
  64. reaktvarsymtable : psymtable;
  65. oldaktfilepos : tfileposinfo;
  66. begin
  67. if not(psym(p)^.typ=typesym) then
  68. exit;
  69. if (sp_forwarddef in psym(p)^.symoptions) then
  70. begin
  71. oldaktfilepos:=aktfilepos;
  72. aktfilepos:=psym(p)^.fileinfo;
  73. Message1(sym_e_forward_type_not_resolved,p^.name);
  74. aktfilepos:=oldaktfilepos;
  75. { try to recover }
  76. ptypesym(p)^.definition:=generrordef;
  77. {$ifdef INCLUDEOK}
  78. exclude(psym(p)^.symoptions,sp_forwarddef);
  79. {$else}
  80. psym(p)^.symoptions:=psym(p)^.symoptions-[sp_forwarddef];
  81. {$endif}
  82. end
  83. else
  84. if (ptypesym(p)^.definition^.deftype in [recorddef,objectdef]) then
  85. begin
  86. if (ptypesym(p)^.definition^.deftype=recorddef) then
  87. reaktvarsymtable:=precorddef(ptypesym(p)^.definition)^.symtable
  88. else
  89. reaktvarsymtable:=pobjectdef(ptypesym(p)^.definition)^.symtable;
  90. reaktvarsymtable^.foreach({$ifndef TP}@{$endif}testforward_type);
  91. end;
  92. end;
  93. procedure const_dec;
  94. var
  95. name : stringid;
  96. p : ptree;
  97. def : pdef;
  98. sym : psym;
  99. storetokenpos,filepos : tfileposinfo;
  100. old_block_type : tblock_type;
  101. ps : pconstset;
  102. pd : pbestreal;
  103. sp : pchar;
  104. begin
  105. consume(_CONST);
  106. old_block_type:=block_type;
  107. block_type:=bt_const;
  108. repeat
  109. name:=pattern;
  110. filepos:=tokenpos;
  111. consume(_ID);
  112. case token of
  113. _EQUAL:
  114. begin
  115. consume(_EQUAL);
  116. p:=comp_expr(true);
  117. do_firstpass(p);
  118. storetokenpos:=tokenpos;
  119. tokenpos:=filepos;
  120. case p^.treetype of
  121. ordconstn:
  122. begin
  123. if is_constintnode(p) then
  124. symtablestack^.insert(new(pconstsym,init_def(name,constint,p^.value,nil)))
  125. else if is_constcharnode(p) then
  126. symtablestack^.insert(new(pconstsym,init_def(name,constchar,p^.value,nil)))
  127. else if is_constboolnode(p) then
  128. symtablestack^.insert(new(pconstsym,init_def(name,constbool,p^.value,nil)))
  129. else if p^.resulttype^.deftype=enumdef then
  130. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  131. else if p^.resulttype^.deftype=pointerdef then
  132. symtablestack^.insert(new(pconstsym,init_def(name,constord,p^.value,p^.resulttype)))
  133. else internalerror(111);
  134. end;
  135. stringconstn:
  136. begin
  137. getmem(sp,p^.length+1);
  138. move(p^.value_str^,sp^,p^.length+1);
  139. symtablestack^.insert(new(pconstsym,init_string(name,conststring,sp,p^.length)));
  140. end;
  141. realconstn :
  142. begin
  143. new(pd);
  144. pd^:=p^.value_real;
  145. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd))));
  146. end;
  147. setconstn :
  148. begin
  149. new(ps);
  150. ps^:=p^.value_set^;
  151. symtablestack^.insert(new(pconstsym,init_def(name,constset,longint(ps),p^.resulttype)));
  152. end;
  153. niln :
  154. begin
  155. symtablestack^.insert(new(pconstsym,init_def(name,constnil,0,p^.resulttype)));
  156. end;
  157. else
  158. Message(cg_e_illegal_expression);
  159. end;
  160. tokenpos:=storetokenpos;
  161. consume(_SEMICOLON);
  162. disposetree(p);
  163. end;
  164. _COLON:
  165. begin
  166. { set the blocktype first so a consume also supports a
  167. caret, to support const s : ^string = nil }
  168. block_type:=bt_type;
  169. consume(_COLON);
  170. ignore_equal:=true;
  171. def:=read_type('');
  172. ignore_equal:=false;
  173. block_type:=bt_const;
  174. storetokenpos:=tokenpos;
  175. tokenpos:=filepos;
  176. {$ifdef DELPHI_CONST_IN_RODATA}
  177. if m_delphi in aktmodeswitches then
  178. begin
  179. if assigned(readtypesym) then
  180. sym:=new(ptypedconstsym,initsym(name,readtypesym,true))
  181. else
  182. sym:=new(ptypedconstsym,init(name,def,true))
  183. end
  184. else
  185. {$endif DELPHI_CONST_IN_RODATA}
  186. begin
  187. if assigned(readtypesym) then
  188. sym:=new(ptypedconstsym,initsym(name,readtypesym,false))
  189. else
  190. sym:=new(ptypedconstsym,init(name,def,false))
  191. end;
  192. tokenpos:=storetokenpos;
  193. symtablestack^.insert(sym);
  194. consume(_EQUAL);
  195. {$ifdef DELPHI_CONST_IN_RODATA}
  196. if m_delphi in aktmodeswitches then
  197. readtypedconst(def,ptypedconstsym(sym),true)
  198. else
  199. {$endif DELPHI_CONST_IN_RODATA}
  200. readtypedconst(def,ptypedconstsym(sym),false);
  201. consume(_SEMICOLON);
  202. end;
  203. else consume(_EQUAL);
  204. end;
  205. until token<>_ID;
  206. block_type:=old_block_type;
  207. end;
  208. procedure label_dec;
  209. var
  210. hl : pasmlabel;
  211. begin
  212. consume(_LABEL);
  213. if not(cs_support_goto in aktmoduleswitches) then
  214. Message(sym_e_goto_and_label_not_supported);
  215. repeat
  216. if not(token in [_ID,_INTCONST]) then
  217. consume(_ID)
  218. else
  219. begin
  220. getlabel(hl);
  221. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  222. consume(token);
  223. end;
  224. if token<>_SEMICOLON then consume(_COMMA);
  225. until not(token in [_ID,_INTCONST]);
  226. consume(_SEMICOLON);
  227. end;
  228. const
  229. variantrecordlevel : longint = 0;
  230. procedure read_var_decs(is_record,is_object,is_threadvar:boolean);
  231. { reads the filed of a record into a }
  232. { symtablestack, if record=false }
  233. { variants are forbidden, so this procedure }
  234. { can be used to read object fields }
  235. { if absolute is true, ABSOLUTE and file }
  236. { types are allowed }
  237. { => the procedure is also used to read }
  238. { a sequence of variable declaration }
  239. procedure insert_syms(st : psymtable;sc : pstringcontainer;def : pdef;sym:ptypesym;is_threadvar : boolean);
  240. { inserts the symbols of sc in st with def as definition or sym as ptypesym, sc is disposed }
  241. var
  242. s : string;
  243. filepos : tfileposinfo;
  244. ss : pvarsym;
  245. begin
  246. { can't have a definition and ttypesym }
  247. if assigned(def) and assigned(sym) then
  248. internalerror(5438257);
  249. filepos:=tokenpos;
  250. while not sc^.empty do
  251. begin
  252. s:=sc^.get_with_tokeninfo(tokenpos);
  253. if assigned(sym) then
  254. ss:=new(pvarsym,initsym(s,sym))
  255. else
  256. ss:=new(pvarsym,init(s,def));
  257. if is_threadvar then
  258. {$ifdef INCLUDEOK}
  259. include(ss^.varoptions,vo_is_thread_var);
  260. {$else}
  261. ss^.varoptions:=ss^.varoptions+[vo_is_thread_var];
  262. {$endif}
  263. st^.insert(ss);
  264. { static data fields are inserted in the globalsymtable }
  265. if (st^.symtabletype=objectsymtable) and
  266. (sp_static in current_object_option) then
  267. begin
  268. s:=lower(st^.name^)+'_'+s;
  269. st^.defowner^.owner^.insert(new(pvarsym,init(s,def)));
  270. end;
  271. end;
  272. dispose(sc,done);
  273. tokenpos:=filepos;
  274. end;
  275. var
  276. sc : pstringcontainer;
  277. s : stringid;
  278. old_block_type : tblock_type;
  279. declarepos,storetokenpos : tfileposinfo;
  280. symdone : boolean;
  281. { to handle absolute }
  282. abssym : pabsolutesym;
  283. l : longint;
  284. code : integer;
  285. { c var }
  286. newtype : ptypesym;
  287. is_dll,
  288. is_gpc_name,is_cdecl,extern_aktvarsym,export_aktvarsym : boolean;
  289. dll_name,
  290. C_name : string;
  291. { case }
  292. p,casedef : pdef;
  293. { Delphi initialized vars }
  294. pconstsym : ptypedconstsym;
  295. { maxsize contains the max. size of a variant }
  296. { startvarrec contains the start of the variant part of a record }
  297. maxsize,startvarrec : longint;
  298. pt : ptree;
  299. begin
  300. old_block_type:=block_type;
  301. block_type:=bt_type;
  302. is_gpc_name:=false;
  303. { Force an expected ID error message }
  304. if not (token in [_ID,_CASE,_END]) then
  305. consume(_ID);
  306. { read vars }
  307. while (token=_ID) and
  308. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  309. begin
  310. C_name:=orgpattern;
  311. sc:=idlist;
  312. consume(_COLON);
  313. if (m_gpc in aktmodeswitches) and
  314. not(is_record or is_object or is_threadvar) and
  315. (token=_ID) and (orgpattern='__asmname__') then
  316. begin
  317. consume(_ID);
  318. C_name:=pattern;
  319. if token=_CCHAR then
  320. consume(_CCHAR)
  321. else
  322. consume(_CSTRING);
  323. Is_gpc_name:=true;
  324. end;
  325. { this is needed for Delphi mode at least
  326. but should be OK for all modes !! (PM) }
  327. ignore_equal:=true;
  328. p:=read_type('');
  329. if (variantrecordlevel>0) and p^.needs_inittable then
  330. Message(parser_e_cant_use_inittable_here);
  331. ignore_equal:=false;
  332. symdone:=false;
  333. if is_gpc_name then
  334. begin
  335. storetokenpos:=tokenpos;
  336. s:=sc^.get_with_tokeninfo(tokenpos);
  337. if not sc^.empty then
  338. Message(parser_e_absolute_only_one_var);
  339. dispose(sc,done);
  340. aktvarsym:=new(pvarsym,init_C(s,target_os.Cprefix+C_name,p));
  341. {$ifdef INCLUDEOK}
  342. include(aktvarsym^.varoptions,vo_is_external);
  343. {$else}
  344. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  345. {$endif}
  346. symtablestack^.insert(aktvarsym);
  347. tokenpos:=storetokenpos;
  348. symdone:=true;
  349. end;
  350. { check for absolute }
  351. if not symdone and
  352. (idtoken=_ABSOLUTE) and not(is_record or is_object or is_threadvar) then
  353. begin
  354. consume(_ABSOLUTE);
  355. { only allowed for one var }
  356. s:=sc^.get_with_tokeninfo(declarepos);
  357. if not sc^.empty then
  358. Message(parser_e_absolute_only_one_var);
  359. dispose(sc,done);
  360. { parse the rest }
  361. if token=_ID then
  362. begin
  363. getsym(pattern,true);
  364. consume(_ID);
  365. { we should check the result type of srsym }
  366. if not (srsym^.typ in [varsym,typedconstsym]) then
  367. Message(parser_e_absolute_only_to_var_or_const);
  368. storetokenpos:=tokenpos;
  369. tokenpos:=declarepos;
  370. abssym:=new(pabsolutesym,init(s,p));
  371. abssym^.abstyp:=tovar;
  372. abssym^.ref:=srsym;
  373. symtablestack^.insert(abssym);
  374. tokenpos:=storetokenpos;
  375. end
  376. else
  377. if (token=_CSTRING) or (token=_CCHAR) then
  378. begin
  379. storetokenpos:=tokenpos;
  380. tokenpos:=declarepos;
  381. abssym:=new(pabsolutesym,init(s,p));
  382. s:=pattern;
  383. consume(token);
  384. abssym^.abstyp:=toasm;
  385. abssym^.asmname:=stringdup(s);
  386. symtablestack^.insert(abssym);
  387. tokenpos:=storetokenpos;
  388. end
  389. else
  390. { absolute address ?!? }
  391. if token=_INTCONST then
  392. begin
  393. if (target_info.target=target_i386_go32v2) then
  394. begin
  395. storetokenpos:=tokenpos;
  396. tokenpos:=declarepos;
  397. abssym:=new(pabsolutesym,init(s,p));
  398. abssym^.abstyp:=toaddr;
  399. abssym^.absseg:=false;
  400. s:=pattern;
  401. consume(_INTCONST);
  402. val(s,abssym^.address,code);
  403. if token=_COLON then
  404. begin
  405. consume(token);
  406. s:=pattern;
  407. consume(_INTCONST);
  408. val(s,l,code);
  409. abssym^.address:=abssym^.address shl 4+l;
  410. abssym^.absseg:=true;
  411. end;
  412. symtablestack^.insert(abssym);
  413. tokenpos:=storetokenpos;
  414. end
  415. else
  416. Message(parser_e_absolute_only_to_var_or_const);
  417. end
  418. else
  419. Message(parser_e_absolute_only_to_var_or_const);
  420. symdone:=true;
  421. end;
  422. { Handling of Delphi typed const = initialized vars ! }
  423. { When should this be rejected ?
  424. - in parasymtable
  425. - in record or object
  426. - ... (PM) }
  427. if (m_delphi in aktmodeswitches) and (token=_EQUAL) and
  428. not (symtablestack^.symtabletype in [parasymtable]) and
  429. not is_record and not is_object then
  430. begin
  431. storetokenpos:=tokenpos;
  432. s:=sc^.get_with_tokeninfo(tokenpos);
  433. if not sc^.empty then
  434. Message(parser_e_initialized_only_one_var);
  435. if assigned(readtypesym) then
  436. pconstsym:=new(ptypedconstsym,initsym(s,readtypesym,false))
  437. else
  438. pconstsym:=new(ptypedconstsym,init(s,p,false));
  439. symtablestack^.insert(pconstsym);
  440. tokenpos:=storetokenpos;
  441. consume(_EQUAL);
  442. readtypedconst(p,pconstsym,false);
  443. symdone:=true;
  444. end;
  445. { for a record there doesn't need to be a ; before the END or ) }
  446. if not((is_record or is_object) and (token in [_END,_RKLAMMER])) then
  447. consume(_SEMICOLON);
  448. { procvar handling }
  449. if (p^.deftype=procvardef) and (p^.sym=nil) then
  450. begin
  451. newtype:=new(ptypesym,init('unnamed',p));
  452. parse_var_proc_directives(newtype);
  453. newtype^.definition:=nil;
  454. p^.sym:=nil;
  455. dispose(newtype,done);
  456. end;
  457. { Check for variable directives }
  458. if not symdone and (token=_ID) then
  459. begin
  460. { Check for C Variable declarations }
  461. if (m_cvar_support in aktmodeswitches) and
  462. not(is_record or is_object or is_threadvar) and
  463. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  464. begin
  465. { only allowed for one var }
  466. s:=sc^.get_with_tokeninfo(declarepos);
  467. if not sc^.empty then
  468. Message(parser_e_absolute_only_one_var);
  469. dispose(sc,done);
  470. { defaults }
  471. is_dll:=false;
  472. is_cdecl:=false;
  473. extern_aktvarsym:=false;
  474. export_aktvarsym:=false;
  475. { cdecl }
  476. if idtoken=_CVAR then
  477. begin
  478. consume(_CVAR);
  479. consume(_SEMICOLON);
  480. is_cdecl:=true;
  481. C_name:=target_os.Cprefix+C_name;
  482. end;
  483. { external }
  484. if idtoken=_EXTERNAL then
  485. begin
  486. consume(_EXTERNAL);
  487. extern_aktvarsym:=true;
  488. end;
  489. { export }
  490. if idtoken in [_EXPORT,_PUBLIC] then
  491. begin
  492. consume(_ID);
  493. if extern_aktvarsym then
  494. Message(parser_e_not_external_and_export)
  495. else
  496. export_aktvarsym:=true;
  497. end;
  498. { external and export need a name after when no cdecl is used }
  499. if not is_cdecl then
  500. begin
  501. { dll name ? }
  502. if (extern_aktvarsym) and (idtoken<>_NAME) then
  503. begin
  504. is_dll:=true;
  505. dll_name:=get_stringconst;
  506. end;
  507. consume(_NAME);
  508. C_name:=get_stringconst;
  509. end;
  510. { consume the ; when export or external is used }
  511. if extern_aktvarsym or export_aktvarsym then
  512. consume(_SEMICOLON);
  513. { insert in the symtable }
  514. storetokenpos:=tokenpos;
  515. tokenpos:=declarepos;
  516. if is_dll then
  517. begin
  518. if assigned(readtypesym) then
  519. aktvarsym:=new(pvarsym,initsym_dll(s,readtypesym))
  520. else
  521. aktvarsym:=new(pvarsym,init_dll(s,p))
  522. end
  523. else
  524. begin
  525. if assigned(readtypesym) then
  526. aktvarsym:=new(pvarsym,initsym_C(s,C_name,readtypesym))
  527. else
  528. aktvarsym:=new(pvarsym,init_C(s,C_name,p));
  529. end;
  530. { set some vars options }
  531. if export_aktvarsym then
  532. inc(aktvarsym^.refs);
  533. if extern_aktvarsym then
  534. {$ifdef INCLUDEOK}
  535. include(aktvarsym^.varoptions,vo_is_external);
  536. {$else}
  537. aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_external];
  538. {$endif}
  539. { insert in the stack/datasegment }
  540. symtablestack^.insert(aktvarsym);
  541. tokenpos:=storetokenpos;
  542. { now we can insert it in the import lib if its a dll, or
  543. add it to the externals }
  544. if extern_aktvarsym then
  545. begin
  546. if is_dll then
  547. begin
  548. if not(current_module^.uses_imports) then
  549. begin
  550. current_module^.uses_imports:=true;
  551. importlib^.preparelib(current_module^.modulename^);
  552. end;
  553. importlib^.importvariable(aktvarsym^.mangledname,dll_name,C_name)
  554. end
  555. end;
  556. symdone:=true;
  557. end
  558. else
  559. if (is_object) and (cs_static_keyword in aktmoduleswitches) and (idtoken=_STATIC) then
  560. begin
  561. {$ifdef INCLUDEOK}
  562. include(current_object_option,sp_static);
  563. {$else}
  564. current_object_option:=current_object_option+[sp_static];
  565. {$endif}
  566. if assigned(readtypesym) then
  567. insert_syms(symtablestack,sc,nil,readtypesym,false)
  568. else
  569. insert_syms(symtablestack,sc,p,nil,false);
  570. {$ifdef INCLUDEOK}
  571. exclude(current_object_option,sp_static);
  572. {$else}
  573. current_object_option:=current_object_option-[sp_static];
  574. {$endif}
  575. consume(_STATIC);
  576. consume(_SEMICOLON);
  577. symdone:=true;
  578. end;
  579. end;
  580. { insert it in the symtable, if not done yet }
  581. if not symdone then
  582. begin
  583. if (sp_published in current_object_option) and
  584. (not((p^.deftype=objectdef) and (pobjectdef(p)^.is_class))) then
  585. Message(parser_e_cant_publish_that);
  586. if assigned(readtypesym) then
  587. insert_syms(symtablestack,sc,nil,readtypesym,is_threadvar)
  588. else
  589. insert_syms(symtablestack,sc,p,nil,is_threadvar);
  590. end;
  591. end;
  592. { Check for Case }
  593. if is_record and (token=_CASE) then
  594. begin
  595. maxsize:=0;
  596. consume(_CASE);
  597. s:=pattern;
  598. getsym(s,false);
  599. { may be only a type: }
  600. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  601. casedef:=read_type('')
  602. else
  603. begin
  604. consume(_ID);
  605. consume(_COLON);
  606. casedef:=read_type('');
  607. symtablestack^.insert(new(pvarsym,init(s,casedef)));
  608. end;
  609. if not(is_ordinal(casedef)) or is_64bitint(casedef) then
  610. Message(type_e_ordinal_expr_expected);
  611. consume(_OF);
  612. startvarrec:=symtablestack^.datasize;
  613. repeat
  614. repeat
  615. pt:=comp_expr(true);
  616. do_firstpass(pt);
  617. if not(pt^.treetype=ordconstn) then
  618. Message(cg_e_illegal_expression);
  619. disposetree(pt);
  620. if token=_COMMA then
  621. consume(_COMMA)
  622. else
  623. break;
  624. until false;
  625. consume(_COLON);
  626. { read the vars }
  627. consume(_LKLAMMER);
  628. inc(variantrecordlevel);
  629. if token<>_RKLAMMER then
  630. read_var_decs(true,false,false);
  631. dec(variantrecordlevel);
  632. consume(_RKLAMMER);
  633. { calculates maximal variant size }
  634. maxsize:=max(maxsize,symtablestack^.datasize);
  635. { the items of the next variant are overlayed }
  636. symtablestack^.datasize:=startvarrec;
  637. if (token<>_END) and (token<>_RKLAMMER) then
  638. consume(_SEMICOLON)
  639. else
  640. break;
  641. until (token=_END) or (token=_RKLAMMER);
  642. { at last set the record size to that of the biggest variant }
  643. symtablestack^.datasize:=maxsize;
  644. end;
  645. block_type:=old_block_type;
  646. end;
  647. function stringtype : pdef;
  648. { reads a string type with optional length }
  649. { and returns a pointer to the string }
  650. { definition }
  651. var
  652. p : ptree;
  653. d : pdef;
  654. begin
  655. consume(_STRING);
  656. if token=_LECKKLAMMER then
  657. begin
  658. consume(_LECKKLAMMER);
  659. p:=comp_expr(true);
  660. do_firstpass(p);
  661. if not is_constintnode(p) then
  662. Message(cg_e_illegal_expression);
  663. if (p^.value<=0) then
  664. begin
  665. Message(parser_e_invalid_string_size);
  666. p^.value:=255;
  667. end;
  668. consume(_RECKKLAMMER);
  669. if p^.value>255 then
  670. d:=new(pstringdef,longinit(p^.value))
  671. else
  672. if p^.value<>255 then
  673. d:=new(pstringdef,shortinit(p^.value))
  674. else
  675. d:=cshortstringdef;
  676. disposetree(p);
  677. end
  678. else
  679. begin
  680. if cs_ansistrings in aktlocalswitches then
  681. d:=cansistringdef
  682. else
  683. d:=cshortstringdef;
  684. end;
  685. stringtype:=d;
  686. end;
  687. function id_type(var s : string) : pdef;
  688. { reads a type definition and returns a pointer }
  689. { to a appropriating pdef, s gets the name of }
  690. { the type to allow name mangling }
  691. begin
  692. s:=pattern;
  693. consume(_ID);
  694. { classes can be used also in classes }
  695. if (curobjectname=pattern) and aktobjectdef^.is_class then
  696. begin
  697. id_type:=aktobjectdef;
  698. exit;
  699. end;
  700. { objects can be parameters }
  701. if (testcurobject=2) and (curobjectname=pattern) then
  702. begin
  703. id_type:=aktobjectdef;
  704. exit;
  705. end;
  706. getsym(s,true);
  707. if assigned(srsym) then
  708. begin
  709. if srsym^.typ=unitsym then
  710. begin
  711. consume(_POINT);
  712. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  713. s:=pattern;
  714. consume(_ID);
  715. end;
  716. if not assigned(srsym) or
  717. (srsym^.typ<>typesym) then
  718. begin
  719. Message(type_e_type_id_expected);
  720. lasttypesym:=ptypesym(srsym);
  721. id_type:=generrordef;
  722. exit;
  723. end;
  724. if not forwardsallowed then
  725. testforward_type(srsym);
  726. end;
  727. lasttypesym:=ptypesym(srsym);
  728. if (ptypesym(srsym)^.owner^.unitid=0) or
  729. (ptypesym(srsym)^.owner^.unitid=1) then
  730. readtypesym:=nil
  731. else
  732. readtypesym:=ptypesym(srsym);
  733. id_type:=ptypesym(srsym)^.definition;
  734. end;
  735. function single_type(var s : string) : pdef;
  736. { reads a string, file type or a type id and returns a name and }
  737. { pdef }
  738. var
  739. hs : string;
  740. begin
  741. readtypesym:=nil;
  742. case token of
  743. _STRING:
  744. begin
  745. single_type:=stringtype;
  746. s:='STRING';
  747. lasttypesym:=nil;
  748. readtypesym:=nil;
  749. end;
  750. _FILE:
  751. begin
  752. consume(_FILE);
  753. if token=_OF then
  754. begin
  755. consume(_OF);
  756. single_type:=new(pfiledef,init(ft_typed,single_type(hs)));
  757. s:='FILE$OF$'+hs;
  758. end
  759. else
  760. begin
  761. { single_type:=new(pfiledef,init(ft_untyped,nil));}
  762. single_type:=cfiledef;
  763. s:='FILE';
  764. end;
  765. lasttypesym:=nil;
  766. readtypesym:=nil;
  767. end;
  768. else
  769. begin
  770. single_type:=id_type(s);
  771. end;
  772. end;
  773. end;
  774. function object_dec(const n : stringid;fd : pobjectdef) : pdef;
  775. { this function parses an object or class declaration }
  776. var
  777. actmembertype : tsymoptions;
  778. there_is_a_destructor : boolean;
  779. is_a_class : boolean;
  780. childof : pobjectdef;
  781. aktclass : pobjectdef;
  782. procedure constructor_head;
  783. begin
  784. consume(_CONSTRUCTOR);
  785. { must be at same level as in implementation }
  786. inc(lexlevel);
  787. parse_proc_head(potype_constructor);
  788. dec(lexlevel);
  789. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'INIT') then
  790. Message(parser_e_constructorname_must_be_init);
  791. {$ifdef INCLUDEOK}
  792. include(aktclass^.objectoptions,oo_has_constructor);
  793. {$else}
  794. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_constructor];
  795. {$endif}
  796. consume(_SEMICOLON);
  797. begin
  798. if (aktclass^.is_class) then
  799. begin
  800. { CLASS constructors return the created instance }
  801. aktprocsym^.definition^.retdef:=aktclass;
  802. end
  803. else
  804. begin
  805. { OBJECT constructors return a boolean }
  806. {$IfDef GDB}
  807. {GDB doesn't like unnamed types !}
  808. aktprocsym^.definition^.retdef:=
  809. globaldef('boolean');
  810. {$Else GDB}
  811. aktprocsym^.definition^.retdef:=
  812. new(porddef,init(bool8bit,0,1));
  813. {$Endif GDB}
  814. end;
  815. end;
  816. end;
  817. procedure property_dec;
  818. var
  819. sym : psym;
  820. propertyparas : pdefcoll;
  821. { returns the matching procedure to access a property }
  822. function get_procdef : pprocdef;
  823. var
  824. p : pprocdef;
  825. begin
  826. p:=pprocsym(sym)^.definition;
  827. get_procdef:=nil;
  828. while assigned(p) do
  829. begin
  830. if equal_paras(p^.para1,propertyparas,true) then
  831. break;
  832. p:=p^.nextoverloaded;
  833. end;
  834. get_procdef:=p;
  835. end;
  836. procedure deletepropsymlist(p : ppropsymlist);
  837. var
  838. hp : ppropsymlist;
  839. begin
  840. while assigned(p) do
  841. begin
  842. hp:=p;
  843. p:=p^.next;
  844. dispose(hp);
  845. end;
  846. end;
  847. procedure addpropsymlist(var root:ppropsymlist;s:psym);
  848. var
  849. last,hp : ppropsymlist;
  850. begin
  851. if not assigned(s) then
  852. exit;
  853. last:=root;
  854. new(hp);
  855. hp^.sym:=s;
  856. hp^.next:=nil;
  857. if assigned(last) then
  858. begin
  859. while assigned(last^.next) do
  860. last:=last^.next;
  861. last^.next:=hp;
  862. end
  863. else
  864. root:=hp;
  865. end;
  866. function copypropsymlist(s:ppropsymlist):ppropsymlist;
  867. var
  868. root,last,hp : ppropsymlist;
  869. begin
  870. copypropsymlist:=nil;
  871. if not assigned(s) then
  872. exit;
  873. last:=nil;
  874. root:=nil;
  875. while assigned(s) do
  876. begin
  877. new(hp);
  878. hp^.sym:=s^.sym;
  879. hp^.next:=nil;
  880. if assigned(last) then
  881. last^.next:=hp;
  882. last:=hp;
  883. if not assigned(root) then
  884. root:=hp;
  885. s:=s^.next;
  886. end;
  887. copypropsymlist:=root;
  888. end;
  889. var
  890. hp2,datacoll : pdefcoll;
  891. p,p2 : ppropertysym;
  892. overriden : psym;
  893. hs : string;
  894. code : integer;
  895. varspez : tvarspez;
  896. sc : pstringcontainer;
  897. hp : pdef;
  898. s : string;
  899. declarepos : tfileposinfo;
  900. pp : pprocdef;
  901. pt : ptree;
  902. propname : stringid;
  903. begin
  904. { check for a class }
  905. if not(aktclass^.is_class) then
  906. Message(parser_e_syntax_error);
  907. consume(_PROPERTY);
  908. propertyparas:=nil;
  909. datacoll:=nil;
  910. if token=_ID then
  911. begin
  912. p:=new(ppropertysym,init(pattern));
  913. propname:=pattern;
  914. consume(_ID);
  915. { property parameters ? }
  916. if token=_LECKKLAMMER then
  917. begin
  918. if (sp_published in current_object_option) then
  919. Message(parser_e_cant_publish_that_property);
  920. { create a list of the parameters in propertyparas }
  921. consume(_LECKKLAMMER);
  922. inc(testcurobject);
  923. repeat
  924. if token=_VAR then
  925. begin
  926. consume(_VAR);
  927. varspez:=vs_var;
  928. end
  929. else if token=_CONST then
  930. begin
  931. consume(_CONST);
  932. varspez:=vs_const;
  933. end
  934. else varspez:=vs_value;
  935. sc:=idlist;
  936. if token=_COLON then
  937. begin
  938. consume(_COLON);
  939. if token=_ARRAY then
  940. begin
  941. {
  942. if (varspez<>vs_const) and
  943. (varspez<>vs_var) then
  944. begin
  945. varspez:=vs_const;
  946. Message(parser_e_illegal_open_parameter);
  947. end;
  948. }
  949. consume(_ARRAY);
  950. consume(_OF);
  951. { define range and type of range }
  952. hp:=new(parraydef,init(0,-1,s32bitdef));
  953. { define field type }
  954. parraydef(hp)^.definition:=single_type(s);
  955. end
  956. else
  957. hp:=single_type(s);
  958. end
  959. else
  960. hp:=cformaldef;
  961. s:=sc^.get_with_tokeninfo(declarepos);
  962. while s<>'' do
  963. begin
  964. new(hp2);
  965. hp2^.paratyp:=varspez;
  966. hp2^.data:=hp;
  967. hp2^.next:=propertyparas;
  968. propertyparas:=hp2;
  969. s:=sc^.get_with_tokeninfo(declarepos);
  970. end;
  971. dispose(sc,done);
  972. if token=_SEMICOLON then consume(_SEMICOLON)
  973. else break;
  974. until false;
  975. dec(testcurobject);
  976. consume(_RECKKLAMMER);
  977. end;
  978. { overriden property ? }
  979. { force property interface, if there is a property parameter }
  980. if (token=_COLON) or assigned(propertyparas) then
  981. begin
  982. consume(_COLON);
  983. p^.proptype:=single_type(hs);
  984. if (idtoken=_INDEX) then
  985. begin
  986. consume(_INDEX);
  987. {$ifdef INCLUDEOK}
  988. include(p^.propoptions,ppo_indexed);
  989. {$else}
  990. p^.propoptions:=p^.propoptions+[ppo_indexed];
  991. {$endif}
  992. if token=_INTCONST then
  993. val(pattern,p^.index,code);
  994. consume(_INTCONST);
  995. { concat a longint to the para template }
  996. new(hp2);
  997. hp2^.paratyp:=vs_value;
  998. hp2^.data:=s32bitdef;
  999. hp2^.next:=propertyparas;
  1000. propertyparas:=hp2;
  1001. end;
  1002. end
  1003. else
  1004. begin
  1005. { do an property override }
  1006. overriden:=search_class_member(aktclass,propname);
  1007. if assigned(overriden) and (overriden^.typ=propertysym) then
  1008. begin
  1009. { take the whole info: }
  1010. p^.propoptions:=ppropertysym(overriden)^.propoptions;
  1011. p^.index:=ppropertysym(overriden)^.index;
  1012. p^.proptype:=ppropertysym(overriden)^.proptype;
  1013. p^.writeaccesssym:=copypropsymlist(ppropertysym(overriden)^.writeaccesssym);
  1014. p^.readaccesssym:=copypropsymlist(ppropertysym(overriden)^.readaccesssym);
  1015. p^.storedsym:=copypropsymlist(ppropertysym(overriden)^.storedsym);
  1016. p^.writeaccessdef:=ppropertysym(overriden)^.writeaccessdef;
  1017. p^.readaccessdef:=ppropertysym(overriden)^.readaccessdef;
  1018. p^.storeddef:=ppropertysym(overriden)^.storeddef;
  1019. p^.default:=ppropertysym(overriden)^.default;
  1020. end
  1021. else
  1022. begin
  1023. p^.proptype:=generrordef;
  1024. message(parser_e_no_property_found_to_override);
  1025. end;
  1026. end;
  1027. if (sp_published in current_object_option) and
  1028. not(p^.proptype^.is_publishable) then
  1029. Message(parser_e_cant_publish_that_property);
  1030. { create data defcoll to allow correct parameter checks }
  1031. new(datacoll);
  1032. datacoll^.paratyp:=vs_value;
  1033. datacoll^.data:=p^.proptype;
  1034. datacoll^.next:=nil;
  1035. if (idtoken=_READ) then
  1036. begin
  1037. if assigned(p^.readaccesssym) then
  1038. deletepropsymlist(p^.readaccesssym);
  1039. p^.readaccesssym:=nil;
  1040. consume(_READ);
  1041. sym:=search_class_member(aktclass,pattern);
  1042. if not(assigned(sym)) then
  1043. begin
  1044. Message1(sym_e_unknown_id,pattern);
  1045. consume(_ID);
  1046. end
  1047. else
  1048. begin
  1049. consume(_ID);
  1050. while (token=_POINT) and
  1051. ((sym^.typ=varsym) and
  1052. (pvarsym(sym)^.definition^.deftype=recorddef)) do
  1053. begin
  1054. addpropsymlist(p^.readaccesssym,sym);
  1055. consume(_POINT);
  1056. getsymonlyin(precorddef(pvarsym(sym)^.definition)^.symtable,pattern);
  1057. if not assigned(srsym) then
  1058. Message1(sym_e_illegal_field,pattern);
  1059. sym:=srsym;
  1060. consume(_ID);
  1061. end;
  1062. end;
  1063. if assigned(sym) then
  1064. begin
  1065. { varsym aren't allowed for an indexed property
  1066. or an property with parameters }
  1067. if ((sym^.typ=varsym) and
  1068. { not necessary, an index forces propertyparas
  1069. to be assigned
  1070. }
  1071. { (((p^.options and ppo_indexed)<>0) or }
  1072. assigned(propertyparas)) or
  1073. not(sym^.typ in [varsym,procsym]) then
  1074. Message(parser_e_ill_property_access_sym);
  1075. { search the matching definition }
  1076. case sym^.typ of
  1077. procsym :
  1078. begin
  1079. pp:=get_procdef;
  1080. if not(assigned(pp)) or
  1081. not(is_equal(pp^.retdef,p^.proptype)) then
  1082. Message(parser_e_ill_property_access_sym);
  1083. p^.readaccessdef:=pp;
  1084. end;
  1085. varsym :
  1086. begin
  1087. if not(is_equal(pvarsym(sym)^.definition,p^.proptype)) then
  1088. Message(parser_e_ill_property_access_sym);
  1089. end;
  1090. end;
  1091. addpropsymlist(p^.readaccesssym,sym);
  1092. end;
  1093. end;
  1094. if (idtoken=_WRITE) then
  1095. begin
  1096. if assigned(p^.writeaccesssym) then
  1097. deletepropsymlist(p^.writeaccesssym);
  1098. p^.writeaccesssym:=nil;
  1099. consume(_WRITE);
  1100. sym:=search_class_member(aktclass,pattern);
  1101. if not(assigned(sym)) then
  1102. begin
  1103. Message1(sym_e_unknown_id,pattern);
  1104. consume(_ID);
  1105. end
  1106. else
  1107. begin
  1108. consume(_ID);
  1109. while (token=_POINT) and
  1110. ((sym^.typ=varsym) and
  1111. (pvarsym(sym)^.definition^.deftype=recorddef)) do
  1112. begin
  1113. addpropsymlist(p^.writeaccesssym,sym);
  1114. consume(_POINT);
  1115. getsymonlyin(precorddef(pvarsym(sym)^.definition)^.symtable,pattern);
  1116. if not assigned(srsym) then
  1117. Message1(sym_e_illegal_field,pattern);
  1118. sym:=srsym;
  1119. consume(_ID);
  1120. end;
  1121. end;
  1122. if assigned(sym) then
  1123. begin
  1124. if ((sym^.typ=varsym) and
  1125. assigned(propertyparas)) or
  1126. not(sym^.typ in [varsym,procsym]) then
  1127. Message(parser_e_ill_property_access_sym);
  1128. { search the matching definition }
  1129. if sym^.typ=procsym then
  1130. begin
  1131. { insert data entry to check access method }
  1132. datacoll^.next:=propertyparas;
  1133. propertyparas:=datacoll;
  1134. pp:=get_procdef;
  1135. { ... and remove it }
  1136. propertyparas:=propertyparas^.next;
  1137. datacoll^.next:=nil;
  1138. if not(assigned(pp)) then
  1139. Message(parser_e_ill_property_access_sym);
  1140. p^.writeaccessdef:=pp;
  1141. end
  1142. else if sym^.typ=varsym then
  1143. begin
  1144. if not(is_equal(pvarsym(sym)^.definition,
  1145. p^.proptype)) then
  1146. Message(parser_e_ill_property_access_sym);
  1147. end;
  1148. addpropsymlist(p^.writeaccesssym,sym);
  1149. end;
  1150. end;
  1151. if (idtoken=_STORED) then
  1152. begin
  1153. consume(_STORED);
  1154. if assigned(p^.storedsym) then
  1155. deletepropsymlist(p^.storedsym);
  1156. p^.storedsym:=nil;
  1157. case token of
  1158. _ID:
  1159. if idtoken=_DEFAULT then
  1160. begin
  1161. include(p^.propoptions,ppo_defaultproperty);
  1162. p^.storeddef:=booldef;
  1163. end
  1164. else
  1165. begin
  1166. sym:=search_class_member(aktclass,pattern);
  1167. if not(assigned(sym)) then
  1168. begin
  1169. Message1(sym_e_unknown_id,pattern);
  1170. consume(_ID);
  1171. end
  1172. else
  1173. begin
  1174. consume(_ID);
  1175. while (token=_POINT) and
  1176. ((sym^.typ=varsym) and
  1177. (pvarsym(sym)^.definition^.deftype=recorddef)) do
  1178. begin
  1179. addpropsymlist(p^.storedsym,sym);
  1180. consume(_POINT);
  1181. getsymonlyin(precorddef(pvarsym(sym)^.definition)^.symtable,pattern);
  1182. if not assigned(srsym) then
  1183. Message1(sym_e_illegal_field,pattern);
  1184. sym:=srsym;
  1185. consume(_ID);
  1186. end;
  1187. end;
  1188. if assigned(sym) then
  1189. begin
  1190. if ((sym^.typ=varsym) and
  1191. assigned(propertyparas)) or
  1192. not(sym^.typ in [varsym,procsym]) then
  1193. Message(parser_e_ill_property_storage_sym);
  1194. { search the matching definition }
  1195. if sym^.typ=procsym then
  1196. begin
  1197. { insert data entry to check access method }
  1198. datacoll^.next:=propertyparas;
  1199. propertyparas:=datacoll;
  1200. pp:=get_procdef;
  1201. { ... and remove it }
  1202. propertyparas:=propertyparas^.next;
  1203. datacoll^.next:=nil;
  1204. if not(assigned(pp)) then
  1205. Message(parser_e_ill_property_storage_sym);
  1206. p^.storeddef:=pp;
  1207. end
  1208. else if sym^.typ=varsym then
  1209. begin
  1210. if not(is_equal(pvarsym(sym)^.definition,
  1211. booldef)) then
  1212. Message(parser_e_stored_property_must_be_boolean);
  1213. end;
  1214. addpropsymlist(p^.storedsym,sym);
  1215. end;
  1216. end;
  1217. _FALSE:
  1218. begin
  1219. exclude(p^.propoptions,ppo_defaultproperty);
  1220. p^.storeddef:=nil;
  1221. end;
  1222. _TRUE:
  1223. begin
  1224. include(p^.propoptions,ppo_defaultproperty);
  1225. p^.storeddef:=booldef;
  1226. end;
  1227. end;
  1228. end;
  1229. if (idtoken=_DEFAULT) then
  1230. begin
  1231. consume(_DEFAULT);
  1232. if not(is_ordinal(p^.proptype) or
  1233. is_64bitint(p^.proptype) or
  1234. ((p^.proptype^.deftype=setdef) and
  1235. (psetdef(p^.proptype)^.settype=smallset)
  1236. ) or
  1237. assigned(propertyparas)
  1238. ) then
  1239. Message(parser_e_property_cant_have_a_default_value);
  1240. { Get the result of the default, the firstpass is
  1241. needed to support values like -1 }
  1242. pt:=comp_expr(true);
  1243. do_firstpass(pt);
  1244. if p^.proptype^.deftype=setdef then
  1245. begin
  1246. {$ifndef newcg}
  1247. {!!!!!!!!!!}
  1248. arrayconstructor_to_set(pt);
  1249. {$endif newcg}
  1250. do_firstpass(pt);
  1251. end;
  1252. pt:=gentypeconvnode(pt,p^.proptype);
  1253. do_firstpass(pt);
  1254. if not(is_constnode(pt)) then
  1255. Message(parser_e_property_default_value_must_const);
  1256. if pt^.treetype=setconstn then
  1257. p^.default:=plongint(pt^.value_set)^
  1258. else
  1259. p^.default:=pt^.value;
  1260. disposetree(pt);
  1261. end
  1262. else if (idtoken=_NODEFAULT) then
  1263. begin
  1264. consume(_NODEFAULT);
  1265. p^.default:=0;
  1266. end;
  1267. symtablestack^.insert(p);
  1268. { default property ? }
  1269. consume(_SEMICOLON);
  1270. if (idtoken=_DEFAULT) then
  1271. begin
  1272. consume(_DEFAULT);
  1273. p2:=search_default_property(aktclass);
  1274. if assigned(p2) then
  1275. message1(parser_e_only_one_default_property,
  1276. pobjectdef(p2^.owner^.defowner)^.objname^)
  1277. else
  1278. begin
  1279. {$ifdef INCLUDEOK}
  1280. include(p^.propoptions,ppo_defaultproperty);
  1281. {$else}
  1282. p^.propoptions:=p^.propoptions+[ppo_defaultproperty];
  1283. {$endif}
  1284. if not(assigned(propertyparas)) then
  1285. message(parser_e_property_need_paras);
  1286. end;
  1287. consume(_SEMICOLON);
  1288. end;
  1289. { clean up }
  1290. if assigned(datacoll) then
  1291. disposepdefcoll(datacoll);
  1292. end
  1293. else
  1294. begin
  1295. consume(_ID);
  1296. consume(_SEMICOLON);
  1297. end;
  1298. if assigned(propertyparas) then
  1299. disposepdefcoll(propertyparas);
  1300. end;
  1301. procedure destructor_head;
  1302. begin
  1303. consume(_DESTRUCTOR);
  1304. inc(lexlevel);
  1305. parse_proc_head(potype_destructor);
  1306. dec(lexlevel);
  1307. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'DONE') then
  1308. Message(parser_e_destructorname_must_be_done);
  1309. {$ifdef INCLUDEOK}
  1310. include(aktclass^.objectoptions,oo_has_destructor);
  1311. {$else}
  1312. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_destructor];
  1313. {$endif}
  1314. consume(_SEMICOLON);
  1315. if assigned(aktprocsym^.definition^.para1) then
  1316. Message(parser_e_no_paras_for_destructor);
  1317. { no return value }
  1318. aktprocsym^.definition^.retdef:=voiddef;
  1319. end;
  1320. var
  1321. hs : string;
  1322. pcrd : pclassrefdef;
  1323. hp1 : pdef;
  1324. oldprocsym : pprocsym;
  1325. oldparse_only : boolean;
  1326. intmessagetable,strmessagetable,classnamelabel : pasmlabel;
  1327. storetypeforwardsallowed : boolean;
  1328. vmtlist : taasmoutput;
  1329. begin
  1330. {Nowadays aktprocsym may already have a value, so we need to save
  1331. it.}
  1332. oldprocsym:=aktprocsym;
  1333. { forward is resolved }
  1334. if assigned(fd) then
  1335. {$ifdef INCLUDEOK}
  1336. exclude(fd^.objectoptions,oo_is_forward);
  1337. {$else}
  1338. fd^.objectoptions:=fd^.objectoptions-[oo_is_forward];
  1339. {$endif}
  1340. there_is_a_destructor:=false;
  1341. actmembertype:=[sp_public];
  1342. { objects and class types can't be declared local }
  1343. if (symtablestack^.symtabletype<>globalsymtable) and
  1344. (symtablestack^.symtabletype<>staticsymtable) then
  1345. Message(parser_e_no_local_objects);
  1346. storetypeforwardsallowed:=typecanbeforward;
  1347. if m_tp in aktmodeswitches then
  1348. typecanbeforward:=false;
  1349. { distinguish classes and objects }
  1350. if token=_OBJECT then
  1351. begin
  1352. is_a_class:=false;
  1353. consume(_OBJECT)
  1354. end
  1355. else
  1356. begin
  1357. is_a_class:=true;
  1358. consume(_CLASS);
  1359. if not(assigned(fd)) and (token=_OF) then
  1360. begin
  1361. { a hack, but it's easy to handle }
  1362. { class reference type }
  1363. consume(_OF);
  1364. if typecanbeforward then
  1365. forwardsallowed:=true;
  1366. hp1:=single_type(hs);
  1367. { accept hp1, if is a forward def ...}
  1368. if ((lasttypesym<>nil) and
  1369. (sp_forwarddef in lasttypesym^.symoptions)) or
  1370. { or a class
  1371. (if the foward defined type is a class is checked, when
  1372. the forward is resolved)
  1373. }
  1374. ((hp1^.deftype=objectdef) and pobjectdef(hp1)^.is_class) then
  1375. begin
  1376. pcrd:=new(pclassrefdef,init(hp1));
  1377. object_dec:=pcrd;
  1378. if assigned(lasttypesym) and (sp_forwarddef in lasttypesym^.symoptions) then
  1379. lasttypesym^.addforwardpointer(ppointerdef(pcrd));
  1380. forwardsallowed:=false;
  1381. end
  1382. else
  1383. begin
  1384. object_dec:=generrordef;
  1385. Message1(type_e_class_type_expected,generrordef^.typename);
  1386. end;
  1387. typecanbeforward:=storetypeforwardsallowed;
  1388. exit;
  1389. end
  1390. { forward class }
  1391. else if not(assigned(fd)) and (token=_SEMICOLON) then
  1392. begin
  1393. { also anonym objects aren't allow (o : object a : longint; end;) }
  1394. if n='' then
  1395. begin
  1396. Message(parser_f_no_anonym_objects)
  1397. end;
  1398. if n='TOBJECT' then
  1399. begin
  1400. aktclass:=new(pobjectdef,init(n,nil));
  1401. class_tobject:=aktclass;
  1402. end
  1403. else
  1404. aktclass:=new(pobjectdef,init(n,nil));
  1405. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_is_class,oo_is_forward];
  1406. { all classes must have a vmt !! at offset zero }
  1407. if not(oo_has_vmt in aktclass^.objectoptions) then
  1408. aktclass^.insertvmt;
  1409. object_dec:=aktclass;
  1410. typecanbeforward:=storetypeforwardsallowed;
  1411. exit;
  1412. end;
  1413. end;
  1414. { also anonym objects aren't allow (o : object a : longint; end;) }
  1415. if n='' then
  1416. Message(parser_f_no_anonym_objects);
  1417. { read the parent class }
  1418. if token=_LKLAMMER then
  1419. begin
  1420. consume(_LKLAMMER);
  1421. childof:=pobjectdef(id_type(pattern));
  1422. if (childof^.deftype<>objectdef) then
  1423. begin
  1424. Message1(type_e_class_type_expected,childof^.typename);
  1425. childof:=nil;
  1426. aktclass:=new(pobjectdef,init(n,nil));
  1427. end
  1428. else
  1429. begin
  1430. { a mix of class and object isn't allowed }
  1431. if (childof^.is_class and not is_a_class) or
  1432. (not childof^.is_class and is_a_class) then
  1433. Message(parser_e_mix_of_classes_and_objects);
  1434. { the forward of the child must be resolved to get
  1435. correct field addresses }
  1436. if assigned(fd) then
  1437. begin
  1438. if (oo_is_forward in childof^.objectoptions) then
  1439. Message1(parser_e_forward_declaration_must_be_resolved,childof^.objname^);
  1440. aktclass:=fd;
  1441. { we must inherit several options !!
  1442. this was missing !!
  1443. all is now done in set_parent
  1444. including symtable datasize setting PM }
  1445. fd^.set_parent(childof);
  1446. end
  1447. else
  1448. aktclass:=new(pobjectdef,init(n,childof));
  1449. end;
  1450. consume(_RKLAMMER);
  1451. end
  1452. { if no parent class, then a class get tobject as parent }
  1453. else if is_a_class then
  1454. begin
  1455. { is the current class tobject? }
  1456. { so you could define your own tobject }
  1457. if n='TOBJECT' then
  1458. begin
  1459. if assigned(fd) then
  1460. aktclass:=fd
  1461. else
  1462. aktclass:=new(pobjectdef,init(n,nil));
  1463. class_tobject:=aktclass;
  1464. end
  1465. else
  1466. begin
  1467. childof:=class_tobject;
  1468. if assigned(fd) then
  1469. begin
  1470. { the forward of the child must be resolved to get
  1471. correct field addresses
  1472. }
  1473. if (oo_is_forward in childof^.objectoptions) then
  1474. Message1(parser_e_forward_declaration_must_be_resolved,childof^.objname^);
  1475. aktclass:=fd;
  1476. aktclass^.set_parent(childof);
  1477. end
  1478. else
  1479. begin
  1480. aktclass:=new(pobjectdef,init(n,childof));
  1481. aktclass^.set_parent(childof);
  1482. end;
  1483. end;
  1484. end
  1485. else
  1486. aktclass:=new(pobjectdef,init(n,nil));
  1487. { set the class attribute }
  1488. if is_a_class then
  1489. begin
  1490. {$ifdef INCLUDEOK}
  1491. include(aktclass^.objectoptions,oo_is_class);
  1492. {$else}
  1493. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_is_class];
  1494. {$endif}
  1495. if (cs_generate_rtti in aktlocalswitches) or
  1496. (assigned(aktclass^.childof) and
  1497. (oo_can_have_published in aktclass^.childof^.objectoptions)) then
  1498. {$ifdef INCLUDEOK}
  1499. include(aktclass^.objectoptions,oo_can_have_published);
  1500. {$else}
  1501. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_can_have_published];
  1502. {$endif}
  1503. end;
  1504. aktobjectdef:=aktclass;
  1505. { default access is public }
  1506. actmembertype:=[sp_public];
  1507. aktclass^.symtable^.next:=symtablestack;
  1508. symtablestack:=aktclass^.symtable;
  1509. procinfo._class:=aktclass;
  1510. testcurobject:=1;
  1511. curobjectname:=n;
  1512. { short class declaration ? }
  1513. if (not is_a_class) or (token<>_SEMICOLON) then
  1514. begin
  1515. { Parse componenten }
  1516. repeat
  1517. if (sp_private in actmembertype) then
  1518. {$ifdef INCLUDEOK}
  1519. include(aktclass^.objectoptions,oo_has_private);
  1520. {$else}
  1521. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_private];
  1522. {$endif}
  1523. if (sp_protected in actmembertype) then
  1524. {$ifdef INCLUDEOK}
  1525. include(aktclass^.objectoptions,oo_has_protected);
  1526. {$else}
  1527. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_protected];
  1528. {$endif}
  1529. case token of
  1530. _ID : begin
  1531. case idtoken of
  1532. _PRIVATE : begin
  1533. consume(_PRIVATE);
  1534. actmembertype:=[sp_private];
  1535. current_object_option:=[sp_private];
  1536. end;
  1537. _PROTECTED : begin
  1538. consume(_PROTECTED);
  1539. current_object_option:=[sp_protected];
  1540. actmembertype:=[sp_protected];
  1541. end;
  1542. _PUBLIC : begin
  1543. consume(_PUBLIC);
  1544. current_object_option:=[sp_public];
  1545. actmembertype:=[sp_public];
  1546. end;
  1547. _PUBLISHED : begin
  1548. if not(oo_can_have_published in aktclass^.objectoptions) then
  1549. Message(parser_e_cant_have_published);
  1550. consume(_PUBLISHED);
  1551. current_object_option:=[sp_published];
  1552. actmembertype:=[sp_published];
  1553. end;
  1554. else
  1555. read_var_decs(false,true,false);
  1556. end;
  1557. end;
  1558. _PROPERTY : property_dec;
  1559. _PROCEDURE,
  1560. _FUNCTION,
  1561. _CLASS : begin
  1562. oldparse_only:=parse_only;
  1563. parse_only:=true;
  1564. parse_proc_dec;
  1565. {$ifndef newcg}
  1566. parse_object_proc_directives(aktprocsym);
  1567. {$endif newcg}
  1568. if (po_msgint in aktprocsym^.definition^.procoptions) then
  1569. {$ifdef INCLUDEOK}
  1570. include(aktclass^.objectoptions,oo_has_msgint);
  1571. {$else}
  1572. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_msgint];
  1573. {$endif}
  1574. if (po_msgstr in aktprocsym^.definition^.procoptions) then
  1575. {$ifdef INCLUDEOK}
  1576. include(aktclass^.objectoptions,oo_has_msgstr);
  1577. {$else}
  1578. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_msgstr];
  1579. {$endif}
  1580. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1581. {$ifdef INCLUDEOK}
  1582. include(aktclass^.objectoptions,oo_has_virtual);
  1583. {$else}
  1584. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1585. {$endif}
  1586. parse_only:=oldparse_only;
  1587. end;
  1588. _CONSTRUCTOR : begin
  1589. if not(sp_public in actmembertype) then
  1590. Message(parser_w_constructor_should_be_public);
  1591. oldparse_only:=parse_only;
  1592. parse_only:=true;
  1593. constructor_head;
  1594. {$ifndef newcg}
  1595. parse_object_proc_directives(aktprocsym);
  1596. {$endif newcg}
  1597. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1598. {$ifdef INCLUDEOK}
  1599. include(aktclass^.objectoptions,oo_has_virtual);
  1600. {$else}
  1601. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1602. {$endif}
  1603. parse_only:=oldparse_only;
  1604. end;
  1605. _DESTRUCTOR : begin
  1606. if there_is_a_destructor then
  1607. Message(parser_n_only_one_destructor);
  1608. there_is_a_destructor:=true;
  1609. if not(sp_public in actmembertype) then
  1610. Message(parser_w_destructor_should_be_public);
  1611. oldparse_only:=parse_only;
  1612. parse_only:=true;
  1613. destructor_head;
  1614. {$ifndef newcg}
  1615. parse_object_proc_directives(aktprocsym);
  1616. {$endif newcg}
  1617. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1618. {$ifdef INCLUDEOK}
  1619. include(aktclass^.objectoptions,oo_has_virtual);
  1620. {$else}
  1621. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1622. {$endif}
  1623. parse_only:=oldparse_only;
  1624. end;
  1625. _END : begin
  1626. consume(_END);
  1627. break;
  1628. end;
  1629. else
  1630. consume(_ID); { Give a ident expected message, like tp7 }
  1631. end;
  1632. until false;
  1633. current_object_option:=[sp_public];
  1634. end;
  1635. testcurobject:=0;
  1636. curobjectname:='';
  1637. typecanbeforward:=storetypeforwardsallowed;
  1638. { generate vmt space if needed }
  1639. if not(oo_has_vmt in aktclass^.objectoptions) and
  1640. ([oo_has_virtual,oo_has_constructor,oo_has_destructor,oo_is_class]*aktclass^.objectoptions<>[]) then
  1641. aktclass^.insertvmt;
  1642. if (cs_smartlink in aktmoduleswitches) then
  1643. datasegment^.concat(new(pai_cut,init));
  1644. { Write the start of the VMT, wich is equal for classes and objects }
  1645. if (oo_has_vmt in aktclass^.objectoptions) then
  1646. begin
  1647. { this generates the entries }
  1648. vmtlist.init;
  1649. genvmt(@vmtlist,aktclass);
  1650. { write tables for classes, this must be done before the actual
  1651. class is written, because we need the labels defined }
  1652. if is_a_class then
  1653. begin
  1654. { rtti }
  1655. if (oo_can_have_published in aktclass^.objectoptions) then
  1656. aktclass^.generate_rtti;
  1657. { write class name }
  1658. getdatalabel(classnamelabel);
  1659. datasegment^.concat(new(pai_label,init(classnamelabel)));
  1660. datasegment^.concat(new(pai_const,init_8bit(length(aktclass^.objname^))));
  1661. datasegment^.concat(new(pai_string,init(aktclass^.objname^)));
  1662. { generate message and dynamic tables }
  1663. if (oo_has_msgstr in aktclass^.objectoptions) then
  1664. strmessagetable:=genstrmsgtab(aktclass);
  1665. if (oo_has_msgint in aktclass^.objectoptions) then
  1666. intmessagetable:=genintmsgtab(aktclass)
  1667. else
  1668. datasegment^.concat(new(pai_const,init_32bit(0)));
  1669. end;
  1670. { write debug info }
  1671. {$ifdef GDB}
  1672. if (cs_debuginfo in aktmoduleswitches) then
  1673. begin
  1674. do_count_dbx:=true;
  1675. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1676. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1677. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1678. end;
  1679. {$endif GDB}
  1680. datasegment^.concat(new(pai_symbol,initname_global(aktclass^.vmt_mangledname,0)));
  1681. { determine the size with symtable^.datasize, because }
  1682. { size gives back 4 for classes }
  1683. datasegment^.concat(new(pai_const,init_32bit(aktclass^.symtable^.datasize)));
  1684. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.symtable^.datasize)));
  1685. { write pointer to parent VMT, this isn't implemented in TP }
  1686. { but this is not used in FPC ? (PM) }
  1687. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1688. { it is not written for parents that don't have any vmt !! }
  1689. if assigned(aktclass^.childof) and
  1690. (oo_has_vmt in aktclass^.childof^.objectoptions) then
  1691. datasegment^.concat(new(pai_const_symbol,initname(aktclass^.childof^.vmt_mangledname)))
  1692. else
  1693. datasegment^.concat(new(pai_const,init_32bit(0)));
  1694. { write extended info for classes, for the order see rtl/inc/objpash.inc }
  1695. if is_a_class then
  1696. begin
  1697. { pointer to class name string }
  1698. datasegment^.concat(new(pai_const_symbol,init(classnamelabel)));
  1699. { pointer to dynamic table }
  1700. if (oo_has_msgint in aktclass^.objectoptions) then
  1701. datasegment^.concat(new(pai_const_symbol,init(intmessagetable)))
  1702. else
  1703. datasegment^.concat(new(pai_const,init_32bit(0)));
  1704. { pointer to method table }
  1705. datasegment^.concat(new(pai_const,init_32bit(0)));
  1706. { pointer to field table }
  1707. datasegment^.concat(new(pai_const,init_32bit(0)));
  1708. { pointer to type info of published section }
  1709. if (oo_can_have_published in aktclass^.objectoptions) then
  1710. datasegment^.concat(new(pai_const_symbol,initname(aktclass^.rtti_name)))
  1711. else
  1712. datasegment^.concat(new(pai_const,init_32bit(0)));
  1713. { inittable for con-/destruction }
  1714. if aktclass^.needs_inittable then
  1715. datasegment^.concat(new(pai_const_symbol,init(aktclass^.get_inittable_label)))
  1716. else
  1717. datasegment^.concat(new(pai_const,init_32bit(0)));
  1718. { auto table }
  1719. datasegment^.concat(new(pai_const,init_32bit(0)));
  1720. { interface table }
  1721. datasegment^.concat(new(pai_const,init_32bit(0)));
  1722. { table for string messages }
  1723. if (oo_has_msgstr in aktclass^.objectoptions) then
  1724. datasegment^.concat(new(pai_const_symbol,init(strmessagetable)))
  1725. else
  1726. datasegment^.concat(new(pai_const,init_32bit(0)));
  1727. end;
  1728. datasegment^.concatlist(@vmtlist);
  1729. vmtlist.done;
  1730. { write the size of the VMT }
  1731. datasegment^.concat(new(pai_symbol_end,initname(aktclass^.vmt_mangledname)));
  1732. end;
  1733. { restore old state }
  1734. symtablestack:=symtablestack^.next;
  1735. procinfo._class:=nil;
  1736. aktobjectdef:=nil;
  1737. {Restore the aktprocsym.}
  1738. aktprocsym:=oldprocsym;
  1739. object_dec:=aktclass;
  1740. end;
  1741. { reads a record declaration }
  1742. function record_dec : pdef;
  1743. var
  1744. symtable : psymtable;
  1745. storetypeforwardsallowed : boolean;
  1746. begin
  1747. { create recdef }
  1748. symtable:=new(psymtable,init(recordsymtable));
  1749. record_dec:=new(precorddef,init(symtable));
  1750. { update symtable stack }
  1751. symtable^.next:=symtablestack;
  1752. symtablestack:=symtable;
  1753. { parse record }
  1754. consume(_RECORD);
  1755. storetypeforwardsallowed:=typecanbeforward;
  1756. if m_tp in aktmodeswitches then
  1757. typecanbeforward:=false;
  1758. read_var_decs(true,false,false);
  1759. consume(_END);
  1760. typecanbeforward:=storetypeforwardsallowed;
  1761. { may be scale record size to a size of n*4 ? }
  1762. symtablestack^.datasize:=align(symtablestack^.datasize,symtablestack^.dataalignment);
  1763. { restore symtable stack }
  1764. symtablestack:=symtable^.next;
  1765. end;
  1766. { reads a type definition and returns a pointer to it }
  1767. function read_type(const name : stringid) : pdef;
  1768. function handle_procvar:Pprocvardef;
  1769. var
  1770. sc : pstringcontainer;
  1771. hs1,s : string;
  1772. p : pdef;
  1773. varspez : tvarspez;
  1774. procvardef : pprocvardef;
  1775. begin
  1776. procvardef:=new(pprocvardef,init);
  1777. if token=_LKLAMMER then
  1778. begin
  1779. consume(_LKLAMMER);
  1780. inc(testcurobject);
  1781. repeat
  1782. if try_to_consume(_VAR) then
  1783. varspez:=vs_var
  1784. else
  1785. if try_to_consume(_CONST) then
  1786. varspez:=vs_const
  1787. else
  1788. varspez:=vs_value;
  1789. { self method ? }
  1790. if idtoken=_SELF then
  1791. begin
  1792. {$ifdef INCLUDEOK}
  1793. include(procvardef^.procoptions,po_containsself);
  1794. {$else}
  1795. procvardef^.procoptions:=procvardef^.procoptions+[po_containsself];
  1796. {$endif}
  1797. consume(idtoken);
  1798. consume(_COLON);
  1799. p:=single_type(hs1);
  1800. procvardef^.concatdef(p,vs_value);
  1801. end
  1802. else
  1803. begin
  1804. sc:=idlist;
  1805. if (token=_COLON) or (varspez=vs_value) then
  1806. begin
  1807. consume(_COLON);
  1808. if token=_ARRAY then
  1809. begin
  1810. consume(_ARRAY);
  1811. consume(_OF);
  1812. { define range and type of range }
  1813. p:=new(Parraydef,init(0,-1,s32bitdef));
  1814. { array of const ? }
  1815. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  1816. begin
  1817. consume(_CONST);
  1818. srsym:=nil;
  1819. if assigned(objpasunit) then
  1820. getsymonlyin(objpasunit,'TVARREC');
  1821. if not assigned(srsym) then
  1822. InternalError(1234124);
  1823. Parraydef(p)^.definition:=ptypesym(srsym)^.definition;
  1824. Parraydef(p)^.IsArrayOfConst:=true;
  1825. end
  1826. else
  1827. begin
  1828. { define field type }
  1829. Parraydef(p)^.definition:=single_type(s);
  1830. end;
  1831. end
  1832. else
  1833. p:=single_type(s);
  1834. end
  1835. else
  1836. p:=cformaldef;
  1837. while not sc^.empty do
  1838. begin
  1839. s:=sc^.get;
  1840. procvardef^.concatdef(p,varspez);
  1841. end;
  1842. dispose(sc,done);
  1843. end;
  1844. until not try_to_consume(_SEMICOLON);
  1845. dec(testcurobject);
  1846. consume(_RKLAMMER);
  1847. end;
  1848. handle_procvar:=procvardef;
  1849. end;
  1850. var
  1851. pt : ptree;
  1852. hp1,p : pdef;
  1853. aufdef : penumdef;
  1854. aufsym : penumsym;
  1855. ap : parraydef;
  1856. s : stringid;
  1857. l,v : longint;
  1858. oldaktpackrecords : tpackrecords;
  1859. hs : string;
  1860. procedure expr_type;
  1861. var
  1862. pt1,pt2 : ptree;
  1863. begin
  1864. { use of current parsed object ? }
  1865. if (token=_ID) and (testcurobject=2) and (curobjectname=pattern) then
  1866. begin
  1867. consume(_ID);
  1868. p:=aktobjectdef;
  1869. exit;
  1870. end;
  1871. { we can't accept a equal in type }
  1872. pt1:=comp_expr(not(ignore_equal));
  1873. do_firstpass(pt1);
  1874. if (token=_POINTPOINT) then
  1875. begin
  1876. consume(_POINTPOINT);
  1877. { get high value of range }
  1878. pt2:=comp_expr(not(ignore_equal));
  1879. do_firstpass(pt2);
  1880. { both must be evaluated to constants now }
  1881. if (pt1^.treetype<>ordconstn) or (pt2^.treetype<>ordconstn) then
  1882. Message(sym_e_error_in_type_def)
  1883. else
  1884. begin
  1885. { check types }
  1886. if CheckTypes(pt1^.resulttype,pt2^.resulttype) then
  1887. begin
  1888. { Check bounds }
  1889. if pt2^.value<pt1^.value then
  1890. Message(cg_e_upper_lower_than_lower)
  1891. else
  1892. begin
  1893. { All checks passed, create the new def }
  1894. case pt1^.resulttype^.deftype of
  1895. enumdef : p:=new(penumdef,init_subrange(penumdef(pt1^.resulttype),pt1^.value,pt2^.value));
  1896. orddef : begin
  1897. if is_char(pt1^.resulttype) then
  1898. p:=new(porddef,init(uchar,pt1^.value,pt2^.value))
  1899. else
  1900. if is_boolean(pt1^.resulttype) then
  1901. p:=new(porddef,init(bool8bit,pt1^.value,pt2^.value))
  1902. else
  1903. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1904. end;
  1905. end;
  1906. end;
  1907. end;
  1908. end;
  1909. disposetree(pt2);
  1910. end
  1911. else
  1912. begin
  1913. { a simple type renaming }
  1914. if (pt1^.treetype=typen) then
  1915. begin
  1916. p:=pt1^.resulttype;
  1917. readtypesym:=pt1^.typenodesym;
  1918. end
  1919. else
  1920. Message(sym_e_error_in_type_def);
  1921. end;
  1922. disposetree(pt1);
  1923. end;
  1924. procedure array_dec;
  1925. var
  1926. lowval,
  1927. highval : longint;
  1928. arraytype : pdef;
  1929. begin
  1930. consume(_ARRAY);
  1931. consume(_LECKKLAMMER);
  1932. { defaults }
  1933. arraytype:=generrordef;
  1934. lowval:=$80000000;
  1935. highval:=$7fffffff;
  1936. p:=nil;
  1937. repeat
  1938. { read the expression and check it }
  1939. pt:=expr;
  1940. if pt^.treetype=typen then
  1941. begin
  1942. case pt^.resulttype^.deftype of
  1943. enumdef :
  1944. begin
  1945. lowval:=penumdef(pt^.resulttype)^.min;
  1946. highval:=penumdef(pt^.resulttype)^.max;
  1947. arraytype:=pt^.resulttype;
  1948. end;
  1949. orddef :
  1950. begin
  1951. lowval:=porddef(pt^.resulttype)^.low;
  1952. highval:=porddef(pt^.resulttype)^.high;
  1953. arraytype:=pt^.resulttype;
  1954. end;
  1955. else
  1956. Message(sym_e_error_in_type_def);
  1957. end;
  1958. end
  1959. else
  1960. begin
  1961. do_firstpass(pt);
  1962. if (pt^.treetype=rangen) then
  1963. begin
  1964. if (pt^.left^.treetype=ordconstn) and
  1965. (pt^.right^.treetype=ordconstn) then
  1966. begin
  1967. lowval:=pt^.left^.value;
  1968. highval:=pt^.right^.value;
  1969. if highval<lowval then
  1970. begin
  1971. Message(parser_e_array_lower_less_than_upper_bound);
  1972. highval:=lowval;
  1973. end;
  1974. arraytype:=pt^.right^.resulttype;
  1975. end
  1976. else
  1977. Message(type_e_cant_eval_constant_expr);
  1978. end
  1979. else
  1980. Message(sym_e_error_in_type_def)
  1981. end;
  1982. disposetree(pt);
  1983. { create arraydef }
  1984. if p=nil then
  1985. begin
  1986. ap:=new(parraydef,init(lowval,highval,arraytype));
  1987. p:=ap;
  1988. end
  1989. else
  1990. begin
  1991. ap^.definition:=new(parraydef,init(lowval,highval,arraytype));
  1992. ap:=parraydef(ap^.definition);
  1993. end;
  1994. if token=_COMMA then
  1995. consume(_COMMA)
  1996. else
  1997. break;
  1998. until false;
  1999. consume(_RECKKLAMMER);
  2000. consume(_OF);
  2001. hp1:=read_type('');
  2002. { if no error, set element type }
  2003. if assigned(ap) then
  2004. ap^.definition:=hp1;
  2005. end;
  2006. begin
  2007. readtypesym:=nil;
  2008. p:=nil;
  2009. case token of
  2010. _STRING,_FILE:
  2011. begin
  2012. p:=single_type(hs);
  2013. readtypesym:=nil;
  2014. end;
  2015. _LKLAMMER:
  2016. begin
  2017. consume(_LKLAMMER);
  2018. { allow negativ value_str }
  2019. l:=-1;
  2020. aufsym := Nil;
  2021. aufdef:=new(penumdef,init);
  2022. repeat
  2023. s:=pattern;
  2024. consume(_ID);
  2025. if token=_ASSIGNMENT then
  2026. begin
  2027. consume(_ASSIGNMENT);
  2028. v:=get_intconst;
  2029. { please leave that a note, allows type save }
  2030. { declarations in the win32 units ! }
  2031. if v<=l then
  2032. Message(parser_n_duplicate_enum);
  2033. l:=v;
  2034. end
  2035. else
  2036. inc(l);
  2037. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  2038. if token=_COMMA then
  2039. consume(_COMMA)
  2040. else
  2041. break;
  2042. until false;
  2043. {aufdef^.max:=l;
  2044. if we allow unordered enums
  2045. this can be wrong
  2046. min and max are now set in tenumsym.init PM }
  2047. p:=aufdef;
  2048. consume(_RKLAMMER);
  2049. readtypesym:=nil;
  2050. end;
  2051. _ARRAY:
  2052. begin
  2053. array_dec;
  2054. readtypesym:=nil;
  2055. end;
  2056. _SET:
  2057. begin
  2058. consume(_SET);
  2059. consume(_OF);
  2060. hp1:=read_type('');
  2061. if assigned(hp1) then
  2062. begin
  2063. case hp1^.deftype of
  2064. { don't forget that min can be negativ PM }
  2065. enumdef :
  2066. if penumdef(hp1)^.min>=0 then
  2067. p:=new(psetdef,init(hp1,penumdef(hp1)^.max))
  2068. else
  2069. Message(sym_e_ill_type_decl_set);
  2070. orddef :
  2071. begin
  2072. case porddef(hp1)^.typ of
  2073. uchar :
  2074. p:=new(psetdef,init(hp1,255));
  2075. u8bit,u16bit,u32bit,
  2076. s8bit,s16bit,s32bit :
  2077. begin
  2078. if (porddef(hp1)^.low>=0) then
  2079. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  2080. else
  2081. Message(sym_e_ill_type_decl_set);
  2082. end;
  2083. else
  2084. Message(sym_e_ill_type_decl_set);
  2085. end;
  2086. end;
  2087. else
  2088. Message(sym_e_ill_type_decl_set);
  2089. end;
  2090. end
  2091. else
  2092. p:=generrordef;
  2093. readtypesym:=nil;
  2094. end;
  2095. _CARET:
  2096. begin
  2097. consume(_CARET);
  2098. { forwards allowed only inside TYPE statements }
  2099. if typecanbeforward then
  2100. forwardsallowed:=true;
  2101. hp1:=single_type(hs);
  2102. p:=new(ppointerdef,init(hp1));
  2103. if (lasttypesym<>nil) and (sp_forwarddef in lasttypesym^.symoptions) then
  2104. lasttypesym^.addforwardpointer(ppointerdef(p));
  2105. forwardsallowed:=false;
  2106. readtypesym:=nil;
  2107. end;
  2108. _RECORD:
  2109. begin
  2110. p:=record_dec;
  2111. readtypesym:=nil;
  2112. end;
  2113. _PACKED:
  2114. begin
  2115. consume(_PACKED);
  2116. if token=_ARRAY then
  2117. array_dec
  2118. else
  2119. begin
  2120. oldaktpackrecords:=aktpackrecords;
  2121. aktpackrecords:=packrecord_1;
  2122. if token in [_CLASS,_OBJECT] then
  2123. p:=object_dec(name,nil)
  2124. else
  2125. p:=record_dec;
  2126. aktpackrecords:=oldaktpackrecords;
  2127. end;
  2128. readtypesym:=nil;
  2129. end;
  2130. _CLASS,
  2131. _OBJECT:
  2132. begin
  2133. p:=object_dec(name,nil);
  2134. readtypesym:=nil;
  2135. end;
  2136. _PROCEDURE:
  2137. begin
  2138. consume(_PROCEDURE);
  2139. p:=handle_procvar;
  2140. if token=_OF then
  2141. begin
  2142. consume(_OF);
  2143. consume(_OBJECT);
  2144. {$ifdef INCLUDEOK}
  2145. include(pprocvardef(p)^.procoptions,po_methodpointer);
  2146. {$else}
  2147. pprocvardef(p)^.procoptions:=pprocvardef(p)^.procoptions+[po_methodpointer];
  2148. {$endif}
  2149. end;
  2150. readtypesym:=nil;
  2151. end;
  2152. _FUNCTION:
  2153. begin
  2154. consume(_FUNCTION);
  2155. p:=handle_procvar;
  2156. consume(_COLON);
  2157. pprocvardef(p)^.retdef:=single_type(hs);
  2158. if token=_OF then
  2159. begin
  2160. consume(_OF);
  2161. consume(_OBJECT);
  2162. {$ifdef INCLUDEOK}
  2163. include(pprocvardef(p)^.procoptions,po_methodpointer);
  2164. {$else}
  2165. pprocvardef(p)^.procoptions:=pprocvardef(p)^.procoptions+[po_methodpointer];
  2166. {$endif}
  2167. end;
  2168. readtypesym:=nil;
  2169. end;
  2170. else
  2171. expr_type;
  2172. end;
  2173. if p=nil then
  2174. p:=generrordef;
  2175. read_type:=p;
  2176. end;
  2177. { reads a type declaration to the symbol table }
  2178. procedure type_dec;
  2179. var
  2180. typename : stringid;
  2181. newtype : ptypesym;
  2182. sym : psym;
  2183. begin
  2184. block_type:=bt_type;
  2185. consume(_TYPE);
  2186. typecanbeforward:=true;
  2187. repeat
  2188. typename:=pattern;
  2189. consume(_ID);
  2190. consume(_EQUAL);
  2191. { here you loose the strictness of pascal
  2192. for which a redefinition like
  2193. childtype = parenttype;
  2194. child2type = parenttype;
  2195. does not make the two child types equal !!
  2196. here all vars from childtype and child2type
  2197. get the definition of parenttype !! }
  2198. {$ifdef testequaltype}
  2199. if (token = _ID) or (token=_FILE) or (token=_STRING) then
  2200. begin
  2201. olddef := single_type(s);
  2202. { make a clone of olddef }
  2203. { is that ok ??? }
  2204. getmem(newdef,SizeOf(olddef));
  2205. move(olddef^,newdef^,SizeOf(olddef));
  2206. newtype:=new(ptypesym,init(typename,newdef));
  2207. symtablestack^.insert(newtype);
  2208. end
  2209. else
  2210. {$endif testequaltype}
  2211. begin
  2212. getsym(typename,false);
  2213. sym:=srsym;
  2214. newtype:=nil;
  2215. { found a symbol with this name? }
  2216. if assigned(sym) then
  2217. begin
  2218. if (sym^.typ=typesym) then
  2219. begin
  2220. if (token=_CLASS) and
  2221. (assigned(ptypesym(sym)^.definition)) and
  2222. (ptypesym(sym)^.definition^.deftype=objectdef) and
  2223. pobjectdef(ptypesym(sym)^.definition)^.is_class and
  2224. (oo_is_forward in pobjectdef(ptypesym(sym)^.definition)^.objectoptions) then
  2225. begin
  2226. { we can ignore the result }
  2227. { the definition is modified }
  2228. object_dec(typename,pobjectdef(ptypesym(sym)^.definition));
  2229. newtype:=ptypesym(sym);
  2230. end
  2231. else
  2232. if (sp_forwarddef in sym^.symoptions) then
  2233. begin
  2234. ptypesym(sym)^.updateforwarddef(read_type(typename));
  2235. newtype:=ptypesym(sym);
  2236. end;
  2237. end;
  2238. end;
  2239. { no old type reused ? Then insert this new type }
  2240. if not assigned(newtype) then
  2241. begin
  2242. newtype:=new(ptypesym,init(typename,read_type(typename)));
  2243. newtype:=ptypesym(symtablestack^.insert(newtype));
  2244. end;
  2245. end;
  2246. consume(_SEMICOLON);
  2247. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  2248. parse_var_proc_directives(newtype);
  2249. until token<>_ID;
  2250. typecanbeforward:=false;
  2251. symtablestack^.foreach({$ifndef TP}@{$endif}testforward_type);
  2252. resolve_forwards;
  2253. block_type:=bt_general;
  2254. end;
  2255. procedure var_dec;
  2256. { parses varaible declarations and inserts them in }
  2257. { the top symbol table of symtablestack }
  2258. begin
  2259. consume(_VAR);
  2260. read_var_decs(false,false,false);
  2261. end;
  2262. procedure threadvar_dec;
  2263. { parses thread variable declarations and inserts them in }
  2264. { the top symbol table of symtablestack }
  2265. begin
  2266. consume(_THREADVAR);
  2267. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  2268. message(parser_e_threadvars_only_sg);
  2269. read_var_decs(false,false,true);
  2270. end;
  2271. procedure resourcestring_dec;
  2272. var
  2273. name : stringid;
  2274. p : ptree;
  2275. storetokenpos,filepos : tfileposinfo;
  2276. old_block_type : tblock_type;
  2277. sp : pchar;
  2278. begin
  2279. consume(_RESOURCESTRING);
  2280. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  2281. message(parser_e_resourcestring_only_sg);
  2282. old_block_type:=block_type;
  2283. block_type:=bt_const;
  2284. repeat
  2285. name:=pattern;
  2286. filepos:=tokenpos;
  2287. consume(_ID);
  2288. case token of
  2289. _EQUAL:
  2290. begin
  2291. consume(_EQUAL);
  2292. p:=comp_expr(true);
  2293. do_firstpass(p);
  2294. storetokenpos:=tokenpos;
  2295. tokenpos:=filepos;
  2296. case p^.treetype of
  2297. ordconstn:
  2298. begin
  2299. if is_constcharnode(p) then
  2300. begin
  2301. getmem(sp,2);
  2302. sp[0]:=chr(p^.value);
  2303. sp[1]:=#0;
  2304. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,1)));
  2305. end
  2306. else
  2307. Message(cg_e_illegal_expression);
  2308. end;
  2309. stringconstn:
  2310. begin
  2311. getmem(sp,p^.length+1);
  2312. move(p^.value_str^,sp^,p^.length+1);
  2313. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,p^.length)));
  2314. end;
  2315. else
  2316. Message(cg_e_illegal_expression);
  2317. end;
  2318. tokenpos:=storetokenpos;
  2319. consume(_SEMICOLON);
  2320. disposetree(p);
  2321. end;
  2322. else consume(_EQUAL);
  2323. end;
  2324. until token<>_ID;
  2325. block_type:=old_block_type;
  2326. end;
  2327. procedure Not_supported_for_inline(t : ttoken);
  2328. begin
  2329. if assigned(aktprocsym) and
  2330. (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  2331. Begin
  2332. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  2333. Message(parser_w_inlining_disabled);
  2334. {$ifdef INCLUDEOK}
  2335. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  2336. {$else}
  2337. aktprocsym^.definition^.proccalloptions:=aktprocsym^.definition^.proccalloptions-[pocall_inline];
  2338. {$endif}
  2339. End;
  2340. end;
  2341. procedure read_declarations(islibrary : boolean);
  2342. begin
  2343. repeat
  2344. case token of
  2345. _LABEL:
  2346. begin
  2347. Not_supported_for_inline(token);
  2348. label_dec;
  2349. end;
  2350. _CONST:
  2351. begin
  2352. Not_supported_for_inline(token);
  2353. const_dec;
  2354. end;
  2355. _TYPE:
  2356. begin
  2357. Not_supported_for_inline(token);
  2358. type_dec;
  2359. end;
  2360. _VAR:
  2361. var_dec;
  2362. _THREADVAR:
  2363. threadvar_dec;
  2364. _CONSTRUCTOR,_DESTRUCTOR,
  2365. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  2366. begin
  2367. Not_supported_for_inline(token);
  2368. read_proc;
  2369. end;
  2370. _RESOURCESTRING:
  2371. resourcestring_dec;
  2372. _EXPORTS:
  2373. begin
  2374. Not_supported_for_inline(token);
  2375. { here we should be at lexlevel 1, no ? PM }
  2376. if (lexlevel<>main_program_level) or
  2377. (not islibrary and not DLLsource) then
  2378. begin
  2379. Message(parser_e_syntax_error);
  2380. consume_all_until(_SEMICOLON);
  2381. end
  2382. else if islibrary then
  2383. read_exports;
  2384. end
  2385. else break;
  2386. end;
  2387. until false;
  2388. end;
  2389. procedure read_interface_declarations;
  2390. begin
  2391. {Since the body is now parsed at lexlevel 1, and the declarations
  2392. must be parsed at the same lexlevel we increase the lexlevel.}
  2393. inc(lexlevel);
  2394. repeat
  2395. case token of
  2396. _CONST : const_dec;
  2397. _TYPE : type_dec;
  2398. _VAR : var_dec;
  2399. _THREADVAR : threadvar_dec;
  2400. _RESOURCESTRING:
  2401. resourcestring_dec;
  2402. _FUNCTION,
  2403. _PROCEDURE,
  2404. _OPERATOR : read_proc;
  2405. else
  2406. break;
  2407. end;
  2408. until false;
  2409. dec(lexlevel);
  2410. end;
  2411. end.
  2412. {
  2413. $Log$
  2414. Revision 1.149 1999-09-10 18:48:07 florian
  2415. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  2416. * most things for stored properties fixed
  2417. Revision 1.148 1999/09/08 21:06:06 michael
  2418. * Stored specifier for properties is now correctly parsed
  2419. Revision 1.147 1999/09/02 09:23:51 peter
  2420. * fixed double dispose of propsymlist
  2421. Revision 1.146 1999/09/01 13:44:56 florian
  2422. * fixed writing of class rtti: vmt offset were written wrong
  2423. Revision 1.145 1999/08/26 21:17:39 peter
  2424. * fixed crash when childof was nil
  2425. Revision 1.144 1999/08/14 00:38:53 peter
  2426. * hack to support property with record fields
  2427. Revision 1.143 1999/08/09 22:19:53 peter
  2428. * classes vmt changed to only positive addresses
  2429. * sharedlib creation is working
  2430. Revision 1.142 1999/08/05 16:53:02 peter
  2431. * V_Fatal=1, all other V_ are also increased
  2432. * Check for local procedure when assigning procvar
  2433. * fixed comment parsing because directives
  2434. * oldtp mode directives better supported
  2435. * added some messages to errore.msg
  2436. Revision 1.141 1999/08/04 13:02:51 jonas
  2437. * all tokens now start with an underscore
  2438. * PowerPC compiles!!
  2439. Revision 1.140 1999/08/04 00:23:11 florian
  2440. * renamed i386asm and i386base to cpuasm and cpubase
  2441. Revision 1.139 1999/08/03 22:02:56 peter
  2442. * moved bitmask constants to sets
  2443. * some other type/const renamings
  2444. Revision 1.138 1999/08/01 18:28:11 florian
  2445. * modifications for the new code generator
  2446. Revision 1.137 1999/07/29 20:54:02 peter
  2447. * write .size also
  2448. Revision 1.136 1999/07/27 23:42:11 peter
  2449. * indirect type referencing is now allowed
  2450. Revision 1.135 1999/07/23 16:05:23 peter
  2451. * alignment is now saved in the symtable
  2452. * C alignment added for records
  2453. * PPU version increased to solve .12 <-> .13 probs
  2454. Revision 1.134 1999/07/22 09:37:50 florian
  2455. + resourcestring implemented
  2456. + start of longstring support
  2457. Revision 1.133 1999/07/16 10:04:34 peter
  2458. * merged
  2459. Revision 1.132 1999/07/11 21:24:31 michael
  2460. + Fixed integer message table
  2461. Revision 1.131 1999/07/06 21:48:23 florian
  2462. * a lot bug fixes:
  2463. - po_external isn't any longer necessary for procedure compatibility
  2464. - m_tp_procvar is in -Sd now available
  2465. - error messages of procedure variables improved
  2466. - return values with init./finalization fixed
  2467. - data types with init./finalization aren't any longer allowed in variant
  2468. record
  2469. Revision 1.130 1999/07/05 20:25:39 peter
  2470. * merged
  2471. Revision 1.129 1999/07/02 13:02:26 peter
  2472. * merged
  2473. Revision 1.128 1999/06/30 22:16:19 florian
  2474. * use of is_ordinal checked: often a qword/int64 isn't allowed (case/for ...)
  2475. * small qword problems fixed
  2476. Revision 1.127.2.4 1999/07/11 21:48:01 michael
  2477. + merged dispatch fix
  2478. Revision 1.127.2.3 1999/07/07 07:53:22 michael
  2479. + Merged patches from florian
  2480. Revision 1.127.2.2 1999/07/05 20:03:27 peter
  2481. * removed warning/notes
  2482. Revision 1.127.2.1 1999/07/02 12:59:49 peter
  2483. * fixed parsing of message directive
  2484. Revision 1.127 1999/06/02 22:44:10 pierre
  2485. * previous wrong log corrected
  2486. Revision 1.126 1999/06/02 22:25:42 pierre
  2487. * changed $ifdef FPC @ into $ifndef TP
  2488. Revision 1.125 1999/06/01 19:27:53 peter
  2489. * better checks for procvar and methodpointer
  2490. Revision 1.124 1999/06/01 14:45:51 peter
  2491. * @procvar is now always needed for FPC
  2492. Revision 1.123 1999/05/27 19:44:45 peter
  2493. * removed oldasm
  2494. * plabel -> pasmlabel
  2495. * -a switches to source writing automaticly
  2496. * assembler readers OOPed
  2497. * asmsymbol automaticly external
  2498. * jumptables and other label fixes for asm readers
  2499. Revision 1.122 1999/05/21 20:08:22 florian
  2500. * hopefully the default property bug fixed
  2501. Revision 1.121 1999/05/21 13:55:04 peter
  2502. * NEWLAB for label as symbol
  2503. Revision 1.120 1999/05/20 22:19:52 pierre
  2504. * better stabs line info for vars
  2505. Revision 1.119 1999/05/19 12:41:56 florian
  2506. * made source compilable with TP (too long line)
  2507. * default values for set properties fixed
  2508. Revision 1.118 1999/05/18 14:15:51 peter
  2509. * containsself fixes
  2510. * checktypes()
  2511. Revision 1.117 1999/05/17 21:57:12 florian
  2512. * new temporary ansistring handling
  2513. Revision 1.116 1999/05/13 21:59:34 peter
  2514. * removed oldppu code
  2515. * warning if objpas is loaded from uses
  2516. * first things for new deref writing
  2517. Revision 1.115 1999/05/07 10:36:09 peter
  2518. * fixed crash
  2519. Revision 1.114 1999/05/04 21:44:54 florian
  2520. * changes to compile it with Delphi 4.0
  2521. Revision 1.113 1999/05/01 13:24:30 peter
  2522. * merged nasm compiler
  2523. * old asm moved to oldasm/
  2524. Revision 1.112 1999/04/28 06:02:07 florian
  2525. * changes of Bruessel:
  2526. + message handler can now take an explicit self
  2527. * typinfo fixed: sometimes the type names weren't written
  2528. * the type checking for pointer comparisations and subtraction
  2529. and are now more strict (was also buggy)
  2530. * small bug fix to link.pas to support compiling on another
  2531. drive
  2532. * probable bug in popt386 fixed: call/jmp => push/jmp
  2533. transformation didn't count correctly the jmp references
  2534. + threadvar support
  2535. * warning if ln/sqrt gets an invalid constant argument
  2536. Revision 1.111 1999/04/26 13:31:37 peter
  2537. * release storenumber,double_checksum
  2538. Revision 1.110 1999/04/25 22:42:16 pierre
  2539. + code for initialized vars in Delphi mode
  2540. Revision 1.109 1999/04/21 09:43:45 peter
  2541. * storenumber works
  2542. * fixed some typos in double_checksum
  2543. + incompatible types type1 and type2 message (with storenumber)
  2544. Revision 1.108 1999/04/17 13:16:19 peter
  2545. * fixes for storenumber
  2546. Revision 1.107 1999/04/14 09:14:50 peter
  2547. * first things to store the symbol/def number in the ppu
  2548. Revision 1.106 1999/04/07 15:31:15 pierre
  2549. * all formaldefs are now a sinlge definition
  2550. cformaldef (this was necessary for double_checksum)
  2551. + small part of double_checksum code
  2552. Revision 1.105 1999/03/26 00:05:34 peter
  2553. * released valintern
  2554. + deffile is now removed when compiling is finished
  2555. * ^( compiles now correct
  2556. + static directive
  2557. * shrd fixed
  2558. Revision 1.104 1999/03/24 23:17:13 peter
  2559. * fixed bugs 212,222,225,227,229,231,233
  2560. Revision 1.103 1999/03/22 22:10:25 florian
  2561. * typecanbeforward wasn't always restored in object_dec which
  2562. sometimes caused strange effects
  2563. Revision 1.102 1999/03/05 01:14:26 pierre
  2564. * bug0198 : call conventions for methods
  2565. not yet implemented is the control of same calling convention
  2566. for virtual and child's virtual
  2567. * msgstr and msgint only created if message was found
  2568. who implemented this by the way ?
  2569. it leaks lots of plabels !!!! (check with heaptrc !)
  2570. Revision 1.101 1999/02/25 21:02:41 peter
  2571. * ag386bin updates
  2572. + coff writer
  2573. Revision 1.100 1999/02/24 00:59:14 peter
  2574. * small updates for ag386bin
  2575. Revision 1.99 1999/02/22 23:33:29 florian
  2576. + message directive for integers added
  2577. Revision 1.98 1999/02/22 20:13:36 florian
  2578. + first implementation of message keyword
  2579. Revision 1.97 1999/02/22 02:44:10 peter
  2580. * ag386bin doesn't use i386.pas anymore
  2581. Revision 1.96 1999/02/17 14:20:40 pierre
  2582. * Reference specific bug in recompiling unit solved
  2583. Revision 1.95 1999/01/25 20:13:48 peter
  2584. * fixed crash with forward declared class of ...
  2585. Revision 1.94 1999/01/19 12:17:00 peter
  2586. * fixed constant strings > 255 chars
  2587. Revision 1.93 1999/01/15 13:08:23 peter
  2588. * error if upper<lower in array decl
  2589. Revision 1.92 1999/01/14 21:49:58 peter
  2590. * fixed forwardpointer problem with multiple forwards for the same
  2591. typesym. It now uses a linkedlist instead of a single pointer
  2592. Revision 1.91 1998/12/30 22:15:46 peter
  2593. + farpointer type
  2594. * absolutesym now also stores if its far
  2595. Revision 1.90 1998/12/15 17:16:00 peter
  2596. * fixed const s : ^string
  2597. * first things for const pchar : @string[1]
  2598. Revision 1.89 1998/12/11 00:03:30 peter
  2599. + globtype,tokens,version unit splitted from globals
  2600. Revision 1.88 1998/11/30 09:43:20 pierre
  2601. * some range check bugs fixed (still not working !)
  2602. + added DLL writing support for win32 (also accepts variables)
  2603. + TempAnsi for code that could be used for Temporary ansi strings
  2604. handling
  2605. Revision 1.87 1998/11/29 12:42:24 peter
  2606. * check for constants with array decl
  2607. Revision 1.86 1998/11/28 16:20:52 peter
  2608. + support for dll variables
  2609. Revision 1.85 1998/11/27 14:34:43 peter
  2610. * give error when string[0] decl is found
  2611. Revision 1.84 1998/11/17 10:40:15 peter
  2612. * H+ fixes
  2613. Revision 1.83 1998/11/16 11:28:59 pierre
  2614. * stackcheck removed for i386_win32
  2615. * exportlist does not crash at least !!
  2616. (was need for tests dir !)z
  2617. Revision 1.82 1998/11/16 10:18:07 peter
  2618. * fixes for ansistrings
  2619. Revision 1.81 1998/11/13 15:40:22 pierre
  2620. + added -Se in Makefile cvstest target
  2621. + lexlevel cleanup
  2622. normal_function_level main_program_level and unit_init_level defined
  2623. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  2624. (test added in code !)
  2625. * -Un option was wrong
  2626. * _FAIL and _SELF only keyword inside
  2627. constructors and methods respectively
  2628. Revision 1.80 1998/11/13 10:18:09 peter
  2629. + nil constants
  2630. Revision 1.79 1998/11/05 12:02:51 peter
  2631. * released useansistring
  2632. * removed -Sv, its now available in fpc modes
  2633. Revision 1.78 1998/10/27 13:45:33 pierre
  2634. * classes get a vmt allways
  2635. * better error info (tried to remove
  2636. several error strings introduced by the tpexcept handling)
  2637. Revision 1.77 1998/10/26 22:58:20 florian
  2638. * new introduded problem with classes fix, the parent class wasn't set
  2639. correct, if the class was defined forward before
  2640. Revision 1.76 1998/10/25 23:31:18 peter
  2641. * procvar parsing updated just like psub.pas routine
  2642. Revision 1.75 1998/10/21 08:39:59 florian
  2643. + ansistring operator +
  2644. + $h and string[n] for n>255 added
  2645. * small problem with TP fixed
  2646. Revision 1.74 1998/10/20 13:09:13 peter
  2647. * fixed object(unknown) crash
  2648. Revision 1.73 1998/10/19 08:54:56 pierre
  2649. * wrong stabs info corrected once again !!
  2650. + variable vmt offset with vmt field only if required
  2651. implemented now !!!
  2652. Revision 1.72 1998/10/16 13:12:51 pierre
  2653. * added vmt_offsets in destructors code also !!!
  2654. * vmt_offset code for m68k
  2655. Revision 1.71 1998/10/15 15:13:25 pierre
  2656. + added oo_hasconstructor and oo_hasdestructor
  2657. for objects options
  2658. Revision 1.70 1998/10/13 13:10:22 peter
  2659. * new style for m68k/i386 infos and enums
  2660. Revision 1.69 1998/10/09 12:07:49 pierre
  2661. * typo error for propertyparas dispose corrected
  2662. Revision 1.68 1998/10/09 11:47:54 pierre
  2663. * still more memory leaks fixes !!
  2664. Revision 1.67 1998/10/08 13:48:46 peter
  2665. * fixed memory leaks for do nothing source
  2666. * fixed unit interdependency
  2667. Revision 1.66 1998/10/06 20:43:31 peter
  2668. * fixed set of bugs. like set of false..true set of #1..#255 and
  2669. set of #1..true which was allowed
  2670. Revision 1.65 1998/10/05 22:43:35 peter
  2671. * commited the wrong file :(
  2672. Revision 1.64 1998/10/05 21:33:24 peter
  2673. * fixed 161,165,166,167,168
  2674. Revision 1.63 1998/10/05 13:57:13 peter
  2675. * crash preventions
  2676. Revision 1.62 1998/10/02 17:06:02 peter
  2677. * better error message for unresolved forward types
  2678. Revision 1.61 1998/10/02 09:23:24 peter
  2679. * fixed error msg with type l=<var>
  2680. * block_type bt_const is now set in read_const_dec
  2681. Revision 1.60 1998/09/30 07:40:33 florian
  2682. * better error recovering
  2683. Revision 1.59 1998/09/26 17:45:33 peter
  2684. + idtoken and only one token table
  2685. Revision 1.58 1998/09/25 00:04:01 florian
  2686. * problems when calling class methods fixed
  2687. Revision 1.57 1998/09/24 23:49:09 peter
  2688. + aktmodeswitches
  2689. Revision 1.56 1998/09/23 15:39:09 pierre
  2690. * browser bugfixes
  2691. was adding a reference when looking for the symbol
  2692. if -bSYM_NAME was used
  2693. Revision 1.55 1998/09/21 13:24:44 daniel
  2694. * Memory leak fixed.
  2695. Revision 1.54 1998/09/17 13:41:16 pierre
  2696. sizeof(TPOINT) problem
  2697. Revision 1.53.2.1 1998/09/17 13:12:09 pierre
  2698. * virtual destructor did not set oo_hasvirtual
  2699. (detected with the sizeof(TPoint) problem
  2700. * genloadcallnode was missing
  2701. Revision 1.53 1998/09/09 11:50:52 pierre
  2702. * forward def are not put in record or objects
  2703. + added check for forwards also in record and objects
  2704. * dummy parasymtable for unit initialization removed from
  2705. symtable stack
  2706. Revision 1.52 1998/09/07 23:10:22 florian
  2707. * a lot of stuff fixed regarding rtti and publishing of properties,
  2708. basics should now work
  2709. Revision 1.51 1998/09/07 19:33:22 florian
  2710. + some stuff for property rtti added:
  2711. - NameIndex of the TPropInfo record is now written correctly
  2712. - the DEFAULT/NODEFAULT keyword is supported now
  2713. - the default value and the storedsym/def are now written to
  2714. the PPU fiel
  2715. Revision 1.50 1998/09/07 18:46:08 peter
  2716. * update smartlinking, uses getdatalabel
  2717. * renamed ptree.value vars to value_str,value_real,value_set
  2718. Revision 1.49 1998/09/07 17:37:00 florian
  2719. * first fixes for published properties
  2720. Revision 1.48 1998/09/04 08:42:02 peter
  2721. * updated some error messages
  2722. Revision 1.47 1998/09/03 16:03:18 florian
  2723. + rtti generation
  2724. * init table generation changed
  2725. Revision 1.46 1998/09/01 17:39:48 peter
  2726. + internal constant functions
  2727. Revision 1.45 1998/08/31 12:20:28 peter
  2728. * fixed array_dec when unknown type was used
  2729. Revision 1.44 1998/08/28 10:57:01 peter
  2730. * removed warnings
  2731. Revision 1.43 1998/08/25 13:09:25 pierre
  2732. * corrected mangling sheme :
  2733. cvar add Cprefix to the mixed case name whereas
  2734. export or public use direct name
  2735. Revision 1.42 1998/08/25 12:42:41 pierre
  2736. * CDECL changed to CVAR for variables
  2737. specifications are read in structures also
  2738. + started adding GPC compatibility mode ( option -Sp)
  2739. * names changed to lowercase
  2740. Revision 1.41 1998/08/23 21:04:36 florian
  2741. + rtti generation for classes added
  2742. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  2743. Revision 1.40 1998/08/21 15:48:58 pierre
  2744. * more cdecl chagnes
  2745. - better line info
  2746. - changes the definition options of a procvar
  2747. if it is a unnamed type
  2748. Revision 1.39 1998/08/19 00:42:40 peter
  2749. + subrange types for enums
  2750. + checking for bounds type with ranges
  2751. Revision 1.38 1998/08/12 19:20:39 peter
  2752. + public is the same as export for c_vars
  2753. * a exported/public c_var incs now the refcount
  2754. Revision 1.37 1998/08/11 15:31:38 peter
  2755. * write extended to ppu file
  2756. * new version 0.99.7
  2757. Revision 1.36 1998/08/10 14:50:09 peter
  2758. + localswitches, moduleswitches, globalswitches splitting
  2759. Revision 1.35 1998/07/26 21:59:00 florian
  2760. + better support for switch $H
  2761. + index access to ansi strings added
  2762. + assigment of data (records/arrays) containing ansi strings
  2763. Revision 1.34 1998/07/20 22:17:15 florian
  2764. * hex constants in numeric char (#$54#$43 ...) are now allowed
  2765. * there was a bug in record_var_dec which prevents the used
  2766. of nested variant records (for example drivers.tevent of tv)
  2767. Revision 1.33 1998/07/18 17:11:11 florian
  2768. + ansi string constants fixed
  2769. + switch $H partial implemented
  2770. Revision 1.32 1998/07/14 21:46:50 peter
  2771. * updated messages file
  2772. Revision 1.31 1998/07/14 14:46:53 peter
  2773. * released NEWINPUT
  2774. Revision 1.30 1998/07/10 00:00:00 peter
  2775. * fixed ttypesym bug finally
  2776. * fileinfo in the symtable and better using for unused vars
  2777. Revision 1.29 1998/06/25 14:04:21 peter
  2778. + internal inc/dec
  2779. Revision 1.28 1998/06/24 12:26:45 peter
  2780. * stricter var parsing like tp7 and some optimizes with directive
  2781. parsing
  2782. Revision 1.27 1998/06/12 16:15:34 pierre
  2783. * external name 'C_var';
  2784. export name 'intern_C_var';
  2785. cdecl;
  2786. cdecl;external;
  2787. are now supported only with -Sv switch
  2788. Revision 1.25 1998/06/09 16:01:45 pierre
  2789. + added procedure directive parsing for procvars
  2790. (accepted are popstack cdecl and pascal)
  2791. + added C vars with the following syntax
  2792. var C calias 'true_c_name';(can be followed by external)
  2793. reason is that you must add the Cprefix
  2794. which is target dependent
  2795. Revision 1.24 1998/06/05 14:37:32 pierre
  2796. * fixes for inline for operators
  2797. * inline procedure more correctly restricted
  2798. Revision 1.23 1998/06/04 23:51:50 peter
  2799. * m68k compiles
  2800. + .def file creation moved to gendef.pas so it could also be used
  2801. for win32
  2802. Revision 1.22 1998/06/03 22:48:59 peter
  2803. + wordbool,longbool
  2804. * rename bis,von -> high,low
  2805. * moved some systemunit loading/creating to psystem.pas
  2806. Revision 1.21 1998/06/03 22:14:19 florian
  2807. * problem with sizes of classes fixed (if the anchestor was declared
  2808. forward, the compiler doesn't update the child classes size)
  2809. Revision 1.20 1998/05/28 14:35:54 peter
  2810. * nicer error message when no id is used after var
  2811. Revision 1.19 1998/05/23 01:21:19 peter
  2812. + aktasmmode, aktoptprocessor, aktoutputformat
  2813. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2814. + $LIBNAME to set the library name where the unit will be put in
  2815. * splitted cgi386 a bit (codeseg to large for bp7)
  2816. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2817. Revision 1.18 1998/05/20 09:42:35 pierre
  2818. + UseTokenInfo now default
  2819. * unit in interface uses and implementation uses gives error now
  2820. * only one error for unknown symbol (uses lastsymknown boolean)
  2821. the problem came from the label code !
  2822. + first inlined procedures and function work
  2823. (warning there might be allowed cases were the result is still wrong !!)
  2824. * UseBrower updated gives a global list of all position of all used symbols
  2825. with switch -gb
  2826. Revision 1.17 1998/05/11 13:07:55 peter
  2827. + $ifdef NEWPPU for the new ppuformat
  2828. + $define GDB not longer required
  2829. * removed all warnings and stripped some log comments
  2830. * no findfirst/findnext anymore to remove smartlink *.o files
  2831. Revision 1.16 1998/05/05 12:05:42 florian
  2832. * problems with properties fixed
  2833. * crash fixed: i:=l when i and l are undefined, was a problem with
  2834. implementation of private/protected
  2835. Revision 1.15 1998/05/01 09:01:23 florian
  2836. + correct semantics of private and protected
  2837. * small fix in variable scope:
  2838. a id can be used in a parameter list of a method, even it is used in
  2839. an anchestor class as field id
  2840. Revision 1.14 1998/05/01 07:43:56 florian
  2841. + basics for rtti implemented
  2842. + switch $m (generate rtti for published sections)
  2843. Revision 1.13 1998/04/30 15:59:41 pierre
  2844. * GDB works again better :
  2845. correct type info in one pass
  2846. + UseTokenInfo for better source position
  2847. * fixed one remaining bug in scanner for line counts
  2848. * several little fixes
  2849. Revision 1.12 1998/04/29 10:33:57 pierre
  2850. + added some code for ansistring (not complete nor working yet)
  2851. * corrected operator overloading
  2852. * corrected nasm output
  2853. + started inline procedures
  2854. + added starstarn : use ** for exponentiation (^ gave problems)
  2855. + started UseTokenInfo cond to get accurate positions
  2856. Revision 1.11 1998/04/28 11:45:52 florian
  2857. * make it compilable with TP
  2858. + small COM problems solved to compile classes.pp
  2859. Revision 1.10 1998/04/27 23:10:28 peter
  2860. + new scanner
  2861. * $makelib -> if smartlink
  2862. * small filename fixes pmodule.setfilename
  2863. * moved import from files.pas -> import.pas
  2864. Revision 1.9 1998/04/10 21:36:56 florian
  2865. + some stuff to support method pointers (procedure of object) added
  2866. (declaration, parameter handling)
  2867. Revision 1.8 1998/04/10 15:39:48 florian
  2868. * more fixes to get classes.pas compiled
  2869. Revision 1.7 1998/04/09 23:02:15 florian
  2870. * small problems solved to get remake3 work
  2871. Revision 1.6 1998/04/09 22:16:35 florian
  2872. * problem with previous REGALLOC solved
  2873. * improved property support
  2874. Revision 1.5 1998/04/08 14:59:20 florian
  2875. * problem with new expr_type solved
  2876. Revision 1.4 1998/04/08 10:26:09 florian
  2877. * correct error handling of virtual constructors
  2878. * problem with new type declaration handling fixed
  2879. Revision 1.3 1998/04/07 22:45:05 florian
  2880. * bug0092, bug0115 and bug0121 fixed
  2881. + packed object/class/array
  2882. Revision 1.2 1998/04/05 13:58:35 peter
  2883. * fixed the -Ss bug
  2884. + warning for Virtual constructors
  2885. * helppages updated with -TGO32V1
  2886. }