pmodules.pas 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  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. hp2:=loadunit(s,false);
  468. { the current module uses the unit hp2 }
  469. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  470. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  471. if current_module^.compiled then
  472. exit;
  473. refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable)));
  474. if token=COMMA then
  475. begin
  476. pattern:='';
  477. consume(COMMA);
  478. end
  479. else
  480. break;
  481. until false;
  482. consume(SEMICOLON);
  483. { set the symtable to systemunit so it gets reorderd correctly }
  484. symtablestack:=defaultsymtablestack;
  485. { now insert the units in the symtablestack }
  486. hp:=pused_unit(current_module^.used_units.first);
  487. while assigned(hp) do
  488. begin
  489. {$IfDef GDB}
  490. if (cs_debuginfo in aktmoduleswitches) and
  491. not hp^.is_stab_written then
  492. begin
  493. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  494. hp^.is_stab_written:=true;
  495. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  496. end;
  497. {$EndIf GDB}
  498. if hp^.in_uses then
  499. begin
  500. hp3:=symtablestack;
  501. while assigned(hp3) do
  502. begin
  503. { insert units only once ! }
  504. if hp^.u^.globalsymtable=hp3 then
  505. break;
  506. hp3:=hp3^.next;
  507. { unit isn't inserted }
  508. if hp3=nil then
  509. begin
  510. psymtable(hp^.u^.globalsymtable)^.next:=symtablestack;
  511. symtablestack:=psymtable(hp^.u^.globalsymtable);
  512. {$ifdef CHAINPROCSYMS}
  513. symtablestack^.chainprocsyms;
  514. {$endif CHAINPROCSYMS}
  515. {$ifdef DEBUG}
  516. test_symtablestack;
  517. {$endif DEBUG}
  518. end;
  519. end;
  520. end;
  521. hp:=pused_unit(hp^.next);
  522. end;
  523. aktprocsym:=oldprocsym;
  524. end;
  525. procedure parse_implementation_uses(symt:Psymtable);
  526. begin
  527. if token=_USES then
  528. begin
  529. symt^.symtabletype:=unitsymtable;
  530. loadunits;
  531. symt^.symtabletype:=globalsymtable;
  532. {$ifdef DEBUG}
  533. test_symtablestack;
  534. {$endif DEBUG}
  535. end;
  536. end;
  537. procedure gen_main_procsym(const name:string;options:longint;st:psymtable);
  538. begin
  539. {Generate a procsym for main}
  540. make_ref:=false;
  541. aktprocsym:=new(Pprocsym,init(name));
  542. aktprocsym^.definition:=new(Pprocdef,init);
  543. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or options;
  544. aktprocsym^.definition^.setmangledname(target_os.cprefix+name);
  545. aktprocsym^.definition^.forwarddef:=false;
  546. make_ref:=true;
  547. { The localst is a local symtable. Change it into the static
  548. symtable }
  549. dispose(aktprocsym^.definition^.localst,done);
  550. aktprocsym^.definition^.localst:=st;
  551. { and insert the procsym in symtable }
  552. st^.insert(aktprocsym);
  553. { set some informations about the main program }
  554. with procinfo do
  555. begin
  556. retdef:=voiddef;
  557. _class:=nil;
  558. call_offset:=8;
  559. framepointer:=frame_pointer;
  560. flags:=0;
  561. end;
  562. end;
  563. procedure proc_unit;
  564. function is_assembler_generated:boolean;
  565. begin
  566. is_assembler_generated:=not(codesegment^.empty and datasegment^.empty and bsssegment^.empty);
  567. end;
  568. var
  569. { unitname : stringid; }
  570. names : Tstringcontainer;
  571. st : psymtable;
  572. unitst : punitsymtable;
  573. {$ifdef GDB}
  574. pu : pused_unit;
  575. {$endif GDB}
  576. i : longint;
  577. s1,s2 : ^string; {Saves stack space}
  578. begin
  579. consume(_UNIT);
  580. if token=ID then
  581. begin
  582. { create filenames and unit name }
  583. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^,true);
  584. stringdispose(current_module^.modulename);
  585. current_module^.modulename:=stringdup(upper(pattern));
  586. { check for system unit }
  587. new(s1);
  588. new(s2);
  589. s1^:=upper(target_info.system_unit);
  590. s2^:=upper(current_scanner^.inputfile^.name^);
  591. { strip extension, there could only be one dot }
  592. i:=pos('.',s2^);
  593. if i>0 then
  594. s2^:=Copy(s2^,1,i-1);
  595. if (cs_compilesystem in aktmoduleswitches) then
  596. begin
  597. if (cs_check_unit_name in aktglobalswitches) and
  598. ((length(current_module^.modulename^)>8) or
  599. (current_module^.modulename^<>s1^) or
  600. (current_module^.modulename^<>s2^)) then
  601. Message1(unit_e_illegal_unit_name,s1^);
  602. end
  603. else
  604. if (current_module^.modulename^=s1^) then
  605. Message(unit_w_switch_us_missed);
  606. dispose(s2);
  607. dispose(s1);
  608. end;
  609. consume(ID);
  610. consume(SEMICOLON);
  611. consume(_INTERFACE);
  612. { global switches are read, so further changes aren't allowed }
  613. current_module^.in_global:=false;
  614. Message1(unit_u_start_parse_interface,current_module^.modulename^);
  615. { update status }
  616. status.currentmodule:=current_module^.modulename^;
  617. { maybe turn off m_objpas if we are compiling objpas }
  618. if (current_module^.modulename^='OBJPAS') then
  619. aktmodeswitches:=aktmodeswitches-[m_objpas];
  620. { this should be placed after uses !!}
  621. {$ifndef UseNiceNames}
  622. procprefix:='_'+current_module^.modulename^+'$$';
  623. {$else UseNiceNames}
  624. procprefix:='_'+tostr(length(current_module^.unitname^))+lowercase(current_module^.unitname^)+'_';
  625. {$endif UseNiceNames}
  626. parse_only:=true;
  627. { generate now the global symboltable }
  628. st:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  629. refsymtable:=st;
  630. unitst:=punitsymtable(st);
  631. { define first as local to overcome dependency conflicts }
  632. current_module^.localsymtable:=st;
  633. { the unit name must be usable as a unit specifier }
  634. { inside the unit itself (PM) }
  635. { this also forbids to have another symbol }
  636. { with the same name as the unit }
  637. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  638. { a unit compiled at command line must be inside the loaded_unit list }
  639. if (compile_level=1) then
  640. loaded_units.insert(current_module);
  641. { load default units, like the system unit }
  642. loaddefaultunits;
  643. { reset }
  644. make_ref:=true;
  645. lexlevel:=0;
  646. { insert qualifier for the system unit (allows system.writeln) }
  647. if not(cs_compilesystem in aktmoduleswitches) then
  648. begin
  649. if token=_USES then
  650. begin
  651. unitst^.symtabletype:=unitsymtable;
  652. loadunits;
  653. { has it been compiled at a higher level ?}
  654. if current_module^.compiled then
  655. begin
  656. { this unit symtable is obsolete }
  657. { dispose(unitst,done);
  658. disposed as localsymtable !! }
  659. exit;
  660. end;
  661. unitst^.symtabletype:=globalsymtable;
  662. end;
  663. { ... but insert the symbol table later }
  664. st^.next:=symtablestack;
  665. symtablestack:=st;
  666. end
  667. else
  668. { while compiling a system unit, some types are directly inserted }
  669. begin
  670. st^.next:=symtablestack;
  671. symtablestack:=st;
  672. insert_intern_types(st);
  673. end;
  674. { now we know the place to insert the constants }
  675. constsymtable:=symtablestack;
  676. { move the global symtab from the temporary local to global }
  677. current_module^.globalsymtable:=current_module^.localsymtable;
  678. current_module^.localsymtable:=nil;
  679. { ... parse the declarations }
  680. read_interface_declarations;
  681. {$ifdef GDB}
  682. { add all used definitions}
  683. if (cs_debuginfo in aktmoduleswitches) then
  684. begin
  685. { all types }
  686. punitsymtable(refsymtable)^.concattypestabto(debuglist);
  687. { and all local symbols}
  688. refsymtable^.concatstabto(debuglist);
  689. end;
  690. {$endif GDB}
  691. { Parse the implementation section }
  692. consume(_IMPLEMENTATION);
  693. current_module^.in_implementation:=true;
  694. Message1(unit_u_start_parse_implementation,current_module^.modulename^);
  695. parse_only:=false;
  696. { generates static symbol table }
  697. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  698. current_module^.localsymtable:=st;
  699. { remove the globalsymtable from the symtable stack }
  700. { to reinsert it after loading the implementation units }
  701. symtablestack:=unitst^.next;
  702. { number the definitions, so a deref from other units works }
  703. refsymtable^.number_defs;
  704. {$ifdef UseBrowser}
  705. refsymtable^.number_symbols;
  706. { we don't want implementation units symbols in unitsymtable !! PM }
  707. refsymtable:=st;
  708. {$endif UseBrowser}
  709. { Read the implementation units }
  710. parse_implementation_uses(unitst);
  711. if current_module^.compiled then
  712. begin
  713. exit;
  714. end;
  715. { reset ranges/stabs in exported definitions }
  716. { If I find who removed this line !!!!!!!
  717. I AM TIRED OF THIS !!!!!!!!!!!
  718. DONT TOUCH WITHOUT ASKING ME Pierre Muller }
  719. reset_global_defs;
  720. { All units are read, now give them a number }
  721. numberunits;
  722. { now we can change refsymtable }
  723. refsymtable:=st;
  724. { but reinsert the global symtable as lasts }
  725. unitst^.next:=symtablestack;
  726. symtablestack:=unitst;
  727. {$ifdef DEBUG}
  728. test_symtablestack;
  729. {$endif DEBUG}
  730. constsymtable:=symtablestack;
  731. {$ifdef Splitheap}
  732. if testsplit then
  733. begin
  734. Split_Heap;
  735. allow_special:=true;
  736. Switch_to_temp_heap;
  737. end;
  738. { it will report all crossings }
  739. allow_special:=false;
  740. {$endif Splitheap}
  741. { Generate a procsym }
  742. gen_main_procsym(current_module^.modulename^+'_init',pounitinit,st);
  743. { Compile the unit }
  744. codegen_newprocedure;
  745. names.init;
  746. names.insert('INIT$$'+current_module^.modulename^);
  747. names.insert(target_os.cprefix+current_module^.modulename^+'_init');
  748. compile_proc_body(names,true,false);
  749. names.done;
  750. codegen_doneprocedure;
  751. { avoid self recursive destructor call !! PM }
  752. aktprocsym^.definition^.localst:=nil;
  753. { finalize? }
  754. if token=_FINALIZATION then
  755. begin
  756. { set module options }
  757. current_module^.flags:=current_module^.flags or uf_finalize;
  758. { Generate a procsym }
  759. gen_main_procsym(current_module^.modulename^+'_finalize',pounitfinalize,st);
  760. { Compile the finalize }
  761. codegen_newprocedure;
  762. names.init;
  763. names.insert('FINALIZE$$'+current_module^.modulename^);
  764. names.insert(target_os.cprefix+current_module^.modulename^+'_finalize');
  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. end;
  771. { the last char should always be a point }
  772. consume(POINT);
  773. { avoid self recursive destructor call !! PM }
  774. aktprocsym^.definition^.localst:=nil;
  775. { absence does not matter here !! }
  776. aktprocsym^.definition^.forwarddef:=false;
  777. { test static symtable }
  778. st^.allsymbolsused;
  779. { size of the static data }
  780. datasize:=st^.datasize;
  781. {$ifdef GDB}
  782. { add all used definitions even for implementation}
  783. if (cs_debuginfo in aktmoduleswitches) then
  784. begin
  785. { all types }
  786. punitsymtable(st)^.concattypestabto(debuglist);
  787. { and all local symbols}
  788. st^.concatstabto(debuglist);
  789. end;
  790. {$endif GDB}
  791. { tests, if all (interface) forwards are resolved }
  792. symtablestack^.check_forwards;
  793. { now we have a correct unit, change the symtable type }
  794. current_module^.in_implementation:=false;
  795. symtablestack^.symtabletype:=unitsymtable;
  796. {$ifdef GDB}
  797. punitsymtable(symtablestack)^.is_stab_written:=false;
  798. {$endif GDB}
  799. { leave when we got an error }
  800. if status.errorcount>0 then
  801. begin
  802. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  803. exit;
  804. end;
  805. { insert own objectfile, or say that it's in a library
  806. (no check for an .o when loading) }
  807. if is_assembler_generated then
  808. insertobjectfile
  809. else
  810. current_module^.flags:=current_module^.flags or uf_in_library;
  811. { Write out the ppufile }
  812. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
  813. { write local browser }
  814. {$ifdef UseBrowser}
  815. if cs_local_browser in aktmoduleswitches then
  816. begin
  817. current_module^.localsymtable:=refsymtable;
  818. refsymtable^.write;
  819. refsymtable^.write_browser;
  820. end;
  821. {$endif UseBrowser}
  822. {$ifdef GDB}
  823. pu:=pused_unit(usedunits.first);
  824. while assigned(pu) do
  825. begin
  826. punitsymtable(pu^.u^.globalsymtable)^.is_stab_written:=false;
  827. pu:=pused_unit(pu^.next);
  828. end;
  829. {$endif GDB}
  830. { remove static symtable (=refsymtable) here to save some mem }
  831. {$ifndef UseBrowser}
  832. dispose(st,done);
  833. current_module^.localsymtable:=nil;
  834. {$endif UseBrowser}
  835. { generate imports }
  836. if current_module^.uses_imports then
  837. importlib^.generatelib;
  838. if is_assembler_generated then
  839. begin
  840. { finish asmlist by adding segment starts }
  841. insertsegment;
  842. { assemble }
  843. create_objectfile;
  844. end;
  845. end;
  846. procedure proc_program(islibrary : boolean);
  847. var
  848. st : psymtable;
  849. names : Tstringcontainer;
  850. begin
  851. parse_only:=false;
  852. if islibrary then
  853. begin
  854. consume(_LIBRARY);
  855. stringdispose(current_module^.modulename);
  856. current_module^.modulename:=stringdup(pattern);
  857. consume(ID);
  858. consume(SEMICOLON);
  859. end
  860. else
  861. { is there an program head ? }
  862. if token=_PROGRAM then
  863. begin
  864. consume(_PROGRAM);
  865. stringdispose(current_module^.modulename);
  866. current_module^.modulename:=stringdup(pattern);
  867. consume(ID);
  868. if token=LKLAMMER then
  869. begin
  870. consume(LKLAMMER);
  871. idlist;
  872. consume(RKLAMMER);
  873. end;
  874. consume(SEMICOLON);
  875. end;
  876. { global switches are read, so further changes aren't allowed }
  877. current_module^.in_global:=false;
  878. { set implementation flag }
  879. current_module^.in_implementation:=true;
  880. { insert after the unit symbol tables the static symbol table }
  881. { of the program }
  882. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  883. current_module^.localsymtable:=st;
  884. symtablestack:=st;
  885. refsymtable:=st;
  886. { necessary for browser }
  887. loaded_units.insert(current_module);
  888. { load standard units (system,objpas unit) }
  889. loaddefaultunits;
  890. { reset }
  891. lexlevel:=0;
  892. {Load the units used by the program we compile.}
  893. if token=_USES then
  894. loadunits;
  895. {Insert the name of the main program into the symbol table.}
  896. if current_module^.modulename^<>'' then
  897. st^.insert(new(pprogramsym,init(current_module^.modulename^)));
  898. { ...is also constsymtable, this is the symtable where }
  899. { the elements of enumeration types are inserted }
  900. constsymtable:=st;
  901. { Generate a procsym for main }
  902. gen_main_procsym('main',poproginit,st);
  903. { reset }
  904. procprefix:='';
  905. in_except_block:=false;
  906. {The program intialization needs an alias, so it can be called
  907. from the bootstrap code.}
  908. codegen_newprocedure;
  909. names.init;
  910. names.insert('program_init');
  911. names.insert('PASCALMAIN');
  912. names.insert(target_os.cprefix+'main');
  913. {$ifdef m68k}
  914. if target_info.target=target_m68k_PalmOS then
  915. names.insert('PilotMain');
  916. {$endif}
  917. compile_proc_body(names,true,false);
  918. names.done;
  919. { avoid self recursive destructor call !! PM }
  920. aktprocsym^.definition^.localst:=nil;
  921. codegen_doneprocedure;
  922. { consume the last point }
  923. consume(POINT);
  924. { leave when we got an error }
  925. if status.errorcount>0 then
  926. begin
  927. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  928. exit;
  929. end;
  930. { insert heap }
  931. insertheap;
  932. { generate imports }
  933. if current_module^.uses_imports then
  934. importlib^.generatelib;
  935. inserttargetspecific;
  936. datasize:=symtablestack^.datasize;
  937. { finish asmlist by adding segment starts }
  938. insertsegment;
  939. { insert own objectfile }
  940. insertobjectfile;
  941. { assemble and link }
  942. create_objectfile;
  943. { create the executable when we are at level 1 }
  944. if (compile_level=1) then
  945. begin
  946. if (cs_link_deffile in aktglobalswitches) then
  947. deffile.writefile;
  948. if (not current_module^.is_unit) then
  949. Linker.MakeExecutable;
  950. end;
  951. end;
  952. end.
  953. {
  954. $Log$
  955. Revision 1.70 1998-10-20 09:30:05 peter
  956. * set also in_library flag when no .o is generated
  957. Revision 1.68 1998/10/19 08:54:59 pierre
  958. * wrong stabs info corrected once again !!
  959. + variable vmt offset with vmt field only if required
  960. implemented now !!!
  961. Revision 1.67 1998/10/13 13:10:25 peter
  962. * new style for m68k/i386 infos and enums
  963. Revision 1.66 1998/10/09 16:36:05 pierre
  964. * some memory leaks specific to usebrowser define fixed
  965. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  966. Revision 1.65 1998/10/09 14:38:55 pierre
  967. * add a second load for PPU file
  968. Revision 1.64 1998/10/09 08:56:28 pierre
  969. * several memory leaks fixed
  970. Revision 1.63 1998/10/08 23:29:01 peter
  971. * -vu shows unit info, -vt shows tried/used files
  972. Revision 1.62 1998/10/08 17:17:25 pierre
  973. * current_module old scanner tagged as invalid if unit is recompiled
  974. + added ppheap for better info on tracegetmem of heaptrc
  975. (adds line column and file index)
  976. * several memory leaks removed ith help of heaptrc !!
  977. Revision 1.61 1998/10/08 13:48:47 peter
  978. * fixed memory leaks for do nothing source
  979. * fixed unit interdependency
  980. Revision 1.60 1998/10/06 17:16:54 pierre
  981. * some memory leaks fixed (thanks to Peter for heaptrc !)
  982. Revision 1.59 1998/10/05 21:33:26 peter
  983. * fixed 161,165,166,167,168
  984. Revision 1.58 1998/09/30 16:43:37 peter
  985. * fixed unit interdependency with circular uses
  986. Revision 1.57 1998/09/30 12:11:52 peter
  987. * fixed circular uses which looped forever
  988. Revision 1.56 1998/09/28 11:22:15 pierre
  989. * did not compile for browser
  990. * merge from fixes
  991. Revision 1.48.2.1 1998/09/28 10:55:16 pierre
  992. fix for current_module dispose bug
  993. Revision 1.55 1998/09/28 11:04:03 peter
  994. * fixed loaddefaultunits which was at the wrong place for programs, so
  995. the default defs were not loaded when main was initialized
  996. Revision 1.54 1998/09/24 23:49:12 peter
  997. + aktmodeswitches
  998. Revision 1.53 1998/09/23 12:20:50 pierre
  999. * main program tmodule had no symtable (crashed browser)
  1000. * unit symbols problem fixed !!
  1001. Revision 1.52 1998/09/22 17:13:49 pierre
  1002. + browsing updated and developed
  1003. records and objects fields are also stored
  1004. Revision 1.51 1998/09/22 15:40:55 peter
  1005. * some extra ifdef GDB
  1006. Revision 1.50 1998/09/21 08:45:17 pierre
  1007. + added vmt_offset in tobjectdef.write for fututre use
  1008. (first steps to have objects without vmt if no virtual !!)
  1009. + added fpu_used field for tabstractprocdef :
  1010. sets this level to 2 if the functions return with value in FPU
  1011. (is then set to correct value at parsing of implementation)
  1012. THIS MIGHT refuse some code with FPU expression too complex
  1013. that were accepted before and even in some cases
  1014. that don't overflow in fact
  1015. ( like if f : float; is a forward that finally in implementation
  1016. only uses one fpu register !!)
  1017. Nevertheless I think that it will improve security on
  1018. FPU operations !!
  1019. * most other changes only for UseBrowser code
  1020. (added symtable references for record and objects)
  1021. local switch for refs to args and local of each function
  1022. (static symtable still missing)
  1023. UseBrowser still not stable and probably broken by
  1024. the definition hash array !!
  1025. Revision 1.49 1998/09/18 08:01:36 pierre
  1026. + improvement on the usebrowser part
  1027. (does not work correctly for now)
  1028. Revision 1.48 1998/09/09 15:33:07 peter
  1029. * fixed in_global to allow directives also after interface token
  1030. Revision 1.47 1998/09/09 11:50:55 pierre
  1031. * forward def are not put in record or objects
  1032. + added check for forwards also in record and objects
  1033. * dummy parasymtable for unit initialization removed from
  1034. symtable stack
  1035. Revision 1.46 1998/09/03 11:24:01 peter
  1036. * moved more inputfile things from tscannerfile to tinputfile
  1037. * changed ifdef Sourceline to cs_asm_source
  1038. Revision 1.45 1998/08/31 12:26:28 peter
  1039. * m68k and palmos updates from surebugfixes
  1040. Revision 1.44 1998/08/26 15:35:33 peter
  1041. * fixed scannerfiles for macros
  1042. + $I %<environment>%
  1043. Revision 1.43 1998/08/26 10:08:47 peter
  1044. * fixed problem with libprefix at the wrong place
  1045. * fixed lib generation with smartlinking and no -CS used
  1046. Revision 1.42 1998/08/19 18:04:54 peter
  1047. * fixed current_module^.in_implementation flag
  1048. Revision 1.41 1998/08/17 10:10:08 peter
  1049. - removed OLDPPU
  1050. Revision 1.40 1998/08/17 09:17:50 peter
  1051. * static/shared linking updates
  1052. Revision 1.39 1998/08/14 21:56:37 peter
  1053. * setting the outputfile using -o works now to create static libs
  1054. Revision 1.38 1998/08/10 14:50:13 peter
  1055. + localswitches, moduleswitches, globalswitches splitting
  1056. Revision 1.37 1998/08/10 10:18:31 peter
  1057. + Compiler,Comphook unit which are the new interface units to the
  1058. compiler
  1059. Revision 1.36 1998/07/14 14:46:54 peter
  1060. * released NEWINPUT
  1061. Revision 1.35 1998/07/08 12:39:38 peter
  1062. * heap_size for m68k
  1063. Revision 1.34 1998/07/07 11:20:03 peter
  1064. + NEWINPUT for a better inputfile and scanner object
  1065. Revision 1.33 1998/06/25 11:15:34 pierre
  1066. * ppu files where not closed in newppu !!
  1067. second compilation was impossible due to too many opened files
  1068. (not visible in 'make cycle' as we remove all the ppu files)
  1069. Revision 1.32 1998/06/25 08:48:16 florian
  1070. * first version of rtti support
  1071. Revision 1.31 1998/06/24 14:48:35 peter
  1072. * ifdef newppu -> ifndef oldppu
  1073. Revision 1.30 1998/06/17 14:10:16 peter
  1074. * small os2 fixes
  1075. * fixed interdependent units with newppu (remake3 under linux works now)
  1076. Revision 1.29 1998/06/16 08:56:25 peter
  1077. + targetcpu
  1078. * cleaner pmodules for newppu
  1079. Revision 1.28 1998/06/13 00:10:10 peter
  1080. * working browser and newppu
  1081. * some small fixes against crashes which occured in bp7 (but not in
  1082. fpc?!)
  1083. Revision 1.27 1998/06/11 13:58:08 peter
  1084. * small fix to let newppu compile
  1085. Revision 1.26 1998/06/09 16:01:47 pierre
  1086. + added procedure directive parsing for procvars
  1087. (accepted are popstack cdecl and pascal)
  1088. + added C vars with the following syntax
  1089. var C calias 'true_c_name';(can be followed by external)
  1090. reason is that you must add the Cprefix
  1091. which is target dependent
  1092. Revision 1.25 1998/06/08 22:59:49 peter
  1093. * smartlinking works for win32
  1094. * some defines to exclude some compiler parts
  1095. Revision 1.24 1998/06/08 13:13:44 pierre
  1096. + temporary variables now in temp_gen.pas unit
  1097. because it is processor independent
  1098. * mppc68k.bat modified to undefine i386 and support_mmx
  1099. (which are defaults for i386)
  1100. Revision 1.23 1998/06/05 17:47:29 peter
  1101. * some better uses clauses
  1102. Revision 1.22 1998/06/05 14:37:34 pierre
  1103. * fixes for inline for operators
  1104. * inline procedure more correctly restricted
  1105. Revision 1.21 1998/06/04 23:51:53 peter
  1106. * m68k compiles
  1107. + .def file creation moved to gendef.pas so it could also be used
  1108. for win32
  1109. Revision 1.20 1998/06/04 09:55:42 pierre
  1110. * demangled name of procsym reworked to become independant of the mangling scheme
  1111. Revision 1.19 1998/06/03 23:40:38 peter
  1112. + unlimited file support, release tempclose
  1113. Revision 1.18 1998/06/03 22:49:00 peter
  1114. + wordbool,longbool
  1115. * rename bis,von -> high,low
  1116. * moved some systemunit loading/creating to psystem.pas
  1117. Revision 1.17 1998/05/28 14:40:25 peter
  1118. * fixes for newppu, remake3 works now with it
  1119. Revision 1.16 1998/05/27 19:45:06 peter
  1120. * symtable.pas splitted into includefiles
  1121. * symtable adapted for $ifdef NEWPPU
  1122. Revision 1.15 1998/05/23 01:21:22 peter
  1123. + aktasmmode, aktoptprocessor, aktoutputformat
  1124. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1125. + $LIBNAME to set the library name where the unit will be put in
  1126. * splitted cgi386 a bit (codeseg to large for bp7)
  1127. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1128. Revision 1.14 1998/05/20 09:42:35 pierre
  1129. + UseTokenInfo now default
  1130. * unit in interface uses and implementation uses gives error now
  1131. * only one error for unknown symbol (uses lastsymknown boolean)
  1132. the problem came from the label code !
  1133. + first inlined procedures and function work
  1134. (warning there might be allowed cases were the result is still wrong !!)
  1135. * UseBrower updated gives a global list of all position of all used symbols
  1136. with switch -gb
  1137. Revision 1.13 1998/05/12 10:47:00 peter
  1138. * moved printstatus to verb_def
  1139. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1140. prefix like error: warning: and is included in V_Default
  1141. * fixed some messages
  1142. * first time parameter scan is only for -v and -T
  1143. - removed old style messages
  1144. Revision 1.12 1998/05/11 13:07:56 peter
  1145. + $ifdef NEWPPU for the new ppuformat
  1146. + $define GDB not longer required
  1147. * removed all warnings and stripped some log comments
  1148. * no findfirst/findnext anymore to remove smartlink *.o files
  1149. Revision 1.11 1998/05/06 18:36:53 peter
  1150. * tai_section extended with code,data,bss sections and enumerated type
  1151. * ident 'compiled by FPC' moved to pmodules
  1152. * small fix for smartlink
  1153. Revision 1.10 1998/05/04 17:54:28 peter
  1154. + smartlinking works (only case jumptable left todo)
  1155. * redesign of systems.pas to support assemblers and linkers
  1156. + Unitname is now also in the PPU-file, increased version to 14
  1157. Revision 1.9 1998/05/01 16:38:45 florian
  1158. * handling of private and protected fixed
  1159. + change_keywords_to_tp implemented to remove
  1160. keywords which aren't supported by tp
  1161. * break and continue are now symbols of the system unit
  1162. + widestring, longstring and ansistring type released
  1163. Revision 1.8 1998/04/30 15:59:41 pierre
  1164. * GDB works again better :
  1165. correct type info in one pass
  1166. + UseTokenInfo for better source position
  1167. * fixed one remaining bug in scanner for line counts
  1168. * several little fixes
  1169. Revision 1.7 1998/04/29 10:33:59 pierre
  1170. + added some code for ansistring (not complete nor working yet)
  1171. * corrected operator overloading
  1172. * corrected nasm output
  1173. + started inline procedures
  1174. + added starstarn : use ** for exponentiation (^ gave problems)
  1175. + started UseTokenInfo cond to get accurate positions
  1176. Revision 1.6 1998/04/27 23:10:28 peter
  1177. + new scanner
  1178. * $makelib -> if smartlink
  1179. * small filename fixes pmodule.setfilename
  1180. * moved import from files.pas -> import.pas
  1181. Revision 1.5 1998/04/14 23:27:03 florian
  1182. + exclude/include with constant second parameter added
  1183. Revision 1.4 1998/04/10 14:41:43 peter
  1184. * removed some Hints
  1185. * small speed optimization for AsmLn
  1186. Revision 1.3 1998/04/03 09:51:00 daniel
  1187. * Fixed heap allocation for OS/2.
  1188. }