files.pas 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586
  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. {$ifndef OLDPPU}
  674. interface_crc:=ppufile^.header.interface_checksum;
  675. {$endif}
  676. { Show Debug info }
  677. Message1(unit_u_ppu_time,filetimestring(ppufiletime));
  678. Message1(unit_u_ppu_flags,tostr(flags));
  679. Message1(unit_u_ppu_crc,tostr(ppufile^.header.checksum));
  680. {$ifndef OLDPPU}
  681. Message1(unit_u_ppu_crc,tostr(ppufile^.header.interface_checksum)+' (intfc)');
  682. {$endif}
  683. { check the object and assembler file to see if we need only to
  684. assemble, only if it's not in a library }
  685. do_compile:=false;
  686. if (flags and uf_in_library)=0 then
  687. begin
  688. if (flags and (uf_static_linked or uf_smartlink))<>0 then
  689. begin
  690. objfiletime:=getnamedfiletime(staticlibfilename^);
  691. Message2(unit_u_check_time,staticlibfilename^,filetimestring(objfiletime));
  692. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  693. begin
  694. Message(unit_u_recompile_staticlib_is_older);
  695. do_compile:=true;
  696. exit;
  697. end;
  698. end
  699. else
  700. if (flags and uf_shared_linked)<>0 then
  701. begin
  702. objfiletime:=getnamedfiletime(sharedlibfilename^);
  703. Message2(unit_u_check_time,sharedlibfilename^,filetimestring(objfiletime));
  704. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  705. begin
  706. Message(unit_u_recompile_sharedlib_is_older);
  707. do_compile:=true;
  708. exit;
  709. end;
  710. end
  711. else
  712. if (flags and uf_obj_linked)<>0 then
  713. begin
  714. { the objectfile should be newer than the ppu file }
  715. objfiletime:=getnamedfiletime(objfilename^);
  716. Message2(unit_u_check_time,objfilename^,filetimestring(objfiletime));
  717. if (ppufiletime<0) or (objfiletime<0) or (ppufiletime>objfiletime) then
  718. begin
  719. { check if assembler file is older than ppu file }
  720. asmfileTime:=GetNamedFileTime(asmfilename^);
  721. Message2(unit_u_check_time,asmfilename^,filetimestring(asmfiletime));
  722. if (asmfiletime<0) or (ppufiletime>asmfiletime) then
  723. begin
  724. Message(unit_u_recompile_obj_and_asm_older);
  725. do_compile:=true;
  726. exit;
  727. end
  728. else
  729. begin
  730. Message(unit_u_recompile_obj_older_than_asm);
  731. if not(cs_asm_extern in aktglobalswitches) then
  732. begin
  733. do_compile:=true;
  734. exit;
  735. end;
  736. end;
  737. end;
  738. end;
  739. end;
  740. openppu:=true;
  741. end;
  742. function tmodule.search_unit(const n : string;onlysource:boolean):boolean;
  743. var
  744. singlepathstring,
  745. filename : string;
  746. Function UnitExists(const ext:string):boolean;
  747. begin
  748. Message1(unit_t_unitsearch,Singlepathstring+filename+ext);
  749. UnitExists:=FileExists(Singlepathstring+FileName+ext);
  750. end;
  751. Function SearchPath(unitpath:string):boolean;
  752. var
  753. found : boolean;
  754. start,i : longint;
  755. ext : string[8];
  756. begin
  757. start:=1;
  758. Found:=false;
  759. repeat
  760. { Create current path to check }
  761. i:=pos(';',unitpath);
  762. if i=0 then
  763. i:=length(unitpath)+1;
  764. singlepathstring:=FixPath(copy(unitpath,start,i-start),false);
  765. delete(unitpath,start,i-start+1);
  766. if not onlysource then
  767. begin
  768. { Check for PPL file }
  769. if not Found then
  770. begin
  771. Found:=UnitExists(target_info.unitlibext);
  772. if Found then
  773. Begin
  774. SetFileName(SinglePathString+FileName,false);
  775. Found:=OpenPPU;
  776. End;
  777. end;
  778. { Check for PPU file }
  779. if not Found then
  780. begin
  781. Found:=UnitExists(target_info.unitext);
  782. if Found then
  783. Begin
  784. SetFileName(SinglePathString+FileName,false);
  785. Found:=OpenPPU;
  786. End;
  787. end;
  788. end;
  789. { Check for Sources }
  790. if not Found then
  791. begin
  792. ppufile:=nil;
  793. do_compile:=true;
  794. {Check for .pp file}
  795. Found:=UnitExists(target_os.sourceext);
  796. if Found then
  797. Ext:=target_os.sourceext
  798. else
  799. begin
  800. {Check for .pas}
  801. Found:=UnitExists(target_os.pasext);
  802. if Found then
  803. Ext:=target_os.pasext;
  804. end;
  805. stringdispose(mainsource);
  806. if Found then
  807. begin
  808. sources_avail:=true;
  809. {Load Filenames when found}
  810. mainsource:=StringDup(SinglePathString+FileName+Ext);
  811. SetFileName(SinglePathString+FileName,false);
  812. end
  813. else
  814. sources_avail:=false;
  815. end;
  816. until Found or (unitpath='');
  817. SearchPath:=Found;
  818. end;
  819. var
  820. fnd : boolean;
  821. begin
  822. filename:=FixFileName(n);
  823. { try to find unit
  824. 1. cwd
  825. 2. local unit path
  826. 3. global unit path }
  827. fnd:=SearchPath('.');
  828. if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
  829. fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
  830. if (not fnd) then
  831. fnd:=SearchPath(UnitSearchPath);
  832. { try to find a file with the first 8 chars of the modulename, like
  833. dos }
  834. if (not fnd) and (length(filename)>8) then
  835. begin
  836. filename:=copy(filename,1,8);
  837. fnd:=SearchPath('.');
  838. if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
  839. fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
  840. if not fnd then
  841. fnd:=SearchPath(UnitSearchPath);
  842. end;
  843. search_unit:=fnd;
  844. end;
  845. procedure tmodule.reset;
  846. {$ifndef OLDPPU}
  847. var
  848. pm : pdependent_unit;
  849. {$endif}
  850. begin
  851. if assigned(scanner) then
  852. pscannerfile(scanner)^.invalid:=true;
  853. if assigned(globalsymtable) then
  854. begin
  855. dispose(punitsymtable(globalsymtable),done);
  856. globalsymtable:=nil;
  857. end;
  858. if assigned(localsymtable) then
  859. begin
  860. dispose(punitsymtable(localsymtable),done);
  861. localsymtable:=nil;
  862. end;
  863. if assigned(map) then
  864. begin
  865. dispose(map);
  866. map:=nil;
  867. end;
  868. if assigned(ppufile) then
  869. begin
  870. dispose(ppufile,done);
  871. ppufile:=nil;
  872. end;
  873. sourcefiles^.done;
  874. sourcefiles^.init;
  875. imports^.done;
  876. imports^.init;
  877. _exports^.done;
  878. _exports^.init;
  879. used_units.done;
  880. used_units.init;
  881. { all units that depend on this one must be recompiled ! }
  882. {$ifndef OLDPPU}
  883. pm:=pdependent_unit(dependent_units.first);
  884. while assigned(pm) do
  885. begin
  886. if pm^.u^.in_second_compile then
  887. Comment(v_debug,'No reload already in second compile: '+pm^.u^.modulename^)
  888. else
  889. begin
  890. pm^.u^.do_reload:=true;
  891. Comment(v_debug,'Reloading '+pm^.u^.modulename^+' needed because '+modulename^+' is reloaded');
  892. end;
  893. pm:=pdependent_unit(pm^.next);
  894. end;
  895. {$endif OLDPPU}
  896. dependent_units.done;
  897. dependent_units.init;
  898. resourcefiles.done;
  899. resourcefiles.init_no_double;
  900. linkunitfiles.done;
  901. linkunitfiles.init_no_double;
  902. linkofiles.done;
  903. linkofiles.init_no_double;
  904. linkstaticlibs.done;
  905. linkstaticlibs.init_no_double;
  906. linksharedlibs.done;
  907. linksharedlibs.init_no_double;
  908. uses_imports:=false;
  909. do_assemble:=false;
  910. do_compile:=false;
  911. { sources_avail:=true;
  912. should not be changed PM }
  913. compiled:=false;
  914. in_implementation:=false;
  915. in_global:=true;
  916. loaded_from:=nil;
  917. flags:=0;
  918. crc:=0;
  919. interface_crc:=0;
  920. unitcount:=1;
  921. end;
  922. constructor tmodule.init(const s:string;_is_unit:boolean);
  923. var
  924. p : dirstr;
  925. n : namestr;
  926. e : extstr;
  927. begin
  928. FSplit(s,p,n,e);
  929. { Programs have the name program to don't conflict with dup id's }
  930. if _is_unit then
  931. modulename:=stringdup(Upper(n))
  932. else
  933. modulename:=stringdup('PROGRAM');
  934. mainsource:=stringdup(s);
  935. ppufilename:=nil;
  936. objfilename:=nil;
  937. asmfilename:=nil;
  938. staticlibfilename:=nil;
  939. sharedlibfilename:=nil;
  940. exefilename:=nil;
  941. outpath:=nil;
  942. { Dos has the famous 8.3 limit :( }
  943. {$ifdef tp}
  944. asmprefix:=stringdup(FixFileName('as'));
  945. {$else}
  946. {$ifdef go32v2}
  947. asmprefix:=stringdup(FixFileName('as'));
  948. {$else}
  949. {$ifdef OS2}
  950. {Allthough OS/2 supports long filenames I play it safe and
  951. use 8.3 filenames, because this allows the compiler to run
  952. on a FAT partition. (DM)}
  953. asmprefix:=stringdup(FixFileName('as'));
  954. {$else}
  955. asmprefix:=stringdup(FixFileName(n));
  956. {$endif}
  957. {$endif}
  958. {$endif tp}
  959. path:=nil;
  960. setfilename(p+n,true);
  961. localunitsearchpath:=nil;
  962. localobjectsearchpath:=nil;
  963. localincludesearchpath:=nil;
  964. locallibrarysearchpath:=nil;
  965. used_units.init;
  966. dependent_units.init;
  967. new(sourcefiles,init);
  968. resourcefiles.init_no_double;
  969. linkunitfiles.init_no_double;
  970. linkofiles.init_no_double;
  971. linkstaticlibs.init_no_double;
  972. linksharedlibs.init_no_double;
  973. ppufile:=nil;
  974. scanner:=nil;
  975. map:=nil;
  976. globalsymtable:=nil;
  977. localsymtable:=nil;
  978. loaded_from:=nil;
  979. flags:=0;
  980. crc:=0;
  981. interface_crc:=0;
  982. do_reload:=false;
  983. unitcount:=1;
  984. inc(global_unit_count);
  985. unit_index:=global_unit_count;
  986. do_assemble:=false;
  987. do_compile:=false;
  988. sources_avail:=true;
  989. compiled:=false;
  990. in_second_compile:=false;
  991. in_implementation:=false;
  992. in_global:=true;
  993. is_unit:=_is_unit;
  994. islibrary:=false;
  995. uses_imports:=false;
  996. imports:=new(plinkedlist,init);
  997. _exports:=new(plinkedlist,init);
  998. { search the PPU file if it is an unit }
  999. if is_unit then
  1000. search_unit(modulename^,false);
  1001. end;
  1002. destructor tmodule.done;
  1003. begin
  1004. if assigned(map) then
  1005. dispose(map);
  1006. if assigned(ppufile) then
  1007. dispose(ppufile,done);
  1008. ppufile:=nil;
  1009. if assigned(imports) then
  1010. dispose(imports,done);
  1011. imports:=nil;
  1012. if assigned(_exports) then
  1013. dispose(_exports,done);
  1014. _exports:=nil;
  1015. if assigned(scanner) then
  1016. pscannerfile(scanner)^.invalid:=true;
  1017. if assigned(sourcefiles) then
  1018. dispose(sourcefiles,done);
  1019. sourcefiles:=nil;
  1020. used_units.done;
  1021. dependent_units.done;
  1022. resourcefiles.done;
  1023. linkunitfiles.done;
  1024. linkofiles.done;
  1025. linkstaticlibs.done;
  1026. linksharedlibs.done;
  1027. stringdispose(objfilename);
  1028. stringdispose(asmfilename);
  1029. stringdispose(ppufilename);
  1030. stringdispose(staticlibfilename);
  1031. stringdispose(sharedlibfilename);
  1032. stringdispose(exefilename);
  1033. stringdispose(outpath);
  1034. stringdispose(path);
  1035. stringdispose(modulename);
  1036. stringdispose(mainsource);
  1037. stringdispose(asmprefix);
  1038. stringdispose(localunitsearchpath);
  1039. stringdispose(localobjectsearchpath);
  1040. stringdispose(localincludesearchpath);
  1041. stringdispose(locallibrarysearchpath);
  1042. if assigned(globalsymtable) then
  1043. dispose(punitsymtable(globalsymtable),done);
  1044. globalsymtable:=nil;
  1045. if assigned(localsymtable) then
  1046. dispose(punitsymtable(localsymtable),done);
  1047. localsymtable:=nil;
  1048. inherited done;
  1049. end;
  1050. {****************************************************************************
  1051. TUSED_UNIT
  1052. ****************************************************************************}
  1053. constructor tused_unit.init(_u : pmodule;intface:boolean);
  1054. begin
  1055. u:=_u;
  1056. in_interface:=intface;
  1057. in_uses:=false;
  1058. is_stab_written:=false;
  1059. loaded:=true;
  1060. name:=stringdup(_u^.modulename^);
  1061. checksum:=_u^.crc;
  1062. interface_checksum:=_u^.interface_crc;
  1063. unitid:=0;
  1064. end;
  1065. constructor tused_unit.init_to_load(const n:string;c,intfc:longint;intface:boolean);
  1066. begin
  1067. u:=nil;
  1068. in_interface:=intface;
  1069. in_uses:=false;
  1070. is_stab_written:=false;
  1071. loaded:=false;
  1072. name:=stringdup(n);
  1073. checksum:=c;
  1074. interface_checksum:=intfc;
  1075. unitid:=0;
  1076. end;
  1077. destructor tused_unit.done;
  1078. begin
  1079. stringdispose(name);
  1080. inherited done;
  1081. end;
  1082. {****************************************************************************
  1083. TDENPENDENT_UNIT
  1084. ****************************************************************************}
  1085. constructor tdependent_unit.init(_u : pmodule);
  1086. begin
  1087. u:=_u;
  1088. end;
  1089. end.
  1090. {
  1091. $Log$
  1092. Revision 1.94 1999-05-04 21:44:42 florian
  1093. * changes to compile it with Delphi 4.0
  1094. Revision 1.93 1999/04/26 13:31:29 peter
  1095. * release storenumber,double_checksum
  1096. Revision 1.92 1999/04/25 15:08:36 peter
  1097. * small fixes for double_checksum
  1098. Revision 1.91 1999/04/21 09:43:36 peter
  1099. * storenumber works
  1100. * fixed some typos in double_checksum
  1101. + incompatible types type1 and type2 message (with storenumber)
  1102. Revision 1.90 1999/04/14 09:14:48 peter
  1103. * first things to store the symbol/def number in the ppu
  1104. Revision 1.89 1999/04/07 15:39:29 pierre
  1105. + double_checksum code added
  1106. Revision 1.88 1999/03/25 16:55:29 peter
  1107. + unitpath,librarypath,includepath,objectpath directives
  1108. Revision 1.87 1999/02/16 00:48:23 peter
  1109. * save in the ppu if linked with obj file instead of using the
  1110. library flag, so the .inc files are also checked
  1111. Revision 1.86 1999/02/05 08:54:24 pierre
  1112. + linkofiles splitted inot linkofiles and linkunitfiles
  1113. because linkofiles must be stored with directory
  1114. to enabled linking of different objects with same name
  1115. in a different directory
  1116. Revision 1.85 1999/01/14 21:47:11 peter
  1117. * status.currentmodule is now also updated
  1118. + status.currentsourcepath
  1119. Revision 1.84 1999/01/14 11:38:39 daniel
  1120. * Exe name derived from target_info instead of target_os
  1121. Revision 1.83 1999/01/13 15:02:00 daniel
  1122. * Tinputfile.readbuf eof bugfix
  1123. Revision 1.82 1999/01/12 14:25:26 peter
  1124. + BrowserLog for browser.log generation
  1125. + BrowserCol for browser info in TCollections
  1126. * released all other UseBrowser
  1127. Revision 1.81 1998/12/28 23:26:14 peter
  1128. + resource file handling ($R directive) for Win32
  1129. Revision 1.80 1998/12/16 00:27:19 peter
  1130. * removed some obsolete version checks
  1131. Revision 1.79 1998/12/11 00:03:14 peter
  1132. + globtype,tokens,version unit splitted from globals
  1133. Revision 1.78 1998/12/04 10:18:07 florian
  1134. * some stuff for procedures of object added
  1135. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1136. Revision 1.77 1998/12/02 16:23:37 jonas
  1137. * changed "if longintvar in set" to case or "if () or () .." statements
  1138. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1139. Revision 1.76 1998/12/01 12:51:19 peter
  1140. * fixed placing of ppas.sh and link.res when using -FE
  1141. Revision 1.75 1998/11/16 15:41:40 peter
  1142. * tp7 didn't like my ifopt H+ :(
  1143. Revision 1.74 1998/11/16 12:18:01 peter
  1144. * H+ fixes
  1145. Revision 1.73 1998/11/16 11:28:58 pierre
  1146. * stackcheck removed for i386_win32
  1147. * exportlist does not crash at least !!
  1148. (was need for tests dir !)z
  1149. Revision 1.72 1998/11/15 16:32:35 florian
  1150. * some stuff of Pavel implement (win32 dll creation)
  1151. * bug with ansistring function results fixed
  1152. Revision 1.71 1998/11/06 09:45:40 pierre
  1153. * bug on errors (file used after dispose !) fixed
  1154. Revision 1.70 1998/11/03 11:33:14 peter
  1155. + search_unit arg to only search for sources
  1156. Revision 1.69 1998/10/29 11:35:44 florian
  1157. * some dll support for win32
  1158. * fixed assembler writing for PalmOS
  1159. Revision 1.68 1998/10/27 10:22:34 florian
  1160. + First things for win32 export sections
  1161. Revision 1.67 1998/10/26 22:23:29 peter
  1162. + fixpath() has an extra option to allow a ./ as path
  1163. Revision 1.66 1998/10/19 18:07:11 peter
  1164. + external dll_name name func support for linux
  1165. Revision 1.65 1998/10/15 12:22:25 pierre
  1166. * close include files immediately after end reading
  1167. instead of waiting until unit compilation ended !
  1168. Revision 1.64 1998/10/14 13:38:19 peter
  1169. * fixed path with staticlib/objects in ppufiles
  1170. Revision 1.63 1998/10/14 11:02:49 daniel
  1171. * Stupid typo fixed.
  1172. Revision 1.62 1998/10/14 10:59:37 daniel
  1173. * Staticlibfilename now doesn't include path.
  1174. Revision 1.61 1998/10/14 10:57:25 daniel
  1175. * Dirstr, namestr, extstr.
  1176. * $V+ to prevent Peter from forgetting this.
  1177. * OS/2 compiler uses 8.3 filenames to support running the compiler on an old
  1178. DOS FAT partition.
  1179. Revision 1.60 1998/10/14 10:45:07 pierre
  1180. * ppu problems for m68k fixed (at least in cross compiling)
  1181. * one last memory leak for sysamiga fixed
  1182. * the amiga RTL compiles now completely !!
  1183. Revision 1.59 1998/10/13 14:01:07 peter
  1184. * fixed -al
  1185. Revision 1.58 1998/10/12 11:59:00 peter
  1186. + show name and date of .o and .s files which the compiler checks
  1187. Revision 1.57 1998/10/09 16:36:03 pierre
  1188. * some memory leaks specific to usebrowser define fixed
  1189. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1190. Revision 1.56 1998/10/09 08:56:26 pierre
  1191. * several memory leaks fixed
  1192. Revision 1.55 1998/10/08 23:28:54 peter
  1193. * -vu shows unit info, -vt shows tried/used files
  1194. Revision 1.54 1998/10/08 17:17:19 pierre
  1195. * current_module old scanner tagged as invalid if unit is recompiled
  1196. + added ppheap for better info on tracegetmem of heaptrc
  1197. (adds line column and file index)
  1198. * several memory leaks removed ith help of heaptrc !!
  1199. Revision 1.53 1998/10/08 13:48:43 peter
  1200. * fixed memory leaks for do nothing source
  1201. * fixed unit interdependency
  1202. Revision 1.52 1998/10/06 22:09:48 peter
  1203. * fixed for compiling with 0.99.8 due circular units
  1204. Revision 1.51 1998/10/06 17:16:47 pierre
  1205. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1206. Revision 1.50 1998/09/30 16:43:34 peter
  1207. * fixed unit interdependency with circular uses
  1208. Revision 1.49 1998/09/28 16:57:20 pierre
  1209. * changed all length(p^.value_str^) into str_length(p)
  1210. to get it work with and without ansistrings
  1211. * changed sourcefiles field of tmodule to a pointer
  1212. Revision 1.48 1998/09/24 23:46:34 peter
  1213. + outputdir support
  1214. Revision 1.47 1998/09/22 17:13:43 pierre
  1215. + browsing updated and developed
  1216. records and objects fields are also stored
  1217. Revision 1.46 1998/09/21 08:45:10 pierre
  1218. + added vmt_offset in tobjectdef.write for fututre use
  1219. (first steps to have objects without vmt if no virtual !!)
  1220. + added fpu_used field for tabstractprocdef :
  1221. sets this level to 2 if the functions return with value in FPU
  1222. (is then set to correct value at parsing of implementation)
  1223. THIS MIGHT refuse some code with FPU expression too complex
  1224. that were accepted before and even in some cases
  1225. that don't overflow in fact
  1226. ( like if f : float; is a forward that finally in implementation
  1227. only uses one fpu register !!)
  1228. Nevertheless I think that it will improve security on
  1229. FPU operations !!
  1230. * most other changes only for UseBrowser code
  1231. (added symtable references for record and objects)
  1232. local switch for refs to args and local of each function
  1233. (static symtable still missing)
  1234. UseBrowser still not stable and probably broken by
  1235. the definition hash array !!
  1236. Revision 1.45 1998/09/18 09:58:51 peter
  1237. * -s doesn't require the .o to be available, this allows compiling of
  1238. everything on other platforms (profiling the windows.pp loading ;)
  1239. Revision 1.44 1998/09/10 13:51:32 peter
  1240. * tp compiler also uses 'as' as asmprefix
  1241. Revision 1.43 1998/09/03 17:08:45 pierre
  1242. * better lines for stabs
  1243. (no scroll back to if before else part
  1244. no return to case line at jump outside case)
  1245. + source lines also if not in order
  1246. Revision 1.42 1998/09/03 11:24:00 peter
  1247. * moved more inputfile things from tscannerfile to tinputfile
  1248. * changed ifdef Sourceline to cs_asm_source
  1249. Revision 1.41 1998/08/26 15:35:30 peter
  1250. * fixed scannerfiles for macros
  1251. + $I %<environment>%
  1252. Revision 1.40 1998/08/26 10:08:48 peter
  1253. * fixed problem with libprefix at the wrong place
  1254. * fixed lib generation with smartlinking and no -CS used
  1255. Revision 1.39 1998/08/25 16:44:16 pierre
  1256. * openppu was true even if the object file is missing
  1257. this lead to trying to open a filename without extension
  1258. and prevented the 'make cycle' to work for win32
  1259. Revision 1.38 1998/08/19 10:06:12 peter
  1260. * fixed filenames and removedir which supports slash at the end
  1261. Revision 1.37 1998/08/18 20:52:19 peter
  1262. * renamed in_main to in_global which is more logical
  1263. Revision 1.36 1998/08/17 10:10:07 peter
  1264. - removed OLDPPU
  1265. Revision 1.35 1998/08/17 09:17:44 peter
  1266. * static/shared linking updates
  1267. Revision 1.34 1998/08/14 21:56:31 peter
  1268. * setting the outputfile using -o works now to create static libs
  1269. Revision 1.33 1998/08/11 14:09:08 peter
  1270. * fixed some messages and smaller msgtxt.inc
  1271. Revision 1.32 1998/08/10 14:49:58 peter
  1272. + localswitches, moduleswitches, globalswitches splitting
  1273. Revision 1.31 1998/07/14 14:46:48 peter
  1274. * released NEWINPUT
  1275. Revision 1.30 1998/07/07 11:19:55 peter
  1276. + NEWINPUT for a better inputfile and scanner object
  1277. Revision 1.29 1998/06/25 10:51:00 pierre
  1278. * removed a remaining ifndef NEWPPU
  1279. replaced by ifdef OLDPPU
  1280. * added uf_finalize to ppu unit
  1281. Revision 1.28 1998/06/25 08:48:12 florian
  1282. * first version of rtti support
  1283. Revision 1.27 1998/06/24 14:48:34 peter
  1284. * ifdef newppu -> ifndef oldppu
  1285. Revision 1.26 1998/06/17 14:36:19 peter
  1286. * forgot an $ifndef OLDPPU :(
  1287. Revision 1.25 1998/06/17 14:10:11 peter
  1288. * small os2 fixes
  1289. * fixed interdependent units with newppu (remake3 under linux works now)
  1290. Revision 1.24 1998/06/16 08:56:20 peter
  1291. + targetcpu
  1292. * cleaner pmodules for newppu
  1293. Revision 1.23 1998/06/15 14:44:36 daniel
  1294. * BP updates.
  1295. Revision 1.22 1998/06/14 18:25:41 peter
  1296. * small fix with crc in newppu
  1297. Revision 1.21 1998/06/13 00:10:05 peter
  1298. * working browser and newppu
  1299. * some small fixes against crashes which occured in bp7 (but not in
  1300. fpc?!)
  1301. Revision 1.20 1998/06/12 14:50:48 peter
  1302. * removed the tree dependency to types.pas
  1303. * long_fil.pas support (not fully tested yet)
  1304. Revision 1.19 1998/06/12 10:32:26 pierre
  1305. * column problem hopefully solved
  1306. + C vars declaration changed
  1307. Revision 1.18 1998/06/11 13:58:07 peter
  1308. * small fix to let newppu compile
  1309. Revision 1.17 1998/06/09 16:01:40 pierre
  1310. + added procedure directive parsing for procvars
  1311. (accepted are popstack cdecl and pascal)
  1312. + added C vars with the following syntax
  1313. var C calias 'true_c_name';(can be followed by external)
  1314. reason is that you must add the Cprefix
  1315. which is target dependent
  1316. Revision 1.16 1998/06/04 10:42:19 pierre
  1317. * small bug fix in load_ppu or openppu
  1318. Revision 1.15 1998/05/28 14:37:53 peter
  1319. * default programname is PROGRAM (like TP7) to avoid dup id's
  1320. Revision 1.14 1998/05/27 19:45:02 peter
  1321. * symtable.pas splitted into includefiles
  1322. * symtable adapted for $ifndef OLDPPU
  1323. Revision 1.13 1998/05/23 01:21:05 peter
  1324. + aktasmmode, aktoptprocessor, aktoutputformat
  1325. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1326. + $LIBNAME to set the library name where the unit will be put in
  1327. * splitted cgi386 a bit (codeseg to large for bp7)
  1328. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1329. Revision 1.12 1998/05/20 09:42:33 pierre
  1330. + UseTokenInfo now default
  1331. * unit in interface uses and implementation uses gives error now
  1332. * only one error for unknown symbol (uses lastsymknown boolean)
  1333. the problem came from the label code !
  1334. + first inlined procedures and function work
  1335. (warning there might be allowed cases were the result is still wrong !!)
  1336. * UseBrower updated gives a global list of all position of all used symbols
  1337. with switch -gb
  1338. Revision 1.11 1998/05/12 10:46:59 peter
  1339. * moved printstatus to verb_def
  1340. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1341. prefix like error: warning: and is included in V_Default
  1342. * fixed some messages
  1343. * first time parameter scan is only for -v and -T
  1344. - removed old style messages
  1345. Revision 1.10 1998/05/11 13:07:53 peter
  1346. + $ifndef OLDPPU for the new ppuformat
  1347. + $define GDB not longer required
  1348. * removed all warnings and stripped some log comments
  1349. * no findfirst/findnext anymore to remove smartlink *.o files
  1350. Revision 1.9 1998/05/06 15:04:20 pierre
  1351. + when trying to find source files of a ppufile
  1352. check the includepathlist for included files
  1353. the main file must still be in the same directory
  1354. Revision 1.8 1998/05/04 17:54:25 peter
  1355. + smartlinking works (only case jumptable left todo)
  1356. * redesign of systems.pas to support assemblers and linkers
  1357. + Unitname is now also in the PPU-file, increased version to 14
  1358. Revision 1.7 1998/05/01 16:38:44 florian
  1359. * handling of private and protected fixed
  1360. + change_keywords_to_tp implemented to remove
  1361. keywords which aren't supported by tp
  1362. * break and continue are now symbols of the system unit
  1363. + widestring, longstring and ansistring type released
  1364. Revision 1.6 1998/05/01 07:43:53 florian
  1365. + basics for rtti implemented
  1366. + switch $m (generate rtti for published sections)
  1367. Revision 1.5 1998/04/30 15:59:40 pierre
  1368. * GDB works again better :
  1369. correct type info in one pass
  1370. + UseTokenInfo for better source position
  1371. * fixed one remaining bug in scanner for line counts
  1372. * several little fixes
  1373. Revision 1.4 1998/04/29 10:33:52 pierre
  1374. + added some code for ansistring (not complete nor working yet)
  1375. * corrected operator overloading
  1376. * corrected nasm output
  1377. + started inline procedures
  1378. + added starstarn : use ** for exponentiation (^ gave problems)
  1379. + started UseTokenInfo cond to get accurate positions
  1380. Revision 1.3 1998/04/27 23:10:28 peter
  1381. + new scanner
  1382. * $makelib -> if smartlink
  1383. * small filename fixes pmodule.setfilename
  1384. * moved import from files.pas -> import.pas
  1385. Revision 1.2 1998/04/21 10:16:47 peter
  1386. * patches from strasbourg
  1387. * objects is not used anymore in the fpc compiled version
  1388. }