/* VMS preprocessor does not like line continuations in conditionals */
#define Are_The_Constants_Incompatible \
-((TC_NULL != 0x00) || (TC_CONSTANT != 0x08) || \
+((TC_FALSE != 0x00) || (TC_CONSTANT != 0x08) || \
(TC_FIXNUM != 0x1A) || (TC_BROKEN_HEART != 0x22) || \
- (TC_CHARACTER_STRING != 0x1E))
+ (TC_BYTEVECTOR != 0x1E))
/* The values used above are in sdata.h and types.h,
check for consistency if the check below fails. */
Expr = (MEMORY_REF ((MEMORY_REF (Expr, ASSIGN_NAME)), VARIABLE_SYMBOL));
goto SPrint;
- case TC_CHARACTER_STRING:
+ case TC_BYTEVECTOR:
print_string (stream, Expr);
return;
print_list (stream, Expr);
return;
- case TC_NULL:
+ case TC_FALSE:
break;
case TC_UNINTERNED_SYMBOL:
#define CI_BAND_P(P) ((OBJECT_TYPE (P)) == TC_CONSTANT)
#define MAKE_CI_VERSION(b, v, a) \
- (MAKE_OBJECT (((b) ? TC_CONSTANT : TC_NULL), \
+ (MAKE_OBJECT (((b) ? TC_CONSTANT : TC_FALSE), \
((((unsigned long) (v)) << HALF_DATUM_LENGTH) \
| ((unsigned long) (a)))))
if ((caddr != 0) && (ADDRESS_IN_FROMSPACE_P (caddr)))
{
- WRITE_TOSPACE (new_addr, (OBJECT_NEW_TYPE (TC_NULL, old_car)));
+ WRITE_TOSPACE (new_addr, (OBJECT_NEW_TYPE (TC_FALSE, old_car)));
(old_addr[1])
= ((weak_chain == 0)
? (MAKE_OBJECT ((OBJECT_TYPE (old_car)), 0))
\f
gc_type_t gc_type_map [N_TYPE_CODES] =
{
- GC_NON_POINTER, /* TC_NULL,etc */
+ GC_NON_POINTER, /* TC_FALSE */
GC_PAIR, /* TC_LIST */
GC_NON_POINTER, /* TC_CHARACTER */
GC_PAIR, /* TC_SCODE_QUOTE */
GC_UNDEFINED, /* was TC_PCOMB1 */
GC_VECTOR, /* TC_CONTROL_POINT */
GC_PAIR, /* TC_INTERNED_SYMBOL */
- GC_VECTOR, /* TC_CHARACTER_STRING,TC_VECTOR_8B */
+ GC_VECTOR, /* TC_BYTEVECTOR */
GC_PAIR, /* TC_ACCESS */
GC_TRIPLE, /* TC_HUNK3_A */
GC_PAIR, /* TC_DEFINITION */
{
case TC_BIG_FIXNUM: /* The self evaluating items */
case TC_BIG_FLONUM:
- case TC_CHARACTER_STRING:
+ case TC_BYTEVECTOR:
case TC_CHARACTER:
case TC_COMPILED_CODE_BLOCK:
case TC_COMPLEX:
case TC_INTERNED_SYMBOL:
case TC_LIST:
case TC_NON_MARKED_VECTOR:
- case TC_NULL:
+ case TC_FALSE:
case TC_PRIMITIVE:
case TC_PROCEDURE:
case TC_QUAD:
#define FLONUM_P(object) ((OBJECT_TYPE (object)) == TC_BIG_FLONUM)
#define COMPLEX_P(object) ((OBJECT_TYPE (object)) == TC_COMPLEX)
#define CHARACTER_P(object) ((OBJECT_TYPE (object)) == TC_CHARACTER)
-#define STRING_P(object) ((OBJECT_TYPE (object)) == TC_CHARACTER_STRING)
+#define BYTEVECTOR_P(object) ((OBJECT_TYPE (object)) == TC_BYTEVECTOR)
#define BIT_STRING_P(object) ((OBJECT_TYPE (object)) == TC_BIT_STRING)
#define CELL_P(object) ((OBJECT_TYPE (object)) == TC_CELL)
#define PAIR_P(object) ((OBJECT_TYPE (object)) == TC_LIST)
\f
/* String Operations */
+#define STRING_P BYTEVECTOR_P
+
/* Add 1 byte to length to account for '\0' at end of string.
Add 1 word to length to account for string header word. */
#define STRING_LENGTH_TO_GC_LENGTH(n_chars) \
- ((BYTES_TO_WORDS ((n_chars) + 1)) + 1)
+ ((BYTES_TO_WORDS ((n_chars) + 1)) + BYTEVECTOR_LENGTH_SIZE)
#define STRING_LENGTH(s) \
- (OBJECT_DATUM (MEMORY_REF ((s), STRING_LENGTH_INDEX)))
+ (OBJECT_DATUM (MEMORY_REF ((s), BYTEVECTOR_LENGTH_INDEX)))
#define SET_STRING_LENGTH(s, n_chars) do \
{ \
MEMORY_SET ((s), \
- STRING_LENGTH_INDEX, \
+ BYTEVECTOR_LENGTH_INDEX, \
(MAKE_OBJECT (0, (n_chars)))); \
STRING_SET ((s), (n_chars), '\0'); \
} while (0)
/* Subtract 1 to account for the fact that we maintain a '\0'
at the end of the string. */
-#define MAXIMUM_STRING_LENGTH(s) \
- ((((VECTOR_LENGTH (s)) - 1) * (sizeof (SCHEME_OBJECT))) - 1)
+#define MAXIMUM_STRING_LENGTH(s) \
+ ((((VECTOR_LENGTH (s)) - BYTEVECTOR_LENGTH_SIZE) * (sizeof (SCHEME_OBJECT))) \
+ - 1)
#define SET_MAXIMUM_STRING_LENGTH(s, n_chars) \
(SET_VECTOR_LENGTH ((s), (STRING_LENGTH_TO_GC_LENGTH (n_chars))))
#define STRING_LOC(s, i) \
- (((unsigned char *) (MEMORY_LOC (s, STRING_CHARS))) + (i))
+ (((unsigned char *) (MEMORY_LOC (s, BYTEVECTOR_DATA))) + (i))
-#define STRING_POINTER(s) ((char *) (MEMORY_LOC (s, STRING_CHARS)))
-#define STRING_BYTE_PTR(s) ((byte_t *) (MEMORY_LOC (s, STRING_CHARS)))
+#define STRING_POINTER(s) ((char *) (MEMORY_LOC (s, BYTEVECTOR_DATA)))
+#define STRING_BYTE_PTR(s) ((byte_t *) (MEMORY_LOC (s, BYTEVECTOR_DATA)))
#define STRING_REF(s, i) (* (STRING_LOC ((s), (i))))
#define STRING_SET(s, i, c) ((* (STRING_LOC ((s), (i)))) = (c))
#define FIXNUM_TO_ULONG_P(fixnum) (((OBJECT_DATUM (fixnum)) & SIGN_MASK) == 0)
#define FIXNUM_TO_ULONG(fixnum) (OBJECT_DATUM (fixnum))
+#define FIXNUM_ZERO (ULONG_TO_FIXNUM (0))
+
#define FIXNUM_TO_DOUBLE(fixnum) ((double) (FIXNUM_TO_LONG (fixnum)))
#define DOUBLE_TO_FIXNUM_P(number) \
9 '()
*/
-#define SHARP_F MAKE_OBJECT (TC_NULL, 0)
+#define SHARP_F MAKE_OBJECT (TC_FALSE, 0)
#define SHARP_T MAKE_OBJECT (TC_CONSTANT, 0)
#define UNSPECIFIC MAKE_OBJECT (TC_CONSTANT, 1)
#define DEFAULT_OBJECT MAKE_OBJECT (TC_CONSTANT, 7)
#define EMPTY_LIST MAKE_OBJECT (TC_CONSTANT, 9)
-#define FIXNUM_ZERO MAKE_OBJECT (TC_FIXNUM, 0)
#define BROKEN_HEART_ZERO MAKE_OBJECT (TC_BROKEN_HEART, 0)
/* Last immediate reference trap. */
long arity = (FIXNUM_TO_LONG (*entries++));
SCHEME_OBJECT prim
= (find_primitive
- ((MAKE_POINTER_OBJECT (TC_CHARACTER_STRING, entries)),
+ ((MAKE_POINTER_OBJECT (TC_BYTEVECTOR, entries)),
true, true, arity));
if (!PRIMITIVE_P (prim))
*/
#define CELL_CONTENTS 0
-/* CHARACTER
- * Not currently used. Intended ultimately to complete the abstraction
- * of strings. This will probably be removed eventually.
- */
-
-/* CHARACTER_STRING
- * Synonym for 8B_VECTOR. Used to store strings of characters. Format
- * consists of the normal non-marked vector header (STRING_HEADER)
- * followed by the number of characters in the string (as a FIXNUM),
- * followed by the characters themselves.
- */
-#define STRING_HEADER 0
-#define STRING_LENGTH_INDEX 1
-#define STRING_CHARS 2
+/* BYTEVECTOR
+ * Format consists of the normal non-marked vector header
+ * (BYTEVECTOR_HEADER) followed by the number of bytes in the vector
+ * (with type-code 0), followed by the bytes themselves.
+ */
+#define BYTEVECTOR_HEADER 0
+#define BYTEVECTOR_LENGTH_INDEX 1
+#define BYTEVECTOR_LENGTH_SIZE 1
+#define BYTEVECTOR_DATA 2
\f
/* COMPILED_PROCEDURE */
#define COMP_PROCEDURE_ADDRESS 0
allocate_string (unsigned long nbytes)
{
SCHEME_OBJECT result
- = (allocate_non_marked_vector (TC_CHARACTER_STRING,
+ = (allocate_non_marked_vector (TC_BYTEVECTOR,
(STRING_LENGTH_TO_GC_LENGTH (nbytes)),
true));
SET_STRING_LENGTH (result, nbytes);
allocate_string_no_gc (unsigned long nbytes)
{
SCHEME_OBJECT result
- = (allocate_non_marked_vector (TC_CHARACTER_STRING,
+ = (allocate_non_marked_vector (TC_BYTEVECTOR,
(STRING_LENGTH_TO_GC_LENGTH (nbytes)),
false));
SET_STRING_LENGTH (result, nbytes);
SET_STRING_LENGTH (string, length);
MEMORY_SET
(string,
- STRING_HEADER,
+ BYTEVECTOR_HEADER,
(MAKE_OBJECT
(TC_MANIFEST_NM_VECTOR, ((BYTES_TO_WORDS (length + 1)) + 1))));
}
/* Type code definitions */
\f
-#define TC_NULL 0x00
+#define TC_FALSE 0x00
#define TC_LIST 0x01
#define TC_CHARACTER 0x02
#define TC_SCODE_QUOTE 0x03
/* #define TC_PCOMB1 0x1B */
#define TC_CONTROL_POINT 0x1C
#define TC_INTERNED_SYMBOL 0x1D
-#define TC_CHARACTER_STRING 0x1E
+#define TC_BYTEVECTOR 0x1E
#define TC_ACCESS 0x1F
#define TC_HUNK3_A 0x20
#define TC_DEFINITION 0x21
/* 0x1B */ 0, \
/* 0x1C */ "control-point", \
/* 0x1D */ "interned-symbol", \
- /* 0x1e */ "string", \
+ /* 0x1e */ "bytevector", \
/* 0x1f */ "access", \
/* 0x20 */ "hunk3-a", \
/* 0x21 */ "definition", \
/* Aliases */
-#define TC_FALSE TC_NULL
-#define TC_MANIFEST_VECTOR TC_NULL
+#define TC_MANIFEST_VECTOR TC_FALSE
#define TC_BIT_STRING TC_VECTOR_1B
-#define TC_VECTOR_8B TC_CHARACTER_STRING
#define TC_HUNK3 TC_HUNK3_B
#define UNMARKED_HISTORY_TYPE TC_HUNK3_A
(BIGNUM BIG-FIXNUM)
(PROMISE DELAYED)
(FIXNUM ADDRESS POSITIVE-FIXNUM NEGATIVE-FIXNUM)
- (STRING CHARACTER-STRING VECTOR-8B)
+ (BYTEVECTOR STRING CHARACTER-STRING VECTOR-8B)
(HUNK3-A UNMARKED-HISTORY)
(TRIPLE HUNK3 HUNK3-B MARKED-HISTORY)
(REFERENCE-TRAP UNASSIGNED)