printing: commit some refactors (probably broken)

This commit is contained in:
Michael McLoughlin
2018-12-11 00:18:22 -08:00
parent 4dc909a81e
commit c882e52510
21 changed files with 398 additions and 222 deletions

View File

@@ -2,8 +2,6 @@ package build
import (
"flag"
"io"
"log"
"os"
"github.com/mmcloughlin/avo/gotypes"
@@ -23,26 +21,14 @@ func TEXT(name, signature string) {
func LABEL(name string) { ctx.Label(avo.Label(name)) }
var (
output = flag.String("output", "", "output filename (default stdout)")
)
var flags = NewFlags(flag.CommandLine)
func EOF() {
func Generate() {
if !flag.Parsed() {
flag.Parse()
}
var w io.Writer = os.Stdout
if *output != "" {
if f, err := os.Create(*output); err != nil {
log.Fatal(err)
} else {
defer f.Close()
w = f
}
}
os.Exit(ctx.Main(w, os.Stderr))
cfg := flags.Config()
os.Exit(Main(cfg, ctx))
}
func GP8v() reg.Virtual { return ctx.GP8v() }