chunk

package
v0.0.0-...-350ec9d Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LuaSignature 魔数
	LuaSignature = "\x1bLua"
	// LuacVersion Luac版本
	LuacVersion = 0x53
	// LuacFormat Luac格式数字
	LuacFormat = 0x00
	// LuacData Luac预留验证数据
	LuacData = "\x19\x93\r\n\x1a\n"
	// CIntSize Lua虚拟机cint宽度
	CIntSize = 4
	// SizeTSize Lua虚拟机size_t宽度
	SizeTSize = 8
	// InstructionSize Lua虚拟机指令宽度
	InstructionSize = 4
	// LuaIntegerSize Lua虚拟机整数宽度
	LuaIntegerSize = 8
	// LuaNumberSize Lua虚拟机浮点数宽度
	LuaNumberSize = 8
	// LuacInt 整数验证数字
	LuacInt = 0x5678
	// LuacNum 浮点数验证数字
	LuacNum = 370.5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

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

Chunk 结构

func (*Chunk) CheckLoad

func (me *Chunk) CheckLoad(reader *Reader)

CheckLoad 校验并加载Chunk

func (*Chunk) Header

func (me *Chunk) Header() Header

Header 获取头部信息

func (*Chunk) MainFunc

func (me *Chunk) MainFunc() *Prototype

MainFunc 获取主函数

func (*Chunk) PrintList

func (me *Chunk) PrintList()

PrintList 输出Chunk信息

func (*Chunk) SizeUpdatevalues

func (me *Chunk) SizeUpdatevalues() byte

SizeUpdatevalues 获取SizeUpdatevalues

type Code

type Code uint32

Code 指令

type Constant

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

Constant 常量空接口

func (*Constant) Type

func (me *Constant) Type() EConstantType

Type 常量的类型

func (*Constant) TypeString

func (me *Constant) TypeString() string

TypeString 常量类型的字符串描述

func (*Constant) Value

func (me *Constant) Value() interface{}

Value 常量的值

func (*Constant) ValueString

func (me *Constant) ValueString() string

ValueString 常量的值用字符串形式表达

type EConstantType

type EConstantType byte

EConstantType Lua常量类型枚举

const (
	// ConstantTypeNil nil常量类型
	ConstantTypeNil EConstantType = 0x00
	// ConstantTypeBoolean 布尔值常量类型
	ConstantTypeBoolean EConstantType = 0x01
	// ConstantTypeNumber 浮点数常量类型
	ConstantTypeNumber EConstantType = 0x03
	// ConstantTypeInteger 整数常量类型
	ConstantTypeInteger EConstantType = 0x13
	// ConstantTypeShortStr 短字符串常量类型
	ConstantTypeShortStr EConstantType = 0x04
	// ConstantTypeLongStr 长字符串常量类型
	ConstantTypeLongStr EConstantType = 0x14
)
type Header struct {
	// contains filtered or unexported fields
}

Header Chunk的Header部分

func (*Header) CheckLoad

func (me *Header) CheckLoad(reader *Reader)

CheckLoad 从Reader中检查并加载Header

type LocVar

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

LocVar 局部变量

func (*LocVar) EndPC

func (me *LocVar) EndPC() uint32

EndPC s

func (*LocVar) StartPC

func (me *LocVar) StartPC() uint32

StartPC s

func (*LocVar) VarName

func (me *LocVar) VarName() string

VarName 局部变量名称

type Prototype

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

Prototype 函数原型

func (*Prototype) Constants

func (me *Prototype) Constants() []Constant

Constants 获取常量表 常量需要改造

func (*Prototype) Instructions

func (me *Prototype) Instructions() []instruction.LuaInstruction

Instructions 指令列表

func (*Prototype) IsVararg

func (me *Prototype) IsVararg() byte

IsVararg 是否是Vararg函数

func (*Prototype) LastLineDefined

func (me *Prototype) LastLineDefined() uint32

LastLineDefined 获取结束行号

func (*Prototype) LineDefined

func (me *Prototype) LineDefined() uint32

LineDefined 获取开始行号

func (*Prototype) LineInfos

func (me *Prototype) LineInfos() []uint32

LineInfos 获取行号表

func (*Prototype) List

func (me *Prototype) List() []string

List 函数原型信息

func (*Prototype) ListConstants

func (me *Prototype) ListConstants() []string

ListConstants 打印常量列表

func (*Prototype) ListInstructions

func (me *Prototype) ListInstructions() []string

ListInstructions 指令列表信息

func (*Prototype) ListLocVars

func (me *Prototype) ListLocVars() []string

ListLocVars 局部变量信息

func (*Prototype) ListMeta

func (me *Prototype) ListMeta() []string

ListMeta 基本信息

func (*Prototype) ListName

func (me *Prototype) ListName() []string

ListName 名称信息

func (*Prototype) ListSubPrototypes

func (me *Prototype) ListSubPrototypes() []string

ListSubPrototypes 子函数原型信息

func (*Prototype) ListUpvalues

func (me *Prototype) ListUpvalues() []string

ListUpvalues Upvalue信息

func (*Prototype) LocVars

func (me *Prototype) LocVars() []LocVar

LocVars 获取局部变量表

func (*Prototype) MaxStackSize

func (me *Prototype) MaxStackSize() byte

MaxStackSize 获取需要寄存器数量

func (*Prototype) NumParams

func (me *Prototype) NumParams() byte

NumParams 获取固定参数个数

func (*Prototype) PrintList

func (me *Prototype) PrintList()

PrintList 打印信息

func (*Prototype) Prototypes

func (me *Prototype) Prototypes() []*Prototype

Prototypes 获取子函数原型表

func (*Prototype) Source

func (me *Prototype) Source() string

Source 获取源文件名

func (*Prototype) UpvalueNames

func (me *Prototype) UpvalueNames() []string

UpvalueNames 获取Upvalue名列表

func (*Prototype) Upvalues

func (me *Prototype) Upvalues() []Upvalue

Upvalues 获取Upvalue表

type Reader

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

Reader 读取器

func NewReader

func NewReader(reader io.Reader) *Reader

NewReader 构造函数

func (*Reader) ReadByte

func (me *Reader) ReadByte() byte

ReadByte 读取一个字节

func (*Reader) ReadBytes

func (me *Reader) ReadBytes(size uint64) []byte

ReadBytes 读取字节数组

func (*Reader) ReadConstant

func (me *Reader) ReadConstant() Constant

ReadConstant 读取常量

func (*Reader) ReadConstants

func (me *Reader) ReadConstants() []Constant

ReadConstants 读取常量列表

func (*Reader) ReadInstructions

func (me *Reader) ReadInstructions() []instruction.LuaInstruction

ReadInstructions 读取Lua虚拟机指令

func (*Reader) ReadLineInfos

func (me *Reader) ReadLineInfos() []uint32

ReadLineInfos 读取行号表

func (*Reader) ReadLocVars

func (me *Reader) ReadLocVars() []LocVar

ReadLocVars 读取本地变量列表

func (*Reader) ReadLuaInteger

func (me *Reader) ReadLuaInteger() int64

ReadLuaInteger 读取一个Lua整数

func (*Reader) ReadLuaNumber

func (me *Reader) ReadLuaNumber() float64

ReadLuaNumber 读取一个Lua浮点数

func (*Reader) ReadPrototype

func (me *Reader) ReadPrototype(parentSource string) *Prototype

ReadPrototype 读取函数原型

func (*Reader) ReadPrototypes

func (me *Reader) ReadPrototypes(parentSource string) []*Prototype

ReadPrototypes 读取函数原型列表

func (*Reader) ReadString

func (me *Reader) ReadString() string

ReadString 读取一个字符串

func (*Reader) ReadUint32

func (me *Reader) ReadUint32() uint32

ReadUint32 读取一个uint32

func (*Reader) ReadUint64

func (me *Reader) ReadUint64() uint64

ReadUint64 读取一个uint64

func (*Reader) ReadUpvalueNames

func (me *Reader) ReadUpvalueNames() []string

ReadUpvalueNames 读取Upvalue名称列表

func (*Reader) ReadUpvalues

func (me *Reader) ReadUpvalues() []Upvalue

ReadUpvalues 读取Upvalues列表

type Upvalue

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

Upvalue 元素

func (*Upvalue) Idx

func (me *Upvalue) Idx() byte

Idx s

func (*Upvalue) Instack

func (me *Upvalue) Instack() byte

Instack s

Jump to

Keyboard shortcuts

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