diff --git a/.gitignore b/.gitignore index 34f58e46..1ac7fa6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .vscode pipefish +pipefish.exe .DS_ pytool rsc/hub/* diff --git a/go.mod b/go.mod index 7c0960b3..38583ab0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module pipefish -go 1.22.5 +go 1.23 require ( github.com/lmorg/readline v0.0.0-20210316231630-be4b7d79fc3a @@ -77,6 +77,7 @@ require ( github.com/snowflakedb/gosnowflake v1.10.1 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect + golang.org/dl v0.0.0-20240905150950-a427666708fc // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.19.0 // indirect golang.org/x/net v0.27.0 // indirect diff --git a/go.sum b/go.sum index 310bc12e..a5eaf0c5 100644 --- a/go.sum +++ b/go.sum @@ -206,6 +206,8 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b h1:7gd+rd8P3bqcn/96gOZa3F5dpJr/vEiDQYlNb/y2uNs= gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= +golang.org/dl v0.0.0-20240905150950-a427666708fc h1:8pL1jPaS3+RBsh1u9o2PSjZ3u/Sla0KqGU0LC/j/3bc= +golang.org/dl v0.0.0-20240905150950-a427666708fc/go.mod h1:fwQ+hlTD8I6TIzOGkQqxQNfE2xqR+y7SzGaDkksVFkw= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/rsc/hub/hub.hub b/hub/hub.hub similarity index 81% rename from rsc/hub/hub.hub rename to hub/hub.hub index c1b8cdd5..9e0f05ca 100644 --- a/rsc/hub/hub.hub +++ b/hub/hub.hub @@ -8,8 +8,7 @@ Database = struct(driver DatabaseDrivers, name, host string, port int, username, var -allServices = map("hub"::"rsc/hub/hub.hub", - .. "TRACK"::"examples/track.pf") +allServices = map("hub"::"hub/hub.hub") currentService string? = "TRACK" diff --git a/main.go b/main.go index dede38db..611f99ef 100644 --- a/main.go +++ b/main.go @@ -49,18 +49,15 @@ func main() { h := hub.New(os.Stdin, os.Stdout) appDir, _ := filepath.Abs(filepath.Dir(os.Args[0])) - f, err := os.Open(appDir + "/user/hubloc.dat") + f, err := os.Open(filepath.Join(appDir, filepath.FromSlash("/user/hub.dat"))) if err != nil { - h.WriteError(err.Error()) + println(err.Error()) panic("That's all folks!") } scanner := bufio.NewScanner(f) scanner.Scan() - scanner.Scan() - scanner.Scan() line := scanner.Text() - fname := line[8 : len(line)-1] - h.OpenHubFile(fname) + h.OpenHubFile(line) hub.StartHub(h, os.Stdin, os.Stdout) } diff --git a/source/report/errorfile.go b/source/report/errorfile.go index 2e2785af..13e5e1f8 100644 --- a/source/report/errorfile.go +++ b/source/report/errorfile.go @@ -1164,7 +1164,7 @@ var ErrorCreatorMap = map[string]ErrorCreator{ "init/source/a": { Message: func(tok *token.Token, args ...any) string { - return "unable to get source " + emph(args[0]) + return "unable to get source " + emph(args[0]) + " with error " + emph(args[1]) }, Explanation: func(errors Errors, pos int, tok *token.Token, args ...any) string { return "The initializer can't retrieve the source code for the given file. Check that it exists." diff --git a/source/service/vmmaker.go b/source/service/vmmaker.go index b28b2d85..2ba4dede 100644 --- a/source/service/vmmaker.go +++ b/source/service/vmmaker.go @@ -4,6 +4,7 @@ import ( "database/sql" "embed" "os" + "path/filepath" "testing" "pipefish/source/ast" @@ -58,7 +59,7 @@ func initializeFromFilepath(mc *Vm, scriptFilepath, dir string, namespacePath st sourcecode = string(sourcebytes) + "\n" if err != nil { uP := NewInitializer(scriptFilepath, sourcecode, dir, namespacePath) // Just because it's expecting to find errors in the uP. - uP.Throw("init/source/a", token.Token{Source: "linking"}, scriptFilepath) + uP.Throw("init/source/a", token.Token{Source: "linking"}, scriptFilepath, err.Error()) return nil, uP } } @@ -1365,8 +1366,8 @@ func altType(t ...values.ValueType) AlternateType { func MakeFilepath(scriptFilepath, dir string) string { doctoredFilepath := strings.Clone(scriptFilepath) - if len(scriptFilepath) >= 4 && scriptFilepath[0:4] == "rsc/" { - doctoredFilepath = dir + scriptFilepath + if len(scriptFilepath) >= 4 && scriptFilepath[0:4] == "rsc/" || scriptFilepath[0:4] == "hub/" { + doctoredFilepath = filepath.Join(dir, filepath.FromSlash(scriptFilepath)) } if settings.StandardLibraries.Contains(scriptFilepath) { doctoredFilepath = dir + "lib/" + scriptFilepath diff --git a/user/hub.dat b/user/hub.dat index 3ad53727..22789037 100644 --- a/user/hub.dat +++ b/user/hub.dat @@ -1 +1 @@ -hub, /Users/tim/Charm/rsc/hub/hub.hub +hub/hub.hub \ No newline at end of file