fppu.pas 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements the first loading and searching of the modules
  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 fppu;
  19. {$i fpcdefs.inc}
  20. { close ppufiles on system that are
  21. short on file handles like DOS system PM }
  22. {$ifdef GO32V2}
  23. {$define SHORT_ON_FILE_HANDLES}
  24. {$endif GO32V2}
  25. interface
  26. uses
  27. cutils,cclasses,
  28. globtype,globals,finput,fmodule,
  29. symbase,symppu,ppu;
  30. type
  31. tppumodule = class(tmodule)
  32. ppufile : tcompilerppufile; { the PPU file }
  33. {$ifdef Test_Double_checksum}
  34. crc_array : pointer;
  35. crc_size : longint;
  36. crc_array2 : pointer;
  37. crc_size2 : longint;
  38. {$endif def Test_Double_checksum}
  39. constructor create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
  40. destructor destroy;override;
  41. procedure reset;override;
  42. function openppu:boolean;
  43. function search_unit(const n : string;const fn:string;onlysource:boolean):boolean;
  44. procedure getppucrc;
  45. procedure writeppu;
  46. procedure loadppu;
  47. private
  48. procedure load_interface;
  49. procedure load_implementation;
  50. procedure load_symtable_refs;
  51. procedure load_usedunits;
  52. procedure writeusedmacro(p:TNamedIndexItem;arg:pointer);
  53. procedure writeusedmacros;
  54. procedure writesourcefiles;
  55. procedure writeusedunit;
  56. procedure writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
  57. procedure putasmsymbol_in_idx(s:tnamedindexitem;arg:pointer);
  58. procedure writeasmsymbols;
  59. procedure readusedmacros;
  60. procedure readsourcefiles;
  61. procedure readloadunit;
  62. procedure readlinkcontainer(var p:tlinkcontainer);
  63. procedure readasmsymbols;
  64. end;
  65. function loadunit(const s : stringid;const fn:string) : tmodule;
  66. implementation
  67. uses
  68. verbose,systems,version,
  69. symtable,
  70. scanner,
  71. aasmbase,
  72. parser;
  73. {****************************************************************************
  74. TPPUMODULE
  75. ****************************************************************************}
  76. constructor tppumodule.create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
  77. begin
  78. inherited create(LoadedFrom,s,_is_unit);
  79. ppufile:=nil;
  80. { search the PPU file if it is an unit }
  81. if is_unit then
  82. begin
  83. { use the realmodulename so we can also find a case sensitive
  84. source filename }
  85. search_unit(realmodulename^,fn,false);
  86. { it the sources_available is changed then we know that
  87. the sources aren't available }
  88. if not sources_avail then
  89. sources_checked:=true;
  90. end;
  91. end;
  92. destructor tppumodule.Destroy;
  93. begin
  94. if assigned(ppufile) then
  95. ppufile.free;
  96. ppufile:=nil;
  97. inherited Destroy;
  98. end;
  99. procedure tppumodule.reset;
  100. begin
  101. if assigned(ppufile) then
  102. begin
  103. ppufile.free;
  104. ppufile:=nil;
  105. end;
  106. inherited reset;
  107. end;
  108. function tppumodule.openppu:boolean;
  109. var
  110. ppufiletime : longint;
  111. begin
  112. openppu:=false;
  113. Message1(unit_t_ppu_loading,ppufilename^);
  114. { Get ppufile time (also check if the file exists) }
  115. ppufiletime:=getnamedfiletime(ppufilename^);
  116. if ppufiletime=-1 then
  117. exit;
  118. { Open the ppufile }
  119. Message1(unit_u_ppu_name,ppufilename^);
  120. ppufile:=tcompilerppufile.create(ppufilename^);
  121. if not ppufile.openfile then
  122. begin
  123. ppufile.free;
  124. ppufile:=nil;
  125. Message(unit_u_ppu_file_too_short);
  126. exit;
  127. end;
  128. { check for a valid PPU file }
  129. if not ppufile.CheckPPUId then
  130. begin
  131. ppufile.free;
  132. ppufile:=nil;
  133. Message(unit_u_ppu_invalid_header);
  134. exit;
  135. end;
  136. { check for allowed PPU versions }
  137. if not (ppufile.GetPPUVersion = CurrentPPUVersion) then
  138. begin
  139. Message1(unit_u_ppu_invalid_version,tostr(ppufile.GetPPUVersion));
  140. ppufile.free;
  141. ppufile:=nil;
  142. exit;
  143. end;
  144. { check the target processor }
  145. if tsystemcpu(ppufile.header.cpu)<>target_cpu then
  146. begin
  147. ppufile.free;
  148. ppufile:=nil;
  149. Message(unit_u_ppu_invalid_processor);
  150. exit;
  151. end;
  152. { check target }
  153. if tsystem(ppufile.header.target)<>target_info.system then
  154. begin
  155. ppufile.free;
  156. ppufile:=nil;
  157. Message(unit_u_ppu_invalid_target);
  158. exit;
  159. end;
  160. {$ifdef cpufpemu}
  161. { check if floating point emulation is on?}
  162. if ((ppufile.header.flags and uf_fpu_emulation)<>0) and
  163. (cs_fp_emulation in aktmoduleswitches) then
  164. begin
  165. ppufile.free;
  166. ppufile:=nil;
  167. Message(unit_u_ppu_invalid_fpumode);
  168. exit;
  169. end;
  170. {$endif cpufpemu}
  171. { Load values to be access easier }
  172. flags:=ppufile.header.flags;
  173. crc:=ppufile.header.checksum;
  174. interface_crc:=ppufile.header.interface_checksum;
  175. { Show Debug info }
  176. Message1(unit_u_ppu_time,filetimestring(ppufiletime));
  177. Message1(unit_u_ppu_flags,tostr(flags));
  178. Message1(unit_u_ppu_crc,hexstr(ppufile.header.checksum,8));
  179. Message1(unit_u_ppu_crc,hexstr(ppufile.header.interface_checksum,8)+' (intfc)');
  180. do_compile:=false;
  181. openppu:=true;
  182. end;
  183. function tppumodule.search_unit(const n : string;const fn:string;onlysource:boolean):boolean;
  184. var
  185. singlepathstring,
  186. filename : string;
  187. Function UnitExists(const ext:string;var foundfile:string):boolean;
  188. begin
  189. Message1(unit_t_unitsearch,Singlepathstring+filename+ext);
  190. UnitExists:=FindFile(FileName+ext,Singlepathstring,foundfile);
  191. end;
  192. Function PPUSearchPath(const s:string):boolean;
  193. var
  194. found : boolean;
  195. hs : string;
  196. begin
  197. Found:=false;
  198. singlepathstring:=FixPath(s,false);
  199. { Check for PPU file }
  200. Found:=UnitExists(target_info.unitext,hs);
  201. if Found then
  202. Begin
  203. SetFileName(hs,false);
  204. Found:=OpenPPU;
  205. End;
  206. PPUSearchPath:=Found;
  207. end;
  208. Function SourceSearchPath(const s:string):boolean;
  209. var
  210. found : boolean;
  211. hs : string;
  212. begin
  213. Found:=false;
  214. singlepathstring:=FixPath(s,false);
  215. { Check for Sources }
  216. ppufile:=nil;
  217. do_compile:=true;
  218. recompile_reason:=rr_noppu;
  219. {Check for .pp file}
  220. Found:=UnitExists(target_info.sourceext,hs);
  221. if not Found then
  222. begin
  223. { Check for .pas }
  224. Found:=UnitExists(target_info.pasext,hs);
  225. end;
  226. stringdispose(mainsource);
  227. if Found then
  228. begin
  229. sources_avail:=true;
  230. { Load Filenames when found }
  231. mainsource:=StringDup(hs);
  232. SetFileName(hs,false);
  233. end
  234. else
  235. sources_avail:=false;
  236. SourceSearchPath:=Found;
  237. end;
  238. Function SearchPath(const s:string):boolean;
  239. var
  240. found : boolean;
  241. begin
  242. { First check for a ppu, then for the source }
  243. found:=false;
  244. if not onlysource then
  245. found:=PPUSearchPath(s);
  246. if not found then
  247. found:=SourceSearchPath(s);
  248. SearchPath:=found;
  249. end;
  250. Function SearchPathList(list:TSearchPathList):boolean;
  251. var
  252. hp : TStringListItem;
  253. found : boolean;
  254. begin
  255. found:=false;
  256. hp:=TStringListItem(list.First);
  257. while assigned(hp) do
  258. begin
  259. found:=SearchPath(hp.Str);
  260. if found then
  261. break;
  262. hp:=TStringListItem(hp.next);
  263. end;
  264. SearchPathList:=found;
  265. end;
  266. var
  267. fnd : boolean;
  268. hs : string;
  269. begin
  270. filename:=FixFileName(n);
  271. { try to find unit
  272. 1. look for ppu in cwd
  273. 2. look for ppu in outputpath if set, this is tp7 compatible (PFV)
  274. 3. look for the specified source file (from the uses line)
  275. 4. look for source in cwd
  276. 5. local unit pathlist
  277. 6. global unit pathlist }
  278. fnd:=false;
  279. if not onlysource then
  280. begin
  281. fnd:=PPUSearchPath('.');
  282. if (not fnd) and (outputpath^<>'') then
  283. fnd:=PPUSearchPath(outputpath^);
  284. end;
  285. if (not fnd) and (fn<>'') then
  286. begin
  287. { the full filename is specified so we can't use here the
  288. searchpath (PFV) }
  289. Message1(unit_t_unitsearch,AddExtension(fn,target_info.sourceext));
  290. fnd:=FindFile(AddExtension(fn,target_info.sourceext),'',hs);
  291. if not fnd then
  292. begin
  293. Message1(unit_t_unitsearch,AddExtension(fn,target_info.pasext));
  294. fnd:=FindFile(AddExtension(fn,target_info.pasext),'',hs);
  295. end;
  296. if fnd then
  297. begin
  298. sources_avail:=true;
  299. do_compile:=true;
  300. recompile_reason:=rr_noppu;
  301. stringdispose(mainsource);
  302. mainsource:=StringDup(hs);
  303. SetFileName(hs,false);
  304. end;
  305. end;
  306. if(not fnd)and Assigned(Loaded_From)
  307. then
  308. fnd:=SearchPathList(Loaded_From.LocalUnitSearchPath);
  309. if not fnd
  310. then
  311. fnd:=SourceSearchPath('.');
  312. if not fnd
  313. then
  314. fnd:=SearchPathList(LocalUnitSearchPath);
  315. if not fnd
  316. then
  317. fnd:=SearchPathList(UnitSearchPath);
  318. { try to find a file with the first 8 chars of the modulename, like
  319. dos }
  320. if (not fnd) and (length(filename)>8) then
  321. begin
  322. filename:=copy(filename,1,8);
  323. fnd:=SearchPath('.');
  324. if (not fnd) then
  325. fnd:=SearchPathList(LocalUnitSearchPath);
  326. if not fnd then
  327. fnd:=SearchPathList(UnitSearchPath);
  328. end;
  329. search_unit:=fnd;
  330. end;
  331. {**********************************
  332. PPU Reading/Writing Helpers
  333. ***********************************}
  334. procedure tppumodule.writeusedmacro(p:TNamedIndexItem;arg:pointer);
  335. begin
  336. if tmacro(p).is_used or tmacro(p).defined_at_startup then
  337. begin
  338. ppufile.putstring(p.name);
  339. ppufile.putbyte(byte(tmacro(p).defined_at_startup));
  340. ppufile.putbyte(byte(tmacro(p).is_used));
  341. end;
  342. end;
  343. procedure tppumodule.writeusedmacros;
  344. begin
  345. ppufile.do_crc:=false;
  346. tscannerfile(scanner).macros.foreach({$ifdef FPCPROCVAR}@{$endif}writeusedmacro,nil);
  347. ppufile.writeentry(ibusedmacros);
  348. ppufile.do_crc:=true;
  349. end;
  350. procedure tppumodule.writesourcefiles;
  351. var
  352. hp : tinputfile;
  353. i,j : longint;
  354. begin
  355. { second write the used source files }
  356. ppufile.do_crc:=false;
  357. hp:=sourcefiles.files;
  358. { write source files directly in good order }
  359. j:=0;
  360. while assigned(hp) do
  361. begin
  362. inc(j);
  363. hp:=hp.ref_next;
  364. end;
  365. while j>0 do
  366. begin
  367. hp:=sourcefiles.files;
  368. for i:=1 to j-1 do
  369. hp:=hp.ref_next;
  370. ppufile.putstring(hp.name^);
  371. ppufile.putlongint(hp.getfiletime);
  372. dec(j);
  373. end;
  374. ppufile.writeentry(ibsourcefiles);
  375. ppufile.do_crc:=true;
  376. end;
  377. procedure tppumodule.writeusedunit;
  378. var
  379. hp : tused_unit;
  380. begin
  381. { renumber the units for derefence writing }
  382. numberunits;
  383. { write a reference for each used unit }
  384. hp:=tused_unit(used_units.first);
  385. while assigned(hp) do
  386. begin
  387. { implementation units should not change
  388. the CRC PM }
  389. ppufile.do_crc:=hp.in_interface;
  390. ppufile.putstring(hp.realname^);
  391. { the checksum should not affect the crc of this unit ! (PFV) }
  392. ppufile.do_crc:=false;
  393. ppufile.putlongint(longint(hp.checksum));
  394. ppufile.putlongint(longint(hp.interface_checksum));
  395. ppufile.putbyte(byte(hp.in_interface));
  396. ppufile.do_crc:=true;
  397. hp:=tused_unit(hp.next);
  398. end;
  399. ppufile.do_interface_crc:=true;
  400. ppufile.writeentry(ibloadunit);
  401. end;
  402. procedure tppumodule.writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
  403. var
  404. hcontainer : tlinkcontainer;
  405. s : string;
  406. mask : cardinal;
  407. begin
  408. hcontainer:=TLinkContainer.Create;
  409. while not p.empty do
  410. begin
  411. s:=p.get(mask);
  412. if strippath then
  413. ppufile.putstring(SplitFileName(s))
  414. else
  415. ppufile.putstring(s);
  416. ppufile.putlongint(mask);
  417. hcontainer.add(s,mask);
  418. end;
  419. ppufile.writeentry(id);
  420. p.Free;
  421. p:=hcontainer;
  422. end;
  423. procedure tppumodule.putasmsymbol_in_idx(s:tnamedindexitem;arg:pointer);
  424. begin
  425. if tasmsymbol(s).ppuidx<>-1 then
  426. librarydata.asmsymbolidx^[tasmsymbol(s).ppuidx-1]:=tasmsymbol(s);
  427. end;
  428. procedure tppumodule.writeasmsymbols;
  429. var
  430. s : tasmsymbol;
  431. i : longint;
  432. asmsymtype : byte;
  433. begin
  434. { get an ordered list of all symbols to put in the ppu }
  435. getmem(librarydata.asmsymbolidx,librarydata.asmsymbolppuidx*sizeof(pointer));
  436. fillchar(librarydata.asmsymbolidx^,librarydata.asmsymbolppuidx*sizeof(pointer),0);
  437. librarydata.symbolsearch.foreach({$ifdef FPCPROCVAR}@{$endif}putasmsymbol_in_idx,nil);
  438. { write the number of symbols }
  439. ppufile.putlongint(librarydata.asmsymbolppuidx);
  440. { write the symbols from the indexed list to the ppu }
  441. for i:=1 to librarydata.asmsymbolppuidx do
  442. begin
  443. s:=librarydata.asmsymbolidx^[i-1];
  444. if not assigned(s) then
  445. internalerror(200208071);
  446. asmsymtype:=1;
  447. if s.Classtype=tasmlabel then
  448. begin
  449. if tasmlabel(s).is_addr then
  450. asmsymtype:=4
  451. else if tasmlabel(s).typ=AT_DATA then
  452. asmsymtype:=3
  453. else
  454. asmsymtype:=2;
  455. end;
  456. ppufile.putbyte(asmsymtype);
  457. case asmsymtype of
  458. 1 :
  459. ppufile.putstring(s.name);
  460. 2 :
  461. ppufile.putlongint(tasmlabel(s).labelnr);
  462. end;
  463. ppufile.putbyte(byte(s.defbind));
  464. ppufile.putbyte(byte(s.typ));
  465. end;
  466. ppufile.writeentry(ibasmsymbols);
  467. end;
  468. procedure tppumodule.readusedmacros;
  469. var
  470. hs : string;
  471. mac : tmacro;
  472. was_defined_at_startup,
  473. was_used : boolean;
  474. begin
  475. { only possible when we've a scanner of the current file }
  476. if not assigned(current_scanner) then
  477. exit;
  478. while not ppufile.endofentry do
  479. begin
  480. hs:=ppufile.getstring;
  481. was_defined_at_startup:=boolean(ppufile.getbyte);
  482. was_used:=boolean(ppufile.getbyte);
  483. mac:=tmacro(tscannerfile(current_scanner).macros.search(hs));
  484. if assigned(mac) then
  485. begin
  486. {$ifndef EXTDEBUG}
  487. { if we don't have the sources why tell }
  488. if sources_avail then
  489. {$endif ndef EXTDEBUG}
  490. if (not was_defined_at_startup) and
  491. was_used and
  492. mac.defined_at_startup then
  493. Message2(unit_h_cond_not_set_in_last_compile,hs,mainsource^);
  494. end
  495. else { not assigned }
  496. if was_defined_at_startup and
  497. was_used then
  498. Message2(unit_h_cond_set_in_last_compile,hs,mainsource^);
  499. end;
  500. end;
  501. procedure tppumodule.readsourcefiles;
  502. var
  503. temp,hs : string;
  504. temp_dir : string;
  505. main_dir : string;
  506. incfile_found,
  507. main_found,
  508. is_main : boolean;
  509. orgfiletime,
  510. source_time : longint;
  511. hp : tinputfile;
  512. begin
  513. sources_avail:=true;
  514. is_main:=true;
  515. main_dir:='';
  516. while not ppufile.endofentry do
  517. begin
  518. hs:=ppufile.getstring;
  519. orgfiletime:=ppufile.getlongint;
  520. temp_dir:='';
  521. if (flags and uf_in_library)<>0 then
  522. begin
  523. sources_avail:=false;
  524. temp:=' library';
  525. end
  526. else if pos('Macro ',hs)=1 then
  527. begin
  528. { we don't want to find this file }
  529. { but there is a problem with file indexing !! }
  530. temp:='';
  531. end
  532. else
  533. begin
  534. { check the date of the source files }
  535. Source_Time:=GetNamedFileTime(path^+hs);
  536. incfile_found:=false;
  537. main_found:=false;
  538. if Source_Time<>-1 then
  539. hs:=path^+hs
  540. else
  541. if not(is_main) then
  542. begin
  543. Source_Time:=GetNamedFileTime(main_dir+hs);
  544. if Source_Time<>-1 then
  545. hs:=main_dir+hs;
  546. end;
  547. if (Source_Time=-1) then
  548. begin
  549. if is_main then
  550. main_found:=unitsearchpath.FindFile(hs,temp_dir)
  551. else
  552. incfile_found:=includesearchpath.FindFile(hs,temp_dir);
  553. if incfile_found or main_found then
  554. begin
  555. Source_Time:=GetNamedFileTime(temp_dir);
  556. if Source_Time<>-1 then
  557. hs:=temp_dir;
  558. end;
  559. end;
  560. if Source_Time=-1 then
  561. begin
  562. sources_avail:=false;
  563. temp:=' not found';
  564. end
  565. else
  566. begin
  567. if main_found then
  568. main_dir:=temp_dir;
  569. { time newer? But only allow if the file is not searched
  570. in the include path (PFV), else you've problems with
  571. units which use the same includefile names }
  572. if incfile_found then
  573. temp:=' found'
  574. else
  575. begin
  576. temp:=' time '+filetimestring(source_time);
  577. if (orgfiletime<>-1) and
  578. (source_time<>orgfiletime) then
  579. begin
  580. if ((flags and uf_release)=0) then
  581. begin
  582. do_compile:=true;
  583. recompile_reason:=rr_sourcenewer;
  584. end
  585. else
  586. Message2(unit_h_source_modified,hs,ppufilename^);
  587. temp:=temp+' *';
  588. end;
  589. end;
  590. end;
  591. hp:=tinputfile.create(hs);
  592. { the indexing is wrong here PM }
  593. sourcefiles.register_file(hp);
  594. end;
  595. if is_main then
  596. begin
  597. stringdispose(mainsource);
  598. mainsource:=stringdup(hs);
  599. end;
  600. Message1(unit_u_ppu_source,hs+temp);
  601. is_main:=false;
  602. end;
  603. { check if we want to rebuild every unit, only if the sources are
  604. available }
  605. if do_build and sources_avail and
  606. ((flags and uf_release)=0) then
  607. begin
  608. do_compile:=true;
  609. recompile_reason:=rr_build;
  610. end;
  611. end;
  612. procedure tppumodule.readloadunit;
  613. var
  614. hs : string;
  615. intfchecksum,
  616. checksum : cardinal;
  617. in_interface : boolean;
  618. begin
  619. while not ppufile.endofentry do
  620. begin
  621. hs:=ppufile.getstring;
  622. checksum:=cardinal(ppufile.getlongint);
  623. intfchecksum:=cardinal(ppufile.getlongint);
  624. in_interface:=(ppufile.getbyte<>0);
  625. used_units.concat(tused_unit.create_to_load(hs,checksum,intfchecksum,in_interface));
  626. end;
  627. end;
  628. procedure tppumodule.readlinkcontainer(var p:tlinkcontainer);
  629. var
  630. s : string;
  631. m : longint;
  632. begin
  633. while not ppufile.endofentry do
  634. begin
  635. s:=ppufile.getstring;
  636. m:=ppufile.getlongint;
  637. p.add(s,m);
  638. end;
  639. end;
  640. procedure tppumodule.readasmsymbols;
  641. var
  642. labelnr,
  643. i : longint;
  644. name : string;
  645. bind : TAsmSymBind;
  646. typ : TAsmSymType;
  647. asmsymtype : byte;
  648. begin
  649. librarydata.asmsymbolppuidx:=ppufile.getlongint;
  650. if librarydata.asmsymbolppuidx>0 then
  651. begin
  652. getmem(librarydata.asmsymbolidx,librarydata.asmsymbolppuidx*sizeof(pointer));
  653. fillchar(librarydata.asmsymbolidx^,librarydata.asmsymbolppuidx*sizeof(pointer),0);
  654. for i:=1 to librarydata.asmsymbolppuidx do
  655. begin
  656. asmsymtype:=ppufile.getbyte;
  657. case asmsymtype of
  658. 1 :
  659. name:=ppufile.getstring;
  660. 2..4 :
  661. labelnr:=ppufile.getlongint;
  662. else
  663. internalerror(200208192);
  664. end;
  665. bind:=tasmsymbind(ppufile.getbyte);
  666. typ:=tasmsymtype(ppufile.getbyte);
  667. case asmsymtype of
  668. 1 :
  669. librarydata.asmsymbolidx^[i-1]:=librarydata.newasmsymboltype(name,bind,typ);
  670. 2 :
  671. librarydata.asmsymbolidx^[i-1]:=librarydata.newasmlabel(labelnr,false,false);
  672. 3 :
  673. librarydata.asmsymbolidx^[i-1]:=librarydata.newasmlabel(labelnr,true,false);
  674. 4 :
  675. librarydata.asmsymbolidx^[i-1]:=librarydata.newasmlabel(labelnr,false,true);
  676. end;
  677. end;
  678. end;
  679. end;
  680. procedure tppumodule.load_interface;
  681. var
  682. b : byte;
  683. newmodulename : string;
  684. begin
  685. { read interface part }
  686. repeat
  687. b:=ppufile.readentry;
  688. case b of
  689. ibmodulename :
  690. begin
  691. newmodulename:=ppufile.getstring;
  692. if (cs_check_unit_name in aktglobalswitches) and
  693. (upper(newmodulename)<>modulename^) then
  694. Message2(unit_f_unit_name_error,realmodulename^,newmodulename);
  695. stringdispose(modulename);
  696. stringdispose(realmodulename);
  697. modulename:=stringdup(upper(newmodulename));
  698. realmodulename:=stringdup(newmodulename);
  699. end;
  700. ibsourcefiles :
  701. readsourcefiles;
  702. ibusedmacros :
  703. readusedmacros;
  704. ibloadunit :
  705. readloadunit;
  706. iblinkunitofiles :
  707. readlinkcontainer(LinkUnitOFiles);
  708. iblinkunitstaticlibs :
  709. readlinkcontainer(LinkUnitStaticLibs);
  710. iblinkunitsharedlibs :
  711. readlinkcontainer(LinkUnitSharedLibs);
  712. iblinkotherofiles :
  713. readlinkcontainer(LinkotherOFiles);
  714. iblinkotherstaticlibs :
  715. readlinkcontainer(LinkotherStaticLibs);
  716. iblinkothersharedlibs :
  717. readlinkcontainer(LinkotherSharedLibs);
  718. ibendinterface :
  719. break;
  720. else
  721. Message1(unit_f_ppu_invalid_entry,tostr(b));
  722. end;
  723. until false;
  724. end;
  725. procedure tppumodule.load_implementation;
  726. var
  727. b : byte;
  728. oldobjectlibrary : tasmlibrarydata;
  729. begin
  730. { read implementation part }
  731. repeat
  732. b:=ppufile.readentry;
  733. case b of
  734. ibasmsymbols :
  735. readasmsymbols;
  736. ibendimplementation :
  737. break;
  738. else
  739. Message1(unit_f_ppu_invalid_entry,tostr(b));
  740. end;
  741. until false;
  742. { we can now derefence all pointers to the implementation parts }
  743. oldobjectlibrary:=objectlibrary;
  744. objectlibrary:=librarydata;
  745. tstoredsymtable(globalsymtable).derefimpl;
  746. if assigned(localsymtable) then
  747. tstoredsymtable(localsymtable).derefimpl;
  748. objectlibrary:=oldobjectlibrary;
  749. end;
  750. procedure tppumodule.load_symtable_refs;
  751. var
  752. b : byte;
  753. unitindex : word;
  754. begin
  755. { load local symtable first }
  756. if ((flags and uf_local_browser)<>0) then
  757. begin
  758. localsymtable:=tstaticsymtable.create(modulename^);
  759. tstaticsymtable(localsymtable).ppuload(ppufile);
  760. end;
  761. { load browser }
  762. if (flags and uf_has_browser)<>0 then
  763. begin
  764. tstoredsymtable(globalsymtable).load_references(ppufile,true);
  765. unitindex:=1;
  766. while assigned(map^[unitindex]) do
  767. begin
  768. { each unit wrote one browser entry }
  769. tstoredsymtable(globalsymtable).load_references(ppufile,false);
  770. inc(unitindex);
  771. end;
  772. b:=ppufile.readentry;
  773. if b<>ibendbrowser then
  774. Message1(unit_f_ppu_invalid_entry,tostr(b));
  775. end;
  776. if ((flags and uf_local_browser)<>0) then
  777. tstaticsymtable(localsymtable).load_references(ppufile,true);
  778. end;
  779. procedure tppumodule.writeppu;
  780. var
  781. pu : tused_unit;
  782. begin
  783. Message1(unit_u_ppu_write,realmodulename^);
  784. { create unit flags }
  785. {$ifdef GDB}
  786. if cs_gdb_dbx in aktglobalswitches then
  787. flags:=flags or uf_has_dbx;
  788. {$endif GDB}
  789. if cs_browser in aktmoduleswitches then
  790. flags:=flags or uf_has_browser;
  791. if cs_local_browser in aktmoduleswitches then
  792. flags:=flags or uf_local_browser;
  793. if do_release then
  794. flags:=flags or uf_release;
  795. {$ifdef cpufpemu}
  796. if (cs_fp_emulation in aktmoduleswitches) then
  797. flags:=flags or uf_fpu_emulation;
  798. {$endif cpufpemu}
  799. {$ifdef Test_Double_checksum_write}
  800. Assign(CRCFile,s+'.IMP');
  801. Rewrite(CRCFile);
  802. {$endif def Test_Double_checksum_write}
  803. { create new ppufile }
  804. ppufile:=tcompilerppufile.create(ppufilename^);
  805. if not ppufile.createfile then
  806. Message(unit_f_ppu_cannot_write);
  807. { first the unitname }
  808. ppufile.putstring(realmodulename^);
  809. ppufile.writeentry(ibmodulename);
  810. writesourcefiles;
  811. writeusedmacros;
  812. writeusedunit;
  813. { write the objectfiles and libraries that come for this unit,
  814. preserve the containers becuase they are still needed to load
  815. the link.res. All doesn't depend on the crc! It doesn't matter
  816. if a unit is in a .o or .a file }
  817. ppufile.do_crc:=false;
  818. writelinkcontainer(linkunitofiles,iblinkunitofiles,true);
  819. writelinkcontainer(linkunitstaticlibs,iblinkunitstaticlibs,true);
  820. writelinkcontainer(linkunitsharedlibs,iblinkunitsharedlibs,true);
  821. writelinkcontainer(linkotherofiles,iblinkotherofiles,false);
  822. writelinkcontainer(linkotherstaticlibs,iblinkotherstaticlibs,true);
  823. writelinkcontainer(linkothersharedlibs,iblinkothersharedlibs,true);
  824. ppufile.do_crc:=true;
  825. ppufile.writeentry(ibendinterface);
  826. { write the symtable entries }
  827. tstoredsymtable(globalsymtable).ppuwrite(ppufile);
  828. { everything after this doesn't affect the crc }
  829. ppufile.do_crc:=false;
  830. { write asmsymbols }
  831. writeasmsymbols;
  832. { end of implementation }
  833. ppufile.writeentry(ibendimplementation);
  834. { write static symtable
  835. needed for local debugging of unit functions }
  836. if ((flags and uf_local_browser)<>0) and
  837. assigned(localsymtable) then
  838. tstoredsymtable(localsymtable).ppuwrite(ppufile);
  839. { write all browser section }
  840. if (flags and uf_has_browser)<>0 then
  841. begin
  842. tstoredsymtable(globalsymtable).write_references(ppufile,true);
  843. pu:=tused_unit(used_units.first);
  844. while assigned(pu) do
  845. begin
  846. tstoredsymtable(pu.u.globalsymtable).write_references(ppufile,false);
  847. pu:=tused_unit(pu.next);
  848. end;
  849. ppufile.writeentry(ibendbrowser);
  850. end;
  851. if ((flags and uf_local_browser)<>0) and
  852. assigned(localsymtable) then
  853. tstaticsymtable(localsymtable).write_references(ppufile,true);
  854. { the last entry ibend is written automaticly }
  855. { flush to be sure }
  856. ppufile.flush;
  857. { create and write header }
  858. ppufile.header.size:=ppufile.size;
  859. ppufile.header.checksum:=ppufile.crc;
  860. ppufile.header.interface_checksum:=ppufile.interface_crc;
  861. ppufile.header.compiler:=wordversion;
  862. ppufile.header.cpu:=word(target_cpu);
  863. ppufile.header.target:=word(target_info.system);
  864. ppufile.header.flags:=flags;
  865. ppufile.writeheader;
  866. { save crc in current module also }
  867. crc:=ppufile.crc;
  868. interface_crc:=ppufile.interface_crc;
  869. {$ifdef Test_Double_checksum_write}
  870. close(CRCFile);
  871. {$endif Test_Double_checksum_write}
  872. ppufile.closefile;
  873. ppufile.free;
  874. ppufile:=nil;
  875. end;
  876. procedure tppumodule.getppucrc;
  877. begin
  878. {$ifdef Test_Double_checksum_write}
  879. Assign(CRCFile,s+'.INT')
  880. Rewrite(CRCFile);
  881. {$endif def Test_Double_checksum_write}
  882. { create new ppufile }
  883. ppufile:=tcompilerppufile.create(ppufilename^);
  884. ppufile.crc_only:=true;
  885. if not ppufile.createfile then
  886. Message(unit_f_ppu_cannot_write);
  887. { first the unitname }
  888. ppufile.putstring(realmodulename^);
  889. ppufile.writeentry(ibmodulename);
  890. { the interface units affect the crc }
  891. writeusedunit;
  892. ppufile.writeentry(ibendinterface);
  893. { write the symtable entries }
  894. tstoredsymtable(globalsymtable).ppuwrite(ppufile);
  895. { save crc }
  896. crc:=ppufile.crc;
  897. interface_crc:=ppufile.interface_crc;
  898. {$ifdef Test_Double_checksum}
  899. crc_array:=ppufile.crc_test;
  900. ppufile.crc_test:=nil;
  901. crc_size:=ppufile.crc_index2;
  902. crc_array2:=ppufile.crc_test2;
  903. ppufile.crc_test2:=nil;
  904. crc_size2:=ppufile.crc_index2;
  905. {$endif Test_Double_checksum}
  906. {$ifdef Test_Double_checksum_write}
  907. close(CRCFile);
  908. {$endif Test_Double_checksum_write}
  909. ppufile.closefile;
  910. ppufile.free;
  911. ppufile:=nil;
  912. end;
  913. procedure tppumodule.load_usedunits;
  914. var
  915. pu : tused_unit;
  916. loaded_unit : tmodule;
  917. load_refs : boolean;
  918. nextmapentry : longint;
  919. begin
  920. load_refs:=true;
  921. { init the map }
  922. new(map);
  923. fillchar(map^,sizeof(tunitmap),#0);
  924. {$ifdef NEWMAP}
  925. map^[0]:=current_module;
  926. {$endif NEWMAP}
  927. nextmapentry:=1;
  928. { load the used units from interface }
  929. in_implementation:=false;
  930. pu:=tused_unit(used_units.first);
  931. while assigned(pu) do
  932. begin
  933. if (not pu.loaded) and (pu.in_interface) then
  934. begin
  935. loaded_unit:=loadunit(pu.realname^,'');
  936. if compiled then
  937. exit;
  938. { register unit in used units }
  939. pu.u:=loaded_unit;
  940. pu.loaded:=true;
  941. { doubles are not important for that list PM }
  942. pu.u.dependent_units.concat(tdependent_unit.create(self));
  943. { need to recompile the current unit ? }
  944. if loaded_unit.crc<>pu.checksum then
  945. begin
  946. Message2(unit_u_recompile_crc_change,realmodulename^,pu.realname^);
  947. recompile_reason:=rr_crcchanged;
  948. do_compile:=true;
  949. dispose(map);
  950. map:=nil;
  951. exit;
  952. end;
  953. { setup the map entry for deref }
  954. {$ifndef NEWMAP}
  955. map^[nextmapentry]:=loaded_unit.globalsymtable;
  956. {$else NEWMAP}
  957. map^[nextmapentry]:=loaded_unit;
  958. {$endif NEWMAP}
  959. inc(nextmapentry);
  960. if nextmapentry>maxunits then
  961. Message(unit_f_too_much_units);
  962. end;
  963. pu:=tused_unit(pu.next);
  964. end;
  965. { ok, now load the interface of this unit }
  966. if current_module<>self then
  967. internalerror(200208187);
  968. // current_module:=self;
  969. // SetCompileModule(current_module);
  970. globalsymtable:=tglobalsymtable.create(modulename^);
  971. tstoredsymtable(globalsymtable).ppuload(ppufile);
  972. { now only read the implementation uses }
  973. in_implementation:=true;
  974. pu:=tused_unit(used_units.first);
  975. while assigned(pu) do
  976. begin
  977. if (not pu.loaded) and (not pu.in_interface) then
  978. begin
  979. loaded_unit:=loadunit(pu.realname^,'');
  980. if compiled then
  981. exit;
  982. { register unit in used units }
  983. pu.u:=loaded_unit;
  984. pu.loaded:=true;
  985. { need to recompile the current unit ? }
  986. if (loaded_unit.interface_crc<>pu.interface_checksum) {and
  987. not(current_module.in_second_compile) } then
  988. begin
  989. Message2(unit_u_recompile_crc_change,realmodulename^,pu.realname^+' {impl}');
  990. recompile_reason:=rr_crcchanged;
  991. do_compile:=true;
  992. dispose(map);
  993. map:=nil;
  994. exit;
  995. end;
  996. { setup the map entry for deref }
  997. {$ifndef NEWMAP}
  998. map^[nextmapentry]:=loaded_unit.globalsymtable;
  999. {$else NEWMAP}
  1000. map^[nextmapentry]:=loaded_unit;
  1001. {$endif NEWMAP}
  1002. inc(nextmapentry);
  1003. if nextmapentry>maxunits then
  1004. Message(unit_f_too_much_units);
  1005. end;
  1006. pu:=tused_unit(pu.next);
  1007. end;
  1008. { read the implementation/objectdata part }
  1009. load_implementation;
  1010. { load browser info if stored }
  1011. if ((flags and uf_has_browser)<>0) and load_refs then
  1012. begin
  1013. if current_module<>self then
  1014. internalerror(200208188);
  1015. // current_module:=self;
  1016. load_symtable_refs;
  1017. end;
  1018. { remove the map, it's not needed anymore }
  1019. dispose(map);
  1020. map:=nil;
  1021. end;
  1022. procedure tppumodule.loadppu;
  1023. var
  1024. name : string;
  1025. begin
  1026. { load interface section }
  1027. if not do_compile then
  1028. load_interface;
  1029. { only load units when we don't recompile }
  1030. if not do_compile then
  1031. load_usedunits;
  1032. { recompile if set }
  1033. if do_compile then
  1034. begin
  1035. { we don't need the ppufile anymore }
  1036. if assigned(ppufile) then
  1037. begin
  1038. ppufile.free;
  1039. ppufile:=nil;
  1040. end;
  1041. { recompile the unit or give a fatal error if sources not available }
  1042. if not(sources_avail) and
  1043. not(sources_checked) then
  1044. if (not search_unit(modulename^,'',true))
  1045. and (length(modulename^)>8) then
  1046. search_unit(copy(modulename^,1,8),'',true);
  1047. if not(sources_avail) then
  1048. begin
  1049. if recompile_reason=rr_noppu then
  1050. Message1(unit_f_cant_find_ppu,modulename^)
  1051. else
  1052. Message1(unit_f_cant_compile_unit,modulename^);
  1053. end
  1054. else
  1055. begin
  1056. if in_compile then
  1057. begin
  1058. in_second_compile:=true;
  1059. Message1(parser_d_compiling_second_time,modulename^);
  1060. end;
  1061. name:=mainsource^;
  1062. { compile this module }
  1063. compile(name);
  1064. in_second_compile:=false;
  1065. end;
  1066. end;
  1067. if assigned(ppufile) then
  1068. begin
  1069. ppufile.closefile;
  1070. ppufile.free;
  1071. ppufile:=nil;
  1072. end;
  1073. end;
  1074. {*****************************************************************************
  1075. LoadUnit
  1076. *****************************************************************************}
  1077. function loadunit(const s : stringid;const fn:string) : tmodule;
  1078. const
  1079. ImplIntf : array[boolean] of string[15]=('interface','implementation');
  1080. var
  1081. st : tglobalsymtable;
  1082. second_time : boolean;
  1083. old_current_module,hp2 : tmodule;
  1084. hp : tppumodule;
  1085. scanner : tscannerfile;
  1086. dummy : tmodule;
  1087. ups : stringid;
  1088. begin
  1089. old_current_module:=current_module;
  1090. { we are loading a new module, save the state of the scanner
  1091. and reset scanner+module }
  1092. if assigned(current_scanner) then
  1093. current_scanner.tempcloseinputfile;
  1094. current_scanner:=nil;
  1095. current_module:=nil;
  1096. { Info }
  1097. Message3(unit_u_load_unit,old_current_module.modulename^,ImplIntf[old_current_module.in_implementation],s);
  1098. ups:=upper(s);
  1099. { unit not found }
  1100. st:=nil;
  1101. dummy:=nil;
  1102. { search all loaded units }
  1103. hp:=tppumodule(loaded_units.first);
  1104. while assigned(hp) do
  1105. begin
  1106. if hp.modulename^=ups then
  1107. begin
  1108. { forced to reload ? }
  1109. if hp.do_reload then
  1110. begin
  1111. hp.do_reload:=false;
  1112. break;
  1113. end;
  1114. { only check for units. The main program is also
  1115. as a unit in the loaded_units list. We simply need
  1116. to ignore this entry (PFV) }
  1117. if hp.is_unit then
  1118. begin
  1119. { the unit is already registered }
  1120. { and this means that the unit }
  1121. { is already compiled }
  1122. { else there is a cyclic unit use }
  1123. if assigned(hp.globalsymtable) then
  1124. st:=tglobalsymtable(hp.globalsymtable)
  1125. else
  1126. begin
  1127. { both units in interface ? }
  1128. if (not old_current_module.in_implementation) and
  1129. (not hp.in_implementation) then
  1130. begin
  1131. { check for a cycle }
  1132. hp2:=old_current_module.loaded_from;
  1133. while assigned(hp2) and (hp2<>hp) do
  1134. begin
  1135. if hp2.in_implementation then
  1136. hp2:=nil
  1137. else
  1138. hp2:=hp2.loaded_from;
  1139. end;
  1140. if assigned(hp2) then
  1141. Message2(unit_f_circular_unit_reference,old_current_module.modulename^,hp.modulename^);
  1142. end;
  1143. end;
  1144. break;
  1145. end;
  1146. end
  1147. else if copy(hp.modulename^,1,8)=ups then
  1148. dummy:=hp;
  1149. { the next unit }
  1150. hp:=tppumodule(hp.next);
  1151. end;
  1152. if assigned(dummy) and not assigned(hp) then
  1153. Message2(unit_w_unit_name_error,s,dummy.modulename^);
  1154. { the unit is not in the loaded units, we must load it first }
  1155. if (not assigned(st)) then
  1156. begin
  1157. if assigned(hp) then
  1158. begin
  1159. current_module:=hp;
  1160. { try to load the unit a second time first }
  1161. Message1(unit_u_second_load_unit,current_module.modulename^);
  1162. second_time:=true;
  1163. current_module.in_second_load:=true;
  1164. { remove the old unit }
  1165. loaded_units.remove(current_module);
  1166. current_module.reset;
  1167. { try to reopen ppu }
  1168. tppumodule(current_module).search_unit(s,fn,false);
  1169. end
  1170. else
  1171. { generates a new unit info record }
  1172. begin
  1173. current_module:=tppumodule.create(old_current_module,s,fn,true);
  1174. second_time:=false;
  1175. end;
  1176. { close old_current_ppu on system that are
  1177. short on file handles like DOS PM }
  1178. {$ifdef SHORT_ON_FILE_HANDLES}
  1179. if old_current_module.is_unit and
  1180. assigned(tppumodule(old_current_module).ppufile) then
  1181. tppumodule(old_current_module).ppufile.tempclose;
  1182. {$endif SHORT_ON_FILE_HANDLES}
  1183. { now we can register the unit }
  1184. current_module.loaded_from:=old_current_module;
  1185. loaded_units.insert(current_module);
  1186. { now realy load the ppu }
  1187. tppumodule(current_module).loadppu;
  1188. { set compiled flag }
  1189. current_module.compiled:=true;
  1190. { load return pointer }
  1191. hp:=tppumodule(current_module);
  1192. { for a second_time recompile reload all dependent units,
  1193. for a first time compile register the unit _once_ }
  1194. if second_time then
  1195. begin
  1196. { now reload all dependent units }
  1197. hp2:=tmodule(loaded_units.first);
  1198. while assigned(hp2) do
  1199. begin
  1200. if hp2.do_reload then
  1201. dummy:=loadunit(hp2.modulename^,'');
  1202. hp2:=tmodule(hp2.next);
  1203. end;
  1204. end
  1205. else
  1206. usedunits.concat(tused_unit.create(current_module,true));
  1207. end;
  1208. { set the old module }
  1209. {$ifdef SHORT_ON_FILE_HANDLES}
  1210. if old_current_module.is_unit and
  1211. assigned(tppumodule(old_current_module).ppufile) then
  1212. tppumodule(old_current_module).ppufile.tempopen;
  1213. {$endif SHORT_ON_FILE_HANDLES}
  1214. { we are back, restore current_module and current_scanner }
  1215. current_module:=old_current_module;
  1216. current_scanner:=tscannerfile(current_module.scanner);
  1217. if assigned(current_scanner) then
  1218. current_scanner.tempopeninputfile;
  1219. SetCompileModule(current_module);
  1220. loadunit:=hp;
  1221. end;
  1222. end.
  1223. {
  1224. $Log$
  1225. Revision 1.28 2002-12-06 16:56:57 peter
  1226. * only compile cs_fp_emulation support when cpufpuemu is defined
  1227. * define cpufpuemu for m68k only
  1228. Revision 1.27 2002/11/20 12:36:24 mazen
  1229. * $UNITPATH directive is now working
  1230. Revision 1.26 2002/11/15 01:58:46 peter
  1231. * merged changes from 1.0.7 up to 04-11
  1232. - -V option for generating bug report tracing
  1233. - more tracing for option parsing
  1234. - errors for cdecl and high()
  1235. - win32 import stabs
  1236. - win32 records<=8 are returned in eax:edx (turned off by default)
  1237. - heaptrc update
  1238. - more info for temp management in .s file with EXTDEBUG
  1239. Revision 1.25 2002/10/20 14:49:31 peter
  1240. * store original source time in ppu so it can be compared instead of
  1241. comparing with the ppu time
  1242. Revision 1.24 2002/10/04 20:13:10 peter
  1243. * set in_second_load flag before resetting the module, this is
  1244. required to skip some checkings
  1245. Revision 1.23 2002/08/19 19:36:42 peter
  1246. * More fixes for cross unit inlining, all tnodes are now implemented
  1247. * Moved pocall_internconst to po_internconst because it is not a
  1248. calling type at all and it conflicted when inlining of these small
  1249. functions was requested
  1250. Revision 1.22 2002/08/18 19:58:28 peter
  1251. * more current_scanner fixes
  1252. Revision 1.21 2002/08/15 15:09:41 carl
  1253. + fpu emulation helpers (ppu checking also)
  1254. Revision 1.20 2002/08/12 16:46:04 peter
  1255. * tscannerfile is now destroyed in tmodule.reset and current_scanner
  1256. is updated accordingly. This removes all the loading and saving of
  1257. the old scanner and the invalid flag marking
  1258. Revision 1.19 2002/08/11 14:28:19 peter
  1259. * TScannerFile.SetInvalid added that will also reset inputfile
  1260. Revision 1.18 2002/08/11 13:24:11 peter
  1261. * saving of asmsymbols in ppu supported
  1262. * asmsymbollist global is removed and moved into a new class
  1263. tasmlibrarydata that will hold the info of a .a file which
  1264. corresponds with a single module. Added librarydata to tmodule
  1265. to keep the library info stored for the module. In the future the
  1266. objectfiles will also be stored to the tasmlibrarydata class
  1267. * all getlabel/newasmsymbol and friends are moved to the new class
  1268. Revision 1.17 2002/07/26 21:15:37 florian
  1269. * rewrote the system handling
  1270. Revision 1.16 2002/05/16 19:46:36 carl
  1271. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1272. + try to fix temp allocation (still in ifdef)
  1273. + generic constructor calls
  1274. + start of tassembler / tmodulebase class cleanup
  1275. Revision 1.15 2002/05/14 19:34:41 peter
  1276. * removed old logs and updated copyright year
  1277. Revision 1.14 2002/05/12 16:53:05 peter
  1278. * moved entry and exitcode to ncgutil and cgobj
  1279. * foreach gets extra argument for passing local data to the
  1280. iterator function
  1281. * -CR checks also class typecasts at runtime by changing them
  1282. into as
  1283. * fixed compiler to cycle with the -CR option
  1284. * fixed stabs with elf writer, finally the global variables can
  1285. be watched
  1286. * removed a lot of routines from cga unit and replaced them by
  1287. calls to cgobj
  1288. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1289. u32bit then the other is typecasted also to u32bit without giving
  1290. a rangecheck warning/error.
  1291. * fixed pascal calling method with reversing also the high tree in
  1292. the parast, detected by tcalcst3 test
  1293. Revision 1.13 2002/04/04 19:05:56 peter
  1294. * removed unused units
  1295. * use tlocation.size in cg.a_*loc*() routines
  1296. Revision 1.12 2002/03/28 20:46:44 carl
  1297. - remove go32v1 support
  1298. Revision 1.11 2002/01/19 14:20:13 peter
  1299. * check for -Un when loading ppu with wrong name
  1300. }