pdecl.pas 98 KB

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