Auto: ablegacy-2 — MicroLogix function-file letters

Closes #245
This commit is contained in:
Joseph Doherty
2026-04-25 13:32:23 -04:00
parent ccf2e3a9c0
commit f2bc36349e
4 changed files with 171 additions and 6 deletions
@@ -107,7 +107,11 @@ public sealed record AbLegacyAddress(
}
// Reject unknown file letters — these cover SLC/ML/PLC-5 canonical families.
if (!IsKnownFileLetter(letter)) return null;
// Function-file letters (RTC/HSC/DLS/MMI/PTO/PWM/STI/EII/IOS/BHI) are MicroLogix-only.
if (!IsKnownFileLetter(letter))
{
if (!IsFunctionFileLetter(letter) || profile?.SupportsFunctionFiles != true) return null;
}
var octalForIo = profile?.OctalIoAddressing == true && (letter == "I" || letter == "O");
@@ -151,4 +155,14 @@ public sealed record AbLegacyAddress(
"N" or "F" or "B" or "L" or "ST" or "T" or "C" or "R" or "I" or "O" or "S" or "A" => true,
_ => false,
};
/// <summary>
/// MicroLogix 1100/1400 function-file prefixes. Each maps to a single fixed instance with a
/// known sub-element catalogue (see <see cref="AbLegacyDataType"/>).
/// </summary>
internal static bool IsFunctionFileLetter(string letter) => letter switch
{
"RTC" or "HSC" or "DLS" or "MMI" or "PTO" or "PWM" or "STI" or "EII" or "IOS" or "BHI" => true,
_ => false,
};
}