fix non locale code
This commit is contained in:
parent
0241151599
commit
ab06b04a09
38
C/write.c
38
C/write.c
@ -317,7 +317,7 @@ wrputf(Float f, struct write_globs *wglb) /* writes a float */
|
|||||||
size_t l1 = strlen((const char *)decimalpoint+1);
|
size_t l1 = strlen((const char *)decimalpoint+1);
|
||||||
#else
|
#else
|
||||||
const unsigned char *decimalpoint = ".";
|
const unsigned char *decimalpoint = ".";
|
||||||
l1 = 0;
|
size_t l1 = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lastw == symbol || lastw == alphanum) {
|
if (lastw == symbol || lastw == alphanum) {
|
||||||
@ -574,11 +574,12 @@ putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb)
|
|||||||
wtype atom_or_symbol;
|
wtype atom_or_symbol;
|
||||||
wrf stream = wglb->stream;
|
wrf stream = wglb->stream;
|
||||||
|
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "AA LCL0=(%p) %p", LCL0, &LCL0 ); }
|
||||||
if (IsBlob(atom)) {
|
if (IsBlob(atom)) {
|
||||||
wrputblob(RepAtom(atom),Quote_illegal,wglb);
|
wrputblob(RepAtom(atom),Quote_illegal,wglb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsWideAtom(atom)) {
|
if (IsWideAtom(atom) ) {
|
||||||
wchar_t *ws = RepAtom(atom)->WStrOfAE;
|
wchar_t *ws = RepAtom(atom)->WStrOfAE;
|
||||||
|
|
||||||
if (Quote_illegal) {
|
if (Quote_illegal) {
|
||||||
@ -593,7 +594,11 @@ putAtom(Atom atom, int Quote_illegal, struct write_globs *wglb)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "AB LCL0=(%p) %p", LCL0, &LCL0 ); }
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "AB LCL0=(%p) %p", LCL0, RepAtom(atom)->StrOfAE ); }
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "AB LCL0=(%p) %c", LCL0, RepAtom(atom)->StrOfAE[0]); }
|
||||||
s = (unsigned char *)RepAtom(atom)->StrOfAE;
|
s = (unsigned char *)RepAtom(atom)->StrOfAE;
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "AC %s LCL0=(%p) %p", s, LCL0, &LCL0 ); }
|
||||||
/* #define CRYPT_FOR_STEVE 1*/
|
/* #define CRYPT_FOR_STEVE 1*/
|
||||||
#ifdef CRYPT_FOR_STEVE
|
#ifdef CRYPT_FOR_STEVE
|
||||||
if (Yap_GetValue(AtomCryptAtoms) != TermNil && Yap_GetAProp(atom, OpProperty) == NIL) {
|
if (Yap_GetValue(AtomCryptAtoms) != TermNil && Yap_GetAProp(atom, OpProperty) == NIL) {
|
||||||
@ -886,14 +891,19 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
if (EX)
|
if (EX)
|
||||||
return;
|
return;
|
||||||
t = Deref(t);
|
t = Deref(t);
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "V %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
write_var((CELL *)t, wglb, &nrwt);
|
write_var((CELL *)t, wglb, &nrwt);
|
||||||
} else if (IsIntTerm(t)) {
|
} else if (IsIntTerm(t)) {
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
|
|
||||||
wrputn((Int) IntOfTerm(t),wglb);
|
wrputn((Int) IntOfTerm(t),wglb);
|
||||||
} else if (IsAtomTerm(t)) {
|
} else if (IsAtomTerm(t)) {
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "A %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
putAtom(AtomOfTerm(t), wglb->Quote_illegal, wglb);
|
putAtom(AtomOfTerm(t), wglb->Quote_illegal, wglb);
|
||||||
} else if (IsPairTerm(t)) {
|
} else if (IsPairTerm(t)) {
|
||||||
if (wglb->Ignore_ops) {
|
if (wglb->Ignore_ops) {
|
||||||
wrputs("'.'(",wglb->stream);
|
wrputs("'.'(",wglb->stream);
|
||||||
lastw = separator;
|
lastw = separator;
|
||||||
writeTerm(from_pointer(RepPair(t), &nrwt, wglb), 999, depth + 1, FALSE, wglb, &nrwt);
|
writeTerm(from_pointer(RepPair(t), &nrwt, wglb), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||||
@ -909,29 +919,33 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
struct DB_TERM *old_EX = NULL;
|
struct DB_TERM *old_EX = NULL;
|
||||||
Int sl = 0;
|
Int sl = 0;
|
||||||
|
|
||||||
targs[0] = t;
|
targs[0] = t;
|
||||||
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
|
Yap_PutValue(AtomPortray, MkAtomTerm(AtomNil));
|
||||||
if (EX) old_EX = EX;
|
if (EX) old_EX = EX;
|
||||||
sl = Yap_InitSlot(t PASS_REGS);
|
sl = Yap_InitSlot(t PASS_REGS);
|
||||||
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs), 0, 1);
|
Yap_execute_goal(Yap_MkApplTerm(FunctorPortray, 1, targs), 0, 1);
|
||||||
t = Yap_GetFromSlot(sl PASS_REGS);
|
t = Yap_GetFromSlot(sl PASS_REGS);
|
||||||
Yap_RecoverSlots(1, sl PASS_REGS);
|
Yap_RecoverSlots(1, sl PASS_REGS);
|
||||||
if (old_EX != NULL) EX = old_EX;
|
if (old_EX != NULL) EX = old_EX;
|
||||||
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue))
|
if (Yap_GetValue(AtomPortray) == MkAtomTerm(AtomTrue))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (yap_flags[WRITE_QUOTED_STRING_FLAG] && IsCodesTerm(t)) {
|
if (yap_flags[WRITE_QUOTED_STRING_FLAG] && IsCodesTerm(t)) {
|
||||||
putString(t, wglb);
|
putString(t, wglb);
|
||||||
} else {
|
} else {
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
wrputc('[', wglb->stream);
|
wrputc('[', wglb->stream);
|
||||||
lastw = separator;
|
lastw = separator;
|
||||||
/* we assume t was already saved in the stack */
|
/* we assume t was already saved in the stack */
|
||||||
write_list(t, 0, depth, wglb, rwt);
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "II %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
|
write_list(t, 0, depth, wglb, rwt);
|
||||||
wrputc(']', wglb->stream);
|
wrputc(']', wglb->stream);
|
||||||
lastw = separator;
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "III II%d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
|
lastw = separator;
|
||||||
}
|
}
|
||||||
} else { /* compound term */
|
} else { /* compound term */
|
||||||
Functor functor = FunctorOfTerm(t);
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
|
Functor functor = FunctorOfTerm(t);
|
||||||
int Arity;
|
int Arity;
|
||||||
Atom atom;
|
Atom atom;
|
||||||
int op, lp, rp;
|
int op, lp, rp;
|
||||||
@ -1087,7 +1101,8 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
} else if (!wglb->Ignore_ops &&
|
} else if (!wglb->Ignore_ops &&
|
||||||
Arity == 2 && Yap_IsInfixOp(atom, &op, &lp,
|
Arity == 2 && Yap_IsInfixOp(atom, &op, &lp,
|
||||||
&rp) ) {
|
&rp) ) {
|
||||||
Term tleft = ArgOfTerm(1, t);
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "II %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
|
Term tleft = ArgOfTerm(1, t);
|
||||||
Term tright = ArgOfTerm(2, t);
|
Term tright = ArgOfTerm(2, t);
|
||||||
int bracket_left =
|
int bracket_left =
|
||||||
!IsVarTerm(tleft) && IsAtomTerm(tleft) &&
|
!IsVarTerm(tleft) && IsAtomTerm(tleft) &&
|
||||||
@ -1104,7 +1119,9 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
if (bracket_left) {
|
if (bracket_left) {
|
||||||
wropen_bracket(wglb, TRUE);
|
wropen_bracket(wglb, TRUE);
|
||||||
}
|
}
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "III %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), lp, depth + 1, rinfixarg, wglb, &nrwt);
|
writeTerm(from_pointer(RepAppl(t)+1, &nrwt, wglb), lp, depth + 1, rinfixarg, wglb, &nrwt);
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "IV %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
t = AbsAppl(restore_from_write(&nrwt, wglb)-1);
|
t = AbsAppl(restore_from_write(&nrwt, wglb)-1);
|
||||||
if (bracket_left) {
|
if (bracket_left) {
|
||||||
wrclose_bracket(wglb, TRUE);
|
wrclose_bracket(wglb, TRUE);
|
||||||
@ -1239,6 +1256,7 @@ Yap_plwrite(Term t, void *mywrite, int max_depth, int flags, int priority)
|
|||||||
wglb.Ignore_ops = flags & Ignore_ops_f;
|
wglb.Ignore_ops = flags & Ignore_ops_f;
|
||||||
wglb.Write_strings = flags & BackQuote_String_f;
|
wglb.Write_strings = flags & BackQuote_String_f;
|
||||||
/* protect slots for portray */
|
/* protect slots for portray */
|
||||||
|
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0=(%p) %p", t, LCL0, &LCL0 ); }
|
||||||
writeTerm(from_pointer(&t, &rwt, &wglb), priority, 1, FALSE, &wglb, &rwt);
|
writeTerm(from_pointer(&t, &rwt, &wglb), priority, 1, FALSE, &wglb, &rwt);
|
||||||
restore_from_write(&rwt, &wglb);
|
restore_from_write(&rwt, &wglb);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user