From 240da62bbc8b607e4fa9d0224a9248490865a6d9 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 19 Oct 2022 08:43:32 +0200 Subject: [PATCH] next bit // CONSTANT --- include/fcntl.h | 3 +++ include/linux/arm/syscall.h | 18 --------------- include/linux/x86/syscall.h | 22 +----------------- include/mes/constants.h | 46 +------------------------------------ include/mes/symbols.h | 8 +------ lib/posix/getcwd.c | 4 +--- lib/posix/getenv.c | 7 ++++-- lib/posix/setenv.c | 7 ++++-- lib/stub/__raise.c | 4 +--- src/core.c | 2 +- src/symbol.c | 6 +---- src/test/gc.c | 7 ++++-- src/vector.c | 6 ++--- 13 files changed, 27 insertions(+), 113 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index 2a8ece80..c5bc6951 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -69,8 +69,11 @@ #define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode) int dup (int old); int dup2 (int old, int new); + +#if !__M2__ int fcntl (int filedes, int command, ...); int open (char const *s, int flags, ...); +#endif #endif // ! SYSTEM_LIBC diff --git a/include/linux/arm/syscall.h b/include/linux/arm/syscall.h index b04ff039..62029463 100644 --- a/include/linux/arm/syscall.h +++ b/include/linux/arm/syscall.h @@ -25,47 +25,29 @@ /* libc-mini */ #ifndef SYS_exit -// CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write -// CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ -// CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 -// CONSTANT SYS_read 0x03 #define SYS_read 0x03 -// CONSTANT SYS_open 0x05 #define SYS_open 0x05 //#define SYS_waitpid -// CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 -// CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b -// CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f -// CONSTANT SYS_access 0x21 #define SYS_access 0x21 -// CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d -// CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 -// CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 -// CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 -// CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 -// CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f -// CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a -// CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e -// CONSTANT SYS_clock_gettime 0x107 #define SYS_clock_gettime 0x107 /* libc+tcc */ diff --git a/include/linux/x86/syscall.h b/include/linux/x86/syscall.h index 01c46a35..c1271f06 100644 --- a/include/linux/x86/syscall.h +++ b/include/linux/x86/syscall.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,50 +22,30 @@ /* libc-mini */ #ifndef SYS_exit -// CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write -// CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ -// CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 -// CONSTANT SYS_read 0x03 #define SYS_read 0x03 -// CONSTANT SYS_open 0x05 #define SYS_open 0x05 -// CONSTANT SYS_waitpid 0x07 #define SYS_waitpid 0x07 -// CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 -// CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b -// CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f -// CONSTANT SYS_access 0x21 #define SYS_access 0x21 -// CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d -// CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 -// CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 -// CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 -// CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 -// CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f -// CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a -// CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e -// CONSTANT SYS_clock_gettime 0x109 #define SYS_clock_gettime 0x109 -// CONSTANT SYS_time 0x0d #define SYS_time 0x0d /* libc+tcc */ diff --git a/include/mes/constants.h b/include/mes/constants.h index 42424390..ebf7787a 100644 --- a/include/mes/constants.h +++ b/include/mes/constants.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -23,76 +23,32 @@ /* Cell types */ -// CONSTANT TCHAR 0 #define TCHAR 0 -// CONSTANT TBYTES 1 #define TBYTES 1 -// CONSTANT TCLOSURE 2 #define TCLOSURE 2 -// CONSTANT TCONTINUATION 3 #define TCONTINUATION 3 -// CONSTANT TKEYWORD 4 #define TKEYWORD 4 -// CONSTANT TMACRO 5 #define TMACRO 5 -// CONSTANT TNUMBER 6 #define TNUMBER 6 -// CONSTANT TPAIR 7 #define TPAIR 7 -// CONSTANT TPORT 8 #define TPORT 8 -// CONSTANT TREF 9 #define TREF 9 -// CONSTANT TSPECIAL 10 #define TSPECIAL 10 -// CONSTANT TSTRING 11 #define TSTRING 11 -// CONSTANT TSTRUCT 12 #define TSTRUCT 12 -// CONSTANT TSYMBOL 13 #define TSYMBOL 13 -// CONSTANT TVALUES 14 #define TVALUES 14 -// CONSTANT TVARIABLE 15 #define TVARIABLE 15 -// CONSTANT TVECTOR 16 #define TVECTOR 16 -// CONSTANT TBROKEN_HEART 17 #define TBROKEN_HEART 17 /* Struct types */ -// CONSTANT STRUCT_TYPE 0 #define STRUCT_TYPE 0 -// CONSTANT STRUCT_PRINTER 1 #define STRUCT_PRINTER 1 -// CONSTANT GC_FRAME_SIZE 5 #define GC_FRAME_SIZE 5 -// CONSTANT GC_FRAME_PROCEDURE 4 #define GC_FRAME_PROCEDURE 4 -// CONSTANT STDIN 0 -// CONSTANT STDOUT 1 -// CONSTANT STDERR 2 - -/* Unknown type 1 -// CONSTANT EOF -1 -*/ - -// CONSTANT O_RDONLY 0 -// CONSTANT O_WRONLY 1 -// CONSTANT O_CREAT 0x40 -// CONSTANT O_TRUNC 0x200 - -// CONSTANT PATH_MAX 1024 -// CONSTANT __FILEDES_MAX 512 - -// CONSTANT S_IRUSR 00400 -// CONSTANT S_IWUSR 00200 - -// CONSTANT CLOCK_PROCESS_CPUTIME_ID 2 - - #endif /* __MES_CONSTANTS_H */ diff --git a/include/mes/symbols.h b/include/mes/symbols.h index 490fa1e2..6e435720 100644 --- a/include/mes/symbols.h +++ b/include/mes/symbols.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -137,14 +137,8 @@ extern struct scm *cell_type_broken_heart; extern struct scm *cell_symbol_program; extern struct scm *cell_symbol_test; -// CONSTANT SYMBOL_MAX 114 #define SYMBOL_MAX 114 - -// CONSTANT CELL_UNSPECIFIED 7 #define CELL_UNSPECIFIED 7 - -// CONSTANT CELL_SYMBOL_RECORD_TYPE 82 #define CELL_SYMBOL_RECORD_TYPE 82 - #endif /* __MES_SYMBOLS_H */ diff --git a/lib/posix/getcwd.c b/lib/posix/getcwd.c index e3e6d67c..97e81c75 100644 --- a/lib/posix/getcwd.c +++ b/lib/posix/getcwd.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -23,8 +23,6 @@ #include #include -char *__getcwd_buf; - char * getcwd (char *buffer, size_t size) { diff --git a/lib/posix/getenv.c b/lib/posix/getenv.c index 9130f76d..9386044b 100644 --- a/lib/posix/getenv.c +++ b/lib/posix/getenv.c @@ -1,6 +1,6 @@ /* * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,8 +22,11 @@ #include #include -// CONSTANT M2_PTR_SIZE 4 +#if __M2__ +#define M2_PTR_SIZE 4 +#else #define M2_PTR_SIZE 1 +#endif char * getenv (char const *s) diff --git a/lib/posix/setenv.c b/lib/posix/setenv.c index 321a5ab1..1754e6e9 100644 --- a/lib/posix/setenv.c +++ b/lib/posix/setenv.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,8 +22,11 @@ #include #include -// CONSTANT M2_PTR_SIZE 4 +#if __M2__ +#define M2_PTR_SIZE 4 +#else #define M2_PTR_SIZE 1 +#endif int setenv (char const *s, char const *v, int overwrite_p) diff --git a/lib/stub/__raise.c b/lib/stub/__raise.c index 9467513c..bfa9853c 100644 --- a/lib/stub/__raise.c +++ b/lib/stub/__raise.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -18,8 +18,6 @@ * along with GNU Mes. If not, see . */ -// CONSTANT SIGABRT 0 - int __raise (int signum) { diff --git a/src/core.c b/src/core.c index 15585e45..a986dcf7 100644 --- a/src/core.c +++ b/src/core.c @@ -148,7 +148,7 @@ length (struct scm *x) struct scm * error (struct scm *key, struct scm *x) { -#if !__MESC_MES__ && !__M2_PLANET__ +#if !__MESC_MES__ && !__M2__ struct scm *throw = module_ref (R0, cell_symbol_throw); if (throw != cell_undefined) return apply (throw, cons (key, cons (x, cell_nil)), R0); diff --git a/src/symbol.c b/src/symbol.c index 4ae8baca..5d0aaaa2 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -23,14 +23,10 @@ #include -// char const *MES_VERSION = "0.24"; - -#if __M2_PLANET__ +#if __M2__ #define M2_CELL_SIZE 12 -// CONSTANT M2_CELL_SIZE 12 #else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 #endif struct scm * diff --git a/src/test/gc.c b/src/test/gc.c index 8d3c70cf..edafad8c 100644 --- a/src/test/gc.c +++ b/src/test/gc.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,8 +24,11 @@ #include #include +#if __M2__ +#define M2_CELL_SIZE 12 +#else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 +#endif int g_debug; diff --git a/src/vector.c b/src/vector.c index 0fc84040..e4a35ead 100644 --- a/src/vector.c +++ b/src/vector.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,12 +21,10 @@ #include "mes/lib.h" #include "mes/mes.h" -#if __M2_PLANET__ +#if __M2__ #define M2_CELL_SIZE 12 -// CONSTANT M2_CELL_SIZE 12 #else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 #endif struct scm *