configurarion changes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@369 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-02-22 06:12:18 +00:00
parent 709b8b277b
commit f92947d61b
18 changed files with 399 additions and 406 deletions

View File

@ -21,6 +21,10 @@ static char SccsId[] = "%W% %G%";
#define ADTDEFS_C
#ifdef __SUNPRO_CC
#define inline
#endif
#include "Yap.h"
Prop STD_PROTO(PredPropByFunc,(Functor, SMALLUNSGN));
Prop STD_PROTO(PredPropByAtom,(Atom, SMALLUNSGN));

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.12 2002-01-26 05:37:31 vsc Exp $ *
* version:$Id: alloc.c,v 1.13 2002-02-22 06:12:18 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -451,12 +451,14 @@ InitWorkSpace(Int s)
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
if (a != (MALLOC_T)MMAP_ADDR) {
Error(SYSTEM_ERROR, TermNil, "mmap could not map ANON at %p, got %p", (void *)MMAP_ADDR, a);
return(NULL);
}
#elif defined(__APPLE__)
a = mmap(((void *)MMAP_ADDR), (size_t) s, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
if (a != (MALLOC_T)MMAP_ADDR) {
Error(SYSTEM_ERROR, TermNil, "mmap could not map ANON at %p, got %p", (void *)MMAP_ADDR,a );
return(NULL);
}
#else
fd = open("/dev/zero", O_RDWR);
@ -470,7 +472,7 @@ InitWorkSpace(Int s)
#else
Error(SYSTEM_ERROR, TermNil, "mkstemp could not create temporary file %s", file);
#endif
return FALSE;
return NULL;
}
#else
#if HAVE_TMPNAM
@ -484,7 +486,7 @@ InitWorkSpace(Int s)
fd = open(file, O_CREAT|O_RDWR);
if (fd < 0) {
Error(SYSTEM_ERROR, TermNil, "mmap could not open %s", file);
return FALSE;
return NULL;
}
if (lseek(fd, s, SEEK_SET) < 0) {
Error(SYSTEM_ERROR, TermNil, "mmap could not lseek in mmapped file %s", file);
@ -492,11 +494,11 @@ InitWorkSpace(Int s)
}
if (write(fd, "", 1) < 0) {
Error(SYSTEM_ERROR, TermNil, "mmap could not write in mmapped file %s", file);
return FALSE;
return NULL;
}
if (unlink(file) < 0) {
Error(SYSTEM_ERROR,TermNil, "mmap could not unlink mmapped file %s", file);
return FALSE;
return NULL;
}
}
#if USE_FIXED
@ -504,17 +506,19 @@ InitWorkSpace(Int s)
MAP_PRIVATE | MAP_FIXED, fd, 0);
if (a != (MALLOC_T)MMAP_ADDR) {
Error(SYSTEM_ERROR, TermNil, "mmap could not map at %p, got %p", (void *)MMAP_ADDR, a);
return NULL;
}
#else
a = mmap(0, (size_t) s, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE, fd, 0);
if ((CELL)a & YAP_PROTECTED_MASK) {
close(fd);
Error(FATAL_ERROR, TermNil, "mmapped address %p collides with YAP tags ***", a);
Error(FATAL_ERROR, TermNil, "mmapped address %p collides with YAP tags", a);
return NULL;
}
if (close(fd) == -1) {
Error(SYSTEM_ERROR, TermNil, "while closing mmaped file ***");
return FALSE;
Error(SYSTEM_ERROR, TermNil, "while closing mmaped file");
return NULL;
}
#endif
#endif

View File

@ -88,7 +88,7 @@ STATIC_PROTO(void a_gl, (op_numbers));
STATIC_PROTO(void a_bfunc, (CELL));
STATIC_PROTO(AREG compile_cmp_flags, (char *));
STATIC_PROTO(void a_igl, (op_numbers));
STATIC_PROTO(void a_ucons, (op_numbers));
STATIC_PROTO(void a_ucons, (compiler_vm_op));
STATIC_PROTO(void a_uvar, (void));
STATIC_PROTO(void a_wvar, (void));
STATIC_PROTO(void do_pass, (void));
@ -1223,7 +1223,7 @@ a_gl(op_numbers opcode)
* the head of the first argument, because of indexing
*/
static void
a_ucons(op_numbers opcode)
a_ucons(compiler_vm_op opcode)
{
#if AGGREGATE_OPS
PInstr *np = cpc->nextInst;

View File

@ -1260,38 +1260,31 @@ replace_array_references(Term t0)
Term t;
t = Deref(t0);
do {
if (IsVarTerm(t)) {
/* we found a variable */
return (MkPairTerm(t, TermNil));
}
else if (IsAtomOrIntTerm(t)) {
return (MkPairTerm(t, TermNil));
}
else if (IsPairTerm(t)) {
Term VList = MkVarTerm();
CELL *h0 = H;
if (IsVarTerm(t)) {
/* we found a variable */
return (MkPairTerm(t, TermNil));
} else if (IsAtomOrIntTerm(t)) {
return (MkPairTerm(t, TermNil));
} else if (IsPairTerm(t)) {
Term VList = MkVarTerm();
CELL *h0 = H;
H += 2;
replace_array_references_complex(RepPair(t) - 1, RepPair(t) + 1, h0,
VList);
return (MkPairTerm(AbsPair(h0), VList));
}
else {
Term VList = MkVarTerm();
CELL *h0 = H;
Functor f = FunctorOfTerm(t);
H += 2;
replace_array_references_complex(RepPair(t) - 1, RepPair(t) + 1, h0,
VList);
return (MkPairTerm(AbsPair(h0), VList));
} else {
Term VList = MkVarTerm();
CELL *h0 = H;
Functor f = FunctorOfTerm(t);
*H++ = (CELL) (f);
H += ArityOfFunctor(f);
replace_array_references_complex(RepAppl(t),
RepAppl(t) + ArityOfFunctor(FunctorOfTerm(t)), h0 + 1,
VList);
return (MkPairTerm(AbsAppl(h0), VList));
}
} while (TRUE);
/* make lcc happy */
return(FALSE);
*H++ = (CELL) (f);
H += ArityOfFunctor(f);
replace_array_references_complex(RepAppl(t),
RepAppl(t) + ArityOfFunctor(FunctorOfTerm(t)), h0 + 1,
VList);
return (MkPairTerm(AbsAppl(h0), VList));
}
}
static Int

View File

@ -774,7 +774,7 @@ YapReset(void)
X_API void
YapExit(int retval)
{
exit_yap(retval, NULL);
exit_yap(retval);
}
X_API void

View File

@ -2098,7 +2098,7 @@ p_system_pred(void)
if (IsExtensionFunctor(funt)) {
return(FALSE);
}
while (funt == FunctorModule) {
if (funt == FunctorModule) {
Term nmod = ArgOfTerm(1, t1);
if (IsVarTerm(nmod)) {
Error(INSTANTIATION_ERROR,ARG1,"system_predicate/1");
@ -2135,7 +2135,7 @@ p_cut_transparent(void)
if (IsExtensionFunctor(funt)) {
return(FALSE);
}
while (funt == FunctorModule) {
if (funt == FunctorModule) {
Term nmod = ArgOfTerm(1, t1);
if (IsVarTerm(nmod)) {
Error(INSTANTIATION_ERROR,ARG1,"system_predicate/1");

View File

@ -573,7 +573,6 @@ c_arg(Int argno, Term t, unsigned int arity)
if (!(CurrentPred->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
READ_UNLOCK(CurrentPred->PRWLock);
FAIL("can not compile data base reference",TYPE_ERROR_CALLABLE,t);
return;
} else {
emit((onhead ? get_atom_op : put_atom_op), (CELL) t, argno);
}

View File

@ -857,8 +857,8 @@ static int can_unify_complex(register CELL *pt0,
case (CELL)FunctorBigInt:
if (mpz_cmp(BigIntOfTerm(d0),BigIntOfTerm(d1)) == 0) continue;
goto comparison_failed;
default:
#endif /* USE_GMP */
default:
goto comparison_failed;
}
}
@ -994,8 +994,8 @@ can_unify(Term t1, Term t2, Term *Vars)
case (CELL)FunctorBigInt:
if (mpz_cmp(BigIntOfTerm(t1),BigIntOfTerm(t2)) == 0) return(TRUE);
return(FALSE);
default:
#endif /* USE_GMP */
default:
return(FALSE);
}
}

View File

@ -2038,7 +2038,8 @@ GetDBTerm(DBRef DBSP)
if (H+NOf > ASP-CalculateStackGap()) {
if (PrologMode & InErrorMode) {
if (H+NOf > ASP)
exit_yap( 1, "No Stack for Error Handling\n");
YP_fprintf(YP_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
exit_yap( 1);
} else {
return((Term)0);
}

File diff suppressed because it is too large Load Diff

View File

@ -2479,7 +2479,7 @@ p_peek_mem_write_stream (void)
while (i > 0) {
--i;
tf = MkPairTerm(MkIntTerm(Stream[sno].u.mem_string.buf[i]),tf);
while (H + 1024 >= ASP) {
if (H + 1024 >= ASP) {
H = HI;
if (!gc(3, ENV, P)) {
Error(SYSTEM_ERROR, TermNil, "YAP could not grow stack in peek_mem_write_stream/2");

View File

@ -1457,7 +1457,7 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries)
if (!growtrail((ADDR)(basep + (NOfE*2))-TrailTop)) {
Error(SYSTEM_ERROR, TermNil,
"not enough space to restore hash tables for indexing");
exit_yap(1, "");
exit_yap(1);
}
}
}

View File

@ -653,7 +653,7 @@ p_atom_concat(void)
if (cptr+sz >= top-1024) {
ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!growheap(FALSE)) {
Error(SYSTEM_ERROR, TermNil, "YAP could not grow heap in recorda/3 ]\n");
Error(SYSTEM_ERROR, TermNil, "YAP could not grow heap in atom_concat/2 ]\n");
return(FALSE);
}
goto restart;
@ -1250,9 +1250,10 @@ p_halt(void)
}
out = IntegerOfTerm(t);
if (yap_flags[HALT_AFTER_CONSULT_FLAG]) {
exit_yap(out, "");
exit_yap(out);
} else {
exit_yap(out, "\n\n[ Prolog execution halted ]\n");
YP_fprintf(YP_stderr, "\n\n[ Prolog execution halted ]\n");
exit_yap(out);
}
return (TRUE);
}
@ -1262,9 +1263,10 @@ static Int
p_halt0(void)
{ /* halt */
if (yap_flags[HALT_AFTER_CONSULT_FLAG]) {
exit_yap(0, "");
exit_yap(0);
} else {
exit_yap(0, "\n\n[ Prolog execution halted ]\n");
YP_fprintf(YP_stderr, "\n\n[ Prolog execution halted ]\n");
exit_yap(0);
}
return (TRUE);
}

View File

@ -1090,7 +1090,7 @@ InteractSIGINT(int ch) {
return(1);
case 'e':
/* exit */
exit_yap(0, "");
exit_yap(0);
return(-1);
case 't':
/* start tracing */
@ -1296,7 +1296,8 @@ ReceiveSignal (int s)
/* These signals are not handled by WIN32 and not the Macintosh */
case SIGQUIT:
case SIGKILL:
exit_yap (SIGKILL, "\n\n\n[ Quit signal received ]\n\n");
YP_fprintf(YP_stderr, "\n\n\n[ Quit signal received ]\n\n");
exit_yap (SIGKILL);
#endif
#if defined(SIGUSR1)
case SIGUSR1:
@ -2180,6 +2181,8 @@ VaxFixFrame (dummy)
#ifdef _WIN32
#include <windows.h>
int WINAPI STD_PROTO(win_yap, (HANDLE, DWORD, LPVOID));
int WINAPI win_yap(HANDLE hinst, DWORD reason, LPVOID reserved)

View File

@ -112,7 +112,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* extern int gc_calls; */
vsc_count++;
if (vsc_count < 6000) return;
/* if (vsc_count < 6000) return;*/
/* if (vsc_count == 6469) {
printf("Here I go\n");
}
@ -120,7 +120,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* if (vsc_count > 500000) exit(0); */
/* if (gc_calls < 1) return;*/
#if defined(__GNUC__)
YP_fprintf(YP_stderr,"%llu (%p,%p: %x %x %x) ", vsc_count, H, ENV, *(CELL *)0x910e088, *(CELL *)0x910e024, *(CELL *)0x910d658);
YP_fprintf(YP_stderr,"%llu ", vsc_count);
#endif
/* check_trail_consistency(); */
if (pred == NULL) {

View File

@ -537,7 +537,7 @@ p_exit()
register Term t = Deref(ARG1);
if (IsVarTerm(t) || !IsIntTerm(t))
return (FALSE);
exit_yap((int) IntOfTerm(t), NIL);
exit_yap((int) IntOfTerm(t));
return(FALSE);
}

View File

@ -39,16 +39,9 @@
#if HAVE_IO_H
#include <io.h>
#endif
#if HAVE_WINSOCK2_H
#if _MSC_VER || defined(__MINGW32__)
#include <io.h>
#include <winsock2.h>
#ifdef HAVE_SYS_UN_H
#undef HAVE_SYS_UN_H
#endif
#elif HAVE_WINSOCK_H
#include <winsock.h>
#ifdef HAVE_SYS_UN_H
#undef HAVE_SYS_UN_H
#endif
#else
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
@ -77,10 +70,6 @@
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#endif /* HAVE_WINSOCK_H */
#if _MSC_VER || defined(__MINGW32__)
#include <io.h>
#include <winsock2.h>
#endif
/* make sure we can compile in any platform */
@ -882,6 +871,7 @@ p_socket_accept(void)
Error(SYSTEM_ERROR, TermNil,
"socket_accept/3 (accept)");
#endif
return(FALSE);
}
if ((s = inet_ntoa(caddr.sin_addr)) == NULL) {
#if HAVE_STRERROR
@ -944,15 +934,18 @@ p_socket_buffering(void)
return(FALSE);
if (IsVarTerm(t4)) {
bufsize = BUFSIZ;
}
if (!IsIntegerTerm(t4)) {
Error(TYPE_ERROR_INTEGER,t4,"socket_buffering/4");
return(FALSE);
}
bufsize = IntegerOfTerm(t4);
if ((Int)bufsize < 0) {
Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,t4,"socket_buffering/4");
return(FALSE);
} else {
Int siz;
if (!IsIntegerTerm(t4)) {
Error(TYPE_ERROR_INTEGER,t4,"socket_buffering/4");
return(FALSE);
}
siz = IntegerOfTerm(t4);
if (siz < 0) {
Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,t4,"socket_buffering/4");
return(FALSE);
}
bufsize = siz;
}
if (writing) {
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));

View File

@ -10,7 +10,7 @@
* File: Yap.proto *
* mods: *
* comments: Function declarations for YAP *
* version: $Id: Yapproto.h,v 1.11 2002-02-12 18:24:20 vsc Exp $ *
* version: $Id: Yapproto.h,v 1.12 2002-02-22 06:12:18 vsc Exp $ *
*************************************************************************/
/* prototype file for Yap */
@ -137,9 +137,8 @@ void STD_PROTO(InitBackDB,(void));
void STD_PROTO(InitDBPreds,(void));
/* errors.c */
void STD_PROTO(exit_yap,(int,char *));
void STD_PROTO(exit_yap,(int));
yamop *STD_PROTO(Error,(yap_error_number,Term,char *msg, ...));
void STD_PROTO(ShutdownYAP,(int));
/* eval.c */