wang

package module
v0.0.0-...-9e68a66 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

Wang

This code inspects and carves files from disks formatted as a Wang "Archive Diskette" (see Chapter 8: https://www.wang2200.org/docs/software/2200WordProcessingOperatorsGuide.700-6937.6-82.pdf).

Files are further processed to convert to RTF format (see File Format Documentation for UN Parallel Texts for more information about the Wang WP character set: https://catalog.ldc.upenn.edu/docs/LDC94T4B-2/wang2iso.txt). Both cited references are also in the /docs folder.

Install

Install go: https://go.dev/doc/install

Run go install github.com/richardlehane/wang/cmd/wang@latest

Usage

wang meta DISK.IMG    // Provides a directory listing and metadata for DISK.IMG
wang csv DISK.IMG     // Directory listing and metadata in CSV format
wang files DISK.IMG   // Extracts files into the working directory
wang text DISK.IMG    // Files are converted to text and extracted to working directory
wang rtf DISK.IMG     // Files are converted to rtf and extracted to working directory
wang fix DISK.IMG     // Attempts to fix a broken wang image by rewriting the image to the working directory
wang dump DISK.IMG    // Dumps sectors with tagged content into the working directory

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatToken

func FormatToken(t Token) (int, []int, int)

Tage a page or format token and return line spacing, indents and line length

func RTFEncode

func RTFEncode(dec *Decoder, w io.Writer) error

func TextEncode

func TextEncode(dec *Decoder, w io.Writer) error

func WWLString

func WWLString(s string) string

WWLString converts a string from the WWL character set to UTF-8

func WangWorldLanguages

func WangWorldLanguages(char byte) rune

WangWorldLanguages converts a character in the Wang World Lanaguages Character Set to a UTF-8 rune

Types

type Decoder

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

func NewDecoder

func NewDecoder(f *File) *Decoder

func (*Decoder) Token

func (d *Decoder) Token() (Token, error)

type EncodeFn

type EncodeFn func(*Decoder, io.Writer) error

type File

type File struct {
	DocID     tag
	ArchiveID string
	Name      string
	Comment   string
	Author    string
	Operator  string
	Created   time.Time
	Modified  time.Time
	// contains filtered or unexported fields
}

func (*File) CSV

func (f *File) CSV() []string

func (*File) Read

func (f *File) Read(b []byte) (int, error)

Read implements the io.Reader interface

func (*File) SanitizedName

func (f *File) SanitizedName() string

func (*File) String

func (f *File) String() string

type Reader

type Reader struct {
	Files []*File
	// contains filtered or unexported fields
}

Reader provides sequential access to a Wang disk image

func Fix

func Fix(ra io.ReaderAt) (*Reader, error)

func New

func New(ra io.ReaderAt) (*Reader, error)

func (*Reader) DumpEncoded

func (r *Reader) DumpEncoded(path string, ext string, fn EncodeFn) error

func (*Reader) DumpFiles

func (r *Reader) DumpFiles(path string) error

DumpFiles writes all files in the Wang disk to the path directory

func (*Reader) DumpRTF

func (r *Reader) DumpRTF(path string) error

func (*Reader) DumpSectors

func (r *Reader) DumpSectors(path string) error

DumpSectors checks all 256 byte sectors in the file for tags Then dumps all 256 byte sectors for each tag.

func (*Reader) DumpText

func (r *Reader) DumpText(path string) error

func (*Reader) WriteFile

func (r *Reader) WriteFile(path string) error

type Token

type Token struct {
	Typ TokenType
	Off int64
	Val string
}

type TokenType

type TokenType int
const (
	TokenNull TokenType = iota
	TokenErr
	TokenEOF
	TokenPage
	TokenFormat
	TokenText
	TokenUnderText // Underlined text
	TokenCentre
	TokenTab
	TokenEnd
	TokenIndent
	TokenDTab
	TokenNoBreak
	TokenNote
	TokenSuper
	TokenSub
	TokenBold
	TokenUnderNoBreak
)

func (TokenType) String

func (t TokenType) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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