Documentation ¶
Index ¶
- Constants
- Variables
- func CanonCapType(capTypeSeq []string) string
- func CanonGoType(goTypeSeq []string) string
- func CapnpCompilePath(fname string) (generatedGoFile []byte, comboOut []byte, err error)
- func Cp(originPath, destinationPath string) (err error)
- func DirExists(name string) bool
- func ExtraSpaces(fieldNum int) string
- func ExtractCapnToGoCode(src string, goName string) string
- func ExtractFromString(src string) ([]byte, error)
- func ExtractGoToCapnCode(src string, goName string) string
- func ExtractString2String(src string) string
- func ExtractStructs(fname string, src interface{}, x *Extractor) ([]byte, error)
- func FileExists(name string) bool
- func GetTypeAsString(ty ast.Expr, sofar string, goTypeSeq []string) (string, string, []string)
- func GoType2CapnType(gotypeName string) string
- func IsDirPath(dir string) bool
- func IsDoubleList(f *Field) bool
- func IsIntrinsicGoType(goFieldTypeName string) bool
- func IsSlice(tnas string) bool
- func LowercaseCapnpFieldName(name string) string
- func SetSpaces(spaces *string, Max int, Len int)
- func TSPrintf(format string, a ...interface{})
- func UppercaseFirstLetter(name string) string
- func VPrintf(format string, a ...interface{})
- type AlphaHelper
- type AlphaHelperSlice
- type ByFinalOrder
- type ByGoName
- type ByOrderOfAppearance
- type Extractor
- func (x *Extractor) AssembleCapnpFile(in []byte) *bytes.Buffer
- func (x *Extractor) CapnTypeToGoType(capTypeSeq []string) (goTypeSeq []string, displayGoCapGoType string)
- func (x *Extractor) CapnpCompileFragment(in []byte) ([]byte, error)
- func (x *Extractor) Cleanup()
- func (x *Extractor) CopySourceFilesAddCapidTag() error
- func (x *Extractor) ElemStarCapToGo(addStar string, f *Field) string
- func (x *Extractor) EndStruct()
- func (x *Extractor) ExtractStructsFromOneFile(src interface{}, fname string) ([]byte, error)
- func (x *Extractor) GenCapidTag(f *Field) string
- func (x *Extractor) GenCapnpHeader() *bytes.Buffer
- func (x *Extractor) GenerateComment(c string)
- func (x *Extractor) GenerateEmbedded(typeName string)
- func (x *Extractor) GenerateListHelpers(f *Field, capListTypeSeq []string, goTypeSeq []string)
- func (x *Extractor) GenerateStructField(goFieldName string, goFieldTypePrefix string, goFieldTypeName string, ...) error
- func (x *Extractor) GenerateTranslators()
- func (x *Extractor) GoTypeToCapnpType(curField *Field, goTypeSeq []string) (capTypeSeq []string, capnTypeDisplayed string)
- func (x *Extractor) ListToSliceSetLHS_RHS(baseIsIntrinsic bool, capName string, goBaseType string) string
- func (x *Extractor) NewEnum(typeName string)
- func (x *Extractor) NoteTypedef(goNewTypeName string, goTargetTypeName string)
- func (x *Extractor) PrettyPrint(fileSet *token.FileSet, astfile *ast.File, fn string) error
- func (x *Extractor) SetUnionStruct()
- func (x *Extractor) SettersToCapn(goName string) string
- func (x *Extractor) SettersToGo(goName string) string
- func (x *Extractor) SettersToGoListHelper(buf io.Writer, myStruct *Struct, f *Field)
- func (x *Extractor) SliceToListSetRHS(baseIsIntrinsic bool, goName string, c2g string) string
- func (x *Extractor) StartStruct(goName string) error
- func (x *Extractor) ToCapnCodeFor(goStructName string) []byte
- func (x *Extractor) ToGoCodeFor(goName string) []byte
- func (x *Extractor) WriteToSchema(w io.Writer) (n int64, err error)
- func (x *Extractor) WriteToTranslators(w io.Writer) (n int64, err error)
- type Field
- type SrcFile
- type Struct
- type TempDir
Constants ¶
View Source
const NotEmbedded = false
View Source
const NotList = false
View Source
const YesEmbedded = true
View Source
const YesIsList = true
Variables ¶
View Source
var Verbose bool
for debug output
Functions ¶
func CanonCapType ¶
func CanonGoType ¶
func CapnpCompilePath ¶
func Cp ¶
Cp implements a portable version of /bin/cp for use in golang code that wants to work on many platforms. If the destinationPath directory hierarchy does not exist, we will attempt to make it, like mkdir -p would.
func ExtraSpaces ¶
func ExtractCapnToGoCode ¶
func ExtractFromString ¶
func ExtractGoToCapnCode ¶
func ExtractString2String ¶
func ExtractStructs ¶
ExtractStructs pulls out the struct definitions from a golang source file.
src has to be string, []byte, or io.Reader, as in parser.ParseFile(). src can be nil if fname is provided. See http://golang.org/pkg/go/parser/#ParseFile
func FileExists ¶
func GetTypeAsString ¶
recursively extract the go type as a string
func GoType2CapnType ¶
func IsDoubleList ¶
func IsIntrinsicGoType ¶
func LowercaseCapnpFieldName ¶
func UppercaseFirstLetter ¶
Types ¶
type AlphaHelper ¶
type AlphaHelperSlice ¶
type AlphaHelperSlice []AlphaHelper
func (AlphaHelperSlice) Len ¶
func (s AlphaHelperSlice) Len() int
func (AlphaHelperSlice) Less ¶
func (s AlphaHelperSlice) Less(i, j int) bool
func (AlphaHelperSlice) Swap ¶
func (s AlphaHelperSlice) Swap(i, j int)
type ByFinalOrder ¶
type ByFinalOrder []*Field
func (ByFinalOrder) Len ¶
func (s ByFinalOrder) Len() int
func (ByFinalOrder) Less ¶
func (s ByFinalOrder) Less(i, j int) bool
func (ByFinalOrder) Swap ¶
func (s ByFinalOrder) Swap(i, j int)
type ByOrderOfAppearance ¶
type ByOrderOfAppearance []*Field
func (ByOrderOfAppearance) Len ¶
func (s ByOrderOfAppearance) Len() int
func (ByOrderOfAppearance) Less ¶
func (s ByOrderOfAppearance) Less(i, j int) bool
func (ByOrderOfAppearance) Swap ¶
func (s ByOrderOfAppearance) Swap(i, j int)
type Extractor ¶
type Extractor struct { PkgName string FieldPrefix string FieldSuffix string ExtractPrivate bool ToGoCode map[string][]byte ToCapnCode map[string][]byte SaveCode map[string][]byte LoadCode map[string][]byte CapnUnion map[string][]byte // key is CanonGoType(goTypeSeq) SliceToListCode map[string][]byte ListToSliceCode map[string][]byte CompileDir *TempDir OutDir string Overwrite bool // fields for testing capid tagging PubABC int `capid:"1"` PubYXZ int `capid:"0"` PubDEF int // contains filtered or unexported fields }
func NewExtractor ¶
func NewExtractor() *Extractor
func (*Extractor) AssembleCapnpFile ¶
func (*Extractor) CapnTypeToGoType ¶
func (*Extractor) CapnpCompileFragment ¶
func (*Extractor) CopySourceFilesAddCapidTag ¶
func (*Extractor) ElemStarCapToGo ¶
func (*Extractor) ExtractStructsFromOneFile ¶
func (*Extractor) GenCapidTag ¶
func (*Extractor) GenCapnpHeader ¶
func (*Extractor) GenerateComment ¶
func (*Extractor) GenerateEmbedded ¶
func (*Extractor) GenerateListHelpers ¶
func (*Extractor) GenerateStructField ¶
func (*Extractor) GenerateTranslators ¶
func (x *Extractor) GenerateTranslators()
func (*Extractor) GoTypeToCapnpType ¶
func (*Extractor) ListToSliceSetLHS_RHS ¶
func (*Extractor) NoteTypedef ¶
func (*Extractor) PrettyPrint ¶
PrettyPrint out the go source file we read in.
func (*Extractor) SetUnionStruct ¶
func (x *Extractor) SetUnionStruct()
func (*Extractor) SettersToCapn ¶
func (*Extractor) SettersToGo ¶
func (*Extractor) SettersToGoListHelper ¶
func (*Extractor) SliceToListSetRHS ¶
func (*Extractor) StartStruct ¶
func (*Extractor) ToCapnCodeFor ¶
func (*Extractor) ToGoCodeFor ¶
func (*Extractor) WriteToSchema ¶
type TempDir ¶
func NewTempDir ¶
func NewTempDir() *TempDir
Click to show internal directories.
Click to hide internal directories.