core: Move M2_PTR_SIZE, M2_CELL_SIZE to include file.

* lib/posix/getenv.c (M2_PTR_SIZE),
lib/posix/setenv.c (M2_PTR_SIZE): Move definition...
* include/mes/lib-mini.h (M2_PTR_SIZE): ...here.
* src/gc.c (M2_CELL_SIZE),
src/symbol.c (M2_CELL_SIZE),
src/test/gc.c (M2_CELL_SIZE),
src/vector.c (M2_CELL_SIZE): Move definition...
* include/mes/mes.h (M2_CELL_SIZE): ...here.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-11-18 01:30:06 +01:00 committed by Janneke Nieuwenhuizen
parent 7725574935
commit cbea14f843
8 changed files with 18 additions and 36 deletions

View File

@ -37,6 +37,15 @@
#define STDERR 2
#endif
/* M2-Planet does not support pointer arithmetic. Explicitly compensate
for that by multiplying with M2_PTR_SIZE when using (char)
pointers. */
#if __M2__
#define M2_PTR_SIZE 4
#else
#define M2_PTR_SIZE 1
#endif
extern char **environ;
extern int __stdin;
extern int __stdout;

View File

@ -53,6 +53,15 @@ struct scm
};
};
/* M2-Planet does not support pointer arithmetic. Explicitly compensate
for that by multiplying with M2_CELL_SIZE when using cell
pointers. */
#if __M2__
#define M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
#endif
/* mes */
extern char *g_datadir;
extern int g_debug;

View File

@ -22,12 +22,6 @@
#include <string.h>
#include <stdlib.h>
#if __M2__
#define M2_PTR_SIZE 4
#else
#define M2_PTR_SIZE 1
#endif
char *
getenv (char const *s)
{

View File

@ -22,12 +22,6 @@
#include <string.h>
#include <stdlib.h>
#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)
{

View File

@ -31,12 +31,6 @@
int g_dump_filedes;
#if __M2__
#define M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1U
#endif
char *
cell_bytes (struct scm *x)
{

View File

@ -23,12 +23,6 @@
#include <string.h>
#if __M2__
#define M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
#endif
struct scm *
init_symbol (struct scm *x, long type, char const *name)
{

View File

@ -24,12 +24,6 @@
#include <stdlib.h>
#include <string.h>
#if __M2__
#define M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
#endif
int g_debug;
void

View File

@ -21,12 +21,6 @@
#include "mes/lib.h"
#include "mes/mes.h"
#if __M2__
#define M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
#endif
struct scm *
make_vector_ (long k, struct scm *e)
{