Package org.lwjgl.system
Class APIUtil
java.lang.Object
org.lwjgl.system.APIUtil
Utility class useful to API bindings. [INTERNAL USE ONLY]
Method names in this class are prefixed with api to avoid ambiguities when used with static imports.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA data class for API versioning information.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrintStreamThePrintStreamused by LWJGL to print debug information and non-fatal errors. -
Method Summary
Modifier and TypeMethodDescriptionstatic longapiArray(MemoryStack stack, long... addresses) Stores the specified array of pointer addresses on the specifiedMemoryStack.static longapiArray(MemoryStack stack, ByteBuffer... buffers) Stores the addresses of the specified array of buffers on the specifiedMemoryStack.static longapiArray(MemoryStack stack, APIUtil.Encoder encoder, CharSequence... strings) Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack.static voidapiArrayFree(long pointers, int length) Frees the specified array of pointers.static longapiArrayi(MemoryStack stack, APIUtil.Encoder encoder, CharSequence... strings) Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack.static longapiArrayp(MemoryStack stack, ByteBuffer... buffers) Stores the addresses of the specified array of buffers on the specifiedMemoryStack.static longapiArrayp(MemoryStack stack, APIUtil.Encoder encoder, CharSequence... strings) Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack.static longapiCheckAllocation(int elements, long bytes, long maxBytes) apiClassTokens(@Nullable BiPredicate<Field, Integer> filter, @Nullable Map<Integer, String> target, Class<?>... tokenClasses) Returns a map of public static final integer fields in the specified classes, to their String representations.static voidapiClosureRet(long ret, boolean __result) static voidapiClosureRet(long ret, byte __result) static voidapiClosureRet(long ret, double __result) static voidapiClosureRet(long ret, float __result) static voidapiClosureRet(long ret, int __result) static voidapiClosureRet(long ret, short __result) static voidapiClosureRetL(long ret, long __result) static voidapiClosureRetP(long ret, long __result) static FFITypeapiCreateArray(FFIType type, int length) static FFICIFapiCreateCIF(int abi, FFIType rtype, FFIType... atypes) Allocates and prepares a libffi CIF.static FFICIFapiCreateCIF(FFIType rtype, FFIType... atypes) Allocates and prepares a libffi CIF using the default ABI.static FFICIFapiCreateCIFVar(int abi, int nfixedargs, FFIType rtype, FFIType... atypes) Allocates and prepares a libffi var CIF.static FFICIFapiCreateCIFVar(int nfixedargs, FFIType rtype, FFIType... atypes) Allocates and prepares a libffi var CIF using the default ABI.static SharedLibraryapiCreateLibrary(String name) static FFITypeapiCreateStruct(FFIType... members) static FFITypeapiCreateUnion(FFIType... members) static voidapiFilterExtensions(Set<String> extensions, Configuration<Object> option) static StringapiFindLibrary(String start, String name) static longapiGetBytes(int elements, int elementShift) static longapiGetFunctionAddress(FunctionProvider provider, String functionName) static longapiGetFunctionAddressOptional(SharedLibrary library, String functionName) static @Nullable ByteBufferapiGetMappedBuffer(@Nullable ByteBuffer buffer, long mappedAddress, int capacity) static voidapiLog(CharSequence msg) Prints the specified message to theDEBUG_STREAMifChecks.DEBUGis true.static voidapiLogMissing(String api, ByteBuffer functionName) static voidapiLogMore(CharSequence msg) Same asapiLog(java.lang.CharSequence), but replaces the LWJGL prefix with a tab character.static APIUtil.APIVersionapiParseVersion(String version) Parses a version string.static @Nullable APIUtil.APIVersionapiParseVersion(Configuration<?> option) Returns theAPIUtil.APIVersionvalue of the specified option.static intstatic StringapiUnknownToken(int token) static StringapiUnknownToken(String description, int token)
-
Field Details
-
DEBUG_STREAM
ThePrintStreamused by LWJGL to print debug information and non-fatal errors. Defaults toSystem.errwhich can be changed withConfiguration.DEBUG_STREAM.
-
-
Method Details
-
apiLog
Prints the specified message to theDEBUG_STREAMifChecks.DEBUGis true.- Parameters:
msg- the message to print
-
apiLogMore
Same asapiLog(java.lang.CharSequence), but replaces the LWJGL prefix with a tab character.- Parameters:
msg- the message to print, in continuation of a previous message
-
apiLogMissing
-
apiFindLibrary
-
apiCreateLibrary
-
apiGetFunctionAddress
-
apiGetMappedBuffer
public static @Nullable ByteBuffer apiGetMappedBuffer(@Nullable ByteBuffer buffer, long mappedAddress, int capacity) -
apiGetBytes
public static long apiGetBytes(int elements, int elementShift) -
apiCheckAllocation
public static long apiCheckAllocation(int elements, long bytes, long maxBytes) -
apiParseVersion
Returns theAPIUtil.APIVersionvalue of the specified option.- Parameters:
option- the option to query
-
apiParseVersion
Parses a version string.The version string must have the format
PREFIX MAJOR.MINOR.REVISION IMPL, wherePREFIXis a prefix without digits (string, optional),MAJORis the major version (integer),MINORis the minor version (integer),REVISIONis the revision version (string, optional) andIMPLis implementation-specific information (string, optional).- Parameters:
version- the version string- Returns:
- the parsed
APIUtil.APIVersion
-
apiFilterExtensions
-
apiUnknownToken
-
apiUnknownToken
-
apiClassTokens
public static Map<Integer,String> apiClassTokens(@Nullable BiPredicate<Field, Integer> filter, @Nullable Map<Integer, String> target, Class<?>... tokenClasses) Returns a map of public static final integer fields in the specified classes, to their String representations. An optional filter can be specified to only include specific fields. The target map may be null, in which case a new map is allocated and returned.This method is useful when debugging to quickly identify values returned from an API.
- Parameters:
filter- the filter to use (optional)target- the target map (optional)tokenClasses- the classes to get tokens from- Returns:
- the token map
-
apiArray
Stores the specified array of pointer addresses on the specifiedMemoryStack.- Parameters:
stack- the stack to useaddresses- the pointer addresses to store- Returns:
- the pointer array address on the stack
-
apiArray
Stores the addresses of the specified array of buffers on the specifiedMemoryStack.- Parameters:
stack- the stack to usebuffers- the buffers to store- Returns:
- the pointer array address on the stack
-
apiArrayp
Stores the addresses of the specified array of buffers on the specifiedMemoryStack. A second array that contains the buffer remaining bytes is stored immediately after the pointer array. Length values are pointer-sized integers.- Parameters:
stack- the stack to usebuffers- the buffers to store- Returns:
- the pointer array address on the stack
-
apiArray
Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack. The encoded strings include null-termination.- Parameters:
stack- the stack to useencoder- the encoder to usestrings- the strings to encode- Returns:
- the pointer array address on the stack
-
apiArrayi
Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack. A second array that contains the string lengths is stored immediately after the pointer array. Length values are 4-byte integers.The encoded buffers must be freed with
apiArrayFree(long, int).- Parameters:
stack- the stack to useencoder- the encoder to usestrings- the strings to encode- Returns:
- the pointer array address on the stack
-
apiArrayp
Encodes the specified strings with the specifiedAPIUtil.Encoderand stores an array of pointers to the encoded data on the specifiedMemoryStack. A second array that contains the string lengths is stored immediately after the pointer array. Length values are pointer-sized integers.The encoded buffers must be freed with
apiArrayFree(long, int).- Parameters:
stack- the stack to useencoder- the encoder to usestrings- the strings to encode- Returns:
- the pointer array address on the stack
-
apiArrayFree
public static void apiArrayFree(long pointers, int length) Frees the specified array of pointers.- Parameters:
pointers- the pointer array to freelength- the pointer array length
-
apiCreateStruct
-
apiCreateUnion
-
apiCreateArray
-
apiCreateCIF
Allocates and prepares a libffi CIF using the default ABI. -
apiCreateCIF
Allocates and prepares a libffi CIF. -
apiCreateCIFVar
Allocates and prepares a libffi var CIF using the default ABI. -
apiCreateCIFVar
Allocates and prepares a libffi var CIF. -
apiStdcall
public static int apiStdcall() -
apiClosureRet
public static void apiClosureRet(long ret, boolean __result) -
apiClosureRet
public static void apiClosureRet(long ret, byte __result) -
apiClosureRet
public static void apiClosureRet(long ret, short __result) -
apiClosureRet
public static void apiClosureRet(long ret, int __result) -
apiClosureRetL
public static void apiClosureRetL(long ret, long __result) -
apiClosureRetP
public static void apiClosureRetP(long ret, long __result) -
apiClosureRet
public static void apiClosureRet(long ret, float __result) -
apiClosureRet
public static void apiClosureRet(long ret, double __result)
-