/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bitstr.h,v 1.2 1987/05/14 13:47:34 cph Rel $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bitstr.h,v 1.3 1987/08/06 05:03:44 jinx Exp $
Copyright (c) 1987 Massachusetts Institute of Technology
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* Bit string macros. */
+/* Bit string macros. "Little indian" version. */
\f
+#define BIT_STRING_LENGTH_OFFSET 1
+#define BIT_STRING_FIRST_WORD 2
+
+#define bits_to_pointers(bits) \
+(((bits) + (POINTER_LENGTH - 1)) / POINTER_LENGTH)
+
+#define low_mask(nbits) ((1 << (nbits)) - 1)
+#define any_mask(nbits, offset) ((low_mask (nbits)) << (offset))
+
#define bit_string_length(bit_string) \
-(Fast_Vector_Ref (bit_string, NM_ENTRY_COUNT))
+(Fast_Vector_Ref (bit_string, BIT_STRING_LENGTH_OFFSET))
#define bit_string_start_ptr(bit_string) \
-(Nth_Vector_Loc (bit_string, NM_DATA))
+(Nth_Vector_Loc (bit_string, BIT_STRING_FIRST_WORD))
#define bit_string_end_ptr(bit_string) \
(Nth_Vector_Loc (bit_string, ((Vector_Length (bit_string)) + 1)))
-#define any_mask(nbits, offset) ((low_mask (nbits)) << (offset))
-#define low_mask(nbits) ((1 << (nbits)) - 1)
+#define bit_string_msw(bit_string) \
+(bit_string_word(bit_string_high_ptr(bit_string)))
+
+#define bit_string_lsw(bit_string) \
+(bit_string_word(Nth_Vector_Loc(bit_string, index_to_word(bit_string, 0))))
+
+#define index_pair_to_bit_fixnum(string, word, bit) \
+(Make_Unsigned_Fixnum (index_pair_to_bit_number (string, word, bit)))
+\f
+/* Byte order dependencies. */
+
+#ifdef VAX_BYTE_ORDER
+
+/*
+
+Memory layout of bit strings:
+
++-------+-------+-------+-------+
+| NMV | GC size (longwords) | 0
++-------+-------+-------+-------+
+| Size in bits | 1
++-------+-------+-------+-------+
+| LSB| 2
++-------+-------+-------+-------+
+| | 3
++-------+-------+-------+-------+
+. . .
+. . .
+. . .
++-------+-------+-------+-------+
+|MSB | N
++-------+-------+-------+-------+
+
+The last data word (marked as word "N" above) is where any excess
+bits are kept.
+
+The "size in bits" is a C "long" integer.
+
+*/
+
+#define bit_string_high_ptr bit_string_end_ptr
+
+#define bit_string_low_ptr bit_string_start_ptr
+
+#define bit_string_word(ptr) (*((ptr) - 1))
+
+#define dec_bit_string_ptr(ptr) (--(ptr))
+
+#define inc_bit_string_ptr(ptr) ((ptr)++)
+
+#define object_msw_ptr(object, length) \
+(Get_Pointer(object) + bits_to_pointers(length - 1))
+
+/* This is off by one so bit_string_word will get the correct word. */
+
+#define index_to_word(bit_string, index) \
+((BIT_STRING_FIRST_WORD + 1) + (index / POINTER_LENGTH))
+
+#define index_pair_to_bit_number(string, word, bit) \
+(((word) * POINTER_LENGTH) + (bit))
+
+
+\f
+#else /* not VAX_BYTE_ORDER */
+
+/*
+
+Memory layout of bit strings:
+
++-------+-------+-------+-------+
+| NMV | GC size (longwords) | 0
++-------+-------+-------+-------+
+| Size in bits | 1
++-------+-------+-------+-------+
+|MSB | 2
++-------+-------+-------+-------+
+| | 3
++-------+-------+-------+-------+
+. . .
+. . .
+. . .
++-------+-------+-------+-------+
+| LSB| N
++-------+-------+-------+-------+
+
+The first data word (marked as word "2" above) is where any excess
+bits are kept.
+
+The "size in bits" is a C "long" integer.
+*/
+
+#define bit_string_high_ptr bit_string_start_ptr
+
+#define bit_string_low_ptr bit_string_end_ptr
+
+#define bit_string_word(ptr) (*(ptr))
+
+#define dec_bit_string_ptr(ptr) ((ptr)++)
+
+#define inc_bit_string_ptr(ptr) (--(ptr))
+
+#define object_msw_ptr(object, length) (Get_Pointer(object))
/* This is especially clever. To understand it, note that the index
of the last pointer of a vector is also the GC length of the
#define index_to_word(bit_string, index) \
((Vector_Length (bit_string)) - (index / POINTER_LENGTH))
-#define bits_to_pointers(bits) \
-(((bits) + (POINTER_LENGTH - 1)) / POINTER_LENGTH)
-
#define index_pair_to_bit_number(string, word, bit) \
((((Vector_Length (string)) - (word)) * POINTER_LENGTH) + (bit))
-#define index_pair_to_bit_fixnum(string, word, bit) \
-(Make_Unsigned_Fixnum (index_pair_to_bit_number (string, word, bit)))
+
+#endif /* VAX_BYTE_ORDER */
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/config.h,v 9.29 1987/06/19 15:53:28 jinx Rel $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/config.h,v 9.30 1987/08/06 05:05:07 jinx Exp $
*
* This file contains the configuration information and the information
* given on the command line on Unix.
(i.e. Pointer) results in a logical (vs. arithmetic) shift.
Setting the flag allows faster type code extraction.
+ VAX_BYTE_ORDER is defined if the least significant byte of a
+ longword in memory lies at the lowest address, not defined if the
+ opposite convention holds (ie. Motorola MC6820), or the concept
+ does not apply (ie. DEC PDP-10).
+
BELL is the character which rings the terminal bell.
The following switches are used to use the system provided library
#define FASL_HP_SPECTRUM 10
#define FASL_UMAX 11
#define FALS_PYR 12
+#define FASL_ALLIANT 13
\f
/* These (pdp10 and nu) haven't worked in a while.
* Should be upgraded or flushed some day.
#endif
\f
#ifdef vax
+
/* Amazingly unix and vms agree on all these */
+
#define Heap_In_Low_Memory
#define UNSIGNED_SHIFT
+#define VAX_BYTE_ORDER
#define CHAR_SIZE 8
#define USHORT_SIZE 16
#define ULONG_SIZE 32
#define FLONUM_MANTISSA_BITS 52
#define MAX_FLONUM_EXPONENT 2047
#endif
+
+#ifdef alliant
+#define Heap_In_Low_Memory
+#define UNSIGNED_SHIFT
+#define CHAR_SIZE 8
+#define USHORT_SIZE 16
+#define ULONG_SIZE 32
+#define BELL '\007'
+#define FASL_INTERNAL_FORMAT FASL_ALLIANT
+#define FLONUM_EXPT_SIZE 10
+#define FLONUM_MANTISSA_BITS 53
+#define MAX_FLONUM_EXPONENT 1023
+#define HAS_FLOOR
+#define HAS_FREXP
+#endif
\f
/* Make sure that some definition applies.
If this error occurs, and the parameters of the
promotional, or sales literature without prior written consent from
MIT in each case. */
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/wsize.c,v 9.22 1987/07/07 02:22:55 jinx Rel $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/wsize.c,v 9.23 1987/08/06 05:04:42 jinx Rel $ */
\f
#include <stdio.h>
#include <math.h>
int count, expt_size, char_size, mant_size;
unsigned long to_be_shifted;
unsigned bogus;
+ char buffer[sizeof(long)];
char *temp;
setup_error();
count += 1)
bogus >>= 1;
- char_size = count/(sizeof(unsigned));
+ char_size = count / (sizeof(unsigned));
+
temp = malloc(MEM_SIZE*sizeof(long));
if (temp == NULL)
+ {
printf("/%c Cannot allocate %d Pointers. %c/\n",
'*', MEM_SIZE, '*');
- else count = free(temp);
-
- if (((unsigned long) temp) < (1 << ((char_size*sizeof(long))-8)))
- printf("#define Heap_In_Low_Memory\n");
+ printf("/%c Will not assume that the Heap is in Low Memory. %c\n",
+ '*', '*');
+ }
else
- printf("/%c Heap is not in Low Memory. %c/\n", '*', '*');
+ {
+ count = free(temp);
+ if (((unsigned long) temp) < (1 << ((char_size * sizeof(long)) - 8)))
+ printf("#define Heap_In_Low_Memory\n");
+ else
+ printf("/%c Heap is not in Low Memory. %c/\n", '*', '*');
+ }
to_be_shifted = -1;
if ((to_be_shifted >> 1) != to_be_shifted)
printf("/%c unsigned longs use arithmetic shifting. %c/\n",
'*', '*');
+ if (sizeof(long) == sizeof(char))
+ {
+ printf("/%c sizeof(long) == sizeof(char); no byte order problems! %c/\n",
+ '*', '*');
+ }
+ else
+ {
+ buffer[0] = 1;
+ for (count = 1; count < sizeof(long); )
+ buffer[count++] = 0;
+ if (*((long *) &buffer[0]) == 1)
+ printf("#define VAX_BYTE_ORDER\n");
+ else
+ printf("/%c VAX_BYTE_ORDER not used. %c/\n", '*', '*');
+ }
+
printf("#define CHAR_SIZE %d\n",
char_size);
printf("#define FLONUM_EXPT_SIZE %d\n", expt_size);
printf("#define FLONUM_MANTISSA_BITS %d\n", mant_size);
printf("#define MAX_FLONUM_EXPONENT %d\n", ((1 << expt_size) - 1));
- printf("/%c Representation %s hidden bit. %c/\n", '*',
- (((2+expt_size+mant_size) > (char_size*sizeof(double))) ?
+ printf("/%c Floating point representation %s hidden bit. %c/\n", '*',
+ (((2 + expt_size + mant_size) > (char_size * sizeof(double))) ?
"uses" :
"does not use"), '*');
return;