tables

package
v0.0.0-...-d69f115 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CGOTable

type CGOTable struct {
	*Table
}

Examples

func Print(s string) {
    cs := C.CString(s)
    defer C.free(unsafe.Pointer(cs))
    C.fputs(cs, (*C.FILE)(C.stdout))
}

Analysis: - C.CString is stored into allocated symbol table as gotypes.CgoSymbol{Def: "CString", Package: "C"} - cs is out gotypes.CgoSymbol{Def: "CString", Package: "C"} - unsafe.Pointer is processed as usually - C.free is stored as gotypes.CgoSymbol{Def: "free", Package: "C"} - C.stdout is stored as gotypes.CgoSymbol{Def: "stdout", Package: "C"} - C.FILE is stored as gotypes.CgoSymbol{Def: "FILE", Package: "C"} - C.fputs is stored as gotypes.CgoSymbol{Def: "fputs", Package: "C"}

Basically, if a gotypes.DataType is of gotypes.CgoSymbol type, it is interpreted based on a context. E.g. if it is a part of an expression, it is interpreted as it would have one result value E.g. it it is a part of a multi-var assignmet, each variable is of type gotypes.CgoSymbol{Def: "", Package: "C"} unless the type can be deduced

C.GoString convers C zero-terminated array of chars to Go string C.int convers Go int to C int C.CString covers Go string to C string

Or go tool cgo -godefs translates all C-like structs into G-like ones

func NewCGOTable

func NewCGOTable() *CGOTable

func (*CGOTable) Flush

func (c *CGOTable) Flush()

func (*CGOTable) LoadFromFile

func (c *CGOTable) LoadFromFile(file string) error

type DataType

type DataType struct {
	gotypes.DataType
}

func (*DataType) UnmarshalYAML

func (d *DataType) UnmarshalYAML(unmarshal func(interface{}) error) error

type Table

type Table struct {
	Symbols    map[string][]*symbols.SymbolDef `json:"symbols"`
	PackageQID string                          `json:"qid"`
	Imports    []string                        `json:"imports"`
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *Table

func (*Table) AddDataType

func (t *Table) AddDataType(sym *symbols.SymbolDef) error

func (*Table) AddFunction

func (t *Table) AddFunction(sym *symbols.SymbolDef) error

func (*Table) AddVariable

func (t *Table) AddVariable(sym *symbols.SymbolDef) error

func (*Table) Exists

func (t *Table) Exists(name string) bool

func (*Table) Lookup

func (t *Table) Lookup(key string) (*symbols.SymbolDef, symbols.SymbolType, error)

func (*Table) LookupAllMethods

func (t *Table) LookupAllMethods(datatype string) (map[string]*symbols.SymbolDef, error)

func (*Table) LookupDataType

func (t *Table) LookupDataType(key string) (*symbols.SymbolDef, error)

func (*Table) LookupFunction

func (t *Table) LookupFunction(key string) (*symbols.SymbolDef, error)

func (*Table) LookupMethod

func (t *Table) LookupMethod(datatype, methodName string) (*symbols.SymbolDef, error)

func (*Table) LookupVariable

func (t *Table) LookupVariable(key string) (*symbols.SymbolDef, error)

func (*Table) LookupVariableLikeSymbol

func (t *Table) LookupVariableLikeSymbol(key string) (*symbols.SymbolDef, symbols.SymbolType, error)

func (*Table) UnmarshalJSON

func (t *Table) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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