files.pas 48 KB

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