repertoire

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: 2 Imported by: 0

Documentation

Overview

Package repertoire provides the graphics repertoire for VT220 terminals. It defines GraphicSet which pairs a character encoding with its DSCS (Designate Character Set) identifier, and provides the standard VT220 character sets pre-configured.

Index

Constants

View Source
const (
	// DSCSAscii is 'B' - ASCII graphic set
	DSCSAscii = codetable.C04R02

	// DSCSSupplemental is '<' - DEC Supplemental Graphics
	DSCSSupplemental = codetable.C03R12

	// DSCSSpecialGraphics is '0' - DEC Special Graphics
	DSCSSpecialGraphics = codetable.C03R00

	// DSCSBritish is 'A' - British NRC
	DSCSBritish = codetable.C04R01

	// DSCSDutch is '4' - Dutch NRC
	DSCSDutch = codetable.C03R04

	// DSCSFinnish is 'C' - Finnish NRC
	// It could also be '5' (C03R05) as both are supported, but we'll use the first option.
	DSCSFinnish = codetable.C04R03

	// DSCSFrench is 'R' - French NRC
	DSCSFrench = codetable.C05R02

	// DSCSFrenchCanadian is 'Q' - French Canadian NRC
	DSCSFrenchCanadian = codetable.C05R01

	// DSCSGerman is 'K' - German NRC
	DSCSGerman = codetable.C04R11

	// DSCSItalian is 'Y' - Italian NRC
	DSCSItalian = codetable.C05R09

	// DSCSNorwegianDanish is 'E' - Norwegian/Danish NRC
	// It could also be '6' (C03R06) as both are supported, but we'll use the first option.
	DSCSNorwegianDanish = codetable.C04R05

	// DSCSSpanish is 'Z' - Spanish NRC
	DSCSSpanish = codetable.C05R10

	// DSCSSwedish is 'H' - Swedish NRC
	// It could also be '7' (C03R07) as both are supported, but we'll use the first option.
	DSCSSwedish = codetable.C04R08

	// DSCSSwiss is '=' - Swiss NRC
	DSCSSwiss = codetable.C03R13
)

DSCS Final bytes for standard VT220 character sets. These are the final characters in Select Character Set sequences.

Variables

Standard VT220 graphic sets. These are the character sets available in the VT220's graphics repertoire.

Functions

This section is empty.

Types

type GraphicSet

type GraphicSet struct {
	// CharSet is the character set for this graphic set.
	CharSet *charmap.CharacterSet

	// Name is a human-readable identifier for this character set.
	Name string
	// contains filtered or unexported fields
}

GraphicSet represents a character set that can be designated to a graphic register. It pairs a CharacterSet (for encoding/decoding) with the DSCS identifier bytes used in SCS escape sequences.

func NewGraphicSet

func NewGraphicSet(name string, charSet *charmap.CharacterSet, dscs ...byte) *GraphicSet

NewGraphicSet creates a new GraphicSet with the given character set and DSCS bytes.

func NewNRCGraphicSet

func NewNRCGraphicSet(name string, charSet *charmap.CharacterSet, dscs ...byte) *GraphicSet

NewNRCGraphicSet creates a new National Replacement Character GraphicSet. NRC sets are 7-bit character sets that require national mode (DECNRCM set).

func (*GraphicSet) DSCS

func (g *GraphicSet) DSCS() []byte

DSCS returns the Designate Character Set Sequence identifier bytes. These are appended to the SCS prefix (ESC (, ESC ), etc.) to form the complete designation sequence.

func (*GraphicSet) IsNRC

func (g *GraphicSet) IsNRC() bool

IsNRC returns true if this is a National Replacement Character set. NRC sets require 7-bit national mode and cannot be used in multinational mode.

type Repertoire

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

Repertoire holds a collection of available graphic sets. It provides lookup by name and iteration over available sets.

func NewRepertoire

func NewRepertoire() *Repertoire

NewRepertoire creates an empty repertoire.

func VT220Repertoire

func VT220Repertoire() *Repertoire

VT220Repertoire returns a repertoire pre-populated with the standard VT220 character sets.

func (*Repertoire) Add

func (r *Repertoire) Add(set *GraphicSet)

Add adds a graphic set to the repertoire.

func (*Repertoire) All

func (r *Repertoire) All() []*GraphicSet

All returns all graphic sets in the repertoire.

func (*Repertoire) AllNames

func (r *Repertoire) AllNames() []string

AllNames returns all graphic set names in the repertoire.

func (*Repertoire) Get

func (r *Repertoire) Get(name string) *GraphicSet

Get returns the graphic set with the given name, or nil if not found.

Jump to

Keyboard shortcuts

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