files.pas 46 KB

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