Compare commits

...

6 Commits

8 changed files with 109 additions and 1 deletions

View File

@ -13,6 +13,7 @@ extern int errno;
#define EISDIR 21 // Is a directory
#define EINVAL 22 // Invalid argument
#define EMFILE 24 // Too many open files
#define EPIPE 32 // Broken pipe. Not implemented.
#define ENOSYS 38 // Function not implemented
#endif

View File

@ -0,0 +1,21 @@
#ifndef _INTTYPES_H
#define _INTTYPES_H
#include <stdint.h>
#define PRId8 "%d"
#define PRId16 "%d"
#define PRId32 "%d"
#define PRId64 "%ld"
#define PRIdLEAST8 "%d"
#define PRIdLEAST16 "%d"
#define PRIdLEAST32 "%d"
#define PRIdLEAST64 "%ld"
#define PRIdFAST8 "%d"
#define PRIdFAST16 "%d"
#define PRIdFAST32 "%d"
#define PRIdFAST64 "%ld"
#define PRIdMAX "%ld"
#define PRIdPTR "%ld"
#endif

View File

@ -0,0 +1,16 @@
#ifndef _LIBGEN_H
#define _LIBGEN_H
#ifdef __cplusplus
extern "C"
{
#endif
char* basename(char*); // Not implemented.
char* dirname(char*); // Not implemented.
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,23 @@
#ifndef _SETJMP_H
#define _SETJMP_H
#include <bits/macros.h>
typedef int jmp_buf[1];
typedef int sigjmp_buf[1];
#ifdef __cplusplus
extern "C"
{
#endif
int setjmp(jmp_buf env); // Not implemented.
int sigsetjmp(sigjmp_buf env, int savesigs); // Not implemented.
__lc_noreturn void longjmp(jmp_buf env, int val); // Not implemented.
__lc_noreturn void siglongjmp(sigjmp_buf env, int val); // Not implemented.
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,7 @@
#ifndef _SIGNAL_H
#define _SIGNAL_H
typedef int sig_atomic_t; // FIXME: Implement signals (I'm trying to build bc, this header is only to satisfy it) and
// use a proper atomic integer type.
#endif

15
libs/libc/src/libgen.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <libgen.h>
#include <luna.h>
extern "C"
{
char* basename(char*)
{
NOT_IMPLEMENTED("basename");
}
char* dirname(char*)
{
NOT_IMPLEMENTED("dirname");
}
}

25
libs/libc/src/setjmp.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <luna.h>
#include <setjmp.h>
extern "C"
{
int setjmp(jmp_buf)
{
NOT_IMPLEMENTED("setjmp");
}
int sigsetjmp(sigjmp_buf, int)
{
NOT_IMPLEMENTED("sigsetjmp");
}
__lc_noreturn void longjmp(jmp_buf, int)
{
NOT_IMPLEMENTED("longjmp");
}
__lc_noreturn void siglongjmp(sigjmp_buf, int)
{
NOT_IMPLEMENTED("siglongjmp");
}
}

View File

@ -176,7 +176,7 @@ extern "C"
case ENOEXEC: return "Exec format error";
case EFAULT: return "Bad address";
case 0: return "Success";
default: return (char*)(unsigned long int)err;
default: return "Unknown error";
}
}