Skip to content

Commit

Permalink
use it in errno
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jan 27, 2025
1 parent 8a0bb4b commit ea9ed6a
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions stdlib/errno.jou
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,31 @@ elif NETBSD:
else:
declare __errno_location() -> int*

# TODO: Ideally we would be able to place the if statements inside the functions.
if WINDOWS:
@public
def set_errno(value: int) -> None:

@public
def set_errno(value: int) -> None:
if WINDOWS:
*_errno() = value
@public
def get_errno() -> int:
return *_errno()
elif MACOS:
@public
def set_errno(value: int) -> None:
elif MACOS:
*__error() = value
@public
def get_errno() -> int:
return *__error()
elif NETBSD:
@public
def set_errno(value: int) -> None:
elif NETBSD:
*__errno() = value
@public
def get_errno() -> int:
return *__errno()
else:
@public
def set_errno(value: int) -> None:
else:
*__errno_location() = value
@public
def get_errno() -> int:


@public
def get_errno() -> int:
if WINDOWS:
return *_errno()
elif MACOS:
return *__error()
elif NETBSD:
return *__errno()
else:
return *__errno_location()


# Convert an error code into a string. Do not modify or free() the returned string.
@public
declare strerror(errno_value: int) -> byte*

0 comments on commit ea9ed6a

Please sign in to comment.