don't break ISO standard in current_predicate/1.
Include Nicos flag. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2081 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a65a9d67ad
commit
83e941e4cf
@ -805,6 +805,7 @@ Yap_tokenizer(int inp_stream)
|
|||||||
*charp++ = och;
|
*charp++ = och;
|
||||||
for (; chtype(ch) <= NU; ch = Nxtch(inp_stream)) {
|
for (; chtype(ch) <= NU; ch = Nxtch(inp_stream)) {
|
||||||
if (charp == (char *)AuxSp-1024) {
|
if (charp == (char *)AuxSp-1024) {
|
||||||
|
huge_var_error:
|
||||||
/* huge atom or variable, we are in trouble */
|
/* huge atom or variable, we are in trouble */
|
||||||
Yap_ErrorMessage = "Code Space Overflow due to huge atom";
|
Yap_ErrorMessage = "Code Space Overflow due to huge atom";
|
||||||
Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
|
Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
|
||||||
@ -817,6 +818,13 @@ Yap_tokenizer(int inp_stream)
|
|||||||
}
|
}
|
||||||
*charp++ = ch;
|
*charp++ = ch;
|
||||||
}
|
}
|
||||||
|
while (ch == '\'' && isvar && yap_flags[VARS_CAN_HAVE_QUOTE_FLAG]) {
|
||||||
|
if (charp == (char *)AuxSp-1024) {
|
||||||
|
goto huge_var_error;
|
||||||
|
}
|
||||||
|
*charp++ = ch;
|
||||||
|
ch = Nxtch(inp_stream);
|
||||||
|
}
|
||||||
*charp++ = '\0';
|
*charp++ = '\0';
|
||||||
if (!isvar) {
|
if (!isvar) {
|
||||||
/* don't do this in iso */
|
/* don't do this in iso */
|
||||||
|
11
C/stdpreds.c
11
C/stdpreds.c
@ -11,8 +11,12 @@
|
|||||||
* File: stdpreds.c *
|
* File: stdpreds.c *
|
||||||
* comments: General-purpose C implemented system predicates *
|
* comments: General-purpose C implemented system predicates *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2008-01-23 17:57:53 $,$Author: vsc $ *
|
* Last rev: $Date: 2008-02-07 23:09:13 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.125 2008/01/23 17:57:53 vsc
|
||||||
|
* valgrind it!
|
||||||
|
* enable atom garbage collection.
|
||||||
|
*
|
||||||
* Revision 1.124 2007/11/26 23:43:08 vsc
|
* Revision 1.124 2007/11/26 23:43:08 vsc
|
||||||
* fixes to support threads and assert correctly, even if inefficiently.
|
* fixes to support threads and assert correctly, even if inefficiently.
|
||||||
*
|
*
|
||||||
@ -3607,6 +3611,11 @@ p_set_yap_flags(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
case VARS_CAN_HAVE_QUOTE_FLAG:
|
||||||
|
if (value != 0 && value != 1)
|
||||||
|
return(FALSE);
|
||||||
|
yap_flags[VARS_CAN_HAVE_QUOTE_FLAG] = value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
5
H/Yap.h
5
H/Yap.h
@ -10,7 +10,7 @@
|
|||||||
* File: Yap.h.m4 *
|
* File: Yap.h.m4 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: main header file for YAP *
|
* comments: main header file for YAP *
|
||||||
* version: $Id: Yap.h,v 1.25 2008-01-28 10:42:20 vsc Exp $ *
|
* version: $Id: Yap.h,v 1.26 2008-02-07 23:09:13 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -520,8 +520,9 @@ typedef enum
|
|||||||
GENERATE_DEBUG_INFO_FLAG = 18,
|
GENERATE_DEBUG_INFO_FLAG = 18,
|
||||||
INDEXING_MODE_FLAG = 19,
|
INDEXING_MODE_FLAG = 19,
|
||||||
TABLING_MODE_FLAG = 20,
|
TABLING_MODE_FLAG = 20,
|
||||||
|
VARS_CAN_HAVE_QUOTE_FLAG = 21,
|
||||||
/* let this be the last one */
|
/* let this be the last one */
|
||||||
LAST_FLAG = 21
|
LAST_FLAG = 22
|
||||||
} yap_flags;
|
} yap_flags;
|
||||||
|
|
||||||
#define STRING_AS_CHARS 0
|
#define STRING_AS_CHARS 0
|
||||||
|
@ -17,8 +17,10 @@ xb
|
|||||||
|
|
||||||
<h2>Yap-5.1.3:</h2>
|
<h2>Yap-5.1.3:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> NEW: variable_names_may_end_with_quotes allows A' in variable
|
||||||
|
names (request from Nicos Angelopoulos).</li>
|
||||||
<li> SPEEDUP: quickly check if we are importing an undefined goal.</li>
|
<li> SPEEDUP: quickly check if we are importing an undefined goal.</li>
|
||||||
<li> FIXED: current_predicate/1 should enumerate all predicates
|
<li> FIXED: current_predicate/1 should enumerate all non-system predicates
|
||||||
visible (obs from Nicos Angelopoulos).</li>
|
visible (obs from Nicos Angelopoulos).</li>
|
||||||
<li> NEW: time/1 (based on the SWI-Prolog time/1 predicate; request from Paulo Moura).</li>
|
<li> NEW: time/1 (based on the SWI-Prolog time/1 predicate; request from Paulo Moura).</li>
|
||||||
<li> FIXED: with 64 bits indexing would separate ints from atoms (obs from A N Saravanaraj).</li>
|
<li> FIXED: with 64 bits indexing would separate ints from atoms (obs from A N Saravanaraj).</li>
|
||||||
|
@ -450,6 +450,19 @@ yap_flag(strict_iso,off) :- !,
|
|||||||
yap_flag(strict_iso,X) :-
|
yap_flag(strict_iso,X) :-
|
||||||
'$do_error'(domain_error(flag_value,strict_iso+X),yap_flag(strict_iso,X)).
|
'$do_error'(domain_error(flag_value,strict_iso+X),yap_flag(strict_iso,X)).
|
||||||
|
|
||||||
|
yap_flag(variable_names_may_end_with_quotes,OUT) :-
|
||||||
|
var(OUT), !,
|
||||||
|
'$access_yap_flags'(21,X),
|
||||||
|
'$transl_to_on_off'(X,OUT).
|
||||||
|
yap_flag(variable_names_may_end_with_quotes,on) :- !,
|
||||||
|
'$transl_to_on_off'(X,on),
|
||||||
|
'$set_yap_flags'(21,X).
|
||||||
|
yap_flag(variable_names_may_end_with_quotes,off) :- !,
|
||||||
|
'$transl_to_on_off'(X,off),
|
||||||
|
'$set_yap_flags'(21,X).
|
||||||
|
yap_flag(variable_names_may_end_with_quotes,X) :-
|
||||||
|
'$do_error'(domain_error(flag_value,strict_iso+X),yap_flag(strict_iso,X)).
|
||||||
|
|
||||||
yap_flag(language,X) :-
|
yap_flag(language,X) :-
|
||||||
var(X), !,
|
var(X), !,
|
||||||
'$access_yap_flags'(8, X1),
|
'$access_yap_flags'(8, X1),
|
||||||
@ -780,6 +793,7 @@ yap_flag(dialect,yap).
|
|||||||
V = user_error ;
|
V = user_error ;
|
||||||
V = user_input ;
|
V = user_input ;
|
||||||
V = user_output ;
|
V = user_output ;
|
||||||
|
V = variable_names_may_end_with_quotes ;
|
||||||
V = verbose_auto_load ;
|
V = verbose_auto_load ;
|
||||||
V = version ;
|
V = version ;
|
||||||
V = version_data ;
|
V = version_data ;
|
||||||
|
18
pl/preds.yap
18
pl/preds.yap
@ -940,11 +940,11 @@ system_predicate(P) :-
|
|||||||
functor(T,A,Arity),
|
functor(T,A,Arity),
|
||||||
'$pred_exists'(T,M)
|
'$pred_exists'(T,M)
|
||||||
;
|
;
|
||||||
'$current_predicate'(prolog,A,Arity)
|
% '$current_predicate'(prolog,A,Arity)
|
||||||
->
|
% ->
|
||||||
functor(T,A,Arity),
|
% functor(T,A,Arity),
|
||||||
'$pred_exists'(T,M)
|
% '$pred_exists'(T,M)
|
||||||
;
|
% ;
|
||||||
recorded('$import','$import'(NM,M,G,T,A,Arity),_)
|
recorded('$import','$import'(NM,M,G,T,A,Arity),_)
|
||||||
->
|
->
|
||||||
'$pred_exists'(G,NM)
|
'$pred_exists'(G,NM)
|
||||||
@ -955,10 +955,10 @@ system_predicate(P) :-
|
|||||||
functor(T,A,Arity),
|
functor(T,A,Arity),
|
||||||
'$pred_exists'(T,M)
|
'$pred_exists'(T,M)
|
||||||
;
|
;
|
||||||
'$current_predicate'(prolog,A,Arity),
|
% '$current_predicate'(prolog,A,Arity),
|
||||||
functor(T,A,Arity),
|
% functor(T,A,Arity),
|
||||||
'$pred_exists'(T,M)
|
% '$pred_exists'(T,M)
|
||||||
;
|
% ;
|
||||||
recorded('$import','$import'(NM,M,G,T,A,Arity),_),
|
recorded('$import','$import'(NM,M,G,T,A,Arity),_),
|
||||||
functor(T,A,Arity),
|
functor(T,A,Arity),
|
||||||
'$pred_exists'(G,NM)
|
'$pred_exists'(G,NM)
|
||||||
|
Reference in New Issue
Block a user