allocator interface (first pass)
This commit is contained in:
+27
-27
@@ -46,7 +46,7 @@ Rectangle :: c_struct {
|
||||
height c_float
|
||||
}
|
||||
Image :: c_struct {
|
||||
data ?*mut void
|
||||
data ?*mut anyopaque
|
||||
width c_int
|
||||
height c_int
|
||||
mipmaps c_int
|
||||
@@ -179,10 +179,10 @@ Wave :: c_struct {
|
||||
sampleRate c_uint
|
||||
sampleSize c_uint
|
||||
channels c_uint
|
||||
data ?*mut void
|
||||
data ?*mut anyopaque
|
||||
}
|
||||
rAudioBuffer :: c_struct
|
||||
rAudioProcessor :: c_struct
|
||||
rAudioBuffer :: opaque
|
||||
rAudioProcessor :: opaque
|
||||
AudioStream :: c_struct {
|
||||
buffer ?*mut rAudioBuffer
|
||||
processor ?*mut rAudioProcessor
|
||||
@@ -199,7 +199,7 @@ Music :: c_struct {
|
||||
frameCount c_uint
|
||||
looping bool
|
||||
ctxType c_int
|
||||
ctxData ?*mut void
|
||||
ctxData ?*mut anyopaque
|
||||
}
|
||||
VrDeviceInfo :: c_struct {
|
||||
hResolution c_int
|
||||
@@ -268,10 +268,10 @@ CameraProjection :: alias c_uint
|
||||
NPatchLayout :: alias c_uint
|
||||
TraceLogCallback :: alias ?*c_func(_ c_int, _ ?*c_char, _ ?*mut c_char) void
|
||||
LoadFileDataCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut c_int) ?*mut c_uchar
|
||||
SaveFileDataCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut void, _ c_int) bool
|
||||
SaveFileDataCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut anyopaque, _ c_int) bool
|
||||
LoadFileTextCallback :: alias ?*c_func(_ ?*c_char) ?*mut c_char
|
||||
SaveFileTextCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut c_char) bool
|
||||
AudioCallback :: alias ?*c_func(_ ?*mut void, _ c_uint) void
|
||||
AudioCallback :: alias ?*c_func(_ ?*mut anyopaque, _ c_uint) void
|
||||
|
||||
RAYLIB_VERSION_MAJOR c_int :: 5
|
||||
RAYLIB_VERSION_MINOR c_int :: 5
|
||||
@@ -634,7 +634,7 @@ SetWindowMaxSize c_func(width c_int, height c_int) void
|
||||
SetWindowSize c_func(width c_int, height c_int) void
|
||||
SetWindowOpacity c_func(opacity c_float) void
|
||||
SetWindowFocused c_func() void
|
||||
GetWindowHandle c_func() ?*mut void
|
||||
GetWindowHandle c_func() ?*mut anyopaque
|
||||
GetScreenWidth c_func() c_int
|
||||
GetScreenHeight c_func() c_int
|
||||
GetRenderWidth c_func() c_int
|
||||
@@ -685,8 +685,8 @@ LoadShaderFromMemory c_func(vsCode ?*c_char, fsCode ?*c_char) Shader
|
||||
IsShaderValid c_func(shader Shader) bool
|
||||
GetShaderLocation c_func(shader Shader, uniformName ?*c_char) c_int
|
||||
GetShaderLocationAttrib c_func(shader Shader, attribName ?*c_char) c_int
|
||||
SetShaderValue c_func(shader Shader, locIndex c_int, value ?*void, uniformType c_int) void
|
||||
SetShaderValueV c_func(shader Shader, locIndex c_int, value ?*void, uniformType c_int, count c_int) void
|
||||
SetShaderValue c_func(shader Shader, locIndex c_int, value ?*anyopaque, uniformType c_int) void
|
||||
SetShaderValueV c_func(shader Shader, locIndex c_int, value ?*anyopaque, uniformType c_int, count c_int) void
|
||||
SetShaderValueMatrix c_func(shader Shader, locIndex c_int, mat Matrix) void
|
||||
SetShaderValueTexture c_func(shader Shader, locIndex c_int, texture Texture) void
|
||||
UnloadShader c_func(shader Shader) void
|
||||
@@ -714,17 +714,17 @@ SetConfigFlags c_func(flags c_uint) void
|
||||
OpenURL c_func(url ?*c_char) void
|
||||
TraceLog c_func(logLevel c_int, text ?*c_char, ...) void
|
||||
SetTraceLogLevel c_func(logLevel c_int) void
|
||||
MemAlloc c_func(size c_uint) ?*mut void
|
||||
MemRealloc c_func(ptr ?*mut void, size c_uint) ?*mut void
|
||||
MemFree c_func(ptr ?*mut void) void
|
||||
MemAlloc c_func(size c_uint) ?*mut anyopaque
|
||||
MemRealloc c_func(ptr ?*mut anyopaque, size c_uint) ?*mut anyopaque
|
||||
MemFree c_func(ptr ?*mut anyopaque) void
|
||||
SetTraceLogCallback c_func(callback ?*c_func(_ c_int, _ ?*c_char, _ ?*mut c_char) void) void
|
||||
SetLoadFileDataCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut c_int) ?*mut c_uchar) void
|
||||
SetSaveFileDataCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut void, _ c_int) bool) void
|
||||
SetSaveFileDataCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut anyopaque, _ c_int) bool) void
|
||||
SetLoadFileTextCallback c_func(callback ?*c_func(_ ?*c_char) ?*mut c_char) void
|
||||
SetSaveFileTextCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut c_char) bool) void
|
||||
LoadFileData c_func(fileName ?*c_char, dataSize ?*mut c_int) ?*mut c_uchar
|
||||
UnloadFileData c_func(data ?*mut c_uchar) void
|
||||
SaveFileData c_func(fileName ?*c_char, data ?*mut void, dataSize c_int) bool
|
||||
SaveFileData c_func(fileName ?*c_char, data ?*mut anyopaque, dataSize c_int) bool
|
||||
ExportDataAsCode c_func(data ?*c_uchar, dataSize c_int, fileName ?*c_char) bool
|
||||
LoadFileText c_func(fileName ?*c_char) ?*mut c_char
|
||||
UnloadFileText c_func(text ?*mut c_char) void
|
||||
@@ -967,8 +967,8 @@ IsTextureValid c_func(texture Texture) bool
|
||||
UnloadTexture c_func(texture Texture) void
|
||||
IsRenderTextureValid c_func(target RenderTexture) bool
|
||||
UnloadRenderTexture c_func(target RenderTexture) void
|
||||
UpdateTexture c_func(texture Texture, pixels ?*void) void
|
||||
UpdateTextureRec c_func(texture Texture, rec Rectangle, pixels ?*void) void
|
||||
UpdateTexture c_func(texture Texture, pixels ?*anyopaque) void
|
||||
UpdateTextureRec c_func(texture Texture, rec Rectangle, pixels ?*anyopaque) void
|
||||
GenTextureMipmaps c_func(texture ?*mut Texture) void
|
||||
SetTextureFilter c_func(texture Texture, filter c_int) void
|
||||
SetTextureWrap c_func(texture Texture, wrap c_int) void
|
||||
@@ -992,8 +992,8 @@ ColorAlpha c_func(color Color, alpha c_float) Color
|
||||
ColorAlphaBlend c_func(dst Color, src Color, tint Color) Color
|
||||
ColorLerp c_func(color1 Color, color2 Color, factor c_float) Color
|
||||
GetColor c_func(hexValue c_uint) Color
|
||||
GetPixelColor c_func(srcPtr ?*mut void, format c_int) Color
|
||||
SetPixelColor c_func(dstPtr ?*mut void, color Color, format c_int) void
|
||||
GetPixelColor c_func(srcPtr ?*mut anyopaque, format c_int) Color
|
||||
SetPixelColor c_func(dstPtr ?*mut anyopaque, color Color, format c_int) void
|
||||
GetPixelDataSize c_func(width c_int, height c_int, format c_int) c_int
|
||||
GetFontDefault c_func() Font
|
||||
LoadFont c_func(fileName ?*c_char) Font
|
||||
@@ -1082,7 +1082,7 @@ DrawBillboard c_func(camera Camera3D, texture Texture, position Vector3, scale c
|
||||
DrawBillboardRec c_func(camera Camera3D, texture Texture, source Rectangle, position Vector3, size Vector2, tint Color) void
|
||||
DrawBillboardPro c_func(camera Camera3D, texture Texture, source Rectangle, position Vector3, up Vector3, size Vector2, origin Vector2, rotation c_float, tint Color) void
|
||||
UploadMesh c_func(mesh ?*mut Mesh, dynamic bool) void
|
||||
UpdateMeshBuffer c_func(mesh Mesh, index c_int, data ?*void, dataSize c_int, offset c_int) void
|
||||
UpdateMeshBuffer c_func(mesh Mesh, index c_int, data ?*anyopaque, dataSize c_int, offset c_int) void
|
||||
UnloadMesh c_func(mesh Mesh) void
|
||||
DrawMesh c_func(mesh Mesh, material Material, transform Matrix) void
|
||||
DrawMeshInstanced c_func(mesh Mesh, material Material, transforms ?*Matrix, instances c_int) void
|
||||
@@ -1133,7 +1133,7 @@ LoadSound c_func(fileName ?*c_char) Sound
|
||||
LoadSoundFromWave c_func(wave Wave) Sound
|
||||
LoadSoundAlias c_func(source Sound) Sound
|
||||
IsSoundValid c_func(sound Sound) bool
|
||||
UpdateSound c_func(sound Sound, data ?*void, sampleCount c_int) void
|
||||
UpdateSound c_func(sound Sound, data ?*anyopaque, sampleCount c_int) void
|
||||
UnloadWave c_func(wave Wave) void
|
||||
UnloadSound c_func(sound Sound) void
|
||||
UnloadSoundAlias c_func(_ Sound) void
|
||||
@@ -1171,7 +1171,7 @@ GetMusicTimePlayed c_func(music Music) c_float
|
||||
LoadAudioStream c_func(sampleRate c_uint, sampleSize c_uint, channels c_uint) AudioStream
|
||||
IsAudioStreamValid c_func(stream AudioStream) bool
|
||||
UnloadAudioStream c_func(stream AudioStream) void
|
||||
UpdateAudioStream c_func(stream AudioStream, data ?*void, frameCount c_int) void
|
||||
UpdateAudioStream c_func(stream AudioStream, data ?*anyopaque, frameCount c_int) void
|
||||
IsAudioStreamProcessed c_func(stream AudioStream) bool
|
||||
PlayAudioStream c_func(stream AudioStream) void
|
||||
PauseAudioStream c_func(stream AudioStream) void
|
||||
@@ -1182,11 +1182,11 @@ SetAudioStreamVolume c_func(stream AudioStream, volume c_float) void
|
||||
SetAudioStreamPitch c_func(stream AudioStream, pitch c_float) void
|
||||
SetAudioStreamPan c_func(stream AudioStream, pan c_float) void
|
||||
SetAudioStreamBufferSizeDefault c_func(size c_int) void
|
||||
SetAudioStreamCallback c_func(stream AudioStream, callback ?*c_func(_ ?*mut void, _ c_uint) void) void
|
||||
AttachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut void, _ c_uint) void) void
|
||||
DetachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut void, _ c_uint) void) void
|
||||
AttachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut void, _ c_uint) void) void
|
||||
DetachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut void, _ c_uint) void) void
|
||||
SetAudioStreamCallback c_func(stream AudioStream, callback ?*c_func(_ ?*mut anyopaque, _ c_uint) void) void
|
||||
AttachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut anyopaque, _ c_uint) void) void
|
||||
DetachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut anyopaque, _ c_uint) void) void
|
||||
AttachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut anyopaque, _ c_uint) void) void
|
||||
DetachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut anyopaque, _ c_uint) void) void
|
||||
|
||||
# unsupported in bindings: RAYLIB_H — C macro has no replacement value
|
||||
# unsupported in bindings: _VA_LIST — C macro has no replacement value
|
||||
|
||||
@@ -78,11 +78,11 @@ increment func(value i32) i32 {
|
||||
return value + 1
|
||||
}
|
||||
|
||||
call_native func(callback *func(value i32) i32, value i32) i32 {
|
||||
call_native func(callback @func(value i32) i32, value i32) i32 {
|
||||
return callback(value)
|
||||
}
|
||||
|
||||
call_fallible func(callback *func(flag bool) i32 ! Error, flag bool) i32 ! Error {
|
||||
call_fallible func(callback @func(flag bool) i32 ! Error, flag bool) i32 ! Error {
|
||||
return try callback(flag)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
mem :: import "@std/mem"
|
||||
|
||||
main func() i32 {
|
||||
memory ?*mut u8 = mem.alloc(mem.heap, 4, 1)
|
||||
defer mem.free(mem.heap, memory, 4, 1)
|
||||
|
||||
if memory |bytes| {
|
||||
bytes[0] = 10
|
||||
bytes[1] = 20
|
||||
bytes[2] = bytes[0] + bytes[1]
|
||||
|
||||
if (bytes[2] != 30) {
|
||||
return 2
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user