Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,23 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
// FutureBasic function
|
||||
local fn Query( buffer as ptr, size as ^unsigned long ) as long
|
||||
CFStringRef string = @"Here am I"
|
||||
ptr p = fn StringCStringUsingEncoding( string, NSASCIIStringEncoding )
|
||||
*size = len(string)
|
||||
BlockMoveData( p, buffer, *size )
|
||||
end fn = 1
|
||||
|
||||
|
||||
// C code
|
||||
BeginCCode
|
||||
char buffer[1024];
|
||||
size_t Size = sizeof(buffer);
|
||||
if ( Query( buffer, &Size ) == 0 ) { // call FutureBasic function
|
||||
NSLog(@"failed to call Query\n");
|
||||
} else {
|
||||
NSLog(@"%s",buffer);
|
||||
}
|
||||
EndC
|
||||
|
||||
HandleEvents
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
const std = @import("std");
|
||||
|
||||
export fn Query(Data: [*c]u8, Length: *usize) callconv(.C) c_int {
|
||||
export fn Query(data: [*c]u8, length: *usize) callconv(.C) c_int {
|
||||
const value = "Here I am";
|
||||
|
||||
if (Length.* >= value.len) {
|
||||
@memcpy(@ptrCast([*]u8, Data), value, value.len);
|
||||
Length.* = value.len;
|
||||
if (length.* >= value.len) {
|
||||
@memcpy(data[0..value.len], value);
|
||||
length.* = value.len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue