globals.pas 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements some support functions and global variables
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit globals;
  19. {$i fpcdefs.inc}
  20. { Use the internal linker by default }
  21. { define INTERNALLINKER}
  22. interface
  23. uses
  24. {$ifdef win32}
  25. windows,
  26. {$endif}
  27. {$ifdef hasunix}
  28. {$ifdef havelinuxrtl10}
  29. linux,
  30. {$else}
  31. Baseunix,unix,
  32. {$endif}
  33. {$endif}
  34. {$ifdef Delphi}
  35. SysUtils,
  36. dmisc,
  37. {$else}
  38. strings,
  39. dos,
  40. {$endif}
  41. cutils,cclasses,
  42. globtype,version,systems,cpuinfo;
  43. const
  44. {$ifdef Splitheap}
  45. testsplit : boolean = false;
  46. {$endif Splitheap}
  47. delphimodeswitches : tmodeswitches=
  48. [m_delphi,m_all,m_class,m_objpas,m_result,m_string_pchar,
  49. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
  50. m_out,m_default_para,m_duplicate_names,m_hintdirective,m_add_pointer];
  51. fpcmodeswitches : tmodeswitches=
  52. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  53. m_cvar_support,m_initfinal,m_add_pointer,m_hintdirective];
  54. objfpcmodeswitches : tmodeswitches=
  55. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  56. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer,m_out,m_default_para,m_hintdirective];
  57. tpmodeswitches : tmodeswitches=
  58. [m_tp7,m_all,m_tp_procvar,m_duplicate_names];
  59. gpcmodeswitches : tmodeswitches=
  60. [m_gpc,m_all];
  61. macmodeswitches : tmodeswitches=
  62. [m_mac,m_all,m_result,m_repeat_forward,m_cvar_support];
  63. { maximum number of locals in bytes before warning is emitted }
  64. maxlocalsize = high(smallint);
  65. { maximum number of paras in bytes before warning is emitted }
  66. maxparasize = high(word);
  67. { maximum nesting of routines }
  68. maxnesting = 32;
  69. treelogfilename = 'tree.log';
  70. { I don't know if this endian dependend }
  71. MathQNaN : array[0..7] of byte = (0,0,0,0,0,0,252,255);
  72. MathInf : array[0..7] of byte = (0,0,0,0,0,0,240,127);
  73. MathNegInf : array[0..7] of byte = (0,0,0,0,0,0,240,255);
  74. type
  75. TFPUException = (exInvalidOp, exDenormalized, exZeroDivide,
  76. exOverflow, exUnderflow, exPrecision);
  77. TFPUExceptionMask = set of TFPUException;
  78. pfileposinfo = ^tfileposinfo;
  79. tfileposinfo = record
  80. line : longint;
  81. column : word;
  82. fileindex : word;
  83. { moduleindex : word; }
  84. end;
  85. TSearchPathList = class(TStringList)
  86. procedure AddPath(s:string;addfirst:boolean);overload;
  87. procedure AddPath(SrcPath,s:string;addfirst:boolean);overload;
  88. procedure AddList(list:TSearchPathList;addfirst:boolean);
  89. function FindFile(const f : string;var foundfile:string):boolean;
  90. end;
  91. tcodepagestring = string[20];
  92. var
  93. { specified inputfile }
  94. inputdir : dirstr;
  95. inputfile : namestr;
  96. inputextension : extstr;
  97. { specified outputfile with -o parameter }
  98. outputfile : namestr;
  99. outputprefix : pstring;
  100. outputsuffix : pstring;
  101. outputextension : namestr;
  102. { specified with -FE or -FU }
  103. outputexedir : dirstr;
  104. outputunitdir : dirstr;
  105. { things specified with parameters }
  106. paralinkoptions,
  107. paradynamiclinker : string;
  108. paraprintnodetree : byte;
  109. parapreprocess : boolean;
  110. printnodefile : text;
  111. { typical cross compiling params}
  112. { directory where the utils can be found (options -FD) }
  113. utilsdirectory : dirstr;
  114. { targetname specific prefix used by these utils (options -XP<path>) }
  115. utilsprefix : dirstr;
  116. cshared : boolean; { pass --shared to ld to link C libs shared}
  117. Dontlinkstdlibpath: Boolean; { Don't add std paths to linkpath}
  118. rlinkpath : dirstr; { rpath-link linkdir override}
  119. { some flags for global compiler switches }
  120. do_build,
  121. do_release,
  122. do_make : boolean;
  123. { path for searching units, different paths can be seperated by ; }
  124. exepath : dirstr; { Path to ppc }
  125. librarysearchpath,
  126. unitsearchpath,
  127. objectsearchpath,
  128. includesearchpath : TSearchPathList;
  129. { linking }
  130. usewindowapi : boolean;
  131. description : string;
  132. DescriptionSetExplicity : boolean;
  133. dllversion : string;
  134. dllmajor,
  135. dllminor,
  136. dllrevision : word; { revision only for netware }
  137. UseDeffileForExports : boolean;
  138. UseDeffileForExportsSetExplicitly : boolean;
  139. RelocSection : boolean;
  140. RelocSectionSetExplicitly : boolean;
  141. LinkTypeSetExplicitly : boolean;
  142. akttokenpos, { position of the last token }
  143. aktfilepos : tfileposinfo; { current position }
  144. nwscreenname : string;
  145. nwthreadname : string;
  146. nwcopyright : string;
  147. codegenerror : boolean; { true if there is an error reported }
  148. block_type : tblock_type; { type of currently parsed block }
  149. parsing_para_level : integer; { parameter level, used to convert
  150. proc calls to proc loads in firstcalln }
  151. compile_level : word;
  152. make_ref : boolean;
  153. resolving_forward : boolean; { used to add forward reference as second ref }
  154. inlining_procedure : boolean; { are we inlining a procedure }
  155. exceptblockcounter : integer; { each except block gets a unique number check gotos }
  156. aktexceptblock : integer; { the exceptblock number of the current block (0 if none) }
  157. { commandline values }
  158. initdefines : tstringlist;
  159. initglobalswitches : tglobalswitches;
  160. initmoduleswitches : tmoduleswitches;
  161. initlocalswitches : tlocalswitches;
  162. initmodeswitches : tmodeswitches;
  163. {$IFDEF testvarsets}
  164. Initsetalloc, {0=fixed, 1 =var}
  165. {$ENDIF}
  166. initpackenum : shortint;
  167. {$ifdef ansistring_bits}
  168. initansistring_bits: Tstringbits;
  169. {$endif}
  170. initalignment : talignmentinfo;
  171. initoptprocessor,
  172. initspecificoptprocessor : tprocessors;
  173. initfputype : tfputype;
  174. initasmmode : tasmmode;
  175. initinterfacetype : tinterfacetypes;
  176. initoutputformat : tasm;
  177. initdefproccall : tproccalloption;
  178. initsourcecodepage : tcodepagestring;
  179. { current state values }
  180. aktglobalswitches : tglobalswitches;
  181. aktmoduleswitches : tmoduleswitches;
  182. aktlocalswitches : tlocalswitches;
  183. nextaktlocalswitches : tlocalswitches;
  184. localswitcheschanged : boolean;
  185. aktmodeswitches : tmodeswitches;
  186. {$IFDEF testvarsets}
  187. aktsetalloc,
  188. {$ENDIF}
  189. aktpackrecords,
  190. aktpackenum : longint;
  191. {$ifdef ansistring_bits}
  192. aktansistring_bits : Tstringbits;
  193. {$endif}
  194. aktmaxfpuregisters : longint;
  195. aktalignment : talignmentinfo;
  196. aktoptprocessor,
  197. aktspecificoptprocessor : tprocessors;
  198. aktfputype : tfputype;
  199. aktasmmode : tasmmode;
  200. aktinterfacetype : tinterfacetypes;
  201. aktoutputformat : tasm;
  202. aktdefproccall : tproccalloption;
  203. aktsourcecodepage : tcodepagestring;
  204. { Memory sizes }
  205. heapsize,
  206. stacksize : longint;
  207. {$Ifdef EXTDEBUG}
  208. { parameter switches }
  209. debugstop : boolean;
  210. {$EndIf EXTDEBUG}
  211. { windows / OS/2 application type }
  212. apptype : tapptype;
  213. const
  214. DLLsource : boolean = false;
  215. DLLImageBase : pstring = nil;
  216. { used to set all registers used for each global function
  217. this should dramatically decrease the number of
  218. recompilations needed PM }
  219. simplify_ppu : boolean = true;
  220. { should we allow non static members ? }
  221. allow_only_static : boolean = false;
  222. Inside_asm_statement : boolean = false;
  223. global_unit_count : word = 0;
  224. { for error info in pp.pas }
  225. parser_current_file : string = '';
  226. {$ifdef m68k}
  227. { PalmOS resources }
  228. palmos_applicationname : string = 'FPC Application';
  229. palmos_applicationid : string[4] = 'FPCA';
  230. {$endif m68k}
  231. procedure abstract;
  232. function bstoslash(const s : string) : string;
  233. function getdatestr:string;
  234. function gettimestr:string;
  235. function filetimestring( t : longint) : string;
  236. procedure DefaultReplacements(var s:string);
  237. {Gives the absolute path to the current directory}
  238. function GetCurrentDir:string;
  239. {Gives the relative path to the current directory,
  240. with a trailing dir separator. E. g. on unix ./ }
  241. function CurDirRelPath(systeminfo: tsysteminfo): string;
  242. function path_absolute(const s : string) : boolean;
  243. Function PathExists ( F : String) : Boolean;
  244. Function FileExists ( Const F : String) : Boolean;
  245. function FileExistsNonCase(const path,fn:string;var foundfile:string):boolean;
  246. Function RemoveFile(const f:string):boolean;
  247. Function RemoveDir(d:string):boolean;
  248. Function GetFileTime ( Var F : File) : Longint;
  249. Function GetNamedFileTime ( Const F : String) : Longint;
  250. Function SplitPath(const s:string):string;
  251. Function SplitFileName(const s:string):string;
  252. Function SplitName(const s:string):string;
  253. Function SplitExtension(Const HStr:String):String;
  254. Function AddExtension(Const HStr,ext:String):String;
  255. Function ForceExtension(Const HStr,ext:String):String;
  256. Function FixPath(s:string;allowdot:boolean):string;
  257. function FixFileName(const s:string):string;
  258. function TargetFixPath(s:string;allowdot:boolean):string;
  259. function TargetFixFileName(const s:string):string;
  260. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  261. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  262. function FindFilePchar(const f : string;path : pchar;var foundfile:string):boolean;
  263. function FindExe(const bin:string;var foundfile:string):boolean;
  264. function GetShortName(const n:string):string;
  265. function Shell(const command:string): longint;
  266. function GetEnvPChar(const envname:string):pchar;
  267. procedure FreeEnvPChar(p:pchar);
  268. procedure SetFPUExceptionMask(const Mask: TFPUExceptionMask);
  269. function is_number_float(d : double) : boolean;
  270. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  271. function SetAktProcCall(const s:string; changeInit: boolean):boolean;
  272. function SetProcessor(const s:string; changeInit: boolean):boolean;
  273. function SetFpuType(const s:string; changeInit: boolean):boolean;
  274. procedure InitGlobals;
  275. procedure DoneGlobals;
  276. function string2guid(const s: string; var GUID: TGUID): boolean;
  277. function guid2string(const GUID: TGUID): string;
  278. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  279. {# Routine to get the required alignment for size of data, which will
  280. be placed in bss segment, according to the current alignment requirements }
  281. function var_align(siz: longint): longint;
  282. {# Routine to get the required alignment for size of data, which will
  283. be placed in data/const segment, according to the current alignment requirements }
  284. function const_align(siz: longint): longint;
  285. implementation
  286. uses
  287. {$ifdef macos}
  288. macutils,
  289. {$endif}
  290. comphook;
  291. procedure abstract;
  292. begin
  293. do_internalerror(255);
  294. end;
  295. procedure WarnNonExistingPath(const path : string);
  296. begin
  297. if assigned({$ifndef FPCPROCVAR}@{$endif}do_comment) then
  298. do_comment(V_Hint,'Path "'+path+'" not found');
  299. end;
  300. function bstoslash(const s : string) : string;
  301. {
  302. return string s with all \ changed into /
  303. }
  304. var
  305. i : longint;
  306. begin
  307. for i:=1to length(s) do
  308. if s[i]='\' then
  309. bstoslash[i]:='/'
  310. else
  311. bstoslash[i]:=s[i];
  312. bstoslash[0]:=s[0];
  313. end;
  314. {****************************************************************************
  315. Time Handling
  316. ****************************************************************************}
  317. Function L0(l:longint):string;
  318. {
  319. return the string of value l, if l<10 then insert a zero, so
  320. the string is always at least 2 chars '01','02',etc
  321. }
  322. var
  323. s : string;
  324. begin
  325. Str(l,s);
  326. if l<10 then
  327. s:='0'+s;
  328. L0:=s;
  329. end;
  330. function gettimestr:string;
  331. {
  332. get the current time in a string HH:MM:SS
  333. }
  334. var
  335. hour,min,sec,hsec : word;
  336. begin
  337. {$ifdef delphi}
  338. dmisc.gettime(hour,min,sec,hsec);
  339. {$else delphi}
  340. dos.gettime(hour,min,sec,hsec);
  341. {$endif delphi}
  342. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  343. end;
  344. function getdatestr:string;
  345. {
  346. get the current date in a string YY/MM/DD
  347. }
  348. var
  349. Year,Month,Day,Wday : Word;
  350. begin
  351. {$ifdef delphi}
  352. dmisc.getdate(year,month,day,wday);
  353. {$else}
  354. dos.getdate(year,month,day,wday);
  355. {$endif}
  356. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  357. end;
  358. function filetimestring( t : longint) : string;
  359. {
  360. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  361. }
  362. var
  363. DT : DateTime;
  364. begin
  365. if t=-1 then
  366. begin
  367. FileTimeString:='Not Found';
  368. exit;
  369. end;
  370. unpacktime(t,DT);
  371. filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
  372. end;
  373. {****************************************************************************
  374. Default Macro Handling
  375. ****************************************************************************}
  376. procedure DefaultReplacements(var s:string);
  377. begin
  378. { Replace some macros }
  379. Replace(s,'$FPCVER',version_string);
  380. Replace(s,'$VERSION',version_string);
  381. Replace(s,'$FULLVERSION',full_version_string);
  382. Replace(s,'$FPCDATE',date_string);
  383. Replace(s,'$FPCTARGET',target_cpu_string);
  384. Replace(s,'$FPCCPU',target_cpu_string);
  385. Replace(s,'$TARGET',target_path);
  386. Replace(s,'$FPCOS',target_path);
  387. end;
  388. {****************************************************************************
  389. File Handling
  390. ****************************************************************************}
  391. var
  392. CachedCurrentDir : string;
  393. {Gives the absolute path to the current directory}
  394. function GetCurrentDir:string;
  395. begin
  396. if CachedCurrentDir='' then
  397. begin
  398. GetDir(0,CachedCurrentDir);
  399. CachedCurrentDir:=FixPath(CachedCurrentDir,false);
  400. end;
  401. result:=CachedCurrentDir;
  402. end;
  403. {Gives the relative path to the current directory,
  404. with a trailing dir separator. E. g. on unix ./ }
  405. function CurDirRelPath(systeminfo: tsysteminfo): string;
  406. begin
  407. if systeminfo.system <> system_powerpc_macos then
  408. CurDirRelPath:= '.'+systeminfo.DirSep
  409. else
  410. CurDirRelPath:= ':'
  411. end;
  412. function path_absolute(const s : string) : boolean;
  413. {
  414. is path s an absolute path?
  415. }
  416. begin
  417. path_absolute:=false;
  418. {$ifdef unix}
  419. if (length(s)>0) and (s[1]='/') then
  420. path_absolute:=true;
  421. {$else unix}
  422. {$ifdef amiga}
  423. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  424. path_absolute:=true;
  425. {$else}
  426. {$ifdef macos}
  427. if IsMacFullPath(s) then
  428. path_absolute:=true;
  429. {$else}
  430. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  431. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  432. path_absolute:=true;
  433. {$endif macos}
  434. {$endif amiga}
  435. {$endif unix}
  436. end;
  437. {$ifndef FPC}
  438. Procedure FindClose(var Info : SearchRec);
  439. Begin
  440. End;
  441. {$endif not FPC}
  442. Function FileExists ( Const F : String) : Boolean;
  443. Var
  444. res : boolean;
  445. {$ifndef delphi}
  446. Info : SearchRec;
  447. {$endif}
  448. begin
  449. {$ifdef delphi}
  450. res:=sysutils.FileExists(f);
  451. {$else}
  452. findfirst(F,readonly+archive+hidden,info);
  453. res:=(doserror=0);
  454. findclose(Info);
  455. {$endif delphi}
  456. if assigned({$ifndef FPCPROVCAR}@{$endif}do_comment) then
  457. begin
  458. if res then
  459. do_comment(V_Tried,'Searching file '+F+'... found')
  460. else
  461. do_comment(V_Tried,'Searching file '+F+'... not found');
  462. end;
  463. FileExists:=res;
  464. end;
  465. function FileExistsNonCase(const path,fn:string;var foundfile:string):boolean;
  466. var
  467. fn2 : string;
  468. begin
  469. result:=false;
  470. if source_info.files_case_relevent then
  471. begin
  472. {
  473. Search order for case sensitive systems:
  474. 1. NormalCase
  475. 2. lowercase
  476. 3. UPPERCASE
  477. }
  478. FoundFile:=path+fn;
  479. If FileExists(FoundFile) then
  480. begin
  481. result:=true;
  482. exit;
  483. end;
  484. fn2:=Lower(fn);
  485. if fn2<>fn then
  486. begin
  487. FoundFile:=path+fn2;
  488. If FileExists(FoundFile) then
  489. begin
  490. result:=true;
  491. exit;
  492. end;
  493. end;
  494. fn2:=Upper(fn);
  495. if fn2<>fn then
  496. begin
  497. FoundFile:=path+fn2;
  498. If FileExists(FoundFile) then
  499. begin
  500. result:=true;
  501. exit;
  502. end;
  503. end;
  504. end
  505. else
  506. begin
  507. { None case sensitive only lowercase }
  508. FoundFile:=path+Lower(fn);
  509. If FileExists(FoundFile) then
  510. begin
  511. result:=true;
  512. exit;
  513. end;
  514. end;
  515. { Set foundfile to something usefull }
  516. FoundFile:=fn;
  517. end;
  518. Function PathExists ( F : String) : Boolean;
  519. Var
  520. FF : file;
  521. A: word;
  522. I: longint;
  523. begin
  524. if F = '' then
  525. begin
  526. PathExists := true;
  527. exit;
  528. end;
  529. F := FExpand (F);
  530. I := Pos (DriveSeparator, F);
  531. if (F [Length (F)] = DirectorySeparator)
  532. and (((I = 0) and (Length (F) > 1)) or (I <> Length (F) - 1))
  533. then
  534. Delete (F, Length (F), 1);
  535. Assign (FF, FExpand (F));
  536. GetFAttr (FF, A);
  537. PathExists := (DosError = 0) and (A and Directory = Directory);
  538. end;
  539. Function RemoveFile(const f:string):boolean;
  540. var
  541. g : file;
  542. begin
  543. assign(g,f);
  544. {$I-}
  545. erase(g);
  546. {$I+}
  547. RemoveFile:=(ioresult=0);
  548. end;
  549. Function RemoveDir(d:string):boolean;
  550. begin
  551. if d[length(d)]=source_info.DirSep then
  552. Delete(d,length(d),1);
  553. {$I-}
  554. rmdir(d);
  555. {$I+}
  556. RemoveDir:=(ioresult=0);
  557. end;
  558. Function SplitPath(const s:string):string;
  559. var
  560. i : longint;
  561. begin
  562. i:=Length(s);
  563. while (i>0) and not(s[i] in ['/','\']) do
  564. dec(i);
  565. SplitPath:=Copy(s,1,i);
  566. end;
  567. Function SplitFileName(const s:string):string;
  568. var
  569. p : dirstr;
  570. n : namestr;
  571. e : extstr;
  572. begin
  573. FSplit(s,p,n,e);
  574. SplitFileName:=n+e;
  575. end;
  576. Function SplitName(const s:string):string;
  577. var
  578. i,j : longint;
  579. begin
  580. i:=Length(s);
  581. j:=Length(s);
  582. while (i>0) and not(s[i] in ['/','\']) do
  583. dec(i);
  584. while (j>0) and (s[j]<>'.') do
  585. dec(j);
  586. if j<=i then
  587. j:=255;
  588. SplitName:=Copy(s,i+1,j-(i+1));
  589. end;
  590. Function SplitExtension(Const HStr:String):String;
  591. var
  592. j : longint;
  593. begin
  594. j:=length(Hstr);
  595. while (j>0) and (Hstr[j]<>'.') do
  596. begin
  597. if hstr[j]=source_info.DirSep then
  598. j:=0
  599. else
  600. dec(j);
  601. end;
  602. if j=0 then
  603. j:=254;
  604. SplitExtension:=Copy(Hstr,j,255);
  605. end;
  606. Function AddExtension(Const HStr,ext:String):String;
  607. begin
  608. if (Ext<>'') and (SplitExtension(HStr)='') then
  609. AddExtension:=Hstr+Ext
  610. else
  611. AddExtension:=Hstr;
  612. end;
  613. Function ForceExtension(Const HStr,ext:String):String;
  614. var
  615. j : longint;
  616. begin
  617. j:=length(Hstr);
  618. while (j>0) and (Hstr[j]<>'.') do
  619. dec(j);
  620. if j=0 then
  621. j:=255;
  622. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  623. end;
  624. Function FixPath(s:string;allowdot:boolean):string;
  625. var
  626. i : longint;
  627. begin
  628. { Fix separator }
  629. for i:=1 to length(s) do
  630. if s[i] in ['/','\'] then
  631. s[i]:=source_info.DirSep;
  632. { Fix ending / }
  633. if (length(s)>0) and (s[length(s)]<>source_info.DirSep) and
  634. (s[length(s)]<>':') then
  635. s:=s+source_info.DirSep;
  636. { Remove ./ }
  637. if (not allowdot) and (s='.'+source_info.DirSep) then
  638. s:='';
  639. { return }
  640. if source_info.files_case_relevent then
  641. FixPath:=s
  642. else
  643. FixPath:=Lower(s);
  644. end;
  645. {Actually the version in macutils.pp could be used,
  646. but that would not work for crosscompiling, so this is a slightly modified
  647. version of it.}
  648. function TranslatePathToMac (const path: string; mpw: Boolean): string;
  649. function GetVolumeIdentifier: string;
  650. begin
  651. GetVolumeIdentifier := '{Boot}'
  652. (*
  653. if mpw then
  654. GetVolumeIdentifier := '{Boot}'
  655. else
  656. GetVolumeIdentifier := macosBootVolumeName;
  657. *)
  658. end;
  659. var
  660. slashPos, oldpos, newpos, oldlen, maxpos: Longint;
  661. begin
  662. oldpos := 1;
  663. slashPos := Pos('/', path);
  664. if (slashPos <> 0) then {its a unix path}
  665. begin
  666. if slashPos = 1 then
  667. begin {its a full path}
  668. oldpos := 2;
  669. TranslatePathToMac := GetVolumeIdentifier;
  670. end
  671. else {its a partial path}
  672. TranslatePathToMac := ':';
  673. end
  674. else
  675. begin
  676. slashPos := Pos('\', path);
  677. if (slashPos <> 0) then {its a dos path}
  678. begin
  679. if slashPos = 1 then
  680. begin {its a full path, without drive letter}
  681. oldpos := 2;
  682. TranslatePathToMac := GetVolumeIdentifier;
  683. end
  684. else if (Length(path) >= 2) and (path[2] = ':') then {its a full path, with drive letter}
  685. begin
  686. oldpos := 4;
  687. TranslatePathToMac := GetVolumeIdentifier;
  688. end
  689. else {its a partial path}
  690. TranslatePathToMac := ':';
  691. end;
  692. end;
  693. if (slashPos <> 0) then {its a unix or dos path}
  694. begin
  695. {Translate "/../" to "::" , "/./" to ":" and "/" to ":" }
  696. newpos := Length(TranslatePathToMac);
  697. oldlen := Length(path);
  698. SetLength(TranslatePathToMac, newpos + oldlen); {It will be no longer than what is already}
  699. {prepended plus length of path.}
  700. maxpos := Length(TranslatePathToMac); {Get real maxpos, can be short if String is ShortString}
  701. {There is never a slash in the beginning, because either it was an absolute path, and then the}
  702. {drive and slash was removed, or it was a relative path without a preceding slash.}
  703. while oldpos <= oldlen do
  704. begin
  705. {Check if special dirs, ./ or ../ }
  706. if path[oldPos] = '.' then
  707. if (oldpos + 1 <= oldlen) and (path[oldPos + 1] = '.') then
  708. begin
  709. if (oldpos + 2 > oldlen) or (path[oldPos + 2] in ['/', '\']) then
  710. begin
  711. {It is "../" or ".." translates to ":" }
  712. if newPos = maxPos then
  713. begin {Shouldn't actually happen, but..}
  714. Exit('');
  715. end;
  716. newPos := newPos + 1;
  717. TranslatePathToMac[newPos] := ':';
  718. oldPos := oldPos + 3;
  719. continue; {Start over again}
  720. end;
  721. end
  722. else if (oldpos + 1 > oldlen) or (path[oldPos + 1] in ['/', '\']) then
  723. begin
  724. {It is "./" or "." ignor it }
  725. oldPos := oldPos + 2;
  726. continue; {Start over again}
  727. end;
  728. {Collect file or dir name}
  729. while (oldpos <= oldlen) and not (path[oldPos] in ['/', '\']) do
  730. begin
  731. if newPos = maxPos then
  732. begin {Shouldn't actually happen, but..}
  733. Exit('');
  734. end;
  735. newPos := newPos + 1;
  736. TranslatePathToMac[newPos] := path[oldPos];
  737. oldPos := oldPos + 1;
  738. end;
  739. {When we come here there is either a slash or we are at the end.}
  740. if (oldpos <= oldlen) then
  741. begin
  742. if newPos = maxPos then
  743. begin {Shouldn't actually happen, but..}
  744. Exit('');
  745. end;
  746. newPos := newPos + 1;
  747. TranslatePathToMac[newPos] := ':';
  748. oldPos := oldPos + 1;
  749. end;
  750. end;
  751. SetLength(TranslatePathToMac, newpos);
  752. end
  753. else if (path = '.') then
  754. TranslatePathToMac := ':'
  755. else if (path = '..') then
  756. TranslatePathToMac := '::'
  757. else
  758. TranslatePathToMac := path; {its a mac path}
  759. end;
  760. function FixFileName(const s:string):string;
  761. var
  762. i : longint;
  763. begin
  764. if source_info.system = system_powerpc_MACOS then
  765. FixFileName:= TranslatePathToMac(s, true)
  766. else if source_info.files_case_relevent then
  767. begin
  768. for i:=1 to length(s) do
  769. begin
  770. case s[i] of
  771. '/','\' :
  772. FixFileName[i]:=source_info.dirsep;
  773. else
  774. FixFileName[i]:=s[i];
  775. end;
  776. end;
  777. FixFileName[0]:=s[0];
  778. end
  779. else
  780. begin
  781. for i:=1 to length(s) do
  782. begin
  783. case s[i] of
  784. '/','\' :
  785. FixFileName[i]:=source_info.dirsep;
  786. 'A'..'Z' :
  787. FixFileName[i]:=char(byte(s[i])+32);
  788. else
  789. FixFileName[i]:=s[i];
  790. end;
  791. end;
  792. FixFileName[0]:=s[0];
  793. end;
  794. end;
  795. Function TargetFixPath(s:string;allowdot:boolean):string;
  796. var
  797. i : longint;
  798. begin
  799. { Fix separator }
  800. for i:=1 to length(s) do
  801. if s[i] in ['/','\'] then
  802. s[i]:=target_info.DirSep;
  803. { Fix ending / }
  804. if (length(s)>0) and (s[length(s)]<>target_info.DirSep) and
  805. (s[length(s)]<>':') then
  806. s:=s+target_info.DirSep;
  807. { Remove ./ }
  808. if (not allowdot) and (s='.'+target_info.DirSep) then
  809. s:='';
  810. { return }
  811. if target_info.files_case_relevent then
  812. TargetFixPath:=s
  813. else
  814. TargetFixPath:=Lower(s);
  815. end;
  816. function TargetFixFileName(const s:string):string;
  817. var
  818. i : longint;
  819. begin
  820. if target_info.system = system_powerpc_MACOS then
  821. TargetFixFileName:= TranslatePathToMac(s, true)
  822. else if target_info.files_case_relevent then
  823. begin
  824. for i:=1 to length(s) do
  825. begin
  826. case s[i] of
  827. '/','\' :
  828. TargetFixFileName[i]:=target_info.dirsep;
  829. else
  830. TargetFixFileName[i]:=s[i];
  831. end;
  832. end;
  833. TargetFixFileName[0]:=s[0];
  834. end
  835. else
  836. begin
  837. for i:=1 to length(s) do
  838. begin
  839. case s[i] of
  840. '/','\' :
  841. TargetFixFileName[i]:=target_info.dirsep;
  842. 'A'..'Z' :
  843. TargetFixFileName[i]:=char(byte(s[i])+32);
  844. else
  845. TargetFixFileName[i]:=s[i];
  846. end;
  847. end;
  848. TargetFixFileName[0]:=s[0];
  849. end;
  850. end;
  851. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  852. var
  853. i : longint;
  854. begin
  855. i:=pos(' ',s);
  856. if i>0 then
  857. begin
  858. bstr:=Copy(s,1,i-1);
  859. cstr:=Copy(s,i+1,length(s)-i);
  860. end
  861. else
  862. begin
  863. bstr:=s;
  864. cstr:='';
  865. end;
  866. end;
  867. procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
  868. begin
  869. AddPath('',s,AddFirst);
  870. end;
  871. procedure TSearchPathList.AddPath(SrcPath,s:string;addfirst:boolean);
  872. var
  873. j : longint;
  874. hs,hsd,
  875. CurrentDir,
  876. currPath : string;
  877. subdirfound : boolean;
  878. dir : searchrec;
  879. hp : TStringListItem;
  880. procedure AddCurrPath;
  881. begin
  882. if addfirst then
  883. begin
  884. Remove(currPath);
  885. Insert(currPath);
  886. end
  887. else
  888. begin
  889. { Check if already in path, then we don't add it }
  890. hp:=Find(currPath);
  891. if not assigned(hp) then
  892. Concat(currPath);
  893. end;
  894. end;
  895. begin
  896. if s='' then
  897. exit;
  898. { Support default macro's }
  899. DefaultReplacements(s);
  900. { get current dir }
  901. CurrentDir:=GetCurrentDir;
  902. repeat
  903. { get currpath }
  904. if addfirst then
  905. begin
  906. j:=length(s);
  907. while (j>0) and (s[j]<>';') do
  908. dec(j);
  909. currPath:= TrimSpace(Copy(s,j+1,length(s)-j));
  910. DePascalQuote(currPath);
  911. currPath:=FixPath(currPath,false);
  912. if j=0 then
  913. s:=''
  914. else
  915. System.Delete(s,j,length(s)-j+1);
  916. end
  917. else
  918. begin
  919. j:=Pos(';',s);
  920. if j=0 then
  921. j:=255;
  922. currPath:= TrimSpace(Copy(s,1,j-1));
  923. DePascalQuote(currPath);
  924. currPath:=SrcPath+FixPath(currPath,false);
  925. System.Delete(s,1,j);
  926. end;
  927. { fix pathname }
  928. if currPath='' then
  929. currPath:= CurDirRelPath(source_info)
  930. else
  931. begin
  932. currPath:=FixPath(FExpand(currPath),false);
  933. if (CurrentDir<>'') and (Copy(currPath,1,length(CurrentDir))=CurrentDir) then
  934. begin
  935. {$ifdef AMIGA}
  936. currPath:= CurrentDir+Copy(currPath,length(CurrentDir)+1,255);
  937. {$else}
  938. currPath:= CurDirRelPath(source_info)+Copy(currPath,length(CurrentDir)+1,255);
  939. {$endif}
  940. end;
  941. end;
  942. { wildcard adding ? }
  943. if pos('*',currpath)>0 then
  944. begin
  945. if currpath[length(currpath)]=source_info.dirsep then
  946. hs:=Copy(currpath,1,length(currPath)-1)
  947. else
  948. hs:=currpath;
  949. hsd:=SplitPath(hs);
  950. findfirst(hs,directory,dir);
  951. subdirfound:=false;
  952. while doserror=0 do
  953. begin
  954. if (dir.name<>'.') and
  955. (dir.name<>'..') and
  956. ((dir.attr and directory)<>0) then
  957. begin
  958. subdirfound:=true;
  959. currpath:=hsd+dir.name+source_info.dirsep;
  960. hp:=Find(currPath);
  961. if not assigned(hp) then
  962. AddCurrPath;
  963. end;
  964. findnext(dir);
  965. if not subdirfound then
  966. WarnNonExistingPath(currpath);
  967. end;
  968. FindClose(dir);
  969. end
  970. else
  971. begin
  972. if PathExists(currpath) then
  973. AddCurrPath
  974. else
  975. WarnNonExistingPath(currpath);
  976. end;
  977. until (s='');
  978. end;
  979. procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
  980. var
  981. s : string;
  982. hl : TSearchPathList;
  983. hp,hp2 : TStringListItem;
  984. begin
  985. if list.empty then
  986. exit;
  987. { create temp and reverse the list }
  988. if addfirst then
  989. begin
  990. hl:=TSearchPathList.Create;
  991. hp:=TStringListItem(list.first);
  992. while assigned(hp) do
  993. begin
  994. hl.insert(hp.Str);
  995. hp:=TStringListItem(hp.next);
  996. end;
  997. while not hl.empty do
  998. begin
  999. s:=hl.GetFirst;
  1000. Remove(s);
  1001. Insert(s);
  1002. end;
  1003. hl.Free;
  1004. end
  1005. else
  1006. begin
  1007. hp:=TStringListItem(list.first);
  1008. while assigned(hp) do
  1009. begin
  1010. hp2:=Find(hp.Str);
  1011. { Check if already in path, then we don't add it }
  1012. if not assigned(hp2) then
  1013. Concat(hp.Str);
  1014. hp:=TStringListItem(hp.next);
  1015. end;
  1016. end;
  1017. end;
  1018. function TSearchPathList.FindFile(const f : string;var foundfile:string):boolean;
  1019. Var
  1020. p : TStringListItem;
  1021. begin
  1022. FindFile:=false;
  1023. p:=TStringListItem(first);
  1024. while assigned(p) do
  1025. begin
  1026. result:=FileExistsNonCase(p.Str,f,FoundFile);
  1027. if result then
  1028. exit;
  1029. p:=TStringListItem(p.next);
  1030. end;
  1031. { Return original filename if not found }
  1032. FoundFile:=f;
  1033. end;
  1034. Function GetFileTime ( Var F : File) : Longint;
  1035. Var
  1036. {$ifdef hasunix}
  1037. info: Stat;
  1038. {$endif}
  1039. L : longint;
  1040. begin
  1041. {$ifdef hasunix}
  1042. {$IFDEF havelinuxrtl10}
  1043. FStat (F,Info);
  1044. L:=Info.Mtime;
  1045. {$ELSE}
  1046. FPFStat (F,Info);
  1047. L:=Info.st_Mtime;
  1048. {$ENDIF}
  1049. {$else}
  1050. GetFTime(f,l);
  1051. {$endif}
  1052. GetFileTime:=L;
  1053. end;
  1054. Function GetNamedFileTime (Const F : String) : Longint;
  1055. begin
  1056. GetNamedFileTime:=do_getnamedfiletime(F);
  1057. end;
  1058. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  1059. Var
  1060. singlepathstring : string;
  1061. i : longint;
  1062. begin
  1063. {$ifdef Unix}
  1064. for i:=1 to length(path) do
  1065. if path[i]=':' then
  1066. path[i]:=';';
  1067. {$endif Unix}
  1068. FindFile:=false;
  1069. repeat
  1070. i:=pos(';',path);
  1071. if i=0 then
  1072. i:=256;
  1073. singlepathstring:=FixPath(copy(path,1,i-1),false);
  1074. delete(path,1,i);
  1075. result:=FileExistsNonCase(singlepathstring,f,FoundFile);
  1076. if result then
  1077. exit;
  1078. until path='';
  1079. FoundFile:=f;
  1080. end;
  1081. function FindFilePchar(const f : string;path : pchar;var foundfile:string):boolean;
  1082. Var
  1083. singlepathstring : string;
  1084. startpc,pc : pchar;
  1085. sepch : char;
  1086. begin
  1087. {$ifdef Unix}
  1088. sepch:=':';
  1089. {$else}
  1090. {$ifdef macos}
  1091. sepch:=',';
  1092. {$else}
  1093. sepch:=';';
  1094. {$endif macos}
  1095. {$endif Unix}
  1096. FindFilePchar:=false;
  1097. pc:=path;
  1098. repeat
  1099. startpc:=pc;
  1100. while (pc^<>sepch) and (pc^<>';') and (pc^<>#0) do
  1101. inc(pc);
  1102. move(startpc^,singlepathstring[1],pc-startpc);
  1103. singlepathstring[0]:=char(longint(pc-startpc));
  1104. singlepathstring:=FixPath(singlepathstring,false);
  1105. result:=FileExistsNonCase(singlepathstring,f,FoundFile);
  1106. if result then
  1107. exit;
  1108. if (pc^=#0) then
  1109. break;
  1110. inc(pc);
  1111. until false;
  1112. foundfile:=f;
  1113. end;
  1114. function FindExe(const bin:string;var foundfile:string):boolean;
  1115. var
  1116. p : pchar;
  1117. found : boolean;
  1118. begin
  1119. found:=FindFile(FixFileName(AddExtension(bin,source_info.exeext)),'.;'+exepath,foundfile);
  1120. if not found then
  1121. begin
  1122. {$ifdef macos}
  1123. p:=GetEnvPchar('Commands');
  1124. {$else}
  1125. p:=GetEnvPchar('PATH');
  1126. {$endif}
  1127. found:=FindFilePChar(FixFileName(AddExtension(bin,source_info.exeext)),p,foundfile);
  1128. FreeEnvPChar(p);
  1129. end;
  1130. FindExe:=found;
  1131. end;
  1132. function GetShortName(const n:string):string;
  1133. {$ifdef win32}
  1134. var
  1135. hs,hs2 : string;
  1136. i : longint;
  1137. {$endif}
  1138. {$ifdef go32v2}
  1139. var
  1140. hs : string;
  1141. {$endif}
  1142. {$ifdef watcom}
  1143. var
  1144. hs : string;
  1145. {$endif}
  1146. begin
  1147. GetShortName:=n;
  1148. {$ifdef win32}
  1149. hs:=n+#0;
  1150. i:=Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
  1151. if (i>0) and (i<=high(hs2)) then
  1152. begin
  1153. hs2[0]:=chr(strlen(@hs2[1]));
  1154. GetShortName:=hs2;
  1155. end;
  1156. {$endif}
  1157. {$ifdef go32v2}
  1158. hs:=n;
  1159. if Dos.GetShortName(hs) then
  1160. GetShortName:=hs;
  1161. {$endif}
  1162. {$ifdef watcom}
  1163. hs:=n;
  1164. if Dos.GetShortName(hs) then
  1165. GetShortName:=hs;
  1166. {$endif}
  1167. end;
  1168. {****************************************************************************
  1169. OS Dependent things
  1170. ****************************************************************************}
  1171. function GetEnvPChar(const envname:string):pchar;
  1172. {$ifdef win32}
  1173. var
  1174. s : string;
  1175. i,len : longint;
  1176. hp,p,p2 : pchar;
  1177. {$endif}
  1178. begin
  1179. {$ifdef hasunix}
  1180. GetEnvPchar:={$ifdef havelinuxrtl10}Linux.getenv{$else}BaseUnix.fpGetEnv{$endif}(envname);
  1181. {$define GETENVOK}
  1182. {$endif}
  1183. {$ifdef win32}
  1184. GetEnvPchar:=nil;
  1185. p:=GetEnvironmentStrings;
  1186. hp:=p;
  1187. while hp^<>#0 do
  1188. begin
  1189. s:=strpas(hp);
  1190. i:=pos('=',s);
  1191. len:=strlen(hp);
  1192. if upper(copy(s,1,i-1))=upper(envname) then
  1193. begin
  1194. GetMem(p2,len-length(envname));
  1195. Move(hp[i],p2^,len-length(envname));
  1196. GetEnvPchar:=p2;
  1197. break;
  1198. end;
  1199. { next string entry}
  1200. hp:=hp+len+1;
  1201. end;
  1202. FreeEnvironmentStrings(p);
  1203. {$define GETENVOK}
  1204. {$endif}
  1205. {$ifdef os2}
  1206. GetEnvPChar := Dos.GetEnvPChar (EnvName);
  1207. {$define GETENVOK}
  1208. {$endif}
  1209. {$ifdef GETENVOK}
  1210. {$undef GETENVOK}
  1211. {$else}
  1212. GetEnvPchar:=StrPNew({$ifdef delphi}DMisc{$else}Dos{$endif}.Getenv(envname));
  1213. {$endif}
  1214. end;
  1215. procedure FreeEnvPChar(p:pchar);
  1216. begin
  1217. {$ifndef hasunix}
  1218. {$ifndef os2}
  1219. StrDispose(p);
  1220. {$endif}
  1221. {$endif}
  1222. end;
  1223. function Shell(const command:string): longint;
  1224. { This is already defined in the linux.ppu for linux, need for the *
  1225. expansion under linux }
  1226. {$ifdef hasunix}
  1227. begin
  1228. result := {$ifdef havelinuxrtl10}Linux{$else}Unix{$endif}.Shell(command);
  1229. end;
  1230. {$else}
  1231. {$ifdef amiga}
  1232. begin
  1233. exec('',command);
  1234. if (doserror <> 0) then
  1235. result := doserror
  1236. else
  1237. result := dosexitcode;
  1238. end;
  1239. {$else}
  1240. var
  1241. comspec : string;
  1242. begin
  1243. comspec:=getenv('COMSPEC');
  1244. Exec(comspec,' /C '+command);
  1245. if (doserror <> 0) then
  1246. result := doserror
  1247. else
  1248. result := dosexitcode;
  1249. end;
  1250. {$endif}
  1251. {$endif}
  1252. {$ifdef CPUI386}
  1253. {$define HASSETFPUEXCEPTIONMASK}
  1254. { later, this should be replaced by the math unit }
  1255. const
  1256. Default8087CW : word = $1332;
  1257. procedure Set8087CW(cw:word);assembler;
  1258. asm
  1259. movw cw,%ax
  1260. movw %ax,default8087cw
  1261. fnclex
  1262. fldcw default8087cw
  1263. end;
  1264. function Get8087CW:word;assembler;
  1265. asm
  1266. pushl $0
  1267. fnstcw (%esp)
  1268. popl %eax
  1269. end;
  1270. procedure SetFPUExceptionMask(const Mask: TFPUExceptionMask);
  1271. var
  1272. CtlWord: Word;
  1273. begin
  1274. CtlWord:=Get8087CW;
  1275. Set8087CW( (CtlWord and $FFC0) or Byte(Longint(Mask)) );
  1276. end;
  1277. {$endif CPUI386}
  1278. {$ifdef CPUX86_64}
  1279. {$define HASSETFPUEXCEPTIONMASK}
  1280. { later, this should be replaced by the math unit }
  1281. const
  1282. Default8087CW : word = $1332;
  1283. procedure Set8087CW(cw:word);assembler;
  1284. asm
  1285. movw cw,%ax
  1286. movw %ax,default8087cw
  1287. fnclex
  1288. fldcw default8087cw
  1289. end;
  1290. function Get8087CW:word;assembler;
  1291. asm
  1292. pushq $0
  1293. fnstcw (%rsp)
  1294. popq %rax
  1295. end;
  1296. procedure SetFPUExceptionMask(const Mask: TFPUExceptionMask);
  1297. var
  1298. CtlWord: Word;
  1299. begin
  1300. CtlWord:=Get8087CW;
  1301. Set8087CW( (CtlWord and $FFC0) or Byte(Longint(Mask)) );
  1302. end;
  1303. {$endif CPUX86_64}
  1304. {$ifdef CPUPOWERPC}
  1305. {$define HASSETFPUEXCEPTIONMASK}
  1306. procedure SetFPUExceptionMask(const Mask: TFPUExceptionMask);
  1307. var
  1308. newmask: record
  1309. case byte of
  1310. 1: (d: double);
  1311. 2: (a,b: cardinal);
  1312. end;
  1313. begin
  1314. { load current control register contents }
  1315. asm
  1316. mffs f0
  1317. stfd f0,newmask.d
  1318. end;
  1319. { invalid operation: bit 24 (big endian, bit 0 = left-most bit) }
  1320. if (exInvalidOp in mask) then
  1321. newmask.b := newmask.b and not(1 shl (31-24))
  1322. else
  1323. newmask.b := newmask.b or (1 shl (31-24));
  1324. { denormals can not cause exceptions on the PPC }
  1325. { zero divide: bit 27 }
  1326. if (exZeroDivide in mask) then
  1327. newmask.b := newmask.b and not(1 shl (31-27))
  1328. else
  1329. newmask.b := newmask.b or (1 shl (31-27));
  1330. { overflow: bit 25 }
  1331. if (exOverflow in mask) then
  1332. newmask.b := newmask.b and not(1 shl (31-25))
  1333. else
  1334. newmask.b := newmask.b or (1 shl (31-25));
  1335. { underflow: bit 26 }
  1336. if (exUnderflow in mask) then
  1337. newmask.b := newmask.b and not(1 shl (31-26))
  1338. else
  1339. newmask.b := newmask.b or (1 shl (31-26));
  1340. { Precision (inexact result): bit 28 }
  1341. if (exPrecision in mask) then
  1342. newmask.b := newmask.b and not(1 shl (31-28))
  1343. else
  1344. newmask.b := newmask.b or (1 shl (31-28));
  1345. { update control register contents }
  1346. asm
  1347. lfd f0, newmask.d
  1348. mtfsf 255,f0
  1349. end;
  1350. end;
  1351. {$endif CPUPOWERPC}
  1352. {$ifdef CPUSPARC}
  1353. {$define HASSETFPUEXCEPTIONMASK}
  1354. procedure SetFPUExceptionMask(const Mask: TFPUExceptionMask);
  1355. var
  1356. fsr : cardinal;
  1357. begin
  1358. { load current control register contents }
  1359. asm
  1360. st %fsr,fsr
  1361. end;
  1362. { invalid operation: bit 27 }
  1363. if (exInvalidOp in mask) then
  1364. fsr:=fsr and not(1 shl 27)
  1365. else
  1366. fsr:=fsr or (1 shl 27);
  1367. { zero divide: bit 24 }
  1368. if (exZeroDivide in mask) then
  1369. fsr:=fsr and not(1 shl 24)
  1370. else
  1371. fsr:=fsr or (1 shl 24);
  1372. { overflow: bit 26 }
  1373. if (exOverflow in mask) then
  1374. fsr:=fsr and not(1 shl 26)
  1375. else
  1376. fsr:=fsr or (1 shl 26);
  1377. { underflow: bit 25 }
  1378. if (exUnderflow in mask) then
  1379. fsr:=fsr and not(1 shl 25)
  1380. else
  1381. fsr:=fsr or (1 shl 25);
  1382. { Precision (inexact result): bit 23 }
  1383. if (exPrecision in mask) then
  1384. fsr:=fsr and not(1 shl 23)
  1385. else
  1386. fsr:=fsr or (1 shl 23);
  1387. { update control register contents }
  1388. asm
  1389. ld fsr,%fsr
  1390. end;
  1391. end;
  1392. {$endif CPUSPARC}
  1393. {$ifndef HASSETFPUEXCEPTIONMASK}
  1394. function SetFPUExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask;
  1395. begin
  1396. end;
  1397. {$endif HASSETFPUEXCEPTIONMASK}
  1398. function is_number_float(d : double) : boolean;
  1399. var
  1400. bytearray : array[0..7] of byte;
  1401. begin
  1402. move(d,bytearray,8);
  1403. { only 1.1 save, 1.0.x will use always little endian }
  1404. {$ifdef FPC_BIG_ENDIAN}
  1405. result:=((bytearray[0] and $7f)<>$7f) or ((bytearray[1] and $f0)<>$f0);
  1406. {$else FPC_BIG_ENDIAN}
  1407. result:=((bytearray[7] and $7f)<>$7f) or ((bytearray[6] and $f0)<>$f0);
  1408. {$endif FPC_BIG_ENDIAN}
  1409. end;
  1410. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  1411. var
  1412. b : boolean;
  1413. begin
  1414. b:=true;
  1415. if s='DEFAULT' then
  1416. aktmodeswitches:=initmodeswitches
  1417. else
  1418. if s='DELPHI' then
  1419. aktmodeswitches:=delphimodeswitches
  1420. else
  1421. if s='TP' then
  1422. aktmodeswitches:=tpmodeswitches
  1423. else
  1424. if s='FPC' then
  1425. aktmodeswitches:=fpcmodeswitches
  1426. else
  1427. if s='OBJFPC' then
  1428. aktmodeswitches:=objfpcmodeswitches
  1429. else
  1430. if s='GPC' then
  1431. aktmodeswitches:=gpcmodeswitches
  1432. else
  1433. if s='MACPAS' then
  1434. aktmodeswitches:=macmodeswitches
  1435. else
  1436. b:=false;
  1437. if b and changeInit then
  1438. initmodeswitches := aktmodeswitches;
  1439. if b then
  1440. begin
  1441. { turn ansistrings on by default ? }
  1442. if (m_delphi in aktmodeswitches) then
  1443. begin
  1444. include(aktlocalswitches,cs_ansistrings);
  1445. if changeinit then
  1446. include(initlocalswitches,cs_ansistrings);
  1447. end
  1448. else
  1449. begin
  1450. exclude(aktlocalswitches,cs_ansistrings);
  1451. if changeinit then
  1452. exclude(initlocalswitches,cs_ansistrings);
  1453. end;
  1454. { Default enum packing for delphi/tp7 }
  1455. if (m_tp7 in aktmodeswitches) or
  1456. (m_delphi in aktmodeswitches) then
  1457. aktpackenum:=1
  1458. else
  1459. aktpackenum:=4;
  1460. if changeinit then
  1461. initpackenum:=aktpackenum;
  1462. {$ifdef i386}
  1463. { Default to intel assembler for delphi/tp7 on i386 }
  1464. if (m_delphi in aktmodeswitches) or
  1465. (m_tp7 in aktmodeswitches) then
  1466. aktasmmode:=asmmode_i386_intel;
  1467. if changeinit then
  1468. initasmmode:=aktasmmode;
  1469. {$endif i386}
  1470. end;
  1471. SetCompileMode:=b;
  1472. end;
  1473. function SetAktProcCall(const s:string; changeInit:boolean):boolean;
  1474. const
  1475. DefProcCallName : array[tproccalloption] of string[12] = ('',
  1476. 'CDECL',
  1477. 'CPPDECL',
  1478. '', { compilerproc }
  1479. 'FAR16',
  1480. 'FPCCALL',
  1481. 'INLINE',
  1482. '', { internproc }
  1483. '', { syscall }
  1484. 'PASCAL',
  1485. 'REGISTER',
  1486. 'SAFECALL',
  1487. 'STDCALL',
  1488. 'SOFTFLOAT'
  1489. );
  1490. var
  1491. t : tproccalloption;
  1492. begin
  1493. result:=false;
  1494. for t:=low(tproccalloption) to high(tproccalloption) do
  1495. if DefProcCallName[t]=s then
  1496. begin
  1497. AktDefProcCall:=t;
  1498. result:=true;
  1499. break;
  1500. end;
  1501. if changeinit then
  1502. InitDefProcCall:=AktDefProcCall;
  1503. end;
  1504. function SetProcessor(const s:string; changeInit: boolean):boolean;
  1505. var
  1506. t : tprocessors;
  1507. begin
  1508. SetProcessor:=false;
  1509. for t:=low(tprocessors) to high(tprocessors) do
  1510. if processorsstr[t]=s then
  1511. begin
  1512. aktspecificoptprocessor:=t;
  1513. SetProcessor:=true;
  1514. break;
  1515. end;
  1516. if changeinit then
  1517. initspecificoptprocessor:=aktspecificoptprocessor;
  1518. end;
  1519. function SetFpuType(const s:string; changeInit: boolean):boolean;
  1520. var
  1521. t : tfputype;
  1522. begin
  1523. SetFpuType:=false;
  1524. for t:=low(tfputype) to high(tfputype) do
  1525. if fputypestr[t]=s then
  1526. begin
  1527. aktfputype:=t;
  1528. SetFpuType:=true;
  1529. break;
  1530. end;
  1531. if changeinit then
  1532. initfputype:=aktfputype;
  1533. end;
  1534. { '('D1:'00000000-'D2:'0000-'D3:'0000-'D4:'0000-000000000000)' }
  1535. function string2guid(const s: string; var GUID: TGUID): boolean;
  1536. function ishexstr(const hs: string): boolean;
  1537. var
  1538. i: integer;
  1539. begin
  1540. ishexstr:=false;
  1541. for i:=1 to Length(hs) do begin
  1542. if not (hs[i] in ['0'..'9','A'..'F','a'..'f']) then
  1543. exit;
  1544. end;
  1545. ishexstr:=true;
  1546. end;
  1547. function hexstr2longint(const hexs: string): longint;
  1548. var
  1549. i: integer;
  1550. rl: longint;
  1551. begin
  1552. rl:=0;
  1553. for i:=1 to length(hexs) do begin
  1554. rl:=rl shl 4;
  1555. case hexs[i] of
  1556. '0'..'9' : inc(rl,ord(hexs[i])-ord('0'));
  1557. 'A'..'F' : inc(rl,ord(hexs[i])-ord('A')+10);
  1558. 'a'..'f' : inc(rl,ord(hexs[i])-ord('a')+10);
  1559. end
  1560. end;
  1561. hexstr2longint:=rl;
  1562. end;
  1563. var
  1564. i: integer;
  1565. begin
  1566. if (Length(s)=38) and (s[1]='{') and (s[38]='}') and
  1567. (s[10]='-') and (s[15]='-') and (s[20]='-') and (s[25]='-') and
  1568. ishexstr(copy(s,2,8)) and ishexstr(copy(s,11,4)) and
  1569. ishexstr(copy(s,16,4)) and ishexstr(copy(s,21,4)) and
  1570. ishexstr(copy(s,26,12)) then begin
  1571. GUID.D1:=dword(hexstr2longint(copy(s,2,8)));
  1572. { these values are arealdy in the correct range (4 chars = word) }
  1573. GUID.D2:=word(hexstr2longint(copy(s,11,4)));
  1574. GUID.D3:=word(hexstr2longint(copy(s,16,4)));
  1575. for i:=0 to 1 do
  1576. GUID.D4[i]:=byte(hexstr2longint(copy(s,21+i*2,2)));
  1577. for i:=2 to 7 do
  1578. GUID.D4[i]:=byte(hexstr2longint(copy(s,22+i*2,2)));
  1579. string2guid:=true;
  1580. end
  1581. else
  1582. string2guid:=false;
  1583. end;
  1584. function guid2string(const GUID: TGUID): string;
  1585. function long2hex(l, len: longint): string;
  1586. const
  1587. hextbl: array[0..15] of char = '0123456789ABCDEF';
  1588. var
  1589. rs: string;
  1590. i: integer;
  1591. begin
  1592. rs[0]:=chr(len);
  1593. for i:=len downto 1 do begin
  1594. rs[i]:=hextbl[l and $F];
  1595. l:=l shr 4;
  1596. end;
  1597. long2hex:=rs;
  1598. end;
  1599. begin
  1600. guid2string:=
  1601. '{'+long2hex(GUID.D1,8)+
  1602. '-'+long2hex(GUID.D2,4)+
  1603. '-'+long2hex(GUID.D3,4)+
  1604. '-'+long2hex(GUID.D4[0],2)+long2hex(GUID.D4[1],2)+
  1605. '-'+long2hex(GUID.D4[2],2)+long2hex(GUID.D4[3],2)+
  1606. long2hex(GUID.D4[4],2)+long2hex(GUID.D4[5],2)+
  1607. long2hex(GUID.D4[6],2)+long2hex(GUID.D4[7],2)+
  1608. '}';
  1609. end;
  1610. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  1611. var
  1612. tok : string;
  1613. vstr : string;
  1614. l : longint;
  1615. code : integer;
  1616. b : talignmentinfo;
  1617. begin
  1618. UpdateAlignmentStr:=true;
  1619. uppervar(s);
  1620. fillchar(b,sizeof(b),0);
  1621. repeat
  1622. tok:=GetToken(s,'=');
  1623. if tok='' then
  1624. break;
  1625. vstr:=GetToken(s,',');
  1626. val(vstr,l,code);
  1627. if tok='PROC' then
  1628. b.procalign:=l
  1629. else if tok='JUMP' then
  1630. b.jumpalign:=l
  1631. else if tok='LOOP' then
  1632. b.loopalign:=l
  1633. else if tok='CONSTMIN' then
  1634. b.constalignmin:=l
  1635. else if tok='CONSTMAX' then
  1636. b.constalignmax:=l
  1637. else if tok='VARMIN' then
  1638. b.varalignmin:=l
  1639. else if tok='VARMAX' then
  1640. b.varalignmax:=l
  1641. else if tok='LOCALMIN' then
  1642. b.localalignmin:=l
  1643. else if tok='LOCALMAX' then
  1644. b.localalignmax:=l
  1645. else if tok='RECORDMIN' then
  1646. b.recordalignmin:=l
  1647. else if tok='RECORDMAX' then
  1648. b.recordalignmax:=l
  1649. else { Error }
  1650. UpdateAlignmentStr:=false;
  1651. until false;
  1652. UpdateAlignment(a,b);
  1653. end;
  1654. function var_align(siz: longint): longint;
  1655. begin
  1656. siz := size_2_align(siz);
  1657. var_align := used_align(siz,aktalignment.varalignmin,aktalignment.varalignmax);
  1658. end;
  1659. function const_align(siz: longint): longint;
  1660. begin
  1661. siz := size_2_align(siz);
  1662. const_align := used_align(siz,aktalignment.constalignmin,aktalignment.constalignmax);
  1663. end;
  1664. {****************************************************************************
  1665. Init
  1666. ****************************************************************************}
  1667. {$ifdef unix}
  1668. {$define need_path_search}
  1669. {$endif unix}
  1670. {$ifdef os2}
  1671. {$define need_path_search}
  1672. {$endif os2}
  1673. procedure get_exepath;
  1674. var
  1675. hs1 : namestr;
  1676. hs2 : extstr;
  1677. {$ifdef need_path_search}
  1678. p : pchar;
  1679. {$endif need_path_search}
  1680. begin
  1681. {$ifdef delphi}
  1682. exepath:=dmisc.getenv('PPC_EXEC_PATH');
  1683. {$else delphi}
  1684. exepath:=dos.getenv('PPC_EXEC_PATH');
  1685. {$endif delphi}
  1686. if exepath='' then
  1687. fsplit(FixFileName(system.paramstr(0)),exepath,hs1,hs2);
  1688. {$ifdef need_path_search}
  1689. if exepath='' then
  1690. begin
  1691. if pos(source_info.exeext,hs1) <>
  1692. (length(hs1) - length(source_info.exeext)+1) then
  1693. hs1 := hs1 + source_info.exeext;
  1694. p:=GetEnvPchar('PATH');
  1695. FindFilePChar(hs1,p,exepath);
  1696. FreeEnvPChar(p);
  1697. exepath:=SplitPath(exepath);
  1698. end;
  1699. {$endif need_path_search}
  1700. exepath:=FixPath(exepath,false);
  1701. end;
  1702. procedure DoneGlobals;
  1703. begin
  1704. initdefines.free;
  1705. if assigned(DLLImageBase) then
  1706. StringDispose(DLLImageBase);
  1707. librarysearchpath.Free;
  1708. unitsearchpath.Free;
  1709. objectsearchpath.Free;
  1710. includesearchpath.Free;
  1711. end;
  1712. procedure InitGlobals;
  1713. begin
  1714. get_exepath;
  1715. { reset globals }
  1716. do_build:=false;
  1717. do_release:=false;
  1718. do_make:=true;
  1719. compile_level:=0;
  1720. DLLsource:=false;
  1721. inlining_procedure:=false;
  1722. resolving_forward:=false;
  1723. make_ref:=false;
  1724. LinkTypeSetExplicitly:=false;
  1725. { Output }
  1726. OutputFile:='';
  1727. OutputPrefix:=Nil;
  1728. OutputSuffix:=Nil;
  1729. OutputExtension:='';
  1730. OutputExeDir:='';
  1731. OutputUnitDir:='';
  1732. { Utils directory }
  1733. utilsdirectory:='';
  1734. utilsprefix:='';
  1735. cshared:=false;
  1736. rlinkpath:='';
  1737. { Search Paths }
  1738. librarysearchpath:=TSearchPathList.Create;
  1739. unitsearchpath:=TSearchPathList.Create;
  1740. includesearchpath:=TSearchPathList.Create;
  1741. objectsearchpath:=TSearchPathList.Create;
  1742. { Def file }
  1743. usewindowapi:=false;
  1744. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1745. DescriptionSetExplicity:=false;
  1746. dllversion:='';
  1747. dllmajor:=1;
  1748. dllminor:=0;
  1749. dllrevision:=0;
  1750. nwscreenname := '';
  1751. nwthreadname := '';
  1752. nwcopyright := '';
  1753. UseDeffileForExports:=false;
  1754. UseDeffileForExportsSetExplicitly:=false;
  1755. RelocSection:=false;
  1756. RelocSectionSetExplicitly:=false;
  1757. LinkTypeSetExplicitly:=false;
  1758. { Init values }
  1759. initmodeswitches:=fpcmodeswitches;
  1760. initlocalswitches:=[cs_check_io,cs_typed_const_writable];
  1761. initmoduleswitches:=[cs_extsyntax,cs_implicit_exceptions];
  1762. initsourcecodepage:='8859-1';
  1763. initglobalswitches:=[cs_check_unit_name,cs_link_static{$ifdef INTERNALLINKER},cs_link_internal,cs_link_map{$endif}];
  1764. initoutputformat:=target_asm.id;
  1765. fillchar(initalignment,sizeof(talignmentinfo),0);
  1766. { might be overridden later }
  1767. initasmmode:=asmmode_standard;
  1768. {$ifdef i386}
  1769. initoptprocessor:=ClassPentium3;
  1770. initspecificoptprocessor:=Class386;
  1771. initfputype:=fpu_x87;
  1772. initpackenum:=4;
  1773. {$IFDEF testvarsets}
  1774. initsetalloc:=0;
  1775. {$ENDIF}
  1776. initasmmode:=asmmode_i386_att;
  1777. {$endif i386}
  1778. {$ifdef m68k}
  1779. initoptprocessor:=MC68020;
  1780. initpackenum:=4;
  1781. {$IFDEF testvarsets}
  1782. initsetalloc:=0;
  1783. {$ENDIF}
  1784. {$endif m68k}
  1785. {$ifdef powerpc}
  1786. initoptprocessor:=PPC604;
  1787. initpackenum:=4;
  1788. {$IFDEF testvarsets}
  1789. initsetalloc:=0;
  1790. {$ENDIF}
  1791. initfputype:=fpu_standard;
  1792. {$endif powerpc}
  1793. {$ifdef sparc}
  1794. initoptprocessor:=SPARC_V8;
  1795. initpackenum:=4;
  1796. {$IFDEF testvarsets}
  1797. initsetalloc:=0;
  1798. {$ENDIF}
  1799. {$endif sparc}
  1800. {$ifdef arm}
  1801. initpackenum:=4;
  1802. {$IFDEF testvarsets}
  1803. initsetalloc:=0;
  1804. {$ENDIF}
  1805. initfputype:=fpu_fpa;
  1806. {$endif arm}
  1807. {$ifdef x86_64}
  1808. initoptprocessor:=ClassAthlon64;
  1809. initspecificoptprocessor:=ClassAthlon64;
  1810. initfputype:=fpu_sse64;
  1811. initpackenum:=4;
  1812. {$IFDEF testvarsets}
  1813. initsetalloc:=0;
  1814. {$ENDIF}
  1815. initasmmode:=asmmode_x86_64_gas;
  1816. {$endif x86_64}
  1817. initinterfacetype:=it_interfacecom;
  1818. initdefproccall:=pocall_default;
  1819. initdefines:=TStringList.Create;
  1820. { memory sizes, will be overriden by parameter or default for target
  1821. in options or init_parser }
  1822. stacksize:=0;
  1823. heapsize:=0;
  1824. apptype:=app_cui;
  1825. end;
  1826. end.
  1827. {
  1828. $Log$
  1829. Revision 1.143 2004-10-10 15:42:22 peter
  1830. * default optimization cpu changed to CLassPentium3
  1831. Revision 1.142 2004/10/09 11:27:59 olle
  1832. + Added CurDirRelPath
  1833. * Exchanged hardcoded "./" to CurDirRelPath
  1834. Revision 1.141 2004/09/21 23:33:43 hajny
  1835. * better PathExists, fix for too long command line, correction of message
  1836. Revision 1.140 2004/09/21 19:59:51 peter
  1837. * x86_64 fixes
  1838. * cleanup of fpcdefs.icn
  1839. Revision 1.139 2004/09/21 17:25:12 peter
  1840. * paraloc branch merged
  1841. Revision 1.138 2004/09/08 11:23:31 michael
  1842. + Check if outputdir exists, Fix exitcode when displaying help pages
  1843. Revision 1.137 2004/08/31 22:02:30 olle
  1844. + support for quoting of paths in TSearchPathList.AddPath so that
  1845. compiler directives which take paths, will support quotes.
  1846. * uppdated TranslateMacPath
  1847. Revision 1.136.4.2 2004/09/12 18:31:26 peter
  1848. * fpu exception support for sparc and x86_64
  1849. Revision 1.136.4.1 2004/09/12 15:30:16 peter
  1850. * cache currentdir
  1851. Revision 1.136 2004/08/28 20:25:25 peter
  1852. * optimized search for noncasesensitive names. It now searches
  1853. first for NormalCase and skips double tests
  1854. Revision 1.135 2004/08/20 10:29:31 olle
  1855. + made fpc work as an MPW tool, by itself calling asm and link.
  1856. * bugfix in fp exception flag settings routine
  1857. Revision 1.134 2004/08/02 07:15:54 michael
  1858. + Patch from Christian Iversen to implement LIBPREFIX/SUFFIX/EXTENSION directives
  1859. Revision 1.133 2004/07/17 15:51:57 jonas
  1860. * shell now returns an exitcode
  1861. * print an error if linking failed when linking was done using a script
  1862. Revision 1.132 2004/07/05 23:28:24 olle
  1863. + FixFileName now handles Mac OS paths
  1864. Revision 1.131 2004/06/20 08:55:29 florian
  1865. * logs truncated
  1866. Revision 1.130 2004/06/16 20:07:07 florian
  1867. * dwarf branch merged
  1868. Revision 1.129 2004/05/11 18:20:52 olle
  1869. * changed $mode mac to $mode macpas
  1870. * changed macmodeswitches to be more faithful to the mac dialect
  1871. Revision 1.128 2004/04/29 19:56:36 daniel
  1872. * Prepare compiler infrastructure for multiple ansistring types
  1873. Revision 1.127 2004/04/28 15:19:03 florian
  1874. + syscall directive support for MorphOS added
  1875. Revision 1.126.2.4 2004/05/09 15:47:21 peter
  1876. * fix typecast from word->set
  1877. }