func verifyDocs(origData, faksData []byte) (errs []error) { orig, faks := xmlx.New(), xmlx.New() err := orig.LoadBytes(origData, nil) if err == nil { if err = faks.LoadBytes(faksData, nil); err == nil { errs = verifyNode(orig.Root, faks.Root) } } return }
func convert(srcFile []byte, retDoc, retBytes bool) (doc *xmlx.Document, dstFile []byte, err error) { doc, surfaceImages, surfaceNodes, skipped = xmlx.New(), map[string]string{}, nil, false if err = doc.LoadBytes(srcFile, nil); err != nil { doc = nil return } srcDoc = doc processNode(doc.Root) srcDoc = nil if skipped { if retBytes { dstFile = srcFile } } else { for _, sn := range surfaceNodes { delNode(sn.Parent) } if retBytes { dstFile = doc.SaveBytes() } } if !retDoc { doc = nil } surfaceImages, surfaceNodes = nil, nil return }
flagTry = flag.Bool("try", true, "Generate function wrappers that check for GL errors and return Go errors") cfg struct { altTryFile struct { only bool funcs []string outPath, pkgName string } outDirPath string minVer *version genExts []string genExtsAll bool } err error specDoc = xmlx.New() allEnums = map[string]*glEnum{} allFuncs = map[string]*glFunc{} allTypes = map[string]string{} ) func main() { if false { cfg.altTryFile.only, cfg.altTryFile.pkgName = true, "glutil" cfg.altTryFile.funcs = []string{"AttachShader", "BufferData", "BufferSubData", "CreateProgram", "CreateShader", "GenBuffers", "GenerateMipmap", "GenTextures", "GenVertexArrays", "ShaderSource", "TexImage2D", "TexStorage2D", "TexSubImage2D"} cfg.altTryFile.outPath = ugo.GopathSrcGithub("go3d", "go-opengl", "util", "-gen-try.go") } flag.Parse() if cfg.minVer = parseVersion(*flagMinVer); cfg.minVer.major < 1 { panic("What kind of minver is that?")
func loadSpecXml() { specDoc = xmlx.New() if err := specDoc.LoadBytes(uio.ReadBinaryFile(util.GopathSrcGithub("go3d", "go-ngine", "___old2013", "_tools", "buildtools", "ng-gogl-imp-version-checker", "opengl.xml"), true), nil); err != nil { panic(err) } }