pdecl.pas 119 KB

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