myplugin/core

stdlib/eval.tur
defn

Env/new

(Env/new :ptr<void>)

create a new unrestricted evaluation environment.

Since: Phase S2

defn

Env/new-sandboxed

(Env/new-sandboxed :ptr<void>)

create a sandboxed environment with I/O and FFI disabled.

Since: Phase S2

defn

Env/free

(Env/free [env :ptr<void>] :void)

free all resources owned by an environment.

envTuriEnv handle returned by Env/new or Env/new-sandboxed

Since: Phase S2

defn

eval

(eval [env :ptr<void> src :cstr] :ptr<void>)

evaluate a Turmeric source string and return a boxed result.

envTuriEnv evaluation environment
srcTurmeric source code string

Since: Phase S2

defn

eval-file

(eval-file [env :ptr<void> path :cstr] :ptr<void>)

evaluate a file's contents in the given environment.

envTuriEnv evaluation environment
pathpath to the .tur file to evaluate

Since: Phase S2

defn

eval!

(eval! [env :ptr<void> src :cstr] :ptr<void>)

evaluate a source string and panic on error.

envTuriEnv evaluation environment
srcTurmeric source code string

Since: Phase S2

defn

eval-free

(eval-free [result :ptr<void>] :void)

free a boxed TuriValue returned by eval or eval-file.

resultptr<void> previously returned by eval, eval-file, or eval!

Since: Phase S2

defn

eval-ok?

(eval-ok? [result :ptr<void>] :bool)

return true if the eval result is not an error.

resultboxed TuriValue

Since: Phase S2

defn

eval-err?

(eval-err? [result :ptr<void>] :bool)

return true if the eval result is an error.

resultboxed TuriValue

Since: Phase S2

defn

eval-err-msg

(eval-err-msg [result :ptr<void>] :cstr)

extract the error message from an error result.

resultboxed TuriValue (should satisfy eval-err?)

Since: Phase S2

defn

eval-as-int

(eval-as-int [result :ptr<void>] :int)

extract the integer value from a TURI_INT result.

resultboxed TuriValue with TURI_INT tag

Since: Phase S2

defn

eval-as-bool

(eval-as-bool [result :ptr<void>] :bool)

extract the boolean value from a TURI_BOOL result.

resultboxed TuriValue with TURI_BOOL tag

Since: Phase S2

defn

eval-as-cstr

(eval-as-cstr [result :ptr<void>] :cstr)

extract the string value from a TURI_CSTR result.

resultboxed TuriValue with TURI_CSTR tag

Since: Phase S2

defn

eval-tag

(eval-tag [result :ptr<void>] :int)

return the numeric tag of a TuriValue result.

resultboxed TuriValue

Since: Phase S2