globals.pas 41 KB

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