pmodules.pas 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365
  1. {
  2. $Id$
  3. Copyright (c) 1998 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. {.$define TEST_IMPL does not work well }
  20. interface
  21. procedure proc_unit;
  22. procedure proc_program(islibrary : boolean);
  23. implementation
  24. uses
  25. cobjects,comphook,systems,globals,
  26. symtable,aasm,files,
  27. hcodegen,verbose,
  28. link,assemble,import,gendef,ppu
  29. {$ifdef i386}
  30. ,i386
  31. {$endif}
  32. {$ifdef m68k}
  33. ,m68k
  34. {$endif}
  35. ,scanner,pbase,psystem,pdecl,psub,parser;
  36. procedure create_objectfile;
  37. begin
  38. { create the .s file and assemble it }
  39. GenerateAsm;
  40. { When creating a library call the linker. And insert the output
  41. of the linker files }
  42. if (cs_create_sharedlib in aktmoduleswitches) then
  43. Linker.MakeSharedLibrary
  44. else
  45. if (cs_create_staticlib in aktmoduleswitches) or
  46. (cs_smartlink in aktmoduleswitches) then
  47. Linker.MakeStaticLibrary(SmartLinkFilesCnt);
  48. { add the files for the linker from current_module }
  49. Linker.AddModuleFiles(current_module);
  50. end;
  51. procedure insertobjectfile;
  52. { Insert the used object file for this unit in the used list for this unit }
  53. begin
  54. if (cs_create_sharedlib in aktmoduleswitches) then
  55. current_module^.linksharedlibs.insert(current_module^.sharedlibfilename^)
  56. else
  57. begin
  58. if (cs_create_staticlib in aktmoduleswitches) or
  59. (cs_smartlink in aktmoduleswitches) then
  60. current_module^.linkstaticlibs.insert(current_module^.staticlibfilename^)
  61. else
  62. current_module^.linkofiles.insert(current_module^.objfilename^);
  63. end;
  64. end;
  65. procedure insertsegment;
  66. procedure fixseg(p:paasmoutput;sec:tsection);
  67. begin
  68. p^.insert(new(pai_section,init(sec)));
  69. if (cs_smartlink in aktmoduleswitches) then
  70. p^.insert(new(pai_cut,init));
  71. p^.concat(new(pai_section,init(sec_none)));
  72. end;
  73. begin
  74. {Insert Ident of the compiler}
  75. if (not (cs_smartlink in aktmoduleswitches))
  76. {$ifndef EXTDEBUG}
  77. and (not current_module^.is_unit)
  78. {$endif}
  79. then
  80. begin
  81. datasegment^.insert(new(pai_align,init(4)));
  82. datasegment^.insert(new(pai_string,init('FPC '+version_string+' for '+target_string+' - '+target_info.short_name)));
  83. end;
  84. { Insert start and end of sections }
  85. fixseg(codesegment,sec_code);
  86. fixseg(datasegment,sec_data);
  87. fixseg(bsssegment,sec_bss);
  88. fixseg(consts,sec_data);
  89. end;
  90. procedure insertheap;
  91. begin
  92. if (cs_smartlink in aktmoduleswitches) then
  93. begin
  94. bsssegment^.concat(new(pai_cut,init));
  95. datasegment^.concat(new(pai_cut,init));
  96. end;
  97. { On the Macintosh Classic M68k Architecture
  98. The Heap variable is simply a POINTER to the
  99. real HEAP. The HEAP must be set up by the RTL
  100. and must store the pointer in this value.
  101. On OS/2 the heap is also intialized by the RTL. We do
  102. not output a pointer }
  103. case target_info.target of
  104. {$ifdef i386}
  105. target_OS2 : ;
  106. {$endif i386}
  107. {$ifdef m68k}
  108. target_Mac68K : bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)));
  109. {$endif m68k}
  110. else
  111. bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
  112. end;
  113. {$ifdef i386}
  114. datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
  115. {$endif i386}
  116. {$ifdef m68k}
  117. datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
  118. {$endif m68k}
  119. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  120. end;
  121. procedure inserttargetspecific;
  122. begin
  123. case target_info.target of
  124. {$ifdef i386}
  125. target_GO32V2 : begin
  126. { stacksize can be specified }
  127. datasegment^.concat(new(pai_symbol,init_global('__stklen')));
  128. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  129. end;
  130. target_WIN32 : begin
  131. { Generate an external entry to be sure that _mainCRTStarup will be
  132. linked, can't use concat_external because those aren't written for
  133. asw (PFV) }
  134. datasegment^.concat(new(pai_const,init_symbol('_mainCRTStartup')));
  135. end;
  136. {$endif i386}
  137. {$ifdef m68k}
  138. target_Atari : begin
  139. { stacksize can be specified }
  140. datasegment^.concat(new(pai_symbol,init_global('__stklen')));
  141. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  142. end;
  143. {$endif m68k}
  144. end;
  145. end;
  146. function loadunit(const s : string;compile_system:boolean) : pmodule;forward;
  147. procedure load_usedunits(compile_system:boolean);
  148. var
  149. pu : pused_unit;
  150. loaded_unit : pmodule;
  151. nextmapentry : longint;
  152. begin
  153. { init the map }
  154. new(current_module^.map);
  155. fillchar(current_module^.map^,sizeof(tunitmap),#0);
  156. {$ifdef NEWMAP}
  157. current_module^.map^[0]:=current_module;
  158. {$endif NEWMAP}
  159. nextmapentry:=1;
  160. { load the used units from interface }
  161. current_module^.in_implementation:=false;
  162. pu:=pused_unit(current_module^.used_units.first);
  163. while assigned(pu) do
  164. begin
  165. if (not pu^.loaded) and (pu^.in_interface) then
  166. begin
  167. loaded_unit:=loadunit(pu^.name^,false);
  168. if current_module^.compiled then
  169. exit;
  170. { register unit in used units }
  171. pu^.u:=loaded_unit;
  172. pu^.loaded:=true;
  173. { need to recompile the current unit ? }
  174. if loaded_unit^.crc<>pu^.checksum then
  175. begin
  176. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^);
  177. current_module^.do_compile:=true;
  178. dispose(current_module^.map);
  179. current_module^.map:=nil;
  180. exit;
  181. end;
  182. { setup the map entry for deref }
  183. {$ifndef NEWMAP}
  184. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  185. {$else NEWMAP}
  186. current_module^.map^[nextmapentry]:=loaded_unit;
  187. {$endif NEWMAP}
  188. inc(nextmapentry);
  189. if nextmapentry>maxunits then
  190. Message(unit_f_too_much_units);
  191. end;
  192. pu:=pused_unit(pu^.next);
  193. end;
  194. { ok, now load the unit }
  195. current_module^.globalsymtable:=new(punitsymtable,loadasunit);
  196. { if this is the system unit insert the intern symbols }
  197. if compile_system then
  198. begin
  199. make_ref:=false;
  200. insertinternsyms(psymtable(current_module^.globalsymtable));
  201. make_ref:=true;
  202. end;
  203. { now only read the implementation part }
  204. current_module^.in_implementation:=true;
  205. { load the used units from implementation }
  206. pu:=pused_unit(current_module^.used_units.first);
  207. while assigned(pu) do
  208. begin
  209. if (not pu^.loaded) and (not pu^.in_interface) then
  210. begin
  211. loaded_unit:=loadunit(pu^.name^,false);
  212. if current_module^.compiled then
  213. exit;
  214. { register unit in used units }
  215. pu^.u:=loaded_unit;
  216. pu^.loaded:=true;
  217. {$ifdef TEST_IMPL}
  218. { need to recompile the current unit ? }
  219. if loaded_unit^.crc<>pu^.checksum then
  220. begin
  221. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^);
  222. current_module^.do_compile:=true;
  223. dispose(current_module^.map);
  224. current_module^.map:=nil;
  225. exit;
  226. end;
  227. {$endif TEST_IMPL}
  228. { setup the map entry for deref }
  229. {$ifndef NEWMAP}
  230. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  231. {$else NEWMAP}
  232. current_module^.map^[nextmapentry]:=loaded_unit;
  233. {$endif NEWMAP}
  234. inc(nextmapentry);
  235. if nextmapentry>maxunits then
  236. Message(unit_f_too_much_units);
  237. end;
  238. pu:=pused_unit(pu^.next);
  239. end;
  240. {$ifdef UseBrowser}
  241. if cs_browser in aktmoduleswitches then
  242. punitsymtable(current_module^.globalsymtable)^.load_symtable_refs;
  243. if ((current_module^.flags and uf_has_browser)<>0) and
  244. (cs_local_browser in aktmoduleswitches) then
  245. begin
  246. current_module^.localsymtable:=new(psymtable,load);
  247. psymtable(current_module^.localsymtable)^.name:=
  248. stringdup('implementation of '+psymtable(current_module^.globalsymtable)^.name^);
  249. psymtable(current_module^.localsymtable)^.load_browser;
  250. end;
  251. {$endif UseBrowser}
  252. { remove the map, it's not needed anymore }
  253. dispose(current_module^.map);
  254. current_module^.map:=nil;
  255. end;
  256. function loadunit(const s : string;compile_system:boolean) : pmodule;
  257. const
  258. ImplIntf : array[boolean] of string[15]=('interface','implementation');
  259. var
  260. st : punitsymtable;
  261. old_current_ppu : pppufile;
  262. old_current_module,hp,hp2 : pmodule;
  263. name : string;{ necessary because
  264. current_module^.mainsource^ is reset in compile !! }
  265. scanner : pscannerfile;
  266. procedure loadppufile;
  267. begin
  268. { load interface section }
  269. if not current_module^.do_compile then
  270. load_interface;
  271. { only load units when we don't recompile }
  272. if not current_module^.do_compile then
  273. load_usedunits(compile_system);
  274. { recompile if set }
  275. if current_module^.do_compile then
  276. begin
  277. { we don't need the ppufile anymore }
  278. if assigned(current_module^.ppufile) then
  279. begin
  280. dispose(current_module^.ppufile,done);
  281. current_module^.ppufile:=nil;
  282. end;
  283. { recompile the unit or give a fatal error if sources not available }
  284. if not(current_module^.sources_avail) then
  285. if (not current_module^.search_unit(current_module^.modulename^))
  286. and (length(current_module^.modulename^)>8) then
  287. current_module^.search_unit(copy(current_module^.modulename^,1,8));
  288. if not(current_module^.sources_avail) then
  289. Message1(unit_f_cant_compile_unit,current_module^.modulename^)
  290. else
  291. begin
  292. if current_module^.in_second_compile then
  293. Message1(parser_d_compiling_second_time,current_module^.modulename^);
  294. current_scanner^.tempcloseinputfile;
  295. name:=current_module^.mainsource^;
  296. if assigned(scanner) then
  297. scanner^.invalid:=true;
  298. compile(name,compile_system);
  299. if (not current_scanner^.invalid) then
  300. current_scanner^.tempopeninputfile;
  301. (*
  302. if assigned(old_current_module^.scanner) then
  303. begin
  304. current_scanner^.tempcloseinputfile;
  305. current_scanner:=nil;
  306. { the current_scanner is always the same
  307. as current_module^.scanner (PFV) }
  308. NO !!! unless you changed the code
  309. because it is only change in compile
  310. whereas current_module is changed here !!
  311. end;
  312. compile(current_module^.mainsource^,compile_system);
  313. if (not old_current_module^.compiled) and
  314. assigned(old_current_module^.scanner) then
  315. begin
  316. current_scanner:=old_current_module^.scanner;
  317. current_scanner^.tempopeninputfile;
  318. end; *)
  319. end;
  320. end
  321. else
  322. begin
  323. { only reassemble ? }
  324. if (current_module^.do_assemble) then
  325. OnlyAsm;
  326. { add the files for the linker }
  327. Linker.AddModuleFiles(current_module);
  328. end;
  329. if assigned(current_module^.ppufile) then
  330. begin
  331. dispose(current_module^.ppufile,done);
  332. current_module^.ppufile:=nil;
  333. end;
  334. end;
  335. begin
  336. old_current_module:=current_module;
  337. old_current_ppu:=current_ppu;
  338. { Info }
  339. Message3(unit_u_load_unit,current_module^.modulename^,ImplIntf[current_module^.in_implementation],s);
  340. { unit not found }
  341. st:=nil;
  342. { search all loaded units }
  343. hp:=pmodule(loaded_units.first);
  344. while assigned(hp) do
  345. begin
  346. if hp^.modulename^=s then
  347. begin
  348. { the unit is already registered }
  349. { and this means that the unit }
  350. { is already compiled }
  351. { else there is a cyclic unit use }
  352. if assigned(hp^.globalsymtable) then
  353. st:=punitsymtable(hp^.globalsymtable)
  354. else
  355. begin
  356. { both units in interface ? }
  357. if (not current_module^.in_implementation) and (not hp^.in_implementation) then
  358. begin
  359. { check for a cycle }
  360. hp2:=current_module^.loaded_from;
  361. while assigned(hp2) and (hp2<>hp) do
  362. begin
  363. if hp2^.in_implementation then
  364. hp2:=nil
  365. else
  366. hp2:=hp2^.loaded_from;
  367. end;
  368. if assigned(hp2) then
  369. Message2(unit_f_circular_unit_reference,current_module^.modulename^,hp^.modulename^);
  370. end;
  371. end;
  372. break;
  373. end;
  374. { the next unit }
  375. hp:=pmodule(hp^.next);
  376. end;
  377. { the unit is not in the symtable stack }
  378. if (not assigned(st)) then
  379. begin
  380. if assigned(hp) then
  381. begin
  382. { remove the old unit }
  383. loaded_units.remove(hp);
  384. scanner:=hp^.scanner;
  385. hp^.reset;
  386. hp^.scanner:=scanner;
  387. { try to reopen ppu }
  388. hp^.search_unit(s);
  389. { try to load the unit a second time first }
  390. if not current_module^.in_implementation then
  391. hp^.do_compile:=true;
  392. current_module:=hp;
  393. current_module^.in_second_compile:=true;
  394. Message1(unit_u_second_load_unit,current_module^.modulename^);
  395. end
  396. else
  397. { generates a new unit info record }
  398. begin
  399. current_module:=new(pmodule,init(s,true));
  400. scanner:=nil;
  401. end;
  402. current_ppu:=current_module^.ppufile;
  403. { now we can register the unit }
  404. current_module^.loaded_from:=old_current_module;
  405. loaded_units.insert(current_module);
  406. { now realy load the ppu }
  407. loadppufile;
  408. { set compiled flag }
  409. current_module^.compiled:=true;
  410. { register the unit _once_ }
  411. usedunits.concat(new(pused_unit,init(current_module,true)));
  412. { load return pointer }
  413. hp:=current_module;
  414. end;
  415. { set the old module }
  416. current_ppu:=old_current_ppu;
  417. current_module:=old_current_module;
  418. loadunit:=hp;
  419. end;
  420. procedure loaddefaultunits;
  421. var
  422. hp : pmodule;
  423. begin
  424. { are we compiling the system unit? }
  425. if (cs_compilesystem in aktmoduleswitches) then
  426. begin
  427. { create system defines }
  428. createconstdefs;
  429. { we don't need to reset anything, it's already done in parser.pas }
  430. exit;
  431. end;
  432. { insert the system unit, it is allways the first }
  433. hp:=loadunit(upper(target_info.system_unit),true);
  434. systemunit:=hp^.globalsymtable;
  435. { it's always the first unit }
  436. systemunit^.next:=nil;
  437. symtablestack:=systemunit;
  438. { add to the used units }
  439. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  440. refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit)));
  441. { read default constant definitions }
  442. make_ref:=false;
  443. readconstdefs;
  444. make_ref:=true;
  445. { if POWER is defined in the RTL then use it for starstar overloading }
  446. getsym('POWER',false);
  447. if assigned(srsym) and (srsym^.typ=procsym) and (overloaded_operators[STARSTAR]=nil) then
  448. overloaded_operators[STARSTAR]:=pprocsym(srsym);
  449. { Objpas unit? }
  450. if m_objpas in aktmodeswitches then
  451. begin
  452. hp:=loadunit('OBJPAS',false);
  453. objpasunit:=hp^.globalsymtable;
  454. { insert in stack }
  455. objpasunit^.next:=symtablestack;
  456. symtablestack:=objpasunit;
  457. { add to the used units }
  458. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  459. refsymtable^.insert(new(punitsym,init('OBJPAS',objpasunit)));
  460. end
  461. else
  462. objpasunit:=nil;
  463. { save default symtablestack }
  464. defaultsymtablestack:=symtablestack;
  465. end;
  466. procedure loadunits;
  467. var
  468. s : stringid;
  469. hp : pused_unit;
  470. hp2 : pmodule;
  471. hp3 : psymtable;
  472. oldprocsym:Pprocsym;
  473. begin
  474. oldprocsym:=aktprocsym;
  475. consume(_USES);
  476. {$ifdef DEBUG}
  477. test_symtablestack;
  478. {$endif DEBUG}
  479. repeat
  480. s:=pattern;
  481. consume(ID);
  482. hp2:=loadunit(s,false);
  483. { the current module uses the unit hp2 }
  484. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  485. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  486. if current_module^.compiled then
  487. exit;
  488. refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable)));
  489. if token=COMMA then
  490. begin
  491. pattern:='';
  492. consume(COMMA);
  493. end
  494. else
  495. break;
  496. until false;
  497. consume(SEMICOLON);
  498. { set the symtable to systemunit so it gets reorderd correctly }
  499. symtablestack:=defaultsymtablestack;
  500. { now insert the units in the symtablestack }
  501. hp:=pused_unit(current_module^.used_units.first);
  502. while assigned(hp) do
  503. begin
  504. {$IfDef GDB}
  505. if (cs_debuginfo in aktmoduleswitches) and
  506. not hp^.is_stab_written then
  507. begin
  508. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  509. hp^.is_stab_written:=true;
  510. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  511. end;
  512. {$EndIf GDB}
  513. if hp^.in_uses then
  514. begin
  515. hp3:=symtablestack;
  516. while assigned(hp3) do
  517. begin
  518. { insert units only once ! }
  519. if hp^.u^.globalsymtable=hp3 then
  520. break;
  521. hp3:=hp3^.next;
  522. { unit isn't inserted }
  523. if hp3=nil then
  524. begin
  525. psymtable(hp^.u^.globalsymtable)^.next:=symtablestack;
  526. symtablestack:=psymtable(hp^.u^.globalsymtable);
  527. {$ifdef CHAINPROCSYMS}
  528. symtablestack^.chainprocsyms;
  529. {$endif CHAINPROCSYMS}
  530. {$ifdef DEBUG}
  531. test_symtablestack;
  532. {$endif DEBUG}
  533. end;
  534. end;
  535. end;
  536. hp:=pused_unit(hp^.next);
  537. end;
  538. aktprocsym:=oldprocsym;
  539. end;
  540. procedure parse_implementation_uses(symt:Psymtable);
  541. begin
  542. if token=_USES then
  543. begin
  544. symt^.symtabletype:=unitsymtable;
  545. loadunits;
  546. symt^.symtabletype:=globalsymtable;
  547. {$ifdef DEBUG}
  548. test_symtablestack;
  549. {$endif DEBUG}
  550. end;
  551. end;
  552. procedure gen_main_procsym(const name:string;options:longint;st:psymtable);
  553. begin
  554. {Generate a procsym for main}
  555. make_ref:=false;
  556. aktprocsym:=new(Pprocsym,init(name));
  557. aktprocsym^.definition:=new(Pprocdef,init);
  558. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or options;
  559. aktprocsym^.definition^.setmangledname(target_os.cprefix+name);
  560. aktprocsym^.definition^.forwarddef:=false;
  561. make_ref:=true;
  562. { The localst is a local symtable. Change it into the static
  563. symtable }
  564. dispose(aktprocsym^.definition^.localst,done);
  565. aktprocsym^.definition^.localst:=st;
  566. { and insert the procsym in symtable }
  567. st^.insert(aktprocsym);
  568. { set some informations about the main program }
  569. with procinfo do
  570. begin
  571. retdef:=voiddef;
  572. _class:=nil;
  573. call_offset:=8;
  574. framepointer:=frame_pointer;
  575. flags:=0;
  576. end;
  577. end;
  578. procedure proc_unit;
  579. var
  580. { unitname : stringid; }
  581. names : Tstringcontainer;
  582. st : psymtable;
  583. unitst : punitsymtable;
  584. {$ifdef GDB}
  585. pu : pused_unit;
  586. {$endif GDB}
  587. i : longint;
  588. s1,s2 : ^string; {Saves stack space}
  589. begin
  590. consume(_UNIT);
  591. if token=ID then
  592. begin
  593. { create filenames and unit name }
  594. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^,true);
  595. stringdispose(current_module^.modulename);
  596. current_module^.modulename:=stringdup(upper(pattern));
  597. { check for system unit }
  598. new(s1);
  599. new(s2);
  600. s1^:=upper(target_info.system_unit);
  601. s2^:=upper(current_scanner^.inputfile^.name^);
  602. { strip extension, there could only be one dot }
  603. i:=pos('.',s2^);
  604. if i>0 then
  605. s2^:=Copy(s2^,1,i-1);
  606. if (cs_compilesystem in aktmoduleswitches) then
  607. begin
  608. if (cs_check_unit_name in aktglobalswitches) and
  609. ((length(current_module^.modulename^)>8) or
  610. (current_module^.modulename^<>s1^) or
  611. (current_module^.modulename^<>s2^)) then
  612. Message1(unit_e_illegal_unit_name,s1^);
  613. end
  614. else
  615. if (current_module^.modulename^=s1^) then
  616. Message(unit_w_switch_us_missed);
  617. dispose(s2);
  618. dispose(s1);
  619. end;
  620. consume(ID);
  621. consume(SEMICOLON);
  622. consume(_INTERFACE);
  623. { global switches are read, so further changes aren't allowed }
  624. current_module^.in_global:=false;
  625. Message1(unit_u_start_parse_interface,current_module^.modulename^);
  626. { update status }
  627. status.currentmodule:=current_module^.modulename^;
  628. { maybe turn off m_objpas if we are compiling objpas }
  629. if (current_module^.modulename^='OBJPAS') then
  630. aktmodeswitches:=aktmodeswitches-[m_objpas];
  631. { this should be placed after uses !!}
  632. {$ifndef UseNiceNames}
  633. procprefix:='_'+current_module^.modulename^+'$$';
  634. {$else UseNiceNames}
  635. procprefix:='_'+tostr(length(current_module^.unitname^))+lowercase(current_module^.unitname^)+'_';
  636. {$endif UseNiceNames}
  637. parse_only:=true;
  638. { generate now the global symboltable }
  639. st:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  640. refsymtable:=st;
  641. unitst:=punitsymtable(st);
  642. { define first as local to overcome dependency conflicts }
  643. current_module^.localsymtable:=st;
  644. { the unit name must be usable as a unit specifier }
  645. { inside the unit itself (PM) }
  646. { this also forbids to have another symbol }
  647. { with the same name as the unit }
  648. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  649. { a unit compiled at command line must be inside the loaded_unit list }
  650. if (compile_level=1) then
  651. loaded_units.insert(current_module);
  652. { load default units, like the system unit }
  653. loaddefaultunits;
  654. { reset }
  655. make_ref:=true;
  656. lexlevel:=0;
  657. { insert qualifier for the system unit (allows system.writeln) }
  658. if not(cs_compilesystem in aktmoduleswitches) then
  659. begin
  660. if token=_USES then
  661. begin
  662. unitst^.symtabletype:=unitsymtable;
  663. loadunits;
  664. { has it been compiled at a higher level ?}
  665. if current_module^.compiled then
  666. begin
  667. { this unit symtable is obsolete }
  668. { dispose(unitst,done);
  669. disposed as localsymtable !! }
  670. exit;
  671. end;
  672. unitst^.symtabletype:=globalsymtable;
  673. end;
  674. { ... but insert the symbol table later }
  675. st^.next:=symtablestack;
  676. symtablestack:=st;
  677. end
  678. else
  679. { while compiling a system unit, some types are directly inserted }
  680. begin
  681. st^.next:=symtablestack;
  682. symtablestack:=st;
  683. insert_intern_types(st);
  684. end;
  685. { now we know the place to insert the constants }
  686. constsymtable:=symtablestack;
  687. { move the global symtab from the temporary local to global }
  688. current_module^.globalsymtable:=current_module^.localsymtable;
  689. current_module^.localsymtable:=nil;
  690. { ... parse the declarations }
  691. read_interface_declarations;
  692. {$ifdef GDB}
  693. { add all used definitions}
  694. if (cs_debuginfo in aktmoduleswitches) then
  695. begin
  696. { all types }
  697. punitsymtable(refsymtable)^.concattypestabto(debuglist);
  698. { and all local symbols}
  699. refsymtable^.concatstabto(debuglist);
  700. end;
  701. {$endif GDB}
  702. { Parse the implementation section }
  703. consume(_IMPLEMENTATION);
  704. current_module^.in_implementation:=true;
  705. Message1(unit_u_start_parse_implementation,current_module^.modulename^);
  706. parse_only:=false;
  707. { generates static symbol table }
  708. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  709. current_module^.localsymtable:=st;
  710. { remove the globalsymtable from the symtable stack }
  711. { to reinsert it after loading the implementation units }
  712. symtablestack:=unitst^.next;
  713. { number the definitions, so a deref from other units works }
  714. refsymtable^.number_defs;
  715. {$ifdef UseBrowser}
  716. refsymtable^.number_symbols;
  717. { we don't want implementation units symbols in unitsymtable !! PM }
  718. refsymtable:=st;
  719. {$endif UseBrowser}
  720. { Read the implementation units }
  721. parse_implementation_uses(unitst);
  722. if current_module^.compiled then
  723. begin
  724. exit;
  725. end;
  726. { All units are read, now give them a number }
  727. numberunits;
  728. { now we can change refsymtable }
  729. refsymtable:=st;
  730. { but reinsert the global symtable as lasts }
  731. unitst^.next:=symtablestack;
  732. symtablestack:=unitst;
  733. {$ifdef DEBUG}
  734. test_symtablestack;
  735. {$endif DEBUG}
  736. constsymtable:=symtablestack;
  737. {$ifdef Splitheap}
  738. if testsplit then
  739. begin
  740. Split_Heap;
  741. allow_special:=true;
  742. Switch_to_temp_heap;
  743. end;
  744. { it will report all crossings }
  745. allow_special:=false;
  746. {$endif Splitheap}
  747. { Generate a procsym }
  748. gen_main_procsym(current_module^.modulename^+'_init',pounitinit,st);
  749. { Compile the unit }
  750. codegen_newprocedure;
  751. names.init;
  752. names.insert('INIT$$'+current_module^.modulename^);
  753. names.insert(target_os.cprefix+current_module^.modulename^+'_init');
  754. compile_proc_body(names,true,false);
  755. names.done;
  756. codegen_doneprocedure;
  757. { avoid self recursive destructor call !! PM }
  758. aktprocsym^.definition^.localst:=nil;
  759. { finalize? }
  760. if token=_FINALIZATION then
  761. begin
  762. { set module options }
  763. current_module^.flags:=current_module^.flags or uf_finalize;
  764. { Generate a procsym }
  765. gen_main_procsym(current_module^.modulename^+'_finalize',pounitfinalize,st);
  766. { Compile the finalize }
  767. codegen_newprocedure;
  768. names.init;
  769. names.insert('FINALIZE$$'+current_module^.modulename^);
  770. names.insert(target_os.cprefix+current_module^.modulename^+'_finalize');
  771. compile_proc_body(names,true,false);
  772. names.done;
  773. codegen_doneprocedure;
  774. { avoid self recursive destructor call !! PM }
  775. aktprocsym^.definition^.localst:=nil;
  776. end;
  777. { the last char should always be a point }
  778. consume(POINT);
  779. { avoid self recursive destructor call !! PM }
  780. aktprocsym^.definition^.localst:=nil;
  781. { absence does not matter here !! }
  782. aktprocsym^.definition^.forwarddef:=false;
  783. { test static symtable }
  784. st^.allsymbolsused;
  785. { size of the static data }
  786. datasize:=st^.datasize;
  787. {$ifdef GDB}
  788. { add all used definitions even for implementation}
  789. if (cs_debuginfo in aktmoduleswitches) then
  790. begin
  791. { all types }
  792. punitsymtable(st)^.concattypestabto(debuglist);
  793. { and all local symbols}
  794. st^.concatstabto(debuglist);
  795. end;
  796. {$endif GDB}
  797. { tests, if all (interface) forwards are resolved }
  798. symtablestack^.check_forwards;
  799. { now we have a correct unit, change the symtable type }
  800. current_module^.in_implementation:=false;
  801. symtablestack^.symtabletype:=unitsymtable;
  802. {$ifdef GDB}
  803. punitsymtable(symtablestack)^.is_stab_written:=false;
  804. {$endif GDB}
  805. { leave when we got an error }
  806. if status.errorcount>0 then
  807. begin
  808. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  809. exit;
  810. end;
  811. { insert own objectfile }
  812. insertobjectfile;
  813. { Write out the ppufile }
  814. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
  815. { write local browser }
  816. {$ifdef UseBrowser}
  817. if cs_local_browser in aktmoduleswitches then
  818. begin
  819. current_module^.localsymtable:=refsymtable;
  820. refsymtable^.write;
  821. refsymtable^.write_browser;
  822. end;
  823. {$endif UseBrowser}
  824. {$ifdef GDB}
  825. pu:=pused_unit(usedunits.first);
  826. while assigned(pu) do
  827. begin
  828. punitsymtable(pu^.u^.globalsymtable)^.is_stab_written:=false;
  829. pu:=pused_unit(pu^.next);
  830. end;
  831. {$endif GDB}
  832. { remove static symtable (=refsymtable) here to save some mem }
  833. {$ifndef UseBrowser}
  834. dispose(st,done);
  835. current_module^.localsymtable:=nil;
  836. {$endif UseBrowser}
  837. { generate imports }
  838. if current_module^.uses_imports then
  839. importlib^.generatelib;
  840. { finish asmlist by adding segment starts }
  841. insertsegment;
  842. { assemble }
  843. create_objectfile;
  844. end;
  845. procedure proc_program(islibrary : boolean);
  846. var
  847. st : psymtable;
  848. names : Tstringcontainer;
  849. begin
  850. parse_only:=false;
  851. if islibrary then
  852. begin
  853. consume(_LIBRARY);
  854. stringdispose(current_module^.modulename);
  855. current_module^.modulename:=stringdup(pattern);
  856. consume(ID);
  857. consume(SEMICOLON);
  858. end
  859. else
  860. { is there an program head ? }
  861. if token=_PROGRAM then
  862. begin
  863. consume(_PROGRAM);
  864. stringdispose(current_module^.modulename);
  865. current_module^.modulename:=stringdup(pattern);
  866. consume(ID);
  867. if token=LKLAMMER then
  868. begin
  869. consume(LKLAMMER);
  870. idlist;
  871. consume(RKLAMMER);
  872. end;
  873. consume(SEMICOLON);
  874. end;
  875. { global switches are read, so further changes aren't allowed }
  876. current_module^.in_global:=false;
  877. { set implementation flag }
  878. current_module^.in_implementation:=true;
  879. { insert after the unit symbol tables the static symbol table }
  880. { of the program }
  881. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  882. current_module^.localsymtable:=st;
  883. symtablestack:=st;
  884. refsymtable:=st;
  885. { necessary for browser }
  886. loaded_units.insert(current_module);
  887. { load standard units (system,objpas unit) }
  888. loaddefaultunits;
  889. { reset }
  890. lexlevel:=0;
  891. {Load the units used by the program we compile.}
  892. if token=_USES then
  893. loadunits;
  894. {Insert the name of the main program into the symbol table.}
  895. if current_module^.modulename^<>'' then
  896. st^.insert(new(pprogramsym,init(current_module^.modulename^)));
  897. { ...is also constsymtable, this is the symtable where }
  898. { the elements of enumeration types are inserted }
  899. constsymtable:=st;
  900. { Generate a procsym for main }
  901. gen_main_procsym('main',poproginit,st);
  902. { reset }
  903. procprefix:='';
  904. in_except_block:=false;
  905. {The program intialization needs an alias, so it can be called
  906. from the bootstrap code.}
  907. codegen_newprocedure;
  908. names.init;
  909. names.insert('program_init');
  910. names.insert('PASCALMAIN');
  911. names.insert(target_os.cprefix+'main');
  912. {$ifdef m68k}
  913. if target_info.target=target_PalmOS then
  914. names.insert('PilotMain');
  915. {$endif}
  916. compile_proc_body(names,true,false);
  917. names.done;
  918. { avoid self recursive destructor call !! PM }
  919. aktprocsym^.definition^.localst:=nil;
  920. codegen_doneprocedure;
  921. { consume the last point }
  922. consume(POINT);
  923. { leave when we got an error }
  924. if status.errorcount>0 then
  925. begin
  926. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  927. exit;
  928. end;
  929. { insert heap }
  930. insertheap;
  931. { generate imports }
  932. if current_module^.uses_imports then
  933. importlib^.generatelib;
  934. inserttargetspecific;
  935. datasize:=symtablestack^.datasize;
  936. { finish asmlist by adding segment starts }
  937. insertsegment;
  938. { insert own objectfile }
  939. insertobjectfile;
  940. { assemble and link }
  941. create_objectfile;
  942. { create the executable when we are at level 1 }
  943. if (compile_level=1) then
  944. begin
  945. if (cs_link_deffile in aktglobalswitches) then
  946. deffile.writefile;
  947. if (not current_module^.is_unit) then
  948. Linker.MakeExecutable;
  949. end;
  950. end;
  951. end.
  952. {
  953. $Log$
  954. Revision 1.66 1998-10-09 16:36:05 pierre
  955. * some memory leaks specific to usebrowser define fixed
  956. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  957. Revision 1.65 1998/10/09 14:38:55 pierre
  958. * add a second load for PPU file
  959. Revision 1.64 1998/10/09 08:56:28 pierre
  960. * several memory leaks fixed
  961. Revision 1.63 1998/10/08 23:29:01 peter
  962. * -vu shows unit info, -vt shows tried/used files
  963. Revision 1.62 1998/10/08 17:17:25 pierre
  964. * current_module old scanner tagged as invalid if unit is recompiled
  965. + added ppheap for better info on tracegetmem of heaptrc
  966. (adds line column and file index)
  967. * several memory leaks removed ith help of heaptrc !!
  968. Revision 1.61 1998/10/08 13:48:47 peter
  969. * fixed memory leaks for do nothing source
  970. * fixed unit interdependency
  971. Revision 1.60 1998/10/06 17:16:54 pierre
  972. * some memory leaks fixed (thanks to Peter for heaptrc !)
  973. Revision 1.59 1998/10/05 21:33:26 peter
  974. * fixed 161,165,166,167,168
  975. Revision 1.58 1998/09/30 16:43:37 peter
  976. * fixed unit interdependency with circular uses
  977. Revision 1.57 1998/09/30 12:11:52 peter
  978. * fixed circular uses which looped forever
  979. Revision 1.56 1998/09/28 11:22:15 pierre
  980. * did not compile for browser
  981. * merge from fixes
  982. Revision 1.48.2.1 1998/09/28 10:55:16 pierre
  983. fix for current_module dispose bug
  984. Revision 1.55 1998/09/28 11:04:03 peter
  985. * fixed loaddefaultunits which was at the wrong place for programs, so
  986. the default defs were not loaded when main was initialized
  987. Revision 1.54 1998/09/24 23:49:12 peter
  988. + aktmodeswitches
  989. Revision 1.53 1998/09/23 12:20:50 pierre
  990. * main program tmodule had no symtable (crashed browser)
  991. * unit symbols problem fixed !!
  992. Revision 1.52 1998/09/22 17:13:49 pierre
  993. + browsing updated and developed
  994. records and objects fields are also stored
  995. Revision 1.51 1998/09/22 15:40:55 peter
  996. * some extra ifdef GDB
  997. Revision 1.50 1998/09/21 08:45:17 pierre
  998. + added vmt_offset in tobjectdef.write for fututre use
  999. (first steps to have objects without vmt if no virtual !!)
  1000. + added fpu_used field for tabstractprocdef :
  1001. sets this level to 2 if the functions return with value in FPU
  1002. (is then set to correct value at parsing of implementation)
  1003. THIS MIGHT refuse some code with FPU expression too complex
  1004. that were accepted before and even in some cases
  1005. that don't overflow in fact
  1006. ( like if f : float; is a forward that finally in implementation
  1007. only uses one fpu register !!)
  1008. Nevertheless I think that it will improve security on
  1009. FPU operations !!
  1010. * most other changes only for UseBrowser code
  1011. (added symtable references for record and objects)
  1012. local switch for refs to args and local of each function
  1013. (static symtable still missing)
  1014. UseBrowser still not stable and probably broken by
  1015. the definition hash array !!
  1016. Revision 1.49 1998/09/18 08:01:36 pierre
  1017. + improvement on the usebrowser part
  1018. (does not work correctly for now)
  1019. Revision 1.48 1998/09/09 15:33:07 peter
  1020. * fixed in_global to allow directives also after interface token
  1021. Revision 1.47 1998/09/09 11:50:55 pierre
  1022. * forward def are not put in record or objects
  1023. + added check for forwards also in record and objects
  1024. * dummy parasymtable for unit initialization removed from
  1025. symtable stack
  1026. Revision 1.46 1998/09/03 11:24:01 peter
  1027. * moved more inputfile things from tscannerfile to tinputfile
  1028. * changed ifdef Sourceline to cs_asm_source
  1029. Revision 1.45 1998/08/31 12:26:28 peter
  1030. * m68k and palmos updates from surebugfixes
  1031. Revision 1.44 1998/08/26 15:35:33 peter
  1032. * fixed scannerfiles for macros
  1033. + $I %<environment>%
  1034. Revision 1.43 1998/08/26 10:08:47 peter
  1035. * fixed problem with libprefix at the wrong place
  1036. * fixed lib generation with smartlinking and no -CS used
  1037. Revision 1.42 1998/08/19 18:04:54 peter
  1038. * fixed current_module^.in_implementation flag
  1039. Revision 1.41 1998/08/17 10:10:08 peter
  1040. - removed OLDPPU
  1041. Revision 1.40 1998/08/17 09:17:50 peter
  1042. * static/shared linking updates
  1043. Revision 1.39 1998/08/14 21:56:37 peter
  1044. * setting the outputfile using -o works now to create static libs
  1045. Revision 1.38 1998/08/10 14:50:13 peter
  1046. + localswitches, moduleswitches, globalswitches splitting
  1047. Revision 1.37 1998/08/10 10:18:31 peter
  1048. + Compiler,Comphook unit which are the new interface units to the
  1049. compiler
  1050. Revision 1.36 1998/07/14 14:46:54 peter
  1051. * released NEWINPUT
  1052. Revision 1.35 1998/07/08 12:39:38 peter
  1053. * heap_size for m68k
  1054. Revision 1.34 1998/07/07 11:20:03 peter
  1055. + NEWINPUT for a better inputfile and scanner object
  1056. Revision 1.33 1998/06/25 11:15:34 pierre
  1057. * ppu files where not closed in newppu !!
  1058. second compilation was impossible due to too many opened files
  1059. (not visible in 'make cycle' as we remove all the ppu files)
  1060. Revision 1.32 1998/06/25 08:48:16 florian
  1061. * first version of rtti support
  1062. Revision 1.31 1998/06/24 14:48:35 peter
  1063. * ifdef newppu -> ifndef oldppu
  1064. Revision 1.30 1998/06/17 14:10:16 peter
  1065. * small os2 fixes
  1066. * fixed interdependent units with newppu (remake3 under linux works now)
  1067. Revision 1.29 1998/06/16 08:56:25 peter
  1068. + targetcpu
  1069. * cleaner pmodules for newppu
  1070. Revision 1.28 1998/06/13 00:10:10 peter
  1071. * working browser and newppu
  1072. * some small fixes against crashes which occured in bp7 (but not in
  1073. fpc?!)
  1074. Revision 1.27 1998/06/11 13:58:08 peter
  1075. * small fix to let newppu compile
  1076. Revision 1.26 1998/06/09 16:01:47 pierre
  1077. + added procedure directive parsing for procvars
  1078. (accepted are popstack cdecl and pascal)
  1079. + added C vars with the following syntax
  1080. var C calias 'true_c_name';(can be followed by external)
  1081. reason is that you must add the Cprefix
  1082. which is target dependent
  1083. Revision 1.25 1998/06/08 22:59:49 peter
  1084. * smartlinking works for win32
  1085. * some defines to exclude some compiler parts
  1086. Revision 1.24 1998/06/08 13:13:44 pierre
  1087. + temporary variables now in temp_gen.pas unit
  1088. because it is processor independent
  1089. * mppc68k.bat modified to undefine i386 and support_mmx
  1090. (which are defaults for i386)
  1091. Revision 1.23 1998/06/05 17:47:29 peter
  1092. * some better uses clauses
  1093. Revision 1.22 1998/06/05 14:37:34 pierre
  1094. * fixes for inline for operators
  1095. * inline procedure more correctly restricted
  1096. Revision 1.21 1998/06/04 23:51:53 peter
  1097. * m68k compiles
  1098. + .def file creation moved to gendef.pas so it could also be used
  1099. for win32
  1100. Revision 1.20 1998/06/04 09:55:42 pierre
  1101. * demangled name of procsym reworked to become independant of the mangling scheme
  1102. Revision 1.19 1998/06/03 23:40:38 peter
  1103. + unlimited file support, release tempclose
  1104. Revision 1.18 1998/06/03 22:49:00 peter
  1105. + wordbool,longbool
  1106. * rename bis,von -> high,low
  1107. * moved some systemunit loading/creating to psystem.pas
  1108. Revision 1.17 1998/05/28 14:40:25 peter
  1109. * fixes for newppu, remake3 works now with it
  1110. Revision 1.16 1998/05/27 19:45:06 peter
  1111. * symtable.pas splitted into includefiles
  1112. * symtable adapted for $ifdef NEWPPU
  1113. Revision 1.15 1998/05/23 01:21:22 peter
  1114. + aktasmmode, aktoptprocessor, aktoutputformat
  1115. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1116. + $LIBNAME to set the library name where the unit will be put in
  1117. * splitted cgi386 a bit (codeseg to large for bp7)
  1118. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1119. Revision 1.14 1998/05/20 09:42:35 pierre
  1120. + UseTokenInfo now default
  1121. * unit in interface uses and implementation uses gives error now
  1122. * only one error for unknown symbol (uses lastsymknown boolean)
  1123. the problem came from the label code !
  1124. + first inlined procedures and function work
  1125. (warning there might be allowed cases were the result is still wrong !!)
  1126. * UseBrower updated gives a global list of all position of all used symbols
  1127. with switch -gb
  1128. Revision 1.13 1998/05/12 10:47:00 peter
  1129. * moved printstatus to verb_def
  1130. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1131. prefix like error: warning: and is included in V_Default
  1132. * fixed some messages
  1133. * first time parameter scan is only for -v and -T
  1134. - removed old style messages
  1135. Revision 1.12 1998/05/11 13:07:56 peter
  1136. + $ifdef NEWPPU for the new ppuformat
  1137. + $define GDB not longer required
  1138. * removed all warnings and stripped some log comments
  1139. * no findfirst/findnext anymore to remove smartlink *.o files
  1140. Revision 1.11 1998/05/06 18:36:53 peter
  1141. * tai_section extended with code,data,bss sections and enumerated type
  1142. * ident 'compiled by FPC' moved to pmodules
  1143. * small fix for smartlink
  1144. Revision 1.10 1998/05/04 17:54:28 peter
  1145. + smartlinking works (only case jumptable left todo)
  1146. * redesign of systems.pas to support assemblers and linkers
  1147. + Unitname is now also in the PPU-file, increased version to 14
  1148. Revision 1.9 1998/05/01 16:38:45 florian
  1149. * handling of private and protected fixed
  1150. + change_keywords_to_tp implemented to remove
  1151. keywords which aren't supported by tp
  1152. * break and continue are now symbols of the system unit
  1153. + widestring, longstring and ansistring type released
  1154. Revision 1.8 1998/04/30 15:59:41 pierre
  1155. * GDB works again better :
  1156. correct type info in one pass
  1157. + UseTokenInfo for better source position
  1158. * fixed one remaining bug in scanner for line counts
  1159. * several little fixes
  1160. Revision 1.7 1998/04/29 10:33:59 pierre
  1161. + added some code for ansistring (not complete nor working yet)
  1162. * corrected operator overloading
  1163. * corrected nasm output
  1164. + started inline procedures
  1165. + added starstarn : use ** for exponentiation (^ gave problems)
  1166. + started UseTokenInfo cond to get accurate positions
  1167. Revision 1.6 1998/04/27 23:10:28 peter
  1168. + new scanner
  1169. * $makelib -> if smartlink
  1170. * small filename fixes pmodule.setfilename
  1171. * moved import from files.pas -> import.pas
  1172. Revision 1.5 1998/04/14 23:27:03 florian
  1173. + exclude/include with constant second parameter added
  1174. Revision 1.4 1998/04/10 14:41:43 peter
  1175. * removed some Hints
  1176. * small speed optimization for AsmLn
  1177. Revision 1.3 1998/04/03 09:51:00 daniel
  1178. * Fixed heap allocation for OS/2.
  1179. }