-
Notifications
You must be signed in to change notification settings - Fork 302
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
25 changed files
with
883 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef __LIMITS__ | ||
#define __LIMITS__ | ||
|
||
#define __LONG_MAX 0x7fffffffffffffffL | ||
#define CHAR_BIT 8 | ||
#define SCHAR_MIN (-128) | ||
#define SCHAR_MAX 127 | ||
#define UCHAR_MAX 255 | ||
#define SHRT_MIN (-1 - 0x7fff) | ||
#define SHRT_MAX 0x7fff | ||
#define USHRT_MAX 0xffff | ||
#define INT_MIN (-1 - 0x7fffffff) | ||
#define INT_MAX 0x7fffffff | ||
#define UINT_MAX 0xffffffffU | ||
#define LONG_MIN (-LONG_MAX - 1) | ||
#define LONG_MAX __LONG_MAX | ||
#define ULONG_MAX (2UL * LONG_MAX + 1) | ||
#define LLONG_MIN (-LLONG_MAX - 1) | ||
#define LLONG_MAX 0x7fffffffffffffffLL | ||
#define ULLONG_MAX (2ULL * LLONG_MAX + 1) | ||
|
||
#define PTHREAD_STACK_MIN 2048 | ||
|
||
#define LOGIN_NAME_MAX 256 | ||
#ifndef NAME_MAX | ||
#define NAME_MAX 255 | ||
#endif | ||
#define TZNAME_MAX 6 | ||
|
||
#define PATH_MAX 4096 | ||
#define SSIZE_MAX LONG_MAX | ||
#define CHAR_MAX 127 | ||
|
||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef _LOCALE_H | ||
#define _LOCALE_H | ||
|
||
#define LC_CTYPE 0 | ||
#define LC_NUMERIC 1 | ||
#define LC_TIME 2 | ||
#define LC_COLLATE 3 | ||
#define LC_MONETARY 4 | ||
#define LC_MESSAGES 5 | ||
#define LC_ALL 6 | ||
#define LOCALE_NAME_MAX 23 | ||
|
||
#include <stddef.h> | ||
|
||
struct lconv { | ||
char *decimal_point; | ||
char *thousands_sep; | ||
char *grouping; | ||
|
||
char *int_curr_symbol; | ||
char *currency_symbol; | ||
char *mon_decimal_point; | ||
char *mon_thousands_sep; | ||
char *mon_grouping; | ||
char *positive_sign; | ||
char *negative_sign; | ||
char int_frac_digits; | ||
char frac_digits; | ||
char p_cs_precedes; | ||
char p_sep_by_space; | ||
char n_cs_precedes; | ||
char n_sep_by_space; | ||
char p_sign_posn; | ||
char n_sign_posn; | ||
char int_p_cs_precedes; | ||
char int_p_sep_by_space; | ||
char int_n_cs_precedes; | ||
char int_n_sep_by_space; | ||
char int_p_sign_posn; | ||
char int_n_sign_posn; | ||
}; | ||
|
||
struct __locale_map { | ||
const void *map; | ||
size_t map_size; | ||
char name[LOCALE_NAME_MAX + 1]; | ||
const struct __locale_map *next; | ||
}; | ||
|
||
struct __locale_struct { | ||
const struct __locale_map *cat[6]; | ||
}; | ||
|
||
typedef struct __locale_struct *locale_t; | ||
|
||
#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
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 |
---|---|---|
@@ -1,34 +1,61 @@ | ||
#ifndef __STDIO_H__ | ||
#define __STDIO_H__ | ||
|
||
#define stdin 0 | ||
#define stdout 1 | ||
#define stderr 2 | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
|
||
int getchar(); | ||
int putchar(int); | ||
int puts(const char *s); | ||
void fprintf(int f, const char *fmt, ...); | ||
int fflush(int); | ||
// TODO: complete this struct | ||
struct IO_FILE { | ||
int fd; | ||
}; | ||
|
||
typedef struct IO_FILE FILE; | ||
|
||
extern FILE *const stdin; | ||
extern FILE *const stdout; | ||
extern FILE *const stderr; | ||
|
||
#define stdin (stdin) | ||
#define stdout (stdout) | ||
#define stderr (stderr) | ||
|
||
#define EOF (-1) | ||
|
||
#define printf(...) fprintf(stdout, __VA_ARGS__) | ||
#define printf(...) fprintf(stdout->fd, __VA_ARGS__) | ||
|
||
#define unimplemented(fmt, ...) \ | ||
printf("\x1b[33m%s%s:\x1b[0m " fmt "\n", "WARN: no ax_call implementation for ", __func__, \ | ||
##__VA_ARGS__) | ||
|
||
struct _IO_FILE { | ||
int fd; | ||
}; | ||
|
||
typedef struct _IO_FILE FILE; | ||
|
||
#define SEEK_SET 0 | ||
#define SEEK_CUR 1 | ||
#define SEEK_END 2 | ||
|
||
#define F_EOF 16 | ||
#define F_ERR 32 | ||
#define F_SVB 64 | ||
#define F_NORD 4 | ||
#define UNGET 8 | ||
|
||
#define FILENAME_MAX 4096 | ||
|
||
int getchar(); | ||
int putchar(int); | ||
int puts(const char *s); | ||
void fprintf(int f, const char *fmt, ...); | ||
|
||
#ifdef AX_CONFIG_ALLOC | ||
#ifdef AX_CONFIG_FS | ||
FILE *fopen(const char *filename, const char *mode); | ||
#endif | ||
#endif | ||
|
||
int fflush(FILE *); | ||
|
||
int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list); | ||
int snprintf(char *__restrict, size_t, const char *__restrict, ...); | ||
int vsprintf(char *__restrict, const char *__restrict, va_list); | ||
int vfprintf(FILE *__restrict, const char *__restrict, va_list); | ||
int sprintf(char *__restrict, const char *__restrict, ...); | ||
|
||
#endif // __STDIO_H__ |
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
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,7 @@ | ||
#include <stdio.h> | ||
|
||
#undef stderr | ||
FILE __stderr_FILE = { | ||
.fd = 2, | ||
}; | ||
FILE *const stderr = &__stderr_FILE; |
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,8 @@ | ||
#include <stdio.h> | ||
|
||
#undef stdin | ||
FILE __stdin_FILE = { | ||
.fd = 0, | ||
}; | ||
|
||
FILE *const stdin = &__stdin_FILE; |
Oops, something went wrong.