fpswitch.pas 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Compiler switches routines for the IDE
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  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.
  11. **********************************************************************}
  12. unit FPSwitch;
  13. interface
  14. uses
  15. Objects,
  16. Systems,
  17. WUtils,
  18. FPConst;
  19. const
  20. MinMemSize = 1024; { min. local heap and stack size }
  21. MaxMemSize = 67107840; { max. local heap and stack size }
  22. type
  23. TParamID =
  24. (idNone,idAlign,idRangeChecks,idStackChecks,idIOChecks,
  25. idOverflowChecks,idAsmDirect,idAsmATT,idAsmIntel,
  26. idSymInfNone,idSymInfGlobalOnly,idSymInfGlobalLocal,
  27. idStackSize,idHeapSize,idStrictVarStrings,idExtendedSyntax,
  28. idMMXOps,idTypedAddress,idPackRecords,idPackEnum,idStackFrames,
  29. idReferenceInfo,idDebugInfo,idBoolEval,
  30. idLongString,idTypeInfo);
  31. TSwitchMode = (om_Normal,om_Debug,om_Release);
  32. TSwitchItemTyp = (ot_Select,ot_Boolean,ot_String,ot_Longint);
  33. PSwitchItem = ^TSwitchItem;
  34. TSwitchItem = object(TObject)
  35. Typ : TSwitchItemTyp;
  36. Name : string[50];
  37. Param : string[10];
  38. ParamID : TParamID;
  39. constructor Init(const n,p:string; AID: TParamID);
  40. function NeedParam:boolean;virtual;
  41. function ParamValue:string;virtual;
  42. function ParamValueBool(SM: TSwitchMode):boolean;virtual;
  43. function GetSwitchStr(SM: TSwitchMode): string; virtual;
  44. function GetNumberStr(SM: TSwitchMode): string; virtual;
  45. function GetOptionStr(SM: TSwitchMode): string; virtual;
  46. procedure Reset;virtual;
  47. end;
  48. PSelectItem = ^TSelectItem;
  49. TSelectItem = object(TSwitchItem)
  50. constructor Init(const n,p:string; AID: TParamID);
  51. end;
  52. PBooleanItem = ^TBooleanItem;
  53. TBooleanItem = object(TSwitchItem)
  54. IsSet : array[TSwitchMode] of boolean;
  55. constructor Init(const n,p:string; AID: TParamID);
  56. function NeedParam:boolean;virtual;
  57. procedure Reset;virtual;
  58. function GetSwitchStr(SM: TSwitchMode): string; virtual;
  59. function ParamValueBool(SM: TSwitchMode):boolean;virtual;
  60. end;
  61. PStringItem = ^TStringItem;
  62. TStringItem = object(TSwitchItem)
  63. Str : array[TSwitchMode] of string;
  64. multiple : boolean;
  65. constructor Init(const n,p:string;AID: TParamID; mult:boolean);
  66. function NeedParam:boolean;virtual;
  67. function ParamValue:string;virtual;
  68. procedure Reset;virtual;
  69. end;
  70. PLongintItem = ^TLongintItem;
  71. TLongintItem = object(TSwitchItem)
  72. Val : array[TSwitchMode] of longint;
  73. constructor Init(const n,p:string; AID: TParamID);
  74. function NeedParam:boolean;virtual;
  75. function ParamValue:string;virtual;
  76. function GetNumberStr(SM: TSwitchMode): string; virtual;
  77. procedure Reset;virtual;
  78. end;
  79. PSwitches = ^TSwitches;
  80. TSwitches = object
  81. constructor Init(ch:char);
  82. constructor InitSelect(ch:char);
  83. destructor Done;
  84. { general items }
  85. function ItemCount:integer;
  86. function ItemName(index:integer):string;
  87. function ItemParam(index:integer):string;
  88. { type specific }
  89. procedure AddSelectItem(const name,param:string; AID: TParamID);
  90. procedure AddBooleanItem(const name,param:string; AID: TParamID);
  91. procedure AddLongintItem(const name,param:string; AID: TParamID);
  92. procedure AddStringItem(const name,param:string;AID: TParamID;mult:boolean);
  93. function GetCurrSel:integer;
  94. function GetCurrSelParam : String;
  95. function GetBooleanItem(index:integer):boolean;
  96. function GetLongintItem(index:integer):longint;
  97. function GetStringItem(index:integer):string;
  98. procedure SetCurrSel(index:integer);
  99. function SetCurrSelParam(const s : String) : boolean;
  100. procedure SetBooleanItem(index:integer;b:boolean);
  101. procedure SetLongintItem(index:integer;l:longint);
  102. procedure SetStringItem(index:integer;const s:string);
  103. { read / write to cfgfile which must be open }
  104. procedure WriteItemsCfg;
  105. function ReadItemsCfg(const s:string):boolean;
  106. private
  107. IsSel : boolean;
  108. Prefix : char;
  109. SelNr : array[TSwitchMode] of integer;
  110. Items : PCollection;
  111. end;
  112. const
  113. SwitchesMode : TSwitchMode = om_Normal;
  114. SwitchesModeName : array[TSwitchMode] of string[10]=
  115. ('~N~ormal','~D~ebug','~R~elease');
  116. SwitchesModeStr : array[TSwitchMode] of string[8]=
  117. ('NORMAL','DEBUG','RELEASE');
  118. CustomArg : array[TSwitchMode] of string{$ifndef FPC}[128]{$endif}=
  119. ('','','');
  120. var
  121. LibLinkerSwitches,
  122. DebugInfoSwitches,
  123. ProfileInfoSwitches,
  124. {MemorySizeSwitches, doubled !! }
  125. SyntaxSwitches,
  126. VerboseSwitches,
  127. CodegenSwitches,
  128. OptimizationSwitches,
  129. OptimizingGoalSwitches,
  130. ProcessorSwitches,
  131. AsmReaderSwitches,
  132. AsmInfoSwitches,
  133. AsmOutputSwitches,
  134. TargetSwitches,
  135. ConditionalSwitches,
  136. MemorySwitches,
  137. BrowserSwitches,
  138. DirectorySwitches : PSwitches;
  139. { write/read the Switches to ppc.cfg file }
  140. procedure WriteSwitches(const fn:string);
  141. procedure ReadSwitches(const fn:string);
  142. { initialize }
  143. procedure InitSwitches;
  144. procedure SetDefaultSwitches;
  145. procedure DoneSwitches;
  146. function GetSourceDirectories : string;
  147. procedure GetCompilerOptionLines(C: PUnsortedStringCollection);
  148. implementation
  149. uses
  150. Dos,
  151. GlobType,
  152. FPString,FPVars,FPUtils;
  153. var
  154. CfgFile : text;
  155. {*****************************************************************************
  156. TSwitchItem
  157. *****************************************************************************}
  158. constructor TSwitchItem.Init(const n,p:string; AID: TParamID);
  159. begin
  160. Inherited Init;
  161. Name:=n;
  162. Param:=p;
  163. ParamID:=AID;
  164. end;
  165. function TSwitchItem.NeedParam:boolean;
  166. begin
  167. NeedParam:=false;
  168. end;
  169. function TSwitchItem.ParamValue:string;
  170. begin
  171. ParamValue:='';
  172. end;
  173. function TSwitchItem.ParamValueBool(SM: TSwitchMode):boolean;
  174. begin
  175. Abstract;
  176. ParamValueBool:=false;
  177. end;
  178. function TSwitchItem.GetSwitchStr(SM: TSwitchMode): string;
  179. begin
  180. Abstract;
  181. GetSwitchStr:='';
  182. end;
  183. function TSwitchItem.GetNumberStr(SM: TSwitchMode): string;
  184. begin
  185. Abstract;
  186. GetNumberStr:='';
  187. end;
  188. function TSwitchItem.GetOptionStr(SM: TSwitchMode): string;
  189. begin
  190. Abstract;
  191. GetOptionStr:='';
  192. end;
  193. procedure TSwitchItem.Reset;
  194. begin
  195. end;
  196. {*****************************************************************************
  197. TSelectItem
  198. *****************************************************************************}
  199. constructor TSelectItem.Init(const n,p:string; AID: TParamID);
  200. begin
  201. Inherited Init(n,p,AID);
  202. Typ:=ot_Select;
  203. end;
  204. {*****************************************************************************
  205. TBooleanItem
  206. *****************************************************************************}
  207. constructor TBooleanItem.Init(const n,p:string; AID: TParamID);
  208. begin
  209. Inherited Init(n,p,AID);
  210. Typ:=ot_Boolean;
  211. Reset;
  212. end;
  213. function TBooleanItem.NeedParam:boolean;
  214. begin
  215. NeedParam:=IsSet[SwitchesMode];
  216. end;
  217. procedure TBooleanItem.Reset;
  218. begin
  219. FillChar(IsSet,sizeof(IsSet),0);
  220. end;
  221. function TBooleanItem.ParamValueBool(SM: TSwitchMode):boolean;
  222. begin
  223. ParamValueBool:=IsSet[SM];
  224. end;
  225. function TBooleanItem.GetSwitchStr(SM: TSwitchMode): string;
  226. begin
  227. GetSwitchStr:=BoolToStr(IsSet[SM],'+','-');
  228. end;
  229. {*****************************************************************************
  230. TStringItem
  231. *****************************************************************************}
  232. constructor TStringItem.Init(const n,p:string; AID: TParamID; mult:boolean);
  233. begin
  234. Inherited Init(n,p,AID);
  235. Typ:=ot_String;
  236. Multiple:=mult;
  237. Reset;
  238. end;
  239. function TStringItem.NeedParam:boolean;
  240. begin
  241. NeedParam:=(Str[SwitchesMode]<>'');
  242. end;
  243. function TStringItem.ParamValue:string;
  244. begin
  245. ParamValue:=Str[SwitchesMode];
  246. end;
  247. procedure TStringItem.Reset;
  248. begin
  249. FillChar(Str,sizeof(Str),0);
  250. end;
  251. {*****************************************************************************
  252. TLongintItem
  253. *****************************************************************************}
  254. constructor TLongintItem.Init(const n,p:string; AID: TParamID);
  255. begin
  256. Inherited Init(n,p,AID);
  257. Typ:=ot_Longint;
  258. Reset;
  259. end;
  260. function TLongintItem.NeedParam:boolean;
  261. begin
  262. NeedParam:=(Val[SwitchesMode]<>0);
  263. end;
  264. function TLongintItem.ParamValue:string;
  265. var
  266. s : string;
  267. begin
  268. Str(Val[SwitchesMode],s);
  269. ParamValue:=s;
  270. end;
  271. procedure TLongintItem.Reset;
  272. begin
  273. FillChar(Val,sizeof(Val),0);
  274. end;
  275. function TLongintItem.GetNumberStr(SM: TSwitchMode): string;
  276. begin
  277. GetNumberStr:=IntToStr(Val[SM]);
  278. end;
  279. {*****************************************************************************
  280. TSwitch
  281. *****************************************************************************}
  282. constructor TSwitches.Init(ch:char);
  283. begin
  284. new(Items,Init(10,5));
  285. Prefix:=ch;
  286. FillChar(SelNr,SizeOf(SelNr),#0);
  287. IsSel:=false;
  288. end;
  289. constructor TSwitches.InitSelect(ch:char);
  290. begin
  291. new(Items,Init(10,5));
  292. Prefix:=ch;
  293. FillChar(SelNr,SizeOf(SelNr),#0);
  294. IsSel:=true;
  295. end;
  296. destructor TSwitches.Done;
  297. begin
  298. dispose(Items,Done);
  299. end;
  300. procedure TSwitches.AddSelectItem(const name,param:string; AID: TParamID);
  301. begin
  302. Items^.Insert(New(PSelectItem,Init(name,Param,AID)));
  303. end;
  304. procedure TSwitches.AddBooleanItem(const name,param:string; AID: TParamID);
  305. begin
  306. Items^.Insert(New(PBooleanItem,Init(name,Param,AID)));
  307. end;
  308. procedure TSwitches.AddLongintItem(const name,param:string; AID: TParamID);
  309. begin
  310. Items^.Insert(New(PLongintItem,Init(name,Param,AID)));
  311. end;
  312. procedure TSwitches.AddStringItem(const name,param:string;AID: TParamID;mult:boolean);
  313. begin
  314. Items^.Insert(New(PStringItem,Init(name,Param,AID,mult)));
  315. end;
  316. function TSwitches.ItemCount:integer;
  317. begin
  318. ItemCount:=Items^.Count;
  319. end;
  320. function TSwitches.ItemName(index:integer):string;
  321. var
  322. P : PSwitchItem;
  323. begin
  324. P:=Items^.At(Index);
  325. if assigned(P) then
  326. ItemName:=P^.Name
  327. else
  328. ItemName:='';
  329. end;
  330. function TSwitches.ItemParam(index:integer):string;
  331. var
  332. P : PSwitchItem;
  333. begin
  334. P:=Items^.At(Index);
  335. if assigned(P) then
  336. ItemParam:='-'+Prefix+P^.Param
  337. else
  338. ItemParam:='';
  339. end;
  340. function TSwitches.GetBooleanItem(index:integer):boolean;
  341. var
  342. P : PBooleanItem;
  343. begin
  344. P:=Items^.At(Index);
  345. if assigned(P) and (P^.Typ=ot_boolean) then
  346. GetBooleanItem:=P^.IsSet[SwitchesMode]
  347. else
  348. GetBooleanItem:=false;
  349. end;
  350. function TSwitches.GetLongintItem(index:integer):longint;
  351. var
  352. P : PLongintItem;
  353. begin
  354. P:=Items^.At(Index);
  355. if assigned(P) and (P^.Typ=ot_longint) then
  356. GetLongintItem:=P^.Val[SwitchesMode]
  357. else
  358. GetLongintItem:=0;
  359. end;
  360. function TSwitches.GetStringItem(index:integer):string;
  361. var
  362. P : PStringItem;
  363. begin
  364. P:=Items^.At(Index);
  365. if assigned(P) and (P^.Typ=ot_string) then
  366. GetStringItem:=P^.Str[SwitchesMode]
  367. else
  368. GetStringItem:='';
  369. end;
  370. procedure TSwitches.SetBooleanItem(index:integer;b:boolean);
  371. var
  372. P : PBooleanItem;
  373. begin
  374. P:=Items^.At(Index);
  375. if assigned(P) and (P^.Typ=ot_boolean) then
  376. P^.IsSet[SwitchesMode]:=b;
  377. end;
  378. procedure TSwitches.SetLongintItem(index:integer;l:longint);
  379. var
  380. P : PLongintItem;
  381. begin
  382. P:=Items^.At(Index);
  383. if assigned(P) and (P^.Typ=ot_longint) then
  384. P^.Val[SwitchesMode]:=l;
  385. end;
  386. procedure TSwitches.SetStringItem(index:integer;const s:string);
  387. var
  388. P : PStringItem;
  389. begin
  390. P:=Items^.At(Index);
  391. if assigned(P) and (P^.Typ=ot_string) then
  392. P^.Str[SwitchesMode]:=s;
  393. end;
  394. function TSwitches.GetCurrSel:integer;
  395. begin
  396. if IsSel then
  397. GetCurrSel:=SelNr[SwitchesMode]
  398. else
  399. GetCurrSel:=-1;
  400. end;
  401. function TSwitches.GetCurrSelParam : String;
  402. begin
  403. if IsSel then
  404. GetCurrSelParam:=PSwitchItem(Items^.At(SelNr[SwitchesMode]))^.Param
  405. else
  406. GetCurrSelParam:='';
  407. end;
  408. procedure TSwitches.SetCurrSel(index:integer);
  409. begin
  410. if IsSel then
  411. SelNr[SwitchesMode]:=index;
  412. end;
  413. function TSwitches.SetCurrSelParam(const s : String) : boolean;
  414. function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
  415. begin
  416. { empty items are not equivalent to others !! }
  417. CheckItem:=((S='') and (P^.Param='')) or
  418. ((Length(S)>0) and (P^.Param=s));
  419. end;
  420. var
  421. FoundP : PSwitchItem;
  422. begin
  423. FoundP:=Items^.FirstThat(@CheckItem);
  424. if Assigned(FoundP) then
  425. begin
  426. SetCurrSelParam:=true;
  427. SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
  428. end
  429. else
  430. SetCurrSelParam:=false;
  431. end;
  432. procedure TSwitches.WriteItemsCfg;
  433. var
  434. Pref : char;
  435. procedure writeitem(P:PSwitchItem);{$ifndef FPC}far;{$endif}
  436. var
  437. s,s1 : string;
  438. i,j : integer;
  439. begin
  440. if P^.NeedParam then
  441. begin
  442. if (P^.Typ=ot_string) and (PStringItem(P)^.Multiple) then
  443. begin
  444. s:=PStringItem(P)^.Str[SwitchesMode];
  445. repeat
  446. i:=pos(';',s);
  447. j:=pos(' ',s);
  448. if i=0 then
  449. i:=256;
  450. if (j>0) and (j<i) then
  451. i:=j;
  452. s1:=Copy(s,1,i-1);
  453. if s1<>'' then
  454. writeln(CfgFile,' -'+Pref+P^.Param+s1);
  455. Delete(s,1,i);
  456. until s='';
  457. end
  458. else
  459. Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
  460. end;
  461. end;
  462. begin
  463. Pref:=Prefix;
  464. if IsSel then
  465. writeln(CfgFile,' '+ItemParam(SelNr[SwitchesMode]))
  466. else
  467. Items^.ForEach(@writeitem);
  468. end;
  469. procedure WriteCustom;
  470. var
  471. s : string;
  472. i : longint;
  473. begin
  474. s:=CustomArg[SwitchesMode];
  475. While s<>'' do
  476. begin
  477. i:=pos(' ',s);
  478. if i=0 then i:=256;
  479. writeln(CfgFile,' '+Copy(s,1,i-1));
  480. if i=256 then
  481. s:=''
  482. else
  483. s:=copy(s,i+1,255);
  484. end;
  485. end;
  486. function TSwitches.ReadItemsCfg(const s:string):boolean;
  487. function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
  488. begin
  489. { empty items are not equivalent to others !! }
  490. CheckItem:=((S='') and (P^.Param='')) or
  491. ((Length(S)>0) and (P^.Param=Copy(s,1,length(P^.Param))));
  492. end;
  493. var
  494. FoundP : PSwitchItem;
  495. code : integer;
  496. begin
  497. FoundP:=Items^.FirstThat(@checkitem);
  498. if assigned(FoundP) then
  499. begin
  500. case FoundP^.Typ of
  501. ot_Select : SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
  502. ot_Boolean : PBooleanItem(FoundP)^.IsSet[SwitchesMode]:=true;
  503. ot_String : begin
  504. if (PStringItem(FoundP)^.Multiple) and (PStringItem(FoundP)^.Str[SwitchesMode]<>'') then
  505. PStringItem(FoundP)^.Str[SwitchesMode]:=PStringItem(FoundP)^.Str[SwitchesMode]+';'+
  506. Copy(s,length(FoundP^.Param)+1,255)
  507. else
  508. PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
  509. end;
  510. ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
  511. end;
  512. ReadItemsCfg:=true;
  513. end
  514. else
  515. ReadItemsCfg:=false;
  516. end;
  517. {*****************************************************************************
  518. Read / Write
  519. *****************************************************************************}
  520. procedure WriteSwitches(const fn:string);
  521. var
  522. OldSwitchesMode : TSwitchMode;
  523. begin
  524. { create the switches }
  525. assign(CfgFile,fn);
  526. {$I-}
  527. rewrite(CfgFile);
  528. {$I+}
  529. if ioresult<>0 then
  530. exit;
  531. writeln(CfgFile,'# '+msg_automaticallycreateddontedit);
  532. OldSwitchesMode:=SwitchesMode;
  533. for SwitchesMode:=low(TSwitchMode) to high(TSwitchMode) do
  534. begin
  535. Writeln(CfgFile,'#IFDEF '+SwitchesModeStr[SwitchesMode]);
  536. TargetSwitches^.WriteItemsCfg;
  537. VerboseSwitches^.WriteItemsCfg;
  538. SyntaxSwitches^.WriteItemsCfg;
  539. CodegenSwitches^.WriteItemsCfg;
  540. OptimizationSwitches^.WriteItemsCfg;
  541. OptimizingGoalSwitches^.WriteItemsCfg;
  542. ProcessorSwitches^.WriteItemsCfg;
  543. AsmReaderSwitches^.WriteItemsCfg;
  544. AsmInfoSwitches^.WriteItemsCfg;
  545. AsmOutputSwitches^.WriteItemsCfg;
  546. DirectorySwitches^.WriteItemsCfg;
  547. MemorySwitches^.WriteItemsCfg;
  548. ConditionalSwitches^.WriteItemsCfg;
  549. LibLinkerSwitches^.WriteItemsCfg;
  550. DebugInfoSwitches^.WriteItemsCfg;
  551. ProfileInfoSwitches^.WriteItemsCfg;
  552. BrowserSwitches^.WriteItemsCfg;
  553. {MemorySizeSwitches^.WriteItemsCfg;}
  554. WriteCustom;
  555. Writeln(CfgFile,'#ENDIF');
  556. Writeln(CfgFile,'');
  557. end;
  558. close(CfgFile);
  559. SwitchesMode:=OldSwitchesMode;
  560. end;
  561. procedure ReadSwitches(const fn:string);
  562. var
  563. c : char;
  564. s : string;
  565. res : boolean;
  566. OldSwitchesMode,i : TSwitchMode;
  567. begin
  568. assign(CfgFile,fn);
  569. {$I-}
  570. reset(CfgFile);
  571. {$I+}
  572. if ioresult<>0 then
  573. begin
  574. SetDefaultSwitches;
  575. exit;
  576. end;
  577. OldSwitchesMode:=SwitchesMode;
  578. SwitchesMode:=om_Normal;
  579. while not eof(CfgFile) do
  580. begin
  581. readln(CfgFile,s);
  582. s:=LTrim(s);
  583. if (length(s)>=2) and (s[1]='-') then
  584. begin
  585. c:=s[2];
  586. res:=false;
  587. Delete(s,1,2);
  588. case c of
  589. 'a' : res:=AsmInfoSwitches^.ReadItemsCfg(s);
  590. 'A' : res:=AsmOutputSwitches^.ReadItemsCfg(s);
  591. 'b' : res:=BrowserSwitches^.ReadItemsCfg(s);
  592. 'C' : begin
  593. res:=CodegenSwitches^.ReadItemsCfg(s);
  594. if not res then
  595. res:=MemorySwitches^.ReadItemsCfg(s);
  596. end;
  597. 'd' : res:=ConditionalSwitches^.ReadItemsCfg(s);
  598. 'F' : res:=DirectorySwitches^.ReadItemsCfg(s);
  599. 'g' : res:=DebugInfoSwitches^.ReadItemsCfg(s);
  600. 'O' : begin
  601. res:=true;
  602. if not OptimizationSwitches^.ReadItemsCfg(s) then
  603. if not ProcessorSwitches^.ReadItemsCfg(s) then
  604. res:=OptimizingGoalSwitches^.ReadItemsCfg(s);
  605. end;
  606. 'p' : res:=ProfileInfoSwitches^.ReadItemsCfg(s);
  607. 'R' : res:=AsmReaderSwitches^.ReadItemsCfg(s);
  608. 'S' : res:=SyntaxSwitches^.ReadItemsCfg(s);
  609. 'T' : res:=TargetSwitches^.ReadItemsCfg(s);
  610. 'v' : res:=VerboseSwitches^.ReadItemsCfg(s);
  611. 'X' : res:=LibLinkerSwitches^.ReadItemsCfg(s);
  612. end;
  613. { keep all others as a string }
  614. if not res then
  615. CustomArg[SwitchesMode]:=CustomArg[SwitchesMode]+' -'+c+s;
  616. end
  617. else
  618. if (Copy(s,1,7)='#IFDEF ') then
  619. begin
  620. Delete(s,1,7);
  621. for i:=low(TSwitchMode) to high(TSwitchMode) do
  622. if s=SwitchesModeStr[i] then
  623. begin
  624. SwitchesMode:=i;
  625. break;
  626. end;
  627. end
  628. else;
  629. end;
  630. close(CfgFile);
  631. SwitchesMode:=OldSwitchesMode;
  632. end;
  633. function GetSourceDirectories : string;
  634. var
  635. P : PStringItem;
  636. S : String;
  637. c : char;
  638. function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
  639. begin
  640. CheckItem:=(P^.Typ=ot_string) and (P^.Param=c);
  641. end;
  642. begin
  643. GetSourceDirectories:='';
  644. c:='u';
  645. P:=DirectorySwitches^.Items^.FirstThat(@CheckItem);
  646. S:='';
  647. if assigned(P) then
  648. S:=P^.Str[SwitchesMode];
  649. c:='i';
  650. P:=DirectorySwitches^.Items^.FirstThat(@CheckItem);
  651. if assigned(P) then
  652. S:=P^.Str[SwitchesMode]+';'+S;
  653. if S='' then
  654. GetSourceDirectories:=SourceDirs+';'
  655. else
  656. GetSourceDirectories:=SourceDirs+';'+S+';';
  657. end;
  658. {*****************************************************************************
  659. Initialize
  660. *****************************************************************************}
  661. procedure InitSwitches;
  662. begin
  663. New(SyntaxSwitches,Init('S'));
  664. with SyntaxSwitches^ do
  665. begin
  666. AddBooleanItem(opt_delphi2extensions,'2',idNone);
  667. AddBooleanItem(opt_clikeoperators,'c',idNone);
  668. AddBooleanItem(opt_stopafterfirsterror,'e',idNone);
  669. AddBooleanItem(opt_allowlabelandgoto,'g',idNone);
  670. AddBooleanItem(opt_cplusplusstyledinline,'i',idNone);
  671. AddBooleanItem(opt_globalcmacros,'m',idNone);
  672. AddBooleanItem(opt_tp7compatibility,'o',idNone);
  673. AddBooleanItem(opt_delphicompatibility,'d',idNone);
  674. AddBooleanItem(opt_allowstaticinobjects,'s',idNone);
  675. AddBooleanItem(opt_strictvarstrings,'',idStrictVarStrings);
  676. AddBooleanItem(opt_extendedsyntax,'',idExtendedSyntax);
  677. AddBooleanItem(opt_allowmmxoperations,'',idMMXOps);
  678. end;
  679. New(VerboseSwitches,Init('v'));
  680. with VerboseSwitches^ do
  681. begin
  682. AddBooleanItem(opt_warnings,'w',idNone);
  683. AddBooleanItem(opt_notes,'n',idNone);
  684. AddBooleanItem(opt_hints,'h',idNone);
  685. AddBooleanItem(opt_generalinfo,'i',idNone);
  686. AddBooleanItem(opt_usedtriedinfo,'ut',idNone);
  687. AddBooleanItem(opt_all,'a',idNone);
  688. AddBooleanItem(opt_showallprocsonerror,'b',idNone);
  689. end;
  690. New(CodegenSwitches,Init('C'));
  691. with CodegenSwitches^ do
  692. begin
  693. AddBooleanItem(opt_rangechecking,'r',idRangeChecks);
  694. AddBooleanItem(opt_stackchecking,'t',idStackChecks);
  695. AddBooleanItem(opt_iochecking,'i',idIOChecks);
  696. AddBooleanItem(opt_overflowchecking,'o',idOverflowChecks);
  697. end;
  698. New(OptimizingGoalSwitches,InitSelect('O'));
  699. with OptimizingGoalSwitches^ do
  700. begin
  701. AddSelectItem(opt_generatefastercode,'G',idNone);
  702. AddSelectItem(opt_generatesmallercode,'g',idNone);
  703. end;
  704. New(OptimizationSwitches,Init('O'));
  705. with OptimizationSwitches^ do
  706. begin
  707. AddBooleanItem(opt_useregistervariables,'r',idNone);
  708. AddBooleanItem(opt_uncertainoptimizations,'u',idNone);
  709. AddBooleanItem(opt_level1optimizations,'1',idNone);
  710. AddBooleanItem(opt_level2optimizations,'2',idNone);
  711. end;
  712. New(ProcessorSwitches,InitSelect('O'));
  713. with ProcessorSwitches^ do
  714. begin
  715. AddSelectItem(opt_i386486,'p1',idNone);
  716. AddSelectItem(opt_pentiumandmmx,'p2',idNone);
  717. AddSelectItem(opt_pentiumpro,'p3',idNone);
  718. end;
  719. New(TargetSwitches,InitSelect('T'));
  720. with TargetSwitches^ do
  721. begin
  722. AddSelectItem('DOS (GO32V~1~)','go32v1',idNone);
  723. AddSelectItem('~D~OS (GO32V2)','go32v2',idNone);
  724. AddSelectItem('~L~inux','linux',idNone);
  725. AddSelectItem('~O~S/2','os2',idNone);
  726. AddSelectItem('~W~IN32','win32',idNone);
  727. end;
  728. New(AsmReaderSwitches,InitSelect('R'));
  729. with AsmReaderSwitches^ do
  730. begin
  731. AddSelectItem(opt_directassembler,'direct',idAsmDirect);
  732. AddSelectItem(opt_attassembler,'att',idAsmATT);
  733. AddSelectItem(opt_intelassembler,'intel',idAsmIntel);
  734. end;
  735. New(AsmInfoSwitches,Init('a'));
  736. with AsmInfoSwitches^ do
  737. begin
  738. AddBooleanItem(opt_listsource,'l',idNone);
  739. AddBooleanItem(opt_listregisterallocation,'r',idNone);
  740. AddBooleanItem(opt_listtempallocation,'t',idNone);
  741. end;
  742. New(AsmOutputSwitches,InitSelect('A'));
  743. with AsmOutputSwitches^ do
  744. begin
  745. AddSelectItem(opt_usegnuas,'as',idNone);
  746. AddSelectItem(opt_usenasmcoff,'nasmcoff',idNone);
  747. AddSelectItem(opt_usenasmelf,'nasmelf',idNone);
  748. AddSelectItem(opt_usenasmobj,'nasmobj',idNone);
  749. AddSelectItem(opt_usemasm,'masm',idNone);
  750. AddSelectItem(opt_usetasm,'tasm',idNone);
  751. AddSelectItem(opt_usecoff,'coff',idNone);
  752. AddSelectItem(opt_usepecoff,'pecoff',idNone);
  753. end;
  754. New(BrowserSwitches,InitSelect('b'));
  755. with BrowserSwitches^ do
  756. begin
  757. AddSelectItem(opt_nobrowser,'-',idSymInfNone);
  758. AddSelectItem(opt_globalonlybrowser,'+',idSymInfGlobalOnly);
  759. AddSelectItem(opt_localglobalbrowser,'l',idSymInfGlobalLocal);
  760. end;
  761. New(ConditionalSwitches,Init('d'));
  762. with ConditionalSwitches^ do
  763. begin
  764. AddStringItem(opt_conditionaldefines,'',idNone,true);
  765. end;
  766. New(MemorySwitches,Init('C'));
  767. with MemorySwitches^ do
  768. begin
  769. AddLongintItem(opt_stacksize,'s',idStackSize);
  770. AddLongintItem(opt_heapsize,'h',idHeapSize);
  771. end;
  772. New(DirectorySwitches,Init('F'));
  773. with DirectorySwitches^ do
  774. begin
  775. AddStringItem(opt_unitdirectories,'u',idNone,true);
  776. AddStringItem(opt_includedirectories,'i',idNone,true);
  777. AddStringItem(opt_librarydirectories,'l',idNone,true);
  778. AddStringItem(opt_objectdirectories,'o',idNone,true);
  779. AddStringItem(opt_exeppudirectories,'E',idNone,true);
  780. end;
  781. New(LibLinkerSwitches,InitSelect('X'));
  782. with LibLinkerSwitches^ do
  783. begin
  784. AddSelectItem(opt_dynamiclibraries,'D',idNone);
  785. AddSelectItem(opt_staticlibraries,'S',idNone);
  786. end;
  787. New(DebugInfoSwitches,InitSelect('g'));
  788. with DebugInfoSwitches^ do
  789. begin
  790. AddSelectItem(opt_stripalldebugsymbols,'-',idNone);
  791. AddSelectItem(opt_gendebugsymbolinfo,'',idNone);
  792. AddSelectItem(opt_gensymbolandbacktraceinfo,'l',idNone);
  793. { AddSelectItem('Generate ~d~bx symbol information','d');
  794. does not work anyhow (PM) }
  795. end;
  796. New(ProfileInfoSwitches,InitSelect('p'));
  797. with ProfileInfoSwitches^ do
  798. begin
  799. AddSelectItem(opt_noprofileinfo,'-',idNone);
  800. AddSelectItem(opt_gprofinfo,'g',idNone);
  801. end;
  802. {New(MemorySizeSwitches,Init('C'));
  803. with MemorySizeSwitches^ do
  804. begin
  805. AddLongIntItem('~S~tack size','s');
  806. AddLongIntItem('Local ~h~eap size','h');
  807. end;}
  808. SwitchesPath:=LocateFile(SwitchesName);
  809. if SwitchesPath='' then
  810. SwitchesPath:=SwitchesName;
  811. SwitchesPath:=FExpand(SwitchesPath);
  812. end;
  813. procedure SetDefaultSwitches;
  814. var
  815. i,OldSwitchesMode : TSwitchMode;
  816. begin
  817. { setup some useful defaults }
  818. OldSwitchesMode:=SwitchesMode;
  819. for i:=low(TSwitchMode) to high(TSwitchMode) do
  820. begin
  821. SwitchesMode:=i;
  822. { default is Pentium }
  823. ProcessorSwitches^.SetCurrSel(1);
  824. { AT&T reader }
  825. AsmReaderSwitches^.SetCurrSel(1);
  826. { 128k stack }
  827. MemorySwitches^.SetLongintItem(0,65536*2);
  828. { 2 MB heap }
  829. MemorySwitches^.SetLongintItem(1,1024*1024*2);
  830. { goto/lable allowed }
  831. SyntaxSwitches^.SetBooleanItem(3,true);
  832. case i of
  833. om_debug:
  834. begin
  835. { debugging info on }
  836. DebugInfoSwitches^.SetCurrSel(1);
  837. { range checking }
  838. CodegenSwitches^.SetBooleanItem(0,true);
  839. { io checking }
  840. CodegenSwitches^.SetBooleanItem(2,true);
  841. { overflow checking }
  842. CodegenSwitches^.SetBooleanItem(3,true);
  843. end;
  844. om_normal:
  845. begin
  846. OptimizationSwitches^.SetBooleanItem(2,true);
  847. end;
  848. om_release:
  849. begin
  850. OptimizationSwitches^.SetBooleanItem(2,true);
  851. OptimizationSwitches^.SetBooleanItem(3,true);
  852. end;
  853. end;
  854. { set appriopriate default target }
  855. {$ifdef go32v2}
  856. TargetSwitches^.SetCurrSel(1);
  857. {$endif}
  858. {$ifdef linux}
  859. TargetSwitches^.SetCurrSel(2);
  860. {$endif}
  861. {$ifdef win32}
  862. TargetSwitches^.SetCurrSel(4);
  863. {$endif}
  864. {$ifdef os2}
  865. TargetSwitches^.SetCurrSel(3);
  866. {$endif}
  867. end;
  868. SwitchesMode:=OldSwitchesMode;
  869. end;
  870. procedure DoneSwitches;
  871. begin
  872. dispose(SyntaxSwitches,Done);
  873. dispose(VerboseSwitches,Done);
  874. dispose(CodegenSwitches,Done);
  875. dispose(OptimizationSwitches,Done);
  876. dispose(OptimizingGoalSwitches,Done);
  877. dispose(ProcessorSwitches,Done);
  878. dispose(BrowserSwitches,Done);
  879. dispose(TargetSwitches,Done);
  880. dispose(AsmReaderSwitches,Done);
  881. dispose(ConditionalSwitches,Done);
  882. dispose(MemorySwitches,Done);
  883. {dispose(MemorySizeSwitches,Done);}
  884. dispose(DirectorySwitches,Done);
  885. dispose(DebugInfoSwitches,Done);
  886. dispose(LibLinkerSwitches,Done);
  887. dispose(ProfileInfoSwitches,Done);
  888. end;
  889. procedure GetCompilerOptionLines(C: PUnsortedStringCollection);
  890. procedure AddLine(const S: string);
  891. begin
  892. C^.Insert(NewStr(S));
  893. end;
  894. procedure ConstructSwitchModeDirectives(SM: TSwitchMode; const IfDefSym: string);
  895. var SwitchParams: PStringCollection;
  896. MiscParams : PStringCollection;
  897. procedure AddSwitch(const S: string);
  898. begin
  899. SwitchParams^.Insert(NewStr(S));
  900. end;
  901. procedure AddParam(const S: string);
  902. begin
  903. MiscParams^.Insert(NewStr(S));
  904. end;
  905. procedure EnumSwitches(P: PSwitches);
  906. procedure HandleSwitch(P: PSwitchItem); {$ifndef FPC}far;{$endif}
  907. begin
  908. case P^.ParamID of
  909. { idAlign :}
  910. idRangeChecks : AddSwitch('R'+P^.GetSwitchStr(SM));
  911. idStackChecks : AddSwitch('S'+P^.GetSwitchStr(SM));
  912. idIOChecks : AddSwitch('I'+P^.GetSwitchStr(SM));
  913. idOverflowChecks : AddSwitch('Q'+P^.GetSwitchStr(SM));
  914. { idAsmDirect : if P^.GetParamValueBool[SM] then AddParam('ASMMODE DIRECT');
  915. idAsmATT : if P^.GetParamValueBool[SM] then AddParam('ASMMODE ATT');
  916. idAsmIntel : if P^.GetParamValueBool[SM] then AddParam('ASMMODE INTEL');}
  917. { idSymInfNone : ;
  918. idSymInfGlobalOnly:;
  919. idSymInfGlobalLocal:if P^.ParamValueBool(SM) then AddSwitch('L+');}
  920. { idStackSize
  921. idHeapSize}
  922. idStrictVarStrings: AddSwitch('V'+P^.GetSwitchStr(SM));
  923. idExtendedSyntax : AddSwitch('X'+P^.GetSwitchStr(SM));
  924. idMMXOps : if P^.ParamValueBool(SM) then AddParam('MMX');
  925. idTypedAddress : AddSwitch('T'+P^.GetSwitchStr(SM));
  926. { idPackRecords
  927. idPackEnum}
  928. idStackFrames : AddSwitch('W'+P^.GetSwitchStr(SM));
  929. idReferenceInfo : AddSwitch('Y'+P^.GetSwitchStr(SM));
  930. idDebugInfo : AddSwitch('D'+P^.GetSwitchStr(SM));
  931. idBoolEval : AddSwitch('B'+P^.GetSwitchStr(SM));
  932. idLongString : AddSwitch('H'+P^.GetSwitchStr(SM));
  933. idTypeInfo : AddSwitch('M'+P^.GetSwitchStr(SM));
  934. end;
  935. end;
  936. begin
  937. P^.Items^.ForEach(@HandleSwitch);
  938. end;
  939. var I: integer;
  940. S: string;
  941. begin
  942. AddLine('{$IFDEF '+IfDefSym+'}');
  943. New(SwitchParams, Init(10,10));
  944. New(MiscParams, Init(10,10));
  945. EnumSwitches(LibLinkerSwitches);
  946. EnumSwitches(DebugInfoSwitches);
  947. EnumSwitches(ProfileInfoSwitches);
  948. EnumSwitches(SyntaxSwitches);
  949. EnumSwitches(VerboseSwitches);
  950. EnumSwitches(CodegenSwitches);
  951. EnumSwitches(OptimizationSwitches);
  952. EnumSwitches(OptimizingGoalSwitches);
  953. EnumSwitches(ProcessorSwitches);
  954. EnumSwitches(AsmReaderSwitches);
  955. EnumSwitches(AsmInfoSwitches);
  956. EnumSwitches(AsmOutputSwitches);
  957. EnumSwitches(TargetSwitches);
  958. EnumSwitches(ConditionalSwitches);
  959. EnumSwitches(MemorySwitches);
  960. EnumSwitches(BrowserSwitches);
  961. EnumSwitches(DirectorySwitches);
  962. S:='';
  963. for I:=0 to SwitchParams^.Count-1 do
  964. begin
  965. if I=0 then S:='{$' else S:=S+',';
  966. S:=S+PString(SwitchParams^.At(I))^;
  967. end;
  968. if S<>'' then S:=S+'}';
  969. if S<>'' then AddLine(' '+S);
  970. for I:=0 to MiscParams^.Count-1 do
  971. AddLine(' {$'+PString(MiscParams^.At(I))^+'}');
  972. Dispose(SwitchParams, Done); Dispose(MiscParams, Done);
  973. AddLine('{$ENDIF '+IfDefSym+'}');
  974. end;
  975. var SM: TSwitchMode;
  976. begin
  977. for SM:=Low(TSwitchMode) to High(TSwitchMode) do
  978. ConstructSwitchModeDirectives(SM,SwitchesModeStr[SM]);
  979. end;
  980. end.
  981. {
  982. $Log$
  983. Revision 1.1 2000-07-13 09:48:36 michael
  984. + Initial import
  985. Revision 1.23 2000/06/22 09:07:12 pierre
  986. * Gabor changes: see fixes.txt
  987. Revision 1.22 2000/05/02 08:42:28 pierre
  988. * new set of Gabor changes: see fixes.txt
  989. Revision 1.21 2000/04/25 08:42:33 pierre
  990. * New Gabor changes : see fixes.txt
  991. Revision 1.20 2000/03/08 16:51:50 pierre
  992. + -gl option support
  993. Revision 1.19 2000/03/07 22:52:50 pierre
  994. + Assembler tab in Options|Compiler
  995. Revision 1.18 2000/03/07 21:17:29 pierre
  996. +ASMInfoSwitches AsmOutputSwitches
  997. Revision 1.17 2000/02/04 14:34:47 pierre
  998. readme.txt
  999. Revision 1.16 2000/02/04 00:05:20 pierre
  1000. * -Fi must also be used for GetSourceDirectories
  1001. Revision 1.15 2000/01/10 15:52:53 pierre
  1002. * use default command line switches only if fp.cfg not found
  1003. Revision 1.14 1999/10/14 14:22:23 florian
  1004. * if no ini file is found the ide uses some useful defaults
  1005. Revision 1.13 1999/04/29 09:36:12 peter
  1006. * fixed hotkeys with Compiler switches
  1007. * fixed compiler status dialog
  1008. * Run shows again the output
  1009. Revision 1.12 1999/03/23 15:11:34 peter
  1010. * desktop saving things
  1011. * vesa mode
  1012. * preferences dialog
  1013. Revision 1.11 1999/03/12 01:14:01 peter
  1014. * flag if trytoopen should look for other extensions
  1015. + browser tab in the tools-compiler
  1016. Revision 1.10 1999/02/16 12:46:38 pierre
  1017. * String items can also be separated by spaces
  1018. Revision 1.9 1999/02/10 09:45:55 pierre
  1019. * MemorySizeSwitches Removed (was duplicate of MemorySwitches !)
  1020. * Added missing disposes at exit
  1021. Revision 1.8 1999/02/08 17:38:52 pierre
  1022. + added CustomArg
  1023. Revision 1.7 1999/02/06 00:07:48 florian
  1024. * speed/size optimization is now a radio button
  1025. Revision 1.6 1999/02/05 13:51:44 peter
  1026. * unit name of FPSwitches -> FPSwitch which is easier to use
  1027. * some fixes for tp7 compiling
  1028. Revision 1.5 1999/02/05 12:12:00 pierre
  1029. + SourceDir that stores directories for sources that the
  1030. compiler should not know about
  1031. Automatically asked for addition when a new file that
  1032. needed filedialog to be found is in an unknown directory
  1033. Stored and retrieved from INIFile
  1034. + Breakpoints conditions added to INIFile
  1035. * Breakpoints insterted and removed at debin and end of debug session
  1036. Revision 1.4 1999/02/04 13:32:10 pierre
  1037. * Several things added (I cannot commit them independently !)
  1038. + added TBreakpoint and TBreakpointCollection
  1039. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  1040. + Breakpoint list in INIFile
  1041. * Select items now also depend of SwitchMode
  1042. * Reading of option '-g' was not possible !
  1043. + added search for -Fu args pathes in TryToOpen
  1044. + added code for automatic opening of FileDialog
  1045. if source not found
  1046. Revision 1.3 1999/01/12 14:29:39 peter
  1047. + Implemented still missing 'switch' entries in Options menu
  1048. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  1049. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  1050. ASCII chars and inserted directly in the text.
  1051. + Added symbol browser
  1052. * splitted fp.pas to fpide.pas
  1053. Revision 1.2 1999/01/04 11:49:50 peter
  1054. * 'Use tab characters' now works correctly
  1055. + Syntax highlight now acts on File|Save As...
  1056. + Added a new class to syntax highlight: 'hex numbers'.
  1057. * There was something very wrong with the palette managment. Now fixed.
  1058. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  1059. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  1060. process revised
  1061. Revision 1.1 1998/12/28 15:47:52 peter
  1062. + Added user screen support, display & window
  1063. + Implemented Editor,Mouse Options dialog
  1064. + Added location of .INI and .CFG file
  1065. + Option (INI) file managment implemented (see bottom of Options Menu)
  1066. + Switches updated
  1067. + Run program
  1068. }