files.pas 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583
  1. {
  2. $Id$
  3. Copyright (c) 1996-98 by Florian Klaempfl
  4. This unit implements an extended file management and the first loading
  5. and searching of the modules (ppufiles)
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit files;
  20. {$ifdef TP}
  21. {$V+}
  22. {$endif}
  23. interface
  24. uses
  25. globtype,
  26. cobjects,globals,ppu;
  27. const
  28. {$ifdef FPC}
  29. maxunits = 1024;
  30. InputFileBufSize=32*1024;
  31. linebufincrease=512;
  32. {$else}
  33. maxunits = 128;
  34. InputFileBufSize=1024;
  35. linebufincrease=64;
  36. {$endif}
  37. type
  38. {$ifdef FPC}
  39. tlongintarr = array[0..1000000] of longint;
  40. {$else}
  41. tlongintarr = array[0..16000] of longint;
  42. {$endif}
  43. plongintarr = ^tlongintarr;
  44. pinputfile = ^tinputfile;
  45. tinputfile = object
  46. path,name : pstring; { path and filename }
  47. next : pinputfile; { next file for reading }
  48. f : file; { current file handle }
  49. is_macro,
  50. endoffile, { still bytes left to read }
  51. closed : boolean; { is the file closed }
  52. buf : pchar; { buffer }
  53. bufstart, { buffer start position in the file }
  54. bufsize, { amount of bytes in the buffer }
  55. maxbufsize : longint; { size in memory for the buffer }
  56. saveinputpointer : pchar; { save fields for scanner variables }
  57. savelastlinepos,
  58. saveline_no : longint;
  59. linebuf : plongintarr; { line buffer to retrieve lines }
  60. maxlinebuf : longint;
  61. ref_count : longint; { to handle the browser refs }
  62. ref_index : longint;
  63. ref_next : pinputfile;
  64. constructor init(const fn:string);
  65. destructor done;
  66. procedure setpos(l:longint);
  67. procedure seekbuf(fpos:longint);
  68. procedure readbuf;
  69. function open:boolean;
  70. procedure close;
  71. procedure tempclose;
  72. function tempopen:boolean;
  73. procedure setmacro(p:pchar;len:longint);
  74. procedure setline(line,linepos:longint);
  75. function getlinestr(l:longint):string;
  76. end;
  77. pfilemanager = ^tfilemanager;
  78. tfilemanager = object
  79. files : pinputfile;
  80. last_ref_index : longint;
  81. cacheindex : longint;
  82. cacheinputfile : pinputfile;
  83. constructor init;
  84. destructor done;
  85. procedure register_file(f : pinputfile);
  86. procedure inverse_register_indexes;
  87. function get_file(l:longint) : pinputfile;
  88. function get_file_name(l :longint):string;
  89. function get_file_path(l :longint):string;
  90. end;
  91. type
  92. {$ifndef NEWMAP}
  93. tunitmap = array[0..maxunits-1] of pointer;
  94. punitmap = ^tunitmap;
  95. pmodule = ^tmodule;
  96. {$else NEWMAP}
  97. pmodule = ^tmodule;
  98. tunitmap = array[0..maxunits-1] of pmodule;
  99. punitmap = ^tunitmap;
  100. {$endif NEWMAP}
  101. tmodule = object(tlinkedlist_item)
  102. ppufile : pppufile; { the PPU file }
  103. crc,
  104. interface_crc,
  105. flags : longint; { the PPU flags }
  106. compiled, { unit is already compiled }
  107. do_reload, { force reloading of the unit }
  108. do_assemble, { only assemble the object, don't recompile }
  109. do_compile, { need to compile the sources }
  110. sources_avail, { if all sources are reachable }
  111. is_unit,
  112. in_second_compile, { is this unit being compiled for the 2nd time? }
  113. in_implementation, { processing the implementation part? }
  114. in_global : boolean; { allow global settings }
  115. islibrary : boolean; { if it is a library (win32 dll) }
  116. map : punitmap; { mapping of all used units }
  117. unitcount : word; { local unit counter }
  118. unit_index : word; { global counter for browser }
  119. globalsymtable, { pointer to the local/static symtable of this unit }
  120. localsymtable : pointer; { pointer to the psymtable of this unit }
  121. scanner : pointer; { scanner object used }
  122. loaded_from : pmodule;
  123. uses_imports : boolean; { Set if the module imports from DLL's.}
  124. imports : plinkedlist;
  125. _exports : plinkedlist;
  126. sourcefiles : pfilemanager;
  127. resourcefiles,
  128. linksharedlibs,
  129. linkstaticlibs,
  130. linkunitfiles,
  131. linkofiles : tstringcontainer;
  132. used_units : tlinkedlist;
  133. dependent_units : tlinkedlist;
  134. localunitsearchpath, { local searchpaths }
  135. localobjectsearchpath,
  136. localincludesearchpath,
  137. locallibrarysearchpath : pstring;
  138. path, { path where the module is find/created }
  139. outpath,
  140. modulename, { name of the module in uppercase }
  141. objfilename, { fullname of the objectfile }
  142. asmfilename, { fullname of the assemblerfile }
  143. ppufilename, { fullname of the ppufile }
  144. staticlibfilename, { fullname of the static libraryfile }
  145. sharedlibfilename, { fullname of the shared libraryfile }
  146. exefilename, { fullname of the exefile }
  147. asmprefix, { prefix for the smartlink asmfiles }
  148. mainsource : pstring; { name of the main sourcefile }
  149. {$ifdef Test_Double_checksum}
  150. crc_array : pointer;
  151. crc_size : longint;
  152. {$endif def Test_Double_checksum}
  153. constructor init(const s:string;_is_unit:boolean);
  154. destructor done;virtual;
  155. procedure reset;
  156. procedure setfilename(const fn:string;allowoutput:boolean);
  157. function openppu:boolean;
  158. function search_unit(const n : string;onlysource:boolean):boolean;
  159. end;
  160. pused_unit = ^tused_unit;
  161. tused_unit = object(tlinkedlist_item)
  162. unitid : word;
  163. name : pstring;
  164. checksum,
  165. interface_checksum : longint;
  166. loaded : boolean;
  167. in_uses,
  168. in_interface,
  169. is_stab_written : boolean;
  170. u : pmodule;
  171. constructor init(_u : pmodule;intface:boolean);
  172. constructor init_to_load(const n:string;c,intfc:longint;intface:boolean);
  173. destructor done;virtual;
  174. end;
  175. pdependent_unit = ^tdependent_unit;
  176. tdependent_unit = object(tlinkedlist_item)
  177. u : pmodule;
  178. constructor init(_u : pmodule);
  179. end;
  180. var
  181. main_module : pmodule; { Main module of the program }
  182. current_module : pmodule; { Current module which is compiled }
  183. current_ppu : pppufile; { Current ppufile which is read }
  184. global_unit_count : word;
  185. usedunits : tlinkedlist; { Used units for this program }
  186. loaded_units : tlinkedlist; { All loaded units }
  187. function get_source_file(moduleindex,fileindex : word) : pinputfile;
  188. implementation
  189. uses
  190. {$ifdef Delphi}
  191. dmisc,
  192. {$endif Delphi}
  193. dos,verbose,systems,
  194. symtable,scanner;
  195. {****************************************************************************
  196. TINPUTFILE
  197. ****************************************************************************}
  198. constructor tinputfile.init(const fn:string);
  199. var
  200. p:dirstr;
  201. n:namestr;
  202. e:extstr;
  203. begin
  204. FSplit(fn,p,n,e);
  205. name:=stringdup(n+e);
  206. path:=stringdup(p);
  207. next:=nil;
  208. { file info }
  209. is_macro:=false;
  210. endoffile:=false;
  211. closed:=true;
  212. buf:=nil;
  213. bufstart:=0;
  214. bufsize:=0;
  215. maxbufsize:=InputFileBufSize;
  216. { save fields }
  217. saveinputpointer:=nil;
  218. saveline_no:=0;
  219. savelastlinepos:=0;
  220. { indexing refs }
  221. ref_next:=nil;
  222. ref_count:=0;
  223. ref_index:=0;
  224. { line buffer }
  225. linebuf:=nil;
  226. maxlinebuf:=0;
  227. end;
  228. destructor tinputfile.done;
  229. begin
  230. if not closed then
  231. close;
  232. stringdispose(path);
  233. stringdispose(name);
  234. { free memory }
  235. if assigned(linebuf) then
  236. freemem(linebuf,maxlinebuf shl 2);
  237. end;
  238. procedure tinputfile.setpos(l:longint);
  239. begin
  240. bufstart:=l;
  241. end;
  242. procedure tinputfile.seekbuf(fpos:longint);
  243. begin
  244. if closed then
  245. exit;
  246. seek(f,fpos);
  247. bufstart:=fpos;
  248. bufsize:=0;
  249. end;
  250. procedure tinputfile.readbuf;
  251. {$ifdef TP}
  252. var
  253. w : word;
  254. {$endif}
  255. begin
  256. if is_macro then
  257. endoffile:=true;
  258. if closed then
  259. exit;
  260. inc(bufstart,bufsize);
  261. {$ifdef TP}
  262. blockread(f,buf^,maxbufsize-1,w);
  263. bufsize:=w;
  264. {$else}
  265. blockread(f,buf^,maxbufsize-1,bufsize);
  266. {$endif}
  267. buf[bufsize]:=#0;
  268. endoffile:=eof(f);
  269. end;
  270. function tinputfile.open:boolean;
  271. var
  272. ofm : byte;
  273. begin
  274. open:=false;
  275. if not closed then
  276. Close;
  277. ofm:=filemode;
  278. filemode:=0;
  279. Assign(f,path^+name^);
  280. {$I-}
  281. reset(f,1);
  282. {$I+}
  283. filemode:=ofm;
  284. if ioresult<>0 then
  285. exit;
  286. { file }
  287. endoffile:=false;
  288. closed:=false;
  289. Getmem(buf,MaxBufsize);
  290. bufstart:=0;
  291. bufsize:=0;
  292. open:=true;
  293. end;
  294. procedure tinputfile.close;
  295. var
  296. i : word;
  297. begin
  298. if is_macro then
  299. begin
  300. if assigned(buf) then
  301. Freemem(buf,maxbufsize);
  302. buf:=nil;
  303. {is_macro:=false;
  304. still needed for dispose in scanner PM }
  305. closed:=true;
  306. exit;
  307. end;
  308. if not closed then
  309. begin
  310. {$I-}
  311. system.close(f);
  312. {$I+}
  313. i:=ioresult;
  314. closed:=true;
  315. end;
  316. if assigned(buf) then
  317. begin
  318. Freemem(buf,maxbufsize);
  319. buf:=nil;
  320. end;
  321. bufstart:=0;
  322. end;
  323. procedure tinputfile.tempclose;
  324. var
  325. i : word;
  326. begin
  327. if is_macro then
  328. exit;
  329. if not closed then
  330. begin
  331. {$I-}
  332. system.close(f);
  333. {$I+}
  334. i:=ioresult;
  335. Freemem(buf,maxbufsize);
  336. buf:=nil;
  337. closed:=true;
  338. end;
  339. end;
  340. function tinputfile.tempopen:boolean;
  341. var
  342. ofm : byte;
  343. begin
  344. tempopen:=false;
  345. if is_macro then
  346. begin
  347. tempopen:=true;
  348. exit;
  349. end;
  350. if not closed then
  351. exit;
  352. ofm:=filemode;
  353. filemode:=0;
  354. Assign(f,path^+name^);
  355. {$I-}
  356. reset(f,1);
  357. {$I+}
  358. filemode:=ofm;
  359. if ioresult<>0 then
  360. exit;
  361. closed:=false;
  362. { get new mem }
  363. Getmem(buf,maxbufsize);
  364. { restore state }
  365. seek(f,BufStart);
  366. bufsize:=0;
  367. readbuf;
  368. tempopen:=true;
  369. end;
  370. procedure tinputfile.setmacro(p:pchar;len:longint);
  371. begin
  372. { create new buffer }
  373. getmem(buf,len+1);
  374. move(p^,buf^,len);
  375. buf[len]:=#0;
  376. { reset }
  377. bufstart:=0;
  378. bufsize:=len;
  379. maxbufsize:=len+1;
  380. is_macro:=true;
  381. endoffile:=true;
  382. closed:=true;
  383. end;
  384. procedure tinputfile.setline(line,linepos:longint);
  385. var
  386. oldlinebuf : plongintarr;
  387. begin
  388. if line<1 then
  389. exit;
  390. while (line>=maxlinebuf) do
  391. begin
  392. oldlinebuf:=linebuf;
  393. { create new linebuf and move old info }
  394. getmem(linebuf,(maxlinebuf+linebufincrease) shl 2);
  395. if assigned(oldlinebuf) then
  396. begin
  397. move(oldlinebuf^,linebuf^,maxlinebuf shl 2);
  398. freemem(oldlinebuf,maxlinebuf shl 2);
  399. end;
  400. fillchar(linebuf^[maxlinebuf],linebufincrease shl 2,0);
  401. inc(maxlinebuf,linebufincrease);
  402. end;
  403. linebuf^[line]:=linepos;
  404. end;
  405. function tinputfile.getlinestr(l:longint):string;
  406. var
  407. c : char;
  408. i,
  409. fpos : longint;
  410. p : pchar;
  411. begin
  412. getlinestr:='';
  413. if l<maxlinebuf then
  414. begin
  415. fpos:=linebuf^[l];
  416. { fpos is set negativ if the line was already written }
  417. { but we still know the correct value }
  418. if fpos<0 then
  419. fpos:=-fpos+1;
  420. if closed then
  421. open;
  422. { in current buf ? }
  423. if (fpos<bufstart) or (fpos>bufstart+bufsize) then
  424. begin
  425. seekbuf(fpos);
  426. readbuf;
  427. end;
  428. { the begin is in the buf now simply read until #13,#10 }
  429. i:=0;
  430. p:=@buf[fpos-bufstart];
  431. repeat
  432. c:=p^;
  433. if c=#0 then
  434. begin
  435. if endoffile then
  436. break;
  437. readbuf;
  438. p:=buf;
  439. c:=p^;
  440. end;
  441. if c in [#10,#13] then
  442. break;
  443. inc(i);
  444. getlinestr[i]:=c;
  445. inc(longint(p));
  446. until (i=255);
  447. {$ifndef TP}
  448. {$ifopt H+}
  449. setlength(getlinestr,i);
  450. {$else}
  451. getlinestr[0]:=chr(i);
  452. {$endif}
  453. {$else}
  454. getlinestr[0]:=chr(i);
  455. {$endif}
  456. end;
  457. end;
  458. {****************************************************************************
  459. TFILEMANAGER
  460. ****************************************************************************}
  461. constructor tfilemanager.init;
  462. begin
  463. files:=nil;
  464. last_ref_index:=0;
  465. cacheindex:=0;
  466. cacheinputfile:=nil;
  467. end;
  468. destructor tfilemanager.done;
  469. var
  470. hp : pinputfile;
  471. begin
  472. hp:=files;
  473. while assigned(hp) do
  474. begin
  475. files:=files^.ref_next;
  476. dispose(hp,done);
  477. hp:=files;
  478. end;
  479. last_ref_index:=0;
  480. end;
  481. procedure tfilemanager.register_file(f : pinputfile);
  482. begin
  483. inc(last_ref_index);
  484. f^.ref_next:=files;
  485. f^.ref_index:=last_ref_index;
  486. files:=f;
  487. { update cache }
  488. cacheindex:=last_ref_index;
  489. cacheinputfile:=f;
  490. {$ifdef FPC}
  491. {$ifdef heaptrc}
  492. writeln(stderr,f^.name^,' index ',current_module^.unit_index*100000+f^.ref_index);
  493. {$endif heaptrc}
  494. {$endif FPC}
  495. end;
  496. { this procedure is necessary after loading the
  497. sources files from a PPU file PM }
  498. procedure tfilemanager.inverse_register_indexes;
  499. var
  500. f : pinputfile;
  501. begin
  502. f:=files;
  503. while assigned(f) do
  504. begin
  505. f^.ref_index:=last_ref_index-f^.ref_index+1;
  506. f:=f^.ref_next;
  507. end;
  508. { reset cache }
  509. cacheindex:=0;
  510. cacheinputfile:=nil;
  511. end;
  512. function tfilemanager.get_file(l :longint) : pinputfile;
  513. var
  514. ff : pinputfile;
  515. begin
  516. { check cache }
  517. if (l=cacheindex) and assigned(cacheinputfile) then
  518. begin
  519. get_file:=cacheinputfile;
  520. exit;
  521. end;
  522. ff:=files;
  523. while assigned(ff) and (ff^.ref_index<>l) do
  524. ff:=ff^.ref_next;
  525. get_file:=ff;
  526. end;
  527. function tfilemanager.get_file_name(l :longint):string;
  528. var
  529. hp : pinputfile;
  530. begin
  531. hp:=get_file(l);
  532. if assigned(hp) then
  533. get_file_name:=hp^.name^
  534. else
  535. get_file_name:='';
  536. end;
  537. function tfilemanager.get_file_path(l :longint):string;
  538. var
  539. hp : pinputfile;
  540. begin
  541. hp:=get_file(l);
  542. if assigned(hp) then
  543. get_file_path:=hp^.path^
  544. else
  545. get_file_path:='';
  546. end;
  547. function get_source_file(moduleindex,fileindex : word) : pinputfile;
  548. var
  549. hp : pmodule;
  550. f : pinputfile;
  551. begin
  552. hp:=pmodule(loaded_units.first);
  553. while assigned(hp) and (hp^.unit_index<>moduleindex) do
  554. hp:=pmodule(hp^.next);
  555. get_source_file:=nil;
  556. if not assigned(hp) then
  557. exit;
  558. f:=pinputfile(hp^.sourcefiles^.files);
  559. while assigned(f) do
  560. begin
  561. if f^.ref_index=fileindex then
  562. begin
  563. get_source_file:=f;
  564. exit;
  565. end;
  566. f:=pinputfile(f^.ref_next);
  567. end;
  568. end;
  569. {****************************************************************************
  570. TMODULE
  571. ****************************************************************************}
  572. procedure tmodule.setfilename(const fn:string;allowoutput:boolean);
  573. var
  574. p : dirstr;
  575. n : NameStr;
  576. e : ExtStr;
  577. begin
  578. stringdispose(objfilename);
  579. stringdispose(asmfilename);
  580. stringdispose(ppufilename);
  581. stringdispose(staticlibfilename);
  582. stringdispose(sharedlibfilename);
  583. stringdispose(exefilename);
  584. stringdispose(outpath);
  585. stringdispose(path);
  586. { Create names }
  587. fsplit(fn,p,n,e);
  588. n:=FixFileName(n);
  589. { set path }
  590. path:=stringdup(FixPath(p,false));
  591. { obj,asm,ppu names }
  592. p:=path^;
  593. if AllowOutput then
  594. begin
  595. if (OutputUnitDir<>'') then
  596. p:=OutputUnitDir
  597. else
  598. if (OutputExeDir<>'') then
  599. p:=OutputExeDir;
  600. end;
  601. outpath:=stringdup(p);
  602. objfilename:=stringdup(p+n+target_info.objext);
  603. asmfilename:=stringdup(p+n+target_info.asmext);
  604. ppufilename:=stringdup(p+n+target_info.unitext);
  605. { lib and exe could be loaded with a file specified with -o }
  606. if AllowOutput and (OutputFile<>'') then
  607. n:=OutputFile;
  608. staticlibfilename:=stringdup(p+target_os.libprefix+n+target_os.staticlibext);
  609. if target_info.target=target_i386_WIN32 then
  610. sharedlibfilename:=stringdup(p+n+target_os.sharedlibext)
  611. else
  612. sharedlibfilename:=stringdup(p+target_os.libprefix+n+target_os.sharedlibext);
  613. { output dir of exe can be specified separatly }
  614. if AllowOutput and (OutputExeDir<>'') then
  615. p:=OutputExeDir
  616. else
  617. p:=path^;
  618. exefilename:=stringdup(p+n+target_info.exeext);
  619. end;
  620. function tmodule.openppu:boolean;
  621. var
  622. objfiletime,
  623. ppufiletime,
  624. asmfiletime : longint;
  625. begin
  626. openppu:=false;
  627. Message1(unit_t_ppu_loading,ppufilename^);
  628. { Get ppufile time (also check if the file exists) }
  629. ppufiletime:=getnamedfiletime(ppufilename^);
  630. if ppufiletime=-1 then
  631. exit;
  632. { Open the ppufile }
  633. Message1(unit_u_ppu_name,ppufilename^);
  634. ppufile:=new(pppufile,init(ppufilename^));
  635. ppufile^.change_endian:=source_os.endian<>target_os.endian;
  636. if not ppufile^.open then
  637. begin
  638. dispose(ppufile,done);
  639. Message(unit_u_ppu_file_too_short);
  640. exit;
  641. end;
  642. { check for a valid PPU file }
  643. if not ppufile^.CheckPPUId then
  644. begin
  645. dispose(ppufile,done);
  646. Message(unit_u_ppu_invalid_header);
  647. exit;
  648. end;
  649. { check for allowed PPU versions }
  650. if not (ppufile^.GetPPUVersion = CurrentPPUVersion) then
  651. begin
  652. dispose(ppufile,done);
  653. Message1(unit_u_ppu_invalid_version,tostr(ppufile^.GetPPUVersion));
  654. exit;
  655. end;
  656. { check the target processor }
  657. if ttargetcpu(ppufile^.header.cpu)<>target_cpu then
  658. begin
  659. dispose(ppufile,done);
  660. Message(unit_u_ppu_invalid_processor);
  661. exit;
  662. end;
  663. { check target }
  664. if ttarget(ppufile^.header.target)<>target_info.target then
  665. begin
  666. dispose(ppufile,done);
  667. Message(unit_u_ppu_invalid_target);
  668. exit;
  669. end;
  670. { Load values to be access easier }
  671. flags:=ppufile^.header.flags;
  672. crc:=ppufile^.header.checksum;
  673. interface_crc:=ppufile^.header.interface_checksum;
  674. { Show Debug info }
  675. Message1(unit_u_ppu_time,filetimestring(ppufiletime));
  676. Message1(unit_u_ppu_flags,tostr(flags));
  677. Message1(unit_u_ppu_crc,tostr(ppufile^.header.checksum));
  678. Message1(unit_u_ppu_crc,tostr(ppufile^.header.interface_checksum)+' (intfc)');
  679. { check the object and assembler file to see if we need only to
  680. assemble, only if it's not in a library }
  681. do_compile:=false;
  682. if (flags and uf_in_library)=0 then
  683. begin
  684. if (flags and (uf_static_linked or uf_smartlink))<>0 then
  685. begin
  686. objfiletime:=getnamedfiletime(staticlibfilename^);
  687. Message2(unit_u_check_time,staticlibfilename^,filetimestring(objfiletime));
  688. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  689. begin
  690. Message(unit_u_recompile_staticlib_is_older);
  691. do_compile:=true;
  692. exit;
  693. end;
  694. end
  695. else
  696. if (flags and uf_shared_linked)<>0 then
  697. begin
  698. objfiletime:=getnamedfiletime(sharedlibfilename^);
  699. Message2(unit_u_check_time,sharedlibfilename^,filetimestring(objfiletime));
  700. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  701. begin
  702. Message(unit_u_recompile_sharedlib_is_older);
  703. do_compile:=true;
  704. exit;
  705. end;
  706. end
  707. else
  708. if (flags and uf_obj_linked)<>0 then
  709. begin
  710. { the objectfile should be newer than the ppu file }
  711. objfiletime:=getnamedfiletime(objfilename^);
  712. Message2(unit_u_check_time,objfilename^,filetimestring(objfiletime));
  713. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  714. begin
  715. { check if assembler file is older than ppu file }
  716. asmfileTime:=GetNamedFileTime(asmfilename^);
  717. Message2(unit_u_check_time,asmfilename^,filetimestring(asmfiletime));
  718. if (asmfiletime<0) or (ppufiletime>asmfiletime) then
  719. begin
  720. Message(unit_u_recompile_obj_and_asm_older);
  721. do_compile:=true;
  722. exit;
  723. end
  724. else
  725. begin
  726. Message(unit_u_recompile_obj_older_than_asm);
  727. if not(cs_asm_extern in aktglobalswitches) then
  728. begin
  729. do_compile:=true;
  730. exit;
  731. end;
  732. end;
  733. end;
  734. end;
  735. end;
  736. openppu:=true;
  737. end;
  738. function tmodule.search_unit(const n : string;onlysource:boolean):boolean;
  739. var
  740. singlepathstring,
  741. filename : string;
  742. Function UnitExists(const ext:string):boolean;
  743. begin
  744. Message1(unit_t_unitsearch,Singlepathstring+filename+ext);
  745. UnitExists:=FileExists(Singlepathstring+FileName+ext);
  746. end;
  747. Function SearchPath(unitpath:string):boolean;
  748. var
  749. found : boolean;
  750. start,i : longint;
  751. ext : string[8];
  752. begin
  753. start:=1;
  754. Found:=false;
  755. repeat
  756. { Create current path to check }
  757. i:=pos(';',unitpath);
  758. if i=0 then
  759. i:=length(unitpath)+1;
  760. singlepathstring:=FixPath(copy(unitpath,start,i-start),false);
  761. delete(unitpath,start,i-start+1);
  762. if not onlysource then
  763. begin
  764. { Check for PPL file }
  765. if not Found then
  766. begin
  767. Found:=UnitExists(target_info.unitlibext);
  768. if Found then
  769. Begin
  770. SetFileName(SinglePathString+FileName,false);
  771. Found:=OpenPPU;
  772. End;
  773. end;
  774. { Check for PPU file }
  775. if not Found then
  776. begin
  777. Found:=UnitExists(target_info.unitext);
  778. if Found then
  779. Begin
  780. SetFileName(SinglePathString+FileName,false);
  781. Found:=OpenPPU;
  782. End;
  783. end;
  784. end;
  785. { Check for Sources }
  786. if not Found then
  787. begin
  788. ppufile:=nil;
  789. do_compile:=true;
  790. {Check for .pp file}
  791. Found:=UnitExists(target_os.sourceext);
  792. if Found then
  793. Ext:=target_os.sourceext
  794. else
  795. begin
  796. {Check for .pas}
  797. Found:=UnitExists(target_os.pasext);
  798. if Found then
  799. Ext:=target_os.pasext;
  800. end;
  801. stringdispose(mainsource);
  802. if Found then
  803. begin
  804. sources_avail:=true;
  805. {Load Filenames when found}
  806. mainsource:=StringDup(SinglePathString+FileName+Ext);
  807. SetFileName(SinglePathString+FileName,false);
  808. end
  809. else
  810. sources_avail:=false;
  811. end;
  812. until Found or (unitpath='');
  813. SearchPath:=Found;
  814. end;
  815. var
  816. fnd : boolean;
  817. begin
  818. filename:=FixFileName(n);
  819. { try to find unit
  820. 1. cwd
  821. 2. local unit path
  822. 3. global unit path }
  823. fnd:=SearchPath('.');
  824. if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
  825. fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
  826. if (not fnd) then
  827. fnd:=SearchPath(UnitSearchPath);
  828. { try to find a file with the first 8 chars of the modulename, like
  829. dos }
  830. if (not fnd) and (length(filename)>8) then
  831. begin
  832. filename:=copy(filename,1,8);
  833. fnd:=SearchPath('.');
  834. if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
  835. fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
  836. if not fnd then
  837. fnd:=SearchPath(UnitSearchPath);
  838. end;
  839. search_unit:=fnd;
  840. end;
  841. procedure tmodule.reset;
  842. var
  843. pm : pdependent_unit;
  844. begin
  845. if assigned(scanner) then
  846. pscannerfile(scanner)^.invalid:=true;
  847. if assigned(globalsymtable) then
  848. begin
  849. dispose(punitsymtable(globalsymtable),done);
  850. globalsymtable:=nil;
  851. end;
  852. if assigned(localsymtable) then
  853. begin
  854. dispose(punitsymtable(localsymtable),done);
  855. localsymtable:=nil;
  856. end;
  857. if assigned(map) then
  858. begin
  859. dispose(map);
  860. map:=nil;
  861. end;
  862. if assigned(ppufile) then
  863. begin
  864. dispose(ppufile,done);
  865. ppufile:=nil;
  866. end;
  867. sourcefiles^.done;
  868. sourcefiles^.init;
  869. imports^.done;
  870. imports^.init;
  871. _exports^.done;
  872. _exports^.init;
  873. used_units.done;
  874. used_units.init;
  875. { all units that depend on this one must be recompiled ! }
  876. pm:=pdependent_unit(dependent_units.first);
  877. while assigned(pm) do
  878. begin
  879. if pm^.u^.in_second_compile then
  880. Comment(v_debug,'No reload already in second compile: '+pm^.u^.modulename^)
  881. else
  882. begin
  883. pm^.u^.do_reload:=true;
  884. Comment(v_debug,'Reloading '+pm^.u^.modulename^+' needed because '+modulename^+' is reloaded');
  885. end;
  886. pm:=pdependent_unit(pm^.next);
  887. end;
  888. dependent_units.done;
  889. dependent_units.init;
  890. resourcefiles.done;
  891. resourcefiles.init_no_double;
  892. linkunitfiles.done;
  893. linkunitfiles.init_no_double;
  894. linkofiles.done;
  895. linkofiles.init_no_double;
  896. linkstaticlibs.done;
  897. linkstaticlibs.init_no_double;
  898. linksharedlibs.done;
  899. linksharedlibs.init_no_double;
  900. uses_imports:=false;
  901. do_assemble:=false;
  902. do_compile:=false;
  903. { sources_avail:=true;
  904. should not be changed PM }
  905. compiled:=false;
  906. in_implementation:=false;
  907. in_global:=true;
  908. loaded_from:=nil;
  909. flags:=0;
  910. crc:=0;
  911. interface_crc:=0;
  912. unitcount:=1;
  913. end;
  914. constructor tmodule.init(const s:string;_is_unit:boolean);
  915. var
  916. p : dirstr;
  917. n : namestr;
  918. e : extstr;
  919. begin
  920. FSplit(s,p,n,e);
  921. { Programs have the name program to don't conflict with dup id's }
  922. if _is_unit then
  923. modulename:=stringdup(Upper(n))
  924. else
  925. modulename:=stringdup('PROGRAM');
  926. mainsource:=stringdup(s);
  927. ppufilename:=nil;
  928. objfilename:=nil;
  929. asmfilename:=nil;
  930. staticlibfilename:=nil;
  931. sharedlibfilename:=nil;
  932. exefilename:=nil;
  933. outpath:=nil;
  934. { Dos has the famous 8.3 limit :( }
  935. {$ifdef tp}
  936. asmprefix:=stringdup(FixFileName('as'));
  937. {$else}
  938. {$ifdef go32v2}
  939. asmprefix:=stringdup(FixFileName('as'));
  940. {$else}
  941. {$ifdef OS2}
  942. {Allthough OS/2 supports long filenames I play it safe and
  943. use 8.3 filenames, because this allows the compiler to run
  944. on a FAT partition. (DM)}
  945. asmprefix:=stringdup(FixFileName('as'));
  946. {$else}
  947. asmprefix:=stringdup(FixFileName(n));
  948. {$endif}
  949. {$endif}
  950. {$endif tp}
  951. path:=nil;
  952. setfilename(p+n,true);
  953. localunitsearchpath:=nil;
  954. localobjectsearchpath:=nil;
  955. localincludesearchpath:=nil;
  956. locallibrarysearchpath:=nil;
  957. used_units.init;
  958. dependent_units.init;
  959. new(sourcefiles,init);
  960. resourcefiles.init_no_double;
  961. linkunitfiles.init_no_double;
  962. linkofiles.init_no_double;
  963. linkstaticlibs.init_no_double;
  964. linksharedlibs.init_no_double;
  965. ppufile:=nil;
  966. scanner:=nil;
  967. map:=nil;
  968. globalsymtable:=nil;
  969. localsymtable:=nil;
  970. loaded_from:=nil;
  971. flags:=0;
  972. crc:=0;
  973. interface_crc:=0;
  974. do_reload:=false;
  975. unitcount:=1;
  976. inc(global_unit_count);
  977. unit_index:=global_unit_count;
  978. do_assemble:=false;
  979. do_compile:=false;
  980. sources_avail:=true;
  981. compiled:=false;
  982. in_second_compile:=false;
  983. in_implementation:=false;
  984. in_global:=true;
  985. is_unit:=_is_unit;
  986. islibrary:=false;
  987. uses_imports:=false;
  988. imports:=new(plinkedlist,init);
  989. _exports:=new(plinkedlist,init);
  990. { search the PPU file if it is an unit }
  991. if is_unit then
  992. search_unit(modulename^,false);
  993. end;
  994. destructor tmodule.done;
  995. begin
  996. if assigned(map) then
  997. dispose(map);
  998. if assigned(ppufile) then
  999. dispose(ppufile,done);
  1000. ppufile:=nil;
  1001. if assigned(imports) then
  1002. dispose(imports,done);
  1003. imports:=nil;
  1004. if assigned(_exports) then
  1005. dispose(_exports,done);
  1006. _exports:=nil;
  1007. if assigned(scanner) then
  1008. pscannerfile(scanner)^.invalid:=true;
  1009. if assigned(sourcefiles) then
  1010. dispose(sourcefiles,done);
  1011. sourcefiles:=nil;
  1012. used_units.done;
  1013. dependent_units.done;
  1014. resourcefiles.done;
  1015. linkunitfiles.done;
  1016. linkofiles.done;
  1017. linkstaticlibs.done;
  1018. linksharedlibs.done;
  1019. stringdispose(objfilename);
  1020. stringdispose(asmfilename);
  1021. stringdispose(ppufilename);
  1022. stringdispose(staticlibfilename);
  1023. stringdispose(sharedlibfilename);
  1024. stringdispose(exefilename);
  1025. stringdispose(outpath);
  1026. stringdispose(path);
  1027. stringdispose(modulename);
  1028. stringdispose(mainsource);
  1029. stringdispose(asmprefix);
  1030. stringdispose(localunitsearchpath);
  1031. stringdispose(localobjectsearchpath);
  1032. stringdispose(localincludesearchpath);
  1033. stringdispose(locallibrarysearchpath);
  1034. if assigned(globalsymtable) then
  1035. dispose(punitsymtable(globalsymtable),done);
  1036. globalsymtable:=nil;
  1037. if assigned(localsymtable) then
  1038. dispose(punitsymtable(localsymtable),done);
  1039. localsymtable:=nil;
  1040. inherited done;
  1041. end;
  1042. {****************************************************************************
  1043. TUSED_UNIT
  1044. ****************************************************************************}
  1045. constructor tused_unit.init(_u : pmodule;intface:boolean);
  1046. begin
  1047. u:=_u;
  1048. in_interface:=intface;
  1049. in_uses:=false;
  1050. is_stab_written:=false;
  1051. loaded:=true;
  1052. name:=stringdup(_u^.modulename^);
  1053. checksum:=_u^.crc;
  1054. interface_checksum:=_u^.interface_crc;
  1055. unitid:=0;
  1056. end;
  1057. constructor tused_unit.init_to_load(const n:string;c,intfc:longint;intface:boolean);
  1058. begin
  1059. u:=nil;
  1060. in_interface:=intface;
  1061. in_uses:=false;
  1062. is_stab_written:=false;
  1063. loaded:=false;
  1064. name:=stringdup(n);
  1065. checksum:=c;
  1066. interface_checksum:=intfc;
  1067. unitid:=0;
  1068. end;
  1069. destructor tused_unit.done;
  1070. begin
  1071. stringdispose(name);
  1072. inherited done;
  1073. end;
  1074. {****************************************************************************
  1075. TDENPENDENT_UNIT
  1076. ****************************************************************************}
  1077. constructor tdependent_unit.init(_u : pmodule);
  1078. begin
  1079. u:=_u;
  1080. end;
  1081. end.
  1082. {
  1083. $Log$
  1084. Revision 1.95 1999-05-13 21:59:25 peter
  1085. * removed oldppu code
  1086. * warning if objpas is loaded from uses
  1087. * first things for new deref writing
  1088. Revision 1.94 1999/05/04 21:44:42 florian
  1089. * changes to compile it with Delphi 4.0
  1090. Revision 1.93 1999/04/26 13:31:29 peter
  1091. * release storenumber,double_checksum
  1092. Revision 1.92 1999/04/25 15:08:36 peter
  1093. * small fixes for double_checksum
  1094. Revision 1.91 1999/04/21 09:43:36 peter
  1095. * storenumber works
  1096. * fixed some typos in double_checksum
  1097. + incompatible types type1 and type2 message (with storenumber)
  1098. Revision 1.90 1999/04/14 09:14:48 peter
  1099. * first things to store the symbol/def number in the ppu
  1100. Revision 1.89 1999/04/07 15:39:29 pierre
  1101. + double_checksum code added
  1102. Revision 1.88 1999/03/25 16:55:29 peter
  1103. + unitpath,librarypath,includepath,objectpath directives
  1104. Revision 1.87 1999/02/16 00:48:23 peter
  1105. * save in the ppu if linked with obj file instead of using the
  1106. library flag, so the .inc files are also checked
  1107. Revision 1.86 1999/02/05 08:54:24 pierre
  1108. + linkofiles splitted inot linkofiles and linkunitfiles
  1109. because linkofiles must be stored with directory
  1110. to enabled linking of different objects with same name
  1111. in a different directory
  1112. Revision 1.85 1999/01/14 21:47:11 peter
  1113. * status.currentmodule is now also updated
  1114. + status.currentsourcepath
  1115. Revision 1.84 1999/01/14 11:38:39 daniel
  1116. * Exe name derived from target_info instead of target_os
  1117. Revision 1.83 1999/01/13 15:02:00 daniel
  1118. * Tinputfile.readbuf eof bugfix
  1119. Revision 1.82 1999/01/12 14:25:26 peter
  1120. + BrowserLog for browser.log generation
  1121. + BrowserCol for browser info in TCollections
  1122. * released all other UseBrowser
  1123. Revision 1.81 1998/12/28 23:26:14 peter
  1124. + resource file handling ($R directive) for Win32
  1125. Revision 1.80 1998/12/16 00:27:19 peter
  1126. * removed some obsolete version checks
  1127. Revision 1.79 1998/12/11 00:03:14 peter
  1128. + globtype,tokens,version unit splitted from globals
  1129. Revision 1.78 1998/12/04 10:18:07 florian
  1130. * some stuff for procedures of object added
  1131. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1132. Revision 1.77 1998/12/02 16:23:37 jonas
  1133. * changed "if longintvar in set" to case or "if () or () .." statements
  1134. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1135. Revision 1.76 1998/12/01 12:51:19 peter
  1136. * fixed placing of ppas.sh and link.res when using -FE
  1137. Revision 1.75 1998/11/16 15:41:40 peter
  1138. * tp7 didn't like my ifopt H+ :(
  1139. Revision 1.74 1998/11/16 12:18:01 peter
  1140. * H+ fixes
  1141. Revision 1.73 1998/11/16 11:28:58 pierre
  1142. * stackcheck removed for i386_win32
  1143. * exportlist does not crash at least !!
  1144. (was need for tests dir !)z
  1145. Revision 1.72 1998/11/15 16:32:35 florian
  1146. * some stuff of Pavel implement (win32 dll creation)
  1147. * bug with ansistring function results fixed
  1148. Revision 1.71 1998/11/06 09:45:40 pierre
  1149. * bug on errors (file used after dispose !) fixed
  1150. Revision 1.70 1998/11/03 11:33:14 peter
  1151. + search_unit arg to only search for sources
  1152. Revision 1.69 1998/10/29 11:35:44 florian
  1153. * some dll support for win32
  1154. * fixed assembler writing for PalmOS
  1155. Revision 1.68 1998/10/27 10:22:34 florian
  1156. + First things for win32 export sections
  1157. Revision 1.67 1998/10/26 22:23:29 peter
  1158. + fixpath() has an extra option to allow a ./ as path
  1159. Revision 1.66 1998/10/19 18:07:11 peter
  1160. + external dll_name name func support for linux
  1161. Revision 1.65 1998/10/15 12:22:25 pierre
  1162. * close include files immediately after end reading
  1163. instead of waiting until unit compilation ended !
  1164. Revision 1.64 1998/10/14 13:38:19 peter
  1165. * fixed path with staticlib/objects in ppufiles
  1166. Revision 1.63 1998/10/14 11:02:49 daniel
  1167. * Stupid typo fixed.
  1168. Revision 1.62 1998/10/14 10:59:37 daniel
  1169. * Staticlibfilename now doesn't include path.
  1170. Revision 1.61 1998/10/14 10:57:25 daniel
  1171. * Dirstr, namestr, extstr.
  1172. * $V+ to prevent Peter from forgetting this.
  1173. * OS/2 compiler uses 8.3 filenames to support running the compiler on an old
  1174. DOS FAT partition.
  1175. Revision 1.60 1998/10/14 10:45:07 pierre
  1176. * ppu problems for m68k fixed (at least in cross compiling)
  1177. * one last memory leak for sysamiga fixed
  1178. * the amiga RTL compiles now completely !!
  1179. Revision 1.59 1998/10/13 14:01:07 peter
  1180. * fixed -al
  1181. Revision 1.58 1998/10/12 11:59:00 peter
  1182. + show name and date of .o and .s files which the compiler checks
  1183. Revision 1.57 1998/10/09 16:36:03 pierre
  1184. * some memory leaks specific to usebrowser define fixed
  1185. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1186. Revision 1.56 1998/10/09 08:56:26 pierre
  1187. * several memory leaks fixed
  1188. Revision 1.55 1998/10/08 23:28:54 peter
  1189. * -vu shows unit info, -vt shows tried/used files
  1190. Revision 1.54 1998/10/08 17:17:19 pierre
  1191. * current_module old scanner tagged as invalid if unit is recompiled
  1192. + added ppheap for better info on tracegetmem of heaptrc
  1193. (adds line column and file index)
  1194. * several memory leaks removed ith help of heaptrc !!
  1195. Revision 1.53 1998/10/08 13:48:43 peter
  1196. * fixed memory leaks for do nothing source
  1197. * fixed unit interdependency
  1198. Revision 1.52 1998/10/06 22:09:48 peter
  1199. * fixed for compiling with 0.99.8 due circular units
  1200. Revision 1.51 1998/10/06 17:16:47 pierre
  1201. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1202. Revision 1.50 1998/09/30 16:43:34 peter
  1203. * fixed unit interdependency with circular uses
  1204. Revision 1.49 1998/09/28 16:57:20 pierre
  1205. * changed all length(p^.value_str^) into str_length(p)
  1206. to get it work with and without ansistrings
  1207. * changed sourcefiles field of tmodule to a pointer
  1208. Revision 1.48 1998/09/24 23:46:34 peter
  1209. + outputdir support
  1210. Revision 1.47 1998/09/22 17:13:43 pierre
  1211. + browsing updated and developed
  1212. records and objects fields are also stored
  1213. Revision 1.46 1998/09/21 08:45:10 pierre
  1214. + added vmt_offset in tobjectdef.write for fututre use
  1215. (first steps to have objects without vmt if no virtual !!)
  1216. + added fpu_used field for tabstractprocdef :
  1217. sets this level to 2 if the functions return with value in FPU
  1218. (is then set to correct value at parsing of implementation)
  1219. THIS MIGHT refuse some code with FPU expression too complex
  1220. that were accepted before and even in some cases
  1221. that don't overflow in fact
  1222. ( like if f : float; is a forward that finally in implementation
  1223. only uses one fpu register !!)
  1224. Nevertheless I think that it will improve security on
  1225. FPU operations !!
  1226. * most other changes only for UseBrowser code
  1227. (added symtable references for record and objects)
  1228. local switch for refs to args and local of each function
  1229. (static symtable still missing)
  1230. UseBrowser still not stable and probably broken by
  1231. the definition hash array !!
  1232. Revision 1.45 1998/09/18 09:58:51 peter
  1233. * -s doesn't require the .o to be available, this allows compiling of
  1234. everything on other platforms (profiling the windows.pp loading ;)
  1235. Revision 1.44 1998/09/10 13:51:32 peter
  1236. * tp compiler also uses 'as' as asmprefix
  1237. Revision 1.43 1998/09/03 17:08:45 pierre
  1238. * better lines for stabs
  1239. (no scroll back to if before else part
  1240. no return to case line at jump outside case)
  1241. + source lines also if not in order
  1242. Revision 1.42 1998/09/03 11:24:00 peter
  1243. * moved more inputfile things from tscannerfile to tinputfile
  1244. * changed ifdef Sourceline to cs_asm_source
  1245. Revision 1.41 1998/08/26 15:35:30 peter
  1246. * fixed scannerfiles for macros
  1247. + $I %<environment>%
  1248. Revision 1.40 1998/08/26 10:08:48 peter
  1249. * fixed problem with libprefix at the wrong place
  1250. * fixed lib generation with smartlinking and no -CS used
  1251. Revision 1.39 1998/08/25 16:44:16 pierre
  1252. * openppu was true even if the object file is missing
  1253. this lead to trying to open a filename without extension
  1254. and prevented the 'make cycle' to work for win32
  1255. Revision 1.38 1998/08/19 10:06:12 peter
  1256. * fixed filenames and removedir which supports slash at the end
  1257. Revision 1.37 1998/08/18 20:52:19 peter
  1258. * renamed in_main to in_global which is more logical
  1259. Revision 1.36 1998/08/17 10:10:07 peter
  1260. - removed OLDPPU
  1261. Revision 1.35 1998/08/17 09:17:44 peter
  1262. * static/shared linking updates
  1263. Revision 1.34 1998/08/14 21:56:31 peter
  1264. * setting the outputfile using -o works now to create static libs
  1265. Revision 1.33 1998/08/11 14:09:08 peter
  1266. * fixed some messages and smaller msgtxt.inc
  1267. Revision 1.32 1998/08/10 14:49:58 peter
  1268. + localswitches, moduleswitches, globalswitches splitting
  1269. Revision 1.31 1998/07/14 14:46:48 peter
  1270. * released NEWINPUT
  1271. Revision 1.30 1998/07/07 11:19:55 peter
  1272. + NEWINPUT for a better inputfile and scanner object
  1273. Revision 1.29 1998/06/25 10:51:00 pierre
  1274. * removed a remaining ifndef NEWPPU
  1275. replaced by ifdef OLDPPU
  1276. * added uf_finalize to ppu unit
  1277. Revision 1.28 1998/06/25 08:48:12 florian
  1278. * first version of rtti support
  1279. Revision 1.27 1998/06/24 14:48:34 peter
  1280. * ifdef newppu -> ifndef oldppu
  1281. Revision 1.26 1998/06/17 14:36:19 peter
  1282. * forgot an $ifndef OLDPPU :(
  1283. Revision 1.25 1998/06/17 14:10:11 peter
  1284. * small os2 fixes
  1285. * fixed interdependent units with newppu (remake3 under linux works now)
  1286. Revision 1.24 1998/06/16 08:56:20 peter
  1287. + targetcpu
  1288. * cleaner pmodules for newppu
  1289. Revision 1.23 1998/06/15 14:44:36 daniel
  1290. * BP updates.
  1291. Revision 1.22 1998/06/14 18:25:41 peter
  1292. * small fix with crc in newppu
  1293. Revision 1.21 1998/06/13 00:10:05 peter
  1294. * working browser and newppu
  1295. * some small fixes against crashes which occured in bp7 (but not in
  1296. fpc?!)
  1297. Revision 1.20 1998/06/12 14:50:48 peter
  1298. * removed the tree dependency to types.pas
  1299. * long_fil.pas support (not fully tested yet)
  1300. Revision 1.19 1998/06/12 10:32:26 pierre
  1301. * column problem hopefully solved
  1302. + C vars declaration changed
  1303. Revision 1.18 1998/06/11 13:58:07 peter
  1304. * small fix to let newppu compile
  1305. Revision 1.17 1998/06/09 16:01:40 pierre
  1306. + added procedure directive parsing for procvars
  1307. (accepted are popstack cdecl and pascal)
  1308. + added C vars with the following syntax
  1309. var C calias 'true_c_name';(can be followed by external)
  1310. reason is that you must add the Cprefix
  1311. which is target dependent
  1312. Revision 1.16 1998/06/04 10:42:19 pierre
  1313. * small bug fix in load_ppu or openppu
  1314. Revision 1.15 1998/05/28 14:37:53 peter
  1315. * default programname is PROGRAM (like TP7) to avoid dup id's
  1316. Revision 1.14 1998/05/27 19:45:02 peter
  1317. * symtable.pas splitted into includefiles
  1318. * symtable adapted for $ifndef OLDPPU
  1319. Revision 1.13 1998/05/23 01:21:05 peter
  1320. + aktasmmode, aktoptprocessor, aktoutputformat
  1321. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1322. + $LIBNAME to set the library name where the unit will be put in
  1323. * splitted cgi386 a bit (codeseg to large for bp7)
  1324. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1325. Revision 1.12 1998/05/20 09:42:33 pierre
  1326. + UseTokenInfo now default
  1327. * unit in interface uses and implementation uses gives error now
  1328. * only one error for unknown symbol (uses lastsymknown boolean)
  1329. the problem came from the label code !
  1330. + first inlined procedures and function work
  1331. (warning there might be allowed cases were the result is still wrong !!)
  1332. * UseBrower updated gives a global list of all position of all used symbols
  1333. with switch -gb
  1334. Revision 1.11 1998/05/12 10:46:59 peter
  1335. * moved printstatus to verb_def
  1336. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1337. prefix like error: warning: and is included in V_Default
  1338. * fixed some messages
  1339. * first time parameter scan is only for -v and -T
  1340. - removed old style messages
  1341. Revision 1.10 1998/05/11 13:07:53 peter
  1342. + $ifndef OLDPPU for the new ppuformat
  1343. + $define GDB not longer required
  1344. * removed all warnings and stripped some log comments
  1345. * no findfirst/findnext anymore to remove smartlink *.o files
  1346. Revision 1.9 1998/05/06 15:04:20 pierre
  1347. + when trying to find source files of a ppufile
  1348. check the includepathlist for included files
  1349. the main file must still be in the same directory
  1350. Revision 1.8 1998/05/04 17:54:25 peter
  1351. + smartlinking works (only case jumptable left todo)
  1352. * redesign of systems.pas to support assemblers and linkers
  1353. + Unitname is now also in the PPU-file, increased version to 14
  1354. Revision 1.7 1998/05/01 16:38:44 florian
  1355. * handling of private and protected fixed
  1356. + change_keywords_to_tp implemented to remove
  1357. keywords which aren't supported by tp
  1358. * break and continue are now symbols of the system unit
  1359. + widestring, longstring and ansistring type released
  1360. Revision 1.6 1998/05/01 07:43:53 florian
  1361. + basics for rtti implemented
  1362. + switch $m (generate rtti for published sections)
  1363. Revision 1.5 1998/04/30 15:59:40 pierre
  1364. * GDB works again better :
  1365. correct type info in one pass
  1366. + UseTokenInfo for better source position
  1367. * fixed one remaining bug in scanner for line counts
  1368. * several little fixes
  1369. Revision 1.4 1998/04/29 10:33:52 pierre
  1370. + added some code for ansistring (not complete nor working yet)
  1371. * corrected operator overloading
  1372. * corrected nasm output
  1373. + started inline procedures
  1374. + added starstarn : use ** for exponentiation (^ gave problems)
  1375. + started UseTokenInfo cond to get accurate positions
  1376. Revision 1.3 1998/04/27 23:10:28 peter
  1377. + new scanner
  1378. * $makelib -> if smartlink
  1379. * small filename fixes pmodule.setfilename
  1380. * moved import from files.pas -> import.pas
  1381. Revision 1.2 1998/04/21 10:16:47 peter
  1382. * patches from strasbourg
  1383. * objects is not used anymore in the fpc compiled version
  1384. }