#ifndef TAGSH
#define TAGSH
-/* Copyright (C) 1995,1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996, 1997 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice.
- */
+ * If you do not wish that, delete this exception notice. */
\f
/** This file defines the format of SCM values and cons pairs.
* gloc ..........SCM vcell..........001 ...........SCM cdr.............G
* struct ..........void * type........001 ...........void * data.........G
* closure ..........SCM code...........011 ...........SCM env.............G
- * tc7 .........long length....GxxxD1S1 ..........void *data............
+ * tc7 .........long length....Gxxxx1S1 ..........void *data............
*
*
*
* for that type.
*
* Sometimes we choose the bottom seven bits carefully,
- * so that the 4- and 1-valued bits (called the D and S
- * bits) can be masked off to reveal a common type.
+ * so that the 2-valued bit (called S bit) can be masked
+ * off to reveal a common type.
*
* TYP7S(X) returns TYP7, but masking out the option bit S.
- * TYP7D(X) returns TYP7, but masking out the option bit D.
- * TYP7SD(X) masks out both option bits.
*
- * For example, all strings have 001 in the 'xxx' bits in
- * the diagram above, the D bit says whether it's a
- * substring, and the S bit says whether it's a multibyte
- * character string.
+ * For example, all strings have 0010 in the 'xxxx' bits
+ * in the diagram above, the S bit says whether it's a
+ * substring.
*
* for example:
- * D S
+ * S
* scm_tc7_string = G0010101
- * scm_tc7_mb_string = G0010111
- * scm_tc7_substring = G0011101
- * scm_tc7_mb_substring = G0011111
- *
- * TYP7DS turns all string tags into tc7_string; thus,
- * testing TYP7DS against tc7_string is a quick way to
- * test for any kind of string.
- *
- * TYP7S turns tc7_mb_string into tc7_string and
- * tc7_mb_substring into tc7_substring.
+ * scm_tc7_substring = G0010111
*
- * TYP7D turns tc7_mb_substring into tc7_mb_string and
- * tc7_substring into tc7_string.
+ * TYP7S turns both string tags into tc7_string; thus,
+ * testing TYP7S against tc7_string is a quick way to
+ * test for any kind of string, shared or unshared.
*
* Some TC7 types are subdivided into 256 subtypes giving
* rise to the macros:
/* {Non-immediate values.}
*
* If X is non-immediate, it is necessary to look at SCM_CAR (X) to
- * figure out Xs type. X may be a cons pair, in which case the
- * value SCM_CAR (x) will be either an immediate or non-immediate value.
- * X may be something other than a cons pair, in which case the value SCM_CAR (x)
- * will be a non-object value.
- *
- * All immediates and non-immediates have a 0 in bit 0. We additionally preserve
- * the invariant that all non-object values stored in the SCM_CAR of a non-immediate
- * object have a 1 in bit 1:
+ * figure out Xs type. X may be a cons pair, in which case the value
+ * SCM_CAR (x) will be either an immediate or non-immediate value. X
+ * may be something other than a cons pair, in which case the value
+ * SCM_CAR (x) will be a non-object value.
+ *
+ * All immediates and non-immediates have a 0 in bit 0. We
+ * additionally preserve the invariant that all non-object values
+ * stored in the SCM_CAR of a non-immediate object have a 1 in bit 1:
*/
#define SCM_NCONSP(x) (1 & (int)SCM_CAR(x))
#define SCM_CONSP(x) (!SCM_NCONSP(x))
-/* ECONSP is historical and, in fact, slightly buggy.
- * There are two places to fix where structures and glocs can be confused.
- * !!!
+/* SCM_ECONSP should be used instead of SCM_CONSP at places where GLOCS
+ * can be expected to occur.
*/
-#define SCM_ECONSP(x) (SCM_CONSP(x) || (1==SCM_TYP3(x)))
-#define SCM_NECONSP(x) (SCM_NCONSP(x) && (1 != SCM_TYP3(x)))
+#define SCM_ECONSP(x) (SCM_CONSP (x) \
+ || (SCM_TYP3(x) == 1 \
+ && SCM_CDR (SCM_CAR (x) - 1) != 0))
+#define SCM_NECONSP(x) (SCM_NCONSP(x) \
+ && (SCM_TYP3(x) != 1 \
+ || SCM_CDR (SCM_CAR (x) - 1) == 0))
\f
*/
-#define SCM_TYP7(x) (0x7f & (int)SCM_CAR(x))
-#define SCM_TYP7S(x) (0x7d & (int)SCM_CAR(x))
-#define SCM_TYP7SD(x) (0x75 & (int)SCM_CAR(x))
-#define SCM_TYP7D(x) (0x77 & (int)SCM_CAR(x))
+#define SCM_TYP7(x) ((int)SCM_CAR(x) & 0x7f)
+#define SCM_TYP7S(x) ((int)SCM_CAR(x) & (0x7f & ~2))
#define SCM_TYP16(x) (0xffff & (int)SCM_CAR(x))
#define scm_tc7_vector 13
#define scm_tc7_wvect 15
-/* a quad, two couples, two trists */
+/* couple */
#define scm_tc7_string 21
-#define scm_tc7_mb_string 23
-#define scm_tc7_substring 29
-#define scm_tc7_mb_substring 31
+#define scm_tc7_substring 23
+
+/* 29 and 31 are free! */
/* Many of the following should be turned
* into structs or smobs. We need back some
enum scm_tags
{
scm_tc8_char = 0xf4,
- scm_tc8_iloc = 0xfc,
+ scm_tc8_iloc = 0xfc
};
#define SCM_ITAG8(X) ((int)(X) & 0xff)