Add initialize entry state in compile script
This commit is contained in:
parent
0ab6868eca
commit
a4ec4dd60e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
examples/**/*.bin
|
||||
examples/**/*.txt
|
||||
|
@ -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
|
||||
|
@ -1,3 +0,0 @@
|
||||
LOAD entry_email_save 0
|
||||
RELOAD myemail
|
||||
MOVE _
|
3
examples/profile/entry_email_save.vis
Normal file
3
examples/profile/entry_email_save.vis
Normal file
@ -0,0 +1,3 @@
|
||||
LOAD do_email_save 1
|
||||
RELOAD myemail
|
||||
MOVE _
|
@ -1,2 +1,3 @@
|
||||
LOAD do_name_save 1
|
||||
RELOAD myname
|
||||
MOVE _
|
||||
|
@ -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",
|
||||
|
@ -1 +0,0 @@
|
||||
not set
|
1
examples/profile/myemail.txt.orig
Normal file
1
examples/profile/myemail.txt.orig
Normal file
@ -0,0 +1 @@
|
||||
(not set)
|
@ -1 +0,0 @@
|
||||
not set
|
1
examples/profile/myname.txt.orig
Normal file
1
examples/profile/myname.txt.orig
Normal file
@ -0,0 +1 @@
|
||||
(not set)
|
Loading…
Reference in New Issue
Block a user