files.pas 42 KB

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