Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <windows.h>
|
||||
#include <uxnt.h>
|
||||
#define O_HASDRIVES 1
|
||||
#define O_HASSHARES 1
|
||||
#endif
|
||||
|
||||
#ifndef PL_CONSOLE
|
||||
@@ -25,6 +26,7 @@
|
||||
|
||||
#include "Yap.h"
|
||||
#include "YapHeap.h"
|
||||
|
||||
/* try not to pollute the SWI space */
|
||||
#ifdef P
|
||||
#undef P
|
||||
|
@@ -74,7 +74,9 @@ too much.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
#ifndef __YAP_PROLOG__
|
||||
static void setArgvPrologFlag(void);
|
||||
#endif
|
||||
static void setTZPrologFlag(void);
|
||||
#ifndef __YAP_PROLOG__
|
||||
static void setVersionPrologFlag(void);
|
||||
#endif
|
||||
static atom_t lookupAtomFlag(atom_t key);
|
||||
@@ -1111,7 +1113,9 @@ initPrologFlags(void)
|
||||
|
||||
#ifndef __YAP_PROLOG__
|
||||
setArgvPrologFlag();
|
||||
#endif /* YAP_PROLOG */
|
||||
setTZPrologFlag();
|
||||
#ifndef __YAP_PROLOG__
|
||||
setOSPrologFlags();
|
||||
setVersionPrologFlag();
|
||||
#endif /* YAP_PROLOG */
|
||||
@@ -1141,6 +1145,8 @@ setArgvPrologFlag()
|
||||
PL_discard_foreign_frame(fid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
setTZPrologFlag()
|
||||
{ tzset();
|
||||
@@ -1148,6 +1154,7 @@ setTZPrologFlag()
|
||||
setPrologFlag("timezone", FT_INTEGER|FF_READONLY, timezone);
|
||||
}
|
||||
|
||||
#ifndef __YAP_PROLOG__
|
||||
|
||||
static void
|
||||
setVersionPrologFlag(void)
|
||||
|
@@ -276,7 +276,6 @@ PutToken(const char *s, IOSTREAM *stream)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PutTokenN(const char *s, size_t len, IOSTREAM *stream)
|
||||
{ if ( len > 0 )
|
||||
@@ -291,6 +290,63 @@ PutTokenN(const char *s, size_t len, IOSTREAM *stream)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if __YAP_PROLOG__
|
||||
static bool
|
||||
PutWideStringN(const wchar_t *str, size_t length, IOSTREAM *s)
|
||||
{ size_t i;
|
||||
const wchar_t *q = (const wchar_t *)str;
|
||||
|
||||
for(i=0; i<length; i++, q++)
|
||||
{ if ( Sputcode(*q, s) == EOF )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool
|
||||
PutWideString(const wchar_t *str, IOSTREAM *s)
|
||||
{ const wchar_t *q = (const wchar_t *)str;
|
||||
|
||||
for( ; *q != EOS; q++ )
|
||||
{ if ( Sputcode(*q, s) == EOF )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PutWideToken(const wchar_t *s, IOSTREAM *stream)
|
||||
{ if ( s[0] )
|
||||
{ int rc;
|
||||
|
||||
TRY(rc=PutOpenToken(s[0]&0xff, stream));
|
||||
TRY(PutWideString(s, stream));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
PutWideTokenN(const wchar_t *s, size_t len, IOSTREAM *stream)
|
||||
{ if ( len > 0 )
|
||||
{ int rc;
|
||||
|
||||
TRY(rc=PutOpenToken(s[0]&0xff, stream));
|
||||
TRY(PutWideStringN(s, len, stream));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PutOpenBrace()/PutCloseBrace() are used to put additional braces around
|
||||
@@ -518,6 +574,11 @@ writeAtom(atom_t a, write_options *options)
|
||||
case AT_SYMBOL:
|
||||
case AT_SOLO:
|
||||
case AT_SPECIAL:
|
||||
#if __YAP_PROLOG__
|
||||
if (isWideAtom(atom)) {
|
||||
return PutWideToken(nameOfWideAtom(atom), options->out);
|
||||
}
|
||||
#endif
|
||||
return PutToken(nameOfAtom(atom), options->out);
|
||||
case AT_QUOTE:
|
||||
case AT_FULLSTOP:
|
||||
@@ -532,8 +593,14 @@ writeAtom(atom_t a, write_options *options)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
#if __YAP_PROLOG__
|
||||
if (isWideAtom(atom)) {
|
||||
return PutWideTokenN(nameOfWideAtom(atom), atomLength(atom), options->out);
|
||||
}
|
||||
#endif
|
||||
return PutTokenN(nameOfAtom(atom), atomLength(atom), options->out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -886,10 +953,16 @@ writePrimitive(term_t t, write_options *options)
|
||||
|
||||
#if __YAP_PROLOG__
|
||||
{
|
||||
number n;
|
||||
n.type = V_INTEGER;
|
||||
n.value.i = 0;
|
||||
return WriteNumber(&n, options);
|
||||
Opaque_CallOnWrite f;
|
||||
|
||||
if ( (f = Yap_blob_write_handler_from_slot(t)) ) {
|
||||
return (f)(options->out, Yap_blob_tag_from_slot(t), Yap_blob_info_from_slot(t), options->flags);
|
||||
} else {
|
||||
number n;
|
||||
n.type = V_INTEGER;
|
||||
n.value.i = 0;
|
||||
return WriteNumber(&n, options);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -993,6 +993,14 @@ int Yap_getInputStream(term_t t, IOSTREAM **s)
|
||||
return getInputStream(t, s);
|
||||
}
|
||||
|
||||
extern int Yap_getOutputStream(term_t t, IOSTREAM **s);
|
||||
|
||||
int Yap_getOutputStream(term_t t, IOSTREAM **s)
|
||||
{
|
||||
GET_LD
|
||||
return getOutputStream(t, s);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
@@ -1157,6 +1165,20 @@ Yap_dowrite(Term t, IOSTREAM *stream, int flags, int priority)
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
isWideAtom(atom_t atom)
|
||||
{
|
||||
Atom a = (Atom)atomValue(atom);
|
||||
return IsWideAtom(a);
|
||||
}
|
||||
|
||||
wchar_t *
|
||||
nameOfWideAtom(atom_t atom)
|
||||
{
|
||||
Atom a = (Atom)atomValue(atom);
|
||||
return RepAtom(a)->WStrOfAE;
|
||||
}
|
||||
|
||||
|
||||
#if THREADS
|
||||
|
||||
@@ -1207,7 +1229,6 @@ error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
recursiveMutexInit(recursiveMutex *m)
|
||||
{
|
||||
|
@@ -148,6 +148,9 @@ extern term_t Yap_CvtTerm(term_t ts);
|
||||
|
||||
#define clearNumber(n)
|
||||
|
||||
wchar_t *nameOfWideAtom(atom_t atom);
|
||||
int isWideAtom(atom_t atom);
|
||||
|
||||
inline static int
|
||||
charCode(Term w)
|
||||
{ if ( IsAtomTerm(w) )
|
||||
|
@@ -516,7 +516,7 @@ are in UTF-8 encoding!
|
||||
|
||||
char *
|
||||
_xos_limited_os_filename(const char *spec, char *limited)
|
||||
{ const unsigned char *i = (const unsigned char*)spec;
|
||||
{ const char *i = spec;
|
||||
char *o = limited;
|
||||
|
||||
while(*i)
|
||||
|
Reference in New Issue
Block a user