pdecl.pas 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155
  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. p^.storeddef:=nil;
  1158. include(p^.propoptions,ppo_stored);
  1159. case token of
  1160. _ID:
  1161. { in the case that idtoken=_DEFAULT }
  1162. { we have to do nothing except }
  1163. { setting ppo_stored, it's the same }
  1164. { as stored true }
  1165. if idtoken<>_DEFAULT then
  1166. begin
  1167. sym:=search_class_member(aktclass,pattern);
  1168. if not(assigned(sym)) then
  1169. begin
  1170. Message1(sym_e_unknown_id,pattern);
  1171. consume(_ID);
  1172. end
  1173. else
  1174. begin
  1175. consume(_ID);
  1176. while (token=_POINT) and
  1177. ((sym^.typ=varsym) and
  1178. (pvarsym(sym)^.definition^.deftype=recorddef)) do
  1179. begin
  1180. addpropsymlist(p^.storedsym,sym);
  1181. consume(_POINT);
  1182. getsymonlyin(precorddef(pvarsym(sym)^.definition)^.symtable,pattern);
  1183. if not assigned(srsym) then
  1184. Message1(sym_e_illegal_field,pattern);
  1185. sym:=srsym;
  1186. consume(_ID);
  1187. end;
  1188. end;
  1189. if assigned(sym) then
  1190. begin
  1191. { only non array properties can be stored }
  1192. if assigned(propertyparas) or
  1193. not(sym^.typ in [varsym,procsym]) then
  1194. Message(parser_e_ill_property_storage_sym);
  1195. { search the matching definition }
  1196. if sym^.typ=procsym then
  1197. begin
  1198. pp:=pprocsym(sym)^.definition;
  1199. while assigned(pp) do
  1200. begin
  1201. { the stored function shouldn't have any parameters }
  1202. if not(assigned(pp^.para1)) then
  1203. break;
  1204. pp:=pp^.nextoverloaded;
  1205. end;
  1206. { found we a procedure and does it really return a bool? }
  1207. if not(assigned(pp)) or
  1208. not(is_equal(pp^.retdef,booldef)) then
  1209. Message(parser_e_ill_property_storage_sym);
  1210. p^.storeddef:=pp;
  1211. end
  1212. else if sym^.typ=varsym then
  1213. begin
  1214. if not(is_equal(pvarsym(sym)^.definition,
  1215. booldef)) then
  1216. Message(parser_e_stored_property_must_be_boolean);
  1217. end;
  1218. addpropsymlist(p^.storedsym,sym);
  1219. end;
  1220. end;
  1221. _FALSE:
  1222. begin
  1223. consume(_FALSE);
  1224. exclude(p^.propoptions,ppo_stored);
  1225. end;
  1226. _TRUE:
  1227. consume(_TRUE);
  1228. end;
  1229. end;
  1230. if (idtoken=_DEFAULT) then
  1231. begin
  1232. consume(_DEFAULT);
  1233. if not(is_ordinal(p^.proptype) or
  1234. is_64bitint(p^.proptype) or
  1235. ((p^.proptype^.deftype=setdef) and
  1236. (psetdef(p^.proptype)^.settype=smallset)
  1237. ) or
  1238. assigned(propertyparas)
  1239. ) then
  1240. Message(parser_e_property_cant_have_a_default_value);
  1241. { Get the result of the default, the firstpass is
  1242. needed to support values like -1 }
  1243. pt:=comp_expr(true);
  1244. do_firstpass(pt);
  1245. if p^.proptype^.deftype=setdef then
  1246. begin
  1247. {$ifndef newcg}
  1248. {!!!!!!!!!!}
  1249. arrayconstructor_to_set(pt);
  1250. {$endif newcg}
  1251. do_firstpass(pt);
  1252. end;
  1253. pt:=gentypeconvnode(pt,p^.proptype);
  1254. do_firstpass(pt);
  1255. if not(is_constnode(pt)) then
  1256. Message(parser_e_property_default_value_must_const);
  1257. if pt^.treetype=setconstn then
  1258. p^.default:=plongint(pt^.value_set)^
  1259. else
  1260. p^.default:=pt^.value;
  1261. disposetree(pt);
  1262. end
  1263. else if (idtoken=_NODEFAULT) then
  1264. begin
  1265. consume(_NODEFAULT);
  1266. p^.default:=0;
  1267. end;
  1268. symtablestack^.insert(p);
  1269. { default property ? }
  1270. consume(_SEMICOLON);
  1271. if (idtoken=_DEFAULT) then
  1272. begin
  1273. consume(_DEFAULT);
  1274. p2:=search_default_property(aktclass);
  1275. if assigned(p2) then
  1276. message1(parser_e_only_one_default_property,
  1277. pobjectdef(p2^.owner^.defowner)^.objname^)
  1278. else
  1279. begin
  1280. {$ifdef INCLUDEOK}
  1281. include(p^.propoptions,ppo_defaultproperty);
  1282. {$else}
  1283. p^.propoptions:=p^.propoptions+[ppo_defaultproperty];
  1284. {$endif}
  1285. if not(assigned(propertyparas)) then
  1286. message(parser_e_property_need_paras);
  1287. end;
  1288. consume(_SEMICOLON);
  1289. end;
  1290. { clean up }
  1291. if assigned(datacoll) then
  1292. disposepdefcoll(datacoll);
  1293. end
  1294. else
  1295. begin
  1296. consume(_ID);
  1297. consume(_SEMICOLON);
  1298. end;
  1299. if assigned(propertyparas) then
  1300. disposepdefcoll(propertyparas);
  1301. end;
  1302. procedure destructor_head;
  1303. begin
  1304. consume(_DESTRUCTOR);
  1305. inc(lexlevel);
  1306. parse_proc_head(potype_destructor);
  1307. dec(lexlevel);
  1308. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'DONE') then
  1309. Message(parser_e_destructorname_must_be_done);
  1310. {$ifdef INCLUDEOK}
  1311. include(aktclass^.objectoptions,oo_has_destructor);
  1312. {$else}
  1313. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_destructor];
  1314. {$endif}
  1315. consume(_SEMICOLON);
  1316. if assigned(aktprocsym^.definition^.para1) then
  1317. Message(parser_e_no_paras_for_destructor);
  1318. { no return value }
  1319. aktprocsym^.definition^.retdef:=voiddef;
  1320. end;
  1321. var
  1322. hs : string;
  1323. pcrd : pclassrefdef;
  1324. hp1 : pdef;
  1325. oldprocsym : pprocsym;
  1326. oldparse_only : boolean;
  1327. intmessagetable,strmessagetable,classnamelabel : pasmlabel;
  1328. storetypeforwardsallowed : boolean;
  1329. vmtlist : taasmoutput;
  1330. begin
  1331. {Nowadays aktprocsym may already have a value, so we need to save
  1332. it.}
  1333. oldprocsym:=aktprocsym;
  1334. { forward is resolved }
  1335. if assigned(fd) then
  1336. {$ifdef INCLUDEOK}
  1337. exclude(fd^.objectoptions,oo_is_forward);
  1338. {$else}
  1339. fd^.objectoptions:=fd^.objectoptions-[oo_is_forward];
  1340. {$endif}
  1341. there_is_a_destructor:=false;
  1342. actmembertype:=[sp_public];
  1343. { objects and class types can't be declared local }
  1344. if (symtablestack^.symtabletype<>globalsymtable) and
  1345. (symtablestack^.symtabletype<>staticsymtable) then
  1346. Message(parser_e_no_local_objects);
  1347. storetypeforwardsallowed:=typecanbeforward;
  1348. if m_tp in aktmodeswitches then
  1349. typecanbeforward:=false;
  1350. { distinguish classes and objects }
  1351. if token=_OBJECT then
  1352. begin
  1353. is_a_class:=false;
  1354. consume(_OBJECT)
  1355. end
  1356. else
  1357. begin
  1358. is_a_class:=true;
  1359. consume(_CLASS);
  1360. if not(assigned(fd)) and (token=_OF) then
  1361. begin
  1362. { a hack, but it's easy to handle }
  1363. { class reference type }
  1364. consume(_OF);
  1365. if typecanbeforward then
  1366. forwardsallowed:=true;
  1367. hp1:=single_type(hs);
  1368. { accept hp1, if is a forward def ...}
  1369. if ((lasttypesym<>nil) and
  1370. (sp_forwarddef in lasttypesym^.symoptions)) or
  1371. { or a class
  1372. (if the foward defined type is a class is checked, when
  1373. the forward is resolved)
  1374. }
  1375. ((hp1^.deftype=objectdef) and pobjectdef(hp1)^.is_class) then
  1376. begin
  1377. pcrd:=new(pclassrefdef,init(hp1));
  1378. object_dec:=pcrd;
  1379. if assigned(lasttypesym) and (sp_forwarddef in lasttypesym^.symoptions) then
  1380. lasttypesym^.addforwardpointer(ppointerdef(pcrd));
  1381. forwardsallowed:=false;
  1382. end
  1383. else
  1384. begin
  1385. object_dec:=generrordef;
  1386. Message1(type_e_class_type_expected,generrordef^.typename);
  1387. end;
  1388. typecanbeforward:=storetypeforwardsallowed;
  1389. exit;
  1390. end
  1391. { forward class }
  1392. else if not(assigned(fd)) and (token=_SEMICOLON) then
  1393. begin
  1394. { also anonym objects aren't allow (o : object a : longint; end;) }
  1395. if n='' then
  1396. begin
  1397. Message(parser_f_no_anonym_objects)
  1398. end;
  1399. if n='TOBJECT' then
  1400. begin
  1401. aktclass:=new(pobjectdef,init(n,nil));
  1402. class_tobject:=aktclass;
  1403. end
  1404. else
  1405. aktclass:=new(pobjectdef,init(n,nil));
  1406. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_is_class,oo_is_forward];
  1407. { all classes must have a vmt !! at offset zero }
  1408. if not(oo_has_vmt in aktclass^.objectoptions) then
  1409. aktclass^.insertvmt;
  1410. object_dec:=aktclass;
  1411. typecanbeforward:=storetypeforwardsallowed;
  1412. exit;
  1413. end;
  1414. end;
  1415. { also anonym objects aren't allow (o : object a : longint; end;) }
  1416. if n='' then
  1417. Message(parser_f_no_anonym_objects);
  1418. { read the parent class }
  1419. if token=_LKLAMMER then
  1420. begin
  1421. consume(_LKLAMMER);
  1422. childof:=pobjectdef(id_type(pattern));
  1423. if (childof^.deftype<>objectdef) then
  1424. begin
  1425. Message1(type_e_class_type_expected,childof^.typename);
  1426. childof:=nil;
  1427. aktclass:=new(pobjectdef,init(n,nil));
  1428. end
  1429. else
  1430. begin
  1431. { a mix of class and object isn't allowed }
  1432. if (childof^.is_class and not is_a_class) or
  1433. (not childof^.is_class and is_a_class) then
  1434. Message(parser_e_mix_of_classes_and_objects);
  1435. { the forward of the child must be resolved to get
  1436. correct field addresses }
  1437. if assigned(fd) then
  1438. begin
  1439. if (oo_is_forward in childof^.objectoptions) then
  1440. Message1(parser_e_forward_declaration_must_be_resolved,childof^.objname^);
  1441. aktclass:=fd;
  1442. { we must inherit several options !!
  1443. this was missing !!
  1444. all is now done in set_parent
  1445. including symtable datasize setting PM }
  1446. fd^.set_parent(childof);
  1447. end
  1448. else
  1449. aktclass:=new(pobjectdef,init(n,childof));
  1450. end;
  1451. consume(_RKLAMMER);
  1452. end
  1453. { if no parent class, then a class get tobject as parent }
  1454. else if is_a_class then
  1455. begin
  1456. { is the current class tobject? }
  1457. { so you could define your own tobject }
  1458. if n='TOBJECT' then
  1459. begin
  1460. if assigned(fd) then
  1461. aktclass:=fd
  1462. else
  1463. aktclass:=new(pobjectdef,init(n,nil));
  1464. class_tobject:=aktclass;
  1465. end
  1466. else
  1467. begin
  1468. childof:=class_tobject;
  1469. if assigned(fd) then
  1470. begin
  1471. { the forward of the child must be resolved to get
  1472. correct field addresses
  1473. }
  1474. if (oo_is_forward in childof^.objectoptions) then
  1475. Message1(parser_e_forward_declaration_must_be_resolved,childof^.objname^);
  1476. aktclass:=fd;
  1477. aktclass^.set_parent(childof);
  1478. end
  1479. else
  1480. begin
  1481. aktclass:=new(pobjectdef,init(n,childof));
  1482. aktclass^.set_parent(childof);
  1483. end;
  1484. end;
  1485. end
  1486. else
  1487. aktclass:=new(pobjectdef,init(n,nil));
  1488. { set the class attribute }
  1489. if is_a_class then
  1490. begin
  1491. {$ifdef INCLUDEOK}
  1492. include(aktclass^.objectoptions,oo_is_class);
  1493. {$else}
  1494. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_is_class];
  1495. {$endif}
  1496. if (cs_generate_rtti in aktlocalswitches) or
  1497. (assigned(aktclass^.childof) and
  1498. (oo_can_have_published in aktclass^.childof^.objectoptions)) then
  1499. {$ifdef INCLUDEOK}
  1500. include(aktclass^.objectoptions,oo_can_have_published);
  1501. {$else}
  1502. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_can_have_published];
  1503. {$endif}
  1504. end;
  1505. aktobjectdef:=aktclass;
  1506. { default access is public }
  1507. actmembertype:=[sp_public];
  1508. aktclass^.symtable^.next:=symtablestack;
  1509. symtablestack:=aktclass^.symtable;
  1510. procinfo._class:=aktclass;
  1511. testcurobject:=1;
  1512. curobjectname:=n;
  1513. { short class declaration ? }
  1514. if (not is_a_class) or (token<>_SEMICOLON) then
  1515. begin
  1516. { Parse componenten }
  1517. repeat
  1518. if (sp_private in actmembertype) then
  1519. {$ifdef INCLUDEOK}
  1520. include(aktclass^.objectoptions,oo_has_private);
  1521. {$else}
  1522. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_private];
  1523. {$endif}
  1524. if (sp_protected in actmembertype) then
  1525. {$ifdef INCLUDEOK}
  1526. include(aktclass^.objectoptions,oo_has_protected);
  1527. {$else}
  1528. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_protected];
  1529. {$endif}
  1530. case token of
  1531. _ID : begin
  1532. case idtoken of
  1533. _PRIVATE : begin
  1534. consume(_PRIVATE);
  1535. actmembertype:=[sp_private];
  1536. current_object_option:=[sp_private];
  1537. end;
  1538. _PROTECTED : begin
  1539. consume(_PROTECTED);
  1540. current_object_option:=[sp_protected];
  1541. actmembertype:=[sp_protected];
  1542. end;
  1543. _PUBLIC : begin
  1544. consume(_PUBLIC);
  1545. current_object_option:=[sp_public];
  1546. actmembertype:=[sp_public];
  1547. end;
  1548. _PUBLISHED : begin
  1549. if not(oo_can_have_published in aktclass^.objectoptions) then
  1550. Message(parser_e_cant_have_published);
  1551. consume(_PUBLISHED);
  1552. current_object_option:=[sp_published];
  1553. actmembertype:=[sp_published];
  1554. end;
  1555. else
  1556. read_var_decs(false,true,false);
  1557. end;
  1558. end;
  1559. _PROPERTY : property_dec;
  1560. _PROCEDURE,
  1561. _FUNCTION,
  1562. _CLASS : begin
  1563. oldparse_only:=parse_only;
  1564. parse_only:=true;
  1565. parse_proc_dec;
  1566. {$ifndef newcg}
  1567. parse_object_proc_directives(aktprocsym);
  1568. {$endif newcg}
  1569. if (po_msgint in aktprocsym^.definition^.procoptions) then
  1570. {$ifdef INCLUDEOK}
  1571. include(aktclass^.objectoptions,oo_has_msgint);
  1572. {$else}
  1573. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_msgint];
  1574. {$endif}
  1575. if (po_msgstr in aktprocsym^.definition^.procoptions) then
  1576. {$ifdef INCLUDEOK}
  1577. include(aktclass^.objectoptions,oo_has_msgstr);
  1578. {$else}
  1579. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_msgstr];
  1580. {$endif}
  1581. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1582. {$ifdef INCLUDEOK}
  1583. include(aktclass^.objectoptions,oo_has_virtual);
  1584. {$else}
  1585. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1586. {$endif}
  1587. parse_only:=oldparse_only;
  1588. end;
  1589. _CONSTRUCTOR : begin
  1590. if not(sp_public in actmembertype) then
  1591. Message(parser_w_constructor_should_be_public);
  1592. oldparse_only:=parse_only;
  1593. parse_only:=true;
  1594. constructor_head;
  1595. {$ifndef newcg}
  1596. parse_object_proc_directives(aktprocsym);
  1597. {$endif newcg}
  1598. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1599. {$ifdef INCLUDEOK}
  1600. include(aktclass^.objectoptions,oo_has_virtual);
  1601. {$else}
  1602. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1603. {$endif}
  1604. parse_only:=oldparse_only;
  1605. end;
  1606. _DESTRUCTOR : begin
  1607. if there_is_a_destructor then
  1608. Message(parser_n_only_one_destructor);
  1609. there_is_a_destructor:=true;
  1610. if not(sp_public in actmembertype) then
  1611. Message(parser_w_destructor_should_be_public);
  1612. oldparse_only:=parse_only;
  1613. parse_only:=true;
  1614. destructor_head;
  1615. {$ifndef newcg}
  1616. parse_object_proc_directives(aktprocsym);
  1617. {$endif newcg}
  1618. if (po_virtualmethod in aktprocsym^.definition^.procoptions) then
  1619. {$ifdef INCLUDEOK}
  1620. include(aktclass^.objectoptions,oo_has_virtual);
  1621. {$else}
  1622. aktclass^.objectoptions:=aktclass^.objectoptions+[oo_has_virtual];
  1623. {$endif}
  1624. parse_only:=oldparse_only;
  1625. end;
  1626. _END : begin
  1627. consume(_END);
  1628. break;
  1629. end;
  1630. else
  1631. consume(_ID); { Give a ident expected message, like tp7 }
  1632. end;
  1633. until false;
  1634. current_object_option:=[sp_public];
  1635. end;
  1636. testcurobject:=0;
  1637. curobjectname:='';
  1638. typecanbeforward:=storetypeforwardsallowed;
  1639. { generate vmt space if needed }
  1640. if not(oo_has_vmt in aktclass^.objectoptions) and
  1641. ([oo_has_virtual,oo_has_constructor,oo_has_destructor,oo_is_class]*aktclass^.objectoptions<>[]) then
  1642. aktclass^.insertvmt;
  1643. if (cs_smartlink in aktmoduleswitches) then
  1644. datasegment^.concat(new(pai_cut,init));
  1645. { Write the start of the VMT, wich is equal for classes and objects }
  1646. if (oo_has_vmt in aktclass^.objectoptions) then
  1647. begin
  1648. { this generates the entries }
  1649. vmtlist.init;
  1650. genvmt(@vmtlist,aktclass);
  1651. { write tables for classes, this must be done before the actual
  1652. class is written, because we need the labels defined }
  1653. if is_a_class then
  1654. begin
  1655. { rtti }
  1656. if (oo_can_have_published in aktclass^.objectoptions) then
  1657. aktclass^.generate_rtti;
  1658. { write class name }
  1659. getdatalabel(classnamelabel);
  1660. datasegment^.concat(new(pai_label,init(classnamelabel)));
  1661. datasegment^.concat(new(pai_const,init_8bit(length(aktclass^.objname^))));
  1662. datasegment^.concat(new(pai_string,init(aktclass^.objname^)));
  1663. { generate message and dynamic tables }
  1664. if (oo_has_msgstr in aktclass^.objectoptions) then
  1665. strmessagetable:=genstrmsgtab(aktclass);
  1666. if (oo_has_msgint in aktclass^.objectoptions) then
  1667. intmessagetable:=genintmsgtab(aktclass)
  1668. else
  1669. datasegment^.concat(new(pai_const,init_32bit(0)));
  1670. end;
  1671. { write debug info }
  1672. {$ifdef GDB}
  1673. if (cs_debuginfo in aktmoduleswitches) then
  1674. begin
  1675. do_count_dbx:=true;
  1676. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1677. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1678. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1679. end;
  1680. {$endif GDB}
  1681. datasegment^.concat(new(pai_symbol,initname_global(aktclass^.vmt_mangledname,0)));
  1682. { determine the size with symtable^.datasize, because }
  1683. { size gives back 4 for classes }
  1684. datasegment^.concat(new(pai_const,init_32bit(aktclass^.symtable^.datasize)));
  1685. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.symtable^.datasize)));
  1686. { write pointer to parent VMT, this isn't implemented in TP }
  1687. { but this is not used in FPC ? (PM) }
  1688. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1689. { it is not written for parents that don't have any vmt !! }
  1690. if assigned(aktclass^.childof) and
  1691. (oo_has_vmt in aktclass^.childof^.objectoptions) then
  1692. datasegment^.concat(new(pai_const_symbol,initname(aktclass^.childof^.vmt_mangledname)))
  1693. else
  1694. datasegment^.concat(new(pai_const,init_32bit(0)));
  1695. { write extended info for classes, for the order see rtl/inc/objpash.inc }
  1696. if is_a_class then
  1697. begin
  1698. { pointer to class name string }
  1699. datasegment^.concat(new(pai_const_symbol,init(classnamelabel)));
  1700. { pointer to dynamic table }
  1701. if (oo_has_msgint in aktclass^.objectoptions) then
  1702. datasegment^.concat(new(pai_const_symbol,init(intmessagetable)))
  1703. else
  1704. datasegment^.concat(new(pai_const,init_32bit(0)));
  1705. { pointer to method table }
  1706. datasegment^.concat(new(pai_const,init_32bit(0)));
  1707. { pointer to field table }
  1708. datasegment^.concat(new(pai_const,init_32bit(0)));
  1709. { pointer to type info of published section }
  1710. if (oo_can_have_published in aktclass^.objectoptions) then
  1711. datasegment^.concat(new(pai_const_symbol,initname(aktclass^.rtti_name)))
  1712. else
  1713. datasegment^.concat(new(pai_const,init_32bit(0)));
  1714. { inittable for con-/destruction }
  1715. if aktclass^.needs_inittable then
  1716. datasegment^.concat(new(pai_const_symbol,init(aktclass^.get_inittable_label)))
  1717. else
  1718. datasegment^.concat(new(pai_const,init_32bit(0)));
  1719. { auto table }
  1720. datasegment^.concat(new(pai_const,init_32bit(0)));
  1721. { interface table }
  1722. datasegment^.concat(new(pai_const,init_32bit(0)));
  1723. { table for string messages }
  1724. if (oo_has_msgstr in aktclass^.objectoptions) then
  1725. datasegment^.concat(new(pai_const_symbol,init(strmessagetable)))
  1726. else
  1727. datasegment^.concat(new(pai_const,init_32bit(0)));
  1728. end;
  1729. datasegment^.concatlist(@vmtlist);
  1730. vmtlist.done;
  1731. { write the size of the VMT }
  1732. datasegment^.concat(new(pai_symbol_end,initname(aktclass^.vmt_mangledname)));
  1733. end;
  1734. { restore old state }
  1735. symtablestack:=symtablestack^.next;
  1736. procinfo._class:=nil;
  1737. aktobjectdef:=nil;
  1738. {Restore the aktprocsym.}
  1739. aktprocsym:=oldprocsym;
  1740. object_dec:=aktclass;
  1741. end;
  1742. { reads a record declaration }
  1743. function record_dec : pdef;
  1744. var
  1745. symtable : psymtable;
  1746. storetypeforwardsallowed : boolean;
  1747. begin
  1748. { create recdef }
  1749. symtable:=new(psymtable,init(recordsymtable));
  1750. record_dec:=new(precorddef,init(symtable));
  1751. { update symtable stack }
  1752. symtable^.next:=symtablestack;
  1753. symtablestack:=symtable;
  1754. { parse record }
  1755. consume(_RECORD);
  1756. storetypeforwardsallowed:=typecanbeforward;
  1757. if m_tp in aktmodeswitches then
  1758. typecanbeforward:=false;
  1759. read_var_decs(true,false,false);
  1760. consume(_END);
  1761. typecanbeforward:=storetypeforwardsallowed;
  1762. { may be scale record size to a size of n*4 ? }
  1763. symtablestack^.datasize:=align(symtablestack^.datasize,symtablestack^.dataalignment);
  1764. { restore symtable stack }
  1765. symtablestack:=symtable^.next;
  1766. end;
  1767. { reads a type definition and returns a pointer to it }
  1768. function read_type(const name : stringid) : pdef;
  1769. function handle_procvar:Pprocvardef;
  1770. var
  1771. sc : pstringcontainer;
  1772. hs1,s : string;
  1773. p : pdef;
  1774. varspez : tvarspez;
  1775. procvardef : pprocvardef;
  1776. begin
  1777. procvardef:=new(pprocvardef,init);
  1778. if token=_LKLAMMER then
  1779. begin
  1780. consume(_LKLAMMER);
  1781. inc(testcurobject);
  1782. repeat
  1783. if try_to_consume(_VAR) then
  1784. varspez:=vs_var
  1785. else
  1786. if try_to_consume(_CONST) then
  1787. varspez:=vs_const
  1788. else
  1789. varspez:=vs_value;
  1790. { self method ? }
  1791. if idtoken=_SELF then
  1792. begin
  1793. {$ifdef INCLUDEOK}
  1794. include(procvardef^.procoptions,po_containsself);
  1795. {$else}
  1796. procvardef^.procoptions:=procvardef^.procoptions+[po_containsself];
  1797. {$endif}
  1798. consume(idtoken);
  1799. consume(_COLON);
  1800. p:=single_type(hs1);
  1801. procvardef^.concatdef(p,vs_value);
  1802. end
  1803. else
  1804. begin
  1805. sc:=idlist;
  1806. if (token=_COLON) or (varspez=vs_value) then
  1807. begin
  1808. consume(_COLON);
  1809. if token=_ARRAY then
  1810. begin
  1811. consume(_ARRAY);
  1812. consume(_OF);
  1813. { define range and type of range }
  1814. p:=new(Parraydef,init(0,-1,s32bitdef));
  1815. { array of const ? }
  1816. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  1817. begin
  1818. consume(_CONST);
  1819. srsym:=nil;
  1820. if assigned(objpasunit) then
  1821. getsymonlyin(objpasunit,'TVARREC');
  1822. if not assigned(srsym) then
  1823. InternalError(1234124);
  1824. Parraydef(p)^.definition:=ptypesym(srsym)^.definition;
  1825. Parraydef(p)^.IsArrayOfConst:=true;
  1826. end
  1827. else
  1828. begin
  1829. { define field type }
  1830. Parraydef(p)^.definition:=single_type(s);
  1831. end;
  1832. end
  1833. else
  1834. p:=single_type(s);
  1835. end
  1836. else
  1837. p:=cformaldef;
  1838. while not sc^.empty do
  1839. begin
  1840. s:=sc^.get;
  1841. procvardef^.concatdef(p,varspez);
  1842. end;
  1843. dispose(sc,done);
  1844. end;
  1845. until not try_to_consume(_SEMICOLON);
  1846. dec(testcurobject);
  1847. consume(_RKLAMMER);
  1848. end;
  1849. handle_procvar:=procvardef;
  1850. end;
  1851. var
  1852. pt : ptree;
  1853. hp1,p : pdef;
  1854. aufdef : penumdef;
  1855. aufsym : penumsym;
  1856. ap : parraydef;
  1857. s : stringid;
  1858. l,v : longint;
  1859. oldaktpackrecords : tpackrecords;
  1860. hs : string;
  1861. procedure expr_type;
  1862. var
  1863. pt1,pt2 : ptree;
  1864. begin
  1865. { use of current parsed object ? }
  1866. if (token=_ID) and (testcurobject=2) and (curobjectname=pattern) then
  1867. begin
  1868. consume(_ID);
  1869. p:=aktobjectdef;
  1870. exit;
  1871. end;
  1872. { we can't accept a equal in type }
  1873. pt1:=comp_expr(not(ignore_equal));
  1874. do_firstpass(pt1);
  1875. if (token=_POINTPOINT) then
  1876. begin
  1877. consume(_POINTPOINT);
  1878. { get high value of range }
  1879. pt2:=comp_expr(not(ignore_equal));
  1880. do_firstpass(pt2);
  1881. { both must be evaluated to constants now }
  1882. if (pt1^.treetype<>ordconstn) or (pt2^.treetype<>ordconstn) then
  1883. Message(sym_e_error_in_type_def)
  1884. else
  1885. begin
  1886. { check types }
  1887. if CheckTypes(pt1^.resulttype,pt2^.resulttype) then
  1888. begin
  1889. { Check bounds }
  1890. if pt2^.value<pt1^.value then
  1891. Message(cg_e_upper_lower_than_lower)
  1892. else
  1893. begin
  1894. { All checks passed, create the new def }
  1895. case pt1^.resulttype^.deftype of
  1896. enumdef : p:=new(penumdef,init_subrange(penumdef(pt1^.resulttype),pt1^.value,pt2^.value));
  1897. orddef : begin
  1898. if is_char(pt1^.resulttype) then
  1899. p:=new(porddef,init(uchar,pt1^.value,pt2^.value))
  1900. else
  1901. if is_boolean(pt1^.resulttype) then
  1902. p:=new(porddef,init(bool8bit,pt1^.value,pt2^.value))
  1903. else
  1904. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1905. end;
  1906. end;
  1907. end;
  1908. end;
  1909. end;
  1910. disposetree(pt2);
  1911. end
  1912. else
  1913. begin
  1914. { a simple type renaming }
  1915. if (pt1^.treetype=typen) then
  1916. begin
  1917. p:=pt1^.resulttype;
  1918. readtypesym:=pt1^.typenodesym;
  1919. end
  1920. else
  1921. Message(sym_e_error_in_type_def);
  1922. end;
  1923. disposetree(pt1);
  1924. end;
  1925. procedure array_dec;
  1926. var
  1927. lowval,
  1928. highval : longint;
  1929. arraytype : pdef;
  1930. begin
  1931. consume(_ARRAY);
  1932. consume(_LECKKLAMMER);
  1933. { defaults }
  1934. arraytype:=generrordef;
  1935. lowval:=$80000000;
  1936. highval:=$7fffffff;
  1937. p:=nil;
  1938. repeat
  1939. { read the expression and check it }
  1940. pt:=expr;
  1941. if pt^.treetype=typen then
  1942. begin
  1943. case pt^.resulttype^.deftype of
  1944. enumdef :
  1945. begin
  1946. lowval:=penumdef(pt^.resulttype)^.min;
  1947. highval:=penumdef(pt^.resulttype)^.max;
  1948. arraytype:=pt^.resulttype;
  1949. end;
  1950. orddef :
  1951. begin
  1952. lowval:=porddef(pt^.resulttype)^.low;
  1953. highval:=porddef(pt^.resulttype)^.high;
  1954. arraytype:=pt^.resulttype;
  1955. end;
  1956. else
  1957. Message(sym_e_error_in_type_def);
  1958. end;
  1959. end
  1960. else
  1961. begin
  1962. do_firstpass(pt);
  1963. if (pt^.treetype=rangen) then
  1964. begin
  1965. if (pt^.left^.treetype=ordconstn) and
  1966. (pt^.right^.treetype=ordconstn) then
  1967. begin
  1968. lowval:=pt^.left^.value;
  1969. highval:=pt^.right^.value;
  1970. if highval<lowval then
  1971. begin
  1972. Message(parser_e_array_lower_less_than_upper_bound);
  1973. highval:=lowval;
  1974. end;
  1975. arraytype:=pt^.right^.resulttype;
  1976. end
  1977. else
  1978. Message(type_e_cant_eval_constant_expr);
  1979. end
  1980. else
  1981. Message(sym_e_error_in_type_def)
  1982. end;
  1983. disposetree(pt);
  1984. { create arraydef }
  1985. if p=nil then
  1986. begin
  1987. ap:=new(parraydef,init(lowval,highval,arraytype));
  1988. p:=ap;
  1989. end
  1990. else
  1991. begin
  1992. ap^.definition:=new(parraydef,init(lowval,highval,arraytype));
  1993. ap:=parraydef(ap^.definition);
  1994. end;
  1995. if token=_COMMA then
  1996. consume(_COMMA)
  1997. else
  1998. break;
  1999. until false;
  2000. consume(_RECKKLAMMER);
  2001. consume(_OF);
  2002. hp1:=read_type('');
  2003. { if no error, set element type }
  2004. if assigned(ap) then
  2005. ap^.definition:=hp1;
  2006. end;
  2007. begin
  2008. readtypesym:=nil;
  2009. p:=nil;
  2010. case token of
  2011. _STRING,_FILE:
  2012. begin
  2013. p:=single_type(hs);
  2014. readtypesym:=nil;
  2015. end;
  2016. _LKLAMMER:
  2017. begin
  2018. consume(_LKLAMMER);
  2019. { allow negativ value_str }
  2020. l:=-1;
  2021. aufsym := Nil;
  2022. aufdef:=new(penumdef,init);
  2023. repeat
  2024. s:=pattern;
  2025. consume(_ID);
  2026. if token=_ASSIGNMENT then
  2027. begin
  2028. consume(_ASSIGNMENT);
  2029. v:=get_intconst;
  2030. { please leave that a note, allows type save }
  2031. { declarations in the win32 units ! }
  2032. if v<=l then
  2033. Message(parser_n_duplicate_enum);
  2034. l:=v;
  2035. end
  2036. else
  2037. inc(l);
  2038. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  2039. if token=_COMMA then
  2040. consume(_COMMA)
  2041. else
  2042. break;
  2043. until false;
  2044. {aufdef^.max:=l;
  2045. if we allow unordered enums
  2046. this can be wrong
  2047. min and max are now set in tenumsym.init PM }
  2048. p:=aufdef;
  2049. consume(_RKLAMMER);
  2050. readtypesym:=nil;
  2051. end;
  2052. _ARRAY:
  2053. begin
  2054. array_dec;
  2055. readtypesym:=nil;
  2056. end;
  2057. _SET:
  2058. begin
  2059. consume(_SET);
  2060. consume(_OF);
  2061. hp1:=read_type('');
  2062. if assigned(hp1) then
  2063. begin
  2064. case hp1^.deftype of
  2065. { don't forget that min can be negativ PM }
  2066. enumdef :
  2067. if penumdef(hp1)^.min>=0 then
  2068. p:=new(psetdef,init(hp1,penumdef(hp1)^.max))
  2069. else
  2070. Message(sym_e_ill_type_decl_set);
  2071. orddef :
  2072. begin
  2073. case porddef(hp1)^.typ of
  2074. uchar :
  2075. p:=new(psetdef,init(hp1,255));
  2076. u8bit,u16bit,u32bit,
  2077. s8bit,s16bit,s32bit :
  2078. begin
  2079. if (porddef(hp1)^.low>=0) then
  2080. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  2081. else
  2082. Message(sym_e_ill_type_decl_set);
  2083. end;
  2084. else
  2085. Message(sym_e_ill_type_decl_set);
  2086. end;
  2087. end;
  2088. else
  2089. Message(sym_e_ill_type_decl_set);
  2090. end;
  2091. end
  2092. else
  2093. p:=generrordef;
  2094. readtypesym:=nil;
  2095. end;
  2096. _CARET:
  2097. begin
  2098. consume(_CARET);
  2099. { forwards allowed only inside TYPE statements }
  2100. if typecanbeforward then
  2101. forwardsallowed:=true;
  2102. hp1:=single_type(hs);
  2103. p:=new(ppointerdef,init(hp1));
  2104. if (lasttypesym<>nil) and (sp_forwarddef in lasttypesym^.symoptions) then
  2105. lasttypesym^.addforwardpointer(ppointerdef(p));
  2106. forwardsallowed:=false;
  2107. readtypesym:=nil;
  2108. end;
  2109. _RECORD:
  2110. begin
  2111. p:=record_dec;
  2112. readtypesym:=nil;
  2113. end;
  2114. _PACKED:
  2115. begin
  2116. consume(_PACKED);
  2117. if token=_ARRAY then
  2118. array_dec
  2119. else
  2120. begin
  2121. oldaktpackrecords:=aktpackrecords;
  2122. aktpackrecords:=packrecord_1;
  2123. if token in [_CLASS,_OBJECT] then
  2124. p:=object_dec(name,nil)
  2125. else
  2126. p:=record_dec;
  2127. aktpackrecords:=oldaktpackrecords;
  2128. end;
  2129. readtypesym:=nil;
  2130. end;
  2131. _CLASS,
  2132. _OBJECT:
  2133. begin
  2134. p:=object_dec(name,nil);
  2135. readtypesym:=nil;
  2136. end;
  2137. _PROCEDURE:
  2138. begin
  2139. consume(_PROCEDURE);
  2140. p:=handle_procvar;
  2141. if token=_OF then
  2142. begin
  2143. consume(_OF);
  2144. consume(_OBJECT);
  2145. {$ifdef INCLUDEOK}
  2146. include(pprocvardef(p)^.procoptions,po_methodpointer);
  2147. {$else}
  2148. pprocvardef(p)^.procoptions:=pprocvardef(p)^.procoptions+[po_methodpointer];
  2149. {$endif}
  2150. end;
  2151. readtypesym:=nil;
  2152. end;
  2153. _FUNCTION:
  2154. begin
  2155. consume(_FUNCTION);
  2156. p:=handle_procvar;
  2157. consume(_COLON);
  2158. pprocvardef(p)^.retdef:=single_type(hs);
  2159. if token=_OF then
  2160. begin
  2161. consume(_OF);
  2162. consume(_OBJECT);
  2163. {$ifdef INCLUDEOK}
  2164. include(pprocvardef(p)^.procoptions,po_methodpointer);
  2165. {$else}
  2166. pprocvardef(p)^.procoptions:=pprocvardef(p)^.procoptions+[po_methodpointer];
  2167. {$endif}
  2168. end;
  2169. readtypesym:=nil;
  2170. end;
  2171. else
  2172. expr_type;
  2173. end;
  2174. if p=nil then
  2175. p:=generrordef;
  2176. read_type:=p;
  2177. end;
  2178. { reads a type declaration to the symbol table }
  2179. procedure type_dec;
  2180. var
  2181. typename : stringid;
  2182. newtype : ptypesym;
  2183. sym : psym;
  2184. begin
  2185. block_type:=bt_type;
  2186. consume(_TYPE);
  2187. typecanbeforward:=true;
  2188. repeat
  2189. typename:=pattern;
  2190. consume(_ID);
  2191. consume(_EQUAL);
  2192. { here you loose the strictness of pascal
  2193. for which a redefinition like
  2194. childtype = parenttype;
  2195. child2type = parenttype;
  2196. does not make the two child types equal !!
  2197. here all vars from childtype and child2type
  2198. get the definition of parenttype !! }
  2199. {$ifdef testequaltype}
  2200. if (token = _ID) or (token=_FILE) or (token=_STRING) then
  2201. begin
  2202. olddef := single_type(s);
  2203. { make a clone of olddef }
  2204. { is that ok ??? }
  2205. getmem(newdef,SizeOf(olddef));
  2206. move(olddef^,newdef^,SizeOf(olddef));
  2207. newtype:=new(ptypesym,init(typename,newdef));
  2208. symtablestack^.insert(newtype);
  2209. end
  2210. else
  2211. {$endif testequaltype}
  2212. begin
  2213. getsym(typename,false);
  2214. sym:=srsym;
  2215. newtype:=nil;
  2216. { found a symbol with this name? }
  2217. if assigned(sym) then
  2218. begin
  2219. if (sym^.typ=typesym) then
  2220. begin
  2221. if (token=_CLASS) and
  2222. (assigned(ptypesym(sym)^.definition)) and
  2223. (ptypesym(sym)^.definition^.deftype=objectdef) and
  2224. pobjectdef(ptypesym(sym)^.definition)^.is_class and
  2225. (oo_is_forward in pobjectdef(ptypesym(sym)^.definition)^.objectoptions) then
  2226. begin
  2227. { we can ignore the result }
  2228. { the definition is modified }
  2229. object_dec(typename,pobjectdef(ptypesym(sym)^.definition));
  2230. newtype:=ptypesym(sym);
  2231. end
  2232. else
  2233. if (sp_forwarddef in sym^.symoptions) then
  2234. begin
  2235. ptypesym(sym)^.updateforwarddef(read_type(typename));
  2236. newtype:=ptypesym(sym);
  2237. end;
  2238. end;
  2239. end;
  2240. { no old type reused ? Then insert this new type }
  2241. if not assigned(newtype) then
  2242. begin
  2243. newtype:=new(ptypesym,init(typename,read_type(typename)));
  2244. newtype:=ptypesym(symtablestack^.insert(newtype));
  2245. end;
  2246. end;
  2247. consume(_SEMICOLON);
  2248. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  2249. parse_var_proc_directives(newtype);
  2250. until token<>_ID;
  2251. typecanbeforward:=false;
  2252. symtablestack^.foreach({$ifndef TP}@{$endif}testforward_type);
  2253. resolve_forwards;
  2254. block_type:=bt_general;
  2255. end;
  2256. procedure var_dec;
  2257. { parses varaible declarations and inserts them in }
  2258. { the top symbol table of symtablestack }
  2259. begin
  2260. consume(_VAR);
  2261. read_var_decs(false,false,false);
  2262. end;
  2263. procedure threadvar_dec;
  2264. { parses thread variable declarations and inserts them in }
  2265. { the top symbol table of symtablestack }
  2266. begin
  2267. consume(_THREADVAR);
  2268. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  2269. message(parser_e_threadvars_only_sg);
  2270. read_var_decs(false,false,true);
  2271. end;
  2272. procedure resourcestring_dec;
  2273. var
  2274. name : stringid;
  2275. p : ptree;
  2276. storetokenpos,filepos : tfileposinfo;
  2277. old_block_type : tblock_type;
  2278. sp : pchar;
  2279. begin
  2280. consume(_RESOURCESTRING);
  2281. if not(symtablestack^.symtabletype in [staticsymtable,globalsymtable]) then
  2282. message(parser_e_resourcestring_only_sg);
  2283. old_block_type:=block_type;
  2284. block_type:=bt_const;
  2285. repeat
  2286. name:=pattern;
  2287. filepos:=tokenpos;
  2288. consume(_ID);
  2289. case token of
  2290. _EQUAL:
  2291. begin
  2292. consume(_EQUAL);
  2293. p:=comp_expr(true);
  2294. do_firstpass(p);
  2295. storetokenpos:=tokenpos;
  2296. tokenpos:=filepos;
  2297. case p^.treetype of
  2298. ordconstn:
  2299. begin
  2300. if is_constcharnode(p) then
  2301. begin
  2302. getmem(sp,2);
  2303. sp[0]:=chr(p^.value);
  2304. sp[1]:=#0;
  2305. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,1)));
  2306. end
  2307. else
  2308. Message(cg_e_illegal_expression);
  2309. end;
  2310. stringconstn:
  2311. begin
  2312. getmem(sp,p^.length+1);
  2313. move(p^.value_str^,sp^,p^.length+1);
  2314. symtablestack^.insert(new(pconstsym,init_string(name,constresourcestring,sp,p^.length)));
  2315. end;
  2316. else
  2317. Message(cg_e_illegal_expression);
  2318. end;
  2319. tokenpos:=storetokenpos;
  2320. consume(_SEMICOLON);
  2321. disposetree(p);
  2322. end;
  2323. else consume(_EQUAL);
  2324. end;
  2325. until token<>_ID;
  2326. block_type:=old_block_type;
  2327. end;
  2328. procedure Not_supported_for_inline(t : ttoken);
  2329. begin
  2330. if assigned(aktprocsym) and
  2331. (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  2332. Begin
  2333. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  2334. Message(parser_w_inlining_disabled);
  2335. {$ifdef INCLUDEOK}
  2336. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  2337. {$else}
  2338. aktprocsym^.definition^.proccalloptions:=aktprocsym^.definition^.proccalloptions-[pocall_inline];
  2339. {$endif}
  2340. End;
  2341. end;
  2342. procedure read_declarations(islibrary : boolean);
  2343. begin
  2344. repeat
  2345. case token of
  2346. _LABEL:
  2347. begin
  2348. Not_supported_for_inline(token);
  2349. label_dec;
  2350. end;
  2351. _CONST:
  2352. begin
  2353. Not_supported_for_inline(token);
  2354. const_dec;
  2355. end;
  2356. _TYPE:
  2357. begin
  2358. Not_supported_for_inline(token);
  2359. type_dec;
  2360. end;
  2361. _VAR:
  2362. var_dec;
  2363. _THREADVAR:
  2364. threadvar_dec;
  2365. _CONSTRUCTOR,_DESTRUCTOR,
  2366. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  2367. begin
  2368. Not_supported_for_inline(token);
  2369. read_proc;
  2370. end;
  2371. _RESOURCESTRING:
  2372. resourcestring_dec;
  2373. _EXPORTS:
  2374. begin
  2375. Not_supported_for_inline(token);
  2376. { here we should be at lexlevel 1, no ? PM }
  2377. if (lexlevel<>main_program_level) or
  2378. (not islibrary and not DLLsource) then
  2379. begin
  2380. Message(parser_e_syntax_error);
  2381. consume_all_until(_SEMICOLON);
  2382. end
  2383. else if islibrary then
  2384. read_exports;
  2385. end
  2386. else break;
  2387. end;
  2388. until false;
  2389. end;
  2390. procedure read_interface_declarations;
  2391. begin
  2392. {Since the body is now parsed at lexlevel 1, and the declarations
  2393. must be parsed at the same lexlevel we increase the lexlevel.}
  2394. inc(lexlevel);
  2395. repeat
  2396. case token of
  2397. _CONST : const_dec;
  2398. _TYPE : type_dec;
  2399. _VAR : var_dec;
  2400. _THREADVAR : threadvar_dec;
  2401. _RESOURCESTRING:
  2402. resourcestring_dec;
  2403. _FUNCTION,
  2404. _PROCEDURE,
  2405. _OPERATOR : read_proc;
  2406. else
  2407. break;
  2408. end;
  2409. until false;
  2410. dec(lexlevel);
  2411. end;
  2412. end.
  2413. {
  2414. $Log$
  2415. Revision 1.150 1999-09-10 20:57:33 florian
  2416. * some more fixes for stored properties
  2417. Revision 1.149 1999/09/10 18:48:07 florian
  2418. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  2419. * most things for stored properties fixed
  2420. Revision 1.148 1999/09/08 21:06:06 michael
  2421. * Stored specifier for properties is now correctly parsed
  2422. Revision 1.147 1999/09/02 09:23:51 peter
  2423. * fixed double dispose of propsymlist
  2424. Revision 1.146 1999/09/01 13:44:56 florian
  2425. * fixed writing of class rtti: vmt offset were written wrong
  2426. Revision 1.145 1999/08/26 21:17:39 peter
  2427. * fixed crash when childof was nil
  2428. Revision 1.144 1999/08/14 00:38:53 peter
  2429. * hack to support property with record fields
  2430. Revision 1.143 1999/08/09 22:19:53 peter
  2431. * classes vmt changed to only positive addresses
  2432. * sharedlib creation is working
  2433. Revision 1.142 1999/08/05 16:53:02 peter
  2434. * V_Fatal=1, all other V_ are also increased
  2435. * Check for local procedure when assigning procvar
  2436. * fixed comment parsing because directives
  2437. * oldtp mode directives better supported
  2438. * added some messages to errore.msg
  2439. Revision 1.141 1999/08/04 13:02:51 jonas
  2440. * all tokens now start with an underscore
  2441. * PowerPC compiles!!
  2442. Revision 1.140 1999/08/04 00:23:11 florian
  2443. * renamed i386asm and i386base to cpuasm and cpubase
  2444. Revision 1.139 1999/08/03 22:02:56 peter
  2445. * moved bitmask constants to sets
  2446. * some other type/const renamings
  2447. Revision 1.138 1999/08/01 18:28:11 florian
  2448. * modifications for the new code generator
  2449. Revision 1.137 1999/07/29 20:54:02 peter
  2450. * write .size also
  2451. Revision 1.136 1999/07/27 23:42:11 peter
  2452. * indirect type referencing is now allowed
  2453. Revision 1.135 1999/07/23 16:05:23 peter
  2454. * alignment is now saved in the symtable
  2455. * C alignment added for records
  2456. * PPU version increased to solve .12 <-> .13 probs
  2457. Revision 1.134 1999/07/22 09:37:50 florian
  2458. + resourcestring implemented
  2459. + start of longstring support
  2460. Revision 1.133 1999/07/16 10:04:34 peter
  2461. * merged
  2462. Revision 1.132 1999/07/11 21:24:31 michael
  2463. + Fixed integer message table
  2464. Revision 1.131 1999/07/06 21:48:23 florian
  2465. * a lot bug fixes:
  2466. - po_external isn't any longer necessary for procedure compatibility
  2467. - m_tp_procvar is in -Sd now available
  2468. - error messages of procedure variables improved
  2469. - return values with init./finalization fixed
  2470. - data types with init./finalization aren't any longer allowed in variant
  2471. record
  2472. Revision 1.130 1999/07/05 20:25:39 peter
  2473. * merged
  2474. Revision 1.129 1999/07/02 13:02:26 peter
  2475. * merged
  2476. Revision 1.128 1999/06/30 22:16:19 florian
  2477. * use of is_ordinal checked: often a qword/int64 isn't allowed (case/for ...)
  2478. * small qword problems fixed
  2479. Revision 1.127.2.4 1999/07/11 21:48:01 michael
  2480. + merged dispatch fix
  2481. Revision 1.127.2.3 1999/07/07 07:53:22 michael
  2482. + Merged patches from florian
  2483. Revision 1.127.2.2 1999/07/05 20:03:27 peter
  2484. * removed warning/notes
  2485. Revision 1.127.2.1 1999/07/02 12:59:49 peter
  2486. * fixed parsing of message directive
  2487. Revision 1.127 1999/06/02 22:44:10 pierre
  2488. * previous wrong log corrected
  2489. Revision 1.126 1999/06/02 22:25:42 pierre
  2490. * changed $ifdef FPC @ into $ifndef TP
  2491. Revision 1.125 1999/06/01 19:27:53 peter
  2492. * better checks for procvar and methodpointer
  2493. Revision 1.124 1999/06/01 14:45:51 peter
  2494. * @procvar is now always needed for FPC
  2495. Revision 1.123 1999/05/27 19:44:45 peter
  2496. * removed oldasm
  2497. * plabel -> pasmlabel
  2498. * -a switches to source writing automaticly
  2499. * assembler readers OOPed
  2500. * asmsymbol automaticly external
  2501. * jumptables and other label fixes for asm readers
  2502. Revision 1.122 1999/05/21 20:08:22 florian
  2503. * hopefully the default property bug fixed
  2504. Revision 1.121 1999/05/21 13:55:04 peter
  2505. * NEWLAB for label as symbol
  2506. Revision 1.120 1999/05/20 22:19:52 pierre
  2507. * better stabs line info for vars
  2508. Revision 1.119 1999/05/19 12:41:56 florian
  2509. * made source compilable with TP (too long line)
  2510. * default values for set properties fixed
  2511. Revision 1.118 1999/05/18 14:15:51 peter
  2512. * containsself fixes
  2513. * checktypes()
  2514. Revision 1.117 1999/05/17 21:57:12 florian
  2515. * new temporary ansistring handling
  2516. Revision 1.116 1999/05/13 21:59:34 peter
  2517. * removed oldppu code
  2518. * warning if objpas is loaded from uses
  2519. * first things for new deref writing
  2520. Revision 1.115 1999/05/07 10:36:09 peter
  2521. * fixed crash
  2522. Revision 1.114 1999/05/04 21:44:54 florian
  2523. * changes to compile it with Delphi 4.0
  2524. Revision 1.113 1999/05/01 13:24:30 peter
  2525. * merged nasm compiler
  2526. * old asm moved to oldasm/
  2527. Revision 1.112 1999/04/28 06:02:07 florian
  2528. * changes of Bruessel:
  2529. + message handler can now take an explicit self
  2530. * typinfo fixed: sometimes the type names weren't written
  2531. * the type checking for pointer comparisations and subtraction
  2532. and are now more strict (was also buggy)
  2533. * small bug fix to link.pas to support compiling on another
  2534. drive
  2535. * probable bug in popt386 fixed: call/jmp => push/jmp
  2536. transformation didn't count correctly the jmp references
  2537. + threadvar support
  2538. * warning if ln/sqrt gets an invalid constant argument
  2539. Revision 1.111 1999/04/26 13:31:37 peter
  2540. * release storenumber,double_checksum
  2541. Revision 1.110 1999/04/25 22:42:16 pierre
  2542. + code for initialized vars in Delphi mode
  2543. Revision 1.109 1999/04/21 09:43:45 peter
  2544. * storenumber works
  2545. * fixed some typos in double_checksum
  2546. + incompatible types type1 and type2 message (with storenumber)
  2547. Revision 1.108 1999/04/17 13:16:19 peter
  2548. * fixes for storenumber
  2549. Revision 1.107 1999/04/14 09:14:50 peter
  2550. * first things to store the symbol/def number in the ppu
  2551. Revision 1.106 1999/04/07 15:31:15 pierre
  2552. * all formaldefs are now a sinlge definition
  2553. cformaldef (this was necessary for double_checksum)
  2554. + small part of double_checksum code
  2555. Revision 1.105 1999/03/26 00:05:34 peter
  2556. * released valintern
  2557. + deffile is now removed when compiling is finished
  2558. * ^( compiles now correct
  2559. + static directive
  2560. * shrd fixed
  2561. Revision 1.104 1999/03/24 23:17:13 peter
  2562. * fixed bugs 212,222,225,227,229,231,233
  2563. Revision 1.103 1999/03/22 22:10:25 florian
  2564. * typecanbeforward wasn't always restored in object_dec which
  2565. sometimes caused strange effects
  2566. Revision 1.102 1999/03/05 01:14:26 pierre
  2567. * bug0198 : call conventions for methods
  2568. not yet implemented is the control of same calling convention
  2569. for virtual and child's virtual
  2570. * msgstr and msgint only created if message was found
  2571. who implemented this by the way ?
  2572. it leaks lots of plabels !!!! (check with heaptrc !)
  2573. Revision 1.101 1999/02/25 21:02:41 peter
  2574. * ag386bin updates
  2575. + coff writer
  2576. Revision 1.100 1999/02/24 00:59:14 peter
  2577. * small updates for ag386bin
  2578. Revision 1.99 1999/02/22 23:33:29 florian
  2579. + message directive for integers added
  2580. Revision 1.98 1999/02/22 20:13:36 florian
  2581. + first implementation of message keyword
  2582. Revision 1.97 1999/02/22 02:44:10 peter
  2583. * ag386bin doesn't use i386.pas anymore
  2584. Revision 1.96 1999/02/17 14:20:40 pierre
  2585. * Reference specific bug in recompiling unit solved
  2586. Revision 1.95 1999/01/25 20:13:48 peter
  2587. * fixed crash with forward declared class of ...
  2588. Revision 1.94 1999/01/19 12:17:00 peter
  2589. * fixed constant strings > 255 chars
  2590. Revision 1.93 1999/01/15 13:08:23 peter
  2591. * error if upper<lower in array decl
  2592. Revision 1.92 1999/01/14 21:49:58 peter
  2593. * fixed forwardpointer problem with multiple forwards for the same
  2594. typesym. It now uses a linkedlist instead of a single pointer
  2595. Revision 1.91 1998/12/30 22:15:46 peter
  2596. + farpointer type
  2597. * absolutesym now also stores if its far
  2598. Revision 1.90 1998/12/15 17:16:00 peter
  2599. * fixed const s : ^string
  2600. * first things for const pchar : @string[1]
  2601. Revision 1.89 1998/12/11 00:03:30 peter
  2602. + globtype,tokens,version unit splitted from globals
  2603. Revision 1.88 1998/11/30 09:43:20 pierre
  2604. * some range check bugs fixed (still not working !)
  2605. + added DLL writing support for win32 (also accepts variables)
  2606. + TempAnsi for code that could be used for Temporary ansi strings
  2607. handling
  2608. Revision 1.87 1998/11/29 12:42:24 peter
  2609. * check for constants with array decl
  2610. Revision 1.86 1998/11/28 16:20:52 peter
  2611. + support for dll variables
  2612. Revision 1.85 1998/11/27 14:34:43 peter
  2613. * give error when string[0] decl is found
  2614. Revision 1.84 1998/11/17 10:40:15 peter
  2615. * H+ fixes
  2616. Revision 1.83 1998/11/16 11:28:59 pierre
  2617. * stackcheck removed for i386_win32
  2618. * exportlist does not crash at least !!
  2619. (was need for tests dir !)z
  2620. Revision 1.82 1998/11/16 10:18:07 peter
  2621. * fixes for ansistrings
  2622. Revision 1.81 1998/11/13 15:40:22 pierre
  2623. + added -Se in Makefile cvstest target
  2624. + lexlevel cleanup
  2625. normal_function_level main_program_level and unit_init_level defined
  2626. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  2627. (test added in code !)
  2628. * -Un option was wrong
  2629. * _FAIL and _SELF only keyword inside
  2630. constructors and methods respectively
  2631. Revision 1.80 1998/11/13 10:18:09 peter
  2632. + nil constants
  2633. Revision 1.79 1998/11/05 12:02:51 peter
  2634. * released useansistring
  2635. * removed -Sv, its now available in fpc modes
  2636. Revision 1.78 1998/10/27 13:45:33 pierre
  2637. * classes get a vmt allways
  2638. * better error info (tried to remove
  2639. several error strings introduced by the tpexcept handling)
  2640. Revision 1.77 1998/10/26 22:58:20 florian
  2641. * new introduded problem with classes fix, the parent class wasn't set
  2642. correct, if the class was defined forward before
  2643. Revision 1.76 1998/10/25 23:31:18 peter
  2644. * procvar parsing updated just like psub.pas routine
  2645. Revision 1.75 1998/10/21 08:39:59 florian
  2646. + ansistring operator +
  2647. + $h and string[n] for n>255 added
  2648. * small problem with TP fixed
  2649. Revision 1.74 1998/10/20 13:09:13 peter
  2650. * fixed object(unknown) crash
  2651. Revision 1.73 1998/10/19 08:54:56 pierre
  2652. * wrong stabs info corrected once again !!
  2653. + variable vmt offset with vmt field only if required
  2654. implemented now !!!
  2655. Revision 1.72 1998/10/16 13:12:51 pierre
  2656. * added vmt_offsets in destructors code also !!!
  2657. * vmt_offset code for m68k
  2658. Revision 1.71 1998/10/15 15:13:25 pierre
  2659. + added oo_hasconstructor and oo_hasdestructor
  2660. for objects options
  2661. Revision 1.70 1998/10/13 13:10:22 peter
  2662. * new style for m68k/i386 infos and enums
  2663. Revision 1.69 1998/10/09 12:07:49 pierre
  2664. * typo error for propertyparas dispose corrected
  2665. Revision 1.68 1998/10/09 11:47:54 pierre
  2666. * still more memory leaks fixes !!
  2667. Revision 1.67 1998/10/08 13:48:46 peter
  2668. * fixed memory leaks for do nothing source
  2669. * fixed unit interdependency
  2670. Revision 1.66 1998/10/06 20:43:31 peter
  2671. * fixed set of bugs. like set of false..true set of #1..#255 and
  2672. set of #1..true which was allowed
  2673. Revision 1.65 1998/10/05 22:43:35 peter
  2674. * commited the wrong file :(
  2675. Revision 1.64 1998/10/05 21:33:24 peter
  2676. * fixed 161,165,166,167,168
  2677. Revision 1.63 1998/10/05 13:57:13 peter
  2678. * crash preventions
  2679. Revision 1.62 1998/10/02 17:06:02 peter
  2680. * better error message for unresolved forward types
  2681. Revision 1.61 1998/10/02 09:23:24 peter
  2682. * fixed error msg with type l=<var>
  2683. * block_type bt_const is now set in read_const_dec
  2684. Revision 1.60 1998/09/30 07:40:33 florian
  2685. * better error recovering
  2686. Revision 1.59 1998/09/26 17:45:33 peter
  2687. + idtoken and only one token table
  2688. Revision 1.58 1998/09/25 00:04:01 florian
  2689. * problems when calling class methods fixed
  2690. Revision 1.57 1998/09/24 23:49:09 peter
  2691. + aktmodeswitches
  2692. Revision 1.56 1998/09/23 15:39:09 pierre
  2693. * browser bugfixes
  2694. was adding a reference when looking for the symbol
  2695. if -bSYM_NAME was used
  2696. Revision 1.55 1998/09/21 13:24:44 daniel
  2697. * Memory leak fixed.
  2698. Revision 1.54 1998/09/17 13:41:16 pierre
  2699. sizeof(TPOINT) problem
  2700. Revision 1.53.2.1 1998/09/17 13:12:09 pierre
  2701. * virtual destructor did not set oo_hasvirtual
  2702. (detected with the sizeof(TPoint) problem
  2703. * genloadcallnode was missing
  2704. Revision 1.53 1998/09/09 11:50:52 pierre
  2705. * forward def are not put in record or objects
  2706. + added check for forwards also in record and objects
  2707. * dummy parasymtable for unit initialization removed from
  2708. symtable stack
  2709. Revision 1.52 1998/09/07 23:10:22 florian
  2710. * a lot of stuff fixed regarding rtti and publishing of properties,
  2711. basics should now work
  2712. Revision 1.51 1998/09/07 19:33:22 florian
  2713. + some stuff for property rtti added:
  2714. - NameIndex of the TPropInfo record is now written correctly
  2715. - the DEFAULT/NODEFAULT keyword is supported now
  2716. - the default value and the storedsym/def are now written to
  2717. the PPU fiel
  2718. Revision 1.50 1998/09/07 18:46:08 peter
  2719. * update smartlinking, uses getdatalabel
  2720. * renamed ptree.value vars to value_str,value_real,value_set
  2721. Revision 1.49 1998/09/07 17:37:00 florian
  2722. * first fixes for published properties
  2723. Revision 1.48 1998/09/04 08:42:02 peter
  2724. * updated some error messages
  2725. Revision 1.47 1998/09/03 16:03:18 florian
  2726. + rtti generation
  2727. * init table generation changed
  2728. Revision 1.46 1998/09/01 17:39:48 peter
  2729. + internal constant functions
  2730. Revision 1.45 1998/08/31 12:20:28 peter
  2731. * fixed array_dec when unknown type was used
  2732. Revision 1.44 1998/08/28 10:57:01 peter
  2733. * removed warnings
  2734. Revision 1.43 1998/08/25 13:09:25 pierre
  2735. * corrected mangling sheme :
  2736. cvar add Cprefix to the mixed case name whereas
  2737. export or public use direct name
  2738. Revision 1.42 1998/08/25 12:42:41 pierre
  2739. * CDECL changed to CVAR for variables
  2740. specifications are read in structures also
  2741. + started adding GPC compatibility mode ( option -Sp)
  2742. * names changed to lowercase
  2743. Revision 1.41 1998/08/23 21:04:36 florian
  2744. + rtti generation for classes added
  2745. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  2746. Revision 1.40 1998/08/21 15:48:58 pierre
  2747. * more cdecl chagnes
  2748. - better line info
  2749. - changes the definition options of a procvar
  2750. if it is a unnamed type
  2751. Revision 1.39 1998/08/19 00:42:40 peter
  2752. + subrange types for enums
  2753. + checking for bounds type with ranges
  2754. Revision 1.38 1998/08/12 19:20:39 peter
  2755. + public is the same as export for c_vars
  2756. * a exported/public c_var incs now the refcount
  2757. Revision 1.37 1998/08/11 15:31:38 peter
  2758. * write extended to ppu file
  2759. * new version 0.99.7
  2760. Revision 1.36 1998/08/10 14:50:09 peter
  2761. + localswitches, moduleswitches, globalswitches splitting
  2762. Revision 1.35 1998/07/26 21:59:00 florian
  2763. + better support for switch $H
  2764. + index access to ansi strings added
  2765. + assigment of data (records/arrays) containing ansi strings
  2766. Revision 1.34 1998/07/20 22:17:15 florian
  2767. * hex constants in numeric char (#$54#$43 ...) are now allowed
  2768. * there was a bug in record_var_dec which prevents the used
  2769. of nested variant records (for example drivers.tevent of tv)
  2770. Revision 1.33 1998/07/18 17:11:11 florian
  2771. + ansi string constants fixed
  2772. + switch $H partial implemented
  2773. Revision 1.32 1998/07/14 21:46:50 peter
  2774. * updated messages file
  2775. Revision 1.31 1998/07/14 14:46:53 peter
  2776. * released NEWINPUT
  2777. Revision 1.30 1998/07/10 00:00:00 peter
  2778. * fixed ttypesym bug finally
  2779. * fileinfo in the symtable and better using for unused vars
  2780. Revision 1.29 1998/06/25 14:04:21 peter
  2781. + internal inc/dec
  2782. Revision 1.28 1998/06/24 12:26:45 peter
  2783. * stricter var parsing like tp7 and some optimizes with directive
  2784. parsing
  2785. Revision 1.27 1998/06/12 16:15:34 pierre
  2786. * external name 'C_var';
  2787. export name 'intern_C_var';
  2788. cdecl;
  2789. cdecl;external;
  2790. are now supported only with -Sv switch
  2791. Revision 1.25 1998/06/09 16:01:45 pierre
  2792. + added procedure directive parsing for procvars
  2793. (accepted are popstack cdecl and pascal)
  2794. + added C vars with the following syntax
  2795. var C calias 'true_c_name';(can be followed by external)
  2796. reason is that you must add the Cprefix
  2797. which is target dependent
  2798. Revision 1.24 1998/06/05 14:37:32 pierre
  2799. * fixes for inline for operators
  2800. * inline procedure more correctly restricted
  2801. Revision 1.23 1998/06/04 23:51:50 peter
  2802. * m68k compiles
  2803. + .def file creation moved to gendef.pas so it could also be used
  2804. for win32
  2805. Revision 1.22 1998/06/03 22:48:59 peter
  2806. + wordbool,longbool
  2807. * rename bis,von -> high,low
  2808. * moved some systemunit loading/creating to psystem.pas
  2809. Revision 1.21 1998/06/03 22:14:19 florian
  2810. * problem with sizes of classes fixed (if the anchestor was declared
  2811. forward, the compiler doesn't update the child classes size)
  2812. Revision 1.20 1998/05/28 14:35:54 peter
  2813. * nicer error message when no id is used after var
  2814. Revision 1.19 1998/05/23 01:21:19 peter
  2815. + aktasmmode, aktoptprocessor, aktoutputformat
  2816. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2817. + $LIBNAME to set the library name where the unit will be put in
  2818. * splitted cgi386 a bit (codeseg to large for bp7)
  2819. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2820. Revision 1.18 1998/05/20 09:42:35 pierre
  2821. + UseTokenInfo now default
  2822. * unit in interface uses and implementation uses gives error now
  2823. * only one error for unknown symbol (uses lastsymknown boolean)
  2824. the problem came from the label code !
  2825. + first inlined procedures and function work
  2826. (warning there might be allowed cases were the result is still wrong !!)
  2827. * UseBrower updated gives a global list of all position of all used symbols
  2828. with switch -gb
  2829. Revision 1.17 1998/05/11 13:07:55 peter
  2830. + $ifdef NEWPPU for the new ppuformat
  2831. + $define GDB not longer required
  2832. * removed all warnings and stripped some log comments
  2833. * no findfirst/findnext anymore to remove smartlink *.o files
  2834. Revision 1.16 1998/05/05 12:05:42 florian
  2835. * problems with properties fixed
  2836. * crash fixed: i:=l when i and l are undefined, was a problem with
  2837. implementation of private/protected
  2838. Revision 1.15 1998/05/01 09:01:23 florian
  2839. + correct semantics of private and protected
  2840. * small fix in variable scope:
  2841. a id can be used in a parameter list of a method, even it is used in
  2842. an anchestor class as field id
  2843. Revision 1.14 1998/05/01 07:43:56 florian
  2844. + basics for rtti implemented
  2845. + switch $m (generate rtti for published sections)
  2846. Revision 1.13 1998/04/30 15:59:41 pierre
  2847. * GDB works again better :
  2848. correct type info in one pass
  2849. + UseTokenInfo for better source position
  2850. * fixed one remaining bug in scanner for line counts
  2851. * several little fixes
  2852. Revision 1.12 1998/04/29 10:33:57 pierre
  2853. + added some code for ansistring (not complete nor working yet)
  2854. * corrected operator overloading
  2855. * corrected nasm output
  2856. + started inline procedures
  2857. + added starstarn : use ** for exponentiation (^ gave problems)
  2858. + started UseTokenInfo cond to get accurate positions
  2859. Revision 1.11 1998/04/28 11:45:52 florian
  2860. * make it compilable with TP
  2861. + small COM problems solved to compile classes.pp
  2862. Revision 1.10 1998/04/27 23:10:28 peter
  2863. + new scanner
  2864. * $makelib -> if smartlink
  2865. * small filename fixes pmodule.setfilename
  2866. * moved import from files.pas -> import.pas
  2867. Revision 1.9 1998/04/10 21:36:56 florian
  2868. + some stuff to support method pointers (procedure of object) added
  2869. (declaration, parameter handling)
  2870. Revision 1.8 1998/04/10 15:39:48 florian
  2871. * more fixes to get classes.pas compiled
  2872. Revision 1.7 1998/04/09 23:02:15 florian
  2873. * small problems solved to get remake3 work
  2874. Revision 1.6 1998/04/09 22:16:35 florian
  2875. * problem with previous REGALLOC solved
  2876. * improved property support
  2877. Revision 1.5 1998/04/08 14:59:20 florian
  2878. * problem with new expr_type solved
  2879. Revision 1.4 1998/04/08 10:26:09 florian
  2880. * correct error handling of virtual constructors
  2881. * problem with new type declaration handling fixed
  2882. Revision 1.3 1998/04/07 22:45:05 florian
  2883. * bug0092, bug0115 and bug0121 fixed
  2884. + packed object/class/array
  2885. Revision 1.2 1998/04/05 13:58:35 peter
  2886. * fixed the -Ss bug
  2887. + warning for Virtual constructors
  2888. * helppages updated with -TGO32V1
  2889. }