MiniQuake

src/miniquake/quakec/vm.ml

Package
miniquake.quakec.vm
Reachable
Yes

Imports

Declarations

callBuiltin

function callBuiltin(machine, builtinIndex)

Implements the `callBuiltin` operation for `miniquake.quakec.vm` (call builtin).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `callBuiltin`.
builtinIndexdynamic—Zero-based index of the requested entry.

View source

callDepth

function callDepth(machine)

Resolve the active PR_ExecuteProgram depth for diagnostics without exposing the fixed-stack representation to compatibility fixtures.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `callDepth`.

View source

canonicalString

function canonicalString(text)

Report whether canonical string.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

clearEntity

function clearEntity(machine, entityIndex)

Update module state for entity.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `clearEntity`.
entityIndexdynamic—Zero-based index of the requested entry.

View source

copyProgramWords

function copyProgramWords(source)

Transfer data for copy program words.

ParameterTypeDefaultDescription
sourcedynamic—Source value or collection to read.

View source

create

function create(program, maxEdicts)

Implements the `create` operation for `miniquake.quakec.vm` (create).

ParameterTypeDefaultDescription
programdynamic—The program input consumed by `create`.
maxEdictsdynamic—The max edicts input consumed by `create`.

View source

debugCeil

function debugCeil(value)

Implements the `debugCeil` operation for `miniquake.quakec.vm` (debug ceil).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `debugCeil`.

View source

debugFloor

function debugFloor(value)

Implements the `debugFloor` operation for `miniquake.quakec.vm` (debug floor).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `debugFloor`.

View source

debugGlobalString

function debugGlobalString(machine, offset, includeContents)

Implements the `debugGlobalString` operation for `miniquake.quakec.vm` (debug global string).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `debugGlobalString`.
offsetdynamic—Zero-based offset of the requested data.
includeContentsdynamic—The include contents input consumed by `debugGlobalString`.

View source

debugOneDecimal

function debugOneDecimal(value)

Implements the `debugOneDecimal` operation for `miniquake.quakec.vm` (debug one decimal).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `debugOneDecimal`.

View source

debugValueString

function debugValueString(machine, definition, offset)

Implements the `debugValueString` operation for `miniquake.quakec.vm` (debug value string).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `debugValueString`.
definitiondynamic—The definition input consumed by `debugValueString`.
offsetdynamic—Zero-based offset of the requested data.

View source

definitionAtOffset

function definitionAtOffset(definitions, offset)

Return definition at offset derived from the active module state.

ParameterTypeDefaultDescription
definitionsdynamic—The definitions input consumed by `definitionAtOffset`.
offsetdynamic—Zero-based offset of the requested data.

View source

definitionOffset

function definitionOffset(definitions, name)

Return definition offset derived from the active module state.

ParameterTypeDefaultDescription
definitionsdynamic—The definitions input consumed by `definitionOffset`.
namedynamic—Stable name that identifies the requested object or option.

View source

ensureGlobal

function ensureGlobal(machine, offset)

Ensure sufficient storage or state for global.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `ensureGlobal`.
offsetdynamic—Zero-based offset of the requested data.

View source

ensureLookupMachine

function ensureLookupMachine(machine)

Ensure sufficient storage or state for lookup machine.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `ensureLookupMachine`.

View source

ensureProgramStringCache

function ensureProgramStringCache(machine)

Ensure immutable progs.dat strings have one decoded value per byte offset.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `ensureProgramStringCache`.

View source

enterFunction

function enterFunction(machine, functionIndex)

Implements the `enterFunction` operation for `miniquake.quakec.vm` (enter function).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `enterFunction`.
functionIndexdynamic—Zero-based index of the requested entry.

View source

entityField

function entityField(machine, entityIndex, fieldOffset)

Implements the `entityField` operation for `miniquake.quakec.vm` (entity field).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `entityField`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetdynamic—Zero-based offset of the requested data.

View source

entityFloat

function entityFloat(machine, entityIndex, fieldOffsetValue)

Implements the `entityFloat` operation for `miniquake.quakec.vm` (entity float).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `entityFloat`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `entityFloat`.

View source

entityString

function entityString(machine, entityIndex, fieldOffsetValue)

Implements the `entityString` operation for `miniquake.quakec.vm` (entity string).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `entityString`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `entityString`.

View source

entityVector

function entityVector(machine, entityIndex, fieldOffsetValue)

Implements the `entityVector` operation for `miniquake.quakec.vm` (entity vector).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `entityVector`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `entityVector`.

View source

execute

function execute(machine, functionIndex)

Execute the requested value.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `execute`.
functionIndexdynamic—Zero-based index of the requested entry.

View source

executeState

function executeState(machine, frameOffset, thinkOffset)

Execute state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `executeState`.
frameOffsetdynamic—Zero-based offset of the requested data.
thinkOffsetdynamic—Zero-based offset of the requested data.

View source

fastEnterFunction

function fastEnterFunction(machine, functionIndex)

Enter a QuakeC function using the original fixed execution and locals stacks. Sources are saved before parameters overwrite a callee's locals.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `fastEnterFunction`.
functionIndexdynamic—Zero-based index of the requested entry.

View source

fieldLookupKeys

fieldLookupKeys

Tracks the module-level field lookup keys state owned by `miniquake.quakec.vm`.

View source

fieldLookupRawKeys

fieldLookupRawKeys

Tracks the module-level field lookup raw keys state owned by `miniquake.quakec.vm`.

View source

fieldLookupValues

fieldLookupValues

Tracks the module-level field lookup values state owned by `miniquake.quakec.vm`.

View source

fieldOffset

function fieldOffset(machine, name)

Implements the `fieldOffset` operation for `miniquake.quakec.vm` (field offset).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `fieldOffset`.
namedynamic—Stable name that identifies the requested object or option.

View source

floatTruth

inline function floatTruth(value)

Implements the `floatTruth` operation for `miniquake.quakec.vm` (float truth).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `floatTruth`.

View source

functionIndex

function functionIndex(machine, name)

Return function index derived from the active module state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `functionIndex`.
namedynamic—Stable name that identifies the requested object or option.

View source

functionLookupKeys

functionLookupKeys

Tracks the module-level function lookup keys state owned by `miniquake.quakec.vm`.

View source

functionLookupRawKeys

functionLookupRawKeys

Tracks the module-level function lookup raw keys state owned by `miniquake.quakec.vm`.

View source

functionLookupValues

functionLookupValues

Tracks the module-level function lookup values state owned by `miniquake.quakec.vm`.

View source

globalFloat

function globalFloat(machine, offset)

Implements the `globalFloat` operation for `miniquake.quakec.vm` (global float).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `globalFloat`.
offsetdynamic—Zero-based offset of the requested data.

View source

globalLookupKeys

globalLookupKeys

Tracks the module-level global lookup keys state owned by `miniquake.quakec.vm`.

View source

globalLookupRawKeys

globalLookupRawKeys

Tracks the module-level global lookup raw keys state owned by `miniquake.quakec.vm`.

View source

globalLookupValues

globalLookupValues

Tracks the module-level global lookup values state owned by `miniquake.quakec.vm`.

View source

globalOffset

function globalOffset(machine, name)

Return global offset derived from the active module state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `globalOffset`.
namedynamic—Stable name that identifies the requested object or option.

View source

internString

function internString(machine, text)

Implements the `internString` operation for `miniquake.quakec.vm` (intern string).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `internString`.
textdynamic—Text to parse or process.

View source

leaveFunction

function leaveFunction(machine)

Implements the `leaveFunction` operation for `miniquake.quakec.vm` (leave function).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `leaveFunction`.

View source

LOCALSTACK_SIZE

const LOCALSTACK_SIZE = 2048

Defines the localstack size value used by `miniquake.quakec.vm`.

View source

LOOKUP_CACHE_SIZE

const LOOKUP_CACHE_SIZE = 512

Defines the lookup cache size value used by `miniquake.quakec.vm`.

View source

lookupMachine

lookupMachine

Tracks the module-level lookup machine state owned by `miniquake.quakec.vm`.

View source

lookupSlot

inline function lookupSlot(key)

Return slot.

ParameterTypeDefaultDescription
keydynamic—Key used to identify the requested entry.

View source

MAX_STACK_DEPTH

const MAX_STACK_DEPTH = 32

Defines the max stack depth value used by `miniquake.quakec.vm`.

View source

namedFieldOffset

function namedFieldOffset(machine, name)

Return named field offset derived from the active module state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `namedFieldOffset`.
namedynamic—Stable name that identifies the requested object or option.

View source

namedGlobalFloat

function namedGlobalFloat(machine, name)

Implements the `namedGlobalFloat` operation for `miniquake.quakec.vm` (named global float).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `namedGlobalFloat`.
namedynamic—Stable name that identifies the requested object or option.

View source

namedGlobalWord

function namedGlobalWord(machine, name)

Implements the `namedGlobalWord` operation for `miniquake.quakec.vm` (named global word).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `namedGlobalWord`.
namedynamic—Stable name that identifies the requested object or option.

View source

opcodeName

function opcodeName(code)

Return opcode name derived from the active module state.

ParameterTypeDefaultDescription
codedynamic—The code input consumed by `opcodeName`.

View source

pointerEntity

function pointerEntity(machine, pointer)

Implements the `pointerEntity` operation for `miniquake.quakec.vm` (pointer entity).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `pointerEntity`.
pointerdynamic—The pointer input consumed by `pointerEntity`.

View source

pointerField

function pointerField(machine, pointer)

Implements the `pointerField` operation for `miniquake.quakec.vm` (pointer field).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `pointerField`.
pointerdynamic—The pointer input consumed by `pointerField`.

View source

popArray

function popArray(values)

Consume pending state for pop array.

ParameterTypeDefaultDescription
valuesdynamic—The values input consumed by `popArray`.

View source

PR_EnterFunction

function PR_EnterFunction(machine, functionIndexValue)

Mirror Quake's PR_EnterFunction routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_EnterFunction`.
functionIndexValuedynamic—The function index value input consumed by `PR_EnterFunction`.

View source

PR_ExecuteProgram

function PR_ExecuteProgram(machine, functionIndexValue)

Mirror Quake's PR_ExecuteProgram routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_ExecuteProgram`.
functionIndexValuedynamic—The function index value input consumed by `PR_ExecuteProgram`.

View source

PR_LeaveFunction

function PR_LeaveFunction(machine)

Mirror Quake's PR_LeaveFunction routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_LeaveFunction`.

View source

PR_PrintStatement

function PR_PrintStatement(machine, statementValue)

Names matching the MiniQuake entry points keep the source-to-port mapping explicit while the lower-camel functions remain the idiomatic MiniLang API.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_PrintStatement`.
statementValuedynamic—The statement value input consumed by `PR_PrintStatement`.

View source

PR_Profile_f

function PR_Profile_f(machine)

Mirror Quake's PR_Profile_f routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_Profile_f`.

View source

PR_RunError

function PR_RunError(machine, message)

Mirror Quake's PR_RunError routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_RunError`.
messagedynamic—Diagnostic message that explains a failure or event.

View source

PR_StackTrace

function PR_StackTrace(machine)

Mirror Quake's PR_StackTrace routine and its observable state changes.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `PR_StackTrace`.

View source

printStatement

function printStatement(machine, statementValue)

Format and emit statement.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `printStatement`.
statementValuedynamic—The statement value input consumed by `printStatement`.

View source

profileReport

function profileReport(machine)

Implements the `profileReport` operation for `miniquake.quakec.vm` (profile report).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `profileReport`.

View source

programStringCache

programStringCache

Tracks the module-level program string cache state owned by `miniquake.quakec.vm`.

View source

programStringCacheMachine

programStringCacheMachine

Tracks the module-level program string cache machine state owned by `miniquake.quakec.vm`.

View source

randomFloat

function randomFloat(machine)

Implements the `randomFloat` operation for `miniquake.quakec.vm` (random float).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `randomFloat`.

View source

returnFloat

function returnFloat(machine)

Implements the `returnFloat` operation for `miniquake.quakec.vm` (return float).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `returnFloat`.

View source

runError

function runError(machine, message)

Execute error.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `runError`.
messagedynamic—Diagnostic message that explains a failure or event.

View source

savedLocalCount

function savedLocalCount(machine)

Encode and write d local count.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `savedLocalCount`.

View source

saveLocals

function saveLocals(machine, functionValue)

Encode and write locals.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `saveLocals`.
functionValuedynamic—The function value input consumed by `saveLocals`.

View source

setContext

function setContext(machine, context)

Update module state for context.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setContext`.
contextdynamic—The context input consumed by `setContext`.

View source

setEntityField

function setEntityField(machine, entityIndex, fieldOffset, value)

Update module state for entity field.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setEntityField`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetdynamic—Zero-based offset of the requested data.
valuedynamic—Value consumed by `setEntityField`.

View source

setEntityFloat

function setEntityFloat(machine, entityIndex, fieldOffsetValue, value)

Sets entity float for `miniquake.quakec.vm`.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setEntityFloat`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `setEntityFloat`.
valuedynamic—Value consumed by `setEntityFloat`.

View source

setEntityString

function setEntityString(machine, entityIndex, fieldOffsetValue, text)

Update module state for entity string.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setEntityString`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `setEntityString`.
textdynamic—Text to parse or process.

View source

setEntityVector

function setEntityVector(machine, entityIndex, fieldOffsetValue, value)

Sets entity vector for `miniquake.quakec.vm`.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setEntityVector`.
entityIndexdynamic—Zero-based index of the requested entry.
fieldOffsetValuedynamic—The field offset value input consumed by `setEntityVector`.
valuedynamic—Value consumed by `setEntityVector`.

View source

setGlobalFloat

function setGlobalFloat(machine, offset, value)

Update module state for global float.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setGlobalFloat`.
offsetdynamic—Zero-based offset of the requested data.
valuedynamic—Value consumed by `setGlobalFloat`.

View source

setGlobalString

function setGlobalString(machine, offset, text)

Update module state for global string.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setGlobalString`.
offsetdynamic—Zero-based offset of the requested data.
textdynamic—Text to parse or process.

View source

setTemporaryString

function setTemporaryString(machine, text)

Update module state for temporary string.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setTemporaryString`.
textdynamic—Text to parse or process.

View source

setVector

function setVector(machine, offset, value)

Update module state for vector.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setVector`.
offsetdynamic—Zero-based offset of the requested data.
valuedynamic—Value consumed by `setVector`.

View source

setWord

function setWord(machine, offset, value)

Update module state for word.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `setWord`.
offsetdynamic—Zero-based offset of the requested data.
valuedynamic—Value consumed by `setWord`.

View source

stackLine

function stackLine(functionValue)

Implements the `stackLine` operation for `miniquake.quakec.vm` (stack line).

ParameterTypeDefaultDescription
functionValuedynamic—The function value input consumed by `stackLine`.

View source

stackTrace

function stackTrace(machine)

Implements the `stackTrace` operation for `miniquake.quakec.vm` (stack trace).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `stackTrace`.

View source

stringAt

function stringAt(machine, globalOffset)

Implements the `stringAt` operation for `miniquake.quakec.vm` (string at).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `stringAt`.
globalOffsetdynamic—Zero-based offset of the requested data.

View source

stringCompare

function stringCompare(left, right)

Implements the `stringCompare` operation for `miniquake.quakec.vm` (string compare).

ParameterTypeDefaultDescription
leftdynamic—The left input consumed by `stringCompare`.
rightdynamic—The right input consumed by `stringCompare`.

View source

stringValue

function stringValue(machine, rawValue)

Return string value derived from the active module state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `stringValue`.
rawValuedynamic—The raw value input consumed by `stringValue`.

View source

TEMP_STRING_HANDLE

const TEMP_STRING_HANDLE = 4294967295

Defines the temp string handle value used by `miniquake.quakec.vm`.

View source

validatePointer

function validatePointer(machine, pointer, wordCount)

Validate pointer and report any incompatibility.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `validatePointer`.
pointerdynamic—The pointer input consumed by `validatePointer`.
wordCountdynamic—Number of entries or units to process.

View source

vector

function vector(machine, offset)

Return vector derived from the active module state.

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `vector`.
offsetdynamic—Zero-based offset of the requested data.

View source

word

function word(machine, offset)

Implements the `word` operation for `miniquake.quakec.vm` (word).

ParameterTypeDefaultDescription
machinedynamic—The machine input consumed by `word`.
offsetdynamic—Zero-based offset of the requested data.

View source

zeroArray

function zeroArray(count)

Create the zero-initialized state for array.

ParameterTypeDefaultDescription
countdynamic—Number of entries or units to process.

View source