vm

package
v0.0.0-...-a860d3e Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2012 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmpLT = iota
	CmpLTE
	CmpEQ
	CmpNE
	CmpGT
	CmpGTE
	CmpIN
	CmpNIN // not in
	CmpIS
	CmpISN // is not
	CmpEM  // Exact match
	CmpBAD //  Bad ????
)
View Source
const (
	POP_TOP           = 1
	ROT_TWO           = 2
	BINARY_MULTIPLY   = 20
	BINARY_ADD        = 23
	BINARY_SUBTRACT   = 24
	BINARY_SUBSCR     = 25
	INPLACE_ADD       = 55
	INPLACE_MULTIPLY  = 57
	STORE_SUBSCR      = 60
	PRINT_ITEM        = 71
	PRINT_NEWLINE     = 72
	RETURN_VALUE      = 83
	POP_BLOCK         = 87
	STORE_NAME        = 90
	DELETE_NAME       = 91
	UNPACK_SEQUENCE   = 92
	FOR_ITER          = 93
	LOAD_CONST        = 100
	LOAD_NAME         = 101
	BUILD_TUPLE       = 102
	BUILD_LIST        = 103
	LOAD_ATTR         = 106
	COMPARE_OP        = 107
	IMPORT_NAME       = 108
	JUMP_ABSOLUTE     = 113
	POP_JUMP_IF_FALSE = 114
	LOAD_GLOBAL       = 116
	SETUP_LOOP        = 120
	LOAD_FAST         = 124
	STORE_FAST        = 125
	CALL_FUNCTION     = 131
	MAKE_FUNCTION     = 132
	MAKE_CLOSURE      = 134
	LOAD_CLOSURE      = 135
	LOAD_DEREF        = 136
	STORE_DEREF       = 137
)
View Source
const (
	OpAdd = iota
	OpMultiply
	OpSubtract
)
View Source
const (
	PyFuncExternal = iota
	PyFuncInternal
)
View Source
const HasArgLimes = 90

Variables

View Source
var ModuleGopy = Module{
	// contains filtered or unexported fields
}
View Source
var ModuleTime = Module{
	// contains filtered or unexported fields
}
View Source
var Modules = map[string]Module{
	"time": ModuleTime,
	"gopy": ModuleGopy,
}
View Source
var PyAttributeError = NewPyException("AttributeError")
View Source
var PyBuiltInFuncMap = map[string]func(){}
View Source
var PyBuiltInTypeMap = map[string]PyObject{
	"True":  PyTrue,
	"False": PyFalse,
}
View Source
var PyFalse = NewPyBool(false)
View Source
var PyIndexError = NewPyException("IndexError")
View Source
var PyNameError = NewPyException("NameError")
View Source
var PyNil = NewPyNone()
View Source
var PyTrue = NewPyBool(true)
View Source
var PyTypeError = NewPyException("TypeError")

Functions

func MinInt

func MinInt(a, b int) int

func NewCodeReader

func NewCodeReader(data []byte) *codeReader

func PyArgs_Build

func PyArgs_Build(args ...PyObject)

Types

type Block

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

BlockStack

type BlockStack

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

func NewBlockStack

func NewBlockStack(count uint64) *BlockStack

func (*BlockStack) Pop

func (s *BlockStack) Pop() *Block

func (*BlockStack) Push

func (s *BlockStack) Push(position, position2 int64)

type CodeFlags

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

type Module

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

type ModuleDict

type ModuleDict map[string]ModuleFunc

type ModuleFunc

type ModuleFunc func(args *PyArgs) PyObject

type PyArgs

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

func NewPyArgs

func NewPyArgs() *PyArgs

type PyBool

type PyBool struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyClass

type PyClass struct {
	PyObjectData
}

type PyCode

type PyCode struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyException

type PyException struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyFrame

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

func NewPyFrame

func NewPyFrame(stacksize uint64) *PyFrame

type PyFunc

type PyFunc struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyInt

type PyInt struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyList

type PyList struct {
	PyTuple
}

type PyModule

type PyModule struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyNone

type PyNone struct {
	PyObjectData
}

type PyObjStack

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

PyObjStack

func NewPyObjStack

func NewPyObjStack(count uint64) *PyObjStack

func (*PyObjStack) Pop

func (s *PyObjStack) Pop() PyObject

func (*PyObjStack) Push

func (s *PyObjStack) Push(item PyObject)

type PyObject

type PyObject interface {
	// contains filtered or unexported methods
}

func NewPyBool

func NewPyBool(value bool) PyObject

func NewPyCode

func NewPyCode(vm *VM) PyObject

func NewPyException

func NewPyException(name string) PyObject

func NewPyFuncExternal

func NewPyFuncExternal(codeobj PyObject) PyObject

func NewPyFuncInternal

func NewPyFuncInternal(module *Module, fn ModuleFunc, name *string) PyObject

func NewPyInt

func NewPyInt(value int64) PyObject

func NewPyList

func NewPyList(items []PyObject) PyObject

func NewPyModule

func NewPyModule(name *string) PyObject

func NewPyNone

func NewPyNone() PyObject

func NewPyString

func NewPyString(value *string) PyObject

func NewPyTuple

func NewPyTuple(items []PyObject) PyObject

type PyObjectData

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

type PyString

type PyString struct {
	PyObjectData
	// contains filtered or unexported fields
}

type PyTuple

type PyTuple struct {
	PyObjectData
	// contains filtered or unexported fields
}

type Runtime

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

type VM

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

func NewVM

func NewVM(filename string, debug bool) (*VM, error)

func (*VM) Filename

func (vm *VM) Filename() *string

func (*VM) Name

func (vm *VM) Name() *string

func (*VM) Run

func (vm *VM) Run() error

Jump to

Keyboard shortcuts

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