*** empty log message ***
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1682 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
d7b73e6886
commit
089e864621
32
C/readutil.c
32
C/readutil.c
@ -101,26 +101,42 @@ p_stream_to_codes(void)
|
||||
{
|
||||
int sno = Yap_CheckStream (ARG1, Input_Stream_f, "read_line_to_codes/2");
|
||||
CELL *HBASE = H;
|
||||
CELL *h0 = &ARG4;
|
||||
|
||||
if (sno < 0)
|
||||
return FALSE;
|
||||
while (!(Stream[sno].status & Eof_Stream_f)) {
|
||||
/* skip errors */
|
||||
Int ch = Stream[sno].stream_getc(sno);
|
||||
Term t;
|
||||
if (ch == EOFCHAR)
|
||||
break;
|
||||
*H++ = MkIntTerm(ch);
|
||||
*H = AbsPair(H+1);
|
||||
H++;
|
||||
if (H >= ASP) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, ARG1, "read_stream_to_codes/3");
|
||||
return FALSE;
|
||||
t = MkIntegerTerm(ch);
|
||||
h0[0] = AbsPair(H);
|
||||
*H = t;
|
||||
H+=2;
|
||||
h0 = H-1;
|
||||
if (H >= ASP-1024) {
|
||||
RESET_VARIABLE(h0);
|
||||
ARG4 = AbsPair(HBASE);
|
||||
ARG5 = (CELL)h0;
|
||||
fprintf(stderr,"+ %p-%p=%p\n",HBASE,H,H-HBASE);
|
||||
if (!Yap_gc(5, ENV, P)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, ARG1, "read_stream_to_codes/3");
|
||||
return FALSE;
|
||||
}
|
||||
/* build a legal term again */
|
||||
h0 = (CELL *)ARG5;
|
||||
HBASE = RepPair(ARG4);
|
||||
fprintf(stderr,"- %p-%p=%d\n",HBASE,h0,h0-HBASE);
|
||||
}
|
||||
}
|
||||
if (H == HBASE)
|
||||
return Yap_unify(ARG2,ARG3);
|
||||
H[-1] = Deref(ARG3);
|
||||
RESET_VARIABLE(H-1);
|
||||
Yap_unify(H[-1],ARG3);
|
||||
return Yap_unify(AbsPair(HBASE),ARG2);
|
||||
|
||||
}
|
||||
|
||||
static Int
|
||||
@ -162,7 +178,7 @@ Yap_InitReadUtil(void)
|
||||
CurrentModule = READUTIL_MODULE;
|
||||
Yap_InitCPred("read_line_to_codes", 2, p_rl_to_codes, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("read_line_to_codes", 3, p_rl_to_codes2, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("read_stream_to_codes", 3, p_stream_to_codes, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("read_stream_to_codes", 3, p_stream_to_codes, SyncPredFlag);
|
||||
Yap_InitCPred("read_stream_to_terms", 3, p_stream_to_terms, SafePredFlag|SyncPredFlag);
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
@ -161,8 +161,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
sc = Yap_heap_regs;
|
||||
vsc_count++;
|
||||
if (vsc_count == 27) Yap_Portray_delays = TRUE;
|
||||
else Yap_Portray_delays = TRUE;
|
||||
#ifdef COMMENTED
|
||||
if (worker_id != 04 || worker_id != 03) return;
|
||||
// if (vsc_count == 218280)
|
||||
|
@ -30,11 +30,6 @@
|
||||
read_stream_to_codes(Stream, Codes) :-
|
||||
read_stream_to_codes(Stream, Codes, []).
|
||||
|
||||
read_file_to_codes(File, Codes) :-
|
||||
open(File, read, Stream),
|
||||
read_stream_to_codes(Stream, Codes, []),
|
||||
close(Stream).
|
||||
|
||||
read_file_to_codes(File, Codes, _) :-
|
||||
open(File, read, Stream),
|
||||
read_stream_to_codes(Stream, Codes, []),
|
||||
@ -42,7 +37,7 @@ read_file_to_codes(File, Codes, _) :-
|
||||
|
||||
read_file_to_codes(File, Codes) :-
|
||||
open(File, read, Stream),
|
||||
read_stream_to_terms(Stream, Codes, []),
|
||||
read_stream_to_codes(Stream, Codes, []),
|
||||
close(Stream).
|
||||
|
||||
read_file_to_terms(File, Codes, _) :-
|
||||
|
Reference in New Issue
Block a user