asoma.dev · the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches

Hooks to override the default functions of the VM. More...

Collaboration diagram for VM Hooks:

Hooks

int osevm_opcode_default (ose_bundle osevm)
 
int32_t osevm_readOpcode (ose_bundle osevm)
 
const char * osevm_opcodeName (ose_bundle b, int32_t off, int32_t n)
 
void osevm_evalType_hook (ose_bundle osevm)
 
#define OSEVM_ASSIGN   osevm_assignStackToEnv
 
#define OSEVM_LOOKUP   osevm_lookupInEnv_impl
 
#define OSEVM_RAISE(osevm)   ((void)(osevm))
 
#define OSEVM_FUNCALL   osevm_funcall
 
#define OSEVM_QUOTE   osevm_quote
 
#define OSEVM_COPYREGISTERTOELEM   osevm_copyRegisterToElem
 
#define OSEVM_APPENDELEMTOREGISTER   osevm_appendElemToRegister
 
#define OSEVM_REPLACEREGISTERWITHELEM   osevm_replaceRegisterWithElem
 
#define OSEVM_MOVEELEMTOREGISTER   osevm_moveElemToRegister
 
#define OSEVM_TOTYPE   osevm_toType
 
#define OSEVM_TOINT32   osevm_toInt32
 
#define OSEVM_TOFLOAT   osevm_toFloat
 
#define OSEVM_TOSTRING   osevm_toString
 
#define OSEVM_TOBLOB   osevm_toBlob
 
#define OSEVM_TOSYMBOL   osevm_toSymbol
 
#define OSEVM_TODOUBLE   osevm_toDouble
 
#define OSEVM_TOINT8   osevm_toInt8
 
#define OSEVM_TOUINT8   osevm_toUInt8
 
#define OSEVM_TOINT16   osevm_toInt16
 
#define OSEVM_TOUINT16   osevm_toUInt16
 
#define OSEVM_TOUINT32   osevm_toUInt32
 
#define OSEVM_TOINT64   osevm_toInt64
 
#define OSEVM_TOUINT64   osevm_toUInt64
 
#define OSEVM_TOTIMETAG   osevm_toTimetag
 
#define OSEVM_TOTRUE   osevm_toTrue
 
#define OSEVM_TOFALSE   osevm_toFalse
 
#define OSEVM_TONIL   osevm_toNil
 
#define OSEVM_TOINFINITUM   osevm_toInfinitum
 
#define OSEVM_APPENDBYTE   osevm_appendByte
 
#define OSEVM_RESPONDTOSTRING   osevm_respondToString
 
#define OSEVM_OPCODE   osevm_opcode_default
 What runs an instruction by number (OSETT_OPCODE).
 
#define OSEVM_OPCODE_NAME(b, off, n)   osevm_opcodeName(b, off, n)
 The name an opcode stands for, or NULL for none. b is the bundle the opcode sits in – the control register, or whatever is being printed – and off is where the opcode's int32 sits in it, or -1 when the caller does not know. From those the host finds the table that numbers it: a table carried beside the opcode in the same bytes, as a machine from another host carries one, or its own. The answer is a string that outlives the call, or NULL, which prints as the number and runs as unbound. The default, for a libose built without a table, answers NULL.
 
#define OSEVM_PREINPUT   osevm_preInput
 
#define OSEVM_POSTINPUT   osevm_postInput
 
#define OSEVM_POPINPUTTOCONTROL   osevm_popInputToControl
 
#define OSEVM_POSTCONTROL   osevm_postControl
 
#define OSEVM_TYPE_ADDR_EVALTYPE_SUFFIX   "/EVTY"
 
#define OSEVM_EVALTYPE_ADDR    OSE_TYPE_ADDR_PREFIX "%c" OSEVM_TYPE_ADDR_EVALTYPE_SUFFIX
 
#define OSEVM_EVALTYPE_ADDR_LEN   sizeof(OSEVM_EVALTYPE_ADDR)
 
#define OSEVM_EVALTYPE   osevm_evalType_hook
 

Detailed Description

Hooks to override the default functions of the VM.

Macro Definition Documentation

◆ OSEVM_OPCODE

#define OSEVM_OPCODE   osevm_opcode_default

What runs an instruction by number (OSETT_OPCODE).

Called by the VM when the control element on top of /_c is a message whose first item is an opcode; osevm_readOpcode() reads the number. Answers nonzero when it ran the instruction. Answers zero when it did not, and the VM then INFLATES the element: the number becomes the string it stands for (OSEVM_OPCODE_NAME) and runs exactly as that string would have, through the same ladder, so an opcode means its name and nothing else. A number no name stands for raises OSE_ERR_UNBOUND, as a name nothing resolves does. The default knows no table and answers zero, which is what a bare libose does with an instruction it cannot run by itself.