cgen

package
v0.0.0-...-67b6ef9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "bsharp__"

Variables

This section is empty.

Functions

func Indent

func Indent(code string, cnf CodeConfig) string

func JoinCode

func JoinCode(vals ...string) string

Types

type CGen

type CGen struct {
	Config CodeConfig
	// contains filtered or unexported fields
}

func NewCGen

func NewCGen(i *ir.IR) *CGen

func (*CGen) AddNode

func (cg *CGen) AddNode(node ir.Node) (*Code, error)

func (*CGen) Build

func (c *CGen) Build() (string, error)

func (*CGen) CType

func (c *CGen) CType(typ types.Type, fn ...bool) string

func (*CGen) FreeCode

func (c *CGen) FreeCode(varName string, typ types.Type) string

func (*CGen) GetTmp

func (c *CGen) GetTmp(name string) string

func (*CGen) GrabCode

func (c *CGen) GrabCode(varName string, typ types.Type) string

func (*CGen) ZeroValue

func (c *CGen) ZeroValue(t types.Type) string

type Code

type Code struct {
	Pre   string
	Value string
}

type CodeConfig

type CodeConfig struct {
	Tab         string
	BoundsCheck bool
}

func DefaultCodeConfig

func DefaultCodeConfig() CodeConfig

Jump to

Keyboard shortcuts

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