Up the maximum count of error codes in ableOS
This commit is contained in:
parent
d150e77aaa
commit
8f4e7cfc87
7
TODO
7
TODO
|
@ -1,6 +1,13 @@
|
|||
- [ ] String
|
||||
- [x] Fix string_eq
|
||||
- [ ] String concat/add
|
||||
- [ ] push/pop characters
|
||||
- [ ] case related functions
|
||||
- [ ] Move function signatures to the *.h file
|
||||
- [ ] Sorting stuff
|
||||
- [ ] Vec
|
||||
- [ ] Pop
|
||||
- [ ] getter/setter
|
||||
- [x] Random Libraries
|
||||
- [x] Mersenne Twister
|
||||
- [ ] add in u64 and f64 generation proper
|
||||
|
|
|
@ -9,7 +9,12 @@ ExitCode ecode_new(char* ptr){
|
|||
};
|
||||
}
|
||||
|
||||
typedef ExitCode ExitCodeArray[255];
|
||||
// Not thread safe
|
||||
// Luckily ableOS will not support OSThreads
|
||||
typedef struct {
|
||||
u16 count;
|
||||
ExitCode exit_codes[];
|
||||
} ExitCodeArray;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -19,9 +24,14 @@ typedef struct {
|
|||
|
||||
|
||||
ExitCodeRegistry exit_codes;
|
||||
int exit_code_count = 0;
|
||||
|
||||
void register_exit_code(ExitCode ecode) {
|
||||
exit_codes.exit_code_registry[exit_code_count] = ecode;
|
||||
exit_code_count += 1;
|
||||
|
||||
// Register an exit code in ableOS
|
||||
// Returns:
|
||||
// - A non-zero u8: When the exit code is registered
|
||||
// - Zero: something has gone horrible
|
||||
u16 register_exit_code(ExitCode ecode) {
|
||||
exit_codes.exit_code_registry.exit_codes[exit_codes.exit_code_registry.count] = ecode;
|
||||
exit_codes.exit_code_registry.count += 1;
|
||||
return exit_codes.exit_code_registry.count - 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*Sadly sometimes dividing people in half is a bad thing actually*/
|
||||
|
||||
|
||||
u8 divide_up_u8(u8 n, u8 d) {
|
||||
if (n % d == 0) {
|
||||
return n / d;
|
||||
|
|
|
@ -9,7 +9,6 @@ typedef enum {
|
|||
} ProcessResponse;
|
||||
|
||||
ProcessID new_id(u64 host, u64 local) {
|
||||
|
||||
return (ProcessID) {
|
||||
.host = host,
|
||||
.local = local
|
||||
|
@ -30,7 +29,7 @@ ProcessID create_process() {
|
|||
|
||||
// Start execution of a created process
|
||||
ProcessResponse start_process(ProcessID pid) {
|
||||
trace("process started");
|
||||
trace("Process started.");
|
||||
|
||||
return AlreadyRunning;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void _start() {
|
||||
exit_codes.exit_code_registry.count = 0;
|
||||
register_exit_code(ecode_new("Success"));
|
||||
|
||||
int exit_code = main();
|
||||
char* ptr = exit_codes.exit_code_registry[exit_code].reason.ptr;
|
||||
char* ptr = exit_codes.exit_code_registry.exit_codes[exit_code].reason.ptr;
|
||||
|
||||
if (ptr == 0) {
|
||||
printf("Invalid ExitCode");
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
// All System Resource IDs are declared here
|
||||
// as well as compound IDs
|
||||
|
||||
|
||||
// The Host Node ID of a Resource in an ableOS Cluster
|
||||
#define HostID u64
|
||||
|
||||
// The Localized Resource ID in an ableOS Cluster
|
||||
#define LocalID u64
|
||||
|
||||
typedef struct {
|
||||
// The Host Node ID of a Process in an ableOS Cluster
|
||||
HostID host;
|
||||
// The Local Node ID of a Process in an ableOS Cluster
|
||||
LocalID local;
|
||||
} ProcessID;
|
||||
|
||||
typedef struct {
|
||||
// The Host Node ID of a Buffer in an ableOS Cluster
|
||||
HostID host_id;
|
||||
// The Local Node ID of a Buffer in an ableOS Cluster
|
||||
LocalID local_id;
|
||||
} BufferID;
|
||||
|
||||
|
||||
BufferID construct_buffer_id(HostID host_id, LocalID local_id){
|
||||
return (BufferID) {
|
||||
.host_id = host_id,
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include "ableos_std/ableos_std.c"
|
||||
|
||||
|
||||
|
||||
|
||||
// Sadly main must return int or it is a warning.
|
||||
int main() {
|
||||
register_exit_code(ecode_new("File System Error"));
|
||||
u16 fs_exit_error = register_exit_code(ecode_new("File System Error"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue