Permalink
Browse files

Go gettable package.

  • Loading branch information...
1 parent 7f793d8 commit ea3f6d41ee26d10a3192f65fb2c6fda35e610b1f @neelance neelance committed Oct 16, 2013
View
@@ -1,5 +1,2 @@
-/bin
-/pkg
-/src/code.google.com
-/src/playground/files.go
/node-syscall/build
+/node_modules
File renamed without changes.
View
@@ -1,125 +0,0 @@
-<!doctype html>
-<html ng-app="playground">
- <head>
- <title>GopherJS Playground</title>
- <style>
- html {
- height: 100%;
- }
- body {
- color: #000;
- height: 100%;
- margin: 0;
- padding: 0;
- width: 100%;
- }
- a {
- color: #009;
- }
- #wrap {
- background: #ffd;
- bottom: 25%;
- left: 0;
- margin: 0;
- padding: 5px;
- position: absolute;
- right: 0;
- top: 50px;
- }
- #code, #output, pre, .lines {
- font-family: Menlo,Courier\ New,monospace;
- font-size: 11pt;
- }
- #code {
- background: inherit;
- border: none;
- float: right;
- height: 100%;
- margin: 0;
- outline: none;
- padding: 0;
- resize: none;
- width: 100%;
- wrap: off;
- }
- #output {
- bottom: 0;
- left: 0;
- padding: 8px;
- position: absolute;
- right: 0;
- top: 75%;
- }
- #output .system,#output .loading {
- color: #999;
- }
- #output .err {
- color: #900;
- }
- #output pre {
- margin: 0;
- }
- #banner {
- height: 50px;
- left: 0;
- position: absolute;
- right: 0;
- top: 0;
- }
- #head {
- float: left;
- font-family: Georgia,serif;
- font-size: 30px;
- padding: 8px;
- }
- #controls {
- float: left;
- padding: 10px;
- }
- input[type="button"] {
- background: #eee;
- border: 1px solid #ccc;
- color: #000;
- font-size: 20px;
- height: 30px;
- }
- input[type="button"]:hover {
- background: #666;
- color: #fff;
- }
- .lines {
- float: left;
- overflow: hidden;
- text-align: right;
- }
- .lines div {
- color: #d3d3d3;
- padding-right: 5px;
- }
- .lineerror {
- background: #fdd;
- color: red;
- }
- .exit {
- color: #d3d3d3;
- }
- </style>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js"></script>
- <script src="bin/playground.js"></script>
- </head>
- <body ng-controller="PlaygroundCtrl">
- <div id="banner">
- <div id="head" itemprop="name">GopherJS Playground</div>
- <div id="controls">
- <input type="button" value="Run" ng-click="run()">
- <input type="button" value="Format" ng-click="format()">
- </div>
- </div>
- <div id="wrap">
- <textarea ng-model="code" id="code" autocorrect="off" autocomplete="off" autocapitalize="off" spellcheck="false"></textarea>
- </div>
- <div id="output">
- <div ng-repeat="line in output" class="{{line.Type}}">{{line.Content}}</div>
- </div>
-</body>
-</html>
@@ -1,79 +0,0 @@
-package angularjs
-
-func NewModule(name string, requires []string, configFn func()) *Module { return nil }
-
-const js_NewModule = `
- requires = requires ? Go$sliceToArray(requires) : [];
- return new Module(angular.module(name, requires, configFn));
-`
-
-type Module struct {
- native interface{}
- SCE *SCE
-}
-
-func (m *Module) NewController(name string, constructor func(scope *Scope)) {}
-
-const js_Module_NewController = `
- this.native.controller(name, function($scope, $sce) {
- constructor(new Scope($scope, new SCE($sce)));
- });
-`
-
-func (m *Module) NewFilter(name string, fn func(text string, arguments []string) string) {}
-
-const js_Module_NewFilter = `
- this.native.filter(name, function() {
- return function(text) {
- return fn(text, new Go$Slice(Array.prototype.slice.call(arguments, 1)));
- };
- });
-`
-
-type Scope struct {
- native interface{}
-}
-
-func (s *Scope) GetString(key string) string { return "" }
-
-const js_Scope_GetString = `
- return Go$internalizeString(String(this.native[key]));
-`
-
-func (s *Scope) GetInt(key string) int { return 0 }
-
-const js_Scope_GetInt = `
- return parseInt(this.native[key]);
-`
-
-func (s *Scope) GetFloat(key string) float64 { return 0 }
-
-const js_Scope_GetFloat = `
- return parseFloat(this.native[key]);
-`
-
-func (s *Scope) GetSlice(key string) []interface{} { return nil }
-
-const js_Scope_GetSlice = `
- return new Go$Slice(this.native[key]);
-`
-
-func (s *Scope) Set(key string, value interface{}) {}
-
-const js_Scope_Set = `
- switch (value.constructor) {
- case Go$String:
- this.native[key] = Go$externalizeString(value.v);
- break;
- case Go$Slice:
- this.native[key] = Go$sliceToArray(value);
- break;
- default:
- this.native[key] = value.v !== undefined ? value.v : value;
- break;
- }
-`
-
-type SCE struct {
- native interface{}
-}
@@ -1,56 +0,0 @@
-package main
-
-import (
- "fmt"
- "go/build"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
-)
-
-func main() {
- dirs := make(map[string][]os.FileInfo)
- files := make(map[string]string)
- readDir := func(dir string) {
- err := filepath.Walk(dir+"/pkg/darwin_amd64_js/", func(path string, info os.FileInfo, err error) error {
- if info.IsDir() {
- var err error
- dirs[path[len(dir):]], err = ioutil.ReadDir(path)
- return err
- }
-
- in, err := ioutil.ReadFile(path)
- if err != nil {
- return err
- }
- files[path[len(dir):]] = string(in)
- return nil
- })
- if err != nil {
- panic(err)
- }
- }
-
- readDir(build.Default.GOROOT)
- readDir(build.Default.GOPATH)
-
- out, err := os.Create("src/playground/files.go")
- if err != nil {
- panic(err)
- }
- out.WriteString("package main\n\nimport \"os\"\n\nvar dirs = map[string][]os.FileInfo {\n")
- for name, content := range dirs {
- entries := make([]string, len(content))
- for i, entry := range content {
- entries[i] = fmt.Sprintf(`&FileEntry{ name: "%s", mode: %d }`, entry.Name(), entry.Mode())
- }
- fmt.Fprintf(out, "\t\"%s\": []os.FileInfo{ %s },\n", name, strings.Join(entries, ", "))
- }
- out.WriteString("}\n\nvar files = map[string]string {\n")
- for name, content := range files {
- fmt.Fprintf(out, "\t\"%s\": %#v,\n", name, content)
- }
- out.WriteString("}\n")
- out.Close()
-}
Oops, something went wrong.

0 comments on commit ea3f6d4

Please sign in to comment.