globals.pas 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. This unit implements some support functions and global variables
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit globals;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. {$ifdef win32}
  22. windows,
  23. {$endif}
  24. {$ifdef os2}
  25. dos,
  26. {$endif os2}
  27. {$ifdef hasunix}
  28. Baseunix,unix,
  29. {$endif}
  30. {$IFNDEF USE_FAKE_SYSUTILS}
  31. sysutils,
  32. {$ELSE}
  33. fksysutl,
  34. {$ENDIF}
  35. { comphook pulls in sysutils anyways }
  36. cutils,cclasses,cfileutl,
  37. cpuinfo,
  38. globtype,version,systems;
  39. const
  40. delphimodeswitches =
  41. [m_delphi,m_all,m_class,m_objpas,m_result,m_string_pchar,
  42. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
  43. m_out,m_default_para,m_duplicate_names,m_hintdirective,m_add_pointer,
  44. m_property,m_default_inline,m_except];
  45. fpcmodeswitches =
  46. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  47. m_cvar_support,m_initfinal,m_add_pointer,m_hintdirective,
  48. m_property,m_default_inline];
  49. objfpcmodeswitches =
  50. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  51. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer,m_out,m_default_para,m_hintdirective,
  52. m_property,m_default_inline,m_except];
  53. tpmodeswitches =
  54. [m_tp7,m_all,m_tp_procvar,m_duplicate_names];
  55. {$ifdef gpc_mode}
  56. gpcmodeswitches =
  57. [m_gpc,m_all,m_tp_procvar];
  58. {$endif}
  59. macmodeswitches =
  60. [m_mac,m_all,m_result,m_cvar_support,m_mac_procvar];
  61. { maximum nesting of routines }
  62. maxnesting = 32;
  63. { Filenames and extensions }
  64. sourceext = '.pp';
  65. pasext = '.pas';
  66. pext = '.p';
  67. treelogfilename = 'tree.log';
  68. {$if defined(CPUARM) and defined(FPUFPA)}
  69. MathQNaN : tdoublerec = (bytes : (0,0,252,255,0,0,0,0));
  70. MathInf : tdoublerec = (bytes : (0,0,240,127,0,0,0,0));
  71. MathNegInf : tdoublerec = (bytes : (0,0,240,255,0,0,0,0));
  72. MathPi : tdoublerec = (bytes : (251,33,9,64,24,45,68,84));
  73. {$else}
  74. {$ifdef FPC_LITTLE_ENDIAN}
  75. MathQNaN : tdoublerec = (bytes : (0,0,0,0,0,0,252,255));
  76. MathInf : tdoublerec = (bytes : (0,0,0,0,0,0,240,127));
  77. MathNegInf : tdoublerec = (bytes : (0,0,0,0,0,0,240,255));
  78. MathPi : tdoublerec = (bytes : (24,45,68,84,251,33,9,64));
  79. MathPiExtended : textendedrec = (bytes : (53,194,104,33,162,218,15,201,0,64));
  80. {$else FPC_LITTLE_ENDIAN}
  81. MathQNaN : tdoublerec = (bytes : (255,252,0,0,0,0,0,0));
  82. MathInf : tdoublerec = (bytes : (127,240,0,0,0,0,0,0));
  83. MathNegInf : tdoublerec = (bytes : (255,240,0,0,0,0,0,0));
  84. MathPi : tdoublerec = (bytes : (64,9,33,251,84,68,45,24));
  85. MathPiExtended : textendedrec = (bytes : (64,0,201,15,218,162,33,104,194,53));
  86. {$endif FPC_LITTLE_ENDIAN}
  87. {$endif}
  88. type
  89. tcodepagestring = string[20];
  90. tsettings = record
  91. globalswitches : tglobalswitches;
  92. moduleswitches : tmoduleswitches;
  93. localswitches : tlocalswitches;
  94. modeswitches : tmodeswitches;
  95. optimizerswitches : toptimizerswitches;
  96. { generate information necessary to perform these wpo's during a subsequent compilation }
  97. genwpoptimizerswitches: twpoptimizerswitches;
  98. { perform these wpo's using information generated during a previous compilation }
  99. dowpoptimizerswitches: twpoptimizerswitches;
  100. debugswitches : tdebugswitches;
  101. { 0: old behaviour for sets <=256 elements
  102. >0: round to this size }
  103. setalloc,
  104. packenum : shortint;
  105. alignment : talignmentinfo;
  106. cputype,
  107. optimizecputype : tcputype;
  108. fputype : tfputype;
  109. asmmode : tasmmode;
  110. interfacetype : tinterfacetypes;
  111. defproccall : tproccalloption;
  112. sourcecodepage : tcodepagestring;
  113. packrecords : shortint;
  114. maxfpuregisters : shortint;
  115. minfpconstprec : tfloattype;
  116. end;
  117. const
  118. LinkMapWeightDefault = 1000;
  119. type
  120. TLinkRec = record
  121. Key : AnsiString;
  122. Value : AnsiString; // key expands to valuelist "value"
  123. Weight: longint;
  124. end;
  125. TLinkStrMap = class
  126. private
  127. itemcnt : longint;
  128. fmap : Array Of TLinkRec;
  129. function Lookup(key:Ansistring):longint;
  130. function getlinkrec(i:longint):TLinkRec;
  131. public
  132. procedure Add(key:ansistring;value:AnsiString='';weight:longint=LinkMapWeightDefault);
  133. procedure addseries(keys:AnsiString;weight:longint=LinkMapWeightDefault);
  134. function AddDep(keyvalue:String):boolean;
  135. function AddWeight(keyvalue:String):boolean;
  136. procedure SetValue(key:AnsiString;Weight:Integer);
  137. procedure SortonWeight;
  138. function Find(key:AnsiString):AnsiString;
  139. procedure Expand(src:TCmdStrList;dest: TLinkStrMap);
  140. procedure UpdateWeights(Weightmap:TLinkStrMap);
  141. constructor Create;
  142. property count : longint read itemcnt;
  143. property items[I:longint]:TLinkRec read getlinkrec; default;
  144. end;
  145. tpendingstate = record
  146. nextverbositystr : string;
  147. nextlocalswitches : tlocalswitches;
  148. nextverbosityfullswitch: longint;
  149. verbosityfullswitched,
  150. localswitcheschanged : boolean;
  151. end;
  152. var
  153. { specified inputfile }
  154. inputfilepath : string;
  155. inputfilename : string;
  156. { specified outputfile with -o parameter }
  157. outputfilename : string;
  158. outputprefix : pshortstring;
  159. outputsuffix : pshortstring;
  160. { specified with -FE or -FU }
  161. outputexedir : TPathStr;
  162. outputunitdir : TPathStr;
  163. { specified with -FW and -Fw }
  164. wpofeedbackinput,
  165. wpofeedbackoutput : TPathStr;
  166. { things specified with parameters }
  167. paratarget : tsystem;
  168. paratargetdbg : tdbg;
  169. paratargetasm : tasm;
  170. paralinkoptions : TCmdStr;
  171. paradynamiclinker : string;
  172. paraprintnodetree : byte;
  173. parapreprocess : boolean;
  174. printnodefile : text;
  175. { typical cross compiling params}
  176. { directory where the utils can be found (options -FD) }
  177. utilsdirectory : TPathStr;
  178. { targetname specific prefix used by these utils (options -XP<path>) }
  179. utilsprefix : TCmdStr;
  180. cshared : boolean; { pass --shared to ld to link C libs shared}
  181. Dontlinkstdlibpath: Boolean; { Don't add std paths to linkpath}
  182. rlinkpath : TCmdStr; { rpath-link linkdir override}
  183. sysrootpath : TCmdStr; { target system root to search dyn linker }
  184. { some flags for global compiler switches }
  185. do_build,
  186. do_release,
  187. do_make : boolean;
  188. { path for searching units, different paths can be seperated by ; }
  189. exepath : TPathStr; { Path to ppc }
  190. librarysearchpath,
  191. unitsearchpath,
  192. objectsearchpath,
  193. includesearchpath,
  194. frameworksearchpath : TSearchPathList;
  195. autoloadunits : string;
  196. { linking }
  197. usewindowapi : boolean;
  198. description : string;
  199. SetPEFlagsSetExplicity,
  200. ImageBaseSetExplicity,
  201. MinStackSizeSetExplicity,
  202. MaxStackSizeSetExplicity,
  203. DescriptionSetExplicity : boolean;
  204. dllversion : string;
  205. dllmajor,
  206. dllminor,
  207. dllrevision : word; { revision only for netware }
  208. { win pe }
  209. peflags : longint;
  210. minstacksize,
  211. maxstacksize,
  212. imagebase : aword;
  213. UseDeffileForExports : boolean;
  214. UseDeffileForExportsSetExplicitly : boolean;
  215. GenerateImportSection,
  216. GenerateImportSectionSetExplicitly,
  217. RelocSection : boolean;
  218. RelocSectionSetExplicitly : boolean;
  219. LinkTypeSetExplicitly : boolean;
  220. current_tokenpos, { position of the last token }
  221. current_filepos : tfileposinfo; { current position }
  222. nwscreenname : string;
  223. nwthreadname : string;
  224. nwcopyright : string;
  225. codegenerror : boolean; { true if there is an error reported }
  226. block_type : tblock_type; { type of currently parsed block }
  227. compile_level : word;
  228. exceptblockcounter : integer; { each except block gets a unique number check gotos }
  229. current_exceptblock : integer; { the exceptblock number of the current block (0 if none) }
  230. LinkLibraryAliases : TLinkStrMap;
  231. LinkLibraryOrder : TLinkStrMap;
  232. init_settings,
  233. current_settings : tsettings;
  234. pendingstate : tpendingstate;
  235. { Memory sizes }
  236. heapsize,
  237. stacksize,
  238. jmp_buf_size,
  239. jmp_buf_align : longint;
  240. {$Ifdef EXTDEBUG}
  241. { parameter switches }
  242. debugstop : boolean;
  243. {$EndIf EXTDEBUG}
  244. { windows / OS/2 application type }
  245. apptype : tapptype;
  246. features : tfeatures;
  247. const
  248. DLLsource : boolean = false;
  249. DLLImageBase : pshortstring = nil;
  250. { used to set all registers used for each global function
  251. this should dramatically decrease the number of
  252. recompilations needed PM }
  253. simplify_ppu : boolean = true;
  254. Inside_asm_statement : boolean = false;
  255. global_unit_count : word = 0;
  256. { for error info in pp.pas }
  257. parser_current_file : string = '';
  258. {$if defined(m68k) or defined(arm)}
  259. { PalmOS resources }
  260. palmos_applicationname : string = 'FPC Application';
  261. palmos_applicationid : string[4] = 'FPCA';
  262. {$endif defined(m68k) or defined(arm)}
  263. {$ifdef powerpc}
  264. { default calling convention used on MorphOS }
  265. syscall_convention : string = 'LEGACY';
  266. {$endif powerpc}
  267. { default name of the C-style "main" procedure of the library/program }
  268. { (this will be prefixed with the target_info.cprefix) }
  269. defaultmainaliasname = 'main';
  270. mainaliasname : string = defaultmainaliasname;
  271. { by default no local variable trashing }
  272. localvartrashing: longint = -1;
  273. { actual values are defined in ncgutil.pas }
  274. nroftrashvalues = 4;
  275. const
  276. default_settings : TSettings = (
  277. globalswitches : [cs_check_unit_name,cs_link_static];
  278. moduleswitches : [cs_extsyntax,cs_implicit_exceptions];
  279. localswitches : [cs_check_io,cs_typed_const_writable];
  280. modeswitches : fpcmodeswitches;
  281. optimizerswitches : [];
  282. genwpoptimizerswitches : [];
  283. dowpoptimizerswitches : [];
  284. debugswitches : [];
  285. setalloc : 0;
  286. packenum : 4;
  287. alignment : (
  288. procalign : 0;
  289. loopalign : 0;
  290. jumpalign : 0;
  291. constalignmin : 0;
  292. constalignmax : 0;
  293. varalignmin : 0;
  294. varalignmax : 0;
  295. localalignmin : 0;
  296. localalignmax : 0;
  297. recordalignmin : 0;
  298. recordalignmax : 0;
  299. maxCrecordalign : 0;
  300. );
  301. {$ifdef i386}
  302. cputype : cpu_Pentium;
  303. optimizecputype : cpu_Pentium3;
  304. fputype : fpu_x87;
  305. {$endif i386}
  306. {$ifdef m68k}
  307. cputype : cpu_MC68020;
  308. optimizecputype : cpu_MC68020;
  309. fputype : fpu_soft;
  310. {$endif m68k}
  311. {$ifdef powerpc}
  312. cputype : cpu_PPC604;
  313. optimizecputype : cpu_ppc7400;
  314. fputype : fpu_standard;
  315. {$endif powerpc}
  316. {$ifdef POWERPC64}
  317. cputype : cpu_PPC970;
  318. optimizecputype : cpu_ppc970;
  319. fputype : fpu_standard;
  320. {$endif POWERPC64}
  321. {$ifdef sparc}
  322. cputype : cpu_SPARC_V8;
  323. optimizecputype : cpu_SPARC_V8;
  324. fputype : fpu_hard;
  325. {$endif sparc}
  326. {$ifdef arm}
  327. cputype : cpu_armv3;
  328. optimizecputype : cpu_armv3;
  329. fputype : fpu_fpa;
  330. {$endif arm}
  331. {$ifdef x86_64}
  332. cputype : cpu_athlon64;
  333. optimizecputype : cpu_athlon64;
  334. fputype : fpu_sse64;
  335. {$endif x86_64}
  336. {$ifdef avr}
  337. cputype : cpuinfo.cpu_avr;
  338. optimizecputype : cpuinfo.cpu_avr;
  339. fputype : fpu_none;
  340. {$endif avr}
  341. asmmode : asmmode_standard;
  342. interfacetype : it_interfacecom;
  343. defproccall : pocall_default;
  344. sourcecodepage : '8859-1';
  345. packrecords : 0;
  346. maxfpuregisters : 0;
  347. minfpconstprec : s32real;
  348. );
  349. var
  350. starttime : real;
  351. function getdatestr:string;
  352. function gettimestr:string;
  353. function filetimestring( t : longint) : string;
  354. function getrealtime : real;
  355. procedure DefaultReplacements(var s:ansistring);
  356. function Shell(const command:ansistring): longint;
  357. function GetEnvPChar(const envname:string):pchar;
  358. procedure FreeEnvPChar(p:pchar);
  359. function is_number_float(d : double) : boolean;
  360. { discern +0.0 and -0.0 }
  361. function get_real_sign(r: bestreal): longint;
  362. procedure InitGlobals;
  363. procedure DoneGlobals;
  364. function string2guid(const s: string; var GUID: TGUID): boolean;
  365. function guid2string(const GUID: TGUID): string;
  366. function SetAktProcCall(const s:string; var a:tproccalloption):boolean;
  367. function Setabitype(const s:string;var a:tabi):boolean;
  368. function Setcputype(const s:string;var a:tcputype):boolean;
  369. function SetFpuType(const s:string;var a:tfputype):boolean;
  370. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  371. function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
  372. function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
  373. function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
  374. function IncludeFeature(const s : string) : boolean;
  375. function SetMinFPConstPrec(const s: string; var a: tfloattype) : boolean;
  376. {# Routine to get the required alignment for size of data, which will
  377. be placed in bss segment, according to the current alignment requirements }
  378. function var_align(siz: longint): shortint;
  379. {# Routine to get the required alignment for size of data, which will
  380. be placed in data/const segment, according to the current alignment requirements }
  381. function const_align(siz: longint): shortint;
  382. {$ifdef ARM}
  383. function is_double_hilo_swapped: boolean;{$ifdef USEINLINE}inline;{$endif}
  384. {$endif ARM}
  385. function floating_point_range_check_error : boolean;
  386. implementation
  387. uses
  388. {$ifdef macos}
  389. macutils,
  390. {$endif}
  391. comphook;
  392. {****************************************************************************
  393. TLinkStrMap
  394. ****************************************************************************}
  395. Constructor TLinkStrMap.create;
  396. begin
  397. inherited;
  398. itemcnt:=0;
  399. end;
  400. procedure TLinkStrMap.Add(key:ansistring;value:AnsiString='';weight:longint=LinkMapWeightDefault);
  401. begin
  402. if lookup(key)<>-1 Then
  403. exit;
  404. if itemcnt<=length(fmap) Then
  405. setlength(fmap,itemcnt+10);
  406. fmap[itemcnt].key:=key;
  407. fmap[itemcnt].value:=value;
  408. fmap[itemcnt].weight:=weight;
  409. inc(itemcnt);
  410. end;
  411. function TLinkStrMap.AddDep(keyvalue:String):boolean;
  412. var
  413. i : Longint;
  414. begin
  415. AddDep:=false;
  416. i:=pos('=',keyvalue);
  417. if i=0 then
  418. exit;
  419. Add(Copy(KeyValue,1,i-1),Copy(KeyValue,i+1,length(KeyValue)-i));
  420. AddDep:=True;
  421. end;
  422. function TLinkStrMap.AddWeight(keyvalue:String):boolean;
  423. var
  424. i,j : Longint;
  425. Code : Word;
  426. s : AnsiString;
  427. begin
  428. AddWeight:=false;
  429. i:=pos('=',keyvalue);
  430. if i=0 then
  431. exit;
  432. s:=Copy(KeyValue,i+1,length(KeyValue)-i);
  433. val(s,j,code);
  434. if code=0 Then
  435. begin
  436. Add(Copy(KeyValue,1,i-1),'',j);
  437. AddWeight:=True;
  438. end;
  439. end;
  440. procedure TLinkStrMap.addseries(keys:AnsiString;weight:longint);
  441. var
  442. i,j,k : longint;
  443. begin
  444. k:=length(keys);
  445. i:=1;
  446. while i<=k do
  447. begin
  448. j:=i;
  449. while (i<=k) and (keys[i]<>',') do
  450. inc(i);
  451. add(copy(keys,j,i-j),'',weight);
  452. inc(i);
  453. end;
  454. end;
  455. procedure TLinkStrMap.SetValue(Key:Ansistring;weight:Integer);
  456. var
  457. j : longint;
  458. begin
  459. j:=lookup(key);
  460. if j<>-1 then
  461. fmap[j].weight:=weight;
  462. end;
  463. function TLinkStrMap.find(key:Ansistring):Ansistring;
  464. var
  465. j : longint;
  466. begin
  467. find:='';
  468. j:=lookup(key);
  469. if j<>-1 then
  470. find:=fmap[j].value;
  471. end;
  472. function TLinkStrMap.lookup(key:Ansistring):longint;
  473. var
  474. i : longint;
  475. begin
  476. lookup:=-1;
  477. i:=0;
  478. while (i<itemcnt) and (fmap[i].key<>key) do
  479. inc(i);
  480. if i<>itemcnt then
  481. lookup:=i;
  482. end;
  483. procedure TLinkStrMap.SortOnWeight;
  484. var
  485. i, j : longint;
  486. m : TLinkRec;
  487. begin
  488. if itemcnt <2 then exit;
  489. for i:=0 to itemcnt-1 do
  490. for j:=i+1 to itemcnt-1 do
  491. begin
  492. if fmap[i].weight>fmap[j].weight Then
  493. begin
  494. m:=fmap[i];
  495. fmap[i]:=fmap[j];
  496. fmap[j]:=m;
  497. end;
  498. end;
  499. end;
  500. function TLinkStrMap.getlinkrec(i:longint):TLinkRec;
  501. begin
  502. result:=fmap[i];
  503. end;
  504. procedure TLinkStrMap.Expand(Src:TCmdStrList;Dest:TLinkStrMap);
  505. // expands every thing in Src to Dest for linkorder purposes.
  506. var
  507. r : longint;
  508. LibN : TCmdStr;
  509. begin
  510. while not src.empty do
  511. begin
  512. LibN:=src.getfirst;
  513. r:=lookup (LibN);
  514. if r=-1 then
  515. dest.add(LibN)
  516. else
  517. dest.addseries(fmap[r].value);
  518. end;
  519. end;
  520. procedure TLinkStrMap.UpdateWeights(Weightmap:TLinkStrMap);
  521. var
  522. l,r : longint;
  523. begin
  524. for l := 0 to itemcnt-1 do
  525. begin
  526. r:=weightmap.lookup (fmap[l].key);
  527. if r<>-1 then
  528. fmap[l].weight:=weightmap[r].weight;
  529. end;
  530. end;
  531. {****************************************************************************
  532. Time Handling
  533. ****************************************************************************}
  534. Function L0(l:longint):string;
  535. {
  536. return the string of value l, if l<10 then insert a zero, so
  537. the string is always at least 2 chars '01','02',etc
  538. }
  539. var
  540. s : string;
  541. begin
  542. Str(l,s);
  543. if l<10 then
  544. s:='0'+s;
  545. L0:=s;
  546. end;
  547. function gettimestr:string;
  548. {
  549. get the current time in a string HH:MM:SS
  550. }
  551. var
  552. hour,min,sec,hsec : word;
  553. begin
  554. DecodeTime(Time,hour,min,sec,hsec);
  555. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  556. end;
  557. function getdatestr:string;
  558. {
  559. get the current date in a string YY/MM/DD
  560. }
  561. var
  562. Year,Month,Day: Word;
  563. begin
  564. DecodeDate(Date,year,month,day);
  565. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  566. end;
  567. function filetimestring( t : longint) : string;
  568. {
  569. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  570. }
  571. var
  572. DT : TDateTime;
  573. hsec : word;
  574. Year,Month,Day: Word;
  575. hour,min,sec : word;
  576. begin
  577. if t=-1 then
  578. begin
  579. Result := 'Not Found';
  580. exit;
  581. end;
  582. DT := FileDateToDateTime(t);
  583. DecodeTime(DT,hour,min,sec,hsec);
  584. DecodeDate(DT,year,month,day);
  585. Result := L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  586. end;
  587. function getrealtime : real;
  588. var
  589. h,m,s,s1000 : word;
  590. begin
  591. DecodeTime(Time,h,m,s,s1000);
  592. result:=h*3600.0+m*60.0+s+s1000/1000.0;
  593. end;
  594. {****************************************************************************
  595. Default Macro Handling
  596. ****************************************************************************}
  597. procedure DefaultReplacements(var s:ansistring);
  598. begin
  599. { Replace some macros }
  600. Replace(s,'$FPCVERSION',version_string);
  601. Replace(s,'$FPCFULLVERSION',full_version_string);
  602. Replace(s,'$FPCDATE',date_string);
  603. Replace(s,'$FPCCPU',target_cpu_string);
  604. Replace(s,'$FPCOS',target_os_string);
  605. if tf_use_8_3 in Source_Info.Flags then
  606. Replace(s,'$FPCTARGET',target_os_string)
  607. else
  608. Replace(s,'$FPCTARGET',target_full_string);
  609. end;
  610. {****************************************************************************
  611. OS Dependent things
  612. ****************************************************************************}
  613. function GetEnvPChar(const envname:string):pchar;
  614. {$ifdef win32}
  615. var
  616. s : string;
  617. i,len : longint;
  618. hp,p,p2 : pchar;
  619. {$endif}
  620. begin
  621. {$ifdef hasunix}
  622. GetEnvPchar:=BaseUnix.fpGetEnv(envname);
  623. {$define GETENVOK}
  624. {$endif}
  625. {$ifdef win32}
  626. GetEnvPchar:=nil;
  627. p:=GetEnvironmentStrings;
  628. hp:=p;
  629. while hp^<>#0 do
  630. begin
  631. s:=strpas(hp);
  632. i:=pos('=',s);
  633. len:=strlen(hp);
  634. if upper(copy(s,1,i-1))=upper(envname) then
  635. begin
  636. GetMem(p2,len-length(envname));
  637. Move(hp[i],p2^,len-length(envname));
  638. GetEnvPchar:=p2;
  639. break;
  640. end;
  641. { next string entry}
  642. hp:=hp+len+1;
  643. end;
  644. FreeEnvironmentStrings(p);
  645. {$define GETENVOK}
  646. {$endif}
  647. {$ifdef os2}
  648. GetEnvPChar := Dos.GetEnvPChar (EnvName);
  649. {$define GETENVOK}
  650. {$endif}
  651. {$ifdef GETENVOK}
  652. {$undef GETENVOK}
  653. {$else}
  654. GetEnvPchar:=StrPNew(GetEnvironmentVariable(envname));
  655. {$endif}
  656. end;
  657. procedure FreeEnvPChar(p:pchar);
  658. begin
  659. {$ifndef hasunix}
  660. {$ifndef os2}
  661. freemem(p);
  662. {$endif}
  663. {$endif}
  664. end;
  665. {$if defined(MORPHOS) or defined(AMIGA)}
  666. {$define AMIGASHELL}
  667. {$endif}
  668. function Shell(const command:ansistring): longint;
  669. { This is already defined in the linux.ppu for linux, need for the *
  670. expansion under linux }
  671. {$ifdef hasunix}
  672. begin
  673. result := Unix.fpsystem(command);
  674. end;
  675. {$else hasunix}
  676. {$ifdef amigashell}
  677. begin
  678. result := ExecuteProcess('',command);
  679. end;
  680. {$else amigashell}
  681. var
  682. comspec : string;
  683. begin
  684. comspec:=GetEnvironmentVariable('COMSPEC');
  685. result := ExecuteProcess(comspec,' /C '+command);
  686. end;
  687. {$endif amigashell}
  688. {$endif hasunix}
  689. {$UNDEF AMIGASHELL}
  690. function is_number_float(d : double) : boolean;
  691. var
  692. bytearray : array[0..7] of byte;
  693. begin
  694. move(d,bytearray,8);
  695. { only 1.1 save, 1.0.x will use always little endian }
  696. {$ifdef FPC_BIG_ENDIAN}
  697. result:=((bytearray[0] and $7f)<>$7f) or ((bytearray[1] and $f0)<>$f0);
  698. {$else FPC_BIG_ENDIAN}
  699. result:=((bytearray[7] and $7f)<>$7f) or ((bytearray[6] and $f0)<>$f0);
  700. {$endif FPC_BIG_ENDIAN}
  701. end;
  702. function get_real_sign(r: bestreal): longint;
  703. var
  704. p: pbyte;
  705. begin
  706. p := pbyte(@r);
  707. {$ifdef CPU_ARM}
  708. inc(p,4);
  709. {$else}
  710. {$ifdef FPC_LITTLE_ENDIAN}
  711. inc(p,sizeof(r)-1);
  712. {$endif}
  713. {$endif}
  714. if (p^ and $80) = 0 then
  715. result := 1
  716. else
  717. result := -1;
  718. end;
  719. function convertdoublerec(d : tdoublerec) : tdoublerec;{$ifdef USEINLINE}inline;{$endif}
  720. {$ifdef CPUARM}
  721. var
  722. i : longint;
  723. begin
  724. for i:=0 to 3 do
  725. begin
  726. result.bytes[i+4]:=d.bytes[i];
  727. result.bytes[i]:=d.bytes[i+4];
  728. end;
  729. {$else CPUARM}
  730. begin
  731. result:=d;
  732. {$endif CPUARM}
  733. end;
  734. { '('D1:'00000000-'D2:'0000-'D3:'0000-'D4:'0000-000000000000)' }
  735. function string2guid(const s: string; var GUID: TGUID): boolean;
  736. function ishexstr(const hs: string): boolean;
  737. var
  738. i: integer;
  739. begin
  740. ishexstr:=false;
  741. for i:=1 to Length(hs) do begin
  742. if not (hs[i] in ['0'..'9','A'..'F','a'..'f']) then
  743. exit;
  744. end;
  745. ishexstr:=true;
  746. end;
  747. function hexstr2longint(const hexs: string): longint;
  748. var
  749. i: integer;
  750. rl: longint;
  751. begin
  752. rl:=0;
  753. for i:=1 to length(hexs) do begin
  754. rl:=rl shl 4;
  755. case hexs[i] of
  756. '0'..'9' : inc(rl,ord(hexs[i])-ord('0'));
  757. 'A'..'F' : inc(rl,ord(hexs[i])-ord('A')+10);
  758. 'a'..'f' : inc(rl,ord(hexs[i])-ord('a')+10);
  759. end
  760. end;
  761. hexstr2longint:=rl;
  762. end;
  763. var
  764. i: integer;
  765. begin
  766. if (Length(s)=38) and (s[1]='{') and (s[38]='}') and
  767. (s[10]='-') and (s[15]='-') and (s[20]='-') and (s[25]='-') and
  768. ishexstr(copy(s,2,8)) and ishexstr(copy(s,11,4)) and
  769. ishexstr(copy(s,16,4)) and ishexstr(copy(s,21,4)) and
  770. ishexstr(copy(s,26,12)) then begin
  771. GUID.D1:=dword(hexstr2longint(copy(s,2,8)));
  772. { these values are arealdy in the correct range (4 chars = word) }
  773. GUID.D2:=word(hexstr2longint(copy(s,11,4)));
  774. GUID.D3:=word(hexstr2longint(copy(s,16,4)));
  775. for i:=0 to 1 do
  776. GUID.D4[i]:=byte(hexstr2longint(copy(s,21+i*2,2)));
  777. for i:=2 to 7 do
  778. GUID.D4[i]:=byte(hexstr2longint(copy(s,22+i*2,2)));
  779. string2guid:=true;
  780. end
  781. else if (length(s)=0) then
  782. begin
  783. FillChar(GUID,SizeOf(GUID),0);
  784. string2guid:=true;
  785. end
  786. else
  787. string2guid:=false;
  788. end;
  789. function guid2string(const GUID: TGUID): string;
  790. begin
  791. guid2string:=
  792. '{'+hexstr(GUID.D1,8)+
  793. '-'+hexstr(GUID.D2,4)+
  794. '-'+hexstr(GUID.D3,4)+
  795. '-'+hexstr(GUID.D4[0],2)+hexstr(GUID.D4[1],2)+
  796. '-'+hexstr(GUID.D4[2],2)+hexstr(GUID.D4[3],2)+
  797. hexstr(GUID.D4[4],2)+hexstr(GUID.D4[5],2)+
  798. hexstr(GUID.D4[6],2)+hexstr(GUID.D4[7],2)+
  799. '}';
  800. end;
  801. function SetAktProcCall(const s:string; var a:tproccalloption):boolean;
  802. const
  803. DefProcCallName : array[tproccalloption] of string[12] = ('',
  804. 'CDECL',
  805. 'CPPDECL',
  806. 'FAR16',
  807. 'OLDFPCCALL',
  808. '', { internproc }
  809. '', { syscall }
  810. 'PASCAL',
  811. 'REGISTER',
  812. 'SAFECALL',
  813. 'STDCALL',
  814. 'SOFTFLOAT',
  815. 'MWPASCAL'
  816. );
  817. var
  818. t : tproccalloption;
  819. hs : string;
  820. begin
  821. result:=false;
  822. if (s = '') then
  823. exit;
  824. hs:=upper(s);
  825. if (hs = 'DEFAULT') then
  826. begin
  827. a := pocall_default;
  828. result := true;
  829. exit;
  830. end;
  831. for t:=low(tproccalloption) to high(tproccalloption) do
  832. if DefProcCallName[t]=hs then
  833. begin
  834. a:=t;
  835. result:=true;
  836. break;
  837. end;
  838. end;
  839. function Setabitype(const s:string;var a:tabi):boolean;
  840. var
  841. t : tabi;
  842. hs : string;
  843. begin
  844. result:=false;
  845. hs:=Upper(s);
  846. for t:=low(t) to high(t) do
  847. if abi2str[t]=hs then
  848. begin
  849. a:=t;
  850. result:=true;
  851. break;
  852. end;
  853. end;
  854. function Setcputype(const s:string;var a:tcputype):boolean;
  855. var
  856. t : tcputype;
  857. hs : string;
  858. begin
  859. result:=false;
  860. hs:=Upper(s);
  861. for t:=low(tcputype) to high(tcputype) do
  862. if cputypestr[t]=hs then
  863. begin
  864. a:=t;
  865. result:=true;
  866. break;
  867. end;
  868. end;
  869. function SetFpuType(const s:string;var a:tfputype):boolean;
  870. var
  871. t : tfputype;
  872. begin
  873. result:=false;
  874. for t:=low(tfputype) to high(tfputype) do
  875. if fputypestr[t]=s then
  876. begin
  877. a:=t;
  878. result:=true;
  879. break;
  880. end;
  881. end;
  882. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  883. var
  884. tok : string;
  885. vstr : string;
  886. l : longint;
  887. code : integer;
  888. b : talignmentinfo;
  889. begin
  890. UpdateAlignmentStr:=true;
  891. uppervar(s);
  892. fillchar(b,sizeof(b),0);
  893. repeat
  894. tok:=GetToken(s,'=');
  895. if tok='' then
  896. break;
  897. vstr:=GetToken(s,',');
  898. val(vstr,l,code);
  899. if tok='PROC' then
  900. b.procalign:=l
  901. else if tok='JUMP' then
  902. b.jumpalign:=l
  903. else if tok='LOOP' then
  904. b.loopalign:=l
  905. else if tok='CONSTMIN' then
  906. b.constalignmin:=l
  907. else if tok='CONSTMAX' then
  908. b.constalignmax:=l
  909. else if tok='VARMIN' then
  910. b.varalignmin:=l
  911. else if tok='VARMAX' then
  912. b.varalignmax:=l
  913. else if tok='LOCALMIN' then
  914. b.localalignmin:=l
  915. else if tok='LOCALMAX' then
  916. b.localalignmax:=l
  917. else if tok='RECORDMIN' then
  918. b.recordalignmin:=l
  919. else if tok='RECORDMAX' then
  920. b.recordalignmax:=l
  921. else { Error }
  922. UpdateAlignmentStr:=false;
  923. until false;
  924. UpdateAlignment(a,b);
  925. end;
  926. function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
  927. var
  928. tok : string;
  929. doset,
  930. found : boolean;
  931. opt : toptimizerswitch;
  932. begin
  933. result:=true;
  934. uppervar(s);
  935. repeat
  936. tok:=GetToken(s,',');
  937. if tok='' then
  938. break;
  939. if Copy(tok,1,2)='NO' then
  940. begin
  941. delete(tok,1,2);
  942. doset:=false;
  943. end
  944. else
  945. doset:=true;
  946. found:=false;
  947. for opt:=low(toptimizerswitch) to high(toptimizerswitch) do
  948. begin
  949. if OptimizerSwitchStr[opt]=tok then
  950. begin
  951. found:=true;
  952. break;
  953. end;
  954. end;
  955. if found then
  956. begin
  957. if doset then
  958. include(a,opt)
  959. else
  960. exclude(a,opt);
  961. end
  962. else
  963. result:=false;
  964. until false;
  965. end;
  966. function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
  967. var
  968. tok : string;
  969. doset,
  970. found : boolean;
  971. opt : twpoptimizerswitch;
  972. begin
  973. result:=true;
  974. uppervar(s);
  975. repeat
  976. tok:=GetToken(s,',');
  977. if tok='' then
  978. break;
  979. if Copy(tok,1,2)='NO' then
  980. begin
  981. delete(tok,1,2);
  982. doset:=false;
  983. end
  984. else
  985. doset:=true;
  986. found:=false;
  987. if (tok = 'ALL') then
  988. begin
  989. for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
  990. if doset then
  991. include(a,opt)
  992. else
  993. exclude(a,opt);
  994. end
  995. else
  996. begin
  997. for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
  998. begin
  999. if WPOptimizerSwitchStr[opt]=tok then
  1000. begin
  1001. found:=true;
  1002. break;
  1003. end;
  1004. end;
  1005. if found then
  1006. begin
  1007. if doset then
  1008. include(a,opt)
  1009. else
  1010. exclude(a,opt);
  1011. end
  1012. else
  1013. result:=false;
  1014. end;
  1015. until false;
  1016. end;
  1017. function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
  1018. var
  1019. tok : string;
  1020. doset,
  1021. found : boolean;
  1022. opt : tdebugswitch;
  1023. begin
  1024. result:=true;
  1025. uppervar(s);
  1026. repeat
  1027. tok:=GetToken(s,',');
  1028. if tok='' then
  1029. break;
  1030. if Copy(tok,1,2)='NO' then
  1031. begin
  1032. delete(tok,1,2);
  1033. doset:=false;
  1034. end
  1035. else
  1036. doset:=true;
  1037. found:=false;
  1038. for opt:=low(tdebugswitch) to high(tdebugswitch) do
  1039. begin
  1040. if DebugSwitchStr[opt]=tok then
  1041. begin
  1042. found:=true;
  1043. break;
  1044. end;
  1045. end;
  1046. if found then
  1047. begin
  1048. if doset then
  1049. include(a,opt)
  1050. else
  1051. exclude(a,opt);
  1052. end
  1053. else
  1054. result:=false;
  1055. until false;
  1056. end;
  1057. function IncludeFeature(const s : string) : boolean;
  1058. var
  1059. i : tfeature;
  1060. begin
  1061. result:=true;
  1062. for i:=low(tfeature) to high(tfeature) do
  1063. if s=featurestr[i] then
  1064. begin
  1065. include(features,i);
  1066. exit;
  1067. end;
  1068. result:=false;
  1069. end;
  1070. function SetMinFPConstPrec(const s: string; var a: tfloattype) : boolean;
  1071. var
  1072. value, error: longint;
  1073. begin
  1074. if (upper(s)='DEFAULT') then
  1075. begin
  1076. a:=s32real;
  1077. result:=true;
  1078. exit;
  1079. end;
  1080. result:=false;
  1081. val(s,value,error);
  1082. if (error<>0) then
  1083. exit;
  1084. case value of
  1085. 32: a:=s32real;
  1086. 64: a:=s64real;
  1087. { adding support for 80 bit here is tricky, since we can't really }
  1088. { check whether the target cpu+OS actually supports it }
  1089. else
  1090. exit;
  1091. end;
  1092. result:=true;
  1093. end;
  1094. function var_align(siz: longint): shortint;
  1095. begin
  1096. siz := size_2_align(siz);
  1097. var_align := used_align(siz,current_settings.alignment.varalignmin,current_settings.alignment.varalignmax);
  1098. end;
  1099. function const_align(siz: longint): shortint;
  1100. begin
  1101. siz := size_2_align(siz);
  1102. const_align := used_align(siz,current_settings.alignment.constalignmin,current_settings.alignment.constalignmax);
  1103. end;
  1104. {$ifdef ARM}
  1105. function is_double_hilo_swapped: boolean;{$ifdef USEINLINE}inline;{$endif}
  1106. begin
  1107. result := (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
  1108. not(cs_fp_emulation in current_settings.moduleswitches);
  1109. {$ifdef FPC_DOUBLE_HILO_SWAPPED}
  1110. { inverse result if compiler was compiled with swapped hilo already }
  1111. result := not result;
  1112. {$endif FPC_DOUBLE_HILO_SWAPPED}
  1113. end;
  1114. {$endif ARM}
  1115. function floating_point_range_check_error : boolean;
  1116. begin
  1117. result:=((([cs_check_range,cs_check_overflow]*current_settings.localswitches)<>[]) and not
  1118. (m_delphi in current_settings.modeswitches)
  1119. ); // or (cs_ieee_errors in current_settings.localswitches);
  1120. end;
  1121. {****************************************************************************
  1122. Init
  1123. ****************************************************************************}
  1124. {$ifdef unix}
  1125. {$define need_path_search}
  1126. {$endif unix}
  1127. {$ifdef os2}
  1128. {$define need_path_search}
  1129. {$endif os2}
  1130. {$ifdef macos}
  1131. {$define need_path_search}
  1132. {$endif macos}
  1133. procedure get_exepath;
  1134. var
  1135. localExepath : TCmdStr;
  1136. exeName:TCmdStr;
  1137. {$ifdef need_path_search}
  1138. hs1 : TPathStr;
  1139. {$endif need_path_search}
  1140. begin
  1141. localexepath:=GetEnvironmentVariable('PPC_EXEC_PATH');
  1142. if localexepath='' then
  1143. begin
  1144. exeName := FixFileName(system.paramstr(0));
  1145. localexepath := ExtractFilePath(exeName);
  1146. end;
  1147. {$ifdef need_path_search}
  1148. if localexepath='' then
  1149. begin
  1150. hs1 := ExtractFileName(exeName);
  1151. ChangeFileExt(hs1,source_info.exeext);
  1152. {$ifdef macos}
  1153. FindFile(hs1,GetEnvironmentVariable('Commands'),false,localExepath);
  1154. {$else macos}
  1155. FindFile(hs1,GetEnvironmentVariable('PATH'),false,localExepath);
  1156. {$endif macos}
  1157. localExepath:=ExtractFilePath(localExepath);
  1158. end;
  1159. {$endif need_path_search}
  1160. exepath:=FixPath(localExepath,false);
  1161. end;
  1162. procedure DoneGlobals;
  1163. begin
  1164. if assigned(DLLImageBase) then
  1165. StringDispose(DLLImageBase);
  1166. librarysearchpath.Free;
  1167. unitsearchpath.Free;
  1168. objectsearchpath.Free;
  1169. includesearchpath.Free;
  1170. frameworksearchpath.Free;
  1171. LinkLibraryAliases.Free;
  1172. LinkLibraryOrder.Free;
  1173. end;
  1174. procedure InitGlobals;
  1175. begin
  1176. get_exepath;
  1177. { reset globals }
  1178. do_build:=false;
  1179. do_release:=false;
  1180. do_make:=true;
  1181. compile_level:=0;
  1182. DLLsource:=false;
  1183. paratarget:=system_none;
  1184. paratargetasm:=as_none;
  1185. paratargetdbg:=dbg_none;
  1186. { Output }
  1187. OutputFileName:='';
  1188. OutputPrefix:=Nil;
  1189. OutputSuffix:=Nil;
  1190. OutputExeDir:='';
  1191. OutputUnitDir:='';
  1192. { Utils directory }
  1193. utilsdirectory:='';
  1194. utilsprefix:='';
  1195. cshared:=false;
  1196. rlinkpath:='';
  1197. sysrootpath:='';
  1198. { Search Paths }
  1199. librarysearchpath:=TSearchPathList.Create;
  1200. unitsearchpath:=TSearchPathList.Create;
  1201. includesearchpath:=TSearchPathList.Create;
  1202. objectsearchpath:=TSearchPathList.Create;
  1203. frameworksearchpath:=TSearchPathList.Create;
  1204. { Def file }
  1205. usewindowapi:=false;
  1206. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1207. DescriptionSetExplicity:=false;
  1208. SetPEFlagsSetExplicity:=false;
  1209. ImageBaseSetExplicity:=false;
  1210. MinStackSizeSetExplicity:=false;
  1211. MaxStackSizeSetExplicity:=false;
  1212. dllversion:='';
  1213. dllmajor:=1;
  1214. dllminor:=0;
  1215. dllrevision:=0;
  1216. nwscreenname := '';
  1217. nwthreadname := '';
  1218. nwcopyright := '';
  1219. UseDeffileForExports:=false;
  1220. UseDeffileForExportsSetExplicitly:=false;
  1221. GenerateImportSection:=false;
  1222. RelocSection:=false;
  1223. RelocSectionSetExplicitly:=false;
  1224. LinkTypeSetExplicitly:=false;
  1225. { memory sizes, will be overriden by parameter or default for target
  1226. in options or init_parser }
  1227. stacksize:=0;
  1228. { not initialized yet }
  1229. jmp_buf_size:=-1;
  1230. apptype:=app_cui;
  1231. { Init values }
  1232. init_settings:=default_settings;
  1233. if init_settings.optimizecputype=cpu_none then
  1234. init_settings.optimizecputype:=init_settings.cputype;
  1235. LinkLibraryAliases :=TLinkStrMap.Create;
  1236. LinkLibraryOrder :=TLinkStrMap.Create;
  1237. { enable all features by default }
  1238. features:=[low(Tfeature)..high(Tfeature)];
  1239. end;
  1240. end.