mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Merge branch 'odin-lang:master' into master
This commit is contained in:
@@ -38,11 +38,6 @@ jobs:
|
|||||||
cd tests/vendor
|
cd tests/vendor
|
||||||
make
|
make
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
- name: Odin issues tests
|
|
||||||
run: |
|
|
||||||
cd tests/issues
|
|
||||||
./run.sh
|
|
||||||
timeout-minutes: 10
|
|
||||||
- name: Odin check examples/all for Linux i386
|
- name: Odin check examples/all for Linux i386
|
||||||
run: ./odin check examples/all -vet -strict-style -target:linux_i386
|
run: ./odin check examples/all -vet -strict-style -target:linux_i386
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -163,13 +158,6 @@ jobs:
|
|||||||
cd tests\core\math\big
|
cd tests\core\math\big
|
||||||
call build.bat
|
call build.bat
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
- name: Odin issues tests
|
|
||||||
shell: cmd
|
|
||||||
run: |
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
|
||||||
cd tests\issues
|
|
||||||
call run.bat
|
|
||||||
timeout-minutes: 10
|
|
||||||
- name: Odin check examples/all for Windows 32bits
|
- name: Odin check examples/all for Windows 32bits
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package libc
|
package libc
|
||||||
|
|
||||||
when ODIN_OS == .Windows {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc {
|
||||||
|
"system:libucrt.lib",
|
||||||
|
"system:legacy_stdio_definitions.lib",
|
||||||
|
}
|
||||||
} else when ODIN_OS == .Darwin {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+29
-11
@@ -369,27 +369,45 @@ close :: proc(fd: Handle) -> bool {
|
|||||||
return _unix_close(fd) == 0
|
return _unix_close(fd) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(private)
|
||||||
|
MAX_RW :: 0x7fffffff // The limit on Darwin is max(i32), trying to read/write more than that fails.
|
||||||
|
|
||||||
write :: proc(fd: Handle, data: []u8) -> (int, Errno) {
|
write :: proc(fd: Handle, data: []u8) -> (int, Errno) {
|
||||||
assert(fd != -1)
|
assert(fd != -1)
|
||||||
|
|
||||||
if len(data) == 0 {
|
bytes_total := len(data)
|
||||||
return 0, 0
|
bytes_written_total := 0
|
||||||
|
|
||||||
|
for bytes_written_total < bytes_total {
|
||||||
|
bytes_to_write := min(bytes_total - bytes_written_total, MAX_RW)
|
||||||
|
slice := data[bytes_written_total:bytes_written_total + bytes_to_write]
|
||||||
|
bytes_written := _unix_write(fd, raw_data(slice), bytes_to_write)
|
||||||
|
if bytes_written == -1 {
|
||||||
|
return bytes_written_total, 1
|
||||||
|
}
|
||||||
|
bytes_written_total += bytes_written
|
||||||
}
|
}
|
||||||
bytes_written := _unix_write(fd, raw_data(data), len(data))
|
|
||||||
if bytes_written == -1 {
|
return bytes_written_total, 0
|
||||||
return 0, 1
|
|
||||||
}
|
|
||||||
return bytes_written, 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
read :: proc(fd: Handle, data: []u8) -> (int, Errno) {
|
read :: proc(fd: Handle, data: []u8) -> (int, Errno) {
|
||||||
assert(fd != -1)
|
assert(fd != -1)
|
||||||
|
|
||||||
bytes_read := _unix_read(fd, raw_data(data), len(data))
|
bytes_total := len(data)
|
||||||
if bytes_read == -1 {
|
bytes_read_total := 0
|
||||||
return 0, 1
|
|
||||||
|
for bytes_read_total < bytes_total {
|
||||||
|
bytes_to_read := min(bytes_total - bytes_read_total, MAX_RW)
|
||||||
|
slice := data[bytes_read_total:bytes_read_total + bytes_to_read]
|
||||||
|
bytes_read := _unix_read(fd, raw_data(slice), bytes_to_read)
|
||||||
|
if bytes_read == -1 {
|
||||||
|
return bytes_read_total, 1
|
||||||
|
}
|
||||||
|
bytes_read_total += bytes_read
|
||||||
}
|
}
|
||||||
return bytes_read, 0
|
|
||||||
|
return bytes_read_total, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
|
seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
|
||||||
|
|||||||
@@ -464,6 +464,7 @@ macos_release_map: map[string]Darwin_To_Release = {
|
|||||||
"21F2092" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
"21F2092" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||||
"21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
|
"21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
|
||||||
"21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
|
"21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
|
||||||
|
"21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
|
|||||||
@@ -963,4 +963,15 @@ DCB :: struct {
|
|||||||
foreign kernel32 {
|
foreign kernel32 {
|
||||||
GetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
GetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
||||||
SetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
SetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LPFIBER_START_ROUTINE :: #type proc "stdcall" (lpFiberParameter: LPVOID)
|
||||||
|
|
||||||
|
@(default_calling_convention = "stdcall")
|
||||||
|
foreign kernel32 {
|
||||||
|
CreateFiber :: proc(dwStackSize: SIZE_T, lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID) -> LPVOID ---
|
||||||
|
DeleteFiber :: proc(lpFiber: LPVOID) ---
|
||||||
|
ConvertThreadToFiber :: proc(lpParameter: LPVOID) -> LPVOID ---
|
||||||
|
SwitchToFiber :: proc(lpFiber: LPVOID) ---
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user