Merge /Users/vsc/git/yap-6.3

This commit is contained in:
Vítor Santos Costa 2014-02-20 10:39:14 +00:00
commit f21823ea00
9 changed files with 50 additions and 22 deletions

View File

@ -575,7 +575,7 @@ putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb)
wrf stream = wglb->stream; wrf stream = wglb->stream;
if (IsBlob(atom)) { if (IsBlob(atom)) {
wrputblob(RepAtom(atom),wglb->Quote_illegal,wglb); wrputblob(RepAtom(atom),Quote_illegal,wglb);
return; return;
} }
if (IsWideAtom(atom)) { if (IsWideAtom(atom)) {
@ -621,6 +621,15 @@ putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb)
} }
} }
void
Yap_WriteAtom(IOSTREAM *s, Atom atom)
{
struct write_globs wglb;
wglb.stream = s;
wglb.Quote_illegal = FALSE;
putAtom(atom, 0, &wglb);
}
static int static int
IsCodesTerm(Term string) /* checks whether this is a string */ IsCodesTerm(Term string) /* checks whether this is a string */
{ {

View File

@ -36,6 +36,7 @@ extern IOENC Yap_DefaultEncoding(void);
extern void Yap_SetDefaultEncoding(IOENC); extern void Yap_SetDefaultEncoding(IOENC);
extern void Yap_setCurrentSourceLocation( void *rd ); extern void Yap_setCurrentSourceLocation( void *rd );
extern void *Yap_GetStreamHandle(Atom at); extern void *Yap_GetStreamHandle(Atom at);
extern void Yap_WriteAtom(IOSTREAM *s, Atom atom);
extern atom_t codeToAtom(int chrcode); extern atom_t codeToAtom(int chrcode);

25
configure vendored
View File

@ -7152,7 +7152,7 @@ fi
DO_SECOND_LD="" DO_SECOND_LD=""
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
SHLIB_LD="$CC -dynamiclib" SHLIB_LD="$CC -dynamiclib"
SHLIB_CXX_LD="$CXX -dynamiclib" SHLIB_CXX_LD="$CXX -dynamiclib"
EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@" EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@"
INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)" INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
@ -7170,10 +7170,11 @@ fi
INSTALL_DLLS="yes" INSTALL_DLLS="yes"
fi fi
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall" CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall"
DYNYAPLIB=libYap."$SO" DYNYAPLIB=libYap."$YAP_VERSION.$SO"
SONAMEFLAG="" SONAMEFLAG="-Wl,-install_name,$prefix/lib/libYap.$YAP_MAJOR_VERSION.$SO -Wl,-compatibility_version,$YAP_MAJOR_VERSION.$YAP_MINOR_VERSION -Wl,-current_version,$YAP_VERSION"
YAPLIB_LD="$CC -dynamiclib -Wl,-install_name,$prefix/lib/libYap.$SO" YAPLIB_LD="$CC -dynamiclib"
PRE_INSTALL_ENV="DYLD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$DYLD_LIBRARY_PATH" PRE_INSTALL_ENV="DYLD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$DYLD_LIBRARY_PATH"
EXTRAYAPLIBS="libYap.$SO libYap.$YAP_MAJOR_VERSION.$SO"
;; ;;
*netbsd*|*openbsd*|*freebsd*|*dragonfly*) *netbsd*|*openbsd*|*freebsd*|*dragonfly*)
if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__ if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__
@ -8963,7 +8964,7 @@ _ACEOF
fi fi
done done
for ac_func in rename rint sbrk select setbuf for ac_func in rename rint sbrk select setbuf setlinebuf
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -12015,7 +12016,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 12018 "configure" */ /* #line 12019 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -12191,7 +12192,7 @@ EOF
if uudecode$EXEEXT Test.uue; then if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes ac_cv_prog_uudecode_base64=yes
else else
echo "configure: 12194: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: 12195: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5 echo "configure: failed file was:" >&5
cat Test.uue >&5 cat Test.uue >&5
ac_cv_prog_uudecode_base64=no ac_cv_prog_uudecode_base64=no
@ -12322,7 +12323,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 12325 "configure" */ /* #line 12326 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -12357,7 +12358,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
TEST=Test TEST=Test
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* [#]line 12360 "configure" */ /* [#]line 12361 "configure" */
public class Test { public class Test {
public static void main (String args[]) { public static void main (String args[]) {
System.exit (0); System.exit (0);
@ -13008,6 +13009,12 @@ _ACEOF
if test $i_am_cross_compiling = yes
then
#mingw: we know where things are
JPLCFLAGS="-I \"$yap_cv_java\"/include -I \"$yap_cv_java\"/include/win32"
JAVALIBS="-L \"$yap_cv_java\"/jre/bin/server -L \"$yap_cv_java\"/jre/bin/client -ljvm"
fi

View File

@ -953,7 +953,7 @@ dnl Linux has both elf and a.out, in this case we found elf
DO_SECOND_LD="" DO_SECOND_LD=""
if test "$dynamic_loading" = "yes" if test "$dynamic_loading" = "yes"
then then
SHLIB_LD="$CC -dynamiclib" SHLIB_LD="$CC -dynamiclib"
SHLIB_CXX_LD="$CXX -dynamiclib" SHLIB_CXX_LD="$CXX -dynamiclib"
EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@" EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@"
INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)" INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
@ -971,10 +971,11 @@ dnl Linux has both elf and a.out, in this case we found elf
INSTALL_DLLS="yes" INSTALL_DLLS="yes"
fi fi
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall" CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall"
DYNYAPLIB=libYap."$SO" DYNYAPLIB=libYap."$YAP_VERSION.$SO"
SONAMEFLAG="" SONAMEFLAG="-Wl,-install_name,$prefix/lib/libYap.$YAP_MAJOR_VERSION.$SO -Wl,-compatibility_version,$YAP_MAJOR_VERSION.$YAP_MINOR_VERSION -Wl,-current_version,$YAP_VERSION"
YAPLIB_LD="$CC -dynamiclib -Wl,-install_name,$prefix/lib/libYap.$SO" YAPLIB_LD="$CC -dynamiclib"
PRE_INSTALL_ENV="DYLD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$DYLD_LIBRARY_PATH" PRE_INSTALL_ENV="DYLD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$DYLD_LIBRARY_PATH"
EXTRAYAPLIBS="libYap.$SO libYap.$YAP_MAJOR_VERSION.$SO"
;; ;;
*netbsd*|*openbsd*|*freebsd*|*dragonfly*) *netbsd*|*openbsd*|*freebsd*|*dragonfly*)
if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__ if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__
@ -1538,7 +1539,7 @@ AC_CHECK_FUNCS(mbsnrtowcs)
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp) AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp)
AC_CHECK_FUNCS(nanosleep mktime opendir) AC_CHECK_FUNCS(nanosleep mktime opendir)
AC_CHECK_FUNCS(putenv rand random readlink regexec) AC_CHECK_FUNCS(putenv rand random readlink regexec)
AC_CHECK_FUNCS(rename rint sbrk select setbuf) AC_CHECK_FUNCS(rename rint sbrk select setbuf setlinebuf)
AC_CHECK_FUNCS(setitimer setlocale setsid setlinebuf sigaction) AC_CHECK_FUNCS(setitimer setlocale setsid setlinebuf sigaction)
AC_CHECK_FUNCS(siggetmask siginterrupt) AC_CHECK_FUNCS(siggetmask siginterrupt)
AC_CHECK_FUNCS(signal sigprocmask socket srand srandom stat) AC_CHECK_FUNCS(signal sigprocmask socket srand srandom stat)

View File

@ -1809,7 +1809,7 @@ PL_record_external
return NULL; return NULL;
if ((nsz = Yap_ExportTerm(t, s, len, 0))) { if ((nsz = Yap_ExportTerm(t, s, len, 0))) {
*sz = nsz; *sz = nsz;
return s; return (record_t)s;
} else { } else {
if (len < 16*1024) if (len < 16*1024)
len = len *2; len = len *2;

View File

@ -1448,7 +1448,11 @@ PRED_IMPL("with_output_to", 2, with_output_to, PL_FA_TRANSPARENT)
void void
PL_write_prompt(int dowrite) PL_write_prompt(int dowrite)
{ GET_LD { GET_LD
#if __YAP_PROLOG__
IOSTREAM *s = getStream(Suser_error);
#else
IOSTREAM *s = getStream(Suser_output); IOSTREAM *s = getStream(Suser_output);
#endif
if ( s ) if ( s )
{ if ( dowrite ) { if ( dowrite )
@ -1457,7 +1461,6 @@ PL_write_prompt(int dowrite)
if ( a ) if ( a )
writeAtomToStream(s, a); writeAtomToStream(s, a);
} }
Sflush(s); Sflush(s);
releaseStream(s); releaseStream(s);
} }
@ -2937,7 +2940,6 @@ PRED_IMPL("prompt", 2, prompt, 0)
void void
prompt1(atom_t prompt) prompt1(atom_t prompt)
{ GET_LD { GET_LD
if ( LD->prompt.first != prompt ) if ( LD->prompt.first != prompt )
{ if ( LD->prompt.first ) { if ( LD->prompt.first )
PL_unregister_atom(LD->prompt.first); PL_unregister_atom(LD->prompt.first);

View File

@ -415,7 +415,6 @@ Sread_readline(void *handle, char *buf, size_t size)
int fd = (int) h; int fd = (int) h;
int ttymode = PL_ttymode(Suser_input); /* Not so nice */ int ttymode = PL_ttymode(Suser_input); /* Not so nice */
int rval; int rval;
PL_write_prompt(ttymode == PL_NOTTY); PL_write_prompt(ttymode == PL_NOTTY);
switch( ttymode ) switch( ttymode )
@ -474,6 +473,9 @@ Sread_readline(void *handle, char *buf, size_t size)
reset_readline(); reset_readline();
} }
#if __YAP_PROLOG__
rl_outstream = stderr;
#endif
if ( in_readline++ ) if ( in_readline++ )
{ int state = rl_readline_state; { int state = rl_readline_state;

View File

@ -2662,7 +2662,6 @@ Swrite_file(void *handle, char *buf, size_t size)
#else #else
bytes = write((int)h, buf, size); bytes = write((int)h, buf, size);
#endif #endif
if ( bytes == -1 && errno == EINTR ) if ( bytes == -1 && errno == EINTR )
{ if ( PL_handle_signals() < 0 ) { if ( PL_handle_signals() < 0 )
{ errno = EPLEXCEPTION; { errno = EPLEXCEPTION;
@ -3541,8 +3540,15 @@ SinitStreams(void)
if ( !isatty(i) && s->functions == &Sttyfunctions ) if ( !isatty(i) && s->functions == &Sttyfunctions )
{ s->flags &= ~SIO_ISATTY; { s->flags &= ~SIO_ISATTY;
s->functions = &Sfilefunctions; /* Check for pipe? */ s->functions = &Sfilefunctions; /* Check for pipe? */
#if HAVE_SETLINEBUF
/* make sure wwe buffer on new line for ttys, eg eclipse console */
} else if (i == 1) {
setlinebuf( stdout );
#endif
} }
if ( s > 0)
s->newline = SIO_NL_DOS;
if ( s->encoding == ENC_ISO_LATIN_1 ) if ( s->encoding == ENC_ISO_LATIN_1 )
s->encoding = enc; s->encoding = enc;
#ifdef O_PLMT #ifdef O_PLMT

View File

@ -249,7 +249,7 @@ writeTopTerm(term_t t, int prec, write_options *options)
int int
writeAtomToStream(IOSTREAM *s, atom_t atom) writeAtomToStream(IOSTREAM *s, atom_t atom)
{ Yap_plwrite(MkAtomTerm(YAP_AtomFromSWIAtom(atom)), s, 0, 0, 1200); { Yap_WriteAtom( s, YAP_AtomFromSWIAtom(atom));
return 1; return 1;
} }