-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements ctype.h functions, adds support for panics, adds more code…
… validation.
- Loading branch information
Felix "xq" Queißner
committed
Jan 21, 2024
1 parent
afe9006
commit b7e5cab
Showing
7 changed files
with
365 additions
and
18 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
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,25 @@ | ||
#ifndef _FOUNDATION_LIBC_INTERNALS_H_ | ||
#define _FOUNDATION_LIBC_INTERNALS_H_ | ||
|
||
#include <stddef.h> | ||
|
||
/// | ||
/// Panic handler for undefined, but catchable behaviour in safe modes. | ||
/// | ||
/// This will be invoked when Zig detects undefined behaviour at runtime, | ||
/// or when foundation libc can recognize illegal arguments. | ||
/// | ||
/// The function receives a non-terminated pointer to the panic message | ||
/// with `msg_len` bytes of UTF-8 encoded payload. | ||
/// | ||
/// It has a weak default implementation shipped, so just implement this | ||
/// function to plug in your own custom behaviour. | ||
/// The default implementation is done by invoking a `trap` instruction to | ||
/// emit an illegal instruction or otherwise crash the program execution. | ||
/// | ||
/// NOTE: This function must never return, because otherwise, the undefined | ||
/// behaviour will be actually undefined! | ||
/// | ||
void foundation_libc_panic_handler(char const * msg_ptr, size_t msg_len); | ||
|
||
#endif |
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
Oops, something went wrong.