codetable

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package codetable provides the underlying byte-level code table structures used by DEC VT series terminals. A code table is a 16x16 matrix where each position corresponds to a single byte value (0x00-0xFF). The table is divided into control code regions (C0, C1) and graphic code regions (GL, GR).

Index

Constants

View Source
const (
	// Column 0
	C00R00 byte = 0b0000_0000 + iota
	C00R01
	C00R02
	C00R03
	C00R04
	C00R05
	C00R06
	C00R07
	C00R08
	C00R09
	C00R10
	C00R11
	C00R12
	C00R13
	C00R14
	C00R15
	// Column 1
	C01R00
	C01R01
	C01R02
	C01R03
	C01R04
	C01R05
	C01R06
	C01R07
	C01R08
	C01R09
	C01R10
	C01R11
	C01R12
	C01R13
	C01R14
	C01R15
	// Column 2
	C02R00
	C02R01
	C02R02
	C02R03
	C02R04
	C02R05
	C02R06
	C02R07
	C02R08
	C02R09
	C02R10
	C02R11
	C02R12
	C02R13
	C02R14
	C02R15
	// Column 3
	C03R00
	C03R01
	C03R02
	C03R03
	C03R04
	C03R05
	C03R06
	C03R07
	C03R08
	C03R09
	C03R10
	C03R11
	C03R12
	C03R13
	C03R14
	C03R15
	// Column 4
	C04R00
	C04R01
	C04R02
	C04R03
	C04R04
	C04R05
	C04R06
	C04R07
	C04R08
	C04R09
	C04R10
	C04R11
	C04R12
	C04R13
	C04R14
	C04R15
	// Column 5
	C05R00
	C05R01
	C05R02
	C05R03
	C05R04
	C05R05
	C05R06
	C05R07
	C05R08
	C05R09
	C05R10
	C05R11
	C05R12
	C05R13
	C05R14
	C05R15
	// Column 6
	C06R00
	C06R01
	C06R02
	C06R03
	C06R04
	C06R05
	C06R06
	C06R07
	C06R08
	C06R09
	C06R10
	C06R11
	C06R12
	C06R13
	C06R14
	C06R15
	// Column 7
	C07R00
	C07R01
	C07R02
	C07R03
	C07R04
	C07R05
	C07R06
	C07R07
	C07R08
	C07R09
	C07R10
	C07R11
	C07R12
	C07R13
	C07R14
	C07R15
	// Column 8
	C08R00
	C08R01
	C08R02
	C08R03
	C08R04
	C08R05
	C08R06
	C08R07
	C08R08
	C08R09
	C08R10
	C08R11
	C08R12
	C08R13
	C08R14
	C08R15
	// Column 9
	C09R00
	C09R01
	C09R02
	C09R03
	C09R04
	C09R05
	C09R06
	C09R07
	C09R08
	C09R09
	C09R10
	C09R11
	C09R12
	C09R13
	C09R14
	C09R15
	// Column 10
	C10R00
	C10R01
	C10R02
	C10R03
	C10R04
	C10R05
	C10R06
	C10R07
	C10R08
	C10R09
	C10R10
	C10R11
	C10R12
	C10R13
	C10R14
	C10R15
	// Column 11
	C11R00
	C11R01
	C11R02
	C11R03
	C11R04
	C11R05
	C11R06
	C11R07
	C11R08
	C11R09
	C11R10
	C11R11
	C11R12
	C11R13
	C11R14
	C11R15
	// Column 12
	C12R00
	C12R01
	C12R02
	C12R03
	C12R04
	C12R05
	C12R06
	C12R07
	C12R08
	C12R09
	C12R10
	C12R11
	C12R12
	C12R13
	C12R14
	C12R15
	// Column 13
	C13R00
	C13R01
	C13R02
	C13R03
	C13R04
	C13R05
	C13R06
	C13R07
	C13R08
	C13R09
	C13R10
	C13R11
	C13R12
	C13R13
	C13R14
	C13R15
	// Column 14
	C14R00
	C14R01
	C14R02
	C14R03
	C14R04
	C14R05
	C14R06
	C14R07
	C14R08
	C14R09
	C14R10
	C14R11
	C14R12
	C14R13
	C14R14
	C14R15
	// Column 15
	C15R00
	C15R01
	C15R02
	C15R03
	C15R04
	C15R05
	C15R06
	C15R07
	C15R08
	C15R09
	C15R10
	C15R11
	C15R12
	C15R13
	C15R14
	C15R15
)
View Source
const (
	C1 = "C1"
	GR = "GR"
)
View Source
const (
	C0 = "C0"
	GL = "GL"
)
View Source
const (
	// CodeSpaceRowCount is the number of rows in each code table column (16).
	CodeSpaceRowCount = 16

	// ControlCodeSpaceColumnCount is the number of columns in a control code
	// space (2, for C0 columns 0-1 or C1 columns 8-9).
	ControlCodeSpaceColumnCount = 2

	// GraphicCodeSpaceColumnCount is the number of columns in a graphic code
	// space (6, for GL columns 2-7 or GR columns 10-15).
	GraphicCodeSpaceColumnCount = 6
)

Variables

View Source
var C0Table = ControlCodeSpace{
	// contains filtered or unexported fields
}
View Source
var C1Table = ControlCodeSpace{
	// contains filtered or unexported fields
}
View Source
var (
	// ErrOutOfBounds is returned when attempting to access a code table position
	// outside the valid range.
	ErrOutOfBounds = errors.New("Coordinates out of bounds")
)
View Source
var GLTable = GraphicCodeSpace{
	// contains filtered or unexported fields
}
View Source
var GRTable = GraphicCodeSpace{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type CodeSpace

type CodeSpace interface {
	Get(int, int) (byte, error)
	ID() string
	Columns() int
}

CodeSpace is the interface implemented by both ControlCodeSpace and GraphicCodeSpace, providing access to byte values at code table positions.

type ControlCodeSpace

type ControlCodeSpace struct {
	// contains filtered or unexported fields
}

ControlCodeSpace represents a control character region of the code table (C0 for columns 0-1, or C1 for columns 8-9). Control characters are non-printable characters used for terminal control functions.

func (ControlCodeSpace) Columns

func (t ControlCodeSpace) Columns() int

Columns returns the number of columns in this code space.

func (ControlCodeSpace) Get

func (t ControlCodeSpace) Get(row, col int) (byte, error)

Get returns the byte value at the specified row and column position. Row must be 0-15, column must be 0-1. Returns ErrOutOfBounds if the coordinates are outside the valid range.

func (ControlCodeSpace) ID

func (t ControlCodeSpace) ID() string

ID returns the identifier string for this code space (e.g., "C0" or "C1").

type GraphicCodeSpace

type GraphicCodeSpace struct {
	// contains filtered or unexported fields
}

GraphicCodeSpace represents a graphic character region of the code table (GL for columns 2-7, or GR for columns 10-15). Graphic characters are printable characters including letters, numbers, and symbols.

func (GraphicCodeSpace) ColumnOffset

func (t GraphicCodeSpace) ColumnOffset() int

ColumnOffset returns the starting column number for this code space (2 for GL, 10 for GR). This is derived from the high nibble of the first byte in the table.

func (GraphicCodeSpace) Columns

func (t GraphicCodeSpace) Columns() int

Columns returns the number of columns in this code space.

func (GraphicCodeSpace) Get

func (t GraphicCodeSpace) Get(row, col int) (byte, error)

Get returns the byte value at the specified row and column position. Row must be 0-15, column must be 0-5. Returns ErrOutOfBounds if the coordinates are outside the valid range.

func (GraphicCodeSpace) ID

func (t GraphicCodeSpace) ID() string

ID returns the identifier string for this code space (e.g., "GL" or "GR").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL