go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit d8c112fa926fb1cd80b2bdd9a53e6fcebe459e68
parent 208ad0e287b98eb3062d2350eb4ad07edca3f7ae
Author: lash <dev@holbrook.no>
Date:   Fri, 14 Apr 2023 09:59:37 +0100

Rename project to vise

Diffstat:
MREADME.md | 4++--
Masm/asm.go | 4++--
Masm/asm_test.go | 2+-
Masm/doc.go | 2+-
Masm/menu.go | 2+-
Masm/menu_test.go | 2+-
Ddev/asm/asm.go | 28----------------------------
Adev/asm/main.go | 28++++++++++++++++++++++++++++
Mdev/disasm/main.go | 2+-
Mdev/gendata/main.go | 2+-
Mdev/interactive/main.go | 2+-
Mengine/default.go | 6+++---
Mengine/engine.go | 10+++++-----
Mengine/engine_test.go | 8++++----
Mengine/loop_test.go | 6+++---
Mengine/persist.go | 4++--
Mengine/persist_test.go | 10++++------
Mgo.mod | 2+-
Mpersist/fs.go | 4++--
Mpersist/fs_test.go | 8++++----
Mpersist/persist.go | 4++--
Mrender/page.go | 4++--
Mrender/page_test.go | 2+-
Mrender/size_test.go | 6+++---
Mresource/state.go | 2+-
Mresource/state_test.go | 2+-
Mtestdata/testdata.go | 4++--
Mvm/doc.go | 2+-
Mvm/input.go | 4++--
Mvm/runner.go | 8++++----
Mvm/runner_test.go | 8++++----
31 files changed, 90 insertions(+), 92 deletions(-)

diff --git a/README.md b/README.md @@ -1,4 +1,4 @@ -# festive: A Constrained Size Output Virtual Machine +# vise: A Constrained Size Output Virtual Machine An attempt at defining a small VM to handle menu interaction for size-constrained clients and servers. @@ -142,7 +142,7 @@ Currently the following rules apply for encoding in version `0`: ## Reference implementation -This repository provides a `golang` reference implementation for the `festive` concept. +This repository provides a `golang` reference implementation for the `vise` concept. In this reference implementation some constraints apply diff --git a/asm/asm.go b/asm/asm.go @@ -13,11 +13,11 @@ import ( "github.com/alecthomas/participle/v2" "github.com/alecthomas/participle/v2/lexer" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) -// Asm assembles bytecode from the festive assembly mini-language. +// Asm assembles bytecode from the vise assembly mini-language. type Asm struct { Instructions []*Instruction `@@*` } diff --git a/asm/asm_test.go b/asm/asm_test.go @@ -7,7 +7,7 @@ import ( "log" "testing" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) diff --git a/asm/doc.go b/asm/doc.go @@ -1,2 +1,2 @@ -// Package asm parses and compiles festive assembly code to bytecode. +// Package asm parses and compiles vise assembly code to bytecode. package asm diff --git a/asm/menu.go b/asm/menu.go @@ -3,7 +3,7 @@ package asm import ( "fmt" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) // BatchCode defines quasi-opcodes that expand to mulitple individual vm instructions. diff --git a/asm/menu_test.go b/asm/menu_test.go @@ -3,7 +3,7 @@ package asm import ( "testing" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) diff --git a/dev/asm/asm.go b/dev/asm/asm.go @@ -1,28 +0,0 @@ -package main - -import ( - "fmt" - "io/ioutil" - "log" - "os" - - "git.defalsify.org/festive/asm" -) - -func main() { - if (len(os.Args) < 2) { - os.Exit(1) - } - fp := os.Args[1] - v, err := ioutil.ReadFile(fp) - if err != nil { - fmt.Fprintf(os.Stderr, "read error: %v", err) - os.Exit(1) - } - n, err := asm.Parse(string(v), os.Stdout) - if err != nil { - fmt.Fprintf(os.Stderr, "parse error: %v", err) - os.Exit(1) - } - log.Printf("parsed total %v bytes", n) -} diff --git a/dev/asm/main.go b/dev/asm/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" + "os" + + "git.defalsify.org/vise/asm" +) + +func main() { + if (len(os.Args) < 2) { + os.Exit(1) + } + fp := os.Args[1] + v, err := ioutil.ReadFile(fp) + if err != nil { + fmt.Fprintf(os.Stderr, "read error: %v", err) + os.Exit(1) + } + n, err := asm.Parse(string(v), os.Stdout) + if err != nil { + fmt.Fprintf(os.Stderr, "parse error: %v", err) + os.Exit(1) + } + log.Printf("parsed total %v bytes", n) +} diff --git a/dev/disasm/main.go b/dev/disasm/main.go @@ -5,7 +5,7 @@ import ( "os" "io/ioutil" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) func main() { diff --git a/dev/gendata/main.go b/dev/gendata/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "git.defalsify.org/festive/testdata" + "git.defalsify.org/vise/testdata" ) func main() { diff --git a/dev/interactive/main.go b/dev/interactive/main.go @@ -6,7 +6,7 @@ import ( "fmt" "os" - "git.defalsify.org/festive/engine" + "git.defalsify.org/vise/engine" ) func main() { diff --git a/engine/default.go b/engine/default.go @@ -3,9 +3,9 @@ package engine import ( "context" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" ) // NewDefaultEngine is a convenience function to instantiate a filesystem-backed engine with no output constraints. diff --git a/engine/engine.go b/engine/engine.go @@ -6,11 +6,11 @@ import ( "io" "log" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/render" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/render" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" + "git.defalsify.org/vise/vm" ) // Config globally defines behavior of all components driven by the engine. diff --git a/engine/engine_test.go b/engine/engine_test.go @@ -8,10 +8,10 @@ import ( "path" "testing" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" - "git.defalsify.org/festive/testdata" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" + "git.defalsify.org/vise/testdata" ) var ( diff --git a/engine/loop_test.go b/engine/loop_test.go @@ -8,9 +8,9 @@ import ( "strings" "testing" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" ) func TestLoopTop(t *testing.T) { diff --git a/engine/persist.go b/engine/persist.go @@ -4,8 +4,8 @@ import ( "context" "io" - "git.defalsify.org/festive/persist" - "git.defalsify.org/festive/resource" + "git.defalsify.org/vise/persist" + "git.defalsify.org/vise/resource" ) // RunPersisted performs a single vm execution from client input using a persisted state. diff --git a/engine/persist_test.go b/engine/persist_test.go @@ -1,16 +1,14 @@ package engine import ( -// "bytes" "context" -// "errors" "io/ioutil" "os" "testing" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/persist" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/persist" + "git.defalsify.org/vise/state" ) func TestPersist(t *testing.T) { @@ -22,7 +20,7 @@ func TestPersist(t *testing.T) { } rs := NewFsWrapper(dataDir, nil) - persistDir, err := ioutil.TempDir("", "festive_engine_persist") + persistDir, err := ioutil.TempDir("", "vise_engine_persist") if err != nil { t.Fatal(err) } diff --git a/go.mod b/go.mod @@ -1,4 +1,4 @@ -module git.defalsify.org/festive +module git.defalsify.org/vise go 1.20 diff --git a/persist/fs.go b/persist/fs.go @@ -7,8 +7,8 @@ import ( "path/filepath" "github.com/fxamacker/cbor/v2" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/state" ) // FsPersister is an implementation of Persister that saves state to the file system. diff --git a/persist/fs_test.go b/persist/fs_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/state" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/state" + "git.defalsify.org/vise/vm" ) func TestSerializeState(t *testing.T) { @@ -73,7 +73,7 @@ func TestSaveLoad(t *testing.T) { ca.Add("inky", "pinky", 13) ca.Add("blinky", "clyde", 42) - dir, err := ioutil.TempDir("", "festive_persist") + dir, err := ioutil.TempDir("", "vise_persist") if err != nil { t.Error(err) } diff --git a/persist/persist.go b/persist/persist.go @@ -1,8 +1,8 @@ package persist import ( - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/state" ) // Persister interface defines the methods needed for a component that can store the execution state to a storage location. diff --git a/render/page.go b/render/page.go @@ -7,8 +7,8 @@ import ( "strings" "text/template" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/resource" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/resource" ) // Page exectues output rendering into pages constrained by size. diff --git a/render/page_test.go b/render/page_test.go @@ -3,7 +3,7 @@ package render import ( "testing" - "git.defalsify.org/festive/cache" + "git.defalsify.org/vise/cache" ) diff --git a/render/size_test.go b/render/size_test.go @@ -5,9 +5,9 @@ import ( "fmt" "testing" - "git.defalsify.org/festive/state" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/cache" + "git.defalsify.org/vise/state" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/cache" ) type TestSizeResource struct { diff --git a/resource/state.go b/resource/state.go @@ -1,7 +1,7 @@ package resource import ( - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/state" ) type StateResource struct { diff --git a/resource/state_test.go b/resource/state_test.go @@ -3,7 +3,7 @@ package resource import ( "testing" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/state" ) func TestStateResourceInit(t *testing.T) { diff --git a/testdata/testdata.go b/testdata/testdata.go @@ -8,7 +8,7 @@ import ( testdataloader "github.com/peteole/testdata-loader" - "git.defalsify.org/festive/vm" + "git.defalsify.org/vise/vm" ) type genFunc func() error @@ -167,7 +167,7 @@ func generate() error { // // This directory can in turn be used as data source for the the resource.FsResource object. func Generate() (string, error) { - dir, err := ioutil.TempDir("", "festive_testdata_") + dir, err := ioutil.TempDir("", "vise_testdata_") if err != nil { return "", err } diff --git a/vm/doc.go b/vm/doc.go @@ -1,2 +1,2 @@ -// Package vm handles the line-by-line execution of festive bytecode. +// Package vm handles the line-by-line execution of vise bytecode. package vm diff --git a/vm/input.go b/vm/input.go @@ -5,8 +5,8 @@ import ( "fmt" "regexp" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/state" ) var ( diff --git a/vm/runner.go b/vm/runner.go @@ -5,10 +5,10 @@ import ( "fmt" "log" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/render" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/render" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" ) // Vm holds sub-components mutated by the vm execution. diff --git a/vm/runner_test.go b/vm/runner_test.go @@ -7,10 +7,10 @@ import ( "log" "testing" - "git.defalsify.org/festive/cache" - "git.defalsify.org/festive/render" - "git.defalsify.org/festive/resource" - "git.defalsify.org/festive/state" + "git.defalsify.org/vise/cache" + "git.defalsify.org/vise/render" + "git.defalsify.org/vise/resource" + "git.defalsify.org/vise/state" ) var dynVal = "three"