files.pas 48 KB

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