pdecl.pas 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Does declaration parsing for Free Pascal
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit pdecl;
  19. interface
  20. uses
  21. globtype,tokens,globals,symtable;
  22. var
  23. { pointer to the last read type symbol, (for "forward" }
  24. { types) }
  25. lasttypesym : ptypesym;
  26. { hack, which allows to use the current parsed }
  27. { object type as function argument type }
  28. testcurobject : byte;
  29. curobjectname : stringid;
  30. { reads a string type with optional length }
  31. { and returns a pointer to the string }
  32. { definition }
  33. function stringtype : pdef;
  34. { reads a string, file type or a type id and returns a name and }
  35. { pdef }
  36. function single_type(var s : string) : pdef;
  37. { reads the declaration blocks }
  38. procedure read_declarations(islibrary : boolean);
  39. { reads declarations in the interface part of a unit }
  40. procedure read_interface_declarations;
  41. implementation
  42. uses
  43. cobjects,scanner,aasm,tree,pass_1,strings,
  44. files,types,hcodegen,verbose,systems,import
  45. {$ifdef GDB}
  46. ,gdb
  47. {$endif GDB}
  48. { parser specific stuff }
  49. ,pbase,ptconst,pexpr,psub,pexports
  50. { processor specific stuff }
  51. {$ifdef i386}
  52. {$ifdef Ag386Bin}
  53. ,i386base
  54. {$else}
  55. ,i386
  56. {$endif}
  57. {$endif}
  58. {$ifdef m68k}
  59. ,m68k
  60. {$endif}
  61. ;
  62. function read_type(const name : stringid) : pdef;forward;
  63. { search in symtablestack used, but not defined type }
  64. procedure testforward_type(p : psym);{$ifndef FPC}far;{$endif}
  65. var
  66. reaktvarsymtable : psymtable;
  67. oldaktfilepos : tfileposinfo;
  68. begin
  69. if not(p^.typ=typesym) then
  70. exit;
  71. if ((p^.properties and sp_forwarddef)<>0) then
  72. begin
  73. oldaktfilepos:=aktfilepos;
  74. aktfilepos:=p^.fileinfo;
  75. Message1(sym_e_forward_type_not_resolved,p^.name);
  76. aktfilepos:=oldaktfilepos;
  77. { try to recover }
  78. ptypesym(p)^.definition:=generrordef;
  79. p^.properties:=p^.properties and (not sp_forwarddef);
  80. end
  81. else
  82. if (ptypesym(p)^.definition^.deftype in [recorddef,objectdef]) then
  83. begin
  84. if (ptypesym(p)^.definition^.deftype=recorddef) then
  85. reaktvarsymtable:=precdef(ptypesym(p)^.definition)^.symtable
  86. else
  87. reaktvarsymtable:=pobjectdef(ptypesym(p)^.definition)^.publicsyms;
  88. {$ifdef tp}
  89. reaktvarsymtable^.foreach(testforward_type);
  90. {$else}
  91. reaktvarsymtable^.foreach(@testforward_type);
  92. {$endif}
  93. end;
  94. end;
  95. procedure const_dec;
  96. var
  97. name : stringid;
  98. p : ptree;
  99. def : pdef;
  100. sym : psym;
  101. storetokenpos,filepos : tfileposinfo;
  102. old_block_type : tblock_type;
  103. ps : pconstset;
  104. pd : pbestreal;
  105. sp : pstring;
  106. l : longint;
  107. begin
  108. consume(_CONST);
  109. old_block_type:=block_type;
  110. block_type:=bt_const;
  111. repeat
  112. name:=pattern;
  113. filepos:=tokenpos;
  114. consume(ID);
  115. case token of
  116. EQUAL:
  117. begin
  118. consume(EQUAL);
  119. p:=comp_expr(true);
  120. do_firstpass(p);
  121. storetokenpos:=tokenpos;
  122. tokenpos:=filepos;
  123. case p^.treetype of
  124. ordconstn:
  125. begin
  126. if is_constintnode(p) then
  127. symtablestack^.insert(new(pconstsym,init(name,constint,p^.value,nil)))
  128. else if is_constcharnode(p) then
  129. symtablestack^.insert(new(pconstsym,init(name,constchar,p^.value,nil)))
  130. else if is_constboolnode(p) then
  131. symtablestack^.insert(new(pconstsym,init(name,constbool,p^.value,nil)))
  132. else if p^.resulttype^.deftype=enumdef then
  133. symtablestack^.insert(new(pconstsym,init(name,constord,p^.value,p^.resulttype)))
  134. else if p^.resulttype^.deftype=pointerdef then
  135. symtablestack^.insert(new(pconstsym,init(name,constord,p^.value,p^.resulttype)))
  136. else internalerror(111);
  137. end;
  138. stringconstn:
  139. begin
  140. if p^.length>255 then
  141. l:=255
  142. else
  143. l:=p^.length;
  144. { value_str is disposed with p so I need a copy }
  145. getmem(sp,l+1);
  146. move(p^.value_str^,sp^[1],l);
  147. {$ifndef TP}
  148. {$ifopt H+}
  149. setlength(sp^,l);
  150. {$else}
  151. sp^[0]:=chr(l);
  152. {$endif}
  153. {$else}
  154. sp^[0]:=chr(l);
  155. {$endif}
  156. symtablestack^.insert(new(pconstsym,init(name,conststring,longint(sp),nil)));
  157. end;
  158. realconstn :
  159. begin
  160. new(pd);
  161. pd^:=p^.value_real;
  162. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd),nil)));
  163. end;
  164. setconstn :
  165. begin
  166. new(ps);
  167. ps^:=p^.value_set^;
  168. symtablestack^.insert(new(pconstsym,init(name,constset,longint(ps),p^.resulttype)));
  169. end;
  170. niln :
  171. begin
  172. symtablestack^.insert(new(pconstsym,init(name,constnil,0,p^.resulttype)));
  173. end;
  174. else
  175. Message(cg_e_illegal_expression);
  176. end;
  177. tokenpos:=storetokenpos;
  178. consume(SEMICOLON);
  179. disposetree(p);
  180. end;
  181. COLON:
  182. begin
  183. { set the blocktype first so a consume also supports a
  184. caret, to support const s : ^string = nil }
  185. block_type:=bt_type;
  186. consume(COLON);
  187. ignore_equal:=true;
  188. def:=read_type('');
  189. ignore_equal:=false;
  190. block_type:=bt_const;
  191. storetokenpos:=tokenpos;
  192. tokenpos:=filepos;
  193. sym:=new(ptypedconstsym,init(name,def));
  194. tokenpos:=storetokenpos;
  195. symtablestack^.insert(sym);
  196. consume(EQUAL);
  197. readtypedconst(def,ptypedconstsym(sym));
  198. consume(SEMICOLON);
  199. end;
  200. else consume(EQUAL);
  201. end;
  202. until token<>ID;
  203. block_type:=old_block_type;
  204. end;
  205. procedure label_dec;
  206. var
  207. hl : plabel;
  208. begin
  209. consume(_LABEL);
  210. if not(cs_support_goto in aktmoduleswitches) then
  211. Message(sym_e_goto_and_label_not_supported);
  212. repeat
  213. if not(token in [ID,INTCONST]) then
  214. consume(ID)
  215. else
  216. begin
  217. getlabel(hl);
  218. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  219. consume(token);
  220. end;
  221. if token<>SEMICOLON then consume(COMMA);
  222. until not(token in [ID,INTCONST]);
  223. consume(SEMICOLON);
  224. end;
  225. procedure read_var_decs(is_record,is_object:boolean);
  226. { reads the filed of a record into a }
  227. { symtablestack, if record=false }
  228. { variants are forbidden, so this procedure }
  229. { can be used to read object fields }
  230. { if absolute is true, ABSOLUTE and file }
  231. { types are allowed }
  232. { => the procedure is also used to read }
  233. { a sequence of variable declaration }
  234. var
  235. sc : pstringcontainer;
  236. s : stringid;
  237. old_block_type : tblock_type;
  238. declarepos,storetokenpos : tfileposinfo;
  239. symdone : boolean;
  240. { to handle absolute }
  241. abssym : pabsolutesym;
  242. l : longint;
  243. code : word;
  244. { c var }
  245. newtype : ptypesym;
  246. is_dll,
  247. is_gpc_name,is_cdecl,extern_aktvarsym,export_aktvarsym : boolean;
  248. dll_name,
  249. C_name : string;
  250. { case }
  251. p,casedef : pdef;
  252. { maxsize contains the max. size of a variant }
  253. { startvarrec contains the start of the variant part of a record }
  254. maxsize,startvarrec : longint;
  255. pt : ptree;
  256. begin
  257. old_block_type:=block_type;
  258. block_type:=bt_type;
  259. is_gpc_name:=false;
  260. { Force an expected ID error message }
  261. if not (token in [ID,_CASE,_END]) then
  262. consume(ID);
  263. { read vars }
  264. while (token=ID) and
  265. not(is_object and (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED])) do
  266. begin
  267. C_name:=orgpattern;
  268. sc:=idlist;
  269. consume(COLON);
  270. if (m_gpc in aktmodeswitches) and
  271. not(is_record or is_object) and
  272. (token=ID) and (orgpattern='__asmname__') then
  273. begin
  274. consume(ID);
  275. C_name:=pattern;
  276. if token=CCHAR then
  277. consume(CCHAR)
  278. else
  279. consume(CSTRING);
  280. Is_gpc_name:=true;
  281. end;
  282. p:=read_type('');
  283. symdone:=false;
  284. if is_gpc_name then
  285. begin
  286. storetokenpos:=tokenpos;
  287. s:=sc^.get_with_tokeninfo(tokenpos);
  288. if not sc^.empty then
  289. Message(parser_e_absolute_only_one_var);
  290. dispose(sc,done);
  291. aktvarsym:=new(pvarsym,init_C(s,target_os.Cprefix+C_name,p));
  292. tokenpos:=storetokenpos;
  293. aktvarsym^.var_options:=aktvarsym^.var_options or vo_is_external;
  294. concat_external(aktvarsym^.mangledname,EXT_NEAR);
  295. symtablestack^.insert(aktvarsym);
  296. symdone:=true;
  297. end;
  298. { check for absolute }
  299. if not symdone and
  300. (idtoken=_ABSOLUTE) and not(is_record or is_object) then
  301. begin
  302. consume(_ABSOLUTE);
  303. { only allowed for one var }
  304. s:=sc^.get_with_tokeninfo(declarepos);
  305. if not sc^.empty then
  306. Message(parser_e_absolute_only_one_var);
  307. dispose(sc,done);
  308. { parse the rest }
  309. if token=ID then
  310. begin
  311. getsym(pattern,true);
  312. consume(ID);
  313. { we should check the result type of srsym }
  314. if not (srsym^.typ in [varsym,typedconstsym]) then
  315. Message(parser_e_absolute_only_to_var_or_const);
  316. storetokenpos:=tokenpos;
  317. tokenpos:=declarepos;
  318. abssym:=new(pabsolutesym,init(s,p));
  319. abssym^.abstyp:=tovar;
  320. abssym^.ref:=srsym;
  321. tokenpos:=storetokenpos;
  322. symtablestack^.insert(abssym);
  323. end
  324. else
  325. if (token=CSTRING) or (token=CCHAR) then
  326. begin
  327. storetokenpos:=tokenpos;
  328. tokenpos:=declarepos;
  329. abssym:=new(pabsolutesym,init(s,p));
  330. s:=pattern;
  331. consume(token);
  332. abssym^.abstyp:=toasm;
  333. abssym^.asmname:=stringdup(s);
  334. tokenpos:=storetokenpos;
  335. symtablestack^.insert(abssym);
  336. end
  337. else
  338. { absolute address ?!? }
  339. if token=INTCONST then
  340. begin
  341. if (target_info.target=target_i386_go32v2) then
  342. begin
  343. storetokenpos:=tokenpos;
  344. tokenpos:=declarepos;
  345. abssym:=new(pabsolutesym,init(s,p));
  346. abssym^.abstyp:=toaddr;
  347. abssym^.absseg:=false;
  348. tokenpos:=storetokenpos;
  349. s:=pattern;
  350. consume(INTCONST);
  351. val(s,abssym^.address,code);
  352. if token=COLON then
  353. begin
  354. consume(token);
  355. s:=pattern;
  356. consume(INTCONST);
  357. val(s,l,code);
  358. abssym^.address:=abssym^.address shl 4+l;
  359. abssym^.absseg:=true;
  360. end;
  361. symtablestack^.insert(abssym);
  362. end
  363. else
  364. Message(parser_e_absolute_only_to_var_or_const);
  365. end
  366. else
  367. Message(parser_e_absolute_only_to_var_or_const);
  368. symdone:=true;
  369. end;
  370. { for a record there doesn't need to be a ; before the END or ) }
  371. if not((is_record or is_object) and (token in [_END,RKLAMMER])) then
  372. consume(SEMICOLON);
  373. { procvar handling }
  374. if (p^.deftype=procvardef) and (p^.sym=nil) then
  375. begin
  376. newtype:=new(ptypesym,init('unnamed',p));
  377. parse_var_proc_directives(newtype);
  378. newtype^.definition:=nil;
  379. p^.sym:=nil;
  380. dispose(newtype,done);
  381. end;
  382. { Check for variable directives }
  383. if not symdone and (token=ID) then
  384. begin
  385. { Check for C Variable declarations }
  386. if (m_cvar_support in aktmodeswitches) and
  387. not(is_record or is_object) and
  388. (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) then
  389. begin
  390. { only allowed for one var }
  391. s:=sc^.get_with_tokeninfo(declarepos);
  392. if not sc^.empty then
  393. Message(parser_e_absolute_only_one_var);
  394. dispose(sc,done);
  395. { defaults }
  396. is_dll:=false;
  397. is_cdecl:=false;
  398. extern_aktvarsym:=false;
  399. export_aktvarsym:=false;
  400. { cdecl }
  401. if idtoken=_CVAR then
  402. begin
  403. consume(_CVAR);
  404. consume(SEMICOLON);
  405. is_cdecl:=true;
  406. C_name:=target_os.Cprefix+C_name;
  407. end;
  408. { external }
  409. if idtoken=_EXTERNAL then
  410. begin
  411. consume(_EXTERNAL);
  412. extern_aktvarsym:=true;
  413. end;
  414. { export }
  415. if idtoken in [_EXPORT,_PUBLIC] then
  416. begin
  417. consume(ID);
  418. if extern_aktvarsym then
  419. Message(parser_e_not_external_and_export)
  420. else
  421. export_aktvarsym:=true;
  422. end;
  423. { external and export need a name after when no cdecl is used }
  424. if not is_cdecl then
  425. begin
  426. { dll name ? }
  427. if (extern_aktvarsym) and (token=CSTRING) then
  428. begin
  429. is_dll:=true;
  430. dll_name:=pattern;
  431. consume(CSTRING);
  432. end;
  433. consume(_NAME);
  434. C_name:=pattern;
  435. { allow also char }
  436. if token=CCHAR then
  437. consume(CCHAR)
  438. else
  439. consume(CSTRING);
  440. end;
  441. { consume the ; when export or external is used }
  442. if extern_aktvarsym or export_aktvarsym then
  443. consume(SEMICOLON);
  444. { insert in the symtable }
  445. storetokenpos:=tokenpos;
  446. tokenpos:=declarepos;
  447. if is_dll then
  448. aktvarsym:=new(pvarsym,init_dll(s,p))
  449. else
  450. aktvarsym:=new(pvarsym,init_C(s,C_name,p));
  451. tokenpos:=storetokenpos;
  452. { set some vars options }
  453. if export_aktvarsym then
  454. inc(aktvarsym^.refs);
  455. if extern_aktvarsym then
  456. aktvarsym^.var_options:=aktvarsym^.var_options or vo_is_external;
  457. { insert in the stack/datasegment }
  458. symtablestack^.insert(aktvarsym);
  459. { now we can insert it in the import lib if its a dll, or
  460. add it to the externals }
  461. if extern_aktvarsym then
  462. begin
  463. if is_dll then
  464. begin
  465. if not(current_module^.uses_imports) then
  466. begin
  467. current_module^.uses_imports:=true;
  468. importlib^.preparelib(current_module^.modulename^);
  469. end;
  470. importlib^.importvariable(aktvarsym^.mangledname,dll_name,C_name)
  471. end
  472. else
  473. concat_external(aktvarsym^.mangledname,EXT_NEAR);
  474. end;
  475. symdone:=true;
  476. end
  477. else
  478. if (is_object) and (cs_static_keyword in aktglobalswitches) and (idtoken=_STATIC) then
  479. begin
  480. current_object_option:=current_object_option or sp_static;
  481. insert_syms(symtablestack,sc,p);
  482. current_object_option:=current_object_option - sp_static;
  483. consume(_STATIC);
  484. consume(SEMICOLON);
  485. symdone:=true;
  486. end;
  487. end;
  488. { insert it in the symtable, if not done yet }
  489. if not symdone then
  490. begin
  491. if (current_object_option=sp_published) and
  492. (not((p^.deftype=objectdef) and (pobjectdef(p)^.isclass))) then
  493. Message(parser_e_cant_publish_that);
  494. insert_syms(symtablestack,sc,p);
  495. end;
  496. end;
  497. { Check for Case }
  498. if is_record and (token=_CASE) then
  499. begin
  500. maxsize:=0;
  501. consume(_CASE);
  502. s:=pattern;
  503. getsym(s,false);
  504. { may be only a type: }
  505. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  506. casedef:=read_type('')
  507. else
  508. begin
  509. consume(ID);
  510. consume(COLON);
  511. casedef:=read_type('');
  512. symtablestack^.insert(new(pvarsym,init(s,casedef)));
  513. end;
  514. if not is_ordinal(casedef) then
  515. Message(type_e_ordinal_expr_expected);
  516. consume(_OF);
  517. startvarrec:=symtablestack^.datasize;
  518. repeat
  519. repeat
  520. pt:=comp_expr(true);
  521. do_firstpass(pt);
  522. if not(pt^.treetype=ordconstn) then
  523. Message(cg_e_illegal_expression);
  524. disposetree(pt);
  525. if token=COMMA then
  526. consume(COMMA)
  527. else
  528. break;
  529. until false;
  530. consume(COLON);
  531. { read the vars }
  532. consume(LKLAMMER);
  533. if token<>RKLAMMER then
  534. read_var_decs(true,false);
  535. consume(RKLAMMER);
  536. { calculates maximal variant size }
  537. maxsize:=max(maxsize,symtablestack^.datasize);
  538. { the items of the next variant are overlayed }
  539. symtablestack^.datasize:=startvarrec;
  540. if (token<>_END) and (token<>RKLAMMER) then
  541. consume(SEMICOLON)
  542. else
  543. break;
  544. until (token=_END) or (token=RKLAMMER);
  545. { at last set the record size to that of the biggest variant }
  546. symtablestack^.datasize:=maxsize;
  547. end;
  548. block_type:=old_block_type;
  549. end;
  550. function stringtype : pdef;
  551. { reads a string type with optional length }
  552. { and returns a pointer to the string }
  553. { definition }
  554. var
  555. p : ptree;
  556. d : pdef;
  557. begin
  558. consume(_STRING);
  559. if token=LECKKLAMMER then
  560. begin
  561. consume(LECKKLAMMER);
  562. p:=comp_expr(true);
  563. do_firstpass(p);
  564. if not is_constintnode(p) then
  565. Message(cg_e_illegal_expression);
  566. if (p^.value<=0) then
  567. begin
  568. Message(parser_e_invalid_string_size);
  569. p^.value:=255;
  570. end;
  571. consume(RECKKLAMMER);
  572. if p^.value>255 then
  573. d:=new(pstringdef,longinit(p^.value))
  574. else
  575. if p^.value<>255 then
  576. d:=new(pstringdef,shortinit(p^.value))
  577. else
  578. d:=cshortstringdef;
  579. disposetree(p);
  580. end
  581. else
  582. begin
  583. if cs_ansistrings in aktlocalswitches then
  584. d:=cansistringdef
  585. else
  586. d:=cshortstringdef;
  587. end;
  588. stringtype:=d;
  589. end;
  590. function id_type(var s : string) : pdef;
  591. { reads a type definition and returns a pointer }
  592. { to a appropriating pdef, s gets the name of }
  593. { the type to allow name mangling }
  594. begin
  595. s:=pattern;
  596. consume(ID);
  597. { classes can be used also in classes }
  598. if (curobjectname=pattern) and aktobjectdef^.isclass then
  599. begin
  600. id_type:=aktobjectdef;
  601. exit;
  602. end;
  603. { objects can be parameters }
  604. if (testcurobject=2) and (curobjectname=pattern) then
  605. begin
  606. id_type:=aktobjectdef;
  607. exit;
  608. end;
  609. getsym(s,true);
  610. if assigned(srsym) then
  611. begin
  612. if srsym^.typ=unitsym then
  613. begin
  614. consume(POINT);
  615. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  616. s:=pattern;
  617. consume(ID);
  618. end;
  619. if srsym^.typ<>typesym then
  620. begin
  621. Message(type_e_type_id_expected);
  622. lasttypesym:=ptypesym(srsym);
  623. id_type:=generrordef;
  624. exit;
  625. end;
  626. if not forwardsallowed then
  627. testforward_type(srsym);
  628. end;
  629. lasttypesym:=ptypesym(srsym);
  630. id_type:=ptypesym(srsym)^.definition;
  631. end;
  632. function single_type(var s : string) : pdef;
  633. { reads a string, file type or a type id and returns a name and }
  634. { pdef }
  635. var
  636. hs : string;
  637. begin
  638. case token of
  639. _STRING:
  640. begin
  641. single_type:=stringtype;
  642. s:='STRING';
  643. lasttypesym:=nil;
  644. end;
  645. _FILE:
  646. begin
  647. consume(_FILE);
  648. if token=_OF then
  649. begin
  650. consume(_OF);
  651. single_type:=new(pfiledef,init(ft_typed,single_type(hs)));
  652. s:='FILE$OF$'+hs;
  653. end
  654. else
  655. begin
  656. { single_type:=new(pfiledef,init(ft_untyped,nil));}
  657. single_type:=cfiledef;
  658. s:='FILE';
  659. end;
  660. lasttypesym:=nil;
  661. end;
  662. else single_type:=id_type(s);
  663. end;
  664. end;
  665. function object_dec(const n : stringid;fd : pobjectdef) : pdef;
  666. { this function parses an object or class declaration }
  667. var
  668. actmembertype : symprop;
  669. there_is_a_destructor : boolean;
  670. is_a_class : boolean;
  671. childof : pobjectdef;
  672. aktclass : pobjectdef;
  673. procedure constructor_head;
  674. begin
  675. consume(_CONSTRUCTOR);
  676. { must be at same level as in implementation }
  677. inc(lexlevel);
  678. parse_proc_head(poconstructor);
  679. dec(lexlevel);
  680. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'INIT') then
  681. Message(parser_e_constructorname_must_be_init);
  682. aktclass^.options:=aktclass^.options or oo_hasconstructor;
  683. consume(SEMICOLON);
  684. begin
  685. if (aktclass^.options and oo_is_class)<>0 then
  686. begin
  687. { CLASS constructors return the created instance }
  688. aktprocsym^.definition^.retdef:=aktclass;
  689. end
  690. else
  691. begin
  692. { OBJECT constructors return a boolean }
  693. {$IfDef GDB}
  694. {GDB doesn't like unnamed types !}
  695. aktprocsym^.definition^.retdef:=
  696. globaldef('boolean');
  697. {$Else GDB}
  698. aktprocsym^.definition^.retdef:=
  699. new(porddef,init(bool8bit,0,1));
  700. {$Endif GDB}
  701. end;
  702. end;
  703. end;
  704. procedure property_dec;
  705. var
  706. sym : psym;
  707. propertyparas : pdefcoll;
  708. { returns the matching procedure to access a property }
  709. function get_procdef : pprocdef;
  710. var
  711. p : pprocdef;
  712. begin
  713. p:=pprocsym(sym)^.definition;
  714. get_procdef:=nil;
  715. while assigned(p) do
  716. begin
  717. if equal_paras(p^.para1,propertyparas,true) then
  718. break;
  719. p:=p^.nextoverloaded;
  720. end;
  721. get_procdef:=p;
  722. end;
  723. var
  724. hp2,datacoll : pdefcoll;
  725. p,p2 : ppropertysym;
  726. overriden : psym;
  727. hs : string;
  728. code : word;
  729. varspez : tvarspez;
  730. sc : pstringcontainer;
  731. hp : pdef;
  732. s : string;
  733. declarepos : tfileposinfo;
  734. pp : pprocdef;
  735. pt : ptree;
  736. propname : stringid;
  737. begin
  738. { check for a class }
  739. if (aktclass^.options and oo_is_class=0) then
  740. Message(parser_e_syntax_error);
  741. consume(_PROPERTY);
  742. propertyparas:=nil;
  743. datacoll:=nil;
  744. if token=ID then
  745. begin
  746. p:=new(ppropertysym,init(pattern));
  747. propname:=pattern;
  748. consume(ID);
  749. { property parameters ? }
  750. if token=LECKKLAMMER then
  751. begin
  752. if current_object_option=sp_published then
  753. Message(parser_e_cant_publish_that_property);
  754. { create a list of the parameters in propertyparas }
  755. consume(LECKKLAMMER);
  756. inc(testcurobject);
  757. repeat
  758. if token=_VAR then
  759. begin
  760. consume(_VAR);
  761. varspez:=vs_var;
  762. end
  763. else if token=_CONST then
  764. begin
  765. consume(_CONST);
  766. varspez:=vs_const;
  767. end
  768. else varspez:=vs_value;
  769. sc:=idlist;
  770. if token=COLON then
  771. begin
  772. consume(COLON);
  773. if token=_ARRAY then
  774. begin
  775. {
  776. if (varspez<>vs_const) and
  777. (varspez<>vs_var) then
  778. begin
  779. varspez:=vs_const;
  780. Message(parser_e_illegal_open_parameter);
  781. end;
  782. }
  783. consume(_ARRAY);
  784. consume(_OF);
  785. { define range and type of range }
  786. hp:=new(parraydef,init(0,-1,s32bitdef));
  787. { define field type }
  788. parraydef(hp)^.definition:=single_type(s);
  789. end
  790. else
  791. hp:=single_type(s);
  792. end
  793. else
  794. hp:=new(pformaldef,init);
  795. s:=sc^.get_with_tokeninfo(declarepos);
  796. while s<>'' do
  797. begin
  798. new(hp2);
  799. hp2^.paratyp:=varspez;
  800. hp2^.data:=hp;
  801. hp2^.next:=propertyparas;
  802. propertyparas:=hp2;
  803. s:=sc^.get_with_tokeninfo(declarepos);
  804. end;
  805. dispose(sc,done);
  806. if token=SEMICOLON then consume(SEMICOLON)
  807. else break;
  808. until false;
  809. dec(testcurobject);
  810. consume(RECKKLAMMER);
  811. end;
  812. { overriden property ? }
  813. { force property interface, if there is a property parameter }
  814. if (token=COLON) or assigned(propertyparas) then
  815. begin
  816. consume(COLON);
  817. p^.proptype:=single_type(hs);
  818. if (idtoken=_INDEX) then
  819. begin
  820. consume(_INDEX);
  821. p^.options:=p^.options or ppo_indexed;
  822. if token=INTCONST then
  823. val(pattern,p^.index,code);
  824. consume(INTCONST);
  825. { concat a longint to the para template }
  826. new(hp2);
  827. hp2^.paratyp:=vs_value;
  828. hp2^.data:=s32bitdef;
  829. hp2^.next:=propertyparas;
  830. propertyparas:=hp2;
  831. end;
  832. end
  833. else
  834. begin
  835. { do an property override }
  836. overriden:=search_class_member(aktclass,propname);
  837. if assigned(overriden) and (overriden^.typ=propertysym) then
  838. begin
  839. { take the whole info: }
  840. p^.options:=ppropertysym(overriden)^.options;
  841. p^.index:=ppropertysym(overriden)^.index;
  842. p^.proptype:=ppropertysym(overriden)^.proptype;
  843. p^.writeaccesssym:=ppropertysym(overriden)^.writeaccesssym;
  844. p^.readaccesssym:=ppropertysym(overriden)^.readaccesssym;
  845. p^.writeaccessdef:=ppropertysym(overriden)^.writeaccessdef;
  846. p^.readaccessdef:=ppropertysym(overriden)^.readaccessdef;
  847. p^.storedsym:=ppropertysym(overriden)^.storedsym;
  848. p^.storeddef:=ppropertysym(overriden)^.storeddef;
  849. p^.default:=ppropertysym(overriden)^.default;
  850. end
  851. else
  852. begin
  853. p^.proptype:=generrordef;
  854. message(parser_e_no_property_found_to_override);
  855. end;
  856. end;
  857. if (current_object_option=sp_published) and
  858. not(p^.proptype^.is_publishable) then
  859. Message(parser_e_cant_publish_that_property);
  860. { create data defcoll to allow correct parameter checks }
  861. new(datacoll);
  862. datacoll^.paratyp:=vs_value;
  863. datacoll^.data:=p^.proptype;
  864. datacoll^.next:=nil;
  865. if (idtoken=_READ) then
  866. begin
  867. consume(_READ);
  868. sym:=search_class_member(aktclass,pattern);
  869. if not(assigned(sym)) then
  870. Message1(sym_e_unknown_id,pattern)
  871. else
  872. begin
  873. { varsym aren't allowed for an indexed property
  874. or an property with parameters }
  875. if ((sym^.typ=varsym) and
  876. { not necessary, an index forces propertyparas
  877. to be assigned
  878. }
  879. { (((p^.options and ppo_indexed)<>0) or }
  880. assigned(propertyparas)) or
  881. not(sym^.typ in [varsym,procsym]) then
  882. Message(parser_e_ill_property_access_sym);
  883. { search the matching definition }
  884. if sym^.typ=procsym then
  885. begin
  886. pp:=get_procdef;
  887. if not(assigned(pp)) or
  888. not(is_equal(pp^.retdef,p^.proptype)) then
  889. Message(parser_e_ill_property_access_sym);
  890. p^.readaccessdef:=pp;
  891. end
  892. else if sym^.typ=varsym then
  893. begin
  894. if not(is_equal(pvarsym(sym)^.definition,
  895. p^.proptype)) then
  896. Message(parser_e_ill_property_access_sym);
  897. end;
  898. p^.readaccesssym:=sym;
  899. end;
  900. consume(ID);
  901. end;
  902. if (idtoken=_WRITE) then
  903. begin
  904. consume(_WRITE);
  905. sym:=search_class_member(aktclass,pattern);
  906. if not(assigned(sym)) then
  907. Message1(sym_e_unknown_id,pattern)
  908. else
  909. begin
  910. if ((sym^.typ=varsym) and
  911. assigned(propertyparas)) or
  912. not(sym^.typ in [varsym,procsym]) then
  913. Message(parser_e_ill_property_access_sym);
  914. { search the matching definition }
  915. if sym^.typ=procsym then
  916. begin
  917. { insert data entry to check access method }
  918. datacoll^.next:=propertyparas;
  919. propertyparas:=datacoll;
  920. pp:=get_procdef;
  921. { ... and remove it }
  922. propertyparas:=propertyparas^.next;
  923. datacoll^.next:=nil;
  924. if not(assigned(pp)) then
  925. Message(parser_e_ill_property_access_sym);
  926. p^.writeaccessdef:=pp;
  927. end
  928. else if sym^.typ=varsym then
  929. begin
  930. if not(is_equal(pvarsym(sym)^.definition,
  931. p^.proptype)) then
  932. Message(parser_e_ill_property_access_sym);
  933. end;
  934. p^.writeaccesssym:=sym;
  935. end;
  936. consume(ID);
  937. end;
  938. if (idtoken=_STORED) then
  939. begin
  940. consume(_STORED);
  941. Message(parser_w_stored_not_implemented);
  942. { !!!!!!!! }
  943. end;
  944. if (idtoken=_DEFAULT) then
  945. begin
  946. consume(_DEFAULT);
  947. if not(is_ordinal(p^.proptype) or
  948. ((p^.proptype^.deftype=setdef) and
  949. (psetdef(p^.proptype)^.settype=smallset)
  950. ) or
  951. assigned(propertyparas)
  952. ) then
  953. Message(parser_e_property_cant_have_a_default_value);
  954. pt:=comp_expr(true);
  955. pt:=gentypeconvnode(pt,p^.proptype);
  956. do_firstpass(pt);
  957. if not(is_constnode(pt)) then
  958. Message(parser_e_property_default_value_must_const);
  959. if pt^.treetype=setconstn then
  960. p^.default:=plongint(pt^.value_set)^
  961. else
  962. p^.default:=pt^.value;
  963. disposetree(pt);
  964. end
  965. else if (idtoken=_NODEFAULT) then
  966. begin
  967. consume(_NODEFAULT);
  968. p^.default:=0;
  969. end;
  970. symtablestack^.insert(p);
  971. { default property ? }
  972. consume(SEMICOLON);
  973. if (idtoken=_DEFAULT) then
  974. begin
  975. consume(_DEFAULT);
  976. p2:=search_default_property(aktclass);
  977. if assigned(p2) then
  978. message1(parser_e_only_one_default_property,
  979. pobjectdef(p2^.owner^.defowner)^.name^)
  980. else
  981. begin
  982. p^.options:=p^.options or ppo_defaultproperty;
  983. if not(assigned(propertyparas)) then
  984. message(parser_e_property_need_paras);
  985. end;
  986. consume(SEMICOLON);
  987. end;
  988. { clean up }
  989. if assigned(datacoll) then
  990. disposepdefcoll(datacoll);
  991. end
  992. else
  993. begin
  994. consume(ID);
  995. consume(SEMICOLON);
  996. end;
  997. if assigned(propertyparas) then
  998. disposepdefcoll(propertyparas);
  999. end;
  1000. procedure destructor_head;
  1001. begin
  1002. consume(_DESTRUCTOR);
  1003. inc(lexlevel);
  1004. parse_proc_head(podestructor);
  1005. dec(lexlevel);
  1006. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'DONE') then
  1007. Message(parser_e_destructorname_must_be_done);
  1008. aktclass^.options:=aktclass^.options or oo_hasdestructor;
  1009. consume(SEMICOLON);
  1010. if assigned(aktprocsym^.definition^.para1) then
  1011. Message(parser_e_no_paras_for_destructor);
  1012. { no return value }
  1013. aktprocsym^.definition^.retdef:=voiddef;
  1014. end;
  1015. var
  1016. hs : string;
  1017. pcrd : pclassrefdef;
  1018. hp1 : pdef;
  1019. hfp : pforwardpointer;
  1020. oldprocsym : pprocsym;
  1021. oldparse_only : boolean;
  1022. intmessagetable,strmessagetable,classnamelabel : plabel;
  1023. storetypeforwardsallowed : boolean;
  1024. pt : ptree;
  1025. begin
  1026. {Nowadays aktprocsym may already have a value, so we need to save
  1027. it.}
  1028. oldprocsym:=aktprocsym;
  1029. { forward is resolved }
  1030. if assigned(fd) then
  1031. fd^.options:=fd^.options and not(oo_isforward);
  1032. there_is_a_destructor:=false;
  1033. actmembertype:=sp_public;
  1034. { objects and class types can't be declared local }
  1035. if (symtablestack^.symtabletype<>globalsymtable) and
  1036. (symtablestack^.symtabletype<>staticsymtable) then
  1037. Message(parser_e_no_local_objects);
  1038. storetypeforwardsallowed:=typecanbeforward;
  1039. if m_tp in aktmodeswitches then
  1040. typecanbeforward:=false;
  1041. { distinguish classes and objects }
  1042. if token=_OBJECT then
  1043. begin
  1044. is_a_class:=false;
  1045. consume(_OBJECT)
  1046. end
  1047. else
  1048. begin
  1049. is_a_class:=true;
  1050. consume(_CLASS);
  1051. if not(assigned(fd)) and (token=_OF) then
  1052. begin
  1053. { a hack, but it's easy to handle }
  1054. { class reference type }
  1055. consume(_OF);
  1056. if typecanbeforward then
  1057. forwardsallowed:=true;
  1058. hp1:=single_type(hs);
  1059. { accept hp1, if is a forward def ...}
  1060. if ((lasttypesym<>nil)
  1061. and ((lasttypesym^.properties and sp_forwarddef)<>0)) or
  1062. { or a class
  1063. (if the foward defined type is a class is checked, when
  1064. the forward is resolved)
  1065. }
  1066. ((hp1^.deftype=objectdef) and (
  1067. (pobjectdef(hp1)^.options and oo_is_class)<>0)) then
  1068. begin
  1069. pcrd:=new(pclassrefdef,init(hp1));
  1070. object_dec:=pcrd;
  1071. {I add big troubles here
  1072. with var p : ^byte in graph.putimage
  1073. because a save_forward was called and
  1074. no resolve forward
  1075. => so the definition was rewritten after
  1076. having been disposed !!
  1077. Strange problems appeared !!!!}
  1078. {Anyhow forwards should only be allowed
  1079. inside a type statement ??
  1080. don't you think so }
  1081. if (lasttypesym<>nil) and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  1082. begin
  1083. new(hfp);
  1084. hfp^.next:=lasttypesym^.forwardpointer;
  1085. hfp^.def:=ppointerdef(pcrd);
  1086. lasttypesym^.forwardpointer:=hfp;
  1087. end;
  1088. forwardsallowed:=false;
  1089. end
  1090. else
  1091. begin
  1092. Message(type_e_class_type_expected);
  1093. object_dec:=new(perrordef,init);
  1094. end;
  1095. exit;
  1096. end
  1097. { forward class }
  1098. else if not(assigned(fd)) and (token=SEMICOLON) then
  1099. begin
  1100. { also anonym objects aren't allow (o : object a : longint; end;) }
  1101. if n='' then
  1102. begin
  1103. Message(parser_f_no_anonym_objects)
  1104. end;
  1105. if n='TOBJECT' then
  1106. begin
  1107. aktclass:=new(pobjectdef,init(n,nil));
  1108. class_tobject:=aktclass;
  1109. end
  1110. else
  1111. aktclass:=new(pobjectdef,init(n,nil));
  1112. aktclass^.options:=aktclass^.options or oo_is_class or oo_isforward;
  1113. { all classes must have a vmt !! at offset zero }
  1114. if (aktclass^.options and oo_hasvmt)=0 then
  1115. aktclass^.insertvmt;
  1116. object_dec:=aktclass;
  1117. exit;
  1118. end;
  1119. end;
  1120. { also anonym objects aren't allow (o : object a : longint; end;) }
  1121. if n='' then
  1122. Message(parser_f_no_anonym_objects);
  1123. { read the parent class }
  1124. if token=LKLAMMER then
  1125. begin
  1126. consume(LKLAMMER);
  1127. { does not allow objects.tobject !! }
  1128. {if token<>ID then
  1129. consume(ID);
  1130. getsym(pattern,true);}
  1131. childof:=pobjectdef(id_type(pattern));
  1132. if (childof^.deftype<>objectdef) then
  1133. begin
  1134. Message(type_e_class_type_expected);
  1135. childof:=nil;
  1136. end
  1137. else
  1138. begin
  1139. { a mix of class and object isn't allowed }
  1140. if (((childof^.options and oo_is_class)<>0) and not is_a_class) or
  1141. (((childof^.options and oo_is_class)=0) and is_a_class) then
  1142. Message(parser_e_mix_of_classes_and_objects);
  1143. end;
  1144. if assigned(fd) then
  1145. begin
  1146. { the forward of the child must be resolved to get
  1147. correct field addresses
  1148. }
  1149. if (childof^.options and oo_isforward)<>0 then
  1150. Message1(parser_e_forward_declaration_must_be_resolved,childof^.name^);
  1151. aktclass:=fd;
  1152. { we must inherit several options !!
  1153. this was missing !!
  1154. all is now done in set_parent
  1155. including symtable datasize setting PM }
  1156. fd^.set_parent(childof);
  1157. end
  1158. else
  1159. aktclass:=new(pobjectdef,init(n,childof));
  1160. consume(RKLAMMER);
  1161. end
  1162. { if no parent class, then a class get tobject as parent }
  1163. else if is_a_class then
  1164. begin
  1165. { is the current class tobject? }
  1166. { so you could define your own tobject }
  1167. if n='TOBJECT' then
  1168. begin
  1169. if assigned(fd) then
  1170. aktclass:=fd
  1171. else
  1172. aktclass:=new(pobjectdef,init(n,nil));
  1173. class_tobject:=aktclass;
  1174. end
  1175. else
  1176. begin
  1177. childof:=class_tobject;
  1178. if assigned(fd) then
  1179. begin
  1180. { the forward of the child must be resolved to get
  1181. correct field addresses
  1182. }
  1183. if (childof^.options and oo_isforward)<>0 then
  1184. Message1(parser_e_forward_declaration_must_be_resolved,childof^.name^);
  1185. aktclass:=fd;
  1186. aktclass^.set_parent(childof);
  1187. end
  1188. else
  1189. begin
  1190. aktclass:=new(pobjectdef,init(n,childof));
  1191. aktclass^.set_parent(childof);
  1192. end;
  1193. end;
  1194. end
  1195. else
  1196. aktclass:=new(pobjectdef,init(n,nil));
  1197. { set the class attribute }
  1198. if is_a_class then
  1199. begin
  1200. aktclass^.options:=aktclass^.options or oo_is_class;
  1201. if (cs_generate_rtti in aktlocalswitches) or
  1202. (assigned(aktclass^.childof) and
  1203. ((aktclass^.childof^.options and oo_can_have_published)<>0)
  1204. ) then
  1205. aktclass^.options:=aktclass^.options or oo_can_have_published;
  1206. end;
  1207. aktobjectdef:=aktclass;
  1208. { default access is public }
  1209. actmembertype:=sp_public;
  1210. aktclass^.publicsyms^.next:=symtablestack;
  1211. symtablestack:=aktclass^.publicsyms;
  1212. procinfo._class:=aktclass;
  1213. testcurobject:=1;
  1214. curobjectname:=n;
  1215. { short class declaration ? }
  1216. if (not is_a_class) or (token<>SEMICOLON) then
  1217. begin
  1218. { Parse componenten }
  1219. repeat
  1220. if actmembertype=sp_private then
  1221. aktclass^.options:=aktclass^.options or oo_hasprivate;
  1222. if actmembertype=sp_protected then
  1223. aktclass^.options:=aktclass^.options or oo_hasprotected;
  1224. case token of
  1225. ID : begin
  1226. case idtoken of
  1227. _PRIVATE : begin
  1228. consume(_PRIVATE);
  1229. actmembertype:=sp_private;
  1230. current_object_option:=sp_private;
  1231. end;
  1232. _PROTECTED : begin
  1233. consume(_PROTECTED);
  1234. current_object_option:=sp_protected;
  1235. actmembertype:=sp_protected;
  1236. end;
  1237. _PUBLIC : begin
  1238. consume(_PUBLIC);
  1239. current_object_option:=sp_public;
  1240. actmembertype:=sp_public;
  1241. end;
  1242. _PUBLISHED : begin
  1243. if (aktclass^.options and oo_can_have_published)=0 then
  1244. Message(parser_e_cant_have_published);
  1245. consume(_PUBLISHED);
  1246. current_object_option:=sp_published;
  1247. actmembertype:=sp_published;
  1248. end;
  1249. else
  1250. read_var_decs(false,true);
  1251. end;
  1252. end;
  1253. _PROPERTY : property_dec;
  1254. _PROCEDURE,
  1255. _FUNCTION,
  1256. _CLASS : begin
  1257. oldparse_only:=parse_only;
  1258. parse_only:=true;
  1259. parse_proc_dec;
  1260. parse_only:=oldparse_only;
  1261. if idtoken=_MESSAGE then
  1262. begin
  1263. { check parameter type }
  1264. if assigned(aktprocsym^.definition^.para1^.next) or
  1265. (aktprocsym^.definition^.para1^.paratyp<>vs_var) then
  1266. Message(parser_e_ill_msg_param);
  1267. consume(idtoken);
  1268. pt:=comp_expr(true);
  1269. do_firstpass(pt);
  1270. if pt^.treetype=stringconstn then
  1271. begin
  1272. aktprocsym^.definition^.options:=
  1273. aktprocsym^.definition^.options or pomsgstr;
  1274. aktprocsym^.definition^.messageinf.str:=strnew(pt^.value_str);
  1275. end
  1276. else if is_constintnode(pt) then
  1277. begin
  1278. aktprocsym^.definition^.options:=
  1279. aktprocsym^.definition^.options or pomsgint;
  1280. aktprocsym^.definition^.messageinf.i:=pt^.value;
  1281. end
  1282. else
  1283. Message(parser_e_ill_msg_expr);
  1284. disposetree(pt);
  1285. consume(SEMICOLON);
  1286. end
  1287. else
  1288. begin
  1289. case idtoken of
  1290. _DYNAMIC,
  1291. _VIRTUAL : begin
  1292. if actmembertype=sp_private then
  1293. Message(parser_w_priv_meth_not_virtual);
  1294. consume(idtoken);
  1295. consume(SEMICOLON);
  1296. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1297. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1298. end;
  1299. _OVERRIDE : begin
  1300. consume(_OVERRIDE);
  1301. consume(SEMICOLON);
  1302. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1303. pooverridingmethod or povirtualmethod;
  1304. end;
  1305. end;
  1306. if idtoken=_abstract then
  1307. begin
  1308. if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
  1309. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
  1310. else
  1311. Message(parser_e_only_virtual_methods_abstract);
  1312. consume(_ABSTRACT);
  1313. consume(SEMICOLON);
  1314. { the method is defined }
  1315. aktprocsym^.definition^.forwarddef:=false;
  1316. end;
  1317. if (cs_static_keyword in aktglobalswitches) and (idtoken=_STATIC) then
  1318. begin
  1319. consume(_STATIC);
  1320. consume(SEMICOLON);
  1321. aktprocsym^.properties:=aktprocsym^.properties or sp_static;
  1322. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or postaticmethod;
  1323. end;
  1324. end;
  1325. end;
  1326. _CONSTRUCTOR : begin
  1327. if actmembertype<>sp_public then
  1328. Message(parser_w_constructor_should_be_public);
  1329. oldparse_only:=parse_only;
  1330. parse_only:=true;
  1331. constructor_head;
  1332. parse_only:=oldparse_only;
  1333. case idtoken of
  1334. _DYNAMIC,
  1335. _VIRTUAL : begin
  1336. if not(aktclass^.isclass) then
  1337. Message(parser_e_constructor_cannot_be_not_virtual)
  1338. else
  1339. begin
  1340. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1341. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1342. end;
  1343. consume(idtoken);
  1344. consume(SEMICOLON);
  1345. end;
  1346. _OVERRIDE : begin
  1347. if (aktclass^.options and oo_is_class=0) then
  1348. Message(parser_e_constructor_cannot_be_not_virtual)
  1349. else
  1350. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1351. pooverridingmethod or povirtualmethod;
  1352. consume(_OVERRIDE);
  1353. consume(SEMICOLON);
  1354. end;
  1355. end;
  1356. end;
  1357. _DESTRUCTOR : begin
  1358. if there_is_a_destructor then
  1359. Message(parser_n_only_one_destructor);
  1360. there_is_a_destructor:=true;
  1361. if actmembertype<>sp_public then
  1362. Message(parser_w_destructor_should_be_public);
  1363. oldparse_only:=parse_only;
  1364. parse_only:=true;
  1365. destructor_head;
  1366. parse_only:=oldparse_only;
  1367. case idtoken of
  1368. _DYNAMIC,
  1369. _VIRTUAL : begin
  1370. consume(idtoken);
  1371. consume(SEMICOLON);
  1372. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1373. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1374. end;
  1375. _OVERRIDE : begin
  1376. consume(_OVERRIDE);
  1377. consume(SEMICOLON);
  1378. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1379. pooverridingmethod or povirtualmethod;
  1380. end;
  1381. end;
  1382. end;
  1383. _END : begin
  1384. consume(_END);
  1385. break;
  1386. end;
  1387. else
  1388. consume(ID); { Give a ident expected message, like tp7 }
  1389. end;
  1390. until false;
  1391. current_object_option:=sp_public;
  1392. end;
  1393. testcurobject:=0;
  1394. curobjectname:='';
  1395. typecanbeforward:=storetypeforwardsallowed;
  1396. { generate vmt space if needed }
  1397. if ((aktclass^.options and
  1398. (oo_hasvirtual or oo_hasconstructor or
  1399. oo_hasdestructor or oo_is_class))<>0) and
  1400. ((aktclass^.options and
  1401. oo_hasvmt)=0) then
  1402. aktclass^.insertvmt;
  1403. if (cs_smartlink in aktmoduleswitches) then
  1404. datasegment^.concat(new(pai_cut,init));
  1405. { write extended info for classes }
  1406. if is_a_class then
  1407. begin
  1408. if (aktclass^.options and oo_can_have_published)<>0 then
  1409. aktclass^.generate_rtti;
  1410. { write class name }
  1411. getlabel(classnamelabel);
  1412. datasegment^.concat(new(pai_label,init(classnamelabel)));
  1413. datasegment^.concat(new(pai_const,init_8bit(length(aktclass^.name^))));
  1414. datasegment^.concat(new(pai_string,init(aktclass^.name^)));
  1415. { generate message and dynamic tables }
  1416. strmessagetable:=genstrmsgtab(aktclass);
  1417. intmessagetable:=genintmsgtab(aktclass);
  1418. { table for string messages }
  1419. datasegment^.concat(new(pai_const_symbol,init(lab2str(strmessagetable))));
  1420. { interface table }
  1421. datasegment^.concat(new(pai_const,init_32bit(0)));
  1422. { auto table }
  1423. datasegment^.concat(new(pai_const,init_32bit(0)));
  1424. { inittable for con-/destruction }
  1425. if aktclass^.needs_inittable then
  1426. datasegment^.concat(new(pai_const_symbol,init(lab2str(aktclass^.get_inittable_label))))
  1427. else
  1428. datasegment^.concat(new(pai_const,init_32bit(0)));
  1429. { pointer to type info of published section }
  1430. if (aktclass^.options and oo_can_have_published)<>0 then
  1431. datasegment^.concat(new(pai_const_symbol,init(aktclass^.rtti_name)))
  1432. else
  1433. datasegment^.concat(new(pai_const,init_32bit(0)));
  1434. { pointer to field table }
  1435. datasegment^.concat(new(pai_const,init_32bit(0)));
  1436. { pointer to method table }
  1437. datasegment^.concat(new(pai_const,init_32bit(0)));
  1438. { pointer to dynamic table }
  1439. datasegment^.concat(new(pai_const_symbol,init(lab2str(intmessagetable))));
  1440. { pointer to class name string }
  1441. datasegment^.concat(new(pai_const_symbol,init(lab2str(classnamelabel))));
  1442. end;
  1443. {$ifdef GDB}
  1444. { generate the VMT }
  1445. if (cs_debuginfo in aktmoduleswitches) and
  1446. ((aktclass^.options and oo_hasvmt)<>0) then
  1447. begin
  1448. do_count_dbx:=true;
  1449. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1450. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1451. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1452. end;
  1453. {$endif GDB}
  1454. if ((aktclass^.options and oo_hasvmt)<>0) then
  1455. begin
  1456. datasegment^.concat(new(pai_symbol,init_global(aktclass^.vmt_mangledname)));
  1457. { determine the size with publicsyms^.datasize, because }
  1458. { size gives back 4 for classes }
  1459. datasegment^.concat(new(pai_const,init_32bit(aktclass^.publicsyms^.datasize)));
  1460. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.publicsyms^.datasize)));
  1461. { write pointer to parent VMT, this isn't implemented in TP }
  1462. { but this is not used in FPC ? (PM) }
  1463. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1464. { it is not written for parents that don't have any vmt !! }
  1465. if assigned(aktclass^.childof) and
  1466. ((aktclass^.childof^.options and oo_hasvmt)<>0) then
  1467. begin
  1468. datasegment^.concat(new(pai_const_symbol,init(aktclass^.childof^.vmt_mangledname)));
  1469. if aktclass^.childof^.owner^.symtabletype=unitsymtable then
  1470. concat_external(aktclass^.childof^.vmt_mangledname,EXT_NEAR);
  1471. end
  1472. else
  1473. datasegment^.concat(new(pai_const,init_32bit(0)));
  1474. { this generates the entries }
  1475. genvmt(aktclass);
  1476. end;
  1477. { number symbols and defs }
  1478. symtablestack^.number_defs;
  1479. symtablestack^.number_symbols;
  1480. { restore old state }
  1481. symtablestack:=symtablestack^.next;
  1482. procinfo._class:=nil;
  1483. aktobjectdef:=nil;
  1484. {Restore the aktprocsym.}
  1485. aktprocsym:=oldprocsym;
  1486. object_dec:=aktclass;
  1487. end;
  1488. { reads a record declaration }
  1489. function record_dec : pdef;
  1490. var
  1491. symtable : psymtable;
  1492. storetypeforwardsallowed : boolean;
  1493. begin
  1494. symtable:=new(psymtable,init(recordsymtable));
  1495. symtable^.next:=symtablestack;
  1496. symtablestack:=symtable;
  1497. consume(_RECORD);
  1498. storetypeforwardsallowed:=typecanbeforward;
  1499. if m_tp in aktmodeswitches then
  1500. typecanbeforward:=false;
  1501. read_var_decs(true,false);
  1502. { may be scale record size to a size of n*4 ? }
  1503. if ((symtablestack^.datasize mod aktpackrecords)<>0) then
  1504. inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
  1505. consume(_END);
  1506. typecanbeforward:=storetypeforwardsallowed;
  1507. { number symbols and defs }
  1508. symtablestack^.number_defs;
  1509. symtablestack^.number_symbols;
  1510. symtablestack:=symtable^.next;
  1511. record_dec:=new(precdef,init(symtable));
  1512. end;
  1513. { reads a type definition and returns a pointer to it }
  1514. function read_type(const name : stringid) : pdef;
  1515. function handle_procvar:Pprocvardef;
  1516. var
  1517. sc : pstringcontainer;
  1518. s : string;
  1519. p : pdef;
  1520. varspez : tvarspez;
  1521. procvardef : pprocvardef;
  1522. begin
  1523. procvardef:=new(pprocvardef,init);
  1524. if token=LKLAMMER then
  1525. begin
  1526. consume(LKLAMMER);
  1527. inc(testcurobject);
  1528. repeat
  1529. case token of
  1530. _VAR :
  1531. begin
  1532. consume(_VAR);
  1533. varspez:=vs_var;
  1534. end;
  1535. _CONST :
  1536. begin
  1537. consume(_CONST);
  1538. varspez:=vs_const;
  1539. end;
  1540. else
  1541. varspez:=vs_value;
  1542. end;
  1543. sc:=idlist;
  1544. if (token=COLON) or (varspez=vs_value) then
  1545. begin
  1546. consume(COLON);
  1547. if token=_ARRAY then
  1548. begin
  1549. consume(_ARRAY);
  1550. consume(_OF);
  1551. { define range and type of range }
  1552. p:=new(Parraydef,init(0,-1,s32bitdef));
  1553. { array of const ? }
  1554. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  1555. begin
  1556. consume(_CONST);
  1557. srsym:=nil;
  1558. if assigned(objpasunit) then
  1559. getsymonlyin(objpasunit,'TVARREC');
  1560. if not assigned(srsym) then
  1561. InternalError(1234124);
  1562. Parraydef(p)^.definition:=ptypesym(srsym)^.definition;
  1563. Parraydef(p)^.IsArrayOfConst:=true;
  1564. end
  1565. else
  1566. begin
  1567. { define field type }
  1568. Parraydef(p)^.definition:=single_type(s);
  1569. end;
  1570. end
  1571. else
  1572. p:=single_type(s);
  1573. end
  1574. else
  1575. p:=new(pformaldef,init);
  1576. while not sc^.empty do
  1577. begin
  1578. s:=sc^.get;
  1579. procvardef^.concatdef(p,varspez);
  1580. end;
  1581. dispose(sc,done);
  1582. if token=SEMICOLON then
  1583. consume(SEMICOLON)
  1584. else
  1585. break;
  1586. until false;
  1587. dec(testcurobject);
  1588. consume(RKLAMMER);
  1589. end;
  1590. handle_procvar:=procvardef;
  1591. end;
  1592. var
  1593. hp1,p : pdef;
  1594. aufdef : penumdef;
  1595. aufsym : penumsym;
  1596. ap : parraydef;
  1597. s : stringid;
  1598. l,v,oldaktpackrecords : longint;
  1599. hs : string;
  1600. procedure expr_type;
  1601. var
  1602. pt1,pt2 : ptree;
  1603. begin
  1604. { use of current parsed object ? }
  1605. if (token=ID) and (testcurobject=2) and (curobjectname=pattern) then
  1606. begin
  1607. consume(ID);
  1608. p:=aktobjectdef;
  1609. exit;
  1610. end;
  1611. { we can't accept a equal in type }
  1612. pt1:=comp_expr(not(ignore_equal));
  1613. do_firstpass(pt1);
  1614. if (token=POINTPOINT) then
  1615. begin
  1616. consume(POINTPOINT);
  1617. { get high value of range }
  1618. pt2:=comp_expr(not(ignore_equal));
  1619. do_firstpass(pt2);
  1620. { both must be evaluated to constants now }
  1621. if (pt1^.treetype<>ordconstn) or (pt2^.treetype<>ordconstn) then
  1622. Message(sym_e_error_in_type_def)
  1623. else
  1624. begin
  1625. { check types }
  1626. if not is_equal(pt1^.resulttype,pt2^.resulttype) then
  1627. Message(type_e_mismatch)
  1628. else
  1629. begin
  1630. { Check bounds }
  1631. if pt2^.value<pt1^.value then
  1632. Message(cg_e_upper_lower_than_lower)
  1633. else
  1634. begin
  1635. { All checks passed, create the new def }
  1636. case pt1^.resulttype^.deftype of
  1637. enumdef : p:=new(penumdef,init_subrange(penumdef(pt1^.resulttype),pt1^.value,pt2^.value));
  1638. orddef : begin
  1639. if is_char(pt1^.resulttype) then
  1640. p:=new(porddef,init(uchar,pt1^.value,pt2^.value))
  1641. else
  1642. if is_boolean(pt1^.resulttype) then
  1643. p:=new(porddef,init(bool8bit,pt1^.value,pt2^.value))
  1644. else
  1645. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1646. end;
  1647. end;
  1648. end;
  1649. end;
  1650. end;
  1651. disposetree(pt2);
  1652. end
  1653. else
  1654. begin
  1655. { a simple type renaming }
  1656. if (pt1^.treetype=typen) then
  1657. p:=pt1^.resulttype
  1658. else
  1659. Message(sym_e_error_in_type_def);
  1660. end;
  1661. disposetree(pt1);
  1662. end;
  1663. var
  1664. pt : ptree;
  1665. procedure array_dec;
  1666. var
  1667. lowval,
  1668. highval : longint;
  1669. arraytype : pdef;
  1670. begin
  1671. consume(_ARRAY);
  1672. consume(LECKKLAMMER);
  1673. { defaults }
  1674. arraytype:=generrordef;
  1675. lowval:=$80000000;
  1676. highval:=$7fffffff;
  1677. p:=nil;
  1678. repeat
  1679. { read the expression and check it }
  1680. pt:=expr;
  1681. if pt^.treetype=typen then
  1682. begin
  1683. case pt^.resulttype^.deftype of
  1684. enumdef : begin
  1685. lowval:=penumdef(pt^.resulttype)^.min;
  1686. highval:=penumdef(pt^.resulttype)^.max;
  1687. arraytype:=pt^.resulttype;
  1688. end;
  1689. orddef : begin
  1690. case porddef(pt^.resulttype)^.typ of
  1691. s8bit,u8bit,
  1692. s16bit,u16bit,
  1693. s32bit : begin
  1694. lowval:=porddef(pt^.resulttype)^.low;
  1695. highval:=porddef(pt^.resulttype)^.high;
  1696. arraytype:=pt^.resulttype;
  1697. end;
  1698. bool8bit,
  1699. bool16bit,
  1700. bool32bit : begin
  1701. lowval:=0;
  1702. highval:=1;
  1703. arraytype:=pt^.resulttype;
  1704. end;
  1705. uchar : begin
  1706. lowval:=0;
  1707. highval:=255;
  1708. arraytype:=pt^.resulttype;
  1709. end;
  1710. else
  1711. Message(sym_e_error_in_type_def);
  1712. end;
  1713. end;
  1714. else
  1715. Message(sym_e_error_in_type_def);
  1716. end
  1717. end
  1718. else
  1719. begin
  1720. do_firstpass(pt);
  1721. if (pt^.treetype=rangen) then
  1722. begin
  1723. if (pt^.left^.treetype=ordconstn) and
  1724. (pt^.right^.treetype=ordconstn) then
  1725. begin
  1726. lowval:=pt^.left^.value;
  1727. highval:=pt^.right^.value;
  1728. if highval<lowval then
  1729. begin
  1730. Message(parser_e_array_lower_less_than_upper_bound);
  1731. highval:=lowval;
  1732. end;
  1733. arraytype:=pt^.right^.resulttype;
  1734. end
  1735. else
  1736. Message(type_e_cant_eval_constant_expr);
  1737. end
  1738. else
  1739. Message(sym_e_error_in_type_def)
  1740. end;
  1741. disposetree(pt);
  1742. { create arraydef }
  1743. if p=nil then
  1744. begin
  1745. ap:=new(parraydef,init(lowval,highval,arraytype));
  1746. p:=ap;
  1747. end
  1748. else
  1749. begin
  1750. ap^.definition:=new(parraydef,init(lowval,highval,arraytype));
  1751. ap:=parraydef(ap^.definition);
  1752. end;
  1753. if token=COMMA then
  1754. consume(COMMA)
  1755. else
  1756. break;
  1757. until false;
  1758. consume(RECKKLAMMER);
  1759. consume(_OF);
  1760. hp1:=read_type('');
  1761. { if no error, set element type }
  1762. if assigned(ap) then
  1763. ap^.definition:=hp1;
  1764. end;
  1765. var
  1766. hfp : pforwardpointer;
  1767. begin
  1768. p:=nil;
  1769. case token of
  1770. _STRING,_FILE:
  1771. p:=single_type(hs);
  1772. LKLAMMER:
  1773. begin
  1774. consume(LKLAMMER);
  1775. { allow negativ value_str }
  1776. l:=-1;
  1777. aufsym := Nil;
  1778. aufdef:=new(penumdef,init);
  1779. repeat
  1780. s:=pattern;
  1781. consume(ID);
  1782. if token=ASSIGNMENT then
  1783. begin
  1784. consume(ASSIGNMENT);
  1785. v:=get_intconst;
  1786. { please leave that a note, allows type save }
  1787. { declarations in the win32 units ! }
  1788. if v<=l then
  1789. Message(parser_n_duplicate_enum);
  1790. l:=v;
  1791. end
  1792. else
  1793. inc(l);
  1794. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  1795. if token=COMMA then
  1796. consume(COMMA)
  1797. else
  1798. break;
  1799. until false;
  1800. {aufdef^.max:=l;
  1801. if we allow unordered enums
  1802. this can be wrong
  1803. min and max are now set in tenumsym.init PM }
  1804. p:=aufdef;
  1805. consume(RKLAMMER);
  1806. end;
  1807. _ARRAY:
  1808. array_dec;
  1809. _SET:
  1810. begin
  1811. consume(_SET);
  1812. consume(_OF);
  1813. hp1:=read_type('');
  1814. if assigned(hp1) then
  1815. begin
  1816. case hp1^.deftype of
  1817. { don't forget that min can be negativ PM }
  1818. enumdef : if penumdef(hp1)^.min>=0 then
  1819. p:=new(psetdef,init(hp1,penumdef(hp1)^.max))
  1820. else
  1821. Message(sym_e_ill_type_decl_set);
  1822. orddef : begin
  1823. case porddef(hp1)^.typ of
  1824. uchar : p:=new(psetdef,init(hp1,255));
  1825. u8bit,s8bit,u16bit,s16bit,s32bit :
  1826. begin
  1827. if (porddef(hp1)^.low>=0) then
  1828. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  1829. else Message(sym_e_ill_type_decl_set);
  1830. end;
  1831. else Message(sym_e_ill_type_decl_set);
  1832. end;
  1833. end;
  1834. else Message(sym_e_ill_type_decl_set);
  1835. end;
  1836. end
  1837. else
  1838. p:=generrordef;
  1839. end;
  1840. CARET:
  1841. begin
  1842. consume(CARET);
  1843. { forwards allowed only inside TYPE statements }
  1844. if typecanbeforward then
  1845. forwardsallowed:=true;
  1846. hp1:=single_type(hs);
  1847. p:=new(ppointerdef,init(hp1));
  1848. {I add big troubles here
  1849. with var p : ^byte in graph.putimage
  1850. because a save_forward was called and
  1851. no resolve forward
  1852. => so the definition was rewritten after
  1853. having been disposed !!
  1854. Strange problems appeared !!!!}
  1855. {Anyhow forwards should only be allowed
  1856. inside a type statement ??
  1857. don't you think so }
  1858. if (lasttypesym<>nil) and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  1859. begin
  1860. new(hfp);
  1861. hfp^.next:=lasttypesym^.forwardpointer;
  1862. hfp^.def:=ppointerdef(p);
  1863. lasttypesym^.forwardpointer:=hfp;
  1864. end;
  1865. forwardsallowed:=false;
  1866. end;
  1867. _RECORD:
  1868. p:=record_dec;
  1869. _PACKED:
  1870. begin
  1871. consume(_PACKED);
  1872. if token=_ARRAY then
  1873. array_dec
  1874. else
  1875. begin
  1876. oldaktpackrecords:=aktpackrecords;
  1877. aktpackrecords:=1;
  1878. if token in [_CLASS,_OBJECT] then
  1879. p:=object_dec(name,nil)
  1880. else
  1881. p:=record_dec;
  1882. aktpackrecords:=oldaktpackrecords;
  1883. end;
  1884. end;
  1885. _CLASS,
  1886. _OBJECT:
  1887. p:=object_dec(name,nil);
  1888. _PROCEDURE:
  1889. begin
  1890. consume(_PROCEDURE);
  1891. p:=handle_procvar;
  1892. if token=_OF then
  1893. begin
  1894. consume(_OF);
  1895. consume(_OBJECT);
  1896. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1897. end;
  1898. end;
  1899. _FUNCTION:
  1900. begin
  1901. consume(_FUNCTION);
  1902. p:=handle_procvar;
  1903. consume(COLON);
  1904. pprocvardef(p)^.retdef:=single_type(hs);
  1905. if token=_OF then
  1906. begin
  1907. consume(_OF);
  1908. consume(_OBJECT);
  1909. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1910. end;
  1911. end;
  1912. else
  1913. expr_type;
  1914. end;
  1915. if p=nil then
  1916. p:=generrordef;
  1917. read_type:=p;
  1918. end;
  1919. { reads a type declaration to the symbol table }
  1920. procedure type_dec;
  1921. var
  1922. typename : stringid;
  1923. newtype : ptypesym;
  1924. {$ifdef dummy}
  1925. olddef,newdef : pdef;
  1926. s : string;
  1927. {$endif dummy}
  1928. begin
  1929. block_type:=bt_type;
  1930. consume(_TYPE);
  1931. typecanbeforward:=true;
  1932. repeat
  1933. typename:=pattern;
  1934. consume(ID);
  1935. consume(EQUAL);
  1936. { here you loose the strictness of pascal
  1937. for which a redefinition like
  1938. childtype = parenttype;
  1939. child2type = parenttype;
  1940. does not make the two child types equal !!
  1941. here all vars from childtype and child2type
  1942. get the definition of parenttype !! }
  1943. {$ifdef testequaltype}
  1944. if (token = ID) or (token=_FILE) or (token=_STRING) then
  1945. begin
  1946. olddef := single_type(s);
  1947. { make a clone of olddef }
  1948. { is that ok ??? }
  1949. getmem(newdef,SizeOf(olddef));
  1950. move(olddef^,newdef^,SizeOf(olddef));
  1951. newtype:=new(ptypesym,init(typename,newdef));
  1952. symtablestack^.insert(newtype);
  1953. end
  1954. else
  1955. {$endif testequaltype}
  1956. begin
  1957. getsym(typename,false);
  1958. { check if it is the definition of a forward defined class }
  1959. if assigned(srsym) and (token=_CLASS) and
  1960. (srsym^.typ=typesym) and
  1961. (assigned(ptypesym(srsym)^.definition)) and
  1962. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  1963. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_isforward)<>0) and
  1964. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_is_class)<>0) then
  1965. begin
  1966. { we can ignore the result }
  1967. { the definition is modified }
  1968. object_dec(typename,pobjectdef(ptypesym(srsym)^.definition));
  1969. newtype:=ptypesym(srsym);
  1970. end
  1971. else
  1972. begin
  1973. newtype:=new(ptypesym,init(typename,read_type(typename)));
  1974. { load newtype with the new pointer to the inserted type
  1975. because it can be an already defined forwarded type !! }
  1976. newtype:=ptypesym(symtablestack^.insert(newtype));
  1977. end;
  1978. end;
  1979. consume(SEMICOLON);
  1980. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  1981. parse_var_proc_directives(newtype);
  1982. until token<>ID;
  1983. typecanbeforward:=false;
  1984. {$ifdef tp}
  1985. symtablestack^.foreach(testforward_type);
  1986. {$else}
  1987. symtablestack^.foreach(@testforward_type);
  1988. {$endif}
  1989. resolve_forwards;
  1990. block_type:=bt_general;
  1991. end;
  1992. procedure var_dec;
  1993. { parses varaible declarations and inserts them in }
  1994. { the top symbol table of symtablestack }
  1995. begin
  1996. consume(_VAR);
  1997. read_var_decs(false,false);
  1998. end;
  1999. procedure Not_supported_for_inline(t : ttoken);
  2000. begin
  2001. if assigned(aktprocsym) and
  2002. ((aktprocsym^.definition^.options and poinline)<>0) then
  2003. Begin
  2004. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  2005. Message(parser_w_inlining_disabled);
  2006. aktprocsym^.definition^.options:= aktprocsym^.definition^.options and not poinline;
  2007. End;
  2008. end;
  2009. procedure read_declarations(islibrary : boolean);
  2010. begin
  2011. repeat
  2012. case token of
  2013. _LABEL:
  2014. begin
  2015. Not_supported_for_inline(token);
  2016. label_dec;
  2017. end;
  2018. _CONST:
  2019. begin
  2020. Not_supported_for_inline(token);
  2021. const_dec;
  2022. end;
  2023. _TYPE:
  2024. begin
  2025. Not_supported_for_inline(token);
  2026. type_dec;
  2027. end;
  2028. _VAR:
  2029. var_dec;
  2030. _CONSTRUCTOR,_DESTRUCTOR,
  2031. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  2032. begin
  2033. Not_supported_for_inline(token);
  2034. read_proc;
  2035. end;
  2036. _EXPORTS:
  2037. begin
  2038. Not_supported_for_inline(token);
  2039. { here we should be at lexlevel 1, no ? PM }
  2040. if (lexlevel<>main_program_level) or
  2041. (not islibrary and not DLLsource) then
  2042. begin
  2043. Message(parser_e_syntax_error);
  2044. consume_all_until(SEMICOLON);
  2045. end
  2046. else if islibrary then
  2047. read_exports;
  2048. end
  2049. else break;
  2050. end;
  2051. until false;
  2052. end;
  2053. procedure read_interface_declarations;
  2054. begin
  2055. {Since the body is now parsed at lexlevel 1, and the declarations
  2056. must be parsed at the same lexlevel we increase the lexlevel.}
  2057. inc(lexlevel);
  2058. repeat
  2059. case token of
  2060. _CONST : const_dec;
  2061. _TYPE : type_dec;
  2062. _VAR : var_dec;
  2063. _FUNCTION,
  2064. _PROCEDURE,
  2065. _OPERATOR : read_proc;
  2066. else
  2067. break;
  2068. end;
  2069. until false;
  2070. dec(lexlevel);
  2071. end;
  2072. end.
  2073. {
  2074. $Log$
  2075. Revision 1.101 1999-02-25 21:02:41 peter
  2076. * ag386bin updates
  2077. + coff writer
  2078. Revision 1.100 1999/02/24 00:59:14 peter
  2079. * small updates for ag386bin
  2080. Revision 1.99 1999/02/22 23:33:29 florian
  2081. + message directive for integers added
  2082. Revision 1.98 1999/02/22 20:13:36 florian
  2083. + first implementation of message keyword
  2084. Revision 1.97 1999/02/22 02:44:10 peter
  2085. * ag386bin doesn't use i386.pas anymore
  2086. Revision 1.96 1999/02/17 14:20:40 pierre
  2087. * Reference specific bug in recompiling unit solved
  2088. Revision 1.95 1999/01/25 20:13:48 peter
  2089. * fixed crash with forward declared class of ...
  2090. Revision 1.94 1999/01/19 12:17:00 peter
  2091. * fixed constant strings > 255 chars
  2092. Revision 1.93 1999/01/15 13:08:23 peter
  2093. * error if upper<lower in array decl
  2094. Revision 1.92 1999/01/14 21:49:58 peter
  2095. * fixed forwardpointer problem with multiple forwards for the same
  2096. typesym. It now uses a linkedlist instead of a single pointer
  2097. Revision 1.91 1998/12/30 22:15:46 peter
  2098. + farpointer type
  2099. * absolutesym now also stores if its far
  2100. Revision 1.90 1998/12/15 17:16:00 peter
  2101. * fixed const s : ^string
  2102. * first things for const pchar : @string[1]
  2103. Revision 1.89 1998/12/11 00:03:30 peter
  2104. + globtype,tokens,version unit splitted from globals
  2105. Revision 1.88 1998/11/30 09:43:20 pierre
  2106. * some range check bugs fixed (still not working !)
  2107. + added DLL writing support for win32 (also accepts variables)
  2108. + TempAnsi for code that could be used for Temporary ansi strings
  2109. handling
  2110. Revision 1.87 1998/11/29 12:42:24 peter
  2111. * check for constants with array decl
  2112. Revision 1.86 1998/11/28 16:20:52 peter
  2113. + support for dll variables
  2114. Revision 1.85 1998/11/27 14:34:43 peter
  2115. * give error when string[0] decl is found
  2116. Revision 1.84 1998/11/17 10:40:15 peter
  2117. * H+ fixes
  2118. Revision 1.83 1998/11/16 11:28:59 pierre
  2119. * stackcheck removed for i386_win32
  2120. * exportlist does not crash at least !!
  2121. (was need for tests dir !)z
  2122. Revision 1.82 1998/11/16 10:18:07 peter
  2123. * fixes for ansistrings
  2124. Revision 1.81 1998/11/13 15:40:22 pierre
  2125. + added -Se in Makefile cvstest target
  2126. + lexlevel cleanup
  2127. normal_function_level main_program_level and unit_init_level defined
  2128. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  2129. (test added in code !)
  2130. * -Un option was wrong
  2131. * _FAIL and _SELF only keyword inside
  2132. constructors and methods respectively
  2133. Revision 1.80 1998/11/13 10:18:09 peter
  2134. + nil constants
  2135. Revision 1.79 1998/11/05 12:02:51 peter
  2136. * released useansistring
  2137. * removed -Sv, its now available in fpc modes
  2138. Revision 1.78 1998/10/27 13:45:33 pierre
  2139. * classes get a vmt allways
  2140. * better error info (tried to remove
  2141. several error strings introduced by the tpexcept handling)
  2142. Revision 1.77 1998/10/26 22:58:20 florian
  2143. * new introduded problem with classes fix, the parent class wasn't set
  2144. correct, if the class was defined forward before
  2145. Revision 1.76 1998/10/25 23:31:18 peter
  2146. * procvar parsing updated just like psub.pas routine
  2147. Revision 1.75 1998/10/21 08:39:59 florian
  2148. + ansistring operator +
  2149. + $h and string[n] for n>255 added
  2150. * small problem with TP fixed
  2151. Revision 1.74 1998/10/20 13:09:13 peter
  2152. * fixed object(unknown) crash
  2153. Revision 1.73 1998/10/19 08:54:56 pierre
  2154. * wrong stabs info corrected once again !!
  2155. + variable vmt offset with vmt field only if required
  2156. implemented now !!!
  2157. Revision 1.72 1998/10/16 13:12:51 pierre
  2158. * added vmt_offsets in destructors code also !!!
  2159. * vmt_offset code for m68k
  2160. Revision 1.71 1998/10/15 15:13:25 pierre
  2161. + added oo_hasconstructor and oo_hasdestructor
  2162. for objects options
  2163. Revision 1.70 1998/10/13 13:10:22 peter
  2164. * new style for m68k/i386 infos and enums
  2165. Revision 1.69 1998/10/09 12:07:49 pierre
  2166. * typo error for propertyparas dispose corrected
  2167. Revision 1.68 1998/10/09 11:47:54 pierre
  2168. * still more memory leaks fixes !!
  2169. Revision 1.67 1998/10/08 13:48:46 peter
  2170. * fixed memory leaks for do nothing source
  2171. * fixed unit interdependency
  2172. Revision 1.66 1998/10/06 20:43:31 peter
  2173. * fixed set of bugs. like set of false..true set of #1..#255 and
  2174. set of #1..true which was allowed
  2175. Revision 1.65 1998/10/05 22:43:35 peter
  2176. * commited the wrong file :(
  2177. Revision 1.64 1998/10/05 21:33:24 peter
  2178. * fixed 161,165,166,167,168
  2179. Revision 1.63 1998/10/05 13:57:13 peter
  2180. * crash preventions
  2181. Revision 1.62 1998/10/02 17:06:02 peter
  2182. * better error message for unresolved forward types
  2183. Revision 1.61 1998/10/02 09:23:24 peter
  2184. * fixed error msg with type l=<var>
  2185. * block_type bt_const is now set in read_const_dec
  2186. Revision 1.60 1998/09/30 07:40:33 florian
  2187. * better error recovering
  2188. Revision 1.59 1998/09/26 17:45:33 peter
  2189. + idtoken and only one token table
  2190. Revision 1.58 1998/09/25 00:04:01 florian
  2191. * problems when calling class methods fixed
  2192. Revision 1.57 1998/09/24 23:49:09 peter
  2193. + aktmodeswitches
  2194. Revision 1.56 1998/09/23 15:39:09 pierre
  2195. * browser bugfixes
  2196. was adding a reference when looking for the symbol
  2197. if -bSYM_NAME was used
  2198. Revision 1.55 1998/09/21 13:24:44 daniel
  2199. * Memory leak fixed.
  2200. Revision 1.54 1998/09/17 13:41:16 pierre
  2201. sizeof(TPOINT) problem
  2202. Revision 1.53.2.1 1998/09/17 13:12:09 pierre
  2203. * virtual destructor did not set oo_hasvirtual
  2204. (detected with the sizeof(TPoint) problem
  2205. * genloadcallnode was missing
  2206. Revision 1.53 1998/09/09 11:50:52 pierre
  2207. * forward def are not put in record or objects
  2208. + added check for forwards also in record and objects
  2209. * dummy parasymtable for unit initialization removed from
  2210. symtable stack
  2211. Revision 1.52 1998/09/07 23:10:22 florian
  2212. * a lot of stuff fixed regarding rtti and publishing of properties,
  2213. basics should now work
  2214. Revision 1.51 1998/09/07 19:33:22 florian
  2215. + some stuff for property rtti added:
  2216. - NameIndex of the TPropInfo record is now written correctly
  2217. - the DEFAULT/NODEFAULT keyword is supported now
  2218. - the default value and the storedsym/def are now written to
  2219. the PPU fiel
  2220. Revision 1.50 1998/09/07 18:46:08 peter
  2221. * update smartlinking, uses getdatalabel
  2222. * renamed ptree.value vars to value_str,value_real,value_set
  2223. Revision 1.49 1998/09/07 17:37:00 florian
  2224. * first fixes for published properties
  2225. Revision 1.48 1998/09/04 08:42:02 peter
  2226. * updated some error messages
  2227. Revision 1.47 1998/09/03 16:03:18 florian
  2228. + rtti generation
  2229. * init table generation changed
  2230. Revision 1.46 1998/09/01 17:39:48 peter
  2231. + internal constant functions
  2232. Revision 1.45 1998/08/31 12:20:28 peter
  2233. * fixed array_dec when unknown type was used
  2234. Revision 1.44 1998/08/28 10:57:01 peter
  2235. * removed warnings
  2236. Revision 1.43 1998/08/25 13:09:25 pierre
  2237. * corrected mangling sheme :
  2238. cvar add Cprefix to the mixed case name whereas
  2239. export or public use direct name
  2240. Revision 1.42 1998/08/25 12:42:41 pierre
  2241. * CDECL changed to CVAR for variables
  2242. specifications are read in structures also
  2243. + started adding GPC compatibility mode ( option -Sp)
  2244. * names changed to lowercase
  2245. Revision 1.41 1998/08/23 21:04:36 florian
  2246. + rtti generation for classes added
  2247. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  2248. Revision 1.40 1998/08/21 15:48:58 pierre
  2249. * more cdecl chagnes
  2250. - better line info
  2251. - changes the definition options of a procvar
  2252. if it is a unnamed type
  2253. Revision 1.39 1998/08/19 00:42:40 peter
  2254. + subrange types for enums
  2255. + checking for bounds type with ranges
  2256. Revision 1.38 1998/08/12 19:20:39 peter
  2257. + public is the same as export for c_vars
  2258. * a exported/public c_var incs now the refcount
  2259. Revision 1.37 1998/08/11 15:31:38 peter
  2260. * write extended to ppu file
  2261. * new version 0.99.7
  2262. Revision 1.36 1998/08/10 14:50:09 peter
  2263. + localswitches, moduleswitches, globalswitches splitting
  2264. Revision 1.35 1998/07/26 21:59:00 florian
  2265. + better support for switch $H
  2266. + index access to ansi strings added
  2267. + assigment of data (records/arrays) containing ansi strings
  2268. Revision 1.34 1998/07/20 22:17:15 florian
  2269. * hex constants in numeric char (#$54#$43 ...) are now allowed
  2270. * there was a bug in record_var_dec which prevents the used
  2271. of nested variant records (for example drivers.tevent of tv)
  2272. Revision 1.33 1998/07/18 17:11:11 florian
  2273. + ansi string constants fixed
  2274. + switch $H partial implemented
  2275. Revision 1.32 1998/07/14 21:46:50 peter
  2276. * updated messages file
  2277. Revision 1.31 1998/07/14 14:46:53 peter
  2278. * released NEWINPUT
  2279. Revision 1.30 1998/07/10 00:00:00 peter
  2280. * fixed ttypesym bug finally
  2281. * fileinfo in the symtable and better using for unused vars
  2282. Revision 1.29 1998/06/25 14:04:21 peter
  2283. + internal inc/dec
  2284. Revision 1.28 1998/06/24 12:26:45 peter
  2285. * stricter var parsing like tp7 and some optimizes with directive
  2286. parsing
  2287. Revision 1.27 1998/06/12 16:15:34 pierre
  2288. * external name 'C_var';
  2289. export name 'intern_C_var';
  2290. cdecl;
  2291. cdecl;external;
  2292. are now supported only with -Sv switch
  2293. Revision 1.25 1998/06/09 16:01:45 pierre
  2294. + added procedure directive parsing for procvars
  2295. (accepted are popstack cdecl and pascal)
  2296. + added C vars with the following syntax
  2297. var C calias 'true_c_name';(can be followed by external)
  2298. reason is that you must add the Cprefix
  2299. which is target dependent
  2300. Revision 1.24 1998/06/05 14:37:32 pierre
  2301. * fixes for inline for operators
  2302. * inline procedure more correctly restricted
  2303. Revision 1.23 1998/06/04 23:51:50 peter
  2304. * m68k compiles
  2305. + .def file creation moved to gendef.pas so it could also be used
  2306. for win32
  2307. Revision 1.22 1998/06/03 22:48:59 peter
  2308. + wordbool,longbool
  2309. * rename bis,von -> high,low
  2310. * moved some systemunit loading/creating to psystem.pas
  2311. Revision 1.21 1998/06/03 22:14:19 florian
  2312. * problem with sizes of classes fixed (if the anchestor was declared
  2313. forward, the compiler doesn't update the child classes size)
  2314. Revision 1.20 1998/05/28 14:35:54 peter
  2315. * nicer error message when no id is used after var
  2316. Revision 1.19 1998/05/23 01:21:19 peter
  2317. + aktasmmode, aktoptprocessor, aktoutputformat
  2318. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2319. + $LIBNAME to set the library name where the unit will be put in
  2320. * splitted cgi386 a bit (codeseg to large for bp7)
  2321. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2322. Revision 1.18 1998/05/20 09:42:35 pierre
  2323. + UseTokenInfo now default
  2324. * unit in interface uses and implementation uses gives error now
  2325. * only one error for unknown symbol (uses lastsymknown boolean)
  2326. the problem came from the label code !
  2327. + first inlined procedures and function work
  2328. (warning there might be allowed cases were the result is still wrong !!)
  2329. * UseBrower updated gives a global list of all position of all used symbols
  2330. with switch -gb
  2331. Revision 1.17 1998/05/11 13:07:55 peter
  2332. + $ifdef NEWPPU for the new ppuformat
  2333. + $define GDB not longer required
  2334. * removed all warnings and stripped some log comments
  2335. * no findfirst/findnext anymore to remove smartlink *.o files
  2336. Revision 1.16 1998/05/05 12:05:42 florian
  2337. * problems with properties fixed
  2338. * crash fixed: i:=l when i and l are undefined, was a problem with
  2339. implementation of private/protected
  2340. Revision 1.15 1998/05/01 09:01:23 florian
  2341. + correct semantics of private and protected
  2342. * small fix in variable scope:
  2343. a id can be used in a parameter list of a method, even it is used in
  2344. an anchestor class as field id
  2345. Revision 1.14 1998/05/01 07:43:56 florian
  2346. + basics for rtti implemented
  2347. + switch $m (generate rtti for published sections)
  2348. Revision 1.13 1998/04/30 15:59:41 pierre
  2349. * GDB works again better :
  2350. correct type info in one pass
  2351. + UseTokenInfo for better source position
  2352. * fixed one remaining bug in scanner for line counts
  2353. * several little fixes
  2354. Revision 1.12 1998/04/29 10:33:57 pierre
  2355. + added some code for ansistring (not complete nor working yet)
  2356. * corrected operator overloading
  2357. * corrected nasm output
  2358. + started inline procedures
  2359. + added starstarn : use ** for exponentiation (^ gave problems)
  2360. + started UseTokenInfo cond to get accurate positions
  2361. Revision 1.11 1998/04/28 11:45:52 florian
  2362. * make it compilable with TP
  2363. + small COM problems solved to compile classes.pp
  2364. Revision 1.10 1998/04/27 23:10:28 peter
  2365. + new scanner
  2366. * $makelib -> if smartlink
  2367. * small filename fixes pmodule.setfilename
  2368. * moved import from files.pas -> import.pas
  2369. Revision 1.9 1998/04/10 21:36:56 florian
  2370. + some stuff to support method pointers (procedure of object) added
  2371. (declaration, parameter handling)
  2372. Revision 1.8 1998/04/10 15:39:48 florian
  2373. * more fixes to get classes.pas compiled
  2374. Revision 1.7 1998/04/09 23:02:15 florian
  2375. * small problems solved to get remake3 work
  2376. Revision 1.6 1998/04/09 22:16:35 florian
  2377. * problem with previous REGALLOC solved
  2378. * improved property support
  2379. Revision 1.5 1998/04/08 14:59:20 florian
  2380. * problem with new expr_type solved
  2381. Revision 1.4 1998/04/08 10:26:09 florian
  2382. * correct error handling of virtual constructors
  2383. * problem with new type declaration handling fixed
  2384. Revision 1.3 1998/04/07 22:45:05 florian
  2385. * bug0092, bug0115 and bug0121 fixed
  2386. + packed object/class/array
  2387. Revision 1.2 1998/04/05 13:58:35 peter
  2388. * fixed the -Ss bug
  2389. + warning for Virtual constructors
  2390. * helppages updated with -TGO32V1
  2391. }