pointer cells/planeet fixups

This commit is contained in:
Jan Nieuwenhuizen 2019-10-25 10:40:39 +02:00
parent b306080171
commit f7d33a5931
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 22 additions and 4 deletions

View File

@ -36,8 +36,13 @@
void init_symbols_ ();
#if __M2_PLANET__
#define M2_CELL_SIZE 12
// CONSTANT M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
// CONSTANT M2_CELL_SIZE 12
#endif
#if POINTER_CELLS
long g_stack;
@ -59,7 +64,12 @@ struct scm *g_news;
char *
cell_bytes (SCM x)
{
#if POINTER_CELLS
char *p = x;
return p + (2 * sizeof (long));
#else
return &CDR (x);
#endif
}
char *
@ -236,7 +246,7 @@ make_bytes (char const *s, size_t length)
SCM x = alloc (size);
TYPE (x) = TBYTES;
LENGTH (x) = length;
char *p = &CDR (x);
char *p = cell_bytes (x);
if (length == 0)
p[0] = 0;
else

View File

@ -23,6 +23,14 @@
#include <string.h>
#if __M2_PLANET__
#define M2_CELL_SIZE 12
// CONSTANT M2_CELL_SIZE 12
#else
#define M2_CELL_SIZE 1
// CONSTANT M2_CELL_SIZE 12
#endif
#if POINTER_CELLS
SCM g_symbol;
#else
@ -34,7 +42,7 @@ init_symbol (SCM x, long type, char const *name)
{
TYPE (x) = type;
if (!g_symbols)
g_free = g_free + 1;
g_free = g_free + M2_CELL_SIZE;
else
{
int length = strlen (name);
@ -43,7 +51,7 @@ init_symbol (SCM x, long type, char const *name)
CDR (x) = STRING (string);
hash_set_x (g_symbols, string, x);
}
g_symbol = g_symbol + 1;
g_symbol = g_symbol + M2_CELL_SIZE;
return x;
}
@ -175,7 +183,7 @@ SCM
init_symbols () /*:((internal)) */
{
#if POINTER_CELLS
g_free = g_cells + 1;
g_free = g_cells + M2_CELL_SIZE;
#else
g_free = 1;
#endif