Files
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.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# atoi
function atoi(text)
Implements the `atoi` operation for `miniquake.common` (atoi).
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# baseDirectory
function baseDirectory(commandLine)
Implements the `baseDirectory` operation for `miniquake.common` (base directory).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# checkParm
function checkParm(commandLine, name)
Validate parm and report any incompatibility.
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `checkParm`. |
name | dynamic | — | Stable name that identifies the requested object or option. |
View source
# ClearLink
function ClearLink(link)
Original WinQuake/common.c entry points. The engine uses the descriptive MiniLang names above internally; these aliases keep the source-file pendant explicit and make one-to-one differential fixtures readable.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `ClearLink`. |
View source
# clearLink
function clearLink(link)
Update module state for link.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `clearLink`. |
View source
# COM_CheckParm
function COM_CheckParm(commandLine, name)
Mirror Quake's COM_CheckParm routine and its observable state changes.
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `COM_CheckParm`. |
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
extension | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
basedir | dynamic | — | The basedir input consumed by `COM_Init`. |
arguments | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
arguments | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
startOffset | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
View source
# create
function create(args)
Implements the `create` operation for `miniquake.common` (create).
| Parameter | Type | Default | Description |
|---|
args | dynamic | — | Command-line arguments supplied by the host process. |
View source
# defaultExtension
function defaultExtension(pathname, extension)
Implements the `defaultExtension` operation for `miniquake.common` (default extension).
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
extension | dynamic | — | The extension input consumed by `defaultExtension`. |
View source
# describe
function describe(commandLine)
Implements the `describe` operation for `miniquake.common` (describe).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `describe`. |
View source
# fileBase
function fileBase(pathname)
Implements the `fileBase` operation for `miniquake.common` (file base).
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
View source
# fileExtension
function fileExtension(pathname)
Implements the `fileExtension` operation for `miniquake.common` (file extension).
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
View source
# fixedFloat
function fixedFloat(value)
Implements the `fixedFloat` operation for `miniquake.common` (fixed float).
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `fixedFloat`. |
View source
# FloatNoSwap
function FloatNoSwap(value)
Convert byte order for float no swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `FloatNoSwap`. |
View source
# floatOption
function floatOption(commandLine, name, fallback)
Implements the `floatOption` operation for `miniquake.common` (float option).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `floatOption`. |
name | dynamic | — | Stable name that identifies the requested object or option. |
fallback | dynamic | — | Value to use when the requested input is unavailable or invalid. |
View source
# FloatSwap
function FloatSwap(value)
Convert byte order for float swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `FloatSwap`. |
View source
# formatFlag
function formatFlag(value)
Format and emit flag.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `formatFlag`. |
View source
# gameDirectory
function gameDirectory(commandLine)
Implements the `gameDirectory` operation for `miniquake.common` (game directory).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `gameDirectory`. |
View source
# hasParm
function hasParm(commandLine, name)
Report whether parm.
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `hasParm`. |
name | dynamic | — | Stable name that identifies the requested object or option. |
View source
# hexadecimal
function hexadecimal(value, upper)
Implements the `hexadecimal` operation for `miniquake.common` (hexadecimal).
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `hexadecimal`. |
upper | dynamic | — | The upper input consumed by `hexadecimal`. |
View source
# hexDigit
function hexDigit(value)
Implements the `hexDigit` operation for `miniquake.common` (hex digit).
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `hexDigit`. |
View source
# InsertLinkAfter
function InsertLinkAfter(link, after)
Add state for insert link after.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `InsertLinkAfter`. |
after | dynamic | — | The after input consumed by `InsertLinkAfter`. |
View source
# insertLinkAfter
function insertLinkAfter(link, after)
Add state for insert link after.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `insertLinkAfter`. |
after | dynamic | — | The after input consumed by `insertLinkAfter`. |
View source
# InsertLinkBefore
function InsertLinkBefore(link, before)
Add state for insert link before.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `InsertLinkBefore`. |
before | dynamic | — | The before input consumed by `InsertLinkBefore`. |
View source
# insertLinkBefore
function insertLinkBefore(link, before)
Add state for insert link before.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `insertLinkBefore`. |
before | dynamic | — | The before input consumed by `insertLinkBefore`. |
View source
# integerOption
function integerOption(commandLine, name, fallback)
Implements the `integerOption` operation for `miniquake.common` (integer option).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `integerOption`. |
name | dynamic | — | Stable name that identifies the requested object or option. |
fallback | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
args | dynamic | — | Command-line arguments supplied by the host process. |
View source
# LongNoSwap
function LongNoSwap(value)
Convert byte order for long no swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `LongNoSwap`. |
View source
# LongSwap
function LongSwap(value)
Convert byte order for long swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `LongSwap`. |
View source
# memCompare
function memCompare(first, second, count)
Implements the `memCompare` operation for `miniquake.common` (mem compare).
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `memCompare`. |
second | dynamic | — | The second input consumed by `memCompare`. |
count | dynamic | — | Number of entries or units to process. |
View source
# memCopy
function memCopy(destination, source, count)
Implements the `memCopy` operation for `miniquake.common` (mem copy).
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
source | dynamic | — | Source value or collection to read. |
count | dynamic | — | Number of entries or units to process. |
View source
# memorySearch
function memorySearch(data, count, search)
Implements the `memorySearch` operation for `miniquake.common` (memory search).
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Input data consumed by the operation. |
count | dynamic | — | Number of entries or units to process. |
search | dynamic | — | The search input consumed by `memorySearch`. |
View source
# memsearch
function memsearch(data, count, search)
Implements the `memsearch` operation for `miniquake.common` (memsearch).
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Input data consumed by the operation. |
count | dynamic | — | Number of entries or units to process. |
search | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
fill | dynamic | — | The fill input consumed by `memSet`. |
count | dynamic | — | Number of entries or units to process. |
View source
# parmValue
function parmValue(commandLine, name, fallback)
Return parm value derived from the active module state.
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `parmValue`. |
name | dynamic | — | Stable name that identifies the requested object or option. |
fallback | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
startOffset | dynamic | — | Zero-based offset of the requested data. |
View source
# plusValue
function plusValue(commandLine, commandName, fallback)
Return plus value derived from the active module state.
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `plusValue`. |
commandName | dynamic | — | Name that identifies the requested value or resource. |
fallback | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `punctuation`. |
View source
# Q_atof
function Q_atof(text)
Provide the Quake-compatible atof entry point.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# Q_atoi
function Q_atoi(text)
Provide the Quake-compatible atoi entry point.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# Q_memcmp
function Q_memcmp(first, second, count)
Provide the Quake-compatible memcmp entry point.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `Q_memcmp`. |
second | dynamic | — | The second input consumed by `Q_memcmp`. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_memcpy
function Q_memcpy(destination, source, count)
Provide the Quake-compatible memcpy entry point.
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
source | dynamic | — | Source value or collection to read. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_memset
function Q_memset(destination, fill, count)
Provide the Quake-compatible memset entry point.
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
fill | dynamic | — | The fill input consumed by `Q_memset`. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_strcasecmp
function Q_strcasecmp(first, second)
Provide the Quake-compatible strcasecmp entry point.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `Q_strcasecmp`. |
second | dynamic | — | The second input consumed by `Q_strcasecmp`. |
View source
# Q_strcat
function Q_strcat(destination, source)
Provide the Quake-compatible strcat entry point.
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
source | dynamic | — | Source value or collection to read. |
View source
# Q_strcmp
function Q_strcmp(first, second)
Provide the Quake-compatible strcmp entry point.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `Q_strcmp`. |
second | dynamic | — | The second input consumed by `Q_strcmp`. |
View source
# Q_strcpy
function Q_strcpy(source)
Provide the Quake-compatible strcpy entry point.
| Parameter | Type | Default | Description |
|---|
source | dynamic | — | Source value or collection to read. |
View source
# Q_strlen
function Q_strlen(text)
Provide the Quake-compatible strlen entry point.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# Q_strncasecmp
function Q_strncasecmp(first, second, count)
Provide the Quake-compatible strncasecmp entry point.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `Q_strncasecmp`. |
second | dynamic | — | The second input consumed by `Q_strncasecmp`. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_strncmp
function Q_strncmp(first, second, count)
Provide the Quake-compatible strncmp entry point.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `Q_strncmp`. |
second | dynamic | — | The second input consumed by `Q_strncmp`. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_strncpy
function Q_strncpy(source, count)
Provide the Quake-compatible strncpy entry point.
| Parameter | Type | Default | Description |
|---|
source | dynamic | — | Source value or collection to read. |
count | dynamic | — | Number of entries or units to process. |
View source
# Q_strrchr
function Q_strrchr(text, character)
Provide the Quake-compatible strrchr entry point.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
character | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `quakeInt32`. |
View source
# quoteCommandArgument
function quoteCommandArgument(text)
Convert data for quote command argument.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# RemoveLink
function RemoveLink(link)
Release state for remove link.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `RemoveLink`. |
View source
# removeLink
function removeLink(link)
Release state for remove link.
| Parameter | Type | Default | Description |
|---|
link | dynamic | — | The link input consumed by `removeLink`. |
View source
# ShortNoSwap
function ShortNoSwap(value)
Convert byte order for short no swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `ShortNoSwap`. |
View source
# ShortSwap
function ShortSwap(value)
Convert byte order for short swap.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `ShortSwap`. |
View source
# signedShort
function signedShort(value)
Implements the `signedShort` operation for `miniquake.common` (signed short).
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed by `signedShort`. |
View source
# skipPath
function skipPath(pathname)
Return skip path derived from the active module state.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
View source
# startsWithMarker
function startsWithMarker(text, marker)
Initialize state for starts with marker.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
marker | dynamic | — | The marker input consumed by `startsWithMarker`. |
View source
# stringCompare
function stringCompare(first, second)
Implements the `stringCompare` operation for `miniquake.common` (string compare).
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `stringCompare`. |
second | dynamic | — | The second input consumed by `stringCompare`. |
View source
# stringCompareCount
function stringCompareCount(first, second, count)
Return string compare count derived from the active module state.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `stringCompareCount`. |
second | dynamic | — | The second input consumed by `stringCompareCount`. |
count | dynamic | — | Number of entries or units to process. |
View source
# stringCompareInsensitive
function stringCompareInsensitive(first, second)
Implements the `stringCompareInsensitive` operation for `miniquake.common` (string compare insensitive).
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `stringCompareInsensitive`. |
second | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | The first input consumed by `stringCompareInsensitiveCount`. |
second | dynamic | — | The second input consumed by `stringCompareInsensitiveCount`. |
count | dynamic | — | Number of entries or units to process. |
View source
# stringConcat
function stringConcat(destination, source)
Implements the `stringConcat` operation for `miniquake.common` (string concat).
| Parameter | Type | Default | Description |
|---|
destination | dynamic | — | Destination value or collection to update. |
source | dynamic | — | Source value or collection to read. |
View source
# stringCopy
function stringCopy(text)
Implements the `stringCopy` operation for `miniquake.common` (string copy).
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# stringCopyCount
function stringCopyCount(text, count)
Return string copy count derived from the active module state.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
count | dynamic | — | Number of entries or units to process. |
View source
# stringLastIndex
function stringLastIndex(text, character)
Return string last index derived from the active module state.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
character | dynamic | — | The character input consumed by `stringLastIndex`. |
View source
# stringLength
function stringLength(text)
Return string length derived from the active module state.
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
View source
# stripExtension
function stripExtension(pathname)
Convert extension into its canonical representation.
| Parameter | Type | Default | Description |
|---|
pathname | dynamic | — | Name that identifies the requested value or resource. |
View source
# stuffCommands
function stuffCommands(commandLine)
Implements the `stuffCommands` operation for `miniquake.common` (stuff commands).
| Parameter | Type | Default | Description |
|---|
commandLine | dynamic | — | The command line input consumed by `stuffCommands`. |
View source
# substring
function substring(text, offset, count)
Implements the `substring` operation for `miniquake.common` (substring).
| Parameter | Type | Default | Description |
|---|
text | dynamic | — | Text to parse or process. |
offset | dynamic | — | Zero-based offset of the requested data. |
count | dynamic | — | Number of entries or units to process. |
View source
# upperAscii
function upperAscii(value)
Convert data for upper ascii.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
format | dynamic | — | The format input consumed by `va`. |
arguments | dynamic | — | Command-line arguments to inspect or execute. |
View source