c

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CExprGenerator added in v0.4.0

type CExprGenerator struct {
	*gen.GenExprDispatcher
	GenType          func(definition.Type) (string, error)
	ValueStr         string
	GenState         *CGeneratorState         // optional
	LiteralGenerator gen.LiteralGeneratorImpl // optional
}

func NewCExprGenerator added in v0.4.0

func NewCExprGenerator(genType func(definition.Type) (string, error), valueStr string, genState *CGeneratorState) *CExprGenerator

func (CExprGenerator) GenerateBinopExpr added in v0.4.0

func (g CExprGenerator) GenerateBinopExpr(expr *definition.BinopExpr) (string, error)

func (CExprGenerator) GenerateCastExpr added in v0.4.0

func (g CExprGenerator) GenerateCastExpr(expr *definition.CastExpr) (string, error)

func (CExprGenerator) GenerateConstantExpr added in v0.4.0

func (g CExprGenerator) GenerateConstantExpr(expr *definition.ConstantExpr) (string, error)

func (CExprGenerator) GenerateExpr added in v0.4.0

func (g CExprGenerator) GenerateExpr(expr definition.Expr) (string, error)

func (CExprGenerator) GenerateRawExpr added in v0.4.0

func (g CExprGenerator) GenerateRawExpr(expr *definition.RawExpr) (string, error)

func (CExprGenerator) GenerateTenaryExpr added in v0.4.0

func (g CExprGenerator) GenerateTenaryExpr(expr *definition.TenaryExpr) (string, error)

func (CExprGenerator) GenerateUnopExpr added in v0.4.0

func (g CExprGenerator) GenerateUnopExpr(expr *definition.UnopExpr) (string, error)

func (CExprGenerator) GenerateValueExpr added in v0.4.0

func (g CExprGenerator) GenerateValueExpr(expr *definition.ValueExpr) (string, error)

type CGenerator

type CGenerator struct {
	*gen.GenDispatcher
	GenCtx   *gen.GenCtx
	GenTypes *util.OrderedMap[string, *GeneratedType]
	GenStack *util.OrderedMap[string, any]
	GenState *CGeneratorState
	Warning  definition.TopLevelWarning
}

func NewCGenerator

func NewCGenerator() *CGenerator

func (*CGenerator) Generate

func (g *CGenerator) Generate(ctx *gen.GenCtx) (retErr error, retWarnings error)

func (CGenerator) GenerateArray added in v0.4.0

func (g CGenerator) GenerateArray(array *definition.Array) (string, error)

func (CGenerator) GenerateArrayDefaultValue added in v0.4.0

func (g CGenerator) GenerateArrayDefaultValue(array *definition.Array) (string, error)

func (CGenerator) GenerateBasicType added in v0.4.0

func (g CGenerator) GenerateBasicType(type_ *definition.BasicType) (string, error)

func (CGenerator) GenerateBasicTypeDefaultValue added in v0.4.0

func (g CGenerator) GenerateBasicTypeDefaultValue(type_ *definition.BasicType) (string, error)

func (CGenerator) GenerateBytes added in v0.4.0

func (g CGenerator) GenerateBytes(bytes *definition.Bytes) (string, error)

func (CGenerator) GenerateBytesDefaultValue added in v0.4.0

func (g CGenerator) GenerateBytesDefaultValue(bytes *definition.Bytes) (string, error)

func (CGenerator) GenerateConstantField added in v0.4.0

func (g CGenerator) GenerateConstantField(field *definition.ConstantField) (string, error)

func (CGenerator) GenerateCustomGetter added in v0.4.0

func (g CGenerator) GenerateCustomGetter(method *definition.GetMethod) (string, error)

func (CGenerator) GenerateCustomGetterDecl added in v0.4.0

func (g CGenerator) GenerateCustomGetterDecl(method *definition.GetMethod) (string, error)

func (CGenerator) GenerateCustomSetter added in v0.4.0

func (g CGenerator) GenerateCustomSetter(method *definition.SetMethod) (string, error)

func (CGenerator) GenerateCustomSetterDecl added in v0.4.0

func (g CGenerator) GenerateCustomSetterDecl(method *definition.SetMethod) (string, error)

func (CGenerator) GenerateDecoder added in v0.4.0

func (g CGenerator) GenerateDecoder(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateDecoderDecl added in v0.4.0

func (g CGenerator) GenerateDecoderDecl(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateDefaultGetter added in v0.4.0

func (g CGenerator) GenerateDefaultGetter(method *definition.GetMethod) (string, error)

func (CGenerator) GenerateDefaultGetterDecl added in v0.4.0

func (g CGenerator) GenerateDefaultGetterDecl(method *definition.GetMethod) (string, error)

func (CGenerator) GenerateDefaultSetter added in v0.4.0

func (g CGenerator) GenerateDefaultSetter(method *definition.SetMethod) (string, error)

func (CGenerator) GenerateDefaultSetterDecl added in v0.4.0

func (g CGenerator) GenerateDefaultSetterDecl(method *definition.SetMethod) (string, error)

func (CGenerator) GenerateEmbeddedField added in v0.4.0

func (g CGenerator) GenerateEmbeddedField(field *definition.EmbeddedField) (string, error)

func (CGenerator) GenerateEncoder added in v0.4.0

func (g CGenerator) GenerateEncoder(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateEncoderDecl added in v0.4.0

func (g CGenerator) GenerateEncoderDecl(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateEnum added in v0.4.0

func (g CGenerator) GenerateEnum(enumDef *definition.Enum) (string, error)

func (CGenerator) GenerateEnumDefaultValue added in v0.4.0

func (g CGenerator) GenerateEnumDefaultValue(enumDef *definition.Enum) (string, error)

func (CGenerator) GenerateExpr added in v0.4.0

func (g CGenerator) GenerateExpr(expr definition.Expr, valueStr string) (string, error)

func (CGenerator) GenerateField added in v0.4.0

func (g CGenerator) GenerateField(field definition.Field) (string, error)

func (CGenerator) GenerateMethod added in v0.4.0

func (g CGenerator) GenerateMethod(method definition.Method) (string, error)

func (CGenerator) GenerateMethodDecl added in v0.4.0

func (g CGenerator) GenerateMethodDecl(method definition.Method) (string, error)

func (CGenerator) GenerateNormalField added in v0.4.0

func (g CGenerator) GenerateNormalField(field *definition.NormalField) (string, error)

func (CGenerator) GenerateRawGetter added in v0.4.0

func (g CGenerator) GenerateRawGetter(field definition.Field) (string, error)

func (CGenerator) GenerateRawGetterDecl added in v0.4.0

func (g CGenerator) GenerateRawGetterDecl(field definition.Field) (string, error)

func (CGenerator) GenerateRawSetter added in v0.4.0

func (g CGenerator) GenerateRawSetter(field definition.Field) (string, error)

func (CGenerator) GenerateRawSetterDecl added in v0.4.0

func (g CGenerator) GenerateRawSetterDecl(field definition.Field) (string, error)

func (CGenerator) GenerateString added in v0.4.0

func (g CGenerator) GenerateString(string_ *definition.String) (string, error)

func (CGenerator) GenerateStringDefaultValue added in v0.4.0

func (g CGenerator) GenerateStringDefaultValue(string_ *definition.String) (string, error)

func (CGenerator) GenerateStruct added in v0.4.0

func (g CGenerator) GenerateStruct(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateStructDefaultValue added in v0.4.0

func (g CGenerator) GenerateStructDefaultValue(structDef *definition.Struct) (string, error)

func (CGenerator) GenerateType added in v0.4.0

func (g CGenerator) GenerateType(type_ definition.Type) (string, error)

func (CGenerator) GenerateTypeDefaultValue added in v0.4.0

func (g CGenerator) GenerateTypeDefaultValue(type_ definition.Type) (string, error)

func (CGenerator) GenerateUnit added in v0.4.0

func (g CGenerator) GenerateUnit(unit *definition.CompilationUnit) error

func (CGenerator) GenerateVoidField added in v0.4.0

func (g CGenerator) GenerateVoidField(field *definition.VoidField) (string, error)

type CGeneratorState added in v1.0.0

type CGeneratorState struct {
	UseMathH     bool
	UseStringH   bool
	UseStdLibH   bool
	UseBytesType bool
}

func NewCGeneratorState added in v1.0.0

func NewCGeneratorState() *CGeneratorState

type CLiteralGenerator added in v0.4.0

type CLiteralGenerator struct {
	*gen.GenLiteralDispatcher
}

func NewCLiteralGenerator added in v0.4.0

func NewCLiteralGenerator() *CLiteralGenerator

func (CLiteralGenerator) GenerateBoolLiteral added in v0.4.0

func (g CLiteralGenerator) GenerateBoolLiteral(literal *definition.BoolLiteral) (string, error)

func (CLiteralGenerator) GenerateFloatLiteral added in v0.4.0

func (g CLiteralGenerator) GenerateFloatLiteral(literal *definition.FloatLiteral) (string, error)

func (CLiteralGenerator) GenerateIntLiteral added in v0.4.0

func (g CLiteralGenerator) GenerateIntLiteral(literal *definition.IntLiteral) (string, error)

func (CLiteralGenerator) GenerateLiteral added in v0.4.0

func (g CLiteralGenerator) GenerateLiteral(literal definition.Literal) (string, error)

func (CLiteralGenerator) GenerateStringLiteral added in v0.4.0

func (g CLiteralGenerator) GenerateStringLiteral(literal *definition.StringLiteral) (string, error)

type GeneratedType

type GeneratedType struct {
	GeneratedConst    string
	GeneratedDef      string
	GeneratedFuncDecl string
	GeneratedFuncDef  string
}

Jump to

Keyboard shortcuts

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