diff --git a/C/globals.c b/C/globals.c index 2b53ee731..08bd9841b 100644 --- a/C/globals.c +++ b/C/globals.c @@ -1869,6 +1869,7 @@ p_nb_heap_add_to_heap(void) CELL *qd = GetHeap(ARG1,"add_to_heap"), *oldH, *oldHB, *pt; UInt hsize, hmsize, old_sz; Term arena, to, key; + UInt mingrow; if (!qd) return FALSE; @@ -1879,7 +1880,7 @@ p_nb_heap_add_to_heap(void) CELL *top = qd+(HEAP_START+2*hmsize); UInt extra_size; - if (hmsize >= 64*1024) { + if (hmsize <= 64*1024) { extra_size = 64*1024; } else { extra_size = hmsize; @@ -1913,9 +1914,10 @@ p_nb_heap_add_to_heap(void) arena = qd[HEAP_ARENA]; if (arena == 0L) return FALSE; - key = CopyTermToArena(ARG2, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, 0); + mingrow = garena_overflow_size(ArenaPt(arena)); + key = CopyTermToArena(ARG2, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, mingrow); arena = qd[HEAP_ARENA]; - to = CopyTermToArena(ARG3, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, 0); + to = CopyTermToArena(ARG3, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, mingrow); if (key == 0 || to == 0L) return FALSE; qd = GetHeap(ARG1,"add_to_heap"); @@ -2295,6 +2297,7 @@ p_nb_beam_add_to_beam(void) CELL *qd = GetHeap(ARG1,"add_to_beam"), *oldH, *oldHB, *pt; UInt hsize, hmsize, old_sz; Term arena, to, key; + UInt mingrow; if (!qd) return FALSE; @@ -2314,9 +2317,10 @@ p_nb_beam_add_to_beam(void) arena = qd[HEAP_ARENA]; if (arena == 0L) return FALSE; - key = CopyTermToArena(ARG2, qd[HEAP_ARENA], FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, 0); + mingrow = garena_overflow_size(ArenaPt(arena)); + key = CopyTermToArena(ARG2, qd[HEAP_ARENA], FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, mingrow); arena = qd[HEAP_ARENA]; - to = CopyTermToArena(ARG3, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, 0); + to = CopyTermToArena(ARG3, arena, FALSE, 3, qd+HEAP_ARENA, qd+HEAP_DELAY_ARENA, mingrow); if (key == 0 || to == 0L) return FALSE; qd = GetHeap(ARG1,"add_to_beam"); diff --git a/C/iopreds.c b/C/iopreds.c index 673cf6663..a9b26c5c0 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -3703,7 +3703,7 @@ syntax_error (TokEntry * tokptr, int sno) Int Yap_FirstLineInParse (void) { - return(StartLine); + return StartLine; } static Int diff --git a/docs/yap.tex b/docs/yap.tex index 19f3b70c3..37e764034 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -7072,6 +7072,12 @@ must be an atom (named array). The @var{Size} must evaluate to an integer. The @var{Type} must be bound to one of types mentioned previously. +@item reset_static_array(+@var{Name}) +@findex reset_static_array/1 +@snindex reset_static_array/1 +@cnindex reset_static_array/1 +Reset static array with name @var{Name} to its initial value. + @item static_array_location(+@var{Name}, -@var{Ptr}) @findex static_array_location/4 @snindex static_array_location/4 @@ -9684,6 +9690,12 @@ Add an element with key @var{Key} and @var{Value} to the tree @var{T0} creating a new red-black tree @var{TF}. Duplicated elements are not allowed. +@snindex rb_insert_new/4 +@cnindex rb_insert_new/4 +Add a new element with key @var{Key} and @var{Value} to the tree +@var{T0} creating a new red-black tree @var{TF}. Fails is an element +with @var{Key} exists in the tree. + @item rb_lookup(+@var{Key},-@var{Value},+@var{T}) @findex rb_lookup/3 @snindex rb_lookup/3 diff --git a/pl/boot.yap b/pl/boot.yap index ce6e1e0cf..4b25dbb28 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -104,7 +104,7 @@ true :- true. nb_setval('$endif',off), nb_setval('$consulting_file',[]), nb_setval('$consulting',false), - nb_setval('$included_file',''). + nb_setval('$included_file',[]). % Start file for yap diff --git a/pl/messages.yap b/pl/messages.yap index 7ac0cd079..56a63815f 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -11,7 +11,7 @@ * File: utilities for displaying messages in YAP. * * comments: error messages for YAP * * * -* Last rev: $Date: 2008-06-12 10:55:52 $,$Author: vsc $ * +* Last rev: $Date: 2008-06-16 21:22:15 $,$Author: vsc $ * * * * * *************************************************************************/ @@ -25,7 +25,7 @@ file_location(Prefix) --> { prolog_load_context(file, FileName) - }, + }, { '$start_line'(LN) }, file_position(FileName,LN,Prefix), [ nl ]. diff --git a/pl/statistics.yap b/pl/statistics.yap index eeb70edb3..c633d6aca 100644 --- a/pl/statistics.yap +++ b/pl/statistics.yap @@ -134,6 +134,14 @@ key_statistics(Key, NOfEntries, TotalSize) :- :- meta_predicate time(:). +time(Goal) :- + var(Goal), + '$do_error'(instantiation_error,time(Goal)). +time(_:Goal) :- + var(Goal), + '$do_error'(instantiation_error,time(Goal)). +time(Goal) :- \+ callable(Goal), !, + '$do_error'(type_error(callable,Goal),time(Goal)). time(Goal) :- statistics(walltime, _), statistics(cputime, _),