Documentation ¶
Overview ¶
Package csym translates Playstation 1 symbol information to C declarations.
Index ¶
- func SliceIndex(limit int, predicate func(i int) bool) int
- func UniqueEnumTag(EnumTags map[string][]*c.EnumType, t *c.EnumType) string
- func UniqueFuncName(funcNames map[string][]*c.FuncDecl, f *c.FuncDecl) string
- func UniqueName(name string, addr uint32) string
- func UniqueStructTag(structTags map[string][]*c.StructType, t *c.StructType) string
- func UniqueTag(tag string, typ string, idx int) string
- func UniqueUnionTag(unionTags map[string][]*c.UnionType, t *c.UnionType) string
- func UniqueVarName(varNames map[string][]*c.VarDecl, v *c.VarDecl) string
- type Line
- type Overlay
- type Parser
- func (p *Parser) AddEnum(t *c.EnumType) *c.EnumType
- func (p *Parser) AddStruct(t *c.StructType) *c.StructType
- func (p *Parser) AddUnion(t *c.UnionType) *c.UnionType
- func (p *Parser) MakeNamesUnique()
- func (p *Parser) ParseDecls(syms []*sym.Symbol)
- func (p *Parser) ParseTypes(syms []*sym.Symbol)
- func (p *Parser) RemoveDuplicateTypes()
- func (p *Parser) ReplaceEnums(typeRemap map[c.Type]c.Type)
- func (p *Parser) ReplaceStructs(typeRemap map[c.Type]c.Type)
- func (p *Parser) ReplaceUnions(typeRemap map[c.Type]c.Type)
- func (p *Parser) ReplaceUsedTypes(typeRemap map[c.Type]c.Type)
- func (p *Parser) RmNilEnums()
- func (p *Parser) RmNilStructs()
- func (p *Parser) RmNilUnions()
- type Symbol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SliceIndex ¶
SliceIndex returns index within slece for which the func returns true
func UniqueEnumTag ¶
UniqueEnumTag returns a unique enum tag based on the given enum and set of present enums mapped by tags.
func UniqueFuncName ¶
UniqueFuncName returns a unique function name based on the given function and set of present functions mapped by names.
func UniqueName ¶
UniqueName returns a unique name based on the given name and address.
func UniqueStructTag ¶
func UniqueStructTag(structTags map[string][]*c.StructType, t *c.StructType) string
UniqueStructTag returns a unique struct tag based on the given struct and set of present structs mapped by tags.
func UniqueUnionTag ¶
UniqueUnionTag returns a unique union tag based on the given union and set of present unions mapped by tags.
Types ¶
type Line ¶
type Line struct { // Address. Addr uint32 // Source file name. Path string // Line number. Line uint32 }
A Line associates a line number in a source file with an address.
type Overlay ¶
type Overlay struct { // Base address at which the overlay is loaded. Addr uint32 // Overlay ID. ID uint32 // Overlay length in bytes. Length uint32 // Variable delcarations. Vars []*c.VarDecl // Function delcarations. Funcs []*c.FuncDecl // Symbols. Symbols []*Symbol // Source file line numbers. Lines []*Line // contains filtered or unexported fields }
An Overlay is an overlay appended to the end of the executable.
type Parser ¶
type Parser struct { // Struct maps from struct tag to struct types. StructTags map[string][]*c.StructType // Unions maps from union tag to union types. UnionTags map[string][]*c.UnionType // Enums maps from enum tag to enum types. EnumTags map[string][]*c.EnumType // types maps from type name to underlying type definition. Types map[string]c.Type // Structs in order of occurrence in SYM file. Structs []*c.StructType // Unions in order of occurrence in SYM file. Unions []*c.UnionType // Enums in order of occurrence in SYM file. Enums []*c.EnumType // Type definitions in order of occurrence in SYM file. Typedefs []c.Type // Declarations. *Overlay // default binary // Overlays. Overlays []*Overlay // contains filtered or unexported fields }
Parser tracks type information used for parsing.
func (*Parser) AddStruct ¶
func (p *Parser) AddStruct(t *c.StructType) *c.StructType
AddStruct adds the type instance to lists within parser
func (*Parser) MakeNamesUnique ¶
func (p *Parser) MakeNamesUnique()
MakeNamesUnique goes through parsed symbols and renames duplicate names.
func (*Parser) ParseDecls ¶
func (p *Parser) ParseDecls(syms []*sym.Symbol)
ParseDecls parses the symbols into the equivalent C declarations.
func (*Parser) ParseTypes ¶
func (p *Parser) ParseTypes(syms []*sym.Symbol)
ParseTypes parses the SYM types into the equivalent C types.
func (*Parser) RemoveDuplicateTypes ¶
func (p *Parser) RemoveDuplicateTypes()
RemoveDuplicateTypes goes through parsed types and marks exact duplicates.
func (*Parser) ReplaceEnums ¶
ReplaceEnums replaces types with another in lists within parser It does not replace use of the enum in other types
func (*Parser) ReplaceStructs ¶
ReplaceStructs replaces types with another in lists within parser It does not replace use of the struct in other types
func (*Parser) ReplaceUnions ¶
ReplaceUnions replaces types with another in lists within parser It does not replace use of the union in other types
func (*Parser) RmNilEnums ¶
func (p *Parser) RmNilEnums()
func (*Parser) RmNilStructs ¶
func (p *Parser) RmNilStructs()
func (*Parser) RmNilUnions ¶
func (p *Parser) RmNilUnions()