globals.pas 59 KB

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