mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-08 05:30:35 +00:00
Eliminate BoxLineCommentDelimiter
This was used to prefix boxed lines with a comment delimiter, but in practice we just need to do this whenever the box character doesn't match the full-line comment delimiter. This has no effect on generated assembly output, but the on-screen (and exported HTML) form will now reflect the current settings.
This commit is contained in:
parent
54d559ad50
commit
14cacb4274
@ -106,8 +106,6 @@ namespace Asm65 {
|
|||||||
public string EndOfLineCommentDelimiter { get; set; } = string.Empty;
|
public string EndOfLineCommentDelimiter { get; set; } = string.Empty;
|
||||||
/// <summary>String to prefix a full-line comment.</summary>
|
/// <summary>String to prefix a full-line comment.</summary>
|
||||||
public string FullLineCommentDelimiterBase { get; set; } = string.Empty;
|
public string FullLineCommentDelimiterBase { get; set; } = string.Empty;
|
||||||
/// <summary>String to prefix a box comment line.</summary>
|
|
||||||
public string BoxLineCommentDelimiter { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>Delimiter patterns for single-character constants.</summary>
|
/// <summary>Delimiter patterns for single-character constants.</summary>
|
||||||
public DelimiterSet CharDelimiters { get; set; } = new DelimiterSet();
|
public DelimiterSet CharDelimiters { get; set; } = new DelimiterSet();
|
||||||
@ -182,7 +180,6 @@ namespace Asm65 {
|
|||||||
|
|
||||||
EndOfLineCommentDelimiter = src.EndOfLineCommentDelimiter;
|
EndOfLineCommentDelimiter = src.EndOfLineCommentDelimiter;
|
||||||
FullLineCommentDelimiterBase = src.FullLineCommentDelimiterBase;
|
FullLineCommentDelimiterBase = src.FullLineCommentDelimiterBase;
|
||||||
BoxLineCommentDelimiter = src.BoxLineCommentDelimiter;
|
|
||||||
|
|
||||||
CharDelimiters = new DelimiterSet(src.CharDelimiters);
|
CharDelimiters = new DelimiterSet(src.CharDelimiters);
|
||||||
StringDelimiters = new DelimiterSet(src.StringDelimiters);
|
StringDelimiters = new DelimiterSet(src.StringDelimiters);
|
||||||
@ -502,6 +499,7 @@ namespace Asm65 {
|
|||||||
// Generated format strings for hex values.
|
// Generated format strings for hex values.
|
||||||
private string[] mHexValueFormats = new string[4];
|
private string[] mHexValueFormats = new string[4];
|
||||||
|
|
||||||
|
// Comment delimiter char plus optional space.
|
||||||
private string mFullLineCommentDelimiterPlus;
|
private string mFullLineCommentDelimiterPlus;
|
||||||
|
|
||||||
// Buffer to use when generating hex dump lines.
|
// Buffer to use when generating hex dump lines.
|
||||||
@ -520,26 +518,25 @@ namespace Asm65 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to put between the operand and the end-of-line comment.
|
/// String to put between the operand and the end-of-line comment. Usually one character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EndOfLineCommentDelimiter {
|
public string EndOfLineCommentDelimiter {
|
||||||
get { return mFormatConfig.EndOfLineCommentDelimiter; }
|
get { return mFormatConfig.EndOfLineCommentDelimiter; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to put at the start of a line with a full-line comment.
|
/// Full-line comment delimiter. Usually one character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FullLineCommentDelimiter {
|
public string FullLineCommentDelimiterBase {
|
||||||
get { return mFullLineCommentDelimiterPlus; }
|
get { return mFormatConfig.FullLineCommentDelimiterBase; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to put at the start of a line that has a box comment. This is usually
|
/// String to put at the start of a line with a full-line comment. Delimiter plus
|
||||||
/// blank, as it's only needed if the assembler doesn't recognize the box character
|
/// optional space.
|
||||||
/// as a comment.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BoxLineCommentDelimiter {
|
public string FullLineCommentDelimiterPlus {
|
||||||
get { return mFormatConfig.BoxLineCommentDelimiter; }
|
get { return mFullLineCommentDelimiterPlus; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -242,7 +242,6 @@ namespace SourceGen.AsmGen {
|
|||||||
config.LocalVariableLabelPrefix = ".";
|
config.LocalVariableLabelPrefix = ".";
|
||||||
config.EndOfLineCommentDelimiter = ";";
|
config.EndOfLineCommentDelimiter = ";";
|
||||||
config.FullLineCommentDelimiterBase = ";";
|
config.FullLineCommentDelimiterBase = ";";
|
||||||
config.BoxLineCommentDelimiter = ";";
|
|
||||||
config.NonUniqueLabelPrefix = "@";
|
config.NonUniqueLabelPrefix = "@";
|
||||||
config.CommaSeparatedDense = false;
|
config.CommaSeparatedDense = false;
|
||||||
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Common;
|
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Common;
|
||||||
@ -286,14 +285,14 @@ namespace SourceGen.AsmGen {
|
|||||||
mOutStream = sw;
|
mOutStream = sw;
|
||||||
|
|
||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiterPlus +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"acme", mAsmVersion, AsmAcme.OPTIONS));
|
"acme", mAsmVersion, AsmAcme.OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasNonZeroBankCode()) {
|
if (HasNonZeroBankCode()) {
|
||||||
// don't try
|
// don't try
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiterPlus +
|
||||||
"ACME can't handle 65816 code that lives outside bank zero");
|
"ACME can't handle 65816 code that lives outside bank zero");
|
||||||
int firstAddr = Project.AddrMap.OffsetToAddress(0);
|
int firstAddr = Project.AddrMap.OffsetToAddress(0);
|
||||||
AddressMap.AddressRegion fakeRegion = new AddressMap.AddressRegion(0,
|
AddressMap.AddressRegion fakeRegion = new AddressMap.AddressRegion(0,
|
||||||
|
@ -216,7 +216,6 @@ namespace SourceGen.AsmGen {
|
|||||||
config.ForceLongOperandPrefix = "f:"; // far
|
config.ForceLongOperandPrefix = "f:"; // far
|
||||||
config.EndOfLineCommentDelimiter = ";";
|
config.EndOfLineCommentDelimiter = ";";
|
||||||
config.FullLineCommentDelimiterBase = ";";
|
config.FullLineCommentDelimiterBase = ";";
|
||||||
config.BoxLineCommentDelimiter = ";";
|
|
||||||
config.NonUniqueLabelPrefix = "@";
|
config.NonUniqueLabelPrefix = "@";
|
||||||
config.CommaSeparatedDense = true;
|
config.CommaSeparatedDense = true;
|
||||||
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Cc65;
|
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Cc65;
|
||||||
@ -259,7 +258,7 @@ namespace SourceGen.AsmGen {
|
|||||||
mOutStream = sw;
|
mOutStream = sw;
|
||||||
|
|
||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiterPlus +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"cc65", mAsmVersion,
|
"cc65", mAsmVersion,
|
||||||
AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName)));
|
AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName)));
|
||||||
|
@ -202,7 +202,6 @@ namespace SourceGen.AsmGen {
|
|||||||
config.LocalVariableLabelPrefix = "]";
|
config.LocalVariableLabelPrefix = "]";
|
||||||
config.EndOfLineCommentDelimiter = ";";
|
config.EndOfLineCommentDelimiter = ";";
|
||||||
config.FullLineCommentDelimiterBase = "*";
|
config.FullLineCommentDelimiterBase = "*";
|
||||||
config.BoxLineCommentDelimiter = string.Empty;
|
|
||||||
config.NonUniqueLabelPrefix = ":";
|
config.NonUniqueLabelPrefix = ":";
|
||||||
config.CommaSeparatedDense = false;
|
config.CommaSeparatedDense = false;
|
||||||
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Merlin;
|
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Merlin;
|
||||||
@ -240,7 +239,7 @@ namespace SourceGen.AsmGen {
|
|||||||
|
|
||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
// No version-specific stuff yet. We're generating code for v1.0.
|
// No version-specific stuff yet. We're generating code for v1.0.
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiterPlus +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"Merlin 32", mAsmVersion, string.Empty));
|
"Merlin 32", mAsmVersion, string.Empty));
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,6 @@ namespace SourceGen.AsmGen {
|
|||||||
config.ForceLongOperandPrefix = "@l"; // long
|
config.ForceLongOperandPrefix = "@l"; // long
|
||||||
config.EndOfLineCommentDelimiter = ";";
|
config.EndOfLineCommentDelimiter = ";";
|
||||||
config.FullLineCommentDelimiterBase = ";";
|
config.FullLineCommentDelimiterBase = ";";
|
||||||
config.BoxLineCommentDelimiter = ";";
|
|
||||||
config.NonUniqueLabelPrefix = ""; // should be '_', but that's a valid label char
|
config.NonUniqueLabelPrefix = ""; // should be '_', but that's a valid label char
|
||||||
config.CommaSeparatedDense = true;
|
config.CommaSeparatedDense = true;
|
||||||
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Common;
|
config.ExprMode = Formatter.FormatConfig.ExpressionMode.Common;
|
||||||
@ -321,7 +320,7 @@ namespace SourceGen.AsmGen {
|
|||||||
mOutStream = sw;
|
mOutStream = sw;
|
||||||
|
|
||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiterPlus +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"64tass", mAsmVersion, AsmTass64.BASE_OPTIONS + extraOptions));
|
"64tass", mAsmVersion, AsmTass64.BASE_OPTIONS + extraOptions));
|
||||||
}
|
}
|
||||||
|
@ -488,12 +488,11 @@ namespace SourceGen {
|
|||||||
Debug.WriteLine("ApplyAppSettings...");
|
Debug.WriteLine("ApplyAppSettings...");
|
||||||
AppSettings settings = AppSettings.Global;
|
AppSettings settings = AppSettings.Global;
|
||||||
|
|
||||||
// Set up the formatter.
|
// Set up the formatter with default values.
|
||||||
mFormatterConfig = new Formatter.FormatConfig();
|
mFormatterConfig = new Formatter.FormatConfig();
|
||||||
AsmGen.GenCommon.ConfigureFormatterFromSettings(AppSettings.Global,
|
AsmGen.GenCommon.ConfigureFormatterFromSettings(AppSettings.Global,
|
||||||
ref mFormatterConfig);
|
ref mFormatterConfig);
|
||||||
mFormatterConfig.EndOfLineCommentDelimiter = ";";
|
mFormatterConfig.EndOfLineCommentDelimiter = ";";
|
||||||
mFormatterConfig.BoxLineCommentDelimiter = string.Empty;
|
|
||||||
|
|
||||||
mFormatterConfig.NonUniqueLabelPrefix =
|
mFormatterConfig.NonUniqueLabelPrefix =
|
||||||
settings.GetString(AppSettings.FMT_NON_UNIQUE_LABEL_PREFIX, string.Empty);
|
settings.GetString(AppSettings.FMT_NON_UNIQUE_LABEL_PREFIX, string.Empty);
|
||||||
|
@ -52,6 +52,11 @@ namespace SourceGen {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BackgroundColor { get; private set; }
|
public Color BackgroundColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Box character to use for "basic" formatting.
|
||||||
|
/// </summary>
|
||||||
|
private const char BASIC_BOX_CHAR = '*';
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor. Object will have a max width of 80 and not be boxed.
|
/// Constructor. Object will have a max width of 80 and not be boxed.
|
||||||
@ -94,7 +99,6 @@ namespace SourceGen {
|
|||||||
/// is non-empty, comment delimiters aren't emitted. (Used for notes.)</param>
|
/// is non-empty, comment delimiters aren't emitted. (Used for notes.)</param>
|
||||||
/// <returns>Array of formatted strings.</returns>
|
/// <returns>Array of formatted strings.</returns>
|
||||||
public List<string> FormatText(Asm65.Formatter formatter, string textPrefix) {
|
public List<string> FormatText(Asm65.Formatter formatter, string textPrefix) {
|
||||||
const char boxChar = '*';
|
|
||||||
const char spcRep = '\u2219'; // BULLET OPERATOR
|
const char spcRep = '\u2219'; // BULLET OPERATOR
|
||||||
string workString = string.IsNullOrEmpty(textPrefix) ? Text : textPrefix + Text;
|
string workString = string.IsNullOrEmpty(textPrefix) ? Text : textPrefix + Text;
|
||||||
List<string> lines = new List<string>();
|
List<string> lines = new List<string>();
|
||||||
@ -103,9 +107,14 @@ namespace SourceGen {
|
|||||||
if (!string.IsNullOrEmpty(textPrefix)) {
|
if (!string.IsNullOrEmpty(textPrefix)) {
|
||||||
linePrefix = string.Empty;
|
linePrefix = string.Empty;
|
||||||
} else if (BoxMode) {
|
} else if (BoxMode) {
|
||||||
linePrefix = formatter.BoxLineCommentDelimiter;
|
if (formatter.FullLineCommentDelimiterBase.Length == 1 &&
|
||||||
|
formatter.FullLineCommentDelimiterBase[0] == BASIC_BOX_CHAR) {
|
||||||
|
linePrefix = string.Empty;
|
||||||
|
} else {
|
||||||
|
linePrefix = formatter.FullLineCommentDelimiterBase;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
linePrefix = formatter.FullLineCommentDelimiter;
|
linePrefix = formatter.FullLineCommentDelimiterPlus;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(MaxWidth);
|
StringBuilder sb = new StringBuilder(MaxWidth);
|
||||||
@ -119,7 +128,7 @@ namespace SourceGen {
|
|||||||
string boxLine, spaces;
|
string boxLine, spaces;
|
||||||
if (BoxMode) {
|
if (BoxMode) {
|
||||||
for (int i = 0; i < MaxWidth - linePrefix.Length; i++) {
|
for (int i = 0; i < MaxWidth - linePrefix.Length; i++) {
|
||||||
sb.Append(boxChar);
|
sb.Append(BASIC_BOX_CHAR);
|
||||||
}
|
}
|
||||||
boxLine = sb.ToString();
|
boxLine = sb.ToString();
|
||||||
sb.Clear();
|
sb.Clear();
|
||||||
@ -159,13 +168,13 @@ namespace SourceGen {
|
|||||||
string str = workString.Substring(startIndex, i - startIndex);
|
string str = workString.Substring(startIndex, i - startIndex);
|
||||||
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
||||||
if (BoxMode) {
|
if (BoxMode) {
|
||||||
if (str == "" + boxChar) {
|
if (str == "" + BASIC_BOX_CHAR) {
|
||||||
// asterisk on a line by itself means "output row of asterisks"
|
// asterisk on a line by itself means "output row of asterisks"
|
||||||
str = linePrefix + boxLine;
|
str = linePrefix + boxLine;
|
||||||
} else {
|
} else {
|
||||||
int padLen = lineWidth - str.Length;
|
int padLen = lineWidth - str.Length;
|
||||||
str = linePrefix + boxChar + " " + str +
|
str = linePrefix + BASIC_BOX_CHAR + " " + str +
|
||||||
spaces.Substring(0, padLen + 1) + boxChar;
|
spaces.Substring(0, padLen + 1) + BASIC_BOX_CHAR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
str = linePrefix + str;
|
str = linePrefix + str;
|
||||||
@ -191,7 +200,7 @@ namespace SourceGen {
|
|||||||
string str = workString.Substring(startIndex, i - startIndex);
|
string str = workString.Substring(startIndex, i - startIndex);
|
||||||
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
||||||
if (BoxMode) {
|
if (BoxMode) {
|
||||||
str = linePrefix + boxChar + " " + str + " " + boxChar;
|
str = linePrefix + BASIC_BOX_CHAR + " " + str + " " + BASIC_BOX_CHAR;
|
||||||
} else {
|
} else {
|
||||||
str = linePrefix + str;
|
str = linePrefix + str;
|
||||||
}
|
}
|
||||||
@ -209,8 +218,8 @@ namespace SourceGen {
|
|||||||
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
||||||
if (BoxMode) {
|
if (BoxMode) {
|
||||||
int padLen = lineWidth - str.Length;
|
int padLen = lineWidth - str.Length;
|
||||||
str = linePrefix + boxChar + " " + str +
|
str = linePrefix + BASIC_BOX_CHAR + " " + str +
|
||||||
spaces.Substring(0, padLen + 1) + boxChar;
|
spaces.Substring(0, padLen + 1) + BASIC_BOX_CHAR;
|
||||||
} else {
|
} else {
|
||||||
str = linePrefix + str;
|
str = linePrefix + str;
|
||||||
}
|
}
|
||||||
@ -239,8 +248,8 @@ namespace SourceGen {
|
|||||||
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
if (DebugShowRuler) { str = str.Replace(' ', spcRep); }
|
||||||
if (BoxMode) {
|
if (BoxMode) {
|
||||||
int padLen = lineWidth - str.Length;
|
int padLen = lineWidth - str.Length;
|
||||||
str = linePrefix + boxChar + " " + str +
|
str = linePrefix + BASIC_BOX_CHAR + " " + str +
|
||||||
spaces.Substring(0, padLen + 1) + boxChar;
|
spaces.Substring(0, padLen + 1) + BASIC_BOX_CHAR;
|
||||||
} else {
|
} else {
|
||||||
str = linePrefix + str;
|
str = linePrefix + str;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user