forked from libffi/libffi
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
708 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"build.zig.zon", | ||
"fficonfig.zig.h", | ||
"include", | ||
"lib", | ||
"src", | ||
}, | ||
.dependencies = .{}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const builtin = @import("builtin"); | ||
|
||
const ffi = @import("ffi.zig"); | ||
const default = @import("default.zig"); | ||
|
||
pub const have_complex_type = builtin.os.tag != .windows; | ||
|
||
const arg_longlong = builtin.cpu.arch == .aarch64_32 or builtin.os.tag == .windows; | ||
|
||
pub const uarg = if (arg_longlong) c_ulonglong else c_ulong; | ||
pub const sarg = if (arg_longlong) c_longlong else c_long; | ||
|
||
pub const Abi = enum(i32) { | ||
sysv = 1, | ||
win64 = 2, | ||
_, | ||
|
||
pub const default: Abi = if (builtin.os.tag == .windows) .win64 else .sysv; | ||
}; | ||
|
||
pub const Function = if (builtin.os.tag.isDarwin()) extern struct { | ||
abi: Abi, | ||
nargs: c_uint, | ||
arg_types: ?[*]*ffi.Type, | ||
rtype: *ffi.Type, | ||
bytes: c_uint, | ||
flags: c_uint, | ||
aarch64_nfixedargs: c_uint, | ||
|
||
pub usingnamespace @import("function.zig"); | ||
} else if (builtin.os.tag == .windows) extern struct { | ||
abi: Abi, | ||
nargs: c_uint, | ||
arg_types: ?[*]*ffi.Type, | ||
rtype: *ffi.Type, | ||
bytes: c_uint, | ||
flags: c_uint, | ||
is_variadic: c_uint, | ||
|
||
pub usingnamespace @import("function.zig"); | ||
} else default.Function(Abi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const default = @import("default.zig"); | ||
|
||
pub const Abi = enum(i32) { | ||
arcompact = 1, | ||
_, | ||
|
||
pub const default: Abi = .arcompact; | ||
}; | ||
|
||
pub const Function = default.Function(Abi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const builtin = @import("builtin"); | ||
|
||
const ffi = @import("ffi.zig"); | ||
|
||
pub const have_complex_type = builtin.os.tag != .windows; | ||
|
||
pub const Abi = enum(i32) { | ||
sysv = 1, | ||
vfp = 2, | ||
_, | ||
|
||
pub const default: Abi = if (builtin.abi.floatAbi() != .soft or builtin.os.tag == .windows) .vfp else .sysv; | ||
}; | ||
|
||
pub const Function = extern struct { | ||
abi: Abi, | ||
nargs: c_uint, | ||
arg_types: ?[*]*ffi.Type, | ||
rtype: *ffi.Type, | ||
bytes: c_uint, | ||
flags: c_uint, | ||
vfp_used: c_int, | ||
vfp_reg_free: c_ushort, | ||
vfp_nargs: c_ushort, | ||
vfp_args: [16]i8, | ||
|
||
pub usingnamespace @import("function.zig"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const ffi = @import("ffi.zig"); | ||
const default = @import("default.zig"); | ||
|
||
pub const Abi = default.Abi; | ||
|
||
pub const Function = extern struct { | ||
abi: Abi, | ||
nargs: c_uint, | ||
arg_types: ?[*]*ffi.Type, | ||
rtype: *ffi.Type, | ||
bytes: c_uint, | ||
flags: c_uint, | ||
rstruct_flag: c_uint, | ||
|
||
pub usingnamespace @import("function.zig"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const default = @import("default.zig"); | ||
|
||
pub const Abi = default.Abi; | ||
|
||
pub const Function = default.Function(Abi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
const ffi = @import("ffi.zig"); | ||
|
||
pub const Abi = enum(i32) { | ||
sysv = 1, | ||
_, | ||
|
||
pub const default: Abi = .sysv; | ||
}; | ||
|
||
pub fn Function(TAbi: type) type { | ||
return extern struct { | ||
abi: TAbi, | ||
nargs: c_uint, | ||
arg_types: ?[*]*ffi.Type, | ||
rtype: *ffi.Type, | ||
bytes: c_uint, | ||
flags: c_uint, | ||
|
||
pub usingnamespace @import("function.zig"); | ||
}; | ||
} |
Oops, something went wrong.