pmodules.pas 48 KB

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