Exemple #1
0
func main() {
	var (
		entryDirBasePath  = util.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "entry")
		entryMakeEmptyDoc = func() interface{} { return &AtomEntryDoc{} }
		feedDirBasePath   = util.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "feed")
		feedMakeEmptyDoc  = func() interface{} { return &AtomFeedDoc{} }
	)
	tests.TestViaRemarshal(entryDirBasePath, entryMakeEmptyDoc)
	tests.TestViaRemarshal(feedDirBasePath, feedMakeEmptyDoc)
}
Exemple #2
0
func main() {
	var (
		dirBasePath  = util.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-kml")
		makeEmptyDoc = func() interface{} { return &KmlDoc{} }
	)
	tests.TestViaRemarshal(dirBasePath, makeEmptyDoc)
}
Exemple #3
0
func main() {
	dir := flag.String("dir", filepath.Join(os.Getenv("GAESDK"), "goroot", "src", "pkg"), "")
	out := flag.String("out", ugo.GopathSrcGithub("metaleap", "go-misctools", "gae-imptest", "imp.txt"), "")
	flag.Parse()
	file, err := os.Create(*out)
	if err == nil {
		defer file.Close()
		m := map[string]bool{}
		if errs := uio.WalkAllFiles(*dir, func(fullPath string) bool {
			if filepath.Ext(fullPath) == ".go" {
				if relPath := filepath.Clean(filepath.Dir(fullPath)[len(*dir):]); !m[relPath] {
					m[relPath] = true
					ban := []string{"syscall", "unsafe", "net/http", "builtin", "go/format", "net/http/cookiejar", "net/http/fcgi"}
					if relPath = strings.Trim(filepath.ToSlash(relPath), "/"); !(usl.StrHas(ban, relPath) || strings.HasPrefix(relPath, "os/") || strings.HasPrefix(relPath, "runtime/") || strings.Contains(relPath, "/testdata") || strings.Contains(relPath, "appengine_internal")) {
						file.WriteString(fmt.Sprintf("\t_ %#v\n", relPath))
					}
				}
			}
			return true
		}); len(errs) > 0 {
			err = errs[0]
		}
	}
	if err != nil {
		panic(err)
	}
}
Exemple #4
0
func main() {
	var (
		col14DirBasePath  = util.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-collada", "1.4.1")
		col14MakeEmptyDoc = func() interface{} { return &Col14Doc{} }
		col15DirBasePath  = util.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)
}
Exemple #5
0
func main() {
	var (
		ver, kind string
		verList   []string
	)
	loadSpecXml()
	enumNodes, funcNodes := specDoc.SelectNodesRecursive("*", "enum"), specDoc.SelectNodesRecursive("*", "function")
	if errs := uio.NewDirWalker(true, nil, checkGoFile).Walk(util.GopathSrcGithub("go3d")); len(errs) > 0 {
		panic(errs[0])
	}
	for glName, _ := range glNames {
		kind, ver = "", ""
		for _, enode := range enumNodes {
			if enode.As("*", "name") == glName {
				ver, kind = enode.As("*", "version"), "enum"
			}
		}
		if len(ver) == 0 {
			for _, fnode := range funcNodes {
				if fnode.As("*", "name") == glName {
					ver, kind = fnode.As("*", "version"), "function"
				}
			}
		}
		if len(ver) > 0 {
			glNames[glName].glVersion, glNames[glName].nameKind = ver, kind
			if ver > "3.2" {
				if verList = glVersions[ver]; (verList == nil) || (len(verList) == 0) {
					verList = []string{}
				}
				if !inSlice(verList, glName) {
					verList = append(verList, glName)
				}
				glVersions[ver] = verList
			}
		}
	}
	for ver, verList = range glVersions {
		fmt.Printf("GL v%v used %vx:\n", ver, len(verList))
		for _, glName := range verList {
			if gni := glNames[glName]; gni != nil {
				fmt.Printf("\t%v %v:\n", gni.nameKind, glName)
				for _, filePath := range gni.filePaths {
					fmt.Printf("\t\t%v\n", filePath)
				}
			}
		}
	}
}
Exemple #6
0
package xsd

import (
	"fmt"
	"path"
	"strings"

	util "github.com/metaleap/go-util"
	ustr "github.com/metaleap/go-util/str"

	xsdt "github.com/metaleap/go-xsd/types"
)

var (
	PkgGen = &pkgGen{
		BaseCodePath:             util.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
}
Exemple #7
0
	"fmt"
	"path/filepath"
	"reflect"
	"strings"

	cdr "github.com/go3d/go-collada/dom/pkgreflect"
	ugo "github.com/metaleap/go-util"
	uio "github.com/metaleap/go-util/io"
)

type libMap struct {
	xnPlural, xnSingular, tn string
}

var (
	outDirPath = flag.String("dst", ugo.GopathSrcGithub("go3d", "go-collada", "imp-1.5"), "out dir path")
	libs       = []libMap{
		libMap{"animation_clips", "animation_clip", "AnimationClip"},
		libMap{"animations", "animation", "Animation"},
		libMap{"cameras", "camera", "Camera"},
		libMap{"controllers", "controller", "Controller"},
		libMap{"formulas", "formula", "Formula"},
		libMap{"geometries", "geometry", "Geometry"},
		libMap{"lights", "light", "Light"},
		libMap{"nodes", "node", "Node"},
		libMap{"visual_scenes", "visual_scene", "VisualScene"},
		libMap{"force_fields", "force_field", "PxForceField"},
		libMap{"physics_materials", "physics_material", "PxMaterial"},
		libMap{"physics_models", "physics_model", "PxModel"},
		libMap{"physics_scenes", "physics_scene", "PxScene"},
		libMap{"effects", "effect", "FxEffect"},
Exemple #8
0
func loadSpecXml() {
	specDoc = xmlx.New()
	if err := specDoc.LoadBytes(uio.ReadBinaryFile(util.GopathSrcGithub("go3d", "go-ngine", "_tools", "buildtools", "ng-gogl-imp-version-checker", "opengl.xml"), true), nil); err != nil {
		panic(err)
	}
}