error handling
This commit is contained in:
parent
0dd8f62237
commit
7d44e3188b
19
C/adtdefs.c
19
C/adtdefs.c
@ -27,8 +27,8 @@ static char SccsId[] = "%W% %G%";
|
||||
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
#include "yapio.h"
|
||||
#include "clause.h"
|
||||
#include "yapio.h"
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#if HAVE_STRING_Hq
|
||||
@ -40,7 +40,7 @@ static char SccsId[] = "%W% %G%";
|
||||
uint64_t hash = 5381;
|
||||
uint64_t c;
|
||||
|
||||
while ((c = (uint64_t)(*CHP++)) != '\0') {
|
||||
while ((c = *CHP++) != '\0') {
|
||||
/* hash = ((hash << 5) + hash) + c; hash * 33 + c */
|
||||
hash = hash * (uint64_t)33 + c;
|
||||
}
|
||||
@ -63,7 +63,6 @@ uint64_t WideHashFunction(wchar_t *CHP) {
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/* this routine must be run at least having a read lock on ae */
|
||||
static Prop
|
||||
GetFunctorProp(AtomEntry *ae,
|
||||
@ -78,8 +77,7 @@ GetFunctorProp(AtomEntry *ae,
|
||||
}
|
||||
|
||||
/* vsc: We must guarantee that IsVarTerm(functor) returns true! */
|
||||
static inline Functor InlinedUnlockedMkFunctor(AtomEntry *ae,
|
||||
arity_t arity) {
|
||||
static inline Functor InlinedUnlockedMkFunctor(AtomEntry *ae, arity_t arity) {
|
||||
FunctorEntry *p;
|
||||
Prop p0;
|
||||
|
||||
@ -174,7 +172,7 @@ static Atom
|
||||
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||
uint64_t hash;
|
||||
const unsigned char *p;
|
||||
Atom a, na;
|
||||
Atom a, na = NIL;
|
||||
AtomEntry *ae;
|
||||
size_t sz = AtomHashTableSize;
|
||||
|
||||
@ -566,10 +564,8 @@ Yap_OpPropForModule(Atom a,
|
||||
}
|
||||
|
||||
OpEntry *
|
||||
Yap_GetOpProp(Atom a,
|
||||
op_type type,
|
||||
Term cmod
|
||||
USES_REGS) { /* look property list of atom a for kind */
|
||||
Yap_GetOpProp(Atom a, op_type type,
|
||||
Term cmod USES_REGS) { /* look property list of atom a for kind */
|
||||
AtomEntry *ae = RepAtom(a);
|
||||
PropEntry *pp;
|
||||
OpEntry *oinfo = NULL;
|
||||
@ -888,8 +884,7 @@ Prop Yap_NewThreadPred(PredEntry *ap USES_REGS) {
|
||||
return NIL;
|
||||
}
|
||||
INIT_LOCK(p->PELock);
|
||||
p->StatisticsForPred = NULL:
|
||||
p->KindOfPE = PEProp;
|
||||
p->StatisticsForPred = NULL : p->KindOfPE = PEProp;
|
||||
p->ArityOfPE = ap->ArityOfPE;
|
||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||
p->cs.p_code.NOfClauses = 0;
|
||||
|
@ -93,6 +93,10 @@ arrays. Memory mapped arrays are limited by available space in the file
|
||||
system and in the virtual memory space.
|
||||
|
||||
The following predicates manipulate arrays:
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "Yap.h"
|
||||
@ -100,6 +104,11 @@ The following predicates manipulate arrays:
|
||||
#include "clause.h"
|
||||
#include "eval.h"
|
||||
#include "heapgc.h"
|
||||
#if HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#else
|
||||
extern int errno;
|
||||
#endif
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
15
C/dbase.c
15
C/dbase.c
@ -97,10 +97,10 @@ stored in the i.d.b.
|
||||
*/
|
||||
|
||||
#include "Yap.h"
|
||||
#include "clause.h"
|
||||
#include "yapio.h"
|
||||
#include "attvar.h"
|
||||
#include "clause.h"
|
||||
#include "heapgc.h"
|
||||
#include "yapio.h"
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
@ -714,13 +714,20 @@ loop:
|
||||
switch ((CELL)f) {
|
||||
case (CELL)FunctorDBRef: {
|
||||
DBRef dbentry;
|
||||
/* store now the correct entry */
|
||||
|
||||
dbentry = DBRefOfTerm(d0);
|
||||
*StoPoint++ = d0;
|
||||
dbg->lr--;
|
||||
if (dbentry->Flags & LogUpdMask) {
|
||||
LogUpdClause *cl = (LogUpdClause *)dbentry;
|
||||
|
||||
/* store now the correct entry */
|
||||
#if DEBUG
|
||||
if (GLOBAL_Option['i' - 'a' + 1]) {
|
||||
Yap_DebugPlWriteln(d0);
|
||||
fprintf(stderr, "+%p@%p %s\n", cl, cl->ClPred,
|
||||
IndicatorOfPred(cl->ClPred));
|
||||
}
|
||||
#endif
|
||||
cl->ClRefCount++;
|
||||
} else {
|
||||
dbentry->NOfRefsTo++;
|
||||
|
Reference in New Issue
Block a user