make it easier for outside packages to link with YAP innards.
This commit is contained in:
parent
682db0aad4
commit
6c36a8ccd3
25
H/TermExt.h
25
H/TermExt.h
@ -148,8 +148,8 @@ exts;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef YAP_H
|
||||
|
||||
#ifdef YAP_H
|
||||
/* make sure that these data structures are the first thing to be allocated
|
||||
in the heap when we start the system */
|
||||
#ifdef THREADS
|
||||
@ -175,7 +175,9 @@ typedef struct special_functors_struct
|
||||
special_functors;
|
||||
#endif
|
||||
|
||||
inline EXTERN Float STD_PROTO (CpFloatUnaligned, (CELL *));
|
||||
#endif /* YAP_H */
|
||||
|
||||
inline extern Float CpFloatUnaligned(CELL *ptr);
|
||||
|
||||
#if SIZEOF_DOUBLE == SIZEOF_LONG_INT
|
||||
|
||||
@ -214,7 +216,7 @@ CpFloatUnaligned(CELL *ptr)
|
||||
|
||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
||||
|
||||
inline EXTERN void STD_PROTO (AlignGlobalForDouble, ( USES_REGS1 ));
|
||||
inline extern void AlignGlobalForDouble( USES_REGS1 );
|
||||
|
||||
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR) & 0x4)
|
||||
|
||||
@ -272,13 +274,16 @@ FloatOfTerm (Term t)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Term STD_PROTO (Yap_MkBlobStringTerm, (const char *, size_t len));
|
||||
Term STD_PROTO (Yap_MkBlobWideStringTerm, (const wchar_t *, size_t len));
|
||||
char *STD_PROTO (Yap_BlobStringOfTerm, (Term));
|
||||
wchar_t *STD_PROTO (Yap_BlobWideStringOfTerm, (Term));
|
||||
char *STD_PROTO (Yap_BlobStringOfTermAndLength, (Term, size_t *));
|
||||
#ifndef YAP_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
Term Yap_MkBlobStringTerm(const char *, size_t len);
|
||||
Term Yap_MkBlobWideStringTerm(const wchar_t *, size_t len);
|
||||
char *Yap_BlobStringOfTerm(Term);
|
||||
wchar_t *Yap_BlobWideStringOfTerm(Term);
|
||||
char *Yap_BlobStringOfTermAndLength(Term, size_t *);
|
||||
|
||||
#endif /* YAP_NOT_INSTALLED */
|
||||
|
||||
|
||||
inline EXTERN int IsFloatTerm (Term);
|
||||
@ -294,7 +299,6 @@ IsFloatTerm (Term t)
|
||||
|
||||
/* extern Functor FunctorLongInt; */
|
||||
|
||||
#ifdef YAP_H
|
||||
inline EXTERN Term MkLongIntTerm (Int);
|
||||
|
||||
inline EXTERN Term
|
||||
@ -308,7 +312,6 @@ MkLongIntTerm (Int i)
|
||||
return AbsAppl(H - 3);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline EXTERN Int LongIntOfTerm (Term t);
|
||||
|
||||
|
69
H/Yap.h
69
H/Yap.h
@ -818,6 +818,12 @@ extern struct worker_local Yap_local;
|
||||
#include "dlocals.h"
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
unification support
|
||||
*************************************************************************************************/
|
||||
|
||||
#include "YapCompoundTerm.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
unification routines
|
||||
*************************************************************************************************/
|
||||
@ -831,69 +837,6 @@ extern struct worker_local Yap_local;
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
High level macros to access arguments
|
||||
*************************************************************************************************/
|
||||
|
||||
inline EXTERN Term ArgOfTerm (int i, Term t);
|
||||
|
||||
inline EXTERN Term
|
||||
ArgOfTerm (int i, Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepAppl (t) + (i)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term HeadOfTerm (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
HeadOfTerm (Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepPair (t)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term TailOfTerm (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
TailOfTerm (Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepPair (t) + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term ArgOfTermCell (int i, Term t);
|
||||
|
||||
inline EXTERN Term
|
||||
ArgOfTermCell (int i, Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepAppl (t) + (i)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term HeadOfTermCell (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
HeadOfTermCell (Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepPair (t)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term TailOfTermCell (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
TailOfTermCell (Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepPair (t) + 1));
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
slots
|
||||
|
115
H/YapCompoundTerm.h
Normal file
115
H/YapCompoundTerm.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog %W% %G% *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2012 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: YapCompounTerm.h *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************************************
|
||||
High level macros to access arguments
|
||||
*************************************************************************************************/
|
||||
|
||||
#ifndef YAPCOMPOUNDTERM_H
|
||||
|
||||
#define YAPCOMPOUNDTERM_H 1
|
||||
|
||||
EXTERN Int Yap_unify(Term a,Term b);
|
||||
|
||||
EXTERN inline Term Deref(Term a);
|
||||
|
||||
EXTERN inline Term Deref(Term a)
|
||||
{
|
||||
while(IsVarTerm(a)) {
|
||||
Term *b = (Term *) a;
|
||||
a = *b;
|
||||
if(a==((Term) b)) return a;
|
||||
}
|
||||
return(a);
|
||||
}
|
||||
|
||||
EXTERN inline Term Derefa(CELL *b);
|
||||
|
||||
EXTERN inline Term
|
||||
Derefa(CELL *b)
|
||||
{
|
||||
Term a = *b;
|
||||
restart:
|
||||
if (!IsVarTerm(a)) {
|
||||
return(a);
|
||||
} else if (a == (CELL)b) {
|
||||
return(a);
|
||||
} else {
|
||||
b = (CELL *)a;
|
||||
a = *b;
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
|
||||
inline EXTERN Term ArgOfTerm (int i, Term t);
|
||||
|
||||
inline EXTERN Term
|
||||
ArgOfTerm (int i, Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepAppl (t) + (i)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term HeadOfTerm (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
HeadOfTerm (Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepPair (t)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term TailOfTerm (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
TailOfTerm (Term t)
|
||||
{
|
||||
return (Term) (Derefa (RepPair (t) + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term ArgOfTermCell (int i, Term t);
|
||||
|
||||
inline EXTERN Term
|
||||
ArgOfTermCell (int i, Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepAppl (t) + (i)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term HeadOfTermCell (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
HeadOfTermCell (Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepPair (t)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline EXTERN Term TailOfTermCell (Term);
|
||||
|
||||
inline EXTERN Term
|
||||
TailOfTermCell (Term t)
|
||||
{
|
||||
return (Term) ((CELL) (RepPair (t) + 1));
|
||||
}
|
||||
|
||||
#endif /* YAPCOMPOUNDTERM_H */
|
10
H/YapTags.h
10
H/YapTags.h
@ -184,8 +184,6 @@ IsUnboundVar (Term * t)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef YAP_H
|
||||
|
||||
inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
|
||||
|
||||
inline EXTERN Term
|
||||
@ -194,8 +192,6 @@ MkVarTerm__ ( USES_REGS1 )
|
||||
return (Term) ((*H = (CELL) H, H++));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
inline EXTERN int IsUnboundVar (Term *);
|
||||
|
||||
@ -316,8 +312,7 @@ IsIntTerm (Term t)
|
||||
}
|
||||
|
||||
|
||||
#ifdef YAP_H
|
||||
EXTERN inline Term STD_PROTO (MkPairTerm__, (Term, Term CACHE_TYPE) );
|
||||
EXTERN inline Term MkPairTerm__(Term head, Term tail CACHE_TYPE );
|
||||
|
||||
EXTERN inline Term
|
||||
MkPairTerm__ (Term head, Term tail USES_REGS)
|
||||
@ -330,7 +325,6 @@ MkPairTerm__ (Term head, Term tail USES_REGS)
|
||||
return (AbsPair (p));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Needed to handle numbers:
|
||||
@ -395,4 +389,6 @@ IntegerOfTerm (Term t)
|
||||
return (Int) (IsIntTerm (t) ? IntOfTerm (t) : LongIntOfTerm (t));
|
||||
}
|
||||
|
||||
#ifndef YAP_H
|
||||
|
||||
#endif
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
typedef void *Functor;
|
||||
typedef void *Atom;
|
||||
|
||||
#define CACHE_TYPE
|
||||
#define CACHE_TYPE1 void
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef EXTERN
|
||||
@ -134,3 +138,4 @@ typedef unsigned long int YAP_ULONG_LONG;
|
||||
|
||||
#define Unsigned(V) ((CELL) (V))
|
||||
#define Signed(V) ((Int) (V))
|
||||
|
||||
|
31
H/amiops.h
31
H/amiops.h
@ -87,35 +87,6 @@ Dereferencing macros
|
||||
|
||||
#endif /* UNIQUE_TAG_FOR_PAIRS */
|
||||
|
||||
EXTERN Term STD_PROTO(Deref,(Term));
|
||||
EXTERN Term STD_PROTO(Derefa,(CELL *));
|
||||
|
||||
EXTERN inline Term Deref(Term a)
|
||||
{
|
||||
while(IsVarTerm(a)) {
|
||||
Term *b = (Term *) a;
|
||||
a = *b;
|
||||
if(a==((Term) b)) return a;
|
||||
}
|
||||
return(a);
|
||||
}
|
||||
|
||||
EXTERN inline Term
|
||||
Derefa(CELL *b)
|
||||
{
|
||||
Term a = *b;
|
||||
restart:
|
||||
if (!IsVarTerm(a)) {
|
||||
return(a);
|
||||
} else if (a == (CELL)b) {
|
||||
return(a);
|
||||
} else {
|
||||
b = (CELL *)a;
|
||||
a = *b;
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
||||
TRAIL VARIABLE
|
||||
@ -309,8 +280,6 @@ Unification Routines
|
||||
|
||||
*************************************************************/
|
||||
|
||||
EXTERN Int STD_PROTO(Yap_unify,(Term,Term));
|
||||
|
||||
inline EXTERN void STD_PROTO(reset_trail,(tr_fr_ptr));
|
||||
|
||||
inline EXTERN void
|
||||
|
@ -122,8 +122,9 @@ INTERFACE_HEADERS = \
|
||||
$(srcdir)/H/Tags_32LowTag.h \
|
||||
$(srcdir)/H/Tags_64bits.h \
|
||||
$(srcdir)/H/Tags_24bits.h \
|
||||
$(srcdir)/H/YapTerm.h \
|
||||
$(srcdir)/H/YapCompoundTerm.h \
|
||||
$(srcdir)/include/YapRegs.h \
|
||||
$(srcdir)/H/YapTerm.h \
|
||||
$(srcdir)/library/dialect/bprolog/fli/bprolog.h \
|
||||
$(srcdir)/os/SWI-Stream.h
|
||||
|
||||
@ -409,7 +410,9 @@ all: parms.h startup.yss @ENABLE_WINCONSOLE@ pl-yap@EXEC_SUFFIX@
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in
|
||||
|
||||
$(srcdir)/H/Yap.h: config.h YapTermConfig.h $(srcdir)/H/YapTags.h
|
||||
$(srcdir)/H/Yap.h: config.h YapTermConfig.h \
|
||||
$(srcdir)/H/YapTags.h \
|
||||
$(srcdir)/H/YapCompoundTerm.h
|
||||
|
||||
config.h: parms.h
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
#ifndef YAP_CONFIG_H
|
||||
|
||||
#define YAP_CONFIG_H
|
||||
|
||||
#include "parms.h"
|
||||
|
||||
/* are dynamic arrays supported? */
|
||||
@ -347,5 +351,4 @@
|
||||
|
||||
#undef MAX_THREADS
|
||||
|
||||
|
||||
|
||||
#endif /* YAP_CONFIG_H */
|
@ -9,8 +9,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <YapTerm.h>
|
||||
#include <YapTags.h>
|
||||
#include <YapRegs.h>
|
||||
#include <YapTags.h>
|
||||
|
||||
typedef void *SYM_REC_PTR;
|
||||
|
||||
|
Reference in New Issue
Block a user