misc fixes
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1068 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
e7fbb54532
commit
a6f1b27c09
@ -10,8 +10,11 @@
|
|||||||
* File: c_interface.c *
|
* File: c_interface.c *
|
||||||
* comments: c_interface primitives definition *
|
* comments: c_interface primitives definition *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2004-05-14 17:56:45 $,$Author: vsc $ *
|
* Last rev: $Date: 2004-05-17 21:42:08 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.46 2004/05/14 17:56:45 vsc
|
||||||
|
* Yap_WriteBuffer
|
||||||
|
*
|
||||||
* Revision 1.45 2004/05/14 17:11:30 vsc
|
* Revision 1.45 2004/05/14 17:11:30 vsc
|
||||||
* support BigNums in interface
|
* support BigNums in interface
|
||||||
*
|
*
|
||||||
@ -125,7 +128,6 @@ X_API Term *STD_PROTO(YAP_AddressFromSlot,(long));
|
|||||||
X_API void STD_PROTO(YAP_PutInSlot,(long, Term));
|
X_API void STD_PROTO(YAP_PutInSlot,(long, Term));
|
||||||
X_API void STD_PROTO(YAP_RecoverSlots,(int));
|
X_API void STD_PROTO(YAP_RecoverSlots,(int));
|
||||||
X_API void STD_PROTO(YAP_Throw,(Term));
|
X_API void STD_PROTO(YAP_Throw,(Term));
|
||||||
X_API Term STD_PROTO(YAP_ModuleName,(int));
|
|
||||||
X_API void STD_PROTO(YAP_Halt,(int));
|
X_API void STD_PROTO(YAP_Halt,(int));
|
||||||
X_API Term *STD_PROTO(YAP_TopOfLocalStack,(void));
|
X_API Term *STD_PROTO(YAP_TopOfLocalStack,(void));
|
||||||
X_API void *STD_PROTO(YAP_Predicate,(Atom,unsigned long int,int));
|
X_API void *STD_PROTO(YAP_Predicate,(Atom,unsigned long int,int));
|
||||||
|
@ -11,8 +11,11 @@
|
|||||||
* File: cdmgr.c *
|
* File: cdmgr.c *
|
||||||
* comments: Code manager *
|
* comments: Code manager *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2004-05-13 21:36:45 $,$Author: vsc $ *
|
* Last rev: $Date: 2004-05-17 21:42:09 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.122 2004/05/13 21:36:45 vsc
|
||||||
|
* get rid of pesky debugging prints
|
||||||
|
*
|
||||||
* Revision 1.121 2004/05/13 20:54:57 vsc
|
* Revision 1.121 2004/05/13 20:54:57 vsc
|
||||||
* debugger fixes
|
* debugger fixes
|
||||||
* make sure we always go back to current module, even during initizlization.
|
* make sure we always go back to current module, even during initizlization.
|
||||||
@ -3054,7 +3057,7 @@ p_system_pred(void)
|
|||||||
}
|
}
|
||||||
pe = RepPredProp(Yap_GetPredPropByFunc(funt, mod));
|
pe = RepPredProp(Yap_GetPredPropByFunc(funt, mod));
|
||||||
} else if (IsPairTerm(t1)) {
|
} else if (IsPairTerm(t1)) {
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
if (EndOfPAEntr(pe))
|
if (EndOfPAEntr(pe))
|
||||||
|
12
C/iopreds.c
12
C/iopreds.c
@ -210,15 +210,23 @@ unix_upd_stream_info (StreamDesc * s)
|
|||||||
#endif /* USE_SOCKET */
|
#endif /* USE_SOCKET */
|
||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
{
|
{
|
||||||
if (_isatty(_fileno(s->u.file.file))) {
|
if (
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
TRUE /* we cannot trust _isatty in MINGW */
|
||||||
|
#else
|
||||||
|
_isatty(_fileno(s->u.file.file))
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f;
|
s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f;
|
||||||
/* make all console descriptors unbuffered */
|
/* make all console descriptors unbuffered */
|
||||||
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
||||||
}
|
}
|
||||||
|
#if _MSC_VER
|
||||||
/* standard error stream should never be buffered */
|
/* standard error stream should never be buffered */
|
||||||
if (StdErrStream == s-Stream) {
|
else if (StdErrStream == s-Stream) {
|
||||||
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -7569,7 +7569,14 @@ allowed.
|
|||||||
@findex lookup/3
|
@findex lookup/3
|
||||||
@snindex lookup/3
|
@snindex lookup/3
|
||||||
@cnindex lookup/3
|
@cnindex lookup/3
|
||||||
Lookup an element with key @var{Key} in the AVL tree
|
Lookup an element with key @var{Key} in the red-black tree
|
||||||
|
@var{T}, returning the value @var{Value}.
|
||||||
|
|
||||||
|
@item lookupall(+@var{Key},-@var{Value},+@var{T})
|
||||||
|
@findex lookupall/3
|
||||||
|
@snindex lookupall/3
|
||||||
|
@cnindex lookupall/3
|
||||||
|
Lookup all elements with key @var{Key} in the red-black tree
|
||||||
@var{T}, returning the value @var{Value}.
|
@var{T}, returning the value @var{Value}.
|
||||||
|
|
||||||
@item new(?@var{T})
|
@item new(?@var{T})
|
||||||
|
@ -325,8 +325,7 @@ extern X_API void PROTO(YAP_Throw,(YAP_Term));
|
|||||||
/* int YAP_LookupModule() */
|
/* int YAP_LookupModule() */
|
||||||
#define YAP_LookupModule(T) (T)
|
#define YAP_LookupModule(T) (T)
|
||||||
|
|
||||||
/* int YAP_ModuleName() */
|
#define YAP_ModuleName(mod) (mod)
|
||||||
extern X_API YAP_Term PROTO(YAP_ModuleName,(int));
|
|
||||||
|
|
||||||
/* int YAP_Halt() */
|
/* int YAP_Halt() */
|
||||||
extern X_API int PROTO(YAP_Halt,(int));
|
extern X_API int PROTO(YAP_Halt,(int));
|
||||||
|
@ -36,6 +36,7 @@ PROGRAMS= $(srcdir)/apply_macros.yap \
|
|||||||
$(srcdir)/prandom.yap \
|
$(srcdir)/prandom.yap \
|
||||||
$(srcdir)/queues.yap \
|
$(srcdir)/queues.yap \
|
||||||
$(srcdir)/random.yap \
|
$(srcdir)/random.yap \
|
||||||
|
$(srcdir)/rbtrees.yap \
|
||||||
$(srcdir)/regexp.yap \
|
$(srcdir)/regexp.yap \
|
||||||
$(srcdir)/splay.yap \
|
$(srcdir)/splay.yap \
|
||||||
$(srcdir)/system.yap \
|
$(srcdir)/system.yap \
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
:- module(rbtrees,
|
:- module(rbtrees,
|
||||||
[new/1,
|
[new/1,
|
||||||
lookup/3,
|
lookup/3,
|
||||||
|
lookupall/3,
|
||||||
insert/4,
|
insert/4,
|
||||||
delete/3]).
|
delete/3]).
|
||||||
|
|
||||||
@ -25,8 +26,8 @@ new(K,V,black(Nil,K,V,Nil)) :-
|
|||||||
|
|
||||||
lookup(Key, Val, black([],_,_,[])) :- !, fail.
|
lookup(Key, Val, black([],_,_,[])) :- !, fail.
|
||||||
lookup(Key, Val, Tree) :-
|
lookup(Key, Val, Tree) :-
|
||||||
arg(Tree,2,KA),
|
arg(2,Tree,KA),
|
||||||
compare(Cmp,KA,Key,Tree),
|
compare(Cmp,KA,Key),
|
||||||
lookup(Cmp,Key,Val,Tree).
|
lookup(Cmp,Key,Val,Tree).
|
||||||
|
|
||||||
lookup(<, K, V, Tree) :-
|
lookup(<, K, V, Tree) :-
|
||||||
@ -35,9 +36,27 @@ lookup(<, K, V, Tree) :-
|
|||||||
lookup(>, K, V, Tree) :-
|
lookup(>, K, V, Tree) :-
|
||||||
arg(4,Tree,NTree),
|
arg(4,Tree,NTree),
|
||||||
lookup(K, V, NTree).
|
lookup(K, V, NTree).
|
||||||
lookup(>, K, V, Tree) :-
|
lookup(=, K, V, Tree) :-
|
||||||
arg(3,Tree,V).
|
arg(3,Tree,V).
|
||||||
|
|
||||||
|
lookupall(Key, Val, black([],_,_,[])) :- !, fail.
|
||||||
|
lookupall(Key, Val, Tree) :-
|
||||||
|
arg(2,Tree,KA),
|
||||||
|
compare(Cmp,KA,Key),
|
||||||
|
lookupall(Cmp,Key,Val,Tree).
|
||||||
|
|
||||||
|
lookupall(>, K, V, Tree) :-
|
||||||
|
arg(4,Tree,NTree),
|
||||||
|
lookupall(K, V, NTree).
|
||||||
|
lookupall(=, K, V, Tree) :-
|
||||||
|
arg(3,Tree,V).
|
||||||
|
lookupall(=, K, V, Tree) :-
|
||||||
|
arg(1,Tree,NTree),
|
||||||
|
lookupall(K, V, NTree).
|
||||||
|
lookupall(<, K, V, Tree) :-
|
||||||
|
arg(1,Tree,NTree),
|
||||||
|
lookupall(K, V, NTree).
|
||||||
|
|
||||||
%
|
%
|
||||||
% Tree insertion
|
% Tree insertion
|
||||||
%
|
%
|
||||||
|
@ -316,9 +316,11 @@ debugging :-
|
|||||||
throw('$fail_spy'(GoalNumber)).
|
throw('$fail_spy'(GoalNumber)).
|
||||||
'$loop_spy_event'(abort, _, _, _, _) :- !,
|
'$loop_spy_event'(abort, _, _, _, _) :- !,
|
||||||
throw(abort).
|
throw(abort).
|
||||||
'$loop_spy_event'(Event, GoalNumber, G, Module, _) :- !,
|
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl) :- !,
|
||||||
'$trace'(exception(Event),G,Module,GoalNumber),
|
'$system_catch'(
|
||||||
fail.
|
('$trace'(exception(Event),G,Module,GoalNumber),fail),
|
||||||
|
Module,NewEvent,
|
||||||
|
'$loop_spy_event'(NewEvent, GoalNumber, G, Module, InControl)).
|
||||||
|
|
||||||
|
|
||||||
'$loop_fail'(GoalNumber, G, Module, InControl) :-
|
'$loop_fail'(GoalNumber, G, Module, InControl) :-
|
||||||
|
@ -122,7 +122,6 @@ bagof(Template, Generator, Bag) :-
|
|||||||
Key =.. ['$'|LFreeVars],
|
Key =.. ['$'|LFreeVars],
|
||||||
'$init_db_queue'(Ref),
|
'$init_db_queue'(Ref),
|
||||||
'$findall_with_common_vars'(Key-Template, Generator, Ref, Bags0),
|
'$findall_with_common_vars'(Key-Template, Generator, Ref, Bags0),
|
||||||
write(vsc:(Bags0,Bags)),nl,
|
|
||||||
'$keysort'(Bags0, Bags),
|
'$keysort'(Bags0, Bags),
|
||||||
'$pick'(Bags, Key, Bag).
|
'$pick'(Bags, Key, Bag).
|
||||||
% or we just have a list of answers
|
% or we just have a list of answers
|
||||||
|
Reference in New Issue
Block a user