Documentation
¶
Index ¶
- Constants
- Variables
- func Equal(x, y *Machine) (bool, string)
- type DivideByZeroError
- type EmptyStackError
- type ErrorInstructionError
- type Instruction
- type Machine
- func (m *Machine) AuxStack() stack.Stack
- func (m *Machine) Clone() *Machine
- func (m *Machine) Context() MachineContext
- func (m *Machine) ErrorStop()
- func (m *Machine) GetAllOperations() []value.Operation
- func (m *Machine) GetErrHandler() value.CodePointValue
- func (m *Machine) GetOperation() value.Operation
- func (m *Machine) GetPC() value.Value
- func (m *Machine) GetSizeLimit() int64
- func (m *Machine) Halt()
- func (m *Machine) Hash() [32]byte
- func (m *Machine) HaveSizeException() bool
- func (m *Machine) IncrPC()
- func (m *Machine) IsErrored() bool
- func (m *Machine) IsHalted() bool
- func (m *Machine) Log(val value.Value)
- func (m *Machine) MarshalForProof(wr io.Writer) error
- func (m *Machine) PrintState()
- func (m *Machine) Register() *MachineValue
- func (m *Machine) Run(maxSteps int32) int32
- func (m *Machine) RunUntilStop()
- func (m *Machine) SetContext(mc MachineContext)
- func (m *Machine) SetPC(iv value.Value) error
- func (m *Machine) Stack() stack.Stack
- func (m *Machine) Static() *MachineValue
- func (m *Machine) Warn(str string)
- type MachineContext
- type MachineNoContext
- func (m *MachineNoContext) CanSpend(tokenType value.IntValue, currency value.IntValue) bool
- func (m *MachineNoContext) GetTimeBounds() value.Value
- func (m *MachineNoContext) LoggedValue(data value.Value) error
- func (m *MachineNoContext) NotifyStep()
- func (m *MachineNoContext) OutMessageCount() int
- func (m *MachineNoContext) ReadInbox() value.Value
- func (m *MachineNoContext) Send(data value.Value, tokenType value.IntValue, currency value.IntValue, ...) error
- type MachinePC
- func (s *MachinePC) Equal(y *MachinePC) (bool, string)
- func (m MachinePC) GetCurrentCodePointHash() [32]byte
- func (m MachinePC) GetCurrentInsn() value.Operation
- func (m MachinePC) GetCurrentInsnName() string
- func (m MachinePC) GetPC() value.CodePointValue
- func (m *MachinePC) IncrPC() error
- func (m *MachinePC) SetPCForced(iv value.Value) error
- type MachineStatus
- type MachineValue
- func (r *MachineValue) Clone() *MachineValue
- func (r *MachineValue) Equal(comp *MachineValue) (bool, string)
- func (r *MachineValue) Get() value.Value
- func (r *MachineValue) ProofValue() value.Value
- func (r *MachineValue) Set(value value.Value)
- func (r *MachineValue) Size() int64
- func (r *MachineValue) StateValue() value.Value
- type PopTypeWarning
- type SilentWarningHandler
- type StackMods
- func NewStackMods(pops, pushes int) StackMods
- func PopAuxStack(m *Machine, mods StackMods) (value.Value, StackMods, error)
- func PopStackBox(m *Machine, mods StackMods) (value.Value, StackMods, error)
- func PopStackCodePoint(m *Machine, mods StackMods) (value.CodePointValue, StackMods, error)
- func PopStackInt(m *Machine, mods StackMods) (value.IntValue, StackMods, error)
- func PopStackTuple(m *Machine, mods StackMods) (value.TupleValue, StackMods, error)
- func PopStackValue(m *Machine, mods StackMods) (value.Value, StackMods, error)
- func PushStackBox(m *Machine, mods StackMods, b value.Value) StackMods
- func PushStackCodePoint(m *Machine, mods StackMods, v value.CodePointValue) StackMods
- func PushStackInt(m *Machine, mods StackMods, v value.IntValue) StackMods
- func PushStackTuple(m *Machine, mods StackMods, v value.TupleValue) StackMods
- func RunInstruction(m *Machine, op value.Operation) (StackMods, error)
- type VMBlockedError
- type VerboseWarningHandler
- type WarningHandler
Constants ¶
View Source
const CodeSaveFrequency = 2
View Source
const MaxAuxStackPops = 1
View Source
const MaxStackPops = 3
Variables ¶
View Source
var HashOfHaltedMachine [32]byte
View Source
var HashOfLastInstruction [32]byte
View Source
var HashOfSizeExceptionMachine [32]byte
View Source
var Instructions = []Instruction(nil)
Functions ¶
Types ¶
type DivideByZeroError ¶
type DivideByZeroError struct { }
func (DivideByZeroError) Error ¶
func (w DivideByZeroError) Error() string
type EmptyStackError ¶
type EmptyStackError struct {
// contains filtered or unexported fields
}
func (EmptyStackError) Error ¶
func (w EmptyStackError) Error() string
type ErrorInstructionError ¶
type ErrorInstructionError struct { }
func (ErrorInstructionError) Error ¶
func (w ErrorInstructionError) Error() string
type Instruction ¶
type Instruction struct {
// contains filtered or unexported fields
}
func (Instruction) GetCode ¶
func (insn Instruction) GetCode() code.Opcode
func (Instruction) GetName ¶
func (insn Instruction) GetName() string
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
func NewMachine ¶
func RestoreMachine ¶
func (*Machine) Context ¶
func (m *Machine) Context() MachineContext
func (*Machine) GetAllOperations ¶
func (*Machine) GetErrHandler ¶
func (m *Machine) GetErrHandler() value.CodePointValue
func (*Machine) GetOperation ¶
func (*Machine) GetSizeLimit ¶
func (*Machine) HaveSizeException ¶
func (*Machine) PrintState ¶
func (m *Machine) PrintState()
func (*Machine) Register ¶
func (m *Machine) Register() *MachineValue
func (*Machine) Run ¶
run up to maxSteps steps, stop earlier if halt or advise instruction, return number of insns actually run, and advise string or ""
func (*Machine) RunUntilStop ¶
func (m *Machine) RunUntilStop()
func (*Machine) SetContext ¶
func (m *Machine) SetContext(mc MachineContext)
func (*Machine) Static ¶
func (m *Machine) Static() *MachineValue
type MachineContext ¶
type MachineContext interface { CanSpend(tokenType value.IntValue, currency value.IntValue) bool Send(data value.Value, tokenType value.IntValue, currency value.IntValue, dest value.IntValue) error ReadInbox() value.Value GetTimeBounds() value.Value NotifyStep() LoggedValue(value.Value) error OutMessageCount() int }
type MachineNoContext ¶
type MachineNoContext struct{}
func (*MachineNoContext) GetTimeBounds ¶
func (m *MachineNoContext) GetTimeBounds() value.Value
func (*MachineNoContext) LoggedValue ¶
func (m *MachineNoContext) LoggedValue(data value.Value) error
func (*MachineNoContext) NotifyStep ¶
func (m *MachineNoContext) NotifyStep()
func (*MachineNoContext) OutMessageCount ¶
func (m *MachineNoContext) OutMessageCount() int
func (*MachineNoContext) ReadInbox ¶
func (m *MachineNoContext) ReadInbox() value.Value
type MachinePC ¶
type MachinePC struct {
// contains filtered or unexported fields
}
func NewMachinePC ¶
func NewMachinePC(insns []value.Operation, handler WarningHandler) *MachinePC
func (MachinePC) GetCurrentCodePointHash ¶
func (MachinePC) GetCurrentInsn ¶
func (MachinePC) GetCurrentInsnName ¶
func (MachinePC) GetPC ¶
func (m MachinePC) GetPC() value.CodePointValue
type MachineStatus ¶
type MachineStatus int
const ( MACHINE_EXTENSIVE MachineStatus = iota MACHINE_ERRORSTOP MACHINE_HALT )
type MachineValue ¶
type MachineValue struct {
// contains filtered or unexported fields
}
func NewMachineValue ¶
func NewMachineValue(val value.Value) *MachineValue
func (*MachineValue) Clone ¶
func (r *MachineValue) Clone() *MachineValue
func (*MachineValue) Equal ¶
func (r *MachineValue) Equal(comp *MachineValue) (bool, string)
func (*MachineValue) Get ¶
func (r *MachineValue) Get() value.Value
func (*MachineValue) ProofValue ¶
func (r *MachineValue) ProofValue() value.Value
func (*MachineValue) Set ¶
func (r *MachineValue) Set(value value.Value)
func (*MachineValue) Size ¶
func (r *MachineValue) Size() int64
func (*MachineValue) StateValue ¶
func (r *MachineValue) StateValue() value.Value
type PopTypeWarning ¶
type PopTypeWarning struct {
// contains filtered or unexported fields
}
func (PopTypeWarning) Error ¶
func (w PopTypeWarning) Error() string
type SilentWarningHandler ¶
type SilentWarningHandler struct {
// contains filtered or unexported fields
}
func NewSilentWarningHandler ¶
func NewSilentWarningHandler() *SilentWarningHandler
func (*SilentWarningHandler) AnyWarnings ¶
func (hand *SilentWarningHandler) AnyWarnings() bool
func (*SilentWarningHandler) Clone ¶
func (hand *SilentWarningHandler) Clone() WarningHandler
func (*SilentWarningHandler) SwitchMachinePC ¶
func (hand *SilentWarningHandler) SwitchMachinePC(m *MachinePC)
func (*SilentWarningHandler) Warn ¶
func (hand *SilentWarningHandler) Warn(wstr string)
type StackMods ¶
type StackMods struct {
// contains filtered or unexported fields
}
func NewStackMods ¶
func PopStackCodePoint ¶
func PopStackTuple ¶
func PushStackCodePoint ¶
func PushStackCodePoint(m *Machine, mods StackMods, v value.CodePointValue) StackMods
func PushStackTuple ¶
func PushStackTuple(m *Machine, mods StackMods, v value.TupleValue) StackMods
type VMBlockedError ¶
type VMBlockedError struct{}
func (VMBlockedError) Error ¶
func (w VMBlockedError) Error() string
type VerboseWarningHandler ¶
type VerboseWarningHandler struct {
// contains filtered or unexported fields
}
func NewVerboseWarningHandler ¶
func NewVerboseWarningHandler(m *MachinePC) *VerboseWarningHandler
func (*VerboseWarningHandler) AnyWarnings ¶
func (hand *VerboseWarningHandler) AnyWarnings() bool
func (*VerboseWarningHandler) Clone ¶
func (hand *VerboseWarningHandler) Clone() WarningHandler
func (*VerboseWarningHandler) SwitchMachinePC ¶
func (hand *VerboseWarningHandler) SwitchMachinePC(m *MachinePC)
func (*VerboseWarningHandler) Warn ¶
func (hand *VerboseWarningHandler) Warn(wstr string)
type WarningHandler ¶
type WarningHandler interface { AnyWarnings() bool Warn(string) Clone() WarningHandler SwitchMachinePC(stack *MachinePC) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.