func main() { var ( entryDirBasePath = ugo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "entry") entryMakeEmptyDoc = func() interface{} { return &AtomEntryDoc{} } feedDirBasePath = ugo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "feed") feedMakeEmptyDoc = func() interface{} { return &AtomFeedDoc{} } ) tests.TestViaRemarshal(entryDirBasePath, entryMakeEmptyDoc) tests.TestViaRemarshal(feedDirBasePath, feedMakeEmptyDoc) }
func main() { var ( dirBasePath = ugo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-kml") makeEmptyDoc = func() interface{} { return &KmlDoc{} } ) tests.TestViaRemarshal(dirBasePath, makeEmptyDoc) }
func copyToRepos() (err error) { var ( dirName, dirPath, srcDirPath string fileInfos []os.FileInfo ) for _, repoBaseDirPath := range []string{"D:\\github", "C:\\gitrepos"} { if fileInfos, _ = ioutil.ReadDir(repoBaseDirPath); len(fileInfos) > 0 { for _, fi := range fileInfos { if dirName = fi.Name(); fi.IsDir() { for _, githubName := range subDirs { if srcDirPath = ugo.GopathSrcGithub(githubName, dirName); ufs.DirExists(srcDirPath) { break } } if dirPath = filepath.Join(repoBaseDirPath, dirName); ufs.DirExists(srcDirPath) { wg.Add(1) go func(dirPath, srcDirPath string) { defer wg.Done() var err error if err = ufs.ClearDirectory(dirPath, ".git"); err == nil { err = ufs.CopyAll(srcDirPath, dirPath, &dirTmpSkipper) } if err != nil { log.Printf("Error @ %s:\t%+v", dirPath, err) } }(dirPath, srcDirPath) } } } } } return }
func main() { flag.Parse() dirPath := *flag.String("dir", ugo.GopathSrcGithub("metaleap", "go-leansite", "helloworld"), "Root directory path containing the static, contents, templates etc. folders.") leansite.Init(dirPath) log.Println("Listening any moment now...") log.Fatal(leansite.ListenAndServe(":8008")) }
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?") } if len(*flagGenExts) > 0 { if *flagGenExts == "*" { cfg.genExtsAll = true } else { cfg.genExts = strings.Split(*flagGenExts, " ") } } if err = specDoc.LoadFile(*flagSpecFile, nil); err != nil { panic(err) } cfg.outDirPath = filepath.Join(*flagOutDir, "core") if err = ufs.EnsureDirExists(cfg.outDirPath); err != nil { panic(err) } if cfg.genExtsAll { xmlWalkExts() } xmlWalkTypes() xmlWalkEnums() xmlWalkFuncs() if err = newGlPack().makeAllFiles(); err != nil { panic(err) } }
func main() { var ( col14DirBasePath = ugo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-collada", "1.4.1") col14MakeEmptyDoc = func() interface{} { return &Col14Doc{} } col15DirBasePath = ugo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-collada", "1.5") col15MakeEmptyDoc = func() interface{} { return &Col15Doc{} } ) if false { tests.OnDocLoaded = func(doc interface{}) { if c14, ok := doc.(*Col14Doc); ok { log.Print("ISC14") for _, camLib := range c14.CamerasLibraries { log.Print("CAMLIB") for _, cam := range camLib.Cameras { log.Printf("CAM aspect: %#v\n", cam.Optics.TechniqueCommon.Perspective.AspectRatio) } } } } } tests.TestViaRemarshal(col14DirBasePath, col14MakeEmptyDoc) tests.TestViaRemarshal(col15DirBasePath, col15MakeEmptyDoc) }
func copyToDropbox() (err error) { const dbp = "Dropbox/_gd" for _, dropDirPath := range []string{filepath.Join("D:", dbp), filepath.Join(ugo.UserHomeDirPath(), dbp)} { if ufs.DirExists(dropDirPath) { if err = ufs.ClearDirectory(dropDirPath); err == nil { for _, githubName := range subDirs { wg.Add(1) go func(dropDirPath, githubName string) { defer wg.Done() dst := filepath.Join(dropDirPath, githubName) if err := ufs.CopyAll(ugo.GopathSrcGithub(githubName), dst, &dirTmpSkipper); err != nil { log.Printf("Error @ %s:\t%+v", dst, err) } }(dropDirPath, githubName) } } break } } return }
import ( "fmt" "log" "strings" "github.com/go-utils/ugo" "github.com/go-utils/uslice" "github.com/go-utils/ustr" "github.com/tmc/xsd" xsdt "github.com/metaleap/go-xsd/types" ) var ( PkgGen = &pkgGen{ BaseCodePath: ugo.GopathSrcGithub("metaleap", "go-xsd-pkg"), BasePath: "github.com/metaleap/go-xsd-pkg", ForceParseForDefaults: false, PluralizeSpecialPrefixes: []string{"Library", "Instance"}, AddWalkers: true, } typeRenderRepls = map[string]string{"*": "", "[": "", "]": "", "(list ": "", ")": ""} ) type pkgGen struct { BaseCodePath, BasePath string ForceParseForDefaults bool PluralizeSpecialPrefixes []string AddWalkers bool }
"io" "io/ioutil" "math" "runtime" "time" "github.com/go-utils/ufs" "github.com/go-utils/ugo" ) type writerMaker func(w io.Writer) io.WriteCloser type readerMaker func(r io.Reader) io.ReadCloser var ( blobs [][]byte dirPath = ugo.GopathSrcGithub("go3d", "go-ngine", "___old2013", "_examples", "-app-data", "_tmp", "tex") packStats = map[string][]float64{} unpackStats = map[string][]float64{} ) func testComp(name string, wm writerMaker, rm readerMaker) { var ( err error buf *bytes.Buffer blob []byte packed [][]byte packer io.WriteCloser unpacker io.ReadCloser now time.Time ) for _, blob = range blobs {
// Returns the base path of the "app dir" for our example apps, in this case: $GOPATH/src/github.com/go3d/go-ngine/_examples/-app-data func AppDirBasePath() string { return ugo.GopathSrcGithub("go3d", "go-ngine", "_examples", "-app-data") }
import ( "flag" "path/filepath" "strings" xmlx "github.com/go-forks/go-pkg-xmlx" "github.com/go-utils/ufs" "github.com/go-utils/ugo" ) const ( xmlns = "http://www.opengl.org/registry/" ) var ( flagOutDir = flag.String("outdir", ugo.GopathSrcGithub("go3d", "go-opengl"), "Full directory path where the ./core/ package folder will be generated.\n") flagGenExts = flag.String("exts", "EXT_texture_filter_anisotropic EXT_texture_compression_s3tc EXT_texture_sRGB", "What extensions to include, space-separated. At a minimum you'll want the 'ubiquitous extensions' EXT_texture_filter_anisotropic EXT_texture_compression_s3tc EXT_texture_sRGB. Use asterisk * to include all extensions in the specpath file (pkg won't compile as of yet though).\n") flagMinVer = flag.String("minver", "3.3", "Minimum GL version. Whatever was deprecated in that version or earlier will be skipped and not included in the generated binding. IF you specify a custom minver, you'll also need to specify a different requirefunc.\n") flagSpecFile = flag.String("specpath", ugo.GopathSrcGithub("go3d", "go-opengl", "cmd", "gen-opengl-bindings", "xmlspecs", "opengl.xml"), "Full path to the spec file.\n") flagProcAddr = flag.String("requirefunc", "BindSampler", "The name of a GL function (without gl prefix) that the binding's Init() method checks for to test initialization success. IF you specify a custom minver, you'll need a different func name here.\n") flagSupports = flag.Bool("supports", true, "Creates a Supports struct that allows runtime checking for individual function availability") 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