fix recent includes.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1921 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2007-09-04 22:37:02 +00:00
parent 4c08960096
commit 35cb7569b7
3 changed files with 3139 additions and 4792 deletions

File diff suppressed because it is too large Load Diff

View File

@ -356,6 +356,7 @@ X_API int PL_get_long(term_t ts, long *i)
return 1; return 1;
} }
X_API int PL_get_int64(term_t ts, int64_t *i) X_API int PL_get_int64(term_t ts, int64_t *i)
{ {
YAP_Term t = YAP_GetFromSlot(ts); YAP_Term t = YAP_GetFromSlot(ts);
@ -367,14 +368,14 @@ X_API int PL_get_int64(term_t ts, int64_t *i)
return 1; return 1;
} }
#if USE_GMP #if USE_GMP
} else if (YAP_IsBigIntTerm(t)) { } else if (YAP_IsBigNumTerm(t)) {
MP_INT *g; MP_INT g;
char s[64]; char s[64];
YAP_BigNumOfTerm(t, (void *)g); YAP_BigNumOfTerm(t, (void *)&g);
if (mpz_sizeinbase(g,2) > 64) { if (mpz_sizeinbase(&g,2) > 64) {
return 0; return 0;
} }
mpz_get_str (s, 10, g); mpz_get_str (s, 10, &g);
sscanf(s, "%lld", (long long int *)i); sscanf(s, "%lld", (long long int *)i);
return 1; return 1;
#endif #endif
@ -385,6 +386,7 @@ X_API int PL_get_int64(term_t ts, int64_t *i)
return 1; return 1;
} }
X_API int PL_get_list(term_t ts, term_t h, term_t tl) X_API int PL_get_list(term_t ts, term_t h, term_t tl)
{ {
YAP_Term t = YAP_GetFromSlot(ts); YAP_Term t = YAP_GetFromSlot(ts);
@ -639,13 +641,13 @@ X_API void PL_put_integer(term_t t, long n)
X_API void PL_put_int64(term_t t, int64_t n) X_API void PL_put_int64(term_t t, int64_t n)
{ {
#if HAVE_GMP #if USE_GMP
char s[64]; char s[64];
MP_INT *rop; MP_INT rop;
sprintf(s, "%lld", (long long int)n); sprintf(s, "%lld", (long long int)n);
mpz_init_set_str (rop, s, 10); mpz_init_set_str (&rop, s, 10);
YAP_PutInSlot(t,YAP_MkBigIntTerm((void *)rop)); YAP_PutInSlot(t,YAP_MkBigNumTerm((void *)&rop));
#endif #endif
} }
@ -744,14 +746,14 @@ X_API int PL_unify_integer(term_t t, long n)
YAP long int unify(YAP_Term* a, Term* b) */ YAP long int unify(YAP_Term* a, Term* b) */
X_API int PL_unify_int64(term_t t, int64_t n) X_API int PL_unify_int64(term_t t, int64_t n)
{ {
#if HAVE_GMP #if USE_GMP
YAP_Term iterm; YAP_Term iterm;
char s[64]; char s[64];
MP_INT *rop; MP_INT rop;
sprintf(s, "%lld", (long long int)n); sprintf(s, "%lld", (long long int)n);
mpz_init_set_str (rop, s, 10); mpz_init_set_str (&rop, s, 10);
iterm = YAP_MkBigIntTerm((void *)rop); iterm = YAP_MkBigNumTerm((void *)&rop);
return YAP_Unify(YAP_GetFromSlot(t),iterm); return YAP_Unify(YAP_GetFromSlot(t),iterm);
#else #else
return FALSE; return FALSE;

View File

@ -18,6 +18,9 @@
#if HAVE_TIME_H #if HAVE_TIME_H
#include <time.h> #include <time.h>
#endif #endif
#if USE_GMP
#include <gmp.h>
#endif
#if defined(_MSC_VER) && defined(YAP_EXPORTS) #if defined(_MSC_VER) && defined(YAP_EXPORTS)
#define X_API __declspec(dllexport) #define X_API __declspec(dllexport)