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,
484 char bundle_typetag);
586#ifdef OSE_PROVIDE_TYPE_SYMBOL
590#ifdef OSE_PROVIDE_TYPE_DOUBLE
594#ifdef OSE_PROVIDE_TYPE_INT8
598#ifdef OSE_PROVIDE_TYPE_UINT8
602#ifdef OSE_PROVIDE_TYPE_INT16
606#ifdef OSE_PROVIDE_TYPE_UINT16
610#ifdef OSE_PROVIDE_TYPE_UINT32
614#ifdef OSE_PROVIDE_TYPE_INT64
618#ifdef OSE_PROVIDE_TYPE_UINT64
622#ifdef OSE_PROVIDE_TYPE_TIMETAG
626#ifdef OSE_PROVIDE_TYPE_TRUE
630#ifdef OSE_PROVIDE_TYPE_FALSE
634#ifdef OSE_PROVIDE_TYPE_NIL
638#ifdef OSE_PROVIDE_TYPE_INFINITUM
void osevm_appendElemToRegister(ose_bundle osevm)
Append the contents of the top element to a register – /<<.
Definition osevm_lib.c:455
void osevm_moveElemToRegister(ose_bundle osevm)
Move the top element into a register – /-.
Definition osevm_lib.c:479
void osevm_copyElemToRegister(ose_bundle osevm)
Copy the top element into a register.
Definition osevm_lib.c:491
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:1618
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:333
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:348
void osevm_lookupInEnv_impl(ose_bundle osevm)
Look a name up – the /$ instruction, and the default OSEVM_LOOKUP.
Definition osevm_lib.c:1537
void osevm_assignStackToEnv(ose_bundle osevm)
Bind the stack into the environment – the /@ instruction, and the default OSEVM_ASSIGN.
Definition osevm_lib.c:1507
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:1598
void osevm_exec1(ose_bundle osevm)
Execute a bundle on the stack.
Definition osevm_lib.c:206
void osevm_exec(ose_bundle osevm)
Synonym for osevm_exec2.
Definition osevm_lib.c:328
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:1084
void osevm_plookupInEnv_impl(ose_bundle osevm)
Does nothing.
Definition osevm_lib.c:1587
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:1075
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:699
void osevm_plookupInEnv(ose_bundle osevm)
Does nothing.
Definition osevm_lib.c:1594
void osevm_replaceRegisterWithElem(ose_bundle osevm)
Replace a register's contents with the top element's – /<.
Definition osevm_lib.c:467
void osevm_lookupInEnv(ose_bundle osevm)
Call whatever OSEVM_LOOKUP names.
Definition osevm_lib.c:1579
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:504
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:1166
void osevm_quote(ose_bundle bundle)
Does nothing – the ‘/’` instruction, and the default OSEVM_QUOTE.
Definition osevm_lib.c:1651
#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_assignStackToRegister(ose_bundle osevm)
Gather the stack into the bundle at its bottom, as one message named by the string on top.
Definition osevm_lib.c:1099
void osevm_copyRegisterToElem(ose_bundle osevm)
Copy a register onto the stack as one element – the /> instruction.
Definition osevm_lib.c:435