Merge branch 'master' of ssh://git.code.sf.net/p/yap/yap-6.3
This commit is contained in:
commit
f3597f3d02
41
C/adtdefs.c
41
C/adtdefs.c
@ -304,17 +304,26 @@ Yap_LookupMaybeWideAtom(wchar_t *atom)
|
||||
Atom
|
||||
Yap_LookupMaybeWideAtomWithLength(wchar_t *atom, size_t len0)
|
||||
{ /* lookup atom in atom table */
|
||||
wchar_t *p = atom, c;
|
||||
size_t len = 0;
|
||||
Atom at;
|
||||
int wide = FALSE;
|
||||
while ((c = *p++)) {
|
||||
if (c > 255) wide = TRUE;
|
||||
len++;
|
||||
if (len == len0) break;
|
||||
size_t i;
|
||||
|
||||
while (i < len0) {
|
||||
// primary support for atoms with null chars
|
||||
wchar_t c = atom[i];
|
||||
if (c > 255) {
|
||||
wide = TRUE;
|
||||
break;
|
||||
}
|
||||
if (c=='\0') {
|
||||
len0 = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (wide) {
|
||||
wchar_t *ptr0;
|
||||
|
||||
ptr0 = (wchar_t *)Yap_AllocCodeSpace(sizeof(wchar_t)*(len0+1));
|
||||
if (!ptr0)
|
||||
return NIL;
|
||||
@ -325,11 +334,12 @@ Yap_LookupMaybeWideAtomWithLength(wchar_t *atom, size_t len0)
|
||||
return at;
|
||||
} else {
|
||||
char *ptr0;
|
||||
Int i;
|
||||
|
||||
ptr0 = (char *)Yap_AllocCodeSpace((len0+1));
|
||||
if (!ptr0)
|
||||
return NIL;
|
||||
for (i=0; i < len0; i++) ptr0[i] = atom[i];
|
||||
for (i=0;i<len0;i++)
|
||||
ptr0[i] = atom[i];
|
||||
ptr0[len0] = '\0';
|
||||
at = LookupAtom(ptr0);
|
||||
Yap_FreeCodeSpace(ptr0);
|
||||
@ -340,20 +350,17 @@ Yap_LookupMaybeWideAtomWithLength(wchar_t *atom, size_t len0)
|
||||
Atom
|
||||
Yap_LookupAtomWithLength(char *atom, size_t len0)
|
||||
{ /* lookup atom in atom table */
|
||||
char *p = atom;
|
||||
Atom at;
|
||||
char *ptr;
|
||||
|
||||
char *ptr, *ptr0;
|
||||
size_t len = 0;
|
||||
/* not really a wide atom */
|
||||
p = atom;
|
||||
ptr0 = ptr = Yap_AllocCodeSpace(len0+1);
|
||||
ptr = Yap_AllocCodeSpace(len0+1);
|
||||
if (!ptr)
|
||||
return NIL;
|
||||
while (len++ < len0) {int ch = *ptr++ = *p++; if (ch == '\0') break;}
|
||||
ptr[0] = '\0';
|
||||
at = LookupAtom(ptr0);
|
||||
Yap_FreeCodeSpace(ptr0);
|
||||
memcpy(ptr, atom, len0);
|
||||
ptr[len0] = '\0';
|
||||
at = LookupAtom(ptr);
|
||||
Yap_FreeCodeSpace(ptr);
|
||||
return at;
|
||||
}
|
||||
|
||||
|
5
C/text.c
5
C/text.c
@ -26,7 +26,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifndef HAVE_WCSNLEN
|
||||
#define wcsnlen(S, N) wcslen(S)
|
||||
inline static min(size_t i, size_t j) {
|
||||
i < j ? return i : return j;
|
||||
}
|
||||
#define wcsnlen(S, N) min(N, wcslen(S))
|
||||
#endif
|
||||
|
||||
static inline unsigned char *get_char(unsigned char *p, int *c) { *c = *p; return p+1; }
|
||||
|
25
H/YapText.h
25
H/YapText.h
@ -47,12 +47,15 @@ typedef enum {
|
||||
YAP_STRING_LITERAL = 0x200,
|
||||
YAP_STRING_LENGTH = 0x400,
|
||||
YAP_STRING_NTH = 0x800,
|
||||
YAP_STRING_TERM = 0x1000, // joint with other flags that define possible values
|
||||
YAP_STRING_DIFF = 0x2000, // difference list
|
||||
YAP_STRING_NCHARS= 0x4000, // size of input/result
|
||||
YAP_STRING_TRUNC= 0x8000 // truncate on maximum size of input/result
|
||||
}
|
||||
seq_type_t;
|
||||
} enum_seq_type_t;
|
||||
|
||||
|
||||
#define YAP_STRING_TERM 0x1000 // joint with other flags that define possible values
|
||||
#define YAP_STRING_DIFF 0x2000 // difference list
|
||||
#define YAP_STRING_NCHARS 0x4000 // size of input/result
|
||||
#define YAP_STRING_TRUNC 0x8000 // truncate on maximum size of input/result
|
||||
|
||||
typedef UInt seq_type_t;
|
||||
|
||||
#define YAP_TYPE_MASK 0x1FFF
|
||||
|
||||
@ -523,6 +526,7 @@ Yap_NCharsToAtom( const char *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_ATOM;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.a;
|
||||
@ -537,6 +541,7 @@ Yap_NCharsToListOfAtoms( const char *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_ATOMS;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -551,6 +556,7 @@ Yap_NCharsToListOfCodes( const char *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_CODES;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -565,6 +571,7 @@ Yap_NCharsToString( const char *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_STRING;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -580,6 +587,7 @@ Yap_NCharsToTDQ( const char *s, size_t len, Term mod USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.mod = mod;
|
||||
out.type = mod_to_type(mod PASS_REGS);
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -642,7 +650,7 @@ Yap_NWCharsToAtom( const wchar_t *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_WCHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_ATOM;
|
||||
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.a;
|
||||
@ -657,6 +665,7 @@ Yap_NWCharsToListOfAtoms( const wchar_t *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_WCHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_ATOMS;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -671,6 +680,7 @@ Yap_NWCharsToListOfCodes( const wchar_t *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_WCHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_CODES;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
@ -685,6 +695,7 @@ Yap_NWCharsToString( const wchar_t *s, size_t len USES_REGS )
|
||||
inp.sz = len;
|
||||
inp.type = YAP_STRING_WCHARS|YAP_STRING_NCHARS;
|
||||
out.type = YAP_STRING_STRING;
|
||||
out.max = len;
|
||||
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||
return 0L;
|
||||
return out.val.t;
|
||||
|
@ -282,11 +282,11 @@ C_SOURCES= \
|
||||
OPTYap/or.thread_engine.c \
|
||||
OPTYap/or.scheduler.c OPTYap/or.cut.c \
|
||||
OPTYap/tab.tries.c OPTYap/tab.completion.c \
|
||||
# library/mpi/mpi.c library/mpi/mpe.c \
|
||||
# library/lammpi/yap_mpi.c library/lammpi/hash.c library/lammpi/prologterms2c.c \
|
||||
C/cut_c.c \
|
||||
library/dialect/swi/fli/swi.c \
|
||||
library/dialect/swi/fli/blobs.c
|
||||
library/dialect/swi/fli/blobs.c \
|
||||
# library/mpi/mpi.c library/mpi/mpe.c \
|
||||
# library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c
|
||||
|
||||
PLCONS_SOURCES = \
|
||||
console/LGPL/pl-nt.c \
|
||||
@ -633,7 +633,7 @@ TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
|
||||
|
||||
depend: $(HEADERS) $(C_SOURCES)
|
||||
-@if test "$(GCC)" = yes; then\
|
||||
$(CC) -MM $(CFLAGS) -D__YAP_NOT_INSTALLED__=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os $(FULL_PATH_C_SOURCES) >> Makefile;\
|
||||
$(CC) -MM $(CFLAGS) -D__YAP_NOT_INSTALLED__=1 -I$(srcdir)/H -I$(srcdir)/include -I$(srcdir)/os -I$(srcdir)/library/dialect/swi/fli -I. $(FULL_PATH_C_SOURCES) >> Makefile;\
|
||||
else\
|
||||
makedepend -f - -- $(CFLAGS) -Iinclude -- $(C_SOURCES) |\
|
||||
sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
|
||||
|
5
configure
vendored
5
configure
vendored
@ -9311,7 +9311,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in time times tmpnam usleep utime vsnprintf wcsdup
|
||||
for ac_func in time times tmpnam usleep utime vsnprintf wcsdup wcsnlen
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@ -13065,6 +13065,9 @@ while test $found = no; do
|
||||
fi
|
||||
done
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: _JTOPDIR=\"$_JTOPDIR\"" >&5
|
||||
$as_echo "_JTOPDIR=\"$_JTOPDIR\"" >&6; }
|
||||
|
||||
# get the likely subdirectories for system specific java includes
|
||||
case "$host_os" in
|
||||
bsdi*) _JNI_INC_SUBDIRS="bsdos";;
|
||||
|
Reference in New Issue
Block a user