files.pas 45 KB

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