midl

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ACS_BYTE_COUNT = 57460
View Source
const AND = 57478
View Source
const ANNOTATION = 57451
View Source
const APPOBJECT = 57445
View Source
const BOOLEAN = 57356
View Source
const BROADCAST = 57405
View Source
const BYTE = 57357
View Source
const CALLBACK = 57431
View Source
const CALL_AS = 57450
View Source
const CASE = 57395
View Source
const CAST = 57484
View Source
const CHAR = 57355
View Source
const CHARACTER_LITERAL = 57462
View Source
const COCLASS = 57458
View Source
const CONST = 57385
View Source
const DEFAULT = 57396
View Source
const DEFAULT_VALUE = 57441
View Source
const DISABLE_CONSISTENCY_CHECK = 57427
View Source
const DISPINTERFACE = 57455
View Source
const DOUBLE = 57347
View Source
const DUAL = 57433
View Source
const ENDPOINT = 57409
View Source
const ENUM = 57391
View Source
const EQ = 57474
View Source
const ERROR_STATUS_T = 57360
View Source
const EXCEPTIONS = 57410
View Source
const FALSE = 57388
View Source
const FIRST_IS = 57365
View Source
const FLOAT = 57346
View Source
const FORMAT = 57374
View Source
const FORMAT_HEX = 57379
View Source
const FORMAT_MULTI_SIZE = 57376
View Source
const FORMAT_NULL_TERMINATED = 57375
View Source
const FORMAT_RUNE = 57378
View Source
const FORMAT_UTF8 = 57377
View Source
const GE = 57471
View Source
const GOEXT_LAYOUT = 57448
View Source
const GOEXT_NO_SIZE_LIMIT = 57449
View Source
const GT = 57473
View Source
const HANDLE = 57399
View Source
const HANDLE_T = 57359
View Source
const HELP_STRING = 57432
View Source
const HIDDEN = 57438
View Source
const HYPER = 57348
View Source
const ID = 57437
View Source
const IDEMPOTENT = 57404
View Source
const IDENT = 57465
View Source
const IGNORE = 57380
View Source
const IID_IS = 57414
View Source
const IMPORT = 57400
View Source
const IN = 57389
View Source
const INT = 57354
View Source
const INT16 = 57418
View Source
const INT32 = 57419
View Source
const INT3264 = 57416
View Source
const INT64 = 57420
View Source
const INT8 = 57417
View Source
const INTERFACE = 57403
View Source
const INT_LITERAL = 57464
View Source
const ISO_LATIN_1 = 57361
View Source
const ISO_MULTILINGUAL = 57362
View Source
const ISO_UCS = 57363
View Source
const LAST_IS = 57366
View Source
const LE = 57470
View Source
const LENGTH_IS = 57367
View Source
const LIBRARY = 57459
View Source
const LOCAL = 57411
View Source
const LOGICAL_AND = 57469
View Source
const LOGICAL_OR = 57468
View Source
const LONG = 57351
View Source
const LSH = 57479
View Source
const LT = 57472
View Source
const MAX_IS = 57368
View Source
const MAYBE = 57406
View Source
const METHODS = 57456
View Source
const MIN_IS = 57369
View Source
const MS_UNION = 57422
View Source
const NE = 57475
View Source
const NONEXTENSIBLE = 57439
View Source
const NULL = 57386
View Source
const OBJECT = 57423
View Source
const ODL = 57442
View Source
const OLEAUTOMATION = 57443
View Source
const OPTIONAL = 57444
View Source
const OR = 57476
View Source
const OUT = 57390
View Source
const PAD = 57447
View Source
const PIPE = 57392
View Source
const POINTER = 57381
View Source
const POINTER_DEFAULT = 57412
View Source
const POINTER_PTR = 57384
View Source
const POINTER_REF = 57382
View Source
const POINTER_UNIQUE = 57383
View Source
const PRAGMA_CPP_QUOTE = 57430
View Source
const PRAGMA_DEFINE = 57429
View Source
const PROPERTIES = 57457
View Source
const PROPGET = 57434
View Source
const PROPPUT = 57435
View Source
const PROPPUTREF = 57436
View Source
const PUBLIC = 57453
View Source
const RANGE = 57421
View Source
const REFLECT_DELETIONS = 57407
View Source
const RESTRICTED = 57440
View Source
const RETVAL = 57413
View Source
const RNG = 57467
View Source
const RPCEofCode = 1
View Source
const RPCErrCode = 2
View Source
const RPCFlag = -1000
View Source
const RPCInitialStackSize = 16
View Source
const RPCLast = 1095
View Source
const RPCPrivate = 57344
View Source
const RSH = 57480
View Source
const SAFEARRAY = 57446
View Source
const SHORT = 57352
View Source
const SIGNED = 57350
View Source
const SIZEOF = 57428
View Source
const SIZE_IS = 57370
View Source
const SMALL = 57353
View Source
const SOURCE = 57454
View Source
const STRICT_CONTEXT_HANDLE = 57425
View Source
const STRING = 57461
View Source
const STRING_LITERAL = 57463
View Source
const STRUCT = 57364
View Source
const SWITCH = 57394
View Source
const SWITCH_IS = 57371
View Source
const SWITCH_TYPE = 57397
View Source
const TERNARY = 57466
View Source
const TRANSMIT_AS = 57398
View Source
const TRUE = 57387
View Source
const TYPEDEF = 57401
View Source
const TYPE_STRICT_CONTEXT_HANDLE = 57426
View Source
const UMINUS = 57485
View Source
const UMUL = 57486
View Source
const UNEG = 57482
View Source
const UNION = 57393
View Source
const UNOT = 57483
View Source
const UNSIGNED = 57349
View Source
const UPLUS = 57481
View Source
const USAGE_CONTEXT_HANDLE = 57373
View Source
const USAGE_STRING = 57372
View Source
const UUID = 57402
View Source
const V1_ENUM = 57424
View Source
const VERSION = 57408
View Source
const VOID = 57358
View Source
const WCHAR_T = 57415
View Source
const WIRE_MARSHAL = 57452
View Source
const XOR = 57477

Variables

View Source
var (
	NameTok = map[string]int{}

	TokName = map[int]string{}/* 112 elements not displayed */

	SQBReservedTok = map[int]struct{}{
		ANNOTATION:                 {},
		APPOBJECT:                  {},
		BROADCAST:                  {},
		CALL_AS:                    {},
		CALLBACK:                   {},
		DEFAULT_VALUE:              {},
		DISABLE_CONSISTENCY_CHECK:  {},
		ENDPOINT:                   {},
		FIRST_IS:                   {},
		HANDLE:                     {},
		HELP_STRING:                {},
		HIDDEN:                     {},
		ID:                         {},
		IGNORE:                     {},
		IDEMPOTENT:                 {},
		IID_IS:                     {},
		IN:                         {},
		LAST_IS:                    {},
		LENGTH_IS:                  {},
		LOCAL:                      {},
		MAX_IS:                     {},
		MAYBE:                      {},
		MIN_IS:                     {},
		MS_UNION:                   {},
		OBJECT:                     {},
		ODL:                        {},
		OLEAUTOMATION:              {},
		OPTIONAL:                   {},
		OUT:                        {},
		POINTER_DEFAULT:            {},
		PROPGET:                    {},
		PROPPUT:                    {},
		PROPPUTREF:                 {},
		POINTER_PTR:                {},
		PUBLIC:                     {},
		RANGE:                      {},
		POINTER_REF:                {},
		RETVAL:                     {},
		SIZE_IS:                    {},
		SOURCE:                     {},
		STRICT_CONTEXT_HANDLE:      {},
		USAGE_STRING:               {},
		USAGE_CONTEXT_HANDLE:       {},
		FORMAT:                     {},
		FORMAT_UTF8:                {},
		FORMAT_NULL_TERMINATED:     {},
		FORMAT_MULTI_SIZE:          {},
		FORMAT_RUNE:                {},
		FORMAT_HEX:                 {},
		SWITCH_IS:                  {},
		SWITCH_TYPE:                {},
		TRANSMIT_AS:                {},
		TYPE_STRICT_CONTEXT_HANDLE: {},
		POINTER_UNIQUE:             {},
		UUID:                       {},
		VERSION:                    {},
		WIRE_MARSHAL:               {},
		PAD:                        {},
		GOEXT_LAYOUT:               {},
		SAFEARRAY:                  {},
	}

	ReservedTok = map[int]struct{}{
		SIZEOF:           {},
		PRAGMA_CPP_QUOTE: {},
		FLOAT:            {},
		DOUBLE:           {},
		HYPER:            {},
		UNSIGNED:         {},
		SIGNED:           {},
		LONG:             {},
		SHORT:            {},
		SMALL:            {},
		INT:              {},
		INT8:             {},
		INT16:            {},
		INT32:            {},
		INT64:            {},
		INT3264:          {},
		CHAR:             {},
		WCHAR_T:          {},
		BOOLEAN:          {},
		BYTE:             {},
		VOID:             {},
		HANDLE_T:         {},
		ERROR_STATUS_T:   {},
		ISO_LATIN_1:      {},
		ISO_MULTILINGUAL: {},
		ISO_UCS:          {},
		STRUCT:           {},
		CONST:            {},
		NULL:             {},
		TRUE:             {},
		FALSE:            {},
		ENUM:             {},
		PIPE:             {},
		UNION:            {},
		SWITCH:           {},
		CASE:             {},
		DEFAULT:          {},
		IMPORT:           {},
		TYPEDEF:          {},
		INTERFACE:        {},
		COCLASS:          {},
		DISPINTERFACE:    {},
	}
)
View Source
var (
	RPCDebug        = 0
	RPCErrorVerbose = false
)
View Source
var (
	// ErrEOF ...
	ErrEOF = errors.New("unexpected EOF")
)
View Source
var RPCAct = [...]int16{}/* 1095 elements not displayed */
View Source
var RPCChk = [...]int16{}/* 614 elements not displayed */
View Source
var RPCDef = [...]int16{}/* 614 elements not displayed */
View Source
var RPCErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var RPCExca = [...]int16{
	-1, 0,
	1, 1,
	-2, 46,
	-1, 1,
	1, -1,
	-2, 0,
	-1, 2,
	1, 2,
	-2, 46,
	-1, 247,
	152, 115,
	-2, 46,
	-1, 263,
	114, 36,
	115, 36,
	152, 36,
	-2, 46,
	-1, 270,
	150, 198,
	155, 198,
	-2, 339,
	-1, 416,
	114, 37,
	115, 37,
	152, 37,
	-2, 46,
	-1, 417,
	114, 35,
	115, 35,
	152, 35,
	-2, 46,
	-1, 464,
	2, 339,
	123, 339,
	157, 339,
	-2, 198,
	-1, 553,
	158, 249,
	-2, 246,
	-1, 557,
	158, 249,
	-2, 246,
	-1, 581,
	158, 250,
	-2, 242,
}
View Source
var RPCPact = [...]int16{}/* 614 elements not displayed */
View Source
var RPCPgo = [...]int16{}/* 144 elements not displayed */
View Source
var RPCR1 = [...]uint8{}/* 361 elements not displayed */
View Source
var RPCR2 = [...]int8{}/* 361 elements not displayed */
View Source
var RPCStatenames = [...]string{}
View Source
var RPCTok1 = [...]uint8{}/* 127 elements not displayed */
View Source
var RPCTok2 = [...]uint8{}/* 143 elements not displayed */
View Source
var RPCTok3 = [...]int8{
	0,
}
View Source
var RPCToknames = [...]string{}/* 163 elements not displayed */

Functions

func CanEval

func CanEval(es ...Expr) bool

CanEval function returns true if expression can be evaluated immediately.

func FileStore

func FileStore(p string, f *File)

func FindFile

func FindFile(f string) (string, string, error)

func FindPath

func FindPath() []string

func Hash

func Hash(s string) int

func IsBoolOp

func IsBoolOp(op int) bool

func IsIntegerType added in v1.0.3

func IsIntegerType(kind Kind) bool

func MD5

func MD5(text string) string

func PrimitiveTypeSize

func PrimitiveTypeSize(kind Kind) int

func RPCErrorMessage

func RPCErrorMessage(state, lookAhead int) string

func RPCParse

func RPCParse(RPClex RPCLexer) int

func RPCStatname

func RPCStatname(s int) string

func RPCTokname

func RPCTokname(c int) string

func RPClex1

func RPClex1(lex RPCLexer, lval *RPCSymType) (char, token int)

func SetSwitchType

func SetSwitchType(fields []*Field)

func TagName

func TagName(kind Kind, tag string) string

TagName function transforms the kind and tag to a tagged name.

func TypeSize

func TypeSize(s TypeStore, t *Type) int

TypeSize ...

Types

type Args

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

func (*Args) LookupExpr

func (a *Args) LookupExpr(string) (Expr, bool)

type Array

type Array struct {
	// The array bounds.
	Bound ArrayBound
}

Array structure represents the array type.

func (Array) IsFixed

func (a Array) IsFixed() bool

IsFixed function returns true if array is of fixed size.

func (*Array) MarshalJSON

func (a *Array) MarshalJSON() ([]byte, error)

func (Array) Size

func (a Array) Size() int64

Size function returns the fixed size array.

type ArrayBound

type ArrayBound struct {
	// The upper and lower bounds for the array declaration.
	Upper, Lower int64
}

ArrayBound structure represents the array bounds declaration.

type Charset

type Charset int

Charset is a predefined character set, as per DCE/RPC [C706].

const (
	CharsetNone Charset = iota
	CharsetISO_Latin_1
	CharsetISO_Multilingual
	CharsetISO_UCS
)

func (Charset) String

func (c Charset) String() (ret string)

type ComClass

type ComClass struct {
	Name       string          `json:"name,omitempty"`
	Attrs      *ComClassAttr   `json:"attrs,omitempty"`
	Interfaces []*ComInterface `json:"interfaces,omitempty"`
}

ComClass structure ...

type ComClassAttr

type ComClassAttr struct {
	*InterfaceAttr
	AppObject bool
}

ComClassAttr ...

func (*ComClassAttr) MarshalJSON

func (a *ComClassAttr) MarshalJSON() ([]byte, error)

func (*ComClassAttr) String

func (a *ComClassAttr) String() string

type ComInterface

type ComInterface struct {
	Name  string            `json:"name,omitempty"`
	Type  *Type             `json:"type,omitempty"`
	Attrs *ComInterfaceAttr `json:"attrs,omitempty"`
}

ComInterface structure ...

type ComInterfaceAttr

type ComInterfaceAttr struct {
	Default bool
	Source  bool
}

ComInterfaceAttr ...

func (*ComInterfaceAttr) MarshalJSON

func (a *ComInterfaceAttr) MarshalJSON() ([]byte, error)

func (*ComInterfaceAttr) String

func (a *ComInterfaceAttr) String() string

type Const

type Const struct {
	// The constant name.
	Name string `json:"name"`
	// The constant type.
	Type Kind `json:"kind"`
	// The constant value.
	Value Expr `json:"value"`
}

Const structure represents the constant declaration. This declaration is obtained either via `const` expression or via #define statement.

type Dim

type Dim struct {
	MinIs            Expr
	MaxIs            Expr
	SizeIs           Expr
	FirstIs          Expr
	LastIs           Expr
	LengthIs         Expr
	IsString         bool
	IsNullTerminated bool
	IsMultiSize      bool
	IsUTF8           bool
	Dimension        int
	NoSizeLimit      bool
}

func (Dim) Empty

func (d Dim) Empty() bool

func (Dim) Size

func (d Dim) Size() Size

func (Dim) String

func (d Dim) String() string

type Direction

type Direction struct {
	// Determines the operation/function parameter direction.
	In, Out bool
}

func (Direction) String

func (d Direction) String() string

type DispatchInterface

type DispatchInterface struct {
	// The dispatch interface name.
	Name string `json:"name"`
	// The dispatch interface attributes.
	Attrs *DispatchInterfaceAttr `json:"attr,omitempty"`
	// The dispatch interface body.
	Body DispatchInterfaceBody `json:"body,omitempty"`
}

DispatchInterface ...

type DispatchInterfaceAttr

type DispatchInterfaceAttr struct {
	*InterfaceAttr
}

DispatchInterfaceAttr ...

func (*DispatchInterfaceAttr) MarshalJSON

func (a *DispatchInterfaceAttr) MarshalJSON() ([]byte, error)

func (*DispatchInterfaceAttr) String

func (a *DispatchInterfaceAttr) String() string

type DispatchInterfaceBody

type DispatchInterfaceBody struct {
	// The dispatch interface properties.
	Properties []*Field `json:"properties,omitempty"`
	// The dispatch interfaces methods.
	Methods []*Operation `json:"methods,omitempty"`
}

DispatchInterfaceBody ...

type Element

type Element struct {
	// The enumeration element label.
	Value string `json:"value"`
	// The enumeration element identifier.
	ID int `json:"id"`
}

Element structure represents the enumeration element.

type Enum

type Enum struct {
	// Requires 32-bit uint type.
	Is32 bool
	// The enumeration elements.
	Elems []*Element `json:"elements"`
}

Enum structure represents the enumeration type.

type Export

type Export struct {
	// The positional number.
	Position int
	// The export symbol name.
	Name string
	// The constant value, or nil.
	Const *Const `json:"const,omitempty"`
	// The type value, or nil.
	Type *Type `json:"type,omitempty"`
	// The list of aliases of the tagged declarator.
	Aliases []string `json:"aliases,omitempty"`
}

Export structure represents the exported symbol.

type Expr

type Expr struct {
	// Value is an expression value.
	Value interface{}

	// Expr is a parsed expression tree.
	Expr *ExprTree
	// contains filtered or unexported fields
}

Expr is an expression.

func NewExpr

func NewExpr(op int, valuer func() (interface{}, bool), es ...Expr) (Expr, bool)

NewExpr function builds a new expression with expression tree.

func NewIdent

func NewIdent(v string) Expr

NewIdent function creates a new expression variable.

func NewValue

func NewValue(v interface{}) Expr

NewValue function creates a new expression node value.

func (Expr) Add

func (lval Expr) Add(rval Expr) (Expr, bool)

Add function performs addition of two integers.

func (Expr) And

func (lval Expr) And(rval Expr) (Expr, bool)

Or function performs the bitwise and operation on expression.

func (Expr) BigInt

func (e Expr) BigInt() (*big.Int, bool)

BigInt function returns the *big.Int representation of the value.

func (Expr) Bool

func (e Expr) Bool() bool

Bool function returns boolean representation of the expression.

func (Expr) CanEval

func (e Expr) CanEval() bool

func (Expr) Char

func (e Expr) Char() (rune, bool)

Char function returns the char representation of the expression.

func (Expr) Coerce

func (e Expr) Coerce(kind Kind) (Expr, error)

Coerce function tries to cast the given Expr to the kind provided and returns the same expression.

func (Expr) Div

func (lval Expr) Div(rval Expr) (Expr, bool)

Div function performs integer division (`lval` / `rval`). Note that `rval` must evaluate to the non-zero value.

func (Expr) Empty

func (val Expr) Empty() bool

Empty function returns 'true' when expression is empty.

func (Expr) Eq

func (lval Expr) Eq(rval Expr) (Expr, bool)

Eq function compares two values and returns `true` if lval is equal rval.

func (Expr) Eval

func (e Expr) Eval(l ExprStore) (Expr, bool)

Eval function evaluates the expression and returns evaluated expression.

func (Expr) Expression

func (e Expr) Expression(opts ...any) string

func (Expr) Ge

func (lval Expr) Ge(rval Expr) (Expr, bool)

Ge function compares two integers and returns `true` if lval >= rval.

func (Expr) Gt

func (lval Expr) Gt(rval Expr) (Expr, bool)

Gt function compares two integers and returns `true` if lval > rval.

func (Expr) Ident

func (val Expr) Ident() Expr

func (Expr) Int64

func (e Expr) Int64() (int64, bool)

Int function returns int64 representation of the expression.

func (Expr) IsIdent

func (e Expr) IsIdent() bool

func (Expr) IsZero

func (e Expr) IsZero() bool

func (Expr) Le

func (lval Expr) Le(rval Expr) (Expr, bool)

Le function compares two integers and returns `true` if lval <= rval.

func (Expr) LogicalAnd

func (lval Expr) LogicalAnd(rval Expr) (Expr, bool)

LogicalAnd function performs logical-and (&&) operation on expression.

func (Expr) LogicalOr

func (lval Expr) LogicalOr(rval Expr) (Expr, bool)

LogicalOr function performs logical-or (||) operation on expression.

func (Expr) Lsh

func (lval Expr) Lsh(rval Expr) (Expr, bool)

Lsh function performs the left-shift of the `lval` on `rval` amount. `rval` must be a valid unsigned integer.

func (Expr) Lt

func (lval Expr) Lt(rval Expr) (Expr, bool)

Lt function compares two integers and returns `true` if lval < rval.

func (Expr) MarshalJSON

func (e Expr) MarshalJSON() ([]byte, error)

func (Expr) Mul

func (lval Expr) Mul(rval Expr) (Expr, bool)

Mul function performs integer multiplication (`lval` * `rval`).

func (Expr) Ne

func (lval Expr) Ne(rval Expr) (Expr, bool)

Ne function compares two values and returns `true` if `lval` is not equal `rval`.

func (Expr) Neg

func (val Expr) Neg() (Expr, bool)

Neg function performs integer bitwise negation.

func (Expr) Negative

func (val Expr) Negative() (Expr, bool)

Negative function returns -integer.

func (Expr) Not

func (val Expr) Not() (Expr, bool)

Not function performs boolean negation.

func (Expr) Null

func (e Expr) Null() bool

Null function returns the null representation of the expression.

func (Expr) Or

func (lval Expr) Or(rval Expr) (Expr, bool)

Or function performs the bitwise or operation on expression.

func (Expr) Positive

func (val Expr) Positive() (Expr, bool)

Positive function returns integer.

func (Expr) Ptr

func (val Expr) Ptr() (Expr, bool)

Ptr function doesn't do anything special, needed to resemble correct tree with pointer value.

func (Expr) Rem

func (lval Expr) Rem(rval Expr) (Expr, bool)

Rem function performs C-like integer reminder operation (`lval` % `rval`). Note that `rval` must evaluate to the non-zero value.

func (Expr) Resolve

func (e Expr) Resolve(in Expr) (Expr, bool)

func (Expr) ResolveTo

func (val Expr) ResolveTo(to Expr) (Expr, bool)

func (Expr) Rsh

func (lval Expr) Rsh(rval Expr) (Expr, bool)

Rsh function performs the right-shift of the `lval` on `rval` amount. `rval` must be a valid unsigned integer.

func (Expr) Str

func (e Expr) Str() (string, bool)

String function returns string representation of the expression.

func (Expr) String

func (e Expr) String() string

func (Expr) Sub

func (lval Expr) Sub(rval Expr) (Expr, bool)

Sub function performs integer substraction (`lval` - `rval`).

func (Expr) Ter

func (cond Expr) Ter(lval, rval Expr) (Expr, bool)

Ternary function performs ternary (?:) operation on expression.

func (Expr) Uint64

func (e Expr) Uint64() (uint64, bool)

Uint function returns uint64 representation of the expression.

func (Expr) Xor

func (lval Expr) Xor(rval Expr) (Expr, bool)

Or function performs the bitwise exclusive-or (xor) operation on expression.

type ExprStore

type ExprStore interface {
	LookupExpr(string) (Expr, bool)
}

func NewArgs

func NewArgs(args ...interface{}) ExprStore

type ExprTree

type ExprTree struct {
	// Op is an expression tree operation.
	Op int
	// Value is a terminal value of the expression tree.
	Value interface{}
	// Cond, Lval, Rval are the expression tree children.
	// (Cond used for ternary only, Lval is a value for unary operation).
	Cond, Lval, Rval *ExprTree
}

ExprTree is an expression tree build when expression cannot be evaluated immediately.

func (*ExprTree) Eval

func (e *ExprTree) Eval(l ExprStore) (Expr, bool)

Eval function evaluates the expression tree with Store for lookup.

func (*ExprTree) Expression

func (t *ExprTree) Expression(opts ...any) string

func (*ExprTree) Resolve

func (e *ExprTree) Resolve(expr *ExprTree) (Expr, *ExprTree, bool)

func (*ExprTree) ResolveTo

func (e *ExprTree) ResolveTo(to Expr) (Expr, bool)

func (*ExprTree) String

func (t *ExprTree) String() string

type Exprs

type Exprs []Expr

Exprs is a list of expressions.

type Field

type Field struct {
	// The field position.
	Position int `json:"-"`
	// The field name.
	Name string `json:"name,omitempty"`
	// The field attributes.
	Attrs *FieldAttr `json:"attrs,omitempty"`
	// The field type.
	Type *Type `json:"type,omitempty"`
	// Default Value.
	DefaultValue Expr `json:"default_value,omitempty"`
}

Field structure represents the union/structure field declaration.

func (*Field) IsHandle

func (f *Field) IsHandle() bool

func (*Field) IsString

func (f *Field) IsString() bool

func (*Field) Scopes

func (f *Field) Scopes() []*Scope

type FieldAttr

type FieldAttr struct {
	FirstIs     []Expr
	LastIs      []Expr
	LengthIs    []Expr
	MinIs       []Expr
	MaxIs       []Expr
	SizeIs      []Expr
	Usage       Usage
	Format      Format
	SwitchIs    Expr
	Ignore      bool
	Pointer     PointerType
	Range       *Range
	SwitchType  *Type
	Safearray   *Type
	Layout      []*Field
	NoSizeLimit bool
	IsLayout    bool
}

FieldAttr ...

func (*FieldAttr) Dim

func (f *FieldAttr) Dim() []Dim

func (*FieldAttr) MarshalJSON

func (a *FieldAttr) MarshalJSON() ([]byte, error)

func (*FieldAttr) SizeAttr

func (f *FieldAttr) SizeAttr() *SizeAttr

func (*FieldAttr) String

func (a *FieldAttr) String() string

func (*FieldAttr) TypeAttr

func (f *FieldAttr) TypeAttr() *TypeAttr

type File

type File struct {
	FullPath string `json:"full_path"`
	// Path is a path to file.
	Path string `json:"path"`
	// GoPkg ...
	GoPkg string `json:"go_pkg"`
	// The list of imports.
	Imports []string `json:"imports,omitempty"`
	// Export is a map of exported symbols on file level.
	Export map[string]*Export `json:"exports,omitempty"`
	// Interfaces is a list of interfaces.
	Interfaces []*Interface `json:"interfaces,omitempty"`
	// ComClasses is a list of COM classes.
	ComClasses []*ComClass `json:"com_classes,omitempty"`
	// DispatchInterfaces ...
	DispatchInterfaces []*DispatchInterface `json:"dispatch_interfaces,omitempty"`
	// Libraries ...
	Libraries []*Library `json:"libraries,omitempty"`
	// contains filtered or unexported fields
}

File structure represents the parsed file contents.

func FileLoad

func FileLoad(p string) (*File, bool)

FileLoad ...

func Files

func Files() []*File

func NewFile

func NewFile(p, pkg string) *File

func Parse

func Parse(s string) (*File, error)

Parse ...

func (*File) Exports

func (f *File) Exports() []*Export

Exports function returns the exported symbols as a sorted array.

func (*File) GoPackage

func (f *File) GoPackage(tn string) (string, bool)

GoPackage function returns the go package name for the type.

func (*File) IsLocal

func (f *File) IsLocal(tn string) bool

func (*File) Load

func (f *File) Load() (*File, error)

Load function loads the file content.

func (*File) LookupAlias

func (f *File) LookupAlias(n string) []string

func (*File) LookupType

func (f *File) LookupType(n string) (*Type, bool)

LookupType function lookups the type inside the file.

type Format

type Format struct {
	NullTerminated bool
	UTF8           bool
	MultiSize      bool
	Rune           bool
	Hex            bool
}

func (Format) String

func (f Format) String() string

type Func

type Func struct {
	// The function parameters list.
	Params []*Param
}

Func structure represents the function type.

type Interface

type Interface struct {
	// The interface name.
	Name string `json:"name,omitempty"`
	// The interface base.
	BaseName string `json:"base_name,omitempty"`
	// The interface base.
	Base *Interface `json:"-"`
	// The interface attributes.
	Attrs *InterfaceAttr `json:"attrs,omitempty"`
	// Body is an interface body (including export symbols and function calls).
	Body InterfaceBody `json:"body,omitempty"`
}

Interface structure represents the interface definition.

func (*Interface) Exports

func (iff *Interface) Exports() []*Export

Exports function ...

func (*Interface) IsObject

func (iff *Interface) IsObject() bool

type InterfaceAttr

type InterfaceAttr struct {
	UUID           *uuid.UUID
	Version        *Version
	Endpoints      []string
	Exceptions     []string
	Local          bool
	PointerDefault PointerType
	MSUnion        bool
	Object         bool
	HelpString     string
	Dual           bool
	Hidden         bool
	Nonextensible  bool
	ODL            bool
	OLEAutomation  bool
}

InterfaceAttr ...

func (*InterfaceAttr) MarshalJSON

func (a *InterfaceAttr) MarshalJSON() ([]byte, error)

func (*InterfaceAttr) String

func (a *InterfaceAttr) String() string

type InterfaceBody

type InterfaceBody struct {
	// Imports is a list of file paths for the imported symbols.
	Imports []string `json:"imports"`
	// Export is a map for the exported symbols.
	Export map[string]*Export `json:"exports"`
	// Operations is a list of the interface operations.
	Operations []*Operation `json:"operations"`
}

InterfaceBody structure represents the interface body definitions.

func (InterfaceBody) Exports

func (b InterfaceBody) Exports() []*Export

Exports function ...

type Kind

type Kind int

Kind is the type selector.

const (
	TypeInvalid Kind = iota
	TypeInt8
	TypeUint8
	TypeInt16
	TypeUint16
	TypeInt32
	TypeInt64
	TypeUint32
	TypeUint64
	TypeInt32_64  // 32 for NDR, 64 for NDR64 representation.
	TypeUint32_64 // 32 for NDR, 64 for NDR64 representation.
	TypeFloat32
	TypeFloat64
	TypeCharset
	TypeUChar
	TypeChar
	TypeWChar
	TypeEnum
	TypeString
	TypeStruct
	TypeUnion
	TypeCUnion
	TypeFunc
	TypeArray
	TypePointer
	TypePipe
	TypeBoolean
	TypeVoid // constant declaration only.
	TypeHandle
	TypeError
	TypeInterface
	TypeDispInterface
	TypeRef       // type reference, resolved via lookup.
	TypeAttribute //
	TypeTag
)

func (Kind) MarshalJSON

func (t Kind) MarshalJSON() ([]byte, error)

func (Kind) Signed

func (k Kind) Signed() bool

func (Kind) String

func (t Kind) String() (ret string)

type Lexer

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

Lexer ...

func NewLexer

func NewLexer(s string) *Lexer

NewLexer ...

func (*Lexer) Error

func (l *Lexer) Error(s string)

Error ...

func (*Lexer) Errorf

func (l *Lexer) Errorf(frmt string, args ...interface{})

Errorf ...

func (*Lexer) Lex

func (l *Lexer) Lex(lval *RPCSymType) int

Lex ...

func (*Lexer) Push

func (l *Lexer) Push(s string)

Push function pushes the string on current position to re-enter the line.

func (*Lexer) TokName

func (l *Lexer) TokName(c int) (string, bool)

TokName function maps the token to the token name.

type Library

type Library struct {
	Name  string       `json:"name"`
	Attrs *LibraryAttr `json:"attr,omitempty"`
	Body  LibraryBody  `json:"body,omitempty"`
}

type LibraryAttr

type LibraryAttr struct {
	*InterfaceAttr
}

LibraryAttr ...

func (*LibraryAttr) MarshalJSON

func (a *LibraryAttr) MarshalJSON() ([]byte, error)

func (*LibraryAttr) String

func (a *LibraryAttr) String() string

type LibraryBody

type LibraryBody struct {
	ComClasses []*ComClass `json:"com_classes,omitempty"`
}

LibraryBody ...

type Operation

type Operation struct {
	// The operation name.
	Name string `json:"name"`
	// The operation number.
	OpNum int `json:"op_num"`
	// The operation return type.
	Type *Type `json:"type"`
	// The operation parameter list.
	Params []*Param `json:"params"`
	// The operation attributes.
	Attrs *OperationAttr `json:"attrs,omitempty"`
}

Operation structure represents the RPC call.

func (*Operation) GetName

func (o *Operation) GetName() string

type OperationAttr

type OperationAttr struct {
	Idempotent       bool
	Broadcast        bool
	Maybe            bool
	ReflectDeletions bool
	Usage            Usage
	Format           Format
	Pointer          PointerType
	Callback         bool
	PropGet          bool
	PropPut          bool
	PropPutRef       bool
	ID               Expr
	Restricted       bool
	CallAs           string
}

OperationAttr ...

func (*OperationAttr) MarshalJSON

func (a *OperationAttr) MarshalJSON() ([]byte, error)

func (*OperationAttr) String

func (a *OperationAttr) String() string

type Param

type Param struct {
	// The parameter name.
	Name string `json:"name,omitempty"`
	// The parameter type.
	Type *Type `json:"type,omitempty"`
	// The parameter attributes.
	Attrs *ParamAttr `json:"attrs,omitempty"`
}

Param structure represents the operation/function parameter declaration.

func (*Param) IsHandle

func (p *Param) IsHandle() bool

type ParamAttr

type ParamAttr struct {
	*FieldAttr
	Direction               Direction
	DisableConsistencyCheck bool
	IIDIs                   Expr
	Retval                  bool
	DefaultValue            Expr
	Optional                bool
	Annotation              string
}

ParamAttr ...

func (*ParamAttr) MarshalJSON

func (a *ParamAttr) MarshalJSON() ([]byte, error)

func (*ParamAttr) String

func (a *ParamAttr) String() string

type Parser

type Parser struct {
	// The lexer entity.
	*Lexer
	// contains filtered or unexported fields
}

func NewParser

func NewParser(s string) *Parser

NewParser function returns the parser entity.

func (*Parser) Defer

func (p *Parser) Defer(ref *Type)

Defer function defers the type resolution until the parse end.

func (*Parser) LookupConst

func (p *Parser) LookupConst(n string) (*Const, bool)

LookupConst ...

func (*Parser) LookupExpr

func (p *Parser) LookupExpr(n string) (Expr, bool)

LookupExpr ...

func (*Parser) LookupType

func (p *Parser) LookupType(n string) (*Type, bool)

LookupType ...

func (*Parser) Store

func (p *Parser) Store(n string, val Expr, typ ...Kind)

Store ...

type PointerType

type PointerType int
const (
	PointerTypeNone PointerType = iota
	PointerTypeRef
	PointerTypePtr
	PointerTypeUnique
	PointerTypeRefWeak
)

func (PointerType) String

func (p PointerType) String() string

type RPCLexer

type RPCLexer interface {
	Lex(lval *RPCSymType) int
	Error(s string)
}

type RPCParser

type RPCParser interface {
	Parse(RPCLexer) int
	Lookahead() int
}

func RPCNewParser

func RPCNewParser() RPCParser

type RPCParserImpl

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

func (*RPCParserImpl) Lookahead

func (p *RPCParserImpl) Lookahead() int

func (*RPCParserImpl) Parse

func (RPCrcvr *RPCParserImpl) Parse(RPClex RPCLexer) int

type RPCSymType

type RPCSymType struct {
	File                  File
	Interface             Interface
	InterfaceBody         InterfaceBody
	Version               *Version
	Export                []*Export
	Type                  *Type
	Kind                  Kind
	Const                 *Const
	Operation             *Operation
	Operations            []*Operation
	Param                 *Param
	Params                []*Param
	Fields                []*Field
	Field                 *Field
	Declarators           []*pDeclarator
	Declarator            *pDeclarator
	ArrayBound            ArrayBound
	Int64                 int64
	UnionSwitch           *UnionSwitch
	UnionCases            []*UnionCase
	UnionCase             *UnionCase
	Expr                  Expr
	Exprs                 Exprs
	Ident                 string
	Char                  rune
	String                string
	Int                   *big.Int
	UUID                  *uuid.UUID
	Range                 *Range
	Strings               []string
	Token                 int
	Typedef               *pTypedef
	Attr                  pAttr
	AttrType              pAttrType
	TagID                 pTagID
	TagIDs                []pTagID
	ComClass              ComClass
	Library               Library
	ComInterfaces         []*ComInterface
	ComInterface          *ComInterface
	DispatchInterface     DispatchInterface
	DispatchInterfaceBody DispatchInterfaceBody
	// contains filtered or unexported fields
}

type Range

type Range struct {
	Min, Max int64
}

Range structure repsents the range attribute.

type Scope

type Scope struct {
	Attr  *TypeAttr
	Types []*ScopedType
}

type ScopedType

type ScopedType struct {
	*Type   `json:"type"`
	Dim     Dim `json:"dim"`
	Pointer int `json:"pointer"`
}

type Size

type Size struct {
	MinIs  Expr
	MaxIs  Expr
	SizeIs Expr
}

func (Size) Empty

func (d Size) Empty() bool

func (Size) Is

func (d Size) Is() (expr Expr)

type SizeAttr

type SizeAttr struct {
	MinIs  []Expr
	MaxIs  []Expr
	SizeIs []Expr
}

type Struct

type Struct struct {
	// The structure fields.
	Fields []*Field `json:"fields,omitempty"`
}

Struct structure represents the structure type.

func (*Struct) LastField

func (s *Struct) LastField() *Field

LastField function

type Type

type Type struct {
	Kind      Kind       `json:"kind,omitempty"`
	Charset   Charset    `json:"charset,omitempty"`
	Name      string     `json:"name,omitempty"`
	Tag       string     `json:"tag,omitempty"`
	Func      *Func      `json:"func,omitempty"`
	Array     *Array     `json:"array,omitempty"`
	Enum      *Enum      `json:"enum,omitempty"`
	Struct    *Struct    `json:"struct,omitempty"`
	Union     *Union     `json:"union,omitempty"`
	Interface *Interface `json:"-"`
	Attrs     *TypeAttr  `json:"attrs,omitempty"`
	Alias     string     `json:"alias,omitempty"`
	Elem      *Type      `json:"elem,omitempty"`
}

Type structure represents the type declaration.

func InterfaceToExport

func InterfaceToExport(iff *Interface) *Type

func LookupType

func LookupType(n string) *Type

func (*Type) Append

func (t *Type) Append(tt *Type) *Type

func (*Type) AppendAfterPointer

func (t *Type) AppendAfterPointer(tt *Type) *Type

func (*Type) Base

func (t *Type) Base() *Type

func (*Type) Is

func (t *Type) Is(kind Kind) bool

Is function returns true if type is of a given kind. Note, that synthetic type `TypeTag` is used to determine if type can be a tagged type.

func (*Type) IsPrimitiveType

func (t *Type) IsPrimitiveType() bool

func (*Type) MarshalJSON

func (a *Type) MarshalJSON() ([]byte, error)

func (*Type) Scopes

func (t *Type) Scopes() []*Scope

Scopes function returns the list types grouped by scope. Within a single scope pointer defaults are applied.

func (*Type) TypeName

func (t *Type) TypeName() string

TypeName function returns the name of the type.

type TypeAttr

type TypeAttr struct {
	TransmitAs              *Type
	Handle                  bool
	SwitchType              *Type
	Usage                   Usage
	Format                  Format
	Pointer                 PointerType
	V1Enum                  bool
	Range                   *Range
	DisableConsistencyCheck bool
	WireMarshal             string
	Public                  bool
	Alias                   string
	// names, pointers to keep track of lost data merged.
	Names    []string
	Pointers []PointerType
	Parent   string
	Pad      uint64
	IsLayout bool
}

TypeAttr ...

func (*TypeAttr) EnumType

func (t *TypeAttr) EnumType() Kind

func (*TypeAttr) MarshalJSON

func (a *TypeAttr) MarshalJSON() ([]byte, error)

func (*TypeAttr) Merge

func (t *TypeAttr) Merge(tt *TypeAttr) *TypeAttr

func (*TypeAttr) String

func (a *TypeAttr) String() string

type TypeStore

type TypeStore interface {
	// LookupType function must resolve the type reference
	// and return type or 'false'
	LookupType(n string) (*Type, bool)
}

TypeStore interface represents the type storage to resolve kind of TypeRef.

type Union

type Union struct {
	// The list of union switch/case statements.
	Body   []*UnionCase `json:"body,omitempty"`
	Switch *UnionSwitch `json:"switch,omitempty"`
}

Union structure represents the union type.

func (*Union) IsEncapsulated

func (u *Union) IsEncapsulated() bool

type UnionCase

type UnionCase struct {
	Position  int           `json:"position,omitempty"`
	Labels    []interface{} `json:"labels,omitempty"`
	Arms      []*Field      `json:"arms,omitempty"`
	IsDefault bool          `json:"is_default,omitempty"`
}

UnionCase structure is a union case statement, if Label is nil, this is default case.

func (*UnionCase) String

func (u *UnionCase) String() string

type UnionSwitch

type UnionSwitch struct {
	Name string `json:"name"`
	Type *Type  `json:"type,omitempty"`
}

UnionSwitch structure represents the union switch (switch_is declaration).

type Usage

type Usage struct {
	ContextHandle bool
	IsString      bool
}

Usage structure represents the field, parameter usage attribute.

func (Usage) String

func (u Usage) String() string

type Version

type Version struct {
	Minor, Major uint16
}

Version structure represents the interface version structure.

func (*Version) String

func (v *Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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