From 8b23aa24e97f3642d44afef4843a2be6ab2eb075 Mon Sep 17 00:00:00 2001 From: PumpkinSeed Date: Wed, 6 Sep 2023 22:13:30 +0200 Subject: [PATCH 1/2] Add LLLLL variable length --- prefix/ascii.go | 1 + prefix/bcd.go | 1 + prefix/binary.go | 1 + prefix/ebcdic.go | 1 + prefix/ebcdic1047.go | 1 + prefix/hex.go | 1 + prefix/prefixer.go | 1 + 7 files changed, 7 insertions(+) diff --git a/prefix/ascii.go b/prefix/ascii.go index b9466809..dbc64443 100644 --- a/prefix/ascii.go +++ b/prefix/ascii.go @@ -16,6 +16,7 @@ var ASCII = Prefixers{ LL: &asciiVarPrefixer{2}, LLL: &asciiVarPrefixer{3}, LLLL: &asciiVarPrefixer{4}, + LLLLL: &asciiVarPrefixer{5}, } func (p *asciiVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/bcd.go b/prefix/bcd.go index 3f9d1a28..dc2fa7fa 100644 --- a/prefix/bcd.go +++ b/prefix/bcd.go @@ -19,6 +19,7 @@ var BCD = Prefixers{ LL: &bcdVarPrefixer{2}, LLL: &bcdVarPrefixer{3}, LLLL: &bcdVarPrefixer{4}, + LLLLL: &bcdVarPrefixer{5}, } func (p *bcdVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/binary.go b/prefix/binary.go index f3a71e3c..f14ebbe7 100644 --- a/prefix/binary.go +++ b/prefix/binary.go @@ -13,6 +13,7 @@ var Binary = Prefixers{ LL: &binaryVarPrefixer{2}, LLL: &binaryVarPrefixer{3}, LLLL: &binaryVarPrefixer{4}, + LLLLL: &binaryVarPrefixer{5}, } type binaryFixedPrefixer struct { diff --git a/prefix/ebcdic.go b/prefix/ebcdic.go index 993d34f0..cab8ff0a 100644 --- a/prefix/ebcdic.go +++ b/prefix/ebcdic.go @@ -18,6 +18,7 @@ var EBCDIC = Prefixers{ LL: &ebcdicVarPrefixer{2}, LLL: &ebcdicVarPrefixer{3}, LLLL: &ebcdicVarPrefixer{4}, + LLLLL: &ebcdicVarPrefixer{5}, } func (p *ebcdicVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/ebcdic1047.go b/prefix/ebcdic1047.go index 05530235..ae432336 100644 --- a/prefix/ebcdic1047.go +++ b/prefix/ebcdic1047.go @@ -14,6 +14,7 @@ var EBCDIC1047 = Prefixers{ LL: &ebcdic1047Prefixer{2}, LLL: &ebcdic1047Prefixer{3}, LLLL: &ebcdic1047Prefixer{4}, + LLLLL: &ebcdic1047Prefixer{5}, } type ebcdic1047Prefixer struct { diff --git a/prefix/hex.go b/prefix/hex.go index da9855bf..0890ac2c 100644 --- a/prefix/hex.go +++ b/prefix/hex.go @@ -13,6 +13,7 @@ var Hex = Prefixers{ LL: &hexVarPrefixer{2}, LLL: &hexVarPrefixer{3}, LLLL: &hexVarPrefixer{4}, + LLLLL: &hexVarPrefixer{5}, } type hexFixedPrefixer struct { diff --git a/prefix/prefixer.go b/prefix/prefixer.go index 707bc95a..52707dcb 100644 --- a/prefix/prefixer.go +++ b/prefix/prefixer.go @@ -24,6 +24,7 @@ type Prefixers struct { LL Prefixer LLL Prefixer LLLL Prefixer + LLLLL Prefixer } type PrefixerBuilder func(int) Prefixer From 9bd5552ac11b2524b0395e2e8d5922fe74933b14 Mon Sep 17 00:00:00 2001 From: PumpkinSeed Date: Thu, 7 Sep 2023 09:28:21 +0200 Subject: [PATCH 2/2] Add LLLLLL as well --- prefix/ascii.go | 13 +++++++------ prefix/bcd.go | 13 +++++++------ prefix/binary.go | 13 +++++++------ prefix/ebcdic.go | 13 +++++++------ prefix/ebcdic1047.go | 13 +++++++------ prefix/hex.go | 13 +++++++------ prefix/prefixer.go | 13 +++++++------ 7 files changed, 49 insertions(+), 42 deletions(-) diff --git a/prefix/ascii.go b/prefix/ascii.go index dbc64443..b7a9fbe5 100644 --- a/prefix/ascii.go +++ b/prefix/ascii.go @@ -11,12 +11,13 @@ type asciiVarPrefixer struct { } var ASCII = Prefixers{ - Fixed: &asciiFixedPrefixer{}, - L: &asciiVarPrefixer{1}, - LL: &asciiVarPrefixer{2}, - LLL: &asciiVarPrefixer{3}, - LLLL: &asciiVarPrefixer{4}, - LLLLL: &asciiVarPrefixer{5}, + Fixed: &asciiFixedPrefixer{}, + L: &asciiVarPrefixer{1}, + LL: &asciiVarPrefixer{2}, + LLL: &asciiVarPrefixer{3}, + LLLL: &asciiVarPrefixer{4}, + LLLLL: &asciiVarPrefixer{5}, + LLLLLL: &asciiVarPrefixer{6}, } func (p *asciiVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/bcd.go b/prefix/bcd.go index dc2fa7fa..39c3ee29 100644 --- a/prefix/bcd.go +++ b/prefix/bcd.go @@ -14,12 +14,13 @@ type bcdVarPrefixer struct { } var BCD = Prefixers{ - Fixed: &bcdFixedPrefixer{}, - L: &bcdVarPrefixer{1}, - LL: &bcdVarPrefixer{2}, - LLL: &bcdVarPrefixer{3}, - LLLL: &bcdVarPrefixer{4}, - LLLLL: &bcdVarPrefixer{5}, + Fixed: &bcdFixedPrefixer{}, + L: &bcdVarPrefixer{1}, + LL: &bcdVarPrefixer{2}, + LLL: &bcdVarPrefixer{3}, + LLLL: &bcdVarPrefixer{4}, + LLLLL: &bcdVarPrefixer{5}, + LLLLLL: &bcdVarPrefixer{6}, } func (p *bcdVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/binary.go b/prefix/binary.go index f14ebbe7..55a59ec1 100644 --- a/prefix/binary.go +++ b/prefix/binary.go @@ -8,12 +8,13 @@ import ( ) var Binary = Prefixers{ - Fixed: &binaryFixedPrefixer{}, - L: &binaryVarPrefixer{1}, - LL: &binaryVarPrefixer{2}, - LLL: &binaryVarPrefixer{3}, - LLLL: &binaryVarPrefixer{4}, - LLLLL: &binaryVarPrefixer{5}, + Fixed: &binaryFixedPrefixer{}, + L: &binaryVarPrefixer{1}, + LL: &binaryVarPrefixer{2}, + LLL: &binaryVarPrefixer{3}, + LLLL: &binaryVarPrefixer{4}, + LLLLL: &binaryVarPrefixer{5}, + LLLLLL: &binaryVarPrefixer{6}, } type binaryFixedPrefixer struct { diff --git a/prefix/ebcdic.go b/prefix/ebcdic.go index cab8ff0a..f8f0b01c 100644 --- a/prefix/ebcdic.go +++ b/prefix/ebcdic.go @@ -13,12 +13,13 @@ type ebcdicVarPrefixer struct { } var EBCDIC = Prefixers{ - Fixed: &ebcdicFixedPrefixer{}, - L: &ebcdicVarPrefixer{1}, - LL: &ebcdicVarPrefixer{2}, - LLL: &ebcdicVarPrefixer{3}, - LLLL: &ebcdicVarPrefixer{4}, - LLLLL: &ebcdicVarPrefixer{5}, + Fixed: &ebcdicFixedPrefixer{}, + L: &ebcdicVarPrefixer{1}, + LL: &ebcdicVarPrefixer{2}, + LLL: &ebcdicVarPrefixer{3}, + LLLL: &ebcdicVarPrefixer{4}, + LLLLL: &ebcdicVarPrefixer{5}, + LLLLLL: &ebcdicVarPrefixer{6}, } func (p *ebcdicVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { diff --git a/prefix/ebcdic1047.go b/prefix/ebcdic1047.go index ae432336..71a7a053 100644 --- a/prefix/ebcdic1047.go +++ b/prefix/ebcdic1047.go @@ -9,12 +9,13 @@ import ( ) var EBCDIC1047 = Prefixers{ - Fixed: &ebcdic1047FixedPrefixer{}, - L: &ebcdic1047Prefixer{1}, - LL: &ebcdic1047Prefixer{2}, - LLL: &ebcdic1047Prefixer{3}, - LLLL: &ebcdic1047Prefixer{4}, - LLLLL: &ebcdic1047Prefixer{5}, + Fixed: &ebcdic1047FixedPrefixer{}, + L: &ebcdic1047Prefixer{1}, + LL: &ebcdic1047Prefixer{2}, + LLL: &ebcdic1047Prefixer{3}, + LLLL: &ebcdic1047Prefixer{4}, + LLLLL: &ebcdic1047Prefixer{5}, + LLLLLL: &ebcdic1047Prefixer{6}, } type ebcdic1047Prefixer struct { diff --git a/prefix/hex.go b/prefix/hex.go index 0890ac2c..bbed59dd 100644 --- a/prefix/hex.go +++ b/prefix/hex.go @@ -8,12 +8,13 @@ import ( ) var Hex = Prefixers{ - Fixed: &hexFixedPrefixer{}, - L: &hexVarPrefixer{1}, - LL: &hexVarPrefixer{2}, - LLL: &hexVarPrefixer{3}, - LLLL: &hexVarPrefixer{4}, - LLLLL: &hexVarPrefixer{5}, + Fixed: &hexFixedPrefixer{}, + L: &hexVarPrefixer{1}, + LL: &hexVarPrefixer{2}, + LLL: &hexVarPrefixer{3}, + LLLL: &hexVarPrefixer{4}, + LLLLL: &hexVarPrefixer{5}, + LLLLLL: &hexVarPrefixer{6}, } type hexFixedPrefixer struct { diff --git a/prefix/prefixer.go b/prefix/prefixer.go index 52707dcb..c56c2235 100644 --- a/prefix/prefixer.go +++ b/prefix/prefixer.go @@ -19,12 +19,13 @@ type Prefixer interface { } type Prefixers struct { - Fixed Prefixer - L Prefixer - LL Prefixer - LLL Prefixer - LLLL Prefixer - LLLLL Prefixer + Fixed Prefixer + L Prefixer + LL Prefixer + LLL Prefixer + LLLL Prefixer + LLLLL Prefixer + LLLLLL Prefixer } type PrefixerBuilder func(int) Prefixer