text
This commit is contained in:
parent
e455d6cc6a
commit
6cdd35b6e1
7
C/text.c
7
C/text.c
@ -445,6 +445,13 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
||||
Yap_ThrowError(LOCAL_Error_TYPE, inp->val.t, "while reading text in");
|
||||
}
|
||||
}
|
||||
|
||||
if ((inp->val.t == TermNil) && inp->type & YAP_STRING_PREFER_LIST )
|
||||
{
|
||||
out = Malloc(4);
|
||||
memset(out, 0, 4);
|
||||
POPRET( out );
|
||||
}
|
||||
if (IsAtomTerm(inp->val.t) && inp->type & YAP_STRING_ATOM) {
|
||||
// this is a term, extract to a buffer, and representation is wide
|
||||
// Yap_DebugPlWriteln(inp->val.t);
|
||||
|
@ -179,7 +179,8 @@ extern Term Yap_tokRep(void *tokptr);
|
||||
|
||||
// standard strings
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
YAP_STRING_STRING = 0x1, /// target is a string term
|
||||
YAP_STRING_CODES = 0x2, /// target is a list of integer codes
|
||||
YAP_STRING_ATOMS = 0x4, /// target is a list of kength-1 atom
|
||||
@ -204,7 +205,8 @@ typedef enum {
|
||||
YAP_STRING_UPCASE = 0x100000, // output on malloced buffer
|
||||
YAP_STRING_DOWNCASE = 0x200000, // output on malloced buffer
|
||||
YAP_STRING_IN_TMP = 0x400000, // temporary space has been allocated
|
||||
YAP_STRING_OUTPUT_TERM = 0x800000 // when we're not sure
|
||||
YAP_STRING_OUTPUT_TERM = 0x800000, // when we're not sure
|
||||
YAP_STRING_PREFER_LIST = 0x1000000 // when we're not sure
|
||||
} enum_seq_type_t;
|
||||
|
||||
typedef UInt seq_type_t;
|
||||
@ -958,7 +960,7 @@ static inline Term Yap_ListSWIToString(Term t0 USES_REGS) {
|
||||
inp.val.t = t0;
|
||||
inp.type = YAP_STRING_STRING | YAP_STRING_ATOM | YAP_STRING_ATOMS_CODES |
|
||||
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG |
|
||||
YAP_STRING_OUTPUT_TERM;
|
||||
YAP_STRING_OUTPUT_TERM | YAP_STRING_PREFER_LIST;
|
||||
out.val.uc = NULL;
|
||||
out.type = YAP_STRING_STRING;
|
||||
out.enc = ENC_ISO_UTF8;
|
||||
|
Reference in New Issue
Block a user