globals.pas 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 by Florian Klaempfl
  4. This unit implements some support functions and global variables
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit globals;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. {$ifdef win32}
  23. windows,
  24. {$endif}
  25. {$ifdef unix}
  26. {$ifdef ver1_0}
  27. linux,
  28. {$else}
  29. unix,
  30. {$endif}
  31. {$endif}
  32. {$ifdef os2}
  33. doscalls,
  34. {$endif}
  35. {$ifdef Delphi}
  36. sysutils,
  37. dmisc,
  38. {$else}
  39. strings,
  40. dos,
  41. {$endif}
  42. cutils,cobjects,cclasses,
  43. globtype,version,systems;
  44. const
  45. {$ifdef unix}
  46. DirSep = '/';
  47. {$else}
  48. {$ifdef amiga}
  49. DirSep = '/';
  50. {$else}
  51. DirSep = '\';
  52. {$endif}
  53. {$endif}
  54. {$ifdef Splitheap}
  55. testsplit : boolean = false;
  56. {$endif Splitheap}
  57. delphimodeswitches : tmodeswitches=
  58. [m_delphi,m_tp,m_all,m_class,m_objpas,m_result,m_string_pchar,
  59. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
  60. m_out,m_default_para];
  61. fpcmodeswitches : tmodeswitches=
  62. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  63. m_cvar_support,m_initfinal,m_add_pointer];
  64. objfpcmodeswitches : tmodeswitches=
  65. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  66. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer,m_out,m_default_para];
  67. tpmodeswitches : tmodeswitches=
  68. [m_tp7,m_tp,m_all,m_tp_procvar];
  69. gpcmodeswitches : tmodeswitches=
  70. [m_gpc,m_all];
  71. type
  72. pfileposinfo = ^tfileposinfo;
  73. tfileposinfo = record
  74. line : longint;
  75. column : word;
  76. fileindex : word;
  77. end;
  78. TSearchPathList = class(TStringList)
  79. procedure AddPath(s:string;addfirst:boolean);
  80. procedure AddList(list:TSearchPathList;addfirst:boolean);
  81. function FindFile(const f : string;var foundfile:string):boolean;
  82. end;
  83. var
  84. { specified inputfile }
  85. inputdir : dirstr;
  86. inputfile : namestr;
  87. inputextension : extstr;
  88. { specified outputfile with -o parameter }
  89. outputfile : namestr;
  90. { specified with -FE or -FU }
  91. outputexedir : dirstr;
  92. outputunitdir : dirstr;
  93. { things specified with parameters }
  94. paralinkoptions,
  95. paradynamiclinker : string;
  96. parapreprocess : boolean;
  97. { directory where the utils can be found (options -FD) }
  98. utilsdirectory : dirstr;
  99. { some flags for global compiler switches }
  100. do_build,
  101. do_make : boolean;
  102. not_unit_proc : boolean;
  103. { path for searching units, different paths can be seperated by ; }
  104. exepath : dirstr; { Path to ppc }
  105. librarysearchpath,
  106. unitsearchpath,
  107. objectsearchpath,
  108. includesearchpath : TSearchPathList;
  109. { deffile }
  110. usewindowapi : boolean;
  111. description : string;
  112. dllversion : string;
  113. dllmajor,dllminor,dllrevision : word; { revision only for netware }
  114. akttokenpos, { position of the last token }
  115. aktfilepos : tfileposinfo; { current position }
  116. { type of currently parsed block }
  117. { isn't full implemented (FK) }
  118. block_type : tblock_type;
  119. in_args : boolean; { arguments must be checked especially }
  120. parsing_para_level : longint; { parameter level, used to convert
  121. proc calls to proc loads in firstcalln }
  122. { Must_be_valid : boolean; should the variable already have a value
  123. obsolete replace by set_varstate function }
  124. compile_level : word;
  125. make_ref : boolean;
  126. resolving_forward : boolean; { used to add forward reference as second ref }
  127. use_esp_stackframe : boolean; { to test for call with ESP as stack frame }
  128. inlining_procedure : boolean; { are we inlining a procedure }
  129. { commandline values }
  130. initdefines : tstringlist;
  131. initglobalswitches : tglobalswitches;
  132. initmoduleswitches : tmoduleswitches;
  133. initlocalswitches : tlocalswitches;
  134. initmodeswitches : tmodeswitches;
  135. {$IFDEF testvarsets}
  136. Initsetalloc, {0=fixed, 1 =var}
  137. {$ENDIF}
  138. initpackenum : longint;
  139. initpackrecords : tpackrecords;
  140. initoutputformat : tasm;
  141. initoptprocessor,
  142. initspecificoptprocessor : tprocessors;
  143. initasmmode : tasmmode;
  144. initinterfacetype : tinterfacetypes;
  145. { current state values }
  146. aktglobalswitches : tglobalswitches;
  147. aktmoduleswitches : tmoduleswitches;
  148. aktlocalswitches : tlocalswitches;
  149. nextaktlocalswitches : tlocalswitches;
  150. localswitcheschanged : boolean;
  151. aktmodeswitches : tmodeswitches;
  152. {$IFDEF testvarsets}
  153. aktsetalloc,
  154. {$ENDIF}
  155. aktpackenum : longint;
  156. aktmaxfpuregisters: longint;
  157. aktpackrecords : tpackrecords;
  158. aktoutputformat : tasm;
  159. aktoptprocessor,
  160. aktspecificoptprocessor : tprocessors;
  161. aktasmmode : tasmmode;
  162. aktinterfacetype : tinterfacetypes;
  163. { Memory sizes }
  164. heapsize,
  165. maxheapsize,
  166. stacksize : longint;
  167. {$Ifdef EXTDEBUG}
  168. total_of_firstpass,
  169. firstpass_several : longint;
  170. {$ifdef FPC}
  171. EntryMemUsed : longint;
  172. {$endif FPC}
  173. { parameter switches }
  174. debugstop,
  175. only_one_pass : boolean;
  176. {$EndIf EXTDEBUG}
  177. { windows / OS/2 application type }
  178. apptype : tapptype;
  179. const
  180. RelocSection : boolean = true;
  181. RelocSectionSetExplicitly : boolean = false;
  182. LinkTypeSetExplicitly : boolean = false;
  183. IsExe : boolean = false;
  184. DLLsource : boolean = false;
  185. DLLImageBase : pstring = nil;
  186. UseDeffileForExport : boolean = true;
  187. ForceDeffileForExport : boolean = false;
  188. { used to set all registers used for each global function
  189. this should dramatically decrease the number of
  190. recompilations needed PM }
  191. simplify_ppu : boolean = false;
  192. { should we allow non static members ? }
  193. allow_only_static : boolean = false;
  194. Inside_asm_statement : boolean = false;
  195. global_unit_count : word = 0;
  196. { for error info in pp.pas }
  197. parser_current_file : string = '';
  198. procedure abstract;
  199. function bstoslash(const s : string) : string;
  200. function getdatestr:string;
  201. function gettimestr:string;
  202. function filetimestring( t : longint) : string;
  203. procedure DefaultReplacements(var s:string);
  204. function GetCurrentDir:string;
  205. function path_absolute(const s : string) : boolean;
  206. Function PathExists ( F : String) : Boolean;
  207. Function FileExists ( Const F : String) : Boolean;
  208. Function RemoveFile(const f:string):boolean;
  209. Function RemoveDir(d:string):boolean;
  210. Function GetFileTime ( Var F : File) : Longint;
  211. Function GetNamedFileTime ( Const F : String) : Longint;
  212. Function SplitPath(const s:string):string;
  213. Function SplitFileName(const s:string):string;
  214. Function SplitName(const s:string):string;
  215. Function SplitExtension(Const HStr:String):String;
  216. Function AddExtension(Const HStr,ext:String):String;
  217. Function ForceExtension(Const HStr,ext:String):String;
  218. Function FixPath(s:string;allowdot:boolean):string;
  219. function FixFileName(const s:string):string;
  220. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  221. procedure SynchronizeFileTime(const fn1,fn2:string);
  222. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  223. function FindExe(const bin:string;var foundfile:string):boolean;
  224. function GetShortName(const n:string):string;
  225. Procedure Shell(const command:string);
  226. function GetEnvPChar(const envname:string):pchar;
  227. procedure FreeEnvPChar(p:pchar);
  228. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  229. procedure InitGlobals;
  230. procedure DoneGlobals;
  231. function string2guid(const s: string; var GUID: TGUID): boolean;
  232. function guid2string(const GUID: TGUID): string;
  233. implementation
  234. uses
  235. comphook;
  236. procedure abstract;
  237. begin
  238. do_internalerror(255);
  239. end;
  240. function ngraphsearchvalue(const s1,s2 : string) : double;
  241. const
  242. n = 3;
  243. var
  244. equals,i,j : longint;
  245. hs : string;
  246. begin
  247. equals:=0;
  248. { is the string long enough ? }
  249. if min(length(s1),length(s2))-n+1<1 then
  250. begin
  251. ngraphsearchvalue:=0.0;
  252. exit;
  253. end;
  254. for i:=1 to length(s1)-n+1 do
  255. begin
  256. hs:=copy(s1,i,n);
  257. for j:=1 to length(s2)-n+1 do
  258. if hs=copy(s2,j,n) then
  259. inc(equals);
  260. end;
  261. {$ifdef fpc}
  262. ngraphsearchvalue:=equals/double(max(length(s1),length(s2))-n+1);
  263. {$else}
  264. ngraphsearchvalue:=equals/(max(length(s1),length(s2))-n+1);
  265. {$endif}
  266. end;
  267. function bstoslash(const s : string) : string;
  268. {
  269. return string s with all \ changed into /
  270. }
  271. var
  272. i : longint;
  273. begin
  274. for i:=1to length(s) do
  275. if s[i]='\' then
  276. bstoslash[i]:='/'
  277. else
  278. bstoslash[i]:=s[i];
  279. bstoslash[0]:=s[0];
  280. end;
  281. {****************************************************************************
  282. Time Handling
  283. ****************************************************************************}
  284. Function L0(l:longint):string;
  285. {
  286. return the string of value l, if l<10 then insert a zero, so
  287. the string is always at least 2 chars '01','02',etc
  288. }
  289. var
  290. s : string;
  291. begin
  292. Str(l,s);
  293. if l<10 then
  294. s:='0'+s;
  295. L0:=s;
  296. end;
  297. function gettimestr:string;
  298. {
  299. get the current time in a string HH:MM:SS
  300. }
  301. var
  302. hour,min,sec,hsec : word;
  303. begin
  304. {$ifdef delphi}
  305. dmisc.gettime(hour,min,sec,hsec);
  306. {$else delphi}
  307. dos.gettime(hour,min,sec,hsec);
  308. {$endif delphi}
  309. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  310. end;
  311. function getdatestr:string;
  312. {
  313. get the current date in a string YY/MM/DD
  314. }
  315. var
  316. Year,Month,Day,Wday : Word;
  317. begin
  318. {$ifdef delphi}
  319. dmisc.getdate(year,month,day,wday);
  320. {$else}
  321. dos.getdate(year,month,day,wday);
  322. {$endif}
  323. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  324. end;
  325. function filetimestring( t : longint) : string;
  326. {
  327. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  328. }
  329. var
  330. {$ifndef unix}
  331. DT : DateTime;
  332. {$endif}
  333. Year,Month,Day,Hour,Min,Sec : Word;
  334. begin
  335. if t=-1 then
  336. begin
  337. FileTimeString:='Not Found';
  338. exit;
  339. end;
  340. {$ifndef unix}
  341. unpacktime(t,DT);
  342. Year:=dT.year;month:=dt.month;day:=dt.day;
  343. Hour:=dt.hour;min:=dt.min;sec:=dt.sec;
  344. {$else}
  345. EpochToLocal (t,year,month,day,hour,min,sec);
  346. {$endif}
  347. filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  348. end;
  349. {****************************************************************************
  350. Default Macro Handling
  351. ****************************************************************************}
  352. procedure DefaultReplacements(var s:string);
  353. begin
  354. { Replace some macro's }
  355. Replace(s,'$FPCVER',version_string);
  356. Replace(s,'$VERSION',version_string);
  357. Replace(s,'$FULLVERSION',full_version_string);
  358. Replace(s,'$FPCDATE',date_string);
  359. Replace(s,'$FPCTARGET',target_cpu_string);
  360. Replace(s,'$FPCCPU',target_cpu_string);
  361. Replace(s,'$TARGET',target_path);
  362. Replace(s,'$FPCOS',target_path);
  363. end;
  364. {****************************************************************************
  365. File Handling
  366. ****************************************************************************}
  367. function GetCurrentDir:string;
  368. var
  369. CurrentDir : string;
  370. begin
  371. GetDir(0,CurrentDir);
  372. GetCurrentDir:=FixPath(CurrentDir,false);
  373. end;
  374. function path_absolute(const s : string) : boolean;
  375. {
  376. is path s an absolute path?
  377. }
  378. begin
  379. path_absolute:=false;
  380. {$ifdef unix}
  381. if (length(s)>0) and (s[1]='/') then
  382. path_absolute:=true;
  383. {$else unix}
  384. {$ifdef amiga}
  385. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  386. path_absolute:=true;
  387. {$else}
  388. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  389. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  390. path_absolute:=true;
  391. {$endif amiga}
  392. {$endif unix}
  393. end;
  394. {$ifndef FPC}
  395. Procedure FindClose(var Info : SearchRec);
  396. Begin
  397. End;
  398. {$endif not FPC}
  399. Function FileExists ( Const F : String) : Boolean;
  400. {$ifndef delphi}
  401. Var
  402. Info : SearchRec;
  403. {$endif}
  404. begin
  405. {$ifdef delphi}
  406. FileExists:=sysutils.FileExists(f);
  407. {$else}
  408. findfirst(F,readonly+archive+hidden,info);
  409. FileExists:=(doserror=0);
  410. findclose(Info);
  411. {$endif delphi}
  412. end;
  413. Function PathExists ( F : String) : Boolean;
  414. Var
  415. Info : SearchRec;
  416. begin
  417. if F[Length(f)] in ['/','\'] then
  418. Delete(f,length(f),1);
  419. findfirst(F,readonly+archive+hidden+directory,info);
  420. PathExists:=(doserror=0) and ((info.attr and directory)=directory);
  421. findclose(Info);
  422. end;
  423. Function RemoveFile(const f:string):boolean;
  424. var
  425. g : file;
  426. begin
  427. assign(g,f);
  428. {$I-}
  429. erase(g);
  430. {$I+}
  431. RemoveFile:=(ioresult=0);
  432. end;
  433. Function RemoveDir(d:string):boolean;
  434. begin
  435. if d[length(d)]=DirSep then
  436. Delete(d,length(d),1);
  437. {$I-}
  438. rmdir(d);
  439. {$I+}
  440. RemoveDir:=(ioresult=0);
  441. end;
  442. Function SplitPath(const s:string):string;
  443. var
  444. i : longint;
  445. begin
  446. i:=Length(s);
  447. while (i>0) and not(s[i] in ['/','\']) do
  448. dec(i);
  449. SplitPath:=Copy(s,1,i);
  450. end;
  451. Function SplitFileName(const s:string):string;
  452. var
  453. p : dirstr;
  454. n : namestr;
  455. e : extstr;
  456. begin
  457. FSplit(s,p,n,e);
  458. SplitFileName:=n+e;
  459. end;
  460. Function SplitName(const s:string):string;
  461. var
  462. i,j : longint;
  463. begin
  464. i:=Length(s);
  465. j:=Length(s);
  466. while (i>0) and not(s[i] in ['/','\']) do
  467. dec(i);
  468. while (j>0) and (s[j]<>'.') do
  469. dec(j);
  470. if j<=i then
  471. j:=255;
  472. SplitName:=Copy(s,i+1,j-(i+1));
  473. end;
  474. Function SplitExtension(Const HStr:String):String;
  475. var
  476. j : longint;
  477. begin
  478. j:=length(Hstr);
  479. while (j>0) and (Hstr[j]<>'.') do
  480. begin
  481. if hstr[j]=DirSep then
  482. j:=0
  483. else
  484. dec(j);
  485. end;
  486. if j=0 then
  487. j:=254;
  488. SplitExtension:=Copy(Hstr,j,255);
  489. end;
  490. Function AddExtension(Const HStr,ext:String):String;
  491. begin
  492. if (Ext<>'') and (SplitExtension(HStr)='') then
  493. AddExtension:=Hstr+Ext
  494. else
  495. AddExtension:=Hstr;
  496. end;
  497. Function ForceExtension(Const HStr,ext:String):String;
  498. var
  499. j : longint;
  500. begin
  501. j:=length(Hstr);
  502. while (j>0) and (Hstr[j]<>'.') do
  503. dec(j);
  504. if j=0 then
  505. j:=255;
  506. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  507. end;
  508. Function FixPath(s:string;allowdot:boolean):string;
  509. var
  510. i : longint;
  511. begin
  512. { Fix separator }
  513. for i:=1 to length(s) do
  514. if s[i] in ['/','\'] then
  515. s[i]:=DirSep;
  516. { Fix ending / }
  517. if (length(s)>0) and (s[length(s)]<>DirSep) and
  518. (s[length(s)]<>':') then
  519. s:=s+DirSep;
  520. { Remove ./ }
  521. if (not allowdot) and (s='.'+DirSep) then
  522. s:='';
  523. { return }
  524. {$ifdef unix}
  525. FixPath:=s;
  526. {$else}
  527. FixPath:=Lower(s);
  528. {$endif}
  529. end;
  530. function FixFileName(const s:string):string;
  531. var
  532. i : longint;
  533. begin
  534. for i:=length(s) downto 1 do
  535. begin
  536. case s[i] of
  537. {$ifdef Unix}
  538. '/','\' :
  539. FixFileName[i]:='/';
  540. {$else Unix}
  541. '/' :
  542. FixFileName[i]:='\';
  543. 'A'..'Z' :
  544. FixFileName[i]:=char(byte(s[i])+32);
  545. {$endif Unix}
  546. else
  547. FixFileName[i]:=s[i];
  548. end;
  549. end;
  550. FixFileName[0]:=s[0];
  551. end;
  552. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  553. var
  554. i : longint;
  555. begin
  556. i:=pos(' ',s);
  557. if i>0 then
  558. begin
  559. bstr:=Copy(s,1,i-1);
  560. cstr:=Copy(s,i+1,length(s)-i);
  561. end
  562. else
  563. begin
  564. bstr:='';
  565. cstr:='';
  566. end;
  567. end;
  568. procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
  569. var
  570. j : longint;
  571. hs,hsd,
  572. CurrentDir,
  573. CurrPath : string;
  574. dir : searchrec;
  575. hp : TStringListItem;
  576. procedure addcurrpath;
  577. begin
  578. if addfirst then
  579. begin
  580. Remove(currPath);
  581. Insert(currPath);
  582. end
  583. else
  584. begin
  585. { Check if already in path, then we don't add it }
  586. hp:=Find(currPath);
  587. if not assigned(hp) then
  588. Concat(currPath);
  589. end;
  590. end;
  591. begin
  592. if s='' then
  593. exit;
  594. { Support default macro's }
  595. DefaultReplacements(s);
  596. { get current dir }
  597. CurrentDir:=GetCurrentDir;
  598. repeat
  599. { get currpath }
  600. if addfirst then
  601. begin
  602. j:=length(s);
  603. while (j>0) and (s[j]<>';') do
  604. dec(j);
  605. CurrPath:=FixPath(Copy(s,j+1,length(s)-j),false);
  606. if j=0 then
  607. s:=''
  608. else
  609. System.Delete(s,j,length(s)-j+1);
  610. end
  611. else
  612. begin
  613. j:=Pos(';',s);
  614. if j=0 then
  615. j:=255;
  616. CurrPath:=FixPath(Copy(s,1,j-1),false);
  617. System.Delete(s,1,j);
  618. end;
  619. { fix pathname }
  620. if CurrPath='' then
  621. CurrPath:='.'+DirSep
  622. else
  623. begin
  624. CurrPath:=FixPath(FExpand(CurrPath),false);
  625. if (CurrentDir<>'') and (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
  626. CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
  627. end;
  628. { wildcard adding ? }
  629. if pos('*',currpath)>0 then
  630. begin
  631. if currpath[length(currpath)]=dirsep then
  632. hs:=Copy(currpath,1,length(CurrPath)-1)
  633. else
  634. hs:=currpath;
  635. hsd:=SplitPath(hs);
  636. findfirst(hs,directory,dir);
  637. while doserror=0 do
  638. begin
  639. if (dir.name<>'.') and
  640. (dir.name<>'..') and
  641. ((dir.attr and directory)<>0) then
  642. begin
  643. currpath:=hsd+dir.name+dirsep;
  644. hp:=Find(currPath);
  645. if not assigned(hp) then
  646. AddCurrPath;
  647. end;
  648. findnext(dir);
  649. end;
  650. FindClose(dir);
  651. end
  652. else
  653. begin
  654. if PathExists(currpath) then
  655. addcurrpath;
  656. end;
  657. until (s='');
  658. end;
  659. procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
  660. var
  661. s : string;
  662. hl : TSearchPathList;
  663. hp,hp2 : TStringListItem;
  664. begin
  665. if list.empty then
  666. exit;
  667. { create temp and reverse the list }
  668. if addfirst then
  669. begin
  670. hl:=TSearchPathList.Create;
  671. hp:=TStringListItem(list.first);
  672. while assigned(hp) do
  673. begin
  674. hl.insert(hp.Str);
  675. hp:=TStringListItem(hp.next);
  676. end;
  677. while not hl.empty do
  678. begin
  679. s:=hl.GetFirst;
  680. Remove(s);
  681. Insert(s);
  682. end;
  683. hl.Free;
  684. end
  685. else
  686. begin
  687. hp:=TStringListItem(list.first);
  688. while assigned(hp) do
  689. begin
  690. hp2:=Find(hp.Str);
  691. { Check if already in path, then we don't add it }
  692. if not assigned(hp2) then
  693. Concat(hp.Str);
  694. hp:=TStringListItem(hp.next);
  695. end;
  696. end;
  697. end;
  698. function TSearchPathList.FindFile(const f : string;var foundfile:string):boolean;
  699. Var
  700. p : TStringListItem;
  701. begin
  702. FindFile:=false;
  703. p:=TStringListItem(first);
  704. while assigned(p) do
  705. begin
  706. {
  707. Search order for case sensitive systems:
  708. 1. lowercase
  709. 2. NormalCase
  710. 3. UPPERCASE
  711. None case sensitive only lowercase
  712. }
  713. FoundFile:=p.Str+Lower(f);
  714. If FileExists(FoundFile) then
  715. begin
  716. FindFile:=true;
  717. exit;
  718. end;
  719. {$ifdef UNIX}
  720. FoundFile:=p.Str+f;
  721. If FileExists(FoundFile) then
  722. begin
  723. FindFile:=true;
  724. exit;
  725. end;
  726. FoundFile:=p.Str+Upper(f);
  727. If FileExists(FoundFile) then
  728. begin
  729. FindFile:=true;
  730. exit;
  731. end;
  732. {$endif UNIX}
  733. p:=TStringListItem(p.next);
  734. end;
  735. { Return original filename if not found }
  736. FoundFile:=f;
  737. end;
  738. Function GetFileTime ( Var F : File) : Longint;
  739. Var
  740. {$ifdef unix}
  741. Info : Stat;
  742. {$endif}
  743. L : longint;
  744. begin
  745. {$ifdef unix}
  746. FStat (F,Info);
  747. L:=Info.Mtime;
  748. {$else}
  749. GetFTime(f,l);
  750. {$endif}
  751. GetFileTime:=L;
  752. end;
  753. Function GetNamedFileTime (Const F : String) : Longint;
  754. begin
  755. GetNamedFileTime:=do_getnamedfiletime(F);
  756. end;
  757. {Touch Assembler and object time to ppu time is there is a ppufilename}
  758. procedure SynchronizeFileTime(const fn1,fn2:string);
  759. var
  760. f : file;
  761. l : longint;
  762. begin
  763. Assign(f,fn1);
  764. {$I-}
  765. reset(f,1);
  766. {$I+}
  767. if ioresult=0 then
  768. begin
  769. getftime(f,l);
  770. { just to be sure in case there are rounding errors }
  771. setftime(f,l);
  772. close(f);
  773. assign(f,fn2);
  774. {$I-}
  775. reset(f,1);
  776. {$I+}
  777. if ioresult=0 then
  778. begin
  779. setftime(f,l);
  780. close(f);
  781. end;
  782. end;
  783. end;
  784. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  785. Var
  786. singlepathstring : string;
  787. i : longint;
  788. begin
  789. {$ifdef Unix}
  790. for i:=1 to length(path) do
  791. if path[i]=':' then
  792. path[i]:=';';
  793. {$endif Unix}
  794. FindFile:=false;
  795. repeat
  796. i:=pos(';',path);
  797. if i=0 then
  798. i:=256;
  799. singlepathstring:=FixPath(copy(path,1,i-1),false);
  800. delete(path,1,i);
  801. {
  802. Search order for case sensitive systems:
  803. 1. lowercase
  804. 2. NormalCase
  805. 3. UPPERCASE
  806. None case sensitive only lowercase
  807. }
  808. FoundFile:=singlepathstring+Lower(f);
  809. If FileExists(FoundFile) then
  810. begin
  811. FindFile:=true;
  812. exit;
  813. end;
  814. {$ifdef UNIX}
  815. FoundFile:=singlepathstring+f;
  816. If FileExists(FoundFile) then
  817. begin
  818. FindFile:=true;
  819. exit;
  820. end;
  821. FoundFile:=singlepathstring+Upper(f);
  822. If FileExists(FoundFile) then
  823. begin
  824. FindFile:=true;
  825. exit;
  826. end;
  827. {$endif UNIX}
  828. until path='';
  829. FoundFile:=f;
  830. end;
  831. function FindExe(const bin:string;var foundfile:string):boolean;
  832. begin
  833. {$ifdef delphi}
  834. FindExe:=FindFile(FixFileName(AddExtension(bin,source_os.exeext)),'.;'+exepath+';'+dmisc.getenv('PATH'),foundfile);
  835. {$else delphi}
  836. FindExe:=FindFile(FixFileName(AddExtension(bin,source_os.exeext)),'.;'+exepath+';'+dos.getenv('PATH'),foundfile);
  837. {$endif delphi}
  838. end;
  839. function GetShortName(const n:string):string;
  840. {$ifdef win32}
  841. var
  842. hs,hs2 : string;
  843. i : longint;
  844. {$endif}
  845. {$ifdef go32v2}
  846. var
  847. hs : string;
  848. {$endif}
  849. begin
  850. GetShortName:=n;
  851. {$ifdef win32}
  852. hs:=n+#0;
  853. i:=Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
  854. if (i>0) and (i<=high(hs2)) then
  855. begin
  856. hs2[0]:=chr(strlen(@hs2[1]));
  857. GetShortName:=hs2;
  858. end;
  859. {$endif}
  860. {$ifdef go32v2}
  861. hs:=n;
  862. if Dos.GetShortName(hs) then
  863. GetShortName:=hs;
  864. {$endif}
  865. end;
  866. {****************************************************************************
  867. OS Dependent things
  868. ****************************************************************************}
  869. function GetEnvPChar(const envname:string):pchar;
  870. {$ifdef win32}
  871. var
  872. s : string;
  873. i,len : longint;
  874. hp,p,p2 : pchar;
  875. {$endif}
  876. {$ifdef os2}
  877. var
  878. P1, P2: PChar;
  879. {$endif}
  880. begin
  881. {$ifdef unix}
  882. GetEnvPchar:={$ifdef ver1_0}Linux{$else}Unix{$endif}.Getenv(envname);
  883. {$define GETENVOK}
  884. {$endif}
  885. {$ifdef win32}
  886. GetEnvPchar:=nil;
  887. p:=GetEnvironmentStrings;
  888. hp:=p;
  889. while hp^<>#0 do
  890. begin
  891. s:=strpas(hp);
  892. i:=pos('=',s);
  893. len:=strlen(hp);
  894. if upper(copy(s,1,i-1))=upper(envname) then
  895. begin
  896. GetMem(p2,len-length(envname));
  897. Move(hp[i],p2^,len-length(envname));
  898. GetEnvPchar:=p2;
  899. break;
  900. end;
  901. { next string entry}
  902. hp:=hp+len+1;
  903. end;
  904. FreeEnvironmentStrings(p);
  905. {$define GETENVOK}
  906. {$endif}
  907. {$ifdef os2}
  908. P1 := StrPNew (EnvName);
  909. if Assigned (P1) then
  910. begin
  911. if DosCalls.DosScanEnv (P1, P2) = 0 then
  912. GetEnvPChar := P2
  913. else
  914. GetEnvPChar := nil;
  915. StrDispose (P1);
  916. end else GetEnvPChar := nil;
  917. {$define GETENVOK}
  918. {$endif}
  919. {$ifdef GETENVOK}
  920. {$undef GETENVOK}
  921. {$else}
  922. GetEnvPchar:=StrPNew(Dos.Getenv(envname));
  923. {$endif}
  924. end;
  925. procedure FreeEnvPChar(p:pchar);
  926. begin
  927. {$ifndef unix}
  928. {$ifndef os2}
  929. StrDispose(p);
  930. {$endif}
  931. {$endif}
  932. end;
  933. Procedure Shell(const command:string);
  934. { This is already defined in the linux.ppu for linux, need for the *
  935. expansion under linux }
  936. {$ifdef unix}
  937. begin
  938. {$ifdef ver1_0}Linux{$else}Unix{$endif}.Shell(command);
  939. end;
  940. {$else}
  941. var
  942. comspec : string;
  943. begin
  944. comspec:=getenv('COMSPEC');
  945. Exec(comspec,' /C '+command);
  946. end;
  947. {$endif}
  948. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  949. var
  950. b : boolean;
  951. begin
  952. b:=true;
  953. if s='DEFAULT' then
  954. aktmodeswitches:=initmodeswitches
  955. else
  956. if s='DELPHI' then
  957. aktmodeswitches:=delphimodeswitches
  958. else
  959. if s='TP' then
  960. aktmodeswitches:=tpmodeswitches
  961. else
  962. if s='FPC' then
  963. aktmodeswitches:=fpcmodeswitches
  964. else
  965. if s='OBJFPC' then
  966. aktmodeswitches:=objfpcmodeswitches
  967. else
  968. if s='GPC' then
  969. aktmodeswitches:=gpcmodeswitches
  970. else
  971. b:=false;
  972. if b and changeInit then
  973. initmodeswitches := aktmodeswitches;
  974. if b then
  975. begin
  976. { turn ansistrings on by default ? }
  977. if (m_delphi in aktmodeswitches) then
  978. begin
  979. include(aktlocalswitches,cs_ansistrings);
  980. if changeinit then
  981. include(initlocalswitches,cs_ansistrings);
  982. end
  983. else
  984. begin
  985. exclude(aktlocalswitches,cs_ansistrings);
  986. if changeinit then
  987. exclude(initlocalswitches,cs_ansistrings);
  988. end;
  989. { enum packing }
  990. if (m_tp7 in aktmodeswitches) then
  991. aktpackenum:=1
  992. else
  993. aktpackenum:=4;
  994. if changeinit then
  995. initpackenum:=aktpackenum;
  996. end;
  997. SetCompileMode:=b;
  998. end;
  999. { '('D1:'00000000-'D2:'0000-'D3:'0000-'D4:'0000-000000000000)' }
  1000. function string2guid(const s: string; var GUID: TGUID): boolean;
  1001. function ishexstr(const hs: string): boolean;
  1002. var
  1003. i: integer;
  1004. begin
  1005. ishexstr:=false;
  1006. for i:=1 to Length(hs) do begin
  1007. if not (hs[i] in ['0'..'9','A'..'F','a'..'f']) then
  1008. exit;
  1009. end;
  1010. ishexstr:=true;
  1011. end;
  1012. function hexstr2longint(const hexs: string): longint;
  1013. var
  1014. i: integer;
  1015. rl: longint;
  1016. begin
  1017. rl:=0;
  1018. for i:=1 to length(hexs) do begin
  1019. rl:=rl shl 4;
  1020. case hexs[i] of
  1021. '0'..'9' : inc(rl,ord(hexs[i])-ord('0'));
  1022. 'A'..'F' : inc(rl,ord(hexs[i])-ord('A')+10);
  1023. 'a'..'f' : inc(rl,ord(hexs[i])-ord('a')+10);
  1024. end
  1025. end;
  1026. hexstr2longint:=rl;
  1027. end;
  1028. var
  1029. i: integer;
  1030. begin
  1031. if (Length(s)=38) and (s[1]='{') and (s[38]='}') and
  1032. (s[10]='-') and (s[15]='-') and (s[20]='-') and (s[25]='-') and
  1033. ishexstr(copy(s,2,8)) and ishexstr(copy(s,11,4)) and
  1034. ishexstr(copy(s,16,4)) and ishexstr(copy(s,21,4)) and
  1035. ishexstr(copy(s,26,12)) then begin
  1036. GUID.D1:=dword(hexstr2longint(copy(s,2,8)));
  1037. GUID.D2:=hexstr2longint(copy(s,11,4));
  1038. GUID.D3:=hexstr2longint(copy(s,16,4));
  1039. for i:=0 to 1 do
  1040. GUID.D4[i]:=hexstr2longint(copy(s,21+i*2,2));
  1041. for i:=2 to 7 do
  1042. GUID.D4[i]:=hexstr2longint(copy(s,22+i*2,2));
  1043. string2guid:=true;
  1044. end
  1045. else
  1046. string2guid:=false;
  1047. end;
  1048. function guid2string(const GUID: TGUID): string;
  1049. function long2hex(l, len: longint): string;
  1050. const
  1051. hextbl: array[0..15] of char = '0123456789ABCDEF';
  1052. var
  1053. rs: string;
  1054. i: integer;
  1055. begin
  1056. rs[0]:=chr(len);
  1057. for i:=len downto 1 do begin
  1058. rs[i]:=hextbl[l and $F];
  1059. l:=l shr 4;
  1060. end;
  1061. long2hex:=rs;
  1062. end;
  1063. begin
  1064. guid2string:=
  1065. '{'+long2hex(GUID.D1,8)+
  1066. '-'+long2hex(GUID.D2,4)+
  1067. '-'+long2hex(GUID.D3,4)+
  1068. '-'+long2hex(GUID.D4[0],2)+long2hex(GUID.D4[1],2)+
  1069. '-'+long2hex(GUID.D4[2],2)+long2hex(GUID.D4[3],2)+
  1070. long2hex(GUID.D4[4],2)+long2hex(GUID.D4[5],2)+
  1071. long2hex(GUID.D4[6],2)+long2hex(GUID.D4[7],2)+
  1072. '}';
  1073. end;
  1074. {****************************************************************************
  1075. Init
  1076. ****************************************************************************}
  1077. {$ifdef unix}
  1078. {$define need_path_search}
  1079. {$endif unix}
  1080. {$ifdef os2}
  1081. {$define need_path_search}
  1082. {$endif os2}
  1083. procedure get_exepath;
  1084. var
  1085. hs1 : namestr;
  1086. hs2 : extstr;
  1087. begin
  1088. {$ifdef delphi}
  1089. exepath:=dmisc.getenv('PPC_EXEC_PATH');
  1090. {$else delphi}
  1091. exepath:=dos.getenv('PPC_EXEC_PATH');
  1092. {$endif delphi}
  1093. if exepath='' then
  1094. fsplit(FixFileName(system.paramstr(0)),exepath,hs1,hs2);
  1095. {$ifdef need_path_search}
  1096. if exepath='' then
  1097. begin
  1098. if pos(source_os.exeext,hs1) <>
  1099. (length(hs1) - length(source_os.exeext)+1) then
  1100. hs1 := hs1 + source_os.exeext;
  1101. {$ifdef delphi}
  1102. findfile(hs1,dmisc.getenv('PATH'),exepath);
  1103. {$else delphi}
  1104. findfile(hs1,dos.getenv('PATH'),exepath);
  1105. {$endif delphi}
  1106. exepath:=SplitPath(exepath);
  1107. end;
  1108. {$endif need_path_search}
  1109. exepath:=FixPath(exepath,false);
  1110. end;
  1111. procedure DoneGlobals;
  1112. begin
  1113. initdefines.free;
  1114. if assigned(DLLImageBase) then
  1115. StringDispose(DLLImageBase);
  1116. RelocSection:=true;
  1117. RelocSectionSetExplicitly:=false;
  1118. UseDeffileForExport:=true;
  1119. librarysearchpath.Free;
  1120. unitsearchpath.Free;
  1121. objectsearchpath.Free;
  1122. includesearchpath.Free;
  1123. end;
  1124. procedure InitGlobals;
  1125. begin
  1126. { set global switches }
  1127. do_build:=false;
  1128. do_make:=true;
  1129. compile_level:=0;
  1130. { these two should not be cleared in
  1131. DoneGlobals as the IDE might need their value }
  1132. IsExe:=false;
  1133. DLLsource:=false;
  1134. { Output }
  1135. OutputFile:='';
  1136. OutputExeDir:='';
  1137. OutputUnitDir:='';
  1138. { Utils directory }
  1139. utilsdirectory:='';
  1140. { Search Paths }
  1141. librarysearchpath:=TSearchPathList.Create;
  1142. unitsearchpath:=TSearchPathList.Create;
  1143. includesearchpath:=TSearchPathList.Create;
  1144. objectsearchpath:=TSearchPathList.Create;
  1145. { Def file }
  1146. usewindowapi:=false;
  1147. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1148. dllversion:='';
  1149. { Init values }
  1150. initmodeswitches:=fpcmodeswitches;
  1151. initlocalswitches:=[cs_check_io];
  1152. initmoduleswitches:=[cs_extsyntax,cs_browser];
  1153. initglobalswitches:=[cs_check_unit_name,cs_link_static];
  1154. {$ifdef i386}
  1155. initoptprocessor:=Class386;
  1156. initspecificoptprocessor:=Class386;
  1157. initpackenum:=4;
  1158. {$IFDEF testvarsets}
  1159. initsetalloc:=0;
  1160. {$ENDIF}
  1161. initpackrecords:=packrecord_2;
  1162. initoutputformat:=target_asm.id;
  1163. initasmmode:=asmmode_i386_att;
  1164. {$else not i386}
  1165. {$ifdef m68k}
  1166. initoptprocessor:=MC68000;
  1167. include(initmoduleswitches,cs_fp_emulation);
  1168. initpackenum:=4;
  1169. {$IFDEF testvarsets}
  1170. initsetalloc:=0;
  1171. {$ENDIF}
  1172. initpackrecords:=packrecord_2;
  1173. initoutputformat:=as_m68k_as;
  1174. initasmmode:=asmmode_m68k_mot;
  1175. {$endif m68k}
  1176. {$endif i386}
  1177. initinterfacetype:=it_interfacecom;
  1178. initdefines:=TStringList.Create;
  1179. { memory sizes, will be overriden by parameter or default for target
  1180. in options or init_parser }
  1181. stacksize:=0;
  1182. heapsize:=0;
  1183. maxheapsize:=0;
  1184. { compile state }
  1185. in_args:=false;
  1186. { must_be_valid:=true; obsolete PM }
  1187. not_unit_proc:=true;
  1188. apptype:=app_cui;
  1189. end;
  1190. begin
  1191. get_exepath;
  1192. {$ifdef EXTDEBUG}
  1193. {$ifdef FPC}
  1194. EntryMemUsed:=system.HeapSize-MemAvail;
  1195. {$endif FPC}
  1196. {$endif}
  1197. end.
  1198. {
  1199. $Log$
  1200. Revision 1.29 2001-04-04 21:30:42 florian
  1201. * applied several fixes to get the DD8 Delphi Unit compiled
  1202. e.g. "forward"-interfaces are working now
  1203. Revision 1.28 2001/02/20 21:41:16 peter
  1204. * new fixfilename, findfile for unix. Look first for lowercase, then
  1205. NormalCase and last for UPPERCASE names.
  1206. Revision 1.27 2001/02/09 23:05:45 peter
  1207. * default packenum=1 for tp7 mode
  1208. Revision 1.26 2001/02/05 20:47:00 peter
  1209. * support linux unit for ver1_0 compilers
  1210. Revision 1.25 2001/01/21 20:32:45 marco
  1211. * Renamefest. Compiler part. Not that hard.
  1212. Revision 1.24 2001/01/20 18:32:52 hajny
  1213. + APPTYPE support under OS/2, app_fs, GetEnvPChar for OS/2
  1214. Revision 1.23 2001/01/13 00:03:41 peter
  1215. * fixed findexe to also support already extension in name
  1216. Revision 1.22 2000/12/26 15:57:25 peter
  1217. * use system.paramstr()
  1218. Revision 1.21 2000/12/25 00:07:26 peter
  1219. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1220. tlinkedlist objects)
  1221. Revision 1.20 2000/11/13 15:26:12 marco
  1222. * Renamefest
  1223. Revision 1.19 2000/11/12 22:20:37 peter
  1224. * create generic toutputsection for binary writers
  1225. Revision 1.18 2000/11/04 14:25:19 florian
  1226. + merged Attila's changes for interfaces, not tested yet
  1227. Revision 1.17 2000/10/31 22:02:46 peter
  1228. * symtable splitted, no real code changes
  1229. Revision 1.16 2000/10/04 14:51:08 pierre
  1230. * IsExe restored
  1231. Revision 1.15 2000/09/27 21:20:56 peter
  1232. * also set initlocalswitches in setcompilemode (merged)
  1233. Revision 1.14 2000/09/26 10:50:41 jonas
  1234. * initmodeswitches is changed is you change the compiler mode from the
  1235. command line (the -S<x> switches didn't work anymore for changing the
  1236. compiler mode) (merged from fixes branch)
  1237. Revision 1.13 2000/09/24 21:33:46 peter
  1238. * message updates merges
  1239. Revision 1.12 2000/09/24 21:19:50 peter
  1240. * delphi compile fixes
  1241. Revision 1.11 2000/09/24 15:12:40 peter
  1242. * fixed typo
  1243. Revision 1.10 2000/09/24 15:06:16 peter
  1244. * use defines.inc
  1245. Revision 1.9 2000/09/24 10:33:07 peter
  1246. * searching of exe in path also for OS/2
  1247. * fixed searching of exe in path.
  1248. Revision 1.8 2000/09/11 17:00:22 florian
  1249. + first implementation of Netware Module support, thanks to
  1250. Armin Diehl ([email protected]) for providing the patches
  1251. Revision 1.7 2000/08/27 16:11:51 peter
  1252. * moved some util functions from globals,cobjects to cutils
  1253. * splitted files into finput,fmodule
  1254. Revision 1.6 2000/08/12 19:14:58 peter
  1255. * ELF writer works now also with -g
  1256. * ELF writer is default again for linux
  1257. Revision 1.5 2000/08/12 15:30:44 peter
  1258. * IDE patch for stream reading (merged)
  1259. Revision 1.4 2000/08/02 19:49:59 peter
  1260. * first things for default parameters
  1261. Revision 1.3 2000/07/13 12:08:25 michael
  1262. + patched to 1.1.0 with former 1.09patch from peter
  1263. Revision 1.2 2000/07/13 11:32:41 michael
  1264. + removed logs
  1265. }