Allow string in $VAR
init spell
This commit is contained in:
Vítor Santos Costa 2015-11-05 16:35:25 +00:00
parent 67bb20cf0d
commit f758ac2fe4
4 changed files with 9 additions and 6 deletions

View File

@ -536,7 +536,7 @@ p_create_thread( USES_REGS1 )
setup_engine(new_worker_id, FALSE); setup_engine(new_worker_id, FALSE);
if ((REMOTE_ThreadHandle(new_worker_id).ret = pthread_create(&REMOTE_ThreadHandle(new_worker_id).pthread_handle, NULL, thread_run, (void *)(&(REMOTE_ThreadHandle(new_worker_id).id)))) == 0) { if ((REMOTE_ThreadHandle(new_worker_id).ret = pthread_create(&REMOTE_ThreadHandle(new_worker_id).pthread_handle, NULL, thread_run, (void *)(&(REMOTE_ThreadHandle(new_worker_id).id)))) == 0) {
pthread_setspecific(Yap_yaamregs_key, (const void *)REMOTE_ThreadHandle(owid).current_yaam_regs); pthread_setspecific(Yap_yaamregs_key, (const void *)REMOTE_ThreadHandle(owid).current_yaam_regs);
/* wait until the client is initialised */ /* wait until the client is initialized */
return TRUE; return TRUE;
} }
pthread_setspecific(Yap_yaamregs_key, (const void *)REMOTE_ThreadHandle(owid).current_yaam_regs); pthread_setspecific(Yap_yaamregs_key, (const void *)REMOTE_ThreadHandle(owid).current_yaam_regs);

View File

@ -5485,7 +5485,7 @@ S_SREG = RepAppl(d0);
XREG(PREG->y_u.yx.x) = (CELL) pt0; XREG(PREG->y_u.yx.x) = (CELL) pt0;
PREG = NEXTOP(PREG, yx); PREG = NEXTOP(PREG, yx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS) #if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
/* We must initialise a shared variable to point to the SBA */ /* We must initialize a shared variable to point to the SBA */
if (Unsigned((Int)(pt0)-(Int)(H_FZ)) > if (Unsigned((Int)(pt0)-(Int)(H_FZ)) >
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) { Unsigned((Int)(B_FZ)-(Int)(H_FZ))) {
*pt0 = (CELL)STACK_TO_SBA(pt0); *pt0 = (CELL)STACK_TO_SBA(pt0);

View File

@ -3087,7 +3087,7 @@
XREG(PREG->y_u.yx.x) = (CELL) pt0; XREG(PREG->y_u.yx.x) = (CELL) pt0;
PREG = NEXTOP(PREG, yx); PREG = NEXTOP(PREG, yx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS) #if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
/* We must initialise a shared variable to point to the SBA */ /* We must initialize a shared variable to point to the SBA */
if (Unsigned((Int)(pt0)-(Int)(H_FZ)) > if (Unsigned((Int)(pt0)-(Int)(H_FZ)) >
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) { Unsigned((Int)(B_FZ)-(Int)(H_FZ))) {
*pt0 = (CELL)STACK_TO_SBA(pt0); *pt0 = (CELL)STACK_TO_SBA(pt0);

View File

@ -341,7 +341,7 @@ static void wrputf(Float f, struct write_globs *wglb) /* writes a float */
} }
lastw = alphanum; lastw = alphanum;
// sprintf(s, "%.15g", f); // sprintf(s, "%.15g", f);
sprintf(s, RepAtom(AtomFloatFormat)->StrOfAE, f); sprintf(s, floatFormat(), f);
while (*pt == ' ') while (*pt == ' ')
pt++; pt++;
if (*pt == '-') { if (*pt == '-') {
@ -1123,7 +1123,8 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
wrputc(' ', wglb->stream); wrputc(' ', wglb->stream);
} }
if (!IsVarTerm(ti) && if (!IsVarTerm(ti) &&
(IsIntTerm(ti) || IsCodesTerm(ti) || IsAtomTerm(ti))) { (IsIntTerm(ti) || IsCodesTerm(ti) ||
IsAtomTerm(ti) || IsStringTerm(ti) )) {
if (IsIntTerm(ti)) { if (IsIntTerm(ti)) {
Int k = IntOfTerm(ti); Int k = IntOfTerm(ti);
if (k == -1) { if (k == -1) {
@ -1141,6 +1142,8 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
} }
} else if (IsAtomTerm(ti)) { } else if (IsAtomTerm(ti)) {
putAtom(AtomOfTerm(ti), FALSE, wglb); putAtom(AtomOfTerm(ti), FALSE, wglb);
} else if (IsStringTerm(ti)) {
putString(ti, wglb);
} else { } else {
putUnquotedString(ti, wglb); putUnquotedString(ti, wglb);
} }
@ -1230,7 +1233,7 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags,
/* notice: we must have ASP well set when using portray, otherwise /* notice: we must have ASP well set when using portray, otherwise
we cannot make recursive Prolog calls */ we cannot make recursive Prolog calls */
wglb.Keep_terms = (flags & (Use_portray_f | To_heap_f)); wglb.Keep_terms = (flags & (Use_portray_f | To_heap_f));
/* initialise wglb */ /* initialize wglb */
rwt.parent = NULL; rwt.parent = NULL;
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;