diff --git a/C/errors.c b/C/errors.c index 11d7c2e23..e4cf93549 100755 --- a/C/errors.c +++ b/C/errors.c @@ -1045,7 +1045,6 @@ static Int query_exception(USES_REGS1) { if (!IsAddressTerm(Deref(ARG2))) return false; yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2)); - Term t3 = Deref(ARG3); //if (IsVarTerm(t3)) { Term rc = queryErr(query, y); // Yap_DebugPlWriteln(rc); diff --git a/C/gprof.c b/C/gprof.c index 1de391638..affaf35db 100755 --- a/C/gprof.c +++ b/C/gprof.c @@ -728,20 +728,18 @@ return GLOBAL_DIRNAME; char *profile_names(int); char *profile_names(int k) { - static char *FNAME=NULL; + char *FNAME=NULL; int size=200; if (GLOBAL_DIRNAME==NULL) set_profile_dir(NULL); size=strlen(GLOBAL_DIRNAME)+40; - if (FNAME!=NULL) free(FNAME); FNAME=malloc(size); if (FNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } - strcpy(FNAME,GLOBAL_DIRNAME); if (k==PROFILING_FILE) { - sprintf(FNAME,"%s/PROFILING_%d",FNAME,getpid()); + sprintf(FNAME,"%s/PROFILING_%d",GLOBAL_DIRNAME,getpid()); } else { - sprintf(FNAME,"%s/PROFPREDS_%d",FNAME,getpid()); + sprintf(FNAME,"%s/PROFPREDS_%d",GLOBAL_DIRNAME,getpid()); } // printf("%s\n",FNAME); diff --git a/C/scanner.c b/C/scanner.c index f401e94f5..2e052c8f4 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -1340,7 +1340,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, TokEntry *t, *l, *p; enum TokenKinds kind; int solo_flag = TRUE; - int32_t ch, och; + int32_t ch, och = ' '; struct qq_struct_t *cur_qq = NULL; int sign = 1; @@ -1423,12 +1423,13 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, case UC: case UL: - case LC: { - int32_t och = ch; + case LC: + och = ch; ch = getchr(st); - size_t sz = 512; - TokImage = Malloc(sz PASS_REGS); scan_name: + { + size_t sz = 1024; + TokImage = Malloc(sz PASS_REGS); charp = (unsigned char *)TokImage; isvar = (chtype(och) != LC); add_ch_to_buff(och); @@ -1514,8 +1515,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, case 'e': case 'E': och = cherr; - TokImage = Malloc(1024 PASS_REGS); - goto scan_name; + goto scan_name; break; case '=': case '_': @@ -1981,6 +1981,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, return l; default: { + kind = Error_tok; char err[1024]; snprintf(err, 1023, "\n++++ token: unrecognised char %c (%d), type %c\n", ch, ch, chtype(ch)); diff --git a/C/stack.c b/C/stack.c index d99bf2090..b216de3a3 100644 --- a/C/stack.c +++ b/C/stack.c @@ -885,7 +885,7 @@ static PredEntry *ClauseInfoForCode(yamop *codeptr, void **startp, if (codeptr >= COMMA_CODE && codeptr < FAILCODE) { pp = RepPredProp(Yap_GetPredPropByFunc(FunctorComma, CurrentModule)); *startp = (CODEADDR)COMMA_CODE; - *endp = (CODEADDR)(FAILCODE - 1); + *endp = (CODEADDR)(FAILCODE); return pp; } pc = codeptr; diff --git a/H/YapEval.h b/H/YapEval.h index 48d24c0ed..ac6e126a5 100755 --- a/H/YapEval.h +++ b/H/YapEval.h @@ -205,7 +205,6 @@ typedef enum { op_heapused, op_localsp, op_globalsp, - op_b, op_env, op_tr, op_stackfree diff --git a/include/YapErrors.h b/include/YapErrors.h index 491945f9b..50bccdc3a 100644 --- a/include/YapErrors.h +++ b/include/YapErrors.h @@ -90,6 +90,7 @@ E(DOMAIN_ERROR_WRITE_OPTION, DOMAIN_ERROR, "write_option") E(EVALUATION_ERROR_FLOAT_OVERFLOW, EVALUATION_ERROR, "float_overflow") E(EVALUATION_ERROR_FLOAT_UNDERFLOW, EVALUATION_ERROR, "float_underflow") E(EVALUATION_ERROR_INT_OVERFLOW, EVALUATION_ERROR, "int_overflow") +E(EVALUATION_ERROR_READ_STREAM, EVALUATION_ERROR, "read_from_stream") E(EVALUATION_ERROR_UNDEFINED, EVALUATION_ERROR, "undefined") E(EVALUATION_ERROR_UNDERFLOW, EVALUATION_ERROR, "underflow") E(EVALUATION_ERROR_ZERO_DIVISOR, EVALUATION_ERROR, "zero_divisor") diff --git a/os/readterm.c b/os/readterm.c index 88067e994..09c800529 100644 --- a/os/readterm.c +++ b/os/readterm.c @@ -337,10 +337,8 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool Yap_local.ActiveError->errorNo = SYNTAX_ERROR; Yap_local.ActiveError->parserFirstLine = start_line; - Yap_local.ActiveError->parserLine = err_line; Yap_local.ActiveError->parserLastLine = end_line; Yap_local.ActiveError->parserFirstPos = startpos; - Yap_local.ActiveError->parserPos = errpos; Yap_local.ActiveError->parserLastPos =endpos; Yap_local.ActiveError->parserFile = RepAtom(AtomOfTerm((GLOBAL_Stream+sno)->user_name))->StrOfAE; @@ -353,14 +351,34 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool int lvl = push_text_stack(); if (GLOBAL_Stream[sno].status & Seekable_Stream_f) { char *o, *o2; + while (tok) { + if (tok->Tok != Error_tok) { + tok = tok->TokNext; + } + } + err_line = tok->TokLine; + errpos = tok->TokPos; if (errpos <= startpos) { o = malloc(1); o[0] = '\0'; } else { - Int sza = (errpos-startpos)+1; + Int sza = (errpos-startpos)+1, tot = sza; o = malloc(sza); - fread(o,sza-1,1,GLOBAL_Stream[sno].file); - o[sza-1] = '\0'; + char *p = o; + while (true) + { + size_t siz = fread( p,tot-1,1,GLOBAL_Stream[sno].file); + if (siz < 0) Yap_Error(EVALUATION_ERROR_READ_STREAM,GLOBAL_Stream[sno].user_name,"%s", strerror(errno) ); + if (siz < tot -1) { + p += siz; + tot -= siz; + } + else + { + break; + } + + } o[sza-1] = '\0'; } Yap_local.ActiveError->parserTextA = o; @@ -368,14 +386,28 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool o2 = malloc(1); o2[0] = '\0'; } else { - Int sza = (endpos-errpos)+1; + Int sza = (endpos-errpos)+1, tot = sza; o2 = malloc(sza); - fread(o2,sza-1,1,GLOBAL_Stream[sno].file); - o2[sza-1] = '\0'; - } + char *p = o2; + while (true) + { + size_t siz = fread( p,tot-1,1,GLOBAL_Stream[sno].file); + if (siz < 0) Yap_Error(EVALUATION_ERROR_READ_STREAM,GLOBAL_Stream[sno].user_name,"%s", strerror(errno) ); + if (siz < tot -1) { + p += siz; + tot -= siz; + } + else + { + break; + } + + } o2[sza-1] = '\0'; + + } Yap_local.ActiveError->parserTextB = o2; } else { - size_t sz = 1024, total=sz, e; + size_t sz = 1024, e; char *o = malloc(1024); char *s = o; o[0] = '\0'; @@ -384,8 +416,10 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool o = realloc(o, strlen(o)+1); Yap_local.ActiveError->parserTextA= o; o = malloc(1024); - total = sz = 1024; - tok = tok->TokNext; + sz = 1024; +err_line = tok->TokLine; + errpos = tok->TokPos; + tok = tok->TokNext; continue; } const char *ns = Yap_tokText(tok); @@ -402,10 +436,11 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool tok = tok->TokNext; } o = realloc(o, strlen(o)+1); - Yap_local.ActiveError->parserTextA= o; + Yap_local.ActiveError->parserTextB= o; } - + Yap_local.ActiveError->parserPos = errpos; + Yap_local.ActiveError->parserLine = err_line; /* 0: strat, error, end line */ /*2 msg */ /* 1: file */ diff --git a/pl/messages.yap b/pl/messages.yap index 290a0f756..6909b7180 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -27,10 +27,10 @@ */ :- module(system('$messages',[]), - [system_message/4, - prefix/2, - %prefix/5, - file_location/3]). + [system_message/4, + prefix/2, + %prefix/5, + file_location/3]). /** @@ -62,10 +62,10 @@ help messages (not currently implemented in YAP) + `query` query used in query processing (not currently implemented in YAP) + `silent`,M,Na,Ar,File, FilePos]], - [nl, nl]. + [nl, nl]. caller( error(_,Term), _) --> - { lists:memberchk([g|g(Call)], Term) }, - ['~*|called from + { lists:memberchk([g|g(Call)], Term) }, + ['~*|called from messages that do not produce output but that can be intercepted by hooks. @@ -83,11 +83,11 @@ In YAP, the info field describes: - input_stream, may be one of; - - loop_stream - - file() - - none + - loop_stream + - file() + - none - - prolog_source(_) a record containing file, line, predicate, and clause + - prolog_source(_) a record containing file, line, predicate, and clause that activated the goal, or a list therof. YAP tries to search for the user code generatinng the error. @@ -122,7 +122,7 @@ Translates a message-term into a string object. Primarily intended for SWI-Prolo */ prolog:message_to_string(Event, Message) :- - translate_message(Event, warning, Message, []). + translate_message(Event, warning, Message, []). %% @pred compose_message(+Term, +Level, +Lines, -Lines0) is det @@ -132,71 +132,71 @@ prolog:message_to_string(Event, Message) :- % to source-location. Note that syntax errors have their own % source-location and should therefore not be handled this way. compose_message( Term, Level ) --> - [' ~w:'- [Level] - ], - prolog:message(Term), !. + [' ~w:'- [Level] + ], + prolog:message(Term), !. compose_message( query(_QueryResult,_), _Level) --> - []. + []. compose_message( absolute_file_path(File), _Level) --> - [ '~N~n absolute_file of ~w' - [File] ]. + [ '~N~n absolute_file of ~w' - [File] ]. compose_message( absolute_file_path(Msg, Args), _Level) --> - [ ' : ' - [], - Msg - Args, - nl ]. + [ ' : ' - [], + Msg - Args, + nl ]. compose_message( arguments([]), _Level) --> - []. + []. compose_message( arguments([A|As]), Level) --> - [ ' ~w' - [A], - nl ], - compose_message( arguments(As), Level). + [ ' ~w' - [A], + nl ], + compose_message( arguments(As), Level). compose_message( ancestors([]), _Level) --> - [ 'There are no ancestors.' ]. + [ 'There are no ancestors.' ]. compose_message( breakp(bp(debugger,_,_,M:F/N,_),add,already), _Level) --> - [ 'There is already a spy point on ~w:~w/~w.' - [M,F,N] ]. + [ 'There is already a spy point on ~w:~w/~w.' - [M,F,N] ]. compose_message( breakp(bp(debugger,_,_,M:F/N,_),add,ok), _Level) --> - [ 'Spy point set on ~w:~w/~w.' - [M,F,N] ]. + [ 'Spy point set on ~w:~w/~w.' - [M,F,N] ]. compose_message( breakp(bp(debugger,_,_,M:F/N,_),remove,last), _Level) --> - [ 'Spy point on ~w:~w/~w removed.' - [M,F,N] ]. + [ 'Spy point on ~w:~w/~w removed.' - [M,F,N] ]. compose_message( breakp(no,breakpoint_for,M:F/N), _Level) --> - [ 'There is no spy point on ~w:~w/~w.' - [M,F,N] ]. + [ 'There is no spy point on ~w:~w/~w.' - [M,F,N] ]. compose_message( breakpoints([]), _Level) --> - [ 'There are no spy-points set.' ]. + [ 'There are no spy-points set.' ]. compose_message( breakpoints(L), _Level) --> - [ 'Spy-points set on:' ], - list_of_preds(L). + [ 'Spy-points set on:' ], + list_of_preds(L). compose_message( clauses_not_together(P), _Level) --> - [ 'Discontiguous definition of ~q.' - [P] ]. + [ 'Discontiguous definition of ~q.' - [P] ]. compose_message( debug(debug), _Level) --> - [ 'Debug mode on.' - [] ]. + [ 'Debug mode on.' - [] ]. compose_message( debug(off), _Level) --> - [ 'Debug mode off.'- [] ]. + [ 'Debug mode off.'- [] ]. compose_message( debug(trace), _Level) --> - [ 'Trace mode on.'- [] ]. + [ 'Trace mode on.'- [] ]. compose_message( declaration(Args,Action), _Level) --> - [ 'declaration ~w ~w.' - [Args,Action] ]. + [ 'declaration ~w ~w.' - [Args,Action] ]. compose_message( defined_elsewhere(P,F), _Level) --> - [ 'predicate ~q previously defined in file ~w' - [P,F] ]. + [ 'predicate ~q previously defined in file ~w' - [P,F] ]. compose_message( functionality(Library), _Level) --> - [ '~q not available' - [Library] ]. + [ '~q not available' - [Library] ]. compose_message( import(Pred,To,From,private), _Level) --> - [ 'Importing private predicate ~w:~w to ~w.' - [From,Pred,To] ]. + [ 'Importing private predicate ~w:~w to ~w.' - [From,Pred,To] ]. compose_message( redefine_imported(M,M0,PI), _Level) --> - { source_location(ParentF, Line) }, - [ '~w:~w: Module ~w redefines imported predicate ~w:~w.' - [ParentF, Line, M,M0,PI] ]. + { source_location(ParentF, Line) }, + [ '~w:~w: Module ~w redefines imported predicate ~w:~w.' - [ParentF, Line, M,M0,PI] ]. compose_message( leash([]), _Level) --> - [ 'No leashing.' ]. + [ 'No leashing.' ]. compose_message( leash([A|B]), _Level) --> - [ 'Leashing set to ~w.' - [[A|B]] ]. + [ 'Leashing set to ~w.' - [[A|B]] ]. compose_message( no, _Level) --> - [ 'no' - [] ]. + [ 'no' - [] ]. compose_message( no_match(P), _Level) --> - [ 'No matching predicate for ~w.' - [P] ]. + [ 'No matching predicate for ~w.' - [P] ]. compose_message( leash([A|B]), _Level) --> - [ 'Leashing set to ~w.' - [[A|B]] ]. + [ 'Leashing set to ~w.' - [[A|B]] ]. compose_message( halt, _Level) --> !, - [ 'YAP execution halted.'-[] ]. + [ 'YAP execution halted.'-[] ]. - % syntax error. + % syntax error. compose_message( error(event(Type),Info), _Level ) --> !, event(Type, Info). @@ -206,7 +206,7 @@ compose_message(error(warning(syntax_error,Info), Exc), Level) --> compose_message(error(E, Exc), Level) --> { % start_low_level_trace, - '$show_consult_level'(LC) + '$show_consult_level'(LC) }, location(error(E, Exc), Level, LC), main_message(error(E,Exc) , Level, LC ), @@ -218,46 +218,46 @@ compose_message(error(E, Exc), Level) --> [nl], [nl]. compose_message( false, _Level) --> !, - [ 'false.'-[] ]. + [ 'false.'-[] ]. compose_message( '$abort', _Level) --> !, - [ 'YAP execution aborted'-[] ]. + [ 'YAP execution aborted'-[] ]. compose_message( abort(user), _Level) --> !, - [ 'YAP execution aborted' - [] ]. + [ 'YAP execution aborted' - [] ]. compose_message( loading(_,F), _Level) --> { F == user }, !. compose_message( loading(What,FileName), _Level) --> !, - [ '~a ~w...' - [What, FileName] ]. + [ '~a ~w...' - [What, FileName] ]. compose_message( loaded(_,user,_,_,_), _Level) --> !. compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !, - [ '~a included in module ~a, ~d msec ~d bytes' - - [AbsFileName,Mod,Time,Space] ]. + [ '~a included in module ~a, ~d msec ~d bytes' - + [AbsFileName,Mod,Time,Space] ]. compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !, - [ '~a ~a in module ~a, ~d msec ~d bytes' - - [What, AbsoluteFileName,Mod,Time,Space] ]. + [ '~a ~a in module ~a, ~d msec ~d bytes' - + [What, AbsoluteFileName,Mod,Time,Space] ]. compose_message(signal(SIG,_), _) --> - !, - [ 'UNEXPECTED SIGNAL: ~a' - [SIG] ]. + !, + [ 'UNEXPECTED SIGNAL: ~a' - [SIG] ]. compose_message(trace_command(C), _Leve) --> - !, - [ '~a is not a valid debugger command.' - [C] ]. + !, + [ '~a is not a valid debugger command.' - [C] ]. compose_message(trace_help, _Leve) --> - !, - [ ' Please enter a valid debugger command (h for help).' ]. + !, + [ ' Please enter a valid debugger command (h for help).' ]. compose_message(version(Version), _Level) --> - !, - [ '~a' - [Version] ]. + !, + [ '~a' - [Version] ]. compose_message(myddas_version(Version), _Leve) --> - !, - [ 'MYDDAS version ~a' - [Version] ]. + !, + [ 'MYDDAS version ~a' - [Version] ]. compose_message(style_check(What,FILE,Line,Clause), Level)--> !, { '$show_consult_level'(LC) }, - location(style_check(What,FILE,Line,Clause), Level, LC), - main_message(style_check(What,FILE,Line,Clause) , Level, LC ). + location(style_check(What,FILE,Line,Clause), Level, LC), + main_message(style_check(What,FILE,Line,Clause) , Level, LC ). compose_message(yes, _Level) --> !, - [ 'yes'- [] ]. + [ 'yes'- [] ]. compose_message(Throw, _Level) --> - !, - [ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ]. + !, + [ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ]. location( error(_,Info), Level, _LC ) --> { '$error_descriptor'(Info, Desc) }, @@ -265,38 +265,40 @@ location( error(_,Info), Level, _LC ) --> { query_exception(parserReadingCode, Desc, true)}, !, { - query_exception(parserFile, Desc, FileName), - query_exception(parserLine, Desc, LN) + query_exception(parserFile, Desc, FileName), + query_exception(parserLine, Desc, LN) }, [ '~a:~d:~d: ~a:' - [FileName,LN,0,Level] ] . location(style_check(A,LN,FileName,B ), Level , LC) --> - !, - display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ), - [ '~a:~d:0: ~a: ' - [FileName,LN,Level] ] . + !, + display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ), + [ '~a:~d:0: ~a: ' - [FileName,LN,Level] ] . location( error(_,Info), Level, LC ) --> { '$error_descriptor'(Info, Desc) }, { - query_exception(prologPredFile, Desc, File), - query_exception(prologPredLine, Desc, FilePos), - query_exception(prologPredModule, Desc, M), - query_exception(prologPredName, Desc, Na), - query_exception(prologPredArity, Desc, Ar) + query_exception(prologPredFile, Desc, File), + query_exception(prologPredLine, Desc, FilePos), + query_exception(prologPredModule, Desc, M), + query_exception(prologPredName, Desc, Na), + query_exception(prologPredArity, Desc, Ar), + query_exception(prologStack, Desc, St) }, !, display_consulting( File, Level, Info, LC ), {simplify_pred(M:Na/Ar,FF)}, - [ '~a:~d:0 ~a while executing ~q:'-[File, FilePos,Level,FF] ]. + [ '~a:~d:0 ~a while executing ~q:'-[File, FilePos,Level,FF] ], + [ 'Execution stack is: ~a' - [St]]. location( error(_,Info), Level, LC ) --> - { '$error_descriptor'(Info, Desc) }, + { '$error_descriptor'(Info, Desc) }, { query_exception(errorFile, Desc, File), - query_exception(errorLine, Desc, FilePos), - query_exception(errorFunction, Desc, F) - }, + query_exception(errorLine, Desc, FilePos), + query_exception(errorFunction, Desc, F) + }, !, display_consulting( File, Level, Info, LC ), {simplify_pred(F,FF)}, - [ '~a:~d:0 ~a while executing ~a():'-[File, FilePos,Level,FF] ]. + [ '~a:~d:0 ~a while executing ~a().'-[File, FilePos,Level,FF] ]. location( _Ball, _Level, _LC ) --> []. event(redo, _Info) --> {fail}. @@ -309,7 +311,7 @@ simplify_pred(F, F). %message(loaded(Past,AbsoluteFileName,user,Msec,Bytes), Prefix, Suffix) :- !, main_message(error(Msg,In), _, _) --> {var(Msg)}, !, - [ 'Uninstantiated message ~w~n.' - [error(Msg,In)], nl ]. + [ 'Uninstantiated message ~w~n.' - [error(Msg,In)], nl ]. main_message( error(syntax_error(Msg),Info), Level, _LC ) --> !, { @@ -317,18 +319,18 @@ main_message( error(syntax_error(Msg),Info), Level, _LC ) --> query_exception(parserTextA, Desc, J), query_exception(parserTextB, Desc, T), query_exception(parserLine, Desc, L) - }, - [' syntax error ~s' - [Level,Msg]], - [nl], - [' ~s <<== at line ~d == ~s !' - [J,L,T], nl ]. + }, + [' syntax error ~s' - [Level,Msg]], + [nl], + [' ~s <<== at line ~d == ~s !' - [J,L,T], nl ]. main_message(style_check(singleton(SVs),_Pos,_File,P), _Level, _LC) --> !, % {writeln(ci)}, - { clause_to_indicator(P, I) }, - [ nl, '~*|singleton variable~*c ~w in ~q.' - [ 10, NVs, 0's, SVsL, I] ], - { svs(SVs,SVs,SVsL), - ( SVs = [_] -> NVs = 0 ; NVs = 1 ) - }. + { clause_to_indicator(P, I) }, + [ nl, '~*|singleton variable~*c ~w in ~q.' - [ 10, NVs, 0's, SVsL, I] ], + { svs(SVs,SVs,SVsL), + ( SVs = [_] -> NVs = 0 ; NVs = 1 ) + }. main_message(style_check(multiple(N,A,Mod,I0),_Pos,File,_P), _Level, _LC) --> !, [ '~*|~a redefines ~q, originally defined in ~a.' - [ 10,File, Mod:N/A, I0] ]. @@ -336,9 +338,9 @@ main_message(style_check(discontiguous(N,A,Mod),_S,_W,_P) , _Level, _LC)--> !, [ '~*|discontiguous definition for ~p.' - [ 10,Mod:N/A] ]. main_message(error(ErrorInfo,_), _Level, _LC) --> - [nl], - main_error_message( ErrorInfo ), - [nl]. + [nl], + main_error_message( ErrorInfo ), + [nl]. main_error_message(consistency_error(Who)) --> @@ -350,25 +352,25 @@ main_error_message(evaluation_error(What)) --> main_error_message(evaluation_error(What, Who)) --> [ '~*|** ~w caused ~a during evaluation of arithmetic expressions **' - [ 10,Who,What], nl ]. main_error_message(existence_error(Type , Who)) --> - [nl], + [nl], [ '~*|** ~q ~q could not be found **' - [ 10,Type, Who], nl ]. main_error_message(permission_error(Op, Type, Id)) --> - [ '~*|** value ~q is not allowed in ~a ~q **' - [ 10, Op, Type,Id], nl ]. + [ '~*|** value ~q is not allowed in ~a ~q **' - [ 10, Op, Type,Id], nl ]. main_error_message(instantiation_error) --> - [ '~*|** unbound variable **' - [10], nl ]. + [ '~*|** unbound variable **' - [10], nl ]. main_error_message(representation_error(Type)) --> - [ '~*|** YAP cannot represent ~w **' - [10, Type], nl ]. + [ '~*|** YAP cannot represent ~w **' - [10, Type], nl ]. main_error_message(resource_error(Who)) --> - [ '~*|** ~q **' - [10,Who]], - [ nl ]. + [ '~*|** ~q **' - [10,Who]], + [ nl ]. main_error_message(type_error(Type,Who)) --> - [ '~*|** ~q should be of type ~a **' - [10,Who,Type]], - [ nl ]. + [ '~*|** ~q should be of type ~a **' - [10,Who,Type]], + [ nl ]. main_error_message(system_error(Who, In)) --> - [ '~*|** ~q ~q **' - [10,Who, In]], - [ nl ]. + [ '~*|** ~q ~q **' - [10,Who, In]], + [ nl ]. main_error_message(uninstantiation_error(T)) --> - [ '~*|** found ~q, expected unbound variable **' - [10,T], nl ]. + [ '~*|** found ~q, expected unbound variable **' - [10,T], nl ]. display_consulting( F, Level, Info, LC) --> { LC > 0, @@ -379,31 +381,31 @@ display_consulting( F, Level, Info, LC) --> }, !, [ '~a:~d:0: ~a raised at:'-[F0,L,Level], nl ]. display_consulting( F, Level, _, LC) --> - { LC > 0, - source_location(F0, L), - F \= F0 - }, !, - [ '~a:~d:0: ~a while compiling.'-[F0,L,Level], nl ]. + { LC > 0, + source_location(F0, L), + F \= F0 + }, !, + [ '~a:~d:0: ~a while compiling.'-[F0,L,Level], nl ]. display_consulting(_F, _, _, _LC) --> - []. + []. c_goal( error(_,Info), _) --> { '$error_descriptor'(Info, Desc) }, ({ query_exception(errorGoal, Desc, Call), - Call = M:(H :- G) + Call = M:(H :- G) } -> ['~*|at ~w' - [10,M:G], '~*|called from ~w' - [10,H] ] ; - {Call \= []} + {Call \= []} -> ['~*|by ~w' - [10,Call]] ; [] ), - !. + !. c_goal(_,_) --> []. caller( error(syntax_error(_),_Info), _Level ) --> !. @@ -415,243 +417,243 @@ caller( error(_,Info), Level ) --> Func \= [], query_exception(errorLine, Desc, Line) }, - !, - ['~*|~a raised by foreign-function ~a(), at ~a:~d:0: '-[10, Level, Func, File, Line]], - [nl]. + !, + ['~*|~a raised by foreign-function ~a(), at ~a:~d:0: '-[10, Level, Func, File, Line]], + [nl]. caller( _, _Level ) --> []. extra_info( error(_,Info), _ ) --> { '$error_descriptor'(Info, Desc) }, { - query_exception(errorMsg, Desc, Msg), - Msg \= [] + query_exception(errorMsg, Desc, Msg), + Msg \= [] }, !, ['~*|user provided data is: ~q' - [10,Msg]], [nl]. extra_info( _, _ ) --> - []. + []. prolog_message(X) --> - system_message(X). + system_message(X). system_message(error(Msg,In)) --> - ( { var(Msg) } ; { var(In)} ), !, - ['bad error ~w' - [error(Msg,In)]]. + ( { var(Msg) } ; { var(In)} ), !, + ['bad error ~w' - [error(Msg,In)]]. system_message(error(consistency_error(Who),Where)) --> - [ 'CONSISTENCY ERROR (arguments not compatible with format)- ~w ~w' - [Who,Where] ]. + [ 'CONSISTENCY ERROR (arguments not compatible with format)- ~w ~w' - [Who,Where] ]. system_message(error(context_error(Goal,Who),Where)) --> - [ 'CONTEXT ERROR- ~w: ~w appeared in ~w' - [Goal,Who,Where] ]. + [ 'CONTEXT ERROR- ~w: ~w appeared in ~w' - [Goal,Who,Where] ]. system_message(error(domain_error(DomainType,Opt), Where)) --> - [ 'DOMAIN ERROR- ~w: ' - Where], - domain_error(DomainType, Opt). + [ 'DOMAIN ERROR- ~w: ' - Where], + domain_error(DomainType, Opt). system_message(error(format_argument_type(Type,Arg), Where)) --> - [ 'FORMAT ARGUMENT ERROR- ~~~a called with ~w in ~w: ' - [Type,Arg,Where]]. + [ 'FORMAT ARGUMENT ERROR- ~~~a called with ~w in ~w: ' - [Type,Arg,Where]]. system_message(error(existence_error(directory,Key), Where)) --> - [ 'EXISTENCE ERROR- ~w: ~w not an existing directory' - [Where,Key] ]. + [ 'EXISTENCE ERROR- ~w: ~w not an existing directory' - [Where,Key] ]. system_message(error(existence_error(key,Key), Where)) --> - [ 'EXISTENCE ERROR- ~w: ~w not an existing key' - [Where,Key] ]. + [ 'EXISTENCE ERROR- ~w: ~w not an existing key' - [Where,Key] ]. system_message(error(existence_error(mutex,Key), Where)) --> [ 'EXISTENCE ERROR- ~w: ~w is an erased mutex' - [Where,Key] ]. system_message(existence_error(prolog_flag,F)) --> - [ 'Prolog Flag ~w: new Prolog flags must be created using create_prolog_flag/3.' - [F] ]. + [ 'Prolog Flag ~w: new Prolog flags must be created using create_prolog_flag/3.' - [F] ]. system_message(error(existence_error(prolog_flag,P), Where)) --> !, - [ 'EXISTENCE ERROR- ~w: prolog flag ~w is undefined' - [Where,P] ]. + [ 'EXISTENCE ERROR- ~w: prolog flag ~w is undefined' - [Where,P] ]. system_message(error(existence_error(procedure,P), context(Call,Parent))) --> !, - [ 'EXISTENCE ERROR- procedure ~w is undefined, called from context ~w~n Goal was ~w' - [P,Parent,Call] ]. + [ 'EXISTENCE ERROR- procedure ~w is undefined, called from context ~w~n Goal was ~w' - [P,Parent,Call] ]. system_message(error(existence_error(stream,Stream), Where)) --> - [ 'EXISTENCE ERROR- ~w: ~w not an open stream' - [Where,Stream] ]. + [ 'EXISTENCE ERROR- ~w: ~w not an open stream' - [Where,Stream] ]. system_message(error(existence_error(thread,Thread), Where)) --> - [ 'EXISTENCE ERROR- ~w: ~w not a running thread' - [Where,Thread] ]. + [ 'EXISTENCE ERROR- ~w: ~w not a running thread' - [Where,Thread] ]. system_message(error(existence_error(variable,Var), Where)) --> - [ 'EXISTENCE ERROR- ~w: variable ~w does not exist' - [Where,Var] ]. + [ 'EXISTENCE ERROR- ~w: variable ~w does not exist' - [Where,Var] ]. system_message(error(existence_error(Name,F), W)) --> - { object_name(Name, ObjName) }, - [ 'EXISTENCE ERROR- ~w could not open ~a ~w' - [W,ObjName,F] ]. + { object_name(Name, ObjName) }, + [ 'EXISTENCE ERROR- ~w could not open ~a ~w' - [W,ObjName,F] ]. system_message(error(evaluation_error(int_overflow), Where)) --> - [ 'INTEGER OVERFLOW ERROR- ~w' - [Where] ]. + [ 'INTEGER OVERFLOW ERROR- ~w' - [Where] ]. system_message(error(evaluation_error(float_overflow), Where)) --> - [ 'FLOATING POINT OVERFLOW ERROR- ~w' - [Where] ]. + [ 'FLOATING POINT OVERFLOW ERROR- ~w' - [Where] ]. system_message(error(evaluation_error(undefined), Where)) --> - [ 'UNDEFINED ARITHMETIC RESULT ERROR- ~w' - [Where] ]. + [ 'UNDEFINED ARITHMETIC RESULT ERROR- ~w' - [Where] ]. system_message(error(evaluation_error(underflow), Where)) --> - [ 'UNDERFLOW ERROR- ~w' - [Where] ]. + [ 'UNDERFLOW ERROR- ~w' - [Where] ]. system_message(error(evaluation_error(float_underflow), Where)) --> - [ 'FLOATING POINT UNDERFLOW ERROR- ~w' - [Where] ]. + [ 'FLOATING POINT UNDERFLOW ERROR- ~w' - [Where] ]. system_message(error(evaluation_error(zero_divisor), Where)) --> - [ 'ZERO DIVISOR ERROR- ~w' - [Where] ]. + [ 'ZERO DIVISOR ERROR- ~w' - [Where] ]. system_message(error(not_implemented(Type, What), Where)) --> - [ '~w: ~w not implemented- ~w' - [Where, Type, What] ]. + [ '~w: ~w not implemented- ~w' - [Where, Type, What] ]. system_message(error(operating_SYSTEM_ERROR_INTERNAL, Where)) --> - [ 'OPERATING SYSTEM ERROR- ~w' - [Where] ]. + [ 'OPERATING SYSTEM ERROR- ~w' - [Where] ]. system_message(error(out_of_heap_error, Where)) --> - [ 'OUT OF DATABASE SPACE ERROR- ~w' - [Where] ]. + [ 'OUT OF DATABASE SPACE ERROR- ~w' - [Where] ]. system_message(error(out_of_stack_error, Where)) --> - [ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ]. + [ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ]. system_message(error(out_of_trail_error, Where)) --> - [ 'OUT OF TRAIL SPACE ERROR- ~w' - [Where] ]. + [ 'OUT OF TRAIL SPACE ERROR- ~w' - [Where] ]. system_message(error(out_of_attvars_error, Where)) --> - [ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ]. + [ 'OUT OF STACK SPACE ERROR- ~w' - [Where] ]. system_message(error(out_of_auxspace_error, Where)) --> - [ 'OUT OF AUXILIARY STACK SPACE ERROR- ~w' - [Where] ]. + [ 'OUT OF AUXILIARY STACK SPACE ERROR- ~w' - [Where] ]. system_message(error(permission_error(access,private_procedure,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot see clauses for ~w' - [Where,P] ]. + [ 'PERMISSION ERROR- ~w: cannot see clauses for ~w' - [Where,P] ]. system_message(error(permission_error(access,static_procedure,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot access static procedure ~w' - [Where,P] ]. + [ 'PERMISSION ERROR- ~w: cannot access static procedure ~w' - [Where,P] ]. system_message(error(permission_error(alias,new,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot create alias ~w' - [Where,P] ]. + [ 'PERMISSION ERROR- ~w: cannot create alias ~w' - [Where,P] ]. system_message(error(permission_error(create,Name,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot create ~a ~w' - [Where,Name,P] ]. + [ 'PERMISSION ERROR- ~w: cannot create ~a ~w' - [Where,Name,P] ]. system_message(error(permission_error(import,M1:I,redefined,SecondMod), Where)) --> - [ 'PERMISSION ERROR- loading ~w: modules ~w and ~w both define ~w' - [Where,M1,SecondMod,I] ]. + [ 'PERMISSION ERROR- loading ~w: modules ~w and ~w both define ~w' - [Where,M1,SecondMod,I] ]. system_message(error(permission_error(input,binary_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot read from binary stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot read from binary stream ~w' - [Where,Stream] ]. system_message(error(permission_error(input,closed_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: trying to read from closed stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: trying to read from closed stream ~w' - [Where,Stream] ]. system_message(error(permission_error(input,past_end_of_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: past end of stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: past end of stream ~w' - [Where,Stream] ]. system_message(error(permission_error(input,stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot read from ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot read from ~w' - [Where,Stream] ]. system_message(error(permission_error(input,text_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot read from text stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot read from text stream ~w' - [Where,Stream] ]. system_message(error(permission_error(modify,dynamic_procedure,_), Where)) --> - [ 'PERMISSION ERROR- ~w: modifying a dynamic procedure' - [Where] ]. + [ 'PERMISSION ERROR- ~w: modifying a dynamic procedure' - [Where] ]. system_message(error(permission_error(modify,flag,W), _)) --> - [ 'PERMISSION ERROR- cannot modify flag ~w' - [W] ]. + [ 'PERMISSION ERROR- cannot modify flag ~w' - [W] ]. system_message(error(permission_error(modify,operator,W), Q)) --> - [ 'PERMISSION ERROR- ~w: cannot modify operator ~q' - [Q,W] ]. + [ 'PERMISSION ERROR- ~w: cannot modify operator ~q' - [Q,W] ]. system_message(error(permission_error(modify,dynamic_procedure,F), Where)) --> - [ 'PERMISSION ERROR- ~w: modifying dynamic procedure ~w' - [Where,F] ]. + [ 'PERMISSION ERROR- ~w: modifying dynamic procedure ~w' - [Where,F] ]. system_message(error(permission_error(modify,static_procedure,F), Where)) --> - [ 'PERMISSION ERROR- ~w: modifying static procedure ~w' - [Where,F] ]. + [ 'PERMISSION ERROR- ~w: modifying static procedure ~w' - [Where,F] ]. system_message(error(permission_error(modify,static_procedure_in_use,_), Where)) --> - [ 'PERMISSION ERROR- ~w: modifying a static procedure in use' - [Where] ]. + [ 'PERMISSION ERROR- ~w: modifying a static procedure in use' - [Where] ]. system_message(error(permission_error(modify,table,P), _)) --> - [ 'PERMISSION ERROR- cannot table procedure ~w' - [P] ]. + [ 'PERMISSION ERROR- cannot table procedure ~w' - [P] ]. system_message(error(permission_error(module,redefined,Mod), Who)) --> - [ 'PERMISSION ERROR ~w- redefining module ~a in a different file' - [Who,Mod] ]. + [ 'PERMISSION ERROR ~w- redefining module ~a in a different file' - [Who,Mod] ]. system_message(error(permission_error(open,source_sink,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot open file ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot open file ~w' - [Where,Stream] ]. system_message(error(permission_error(output,binary_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot - write to binary stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot + write to binary stream ~w' - [Where,Stream] ]. system_message(error(permission_error(output,stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot write to ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot write to ~w' - [Where,Stream] ]. system_message(error(permission_error(output,text_stream,Stream), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot write to text stream ~w' - [Where,Stream] ]. + [ 'PERMISSION ERROR- ~w: cannot write to text stream ~w' - [Where,Stream] ]. system_message(error(permission_error(resize,array,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot resize array ~w' - [Where,P] ]. + [ 'PERMISSION ERROR- ~w: cannot resize array ~w' - [Where,P] ]. system_message(error(permission_error(unlock,mutex,P), Where)) --> - [ 'PERMISSION ERROR- ~w: cannot unlock mutex ~w' - [Where,P] ]. + [ 'PERMISSION ERROR- ~w: cannot unlock mutex ~w' - [Where,P] ]. system_message(error(representation_error(character), Where)) --> - [ 'REPRESENTATION ERROR- ~w: expected character' - [Where] ]. + [ 'REPRESENTATION ERROR- ~w: expected character' - [Where] ]. system_message(error(representation_error(character_code), Where)) --> - [ 'REPRESENTATION ERROR- ~w: expected character code' - [Where] ]. + [ 'REPRESENTATION ERROR- ~w: expected character code' - [Where] ]. system_message(error(representation_error(max_arity), Where)) --> - [ 'REPRESENTATION ERROR- ~w: number too big' - [Where] ]. + [ 'REPRESENTATION ERROR- ~w: number too big' - [Where] ]. system_message(error(representation_error(variable), Where)) --> - [ 'REPRESENTATION ERROR- ~w: should be a variable' - [Where] ]. + [ 'REPRESENTATION ERROR- ~w: should be a variable' - [Where] ]. system_message(error(resource_error(code_space), Where)) --> - [ 'RESOURCE ERROR- not enough code space' - [Where] ]. + [ 'RESOURCE ERROR- not enough code space' - [Where] ]. system_message(error(resource_error(huge_int), Where)) --> - [ 'RESOURCE ERROR- too large an integer in absolute value' - [Where] ]. + [ 'RESOURCE ERROR- too large an integer in absolute value' - [Where] ]. system_message(error(resource_error(memory), Where)) --> - [ 'RESOURCE ERROR- not enough virtual memory' - [Where] ]. + [ 'RESOURCE ERROR- not enough virtual memory' - [Where] ]. system_message(error(resource_error(stack), Where)) --> - [ 'RESOURCE ERROR- not enough stack' - [Where] ]. + [ 'RESOURCE ERROR- not enough stack' - [Where] ]. system_message(error(resource_error(streams), Where)) --> - [ 'RESOURCE ERROR- could not find a free stream' - [Where] ]. + [ 'RESOURCE ERROR- could not find a free stream' - [Where] ]. system_message(error(resource_error(threads), Where)) --> - [ 'RESOURCE ERROR- too many open threads' - [Where] ]. + [ 'RESOURCE ERROR- too many open threads' - [Where] ]. system_message(error(resource_error(trail), Where)) --> - [ 'RESOURCE ERROR- not enough trail space' - [Where] ]. + [ 'RESOURCE ERROR- not enough trail space' - [Where] ]. system_message(error(signal(SIG,_), _)) --> - [ 'UNEXPECTED SIGNAL: ~a' - [SIG] ]. + [ 'UNEXPECTED SIGNAL: ~a' - [SIG] ]. % SWI like I/O error message. system_message(error(unhandled_exception,Throw)) --> - [ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ]. + [ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ]. system_message(error(uninstantiation_error(TE), _Where)) --> - [ 'UNINSTANTIATION ERROR - expected unbound term, got ~q' - [TE] ]. + [ 'UNINSTANTIATION ERROR - expected unbound term, got ~q' - [TE] ]. system_message(Messg) --> - [ '~q' - Messg ]. + [ '~q' - Messg ]. domain_error(array_overflow, Opt) --> !, - [ 'invalid static index ~w for array' - Opt ]. + [ 'invalid static index ~w for array' - Opt ]. domain_error(array_type, Opt) --> !, - [ 'invalid static array type ~w' - Opt ]. + [ 'invalid static array type ~w' - Opt ]. domain_error(builtin_procedure, _) --> !, - [ 'non-iso built-in procedure' ]. + [ 'non-iso built-in procedure' ]. domain_error(character_code_list, Opt) --> !, - [ 'invalid list of codes ~w' - [Opt] ]. + [ 'invalid list of codes ~w' - [Opt] ]. domain_error(close_option, Opt) --> !, - [ 'invalid close option ~w' - [Opt] ]. + [ 'invalid close option ~w' - [Opt] ]. domain_error(delete_file_option, Opt) --> !, - [ 'invalid list of options ~w' - [Opt] ]. + [ 'invalid list of options ~w' - [Opt] ]. domain_error(encoding, Opt) --> !, - [ 'invalid encoding ~w' - [Opt] ]. + [ 'invalid encoding ~w' - [Opt] ]. domain_error(flag_value, [Opt,Flag]) --> !, - [ 'invalid value ~w for flag ~w' - [Opt,Flag] ]. + [ 'invalid value ~w for flag ~w' - [Opt,Flag] ]. domain_error(flag_value, Opt) --> !, - [ 'invalid value ~w for flag' - [Opt] ]. + [ 'invalid value ~w for flag' - [Opt] ]. domain_error(io_mode, Opt) --> !, - [ 'invalid io mode ~w' - [Opt] ]. + [ 'invalid io mode ~w' - [Opt] ]. domain_error(mutable, Opt) --> !, - [ 'invalid id mutable ~w' - [Opt] ]. + [ 'invalid id mutable ~w' - [Opt] ]. domain_error(module_decl_options, Opt) --> !, - [ 'expect module declaration options, found ~w' - [Opt] ]. + [ 'expect module declaration options, found ~w' - [Opt] ]. domain_error(non_empty_list, Opt) --> !, - [ 'found empty list' - [Opt] ]. + [ 'found empty list' - [Opt] ]. domain_error(not_less_than_zero, Opt) --> !, - [ 'number ~w less than zero' - [Opt] ]. + [ 'number ~w less than zero' - [Opt] ]. domain_error(not_newline, Opt) --> !, - [ 'number ~w not newline' - [Opt] ]. + [ 'number ~w not newline' - [Opt] ]. domain_error(not_zero, Opt) --> !, - [ '~w is not allowed in the domain' - [Opt] ]. + [ '~w is not allowed in the domain' - [Opt] ]. domain_error(operator_priority, Opt) --> !, - [ '~w invalid operator priority' - [Opt] ]. + [ '~w invalid operator priority' - [Opt] ]. domain_error(operator_specifier, Opt) --> !, - [ 'invalid operator specifier ~w' - [Opt] ]. + [ 'invalid operator specifier ~w' - [Opt] ]. domain_error(out_of_range, Opt) --> !, - [ 'expression ~w is out of range' - [Opt] ]. + [ 'expression ~w is out of range' - [Opt] ]. domain_error(predicate_spec, Opt) --> !, - [ '~w invalid predicate specifier' - [Opt] ]. + [ '~w invalid predicate specifier' - [Opt] ]. domain_error(radix, Opt) --> !, - [ 'invalid radix ~w' - [Opt] ]. + [ 'invalid radix ~w' - [Opt] ]. domain_error(read_option, Opt) --> !, - [ '~w invalid option to read_term' - [Opt] ]. + [ '~w invalid option to read_term' - [Opt] ]. domain_error(semantics_indicator, Opt) --> !, - [ 'predicate indicator, got ~w' - [Opt] ]. + [ 'predicate indicator, got ~w' - [Opt] ]. domain_error(shift_count_overflow, Opt) --> !, - [ 'shift count overflow in ~w' - [Opt] ]. + [ 'shift count overflow in ~w' - [Opt] ]. domain_error(source_sink, Opt) --> !, - [ '~w is not a source sink term' - [Opt] ]. + [ '~w is not a source sink term' - [Opt] ]. domain_error(stream, Opt) --> !, - [ '~w is not a stream' - [Opt] ]. + [ '~w is not a stream' - [Opt] ]. domain_error(stream_or_alias, Opt) --> !, - [ '~w is not a stream (or alias)' - [Opt] ]. + [ '~w is not a stream (or alias)' - [Opt] ]. domain_error(stream_encoding, Opt) --> !, - [ '~w is not a supported stream encoding' - [Opt] ]. + [ '~w is not a supported stream encoding' - [Opt] ]. domain_error(stream_position, Opt) --> !, - [ '~w is not a stream position' - [Opt] ]. + [ '~w is not a stream position' - [Opt] ]. domain_error(stream_property, Opt) --> !, - [ '~w is not a stream property' - [Opt] ]. + [ '~w is not a stream property' - [Opt] ]. domain_error(syntax_error_handler, Opt) --> !, - [ '~w is not a syntax error handler' - [Opt] ]. + [ '~w is not a syntax error handler' - [Opt] ]. domain_error(table, Opt) --> !, - [ 'non-tabled procedure ~w' - [Opt] ]. + [ 'non-tabled procedure ~w' - [Opt] ]. domain_error(thread_create_option, Opt) --> !, - [ '~w is not a thread_create option' - [Opt] ]. + [ '~w is not a thread_create option' - [Opt] ]. domain_error(time_out_spec, Opt) --> !, - [ '~w is not valid specificatin for time_out' - [Opt] ]. + [ '~w is not valid specificatin for time_out' - [Opt] ]. domain_error(unimplemented_option, Opt) --> !, - [ '~w is not yet implemented' - [Opt] ]. + [ '~w is not yet implemented' - [Opt] ]. domain_error(write_option, Opt) --> !, - [ '~w invalid write option' - [Opt] ]. + [ '~w invalid write option' - [Opt] ]. domain_error(Domain, Opt) --> - [ '~w not a valid element for ~w' - [Opt,Domain] ]. + [ '~w not a valid element for ~w' - [Opt,Domain] ]. object_name(array, array). object_name(atom, atom). @@ -685,155 +687,155 @@ object_name(unsigned_char, 'unsigned char'). object_name(variable, 'unbound variable'). svs([A=VA], [A=VA], S) :- !, - atom_string(A, S). + atom_string(A, S). svs([A=VA,B=VB], [A=VA,B=VB], SN) :- !, - atom_string(A, S), - atom_string(B, S1), - string_concat([S,` and `,S1], SN). + atom_string(A, S), + atom_string(B, S1), + string_concat([S,` and `,S1], SN). svs([A=_], _, SN) :- !, - atom_string(A, S), - string_concat(`, and `,S, SN). + atom_string(A, S), + string_concat(`, and `,S, SN). svs([A=V|L], [A=V|L], SN) :- !, - atom_string(A, S), - svs(L, [A=V|L], S1 ), - string_concat([ S, S1], SN). + atom_string(A, S), + svs(L, [A=V|L], S1 ), + string_concat([ S, S1], SN). svs([A=_V|L], All, SN) :- !, - atom_string(A, S), - svs(L, All, S1 ), - string_concat([`, `, S, S1], SN). + atom_string(A, S), + svs(L, All, S1 ), + string_concat([`, `, S, S1], SN). list_of_preds([]) --> []. list_of_preds([P|L]) --> - ['~q' - [P]], - list_of_preds(L). + ['~q' - [P]], + list_of_preds(L). syntax_error_term(between(_I,J,_L),[S|T],_LC) --> - {string(S)}, - !, - [ '~s' - [S] ], - [' <<<< at line ~d >>>> ~s' - [J,T], nl ]. + {string(S)}, + !, + [ '~s' - [S] ], + [' <<<< at line ~d >>>> ~s' - [J,T], nl ]. syntax_error_term(between(_I,J,_L),LTaL,LC) --> - syntax_error_tokens(LTaL, J, LC). + syntax_error_tokens(LTaL, J, LC). syntax_error_tokens([], _, _LC) --> []. syntax_error_tokens([T|L], J, LC) --> - syntax_error_token(T, J, LC), - syntax_error_tokens(L, J, LC). + syntax_error_token(T, J, LC), + syntax_error_tokens(L, J, LC). syntax_error_token(atom(A), _, _LC) --> !, - [ '~q' - [A] ]. + [ '~q' - [A] ]. syntax_error_token(number(N), _, _LC) --> !, - [ '~w' - [N] ]. + [ '~w' - [N] ]. syntax_error_token(var(_,S), _, _LC) --> !, - [ '~a' - [S] ]. + [ '~a' - [S] ]. syntax_error_token(string(S), _, _LC) --> !, - [ '`~s`' - [S] ]. + [ '`~s`' - [S] ]. syntax_error_token(error, L, _LC) --> !, - [ ' <<<< at line ~d >>>> ' - [L] ]. + [ ' <<<< at line ~d >>>> ' - [L] ]. syntax_error_token('EOT',_, _LC) --> !, - [ '.' - [], nl ]. + [ '.' - [], nl ]. syntax_error_token('(',_, _LC) --> !, - [ '( '- [] ]. + [ '( '- [] ]. syntax_error_token('{',_, _LC) --> !, - [ '{ '- [] ]. + [ '{ '- [] ]. syntax_error_token('[', _, _LC) --> !, - [ '[' - [] ]. + [ '[' - [] ]. syntax_error_token(')',_, _LC) --> !, - [ ' )'- [] ]. + [ ' )'- [] ]. syntax_error_token(']',_, _LC) --> !, - [ ']'- [] ]. + [ ']'- [] ]. syntax_error_token('}',_, _LC) --> !, - [ ' }' - [] ]. + [ ' }' - [] ]. syntax_error_token(',',_, _LC) --> !, - [ ', ' - [] ]. + [ ', ' - [] ]. syntax_error_token('.',_, _LC) --> !, - [ '.' - [] ]. + [ '.' - [] ]. syntax_error_token(';', _, _LC) --> !, - [ '; ' - [] ]. + [ '; ' - [] ]. syntax_error_token(':', _, _LC) --> !, - [ ':' - [] ]. + [ ':' - [] ]. syntax_error_token('|', _, _LC) --> !, - [ '|' - [] ]. + [ '|' - [] ]. syntax_error_token('l',_, _LC) --> !, - [ '|' - [] ]. + [ '|' - [] ]. syntax_error_token(nl, _, LC) --> !, - [ '~*| ' -[LC], nl ]. + [ '~*| ' -[LC], nl ]. syntax_error_token(B,_, _LC) --> !, - [ nl, 'bad_token: ~q' - [B], nl ]. + [ nl, 'bad_token: ~q' - [B], nl ]. print_lines( S, A, Key) --> - [Tok], - print_lines_(Tok, S, A, Key). + [Tok], + print_lines_(Tok, S, A, Key). print_lines_( at_same_line, S, Prefix, Key) --> - !, - print_lines( S, Prefix, Key). + !, + print_lines( S, Prefix, Key). print_lines_(begin(Severity, OtherKey), S, Prefixes, Key) --> - !, - { prefix( Severity, P ) }, - print_message_lines(S, [P], OtherKey), - print_lines( S, Prefixes, Key ). + !, + { prefix( Severity, P ) }, + print_message_lines(S, [P], OtherKey), + print_lines( S, Prefixes, Key ). print_lines_( end(Key0), S, _, Key) --> - { Key0 == Key }, - !, - { nl(S) }. + { Key0 == Key }, + !, + { nl(S) }. print_lines_( end(_OtherKey), S, Prefixes, Key) --> - !, - print_lines( S, Prefixes, Key ). + !, + print_lines( S, Prefixes, Key ). print_lines_( flush, S, _, Key) --> - [ end(Key0)], - { Key == Key0 }, - !, - { flush_output(S) }. + [ end(Key0)], + { Key == Key0 }, + !, + { flush_output(S) }. print_lines_(flush, S, Prefixes, Key) --> - !, - { flush_output(S) }, - print_lines( S, Prefixes, Key ). + !, + { flush_output(S) }, + print_lines( S, Prefixes, Key ). print_lines_(format(Fmt,Args), S, Prefixes, Key) --> - !, - { format(S, Fmt, Args) }, - print_lines( S, Prefixes, Key ). + !, + { format(S, Fmt, Args) }, + print_lines( S, Prefixes, Key ). print_lines_( nl, S, _, Key) --> - [ end(Key0)], - { Key == Key0 }, - !, - { nl(S), - flush_output(S) }. + [ end(Key0)], + { Key == Key0 }, + !, + { nl(S), + flush_output(S) }. print_lines_(nl, S, Prefixes, Key) --> - !, - { nl(S), - Prefixes = [PrefixS - Cmds|More], - format(S, PrefixS, Cmds) - }, - { - More == [] - -> - NPrefixes = Prefixes - ; - NPrefixes = More - }, - print_lines( S, NPrefixes, Key). + !, + { nl(S), + Prefixes = [PrefixS - Cmds|More], + format(S, PrefixS, Cmds) + }, + { + More == [] + -> + NPrefixes = Prefixes + ; + NPrefixes = More + }, + print_lines( S, NPrefixes, Key). % consider this a message within the message print_lines_(prefix(Fmt-Args), S, Prefixes, Key) --> - !, - print_lines( S, [Fmt-Args|Prefixes], Key ). + !, + print_lines( S, [Fmt-Args|Prefixes], Key ). print_lines_(prefix(Fmt), S, Prefixes, Key) --> - { atom( Fmt ) ; string( Fmt ) }, - !, - print_lines( S, [Fmt-[]|Prefixes], Key ). + { atom( Fmt ) ; string( Fmt ) }, + !, + print_lines( S, [Fmt-[]|Prefixes], Key ). print_lines_(Fmt-Args, S, Prefixes, Key) --> - !, - { format(S, Fmt, Args) }, - print_lines( S, Prefixes, Key ). + !, + { format(S, Fmt, Args) }, + print_lines( S, Prefixes, Key ). % deprecated.... print_lines_(Fmt, S, Prefixes, Key) --> - { atom(Fmt) ; string( Fmt ) }, - !, - { format(S, Fmt, []) }, - print_lines(S, Prefixes, Key). + { atom(Fmt) ; string( Fmt ) }, + !, + { format(S, Fmt, []) }, + print_lines(S, Prefixes, Key). print_lines_(Msg, S, _Prefixes, _Key) --> - { format(S, 'Illegal message Component: ~q !!!.~n', [Msg]) }. + { format(S, 'Illegal message Component: ~q !!!.~n', [Msg]) }. prefix(help, '~N'-[]). prefix(query, '~N'-[]). @@ -844,42 +846,42 @@ prefix(banner, '~N'-[]). prefix(informational, '~N~*|% '-[LC]) :- '$show_consult_level'(LC), LC > 0, - !. + !. prefix(informational, '~N'-[]). prefix(debug(_), '~N'-[]). /* { thread_self(Id) }, - ( { Id == main } - -> [ 'warning, ' - [] ] - ; { atom(Id) } - -> ['warning [Thread ~a ], ' - [Id] ] - ; ['warning [Thread ~d ], ' - [Id] ] - ). + ( { Id == main } + -> [ 'warning, ' - [] ] + ; { atom(Id) } + -> ['warning [Thread ~a ], ' - [Id] ] + ; ['warning [Thread ~d ], ' - [Id] ] + ). */ /* - { thread_self(Id) }, - ( { Id == main } - -> [ 'error ' ] + { thread_self(Id) }, + ( { Id == main } + -> [ 'error ' ] ; { thread_main_name(Id) } - -> [ 'error [ Thread ~w ] ' - [Id] ] - ), - !. + -> [ 'error [ Thread ~w ] ' - [Id] ] + ), + !. prefix(error, '', user_error) --> - { thread_self(Id) }, - ( { Id == main } - -> [ 'error ' - [], nl ] - ; { atom(Id) } - -> [ 'error [ Thread ~a ] ' - [Id], nl ] - ; [ 'error [ Thread ~d ] ' - [Id], nl ] - ). + { thread_self(Id) }, + ( { Id == main } + -> [ 'error ' - [], nl ] + ; { atom(Id) } + -> [ 'error [ Thread ~a ] ' - [Id], nl ] + ; [ 'error [ Thread ~d ] ' - [Id], nl ] + ). */ clause_to_indicator(T, MNameArity) :- - strip_module(T, M0, T1), - pred_arity( T1, M0, MNameArity ). + strip_module(T, M0, T1), + pred_arity( T1, M0, MNameArity ). pred_arity(V, M, M:call/1) :- var(V), !. pred_arity((:- _Path), _M, prolog:(:-)/1 ) :- !. @@ -909,12 +911,12 @@ pred_arity(H,M, M:Name/Arity) :- translate_message(Term, Level) --> - compose_message(Term, Level), !. + compose_message(Term, Level), !. translate_message(Term, _) --> - { Term = error(_, _) }, - [ 'Unknown exception: ~p'-[Term] ]. + { Term = error(_, _) }, + [ 'Unknown exception: ~p'-[Term] ]. translate_message(Term, _) --> - [ 'Unknown message: ~p'-[Term] ]. + [ 'Unknown message: ~p'-[Term] ]. % print_message_lines(+Stream, +Prefix, +Lines) % @@ -948,24 +950,24 @@ A new line is started and if the message is not complete the _Prefix_ is printed too. */ prolog:print_message_lines(S, Prefix0, Lines) :- - Lines = [begin(_, Key)|Msg], - ( - atom(Prefix0) - -> - Prefix = Prefix0-[] - ; - string(Prefix0) - -> - Prefix = Prefix0-[] - ; - Prefix = Prefix0 - ), - (Msg = [at_same_line|Msg1] - -> - print_lines(S, [Prefix], Key, Msg1, []) - ; - print_lines(S, [Prefix], Key, [Prefix|Msg], []) - ). + Lines = [begin(_, Key)|Msg], + ( + atom(Prefix0) + -> + Prefix = Prefix0-[] + ; + string(Prefix0) + -> + Prefix = Prefix0-[] + ; + Prefix = Prefix0 + ), + (Msg = [at_same_line|Msg1] + -> + print_lines(S, [Prefix], Key, Msg1, []) + ; + print_lines(S, [Prefix], Key, [Prefix|Msg], []) + ). /** @pred prolog:print_message(+ Severity, +Term) @@ -1007,66 +1009,66 @@ prolog:print_message(Severity, Msg) :- ). */ prolog:print_message(Severity, Msg) :- - ( - var(Severity) - -> - !, - format(user_error, 'malformed message ~q: message level is unbound~n', [Msg]) - ; - var(Msg) - -> - !, - format(user_error, 'uninstantiated message~n', []) + ( + var(Severity) + -> + !, + format(user_error, 'malformed message ~q: message level is unbound~n', [Msg]) + ; + var(Msg) + -> + !, + format(user_error, 'uninstantiated message~n', []) ; - Severity == silent + Severity == silent -> - [] - ; - '$pred_exists'(portray_message(_,_),user), - user:portray_message(Severity, Msg) - ), - !. + [] + ; + '$pred_exists'(portray_message(_,_),user), + user:portray_message(Severity, Msg) + ), + !. prolog:print_message(Level, _Msg) :- - current_prolog_flag(verbose_load, false), - stream_property(_Stream, alias(loop_stream) ), - Level = informational, - !. + current_prolog_flag(verbose_load, false), + stream_property(_Stream, alias(loop_stream) ), + Level = informational, + !. prolog:print_message(Level, _Msg) :- - current_prolog_flag(verbose, silent), - Level \= error, - Level \= warning, - !. + current_prolog_flag(verbose, silent), + Level \= error, + Level \= warning, + !. prolog:print_message(_, _Msg) :- - % first step at hook processing - '__NB_getval__'('$if_skip_mode',skip,fail), - !. + % first step at hook processing + '__NB_getval__'('$if_skip_mode',skip,fail), + !. prolog:print_message(force(_Severity), Msg) :- !, - print(user_error,Msg). + print(user_error,Msg). % This predicate has more hooks than a pirate ship! prolog:print_message(Severity, Term) :- message( Term,Lines0, [ end(Id)]), - Lines = [begin(Severity, Id)| Lines0], - ( - user:message_hook(Term, Severity, Lines) - -> - true - ; - ignore((prefix( Severity, Prefix ), - prolog:print_message_lines(user_error, Prefix, Lines))) - ), - !. + Lines = [begin(Severity, Id)| Lines0], + ( + user:message_hook(Term, Severity, Lines) + -> + true + ; + ignore((prefix( Severity, Prefix ), + prolog:print_message_lines(user_error, Prefix, Lines))) + ), + !. prolog:print_message(Severity, Term) :- translate_message( Term, Severity, Lines0, [ end(Id)]), - Lines = [begin(Severity, Id)| Lines0], - ( - user:message_hook(Term, Severity, Lines) - -> - true - ; - ignore(( prefix( Severity, Prefix ), - prolog:print_message_lines(user_error, Prefix, Lines))) - ), - !. + Lines = [begin(Severity, Id)| Lines0], + ( + user:message_hook(Term, Severity, Lines) + -> + true + ; + ignore(( prefix( Severity, Prefix ), + prolog:print_message_lines(user_error, Prefix, Lines))) + ), + !. prolog:print_message(_Severity, _Term) :- format(user_error,'failed to print ~w: ~w~n' ,[ _Severity, _Term]). @@ -1082,3 +1084,4 @@ query_exception(M,K,V) :- /** @} */ +