globals.pas 40 KB

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