Add initialize entry state in compile script

This commit is contained in:
lash 2023-04-16 08:25:44 +01:00
parent 0ab6868eca
commit a4ec4dd60e
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
10 changed files with 24 additions and 6 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
examples/**/*.bin
examples/**/*.txt

View File

@ -3,3 +3,11 @@ for f in $(ls $1/*.vis); do
b=${b%.*}
go run ./dev/asm $1/$b.vis > $1/$b.bin
done
for f in $(ls $1/*.txt.orig); do
b=$(basename $f)
b=${b%.*}
#go run ./dev/asm $1/$b.vis > $1/$b.bin
echo $b
cp -v $f $1/$b
done

View File

@ -1,3 +0,0 @@
LOAD entry_email_save 0
RELOAD myemail
MOVE _

View File

@ -0,0 +1,3 @@
LOAD do_email_save 1
RELOAD myemail
MOVE _

View File

@ -1,2 +1,3 @@
LOAD do_name_save 1
RELOAD myname
MOVE _

View File

@ -29,6 +29,13 @@ func nameSave(sym string, input []byte, ctx context.Context) (resource.Result, e
return resource.Result{}, err
}
func emailSave(sym string, input []byte, ctx context.Context) (resource.Result, error) {
log.Printf("writing email to file")
fp := path.Join(scriptDir, "myemail.txt")
err := ioutil.WriteFile(fp, input, 0600)
return resource.Result{}, err
}
func main() {
var dir string
var root string
@ -42,7 +49,8 @@ func main() {
st := state.NewState(0)
rs := resource.NewFsResource(scriptDir)
rs.AddLocalFunc("entry_name_save", nameSave)
rs.AddLocalFunc("do_name_save", nameSave)
rs.AddLocalFunc("do_email_save", emailSave)
ca := cache.NewCache()
cfg := engine.Config{
Root: "root",

View File

@ -1 +0,0 @@
not set

View File

@ -0,0 +1 @@
(not set)

View File

@ -1 +0,0 @@
not set

View File

@ -0,0 +1 @@
(not set)