parser.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit does the parsing process
  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 parser;
  19. {$i fpcdefs.inc}
  20. interface
  21. {$ifdef PREPROCWRITE}
  22. procedure preprocess(const filename:string);
  23. {$endif PREPROCWRITE}
  24. procedure compile(const filename:string);
  25. procedure initparser;
  26. procedure doneparser;
  27. implementation
  28. uses
  29. cutils,cclasses,
  30. globtype,version,tokens,systems,globals,verbose,
  31. symbase,symtable,symsym,
  32. finput,fmodule,fppu,
  33. aasmbase,aasmtai,
  34. cgbase,
  35. script,gendef,
  36. {$ifdef BrowserLog}
  37. browlog,
  38. {$endif BrowserLog}
  39. {$ifdef UseExcept}
  40. tpexcept,
  41. {$endif UseExcept}
  42. {$ifdef GDB}
  43. gdb,
  44. {$endif GDB}
  45. comphook,
  46. scanner,scandir,
  47. pbase,ptype,psystem,pmodules,psub,
  48. cresstr,cpuinfo,procinfo;
  49. procedure initparser;
  50. begin
  51. { ^M means a string or a char, because we don't parse a }
  52. { type declaration }
  53. ignore_equal:=false;
  54. { we didn't parse a object or class declaration }
  55. { and no function header }
  56. testcurobject:=0;
  57. { Current compiled module/proc }
  58. objectlibrary:=nil;
  59. current_module:=nil;
  60. compiled_module:=nil;
  61. current_procinfo:=nil;
  62. loaded_units:=TLinkedList.Create;
  63. usedunits:=TLinkedList.Create;
  64. { global switches }
  65. aktglobalswitches:=initglobalswitches;
  66. aktsourcecodepage:=initsourcecodepage;
  67. { initialize scanner }
  68. InitScanner;
  69. InitScannerDirectives;
  70. { scanner }
  71. c:=#0;
  72. pattern:='';
  73. orgpattern:='';
  74. current_scanner:=nil;
  75. { register all nodes and tais }
  76. registernodes;
  77. registertais;
  78. { memory sizes }
  79. if heapsize=0 then
  80. heapsize:=target_info.heapsize;
  81. if stacksize=0 then
  82. stacksize:=target_info.stacksize;
  83. { open assembler response }
  84. if cs_link_on_target in aktglobalswitches then
  85. GenerateAsmRes(outputexedir+inputfile+'_ppas')
  86. else
  87. GenerateAsmRes(outputexedir+'ppas');
  88. { open deffile }
  89. DefFile:=TDefFile.Create(outputexedir+inputfile+target_info.defext);
  90. { list of generated .o files, so the linker can remove them }
  91. SmartLinkOFiles:=TStringList.Create;
  92. { codegen }
  93. if paraprintnodetree<>0 then
  94. printnode_reset;
  95. end;
  96. procedure doneparser;
  97. begin
  98. { unload units }
  99. loaded_units.free;
  100. usedunits.free;
  101. { if there was an error in the scanner, the scanner is
  102. still assinged }
  103. if assigned(current_scanner) then
  104. begin
  105. current_scanner.free;
  106. current_scanner:=nil;
  107. end;
  108. { close scanner }
  109. DoneScanner;
  110. { close ppas,deffile }
  111. asmres.free;
  112. deffile.free;
  113. { free list of .o files }
  114. SmartLinkOFiles.Free;
  115. end;
  116. procedure default_macros;
  117. var
  118. hp : tstringlistitem;
  119. begin
  120. { commandline }
  121. hp:=tstringlistitem(initdefines.first);
  122. while assigned(hp) do
  123. begin
  124. current_scanner.def_macro(hp.str);
  125. hp:=tstringlistitem(hp.next);
  126. end;
  127. { set macros for version checking }
  128. current_scanner.set_macro('FPC_VERSION',version_nr);
  129. current_scanner.set_macro('FPC_RELEASE',release_nr);
  130. current_scanner.set_macro('FPC_PATCH',patch_nr);
  131. end;
  132. {$ifdef PREPROCWRITE}
  133. procedure preprocess(const filename:string);
  134. var
  135. i : longint;
  136. begin
  137. new(preprocfile,init('pre'));
  138. { default macros }
  139. current_scanner^.macros:=new(pdictionary,init);
  140. default_macros;
  141. { initialize a module }
  142. current_module:=new(pmodule,init(filename,false));
  143. main_module:=current_module;
  144. { startup scanner, and save in current_module }
  145. current_scanner:=new(pscannerfile,Init(filename));
  146. current_module.scanner:=current_scanner;
  147. { loop until EOF is found }
  148. repeat
  149. current_scanner^.readtoken;
  150. preprocfile^.AddSpace;
  151. case token of
  152. _ID :
  153. begin
  154. preprocfile^.Add(orgpattern);
  155. end;
  156. _REALNUMBER,
  157. _INTCONST :
  158. preprocfile^.Add(pattern);
  159. _CSTRING :
  160. begin
  161. i:=0;
  162. while (i<length(pattern)) do
  163. begin
  164. inc(i);
  165. if pattern[i]='''' then
  166. begin
  167. insert('''',pattern,i);
  168. inc(i);
  169. end;
  170. end;
  171. preprocfile^.Add(''''+pattern+'''');
  172. end;
  173. _CCHAR :
  174. begin
  175. case pattern[1] of
  176. #39 :
  177. pattern:='''''''';
  178. #0..#31,
  179. #128..#255 :
  180. begin
  181. str(ord(pattern[1]),pattern);
  182. pattern:='#'+pattern;
  183. end;
  184. else
  185. pattern:=''''+pattern[1]+'''';
  186. end;
  187. preprocfile^.Add(pattern);
  188. end;
  189. _EOF :
  190. break;
  191. else
  192. preprocfile^.Add(tokeninfo^[token].str)
  193. end;
  194. until false;
  195. { free scanner }
  196. dispose(current_scanner,done);
  197. current_scanner:=nil;
  198. { close }
  199. dispose(preprocfile,done);
  200. end;
  201. {$endif PREPROCWRITE}
  202. {*****************************************************************************
  203. Create information for a new module
  204. *****************************************************************************}
  205. procedure init_module;
  206. begin
  207. { Create assembler output lists for CG }
  208. exprasmlist:=taasmoutput.create;
  209. datasegment:=taasmoutput.create;
  210. codesegment:=taasmoutput.create;
  211. bsssegment:=taasmoutput.create;
  212. debuglist:=taasmoutput.create;
  213. withdebuglist:=taasmoutput.create;
  214. consts:=taasmoutput.create;
  215. rttilist:=taasmoutput.create;
  216. picdata:=taasmoutput.create;
  217. if target_info.system=system_powerpc_darwin then
  218. picdata.concat(tai_simple.create(ait_non_lazy_symbol_pointer));
  219. ResourceStringList:=Nil;
  220. importssection:=nil;
  221. exportssection:=nil;
  222. resourcesection:=nil;
  223. { Resource strings }
  224. ResourceStrings:=TResourceStrings.Create;
  225. { use the librarydata from current_module }
  226. objectlibrary:=current_module.librarydata;
  227. end;
  228. procedure done_module;
  229. {$ifdef MEMDEBUG}
  230. var
  231. d : tmemdebug;
  232. {$endif}
  233. begin
  234. {$ifdef MEMDEBUG}
  235. d:=tmemdebug.create(current_module.modulename^+' - asmlists');
  236. {$endif}
  237. exprasmlist.free;
  238. codesegment.free;
  239. bsssegment.free;
  240. datasegment.free;
  241. debuglist.free;
  242. withdebuglist.free;
  243. consts.free;
  244. rttilist.free;
  245. picdata.free;
  246. if assigned(ResourceStringList) then
  247. ResourceStringList.free;
  248. if assigned(importssection) then
  249. importssection.free;
  250. if assigned(exportssection) then
  251. exportssection.free;
  252. if assigned(resourcesection) then
  253. resourcesection.free;
  254. {$ifdef MEMDEBUG}
  255. d.free;
  256. {$endif}
  257. { resource strings }
  258. ResourceStrings.free;
  259. objectlibrary:=nil;
  260. end;
  261. {*****************************************************************************
  262. Compile a source file
  263. *****************************************************************************}
  264. procedure compile(const filename:string);
  265. type
  266. polddata=^tolddata;
  267. tolddata=record
  268. { scanner }
  269. oldidtoken,
  270. oldtoken : ttoken;
  271. oldtokenpos : tfileposinfo;
  272. oldc : char;
  273. oldpattern,
  274. oldorgpattern : string;
  275. old_block_type : tblock_type;
  276. { symtable }
  277. oldrefsymtable,
  278. olddefaultsymtablestack,
  279. oldsymtablestack : tsymtable;
  280. oldaktprocsym : tprocsym;
  281. { cg }
  282. oldparse_only : boolean;
  283. { asmlists }
  284. oldimports,
  285. oldexports,
  286. oldresource,
  287. oldrttilist,
  288. oldpicdata,
  289. oldresourcestringlist,
  290. oldbsssegment,
  291. olddatasegment,
  292. oldcodesegment,
  293. oldexprasmlist,
  294. olddebuglist,
  295. oldwithdebuglist,
  296. oldconsts : taasmoutput;
  297. oldobjectlibrary : tasmlibrarydata;
  298. { resourcestrings }
  299. OldResourceStrings : tResourceStrings;
  300. { akt.. things }
  301. oldaktlocalswitches : tlocalswitches;
  302. oldaktmoduleswitches : tmoduleswitches;
  303. oldaktfilepos : tfileposinfo;
  304. oldaktpackrecords,
  305. oldaktpackenum,oldaktmaxfpuregisters : longint;
  306. oldaktalignment : talignmentinfo;
  307. oldaktoutputformat : tasm;
  308. oldaktspecificoptprocessor,
  309. oldaktoptprocessor : tprocessors;
  310. oldaktfputype : tfputype;
  311. oldaktasmmode : tasmmode;
  312. oldaktinterfacetype: tinterfacetypes;
  313. oldaktmodeswitches : tmodeswitches;
  314. old_compiled_module : tmodule;
  315. oldcurrent_procinfo : tprocinfo;
  316. oldaktdefproccall : tproccalloption;
  317. oldsourcecodepage : tcodepagestring;
  318. {$ifdef GDB}
  319. store_dbx : plongint;
  320. {$endif GDB}
  321. end;
  322. var
  323. olddata : polddata;
  324. {$ifdef USEEXCEPT}
  325. {$ifndef Delphi}
  326. recoverpos : jmp_buf;
  327. oldrecoverpos : pjmp_buf;
  328. {$endif Delphi}
  329. {$endif useexcept}
  330. begin
  331. inc(compile_level);
  332. parser_current_file:=filename;
  333. { Uses heap memory instead of placing everything on the
  334. stack. This is needed because compile() can be called
  335. recursively }
  336. new(olddata);
  337. with olddata^ do
  338. begin
  339. old_compiled_module:=compiled_module;
  340. { save symtable state }
  341. oldsymtablestack:=symtablestack;
  342. olddefaultsymtablestack:=defaultsymtablestack;
  343. oldrefsymtable:=refsymtable;
  344. oldcurrent_procinfo:=current_procinfo;
  345. oldaktdefproccall:=aktdefproccall;
  346. { save scanner state }
  347. oldc:=c;
  348. oldpattern:=pattern;
  349. oldorgpattern:=orgpattern;
  350. oldtoken:=token;
  351. oldidtoken:=idtoken;
  352. old_block_type:=block_type;
  353. oldtokenpos:=akttokenpos;
  354. oldsourcecodepage:=aktsourcecodepage;
  355. { save cg }
  356. oldparse_only:=parse_only;
  357. { save assembler lists }
  358. olddatasegment:=datasegment;
  359. oldbsssegment:=bsssegment;
  360. oldcodesegment:=codesegment;
  361. olddebuglist:=debuglist;
  362. oldwithdebuglist:=withdebuglist;
  363. oldconsts:=consts;
  364. oldrttilist:=rttilist;
  365. oldpicdata:=picdata;
  366. oldexprasmlist:=exprasmlist;
  367. oldimports:=importssection;
  368. oldexports:=exportssection;
  369. oldresource:=resourcesection;
  370. oldresourcestringlist:=resourcestringlist;
  371. oldobjectlibrary:=objectlibrary;
  372. OldResourceStrings:=ResourceStrings;
  373. { save akt... state }
  374. { handle the postponed case first }
  375. if localswitcheschanged then
  376. begin
  377. aktlocalswitches:=nextaktlocalswitches;
  378. localswitcheschanged:=false;
  379. end;
  380. oldaktlocalswitches:=aktlocalswitches;
  381. oldaktmoduleswitches:=aktmoduleswitches;
  382. oldaktalignment:=aktalignment;
  383. oldaktpackenum:=aktpackenum;
  384. oldaktpackrecords:=aktpackrecords;
  385. oldaktfputype:=aktfputype;
  386. oldaktmaxfpuregisters:=aktmaxfpuregisters;
  387. oldaktoutputformat:=aktoutputformat;
  388. oldaktoptprocessor:=aktoptprocessor;
  389. oldaktspecificoptprocessor:=aktspecificoptprocessor;
  390. oldaktasmmode:=aktasmmode;
  391. oldaktinterfacetype:=aktinterfacetype;
  392. oldaktfilepos:=aktfilepos;
  393. oldaktmodeswitches:=aktmodeswitches;
  394. {$ifdef GDB}
  395. store_dbx:=dbx_counter;
  396. dbx_counter:=nil;
  397. {$endif GDB}
  398. end;
  399. { show info }
  400. Message1(parser_i_compiling,filename);
  401. { reset symtable }
  402. symtablestack:=nil;
  403. defaultsymtablestack:=nil;
  404. systemunit:=nil;
  405. refsymtable:=nil;
  406. aktdefproccall:=initdefproccall;
  407. registerdef:=true;
  408. aktexceptblock:=0;
  409. exceptblockcounter:=0;
  410. aktmaxfpuregisters:=-1;
  411. { reset the unit or create a new program }
  412. if not assigned(current_module) then
  413. begin
  414. current_module:=tppumodule.create(nil,filename,'',false);
  415. main_module:=current_module;
  416. current_module.state:=ms_compile;
  417. end;
  418. if not(current_module.state in [ms_compile,ms_second_compile]) then
  419. internalerror(200212281);
  420. { a unit compiled at command line must be inside the loaded_unit list }
  421. if (compile_level=1) then
  422. loaded_units.insert(current_module);
  423. { Set the module to use for verbose }
  424. compiled_module:=current_module;
  425. SetCompileModule(current_module);
  426. Fillchar(aktfilepos,0,sizeof(aktfilepos));
  427. { Load current state from the init values }
  428. aktlocalswitches:=initlocalswitches;
  429. aktmoduleswitches:=initmoduleswitches;
  430. aktmodeswitches:=initmodeswitches;
  431. {$IFDEF Testvarsets}
  432. aktsetalloc:=initsetalloc;
  433. {$ENDIF}
  434. aktalignment:=initalignment;
  435. aktfputype:=initfputype;
  436. aktpackenum:=initpackenum;
  437. aktpackrecords:=0;
  438. aktoutputformat:=initoutputformat;
  439. set_target_asm(aktoutputformat);
  440. aktoptprocessor:=initoptprocessor;
  441. aktspecificoptprocessor:=initspecificoptprocessor;
  442. aktasmmode:=initasmmode;
  443. aktinterfacetype:=initinterfacetype;
  444. { startup scanner and load the first file }
  445. current_scanner:=tscannerfile.Create(filename);
  446. current_scanner.firstfile;
  447. current_module.scanner:=current_scanner;
  448. { macros }
  449. default_macros;
  450. { read the first token }
  451. current_scanner.readtoken;
  452. { init code generator for a new module }
  453. init_module;
  454. { If the compile level > 1 we get a nice "unit expected" error
  455. message if we are trying to use a program as unit.}
  456. {$ifdef USEEXCEPT}
  457. if setjmp(recoverpos)=0 then
  458. begin
  459. oldrecoverpos:=recoverpospointer;
  460. recoverpospointer:=@recoverpos;
  461. {$endif USEEXCEPT}
  462. if (token=_UNIT) or (compile_level>1) then
  463. begin
  464. current_module.is_unit:=true;
  465. proc_unit;
  466. end
  467. else
  468. proc_program(token=_LIBRARY);
  469. {$ifdef USEEXCEPT}
  470. recoverpospointer:=oldrecoverpos;
  471. end
  472. else
  473. begin
  474. recoverpospointer:=oldrecoverpos;
  475. longjump_used:=true;
  476. end;
  477. {$endif USEEXCEPT}
  478. { clear memory }
  479. {$ifdef Splitheap}
  480. if testsplit then
  481. begin
  482. { temp heap should be empty after that !!!}
  483. codegen_donemodule;
  484. Releasetempheap;
  485. end;
  486. {$endif Splitheap}
  487. { restore old state, close trees, > 0.99.5 has heapblocks, so
  488. it's the default to release the trees }
  489. done_module;
  490. if assigned(current_module) then
  491. begin
  492. { module is now compiled }
  493. tppumodule(current_module).state:=ms_compiled;
  494. { free ppu }
  495. if assigned(tppumodule(current_module).ppufile) then
  496. begin
  497. tppumodule(current_module).ppufile.free;
  498. tppumodule(current_module).ppufile:=nil;
  499. end;
  500. { free scanner }
  501. if assigned(current_module.scanner) then
  502. begin
  503. if current_scanner=tscannerfile(current_module.scanner) then
  504. current_scanner:=nil;
  505. tscannerfile(current_module.scanner).free;
  506. current_module.scanner:=nil;
  507. end;
  508. end;
  509. if (compile_level>1) then
  510. begin
  511. with olddata^ do
  512. begin
  513. { restore scanner }
  514. c:=oldc;
  515. pattern:=oldpattern;
  516. orgpattern:=oldorgpattern;
  517. token:=oldtoken;
  518. idtoken:=oldidtoken;
  519. akttokenpos:=oldtokenpos;
  520. block_type:=old_block_type;
  521. { restore cg }
  522. parse_only:=oldparse_only;
  523. { restore asmlists }
  524. exprasmlist:=oldexprasmlist;
  525. datasegment:=olddatasegment;
  526. bsssegment:=oldbsssegment;
  527. codesegment:=oldcodesegment;
  528. consts:=oldconsts;
  529. debuglist:=olddebuglist;
  530. withdebuglist:=oldwithdebuglist;
  531. importssection:=oldimports;
  532. exportssection:=oldexports;
  533. resourcesection:=oldresource;
  534. rttilist:=oldrttilist;
  535. picdata:=oldpicdata;
  536. resourcestringlist:=oldresourcestringlist;
  537. { object data }
  538. ResourceStrings:=OldResourceStrings;
  539. objectlibrary:=oldobjectlibrary;
  540. { restore previous scanner }
  541. if assigned(old_compiled_module) then
  542. current_scanner:=tscannerfile(old_compiled_module.scanner)
  543. else
  544. current_scanner:=nil;
  545. if assigned(current_scanner) then
  546. parser_current_file:=current_scanner.inputfile.name^;
  547. { restore symtable state }
  548. refsymtable:=oldrefsymtable;
  549. symtablestack:=oldsymtablestack;
  550. defaultsymtablestack:=olddefaultsymtablestack;
  551. aktdefproccall:=oldaktdefproccall;
  552. current_procinfo:=oldcurrent_procinfo;
  553. aktsourcecodepage:=oldsourcecodepage;
  554. aktlocalswitches:=oldaktlocalswitches;
  555. aktmoduleswitches:=oldaktmoduleswitches;
  556. aktalignment:=oldaktalignment;
  557. aktpackenum:=oldaktpackenum;
  558. aktpackrecords:=oldaktpackrecords;
  559. aktmaxfpuregisters:=oldaktmaxfpuregisters;
  560. aktoutputformat:=oldaktoutputformat;
  561. set_target_asm(aktoutputformat);
  562. aktoptprocessor:=oldaktoptprocessor;
  563. aktspecificoptprocessor:=oldaktspecificoptprocessor;
  564. aktfputype:=oldaktfputype;
  565. aktasmmode:=oldaktasmmode;
  566. aktinterfacetype:=oldaktinterfacetype;
  567. aktfilepos:=oldaktfilepos;
  568. aktmodeswitches:=oldaktmodeswitches;
  569. aktexceptblock:=0;
  570. exceptblockcounter:=0;
  571. {$ifdef GDB}
  572. dbx_counter:=store_dbx;
  573. {$endif GDB}
  574. end;
  575. end
  576. else
  577. begin
  578. parser_current_file:='';
  579. { Shut down things when the last file is compiled }
  580. if (compile_level=1) then
  581. begin
  582. { Close script }
  583. if (not AsmRes.Empty) then
  584. begin
  585. Message1(exec_i_closing_script,AsmRes.Fn);
  586. AsmRes.WriteToDisk;
  587. end;
  588. {$ifdef USEEXCEPT}
  589. if not longjump_used then
  590. {$endif USEEXCEPT}
  591. begin
  592. { do not create browsers on errors !! }
  593. if status.errorcount=0 then
  594. begin
  595. {$ifdef BrowserLog}
  596. { Write Browser Log }
  597. if (cs_browser_log in aktglobalswitches) and
  598. (cs_browser in aktmoduleswitches) then
  599. begin
  600. if browserlog.elements_to_list.empty then
  601. begin
  602. Message1(parser_i_writing_browser_log,browserlog.Fname);
  603. WriteBrowserLog;
  604. end
  605. else
  606. browserlog.list_elements;
  607. end;
  608. {$endif BrowserLog}
  609. { Write Browser Collections }
  610. do_extractsymbolinfo{$ifdef FPC}(){$endif};
  611. end;
  612. end;
  613. {$ifdef dummy}
  614. if current_module.in_second_compile then
  615. begin
  616. current_module.in_second_compile:=false;
  617. current_module.in_compile:=true;
  618. end
  619. else
  620. current_module.in_compile:=false;
  621. {$endif dummy}
  622. end;
  623. end;
  624. dec(compile_level);
  625. compiled_module:=olddata^.old_compiled_module;
  626. dispose(olddata);
  627. {$ifdef USEEXCEPT}
  628. if longjump_used then
  629. longjmp(recoverpospointer^,1);
  630. {$endif USEEXCEPT}
  631. end;
  632. end.
  633. {
  634. $Log$
  635. Revision 1.62 2004-03-14 20:08:37 peter
  636. * packrecords fixed for settings from $PACKRECORDS
  637. * default packrecords now uses value 0 and uses info from aligment
  638. structure only, initpackrecords removed
  639. Revision 1.61 2004/03/02 17:32:12 florian
  640. * make cycle fixed
  641. + pic support for darwin
  642. + support of importing vars from shared libs on darwin implemented
  643. Revision 1.60 2004/02/04 22:15:15 daniel
  644. * Rtti generation moved to ncgutil
  645. * Assmtai usage of symsym removed
  646. * operator overloading cleanup up
  647. Revision 1.59 2004/01/28 22:16:31 peter
  648. * more record alignment fixes
  649. Revision 1.58 2003/10/29 21:02:51 peter
  650. * set ms_compiled after the program/unit is parsed
  651. * check for ms_compiled before checking preproc matches
  652. Revision 1.57 2003/10/01 20:34:49 peter
  653. * procinfo unit contains tprocinfo
  654. * cginfo renamed to cgbase
  655. * moved cgmessage to verbose
  656. * fixed ppc and sparc compiles
  657. Revision 1.56 2003/09/03 11:18:37 florian
  658. * fixed arm concatcopy
  659. + arm support in the common compiler sources added
  660. * moved some generic cg code around
  661. + tfputype added
  662. * ...
  663. Revision 1.55 2003/06/13 21:19:30 peter
  664. * current_procdef removed, use current_procinfo.procdef instead
  665. Revision 1.54 2003/06/12 16:41:51 peter
  666. * add inputfile prefix to ppas/link.res
  667. Revision 1.53 2003/05/15 18:58:53 peter
  668. * removed selfpointer_offset, vmtpointer_offset
  669. * tvarsym.adjusted_address
  670. * address in localsymtable is now in the real direction
  671. * removed some obsolete globals
  672. Revision 1.52 2003/04/27 11:21:33 peter
  673. * aktprocdef renamed to current_procinfo.procdef
  674. * procinfo renamed to current_procinfo
  675. * procinfo will now be stored in current_module so it can be
  676. cleaned up properly
  677. * gen_main_procsym changed to create_main_proc and release_main_proc
  678. to also generate a tprocinfo structure
  679. * fixed unit implicit initfinal
  680. Revision 1.51 2003/04/27 07:29:50 peter
  681. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  682. a new procdef declaration
  683. * aktprocsym removed
  684. * lexlevel removed, use symtable.symtablelevel instead
  685. * implicit init/final code uses the normal genentry/genexit
  686. * funcret state checking updated for new funcret handling
  687. Revision 1.50 2003/04/26 00:30:52 peter
  688. * reset aktfilepos when setting new module for compile
  689. Revision 1.49 2003/04/25 20:59:33 peter
  690. * removed funcretn,funcretsym, function result is now in varsym
  691. and aliases for result and function name are added using absolutesym
  692. * vs_hidden parameter for funcret passed in parameter
  693. * vs_hidden fixes
  694. * writenode changed to printnode and released from extdebug
  695. * -vp option added to generate a tree.log with the nodetree
  696. * nicer printnode for statements, callnode
  697. Revision 1.48 2002/12/29 14:57:50 peter
  698. * unit loading changed to first register units and load them
  699. afterwards. This is needed to support uses xxx in yyy correctly
  700. * unit dependency check fixed
  701. Revision 1.47 2002/12/24 23:32:19 peter
  702. * fixed crash when old_compiled_module was nil
  703. Revision 1.46 2002/11/20 12:36:24 mazen
  704. * $UNITPATH directive is now working
  705. Revision 1.45 2002/10/07 19:29:52 peter
  706. * Place old data in compile() in the heap to save stack
  707. Revision 1.44 2002/09/05 19:27:06 peter
  708. * fixed crash when current_module becomes nil
  709. Revision 1.43 2002/08/18 19:58:28 peter
  710. * more current_scanner fixes
  711. Revision 1.42 2002/08/16 15:31:08 peter
  712. * fixed possible crashes with current_scanner
  713. Revision 1.41 2002/08/15 19:10:35 peter
  714. * first things tai,tnode storing in ppu
  715. Revision 1.40 2002/08/12 16:46:04 peter
  716. * tscannerfile is now destroyed in tmodule.reset and current_scanner
  717. is updated accordingly. This removes all the loading and saving of
  718. the old scanner and the invalid flag marking
  719. Revision 1.39 2002/08/12 15:08:40 carl
  720. + stab register indexes for powerpc (moved from gdb to cpubase)
  721. + tprocessor enumeration moved to cpuinfo
  722. + linker in target_info is now a class
  723. * many many updates for m68k (will soon start to compile)
  724. - removed some ifdef or correct them for correct cpu
  725. Revision 1.38 2002/08/11 14:28:19 peter
  726. * TScannerFile.SetInvalid added that will also reset inputfile
  727. Revision 1.37 2002/08/11 13:24:12 peter
  728. * saving of asmsymbols in ppu supported
  729. * asmsymbollist global is removed and moved into a new class
  730. tasmlibrarydata that will hold the info of a .a file which
  731. corresponds with a single module. Added librarydata to tmodule
  732. to keep the library info stored for the module. In the future the
  733. objectfiles will also be stored to the tasmlibrarydata class
  734. * all getlabel/newasmsymbol and friends are moved to the new class
  735. Revision 1.36 2002/08/09 19:15:41 carl
  736. - removed newcg define
  737. Revision 1.35 2002/07/20 17:16:03 florian
  738. + source code page support
  739. Revision 1.34 2002/07/01 18:46:24 peter
  740. * internal linker
  741. * reorganized aasm layer
  742. Revision 1.33 2002/05/18 13:34:11 peter
  743. * readded missing revisions
  744. Revision 1.32 2002/05/16 19:46:42 carl
  745. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  746. + try to fix temp allocation (still in ifdef)
  747. + generic constructor calls
  748. + start of tassembler / tmodulebase class cleanup
  749. Revision 1.30 2002/04/21 18:57:23 peter
  750. * fixed memleaks when file can't be opened
  751. Revision 1.29 2002/04/20 21:32:24 carl
  752. + generic FPC_CHECKPOINTER
  753. + first parameter offset in stack now portable
  754. * rename some constants
  755. + move some cpu stuff to other units
  756. - remove unused constents
  757. * fix stacksize for some targets
  758. * fix generic size problems which depend now on EXTEND_SIZE constant
  759. Revision 1.28 2002/04/19 15:46:02 peter
  760. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  761. in most cases and not written to the ppu
  762. * add mangeledname_prefix() routine to generate the prefix of
  763. manglednames depending on the current procedure, object and module
  764. * removed static procprefix since the mangledname is now build only
  765. on demand from tprocdef.mangledname
  766. Revision 1.27 2002/01/29 19:43:11 peter
  767. * update target_asm according to outputformat
  768. }