fppu.pas 47 KB

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