globals.pas 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556
  1. {
  2. $Id$
  3. Copyright (C) 1993-98 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. {$ifdef tp}
  19. {$E+,N+}
  20. {$endif}
  21. unit globals;
  22. interface
  23. uses
  24. {$ifdef win32}
  25. windows,
  26. {$endif}
  27. {$ifdef linux}
  28. linux,
  29. {$endif}
  30. {$ifdef Delphi4}
  31. dmisc,
  32. sysutils,
  33. {$else}
  34. strings,dos,
  35. {$endif}
  36. {$ifdef TP}
  37. objects,
  38. {$endif}
  39. globtype,version,tokens,systems,cobjects;
  40. const
  41. {$ifdef linux}
  42. DirSep = '/';
  43. {$else}
  44. {$ifdef amiga}
  45. DirSep = '/';
  46. {$else}
  47. DirSep = '\';
  48. {$endif}
  49. {$endif}
  50. {$ifdef Splitheap}
  51. testsplit : boolean = false;
  52. {$endif Splitheap}
  53. delphimodeswitches : tmodeswitches=
  54. [m_delphi,m_tp,m_all,m_class,m_objpas,m_result,m_string_pchar,
  55. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal];
  56. fpcmodeswitches : tmodeswitches=
  57. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  58. m_cvar_support,m_initfinal,m_add_pointer];
  59. objfpcmodeswitches : tmodeswitches=
  60. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  61. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer];
  62. tpmodeswitches : tmodeswitches=
  63. [m_tp,m_all,m_tp_procvar];
  64. gpcmodeswitches : tmodeswitches=
  65. [m_gpc,m_all];
  66. type
  67. TSearchPathList = object(TStringQueue)
  68. procedure AddPath(s:string;addfirst:boolean);
  69. procedure AddList(list:TSearchPathList;addfirst:boolean);
  70. function FindFile(const f : string;var b : boolean) : string;
  71. end;
  72. var
  73. { specified inputfile }
  74. inputdir : dirstr;
  75. inputfile : namestr;
  76. inputextension : extstr;
  77. { specified outputfile with -o parameter }
  78. outputfile : namestr;
  79. { specified with -FE or -FU }
  80. outputexedir : dirstr;
  81. outputunitdir : dirstr;
  82. { things specified with parameters }
  83. paralinkoptions,
  84. paradynamiclinker : string;
  85. parapreprocess : boolean;
  86. { directory where the utils can be found (options -FD) }
  87. utilsdirectory : dirstr;
  88. { some flags for global compiler switches }
  89. do_build,
  90. do_make : boolean;
  91. not_unit_proc : boolean;
  92. { path for searching units, different paths can be seperated by ; }
  93. exepath : dirstr; { Path to ppc }
  94. librarysearchpath,
  95. unitsearchpath,
  96. objectsearchpath,
  97. includesearchpath : TSearchPathList;
  98. { deffile }
  99. usewindowapi : boolean;
  100. description : string;
  101. dllversion : string;
  102. dllmajor,dllminor : word;
  103. { current position }
  104. token, { current token being parsed }
  105. idtoken : ttoken; { holds the token if the pattern is a known word }
  106. tokenpos, { last postion of the read token }
  107. aktfilepos : tfileposinfo; { current position }
  108. { type of currently parsed block }
  109. { isn't full implemented (FK) }
  110. block_type : tblock_type;
  111. in_args : boolean; { arguments must be checked especially }
  112. parsing_para_level : longint; { parameter level, used to convert
  113. proc calls to proc loads in firstcalln }
  114. { Must_be_valid : boolean; should the variable already have a value
  115. obsolete replace by set_varstate function }
  116. compile_level : word;
  117. make_ref : boolean;
  118. resolving_forward : boolean; { used to add forward reference as second ref }
  119. use_esp_stackframe : boolean; { to test for call with ESP as stack frame }
  120. {$ifdef TP}
  121. use_big : boolean;
  122. {$endif}
  123. { commandline values }
  124. initdefines : tlinkedlist;
  125. initglobalswitches : tglobalswitches;
  126. initmoduleswitches : tmoduleswitches;
  127. initlocalswitches : tlocalswitches;
  128. initmodeswitches : tmodeswitches;
  129. initpackenum : longint;
  130. initpackrecords : tpackrecords;
  131. initoutputformat : tasm;
  132. initoptprocessor : tprocessors;
  133. initasmmode : tasmmode;
  134. { current state values }
  135. aktglobalswitches : tglobalswitches;
  136. aktmoduleswitches : tmoduleswitches;
  137. aktlocalswitches : tlocalswitches;
  138. aktmodeswitches : tmodeswitches;
  139. aktpackenum : longint;
  140. aktpackrecords : tpackrecords;
  141. aktoutputformat : tasm;
  142. aktoptprocessor : tprocessors;
  143. aktasmmode : tasmmode;
  144. { Memory sizes }
  145. heapsize,
  146. maxheapsize,
  147. stacksize : longint;
  148. {$Ifdef EXTDEBUG}
  149. total_of_firstpass,
  150. firstpass_several : longint;
  151. {$ifdef FPC}
  152. EntryMemUsed : longint;
  153. {$endif FPC}
  154. { parameter switches }
  155. debugstop,
  156. only_one_pass : boolean;
  157. {$EndIf EXTDEBUG}
  158. { windows application type }
  159. apptype : tapptype;
  160. const
  161. RelocSection : boolean = true;
  162. RelocSectionSetExplicitly : boolean = false;
  163. DLLsource : boolean = false;
  164. DLLImageBase : pstring = nil;
  165. UseDeffileForExport : boolean = true;
  166. ForceDeffileForExport : boolean = false;
  167. { used to set all registers used for each global function
  168. this should dramatically decrease the number of
  169. recompilations needed PM }
  170. simplify_ppu : boolean = false;
  171. { should we allow non static members ? }
  172. allow_only_static : boolean = false;
  173. Inside_asm_statement : boolean = false;
  174. { for error info in pp.pas }
  175. const
  176. parser_current_file : string = '';
  177. {$ifdef debug}
  178. { if the pointer don't point to the heap then write an error }
  179. function assigned(p : pointer) : boolean;
  180. {$endif}
  181. function min(a,b : longint) : longint;
  182. function max(a,b : longint) : longint;
  183. function align(i,a:longint):longint;
  184. procedure Replace(var s:string;s1:string;const s2:string);
  185. procedure ReplaceCase(var s:string;const s1,s2:string);
  186. function upper(const s : string) : string;
  187. function lower(const s : string) : string;
  188. function trimspace(const s:string):string;
  189. {$ifdef FPC}
  190. function tostru(i:cardinal) : string;
  191. {$else}
  192. function tostru(i:longint) : string;
  193. {$endif}
  194. procedure uppervar(var s : string);
  195. function tostr(i : longint) : string;
  196. function tostr_with_plus(i : longint) : string;
  197. procedure valint(S : string;var V : longint;var code : integer);
  198. function is_number(const s : string) : boolean;
  199. function ispowerof2(value : longint;var power : longint) : boolean;
  200. { enable ansistring comparison }
  201. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  202. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  203. function bstoslash(const s : string) : string;
  204. procedure abstract;
  205. function getdatestr:string;
  206. function gettimestr:string;
  207. function filetimestring( t : longint) : string;
  208. procedure DefaultReplacements(var s:string);
  209. function path_absolute(const s : string) : boolean;
  210. Function FileExists ( Const F : String) : Boolean;
  211. Function RemoveFile(const f:string):boolean;
  212. Function RemoveDir(d:string):boolean;
  213. Function GetFileTime ( Var F : File) : Longint;
  214. Function GetNamedFileTime ( Const F : String) : Longint;
  215. Function SplitFileName(const s:string):string;
  216. Function SplitName(const s:string):string;
  217. Function SplitExtension(Const HStr:String):String;
  218. Function AddExtension(Const HStr,ext:String):String;
  219. Function ForceExtension(Const HStr,ext:String):String;
  220. Function FixPath(s:string;allowdot:boolean):string;
  221. function FixFileName(const s:string):string;
  222. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  223. procedure SynchronizeFileTime(const fn1,fn2:string);
  224. function FindFile(const f : string;path : string;var b : boolean) : string;
  225. function FindExe(bin:string;var found:boolean):string;
  226. function GetShortName(const n:string):string;
  227. Procedure Shell(const command:string);
  228. function GetEnvPChar(const envname:string):pchar;
  229. procedure FreeEnvPChar(p:pchar);
  230. procedure InitGlobals;
  231. procedure DoneGlobals;
  232. implementation
  233. uses
  234. comphook;
  235. procedure abstract;
  236. begin
  237. do_internalerror(255);
  238. end;
  239. function ngraphsearchvalue(const s1,s2 : string) : double;
  240. const
  241. n = 3;
  242. var
  243. equals,i,j : longint;
  244. hs : string;
  245. begin
  246. equals:=0;
  247. { is the string long enough ? }
  248. if min(length(s1),length(s2))-n+1<1 then
  249. begin
  250. ngraphsearchvalue:=0.0;
  251. exit;
  252. end;
  253. for i:=1 to length(s1)-n+1 do
  254. begin
  255. hs:=copy(s1,i,n);
  256. for j:=1 to length(s2)-n+1 do
  257. if hs=copy(s2,j,n) then
  258. inc(equals);
  259. end;
  260. {$ifdef fpc}
  261. ngraphsearchvalue:=equals/double(max(length(s1),length(s2))-n+1);
  262. {$else}
  263. ngraphsearchvalue:=equals/(max(length(s1),length(s2))-n+1);
  264. {$endif}
  265. end;
  266. function bstoslash(const s : string) : string;
  267. {
  268. return string s with all \ changed into /
  269. }
  270. var
  271. i : longint;
  272. begin
  273. for i:=1to length(s) do
  274. if s[i]='\' then
  275. bstoslash[i]:='/'
  276. else
  277. bstoslash[i]:=s[i];
  278. {$ifndef TP}
  279. {$ifopt H+}
  280. setlength(bstoslash,length(s));
  281. {$else}
  282. bstoslash[0]:=s[0];
  283. {$endif}
  284. {$else}
  285. bstoslash[0]:=s[0];
  286. {$endif}
  287. end;
  288. {$ifdef debug}
  289. function assigned(p : pointer) : boolean;
  290. {$ifndef FPC}
  291. {$ifndef DPMI}
  292. type
  293. ptrrec = record
  294. ofs,seg : word;
  295. end;
  296. var
  297. lp : longint;
  298. {$endif DPMI}
  299. {$endif FPC}
  300. begin
  301. {$ifdef FPC}
  302. { Assigned is used for procvar and
  303. stack stored temp records !! PM }
  304. (* if (p<>nil) {and
  305. ((p<heaporg) or
  306. (p>heapptr))} then
  307. do_internalerror(230); *)
  308. {$else}
  309. {$ifdef DPMI}
  310. assigned:=(p<>nil);
  311. exit;
  312. {$else DPMI}
  313. if p=nil then
  314. lp:=0
  315. else
  316. lp:=longint(ptrrec(p).seg)*16+longint(ptrrec(p).ofs);
  317. if (lp<>0) and
  318. ((lp<longint(seg(heaporg^))*16+longint(ofs(heaporg^))) or
  319. (lp>longint(seg(heapptr^))*16+longint(ofs(heapptr^)))) then
  320. do_internalerror(230);
  321. {$endif DPMI}
  322. {$endif FPC}
  323. assigned:=(p<>nil);
  324. end;
  325. {$endif}
  326. function min(a,b : longint) : longint;
  327. {
  328. return the minimal of a and b
  329. }
  330. begin
  331. if a>b then
  332. min:=b
  333. else
  334. min:=a;
  335. end;
  336. function max(a,b : longint) : longint;
  337. {
  338. return the maximum of a and b
  339. }
  340. begin
  341. if a<b then
  342. max:=b
  343. else
  344. max:=a;
  345. end;
  346. function align(i,a:longint):longint;
  347. {
  348. return value <i> aligned <a> boundary
  349. }
  350. begin
  351. align:=(i+a-1) and not(a-1);
  352. end;
  353. procedure Replace(var s:string;s1:string;const s2:string);
  354. var
  355. last,
  356. i : longint;
  357. begin
  358. s1:=upper(s1);
  359. last:=0;
  360. repeat
  361. i:=pos(s1,upper(s));
  362. if i=last then
  363. i:=0;
  364. if (i>0) then
  365. begin
  366. Delete(s,i,length(s1));
  367. Insert(s2,s,i);
  368. last:=i;
  369. end;
  370. until (i=0);
  371. end;
  372. procedure ReplaceCase(var s:string;const s1,s2:string);
  373. var
  374. last,
  375. i : longint;
  376. begin
  377. last:=0;
  378. repeat
  379. i:=pos(s1,s);
  380. if i=last then
  381. i:=0;
  382. if (i>0) then
  383. begin
  384. Delete(s,i,length(s1));
  385. Insert(s2,s,i);
  386. last:=i;
  387. end;
  388. until (i=0);
  389. end;
  390. function upper(const s : string) : string;
  391. {
  392. return uppercased string of s
  393. }
  394. var
  395. i : longint;
  396. begin
  397. for i:=1 to length(s) do
  398. if s[i] in ['a'..'z'] then
  399. upper[i]:=char(byte(s[i])-32)
  400. else
  401. upper[i]:=s[i];
  402. upper[0]:=s[0];
  403. end;
  404. function lower(const s : string) : string;
  405. {
  406. return lowercased string of s
  407. }
  408. var
  409. i : longint;
  410. begin
  411. for i:=1 to length(s) do
  412. if s[i] in ['A'..'Z'] then
  413. lower[i]:=char(byte(s[i])+32)
  414. else
  415. lower[i]:=s[i];
  416. lower[0]:=s[0];
  417. end;
  418. procedure uppervar(var s : string);
  419. {
  420. uppercase string s
  421. }
  422. var
  423. i : longint;
  424. begin
  425. for i:=1 to length(s) do
  426. if s[i] in ['a'..'z'] then
  427. s[i]:=char(byte(s[i])-32);
  428. end;
  429. {$ifdef FPC}
  430. function tostru(i:cardinal):string;
  431. {
  432. return string of value i, but for cardinals
  433. }
  434. var
  435. hs : string;
  436. begin
  437. str(i,hs);
  438. tostru:=hs;
  439. end;
  440. {$else FPC}
  441. function tostru(i:longint):string;
  442. begin
  443. tostru:=tostr(i);
  444. end;
  445. {$endif FPC}
  446. function trimspace(const s:string):string;
  447. {
  448. return s with all leading and ending spaces and tabs removed
  449. }
  450. var
  451. i,j : longint;
  452. begin
  453. i:=length(s);
  454. while (i>0) and (s[i] in [#9,' ']) do
  455. dec(i);
  456. j:=1;
  457. while (j<i) and (s[j] in [#9,' ']) do
  458. inc(j);
  459. trimspace:=Copy(s,j,i-j+1);
  460. end;
  461. function tostr(i : longint) : string;
  462. {
  463. return string of value i
  464. }
  465. var
  466. hs : string;
  467. begin
  468. str(i,hs);
  469. tostr:=hs;
  470. end;
  471. function tostr_with_plus(i : longint) : string;
  472. {
  473. return string of value i, but always include a + when i>=0
  474. }
  475. var
  476. hs : string;
  477. begin
  478. str(i,hs);
  479. if i>=0 then
  480. tostr_with_plus:='+'+hs
  481. else
  482. tostr_with_plus:=hs;
  483. end;
  484. procedure valint(S : string;var V : longint;var code : integer);
  485. {
  486. val() with support for octal, which is not supported under tp7
  487. }
  488. {$ifndef FPC}
  489. var
  490. vs : longint;
  491. c : byte;
  492. begin
  493. if s[1]='%' then
  494. begin
  495. vs:=0;
  496. longint(v):=0;
  497. for c:=2 to length(s) do
  498. begin
  499. if s[c]='0' then
  500. vs:=vs shl 1
  501. else
  502. if s[c]='1' then
  503. vs:=vs shl 1+1
  504. else
  505. begin
  506. code:=c;
  507. exit;
  508. end;
  509. end;
  510. code:=0;
  511. longint(v):=vs;
  512. end
  513. else
  514. system.val(S,V,code);
  515. end;
  516. {$else not FPC}
  517. begin
  518. system.val(S,V,code);
  519. end;
  520. {$endif not FPC}
  521. function is_number(const s : string) : boolean;
  522. {
  523. is string a correct number ?
  524. }
  525. var
  526. w : integer;
  527. l : longint;
  528. begin
  529. valint(s,l,w);
  530. is_number:=(w=0);
  531. end;
  532. function ispowerof2(value : longint;var power : longint) : boolean;
  533. {
  534. return if value is a power of 2. And if correct return the power
  535. }
  536. var
  537. hl : longint;
  538. i : longint;
  539. begin
  540. hl:=1;
  541. ispowerof2:=true;
  542. for i:=0 to 31 do
  543. begin
  544. if hl=value then
  545. begin
  546. power:=i;
  547. exit;
  548. end;
  549. hl:=hl shl 1;
  550. end;
  551. ispowerof2:=false;
  552. end;
  553. { enable ansistring comparison }
  554. { 0 means equal }
  555. { 1 means p1 > p2 }
  556. { -1 means p1 < p2 }
  557. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  558. var
  559. i,j : longint;
  560. begin
  561. compareansistrings:=0;
  562. j:=min(length1,length2);
  563. i:=0;
  564. while (i<j) do
  565. begin
  566. if p1[i]>p2[i] then
  567. begin
  568. compareansistrings:=1;
  569. exit;
  570. end
  571. else
  572. if p1[i]<p2[i] then
  573. begin
  574. compareansistrings:=-1;
  575. exit;
  576. end;
  577. inc(i);
  578. end;
  579. if length1>length2 then
  580. compareansistrings:=1
  581. else
  582. if length1<length2 then
  583. compareansistrings:=-1;
  584. end;
  585. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  586. var
  587. p : pchar;
  588. begin
  589. getmem(p,length1+length2+1);
  590. move(p1[0],p[0],length1);
  591. move(p2[0],p[length1],length2+1);
  592. concatansistrings:=p;
  593. end;
  594. {****************************************************************************
  595. Time Handling
  596. ****************************************************************************}
  597. Function L0(l:longint):string;
  598. {
  599. return the string of value l, if l<10 then insert a zero, so
  600. the string is always at least 2 chars '01','02',etc
  601. }
  602. var
  603. s : string;
  604. begin
  605. Str(l,s);
  606. if l<10 then
  607. s:='0'+s;
  608. L0:=s;
  609. end;
  610. function gettimestr:string;
  611. {
  612. get the current time in a string HH:MM:SS
  613. }
  614. var
  615. hour,min,sec,hsec : word;
  616. begin
  617. {$ifdef delphi}
  618. dmisc.gettime(hour,min,sec,hsec);
  619. {$else delphi}
  620. dos.gettime(hour,min,sec,hsec);
  621. {$endif delphi}
  622. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  623. end;
  624. function getdatestr:string;
  625. {
  626. get the current date in a string YY/MM/DD
  627. }
  628. var
  629. Year,Month,Day,Wday : Word;
  630. begin
  631. {$ifdef delphi}
  632. dmisc.getdate(year,month,day,wday);
  633. {$else}
  634. dos.getdate(year,month,day,wday);
  635. {$endif}
  636. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  637. end;
  638. function filetimestring( t : longint) : string;
  639. {
  640. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  641. }
  642. var
  643. {$ifndef linux}
  644. DT : DateTime;
  645. {$endif}
  646. Year,Month,Day,Hour,Min,Sec : Word;
  647. begin
  648. if t=-1 then
  649. begin
  650. FileTimeString:='Not Found';
  651. exit;
  652. end;
  653. {$ifndef linux}
  654. unpacktime(t,DT);
  655. Year:=dT.year;month:=dt.month;day:=dt.day;
  656. Hour:=dt.hour;min:=dt.min;sec:=dt.sec;
  657. {$else}
  658. EpochToLocal (t,year,month,day,hour,min,sec);
  659. {$endif}
  660. filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  661. end;
  662. {****************************************************************************
  663. Default Macro Handling
  664. ****************************************************************************}
  665. procedure DefaultReplacements(var s:string);
  666. begin
  667. { Replace some macro's }
  668. Replace(s,'$FPCVER',full_version_string);
  669. Replace(s,'$FPCDATE',date_string);
  670. Replace(s,'$FPCTARGET',target_cpu_string);
  671. Replace(s,'$FPCCPU',target_cpu_string);
  672. Replace(s,'$TARGET',target_path);
  673. Replace(s,'$FPCOS',target_path);
  674. end;
  675. {****************************************************************************
  676. File Handling
  677. ****************************************************************************}
  678. function path_absolute(const s : string) : boolean;
  679. {
  680. is path s an absolute path?
  681. }
  682. begin
  683. path_absolute:=false;
  684. {$ifdef linux}
  685. if (length(s)>0) and (s[1]='/') then
  686. path_absolute:=true;
  687. {$else linux}
  688. {$ifdef amiga}
  689. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  690. path_absolute:=true;
  691. {$else}
  692. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  693. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  694. path_absolute:=true;
  695. {$endif amiga}
  696. {$endif linux}
  697. end;
  698. {$ifndef FPC}
  699. Procedure FindClose(var Info : SearchRec);
  700. Begin
  701. End;
  702. {$endif not FPC}
  703. {$ifdef delphi}
  704. Function FileExists ( Const F : String) : Boolean;
  705. begin
  706. FileExists:=sysutils.FileExists(f);
  707. end;
  708. {$else}
  709. Function FileExists ( Const F : String) : Boolean;
  710. Var
  711. {$ifdef linux}
  712. Info : Stat;
  713. {$else}
  714. Info : SearchRec;
  715. {$endif}
  716. begin
  717. {$ifdef linux}
  718. FileExists:=FStat(F,info);
  719. {$else}
  720. findfirst(F,readonly+archive+hidden,info);
  721. FileExists:=(doserror=0);
  722. findclose(Info);
  723. {$endif}
  724. end;
  725. {$endif}
  726. Function RemoveFile(const f:string):boolean;
  727. var
  728. g : file;
  729. begin
  730. assign(g,f);
  731. {$I-}
  732. erase(g);
  733. {$I+}
  734. RemoveFile:=(ioresult=0);
  735. end;
  736. Function RemoveDir(d:string):boolean;
  737. begin
  738. if d[length(d)]=DirSep then
  739. Delete(d,length(d),1);
  740. {$I-}
  741. rmdir(d);
  742. {$I+}
  743. RemoveDir:=(ioresult=0);
  744. end;
  745. Function SplitFileName(const s:string):string;
  746. var
  747. p : dirstr;
  748. n : namestr;
  749. e : extstr;
  750. begin
  751. FSplit(s,p,n,e);
  752. SplitFileName:=n+e;
  753. end;
  754. Function SplitName(const s:string):string;
  755. var
  756. i,j : longint;
  757. begin
  758. i:=Length(s);
  759. j:=Length(s);
  760. while (i>0) and not(s[i] in ['/','\']) do
  761. dec(i);
  762. while (j>0) and (s[j]<>'.') do
  763. dec(j);
  764. if j<=i then
  765. j:=255;
  766. SplitName:=Copy(s,i+1,j-(i+1));
  767. end;
  768. Function SplitExtension(Const HStr:String):String;
  769. var
  770. j : longint;
  771. begin
  772. j:=length(Hstr);
  773. while (j>0) and (Hstr[j]<>'.') do
  774. begin
  775. if hstr[j]=DirSep then
  776. j:=0
  777. else
  778. dec(j);
  779. end;
  780. if j=0 then
  781. j:=254;
  782. SplitExtension:=Copy(Hstr,j,255);
  783. end;
  784. Function AddExtension(Const HStr,ext:String):String;
  785. begin
  786. if (Ext<>'') and (SplitExtension(HStr)='') then
  787. AddExtension:=Hstr+Ext
  788. else
  789. AddExtension:=Hstr;
  790. end;
  791. Function ForceExtension(Const HStr,ext:String):String;
  792. var
  793. j : longint;
  794. begin
  795. j:=length(Hstr);
  796. while (j>0) and (Hstr[j]<>'.') do
  797. dec(j);
  798. if j=0 then
  799. j:=255;
  800. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  801. end;
  802. Function FixPath(s:string;allowdot:boolean):string;
  803. var
  804. i : longint;
  805. begin
  806. { Fix separator }
  807. for i:=1 to length(s) do
  808. if s[i] in ['/','\'] then
  809. s[i]:=DirSep;
  810. { Fix ending / }
  811. if (length(s)>0) and (s[length(s)]<>DirSep) and
  812. (s[length(s)]<>':') then
  813. s:=s+DirSep;
  814. { Remove ./ }
  815. if (not allowdot) and (s='.'+DirSep) then
  816. s:='';
  817. { return }
  818. FixPath:=s;
  819. end;
  820. function FixFileName(const s:string):string;
  821. var
  822. i : longint;
  823. {$ifdef Linux}
  824. NoPath : boolean;
  825. {$endif Linux}
  826. begin
  827. {$ifdef Linux}
  828. NoPath:=true;
  829. {$endif Linux}
  830. for i:=length(s) downto 1 do
  831. begin
  832. case s[i] of
  833. {$ifdef Linux}
  834. '/','\' : begin
  835. FixFileName[i]:='/';
  836. NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
  837. end;
  838. 'A'..'Z' : if NoPath then
  839. FixFileName[i]:=char(byte(s[i])+32)
  840. else
  841. FixFileName[i]:=s[i];
  842. {$else}
  843. '/' : FixFileName[i]:='\';
  844. 'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
  845. {$endif}
  846. else
  847. FixFileName[i]:=s[i];
  848. end;
  849. end;
  850. {$ifndef TP}
  851. {$ifopt H+}
  852. SetLength(FixFileName,length(s));
  853. {$else}
  854. FixFileName[0]:=s[0];
  855. {$endif}
  856. {$else}
  857. FixFileName[0]:=s[0];
  858. {$endif}
  859. end;
  860. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  861. var
  862. i : longint;
  863. begin
  864. i:=pos(' ',s);
  865. if i>0 then
  866. begin
  867. bstr:=Copy(s,1,i-1);
  868. cstr:=Copy(s,i+1,length(s)-i);
  869. end
  870. else
  871. begin
  872. bstr:='';
  873. cstr:='';
  874. end;
  875. end;
  876. procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
  877. var
  878. j : longint;
  879. CurrentDir,
  880. CurrPath : string;
  881. hp : PStringQueueItem;
  882. begin
  883. if s='' then
  884. exit;
  885. { Support default macro's }
  886. DefaultReplacements(s);
  887. { get current dir }
  888. GetDir(0,CurrentDir);
  889. CurrentDir:=FixPath(CurrentDir,false);
  890. repeat
  891. j:=Pos(';',s);
  892. if j=0 then
  893. j:=255;
  894. {Get Pathname}
  895. CurrPath:=FixPath(Copy(s,1,j-1),false);
  896. if CurrPath='' then
  897. CurrPath:='.'+DirSep
  898. else
  899. begin
  900. CurrPath:=FixPath(FExpand(CurrPath),false);
  901. if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
  902. CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
  903. end;
  904. System.Delete(s,1,j);
  905. if addfirst then
  906. begin
  907. Delete(currPath);
  908. Insert(currPath);
  909. end
  910. else
  911. begin
  912. { Check if already in path, then we don't add it }
  913. hp:=Find(currPath);
  914. if not assigned(hp) then
  915. Concat(currPath);
  916. end;
  917. until (s='');
  918. end;
  919. procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
  920. var
  921. s : string;
  922. hl : TSearchPathList;
  923. hp,hp2 : PStringQueueItem;
  924. begin
  925. if list.empty then
  926. exit;
  927. { create temp and reverse the list }
  928. if addfirst then
  929. begin
  930. hl.Init;
  931. hp:=list.first;
  932. while assigned(hp) do
  933. begin
  934. hl.insert(hp^.data^);
  935. hp:=hp^.next;
  936. end;
  937. while not hl.empty do
  938. begin
  939. s:=hl.Get;
  940. Delete(s);
  941. Insert(s);
  942. end;
  943. hl.done;
  944. end
  945. else
  946. begin
  947. hp:=list.first;
  948. while assigned(hp) do
  949. begin
  950. hp2:=Find(hp^.data^);
  951. { Check if already in path, then we don't add it }
  952. if not assigned(hp2) then
  953. Concat(hp^.data^);
  954. hp:=hp^.next;
  955. end;
  956. end;
  957. end;
  958. function TSearchPathList.FindFile(const f : string;var b : boolean) : string;
  959. Var
  960. p : PStringQueueItem;
  961. begin
  962. FindFile:='';
  963. b:=false;
  964. p:=first;
  965. while assigned(p) do
  966. begin
  967. If FileExists(p^.data^+f) then
  968. begin
  969. FindFile:=p^.data^;
  970. b:=true;
  971. exit;
  972. end;
  973. p:=p^.next;
  974. end;
  975. end;
  976. Function GetFileTime ( Var F : File) : Longint;
  977. Var
  978. {$ifdef linux}
  979. Info : Stat;
  980. {$endif}
  981. L : longint;
  982. begin
  983. {$ifdef linux}
  984. FStat (F,Info);
  985. L:=Info.Mtime;
  986. {$else}
  987. GetFTime(f,l);
  988. {$endif}
  989. GetFileTime:=L;
  990. end;
  991. Function GetNamedFileTime (Const F : String) : Longint;
  992. var
  993. L : Longint;
  994. {$ifndef linux}
  995. info : SearchRec;
  996. {$else}
  997. info : stat;
  998. {$endif}
  999. begin
  1000. l:=-1;
  1001. {$ifdef linux}
  1002. if FStat (F,Info) then
  1003. L:=info.mtime;
  1004. {$else}
  1005. {$ifdef delphi}
  1006. dmisc.FindFirst (F,archive+readonly+hidden,info);
  1007. {$else delphi}
  1008. FindFirst (F,archive+readonly+hidden,info);
  1009. {$endif delphi}
  1010. if DosError=0 then
  1011. l:=info.time;
  1012. {$ifdef Linux}
  1013. FindClose(info);
  1014. {$endif}
  1015. {$ifdef Win32}
  1016. FindClose(info);
  1017. {$endif}
  1018. {$endif}
  1019. GetNamedFileTime:=l;
  1020. end;
  1021. {Touch Assembler and object time to ppu time is there is a ppufilename}
  1022. procedure SynchronizeFileTime(const fn1,fn2:string);
  1023. var
  1024. f : file;
  1025. l : longint;
  1026. begin
  1027. Assign(f,fn1);
  1028. {$I-}
  1029. reset(f,1);
  1030. {$I+}
  1031. if ioresult=0 then
  1032. begin
  1033. getftime(f,l);
  1034. close(f);
  1035. assign(f,fn2);
  1036. {$I-}
  1037. reset(f,1);
  1038. {$I+}
  1039. if ioresult=0 then
  1040. begin
  1041. setftime(f,l);
  1042. close(f);
  1043. end;
  1044. end;
  1045. end;
  1046. function FindFile(const f : string;path : string;var b : boolean) : string;
  1047. Var
  1048. singlepathstring : string;
  1049. i : longint;
  1050. begin
  1051. {$ifdef linux}
  1052. for i:=1 to length(path) do
  1053. if path[i]=':' then
  1054. path[i]:=';';
  1055. {$endif}
  1056. b:=false;
  1057. FindFile:='';
  1058. repeat
  1059. i:=pos(';',path);
  1060. if i=0 then
  1061. i:=255;
  1062. singlepathstring:=FixPath(copy(path,1,i-1),false);
  1063. delete(path,1,i);
  1064. If FileExists (singlepathstring+f) then
  1065. begin
  1066. FindFile:=singlepathstring;
  1067. b:=true;
  1068. exit;
  1069. end;
  1070. until path='';
  1071. end;
  1072. function FindExe(bin:string;var found:boolean):string;
  1073. begin
  1074. bin:=FixFileName(bin)+source_os.exeext;
  1075. {$ifdef delphi}
  1076. FindExe:=FindFile(bin,'.;'+exepath+';'+dmisc.getenv('PATH'),found)+bin;
  1077. {$else delphi}
  1078. FindExe:=FindFile(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
  1079. {$endif delphi}
  1080. end;
  1081. function GetShortName(const n:string):string;
  1082. {$ifdef win32}
  1083. var
  1084. hs,hs2 : string;
  1085. {$endif}
  1086. {$ifdef go32v2}
  1087. var
  1088. hs : string;
  1089. {$endif}
  1090. begin
  1091. GetShortName:=n;
  1092. {$ifdef win32}
  1093. hs:=n+#0;
  1094. Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
  1095. hs2[0]:=chr(strlen(@hs2[1]));
  1096. GetShortName:=hs2;
  1097. {$endif}
  1098. {$ifdef go32v2}
  1099. hs:=n;
  1100. if Dos.GetShortName(hs) then
  1101. GetShortName:=hs;
  1102. {$endif}
  1103. end;
  1104. {****************************************************************************
  1105. OS Dependent things
  1106. ****************************************************************************}
  1107. function GetEnvPChar(const envname:string):pchar;
  1108. {$ifdef win32}
  1109. var
  1110. s : string;
  1111. i,len : longint;
  1112. hp,p,p2 : pchar;
  1113. {$endif}
  1114. begin
  1115. {$ifdef linux}
  1116. GetEnvPchar:=Linux.Getenv(envname);
  1117. {$define GETENVOK}
  1118. {$endif}
  1119. {$ifdef win32}
  1120. GetEnvPchar:=nil;
  1121. p:=GetEnvironmentStrings;
  1122. hp:=p;
  1123. while hp^<>#0 do
  1124. begin
  1125. s:=strpas(hp);
  1126. i:=pos('=',s);
  1127. len:=strlen(hp);
  1128. if upcase(copy(s,1,i-1))=upcase(envname) then
  1129. begin
  1130. GetMem(p2,len-length(envname));
  1131. Move(hp[i],p2^,len-length(envname));
  1132. GetEnvPchar:=p2;
  1133. break;
  1134. end;
  1135. { next string entry}
  1136. hp:=hp+len+1;
  1137. end;
  1138. FreeEnvironmentStrings(p);
  1139. {$define GETENVOK}
  1140. {$endif}
  1141. {$ifdef GETENVOK}
  1142. {$undef GETENVOK}
  1143. {$else}
  1144. GetEnvPchar:=StrPNew(Dos.Getenv(envname));
  1145. {$endif}
  1146. end;
  1147. procedure FreeEnvPChar(p:pchar);
  1148. begin
  1149. {$ifndef linux}
  1150. StrDispose(p);
  1151. {$endif}
  1152. end;
  1153. Procedure Shell(const command:string);
  1154. { This is already defined in the linux.ppu for linux, need for the *
  1155. expansion under linux }
  1156. {$ifdef linux}
  1157. begin
  1158. Linux.Shell(command);
  1159. end;
  1160. {$else}
  1161. var
  1162. comspec : string;
  1163. begin
  1164. comspec:=getenv('COMSPEC');
  1165. Exec(comspec,' /C '+command);
  1166. end;
  1167. {$endif}
  1168. {****************************************************************************
  1169. Init
  1170. ****************************************************************************}
  1171. procedure get_exepath;
  1172. var
  1173. hs1 : namestr;
  1174. hs2 : extstr;
  1175. begin
  1176. {$ifdef delphi}
  1177. exepath:=dmisc.getenv('PPC_EXEC_PATH');
  1178. {$else delphi}
  1179. exepath:=dos.getenv('PPC_EXEC_PATH');
  1180. {$endif delphi}
  1181. if exepath='' then
  1182. fsplit(FixFileName(paramstr(0)),exepath,hs1,hs2);
  1183. {$ifdef linux}
  1184. if exepath='' then
  1185. fsearch(hs1,dos.getenv('PATH'));
  1186. {$endif}
  1187. exepath:=FixPath(exepath,false);
  1188. end;
  1189. procedure DoneGlobals;
  1190. begin
  1191. initdefines.done;
  1192. if assigned(DLLImageBase) then
  1193. StringDispose(DLLImageBase);
  1194. RelocSection:=true;
  1195. RelocSectionSetExplicitly:=false;
  1196. DLLsource:=false;
  1197. UseDeffileForExport:=true;
  1198. librarysearchpath.Done;
  1199. unitsearchpath.Done;
  1200. objectsearchpath.Done;
  1201. includesearchpath.Done;
  1202. end;
  1203. procedure InitGlobals;
  1204. begin
  1205. { set global switches }
  1206. do_build:=false;
  1207. do_make:=true;
  1208. {$ifdef tp}
  1209. use_big:=false;
  1210. {$endif tp}
  1211. compile_level:=0;
  1212. { Output }
  1213. OutputFile:='';
  1214. OutputExeDir:='';
  1215. OutputUnitDir:='';
  1216. { Utils directory }
  1217. utilsdirectory:='';
  1218. { Search Paths }
  1219. librarysearchpath.Init;
  1220. unitsearchpath.Init;
  1221. includesearchpath.Init;
  1222. objectsearchpath.Init;
  1223. { Def file }
  1224. usewindowapi:=false;
  1225. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1226. dllversion:='';
  1227. { Init values }
  1228. initmodeswitches:=fpcmodeswitches;
  1229. initlocalswitches:=[cs_check_io];
  1230. initmoduleswitches:=[cs_extsyntax,cs_browser];
  1231. initglobalswitches:=[cs_check_unit_name,cs_link_static];
  1232. {$ifdef i386}
  1233. initoptprocessor:=Class386;
  1234. initpackenum:=4;
  1235. initpackrecords:=packrecord_2;
  1236. initoutputformat:=target_asm.id;
  1237. initasmmode:=asmmode_i386_att;
  1238. {$else not i386}
  1239. {$ifdef m68k}
  1240. initoptprocessor:=MC68000;
  1241. include(initmoduleswitches,cs_fp_emulation);
  1242. initpackenum:=4;
  1243. initpackrecords:=packrecord_2;
  1244. initoutputformat:=as_m68k_as;
  1245. initasmmode:=asmmode_m68k_mot;
  1246. {$endif m68k}
  1247. {$endif i386}
  1248. initdefines.init;
  1249. { memory sizes, will be overriden by parameter or default for target
  1250. in options or init_parser }
  1251. stacksize:=0;
  1252. heapsize:=0;
  1253. maxheapsize:=0;
  1254. { compile state }
  1255. in_args:=false;
  1256. { must_be_valid:=true; obsolete PM }
  1257. not_unit_proc:=true;
  1258. apptype:=at_cui;
  1259. end;
  1260. begin
  1261. get_exepath;
  1262. {$ifdef EXTDEBUG}
  1263. {$ifdef FPC}
  1264. EntryMemUsed:=system.HeapSize-MemAvail;
  1265. {$endif FPC}
  1266. {$endif}
  1267. end.
  1268. {
  1269. $Log$
  1270. Revision 1.41 1999-12-20 23:23:28 pierre
  1271. + $description $version
  1272. Revision 1.40 1999/12/20 21:42:34 pierre
  1273. + dllversion global variable
  1274. * FPC_USE_CPREFIX code removed, not necessary anymore
  1275. as we use .edata direct writing by default now.
  1276. Revision 1.39 1999/12/08 10:40:00 pierre
  1277. + allow use of unit var in exports of DLL for win32
  1278. by using direct export writing by default instead of use of DEFFILE
  1279. that does not allow assembler labels that do not
  1280. start with an underscore.
  1281. Use -WD to force use of Deffile for Win32 DLL
  1282. Revision 1.38 1999/12/06 18:21:03 peter
  1283. * support !ENVVAR for long commandlines
  1284. * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
  1285. finally supported as installdir.
  1286. Revision 1.37 1999/12/02 17:34:34 peter
  1287. * preprocessor support. But it fails on the caret in type blocks
  1288. Revision 1.36 1999/11/18 15:34:45 pierre
  1289. * Notes/Hints for local syms changed to
  1290. Set_varstate function
  1291. Revision 1.35 1999/11/17 17:04:59 pierre
  1292. * Notes/hints changes
  1293. Revision 1.34 1999/11/15 17:42:41 pierre
  1294. * -g disables reloc section for win32
  1295. Revision 1.33 1999/11/12 11:03:50 peter
  1296. * searchpaths changed to stringqueue object
  1297. Revision 1.32 1999/11/09 23:34:46 pierre
  1298. + resolving_forward boolean used for references
  1299. Revision 1.31 1999/11/09 13:00:38 peter
  1300. * define FPC_DELPHI,FPC_OBJFPC,FPC_TP,FPC_GPC
  1301. * initial support for ansistring default with modes
  1302. Revision 1.30 1999/11/08 16:27:20 pierre
  1303. + Reset AnsiStrings to clean up memory
  1304. Revision 1.29 1999/11/06 14:34:20 peter
  1305. * truncated log to 20 revs
  1306. Revision 1.28 1999/11/04 10:55:31 peter
  1307. * TSearchPathList for the string type of the searchpaths, which is
  1308. ansistring under FPC/Delphi
  1309. Revision 1.27 1999/10/26 12:30:41 peter
  1310. * const parameter is now checked
  1311. * better and generic check if a node can be used for assigning
  1312. * export fixes
  1313. * procvar equal works now (it never had worked at least from 0.99.8)
  1314. * defcoll changed to linkedlist with pparaitem so it can easily be
  1315. walked both directions
  1316. Revision 1.26 1999/10/21 14:29:34 peter
  1317. * redesigned linker object
  1318. + library support for linux (only procedures can be exported)
  1319. Revision 1.25 1999/09/10 18:48:02 florian
  1320. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  1321. * most things for stored properties fixed
  1322. Revision 1.24 1999/09/08 16:05:31 peter
  1323. * pointer add/sub is now as expected and the same results as inc/dec
  1324. Revision 1.23 1999/09/07 15:11:00 pierre
  1325. * use do_internalerror insetead of runerror
  1326. Revision 1.22 1999/08/30 10:17:56 peter
  1327. * fixed crash in psub
  1328. * ansistringcompare fixed
  1329. * support for #$0b8
  1330. Revision 1.21 1999/08/27 10:45:00 pierre
  1331. options -Ca sets simply_ppu to true
  1332. Revision 1.20 1999/08/19 13:02:12 pierre
  1333. + label faillabel added for _FAIL support
  1334. Revision 1.19 1999/08/16 15:35:21 pierre
  1335. * fix for DLL relocation problems
  1336. * external bss vars had wrong stabs for pecoff
  1337. + -WB11000000 to specify default image base, allows to
  1338. load several DLLs with debugging info included
  1339. (relocatable DLL are stripped because the relocation
  1340. of the .Stab section is misplaced by ldw)
  1341. Revision 1.18 1999/08/11 17:26:32 peter
  1342. * tlinker object is now inherited for win32 and dos
  1343. * postprocessexecutable is now a method of tlinker
  1344. Revision 1.17 1999/08/10 12:51:14 pierre
  1345. * bind_win32_dll removed (Relocsection used instead)
  1346. * now relocsection is true by default ! (needs dlltool
  1347. for DLL generation)
  1348. Revision 1.16 1999/08/05 20:54:19 daniel
  1349. * Changes for new symtable.
  1350. Revision 1.15 1999/08/03 17:09:35 florian
  1351. * the alpha compiler can be compiled now
  1352. Revision 1.14 1999/07/23 16:05:19 peter
  1353. * alignment is now saved in the symtable
  1354. * C alignment added for records
  1355. * PPU version increased to solve .12 <-> .13 probs
  1356. Revision 1.13 1999/07/18 10:19:52 florian
  1357. * made it compilable with Dlephi 4 again
  1358. + fixed problem with large stack allocations on win32
  1359. Revision 1.12 1999/07/13 19:14:44 michael
  1360. + Defaultreplacemens now more logical
  1361. Revision 1.11 1999/07/10 10:26:18 peter
  1362. * merged
  1363. Revision 1.8.2.2 1999/07/10 10:03:04 peter
  1364. * fixed initialization/finalization in fpc mode
  1365. * allow $TARGET also in search paths
  1366. Revision 1.8.2.1 1999/07/07 07:53:21 michael
  1367. + Merged patches from florian
  1368. }