misc fixes
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1068 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		@@ -10,8 +10,11 @@
 | 
			
		||||
* File:		c_interface.c						 *
 | 
			
		||||
* 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 $
 | 
			
		||||
* Revision 1.46  2004/05/14 17:56:45  vsc
 | 
			
		||||
* Yap_WriteBuffer
 | 
			
		||||
*
 | 
			
		||||
* Revision 1.45  2004/05/14 17:11:30  vsc
 | 
			
		||||
* 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_RecoverSlots,(int));
 | 
			
		||||
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 Term   *STD_PROTO(YAP_TopOfLocalStack,(void));
 | 
			
		||||
X_API void   *STD_PROTO(YAP_Predicate,(Atom,unsigned long int,int));
 | 
			
		||||
 
 | 
			
		||||
@@ -11,8 +11,11 @@
 | 
			
		||||
* File:		cdmgr.c							 *
 | 
			
		||||
* 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 $
 | 
			
		||||
* 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
 | 
			
		||||
* debugger fixes
 | 
			
		||||
* 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));
 | 
			
		||||
  } else if (IsPairTerm(t1)) {
 | 
			
		||||
    return (TRUE);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  } else
 | 
			
		||||
    return (FALSE);
 | 
			
		||||
  if (EndOfPAEntr(pe))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								C/iopreds.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								C/iopreds.c
									
									
									
									
									
								
							@@ -208,17 +208,25 @@ unix_upd_stream_info (StreamDesc * s)
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
#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;
 | 
			
		||||
      /* make all console descriptors unbuffered */
 | 
			
		||||
      setvbuf(s->u.file.file, NULL, _IONBF, 0);
 | 
			
		||||
    }
 | 
			
		||||
#if _MSC_VER
 | 
			
		||||
    /* standard error stream should never be buffered */
 | 
			
		||||
    if (StdErrStream == s-Stream) {
 | 
			
		||||
    else if (StdErrStream == s-Stream) {
 | 
			
		||||
      setvbuf(s->u.file.file, NULL, _IONBF, 0);      
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
#else
 | 
			
		||||
 
 | 
			
		||||
@@ -7569,7 +7569,14 @@ allowed.
 | 
			
		||||
@findex lookup/3
 | 
			
		||||
@snindex 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}.
 | 
			
		||||
 | 
			
		||||
@item new(?@var{T})
 | 
			
		||||
 
 | 
			
		||||
@@ -325,8 +325,7 @@ extern X_API void PROTO(YAP_Throw,(YAP_Term));
 | 
			
		||||
/*  int  YAP_LookupModule()  */
 | 
			
		||||
#define YAP_LookupModule(T)  (T)
 | 
			
		||||
 | 
			
		||||
/*  int  YAP_ModuleName()  */
 | 
			
		||||
extern X_API YAP_Term  PROTO(YAP_ModuleName,(int));
 | 
			
		||||
#define YAP_ModuleName(mod) (mod)
 | 
			
		||||
 | 
			
		||||
/*  int  YAP_Halt()  */
 | 
			
		||||
extern X_API int  PROTO(YAP_Halt,(int));
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@ PROGRAMS= $(srcdir)/apply_macros.yap \
 | 
			
		||||
	$(srcdir)/prandom.yap \
 | 
			
		||||
	$(srcdir)/queues.yap \
 | 
			
		||||
	$(srcdir)/random.yap \
 | 
			
		||||
	$(srcdir)/rbtrees.yap \
 | 
			
		||||
	$(srcdir)/regexp.yap \
 | 
			
		||||
	$(srcdir)/splay.yap \
 | 
			
		||||
	$(srcdir)/system.yap \
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@
 | 
			
		||||
:- module(rbtrees,
 | 
			
		||||
	  [new/1,
 | 
			
		||||
	   lookup/3,
 | 
			
		||||
	   lookupall/3,
 | 
			
		||||
	   insert/4,
 | 
			
		||||
	   delete/3]).
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +26,8 @@ new(K,V,black(Nil,K,V,Nil)) :-
 | 
			
		||||
 | 
			
		||||
lookup(Key, Val, black([],_,_,[])) :- !, fail.
 | 
			
		||||
lookup(Key, Val, Tree) :-
 | 
			
		||||
	arg(Tree,2,KA),
 | 
			
		||||
	compare(Cmp,KA,Key,Tree),
 | 
			
		||||
	arg(2,Tree,KA),
 | 
			
		||||
	compare(Cmp,KA,Key),
 | 
			
		||||
	lookup(Cmp,Key,Val,Tree).
 | 
			
		||||
 | 
			
		||||
lookup(<, K, V, Tree) :-
 | 
			
		||||
@@ -35,9 +36,27 @@ lookup(<, K, V, Tree) :-
 | 
			
		||||
lookup(>, K, V, Tree) :-
 | 
			
		||||
	arg(4,Tree,NTree),
 | 
			
		||||
	lookup(K, V, NTree).
 | 
			
		||||
lookup(>, K, V, Tree) :-
 | 
			
		||||
lookup(=, K, V, Tree) :-
 | 
			
		||||
	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
 | 
			
		||||
%
 | 
			
		||||
 
 | 
			
		||||
@@ -316,9 +316,11 @@ debugging :-
 | 
			
		||||
     throw('$fail_spy'(GoalNumber)).
 | 
			
		||||
'$loop_spy_event'(abort, _, _, _, _) :- !,
 | 
			
		||||
     throw(abort).
 | 
			
		||||
'$loop_spy_event'(Event, GoalNumber, G, Module, _) :- !,
 | 
			
		||||
     '$trace'(exception(Event),G,Module,GoalNumber),
 | 
			
		||||
     fail.
 | 
			
		||||
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl) :- !,
 | 
			
		||||
     '$system_catch'(
 | 
			
		||||
		     ('$trace'(exception(Event),G,Module,GoalNumber),fail),
 | 
			
		||||
		     Module,NewEvent,
 | 
			
		||||
		     '$loop_spy_event'(NewEvent, GoalNumber, G, Module, InControl)).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
'$loop_fail'(GoalNumber, G, Module, InControl) :-
 | 
			
		||||
 
 | 
			
		||||
@@ -122,7 +122,6 @@ bagof(Template, Generator, Bag) :-
 | 
			
		||||
	Key =.. ['$'|LFreeVars],
 | 
			
		||||
	'$init_db_queue'(Ref),
 | 
			
		||||
	'$findall_with_common_vars'(Key-Template, Generator, Ref, Bags0),
 | 
			
		||||
write(vsc:(Bags0,Bags)),nl,
 | 
			
		||||
	'$keysort'(Bags0, Bags),
 | 
			
		||||
	'$pick'(Bags, Key, Bag).
 | 
			
		||||
% or we just have a list of answers
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user