46#define OSEVM_WRAP_DECL(name) \
47 void osevm_##name(ose_bundle bundle);
73#define OSEVM_WRAP_DEFN(name) \
74 void osevm_##name(ose_bundle bundle) \
76 ose_bundle vm_s = OSEVM_STACK(bundle); \
77 enum ose_errno e = OSE_ERR_NONE; \
78 ose_errno_set(vm_s, OSE_ERR_NONE); \
80 if((e = ose_errno_get(vm_s))) \
82 ose_errno_set(bundle, e); \
83 ose_errno_set(vm_s, OSE_ERR_NONE); \
94#define OSEVM_WRAP_DEFPRED(name) \
95 void osevm_##name(ose_bundle bundle) \
97 ose_bundle vm_s = OSEVM_STACK(bundle); \
99 ose_errno_set(vm_s, OSE_ERR_NONE); \
100 i = ose_popInt32(vm_s); \
101 enum ose_errno e = OSE_ERR_NONE; \
102 if((e = ose_errno_get(vm_s))) \
104 ose_errno_set(bundle, e); \
105 ose_errno_set(vm_s, OSE_ERR_NONE); \
107 bool r = ose_##name(i); \
108 ose_pushInt32(vm_s, r == true ? 1 : 0); \
148#define OSEVM_FRAME_MAGIC 0x2346524D
151 OSEVM_FRAME_INPUT = 1,
153 OSEVM_FRAME_STACK = 4,
154 OSEVM_FRAME_CONTROL = 8,
162 OSEVM_FRAME_STACK_BELOW = 16
194 const char *
const env,
491 char bundle_typetag);
593#ifdef OSE_PROVIDE_TYPE_SYMBOL
597#ifdef OSE_PROVIDE_TYPE_DOUBLE
601#ifdef OSE_PROVIDE_TYPE_INT8
605#ifdef OSE_PROVIDE_TYPE_UINT8
609#ifdef OSE_PROVIDE_TYPE_INT16
613#ifdef OSE_PROVIDE_TYPE_UINT16
617#ifdef OSE_PROVIDE_TYPE_UINT32
621#ifdef OSE_PROVIDE_TYPE_INT64
625#ifdef OSE_PROVIDE_TYPE_UINT64
629#ifdef OSE_PROVIDE_TYPE_TIMETAG
633#ifdef OSE_PROVIDE_TYPE_TRUE
637#ifdef OSE_PROVIDE_TYPE_FALSE
641#ifdef OSE_PROVIDE_TYPE_NIL
645#ifdef OSE_PROVIDE_TYPE_INFINITUM
ose_errno
Definition ose_errno.h:37
void osevm_appendElemToRegister(ose_bundle osevm)
Append the contents of the top element to a register – /<<.
Definition osevm_lib.c:516
void osevm_moveElemToRegister(ose_bundle osevm)
Move the top element into a register – /-.
Definition osevm_lib.c:540
void osevm_copyElemToRegister(ose_bundle osevm)
Copy the top element into a register.
Definition osevm_lib.c:552
enum ose_errno osevm_resolveWildPtr(ose_bundle osevm)
Replace the pointer by name ('P') on top of the stack with what /$ of its name would push: the VM ope...
Definition osevm_lib.c:572
void osevm_makeRegister(ose_bundle osevm)
Create a register from a size and a name on the stack; the standard library binds it as /o/make/regis...
Definition osevm_lib.c:1740
void osevm_if(ose_bundle osevm)
Execute one of two bundles, depending on the value of the int in the last message on the stack.
Definition osevm_lib.c:394
int osevm_pushFrame(ose_bundle osevm, int32_t which, const char *const env, int32_t envlen)
Save registers to the dump as ONE element – whole, or not at all.
Definition osevm_lib.c:88
void osevm_dotimes(ose_bundle osevm)
Execute a bundle repeatedly.
Definition osevm_lib.c:409
void osevm_lookupInEnv_impl(ose_bundle osevm)
Look a name up – the /$ instruction, and the default OSEVM_LOOKUP.
Definition osevm_lib.c:1622
void osevm_assignStackToEnv(ose_bundle osevm)
Bind the stack into the environment – the /@ instruction, and the default OSEVM_ASSIGN.
Definition osevm_lib.c:1592
void osevm_funcall(ose_bundle osevm)
Look a name up and apply what it finds – the /! instruction on a string, and the default OSEVM_FUNCAL...
Definition osevm_lib.c:1683
void osevm_exec1(ose_bundle osevm)
Execute a bundle on the stack.
Definition osevm_lib.c:206
void osevm_call(ose_bundle osevm)
Execute a bundle as a function: osevm_exec2, with the caller's stack set aside.
Definition osevm_lib.c:337
void osevm_exec(ose_bundle osevm)
Synonym for osevm_exec2.
Definition osevm_lib.c:389
void osevm_exec3(ose_bundle osevm)
Execute a bundle on the stack.
Definition osevm_lib.c:291
void osevm_version(ose_bundle osevm)
Push the library's version – /!/version.
Definition osevm_lib.c:1222
void osevm_plookupInEnv_impl(ose_bundle osevm)
Does nothing.
Definition osevm_lib.c:1672
void osevm_return(ose_bundle osevm)
Pop the topmost frame from the dump and restore what it carried – /!/return, and what the VM runs whe...
Definition osevm_lib.c:1213
void osevm_map(ose_bundle osevm)
Apply a function to each item of a message, or each element of a bundle – /!/map.
Definition osevm_lib.c:837
void osevm_plookupInEnv(ose_bundle osevm)
Does nothing.
Definition osevm_lib.c:1679
void osevm_replaceRegisterWithElem(ose_bundle osevm)
Replace a register's contents with the top element's – /<.
Definition osevm_lib.c:528
void osevm_lookupInEnv(ose_bundle osevm)
Call whatever OSEVM_LOOKUP names.
Definition osevm_lib.c:1664
void osevm_apply(ose_bundle osevm)
Apply the top of the stack – the /! instruction, and the second half of osevm_funcall.
Definition osevm_lib.c:637
void osevm_assignStackToEnv_impl(ose_bundle osevm, ose_bundle env, int replace, int new_msg_first, char bundle_typetag)
Bind everything on the stack, as one message, into a bundle.
Definition osevm_lib.c:1251
void osevm_quote(ose_bundle bundle)
Does nothing – the ‘/’` instruction, and the default OSEVM_QUOTE.
Definition osevm_lib.c:1773
#define OSEVM_WRAP_DECL(name)
Declare void osevm_<name>(ose_bundle osevm), the VM-level form of the stack operation ose_<name>().
Definition osevm_lib.h:46
void osevm_exec2(ose_bundle osevm)
Execute a bundle on the stack.
Definition osevm_lib.c:257
void osevm_copyRegisterToElem(ose_bundle osevm)
Copy a register onto the stack as one element – the /> instruction.
Definition osevm_lib.c:496