basictypes.h

00001 /* File:      basictypes.h
00002 ** Author(s): kifer
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1999
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: basictypes.h,v 1.21 2006/01/14 16:25:32 dwarren Exp $
00022 ** 
00023 */
00024 
00025 
00026 
00027 #ifndef BASIC_TYPES_INCLUDED
00028 #include "xsb_config.h"
00029 #include "cell_def_xsb.h"
00030 
00031 /*******************
00032 * Definitions for the basic Integer and Floating point types. 
00033 *   Each type varies depending on whether the BITS64 and FAST_FLOATS flags are set.
00034 *   These types should be used in place of 'float' and 'int'
00035 *******************/
00036 #ifdef BITS64
00037 typedef long prolog_int ;
00038 typedef long Integer ;
00039 typedef unsigned long UInteger ;
00040 #define MY_MAXINT ((long)0x7fffffffffffff)
00041 #else
00042 typedef int prolog_int ;
00043 typedef int Integer ;
00044 typedef unsigned int UInteger ;
00045 #define MY_MAXINT ((int)0x7fffffff)     /* Modified by Kostis */
00046 #endif
00047 #define MY_MININT (-MY_MAXINT - 1)
00048 typedef double prolog_float;
00049 
00050 #ifndef FAST_FLOATS
00051 typedef double Float;
00052 #else
00053 typedef float Float;
00054 #endif
00055 /*******************************/
00056 
00057 
00058 typedef int reg_num;
00059 
00060 /* CELL and PROLOG_TERM are defined identically.
00061    However, CELL is used to refer to elements of (slg-)WAM stacks, while
00062    PROLOG_TERM is used in the C interface to point to a cell containing 
00063    the outer functor of a prolog term. */
00064 typedef unsigned long prolog_term;
00065 
00066 typedef short  xsbBool;
00067 
00068 #ifndef __RPCNDR_H__
00069 typedef unsigned char byte;
00070 #endif
00071 typedef unsigned int counter;
00072 typedef unsigned long word;
00073 typedef byte *pb;
00074 typedef word *pw;
00075 typedef int (*PFI)(void);
00076 // typedef int *int_ptr;
00077 
00078 
00079 /*******************
00080 * Definitions for converter types. 
00081 *   These types are used as bit manipulation tools, exploiting the shared memory of a union.
00082 
00083 * constraints: each member of the union should have equal size, in bytes.
00084 *******************/
00085 typedef union float_conv {
00086   Cell i;
00087   float f;
00088 } FloatConv;
00089 
00090 typedef union float_to_ints_conv {
00091    Float float_val;
00092    struct {
00093     UInteger high;
00094     UInteger low;
00095    }int_vals;
00096     
00097 } FloatToIntsConv;
00098 
00099 typedef union cell_to_bytes_conv {
00100    Cell cell_val;
00101    struct {
00102     byte b1;
00103     byte b2;
00104     byte b3;
00105     byte b4;
00106    }byte_vals;
00107     
00108 } CellToBytesConv;
00109 
00110 
00111 #endif /* BASIC_TYPES_INCLUDED */
00112 
00113 #define BASIC_TYPES_INCLUDED

Generated on Wed Jul 26 13:30:39 2006 for XSB by  doxygen 1.4.5