type1

package
v0.0.0-...-a16ce98 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2013 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CHARSTRING_KEY = 4330
View Source
const EEXEC_KEY = 55665

Variables

View Source
var Ops = map[string]func(t *TypeOneI){
	"+": func(t *TypeOneI) {
	},
	"array": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(t.NewArray(strm.Int(string(a), 1)))
	},
	"begin": func(t *TypeOneI) {
		a := t.St.Pop()
		if a[0] != 'D' {
			panic("Wrong dictionary!\n")
		}
		t.DicSp++
		t.DicSt[t.DicSp] = t.Dicts[strm.Int(string(a[1:]), 1)]
	},
	"bind": func(t *TypeOneI) {
	},
	"cleartomark": func(t *TypeOneI) {
		a := t.St.Pop()
		for string(a) != "mark" {
			a = t.St.Pop()
		}
	},
	"closefile": func(t *TypeOneI) {
		a := t.St.Pop()
		t.Done = true
		_ = a
	},
	"currentdict": func(t *TypeOneI) {
		t.St.Push(t.DicSt[t.DicSp].Name)
	},
	"currentfile": func(t *TypeOneI) {
		t.St.Push([]byte{'?'})
	},
	"def": func(t *TypeOneI) {
		a := t.St.Drop(2)
		t.DicSt[t.DicSp].Defs[string(a[0])] = a[1]
	},
	"definefont": func(t *TypeOneI) {
		a := t.St.Drop(2)
		t.Fonts[string(a[0])] = string(a[1])
		t.St.Push(util.Bytes("<FONT>"))
		_ = a
	},
	"defineresource": func(t *TypeOneI) {
		a := t.St.Drop(3)
		t.St.Push([]byte{'?'})
		_ = a
	},
	"dict": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(t.NewDic())
		_ = a
	},
	"dup": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(a)
		t.St.Push(a)
	},
	"end": func(t *TypeOneI) {
		t.DicSp--
	},
	"exch": func(t *TypeOneI) {
		a := t.St.Drop(2)
		a0 := a[0]
		t.St.Push(a[1])
		t.St.Push(a0)
	},
	"executeonly": func(t *TypeOneI) {
	},
	"findresource": func(t *TypeOneI) {
		a := t.St.Drop(2)
		t.St.Push([]byte{'?'})
		_ = a
	},
	"for": func(t *TypeOneI) {
		a := t.St.Drop(4)

		_ = a
	},
	"get": func(t *TypeOneI) {
		a := t.St.Drop(2)
		i := strm.Int(string(a[0][1:]), 1)
		if a[0][0] == 'D' {
			t.St.Push(t.Dicts[i].Defs[string(a[1])])
		} else if a[0][0] == 'A' {
			t.St.Push(t.Arrays[i][strm.Int(string(a[1]), 1)])
		} else {
			panic("Can not 'get' from!\n")
		}
	},
	"index": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(t.St.Index(strm.Int(string(a), 1) + 1))
	},
	"known": func(t *TypeOneI) {
		a := t.St.Drop(2)
		t.St.Push(util.Bytes("false"))
		_ = a
	},
	"noaccess": func(t *TypeOneI) {
	},
	"pop": func(t *TypeOneI) {
		a := t.St.Pop()
		_ = a
	},
	"put": func(t *TypeOneI) {
		a := t.St.Drop(3)
		if a[0][0] == 'D' {
			t.Dicts[strm.Int(string(a[0][1:]), 1)].Defs[string(a[1])] = a[2]
		} else if a[0][0] == 'A' {
			t.Arrays[strm.Int(string(a[0][1:]), 1)][strm.Int(string(a[1]), 1)] = a[2]
		} else {
			panic("Wrong dictionary or array!\n")
		}
	},
	"readonly": func(t *TypeOneI) {
	},
	"readstring": func(t *TypeOneI) {
		a := t.St.Drop(2)
		c, _ := t.Rdr.Read(a[1])
		t.St.Push(a[1][0:c])
		t.St.Push(util.Bytes("true"))
	},
	"string": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(make([]byte, strm.Int(string(a), 1)))
	},
	"userdict": func(t *TypeOneI) {
		t.St.Push(util.Bytes("D0"))
	},
	"where": func(t *TypeOneI) {
		a := t.St.Pop()
		t.St.Push(util.Bytes("false"))
		_ = a
	},
}

Functions

func T1Decrypt

func T1Decrypt(r int, s []byte) []byte

Types

type DicT

type DicT struct {
	Defs map[string][]byte
	Name []byte
}

type TypeOneI

type TypeOneI struct {
	Rdr    fancy.Reader
	St     stacks.Stack
	DicSt  [64]*DicT
	DicSp  int
	Dicts  [1024]*DicT
	DicNo  int
	Arrays [1024][][]byte
	ArraNo int
	Marker int
	Args   [][]byte
	Done   bool
	Fonts  map[string]string
}

func NewInterpreter

func NewInterpreter() *TypeOneI

func Read

func Read(rdr fancy.Reader) (r *TypeOneI)

func (*TypeOneI) Dic

func (i *TypeOneI) Dic(id string) map[string][]byte

func (*TypeOneI) NewArray

func (t *TypeOneI) NewArray(size int) (r []byte)

func (*TypeOneI) NewDic

func (t *TypeOneI) NewDic() (r []byte)

Jump to

Keyboard shortcuts

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