files.pas 48 KB

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