pdecl.pas 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078
  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. 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,
  44. files,types,hcodegen,verbose,systems
  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. ,i386
  53. {$endif}
  54. {$ifdef m68k}
  55. ,m68k
  56. {$endif}
  57. ;
  58. function read_type(const name : stringid) : pdef;forward;
  59. procedure const_dec;
  60. var
  61. name : stringid;
  62. p : ptree;
  63. def : pdef;
  64. sym : psym;
  65. ps : pconstset;
  66. pd : pbestreal;
  67. {$ifdef USEANSISTRING}
  68. sp : pstring;
  69. {$endif USEANSISTRING}
  70. begin
  71. consume(_CONST);
  72. repeat
  73. name:=pattern;
  74. consume(ID);
  75. case token of
  76. EQUAL:
  77. begin
  78. consume(EQUAL);
  79. p:=comp_expr(true);
  80. do_firstpass(p);
  81. case p^.treetype of
  82. ordconstn:
  83. begin
  84. if is_constintnode(p) then
  85. symtablestack^.insert(new(pconstsym,init(name,constint,p^.value,nil)))
  86. else if is_constcharnode(p) then
  87. symtablestack^.insert(new(pconstsym,init(name,constchar,p^.value,nil)))
  88. else if is_constboolnode(p) then
  89. symtablestack^.insert(new(pconstsym,init(name,constbool,p^.value,nil)))
  90. else if p^.resulttype^.deftype=enumdef then
  91. symtablestack^.insert(new(pconstsym,init(name,constord,p^.value,p^.resulttype)))
  92. else internalerror(111);
  93. end;
  94. stringconstn:
  95. {values is disposed with p so I need a copy !}
  96. {$ifdef USEANSISTRING} begin
  97. getmem(sp,p^.length+1);
  98. move(p^.values^,sp^[1],p^.length);
  99. sp^[0]:=chr(p^.length);
  100. symtablestack^.insert(new(pconstsym,init(name,conststring,longint(sp),nil)));
  101. end;
  102. {$else USEANSISTRING}
  103. symtablestack^.insert(new(pconstsym,init(name,conststring,longint(stringdup(p^.values^)),nil)));
  104. {$endif USEANSISTRING}
  105. realconstn : begin
  106. new(pd);
  107. pd^:=p^.valued;
  108. symtablestack^.insert(new(pconstsym,init(name,constreal,longint(pd),nil)));
  109. end;
  110. setconstrn : begin
  111. new(ps);
  112. ps^:=p^.constset^;
  113. symtablestack^.insert(new(pconstsym,init(name,
  114. constseta,longint(ps),p^.resulttype)));
  115. end;
  116. else Message(cg_e_illegal_expression);
  117. end;
  118. consume(SEMICOLON);
  119. end;
  120. COLON:
  121. begin
  122. { this was missed, so const s : ^string = nil gives an
  123. error (FK)
  124. }
  125. block_type:=bt_type;
  126. consume(COLON);
  127. ignore_equal:=true;
  128. def:=read_type('');
  129. block_type:=bt_general;
  130. ignore_equal:=false;
  131. sym:=new(ptypedconstsym,init(name,def));
  132. symtablestack^.insert(sym);
  133. consume(EQUAL);
  134. readtypedconst(def,ptypedconstsym(sym));
  135. consume(SEMICOLON);
  136. end;
  137. else consume(EQUAL);
  138. end;
  139. until token<>ID;
  140. end;
  141. procedure label_dec;
  142. var
  143. hl : plabel;
  144. begin
  145. consume(_LABEL);
  146. if not(cs_support_goto in aktmoduleswitches) then
  147. Message(sym_e_goto_and_label_not_supported);
  148. repeat
  149. if not(token in [ID,INTCONST]) then
  150. consume(ID)
  151. else
  152. begin
  153. getlabel(hl);
  154. symtablestack^.insert(new(plabelsym,init(pattern,hl)));
  155. consume(token);
  156. end;
  157. if token<>SEMICOLON then consume(COMMA);
  158. until not(token in [ID,INTCONST]);
  159. consume(SEMICOLON);
  160. end;
  161. procedure read_var_decs(is_record,is_object:boolean);
  162. { reads the filed of a record into a }
  163. { symtablestack, if record=false }
  164. { variants are forbidden, so this procedure }
  165. { can be used to read object fields }
  166. { if absolute is true, ABSOLUTE and file }
  167. { types are allowed }
  168. { => the procedure is also used to read }
  169. { a sequence of variable declaration }
  170. var
  171. sc : pstringcontainer;
  172. s : stringid;
  173. old_block_type : tblock_type;
  174. filepos : tfileposinfo;
  175. symdone : boolean;
  176. { to handle absolute }
  177. abssym : pabsolutesym;
  178. {$ifdef i386}
  179. l : longint;
  180. code : word;
  181. {$endif i386}
  182. { c var }
  183. Csym : pvarsym;
  184. is_cdecl,extern_Csym,export_Csym : boolean;
  185. C_name : string;
  186. { case }
  187. p,casedef : pdef;
  188. { maxsize contains the max. size of a variant }
  189. { startvarrec contains the start of the variant part of a record }
  190. maxsize,startvarrec : longint;
  191. pt : ptree;
  192. begin
  193. old_block_type:=block_type;
  194. block_type:=bt_type;
  195. { Force an expected ID error message }
  196. if not (token in [ID,_CASE,_END]) then
  197. consume(ID);
  198. { read vars }
  199. while (token=ID) and
  200. not(is_object and
  201. ((pattern='PUBLIC') or (pattern='PRIVATE') or
  202. (pattern='PUBLISHED') or (pattern='PROTECTED'))) do
  203. begin
  204. C_name:=orgpattern;
  205. sc:=idlist;
  206. consume(COLON);
  207. p:=read_type('');
  208. symdone:=false;
  209. { check for absolute }
  210. if (token=ID) and (pattern='ABSOLUTE') and not(is_record or is_object) then
  211. begin
  212. consume(ID);
  213. { only allowed for one var }
  214. s:=sc^.get_with_tokeninfo(filepos);
  215. if not sc^.empty then
  216. Message(parser_e_absolute_only_one_var);
  217. dispose(sc,done);
  218. { parse the rest }
  219. if token=ID then
  220. begin
  221. getsym(pattern,true);
  222. consume(ID);
  223. { we should check the result type of srsym }
  224. if not (srsym^.typ in [varsym,typedconstsym]) then
  225. Message(parser_e_absolute_only_to_var_or_const);
  226. abssym:=new(pabsolutesym,init(s,p));
  227. abssym^.typ:=absolutesym;
  228. abssym^.abstyp:=tovar;
  229. abssym^.ref:=srsym;
  230. abssym^.fileinfo:=filepos;
  231. symtablestack^.insert(abssym);
  232. end
  233. else
  234. if token=CSTRING then
  235. begin
  236. abssym:=new(pabsolutesym,init(s,p));
  237. s:=pattern;
  238. consume(CSTRING);
  239. abssym^.typ:=absolutesym;
  240. abssym^.abstyp:=toasm;
  241. abssym^.asmname:=stringdup(s);
  242. abssym^.fileinfo:=filepos;
  243. symtablestack^.insert(abssym);
  244. end
  245. else
  246. { absolute address ?!? }
  247. if token=INTCONST then
  248. begin
  249. {$ifdef i386}
  250. if (target_info.target=target_GO32V2) then
  251. begin
  252. abssym:=new(pabsolutesym,init(s,p));
  253. abssym^.typ:=absolutesym;
  254. abssym^.abstyp:=toaddr;
  255. abssym^.absseg:=false;
  256. abssym^.fileinfo:=filepos;
  257. s:=pattern;
  258. consume(INTCONST);
  259. val(s,abssym^.address,code);
  260. if token=COLON then
  261. begin
  262. consume(token);
  263. s:=pattern;
  264. consume(INTCONST);
  265. val(s,l,code);
  266. abssym^.address:=abssym^.address shl 4+l;
  267. abssym^.absseg:=true;
  268. end;
  269. symtablestack^.insert(abssym);
  270. end
  271. else
  272. {$endif i386}
  273. Message(parser_e_absolute_only_to_var_or_const);
  274. end
  275. else
  276. Message(parser_e_absolute_only_to_var_or_const);
  277. symdone:=true;
  278. end;
  279. { for a record there doesn't need to be a ; before the END or ) }
  280. if not((is_record or is_object) and (token in [_END,RKLAMMER])) then
  281. consume(SEMICOLON);
  282. { Check for variable directives }
  283. if (token=ID) then
  284. begin
  285. { Check for C Variable declarations }
  286. if (cs_support_c_var in aktmoduleswitches) and
  287. not(is_record or is_object) and
  288. ((pattern='EXPORT') or
  289. (pattern='EXTERNAL') or
  290. (pattern='PUBLIC') or
  291. (pattern='CDECL')) then
  292. begin
  293. { only allowed for one var }
  294. s:=sc^.get_with_tokeninfo(filepos);
  295. if not sc^.empty then
  296. Message(parser_e_absolute_only_one_var);
  297. dispose(sc,done);
  298. { defaults }
  299. is_cdecl:=false;
  300. extern_csym:=false;
  301. export_Csym:=false;
  302. { cdecl }
  303. if pattern='CDECL' then
  304. begin
  305. consume(ID);
  306. consume(SEMICOLON);
  307. is_cdecl:=true;
  308. end;
  309. { external }
  310. if pattern='EXTERNAL' then
  311. begin
  312. consume(ID);
  313. extern_csym:=true;
  314. end;
  315. { export }
  316. if (pattern='EXPORT') or (pattern='PUBLIC') then
  317. begin
  318. consume(ID);
  319. if extern_csym then
  320. Message(parser_e_not_external_and_export)
  321. else
  322. export_Csym:=true;
  323. end;
  324. { external and export need a name after when no cdecl is used }
  325. if not is_cdecl then
  326. begin
  327. if (token=ID) and (pattern='NAME') then
  328. consume(ID)
  329. else
  330. Message(parser_e_name_keyword_expected);
  331. C_name:=pattern;
  332. { allow also char }
  333. if token=CCHAR then
  334. consume(CCHAR)
  335. else
  336. consume(CSTRING);
  337. end;
  338. { consume the ; when export or external is used }
  339. if extern_csym or export_csym then
  340. consume(SEMICOLON);
  341. { insert in the symtable }
  342. Csym:=new(pvarsym,init_C(s,C_name,p));
  343. if export_Csym then
  344. inc(Csym^.refs);
  345. if extern_Csym then
  346. begin
  347. Csym^.var_options:=Csym^.var_options or vo_is_external;
  348. { correct type ?? }
  349. externals^.concat(new(pai_external,init(Csym^.mangledname,EXT_NEAR)));
  350. end;
  351. symtablestack^.insert(Csym);
  352. symdone:=true;
  353. end
  354. else
  355. if (is_object) and (cs_static_keyword in aktglobalswitches) and (pattern='STATIC') then
  356. begin
  357. current_object_option:=current_object_option or sp_static;
  358. insert_syms(symtablestack,sc,p);
  359. current_object_option:=current_object_option - sp_static;
  360. consume(ID);
  361. consume(SEMICOLON);
  362. symdone:=true;
  363. end;
  364. end;
  365. { insert it in the symtable, if not done yet }
  366. if not symdone then
  367. insert_syms(symtablestack,sc,p);
  368. end;
  369. { Check for Case }
  370. if is_record and (token=_CASE) then
  371. begin
  372. maxsize:=0;
  373. consume(_CASE);
  374. s:=pattern;
  375. getsym(s,false);
  376. { may be only a type: }
  377. if assigned(srsym) and (srsym^.typ in [typesym,unitsym]) then
  378. casedef:=read_type('')
  379. else
  380. begin
  381. consume(ID);
  382. consume(COLON);
  383. casedef:=read_type('');
  384. symtablestack^.insert(new(pvarsym,init(s,casedef)));
  385. end;
  386. if not is_ordinal(casedef) then
  387. Message(parser_e_ordinal_expected);
  388. consume(_OF);
  389. startvarrec:=symtablestack^.datasize;
  390. repeat
  391. repeat
  392. pt:=comp_expr(true);
  393. do_firstpass(pt);
  394. if not(pt^.treetype=ordconstn) then
  395. Message(cg_e_illegal_expression);
  396. disposetree(pt);
  397. if token=COMMA then
  398. consume(COMMA)
  399. else
  400. break;
  401. until false;
  402. consume(COLON);
  403. { read the vars }
  404. consume(LKLAMMER);
  405. if token<>RKLAMMER then
  406. read_var_decs(true,false);
  407. consume(RKLAMMER);
  408. { calculates maximal variant size }
  409. maxsize:=max(maxsize,symtablestack^.datasize);
  410. { the items of the next variant are overlayed }
  411. symtablestack^.datasize:=startvarrec;
  412. if (token<>_END) and (token<>RKLAMMER) then
  413. consume(SEMICOLON)
  414. else
  415. break;
  416. until (token=_END) or (token=RKLAMMER);
  417. { at last set the record size to that of the biggest variant }
  418. symtablestack^.datasize:=maxsize;
  419. end;
  420. block_type:=old_block_type;
  421. end;
  422. function stringtype : pdef;
  423. { reads a string type with optional length }
  424. { and returns a pointer to the string }
  425. { definition }
  426. var
  427. p : ptree;
  428. d : pdef;
  429. begin
  430. consume(_STRING);
  431. if token=LECKKLAMMER then
  432. begin
  433. consume(LECKKLAMMER);
  434. p:=comp_expr(true);
  435. do_firstpass(p);
  436. if not is_constintnode(p) then
  437. Message(cg_e_illegal_expression);
  438. {$ifndef UseAnsiString}
  439. if (p^.value<1) or (p^.value>255) then
  440. begin
  441. Message(parser_e_string_too_long);
  442. p^.value:=255;
  443. end;
  444. consume(RECKKLAMMER);
  445. if p^.value<>255 then
  446. d:=new(pstringdef,init(p^.value))
  447. {$ifndef GDB}
  448. else d:=new(pstringdef,init(255));
  449. {$else GDB}
  450. else d:=globaldef('STRING');
  451. {$endif GDB}
  452. {$else UseAnsiString}
  453. if p^.value>255 then
  454. d:=new(pstringdef,ansiinit(p^.value))
  455. else if p^.value<>255 then
  456. d:=new(pstringdef,init(p^.value))
  457. {$ifndef GDB}
  458. else d:=new(pstringdef,init(255));
  459. {$else GDB}
  460. else d:=globaldef('STRING');
  461. {$endif GDB}
  462. consume(RECKKLAMMER);
  463. {$endif UseAnsiString}
  464. disposetree(p);
  465. end
  466. { should string without suffix be an ansistring also
  467. in ansistring mode ?? (PM) Yes!!! (FK) }
  468. else
  469. begin
  470. if cs_ansistrings in aktlocalswitches then
  471. d:=new(pstringdef,ansiinit(0))
  472. else
  473. {$ifndef GDB}
  474. d:=new(pstringdef,init(255));
  475. {$else GDB}
  476. d:=globaldef('STRING');
  477. {$endif GDB}
  478. end;
  479. stringtype:=d;
  480. end;
  481. function id_type(var s : string) : pdef;
  482. { reads a type definition and returns a pointer }
  483. { to a appropriating pdef, s gets the name of }
  484. { the type to allow name mangling }
  485. begin
  486. s:=pattern;
  487. consume(ID);
  488. { classes can be used also in classes }
  489. if (curobjectname=pattern) and aktobjectdef^.isclass then
  490. begin
  491. id_type:=aktobjectdef;
  492. exit;
  493. end;
  494. { objects can be parameters }
  495. if (testcurobject=2) and (curobjectname=pattern) then
  496. begin
  497. id_type:=aktobjectdef;
  498. exit;
  499. end;
  500. getsym(s,true);
  501. if assigned(srsym) then
  502. begin
  503. if srsym^.typ=unitsym then
  504. begin
  505. consume(POINT);
  506. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  507. s:=pattern;
  508. consume(ID);
  509. end;
  510. if srsym^.typ<>typesym then
  511. begin
  512. Message(sym_e_type_id_expected);
  513. lasttypesym:=ptypesym(srsym);
  514. id_type:=generrordef;
  515. exit;
  516. end;
  517. end;
  518. lasttypesym:=ptypesym(srsym);
  519. id_type:=ptypesym(srsym)^.definition;
  520. end;
  521. function single_type(var s : string) : pdef;
  522. { reads a string, file type or a type id and returns a name and }
  523. { pdef }
  524. var
  525. hs : string;
  526. begin
  527. case token of
  528. _STRING:
  529. begin
  530. single_type:=stringtype;
  531. s:='STRING';
  532. lasttypesym:=nil;
  533. end;
  534. _FILE:
  535. begin
  536. consume(_FILE);
  537. if token=_OF then
  538. begin
  539. consume(_OF);
  540. single_type:=new(pfiledef,init(ft_typed,single_type(hs)));
  541. s:='FILE$OF$'+hs;
  542. end
  543. else
  544. begin
  545. { single_type:=new(pfiledef,init(ft_untyped,nil));}
  546. single_type:=cfiledef;
  547. s:='FILE';
  548. end;
  549. lasttypesym:=nil;
  550. end;
  551. else single_type:=id_type(s);
  552. end;
  553. end;
  554. function object_dec(const n : stringid;fd : pobjectdef) : pdef;
  555. { this function parses an object or class declaration }
  556. var
  557. actmembertype : symprop;
  558. there_is_a_destructor : boolean;
  559. is_a_class : boolean;
  560. childof : pobjectdef;
  561. aktclass : pobjectdef;
  562. procedure constructor_head;
  563. begin
  564. consume(_CONSTRUCTOR);
  565. { must be at same level as in implementation }
  566. _proc_head(poconstructor);
  567. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'INIT') then
  568. Message(parser_e_constructorname_must_be_init);
  569. consume(SEMICOLON);
  570. begin
  571. if (aktclass^.options and oois_class)<>0 then
  572. begin
  573. { CLASS constructors return the created instance }
  574. aktprocsym^.definition^.retdef:=aktclass;
  575. end
  576. else
  577. begin
  578. { OBJECT constructors return a boolean }
  579. {$IfDef GDB}
  580. {GDB doesn't like unnamed types !}
  581. aktprocsym^.definition^.retdef:=
  582. globaldef('boolean');
  583. {$Else GDB}
  584. aktprocsym^.definition^.retdef:=
  585. new(porddef,init(bool8bit,0,1));
  586. {$Endif GDB}
  587. end;
  588. end;
  589. end;
  590. procedure property_dec;
  591. var
  592. sym : psym;
  593. propertyparas : pdefcoll;
  594. { returns the matching procedure to access a property }
  595. function get_procdef : pprocdef;
  596. var
  597. p : pprocdef;
  598. begin
  599. p:=pprocsym(sym)^.definition;
  600. get_procdef:=nil;
  601. while assigned(p) do
  602. begin
  603. if equal_paras(p^.para1,propertyparas,true) then
  604. break;
  605. p:=p^.nextoverloaded;
  606. end;
  607. get_procdef:=p;
  608. end;
  609. var
  610. hp2,datacoll : pdefcoll;
  611. p,p2 : ppropertysym;
  612. overriden : psym;
  613. hs : string;
  614. code : word;
  615. varspez : tvarspez;
  616. sc : pstringcontainer;
  617. hp : pdef;
  618. s : string;
  619. filepos : tfileposinfo;
  620. pp : pprocdef;
  621. begin
  622. { check for a class }
  623. if (aktclass^.options and oois_class=0) then
  624. Message(parser_e_syntax_error);
  625. consume(_PROPERTY);
  626. if token=ID then
  627. begin
  628. p:=new(ppropertysym,init(pattern));
  629. consume(ID);
  630. propertyparas:=nil;
  631. datacoll:=nil;
  632. { property parameters ? }
  633. if token=LECKKLAMMER then
  634. begin
  635. { create a list of the parameters in propertyparas }
  636. consume(LECKKLAMMER);
  637. inc(testcurobject);
  638. repeat
  639. if token=_VAR then
  640. begin
  641. consume(_VAR);
  642. varspez:=vs_var;
  643. end
  644. else if token=_CONST then
  645. begin
  646. consume(_CONST);
  647. varspez:=vs_const;
  648. end
  649. else varspez:=vs_value;
  650. sc:=idlist;
  651. if token=COLON then
  652. begin
  653. consume(COLON);
  654. if token=_ARRAY then
  655. begin
  656. {
  657. if (varspez<>vs_const) and
  658. (varspez<>vs_var) then
  659. begin
  660. varspez:=vs_const;
  661. Message(parser_e_illegal_open_parameter);
  662. end;
  663. }
  664. consume(_ARRAY);
  665. consume(_OF);
  666. { define range and type of range }
  667. hp:=new(parraydef,init(0,-1,s32bitdef));
  668. { define field type }
  669. parraydef(hp)^.definition:=single_type(s);
  670. end
  671. else
  672. hp:=single_type(s);
  673. end
  674. else
  675. hp:=new(pformaldef,init);
  676. s:=sc^.get_with_tokeninfo(filepos);
  677. while s<>'' do
  678. begin
  679. new(hp2);
  680. hp2^.paratyp:=varspez;
  681. hp2^.data:=hp;
  682. hp2^.next:=propertyparas;
  683. propertyparas:=hp2;
  684. s:=sc^.get_with_tokeninfo(filepos);
  685. end;
  686. dispose(sc,done);
  687. if token=SEMICOLON then consume(SEMICOLON)
  688. else break;
  689. until false;
  690. dec(testcurobject);
  691. consume(RECKKLAMMER);
  692. end;
  693. { overriden property ? }
  694. { force property interface, if there is a property parameter }
  695. if (token=COLON) or assigned(propertyparas) then
  696. begin
  697. consume(COLON);
  698. p^.proptype:=single_type(hs);
  699. if (token=ID) and (pattern='INDEX') then
  700. begin
  701. consume(ID);
  702. p^.options:=p^.options or ppo_indexed;
  703. if token=INTCONST then
  704. val(pattern,p^.index,code);
  705. consume(INTCONST);
  706. { concat a longint to the para template }
  707. new(hp2);
  708. hp2^.paratyp:=vs_value;
  709. hp2^.data:=s32bitdef;
  710. hp2^.next:=propertyparas;
  711. propertyparas:=hp2;
  712. end;
  713. end
  714. else
  715. begin
  716. { do an property override }
  717. overriden:=search_class_member(aktclass,pattern);
  718. if assigned(overriden) and (overriden^.typ=propertysym) then
  719. begin
  720. { take the whole info: }
  721. p^.options:=ppropertysym(overriden)^.options;
  722. p^.index:=ppropertysym(overriden)^.index;
  723. p^.proptype:=ppropertysym(overriden)^.proptype;
  724. p^.writeaccesssym:=ppropertysym(overriden)^.writeaccesssym;
  725. p^.readaccesssym:=ppropertysym(overriden)^.readaccesssym;
  726. p^.writeaccessdef:=ppropertysym(overriden)^.writeaccessdef;
  727. p^.readaccessdef:=ppropertysym(overriden)^.readaccessdef;
  728. end
  729. else
  730. begin
  731. p^.proptype:=generrordef;
  732. message(parser_e_no_property_found_to_override);
  733. end;
  734. end;
  735. { create data defcoll to allow correct parameter checks }
  736. new(datacoll);
  737. datacoll^.paratyp:=vs_value;
  738. datacoll^.data:=p^.proptype;
  739. datacoll^.next:=nil;
  740. if (token=ID) and (pattern='READ') then
  741. begin
  742. consume(ID);
  743. sym:=search_class_member(aktclass,pattern);
  744. if not(assigned(sym)) then
  745. Message1(sym_e_unknown_id,pattern)
  746. else
  747. begin
  748. { varsym aren't allowed for an indexed property
  749. or an property with parameters }
  750. if ((sym^.typ=varsym) and
  751. { not necessary, an index forces propertyparas
  752. to be assigned
  753. }
  754. { (((p^.options and ppo_indexed)<>0) or }
  755. assigned(propertyparas)) or
  756. not(sym^.typ in [varsym,procsym]) then
  757. Message(parser_e_ill_property_access_sym);
  758. { search the matching definition }
  759. if sym^.typ=procsym then
  760. begin
  761. pp:=get_procdef;
  762. if not(assigned(pp)) or
  763. not(is_equal(pp^.retdef,p^.proptype)) then
  764. Message(parser_e_ill_property_access_sym);
  765. p^.readaccessdef:=pp;
  766. end
  767. else if sym^.typ=varsym then
  768. begin
  769. if not(is_equal(pvarsym(sym)^.definition,
  770. p^.proptype)) then
  771. Message(parser_e_ill_property_access_sym);
  772. end;
  773. p^.readaccesssym:=sym;
  774. end;
  775. consume(ID);
  776. end;
  777. if (token=ID) and (pattern='WRITE') then
  778. begin
  779. consume(ID);
  780. sym:=search_class_member(aktclass,pattern);
  781. if not(assigned(sym)) then
  782. Message1(sym_e_unknown_id,pattern)
  783. else
  784. begin
  785. if ((sym^.typ=varsym) and
  786. assigned(propertyparas)) or
  787. not(sym^.typ in [varsym,procsym]) then
  788. Message(parser_e_ill_property_access_sym);
  789. { search the matching definition }
  790. if sym^.typ=procsym then
  791. begin
  792. { insert data entry to check access method }
  793. datacoll^.next:=propertyparas;
  794. propertyparas:=datacoll;
  795. pp:=get_procdef;
  796. { ... and remove it }
  797. propertyparas:=propertyparas^.next;
  798. if not(assigned(pp)) then
  799. Message(parser_e_ill_property_access_sym);
  800. p^.writeaccessdef:=pp;
  801. end
  802. else if sym^.typ=varsym then
  803. begin
  804. if not(is_equal(pvarsym(sym)^.definition,
  805. p^.proptype)) then
  806. Message(parser_e_ill_property_access_sym);
  807. end;
  808. p^.writeaccesssym:=sym;
  809. end;
  810. consume(ID);
  811. end;
  812. if (token=ID) and (pattern='STORED') then
  813. begin
  814. consume(ID);
  815. { !!!!!!!! }
  816. end;
  817. if (token=ID) and (pattern='DEFAULT') then
  818. begin
  819. consume(ID);
  820. { !!!!!!! storage }
  821. consume(SEMICOLON);
  822. end
  823. else if (token=ID) and (pattern='NODEFAULT') then
  824. begin
  825. consume(ID);
  826. { !!!!!!!! }
  827. end;
  828. symtablestack^.insert(p);
  829. { default property ? }
  830. consume(SEMICOLON);
  831. if (token=ID) and (pattern='DEFAULT') then
  832. begin
  833. consume(ID);
  834. p2:=search_default_property(aktclass);
  835. if assigned(p2) then
  836. message1(parser_e_only_one_default_property,
  837. pobjectdef(p2^.owner^.defowner)^.name^)
  838. else
  839. begin
  840. p^.options:=p^.options or ppo_defaultproperty;
  841. if not(assigned(propertyparas)) then
  842. message(parser_e_property_need_paras);
  843. end;
  844. consume(SEMICOLON);
  845. end;
  846. { clean up }
  847. if assigned(datacoll) then
  848. dispose(datacoll);
  849. end
  850. else
  851. begin
  852. consume(ID);
  853. consume(SEMICOLON);
  854. end;
  855. end;
  856. procedure destructor_head;
  857. begin
  858. consume(_DESTRUCTOR);
  859. _proc_head(podestructor);
  860. if (cs_constructor_name in aktglobalswitches) and (aktprocsym^.name<>'DONE') then
  861. Message(parser_e_destructorname_must_be_done);
  862. consume(SEMICOLON);
  863. if assigned(aktprocsym^.definition^.para1) then
  864. Message(parser_e_no_paras_for_destructor);
  865. { no return value }
  866. aktprocsym^.definition^.retdef:=voiddef;
  867. end;
  868. var
  869. hs : string;
  870. pcrd : pclassrefdef;
  871. hp1 : pdef;
  872. oldprocsym : Pprocsym;
  873. oldparse_only : boolean;
  874. begin
  875. {Nowadays aktprocsym may already have a value, so we need to save
  876. it.}
  877. oldprocsym:=aktprocsym;
  878. { forward is resolved }
  879. if assigned(fd) then
  880. fd^.options:=fd^.options and not(oo_isforward);
  881. there_is_a_destructor:=false;
  882. actmembertype:=sp_public;
  883. { objects and class types can't be declared local }
  884. if (symtablestack^.symtabletype<>globalsymtable) and
  885. (symtablestack^.symtabletype<>staticsymtable) then
  886. Message(parser_e_no_local_objects);
  887. { distinguish classes and objects }
  888. if token=_OBJECT then
  889. begin
  890. is_a_class:=false;
  891. consume(_OBJECT)
  892. end
  893. else
  894. begin
  895. is_a_class:=true;
  896. consume(_CLASS);
  897. if not(assigned(fd)) and (token=_OF) then
  898. begin
  899. { a hack, but it's easy to handle }
  900. { class reference type }
  901. consume(_OF);
  902. if typecanbeforward then
  903. forwardsallowed:=true;
  904. hp1:=single_type(hs);
  905. { accept hp1, if is a forward def ...}
  906. if ((lasttypesym<>nil)
  907. and ((lasttypesym^.properties and sp_forwarddef)<>0)) or
  908. { or a class
  909. (if the foward defined type is a class is checked, when
  910. the forward is resolved)
  911. }
  912. ((hp1^.deftype=objectdef) and (
  913. (pobjectdef(hp1)^.options and oois_class)<>0)) then
  914. begin
  915. pcrd:=new(pclassrefdef,init(hp1));
  916. object_dec:=pcrd;
  917. {I add big troubles here
  918. with var p : ^byte in graph.putimage
  919. because a save_forward was called and
  920. no resolve forward
  921. => so the definition was rewritten after
  922. having been disposed !!
  923. Strange problems appeared !!!!}
  924. {Anyhow forwards should only be allowed
  925. inside a type statement ??
  926. don't you think so }
  927. if (lasttypesym<>nil)
  928. and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  929. lasttypesym^.forwardpointer:=ppointerdef(pcrd);
  930. forwardsallowed:=false;
  931. end
  932. else
  933. begin
  934. Message(parser_e_class_type_expected);
  935. object_dec:=new(perrordef,init);
  936. end;
  937. exit;
  938. end
  939. { forward class }
  940. else if not(assigned(fd)) and (token=SEMICOLON) then
  941. begin
  942. { also anonym objects aren't allow (o : object a : longint; end;) }
  943. if n='' then
  944. Message(parser_e_no_anonym_objects);
  945. if n='TOBJECT' then
  946. begin
  947. aktclass:=new(pobjectdef,init(n,nil));
  948. class_tobject:=aktclass;
  949. end
  950. else
  951. aktclass:=new(pobjectdef,init(n,class_tobject));
  952. aktclass^.options:=aktclass^.options or oois_class or oo_isforward;
  953. object_dec:=aktclass;
  954. exit;
  955. end;
  956. end;
  957. { also anonym objects aren't allow (o : object a : longint; end;) }
  958. if n='' then
  959. Message(parser_e_no_anonym_objects);
  960. { read the parent class }
  961. if token=LKLAMMER then
  962. begin
  963. consume(LKLAMMER);
  964. { does not allow objects.tobject !! }
  965. {if token<>ID then
  966. consume(ID);
  967. getsym(pattern,true);}
  968. childof:=pobjectdef(id_type(pattern));
  969. if (childof^.deftype<>objectdef) then
  970. begin
  971. Message(parser_e_class_type_expected);
  972. childof:=nil;
  973. end;
  974. { a mix of class and object isn't allowed }
  975. if (((childof^.options and oois_class)<>0) and not is_a_class) or
  976. (((childof^.options and oois_class)=0) and is_a_class) then
  977. Message(parser_e_mix_of_classes_and_objects);
  978. if assigned(fd) then
  979. begin
  980. { the forward of the child must be resolved to get
  981. correct field addresses
  982. }
  983. if (childof^.options and oo_isforward)<>0 then
  984. Message1(parser_forward_declaration_must_be_resolved,childof^.name^);
  985. fd^.childof:=childof;
  986. aktclass:=fd;
  987. { ajust the size, because the child could be also
  988. forward defined
  989. }
  990. aktclass^.publicsyms^.datasize:=
  991. aktclass^.publicsyms^.datasize-4+childof^.publicsyms^.datasize;
  992. end
  993. else
  994. aktclass:=new(pobjectdef,init(n,childof));
  995. consume(RKLAMMER);
  996. end
  997. { if no parent class, then a class get tobject as parent }
  998. else if is_a_class then
  999. begin
  1000. { is the current class tobject? }
  1001. { so you could define your own tobject }
  1002. if n='TOBJECT' then
  1003. begin
  1004. if assigned(fd) then
  1005. aktclass:=fd
  1006. else
  1007. aktclass:=new(pobjectdef,init(n,nil));
  1008. class_tobject:=aktclass;
  1009. end
  1010. else
  1011. begin
  1012. childof:=class_tobject;
  1013. if assigned(fd) then
  1014. begin
  1015. { the forward of the child must be resolved to get
  1016. correct field addresses
  1017. }
  1018. if (childof^.options and oo_isforward)<>0 then
  1019. Message1(parser_forward_declaration_must_be_resolved,childof^.name^);
  1020. aktclass:=fd;
  1021. aktclass^.childof:=childof;
  1022. { ajust the size, because the child could be also
  1023. forward defined
  1024. }
  1025. aktclass^.publicsyms^.datasize:=
  1026. aktclass^.publicsyms^.datasize-4+childof^.publicsyms^.datasize;
  1027. end
  1028. else
  1029. aktclass:=new(pobjectdef,init(n,childof));
  1030. end;
  1031. end
  1032. else aktclass:=new(pobjectdef,init(n,nil));
  1033. { set the class attribute }
  1034. if is_a_class then
  1035. begin
  1036. aktclass^.options:=aktclass^.options or oois_class;
  1037. if (cs_generate_rtti in aktmoduleswitches) or
  1038. (assigned(aktclass^.childof) and
  1039. ((aktclass^.childof^.options and oo_can_have_published)<>0)
  1040. ) then
  1041. aktclass^.options:=aktclass^.options or oo_can_have_published;
  1042. end;
  1043. aktobjectdef:=aktclass;
  1044. { default access is public }
  1045. actmembertype:=sp_public;
  1046. aktclass^.publicsyms^.next:=symtablestack;
  1047. symtablestack:=aktclass^.publicsyms;
  1048. procinfo._class:=aktclass;
  1049. testcurobject:=1;
  1050. curobjectname:=n;
  1051. { short class declaration ? }
  1052. if (not is_a_class) or (token<>SEMICOLON) then
  1053. begin
  1054. { Parse componenten }
  1055. repeat
  1056. if actmembertype=sp_private then
  1057. aktclass^.options:=aktclass^.options or oo_hasprivate;
  1058. if actmembertype=sp_protected then
  1059. aktclass^.options:=aktclass^.options or oo_hasprotected;
  1060. case token of
  1061. ID : begin
  1062. if (pattern='PRIVATE') then
  1063. begin
  1064. consume(ID);
  1065. actmembertype:=sp_private;
  1066. current_object_option:=sp_private;
  1067. end
  1068. else
  1069. if (pattern='PROTECTED') then
  1070. begin
  1071. consume(ID);
  1072. current_object_option:=sp_protected;
  1073. actmembertype:=sp_protected;
  1074. end
  1075. else
  1076. if (pattern='PUBLIC') then
  1077. begin
  1078. consume(ID);
  1079. current_object_option:=sp_public;
  1080. actmembertype:=sp_public;
  1081. end
  1082. else
  1083. if (pattern='PUBLISHED') then
  1084. begin
  1085. if (aktclass^.options and oo_can_have_published)=0 then
  1086. Message(parser_e_cant_have_published);
  1087. consume(ID);
  1088. current_object_option:=sp_published;
  1089. actmembertype:=sp_published;
  1090. end
  1091. else
  1092. read_var_decs(false,true);
  1093. end;
  1094. _PROPERTY : property_dec;
  1095. _PROCEDURE,
  1096. _FUNCTION,
  1097. _CLASS : begin
  1098. oldparse_only:=parse_only;
  1099. parse_only:=true;
  1100. proc_head;
  1101. parse_only:=oldparse_only;
  1102. if (token=ID) then
  1103. begin
  1104. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1105. begin
  1106. if actmembertype=sp_private then
  1107. Message(parser_w_priv_meth_not_virtual);
  1108. consume(ID);
  1109. consume(SEMICOLON);
  1110. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1111. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1112. end
  1113. else
  1114. if (pattern='OVERRIDE') then
  1115. begin
  1116. consume(ID);
  1117. consume(SEMICOLON);
  1118. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1119. pooverridingmethod or povirtualmethod;
  1120. end;
  1121. { Delphi II extension }
  1122. if (pattern='ABSTRACT') then
  1123. begin
  1124. consume(ID);
  1125. consume(SEMICOLON);
  1126. if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
  1127. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
  1128. else
  1129. Message(parser_e_only_virtual_methods_abstract);
  1130. { the method is defined }
  1131. aktprocsym^.definition^.forwarddef:=false;
  1132. end;
  1133. if (cs_static_keyword in aktglobalswitches) and (pattern='STATIC') then
  1134. begin
  1135. consume(ID);
  1136. consume(SEMICOLON);
  1137. aktprocsym^.properties:=aktprocsym^.properties or sp_static;
  1138. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or postaticmethod;
  1139. end;
  1140. end;
  1141. end;
  1142. _CONSTRUCTOR : begin
  1143. if actmembertype<>sp_public then
  1144. Message(parser_w_constructor_should_be_public);
  1145. oldparse_only:=parse_only;
  1146. parse_only:=true;
  1147. constructor_head;
  1148. parse_only:=oldparse_only;
  1149. if (token=ID) then
  1150. begin
  1151. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1152. begin
  1153. consume(ID);
  1154. consume(SEMICOLON);
  1155. if not(aktclass^.isclass) then
  1156. Message(parser_e_constructor_cannot_be_not_virtual)
  1157. else
  1158. begin
  1159. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1160. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1161. end;
  1162. end
  1163. else
  1164. if (pattern='OVERRIDE') then
  1165. begin
  1166. consume(ID);
  1167. consume(SEMICOLON);
  1168. if (aktclass^.options and oois_class=0) then
  1169. Message(parser_e_constructor_cannot_be_not_virtual)
  1170. else
  1171. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1172. pooverridingmethod or povirtualmethod;
  1173. end;
  1174. end;
  1175. end;
  1176. _DESTRUCTOR : begin
  1177. if there_is_a_destructor then
  1178. Message(parser_n_only_one_destructor);
  1179. there_is_a_destructor:=true;
  1180. if actmembertype<>sp_public then
  1181. Message(parser_w_destructor_should_be_public);
  1182. oldparse_only:=parse_only;
  1183. parse_only:=true;
  1184. destructor_head;
  1185. parse_only:=oldparse_only;
  1186. if (token=ID) then
  1187. begin
  1188. if (pattern='VIRTUAL') or (pattern='DYNAMIC') then
  1189. begin
  1190. consume(ID);
  1191. consume(SEMICOLON);
  1192. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1193. end
  1194. else
  1195. if (pattern='OVERRIDE') then
  1196. begin
  1197. consume(ID);
  1198. consume(SEMICOLON);
  1199. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1200. pooverridingmethod or povirtualmethod;
  1201. end;
  1202. end;
  1203. end;
  1204. _END : begin
  1205. consume(_END);
  1206. break;
  1207. end;
  1208. else
  1209. consume(ID); { Give a ident expected message, like tp7 }
  1210. end;
  1211. until false;
  1212. current_object_option:=sp_public;
  1213. end;
  1214. testcurobject:=0;
  1215. curobjectname:='';
  1216. if (cs_smartlink in aktmoduleswitches) then
  1217. datasegment^.concat(new(pai_cut,init));
  1218. {$ifdef GDB}
  1219. { generate the VMT }
  1220. if cs_debuginfo in aktmoduleswitches then
  1221. begin
  1222. do_count_dbx:=true;
  1223. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1224. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1225. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1226. end;
  1227. {$endif GDB}
  1228. datasegment^.concat(new(pai_symbol,init_global(aktclass^.vmt_mangledname)));
  1229. { determine the size with publicsyms^.datasize, because }
  1230. { size gives back 4 for CLASSes }
  1231. datasegment^.concat(new(pai_const,init_32bit(aktclass^.publicsyms^.datasize)));
  1232. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.publicsyms^.datasize)));
  1233. { write pointer to parent VMT, this isn't implemented in TP }
  1234. { but this is not used in FPC ? (PM) }
  1235. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1236. if assigned(aktclass^.childof) then
  1237. begin
  1238. datasegment^.concat(new(pai_const,init_symbol(strpnew(aktclass^.childof^.vmt_mangledname))));
  1239. if aktclass^.childof^.owner^.symtabletype=unitsymtable then
  1240. concat_external(aktclass^.childof^.vmt_mangledname,EXT_NEAR);
  1241. end
  1242. else
  1243. datasegment^.concat(new(pai_const,init_32bit(0)));
  1244. { this generates the entries }
  1245. genvmt(aktclass);
  1246. { restore old state }
  1247. symtablestack:=symtablestack^.next;
  1248. procinfo._class:=nil;
  1249. {Restore the aktprocsym.}
  1250. aktprocsym:=oldprocsym;
  1251. object_dec:=aktclass;
  1252. end;
  1253. { reads a record declaration }
  1254. function record_dec : pdef;
  1255. var
  1256. symtable : psymtable;
  1257. begin
  1258. symtable:=new(psymtable,init(recordsymtable));
  1259. symtable^.next:=symtablestack;
  1260. symtablestack:=symtable;
  1261. consume(_RECORD);
  1262. read_var_decs(true,false);
  1263. { may be scale record size to a size of n*4 ? }
  1264. if ((symtablestack^.datasize mod aktpackrecords)<>0) then
  1265. inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
  1266. consume(_END);
  1267. symtablestack:=symtable^.next;
  1268. record_dec:=new(precdef,init(symtable));
  1269. end;
  1270. { search in symtablestack used, but not defined type }
  1271. procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
  1272. begin
  1273. if (p^.typ=typesym) and ((p^.properties and sp_forwarddef)<>0) then
  1274. Message(sym_e_type_id_not_defined);
  1275. end;
  1276. { reads a type definition and returns a pointer to it }
  1277. function read_type(const name : stringid) : pdef;
  1278. function handle_procvar:Pprocvardef;
  1279. var
  1280. sc : pstringcontainer;
  1281. s : string;
  1282. p : pdef;
  1283. varspez : tvarspez;
  1284. procvardef : pprocvardef;
  1285. begin
  1286. procvardef:=new(pprocvardef,init);
  1287. if token=LKLAMMER then
  1288. begin
  1289. consume(LKLAMMER);
  1290. inc(testcurobject);
  1291. repeat
  1292. if token=_VAR then
  1293. begin
  1294. consume(_VAR);
  1295. varspez:=vs_var;
  1296. end
  1297. else if token=_CONST then
  1298. begin
  1299. consume(_CONST);
  1300. varspez:=vs_const;
  1301. end
  1302. else varspez:=vs_value;
  1303. sc:=idlist;
  1304. if token=COLON then
  1305. begin
  1306. consume(COLON);
  1307. if token=_ARRAY then
  1308. begin
  1309. {
  1310. if (varspez<>vs_const) and
  1311. (varspez<>vs_var) then
  1312. begin
  1313. varspez:=vs_const;
  1314. Message(parser_e_illegal_open_parameter);
  1315. end;
  1316. }
  1317. consume(_ARRAY);
  1318. consume(_OF);
  1319. { define range and type of range }
  1320. p:=new(parraydef,init(0,-1,s32bitdef));
  1321. { define field type }
  1322. parraydef(p)^.definition:=single_type(s);
  1323. end
  1324. else
  1325. p:=single_type(s);
  1326. end
  1327. else
  1328. p:=new(pformaldef,init);
  1329. s:=sc^.get;
  1330. while s<>'' do
  1331. begin
  1332. procvardef^.concatdef(p,varspez);
  1333. s:=sc^.get;
  1334. end;
  1335. dispose(sc,done);
  1336. if token=SEMICOLON then consume(SEMICOLON)
  1337. else break;
  1338. until false;
  1339. dec(testcurobject);
  1340. consume(RKLAMMER);
  1341. end;
  1342. handle_procvar:=procvardef;
  1343. end;
  1344. var
  1345. hp1,p : pdef;
  1346. aufdef : penumdef;
  1347. aufsym : penumsym;
  1348. ap : parraydef;
  1349. s : stringid;
  1350. l,v,oldaktpackrecords : longint;
  1351. hs : string;
  1352. procedure expr_type;
  1353. var
  1354. pt1,pt2 : ptree;
  1355. begin
  1356. p:=nil;
  1357. { use of current parsed object ? }
  1358. if (token=ID) and (testcurobject=2) and (curobjectname=pattern) then
  1359. begin
  1360. consume(ID);
  1361. p:=aktobjectdef;
  1362. exit;
  1363. end;
  1364. { we can't accept a equal in type }
  1365. pt1:=comp_expr(not(ignore_equal));
  1366. if (pt1^.treetype=typen) and (token<>POINTPOINT) then
  1367. begin
  1368. { a simple type renaming }
  1369. p:=pt1^.resulttype;
  1370. end
  1371. else
  1372. begin
  1373. { range type }
  1374. consume(POINTPOINT);
  1375. { range type declaration }
  1376. do_firstpass(pt1);
  1377. pt2:=comp_expr(not(ignore_equal));
  1378. do_firstpass(pt2);
  1379. { valid expression ? }
  1380. if (pt1^.treetype<>ordconstn) or (pt2^.treetype<>ordconstn) then
  1381. Message(sym_e_error_in_type_def)
  1382. else
  1383. begin
  1384. { Check bounds }
  1385. if pt2^.value<pt1^.value then
  1386. Message(cg_e_upper_lower_than_lower)
  1387. else
  1388. begin
  1389. { is one an enum ? }
  1390. if (pt1^.resulttype^.deftype=enumdef) or (pt2^.resulttype^.deftype=enumdef) then
  1391. begin
  1392. { both must be the have the same (enumdef) definition, else its a type mismatch }
  1393. if (pt1^.resulttype=pt2^.resulttype) then
  1394. p:=new(penumdef,init_subrange(penumdef(pt1^.resulttype),pt1^.value,pt2^.value))
  1395. else
  1396. Message(sym_e_type_mismatch);
  1397. end
  1398. else
  1399. begin
  1400. { both must be are orddefs, create an uauto orddef }
  1401. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1402. end;
  1403. end;
  1404. end;
  1405. disposetree(pt2);
  1406. end;
  1407. disposetree(pt1);
  1408. end;
  1409. var
  1410. pt : ptree;
  1411. procedure array_dec;
  1412. begin
  1413. consume(_ARRAY);
  1414. consume(LECKKLAMMER);
  1415. p:=nil;
  1416. repeat
  1417. { read the expression and check it }
  1418. pt:=expr;
  1419. if pt^.treetype=typen then
  1420. begin
  1421. if pt^.resulttype^.deftype=enumdef then
  1422. begin
  1423. if p=nil then
  1424. begin
  1425. ap:=new(parraydef,
  1426. init(penumdef(pt^.resulttype)^.min,penumdef(pt^.resulttype)^.max,pt^.resulttype));
  1427. p:=ap;
  1428. end
  1429. else
  1430. begin
  1431. ap^.definition:=new(parraydef,
  1432. init(penumdef(pt^.resulttype)^.min,penumdef(pt^.resulttype)^.max,pt^.resulttype));
  1433. ap:=parraydef(ap^.definition);
  1434. end;
  1435. end
  1436. else if pt^.resulttype^.deftype=orddef then
  1437. begin
  1438. case porddef(pt^.resulttype)^.typ of
  1439. s8bit,u8bit,s16bit,u16bit,s32bit :
  1440. begin
  1441. if p=nil then
  1442. begin
  1443. ap:=new(parraydef,init(porddef(pt^.resulttype)^.low,
  1444. porddef(pt^.resulttype)^.high,pt^.resulttype));
  1445. p:=ap;
  1446. end
  1447. else
  1448. begin
  1449. ap^.definition:=new(parraydef,init(porddef(pt^.resulttype)^.low,
  1450. porddef(pt^.resulttype)^.high,pt^.resulttype));
  1451. ap:=parraydef(ap^.definition);
  1452. end;
  1453. end;
  1454. bool8bit:
  1455. begin
  1456. if p=nil then
  1457. begin
  1458. ap:=new(parraydef,init(0,1,pt^.resulttype));
  1459. p:=ap;
  1460. end
  1461. else
  1462. begin
  1463. ap^.definition:=new(parraydef,init(0,1,pt^.resulttype));
  1464. ap:=parraydef(ap^.definition);
  1465. end;
  1466. end;
  1467. uchar:
  1468. begin
  1469. if p=nil then
  1470. begin
  1471. ap:=new(parraydef,init(0,255,pt^.resulttype));
  1472. p:=ap;
  1473. end
  1474. else
  1475. begin
  1476. ap^.definition:=new(parraydef,init(0,255,pt^.resulttype));
  1477. ap:=parraydef(ap^.definition);
  1478. end;
  1479. end;
  1480. else Message(sym_e_error_in_type_def);
  1481. end;
  1482. end
  1483. else Message(sym_e_error_in_type_def);
  1484. end
  1485. else
  1486. begin
  1487. do_firstpass(pt);
  1488. if (pt^.treetype<>rangen) or
  1489. (pt^.left^.treetype<>ordconstn) then
  1490. Message(sym_e_error_in_type_def);
  1491. { force the registration of the ranges }
  1492. {$ifndef GDB}
  1493. if pt^.right^.resulttype=pdef(s32bitdef) then
  1494. pt^.right^.resulttype:=new(porddef,init(
  1495. s32bit,$80000000,$7fffffff));
  1496. {$endif GDB}
  1497. if p=nil then
  1498. begin
  1499. ap:=new(parraydef,init(pt^.left^.value,pt^.right^.value,pt^.right^.resulttype));
  1500. p:=ap;
  1501. end
  1502. else
  1503. begin
  1504. ap^.definition:=new(parraydef,init(pt^.left^.value,pt^.right^.value,pt^.right^.resulttype));
  1505. ap:=parraydef(ap^.definition);
  1506. end;
  1507. end;
  1508. disposetree(pt);
  1509. if token=COMMA then consume(COMMA)
  1510. else break;
  1511. until false;
  1512. consume(RECKKLAMMER);
  1513. consume(_OF);
  1514. hp1:=read_type('');
  1515. { if no error, set element type }
  1516. if assigned(ap) then
  1517. ap^.definition:=hp1;
  1518. end;
  1519. begin
  1520. case token of
  1521. _STRING,_FILE:
  1522. p:=single_type(hs);
  1523. LKLAMMER:
  1524. begin
  1525. consume(LKLAMMER);
  1526. l:=-1;
  1527. aufsym := Nil;
  1528. aufdef:=new(penumdef,init);
  1529. repeat
  1530. s:=pattern;
  1531. consume(ID);
  1532. if token=ASSIGNMENT then
  1533. begin
  1534. consume(ASSIGNMENT);
  1535. v:=get_intconst;
  1536. { please leave that a note, allows type save }
  1537. { declarations in the win32 units ! }
  1538. if v<=l then
  1539. Message(parser_n_duplicate_enum);
  1540. l:=v;
  1541. end
  1542. else
  1543. inc(l);
  1544. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  1545. if token=COMMA then
  1546. consume(COMMA)
  1547. else
  1548. break;
  1549. until false;
  1550. aufdef^.max:=l;
  1551. p:=aufdef;
  1552. consume(RKLAMMER);
  1553. end;
  1554. _ARRAY:
  1555. array_dec;
  1556. _SET:
  1557. begin
  1558. consume(_SET);
  1559. consume(_OF);
  1560. hp1:=read_type('');
  1561. case hp1^.deftype of
  1562. enumdef : p:=new(psetdef,init(hp1,penumdef(hp1)^.max));
  1563. orddef : begin
  1564. case porddef(hp1)^.typ of
  1565. uchar : p:=new(psetdef,init(hp1,255));
  1566. u8bit,s8bit,u16bit,s16bit,s32bit :
  1567. begin
  1568. if (porddef(hp1)^.low>=0) then
  1569. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  1570. else Message(sym_e_ill_type_decl_set);
  1571. end;
  1572. else Message(sym_e_ill_type_decl_set);
  1573. end;
  1574. end;
  1575. else Message(sym_e_ill_type_decl_set);
  1576. end;
  1577. end;
  1578. CARET:
  1579. begin
  1580. consume(CARET);
  1581. { forwards allowed only inside TYPE statements }
  1582. if typecanbeforward then
  1583. forwardsallowed:=true;
  1584. hp1:=single_type(hs);
  1585. p:=new(ppointerdef,init(hp1));
  1586. {I add big troubles here
  1587. with var p : ^byte in graph.putimage
  1588. because a save_forward was called and
  1589. no resolve forward
  1590. => so the definition was rewritten after
  1591. having been disposed !!
  1592. Strange problems appeared !!!!}
  1593. {Anyhow forwards should only be allowed
  1594. inside a type statement ??
  1595. don't you think so }
  1596. if (lasttypesym<>nil)
  1597. and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  1598. lasttypesym^.forwardpointer:=ppointerdef(p);
  1599. forwardsallowed:=false;
  1600. end;
  1601. _RECORD:
  1602. p:=record_dec;
  1603. _PACKED:
  1604. begin
  1605. consume(_PACKED);
  1606. if token=_ARRAY then
  1607. array_dec
  1608. else
  1609. begin
  1610. oldaktpackrecords:=aktpackrecords;
  1611. aktpackrecords:=1;
  1612. if token in [_CLASS,_OBJECT] then
  1613. p:=object_dec(name,nil)
  1614. else
  1615. p:=record_dec;
  1616. aktpackrecords:=oldaktpackrecords;
  1617. end;
  1618. end;
  1619. _CLASS,
  1620. _OBJECT:
  1621. p:=object_dec(name,nil);
  1622. _PROCEDURE:
  1623. begin
  1624. consume(_PROCEDURE);
  1625. p:=handle_procvar;
  1626. if token=_OF then
  1627. begin
  1628. consume(_OF);
  1629. consume(_OBJECT);
  1630. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1631. end;
  1632. end;
  1633. _FUNCTION:
  1634. begin
  1635. consume(_FUNCTION);
  1636. p:=handle_procvar;
  1637. consume(COLON);
  1638. pprocvardef(p)^.retdef:=single_type(hs);
  1639. if token=_OF then
  1640. begin
  1641. consume(_OF);
  1642. consume(_OBJECT);
  1643. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1644. end;
  1645. end;
  1646. else
  1647. expr_type;
  1648. end;
  1649. read_type:=p;
  1650. end;
  1651. { reads a type declaration to the symbol table }
  1652. procedure type_dec;
  1653. var
  1654. typename : stringid;
  1655. newtype : ptypesym;
  1656. {$ifdef dummy}
  1657. olddef,newdef : pdef;
  1658. s : string;
  1659. {$endif dummy}
  1660. begin
  1661. block_type:=bt_type;
  1662. consume(_TYPE);
  1663. typecanbeforward:=true;
  1664. repeat
  1665. typename:=pattern;
  1666. consume(ID);
  1667. consume(EQUAL);
  1668. { here you loose the strictness of pascal
  1669. for which a redefinition like
  1670. childtype = parenttype;
  1671. child2type = parenttype;
  1672. does not make the two child types equal !!
  1673. here all vars from childtype and child2type
  1674. get the definition of parenttype !! }
  1675. {$ifdef testequaltype}
  1676. if (token = ID) or (token=_FILE) or (token=_STRING) then
  1677. begin
  1678. olddef := single_type(s);
  1679. { make a clone of olddef }
  1680. { is that ok ??? }
  1681. getmem(newdef,SizeOf(olddef));
  1682. move(olddef^,newdef^,SizeOf(olddef));
  1683. newtype:=new(ptypesym,init(typename,newdef));
  1684. symtablestack^.insert(newtype);
  1685. end
  1686. else
  1687. {$endif testequaltype}
  1688. begin
  1689. getsym(typename,false);
  1690. { check if it is the definition of a forward defined class }
  1691. if assigned(srsym) and (token=_CLASS) and
  1692. (srsym^.typ=typesym) and
  1693. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  1694. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_isforward)<>0) and
  1695. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oois_class)<>0) then
  1696. begin
  1697. { we can ignore the result }
  1698. { the definition is modified }
  1699. object_dec(typename,pobjectdef(ptypesym(srsym)^.definition));
  1700. newtype:=ptypesym(srsym);
  1701. end
  1702. else
  1703. begin
  1704. newtype:=new(ptypesym,init(typename,read_type(typename)));
  1705. { load newtype with the new pointer to the inserted type
  1706. because it can be an already defined forwarded type !! }
  1707. newtype:=ptypesym(symtablestack^.insert(newtype));
  1708. end;
  1709. end;
  1710. consume(SEMICOLON);
  1711. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  1712. parse_var_proc_directives(newtype);
  1713. until token<>ID;
  1714. typecanbeforward:=false;
  1715. {$ifdef tp}
  1716. symtablestack^.foreach(testforward_types);
  1717. {$else}
  1718. symtablestack^.foreach(@testforward_types);
  1719. {$endif}
  1720. resolve_forwards;
  1721. block_type:=bt_general;
  1722. end;
  1723. procedure var_dec;
  1724. { parses varaible declarations and inserts them in }
  1725. { the top symbol table of symtablestack }
  1726. begin
  1727. consume(_VAR);
  1728. read_var_decs(false,false);
  1729. end;
  1730. procedure Not_supported_for_inline(t : ttoken);
  1731. begin
  1732. if assigned(aktprocsym) and
  1733. ((aktprocsym^.definition^.options and poinline)<>0) then
  1734. Begin
  1735. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  1736. Message(parser_w_inlining_disabled);
  1737. aktprocsym^.definition^.options:= aktprocsym^.definition^.options and not poinline;
  1738. End;
  1739. end;
  1740. procedure read_declarations(islibrary : boolean);
  1741. begin
  1742. repeat
  1743. case token of
  1744. _LABEL:
  1745. begin
  1746. Not_supported_for_inline(token);
  1747. label_dec;
  1748. end;
  1749. _CONST:
  1750. begin
  1751. Not_supported_for_inline(token);
  1752. const_dec;
  1753. end;
  1754. _TYPE:
  1755. begin
  1756. Not_supported_for_inline(token);
  1757. type_dec;
  1758. end;
  1759. _VAR:
  1760. var_dec;
  1761. _CONSTRUCTOR,_DESTRUCTOR,
  1762. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  1763. begin
  1764. Not_supported_for_inline(token);
  1765. unter_dec;
  1766. end;
  1767. _EXPORTS:
  1768. begin
  1769. { here we should be at lexlevel 1, no ? PM }
  1770. Not_supported_for_inline(token);
  1771. if islibrary then
  1772. read_exports
  1773. else
  1774. break;
  1775. end
  1776. else break;
  1777. end;
  1778. until false;
  1779. end;
  1780. procedure read_interface_declarations;
  1781. begin
  1782. {Since the body is now parsed at lexlevel 1, and the declarations
  1783. must be parsed at the same lexlevel we increase the lexlevel.}
  1784. inc(lexlevel);
  1785. repeat
  1786. case token of
  1787. _CONST : const_dec;
  1788. _TYPE : type_dec;
  1789. _VAR : var_dec;
  1790. _FUNCTION,
  1791. _PROCEDURE,
  1792. _OPERATOR : unter_dec;
  1793. else
  1794. break;
  1795. end;
  1796. until false;
  1797. dec(lexlevel);
  1798. end;
  1799. end.
  1800. {
  1801. $Log$
  1802. Revision 1.39 1998-08-19 00:42:40 peter
  1803. + subrange types for enums
  1804. + checking for bounds type with ranges
  1805. Revision 1.38 1998/08/12 19:20:39 peter
  1806. + public is the same as export for c_vars
  1807. * a exported/public c_var incs now the refcount
  1808. Revision 1.37 1998/08/11 15:31:38 peter
  1809. * write extended to ppu file
  1810. * new version 0.99.7
  1811. Revision 1.36 1998/08/10 14:50:09 peter
  1812. + localswitches, moduleswitches, globalswitches splitting
  1813. Revision 1.35 1998/07/26 21:59:00 florian
  1814. + better support for switch $H
  1815. + index access to ansi strings added
  1816. + assigment of data (records/arrays) containing ansi strings
  1817. Revision 1.34 1998/07/20 22:17:15 florian
  1818. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1819. * there was a bug in record_var_dec which prevents the used
  1820. of nested variant records (for example drivers.tevent of tv)
  1821. Revision 1.33 1998/07/18 17:11:11 florian
  1822. + ansi string constants fixed
  1823. + switch $H partial implemented
  1824. Revision 1.32 1998/07/14 21:46:50 peter
  1825. * updated messages file
  1826. Revision 1.31 1998/07/14 14:46:53 peter
  1827. * released NEWINPUT
  1828. Revision 1.30 1998/07/10 00:00:00 peter
  1829. * fixed ttypesym bug finally
  1830. * fileinfo in the symtable and better using for unused vars
  1831. Revision 1.29 1998/06/25 14:04:21 peter
  1832. + internal inc/dec
  1833. Revision 1.28 1998/06/24 12:26:45 peter
  1834. * stricter var parsing like tp7 and some optimizes with directive
  1835. parsing
  1836. Revision 1.27 1998/06/12 16:15:34 pierre
  1837. * external name 'C_var';
  1838. export name 'intern_C_var';
  1839. cdecl;
  1840. cdecl;external;
  1841. are now supported only with -Sv switch
  1842. Revision 1.25 1998/06/09 16:01:45 pierre
  1843. + added procedure directive parsing for procvars
  1844. (accepted are popstack cdecl and pascal)
  1845. + added C vars with the following syntax
  1846. var C calias 'true_c_name';(can be followed by external)
  1847. reason is that you must add the Cprefix
  1848. which is target dependent
  1849. Revision 1.24 1998/06/05 14:37:32 pierre
  1850. * fixes for inline for operators
  1851. * inline procedure more correctly restricted
  1852. Revision 1.23 1998/06/04 23:51:50 peter
  1853. * m68k compiles
  1854. + .def file creation moved to gendef.pas so it could also be used
  1855. for win32
  1856. Revision 1.22 1998/06/03 22:48:59 peter
  1857. + wordbool,longbool
  1858. * rename bis,von -> high,low
  1859. * moved some systemunit loading/creating to psystem.pas
  1860. Revision 1.21 1998/06/03 22:14:19 florian
  1861. * problem with sizes of classes fixed (if the anchestor was declared
  1862. forward, the compiler doesn't update the child classes size)
  1863. Revision 1.20 1998/05/28 14:35:54 peter
  1864. * nicer error message when no id is used after var
  1865. Revision 1.19 1998/05/23 01:21:19 peter
  1866. + aktasmmode, aktoptprocessor, aktoutputformat
  1867. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1868. + $LIBNAME to set the library name where the unit will be put in
  1869. * splitted cgi386 a bit (codeseg to large for bp7)
  1870. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1871. Revision 1.18 1998/05/20 09:42:35 pierre
  1872. + UseTokenInfo now default
  1873. * unit in interface uses and implementation uses gives error now
  1874. * only one error for unknown symbol (uses lastsymknown boolean)
  1875. the problem came from the label code !
  1876. + first inlined procedures and function work
  1877. (warning there might be allowed cases were the result is still wrong !!)
  1878. * UseBrower updated gives a global list of all position of all used symbols
  1879. with switch -gb
  1880. Revision 1.17 1998/05/11 13:07:55 peter
  1881. + $ifdef NEWPPU for the new ppuformat
  1882. + $define GDB not longer required
  1883. * removed all warnings and stripped some log comments
  1884. * no findfirst/findnext anymore to remove smartlink *.o files
  1885. Revision 1.16 1998/05/05 12:05:42 florian
  1886. * problems with properties fixed
  1887. * crash fixed: i:=l when i and l are undefined, was a problem with
  1888. implementation of private/protected
  1889. Revision 1.15 1998/05/01 09:01:23 florian
  1890. + correct semantics of private and protected
  1891. * small fix in variable scope:
  1892. a id can be used in a parameter list of a method, even it is used in
  1893. an anchestor class as field id
  1894. Revision 1.14 1998/05/01 07:43:56 florian
  1895. + basics for rtti implemented
  1896. + switch $m (generate rtti for published sections)
  1897. Revision 1.13 1998/04/30 15:59:41 pierre
  1898. * GDB works again better :
  1899. correct type info in one pass
  1900. + UseTokenInfo for better source position
  1901. * fixed one remaining bug in scanner for line counts
  1902. * several little fixes
  1903. Revision 1.12 1998/04/29 10:33:57 pierre
  1904. + added some code for ansistring (not complete nor working yet)
  1905. * corrected operator overloading
  1906. * corrected nasm output
  1907. + started inline procedures
  1908. + added starstarn : use ** for exponentiation (^ gave problems)
  1909. + started UseTokenInfo cond to get accurate positions
  1910. Revision 1.11 1998/04/28 11:45:52 florian
  1911. * make it compilable with TP
  1912. + small COM problems solved to compile classes.pp
  1913. Revision 1.10 1998/04/27 23:10:28 peter
  1914. + new scanner
  1915. * $makelib -> if smartlink
  1916. * small filename fixes pmodule.setfilename
  1917. * moved import from files.pas -> import.pas
  1918. Revision 1.9 1998/04/10 21:36:56 florian
  1919. + some stuff to support method pointers (procedure of object) added
  1920. (declaration, parameter handling)
  1921. Revision 1.8 1998/04/10 15:39:48 florian
  1922. * more fixes to get classes.pas compiled
  1923. Revision 1.7 1998/04/09 23:02:15 florian
  1924. * small problems solved to get remake3 work
  1925. Revision 1.6 1998/04/09 22:16:35 florian
  1926. * problem with previous REGALLOC solved
  1927. * improved property support
  1928. Revision 1.5 1998/04/08 14:59:20 florian
  1929. * problem with new expr_type solved
  1930. Revision 1.4 1998/04/08 10:26:09 florian
  1931. * correct error handling of virtual constructors
  1932. * problem with new type declaration handling fixed
  1933. Revision 1.3 1998/04/07 22:45:05 florian
  1934. * bug0092, bug0115 and bug0121 fixed
  1935. + packed object/class/array
  1936. Revision 1.2 1998/04/05 13:58:35 peter
  1937. * fixed the -Ss bug
  1938. + warning for Virtual constructors
  1939. * helppages updated with -TGO32V1
  1940. }