fix manual and message handling
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2253 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8e6403794f
commit
02497c1172
@ -786,8 +786,15 @@ p_thread_unlock(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_max_workers(void)
|
||||
{ /* '$max_workers'(+P) */
|
||||
return Yap_unify(ARG1,MkIntTerm(1));
|
||||
}
|
||||
|
||||
void Yap_InitThreadPreds(void)
|
||||
{
|
||||
Yap_InitCPred("$max_workers", 1, p_max_workers, HiddenPredFlag);
|
||||
Yap_InitCPred("$thread_self", 1, p_thread_self, SafePredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$no_threads", 0, p_no_threads, SafePredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$max_threads", 1, p_max_threads, SafePredFlag|HiddenPredFlag);
|
||||
|
@ -3409,7 +3409,7 @@ sub-strings of @var{A}.
|
||||
@end table
|
||||
|
||||
@node Predicates on Characters, Comparing Terms, Predicates on Atoms, Top
|
||||
@section Predicates on Atoms
|
||||
@section Predicates on Characters
|
||||
|
||||
The following predicates are used to manipulate characters:
|
||||
|
||||
|
@ -47,10 +47,12 @@
|
||||
ranstart/0,
|
||||
ranstart/1,
|
||||
rannum/1,
|
||||
rannunif/2]).
|
||||
ranunif/2]).
|
||||
|
||||
:- initialization(ranstart).
|
||||
|
||||
:- dynamic ranState/5.
|
||||
|
||||
%
|
||||
% vsc: dangerous code, to change.
|
||||
%
|
||||
@ -67,13 +69,12 @@ ranstart(N) :-
|
||||
Incr is (8'154 << (Wsize - 9)) + 1, % per Knuth, v.2 p.78
|
||||
Mult is 8'3655, % OK for 16-18 Wsize
|
||||
Prev is Mult * (8 * N + 5) + Incr,
|
||||
recorda(ranState, ranState(Mult, Prev, Wsize, MaxInt, Incr), Ref).
|
||||
assert(ranState, ranState(Mult, Prev, Wsize, MaxInt, Incr).
|
||||
|
||||
rannum(Raw) :-
|
||||
recorded(ranState, ranState(Mult, Prev, Wsize, MaxInt, Incr), Oldref),
|
||||
erase(Oldref),
|
||||
retract(ranState(Mult, Prev, Wsize, MaxInt, Incr)),
|
||||
Curr is Mult * Prev + Incr,
|
||||
recorda(ranState, ranState(Mult, Curr, Wsize, MaxInt, Incr), Ref),
|
||||
assert(ranState(Mult, Curr, Wsize, MaxInt, Incr),
|
||||
( Curr > 0,
|
||||
Raw is Curr
|
||||
;
|
||||
@ -83,10 +84,9 @@ rannum(Raw) :-
|
||||
|
||||
ranunif(Range, Unif) :-
|
||||
Range > 0,
|
||||
recorded(ranState, ranState(Mult, Prev, Wsize, MaxInt, Incr), Oldref),
|
||||
erase(Oldref),
|
||||
retract( ranState(Mult, Prev, Wsize, MaxInt, Incr) ),
|
||||
Curr is Mult * Prev + Incr,
|
||||
recorda(ranState, ranState(Mult, Curr, Wsize, MaxInt, Incr), Ref),
|
||||
assert(ranState(Mult, Curr, Wsize, MaxInt, Incr)),
|
||||
( Curr > 0,
|
||||
Raw is Curr
|
||||
;
|
||||
|
20
pl/preds.yap
20
pl/preds.yap
@ -979,5 +979,21 @@ current_key(A,K) :-
|
||||
'$noprofile'(_, _).
|
||||
|
||||
'$notrace'(G) :-
|
||||
\+ '$undefined'(G, prolog),
|
||||
call(G).
|
||||
var(G), !,
|
||||
'$do_error'(instantiation_error,G).
|
||||
'$notrace'(G) :- number(G), !,
|
||||
'$do_error'(type_error(callable,G),G).
|
||||
'$notrace'(G) :- db_reference(G), !,
|
||||
'$do_error'(type_error(callable,G),G).
|
||||
'$notrace'(M:G) :-
|
||||
\+ atom(M),
|
||||
'$do_error'(type_error(atom,Na), Msg).
|
||||
'$notrace'(M:G) :- !,
|
||||
'$notrace'(G, M).
|
||||
'$notrace'(G) :- !,
|
||||
'$notrace'(G, prolog).
|
||||
|
||||
|
||||
'$notrace'(G, Mod) :-
|
||||
\+ '$undefined'(G, Mod),
|
||||
call(Mod:G).
|
||||
|
Reference in New Issue
Block a user