Types
NimPkError = object of CatchableError report*: string
- Catchable errors for NimPk.
NpVar = object
- Object of NimPk variable.
NpVm = ref object of RootObj
- Ref object of NimPk VM.
Procs
proc `=destroy`(vm: typeof(NpVm()[])) {....raises: [], tags: [], forbids: [].}
- =destroy hook of NimPK VM.
proc `=destroy`(x: NpVar) {....raises: [], tags: [], forbids: [].}
- =destroy hook of NpVar.
proc addSearchPath(vm: NpVm; path: string) {....raises: [], tags: [], forbids: [].}
- Adds a new search paht to the VM, the path will be appended to the list of search paths. Search path orders are the same as the registered order.
proc getCurrentPocketLangStackReport(): string {....raises: [Exception], tags: [], forbids: [].}
- Retrieves the stack report that was attached to the current NimPkError.
proc newVm(config: ptr PkConfiguration = nil): NpVm {....raises: [], tags: [], forbids: [].}
- Create a new NimPk virtual machine.
proc newVm(T: typedesc; config: ptr PkConfiguration = nil): T:type
- Create a new NimPk virtual machine with custom type to store user data. Custom type must be ref object of NpVm.
Converters
converter convertNpVmToPkVm(vm: NpVm): ptr PKVM {.inline, ...raises: [], tags: [], forbids: [].}
converter toBiggestFloat(v: NpVar): BiggestFloat {....raises: [NimPkError], tags: [], forbids: [].}
- BiggestFloat v convert variable into BiggestFloat.
converter toBiggestInt(v: NpVar): BiggestInt {....raises: [NimPkError], tags: [], forbids: [].}
- BiggestInt v convert variable into BiggestInt.
Macros
macro addFn(module: NpVar; fn: untyped; rename = ""): untyped
- Add nim proc as a new function to the module. Parameters of nim proc can be NpVm to pass the vm.
macro addFn(module: NpVar; name: string; fn: proc): untyped
- This is a overloaded addFn macro to support lambda proc.
macro addMethodDoc(class: NpVar; fn: untyped; doc: static[string] = ""; rename = ""): untyped
- Add nim proc as a method to specified class. Parameters of nim proc can be NpVm to pass the vm. First parameter except NpVm will be self, it should correspond to the nim type of the class. This macro don't extract document from proc but use custom one.
Templates
template exportNimPk(name: string; body: untyped)
- Export native code to dynamic library. Inject self as the module object to export. Inject vm of NpVm.
template exportNimPk(t: typedesc; name: string; body: untyped)
- Export native code to dynamic library. Inject self as the module object to export. Inject vm of custom type NpVM (must be ref object of NpVm).
template NpNil(): untyped
- NpNull for default value of NpVar type.
template withNimPkVm(body: untyped)
- Start a vm with default config.
template withNimPkVm(t: untyped; body: untyped)
- Start a vm with custom type and default config.
template withNimPkVmConfig(config: ptr PkConfiguration; body: untyped)
- Start a VM with given config.
template withNimPkVmConfig(t: typedesc; config: ptr PkConfiguration; body: untyped)
- Start a VM with custom type and given config.