files.pas 42 KB

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