2020-05-31 23:45:04 +00:00
|
|
|
;; allocate function type
|
|
|
|
(@interface type (func (param i32) (result i32))) ;; 0
|
|
|
|
|
|
|
|
;; deallocate function
|
|
|
|
(@interface type (func (param i32 i32))) ;; 1
|
|
|
|
|
|
|
|
;; invoke function
|
|
|
|
(@interface type (func (param string) (result string))) ;; 2
|
|
|
|
|
|
|
|
;; result extractor functions
|
|
|
|
(@interface type (func (result i32))) ;; 3
|
|
|
|
|
|
|
|
;; result setter functions
|
2020-06-01 09:14:12 +00:00
|
|
|
(@interface type (func (param string))) ;; 4
|
2020-05-31 23:45:04 +00:00
|
|
|
|
|
|
|
;; import ipfs put/get function
|
2020-06-01 09:14:12 +00:00
|
|
|
(@interface type (func (param i32 i32))) ;; 5
|
2020-05-31 23:45:04 +00:00
|
|
|
|
|
|
|
;; import ipfs put/get function
|
|
|
|
(@interface type (func (param string) (result string))) ;; 6
|
|
|
|
|
|
|
|
;; import ipfs put/get function
|
|
|
|
(@interface type (func (param string) (result string))) ;; 7
|
|
|
|
|
|
|
|
(@interface export "allocate" (func 0)) ;; 0
|
|
|
|
(@interface export "deallocate" (func 1)) ;; 1
|
2020-06-01 09:14:12 +00:00
|
|
|
(@interface export "get_result_size" (func 3)) ;; 2
|
|
|
|
(@interface export "get_result_ptr" (func 3)) ;; 3
|
|
|
|
(@interface export "set_result_size" (func 4)) ;; 4
|
|
|
|
(@interface export "set_result_ptr" (func 4)) ;; 5
|
2020-05-31 23:45:04 +00:00
|
|
|
|
2020-06-01 09:14:12 +00:00
|
|
|
(@interface export "put" (func 5)) ;; 6
|
2020-05-31 23:45:04 +00:00
|
|
|
(@interface export "get" (func 5)) ;; 7
|
|
|
|
|
|
|
|
(@interface func (type 6)
|
2020-06-01 09:14:12 +00:00
|
|
|
arg.get 0
|
|
|
|
string.size
|
|
|
|
call-core 0 ;; call allocate
|
2020-05-31 23:45:04 +00:00
|
|
|
arg.get 0
|
|
|
|
string.lower_memory
|
2020-06-01 09:14:12 +00:00
|
|
|
call-core 7 ;; call node.get
|
|
|
|
call-core 3 ;; call get_result_ptr
|
|
|
|
call-core 2 ;; call get_result_size
|
|
|
|
string.lift_memory
|
|
|
|
call-core 3 ;; call get_result_ptr
|
|
|
|
call-core 2 ;; call get_result_size
|
|
|
|
call-core 1 ;; call deallocate
|
2020-05-31 23:45:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
;; Implementations
|
|
|
|
(@interface implement (func 5) (func 6))
|