Skip to content

Commit

Permalink
use go-duktape fork
Browse files Browse the repository at this point in the history
  • Loading branch information
ltearno committed Feb 28, 2020
1 parent f82dc0f commit 4ca18bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/my-own-cluster/duktape/engine-js.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"my-own-cluster/common"
"my-own-cluster/coreapi"

"gopkg.in/olebedev/go-duktape.v3"
"gopkg.in/ltearno/go-duktape.v3"
)

type JSProcessContext struct {
Expand Down Expand Up @@ -255,6 +255,19 @@ func (e *JavascriptDuktapeEngine) PrepareContext(fctx *common.FunctionExecutionC
case duktape.TypeBuffer:
inputPtr, inputLength := c.GetBuffer(-3)
input = (*[1 << 30]byte)(inputPtr)[:inputLength:inputLength]
case duktape.TypeObject:
fmt.Printf("TYPE OBJECT")
if c.IsBufferData(-3) {
fmt.Printf("TYPE BUFFERDATA")
inputPtr, inputLength := c.GetBufferData(-3)
input = (*[1 << 30]byte)(inputPtr)[:inputLength:inputLength]
} else {
fmt.Printf("cannot handle TypeObject content type of input param when calling function from js\n")
return 0
}
case duktape.TypePointer:
fmt.Printf("cannot handle TypePointer content type of input param when calling function from js\n")
return 0
default:
fmt.Printf("cannot guess content type of input param when calling function from js\n")
return 0
Expand Down
2 changes: 1 addition & 1 deletion update-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go get -u github.com/jteeuwen/go-bindata/...
go get github.com/julienschmidt/httprouter
go get github.com/syndtr/goleveldb/leveldb
go get github.com/ltearno/go-wasm3
go get gopkg.in/ltearno/go-duktape.v3
go get golang.org/x/sys/unix
go get gopkg.in/olebedev/go-duktape.v3

exit 0

0 comments on commit 4ca18bf

Please sign in to comment.