mescc: Add headers for 8cc.

* mlibc/include/libgen.h: New file.
* mlibc/include/locale.hh: New file.
* mlibc/include/stdbool.h: New file.
* mlibc/include/stdnoreturn.h: New file.
* mlibc/include/time.h: Add time_t.
This commit is contained in:
Jan Nieuwenhuizen 2017-06-18 16:12:15 +02:00
parent e2fef673a2
commit cf7211e8a7
5 changed files with 137 additions and 1 deletions

33
mlibc/include/libgen.h Normal file
View File

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
* Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LIBGEN_H
#define __MES_LIBGEN_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include_next <libgen.h>
#else // ! (__GNUC__ && POSIX)
char* dirname (char*);
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_LIBGEN_H

33
mlibc/include/locale.h Normal file
View File

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
* Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LOCALE_H
#define __MES_LOCALE_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include_next <locale.h>
#else // ! (__GNUC__ && POSIX)
char* dirname (char*);
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_LOCALE_H

35
mlibc/include/stdbool.h Normal file
View File

@ -0,0 +1,35 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
* Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_STDBOOL_H
#define __MES_STDBOOL_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include_next <stdbool.h>
#else // ! (__GNUC__ && POSIX)
typedef int bool;
#define false 0
#define true 1
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_STDBOOL_H

View File

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
* Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_STDNORETURN_H
#define __MES_STDNORETURN_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include_next <stdnoreturn.h>
#else // ! (__GNUC__ && POSIX)
// whut?
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_STDNORETURN_H

View File

@ -22,7 +22,9 @@
#if __GNUC__ && POSIX
#include_next <time.h>
#endif // (__GNUC__ && POSIX)
#else // ! (__GNUC__ && POSIX)
typedef int time_t;
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_TIME_H