/// <summary> /// Returns true if the selected cross-assembler executable has been configured. /// </summary> private bool IsAssemblerConfigured() { AssemblerConfig config = AssemblerConfig.GetConfig(AppSettings.Global, mSelectedAssemblerId); return(config != null && !string.IsNullOrEmpty(config.ExecutablePath)); }
/// <summary> /// Gets a copy of the AppSettings with a standard set of formatting options (e.g. lower /// case for everything). /// </summary> /// <returns>New app settings object.</returns> private AppSettings CreateNormalizedSettings() { AppSettings settings = AppSettings.Global.GetCopy(); // Override all asm formatting options. We can ignore ShiftBeforeAdjust and the // pseudo-op names because those are set by the generators. settings.SetBool(AppSettings.FMT_UPPER_HEX_DIGITS, false); settings.SetBool(AppSettings.FMT_UPPER_OP_MNEMONIC, false); settings.SetBool(AppSettings.FMT_UPPER_PSEUDO_OP_MNEMONIC, false); settings.SetBool(AppSettings.FMT_UPPER_OPERAND_A, true); settings.SetBool(AppSettings.FMT_UPPER_OPERAND_S, true); settings.SetBool(AppSettings.FMT_UPPER_OPERAND_XY, false); settings.SetBool(AppSettings.FMT_ADD_SPACE_FULL_COMMENT, false); // Don't show the assembler ident line. You can make a case for this being // mandatory, since the generated code is only guaranteed to work with the // assembler for which it was targeted, but I expect we'll quickly get to a // place where we don't have to work around assembler bugs, and this will just // become a nuisance. settings.SetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false); // Don't break lines with long labels. That way we can redefine "long" // without breaking our tests. (This is purely cosmetic.) settings.SetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false); // This could be on or off. Off seems less distracting. settings.SetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false); // Disable label localization. We want to be able to play with this a bit // without disrupting all the other tests. Use a test-only feature to enable // it for the localization test. settings.SetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, true); IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator(); while (iter.MoveNext()) { AssemblerInfo.Id asmId = iter.Current.AssemblerId; AssemblerConfig curConfig = AssemblerConfig.GetConfig(settings, asmId); AssemblerConfig defConfig = AssemblerInfo.GetAssembler(asmId).GetDefaultConfig(); // Merge the two together. We want the default assembler config for most // things, but the executable path from the current config. defConfig.ExecutablePath = curConfig.ExecutablePath; // Write it into the test settings. AssemblerConfig.SetConfig(settings, asmId, defConfig); } return(settings); }