2011-11-04 09:28:09 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog %W% %G% *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: Yap.h *
|
|
|
|
* mods: *
|
|
|
|
* comments: abstract type definitions for YAP *
|
|
|
|
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
|
|
|
|
*************************************************************************/
|
|
|
|
|
2011-11-10 12:26:23 +00:00
|
|
|
#ifndef YAP_H
|
2011-11-04 09:28:09 +00:00
|
|
|
#include "YapTermConfig.h"
|
2015-01-27 03:25:56 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef void *Functor;
|
|
|
|
typedef void *Atom;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-06-11 19:36:50 +01:00
|
|
|
#if HAVE_STDINT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
|
|
|
#if HAVE_INTTYPES_H
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif
|
|
|
|
|
2016-04-05 02:28:56 +01:00
|
|
|
#define ALIGN_BY_TYPE(X, TYPE) \
|
|
|
|
(((CELL)(X) + (sizeof(TYPE) - 1)) & ~(sizeof(TYPE) - 1))
|
2013-12-02 14:49:41 +00:00
|
|
|
|
2011-11-04 09:28:09 +00:00
|
|
|
#ifndef EXTERN
|
2017-02-20 15:28:46 +00:00
|
|
|
#ifdef MSC_VER
|
2016-02-28 19:32:55 +00:00
|
|
|
#define EXTERN
|
|
|
|
#else
|
2011-11-04 09:28:09 +00:00
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
2016-02-28 19:32:55 +00:00
|
|
|
#endif
|
2011-11-04 09:28:09 +00:00
|
|
|
|
|
|
|
/* defines integer types Int and UInt (unsigned) with the same size as a ptr
|
|
|
|
** and integer types Short and UShort with half the size of a ptr */
|
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
#if defined(PRIdPTR)
|
2016-04-05 02:28:56 +01:00
|
|
|
|
2014-09-10 05:51:44 +01:00
|
|
|
typedef intptr_t Int;
|
|
|
|
typedef uintptr_t UInt;
|
2014-06-11 19:36:50 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
#elif defined(_WIN64)
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef int64_t Int;
|
|
|
|
typedef uint64_t UInt;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
#elif defined(_WIN32)
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef int32_t Int;
|
|
|
|
typedef uint32_t UInt;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-08-03 00:28:02 +01:00
|
|
|
#elif SIZEOF_LONG_INT == SIZEOF_INT_P
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef long int Int;
|
|
|
|
typedef unsigned long int UInt;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
#elif SIZEOF_INT == SIZEOF_INT_P
|
2014-06-16 14:44:04 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef int Int;
|
|
|
|
typedef unsigned int UInt;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-04-05 02:28:56 +01:00
|
|
|
#else
|
2016-07-31 16:31:22 +01:00
|
|
|
#error Yap require integer types of the same size as a pointer
|
2016-04-05 02:28:56 +01:00
|
|
|
#endif
|
2011-11-04 09:28:09 +00:00
|
|
|
|
|
|
|
/* */ typedef short int Short;
|
|
|
|
/* */ typedef unsigned short int UShort;
|
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef UInt CELL;
|
2013-06-22 06:24:53 +01:00
|
|
|
|
|
|
|
typedef uint16_t BITS16;
|
|
|
|
typedef int16_t SBITS16;
|
|
|
|
typedef uint32_t BITS32;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-04-05 02:28:56 +01:00
|
|
|
#define WordSize sizeof(BITS16)
|
|
|
|
#define CellSize sizeof(CELL)
|
|
|
|
#define SmallSize sizeof(SMALLUNSGN)
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2017-02-20 15:28:46 +00:00
|
|
|
#include "YapFormat.h"
|
|
|
|
|
2011-11-04 09:28:09 +00:00
|
|
|
/*************************************************************************************************
|
|
|
|
type casting macros
|
|
|
|
*************************************************************************************************/
|
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef UInt Term;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef Int yhandle_t;
|
2014-06-11 19:36:50 +01:00
|
|
|
|
2014-09-10 05:51:44 +01:00
|
|
|
typedef double Float;
|
2011-11-04 09:28:09 +00:00
|
|
|
|
2016-04-05 02:28:56 +01:00
|
|
|
#if SIZEOF_INT < SIZEOF_INT_P
|
2011-11-04 09:28:09 +00:00
|
|
|
#define SHORT_INTS 1
|
|
|
|
#else
|
|
|
|
#define SHORT_INTS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
typedef long long int YAP_LONG_LONG;
|
|
|
|
typedef unsigned long long int YAP_ULONG_LONG;
|
|
|
|
#else
|
|
|
|
typedef long int YAP_LONG_LONG;
|
|
|
|
typedef unsigned long int YAP_ULONG_LONG;
|
|
|
|
#endif
|
|
|
|
|
2016-04-05 02:28:56 +01:00
|
|
|
#define Unsigned(V) ((CELL)(V))
|
|
|
|
#define Signed(V) ((Int)(V))
|