/*
 * This file is part of the Poliqarp suite.
 * 
 * Copyright (C) 2004-2009 by Instytut Podstaw Informatyki Polskiej
 * Akademii Nauk (IPI PAN; Institute of Computer Science, Polish
 * Academy of Sciences; cf. www.ipipan.waw.pl).  All rights reserved.
 * 
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation and appearing in the file gpl.txt included in the packaging
 * of this file.  (See http://www.gnu.org/licenses/translations.html for
 * unofficial translations.)
 * 
 * A commercial license is available from IPI PAN (contact
 * Michal.Ciesiolka@ipipan.waw.pl or ipi@ipipan.waw.pl for more
 * information).  Licensees holding a valid commercial license from IPI
 * PAN may use this file in accordance with that license.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

/* LPTR
 * 
 * lptr is a tagged pointer. The two least significant bits have special meaning.
 * Tag explanation chart:
 * bits 2->31        : value (depends on tag)
 * bit  1        : integer indicator
 * bit  0        : garbage collector mark
 * 
 * Bit 1 meaning:
 *         *set*                -> value is a 30 bit integer.
 *         *clear*                -> value is a pointer to cell8. (described below)
 *
 *         
 * Bit 0 meaning:
 *         *clear*                -> this lptr has not been traversed yet
 *         *set*                -> this pointer was traversed
 *
 * Also in general bit-zero is reserved for special purpose things so it's not
 * reusable for any value semantic
 *
 *
 * There are two special cases, both require bit 2 and bit 1 : clear
 *  if value == 0: the lptr has the NIL value
 *  If value == 1: the lptr has the T value
 *
 *
 * Cell8 is composed of two lptr's: car and cdr but tag meaning has changed a little.
 *
 *                     car.bit0
 *            [clear]   /   \   [set]
 *                    /       \
 *                  /           \
 *                /               \
 *  /------------+--------\    /---+---------------------\
 * | This is a cons cell,  |  | This is a special cell,   |
 * | cdr.bit1 is used for  |  | all remaining bits of car |
 * | garbage collection.   |  | are described below.      |
 * | All other bits retain |  |                           |
 * | their meaning.        |  |                           |
 *  \---------------------/    \-------------------------/
 */
