Merge branch 'master' of /cygdrive/z/vitor/Yap/yap-6.3

This commit is contained in:
U-WIN-U2045GN0RNQ\Vítor Santos Costa 2011-07-26 17:07:10 +01:00
commit 5437984815
4 changed files with 107 additions and 10 deletions

View File

@ -251,17 +251,12 @@ typedef unsigned long int YAP_ULONG_LONG;
#endif /* FORCE_SECOND_QUADRANT */ #endif /* FORCE_SECOND_QUADRANT */
#if !defined(IN_SECOND_QUADRANT) #if !defined(IN_SECOND_QUADRANT)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(mips) || defined(__APPLE__) || defined(__DragonFly__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(mips) || (__DragonFly__)
#if defined(YAPOR) && defined(__alpha) #if defined(YAPOR) && defined(__alpha)
#define MMAP_ADDR 0x40000000 #define MMAP_ADDR 0x40000000
#elif defined(mips) #elif defined(mips)
#define MMAP_ADDR 0x02000000 #define MMAP_ADDR 0x02000000
#elif defined(__APPLE__) && __LP64__
// this address is high enough that it is likely not to confuse Apple's malloc debugger; lowest possible is 0x100200000
#define MMAP_ADDR 0x200000000
#elif defined(__APPLE__) && !__LP64__
#define MMAP_ADDR 0x20000000
#elif defined(__powerpc__) #elif defined(__powerpc__)
#define MMAP_ADDR 0x20000000 #define MMAP_ADDR 0x20000000
#else #else

View File

@ -683,6 +683,36 @@ PL_EXPORT(LRESULT) PL_win_message_proc(HWND hwnd,
X_API intptr_t PL_query(int); /* get information from Prolog */ X_API intptr_t PL_query(int); /* get information from Prolog */
/*******************************
* ERRORS *
*******************************/
PL_EXPORT(int) PL_get_atom_ex(term_t t, atom_t *a);
PL_EXPORT(int) PL_get_integer_ex(term_t t, int *i);
PL_EXPORT(int) PL_get_long_ex(term_t t, long *i);
PL_EXPORT(int) PL_get_int64_ex(term_t t, int64_t *i);
PL_EXPORT(int) PL_get_intptr_ex(term_t t, intptr_t *i);
PL_EXPORT(int) PL_get_size_ex(term_t t, size_t *i);
PL_EXPORT(int) PL_get_bool_ex(term_t t, int *i);
PL_EXPORT(int) PL_get_float_ex(term_t t, double *f);
PL_EXPORT(int) PL_get_char_ex(term_t t, int *p, int eof);
PL_EXPORT(int) PL_unify_bool_ex(term_t t, int val);
PL_EXPORT(int) PL_get_pointer_ex(term_t t, void **addrp);
PL_EXPORT(int) PL_unify_list_ex(term_t l, term_t h, term_t t);
PL_EXPORT(int) PL_unify_nil_ex(term_t l);
PL_EXPORT(int) PL_get_list_ex(term_t l, term_t h, term_t t);
PL_EXPORT(int) PL_get_nil_ex(term_t l);
PL_EXPORT(int) PL_instantiation_error(term_t culprit);
PL_EXPORT(int) PL_representation_error(const char *resource);
PL_EXPORT(int) PL_type_error(const char *expected, term_t culprit);
PL_EXPORT(int) PL_domain_error(const char *expected, term_t culprit);
PL_EXPORT(int) PL_existence_error(const char *type, term_t culprit);
PL_EXPORT(int) PL_permission_error(const char *operation,
const char *type, term_t culprit);
PL_EXPORT(int) PL_resource_error(const char *resource);
/******************************* /*******************************
* BLOBS * * BLOBS *
*******************************/ *******************************/

View File

@ -184,6 +184,76 @@ PL_unify_bool_ex(term_t t, bool val)
return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_bool, t); return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_bool, t);
} }
/*******************************
* TYPICAL ERRORS *
*******************************/
int
PL_instantiation_error(term_t actual)
{ return PL_error(NULL, 0, NULL, ERR_INSTANTIATION);
}
int
PL_representation_error(const char *resource)
{ atom_t r = PL_new_atom(resource);
int rc = PL_error(NULL, 0, NULL, ERR_RESOURCE, r);
PL_unregister_atom(r);
return rc;
}
int
PL_type_error(const char *expected, term_t actual)
{ return PL_error(NULL, 0, NULL, ERR_CHARS_TYPE, expected, actual);
}
int
PL_domain_error(const char *expected, term_t actual)
{ atom_t a = PL_new_atom(expected);
int rc = PL_error(NULL, 0, NULL, ERR_DOMAIN, a, actual);
PL_unregister_atom(a);
return rc;
}
int
PL_existence_error(const char *type, term_t actual)
{ atom_t a = PL_new_atom(type);
int rc = PL_error(NULL, 0, NULL, ERR_EXISTENCE, a, actual);
PL_unregister_atom(a);
return rc;
}
int
PL_permission_error(const char *op, const char *type, term_t obj)
{ atom_t t = PL_new_atom(type);
atom_t o = PL_new_atom(op);
int rc = PL_error(NULL, 0, NULL, ERR_PERMISSION, o, t, obj);
PL_unregister_atom(t);
PL_unregister_atom(o);
return rc;
}
int
PL_resource_error(const char *resource)
{ atom_t r = PL_new_atom(resource);
int rc = PL_error(NULL, 0, NULL, ERR_RESOURCE, r);
PL_unregister_atom(r);
return rc;
}
word word
notImplemented(char *name, int arity) notImplemented(char *name, int arity)
{ return (word)PL_error(NULL, 0, NULL, ERR_NOT_IMPLEMENTED_PROC, name, arity); { return (word)PL_error(NULL, 0, NULL, ERR_NOT_IMPLEMENTED_PROC, name, arity);

View File

@ -5,6 +5,12 @@
#define O_GMP 1 #define O_GMP 1
#endif #endif
#ifdef __WINDOWS__
#include <windows.h>
#include <uxnt.h>
#define O_HASDRIVES 1
#endif
#ifndef PL_CONSOLE #ifndef PL_CONSOLE
#define PL_KERNEL 1 #define PL_KERNEL 1
#endif #endif
@ -18,10 +24,6 @@
#endif #endif
#include "Yap.h" #include "Yap.h"
#ifdef __WINDOWS__
#include <windows.h>
#include <uxnt.h>
#endif
#include "YapHeap.h" #include "YapHeap.h"
/* try not to pollute the SWI space */ /* try not to pollute the SWI space */
#ifdef P #ifdef P