files.pas 49 KB

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