pdecl.pas 77 KB

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