chaeacters mostly
This commit is contained in:
parent
af38546a0d
commit
7dab812d64
1998
C/adtdefs.c
1998
C/adtdefs.c
File diff suppressed because it is too large
Load Diff
54
C/errors.c
54
C/errors.c
@ -38,7 +38,7 @@ bool Yap_Warning(const char *s, ...) {
|
|||||||
PredEntry *pred;
|
PredEntry *pred;
|
||||||
bool rc;
|
bool rc;
|
||||||
Term ts[2];
|
Term ts[2];
|
||||||
const char *format;
|
const char *fmt;
|
||||||
char tmpbuf[MAXPATHLEN];
|
char tmpbuf[MAXPATHLEN];
|
||||||
|
|
||||||
LOCAL_DoingUndefp = true;
|
LOCAL_DoingUndefp = true;
|
||||||
@ -46,12 +46,12 @@ bool Yap_Warning(const char *s, ...) {
|
|||||||
pred = RepPredProp(PredPropByFunc(FunctorPrintMessage,
|
pred = RepPredProp(PredPropByFunc(FunctorPrintMessage,
|
||||||
PROLOG_MODULE)); // PROCEDURE_print_message2
|
PROLOG_MODULE)); // PROCEDURE_print_message2
|
||||||
va_start(ap, s);
|
va_start(ap, s);
|
||||||
format = va_arg(ap, char *);
|
fmt = va_arg(ap, char *);
|
||||||
if (format != NULL) {
|
if (fmt != NULL) {
|
||||||
#if HAVE_VSNPRINTF
|
#if HAVE_VSNPRINTF
|
||||||
vsnprintf(tmpbuf, MAXPATHLEN - 1, format, ap);
|
vsnprintf(tmpbuf, MAXPATHLEN - 1, fmt, ap);
|
||||||
#else
|
#else
|
||||||
(void)vsprintf(tmpbuf, format, ap);
|
(void)vsprintf(tmpbuf, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@ -321,12 +321,12 @@ void Yap_ThrowError__(const char *file, const char *function, int lineno,
|
|||||||
char tmpbuf[MAXPATHLEN];
|
char tmpbuf[MAXPATHLEN];
|
||||||
|
|
||||||
va_start(ap, where);
|
va_start(ap, where);
|
||||||
char *format = va_arg(ap, char *);
|
char *fmt = va_arg(ap, char *);
|
||||||
if (format != NULL) {
|
if (fmt != NULL) {
|
||||||
#if HAVE_VSNPRINTF
|
#if HAVE_VSNPRINTF
|
||||||
(void)vsnprintf(tmpbuf, MAXPATHLEN - 1, format, ap);
|
(void)vsnprintf(tmpbuf, MAXPATHLEN - 1, fmt, ap);
|
||||||
#else
|
#else
|
||||||
(void)vsprintf(tnpbuf, format, ap);
|
(void)vsprintf(tnpbuf, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
// fprintf(stderr, "warning: ");
|
// fprintf(stderr, "warning: ");
|
||||||
Yap_Error__(file, function, lineno, type, where, tmpbuf);
|
Yap_Error__(file, function, lineno, type, where, tmpbuf);
|
||||||
@ -377,7 +377,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
Functor fun;
|
Functor fun;
|
||||||
Term error_t;
|
Term error_t;
|
||||||
Term comment;
|
Term comment;
|
||||||
char *format;
|
char *fmt;
|
||||||
char s[MAXPATHLEN];
|
char s[MAXPATHLEN];
|
||||||
|
|
||||||
/* disallow recursive error handling */
|
/* disallow recursive error handling */
|
||||||
@ -389,7 +389,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_ActiveError->errorAsText = Yap_LookupAtom(Yap_errorName(type));
|
LOCAL_ActiveError->errorAsText = Yap_LookupAtom(Yap_errorName(type));
|
||||||
LOCAL_ActiveError->errorClass = Yap_errorClass(type);
|
LOCAL_ActiveError->errorClass = Yap_errorClass(type);
|
||||||
LOCAL_ActiveError->classAsText =
|
LOCAL_ActiveError->classAsText =
|
||||||
Yap_LookupAtom(Yap_errorClassName(LOCAL_ActiveError->errorClass));
|
Yap_LookupAtom(Yap_errorClassName(LOCAL_ActiveError->errorClass));
|
||||||
LOCAL_ActiveError->errorLine = lineno;
|
LOCAL_ActiveError->errorLine = lineno;
|
||||||
LOCAL_ActiveError->errorFunction = function;
|
LOCAL_ActiveError->errorFunction = function;
|
||||||
LOCAL_ActiveError->errorFile = file;
|
LOCAL_ActiveError->errorFile = file;
|
||||||
@ -399,17 +399,17 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
if (where == 0L) {
|
if (where == 0L) {
|
||||||
where = TermNil;
|
where = TermNil;
|
||||||
}
|
}
|
||||||
// first, obtain current location
|
// first, obtain current location
|
||||||
// sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno,
|
// sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno,
|
||||||
// function);
|
// function);
|
||||||
// tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
// tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
||||||
#if DEBUG_STRICT
|
#if DEBUG_STRICT
|
||||||
if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))
|
if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))
|
||||||
fprintf(stderr, "***** Processing Error %d (%lx,%x) %s***\n", type,
|
fprintf(stderr, "***** Processing Error %d (%lx,%x) %s***\n", type,
|
||||||
(unsigned long int)LOCAL_Signals, LOCAL_PrologMode, format);
|
(unsigned long int)LOCAL_Signals, LOCAL_PrologMode, fmt);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "***** Processing Error %d (%x) %s***\n", type,
|
fprintf(stderr, "***** Processing Error %d (%x) %s***\n", type,
|
||||||
LOCAL_PrologMode, format);
|
LOCAL_PrologMode, fmt);
|
||||||
#endif
|
#endif
|
||||||
if (type == INTERRUPT_EVENT) {
|
if (type == INTERRUPT_EVENT) {
|
||||||
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
||||||
@ -425,12 +425,12 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
Yap_exit(1);
|
Yap_exit(1);
|
||||||
}
|
}
|
||||||
va_start(ap, where);
|
va_start(ap, where);
|
||||||
format = va_arg(ap, char *);
|
fmt = va_arg(ap, char *);
|
||||||
if (format != NULL) {
|
if (fmt != NULL) {
|
||||||
#if HAVE_VSNPRINTF
|
#if HAVE_VSNPRINTF
|
||||||
(void)vsnprintf(s, MAXPATHLEN - 1, format, ap);
|
(void)vsnprintf(s, MAXPATHLEN - 1, fmt, ap);
|
||||||
#else
|
#else
|
||||||
(void)vsprintf(s, format, ap);
|
(void)vsprintf(s, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
// fprintf(stderr, "warning: ");
|
// fprintf(stderr, "warning: ");
|
||||||
comment = MkAtomTerm(Yap_LookupAtom(s));
|
comment = MkAtomTerm(Yap_LookupAtom(s));
|
||||||
@ -479,7 +479,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
error_exit_yap(1);
|
error_exit_yap(1);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// DumpActiveGoals( USES_REGS1 );
|
// DumpActiveGoals( USES_REGS1 );
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!IsVarTerm(where) && IsApplTerm(where) &&
|
if (!IsVarTerm(where) && IsApplTerm(where) &&
|
||||||
FunctorOfTerm(where) == FunctorError) {
|
FunctorOfTerm(where) == FunctorError) {
|
||||||
@ -569,7 +569,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_ErrorMessage = RepAtom(AtomOfTerm(nt[0]))->StrOfAE;
|
LOCAL_ErrorMessage = RepAtom(AtomOfTerm(nt[0]))->StrOfAE;
|
||||||
} else {
|
} else {
|
||||||
LOCAL_ErrorMessage =
|
LOCAL_ErrorMessage =
|
||||||
(char *)RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE;
|
(char *)RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE;
|
||||||
}
|
}
|
||||||
nt[1] = TermNil;
|
nt[1] = TermNil;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -588,15 +588,15 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
ts[2] = MkAtomTerm(Yap_LookupAtom(function));
|
ts[2] = MkAtomTerm(Yap_LookupAtom(function));
|
||||||
t3 = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("c"), 3), 3, ts);
|
t3 = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("c"), 3), 3, ts);
|
||||||
nt[1] =
|
nt[1] =
|
||||||
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
||||||
}
|
}
|
||||||
if ((location = Yap_pc_location(P, B, ENV)) != TermNil) {
|
if ((location = Yap_pc_location(P, B, ENV)) != TermNil) {
|
||||||
nt[1] = MkPairTerm(
|
nt[1] = MkPairTerm(
|
||||||
MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), location), nt[1]);
|
MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), location), nt[1]);
|
||||||
}
|
}
|
||||||
if ((location = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
if ((location = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
||||||
nt[1] = MkPairTerm(
|
nt[1] = MkPairTerm(
|
||||||
MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), location), nt[1]);
|
MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), location), nt[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_Signals = 0;
|
LOCAL_Signals = 0;
|
||||||
CalculateStackGap(PASS_REGS1);
|
CalculateStackGap(PASS_REGS1);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// DumpActiveGoals( PASS_REGS1 );
|
// DumpActiveGoals( PASS_REGS1 );
|
||||||
#endif
|
#endif
|
||||||
/* wait if we we are in user code,
|
/* wait if we we are in user code,
|
||||||
it's up to her to decide */
|
it's up to her to decide */
|
||||||
|
74
C/text.c
74
C/text.c
@ -268,7 +268,7 @@ static void *codes2buf(Term t0, void *b0, bool *get_codes USES_REGS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
st0 = st = malloc(length + 1);
|
st0 = st = Malloc(length + 1);
|
||||||
t = t0;
|
t = t0;
|
||||||
if (codes) {
|
if (codes) {
|
||||||
while (IsPairTerm(t)) {
|
while (IsPairTerm(t)) {
|
||||||
@ -290,20 +290,20 @@ static void *codes2buf(Term t0, void *b0, bool *get_codes USES_REGS) {
|
|||||||
st[0] = '\0';
|
st[0] = '\0';
|
||||||
|
|
||||||
return st0;
|
return st0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *latin2utf8(seq_tv_t *inp) {
|
static unsigned char *latin2utf8(seq_tv_t *inp) {
|
||||||
unsigned char *b0 = inp->val.uc;
|
unsigned char *b0 = inp->val.uc;
|
||||||
size_t sz = strlen(inp->val.c);
|
size_t sz = strlen(inp->val.c);
|
||||||
sz *= 2;
|
sz *= 2;
|
||||||
int ch;
|
int ch;
|
||||||
unsigned char *buf = Malloc(sz + 1), *pt = buf;
|
unsigned char *buf = Malloc(sz + 1), *pt = buf;
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
while ((ch = *b0++)) {
|
while ((ch = *b0++)) {
|
||||||
int off = put_utf8(pt, ch);
|
int off = put_utf8(pt, ch);
|
||||||
if (off < 0) {
|
if (off < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pt += off;
|
pt += off;
|
||||||
}
|
}
|
||||||
@ -339,13 +339,13 @@ static void *codes2buf(Term t0, void *b0, bool *get_codes USES_REGS) {
|
|||||||
seq_tv_t *inp USES_REGS) {
|
seq_tv_t *inp USES_REGS) {
|
||||||
bool codes;
|
bool codes;
|
||||||
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
unsigned char *nbuf = codes2buf(t, buf, &codes PASS_REGS);
|
||||||
if (!codes)
|
if (codes)
|
||||||
return NULL;
|
return NULL;
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
static unsigned char *Yap_ListToBuffer(unsigned char *buf, Term t,
|
||||||
seq_tv_t *inp USES_REGS) {
|
seq_tv_t *inp USES_REGS) {
|
||||||
unsigned char *nbuf = codes2buf(t, buf, NULL PASS_REGS);
|
unsigned char *nbuf = codes2buf(t, buf, NULL PASS_REGS);
|
||||||
return nbuf;
|
return nbuf;
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ static void *codes2buf(Term t0, void *b0, bool *get_codes USES_REGS) {
|
|||||||
out->val.uc = BaseMalloc(leng + 1);
|
out->val.uc = BaseMalloc(leng + 1);
|
||||||
strcpy(out->val.c, (char *)s0);
|
strcpy(out->val.c, (char *)s0);
|
||||||
} else if (out->val.uc != s0) {
|
} else if (out->val.uc != s0) {
|
||||||
out->val.c = Realloc(out->val.c, leng + 1);
|
out->val.c = BaseMalloc(leng + 1);
|
||||||
strcpy(out->val.c, (char *)s0);
|
strcpy(out->val.c, (char *)s0);
|
||||||
}
|
}
|
||||||
} else if (out->enc == ENC_ISO_LATIN1) {
|
} else if (out->enc == ENC_ISO_LATIN1) {
|
||||||
@ -954,7 +954,7 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
bufv[j++] = nbuf;
|
bufv[j++] = nbuf;
|
||||||
}
|
}
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
buf = malloc(8);
|
buf = Malloc(8);
|
||||||
memset(buf, 0, 4);
|
memset(buf, 0, 4);
|
||||||
} else if (j == 1) {
|
} else if (j == 1) {
|
||||||
buf = bufv[0];
|
buf = bufv[0];
|
||||||
@ -966,25 +966,25 @@ bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||||
seq_tv_t outv[] USES_REGS) {
|
seq_tv_t outv[] USES_REGS) {
|
||||||
const unsigned char *buf;
|
const unsigned char *buf;
|
||||||
size_t b_l, u_l;
|
size_t b_l, u_l;
|
||||||
|
|
||||||
inp->type |= YAP_STRING_IN_TMP;
|
inp->type |= YAP_STRING_IN_TMP;
|
||||||
buf = Yap_readText(inp PASS_REGS);
|
buf = Yap_readText(inp PASS_REGS);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
b_l = strlen((char *)buf);
|
b_l = strlen((char *)buf);
|
||||||
if (b_l == 0) {
|
if (b_l == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
u_l = strlen_utf8(buf);
|
u_l = strlen_utf8(buf);
|
||||||
if (!cuts) {
|
if (!cuts) {
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
size_t b_l0, b_l1, u_l0, u_l1;
|
size_t b_l0, b_l1, u_l0, u_l1;
|
||||||
unsigned char *buf0, *buf1;
|
unsigned char *buf0, *buf1;
|
||||||
|
|
||||||
if (outv[0].val.t) {
|
if (outv[0].val.t) {
|
||||||
|
@ -800,12 +800,12 @@ Atom export_atom(Atom at, char **hpp, char *buf, size_t len)
|
|||||||
ptr = (char *)AdjustSize((CELL*)ptr, buf);
|
ptr = (char *)AdjustSize((CELL*)ptr, buf);
|
||||||
|
|
||||||
p0 = ptr;
|
p0 = ptr;
|
||||||
*ptr++ = 0;
|
*ptr++ = 0;
|
||||||
sz = strlen(RepAtom(at)->StrOfAE);
|
sz = strlen(RepAtom(at)->StrOfAE);
|
||||||
if (sz + 1 >= len)
|
if (sz + 1 >= len)
|
||||||
return (Atom)NULL;
|
return (Atom)NULL;
|
||||||
strcpy(ptr, RepAtom(at)->StrOfAE);
|
strcpy(ptr, RepAtom(at)->StrOfAE);
|
||||||
*hpp = ptr+(sz+1);
|
*hpp = ptr+(sz+1);
|
||||||
return (Atom)(p0-buf);
|
return (Atom)(p0-buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ Functor export_functor(Functor f, char **hpp, char *buf, size_t len)
|
|||||||
return (Functor)(((char *)hptr-buf)+1);
|
return (Functor)(((char *)hptr-buf)+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define export_derefa_body(D,A,LabelUnk,LabelNonVar) \
|
#define export_derefa_body(D,A,LabelUnk,LabelNonVar) \
|
||||||
do { \
|
do { \
|
||||||
if ((CELL *)(D) < CellDifH(HR,HLow)) { (A) = (CELL *)(D); break; } \
|
if ((CELL *)(D) < CellDifH(HR,HLow)) { (A) = (CELL *)(D); break; } \
|
||||||
(A) = (CELL *)(D); \
|
(A) = (CELL *)(D); \
|
||||||
|
@ -525,7 +525,7 @@ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|||||||
|
|
||||||
# when building, don't use the install RPATH already
|
# when building, don't use the install RPATH already
|
||||||
# (but later on when installing)
|
# (but later on when installing)
|
||||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
|
|
||||||
SET(CMAKE_INSTALL_RPATH "${libdir}")
|
SET(CMAKE_INSTALL_RPATH "${libdir}")
|
||||||
|
|
||||||
|
@ -114,3 +114,4 @@ typedef unsigned long int YAP_ULONG_LONG;
|
|||||||
|
|
||||||
#define Unsigned(V) ((CELL)(V))
|
#define Unsigned(V) ((CELL)(V))
|
||||||
#define Signed(V) ((Int)(V))
|
#define Signed(V) ((Int)(V))
|
||||||
|
|
||||||
|
189
H/YapText.h
189
H/YapText.h
@ -188,11 +188,7 @@ INLINE_ONLY inline EXTERN utf8proc_ssize_t get_utf8(const utf8proc_uint8_t *ptr,
|
|||||||
utf8proc_int32_t *valp) {
|
utf8proc_int32_t *valp) {
|
||||||
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
|
utf8proc_ssize_t rc = utf8proc_iterate(ptr, n, valp);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
if (rc == UTF8PROC_ERROR_INVALIDUTF8)
|
LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_IN_CHARACTER_CODE;
|
||||||
Yap_Warning("get_utf8 found bad UTF-8 char %s, skipping...", ptr);
|
|
||||||
else
|
|
||||||
Yap_Warning("UTF-8 error %d, skipping...", *ptr);
|
|
||||||
rc = 1;
|
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -203,13 +199,14 @@ INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
|||||||
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
INLINE_ONLY inline EXTERN utf8proc_ssize_t put_utf8(utf8proc_uint8_t *ptr,
|
||||||
utf8proc_int32_t val) {
|
utf8proc_int32_t val) {
|
||||||
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
|
utf8proc_ssize_t rc = utf8proc_encode_char(val, ptr);
|
||||||
if (rc == 0)
|
if (rc < 0) {
|
||||||
Yap_Warning("UTF-8 error at %s", ptr);
|
LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static const utf8proc_uint8_t *skip_utf8(const utf8proc_uint8_t *pt,
|
inline static const utf8proc_uint8_t *skip_utf8(const utf8proc_uint8_t *pt,
|
||||||
utf8proc_ssize_t n) {
|
utf8proc_ssize_t n) {
|
||||||
utf8proc_ssize_t i;
|
utf8proc_ssize_t i;
|
||||||
utf8proc_int32_t b;
|
utf8proc_int32_t b;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -217,14 +214,10 @@ inline static const utf8proc_uint8_t *skip_utf8(const utf8proc_uint8_t *pt,
|
|||||||
if (b == 0)
|
if (b == 0)
|
||||||
return pt;
|
return pt;
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
if (l == UTF8PROC_ERROR_INVALIDUTF8)
|
LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||||
Yap_Warning("skip_utf8: found bad UTF-8 in char %s[%d], skipping...",
|
} else {
|
||||||
pt, i);
|
pt += l;
|
||||||
else
|
|
||||||
Yap_Warning("UTF-8 error %d at %s[%d], skipping...", l, pt, i);
|
|
||||||
l = 1;
|
|
||||||
}
|
}
|
||||||
pt += l;
|
|
||||||
}
|
}
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
@ -240,14 +233,11 @@ inline static utf8proc_ssize_t strlen_utf8(const utf8proc_uint8_t *pt) {
|
|||||||
utf8proc_ssize_t l = utf8proc_iterate(pt, -1, &b);
|
utf8proc_ssize_t l = utf8proc_iterate(pt, -1, &b);
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return rc;
|
return rc;
|
||||||
else if (b > 0) {
|
else if (l > 0) {
|
||||||
pt += l;
|
pt += l;
|
||||||
rc++;
|
rc++;
|
||||||
} else {
|
} else {
|
||||||
if (l == UTF8PROC_ERROR_INVALIDUTF8)
|
LOCAL_ActiveError->errorNo = REPRESENTATION_ERROR_CHARACTER_CODE;
|
||||||
Yap_Warning("found bad UTF-8 char %d, skipping %s...", *pt, pt);
|
|
||||||
else
|
|
||||||
Yap_Warning("UTF-8 error %d, skipping...", l);
|
|
||||||
pt++;
|
pt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,6 +249,9 @@ inline static utf8proc_ssize_t strlen_latin_utf8(const unsigned char *pt) {
|
|||||||
utf8proc_uint8_t b;
|
utf8proc_uint8_t b;
|
||||||
while (true) {
|
while (true) {
|
||||||
utf8proc_ssize_t l = utf8proc_encode_char(*pt, &b);
|
utf8proc_ssize_t l = utf8proc_encode_char(*pt, &b);
|
||||||
|
if (l<0) {
|
||||||
|
pt++;
|
||||||
|
}
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return rc;
|
return rc;
|
||||||
pt++;
|
pt++;
|
||||||
@ -268,7 +261,7 @@ inline static utf8proc_ssize_t strlen_latin_utf8(const unsigned char *pt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static utf8proc_ssize_t strnlen_latin_utf8(const unsigned char *pt,
|
inline static utf8proc_ssize_t strnlen_latin_utf8(const unsigned char *pt,
|
||||||
size_t max) {
|
size_t max) {
|
||||||
utf8proc_ssize_t rc = 0;
|
utf8proc_ssize_t rc = 0;
|
||||||
utf8proc_uint8_t b;
|
utf8proc_uint8_t b;
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -276,7 +269,8 @@ inline static utf8proc_ssize_t strnlen_latin_utf8(const unsigned char *pt,
|
|||||||
if (b == 0)
|
if (b == 0)
|
||||||
return rc;
|
return rc;
|
||||||
pt++;
|
pt++;
|
||||||
rc += l;
|
if (l > 0)
|
||||||
|
rc += l;
|
||||||
if (--max == 0)
|
if (--max == 0)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -290,6 +284,8 @@ inline static utf8proc_ssize_t strlen_ucs2_utf8(const wchar_t *pt) {
|
|||||||
utf8proc_ssize_t l = utf8proc_encode_char(*pt, &b);
|
utf8proc_ssize_t l = utf8proc_encode_char(*pt, &b);
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
if (l < 0)
|
||||||
|
continue;
|
||||||
pt++;
|
pt++;
|
||||||
rc += l;
|
rc += l;
|
||||||
}
|
}
|
||||||
@ -297,7 +293,7 @@ inline static utf8proc_ssize_t strlen_ucs2_utf8(const wchar_t *pt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static utf8proc_ssize_t strnlen_ucs2_utf8(const wchar_t *pt,
|
inline static utf8proc_ssize_t strnlen_ucs2_utf8(const wchar_t *pt,
|
||||||
size_t max) {
|
size_t max) {
|
||||||
utf8proc_ssize_t rc = 0;
|
utf8proc_ssize_t rc = 0;
|
||||||
utf8proc_uint8_t b;
|
utf8proc_uint8_t b;
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -313,7 +309,7 @@ inline static utf8proc_ssize_t strnlen_ucs2_utf8(const wchar_t *pt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
||||||
const utf8proc_uint8_t *pt2, utf8proc_ssize_t n) {
|
const utf8proc_uint8_t *pt2, utf8proc_ssize_t n) {
|
||||||
utf8proc_ssize_t i;
|
utf8proc_ssize_t i;
|
||||||
utf8proc_int32_t b;
|
utf8proc_int32_t b;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -322,13 +318,13 @@ inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
|||||||
utf8proc_ssize_t l = utf8proc_iterate(pt1, -1, &b);
|
utf8proc_ssize_t l = utf8proc_iterate(pt1, -1, &b);
|
||||||
if (l == 2) {
|
if (l == 2) {
|
||||||
if (pt1[1] != pt2[1])
|
if (pt1[1] != pt2[1])
|
||||||
return pt1[1] - pt2[1];
|
return pt1[1] - pt2[1];
|
||||||
} else if (l == 3) {
|
} else if (l == 3) {
|
||||||
if (pt1[2] != pt2[2])
|
if (pt1[2] != pt2[2])
|
||||||
return pt1[2] - pt2[2];
|
return pt1[2] - pt2[2];
|
||||||
} else if (l == 4) {
|
} else if (l == 4) {
|
||||||
if (pt1[3] != pt2[3])
|
if (pt1[3] != pt2[3])
|
||||||
return pt1[3] - pt2[3];
|
return pt1[3] - pt2[3];
|
||||||
}
|
}
|
||||||
pt1 += l;
|
pt1 += l;
|
||||||
pt2 += l;
|
pt2 += l;
|
||||||
@ -339,7 +335,7 @@ inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
|||||||
// UTF16
|
// UTF16
|
||||||
|
|
||||||
#define LEAD_OFFSET ((uint32_t)0xD800 - (uint32_t)(0x10000 >> 10))
|
#define LEAD_OFFSET ((uint32_t)0xD800 - (uint32_t)(0x10000 >> 10))
|
||||||
#define SURROGATE_OFFSET \
|
#define SURROGATE_OFFSET \
|
||||||
((uint32_t)0x10000 - (uint32_t)(0xD800 << 10) - (uint32_t)0xDC00)
|
((uint32_t)0x10000 - (uint32_t)(0xD800 << 10) - (uint32_t)0xDC00)
|
||||||
|
|
||||||
extern const char *Yap_tokText(void *tokptr);
|
extern const char *Yap_tokText(void *tokptr);
|
||||||
@ -359,9 +355,9 @@ typedef enum {
|
|||||||
YAP_STRING_FLOAT = 0x80, /// target is a floar term
|
YAP_STRING_FLOAT = 0x80, /// target is a floar term
|
||||||
YAP_STRING_BIG = 0x100, /// target is an big num term
|
YAP_STRING_BIG = 0x100, /// target is an big num term
|
||||||
YAP_STRING_DATUM =
|
YAP_STRING_DATUM =
|
||||||
0x200, /// associated with previous 3, use actual object if type, not tern
|
0x200, /// associated with previous 3, use actual object if type, not tern
|
||||||
YAP_STRING_LENGTH =
|
YAP_STRING_LENGTH =
|
||||||
0x400, /// input: length is fixed; output: return integer with length
|
0x400, /// input: length is fixed; output: return integer with length
|
||||||
YAP_STRING_NTH = 0x800, /// input: ignored; output: nth char
|
YAP_STRING_NTH = 0x800, /// input: ignored; output: nth char
|
||||||
YAP_STRING_TERM = 0x1000, // Generic term, if nothing else given
|
YAP_STRING_TERM = 0x1000, // Generic term, if nothing else given
|
||||||
YAP_STRING_DIFF = 0x2000, // difference list
|
YAP_STRING_DIFF = 0x2000, // difference list
|
||||||
@ -490,7 +486,7 @@ extern bool write_Text(unsigned char *inp, seq_tv_t *out USES_REGS);
|
|||||||
extern bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS);
|
extern bool Yap_CVT_Text(seq_tv_t *inp, seq_tv_t *out USES_REGS);
|
||||||
extern bool Yap_Concat_Text(int n, seq_tv_t inp[], seq_tv_t *out USES_REGS);
|
extern bool Yap_Concat_Text(int n, seq_tv_t inp[], seq_tv_t *out USES_REGS);
|
||||||
extern bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
extern bool Yap_Splice_Text(int n, size_t cuts[], seq_tv_t *inp,
|
||||||
seq_tv_t outv[] USES_REGS);
|
seq_tv_t outv[] USES_REGS);
|
||||||
|
|
||||||
// user friendly interface
|
// user friendly interface
|
||||||
|
|
||||||
@ -498,8 +494,8 @@ static inline Atom Yap_AtomicToLowAtom(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOM | YAP_STRING_DOWNCASE;
|
out.type = YAP_STRING_ATOM | YAP_STRING_DOWNCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -510,8 +506,8 @@ static inline Atom Yap_AtomicToUpAtom(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOM | YAP_STRING_UPCASE;
|
out.type = YAP_STRING_ATOM | YAP_STRING_UPCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -522,8 +518,8 @@ static inline Term Yap_AtomicToLowString(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_STRING | YAP_STRING_DOWNCASE;
|
out.type = YAP_STRING_STRING | YAP_STRING_DOWNCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -534,8 +530,8 @@ static inline Term Yap_AtomicToUpString(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_STRING | YAP_STRING_UPCASE;
|
out.type = YAP_STRING_STRING | YAP_STRING_UPCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -546,8 +542,8 @@ static inline Term Yap_AtomicToLowListOfCodes(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_CODES | YAP_STRING_DOWNCASE;
|
out.type = YAP_STRING_CODES | YAP_STRING_DOWNCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -558,8 +554,8 @@ static inline Term Yap_AtomicToUpListOfCodes(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_CODES | YAP_STRING_UPCASE;
|
out.type = YAP_STRING_CODES | YAP_STRING_UPCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -570,8 +566,8 @@ static inline Term Yap_AtomicToLowListOfAtoms(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOMS | YAP_STRING_DOWNCASE;
|
out.type = YAP_STRING_ATOMS | YAP_STRING_DOWNCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -582,8 +578,8 @@ static inline Term Yap_AtomicToUpListOfAtoms(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOMS | YAP_STRING_UPCASE;
|
out.type = YAP_STRING_ATOMS | YAP_STRING_UPCASE;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -594,8 +590,8 @@ static inline size_t Yap_AtomicToUnicodeLength(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
inp.type = YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS |
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_CHARS | YAP_STRING_OUTPUT_TERM;
|
out.type = YAP_STRING_CHARS | YAP_STRING_OUTPUT_TERM;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -606,7 +602,7 @@ static inline Term Yap_AtomicToListOfAtoms(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOMS;
|
out.type = YAP_STRING_ATOMS;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -617,7 +613,7 @@ static inline Term Yap_AtomicToListOfCodes(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_CODES;
|
out.type = YAP_STRING_CODES;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -629,7 +625,7 @@ static inline Atom Yap_AtomicToAtom(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -667,8 +663,8 @@ static inline Term Yap_AtomSWIToListOfAtoms(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_INT |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
||||||
YAP_STRING_TERM;
|
YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_ATOMS;
|
out.type = YAP_STRING_ATOMS;
|
||||||
|
|
||||||
@ -718,7 +714,7 @@ static inline Term Yap_AtomSWIToString(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_INT |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_STRING;
|
out.type = YAP_STRING_STRING;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
@ -733,7 +729,7 @@ static inline Term Yap_AtomicToString(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_STRING;
|
out.type = YAP_STRING_STRING;
|
||||||
|
|
||||||
@ -747,7 +743,7 @@ static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = mod_to_type(mod PASS_REGS);
|
out.type = mod_to_type(mod PASS_REGS);
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
@ -773,7 +769,7 @@ static inline Term Yap_AtomicToTBQ(Term t0, Term mod USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = mod_to_bqtype(mod PASS_REGS);
|
out.type = mod_to_bqtype(mod PASS_REGS);
|
||||||
|
|
||||||
@ -797,7 +793,7 @@ static inline Atom Yap_CharsToAtom(const char *s, encoding_t enc USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToListOfAtoms(const char *s,
|
static inline Term Yap_CharsToListOfAtoms(const char *s,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -811,7 +807,7 @@ static inline Term Yap_CharsToListOfAtoms(const char *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToListOfCodes(const char *s,
|
static inline Term Yap_CharsToListOfCodes(const char *s,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -849,7 +845,7 @@ static inline Atom Yap_UTF8ToAtom(const unsigned char *s USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
|
static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -864,7 +860,7 @@ static inline Term Yap_CharsToDiffListOfCodes(const char *s, Term tail,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
|
static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
|
||||||
Term tail USES_REGS) {
|
Term tail USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -879,7 +875,7 @@ static inline Term Yap_UTF8ToDiffListOfCodes(const char *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_WCharsToDiffListOfCodes(const wchar_t *s,
|
static inline Term Yap_WCharsToDiffListOfCodes(const wchar_t *s,
|
||||||
Term tail USES_REGS) {
|
Term tail USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.w0 = s;
|
inp.val.w0 = s;
|
||||||
@ -911,7 +907,7 @@ static inline char *Yap_AtomToUTF8Text(Atom at USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToTDQ(const char *s, Term mod,
|
static inline Term Yap_CharsToTDQ(const char *s, Term mod,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -926,7 +922,7 @@ static inline Term Yap_CharsToTDQ(const char *s, Term mod,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToTBQ(const char *s, Term mod,
|
static inline Term Yap_CharsToTBQ(const char *s, Term mod,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -947,7 +943,6 @@ static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
|
|||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
out.enc = ENC_ISO_UTF8;
|
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return (Atom)NULL;
|
return (Atom)NULL;
|
||||||
return out.val.a;
|
return out.val.a;
|
||||||
@ -958,7 +953,7 @@ static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
|
|||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOMS;
|
inp.type = YAP_STRING_ATOMS;
|
||||||
out.type =
|
out.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -1033,7 +1028,7 @@ static inline Term Yap_ListToAtomic(Term t0 USES_REGS) {
|
|||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
out.type = YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
out.type = YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT |
|
||||||
YAP_STRING_BIG | YAP_STRING_OUTPUT_TERM;
|
YAP_STRING_BIG | YAP_STRING_OUTPUT_TERM;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
return out.val.t;
|
return out.val.t;
|
||||||
@ -1072,8 +1067,8 @@ static inline Term Yap_ListSWIToString(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_ATOMS_CODES |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_ATOMS_CODES |
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG |
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG |
|
||||||
YAP_STRING_OUTPUT_TERM;
|
YAP_STRING_OUTPUT_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_STRING;
|
out.type = YAP_STRING_STRING;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
@ -1112,7 +1107,7 @@ static inline Term YapListToTBQ(Term t0, Term mod USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
|
static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1128,7 +1123,7 @@ static inline Atom Yap_NCharsToAtom(const char *s, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
|
static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
|
||||||
Term tail USES_REGS) {
|
Term tail USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1142,7 +1137,7 @@ static inline Term Yap_CharsToDiffListOfAtoms(const char *s, encoding_t enc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
|
static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1156,7 +1151,7 @@ static inline Term Yap_NCharsToListOfCodes(const char *s, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NCharsToString(const char *s, size_t len,
|
static inline Term Yap_NCharsToString(const char *s, size_t len,
|
||||||
encoding_t enc USES_REGS) {
|
encoding_t enc USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1170,7 +1165,7 @@ static inline Term Yap_NCharsToString(const char *s, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
|
static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
|
||||||
Term mod USES_REGS) {
|
Term mod USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1185,7 +1180,7 @@ static inline Term Yap_NCharsToTDQ(const char *s, size_t len, encoding_t enc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NCharsToTBQ(const char *s, size_t len, encoding_t enc,
|
static inline Term Yap_NCharsToTBQ(const char *s, size_t len, encoding_t enc,
|
||||||
Term mod USES_REGS) {
|
Term mod USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.c0 = s;
|
inp.val.c0 = s;
|
||||||
@ -1203,7 +1198,7 @@ static inline Atom Yap_NumberToAtom(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type =
|
inp.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -1214,7 +1209,7 @@ static inline Term Yap_NumberToListOfAtoms(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type =
|
inp.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOMS;
|
out.type = YAP_STRING_ATOMS;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -1225,7 +1220,7 @@ static inline Term Yap_NumberToListOfCodes(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type =
|
inp.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_CODES;
|
out.type = YAP_STRING_CODES;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -1236,7 +1231,7 @@ static inline Term Yap_NumberToString(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type =
|
inp.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_STRING;
|
out.type = YAP_STRING_STRING;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -1256,7 +1251,7 @@ static inline Atom Yap_NWCharsToAtom(const wchar_t *s, size_t len USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
|
static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
|
||||||
size_t len USES_REGS) {
|
size_t len USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.w0 = s;
|
inp.val.w0 = s;
|
||||||
@ -1269,7 +1264,7 @@ static inline Term Yap_NWCharsToListOfAtoms(const wchar_t *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_NWCharsToListOfCodes(const wchar_t *s,
|
static inline Term Yap_NWCharsToListOfCodes(const wchar_t *s,
|
||||||
size_t len USES_REGS) {
|
size_t len USES_REGS) {
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
|
||||||
inp.val.w0 = s;
|
inp.val.w0 = s;
|
||||||
@ -1310,8 +1305,8 @@ static inline Atom Yap_StringSWIToAtom(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
||||||
YAP_STRING_TERM;
|
YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -1324,7 +1319,7 @@ static inline size_t Yap_StringToAtomic(Term t0 USES_REGS) {
|
|||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING;
|
inp.type = YAP_STRING_STRING;
|
||||||
out.type =
|
out.type =
|
||||||
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG;
|
YAP_STRING_ATOM | YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
return 0L;
|
return 0L;
|
||||||
@ -1353,8 +1348,8 @@ static inline size_t Yap_StringSWIToListOfAtoms(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
||||||
YAP_STRING_TERM;
|
YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOMS;
|
out.type = YAP_STRING_ATOMS;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -1377,8 +1372,8 @@ static inline size_t Yap_StringSWIToListOfCodes(Term t0 USES_REGS) {
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_ATOMS_CODES |
|
||||||
YAP_STRING_TERM;
|
YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_CODES;
|
out.type = YAP_STRING_CODES;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -1391,7 +1386,7 @@ static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
|
|||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_STRING;
|
inp.type = YAP_STRING_STRING;
|
||||||
out.type =
|
out.type =
|
||||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
@ -1404,7 +1399,7 @@ static inline Atom Yap_TextToAtom(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
||||||
YAP_STRING_ATOMS_CODES;
|
YAP_STRING_ATOMS_CODES;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
|
|
||||||
@ -1418,7 +1413,7 @@ static inline Term Yap_TextToString(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
||||||
YAP_STRING_ATOMS_CODES;
|
YAP_STRING_ATOMS_CODES;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_STRING;
|
out.type = YAP_STRING_STRING;
|
||||||
|
|
||||||
@ -1443,7 +1438,7 @@ static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
|
|||||||
|
|
||||||
inp.val.t = t0;
|
inp.val.t = t0;
|
||||||
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
|
||||||
YAP_STRING_ATOMS_CODES | YAP_STRING_MALLOC;
|
YAP_STRING_ATOMS_CODES | YAP_STRING_MALLOC;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
out.type = YAP_STRING_CHARS;
|
out.type = YAP_STRING_CHARS;
|
||||||
out.enc = ENC_ISO_UTF8;
|
out.enc = ENC_ISO_UTF8;
|
||||||
@ -1535,10 +1530,10 @@ static inline Atom Yap_ConcatAtomics(Term t1, Term t2 USES_REGS) {
|
|||||||
seq_tv_t inpv[2], out;
|
seq_tv_t inpv[2], out;
|
||||||
inpv[0].val.t = t1;
|
inpv[0].val.t = t1;
|
||||||
inpv[0].type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inpv[0].type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
inpv[1].val.t = t2;
|
inpv[1].val.t = t2;
|
||||||
inpv[1].type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
inpv[1].type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_INT |
|
||||||
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
out.val.uc = NULL;
|
out.val.uc = NULL;
|
||||||
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
|
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
|
||||||
@ -1560,7 +1555,7 @@ static inline Term Yap_ConcatStrings(Term t1, Term t2 USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut,
|
static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut,
|
||||||
size_t max USES_REGS) {
|
size_t max USES_REGS) {
|
||||||
seq_tv_t outv[2], inp;
|
seq_tv_t outv[2], inp;
|
||||||
size_t cuts[2];
|
size_t cuts[2];
|
||||||
cuts[0] = cut;
|
cuts[0] = cut;
|
||||||
@ -1603,7 +1598,7 @@ static inline Atom Yap_SubtractTailAtom(Term t1, Term th USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut,
|
static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut,
|
||||||
size_t max USES_REGS) {
|
size_t max USES_REGS) {
|
||||||
seq_tv_t outv[2], inp;
|
seq_tv_t outv[2], inp;
|
||||||
size_t cuts[2];
|
size_t cuts[2];
|
||||||
inp.type = YAP_STRING_STRING;
|
inp.type = YAP_STRING_STRING;
|
||||||
|
@ -20,8 +20,6 @@ check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
|
|||||||
check_include_files( "stdio.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
check_include_files( "stdio.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
|
||||||
configure_file (cmake/cudd_config.h.cmake
|
configure_file (cmake/cudd_config.h.cmake
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/cudd_config.h" )
|
"${CMAKE_CURRENT_BINARY_DIR}/cudd_config.h" )
|
||||||
configure_file (cmake/cudd_config.h.cmake
|
|
||||||
"${CMAKE_BINARY_DIR}/packages/cplint/config,config.h" )
|
|
||||||
|
|
||||||
endif (CUDD_FOUND)
|
endif (CUDD_FOUND)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ package:
|
|||||||
requirements:
|
requirements:
|
||||||
build:
|
build:
|
||||||
- cmake
|
- cmake
|
||||||
- clang
|
|
||||||
- swig
|
- swig
|
||||||
- readline
|
- readline
|
||||||
- gmp
|
- gmp
|
||||||
@ -24,4 +23,4 @@ about:
|
|||||||
summary: Prolog System
|
summary: Prolog System
|
||||||
|
|
||||||
source:
|
source:
|
||||||
path: ..
|
path: ..
|
||||||
|
36
os/charsio.c
36
os/charsio.c
@ -97,7 +97,7 @@ Int Yap_peek(int sno) {
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Int ocharcount, olinecount, olinepos;
|
Int ocharcount, olinecount, olinepos;
|
||||||
StreamDesc *s;
|
StreamDesc *s;
|
||||||
uint32_t ch;
|
int32_t ch;
|
||||||
|
|
||||||
s = GLOBAL_Stream + sno;
|
s = GLOBAL_Stream + sno;
|
||||||
#if USE_READLINE
|
#if USE_READLINE
|
||||||
@ -1039,11 +1039,11 @@ code with _C_, while leaving the current stream position unaltered.
|
|||||||
*/
|
*/
|
||||||
static Int peek_byte(USES_REGS1) { /* at_end_of_stream */
|
static Int peek_byte(USES_REGS1) { /* at_end_of_stream */
|
||||||
/* the next character is a EOF */
|
/* the next character is a EOF */
|
||||||
int sno = Yap_CheckStream(ARG1, Input_Stream_f, "peek_byte/2");
|
int sno = Yap_CheckBinaryStream(ARG1, Input_Stream_f, "peek_byte/2");
|
||||||
Int ch;
|
Int ch;
|
||||||
|
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return (FALSE);
|
return false;
|
||||||
if (!(GLOBAL_Stream[sno].status & Binary_Stream_f)) {
|
if (!(GLOBAL_Stream[sno].status & Binary_Stream_f)) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_byte/2");
|
Yap_Error(PERMISSION_ERROR_INPUT_BINARY_STREAM, ARG1, "peek_byte/2");
|
||||||
@ -1099,24 +1099,22 @@ atom with _C_, while leaving the stream position unaltered.
|
|||||||
static Int peek_char(USES_REGS1) {
|
static Int peek_char(USES_REGS1) {
|
||||||
/* the next character is a EOF */
|
/* the next character is a EOF */
|
||||||
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2");
|
int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2");
|
||||||
unsigned char sinp[10];
|
unsigned char sinp[16];
|
||||||
Int ch;
|
Int ch;
|
||||||
|
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return false;
|
return false;
|
||||||
if ((GLOBAL_Stream[sno].status & Binary_Stream_f)) {
|
if ((ch = Yap_peek(sno)) < 0) {
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_byte/2");
|
return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
|
||||||
return (FALSE);
|
}
|
||||||
}
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
if ((ch = Yap_peek(sno)) < 0) {
|
int off = put_utf8(sinp, ch);
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
if (off < 0) {
|
||||||
return Yap_unify_constant(ARG2, MkAtomTerm(AtomEof));
|
return false;
|
||||||
}
|
}
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
sinp[off] = '\0';
|
||||||
int off = put_utf8(sinp, ch);
|
return Yap_unify_constant(ARG2, MkAtomTerm(Yap_ULookupAtom(sinp)));
|
||||||
sinp[off] = '\0';
|
|
||||||
return Yap_unify_constant(ARG2, MkAtomTerm(Yap_ULookupAtom(sinp)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @pred peek_char( - _C_) is iso
|
/** @pred peek_char( - _C_) is iso
|
||||||
|
Reference in New Issue
Block a user