parser.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  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. ResourceStringList:=Nil;
  217. importssection:=nil;
  218. exportssection:=nil;
  219. resourcesection:=nil;
  220. { Resource strings }
  221. ResourceStrings:=TResourceStrings.Create;
  222. { use the librarydata from current_module }
  223. objectlibrary:=current_module.librarydata;
  224. end;
  225. procedure done_module;
  226. {$ifdef MEMDEBUG}
  227. var
  228. d : tmemdebug;
  229. {$endif}
  230. begin
  231. {$ifdef MEMDEBUG}
  232. d:=tmemdebug.create(current_module.modulename^+' - asmlists');
  233. {$endif}
  234. exprasmlist.free;
  235. codesegment.free;
  236. bsssegment.free;
  237. datasegment.free;
  238. debuglist.free;
  239. withdebuglist.free;
  240. consts.free;
  241. rttilist.free;
  242. if assigned(ResourceStringList) then
  243. ResourceStringList.free;
  244. if assigned(importssection) then
  245. importssection.free;
  246. if assigned(exportssection) then
  247. exportssection.free;
  248. if assigned(resourcesection) then
  249. resourcesection.free;
  250. {$ifdef MEMDEBUG}
  251. d.free;
  252. {$endif}
  253. { resource strings }
  254. ResourceStrings.free;
  255. objectlibrary:=nil;
  256. end;
  257. {*****************************************************************************
  258. Compile a source file
  259. *****************************************************************************}
  260. procedure compile(const filename:string);
  261. type
  262. polddata=^tolddata;
  263. tolddata=record
  264. { scanner }
  265. oldidtoken,
  266. oldtoken : ttoken;
  267. oldtokenpos : tfileposinfo;
  268. oldc : char;
  269. oldpattern,
  270. oldorgpattern : string;
  271. old_block_type : tblock_type;
  272. { symtable }
  273. oldrefsymtable,
  274. olddefaultsymtablestack,
  275. oldsymtablestack : tsymtable;
  276. oldaktprocsym : tprocsym;
  277. oldoverloaded_operators : toverloaded_operators;
  278. { cg }
  279. oldparse_only : boolean;
  280. { asmlists }
  281. oldimports,
  282. oldexports,
  283. oldresource,
  284. oldrttilist,
  285. oldresourcestringlist,
  286. oldbsssegment,
  287. olddatasegment,
  288. oldcodesegment,
  289. oldexprasmlist,
  290. olddebuglist,
  291. oldwithdebuglist,
  292. oldconsts : taasmoutput;
  293. oldobjectlibrary : tasmlibrarydata;
  294. { resourcestrings }
  295. OldResourceStrings : tResourceStrings;
  296. { akt.. things }
  297. oldaktlocalswitches : tlocalswitches;
  298. oldaktmoduleswitches : tmoduleswitches;
  299. oldaktfilepos : tfileposinfo;
  300. oldaktpackenum,oldaktmaxfpuregisters : longint;
  301. oldaktalignment : talignmentinfo;
  302. oldaktoutputformat : tasm;
  303. oldaktspecificoptprocessor,
  304. oldaktoptprocessor : tprocessors;
  305. oldaktfputype : tfputype;
  306. oldaktasmmode : tasmmode;
  307. oldaktinterfacetype: tinterfacetypes;
  308. oldaktmodeswitches : tmodeswitches;
  309. old_compiled_module : tmodule;
  310. oldcurrent_procinfo : tprocinfo;
  311. oldaktdefproccall : tproccalloption;
  312. oldsourcecodepage : tcodepagestring;
  313. {$ifdef GDB}
  314. store_dbx : plongint;
  315. {$endif GDB}
  316. end;
  317. var
  318. olddata : polddata;
  319. {$ifdef USEEXCEPT}
  320. {$ifndef Delphi}
  321. recoverpos : jmp_buf;
  322. oldrecoverpos : pjmp_buf;
  323. {$endif Delphi}
  324. {$endif useexcept}
  325. begin
  326. inc(compile_level);
  327. parser_current_file:=filename;
  328. { Uses heap memory instead of placing everything on the
  329. stack. This is needed because compile() can be called
  330. recursively }
  331. new(olddata);
  332. with olddata^ do
  333. begin
  334. old_compiled_module:=compiled_module;
  335. { save symtable state }
  336. oldsymtablestack:=symtablestack;
  337. olddefaultsymtablestack:=defaultsymtablestack;
  338. oldrefsymtable:=refsymtable;
  339. oldcurrent_procinfo:=current_procinfo;
  340. oldaktdefproccall:=aktdefproccall;
  341. move(overloaded_operators,oldoverloaded_operators,sizeof(toverloaded_operators));
  342. { save scanner state }
  343. oldc:=c;
  344. oldpattern:=pattern;
  345. oldorgpattern:=orgpattern;
  346. oldtoken:=token;
  347. oldidtoken:=idtoken;
  348. old_block_type:=block_type;
  349. oldtokenpos:=akttokenpos;
  350. oldsourcecodepage:=aktsourcecodepage;
  351. { save cg }
  352. oldparse_only:=parse_only;
  353. { save assembler lists }
  354. olddatasegment:=datasegment;
  355. oldbsssegment:=bsssegment;
  356. oldcodesegment:=codesegment;
  357. olddebuglist:=debuglist;
  358. oldwithdebuglist:=withdebuglist;
  359. oldconsts:=consts;
  360. oldrttilist:=rttilist;
  361. oldexprasmlist:=exprasmlist;
  362. oldimports:=importssection;
  363. oldexports:=exportssection;
  364. oldresource:=resourcesection;
  365. oldresourcestringlist:=resourcestringlist;
  366. oldobjectlibrary:=objectlibrary;
  367. OldResourceStrings:=ResourceStrings;
  368. { save akt... state }
  369. { handle the postponed case first }
  370. if localswitcheschanged then
  371. begin
  372. aktlocalswitches:=nextaktlocalswitches;
  373. localswitcheschanged:=false;
  374. end;
  375. oldaktlocalswitches:=aktlocalswitches;
  376. oldaktmoduleswitches:=aktmoduleswitches;
  377. oldaktalignment:=aktalignment;
  378. oldaktpackenum:=aktpackenum;
  379. oldaktfputype:=aktfputype;
  380. oldaktmaxfpuregisters:=aktmaxfpuregisters;
  381. oldaktoutputformat:=aktoutputformat;
  382. oldaktoptprocessor:=aktoptprocessor;
  383. oldaktspecificoptprocessor:=aktspecificoptprocessor;
  384. oldaktasmmode:=aktasmmode;
  385. oldaktinterfacetype:=aktinterfacetype;
  386. oldaktfilepos:=aktfilepos;
  387. oldaktmodeswitches:=aktmodeswitches;
  388. {$ifdef GDB}
  389. store_dbx:=dbx_counter;
  390. dbx_counter:=nil;
  391. {$endif GDB}
  392. end;
  393. { show info }
  394. Message1(parser_i_compiling,filename);
  395. { reset symtable }
  396. symtablestack:=nil;
  397. defaultsymtablestack:=nil;
  398. systemunit:=nil;
  399. refsymtable:=nil;
  400. aktdefproccall:=initdefproccall;
  401. registerdef:=true;
  402. aktexceptblock:=0;
  403. exceptblockcounter:=0;
  404. aktmaxfpuregisters:=-1;
  405. fillchar(overloaded_operators,sizeof(toverloaded_operators),0);
  406. { reset the unit or create a new program }
  407. if not assigned(current_module) then
  408. begin
  409. current_module:=tppumodule.create(nil,filename,'',false);
  410. main_module:=current_module;
  411. current_module.state:=ms_compile;
  412. end;
  413. if not(current_module.state in [ms_compile,ms_second_compile]) then
  414. internalerror(200212281);
  415. { a unit compiled at command line must be inside the loaded_unit list }
  416. if (compile_level=1) then
  417. loaded_units.insert(current_module);
  418. { Set the module to use for verbose }
  419. compiled_module:=current_module;
  420. SetCompileModule(current_module);
  421. Fillchar(aktfilepos,0,sizeof(aktfilepos));
  422. { Load current state from the init values }
  423. aktlocalswitches:=initlocalswitches;
  424. aktmoduleswitches:=initmoduleswitches;
  425. aktmodeswitches:=initmodeswitches;
  426. {$IFDEF Testvarsets}
  427. aktsetalloc:=initsetalloc;
  428. {$ENDIF}
  429. aktalignment:=initalignment;
  430. aktfputype:=initfputype;
  431. aktpackenum:=initpackenum;
  432. aktoutputformat:=initoutputformat;
  433. set_target_asm(aktoutputformat);
  434. aktoptprocessor:=initoptprocessor;
  435. aktspecificoptprocessor:=initspecificoptprocessor;
  436. aktasmmode:=initasmmode;
  437. aktinterfacetype:=initinterfacetype;
  438. { startup scanner and load the first file }
  439. current_scanner:=tscannerfile.Create(filename);
  440. current_scanner.firstfile;
  441. current_module.scanner:=current_scanner;
  442. { macros }
  443. default_macros;
  444. { read the first token }
  445. current_scanner.readtoken;
  446. { init code generator for a new module }
  447. init_module;
  448. { If the compile level > 1 we get a nice "unit expected" error
  449. message if we are trying to use a program as unit.}
  450. {$ifdef USEEXCEPT}
  451. if setjmp(recoverpos)=0 then
  452. begin
  453. oldrecoverpos:=recoverpospointer;
  454. recoverpospointer:=@recoverpos;
  455. {$endif USEEXCEPT}
  456. if (token=_UNIT) or (compile_level>1) then
  457. begin
  458. current_module.is_unit:=true;
  459. proc_unit;
  460. end
  461. else
  462. proc_program(token=_LIBRARY);
  463. {$ifdef USEEXCEPT}
  464. recoverpospointer:=oldrecoverpos;
  465. end
  466. else
  467. begin
  468. recoverpospointer:=oldrecoverpos;
  469. longjump_used:=true;
  470. end;
  471. {$endif USEEXCEPT}
  472. { clear memory }
  473. {$ifdef Splitheap}
  474. if testsplit then
  475. begin
  476. { temp heap should be empty after that !!!}
  477. codegen_donemodule;
  478. Releasetempheap;
  479. end;
  480. {$endif Splitheap}
  481. { restore old state, close trees, > 0.99.5 has heapblocks, so
  482. it's the default to release the trees }
  483. done_module;
  484. if assigned(current_module) then
  485. begin
  486. { module is now compiled }
  487. tppumodule(current_module).state:=ms_compiled;
  488. { free ppu }
  489. if assigned(tppumodule(current_module).ppufile) then
  490. begin
  491. tppumodule(current_module).ppufile.free;
  492. tppumodule(current_module).ppufile:=nil;
  493. end;
  494. { free scanner }
  495. if assigned(current_module.scanner) then
  496. begin
  497. if current_scanner=tscannerfile(current_module.scanner) then
  498. current_scanner:=nil;
  499. tscannerfile(current_module.scanner).free;
  500. current_module.scanner:=nil;
  501. end;
  502. end;
  503. if (compile_level>1) then
  504. begin
  505. with olddata^ do
  506. begin
  507. { restore scanner }
  508. c:=oldc;
  509. pattern:=oldpattern;
  510. orgpattern:=oldorgpattern;
  511. token:=oldtoken;
  512. idtoken:=oldidtoken;
  513. akttokenpos:=oldtokenpos;
  514. block_type:=old_block_type;
  515. { restore cg }
  516. parse_only:=oldparse_only;
  517. { restore asmlists }
  518. exprasmlist:=oldexprasmlist;
  519. datasegment:=olddatasegment;
  520. bsssegment:=oldbsssegment;
  521. codesegment:=oldcodesegment;
  522. consts:=oldconsts;
  523. debuglist:=olddebuglist;
  524. withdebuglist:=oldwithdebuglist;
  525. importssection:=oldimports;
  526. exportssection:=oldexports;
  527. resourcesection:=oldresource;
  528. rttilist:=oldrttilist;
  529. resourcestringlist:=oldresourcestringlist;
  530. { object data }
  531. ResourceStrings:=OldResourceStrings;
  532. objectlibrary:=oldobjectlibrary;
  533. { restore previous scanner }
  534. if assigned(old_compiled_module) then
  535. current_scanner:=tscannerfile(old_compiled_module.scanner)
  536. else
  537. current_scanner:=nil;
  538. if assigned(current_scanner) then
  539. parser_current_file:=current_scanner.inputfile.name^;
  540. { restore symtable state }
  541. refsymtable:=oldrefsymtable;
  542. symtablestack:=oldsymtablestack;
  543. defaultsymtablestack:=olddefaultsymtablestack;
  544. aktdefproccall:=oldaktdefproccall;
  545. current_procinfo:=oldcurrent_procinfo;
  546. move(oldoverloaded_operators,overloaded_operators,sizeof(toverloaded_operators));
  547. aktsourcecodepage:=oldsourcecodepage;
  548. aktlocalswitches:=oldaktlocalswitches;
  549. aktmoduleswitches:=oldaktmoduleswitches;
  550. aktalignment:=oldaktalignment;
  551. aktpackenum:=oldaktpackenum;
  552. aktmaxfpuregisters:=oldaktmaxfpuregisters;
  553. aktoutputformat:=oldaktoutputformat;
  554. set_target_asm(aktoutputformat);
  555. aktoptprocessor:=oldaktoptprocessor;
  556. aktspecificoptprocessor:=oldaktspecificoptprocessor;
  557. aktfputype:=oldaktfputype;
  558. aktasmmode:=oldaktasmmode;
  559. aktinterfacetype:=oldaktinterfacetype;
  560. aktfilepos:=oldaktfilepos;
  561. aktmodeswitches:=oldaktmodeswitches;
  562. aktexceptblock:=0;
  563. exceptblockcounter:=0;
  564. {$ifdef GDB}
  565. dbx_counter:=store_dbx;
  566. {$endif GDB}
  567. end;
  568. end
  569. else
  570. begin
  571. parser_current_file:='';
  572. { Shut down things when the last file is compiled }
  573. if (compile_level=1) then
  574. begin
  575. { Close script }
  576. if (not AsmRes.Empty) then
  577. begin
  578. Message1(exec_i_closing_script,AsmRes.Fn);
  579. AsmRes.WriteToDisk;
  580. end;
  581. {$ifdef USEEXCEPT}
  582. if not longjump_used then
  583. {$endif USEEXCEPT}
  584. begin
  585. { do not create browsers on errors !! }
  586. if status.errorcount=0 then
  587. begin
  588. {$ifdef BrowserLog}
  589. { Write Browser Log }
  590. if (cs_browser_log in aktglobalswitches) and
  591. (cs_browser in aktmoduleswitches) then
  592. begin
  593. if browserlog.elements_to_list.empty then
  594. begin
  595. Message1(parser_i_writing_browser_log,browserlog.Fname);
  596. WriteBrowserLog;
  597. end
  598. else
  599. browserlog.list_elements;
  600. end;
  601. {$endif BrowserLog}
  602. { Write Browser Collections }
  603. do_extractsymbolinfo{$ifdef FPC}(){$endif};
  604. end;
  605. end;
  606. {$ifdef dummy}
  607. if current_module.in_second_compile then
  608. begin
  609. current_module.in_second_compile:=false;
  610. current_module.in_compile:=true;
  611. end
  612. else
  613. current_module.in_compile:=false;
  614. {$endif dummy}
  615. end;
  616. end;
  617. dec(compile_level);
  618. compiled_module:=olddata^.old_compiled_module;
  619. dispose(olddata);
  620. {$ifdef USEEXCEPT}
  621. if longjump_used then
  622. longjmp(recoverpospointer^,1);
  623. {$endif USEEXCEPT}
  624. end;
  625. end.
  626. {
  627. $Log$
  628. Revision 1.58 2003-10-29 21:02:51 peter
  629. * set ms_compiled after the program/unit is parsed
  630. * check for ms_compiled before checking preproc matches
  631. Revision 1.57 2003/10/01 20:34:49 peter
  632. * procinfo unit contains tprocinfo
  633. * cginfo renamed to cgbase
  634. * moved cgmessage to verbose
  635. * fixed ppc and sparc compiles
  636. Revision 1.56 2003/09/03 11:18:37 florian
  637. * fixed arm concatcopy
  638. + arm support in the common compiler sources added
  639. * moved some generic cg code around
  640. + tfputype added
  641. * ...
  642. Revision 1.55 2003/06/13 21:19:30 peter
  643. * current_procdef removed, use current_procinfo.procdef instead
  644. Revision 1.54 2003/06/12 16:41:51 peter
  645. * add inputfile prefix to ppas/link.res
  646. Revision 1.53 2003/05/15 18:58:53 peter
  647. * removed selfpointer_offset, vmtpointer_offset
  648. * tvarsym.adjusted_address
  649. * address in localsymtable is now in the real direction
  650. * removed some obsolete globals
  651. Revision 1.52 2003/04/27 11:21:33 peter
  652. * aktprocdef renamed to current_procinfo.procdef
  653. * procinfo renamed to current_procinfo
  654. * procinfo will now be stored in current_module so it can be
  655. cleaned up properly
  656. * gen_main_procsym changed to create_main_proc and release_main_proc
  657. to also generate a tprocinfo structure
  658. * fixed unit implicit initfinal
  659. Revision 1.51 2003/04/27 07:29:50 peter
  660. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  661. a new procdef declaration
  662. * aktprocsym removed
  663. * lexlevel removed, use symtable.symtablelevel instead
  664. * implicit init/final code uses the normal genentry/genexit
  665. * funcret state checking updated for new funcret handling
  666. Revision 1.50 2003/04/26 00:30:52 peter
  667. * reset aktfilepos when setting new module for compile
  668. Revision 1.49 2003/04/25 20:59:33 peter
  669. * removed funcretn,funcretsym, function result is now in varsym
  670. and aliases for result and function name are added using absolutesym
  671. * vs_hidden parameter for funcret passed in parameter
  672. * vs_hidden fixes
  673. * writenode changed to printnode and released from extdebug
  674. * -vp option added to generate a tree.log with the nodetree
  675. * nicer printnode for statements, callnode
  676. Revision 1.48 2002/12/29 14:57:50 peter
  677. * unit loading changed to first register units and load them
  678. afterwards. This is needed to support uses xxx in yyy correctly
  679. * unit dependency check fixed
  680. Revision 1.47 2002/12/24 23:32:19 peter
  681. * fixed crash when old_compiled_module was nil
  682. Revision 1.46 2002/11/20 12:36:24 mazen
  683. * $UNITPATH directive is now working
  684. Revision 1.45 2002/10/07 19:29:52 peter
  685. * Place old data in compile() in the heap to save stack
  686. Revision 1.44 2002/09/05 19:27:06 peter
  687. * fixed crash when current_module becomes nil
  688. Revision 1.43 2002/08/18 19:58:28 peter
  689. * more current_scanner fixes
  690. Revision 1.42 2002/08/16 15:31:08 peter
  691. * fixed possible crashes with current_scanner
  692. Revision 1.41 2002/08/15 19:10:35 peter
  693. * first things tai,tnode storing in ppu
  694. Revision 1.40 2002/08/12 16:46:04 peter
  695. * tscannerfile is now destroyed in tmodule.reset and current_scanner
  696. is updated accordingly. This removes all the loading and saving of
  697. the old scanner and the invalid flag marking
  698. Revision 1.39 2002/08/12 15:08:40 carl
  699. + stab register indexes for powerpc (moved from gdb to cpubase)
  700. + tprocessor enumeration moved to cpuinfo
  701. + linker in target_info is now a class
  702. * many many updates for m68k (will soon start to compile)
  703. - removed some ifdef or correct them for correct cpu
  704. Revision 1.38 2002/08/11 14:28:19 peter
  705. * TScannerFile.SetInvalid added that will also reset inputfile
  706. Revision 1.37 2002/08/11 13:24:12 peter
  707. * saving of asmsymbols in ppu supported
  708. * asmsymbollist global is removed and moved into a new class
  709. tasmlibrarydata that will hold the info of a .a file which
  710. corresponds with a single module. Added librarydata to tmodule
  711. to keep the library info stored for the module. In the future the
  712. objectfiles will also be stored to the tasmlibrarydata class
  713. * all getlabel/newasmsymbol and friends are moved to the new class
  714. Revision 1.36 2002/08/09 19:15:41 carl
  715. - removed newcg define
  716. Revision 1.35 2002/07/20 17:16:03 florian
  717. + source code page support
  718. Revision 1.34 2002/07/01 18:46:24 peter
  719. * internal linker
  720. * reorganized aasm layer
  721. Revision 1.33 2002/05/18 13:34:11 peter
  722. * readded missing revisions
  723. Revision 1.32 2002/05/16 19:46:42 carl
  724. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  725. + try to fix temp allocation (still in ifdef)
  726. + generic constructor calls
  727. + start of tassembler / tmodulebase class cleanup
  728. Revision 1.30 2002/04/21 18:57:23 peter
  729. * fixed memleaks when file can't be opened
  730. Revision 1.29 2002/04/20 21:32:24 carl
  731. + generic FPC_CHECKPOINTER
  732. + first parameter offset in stack now portable
  733. * rename some constants
  734. + move some cpu stuff to other units
  735. - remove unused constents
  736. * fix stacksize for some targets
  737. * fix generic size problems which depend now on EXTEND_SIZE constant
  738. Revision 1.28 2002/04/19 15:46:02 peter
  739. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  740. in most cases and not written to the ppu
  741. * add mangeledname_prefix() routine to generate the prefix of
  742. manglednames depending on the current procedure, object and module
  743. * removed static procprefix since the mangledname is now build only
  744. on demand from tprocdef.mangledname
  745. Revision 1.27 2002/01/29 19:43:11 peter
  746. * update target_asm according to outputformat
  747. }