pdecl.pas 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643
  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. if idtoken=_MESSAGE then
  1261. begin
  1262. { check parameter type }
  1263. if assigned(aktprocsym^.definition^.para1^.next) or
  1264. (aktprocsym^.definition^.para1^.paratyp<>vs_var) then
  1265. Message(parser_e_ill_msg_param);
  1266. consume(idtoken);
  1267. pt:=comp_expr(true);
  1268. do_firstpass(pt);
  1269. if pt^.treetype=stringconstn then
  1270. begin
  1271. aktclass^.options:=aktclass^.options or oo_hasmsgstr;
  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. aktclass^.options:=aktclass^.options or oo_hasmsgint;
  1279. aktprocsym^.definition^.options:=
  1280. aktprocsym^.definition^.options or pomsgint;
  1281. aktprocsym^.definition^.messageinf.i:=pt^.value;
  1282. end
  1283. else
  1284. Message(parser_e_ill_msg_expr);
  1285. disposetree(pt);
  1286. consume(SEMICOLON);
  1287. end
  1288. else
  1289. begin
  1290. {$ifdef OLDOBJECTOPTIONS}
  1291. case idtoken of
  1292. _DYNAMIC,
  1293. _VIRTUAL : begin
  1294. if actmembertype=sp_private then
  1295. Message(parser_w_priv_meth_not_virtual);
  1296. consume(idtoken);
  1297. consume(SEMICOLON);
  1298. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1299. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1300. end;
  1301. _OVERRIDE : begin
  1302. consume(_OVERRIDE);
  1303. consume(SEMICOLON);
  1304. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1305. pooverridingmethod or povirtualmethod;
  1306. end;
  1307. end;
  1308. if idtoken=_ABSTRACT then
  1309. begin
  1310. if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
  1311. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
  1312. else
  1313. Message(parser_e_only_virtual_methods_abstract);
  1314. consume(_ABSTRACT);
  1315. consume(SEMICOLON);
  1316. { the method is defined }
  1317. aktprocsym^.definition^.forwarddef:=false;
  1318. end;
  1319. if (cs_static_keyword in aktglobalswitches) and (idtoken=_STATIC) then
  1320. begin
  1321. consume(_STATIC);
  1322. consume(SEMICOLON);
  1323. aktprocsym^.properties:=aktprocsym^.properties or sp_static;
  1324. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or postaticmethod;
  1325. end;
  1326. {$else OLDOBJECTOPTIONS}
  1327. parse_object_proc_directives(aktprocsym);
  1328. {$endif def OLDOBJECTOPTIONS}
  1329. end;
  1330. parse_only:=oldparse_only;
  1331. end;
  1332. _CONSTRUCTOR : begin
  1333. if actmembertype<>sp_public then
  1334. Message(parser_w_constructor_should_be_public);
  1335. oldparse_only:=parse_only;
  1336. parse_only:=true;
  1337. constructor_head;
  1338. {$ifdef OLDOBJECTOPTIONS}
  1339. parse_object_proc_directives(aktprocsym);
  1340. {$else OLDOBJECTOPTIONS}
  1341. case idtoken of
  1342. _DYNAMIC,
  1343. _VIRTUAL : begin
  1344. if not(aktclass^.isclass) then
  1345. Message(parser_e_constructor_cannot_be_not_virtual)
  1346. else
  1347. begin
  1348. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1349. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1350. end;
  1351. consume(idtoken);
  1352. consume(SEMICOLON);
  1353. end;
  1354. _OVERRIDE : begin
  1355. if (aktclass^.options and oo_is_class=0) then
  1356. Message(parser_e_constructor_cannot_be_not_virtual)
  1357. else
  1358. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1359. pooverridingmethod or povirtualmethod;
  1360. consume(_OVERRIDE);
  1361. consume(SEMICOLON);
  1362. end;
  1363. end;
  1364. {$endif def OLDOBJECTOPTIONS}
  1365. parse_only:=oldparse_only;
  1366. end;
  1367. _DESTRUCTOR : begin
  1368. if there_is_a_destructor then
  1369. Message(parser_n_only_one_destructor);
  1370. there_is_a_destructor:=true;
  1371. if actmembertype<>sp_public then
  1372. Message(parser_w_destructor_should_be_public);
  1373. oldparse_only:=parse_only;
  1374. parse_only:=true;
  1375. destructor_head;
  1376. {$ifdef OLDOBJECTOPTIONS}
  1377. parse_object_proc_directives(aktprocsym);
  1378. {$else OLDOBJECTOPTIONS}
  1379. case idtoken of
  1380. _DYNAMIC,
  1381. _VIRTUAL : begin
  1382. consume(idtoken);
  1383. consume(SEMICOLON);
  1384. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or povirtualmethod;
  1385. aktclass^.options:=aktclass^.options or oo_hasvirtual;
  1386. end;
  1387. _OVERRIDE : begin
  1388. consume(_OVERRIDE);
  1389. consume(SEMICOLON);
  1390. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
  1391. pooverridingmethod or povirtualmethod;
  1392. end;
  1393. end;
  1394. {$endif def OLDOBJECTOPTIONS}
  1395. parse_only:=oldparse_only;
  1396. end;
  1397. _END : begin
  1398. consume(_END);
  1399. break;
  1400. end;
  1401. else
  1402. consume(ID); { Give a ident expected message, like tp7 }
  1403. end;
  1404. until false;
  1405. current_object_option:=sp_public;
  1406. end;
  1407. testcurobject:=0;
  1408. curobjectname:='';
  1409. typecanbeforward:=storetypeforwardsallowed;
  1410. { generate vmt space if needed }
  1411. if ((aktclass^.options and
  1412. (oo_hasvirtual or oo_hasconstructor or
  1413. oo_hasdestructor or oo_is_class))<>0) and
  1414. ((aktclass^.options and
  1415. oo_hasvmt)=0) then
  1416. aktclass^.insertvmt;
  1417. if (cs_smartlink in aktmoduleswitches) then
  1418. datasegment^.concat(new(pai_cut,init));
  1419. { write extended info for classes }
  1420. if is_a_class then
  1421. begin
  1422. if (aktclass^.options and oo_can_have_published)<>0 then
  1423. aktclass^.generate_rtti;
  1424. { write class name }
  1425. getlabel(classnamelabel);
  1426. datasegment^.concat(new(pai_label,init(classnamelabel)));
  1427. datasegment^.concat(new(pai_const,init_8bit(length(aktclass^.name^))));
  1428. datasegment^.concat(new(pai_string,init(aktclass^.name^)));
  1429. { generate message and dynamic tables }
  1430. { why generate those if empty ??? }
  1431. if (aktclass^.options and oo_hasmsgstr)<>0 then
  1432. strmessagetable:=genstrmsgtab(aktclass);
  1433. if (aktclass^.options and oo_hasmsgint)<>0 then
  1434. intmessagetable:=genintmsgtab(aktclass);
  1435. { table for string messages }
  1436. if (aktclass^.options and oo_hasmsgstr)<>0 then
  1437. datasegment^.concat(new(pai_const_symbol,init(lab2str(strmessagetable))))
  1438. else
  1439. datasegment^.concat(new(pai_const,init_32bit(0)));
  1440. { interface table }
  1441. datasegment^.concat(new(pai_const,init_32bit(0)));
  1442. { auto table }
  1443. datasegment^.concat(new(pai_const,init_32bit(0)));
  1444. { inittable for con-/destruction }
  1445. if aktclass^.needs_inittable then
  1446. datasegment^.concat(new(pai_const_symbol,init(lab2str(aktclass^.get_inittable_label))))
  1447. else
  1448. datasegment^.concat(new(pai_const,init_32bit(0)));
  1449. { pointer to type info of published section }
  1450. if (aktclass^.options and oo_can_have_published)<>0 then
  1451. datasegment^.concat(new(pai_const_symbol,init(aktclass^.rtti_name)))
  1452. else
  1453. datasegment^.concat(new(pai_const,init_32bit(0)));
  1454. { pointer to field table }
  1455. datasegment^.concat(new(pai_const,init_32bit(0)));
  1456. { pointer to method table }
  1457. datasegment^.concat(new(pai_const,init_32bit(0)));
  1458. { pointer to dynamic table }
  1459. if (aktclass^.options and oo_hasmsgint)<>0 then
  1460. datasegment^.concat(new(pai_const_symbol,init(lab2str(intmessagetable))))
  1461. else
  1462. datasegment^.concat(new(pai_const,init_32bit(0)));
  1463. { pointer to class name string }
  1464. datasegment^.concat(new(pai_const_symbol,init(lab2str(classnamelabel))));
  1465. end;
  1466. {$ifdef GDB}
  1467. { generate the VMT }
  1468. if (cs_debuginfo in aktmoduleswitches) and
  1469. ((aktclass^.options and oo_hasvmt)<>0) then
  1470. begin
  1471. do_count_dbx:=true;
  1472. if assigned(aktclass^.owner) and assigned(aktclass^.owner^.name) then
  1473. datasegment^.concat(new(pai_stabs,init(strpnew('"vmt_'+aktclass^.owner^.name^+n+':S'+
  1474. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+aktclass^.vmt_mangledname))));
  1475. end;
  1476. {$endif GDB}
  1477. if ((aktclass^.options and oo_hasvmt)<>0) then
  1478. begin
  1479. datasegment^.concat(new(pai_symbol,init_global(aktclass^.vmt_mangledname)));
  1480. { determine the size with publicsyms^.datasize, because }
  1481. { size gives back 4 for classes }
  1482. datasegment^.concat(new(pai_const,init_32bit(aktclass^.publicsyms^.datasize)));
  1483. datasegment^.concat(new(pai_const,init_32bit(-aktclass^.publicsyms^.datasize)));
  1484. { write pointer to parent VMT, this isn't implemented in TP }
  1485. { but this is not used in FPC ? (PM) }
  1486. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1487. { it is not written for parents that don't have any vmt !! }
  1488. if assigned(aktclass^.childof) and
  1489. ((aktclass^.childof^.options and oo_hasvmt)<>0) then
  1490. begin
  1491. datasegment^.concat(new(pai_const_symbol,init(aktclass^.childof^.vmt_mangledname)));
  1492. if aktclass^.childof^.owner^.symtabletype=unitsymtable then
  1493. concat_external(aktclass^.childof^.vmt_mangledname,EXT_NEAR);
  1494. end
  1495. else
  1496. datasegment^.concat(new(pai_const,init_32bit(0)));
  1497. { this generates the entries }
  1498. genvmt(aktclass);
  1499. end;
  1500. { number symbols and defs }
  1501. symtablestack^.number_defs;
  1502. symtablestack^.number_symbols;
  1503. { restore old state }
  1504. symtablestack:=symtablestack^.next;
  1505. procinfo._class:=nil;
  1506. aktobjectdef:=nil;
  1507. {Restore the aktprocsym.}
  1508. aktprocsym:=oldprocsym;
  1509. object_dec:=aktclass;
  1510. end;
  1511. { reads a record declaration }
  1512. function record_dec : pdef;
  1513. var
  1514. symtable : psymtable;
  1515. storetypeforwardsallowed : boolean;
  1516. begin
  1517. symtable:=new(psymtable,init(recordsymtable));
  1518. symtable^.next:=symtablestack;
  1519. symtablestack:=symtable;
  1520. consume(_RECORD);
  1521. storetypeforwardsallowed:=typecanbeforward;
  1522. if m_tp in aktmodeswitches then
  1523. typecanbeforward:=false;
  1524. read_var_decs(true,false);
  1525. { may be scale record size to a size of n*4 ? }
  1526. if ((symtablestack^.datasize mod aktpackrecords)<>0) then
  1527. inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
  1528. consume(_END);
  1529. typecanbeforward:=storetypeforwardsallowed;
  1530. { number symbols and defs }
  1531. symtablestack^.number_defs;
  1532. symtablestack^.number_symbols;
  1533. symtablestack:=symtable^.next;
  1534. record_dec:=new(precdef,init(symtable));
  1535. end;
  1536. { reads a type definition and returns a pointer to it }
  1537. function read_type(const name : stringid) : pdef;
  1538. function handle_procvar:Pprocvardef;
  1539. var
  1540. sc : pstringcontainer;
  1541. s : string;
  1542. p : pdef;
  1543. varspez : tvarspez;
  1544. procvardef : pprocvardef;
  1545. begin
  1546. procvardef:=new(pprocvardef,init);
  1547. if token=LKLAMMER then
  1548. begin
  1549. consume(LKLAMMER);
  1550. inc(testcurobject);
  1551. repeat
  1552. case token of
  1553. _VAR :
  1554. begin
  1555. consume(_VAR);
  1556. varspez:=vs_var;
  1557. end;
  1558. _CONST :
  1559. begin
  1560. consume(_CONST);
  1561. varspez:=vs_const;
  1562. end;
  1563. else
  1564. varspez:=vs_value;
  1565. end;
  1566. sc:=idlist;
  1567. if (token=COLON) or (varspez=vs_value) then
  1568. begin
  1569. consume(COLON);
  1570. if token=_ARRAY then
  1571. begin
  1572. consume(_ARRAY);
  1573. consume(_OF);
  1574. { define range and type of range }
  1575. p:=new(Parraydef,init(0,-1,s32bitdef));
  1576. { array of const ? }
  1577. if (token=_CONST) and (m_objpas in aktmodeswitches) then
  1578. begin
  1579. consume(_CONST);
  1580. srsym:=nil;
  1581. if assigned(objpasunit) then
  1582. getsymonlyin(objpasunit,'TVARREC');
  1583. if not assigned(srsym) then
  1584. InternalError(1234124);
  1585. Parraydef(p)^.definition:=ptypesym(srsym)^.definition;
  1586. Parraydef(p)^.IsArrayOfConst:=true;
  1587. end
  1588. else
  1589. begin
  1590. { define field type }
  1591. Parraydef(p)^.definition:=single_type(s);
  1592. end;
  1593. end
  1594. else
  1595. p:=single_type(s);
  1596. end
  1597. else
  1598. p:=new(pformaldef,init);
  1599. while not sc^.empty do
  1600. begin
  1601. s:=sc^.get;
  1602. procvardef^.concatdef(p,varspez);
  1603. end;
  1604. dispose(sc,done);
  1605. if token=SEMICOLON then
  1606. consume(SEMICOLON)
  1607. else
  1608. break;
  1609. until false;
  1610. dec(testcurobject);
  1611. consume(RKLAMMER);
  1612. end;
  1613. handle_procvar:=procvardef;
  1614. end;
  1615. var
  1616. hp1,p : pdef;
  1617. aufdef : penumdef;
  1618. aufsym : penumsym;
  1619. ap : parraydef;
  1620. s : stringid;
  1621. l,v,oldaktpackrecords : longint;
  1622. hs : string;
  1623. procedure expr_type;
  1624. var
  1625. pt1,pt2 : ptree;
  1626. begin
  1627. { use of current parsed object ? }
  1628. if (token=ID) and (testcurobject=2) and (curobjectname=pattern) then
  1629. begin
  1630. consume(ID);
  1631. p:=aktobjectdef;
  1632. exit;
  1633. end;
  1634. { we can't accept a equal in type }
  1635. pt1:=comp_expr(not(ignore_equal));
  1636. do_firstpass(pt1);
  1637. if (token=POINTPOINT) then
  1638. begin
  1639. consume(POINTPOINT);
  1640. { get high value of range }
  1641. pt2:=comp_expr(not(ignore_equal));
  1642. do_firstpass(pt2);
  1643. { both must be evaluated to constants now }
  1644. if (pt1^.treetype<>ordconstn) or (pt2^.treetype<>ordconstn) then
  1645. Message(sym_e_error_in_type_def)
  1646. else
  1647. begin
  1648. { check types }
  1649. if not is_equal(pt1^.resulttype,pt2^.resulttype) then
  1650. Message(type_e_mismatch)
  1651. else
  1652. begin
  1653. { Check bounds }
  1654. if pt2^.value<pt1^.value then
  1655. Message(cg_e_upper_lower_than_lower)
  1656. else
  1657. begin
  1658. { All checks passed, create the new def }
  1659. case pt1^.resulttype^.deftype of
  1660. enumdef : p:=new(penumdef,init_subrange(penumdef(pt1^.resulttype),pt1^.value,pt2^.value));
  1661. orddef : begin
  1662. if is_char(pt1^.resulttype) then
  1663. p:=new(porddef,init(uchar,pt1^.value,pt2^.value))
  1664. else
  1665. if is_boolean(pt1^.resulttype) then
  1666. p:=new(porddef,init(bool8bit,pt1^.value,pt2^.value))
  1667. else
  1668. p:=new(porddef,init(uauto,pt1^.value,pt2^.value));
  1669. end;
  1670. end;
  1671. end;
  1672. end;
  1673. end;
  1674. disposetree(pt2);
  1675. end
  1676. else
  1677. begin
  1678. { a simple type renaming }
  1679. if (pt1^.treetype=typen) then
  1680. p:=pt1^.resulttype
  1681. else
  1682. Message(sym_e_error_in_type_def);
  1683. end;
  1684. disposetree(pt1);
  1685. end;
  1686. var
  1687. pt : ptree;
  1688. procedure array_dec;
  1689. var
  1690. lowval,
  1691. highval : longint;
  1692. arraytype : pdef;
  1693. begin
  1694. consume(_ARRAY);
  1695. consume(LECKKLAMMER);
  1696. { defaults }
  1697. arraytype:=generrordef;
  1698. lowval:=$80000000;
  1699. highval:=$7fffffff;
  1700. p:=nil;
  1701. repeat
  1702. { read the expression and check it }
  1703. pt:=expr;
  1704. if pt^.treetype=typen then
  1705. begin
  1706. case pt^.resulttype^.deftype of
  1707. enumdef : begin
  1708. lowval:=penumdef(pt^.resulttype)^.min;
  1709. highval:=penumdef(pt^.resulttype)^.max;
  1710. arraytype:=pt^.resulttype;
  1711. end;
  1712. orddef : begin
  1713. case porddef(pt^.resulttype)^.typ of
  1714. s8bit,u8bit,
  1715. s16bit,u16bit,
  1716. s32bit : begin
  1717. lowval:=porddef(pt^.resulttype)^.low;
  1718. highval:=porddef(pt^.resulttype)^.high;
  1719. arraytype:=pt^.resulttype;
  1720. end;
  1721. bool8bit,
  1722. bool16bit,
  1723. bool32bit : begin
  1724. lowval:=0;
  1725. highval:=1;
  1726. arraytype:=pt^.resulttype;
  1727. end;
  1728. uchar : begin
  1729. lowval:=0;
  1730. highval:=255;
  1731. arraytype:=pt^.resulttype;
  1732. end;
  1733. else
  1734. Message(sym_e_error_in_type_def);
  1735. end;
  1736. end;
  1737. else
  1738. Message(sym_e_error_in_type_def);
  1739. end
  1740. end
  1741. else
  1742. begin
  1743. do_firstpass(pt);
  1744. if (pt^.treetype=rangen) then
  1745. begin
  1746. if (pt^.left^.treetype=ordconstn) and
  1747. (pt^.right^.treetype=ordconstn) then
  1748. begin
  1749. lowval:=pt^.left^.value;
  1750. highval:=pt^.right^.value;
  1751. if highval<lowval then
  1752. begin
  1753. Message(parser_e_array_lower_less_than_upper_bound);
  1754. highval:=lowval;
  1755. end;
  1756. arraytype:=pt^.right^.resulttype;
  1757. end
  1758. else
  1759. Message(type_e_cant_eval_constant_expr);
  1760. end
  1761. else
  1762. Message(sym_e_error_in_type_def)
  1763. end;
  1764. disposetree(pt);
  1765. { create arraydef }
  1766. if p=nil then
  1767. begin
  1768. ap:=new(parraydef,init(lowval,highval,arraytype));
  1769. p:=ap;
  1770. end
  1771. else
  1772. begin
  1773. ap^.definition:=new(parraydef,init(lowval,highval,arraytype));
  1774. ap:=parraydef(ap^.definition);
  1775. end;
  1776. if token=COMMA then
  1777. consume(COMMA)
  1778. else
  1779. break;
  1780. until false;
  1781. consume(RECKKLAMMER);
  1782. consume(_OF);
  1783. hp1:=read_type('');
  1784. { if no error, set element type }
  1785. if assigned(ap) then
  1786. ap^.definition:=hp1;
  1787. end;
  1788. var
  1789. hfp : pforwardpointer;
  1790. begin
  1791. p:=nil;
  1792. case token of
  1793. _STRING,_FILE:
  1794. p:=single_type(hs);
  1795. LKLAMMER:
  1796. begin
  1797. consume(LKLAMMER);
  1798. { allow negativ value_str }
  1799. l:=-1;
  1800. aufsym := Nil;
  1801. aufdef:=new(penumdef,init);
  1802. repeat
  1803. s:=pattern;
  1804. consume(ID);
  1805. if token=ASSIGNMENT then
  1806. begin
  1807. consume(ASSIGNMENT);
  1808. v:=get_intconst;
  1809. { please leave that a note, allows type save }
  1810. { declarations in the win32 units ! }
  1811. if v<=l then
  1812. Message(parser_n_duplicate_enum);
  1813. l:=v;
  1814. end
  1815. else
  1816. inc(l);
  1817. constsymtable^.insert(new(penumsym,init(s,aufdef,l)));
  1818. if token=COMMA then
  1819. consume(COMMA)
  1820. else
  1821. break;
  1822. until false;
  1823. {aufdef^.max:=l;
  1824. if we allow unordered enums
  1825. this can be wrong
  1826. min and max are now set in tenumsym.init PM }
  1827. p:=aufdef;
  1828. consume(RKLAMMER);
  1829. end;
  1830. _ARRAY:
  1831. array_dec;
  1832. _SET:
  1833. begin
  1834. consume(_SET);
  1835. consume(_OF);
  1836. hp1:=read_type('');
  1837. if assigned(hp1) then
  1838. begin
  1839. case hp1^.deftype of
  1840. { don't forget that min can be negativ PM }
  1841. enumdef : if penumdef(hp1)^.min>=0 then
  1842. p:=new(psetdef,init(hp1,penumdef(hp1)^.max))
  1843. else
  1844. Message(sym_e_ill_type_decl_set);
  1845. orddef : begin
  1846. case porddef(hp1)^.typ of
  1847. uchar : p:=new(psetdef,init(hp1,255));
  1848. u8bit,s8bit,u16bit,s16bit,s32bit :
  1849. begin
  1850. if (porddef(hp1)^.low>=0) then
  1851. p:=new(psetdef,init(hp1,porddef(hp1)^.high))
  1852. else Message(sym_e_ill_type_decl_set);
  1853. end;
  1854. else Message(sym_e_ill_type_decl_set);
  1855. end;
  1856. end;
  1857. else Message(sym_e_ill_type_decl_set);
  1858. end;
  1859. end
  1860. else
  1861. p:=generrordef;
  1862. end;
  1863. CARET:
  1864. begin
  1865. consume(CARET);
  1866. { forwards allowed only inside TYPE statements }
  1867. if typecanbeforward then
  1868. forwardsallowed:=true;
  1869. hp1:=single_type(hs);
  1870. p:=new(ppointerdef,init(hp1));
  1871. {I add big troubles here
  1872. with var p : ^byte in graph.putimage
  1873. because a save_forward was called and
  1874. no resolve forward
  1875. => so the definition was rewritten after
  1876. having been disposed !!
  1877. Strange problems appeared !!!!}
  1878. {Anyhow forwards should only be allowed
  1879. inside a type statement ??
  1880. don't you think so }
  1881. if (lasttypesym<>nil) and ((lasttypesym^.properties and sp_forwarddef)<>0) then
  1882. begin
  1883. new(hfp);
  1884. hfp^.next:=lasttypesym^.forwardpointer;
  1885. hfp^.def:=ppointerdef(p);
  1886. lasttypesym^.forwardpointer:=hfp;
  1887. end;
  1888. forwardsallowed:=false;
  1889. end;
  1890. _RECORD:
  1891. p:=record_dec;
  1892. _PACKED:
  1893. begin
  1894. consume(_PACKED);
  1895. if token=_ARRAY then
  1896. array_dec
  1897. else
  1898. begin
  1899. oldaktpackrecords:=aktpackrecords;
  1900. aktpackrecords:=1;
  1901. if token in [_CLASS,_OBJECT] then
  1902. p:=object_dec(name,nil)
  1903. else
  1904. p:=record_dec;
  1905. aktpackrecords:=oldaktpackrecords;
  1906. end;
  1907. end;
  1908. _CLASS,
  1909. _OBJECT:
  1910. p:=object_dec(name,nil);
  1911. _PROCEDURE:
  1912. begin
  1913. consume(_PROCEDURE);
  1914. p:=handle_procvar;
  1915. if token=_OF then
  1916. begin
  1917. consume(_OF);
  1918. consume(_OBJECT);
  1919. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1920. end;
  1921. end;
  1922. _FUNCTION:
  1923. begin
  1924. consume(_FUNCTION);
  1925. p:=handle_procvar;
  1926. consume(COLON);
  1927. pprocvardef(p)^.retdef:=single_type(hs);
  1928. if token=_OF then
  1929. begin
  1930. consume(_OF);
  1931. consume(_OBJECT);
  1932. pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
  1933. end;
  1934. end;
  1935. else
  1936. expr_type;
  1937. end;
  1938. if p=nil then
  1939. p:=generrordef;
  1940. read_type:=p;
  1941. end;
  1942. { reads a type declaration to the symbol table }
  1943. procedure type_dec;
  1944. var
  1945. typename : stringid;
  1946. newtype : ptypesym;
  1947. {$ifdef dummy}
  1948. olddef,newdef : pdef;
  1949. s : string;
  1950. {$endif dummy}
  1951. begin
  1952. block_type:=bt_type;
  1953. consume(_TYPE);
  1954. typecanbeforward:=true;
  1955. repeat
  1956. typename:=pattern;
  1957. consume(ID);
  1958. consume(EQUAL);
  1959. { here you loose the strictness of pascal
  1960. for which a redefinition like
  1961. childtype = parenttype;
  1962. child2type = parenttype;
  1963. does not make the two child types equal !!
  1964. here all vars from childtype and child2type
  1965. get the definition of parenttype !! }
  1966. {$ifdef testequaltype}
  1967. if (token = ID) or (token=_FILE) or (token=_STRING) then
  1968. begin
  1969. olddef := single_type(s);
  1970. { make a clone of olddef }
  1971. { is that ok ??? }
  1972. getmem(newdef,SizeOf(olddef));
  1973. move(olddef^,newdef^,SizeOf(olddef));
  1974. newtype:=new(ptypesym,init(typename,newdef));
  1975. symtablestack^.insert(newtype);
  1976. end
  1977. else
  1978. {$endif testequaltype}
  1979. begin
  1980. getsym(typename,false);
  1981. { check if it is the definition of a forward defined class }
  1982. if assigned(srsym) and (token=_CLASS) and
  1983. (srsym^.typ=typesym) and
  1984. (assigned(ptypesym(srsym)^.definition)) and
  1985. (ptypesym(srsym)^.definition^.deftype=objectdef) and
  1986. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_isforward)<>0) and
  1987. ((pobjectdef(ptypesym(srsym)^.definition)^.options and oo_is_class)<>0) then
  1988. begin
  1989. { we can ignore the result }
  1990. { the definition is modified }
  1991. object_dec(typename,pobjectdef(ptypesym(srsym)^.definition));
  1992. newtype:=ptypesym(srsym);
  1993. end
  1994. else
  1995. begin
  1996. newtype:=new(ptypesym,init(typename,read_type(typename)));
  1997. { load newtype with the new pointer to the inserted type
  1998. because it can be an already defined forwarded type !! }
  1999. newtype:=ptypesym(symtablestack^.insert(newtype));
  2000. end;
  2001. end;
  2002. consume(SEMICOLON);
  2003. if assigned(newtype^.definition) and (newtype^.definition^.deftype=procvardef) then
  2004. parse_var_proc_directives(newtype);
  2005. until token<>ID;
  2006. typecanbeforward:=false;
  2007. {$ifdef tp}
  2008. symtablestack^.foreach(testforward_type);
  2009. {$else}
  2010. symtablestack^.foreach(@testforward_type);
  2011. {$endif}
  2012. resolve_forwards;
  2013. block_type:=bt_general;
  2014. end;
  2015. procedure var_dec;
  2016. { parses varaible declarations and inserts them in }
  2017. { the top symbol table of symtablestack }
  2018. begin
  2019. consume(_VAR);
  2020. read_var_decs(false,false);
  2021. end;
  2022. procedure Not_supported_for_inline(t : ttoken);
  2023. begin
  2024. if assigned(aktprocsym) and
  2025. ((aktprocsym^.definition^.options and poinline)<>0) then
  2026. Begin
  2027. Message1(parser_w_not_supported_for_inline,tokenstring(t));
  2028. Message(parser_w_inlining_disabled);
  2029. aktprocsym^.definition^.options:= aktprocsym^.definition^.options and not poinline;
  2030. End;
  2031. end;
  2032. procedure read_declarations(islibrary : boolean);
  2033. begin
  2034. repeat
  2035. case token of
  2036. _LABEL:
  2037. begin
  2038. Not_supported_for_inline(token);
  2039. label_dec;
  2040. end;
  2041. _CONST:
  2042. begin
  2043. Not_supported_for_inline(token);
  2044. const_dec;
  2045. end;
  2046. _TYPE:
  2047. begin
  2048. Not_supported_for_inline(token);
  2049. type_dec;
  2050. end;
  2051. _VAR:
  2052. var_dec;
  2053. _CONSTRUCTOR,_DESTRUCTOR,
  2054. _FUNCTION,_PROCEDURE,_OPERATOR,_CLASS:
  2055. begin
  2056. Not_supported_for_inline(token);
  2057. read_proc;
  2058. end;
  2059. _EXPORTS:
  2060. begin
  2061. Not_supported_for_inline(token);
  2062. { here we should be at lexlevel 1, no ? PM }
  2063. if (lexlevel<>main_program_level) or
  2064. (not islibrary and not DLLsource) then
  2065. begin
  2066. Message(parser_e_syntax_error);
  2067. consume_all_until(SEMICOLON);
  2068. end
  2069. else if islibrary then
  2070. read_exports;
  2071. end
  2072. else break;
  2073. end;
  2074. until false;
  2075. end;
  2076. procedure read_interface_declarations;
  2077. begin
  2078. {Since the body is now parsed at lexlevel 1, and the declarations
  2079. must be parsed at the same lexlevel we increase the lexlevel.}
  2080. inc(lexlevel);
  2081. repeat
  2082. case token of
  2083. _CONST : const_dec;
  2084. _TYPE : type_dec;
  2085. _VAR : var_dec;
  2086. _FUNCTION,
  2087. _PROCEDURE,
  2088. _OPERATOR : read_proc;
  2089. else
  2090. break;
  2091. end;
  2092. until false;
  2093. dec(lexlevel);
  2094. end;
  2095. end.
  2096. {
  2097. $Log$
  2098. Revision 1.102 1999-03-05 01:14:26 pierre
  2099. * bug0198 : call conventions for methods
  2100. not yet implemented is the control of same calling convention
  2101. for virtual and child's virtual
  2102. * msgstr and msgint only created if message was found
  2103. who implemented this by the way ?
  2104. it leaks lots of plabels !!!! (check with heaptrc !)
  2105. Revision 1.101 1999/02/25 21:02:41 peter
  2106. * ag386bin updates
  2107. + coff writer
  2108. Revision 1.100 1999/02/24 00:59:14 peter
  2109. * small updates for ag386bin
  2110. Revision 1.99 1999/02/22 23:33:29 florian
  2111. + message directive for integers added
  2112. Revision 1.98 1999/02/22 20:13:36 florian
  2113. + first implementation of message keyword
  2114. Revision 1.97 1999/02/22 02:44:10 peter
  2115. * ag386bin doesn't use i386.pas anymore
  2116. Revision 1.96 1999/02/17 14:20:40 pierre
  2117. * Reference specific bug in recompiling unit solved
  2118. Revision 1.95 1999/01/25 20:13:48 peter
  2119. * fixed crash with forward declared class of ...
  2120. Revision 1.94 1999/01/19 12:17:00 peter
  2121. * fixed constant strings > 255 chars
  2122. Revision 1.93 1999/01/15 13:08:23 peter
  2123. * error if upper<lower in array decl
  2124. Revision 1.92 1999/01/14 21:49:58 peter
  2125. * fixed forwardpointer problem with multiple forwards for the same
  2126. typesym. It now uses a linkedlist instead of a single pointer
  2127. Revision 1.91 1998/12/30 22:15:46 peter
  2128. + farpointer type
  2129. * absolutesym now also stores if its far
  2130. Revision 1.90 1998/12/15 17:16:00 peter
  2131. * fixed const s : ^string
  2132. * first things for const pchar : @string[1]
  2133. Revision 1.89 1998/12/11 00:03:30 peter
  2134. + globtype,tokens,version unit splitted from globals
  2135. Revision 1.88 1998/11/30 09:43:20 pierre
  2136. * some range check bugs fixed (still not working !)
  2137. + added DLL writing support for win32 (also accepts variables)
  2138. + TempAnsi for code that could be used for Temporary ansi strings
  2139. handling
  2140. Revision 1.87 1998/11/29 12:42:24 peter
  2141. * check for constants with array decl
  2142. Revision 1.86 1998/11/28 16:20:52 peter
  2143. + support for dll variables
  2144. Revision 1.85 1998/11/27 14:34:43 peter
  2145. * give error when string[0] decl is found
  2146. Revision 1.84 1998/11/17 10:40:15 peter
  2147. * H+ fixes
  2148. Revision 1.83 1998/11/16 11:28:59 pierre
  2149. * stackcheck removed for i386_win32
  2150. * exportlist does not crash at least !!
  2151. (was need for tests dir !)z
  2152. Revision 1.82 1998/11/16 10:18:07 peter
  2153. * fixes for ansistrings
  2154. Revision 1.81 1998/11/13 15:40:22 pierre
  2155. + added -Se in Makefile cvstest target
  2156. + lexlevel cleanup
  2157. normal_function_level main_program_level and unit_init_level defined
  2158. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  2159. (test added in code !)
  2160. * -Un option was wrong
  2161. * _FAIL and _SELF only keyword inside
  2162. constructors and methods respectively
  2163. Revision 1.80 1998/11/13 10:18:09 peter
  2164. + nil constants
  2165. Revision 1.79 1998/11/05 12:02:51 peter
  2166. * released useansistring
  2167. * removed -Sv, its now available in fpc modes
  2168. Revision 1.78 1998/10/27 13:45:33 pierre
  2169. * classes get a vmt allways
  2170. * better error info (tried to remove
  2171. several error strings introduced by the tpexcept handling)
  2172. Revision 1.77 1998/10/26 22:58:20 florian
  2173. * new introduded problem with classes fix, the parent class wasn't set
  2174. correct, if the class was defined forward before
  2175. Revision 1.76 1998/10/25 23:31:18 peter
  2176. * procvar parsing updated just like psub.pas routine
  2177. Revision 1.75 1998/10/21 08:39:59 florian
  2178. + ansistring operator +
  2179. + $h and string[n] for n>255 added
  2180. * small problem with TP fixed
  2181. Revision 1.74 1998/10/20 13:09:13 peter
  2182. * fixed object(unknown) crash
  2183. Revision 1.73 1998/10/19 08:54:56 pierre
  2184. * wrong stabs info corrected once again !!
  2185. + variable vmt offset with vmt field only if required
  2186. implemented now !!!
  2187. Revision 1.72 1998/10/16 13:12:51 pierre
  2188. * added vmt_offsets in destructors code also !!!
  2189. * vmt_offset code for m68k
  2190. Revision 1.71 1998/10/15 15:13:25 pierre
  2191. + added oo_hasconstructor and oo_hasdestructor
  2192. for objects options
  2193. Revision 1.70 1998/10/13 13:10:22 peter
  2194. * new style for m68k/i386 infos and enums
  2195. Revision 1.69 1998/10/09 12:07:49 pierre
  2196. * typo error for propertyparas dispose corrected
  2197. Revision 1.68 1998/10/09 11:47:54 pierre
  2198. * still more memory leaks fixes !!
  2199. Revision 1.67 1998/10/08 13:48:46 peter
  2200. * fixed memory leaks for do nothing source
  2201. * fixed unit interdependency
  2202. Revision 1.66 1998/10/06 20:43:31 peter
  2203. * fixed set of bugs. like set of false..true set of #1..#255 and
  2204. set of #1..true which was allowed
  2205. Revision 1.65 1998/10/05 22:43:35 peter
  2206. * commited the wrong file :(
  2207. Revision 1.64 1998/10/05 21:33:24 peter
  2208. * fixed 161,165,166,167,168
  2209. Revision 1.63 1998/10/05 13:57:13 peter
  2210. * crash preventions
  2211. Revision 1.62 1998/10/02 17:06:02 peter
  2212. * better error message for unresolved forward types
  2213. Revision 1.61 1998/10/02 09:23:24 peter
  2214. * fixed error msg with type l=<var>
  2215. * block_type bt_const is now set in read_const_dec
  2216. Revision 1.60 1998/09/30 07:40:33 florian
  2217. * better error recovering
  2218. Revision 1.59 1998/09/26 17:45:33 peter
  2219. + idtoken and only one token table
  2220. Revision 1.58 1998/09/25 00:04:01 florian
  2221. * problems when calling class methods fixed
  2222. Revision 1.57 1998/09/24 23:49:09 peter
  2223. + aktmodeswitches
  2224. Revision 1.56 1998/09/23 15:39:09 pierre
  2225. * browser bugfixes
  2226. was adding a reference when looking for the symbol
  2227. if -bSYM_NAME was used
  2228. Revision 1.55 1998/09/21 13:24:44 daniel
  2229. * Memory leak fixed.
  2230. Revision 1.54 1998/09/17 13:41:16 pierre
  2231. sizeof(TPOINT) problem
  2232. Revision 1.53.2.1 1998/09/17 13:12:09 pierre
  2233. * virtual destructor did not set oo_hasvirtual
  2234. (detected with the sizeof(TPoint) problem
  2235. * genloadcallnode was missing
  2236. Revision 1.53 1998/09/09 11:50:52 pierre
  2237. * forward def are not put in record or objects
  2238. + added check for forwards also in record and objects
  2239. * dummy parasymtable for unit initialization removed from
  2240. symtable stack
  2241. Revision 1.52 1998/09/07 23:10:22 florian
  2242. * a lot of stuff fixed regarding rtti and publishing of properties,
  2243. basics should now work
  2244. Revision 1.51 1998/09/07 19:33:22 florian
  2245. + some stuff for property rtti added:
  2246. - NameIndex of the TPropInfo record is now written correctly
  2247. - the DEFAULT/NODEFAULT keyword is supported now
  2248. - the default value and the storedsym/def are now written to
  2249. the PPU fiel
  2250. Revision 1.50 1998/09/07 18:46:08 peter
  2251. * update smartlinking, uses getdatalabel
  2252. * renamed ptree.value vars to value_str,value_real,value_set
  2253. Revision 1.49 1998/09/07 17:37:00 florian
  2254. * first fixes for published properties
  2255. Revision 1.48 1998/09/04 08:42:02 peter
  2256. * updated some error messages
  2257. Revision 1.47 1998/09/03 16:03:18 florian
  2258. + rtti generation
  2259. * init table generation changed
  2260. Revision 1.46 1998/09/01 17:39:48 peter
  2261. + internal constant functions
  2262. Revision 1.45 1998/08/31 12:20:28 peter
  2263. * fixed array_dec when unknown type was used
  2264. Revision 1.44 1998/08/28 10:57:01 peter
  2265. * removed warnings
  2266. Revision 1.43 1998/08/25 13:09:25 pierre
  2267. * corrected mangling sheme :
  2268. cvar add Cprefix to the mixed case name whereas
  2269. export or public use direct name
  2270. Revision 1.42 1998/08/25 12:42:41 pierre
  2271. * CDECL changed to CVAR for variables
  2272. specifications are read in structures also
  2273. + started adding GPC compatibility mode ( option -Sp)
  2274. * names changed to lowercase
  2275. Revision 1.41 1998/08/23 21:04:36 florian
  2276. + rtti generation for classes added
  2277. + new/dispose do now also a call to INITIALIZE/FINALIZE, if necessaray
  2278. Revision 1.40 1998/08/21 15:48:58 pierre
  2279. * more cdecl chagnes
  2280. - better line info
  2281. - changes the definition options of a procvar
  2282. if it is a unnamed type
  2283. Revision 1.39 1998/08/19 00:42:40 peter
  2284. + subrange types for enums
  2285. + checking for bounds type with ranges
  2286. Revision 1.38 1998/08/12 19:20:39 peter
  2287. + public is the same as export for c_vars
  2288. * a exported/public c_var incs now the refcount
  2289. Revision 1.37 1998/08/11 15:31:38 peter
  2290. * write extended to ppu file
  2291. * new version 0.99.7
  2292. Revision 1.36 1998/08/10 14:50:09 peter
  2293. + localswitches, moduleswitches, globalswitches splitting
  2294. Revision 1.35 1998/07/26 21:59:00 florian
  2295. + better support for switch $H
  2296. + index access to ansi strings added
  2297. + assigment of data (records/arrays) containing ansi strings
  2298. Revision 1.34 1998/07/20 22:17:15 florian
  2299. * hex constants in numeric char (#$54#$43 ...) are now allowed
  2300. * there was a bug in record_var_dec which prevents the used
  2301. of nested variant records (for example drivers.tevent of tv)
  2302. Revision 1.33 1998/07/18 17:11:11 florian
  2303. + ansi string constants fixed
  2304. + switch $H partial implemented
  2305. Revision 1.32 1998/07/14 21:46:50 peter
  2306. * updated messages file
  2307. Revision 1.31 1998/07/14 14:46:53 peter
  2308. * released NEWINPUT
  2309. Revision 1.30 1998/07/10 00:00:00 peter
  2310. * fixed ttypesym bug finally
  2311. * fileinfo in the symtable and better using for unused vars
  2312. Revision 1.29 1998/06/25 14:04:21 peter
  2313. + internal inc/dec
  2314. Revision 1.28 1998/06/24 12:26:45 peter
  2315. * stricter var parsing like tp7 and some optimizes with directive
  2316. parsing
  2317. Revision 1.27 1998/06/12 16:15:34 pierre
  2318. * external name 'C_var';
  2319. export name 'intern_C_var';
  2320. cdecl;
  2321. cdecl;external;
  2322. are now supported only with -Sv switch
  2323. Revision 1.25 1998/06/09 16:01:45 pierre
  2324. + added procedure directive parsing for procvars
  2325. (accepted are popstack cdecl and pascal)
  2326. + added C vars with the following syntax
  2327. var C calias 'true_c_name';(can be followed by external)
  2328. reason is that you must add the Cprefix
  2329. which is target dependent
  2330. Revision 1.24 1998/06/05 14:37:32 pierre
  2331. * fixes for inline for operators
  2332. * inline procedure more correctly restricted
  2333. Revision 1.23 1998/06/04 23:51:50 peter
  2334. * m68k compiles
  2335. + .def file creation moved to gendef.pas so it could also be used
  2336. for win32
  2337. Revision 1.22 1998/06/03 22:48:59 peter
  2338. + wordbool,longbool
  2339. * rename bis,von -> high,low
  2340. * moved some systemunit loading/creating to psystem.pas
  2341. Revision 1.21 1998/06/03 22:14:19 florian
  2342. * problem with sizes of classes fixed (if the anchestor was declared
  2343. forward, the compiler doesn't update the child classes size)
  2344. Revision 1.20 1998/05/28 14:35:54 peter
  2345. * nicer error message when no id is used after var
  2346. Revision 1.19 1998/05/23 01:21:19 peter
  2347. + aktasmmode, aktoptprocessor, aktoutputformat
  2348. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2349. + $LIBNAME to set the library name where the unit will be put in
  2350. * splitted cgi386 a bit (codeseg to large for bp7)
  2351. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2352. Revision 1.18 1998/05/20 09:42:35 pierre
  2353. + UseTokenInfo now default
  2354. * unit in interface uses and implementation uses gives error now
  2355. * only one error for unknown symbol (uses lastsymknown boolean)
  2356. the problem came from the label code !
  2357. + first inlined procedures and function work
  2358. (warning there might be allowed cases were the result is still wrong !!)
  2359. * UseBrower updated gives a global list of all position of all used symbols
  2360. with switch -gb
  2361. Revision 1.17 1998/05/11 13:07:55 peter
  2362. + $ifdef NEWPPU for the new ppuformat
  2363. + $define GDB not longer required
  2364. * removed all warnings and stripped some log comments
  2365. * no findfirst/findnext anymore to remove smartlink *.o files
  2366. Revision 1.16 1998/05/05 12:05:42 florian
  2367. * problems with properties fixed
  2368. * crash fixed: i:=l when i and l are undefined, was a problem with
  2369. implementation of private/protected
  2370. Revision 1.15 1998/05/01 09:01:23 florian
  2371. + correct semantics of private and protected
  2372. * small fix in variable scope:
  2373. a id can be used in a parameter list of a method, even it is used in
  2374. an anchestor class as field id
  2375. Revision 1.14 1998/05/01 07:43:56 florian
  2376. + basics for rtti implemented
  2377. + switch $m (generate rtti for published sections)
  2378. Revision 1.13 1998/04/30 15:59:41 pierre
  2379. * GDB works again better :
  2380. correct type info in one pass
  2381. + UseTokenInfo for better source position
  2382. * fixed one remaining bug in scanner for line counts
  2383. * several little fixes
  2384. Revision 1.12 1998/04/29 10:33:57 pierre
  2385. + added some code for ansistring (not complete nor working yet)
  2386. * corrected operator overloading
  2387. * corrected nasm output
  2388. + started inline procedures
  2389. + added starstarn : use ** for exponentiation (^ gave problems)
  2390. + started UseTokenInfo cond to get accurate positions
  2391. Revision 1.11 1998/04/28 11:45:52 florian
  2392. * make it compilable with TP
  2393. + small COM problems solved to compile classes.pp
  2394. Revision 1.10 1998/04/27 23:10:28 peter
  2395. + new scanner
  2396. * $makelib -> if smartlink
  2397. * small filename fixes pmodule.setfilename
  2398. * moved import from files.pas -> import.pas
  2399. Revision 1.9 1998/04/10 21:36:56 florian
  2400. + some stuff to support method pointers (procedure of object) added
  2401. (declaration, parameter handling)
  2402. Revision 1.8 1998/04/10 15:39:48 florian
  2403. * more fixes to get classes.pas compiled
  2404. Revision 1.7 1998/04/09 23:02:15 florian
  2405. * small problems solved to get remake3 work
  2406. Revision 1.6 1998/04/09 22:16:35 florian
  2407. * problem with previous REGALLOC solved
  2408. * improved property support
  2409. Revision 1.5 1998/04/08 14:59:20 florian
  2410. * problem with new expr_type solved
  2411. Revision 1.4 1998/04/08 10:26:09 florian
  2412. * correct error handling of virtual constructors
  2413. * problem with new type declaration handling fixed
  2414. Revision 1.3 1998/04/07 22:45:05 florian
  2415. * bug0092, bug0115 and bug0121 fixed
  2416. + packed object/class/array
  2417. Revision 1.2 1998/04/05 13:58:35 peter
  2418. * fixed the -Ss bug
  2419. + warning for Virtual constructors
  2420. * helppages updated with -TGO32V1
  2421. }