aboutsummaryrefslogtreecommitdiff
path: root/cmd/ps/main.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-09-18 19:17:50 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-09-18 19:17:50 +0200
commit3ff749c98c4593ff35b2f82de222db9f97954f29 (patch)
treebcf452f4c58f9e65e3c1d4b8cb0034b798c1a2b7 /cmd/ps/main.go
parentdab8960e11bcbd102469881f3e1f9a75abadb896 (diff)
Move to cmd
Diffstat (limited to 'cmd/ps/main.go')
-rw-r--r--cmd/ps/main.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd/ps/main.go b/cmd/ps/main.go
new file mode 100644
index 0000000..478e52c
--- /dev/null
+++ b/cmd/ps/main.go
@@ -0,0 +1,34 @@
+package main
+
+import (
+ "io/ioutil"
+ "log"
+ "os"
+ "strings"
+
+ "dim13.org/robo/gc"
+ "github.com/llgcode/ps"
+)
+
+var postscriptContent string
+
+func main() {
+ src, err := os.OpenFile("tiger.ps", 0, 0)
+ if err != nil {
+ log.Println("can't find postscript file.")
+ return
+ }
+ defer src.Close()
+ bytes, err := ioutil.ReadAll(src)
+ postscriptContent = string(bytes)
+ if err != nil {
+ panic(err)
+ }
+
+ GC := gc.NewGraphicContext()
+
+ interpreter := ps.NewInterpreter(GC)
+ reader := strings.NewReader(postscriptContent)
+ interpreter.Execute(reader)
+
+}