pdecl.pas 76 KB

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