MiniQuake

src/miniquake/common.ml

Package
miniquake.common
Reachable
Yes

Imports

Declarations

atof

function atof(text)

Q_atof deliberately stops at the first non-number and supports Quake's hexadecimal and character literal forms. It is not the host language's stricter general-purpose number parser.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

atoi

function atoi(text)

Implements the `atoi` operation for `miniquake.common` (atoi).

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

baseDirectory

function baseDirectory(commandLine)

Implements the `baseDirectory` operation for `miniquake.common` (base directory).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `baseDirectory`.

View source

cAtof

function cAtof(text)

C runtime atof semantics used by pr_edict.c and host_cmd.c save loading. The main native bridge calls strtod and narrows the result to C float, so signed zero, exponent syntax and the exact IEEE-754 binary32 boundary match WinQuake instead of depending on MiniLang's general toNumber() conversion.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

cAtoi

function cAtoi(text)

C runtime atoi semantics used by host_cmd.c and view.c. Unlike Quake's Q_atoi above, this accepts only the initial decimal digit run after ASCII whitespace and an optional sign; 0x and character-literal syntax are not recognized. The result is narrowed to WinQuake's signed 32-bit int.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

checkParm

function checkParm(commandLine, name)

Validate parm and report any incompatibility.

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `checkParm`.
namedynamic—Stable name that identifies the requested object or option.

View source

COM_CheckParm

function COM_CheckParm(commandLine, name)

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

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `COM_CheckParm`.
namedynamic—Stable name that identifies the requested object or option.

View source

COM_DefaultExtension

function COM_DefaultExtension(pathname, extension)

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

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.
extensiondynamic—The extension input consumed by `COM_DefaultExtension`.

View source

COM_FileBase

function COM_FileBase(pathname)

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

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

COM_FileExtension

function COM_FileExtension(pathname)

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

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

COM_Init

function COM_Init(basedir, arguments)

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

ParameterTypeDefaultDescription
basedirdynamic—The basedir input consumed by `COM_Init`.
argumentsdynamic—Command-line arguments to inspect or execute.

View source

COM_InitArgv

function COM_InitArgv(arguments)

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

ParameterTypeDefaultDescription
argumentsdynamic—Command-line arguments to inspect or execute.

View source

COM_Parse

function COM_Parse(text, startOffset)

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

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
startOffsetdynamic—Zero-based offset of the requested data.

View source

COM_SkipPath

function COM_SkipPath(pathname)

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

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

COM_StripExtension

function COM_StripExtension(pathname)

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

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

create

function create(args)

Implements the `create` operation for `miniquake.common` (create).

ParameterTypeDefaultDescription
argsdynamic—Command-line arguments supplied by the host process.

View source

defaultExtension

function defaultExtension(pathname, extension)

Implements the `defaultExtension` operation for `miniquake.common` (default extension).

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.
extensiondynamic—The extension input consumed by `defaultExtension`.

View source

describe

function describe(commandLine)

Implements the `describe` operation for `miniquake.common` (describe).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `describe`.

View source

fileBase

function fileBase(pathname)

Implements the `fileBase` operation for `miniquake.common` (file base).

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

fileExtension

function fileExtension(pathname)

Implements the `fileExtension` operation for `miniquake.common` (file extension).

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

fixedFloat

function fixedFloat(value)

Implements the `fixedFloat` operation for `miniquake.common` (fixed float).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `fixedFloat`.

View source

FloatNoSwap

function FloatNoSwap(value)

Convert byte order for float no swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `FloatNoSwap`.

View source

floatOption

function floatOption(commandLine, name, fallback)

Implements the `floatOption` operation for `miniquake.common` (float option).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `floatOption`.
namedynamic—Stable name that identifies the requested object or option.
fallbackdynamic—Value to use when the requested input is unavailable or invalid.

View source

FloatSwap

function FloatSwap(value)

Convert byte order for float swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `FloatSwap`.

View source

formatFlag

function formatFlag(value)

Format and emit flag.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `formatFlag`.

View source

gameDirectory

function gameDirectory(commandLine)

Implements the `gameDirectory` operation for `miniquake.common` (game directory).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `gameDirectory`.

View source

hasParm

function hasParm(commandLine, name)

Report whether parm.

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `hasParm`.
namedynamic—Stable name that identifies the requested object or option.

View source

hexadecimal

function hexadecimal(value, upper)

Implements the `hexadecimal` operation for `miniquake.common` (hexadecimal).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `hexadecimal`.
upperdynamic—The upper input consumed by `hexadecimal`.

View source

hexDigit

function hexDigit(value)

Implements the `hexDigit` operation for `miniquake.common` (hex digit).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `hexDigit`.

View source

integerOption

function integerOption(commandLine, name, fallback)

Implements the `integerOption` operation for `miniquake.common` (integer option).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `integerOption`.
namedynamic—Stable name that identifies the requested object or option.
fallbackdynamic—Value to use when the requested input is unavailable or invalid.

View source

joinArguments

function joinArguments(args)

Implements the `joinArguments` operation for `miniquake.common` (join arguments).

ParameterTypeDefaultDescription
argsdynamic—Command-line arguments supplied by the host process.

View source

LongNoSwap

function LongNoSwap(value)

Convert byte order for long no swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `LongNoSwap`.

View source

LongSwap

function LongSwap(value)

Convert byte order for long swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `LongSwap`.

View source

memCompare

function memCompare(first, second, count)

Implements the `memCompare` operation for `miniquake.common` (mem compare).

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `memCompare`.
seconddynamic—The second input consumed by `memCompare`.
countdynamic—Number of entries or units to process.

View source

memCopy

function memCopy(destination, source, count)

Implements the `memCopy` operation for `miniquake.common` (mem copy).

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
sourcedynamic—Source value or collection to read.
countdynamic—Number of entries or units to process.

View source

memorySearch

function memorySearch(data, count, search)

Implements the `memorySearch` operation for `miniquake.common` (memory search).

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.
countdynamic—Number of entries or units to process.
searchdynamic—The search input consumed by `memorySearch`.

View source

memsearch

function memsearch(data, count, search)

Implements the `memsearch` operation for `miniquake.common` (memsearch).

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.
countdynamic—Number of entries or units to process.
searchdynamic—The search input consumed by `memsearch`.

View source

memSet

function memSet(destination, fill, count)

MiniLang byte arrays replace Q_mem*'s untyped pointers. These functions preserve Quake's observable copy/fill/compare rules at offset zero.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
filldynamic—The fill input consumed by `memSet`.
countdynamic—Number of entries or units to process.

View source

parmValue

function parmValue(commandLine, name, fallback)

Return parm value derived from the active module state.

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `parmValue`.
namedynamic—Stable name that identifies the requested object or option.
fallbackdynamic—Value to use when the requested input is unavailable or invalid.

View source

parseToken

function parseToken(text, startOffset)

COM_Parse returns a pointer to the remaining source. Its MiniLang pendant returns [token, nextOffset, eof], retaining punctuation and comment rules.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
startOffsetdynamic—Zero-based offset of the requested data.

View source

plusValue

function plusValue(commandLine, commandName, fallback)

Return plus value derived from the active module state.

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `plusValue`.
commandNamedynamic—Name that identifies the requested value or resource.
fallbackdynamic—Value to use when the requested input is unavailable or invalid.

View source

punctuation

function punctuation(value)

Implements the `punctuation` operation for `miniquake.common` (punctuation).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `punctuation`.

View source

Q_atof

function Q_atof(text)

Provide the Quake-compatible atof entry point.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

Q_atoi

function Q_atoi(text)

Provide the Quake-compatible atoi entry point.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

Q_memcmp

function Q_memcmp(first, second, count)

Provide the Quake-compatible memcmp entry point.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `Q_memcmp`.
seconddynamic—The second input consumed by `Q_memcmp`.
countdynamic—Number of entries or units to process.

View source

Q_memcpy

function Q_memcpy(destination, source, count)

Provide the Quake-compatible memcpy entry point.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
sourcedynamic—Source value or collection to read.
countdynamic—Number of entries or units to process.

View source

Q_memset

function Q_memset(destination, fill, count)

Provide the Quake-compatible memset entry point.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
filldynamic—The fill input consumed by `Q_memset`.
countdynamic—Number of entries or units to process.

View source

Q_strcasecmp

function Q_strcasecmp(first, second)

Provide the Quake-compatible strcasecmp entry point.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `Q_strcasecmp`.
seconddynamic—The second input consumed by `Q_strcasecmp`.

View source

Q_strcat

function Q_strcat(destination, source)

Provide the Quake-compatible strcat entry point.

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
sourcedynamic—Source value or collection to read.

View source

Q_strcmp

function Q_strcmp(first, second)

Provide the Quake-compatible strcmp entry point.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `Q_strcmp`.
seconddynamic—The second input consumed by `Q_strcmp`.

View source

Q_strcpy

function Q_strcpy(source)

Provide the Quake-compatible strcpy entry point.

ParameterTypeDefaultDescription
sourcedynamic—Source value or collection to read.

View source

Q_strlen

function Q_strlen(text)

Provide the Quake-compatible strlen entry point.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

Q_strncasecmp

function Q_strncasecmp(first, second, count)

Provide the Quake-compatible strncasecmp entry point.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `Q_strncasecmp`.
seconddynamic—The second input consumed by `Q_strncasecmp`.
countdynamic—Number of entries or units to process.

View source

Q_strncmp

function Q_strncmp(first, second, count)

Provide the Quake-compatible strncmp entry point.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `Q_strncmp`.
seconddynamic—The second input consumed by `Q_strncmp`.
countdynamic—Number of entries or units to process.

View source

Q_strncpy

function Q_strncpy(source, count)

Provide the Quake-compatible strncpy entry point.

ParameterTypeDefaultDescription
sourcedynamic—Source value or collection to read.
countdynamic—Number of entries or units to process.

View source

Q_strrchr

function Q_strrchr(text, character)

Provide the Quake-compatible strrchr entry point.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
characterdynamic—The character input consumed by `Q_strrchr`.

View source

quakeFloat

function quakeFloat(value)

Original Q_atof returns C float even though it accumulates through a double. Make the return boundary explicit so MiniLang wider precision cannot leak.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `quakeFloat`.

View source

quakeInt32

function quakeInt32(value)

WinQuake Q_atoi stores all intermediate results in a signed 32-bit int. MSVC on the original target observes two's-complement wrapping here.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `quakeInt32`.

View source

quoteCommandArgument

function quoteCommandArgument(text)

Convert data for quote command argument.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

ShortNoSwap

function ShortNoSwap(value)

Convert byte order for short no swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `ShortNoSwap`.

View source

ShortSwap

function ShortSwap(value)

Convert byte order for short swap.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `ShortSwap`.

View source

signedShort

function signedShort(value)

Implements the `signedShort` operation for `miniquake.common` (signed short).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `signedShort`.

View source

skipPath

function skipPath(pathname)

Return skip path derived from the active module state.

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

startsWithMarker

function startsWithMarker(text, marker)

Initialize state for starts with marker.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
markerdynamic—The marker input consumed by `startsWithMarker`.

View source

stringCompare

function stringCompare(first, second)

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

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `stringCompare`.
seconddynamic—The second input consumed by `stringCompare`.

View source

stringCompareCount

function stringCompareCount(first, second, count)

Return string compare count derived from the active module state.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `stringCompareCount`.
seconddynamic—The second input consumed by `stringCompareCount`.
countdynamic—Number of entries or units to process.

View source

stringCompareInsensitive

function stringCompareInsensitive(first, second)

Implements the `stringCompareInsensitive` operation for `miniquake.common` (string compare insensitive).

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `stringCompareInsensitive`.
seconddynamic—The second input consumed by `stringCompareInsensitive`.

View source

stringCompareInsensitiveCount

function stringCompareInsensitiveCount(first, second, count)

Return string compare insensitive count derived from the active module state.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `stringCompareInsensitiveCount`.
seconddynamic—The second input consumed by `stringCompareInsensitiveCount`.
countdynamic—Number of entries or units to process.

View source

stringConcat

function stringConcat(destination, source)

Implements the `stringConcat` operation for `miniquake.common` (string concat).

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
sourcedynamic—Source value or collection to read.

View source

stringCopy

function stringCopy(text)

Implements the `stringCopy` operation for `miniquake.common` (string copy).

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

stringCopyCount

function stringCopyCount(text, count)

Return string copy count derived from the active module state.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
countdynamic—Number of entries or units to process.

View source

stringLastIndex

function stringLastIndex(text, character)

Return string last index derived from the active module state.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
characterdynamic—The character input consumed by `stringLastIndex`.

View source

stringLength

function stringLength(text)

Return string length derived from the active module state.

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.

View source

stripExtension

function stripExtension(pathname)

Convert extension into its canonical representation.

ParameterTypeDefaultDescription
pathnamedynamic—Name that identifies the requested value or resource.

View source

stuffCommands

function stuffCommands(commandLine)

Implements the `stuffCommands` operation for `miniquake.common` (stuff commands).

ParameterTypeDefaultDescription
commandLinedynamic—The command line input consumed by `stuffCommands`.

View source

substring

function substring(text, offset, count)

Implements the `substring` operation for `miniquake.common` (substring).

ParameterTypeDefaultDescription
textdynamic—Text to parse or process.
offsetdynamic—Zero-based offset of the requested data.
countdynamic—Number of entries or units to process.

View source

upperAscii

function upperAscii(value)

Convert data for upper ascii.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `upperAscii`.

View source

va

function va(format, arguments)

C va() is a transient 1024-byte vsprintf buffer. MiniLang strings are immutable, so callers pass the variadic values as an array and receive an owned string. This covers every conversion used by the MiniQuake target.

ParameterTypeDefaultDescription
formatdynamic—The format input consumed by `va`.
argumentsdynamic—Command-line arguments to inspect or execute.

View source