profile

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransformTypes

func TransformTypes(types []*Type) (map[string]*GoType, error)

Types

type Field

type Field struct {
	RegField  []string
	DynFields [][]string
}

type Generator

type Generator struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(sdkVersion string) *Generator

func (*Generator) GenerateMsgs

func (g *Generator) GenerateMsgs(msgs []*GoMsg) ([]byte, error)

func (*Generator) GenerateProfile

func (g *Generator) GenerateProfile(types map[string]*GoType, msgs []*GoMsg, jmptable bool) ([]byte, error)

func (*Generator) GenerateTypes

func (g *Generator) GenerateTypes(types map[string]*GoType) ([]byte, error)

type GoField

type GoField struct {
	DefNum        string
	Name          string
	CamelCaseName string
	Type          string
	Array         string // 255=N
	Components    []string
	Scale         string
	Offset        string
	Units         string
	Bits          []string
	RefFieldName  []string
	RefFieldValue []string
	Comment       string
	Example       string

	BaseType  string
	GoType    string
	GoInvalid string

	DynFields []*GoField
}

type GoMsg

type GoMsg struct {
	Name          string
	CamelCaseName string
	Fields        []*GoField
}

func TransformMsgs

func TransformMsgs(msgs []*Msg, types map[string]*GoType) ([]*GoMsg, error)

type GoType

type GoType struct {
	Name          string
	CamelCaseName string
	PkgName       string
	BaseType      string
	GoBaseType    string
	InvalidValue  string
	Values        []ValueTriple
}

type Msg

type Msg struct {
	Header []string
	Fields []*Field
}

type Parser

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

func NewMsgParser

func NewMsgParser(r io.Reader) (*Parser, error)

func NewTypeParser

func NewTypeParser(r io.Reader) (*Parser, error)

func (*Parser) ParseMsg

func (p *Parser) ParseMsg() (*Msg, error)

func (*Parser) ParseType

func (p *Parser) ParseType() (*Type, error)

type Scanner

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

func NewMsgScanner

func NewMsgScanner(r io.Reader) (*Scanner, error)

func NewTypeScanner

func NewTypeScanner(r io.Reader) (*Scanner, error)

func (*Scanner) Scan

func (s *Scanner) Scan() (tok Token, lit []string)

type Token

type Token int
const (
	// Common
	ILLEGAL Token = iota
	EOF
	EMPTY
	CSVHDR

	// Types
	THDR
	TFIELD

	// Messages
	FMSGSHDR
	MSGHDR
	MSGFIELD
	DYNMSGFIELD
)

func (Token) String

func (t Token) String() string

type Type

type Type struct {
	Header []string
	Fields [][]string
}

type ValueTriple

type ValueTriple struct {
	Name, Value, Comment string
}

Jump to

Keyboard shortcuts

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