allow the option to have priorities above 1200
This commit is contained in:
parent
c6f1c328f8
commit
edb6189512
@ -2512,7 +2512,7 @@ break_debug(contador);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
Yap_plwrite ((Term) beam_X[1], NULL, 0, 1200);
|
||||
Yap_plwrite ((Term) beam_X[1], NULL, 0, GLOBAL_MaxPriority);
|
||||
#else
|
||||
extern int beam_write (void);
|
||||
beam_write();
|
||||
|
@ -742,10 +742,10 @@ void ShowCode_new2(int op, int new1,CELL new4)
|
||||
switch (ch = *f++)
|
||||
{
|
||||
case '1':
|
||||
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, 1200);
|
||||
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, GLOBAL_MaxPriority);
|
||||
break;
|
||||
case '4':
|
||||
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, 1200);
|
||||
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, GLOBAL_MaxPriority);
|
||||
break;
|
||||
default:
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'%');
|
||||
|
@ -1723,7 +1723,7 @@ X_API Term YAP_ReadBuffer(const char *s, Term *tp) {
|
||||
BACKUP_H();
|
||||
|
||||
LOCAL_ErrorMessage = NULL;
|
||||
while (!(t = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding, 1200, tp))) {
|
||||
while (!(t = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding, GLOBAL_MaxPriority, tp))) {
|
||||
if (LOCAL_ErrorMessage) {
|
||||
if (!strcmp(LOCAL_ErrorMessage, "Stack Overflow")) {
|
||||
if (!Yap_dogc(0, NULL PASS_REGS)) {
|
||||
@ -2467,7 +2467,7 @@ X_API void YAP_Write(Term t, FILE *f, int flags) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
int sno = Yap_OpenStream(f, NULL, TermNil, Output_Stream_f);
|
||||
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, 1200);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
|
||||
Yap_ReleaseStream(sno);
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
|
@ -1143,7 +1143,7 @@ setInitialValue( bool bootstrap, flag_func f, const char *s,flag_term *tarr )
|
||||
Term t0;
|
||||
if (bootstrap) { return false; }
|
||||
CACHE_REGS
|
||||
t0 = Yap_StringToTerm(s, strlen(s)+1, &LOCAL_encoding, 1200, NULL);
|
||||
t0 = Yap_StringToTerm(s, strlen(s)+1, &LOCAL_encoding, GLOBAL_MaxPriority, NULL);
|
||||
if (!t0)
|
||||
return false;
|
||||
if (IsAtomTerm(t0) || IsIntTerm(t0)) {
|
||||
@ -1447,7 +1447,7 @@ Yap_InitFlags( bool bootstrap) {
|
||||
local_flags_setup;
|
||||
while (f->name != NULL) {
|
||||
bool itf = setInitialValue( bootstrap, f->def, f->init, LOCAL_Flags+LOCAL_flagCount );
|
||||
// Term itf = Yap_StringToTerm(f->init, strlen(f->init)+1, LOCAL_encoding, 1200, &tp);
|
||||
// Term itf = Yap_StringToTerm(f->init, strlen(f->init)+1, LOCAL_encoding, GLOBAL_MaxPriority, &tp);
|
||||
if (itf) {
|
||||
initFlag( f, LOCAL_flagCount, false);
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ case Var_tok:
|
||||
case '(':
|
||||
case 'l': /* non solo ( */
|
||||
NextToken;
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
checkfor(')', FailBuff PASS_REGS);
|
||||
break;
|
||||
case '[':
|
||||
@ -830,7 +830,7 @@ case Var_tok:
|
||||
NextToken;
|
||||
break;
|
||||
}
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
@ -882,7 +882,7 @@ case Var_tok:
|
||||
}
|
||||
|
||||
NextToken;
|
||||
t = ParseTerm( 1200, FailBuff PASS_REGS);
|
||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
||||
if (LOCAL_tokptr->Tok != QuasiQuotes_tok) {
|
||||
syntax_msg( "expected to find quasi quotes, got \"%s\"", , Yap_tokRep(LOCAL_tokptr) );
|
||||
FAIL;
|
||||
@ -987,7 +987,7 @@ case Var_tok:
|
||||
Volatile Term args[2];
|
||||
NextToken;
|
||||
args[0] = t;
|
||||
args[1] = ParseTerm( 1000, FailBuff PASS_REGS);
|
||||
args[1] = ParseTerm(1000, FailBuff PASS_REGS);
|
||||
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
||||
/* check for possible overflow against local stack */
|
||||
if (HR > ASP - 4096) {
|
||||
|
21
C/stack.c
21
C/stack.c
@ -1768,8 +1768,7 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
if (mod == PROLOG_MODULE)
|
||||
mod = TermProlog;
|
||||
Term t = Yap_MkNewApplTerm(f, pe->ArityOfPE);
|
||||
Yap_plwrite(Yap_PredicateIndicator(t,mod),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
|
||||
Yap_plwrite(Yap_PredicateIndicator(t,mod),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '\n', stderr );
|
||||
} else {
|
||||
UNLOCK(pe->PELock);
|
||||
@ -1798,23 +1797,23 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
else
|
||||
mod = TermProlog;
|
||||
if (mod != TermProlog && mod != MkAtomTerm(AtomUser)) {
|
||||
Yap_plwrite(mod,GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(mod,GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( ':', stderr );
|
||||
}
|
||||
if (mod == IDB_MODULE) {
|
||||
if (pe->PredFlags & NumberDBPredFlag) {
|
||||
Int id = pe->src.IndxId;
|
||||
Yap_plwrite(MkIntegerTerm(id),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkIntegerTerm(id),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else if (pe->PredFlags & AtomDBPredFlag) {
|
||||
Atom At = (Atom)pe->FunctorOfPred;
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else {
|
||||
Functor f = pe->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
arity_t arity = ArityOfFunctor(f);
|
||||
int i;
|
||||
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(At),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
@ -1824,14 +1823,14 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
fputc( ')', stderr );
|
||||
}
|
||||
fputc( '(', stderr );
|
||||
Yap_plwrite(b_ptr->cp_a2,GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(b_ptr->cp_a2,GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( ')', stderr );
|
||||
} else if (pe->ArityOfPE == 0) {
|
||||
Yap_plwrite(MkAtomTerm((Atom)f),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm((Atom)f),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
} else {
|
||||
Int i = 0, arity = pe->ArityOfPE;
|
||||
if (opnum == _or_last || opnum == _or_else) {
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
@ -1841,12 +1840,12 @@ void DumpActiveGoals(USES_REGS1) {
|
||||
fputs(") :- ... ( _ ; _ ", stderr);
|
||||
} else {
|
||||
Term *args = &(b_ptr->cp_a1);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(MkAtomTerm(NameOfFunctor(f)),GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
fputc( '(', stderr );
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
fputc( ',', stderr );
|
||||
Yap_plwrite(args[i],GLOBAL_Stream+2, 0, 0, 1200);
|
||||
Yap_plwrite(args[i],GLOBAL_Stream+2, 0, 0, GLOBAL_MaxPriority);
|
||||
}
|
||||
}
|
||||
fputc( ')', stderr );
|
||||
|
4
C/text.c
4
C/text.c
@ -969,9 +969,7 @@ write_number( void *s0, seq_tv_t *out, encoding_t enc, int minimal, int size USE
|
||||
static Term
|
||||
string_to_term( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
||||
{
|
||||
printf("TR0=%p\n", TR);
|
||||
Term o = out->val.t = Yap_StringToTerm(s0, strlen(s0)+1, &enc, 1200, NULL);
|
||||
printf("TRF=%p\n", TR);
|
||||
Term o = out->val.t = Yap_StringToTerm(s0, strlen(s0)+1, &enc, GLOBAL_MaxPriority, NULL);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ static void send_tracer_message(char *start, char *name, Int arity, char *mname,
|
||||
for (i = 0; i < arity; i++) {
|
||||
if (i > 0)
|
||||
fprintf(stderr, ",");
|
||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f, 1200);
|
||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f, GLOBAL_MaxPriority);
|
||||
}
|
||||
if (arity) {
|
||||
fprintf(stderr, ")");
|
||||
|
@ -1158,7 +1158,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
||||
} else if (!wglb->Ignore_ops && functor == FunctorBraces) {
|
||||
wrputc('{', wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(from_pointer(RepAppl(t) + 1, &nrwt, wglb), 1200, depth + 1,
|
||||
writeTerm(from_pointer(RepAppl(t) + 1, &nrwt, wglb), GLOBAL_MaxPriority, depth + 1,
|
||||
FALSE, wglb, &nrwt);
|
||||
restore_from_write(&nrwt, wglb);
|
||||
wrputc('}', wglb->stream);
|
||||
@ -1269,7 +1269,7 @@ char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length,
|
||||
GLOBAL_Stream[sno].encoding = *encp;
|
||||
else
|
||||
GLOBAL_Stream[sno].encoding = LOCAL_encoding;
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, 1200);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
|
||||
s = Yap_MemExportStreamPtr(sno);
|
||||
Yap_CloseStream(sno);
|
||||
LOCAL_c_output_stream = old_output_stream;
|
||||
|
@ -168,6 +168,9 @@ char* CharConversionTable2 =NULL
|
||||
/* time */
|
||||
void* LastWTimePtr =NULL
|
||||
|
||||
/* max priority */
|
||||
int MaxPriority =1200
|
||||
|
||||
|
||||
|
||||
END_GLOBAL_DATA
|
||||
|
10
os/format.c
10
os/format.c
@ -618,7 +618,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
goto do_type_atom_error;
|
||||
yhandle_t sl = Yap_StartSlots();
|
||||
// stream is already locked.
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, Handle_vars_f | To_heap_f, 1200);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, Handle_vars_f | To_heap_f, GLOBAL_MaxPriority);
|
||||
Yap_CloseSlots(sl);
|
||||
break;
|
||||
case 'c': {
|
||||
@ -871,7 +871,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
t = targs[targ++];
|
||||
yhandle_t sl = Yap_StartSlots();
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0,
|
||||
Quote_illegal_f | Ignore_ops_f | To_heap_f, 1200);
|
||||
Quote_illegal_f | Ignore_ops_f | To_heap_f, GLOBAL_MaxPriority);
|
||||
Yap_CloseSlots(sl);
|
||||
break;
|
||||
case '@':
|
||||
@ -910,7 +910,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
{
|
||||
Int sl = Yap_InitSlot(args);
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0,
|
||||
Handle_vars_f | Use_portray_f | To_heap_f, 1200);
|
||||
Handle_vars_f | Use_portray_f | To_heap_f, GLOBAL_MaxPriority);
|
||||
args = Yap_GetFromSlot(sl);
|
||||
Yap_CloseSlots(sl);
|
||||
}
|
||||
@ -939,7 +939,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
t = targs[targ++];
|
||||
yhandle_t sl0 = Yap_StartSlots();
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0,
|
||||
Handle_vars_f | Quote_illegal_f | To_heap_f, 1200);
|
||||
Handle_vars_f | Quote_illegal_f | To_heap_f, GLOBAL_MaxPriority);
|
||||
Yap_CloseSlots(sl0);
|
||||
break;
|
||||
case 'w':
|
||||
@ -948,7 +948,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
t = targs[targ++];
|
||||
yhandle_t slf = Yap_StartSlots();
|
||||
Yap_plwrite(t, GLOBAL_Stream + sno, 0, Handle_vars_f | To_heap_f,
|
||||
1200);
|
||||
GLOBAL_MaxPriority);
|
||||
Yap_CloseSlots(slf);
|
||||
break;
|
||||
case '~':
|
||||
|
@ -446,9 +446,9 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
|
||||
}
|
||||
if (args[READ_PRIORITY].used) {
|
||||
re->prio = IntegerOfTerm(args[READ_PRIORITY].tvalue);
|
||||
if (re->prio > 1200) {
|
||||
if (re->prio > GLOBAL_MaxPriority) {
|
||||
Yap_Error(DOMAIN_ERROR_OPERATOR_PRIORITY, opts,
|
||||
"max priority in Prolog is 1200, not %ld", re->prio);
|
||||
"max priority in Prolog is %d, not %ld", GLOBAL_MaxPriority, re->prio);
|
||||
}
|
||||
} else {
|
||||
re->prio = LOCAL_default_priority;
|
||||
|
@ -143,7 +143,7 @@ static char SccsId[] = "%W% %G%";
|
||||
int beam_write ( USES_REGS1 )
|
||||
{
|
||||
Yap_StartSlots();
|
||||
Yap_plwrite (ARG1, GLOBAL_Stream+LOCAL_c_output_stream, 0, 0, 1200);
|
||||
Yap_plwrite (ARG1, GLOBAL_Stream+LOCAL_c_output_stream, 0, 0, GLOBAL_MaxPriority);
|
||||
Yap_CloseSlots();
|
||||
if (EX != 0L) {
|
||||
Term ball = Yap_PopTermFromDB(EX);
|
||||
@ -288,7 +288,7 @@ write_term ( int output_stream, Term t, xarg *args USES_REGS )
|
||||
if (args[WRITE_PRIORITY].used) {
|
||||
prio = IntegerOfTerm(args[WRITE_PRIORITY].tvalue);
|
||||
} else {
|
||||
prio = 1200;
|
||||
prio = GLOBAL_MaxPriority;
|
||||
}
|
||||
Yap_plwrite( t, GLOBAL_Stream+output_stream, depth, flags, prio);
|
||||
UNLOCK(GLOBAL_Stream[output_stream].streamlock);
|
||||
|
Reference in New Issue
Block a user