Copyright (c) 2022 Alex "Y_Less" Cole. Licensed under MPL 1.1
Indirection is a system for calling function pointers in a generic and type-safe way. Instead of CallLocalFunction
, Call
, defer
, Callback_Call
, or any other method, this gives one common interface which can be extended by library authors; utilising tags for compile-time parameters.
Indirect_Call(func, tag, ...)
Name | Info |
---|---|
func |
|
tag |
|
... |
{_,Bit,Text,Group,File,Float,Text3D} |
1 cells
Indirect_Claim_(func)
Name | Info |
---|---|
func |
The function pointer you want to use later. |
If a function pointer is used within one function, that is not a problem. However, if you want to store the function pointer for use later, you must first "claim" it, so that any associated data is not cleared when the parent function ends (i.e. the function that called your function). After use it must be released, and the number of claims must match the number of releases.
1 cells
Indirect_DePtr_(ptr)
Name | Info |
---|---|
ptr |
|
`` | The array to convert to an offset pointer. |
Strings and arrays are passed relative to COD
not DAT
so they can be distinguished from normal function pointers. This function does the offset.
1 cells
Indirect_FromCallback(cb, release)
Name | Info |
---|---|
cb |
F@_@ |
release |
bool |
A generic public wrapper for calling inline functions.
public
5 cells
Indirect_GetMetaBool(index, &ret)
Name | Info |
---|---|
index |
|
ret |
bool & |
bool:
Get boolean metadata.
1 cells
Indirect_GetMetaFloat(index, &ret)
Name | Info |
---|---|
index |
|
ret |
Float & |
bool:
Get float metadata.
1 cells
Indirect_GetMetaInt(index, &ret)
Name | Info |
---|---|
index |
|
ret |
& |
bool:
Get integer metadata.
1 cells
Indirect_GetMetaRef(index, &ret)
Name | Info |
---|---|
index |
|
ret |
& |
bool:
Get ref metadata.
1 cells
Indirect_GetMetaString(index, dest[], size)
Name | Info |
---|---|
index |
|
dest |
[] |
size |
bool:
Get ref metadata.
5 cells
Indirect_Init()
Get the size of the COD AMX segment.
21 cells
Indirect_Memcpy(dest[], source, index, numbytes, maxlength)
Name | Info |
---|---|
dest |
[] |
source |
|
index |
|
numbytes |
|
maxlength |
native
Indirect_SetMetaRef(index, val)
Name | Info |
---|---|
index |
|
val |
bool:
Set ref metadata.
1 cells
Indirect_Strcat(dest[], source, maxlength)
Name | Info |
---|---|
dest |
[] |
source |
|
maxlength |
native
Indirect_Tag(id, dest[])
Name | Info |
---|---|
id |
The ID of the tag to get the specifiers from the name of. |
dest |
[32] Where to store the name. |
Functions are tagged with a special tag containing their specifiers. Get the string value of that tag from the AMX header.
6 cells
OnScriptInit@C()
public
3 cells
OnScriptInit@E()
public
3 cells
ScriptInit_OnJITCompile()
public
_ALS
3 cells