#ifndef TAGSH
#define TAGSH
-/* Copyright (C) 1995 Free Software Foundation, Inc.
- *
+/* Copyright (C) 1995, 1999, 2007 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
* the Free Software Foundation; either version 2, or (at your option)
* GNU General Public License for more details.
*
* 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.
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
/** This file defines the format of SCM values and cons pairs.
** It is here that tag bits are assigned for various purposes.
**/
-
\f
+
/* Three Bit Tags
- *
+
* 000 -- a non-immediate value. Points into the pair heap.
*
* 001 -- a gloc (i.e., a resolved global variable in a CAR in a code graph)
- * or the CAR of an object handle (i.e., the tagged pointer to the
- * vtable part of a user-defined object).
+ * or the CAR of an object handle (i.e., the tagged pointer to the
+ * vtable part of a user-defined object).
*
* If X has this tag, the value at CDAR(X - 1) distinguishes
- * glocs from object handles. The distinction only needs
- * to be made in a few places. Only a few parts of the code know
- * about glocs. In most cases, when a value in the CAR of a pair
- * has the tag 001, it means that the pair is an object handle.
+ * glocs from object handles. The distinction only needs
+ * to be made in a few places. Only a few parts of the code know
+ * about glocs. In most cases, when a value in the CAR of a pair
+ * has the tag 001, it means that the pair is an object handle.
*
* 010 -- the tag for immediate, exact integers.
*
* 011 -- in the CAR of a pair, this tag indicates that the pair is a closure.
- * The remaining bits of the CAR are a pointer into the pair heap
- * to the code graph for the closure.
+ * The remaining bits of the CAR are a pointer into the pair heap
+ * to the code graph for the closure.
*
* 1xy -- an extension tag which means that there is a five or six bit
- * tag to the left of the low three bits. See the nice diagrams
- * in ../doc/code.doc if you want to know what the bits mean.
+ * tag to the left of the low three bits. See the nice diagrams
+ * in ../doc/code.doc if you want to know what the bits mean.
*/
-
\f
+
#define scm_tc3_cons 0
#define scm_tc3_cons_gloc 1
#define scm_tc3_closure 3
#define scm_tcs_symbols scm_tc7_ssymbol:case scm_tc7_msymbol
#define scm_tcs_bignums tc16_bigpos:case tc16_bigneg
-
\f
+
/* References to objects are of type SCM. Values may be non-immediate
* (pointers) or immediate (encoded, immutable, scalar values that fit
* in an SCM variable).
* to scm_vector elts, functions, &c are not munged.
*/
#ifdef _UNICOS
-# define SCM2PTR(x) ((int)(x) >> 3)
-# define PTR2SCM(x) (((SCM)(x)) << 3)
-# define SCM_POINTERS_MUNGED
+#define SCM2PTR(x) ((int)(x) >> 3)
+#define PTR2SCM(x) (((SCM)(x)) << 3)
+#define SCM_POINTERS_MUNGED
#else
-# define SCM2PTR(x) (x)
-# define PTR2SCM(x) ((SCM)(x))
+#define SCM2PTR(x) (x)
+#define PTR2SCM(x) ((SCM)(x))
#endif /* def _UNICOS */
-
\f
+
/* Immediate? Predicates
*/
#define SCM_IMP(x) (6 & (int)(x))
#define SCM_NIMP(x) (!SCM_IMP(x))
-
\f
+
enum scm_tags
-{
- scm_tc8_char = 0xf4,
-};
+ {
+ scm_tc8_char = 0xf4
+ };
#define SCM_ITAG8(X) ((int)(X) & 0xff)
#define SCM_MAKE_ITAG8(X, TAG) (((X)<<8) + TAG)
#define SCM_ITAG8_DATA(X) ((X)>>8)
+\f
-\f
/* Local Environment Structure
*/
#define SCM_ILOCP(n) ((0xff & (int)(n))==0xfc)
#define SCM_IFRAME(n) ((int)((SCM_ICDR-SCM_IFRINC)>>8) & ((int)(n)>>8))
#define SCM_IDIST(n) (((unsigned long)(n))>>20)
#define SCM_ICDRP(n) (SCM_ICDR & (n))
-
\f
+
/* Immediate Symbols, Special Symbols, Flags (various constants).
*/
#endif
#define SCM_UNSPECIFIED SCM_MAKIFLAG(SCM_NUM_ISYMS+5)
-
\f
+
/* Heap Pairs and the Empty List Predicates
*/
#define SCM_NULLP(x) (SCM_EOL == (x))
#define SCM_NNULLP(x) (SCM_EOL != (x))
#define SCM_CELLP(x) (!SCM_NCELLP(x))
#define SCM_NCELLP(x) ((sizeof(scm_cell)-1) & (int)(x))
+\f
-\f
#define SCM_UNBNDP(x) (SCM_UNDEFINED==(x))
-
\f
+
/* Testing and Changing GC Marks in Various Standard Positions
*/
#define SCM_GCMARKP(x) (1 & (int)SCM_CDR(x))
#define SCM_CLRGCMARK(x) (SCM_CDR(x) &= ~1L)
#define SCM_SETGC8MARK(x) (SCM_CAR(x) |= 0x80)
#define SCM_CLRGC8MARK(x) (SCM_CAR(x) &= ~0x80L)
-
\f
+
/* Extracting Tag Bits, With or Without GC Safety and Optional Bits
*/
#define SCM_TYP3(x) (7 & (int)SCM_CAR(x))
#define SCM_TYP16(x) (0xffff & (int)SCM_CAR(x))
#define SCM_TYP16S(x) (0xfeff & (int)SCM_CAR(x))
#define SCM_GCTYP16(x) (0xff7f & (int)SCM_CAR(x))
-
\f
+
/* Two slightly extensible types: smobs and ptobs.
- *
+
*/
#define SCM_SMOBNUM(x) (0x0ff & (CAR(x)>>8));
#define SCM_PTOBNUM(x) (0x0ff & (CAR(x)>>8));
+\f
-\f
#define SCM_DIRP(x) (SCM_NIMP(x) && (TYP16(x)==(scm_tc16_dir)))
#define SCM_OPDIRP(x) (SCM_NIMP(x) && (CAR(x)==(scm_tc16_dir | OPN)))
-
\f
+
/* Lvectors
*/
#define SCM_LVECTORP(x) (TYP7(x)==tc7_lvector)
-
\f
+
#if 0
\f
/* Sockets
#define tc_socket (tc7_port | OPN)
#define SCM_SOCKP(x) (((0x7f | OPN | RDNG | WRTNG) & CAR(x))==(tc_socket))
#define SCM_SOCKTYP(x) (CAR(x)>>24)
-
\f
+
extern int scm_tc16_key_vector;
#define SCM_KEYVECP(X) (scm_tc16_key_vector == TYP16 (X))
#define SCM_KEYVECLEN(OBJ) (((unsigned long)CAR (obj)) >> 16)
-
\f
+
#define SCM_MALLOCDATA(obj) ((char *)CDR(obj))
#define SCM_MALLOCLEN(obj) (((unsigned long)CAR (obj)) >> 16)
#define SCM_WORDDATA(obj) (CDR (obj))
#define SCM_BYTECODE_NAME(X) (VELTS(X)[3])
#define SCM_BYTECODE_BCODE(X) (VELTS(X)[4])
#define SCM_BYTECODE_ELTS 5
-
\f
+
#define SCM_FREEP(x) (CAR(x)==tc_free_cell)
#define SCM_NFREEP(x) (!FREEP(x))
\f
-#endif /* 0*/
+#endif /* 0 */
\f
-#ifdef __STDC__
-
-#else /* STDC */
-
-#endif /* STDC */
-
-#endif /* TAGSH */
+#endif /* TAGSH */