mescc: C99 header files and declaraions.

* libc/include/assert.h (assert_fail):
* libc/include/stdio.h:
+int eputs (char const* s);
+int fputs (char const* s);
+int puts (char const* s);
+int putchar (int c);
+int fputc (int c, int fd);
+int getchar ();
* libc/include/stdlib.h:
+char* getenv (char const* s)
+int atoi (char const *s);
+int *malloc (size_t);
+int *realloc (int *p, int size);
* libc/include/unistd.h (access):
* src/lib.c (display_helper):
* src/mes.c (read_input_file_env):
* src/posix.c: Include unistd.h.
This commit is contained in:
Jan Nieuwenhuizen 2017-05-23 07:16:08 +02:00
parent 174c7a5e22
commit 6af7556d51
33 changed files with 571 additions and 68 deletions

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASSERT_H
#define __ASSERT_H 1
#ifndef __MES_ASSERT_H
#define __MES_ASSERT_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -27,6 +27,7 @@
#include_next <assert.h>
#else // ! (__GNUC__ && POSIX)
#define assert(x) ((x) ? (void)0 : assert_fail (#x))
void assert_fail (char* s);
#endif // ! (__GNUC__ && POSIX)
#endif // __ASSERT_H
#endif // __MES_ASSERT_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CTYPE_H
#define __CTYPE_H 1
#ifndef __MES_CTYPE_H
#define __MES_CTYPE_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -30,4 +30,4 @@
int isdigit (int);
#endif // ! (__GNUC__ && POSIX)
#endif // __CTYPE_H
#endif // __MES_CTYPE_H

28
libc/include/dlfcn.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_DLFCN_H
#define __MES_DLFCN_H 1
#if __GNUC__ && POSIX
#include_next <dlfcn.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_DLFCN_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ERRNO_H
#define __ERRNO_H 1
#ifndef __MES_ERRNO_H
#define __MES_ERRNO_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -27,4 +27,4 @@
#include_next <errno.h>
#endif // ! (__GNUC__ && POSIX)
#endif // __ERRNO_H
#endif // __MES_ERRNO_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FCNTL_H
#define __FCNTL_H 1
#ifndef __MES_FCNTL_H
#define __MES_FCNTL_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -40,4 +40,4 @@
int open (char const *s, int flags, ...);
#endif // ! (__GNUC__ && POSIX)
#endif // __FCNTL_H
#endif // __MES_FCNTL_H

28
libc/include/features.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_FEATURES_H
#define __MES_FEATURES_H 1
#if __GNUC__ && POSIX
#include_next <features.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_FEATURES_H

41
libc/include/inttypes.h Normal file
View File

@ -0,0 +1,41 @@
/* -*-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_INTTYPES_H
#define __MES_INTTYPES_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include_next <inttypes.h>
#else // ! (__GNUC__ && POSIX)
typedef unsigned char uint8_t;
typedef char int8_t;
typedef unsigned short uint16_t;
typedef unsigned uint32_t;
typedef int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_INTTYPES_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LIMITS_H
#define __LIMITS_H 1
#ifndef __MES_LIMITS_H
#define __MES_LIMITS_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -31,4 +31,4 @@
#define INT_MAX 2147483647
#endif // ! (__GNUC__ && POSIX)
#endif // __LIMITS_H
#endif // __MES_LIMITS_H

28
libc/include/math.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_MATH_H
#define __MES_MATH_H 1
#if __GNUC__ && POSIX
#include_next <math.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_MATH_H

View File

@ -18,8 +18,8 @@
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MLIBC_H
#define __MLIBC_H
#ifndef __MES_MLIBC_H
#define __MES_MLIBC_H
char const* itoa (int);

32
libc/include/setjmp.h Normal file
View File

@ -0,0 +1,32 @@
/* -*-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_SETJMP_H
#define __MES_SETJMP_H 1
#if __GNUC__ && POSIX
#include_next <setjmp.h>
#else // ! (__GNUC__ && POSIX)
typedef int jmp_buf;
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_SETJMP_H

28
libc/include/signal.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SIGNAL_H
#define __MES_SIGNAL_H 1
#if __GNUC__ && POSIX
#include_next <signal.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SIGNAL_H

28
libc/include/stdarg.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_STDARG_H
#define __MES_STDARG_H 1
#if __GNUC__ && POSIX
#include_next <stdarg.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_STDARG_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STDIO_H
#define __STDIO_H 1
#ifndef __MES_STDIO_H
#define __MES_STDIO_H 1
char **g_environment;
int g_stdin;
@ -57,12 +57,34 @@ int fdputc (int c, int fd);
#define ungetc fdungetc
int fdungetc (int c, int fd);
#else // !POSIX
#else // ! (__GNUC__ && POSIX)
// Hmm
#define stdin 0
#define stdout 1
#define stderr 2
// TODO: fseek etc
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#if __GNUC__
#undef fputs
#undef fdputs
int fdputs (char const* s, int fd);
#endif // __MES_GNUC__
#endif // __GNUC__ && POSIX
int eputs (char const* s);
int fputs (char const* s, int fd);
int puts (char const* s);
int putchar (int c);
int fputc (int c, int fd);
int getchar ();
int ungetc (int c, int fd);
#endif // __STDIO_H
typedef int FILE;
#endif // ! (__GNUC__ && POSIX)
#endif // __MES_STDIO_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STDLIB_H
#define __STDLIB_H 1
#ifndef __MES_STDLIB_H
#define __MES_STDLIB_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -27,14 +27,18 @@
#include_next <stdlib.h>
#else // !(__GNUC__ && POSIX)
#ifndef __SIZE_T
#define __SIZE_T
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
typedef long size_t;
#endif
char* getenv (char const* s);
int atoi (char const *s);
void *malloc (size_t);
void *realloc (void *p, size_t size);
void exit (int);
#endif // !(__GNUC__ && POSIX)
#endif // __STDLIB_H
#endif // __MES_STDLIB_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STRING_H
#define __STRING_H 1
#ifndef __MES_STRING_H
#define __MES_STRING_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -28,8 +28,8 @@
#else // ! (__GNUC__ && POSIX)
#ifndef __SIZE_T
#define __SIZE_T
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
typedef long size_t;
#endif
@ -39,4 +39,4 @@ int strncmp (char const*, char const*, size_t);
char *strcpy (char *dest, char const *src);
#endif // ! (__GNUC__ && POSIX)
#endif // __STRING_H
#endif // __MES_STRING_H

28
libc/include/strings.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_STRINGS_H
#define __MES_STRINGS_H 1
#if __GNUC__ && POSIX
#include_next <strings.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_STRINGS_H

28
libc/include/sys/cdefs.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_CDEFS_H
#define __MES_SYS_CDEFS_H 1
#if __GNUC__ && POSIX
#include_next <sys/cdefs.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_CDEFS_H

28
libc/include/sys/mman.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_MMAN_H
#define __MES_SYS_MMAN_H 1
#if __GNUC__ && POSIX
#include_next <sys/mman.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_MMAN_H

28
libc/include/sys/stat.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_STAT_H
#define __MES_SYS_STAT_H 1
#if __GNUC__ && POSIX
#include_next <sys/stat.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_STAT_H

28
libc/include/sys/time.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_TIME_H
#define __MES_SYS_TIME_H 1
#if __GNUC__ && POSIX
#include_next <sys/time.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_TIME_H

28
libc/include/sys/timeb.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_TIMEB_H
#define __MES_SYS_TIMEB_H 1
#if __GNUC__ && POSIX
#include_next <sys/timeb.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_TIMEB_H

28
libc/include/sys/types.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_SYS_TYPES_H
#define __MES_SYS_TYPES_H 1
#if __GNUC__ && POSIX
#include_next <sys/types.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_TYPES_H

View File

@ -0,0 +1,28 @@
/* -*-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_SYS_UCONTEXT_H
#define __MES_SYS_UCONTEXT_H 1
#if __GNUC__ && POSIX
#include_next <sys/ucontext.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_SYS_UCONTEXT_H

28
libc/include/time.h Normal file
View File

@ -0,0 +1,28 @@
/* -*-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_TIME_H
#define __MES_TIME_H 1
#if __GNUC__ && POSIX
#include_next <time.h>
#endif // (__GNUC__ && POSIX)
#endif // __MES_TIME_H

View File

@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UNISTD_H
#define __UNISTD_H 1
#ifndef __MES_UNISTD_H
#define __MES_UNISTD_H 1
#if __GNUC__ && POSIX
#ifndef _GNU_SOURCE
@ -28,13 +28,14 @@
#else // ! (__GNUC__ && POSIX)
#ifndef __SIZE_T
#define __SIZE_T
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
typedef long size_t;
#endif
int access (char const *s, int mode);
int read (int fd, void* buf, size_t n);
int write (int fd, char const* s, int n);
#endif // ! (__GNUC__ && POSIX)
#endif // __UNISTD_H
#endif // __MES_UNISTD_H

View File

@ -305,7 +305,7 @@ strncmp (char const* a, char const* b, size_t length)
return *a - *b;
}
char const*
char *
getenv (char const* s)
{
char **p = g_environment;

View File

@ -292,7 +292,7 @@ strncmp (char const* a, char const* b, int length)
}
char **g_environment;
char const*
char *
getenv (char const* s)
{
char **p = g_environment;

View File

@ -99,6 +99,10 @@ install: $(CLEAN) ChangeLog
mkdir -p $(DESTDIR)$(GODIR)
tar -cf- -C module $(INSTALL_GO_FILES:module/%=%)\
| tar -C $(DESTDIR)$(GODIR) -xf-
mkdir -p $(DESTDIR)$(PREFIX)/lib
$(GIT_ARCHIVE_HEAD) libc/include \
| tar -C $(DESTDIR)$(PREFIX) --strip=1 -xf-
cp out/libc/libc-mes.guile-o $(DESTDIR)$(PREFIX)/lib/libc-mes.o
release: tree-clean-p check dist
git tag v$(VERSION)

View File

@ -54,35 +54,36 @@
(define mes? (pair? (current-module)))
(define* (c99-input->ast #:key (defines '()) (includes '()))
(parse-c99
#:inc-dirs (append includes (cons* "." "libc/include" "libc" "src" "out" "out/src" (string-split (getenv "C_INCLUDE_PATH") #\:)))
#:cpp-defs `(
"POSIX=0"
"_POSIX_SOURCE=0"
"__GNUC__=0"
"__MESC__=1"
"__NYACC__=1" ;; REMOVEME
"EOF=-1"
"STDIN=0"
"STDOUT=1"
"STDERR=2"
"INT_MIN=-2147483648"
"INT_MAX=2147483647"
"MES_FULL=0"
"FIXED_PRIMITIVES=1"
,(if mes? "__MESC_MES__=1" "__MESC_MES__=0")
,(string-append "DATADIR=\"" %datadir "\"")
,(string-append "DOCDIR=\"" %docdir "\"")
,(string-append "PREFIX=\"" %prefix "\"")
,(string-append "MODULEDIR=\"" %moduledir "\"")
,(string-append "VERSION=\"" %version "\"")
,@defines
)
#:mode 'code))
(let ((include (if (equal? %prefix "") "libc/include" (string-append %prefix "/include"))))
(parse-c99
#:inc-dirs (append includes (cons* "." "libc" "src" "out" "out/src" include (string-split (getenv "C_INCLUDE_PATH") #\:)))
#:cpp-defs `(
"POSIX=0"
"_POSIX_SOURCE=0"
"__GNUC__=0"
"__MESC__=1"
"__NYACC__=1" ;; REMOVEME
"EOF=-1"
"STDIN=0"
"STDOUT=1"
"STDERR=2"
"INT_MIN=-2147483648"
"INT_MAX=2147483647"
"MES_FULL=0"
"FIXED_PRIMITIVES=1"
,(if mes? "__MESC_MES__=1" "__MESC_MES__=0")
,(string-append "DATADIR=\"" %datadir "\"")
,(string-append "DOCDIR=\"" %docdir "\"")
,(string-append "PREFIX=\"" %prefix "\"")
,(string-append "MODULEDIR=\"" %moduledir "\"")
,(string-append "VERSION=\"" %version "\"")
,@defines
)
#:mode 'code)))
(define (ast:function? o)
(and (pair? o) (eq? (car o) 'fctn-defn)))

View File

@ -25,6 +25,8 @@
int g_depth;
SCM fdisplay_ (SCM, int);
SCM display_helper (SCM x, int cont, char* sep, int fd);
SCM
display_helper (SCM x, int cont, char* sep, int fd)
{

View File

@ -1239,6 +1239,8 @@ mes_builtins (SCM a) ///((internal))
return a;
}
SCM read_input_file_env (SCM);
SCM
load_env (SCM a) ///((internal))
{

View File

@ -19,6 +19,7 @@
*/
#include <fcntl.h>
#include <unistd.h>
int
ungetchar (int c)