From db692b735d0525864e85f82d253b10d58abd7055 Mon Sep 17 00:00:00 2001 From: Richard Cornwell Date: Thu, 11 Jul 2024 13:08:11 -0400 Subject: [PATCH] Moved card init function to end of file. --- util/card/card.go | 60 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/util/card/card.go b/util/card/card.go index 7d8b12c..44165b0 100644 --- a/util/card/card.go +++ b/util/card/card.go @@ -186,36 +186,6 @@ func (ctx *CardContext) Detach() error { return nil } -// Initialize back translation tables. -func init() { - for i := range 4096 { - holToEBCDICTable[i] = 0x100 - holToASCIITable26[i] = 0xff - holToASCIITable29[i] = 0xff - } - - // Initialize back translation from Hollerith to Ebcdic - for i, t := range ebcdicToHolTable { - if holToEBCDICTable[t] != 0x100 { - s := fmt.Sprintf("Translation error EBCDIC %02x is %03x and %03x", i, t, holToEBCDICTable[t]) - panic(s) - } - holToEBCDICTable[t] = uint16(i) - } - - // Initialize back translation from Hollerith to ascii - for i, t := range asciiToHol29 { - if (t & 0xf000) == 0 { - holToASCIITable29[t] = uint8(i) - } - } - for i, t := range asciiToHol26 { - if (t & 0xf000) == 0 { - holToASCIITable26[t] = uint8(i) - } - } -} - func (ctx CardContext) HopperSize() int { return ctx.hopperCards - ctx.hopperPos } @@ -804,3 +774,33 @@ card_done: } buf.len -= p } + +// Initialize back translation tables. +func init() { + for i := range 4096 { + holToEBCDICTable[i] = 0x100 + holToASCIITable26[i] = 0xff + holToASCIITable29[i] = 0xff + } + + // Initialize back translation from Hollerith to Ebcdic + for i, t := range ebcdicToHolTable { + if holToEBCDICTable[t] != 0x100 { + s := fmt.Sprintf("Translation error EBCDIC %02x is %03x and %03x", i, t, holToEBCDICTable[t]) + panic(s) + } + holToEBCDICTable[t] = uint16(i) + } + + // Initialize back translation from Hollerith to ascii + for i, t := range asciiToHol29 { + if (t & 0xf000) == 0 { + holToASCIITable29[t] = uint8(i) + } + } + for i, t := range asciiToHol26 { + if (t & 0xf000) == 0 { + holToASCIITable26[t] = uint8(i) + } + } +}