pmodules.pas 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Handles the parsing and loading of the modules (ppufiles)
  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 pmodules;
  19. {$i defines.inc}
  20. {$define New_GDB}
  21. interface
  22. procedure proc_unit;
  23. procedure proc_program(islibrary : boolean);
  24. implementation
  25. uses
  26. globtype,version,systems,tokens,
  27. cutils,comphook,
  28. globals,verbose,fmodule,finput,fppu,
  29. symconst,symbase,symppu,symdef,symsym,symtable,aasm,
  30. {$ifdef newcg}
  31. cgbase,
  32. {$else newcg}
  33. hcodegen,
  34. {$ifdef i386}
  35. cgai386,
  36. {$endif i386}
  37. {$endif newcg}
  38. link,assemble,import,export,gendef,ppu,comprsrc,
  39. cresstr,cpubase,cpuasm,
  40. {$ifdef GDB}
  41. gdb,
  42. {$endif GDB}
  43. scanner,pbase,psystem,psub,parser;
  44. procedure create_objectfile;
  45. var
  46. DLLScanner : TDLLScanner;
  47. s : string;
  48. begin
  49. { try to create import entries from system dlls }
  50. if target_info.DllScanSupported and
  51. (not current_module.linkOtherSharedLibs.Empty) then
  52. begin
  53. { Init DLLScanner }
  54. if assigned(CDLLScanner[target_info.target]) then
  55. DLLScanner:=CDLLScanner[target_info.target].Create
  56. else
  57. internalerror(200104121);
  58. { Walk all shared libs }
  59. While not current_module.linkOtherSharedLibs.Empty do
  60. begin
  61. S:=current_module.linkOtherSharedLibs.Getusemask(link_allways);
  62. DLLScanner.scan(s)
  63. end;
  64. DLLscanner.Free;
  65. { Recreate import section }
  66. if (target_info.target=target_i386_win32) then
  67. begin
  68. if assigned(importssection)then
  69. importssection.clear
  70. else
  71. importssection:=taasmoutput.Create;
  72. importlib.generatelib;
  73. end;
  74. end;
  75. { create the .s file and assemble it }
  76. GenerateAsm(false);
  77. { Also create a smartlinked version ? }
  78. if (cs_create_smart in aktmoduleswitches) then
  79. begin
  80. { regenerate the importssection for win32 }
  81. if assigned(importssection) and
  82. (target_info.target=target_i386_win32) then
  83. begin
  84. importsSection.clear;
  85. importlib.generatesmartlib;
  86. end;
  87. GenerateAsm(true);
  88. if target_asm.needar then
  89. Linker.MakeStaticLibrary;
  90. end;
  91. { resource files }
  92. CompileResourceFiles;
  93. end;
  94. procedure insertobjectfile;
  95. { Insert the used object file for this unit in the used list for this unit }
  96. begin
  97. current_module.linkunitofiles.add(current_module.objfilename^,link_static);
  98. current_module.flags:=current_module.flags or uf_static_linked;
  99. if (cs_create_smart in aktmoduleswitches) then
  100. begin
  101. current_module.linkunitstaticlibs.add(current_module.staticlibfilename^,link_smart);
  102. current_module.flags:=current_module.flags or uf_smart_linked;
  103. end;
  104. end;
  105. procedure insertsegment;
  106. procedure fixseg(p:TAAsmoutput;sec:tsection);
  107. begin
  108. p.insert(Tai_section.Create(sec));
  109. if (cs_create_smart in aktmoduleswitches) then
  110. p.insert(Tai_cut.Create);
  111. p.concat(Tai_section.Create(sec_none));
  112. end;
  113. begin
  114. { Insert Ident of the compiler }
  115. if (not (cs_create_smart in aktmoduleswitches))
  116. {$ifndef EXTDEBUG}
  117. and (not current_module.is_unit)
  118. {$endif}
  119. then
  120. begin
  121. dataSegment.insert(Tai_align.Create(4));
  122. dataSegment.insert(Tai_string.Create('FPC '+full_version_string+
  123. ' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname));
  124. end;
  125. { finish codesegment }
  126. codeSegment.concat(Tai_align.Create(16));
  127. { Insert start and end of sections }
  128. fixseg(codesegment,sec_code);
  129. fixseg(datasegment,sec_data);
  130. fixseg(bsssegment,sec_bss);
  131. { we should use .rdata section for these two no ? }
  132. { .rdata is a read only data section (PM) }
  133. fixseg(rttilist,sec_data);
  134. fixseg(consts,sec_data);
  135. if assigned(resourcestringlist) then
  136. fixseg(resourcestringlist,sec_data);
  137. {$ifdef GDB}
  138. if assigned(debuglist) then
  139. begin
  140. debugList.insert(Tai_symbol.Createname('gcc2_compiled',0));
  141. debugList.insert(Tai_symbol.Createname('fpc_compiled',0));
  142. fixseg(debuglist,sec_code);
  143. end;
  144. {$endif GDB}
  145. end;
  146. Procedure InsertResourceTablesTable;
  147. var
  148. hp : tused_unit;
  149. ResourceStringTables : taasmoutput;
  150. count : longint;
  151. begin
  152. ResourceStringTables:=TAAsmOutput.Create;
  153. count:=0;
  154. hp:=tused_unit(usedunits.first);
  155. while assigned(hp) do
  156. begin
  157. If (hp.u.flags and uf_has_resources)=uf_has_resources then
  158. begin
  159. ResourceStringTables.concat(Tai_const_symbol.Createname(hp.u.modulename^+'_RESOURCESTRINGLIST'));
  160. inc(count);
  161. end;
  162. hp:=tused_unit(hp.next);
  163. end;
  164. { Add program resources, if any }
  165. If ResourceStringList<>Nil then
  166. begin
  167. ResourceStringTables.concat(Tai_const_symbol.Createname(current_module.modulename^+'_RESOURCESTRINGLIST'));
  168. Inc(Count);
  169. end;
  170. { TableCount }
  171. ResourceStringTables.insert(Tai_const.Create_32bit(count));
  172. ResourceStringTables.insert(Tai_symbol.Createdataname_global('FPC_RESOURCESTRINGTABLES',0));
  173. ResourceStringTables.concat(Tai_symbol_end.Createname('FPC_RESOURCESTRINGTABLES'));
  174. { insert in data segment }
  175. if (cs_create_smart in aktmoduleswitches) then
  176. dataSegment.concat(Tai_cut.Create);
  177. dataSegment.concatlist(ResourceStringTables);
  178. ResourceStringTables.free;
  179. end;
  180. procedure InsertInitFinalTable;
  181. var
  182. hp : tused_unit;
  183. unitinits : taasmoutput;
  184. count : longint;
  185. begin
  186. unitinits:=TAAsmOutput.Create;
  187. count:=0;
  188. hp:=tused_unit(usedunits.first);
  189. while assigned(hp) do
  190. begin
  191. { call the unit init code and make it external }
  192. if (hp.u.flags and (uf_init or uf_finalize))<>0 then
  193. begin
  194. if (hp.u.flags and uf_init)<>0 then
  195. unitinits.concat(Tai_const_symbol.Createname('INIT$$'+hp.u.modulename^))
  196. else
  197. unitinits.concat(Tai_const.Create_32bit(0));
  198. if (hp.u.flags and uf_finalize)<>0 then
  199. unitinits.concat(Tai_const_symbol.Createname('FINALIZE$$'+hp.u.modulename^))
  200. else
  201. unitinits.concat(Tai_const.Create_32bit(0));
  202. inc(count);
  203. end;
  204. hp:=tused_unit(hp.next);
  205. end;
  206. if current_module.islibrary then
  207. if (current_module.flags and uf_finalize)<>0 then
  208. begin
  209. { INIT code is done by PASCALMAIN calling }
  210. unitinits.concat(Tai_const.Create_32bit(0));
  211. unitinits.concat(Tai_const_symbol.Createname('FINALIZE$$'+current_module.modulename^));
  212. inc(count);
  213. end;
  214. { TableCount,InitCount }
  215. unitinits.insert(Tai_const.Create_32bit(0));
  216. unitinits.insert(Tai_const.Create_32bit(count));
  217. unitinits.insert(Tai_symbol.Createdataname_global('INITFINAL',0));
  218. unitinits.concat(Tai_symbol_end.Createname('INITFINAL'));
  219. { insert in data segment }
  220. if (cs_create_smart in aktmoduleswitches) then
  221. dataSegment.concat(Tai_cut.Create);
  222. dataSegment.concatlist(unitinits);
  223. unitinits.free;
  224. end;
  225. procedure insertheap;
  226. begin
  227. if (cs_create_smart in aktmoduleswitches) then
  228. begin
  229. bssSegment.concat(Tai_cut.Create);
  230. dataSegment.concat(Tai_cut.Create);
  231. end;
  232. { On the Macintosh Classic M68k Architecture
  233. The Heap variable is simply a POINTER to the
  234. real HEAP. The HEAP must be set up by the RTL
  235. and must store the pointer in this value.
  236. On OS/2 the heap is also intialized by the RTL. We do
  237. not output a pointer }
  238. case target_info.target of
  239. {$ifdef i386}
  240. target_i386_OS2:
  241. ;
  242. {$endif i386}
  243. {$ifdef alpha}
  244. target_alpha_linux:
  245. ;
  246. {$endif alpha}
  247. {$ifdef powerpc}
  248. target_powerpc_linux:
  249. ;
  250. {$endif powerpc}
  251. {$ifdef m68k}
  252. target_m68k_Mac:
  253. bssSegment.concat(Tai_datablock.Create_global('HEAP',4));
  254. target_m68k_PalmOS:
  255. ;
  256. {$endif m68k}
  257. else
  258. bssSegment.concat(Tai_datablock.Create_global('HEAP',heapsize));
  259. end;
  260. {$ifdef m68k}
  261. if target_info.target<>target_m68k_PalmOS then
  262. begin
  263. dataSegment.concat(Tai_symbol.Createdataname_global('HEAP_SIZE',0));
  264. dataSegment.concat(Tai_const.Create_32bit(heapsize));
  265. end;
  266. {$else m68k}
  267. dataSegment.concat(Tai_symbol.Createdataname_global('HEAPSIZE',4));
  268. dataSegment.concat(Tai_const.Create_32bit(heapsize));
  269. {$endif m68k}
  270. end;
  271. procedure inserttargetspecific;
  272. begin
  273. case target_info.target of
  274. {$ifdef alpha}
  275. target_alpha_linux:
  276. ;
  277. {$endif alpha}
  278. {$ifdef powerpc}
  279. target_powerpc_linux:
  280. ;
  281. {$endif powerpc}
  282. {$ifdef i386}
  283. target_i386_GO32V2 :
  284. begin
  285. { stacksize can be specified }
  286. dataSegment.concat(Tai_symbol.Createdataname_global('__stklen',4));
  287. dataSegment.concat(Tai_const.Create_32bit(stacksize));
  288. end;
  289. {$endif i386}
  290. {$ifdef m68k}
  291. target_m68k_Atari :
  292. begin
  293. { stacksize can be specified }
  294. dataSegment.concat(Tai_symbol.Createdataname_global('__stklen',4));
  295. dataSegment.concat(Tai_const.Create_32bit(stacksize));
  296. end;
  297. {$endif m68k}
  298. end;
  299. end;
  300. procedure loaddefaultunits;
  301. var
  302. hp : tmodule;
  303. unitsym : tunitsym;
  304. begin
  305. { are we compiling the system unit? }
  306. if (cs_compilesystem in aktmoduleswitches) then
  307. begin
  308. { create system defines }
  309. createconstdefs;
  310. { we don't need to reset anything, it's already done in parser.pas }
  311. exit;
  312. end;
  313. { insert the system unit, it is allways the first }
  314. hp:=loadunit('System');
  315. systemunit:=tglobalsymtable(hp.globalsymtable);
  316. { it's always the first unit }
  317. systemunit.next:=nil;
  318. symtablestack:=systemunit;
  319. { add to the used units }
  320. current_module.used_units.concat(tused_unit.create(hp,true));
  321. unitsym:=tunitsym.create('System',systemunit);
  322. inc(unitsym.refs);
  323. refsymtable.insert(unitsym);
  324. { read default constant definitions }
  325. make_ref:=false;
  326. readconstdefs;
  327. make_ref:=true;
  328. { Objpas unit? }
  329. if m_objpas in aktmodeswitches then
  330. begin
  331. hp:=loadunit('ObjPas');
  332. tsymtable(hp.globalsymtable).next:=symtablestack;
  333. symtablestack:=hp.globalsymtable;
  334. { add to the used units }
  335. current_module.used_units.concat(tused_unit.create(hp,true));
  336. unitsym:=tunitsym.create('ObjPas',hp.globalsymtable);
  337. inc(unitsym.refs);
  338. refsymtable.insert(unitsym);
  339. end;
  340. { Profile unit? Needed for go32v2 only }
  341. if (cs_profile in aktmoduleswitches) and (target_info.target=target_i386_go32v2) then
  342. begin
  343. hp:=loadunit('Profile');
  344. tsymtable(hp.globalsymtable).next:=symtablestack;
  345. symtablestack:=hp.globalsymtable;
  346. { add to the used units }
  347. current_module.used_units.concat(tused_unit.create(hp,true));
  348. unitsym:=tunitsym.create('Profile',hp.globalsymtable);
  349. inc(unitsym.refs);
  350. refsymtable.insert(unitsym);
  351. end;
  352. { Units only required for main module }
  353. if not(current_module.is_unit) then
  354. begin
  355. { Heaptrc unit }
  356. if (cs_gdb_heaptrc in aktglobalswitches) then
  357. begin
  358. hp:=loadunit('HeapTrc');
  359. tsymtable(hp.globalsymtable).next:=symtablestack;
  360. symtablestack:=hp.globalsymtable;
  361. { add to the used units }
  362. current_module.used_units.concat(tused_unit.create(hp,true));
  363. unitsym:=tunitsym.create('HeapTrc',hp.globalsymtable);
  364. inc(unitsym.refs);
  365. refsymtable.insert(unitsym);
  366. end;
  367. { Lineinfo unit }
  368. if (cs_gdb_lineinfo in aktglobalswitches) then
  369. begin
  370. hp:=loadunit('LineInfo');
  371. tsymtable(hp.globalsymtable).next:=symtablestack;
  372. symtablestack:=hp.globalsymtable;
  373. { add to the used units }
  374. current_module.used_units.concat(tused_unit.create(hp,true));
  375. unitsym:=tunitsym.create('LineInfo',hp.globalsymtable);
  376. inc(unitsym.refs);
  377. refsymtable.insert(unitsym);
  378. end;
  379. end;
  380. { save default symtablestack }
  381. defaultsymtablestack:=symtablestack;
  382. end;
  383. procedure loadunits;
  384. var
  385. s,sorg : stringid;
  386. pu,
  387. hp : tused_unit;
  388. hp2 : tmodule;
  389. hp3 : tsymtable;
  390. oldprocsym:tprocsym;
  391. unitsym : tunitsym;
  392. begin
  393. oldprocsym:=aktprocsym;
  394. consume(_USES);
  395. {$ifdef DEBUG}
  396. test_symtablestack;
  397. {$endif DEBUG}
  398. repeat
  399. s:=pattern;
  400. sorg:=orgpattern;
  401. consume(_ID);
  402. { Give a warning if objpas is loaded }
  403. if s='OBJPAS' then
  404. Message(parser_w_no_objpas_use_mode);
  405. { check if the unit is already used }
  406. pu:=tused_unit(current_module.used_units.first);
  407. while assigned(pu) do
  408. begin
  409. if (pu.name^=s) then
  410. break;
  411. pu:=tused_unit(pu.next);
  412. end;
  413. { avoid uses of itself }
  414. if not assigned(pu) and (s<>current_module.modulename^) then
  415. begin
  416. { load the unit }
  417. hp2:=loadunit(sorg);
  418. { the current module uses the unit hp2 }
  419. current_module.used_units.concat(tused_unit.create(hp2,not current_module.in_implementation));
  420. tused_unit(current_module.used_units.last).in_uses:=true;
  421. if current_module.compiled then
  422. exit;
  423. unitsym:=tunitsym.create(sorg,hp2.globalsymtable);
  424. { never claim about unused unit if
  425. there is init or finalize code PM }
  426. if (hp2.flags and (uf_init or uf_finalize))<>0 then
  427. inc(unitsym.refs);
  428. refsymtable.insert(unitsym);
  429. end
  430. else
  431. Message1(sym_e_duplicate_id,s);
  432. if token=_COMMA then
  433. begin
  434. pattern:='';
  435. consume(_COMMA);
  436. end
  437. else
  438. break;
  439. until false;
  440. consume(_SEMICOLON);
  441. { set the symtable to systemunit so it gets reorderd correctly }
  442. symtablestack:=defaultsymtablestack;
  443. { now insert the units in the symtablestack }
  444. hp:=tused_unit(current_module.used_units.first);
  445. while assigned(hp) do
  446. begin
  447. {$IfDef GDB}
  448. if (cs_debuginfo in aktmoduleswitches) and
  449. (cs_gdb_dbx in aktglobalswitches) and
  450. not hp.is_stab_written then
  451. begin
  452. tglobalsymtable(hp.u.globalsymtable).concattypestabto(debuglist);
  453. hp.is_stab_written:=true;
  454. hp.unitid:=tsymtable(hp.u.globalsymtable).unitid;
  455. end;
  456. {$EndIf GDB}
  457. if hp.in_uses then
  458. begin
  459. hp3:=symtablestack;
  460. while assigned(hp3) do
  461. begin
  462. { insert units only once ! }
  463. if hp.u.globalsymtable=hp3 then
  464. break;
  465. hp3:=hp3.next;
  466. { unit isn't inserted }
  467. if hp3=nil then
  468. begin
  469. tsymtable(hp.u.globalsymtable).next:=symtablestack;
  470. symtablestack:=tsymtable(hp.u.globalsymtable);
  471. {$ifdef CHAINPROCSYMS}
  472. symtablestack.chainprocsyms;
  473. {$endif CHAINPROCSYMS}
  474. {$ifdef DEBUG}
  475. test_symtablestack;
  476. {$endif DEBUG}
  477. end;
  478. end;
  479. end;
  480. hp:=tused_unit(hp.next);
  481. end;
  482. aktprocsym:=oldprocsym;
  483. end;
  484. procedure write_gdb_info;
  485. {$IfDef GDB}
  486. var
  487. hp : tused_unit;
  488. begin
  489. if not (cs_debuginfo in aktmoduleswitches) then
  490. exit;
  491. if (cs_gdb_dbx in aktglobalswitches) then
  492. begin
  493. debugList.concat(Tai_asm_comment.Create(strpnew('EINCL of global '+
  494. tglobalsymtable(current_module.globalsymtable).name^+' has index '+
  495. tostr(tglobalsymtable(current_module.globalsymtable).unitid))));
  496. debugList.concat(Tai_stabs.Create(strpnew('"'+
  497. tglobalsymtable(current_module.globalsymtable).name^+'",'+
  498. tostr(N_EINCL)+',0,0,0')));
  499. tglobalsymtable(current_module.globalsymtable).dbx_count_ok:={true}false;
  500. dbx_counter:=tglobalsymtable(current_module.globalsymtable).prev_dbx_counter;
  501. do_count_dbx:=false;
  502. end;
  503. { now insert the units in the symtablestack }
  504. hp:=tused_unit(current_module.used_units.first);
  505. while assigned(hp) do
  506. begin
  507. if (cs_debuginfo in aktmoduleswitches) and
  508. not hp.is_stab_written then
  509. begin
  510. tglobalsymtable(hp.u.globalsymtable).concattypestabto(debuglist);
  511. hp.is_stab_written:=true;
  512. hp.unitid:=tsymtable(hp.u.globalsymtable).unitid;
  513. end;
  514. hp:=tused_unit(hp.next);
  515. end;
  516. if current_module.in_implementation and
  517. assigned(current_module.localsymtable) then
  518. begin
  519. { all types }
  520. tstaticsymtable(current_module.localsymtable).concattypestabto(debuglist);
  521. { and all local symbols}
  522. tstaticsymtable(current_module.localsymtable).concatstabto(debuglist);
  523. end
  524. else if assigned(current_module.globalsymtable) then
  525. begin
  526. { all types }
  527. tglobalsymtable(current_module.globalsymtable).concattypestabto(debuglist);
  528. { and all local symbols}
  529. tglobalsymtable(current_module.globalsymtable).concatstabto(debuglist);
  530. end;
  531. end;
  532. {$Else GDB}
  533. begin
  534. end;
  535. {$EndIf GDB}
  536. procedure parse_implementation_uses(symt:tsymtable);
  537. begin
  538. if token=_USES then
  539. begin
  540. loadunits;
  541. {$ifdef DEBUG}
  542. test_symtablestack;
  543. {$endif DEBUG}
  544. end;
  545. end;
  546. procedure setupglobalswitches;
  547. begin
  548. { can't have local browser when no global browser }
  549. if (cs_local_browser in aktmoduleswitches) and
  550. not(cs_browser in aktmoduleswitches) then
  551. exclude(aktmoduleswitches,cs_local_browser);
  552. { define a symbol in delphi,objfpc,tp,gpc mode }
  553. if (m_delphi in aktmodeswitches) then
  554. current_scanner.def_macro('FPC_DELPHI')
  555. else
  556. if (m_tp in aktmodeswitches) then
  557. current_scanner.def_macro('FPC_TP')
  558. else
  559. if (m_objfpc in aktmodeswitches) then
  560. current_scanner.def_macro('FPC_OBJFPC')
  561. else
  562. if (m_gpc in aktmodeswitches) then
  563. current_scanner.def_macro('FPC_GPC');
  564. end;
  565. procedure gen_main_procsym(const name:string;options:tproctypeoption;st:tsymtable);
  566. var
  567. stt : tsymtable;
  568. begin
  569. {Generate a procsym for main}
  570. make_ref:=false;
  571. aktprocsym:=tprocsym.create('$'+name);
  572. { main are allways used }
  573. inc(aktprocsym.refs);
  574. {Try to insert in in static symtable ! }
  575. stt:=symtablestack;
  576. symtablestack:=st;
  577. aktprocsym.definition:=tprocdef.create;
  578. symtablestack:=stt;
  579. aktprocsym.definition.proctypeoption:=options;
  580. aktprocsym.definition.setmangledname(target_info.cprefix+name);
  581. aktprocsym.definition.forwarddef:=false;
  582. make_ref:=true;
  583. { The localst is a local symtable. Change it into the static
  584. symtable }
  585. aktprocsym.definition.localst.free;
  586. aktprocsym.definition.localst:=st;
  587. { and insert the procsym in symtable }
  588. st.insert(aktprocsym);
  589. { set some informations about the main program }
  590. with procinfo^ do
  591. begin
  592. returntype:=voidtype;
  593. _class:=nil;
  594. para_offset:=8;
  595. framepointer:=frame_pointer;
  596. flags:=0;
  597. end;
  598. end;
  599. procedure proc_unit;
  600. function is_assembler_generated:boolean;
  601. begin
  602. is_assembler_generated:=(Errorcount=0) and
  603. not(
  604. codeSegment.empty and
  605. dataSegment.empty and
  606. bssSegment.empty and
  607. ((importssection=nil) or importsSection.empty) and
  608. ((resourcesection=nil) or resourceSection.empty) and
  609. ((resourcestringlist=nil) or resourcestringList.empty)
  610. );
  611. end;
  612. var
  613. main_file: tinputfile;
  614. st : tsymtable;
  615. unitst : tglobalsymtable;
  616. {$ifdef GDB}
  617. pu : tused_unit;
  618. {$endif GDB}
  619. store_crc,store_interface_crc : cardinal;
  620. s2 : ^string; {Saves stack space}
  621. force_init_final : boolean;
  622. begin
  623. consume(_UNIT);
  624. if token=_ID then
  625. begin
  626. { create filenames and unit name }
  627. main_file := current_scanner.inputfile;
  628. while assigned(main_file.next) do
  629. main_file := main_file.next;
  630. current_module.SetFileName(main_file.path^+main_file.name^,true);
  631. stringdispose(current_module.modulename);
  632. stringdispose(current_module.realmodulename);
  633. current_module.modulename:=stringdup(pattern);
  634. current_module.realmodulename:=stringdup(orgpattern);
  635. { check for system unit }
  636. new(s2);
  637. s2^:=upper(SplitName(main_file.name^));
  638. if (cs_check_unit_name in aktglobalswitches) and
  639. not((current_module.modulename^=s2^) or
  640. ((length(current_module.modulename^)>8) and
  641. (copy(current_module.modulename^,1,8)=s2^))) then
  642. Message1(unit_e_illegal_unit_name,current_module.realmodulename^);
  643. if (current_module.modulename^='SYSTEM') then
  644. include(aktmoduleswitches,cs_compilesystem);
  645. dispose(s2);
  646. end;
  647. consume(_ID);
  648. consume(_SEMICOLON);
  649. consume(_INTERFACE);
  650. { global switches are read, so further changes aren't allowed }
  651. current_module.in_global:=false;
  652. { handle the global switches }
  653. setupglobalswitches;
  654. Message1(unit_u_start_parse_interface,current_module.realmodulename^);
  655. { update status }
  656. status.currentmodule:=current_module.realmodulename^;
  657. { maybe turn off m_objpas if we are compiling objpas }
  658. if (current_module.modulename^='OBJPAS') then
  659. exclude(aktmodeswitches,m_objpas);
  660. { this should be placed after uses !!}
  661. {$ifndef UseNiceNames}
  662. procprefix:='_'+current_module.modulename^+'$$';
  663. {$else UseNiceNames}
  664. procprefix:='_'+tostr(length(current_module.modulename^))+lowercase(current_module.modulename^)+'_';
  665. {$endif UseNiceNames}
  666. parse_only:=true;
  667. { generate now the global symboltable }
  668. st:=tglobalsymtable.create(current_module.modulename^);
  669. refsymtable:=st;
  670. unitst:=tglobalsymtable(st);
  671. { define first as local to overcome dependency conflicts }
  672. current_module.localsymtable:=st;
  673. { the unit name must be usable as a unit specifier }
  674. { inside the unit itself (PM) }
  675. { this also forbids to have another symbol }
  676. { with the same name as the unit }
  677. refsymtable.insert(tunitsym.create(current_module.realmodulename^,unitst));
  678. { load default units, like the system unit }
  679. loaddefaultunits;
  680. { reset }
  681. make_ref:=true;
  682. lexlevel:=0;
  683. { insert qualifier for the system unit (allows system.writeln) }
  684. if not(cs_compilesystem in aktmoduleswitches) then
  685. begin
  686. if token=_USES then
  687. begin
  688. loadunits;
  689. { has it been compiled at a higher level ?}
  690. if current_module.compiled then
  691. begin
  692. { this unit symtable is obsolete }
  693. { dispose(unitst,done);
  694. disposed as localsymtable !! }
  695. RestoreUnitSyms;
  696. exit;
  697. end;
  698. end;
  699. { ... but insert the symbol table later }
  700. st.next:=symtablestack;
  701. symtablestack:=st;
  702. end
  703. else
  704. { while compiling a system unit, some types are directly inserted }
  705. begin
  706. st.next:=symtablestack;
  707. symtablestack:=st;
  708. insert_intern_types(st);
  709. end;
  710. { now we know the place to insert the constants }
  711. constsymtable:=symtablestack;
  712. { move the global symtab from the temporary local to global }
  713. current_module.globalsymtable:=current_module.localsymtable;
  714. current_module.localsymtable:=nil;
  715. reset_global_defs;
  716. { number all units, so we know if a unit is used by this unit or
  717. needs to be added implicitly }
  718. current_module.numberunits;
  719. { ... parse the declarations }
  720. Message1(parser_u_parsing_interface,current_module.realmodulename^);
  721. read_interface_declarations;
  722. { leave when we got an error }
  723. if (Errorcount>0) and not status.skip_error then
  724. begin
  725. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  726. status.skip_error:=true;
  727. exit;
  728. end;
  729. {else in inteface its somatimes necessary even if unused
  730. st^.allunitsused; }
  731. {$ifdef New_GDB}
  732. write_gdb_info;
  733. {$endIf Def New_GDB}
  734. if not(cs_compilesystem in aktmoduleswitches) then
  735. if (Errorcount=0) then
  736. tppumodule(current_module).getppucrc;
  737. { Parse the implementation section }
  738. consume(_IMPLEMENTATION);
  739. current_module.in_implementation:=true;
  740. Message1(unit_u_start_parse_implementation,current_module.modulename^);
  741. parse_only:=false;
  742. { generates static symbol table }
  743. st:=tstaticsymtable.create(current_module.modulename^);
  744. current_module.localsymtable:=st;
  745. { remove the globalsymtable from the symtable stack }
  746. { to reinsert it after loading the implementation units }
  747. symtablestack:=unitst.next;
  748. { we don't want implementation units symbols in unitsymtable !! PM }
  749. refsymtable:=st;
  750. { Read the implementation units }
  751. parse_implementation_uses(unitst);
  752. if current_module.compiled then
  753. begin
  754. RestoreUnitSyms;
  755. exit;
  756. end;
  757. { reset ranges/stabs in exported definitions }
  758. reset_global_defs;
  759. { All units are read, now give them a number }
  760. current_module.numberunits;
  761. { now we can change refsymtable }
  762. refsymtable:=st;
  763. { but reinsert the global symtable as lasts }
  764. unitst.next:=symtablestack;
  765. symtablestack:=unitst;
  766. tstoredsymtable(symtablestack).chainoperators;
  767. {$ifdef DEBUG}
  768. test_symtablestack;
  769. {$endif DEBUG}
  770. constsymtable:=symtablestack;
  771. {$ifdef Splitheap}
  772. if testsplit then
  773. begin
  774. Split_Heap;
  775. allow_special:=true;
  776. Switch_to_temp_heap;
  777. end;
  778. { it will report all crossings }
  779. allow_special:=false;
  780. {$endif Splitheap}
  781. Message1(parser_u_parsing_implementation,current_module.realmodulename^);
  782. { Compile the unit }
  783. codegen_newprocedure;
  784. gen_main_procsym(current_module.modulename^+'_init',potype_unitinit,st);
  785. aktprocsym.definition.aliasnames.insert('INIT$$'+current_module.modulename^);
  786. aktprocsym.definition.aliasnames.insert(target_info.cprefix+current_module.modulename^+'_init');
  787. compile_proc_body(true,false);
  788. codegen_doneprocedure;
  789. { avoid self recursive destructor call !! PM }
  790. aktprocsym.definition.localst:=nil;
  791. { if the unit contains ansi/widestrings, initialization and
  792. finalization code must be forced }
  793. force_init_final:=tglobalsymtable(current_module.globalsymtable).needs_init_final or
  794. tstaticsymtable(current_module.localsymtable).needs_init_final;
  795. { should we force unit initialization? }
  796. { this is a hack, but how can it be done better ? }
  797. if force_init_final and ((current_module.flags and uf_init)=0) then
  798. begin
  799. current_module.flags:=current_module.flags or uf_init;
  800. { now we can insert a cut }
  801. if (cs_create_smart in aktmoduleswitches) then
  802. codeSegment.concat(Tai_cut.Create);
  803. genimplicitunitinit(codesegment);
  804. end;
  805. { finalize? }
  806. if token=_FINALIZATION then
  807. begin
  808. { set module options }
  809. current_module.flags:=current_module.flags or uf_finalize;
  810. { Compile the finalize }
  811. codegen_newprocedure;
  812. gen_main_procsym(current_module.modulename^+'_finalize',potype_unitfinalize,st);
  813. aktprocsym.definition.aliasnames.insert('FINALIZE$$'+current_module.modulename^);
  814. aktprocsym.definition.aliasnames.insert(target_info.cprefix+current_module.modulename^+'_finalize');
  815. compile_proc_body(true,false);
  816. codegen_doneprocedure;
  817. end
  818. else if force_init_final then
  819. begin
  820. current_module.flags:=current_module.flags or uf_finalize;
  821. { now we can insert a cut }
  822. if (cs_create_smart in aktmoduleswitches) then
  823. codeSegment.concat(Tai_cut.Create);
  824. genimplicitunitfinal(codesegment);
  825. end;
  826. { the last char should always be a point }
  827. consume(_POINT);
  828. If ResourceStrings.ResStrCount>0 then
  829. begin
  830. ResourceStrings.CreateResourceStringList;
  831. current_module.flags:=current_module.flags or uf_has_resources;
  832. { only write if no errors found }
  833. if (Errorcount=0) then
  834. ResourceStrings.WriteResourceFile(ForceExtension(current_module.ppufilename^,'.rst'));
  835. end;
  836. { avoid self recursive destructor call !! PM }
  837. aktprocsym.definition.localst:=nil;
  838. { absence does not matter here !! }
  839. aktprocsym.definition.forwarddef:=false;
  840. { test static symtable }
  841. if (Errorcount=0) then
  842. begin
  843. tstoredsymtable(st).allsymbolsused;
  844. tstoredsymtable(st).allunitsused;
  845. tstoredsymtable(st).allprivatesused;
  846. end;
  847. { size of the static data }
  848. datasize:=st.datasize;
  849. {$ifdef GDB}
  850. { add all used definitions even for implementation}
  851. if (cs_debuginfo in aktmoduleswitches) then
  852. begin
  853. {$IfnDef New_GDB}
  854. if assigned(current_module.globalsymtable) then
  855. begin
  856. { all types }
  857. tglobalsymtable(current_module.globalsymtable).concattypestabto(debuglist);
  858. { and all local symbols}
  859. tglobalsymtable(current_module.globalsymtable).concatstabto(debuglist);
  860. end;
  861. { all local types }
  862. tglobalsymtable(st)^.concattypestabto(debuglist);
  863. { and all local symbols}
  864. st^.concatstabto(debuglist);
  865. {$else New_GDB}
  866. write_gdb_info;
  867. {$endIf Def New_GDB}
  868. end;
  869. {$endif GDB}
  870. reset_global_defs;
  871. { tests, if all (interface) forwards are resolved }
  872. if (Errorcount=0) then
  873. begin
  874. tstoredsymtable(symtablestack).check_forwards;
  875. tstoredsymtable(symtablestack).allprivatesused;
  876. end;
  877. current_module.in_implementation:=false;
  878. {$ifdef GDB}
  879. tglobalsymtable(symtablestack).is_stab_written:=false;
  880. {$endif GDB}
  881. { leave when we got an error }
  882. if (Errorcount>0) and not status.skip_error then
  883. begin
  884. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  885. status.skip_error:=true;
  886. exit;
  887. end;
  888. { generate imports }
  889. if current_module.uses_imports then
  890. importlib.generatelib;
  891. { insert own objectfile, or say that it's in a library
  892. (no check for an .o when loading) }
  893. if is_assembler_generated then
  894. insertobjectfile
  895. else
  896. current_module.flags:=current_module.flags or uf_no_link;
  897. if cs_local_browser in aktmoduleswitches then
  898. current_module.localsymtable:=refsymtable;
  899. {$ifdef GDB}
  900. pu:=tused_unit(usedunits.first);
  901. while assigned(pu) do
  902. begin
  903. if assigned(pu.u.globalsymtable) then
  904. tglobalsymtable(pu.u.globalsymtable).is_stab_written:=false;
  905. pu:=tused_unit(pu.next);
  906. end;
  907. {$endif GDB}
  908. if is_assembler_generated then
  909. begin
  910. { finish asmlist by adding segment starts }
  911. insertsegment;
  912. { assemble }
  913. create_objectfile;
  914. end;
  915. { Write out the ppufile after the object file has been created }
  916. store_interface_crc:=current_module.interface_crc;
  917. store_crc:=current_module.crc;
  918. if (Errorcount=0) then
  919. tppumodule(current_module).writeppu;
  920. if not(cs_compilesystem in aktmoduleswitches) then
  921. if store_interface_crc<>current_module.interface_crc then
  922. Comment(V_Warning,current_module.ppufilename^+' Interface CRC changed '+
  923. hexstr(store_crc,8)+'<>'+hexstr(current_module.interface_crc,8));
  924. {$ifdef EXTDEBUG}
  925. if not(cs_compilesystem in aktmoduleswitches) then
  926. if (store_crc<>current_module.crc) and simplify_ppu then
  927. Comment(V_Warning,current_module.ppufilename^+' implementation CRC changed '+
  928. hexstr(store_crc,8)+'<>'+hexstr(current_module.interface_crc,8));
  929. {$endif EXTDEBUG}
  930. { remove static symtable (=refsymtable) here to save some mem }
  931. if not (cs_local_browser in aktmoduleswitches) then
  932. begin
  933. st.free;
  934. current_module.localsymtable:=nil;
  935. end;
  936. RestoreUnitSyms;
  937. { leave when we got an error }
  938. if (Errorcount>0) and not status.skip_error then
  939. begin
  940. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  941. status.skip_error:=true;
  942. exit;
  943. end;
  944. end;
  945. procedure proc_program(islibrary : boolean);
  946. var
  947. main_file: tinputfile;
  948. st : tsymtable;
  949. hp : tmodule;
  950. begin
  951. DLLsource:=islibrary;
  952. IsExe:=true;
  953. parse_only:=false;
  954. { relocation works only without stabs under win32 !! PM }
  955. { internal assembler uses rva for stabs info
  956. so it should work with relocated DLLs }
  957. if RelocSection and
  958. (target_info.target=target_i386_win32) and
  959. (target_info.assem<>as_i386_pecoff) then
  960. begin
  961. include(aktglobalswitches,cs_link_strip);
  962. { Warning stabs info does not work with reloc section !! }
  963. if cs_debuginfo in aktmoduleswitches then
  964. begin
  965. Message1(parser_w_parser_reloc_no_debug,current_module.mainsource^);
  966. Message(parser_w_parser_win32_debug_needs_WN);
  967. exclude(aktmoduleswitches,cs_debuginfo);
  968. end;
  969. end;
  970. { get correct output names }
  971. main_file := current_scanner.inputfile;
  972. while assigned(main_file.next) do
  973. main_file := main_file.next;
  974. current_module.SetFileName(main_file.path^+main_file.name^,true);
  975. if islibrary then
  976. begin
  977. consume(_LIBRARY);
  978. stringdispose(current_module.modulename);
  979. current_module.modulename:=stringdup(pattern);
  980. current_module.islibrary:=true;
  981. exportlib.preparelib(pattern);
  982. consume(_ID);
  983. consume(_SEMICOLON);
  984. end
  985. else
  986. { is there an program head ? }
  987. if token=_PROGRAM then
  988. begin
  989. consume(_PROGRAM);
  990. stringdispose(current_module.modulename);
  991. stringdispose(current_module.realmodulename);
  992. current_module.modulename:=stringdup(pattern);
  993. current_module.realmodulename:=stringdup(orgpattern);
  994. if (target_info.target=target_i386_WIN32) then
  995. exportlib.preparelib(pattern);
  996. consume(_ID);
  997. if token=_LKLAMMER then
  998. begin
  999. consume(_LKLAMMER);
  1000. idlist;
  1001. consume(_RKLAMMER);
  1002. end;
  1003. consume(_SEMICOLON);
  1004. end
  1005. else if (target_info.target=target_i386_WIN32) then
  1006. exportlib.preparelib(current_module.modulename^);
  1007. { global switches are read, so further changes aren't allowed }
  1008. current_module.in_global:=false;
  1009. { setup things using the global switches }
  1010. setupglobalswitches;
  1011. { set implementation flag }
  1012. current_module.in_implementation:=true;
  1013. { insert after the unit symbol tables the static symbol table }
  1014. { of the program }
  1015. st:=tstaticsymtable.create(current_module.modulename^);;
  1016. current_module.localsymtable:=st;
  1017. refsymtable:=st;
  1018. { load standard units (system,objpas,profile unit) }
  1019. loaddefaultunits;
  1020. { reset }
  1021. lexlevel:=0;
  1022. {Load the units used by the program we compile.}
  1023. if token=_USES then
  1024. loadunits;
  1025. tstoredsymtable(symtablestack).chainoperators;
  1026. { reset ranges/stabs in exported definitions }
  1027. reset_global_defs;
  1028. { All units are read, now give them a number }
  1029. current_module.numberunits;
  1030. {Insert the name of the main program into the symbol table.}
  1031. if current_module.realmodulename^<>'' then
  1032. st.insert(tunitsym.create(current_module.realmodulename^,tglobalsymtable(st)));
  1033. { ...is also constsymtable, this is the symtable where }
  1034. { the elements of enumeration types are inserted }
  1035. constsymtable:=st;
  1036. Message1(parser_u_parsing_implementation,current_module.mainsource^);
  1037. { reset }
  1038. procprefix:='';
  1039. {The program intialization needs an alias, so it can be called
  1040. from the bootstrap code.}
  1041. codegen_newprocedure;
  1042. gen_main_procsym('main',potype_proginit,st);
  1043. aktprocsym.definition.aliasnames.insert('program_init');
  1044. aktprocsym.definition.aliasnames.insert('PASCALMAIN');
  1045. aktprocsym.definition.aliasnames.insert(target_info.cprefix+'main');
  1046. {$ifdef m68k}
  1047. if target_info.target=target_m68k_PalmOS then
  1048. aktprocsym.definition.aliasnames.insert('PilotMain');
  1049. {$endif m68k}
  1050. compile_proc_body(true,false);
  1051. { avoid self recursive destructor call !! PM }
  1052. aktprocsym.definition.localst:=nil;
  1053. { consider these symbols as global ones for browser
  1054. but the typecasting of the globalsymtable with tglobalsymtable
  1055. can then lead to problems (PFV)
  1056. current_module.globalsymtable:=current_module.localsymtable;
  1057. current_module.localsymtable:=nil;}
  1058. If ResourceStrings.ResStrCount>0 then
  1059. begin
  1060. ResourceStrings.CreateResourceStringList;
  1061. { only write if no errors found }
  1062. if (Errorcount=0) then
  1063. ResourceStrings.WriteResourceFile(ForceExtension(current_module.ppufilename^,'.rst'));
  1064. end;
  1065. codegen_doneprocedure;
  1066. { finalize? }
  1067. if token=_FINALIZATION then
  1068. begin
  1069. { set module options }
  1070. current_module.flags:=current_module.flags or uf_finalize;
  1071. { Compile the finalize }
  1072. codegen_newprocedure;
  1073. gen_main_procsym(current_module.modulename^+'_finalize',potype_unitfinalize,st);
  1074. aktprocsym.definition.aliasnames.insert('FINALIZE$$'+current_module.modulename^);
  1075. aktprocsym.definition.aliasnames.insert(target_info.cprefix+current_module.modulename^+'_finalize');
  1076. compile_proc_body(true,false);
  1077. codegen_doneprocedure;
  1078. end;
  1079. { consume the last point }
  1080. consume(_POINT);
  1081. {$ifdef New_GDB}
  1082. write_gdb_info;
  1083. {$endIf Def New_GDB}
  1084. { leave when we got an error }
  1085. if (Errorcount>0) and not status.skip_error then
  1086. begin
  1087. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1088. status.skip_error:=true;
  1089. exit;
  1090. end;
  1091. { test static symtable }
  1092. if (Errorcount=0) then
  1093. begin
  1094. tstoredsymtable(st).allsymbolsused;
  1095. tstoredsymtable(st).allunitsused;
  1096. tstoredsymtable(st).allprivatesused;
  1097. end;
  1098. { generate imports }
  1099. if current_module.uses_imports then
  1100. importlib.generatelib;
  1101. if islibrary or
  1102. (target_info.target=target_i386_WIN32) then
  1103. exportlib.generatelib;
  1104. { insert heap }
  1105. insertResourceTablesTable;
  1106. insertinitfinaltable;
  1107. insertheap;
  1108. inserttargetspecific;
  1109. datasize:=symtablestack.datasize;
  1110. { finish asmlist by adding segment starts }
  1111. insertsegment;
  1112. { insert own objectfile }
  1113. insertobjectfile;
  1114. { assemble and link }
  1115. create_objectfile;
  1116. { leave when we got an error }
  1117. if (Errorcount>0) and not status.skip_error then
  1118. begin
  1119. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1120. status.skip_error:=true;
  1121. exit;
  1122. end;
  1123. { create the executable when we are at level 1 }
  1124. if (compile_level=1) then
  1125. begin
  1126. { insert all .o files from all loaded units }
  1127. hp:=tmodule(loaded_units.first);
  1128. while assigned(hp) do
  1129. begin
  1130. linker.AddModuleFiles(hp);
  1131. hp:=tmodule(hp.next);
  1132. end;
  1133. { write .def file }
  1134. if (cs_link_deffile in aktglobalswitches) then
  1135. deffile.writefile;
  1136. { finally we can create a executable }
  1137. if (not current_module.is_unit) then
  1138. begin
  1139. if DLLSource then
  1140. linker.MakeSharedLibrary
  1141. else
  1142. linker.MakeExecutable;
  1143. end;
  1144. end;
  1145. end;
  1146. end.
  1147. {
  1148. $Log$
  1149. Revision 1.31 2001-05-09 14:11:10 jonas
  1150. * range check error fixes from Peter
  1151. Revision 1.30 2001/05/06 14:49:17 peter
  1152. * ppu object to class rewrite
  1153. * move ppu read and write stuff to fppu
  1154. Revision 1.29 2001/04/18 22:01:57 peter
  1155. * registration of targets and assemblers
  1156. Revision 1.28 2001/04/13 18:08:37 peter
  1157. * scanner object to class
  1158. Revision 1.27 2001/04/13 01:22:12 peter
  1159. * symtable change to classes
  1160. * range check generation and errors fixed, make cycle DEBUG=1 works
  1161. * memory leaks fixed
  1162. Revision 1.26 2001/04/02 21:20:33 peter
  1163. * resulttype rewrite
  1164. Revision 1.25 2001/03/13 18:45:07 peter
  1165. * fixed some memory leaks
  1166. Revision 1.24 2001/03/06 18:28:02 peter
  1167. * patch from Pavel with a new and much faster DLL Scanner for
  1168. automatic importing so $linklib works for DLLs. Thanks Pavel!
  1169. Revision 1.23 2001/02/24 10:44:56 peter
  1170. * generate .rst from ppufilename instead of modulename
  1171. Revision 1.22 2001/02/21 19:37:19 peter
  1172. * moved deref to be done after loading of implementation units. prederef
  1173. is still done directly after loading of symbols and definitions.
  1174. Revision 1.21 2001/01/14 22:13:52 peter
  1175. * fixed crash with program name as a important unit name
  1176. Revision 1.20 2000/12/25 00:07:27 peter
  1177. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1178. tlinkedlist objects)
  1179. Revision 1.19 2000/11/29 00:30:36 florian
  1180. * unused units removed from uses clause
  1181. * some changes for widestrings
  1182. Revision 1.18 2000/11/01 23:04:37 peter
  1183. * tprocdef.fullprocname added for better casesensitve writing of
  1184. procedures
  1185. Revision 1.17 2000/10/31 22:02:50 peter
  1186. * symtable splitted, no real code changes
  1187. Revision 1.16 2000/10/21 14:36:26 peter
  1188. * merged pierres fixes
  1189. Revision 1.15 2000/10/15 09:08:58 peter
  1190. * use System for the systemunit instead of target dependent
  1191. Revision 1.14 2000/10/15 07:47:51 peter
  1192. * unit names and procedure names are stored mixed case
  1193. Revision 1.13 2000/10/04 14:51:08 pierre
  1194. * IsExe restored
  1195. Revision 1.12 2000/09/30 16:07:40 peter
  1196. * filepos when unit not found (merged)
  1197. Revision 1.11 2000/09/24 21:33:47 peter
  1198. * message updates merges
  1199. Revision 1.10 2000/09/24 15:06:22 peter
  1200. * use defines.inc
  1201. Revision 1.9 2000/08/31 07:53:02 michael
  1202. + Applied patch from Peter
  1203. Revision 1.8 2000/08/29 19:00:01 peter
  1204. * _init and _finalize procsyms also need a $ prefix
  1205. Revision 1.7 2000/08/27 20:19:39 peter
  1206. * store strings with case in ppu, when an internal symbol is created
  1207. a '$' is prefixed so it's not automatic uppercased
  1208. Revision 1.6 2000/08/27 16:11:52 peter
  1209. * moved some util functions from globals,cobjects to cutils
  1210. * splitted files into finput,fmodule
  1211. Revision 1.5 2000/08/25 08:48:22 jonas
  1212. * fixed bug with include files at the very beginning of .pp/.pas files
  1213. (wrong name used for generating exe/checking unit name) (merged from
  1214. fixes branch)
  1215. Revision 1.4 2000/08/21 11:27:44 pierre
  1216. * fix the stabs problems
  1217. Revision 1.3 2000/07/13 12:08:26 michael
  1218. + patched to 1.1.0 with former 1.09patch from peter
  1219. Revision 1.2 2000/07/13 11:32:45 michael
  1220. + removed logs
  1221. }