sauce

package module
v0.0.0-...-8098c62 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2016 License: GPL-2.0 Imports: 9 Imported by: 0

README

sauce

SAUCE (Standard Architecture for Universal Comment Extensions) parser in Go

Documentation

Overview

Package sauce contains a SAUCE (Standard Architecture for Universal Comment Extensions) parser.

Index

Constants

View Source
const (
	// LetterSpacingLegacy enables legacy letter spacing
	LetterSpacingLegacy = iota
	// LetterSpacing8Pixel enables 8 pixel letter spacing
	LetterSpacing8Pixel
	// LetterSpacing9Pixel enables 9 pixel letter spacing
	LetterSpacing9Pixel
	// LetterSpacingInvalid is unspecified
	LetterSpacingInvalid
)
View Source
const (
	// AspectRatioLegacy enables legacy aspect ratio
	AspectRatioLegacy = iota
	// AspectRatioStretch enables stretching on displays with square pixels
	AspectRatioStretch
	// AspectRatioSquare enables optimization for non-square displays
	AspectRatioSquare
	// AspectRatioInvalid is unspecified
	AspectRatioInvalid
)
View Source
const (
	DataTypeNone uint8 = iota
	DataTypeCharacter
	DataTypeBitmap
	DataTypeVector
	DataTypeAudio
	DataTypeBinaryText
	DataTypeXBIN
	DataTypeArchive
	DataTypeExecutable
)
View Source
const (
	// ASCIISub is the SUB ASCII character (or EOF)
	ASCIISub = '\x1a'
)

Variables

View Source
var (
	// ID is the SAUCE header identifier
	ID = [5]byte{'S', 'A', 'U', 'C', 'E'}

	// Version is the SAUCE version
	Version = [2]byte{0, 0}

	// No SAUCE record found
	ErrNoRecord = errors.New(`sauce: no SAUCE record found`)
)
View Source
var (
	DataType = map[uint8]string{
		DataTypeNone:       "None",
		DataTypeCharacter:  "Character",
		DataTypeBitmap:     "Bitmap",
		DataTypeVector:     "Vector",
		DataTypeAudio:      "Audio",
		DataTypeBinaryText: "BinaryText",
		DataTypeXBIN:       "XBin",
		DataTypeArchive:    "Archive",
		DataTypeExecutable: "Executable",
	}
	FileType = map[uint8]map[uint8]string{
		DataTypeCharacter: map[uint8]string{
			0: "ASCII",
			1: "ANSi",
			2: "ANSiMation",
			3: "RIP script",
			4: "PCBoard",
			5: "Avatar",
			6: "HTML",
			7: "Source",
			8: "Tundradraw",
		},
		DataTypeBitmap: map[uint8]string{
			0:  "GIF",
			1:  "PCX",
			2:  "LBM/FF",
			3:  "TGA",
			4:  "FLI",
			5:  "FLC",
			6:  "BMP",
			7:  "GL",
			8:  "DL",
			9:  "WPG",
			10: "PNG",
			11: "JPG",
			12: "MPG",
			13: "AVI",
		},
		DataTypeVector: map[uint8]string{
			0: "DXF",
			1: "DWG",
			2: "WPG",
			3: "3DS",
		},
		DataTypeAudio: map[uint8]string{
			0:  "MOD",
			1:  "669",
			2:  "STM",
			3:  "S3M",
			4:  "MTM",
			5:  "FAR",
			6:  "ULT",
			7:  "AMF",
			8:  "DMF",
			9:  "OKT",
			10: "ROL",
			11: "CMF",
			12: "MID",
			13: "SADT",
			14: "VOC",
			15: "WAV",
			16: "SMP8",
			17: "SMP8S",
			18: "SMP16",
			19: "SMP16S",
			20: "PATCH8",
			21: "PATCH16",
			22: "XM",
			23: "HSC",
			24: "IT",
		},
		DataTypeArchive: map[uint8]string{
			0: "ZIP",
			1: "ARJ",
			2: "LZH",
			3: "ARC",
			4: "TAR",
			5: "ZOO",
			6: "RAR",
			7: "UC2",
			8: "PAK",
			9: "SQZ",
		},
	}
	MimeType = map[uint8]map[uint8]string{
		DataTypeCharacter: map[uint8]string{
			0: "text/plain",
			1: "text/plain",
			2: "text/plain",
			3: "image/x-rip",
			4: "text/plain",
			5: "image/x-avatar",
			6: "text/html",
			7: "text/plain",
			8: "image/x-tnd",
		},
		DataTypeBitmap: map[uint8]string{
			0:  "image/gif",
			1:  "image/pcx",
			2:  "image/lbm",
			3:  "image/tga",
			4:  "video/fli",
			5:  "video/flc",
			6:  "image/bmp",
			7:  "video/x-gl",
			8:  "video/x-dl",
			9:  "image/wpg",
			10: "image/png",
			11: "image/jpeg",
			12: "video/mpeg",
			13: "video/x-msvideo",
		},
		DataTypeVector: map[uint8]string{
			0: "image/vnd.dxf",
			1: "image/vnd.dwg",
			2: "image/vnd.wpg",
			3: "image/x-3ds",
		},
		DataTypeAudio: map[uint8]string{
			0:  "audio/x-mod",
			1:  "audio/x-mod",
			2:  "audio/x-mod",
			3:  "audio/x-mod",
			4:  "audio/x-mod",
			5:  "audio/x-mod",
			6:  "audio/x-mod",
			7:  "audio/x-mod",
			8:  "audio/x-mod",
			12: "audio/midi",
			15: "audio/x-wav",
			16: "SMP8",
			17: "SMP8S",
			18: "SMP16",
			19: "SMP16S",
			20: "PATCH8",
			21: "PATCH16",
			22: "audio/x-mod",
			23: "audio/x-mod",
			24: "audio/x-mod",
		},
		DataTypeArchive: map[uint8]string{
			0: "application/zip",
			1: "application/arj",
			2: "application/x-lzh",
			3: "application/x-arc",
			4: "application/x-tar",
			5: "application/x-zoo",
			6: "application/rar",
			7: "application/x-uc2",
			8: "application/x-pak",
			9: "applicaiton/x-sqz",
		},
	}
)

Functions

This section is empty.

Types

type SAUCE

type SAUCE struct {
	ID       [5]byte
	Version  [2]byte
	Title    string
	Author   string
	Group    string
	Date     time.Time
	FileSize uint32
	DataType uint8
	FileType uint8
	TInfo    [4]uint16
	Comments uint8
	TFlags   TFlags
	TInfos   []byte
}

SAUCE (Standard Architecture for Universal Comment Extensions) record.

func New

func New() *SAUCE

New creates an empty SAUCE record.

func Parse

func Parse(s *io.SectionReader) (r *SAUCE, err error)

Parse SAUCE record

func ParseBytes

func ParseBytes(b []byte) (r *SAUCE, err error)

ParseBytes reads the SAUCE header from a slice of bytes

func ParseReader

func ParseReader(i io.Reader) (r *SAUCE, err error)

ParseReader reads the SAUCE header from a stream

func (*SAUCE) DataTypeString

func (r *SAUCE) DataTypeString() string

DataTypeString returns the DataType as string.

func (*SAUCE) Dump

func (r *SAUCE) Dump()

Dump the contents of the SAUCE record to stdout.

func (*SAUCE) FileTypeString

func (r *SAUCE) FileTypeString() string

FileTypeString returns the FileType as string.

func (*SAUCE) Font

func (r *SAUCE) Font() string

Font returns the font name

func (*SAUCE) MimeType

func (r *SAUCE) MimeType() (t string)

MimeType returns the mime type as string.

type TFlags

type TFlags struct {
	NonBlink      bool
	LetterSpacing uint8
	AspectRatio   uint8
}

TFlags contains a parsed TFlags structure

Jump to

Keyboard shortcuts

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