globals.pas 39 KB

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