*** 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
28
C/readutil.c
28
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");
|
int sno = Yap_CheckStream (ARG1, Input_Stream_f, "read_line_to_codes/2");
|
||||||
CELL *HBASE = H;
|
CELL *HBASE = H;
|
||||||
|
CELL *h0 = &ARG4;
|
||||||
|
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
while (!(Stream[sno].status & Eof_Stream_f)) {
|
while (!(Stream[sno].status & Eof_Stream_f)) {
|
||||||
/* skip errors */
|
/* skip errors */
|
||||||
Int ch = Stream[sno].stream_getc(sno);
|
Int ch = Stream[sno].stream_getc(sno);
|
||||||
|
Term t;
|
||||||
if (ch == EOFCHAR)
|
if (ch == EOFCHAR)
|
||||||
break;
|
break;
|
||||||
*H++ = MkIntTerm(ch);
|
t = MkIntegerTerm(ch);
|
||||||
*H = AbsPair(H+1);
|
h0[0] = AbsPair(H);
|
||||||
H++;
|
*H = t;
|
||||||
if (H >= ASP) {
|
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");
|
Yap_Error(OUT_OF_STACK_ERROR, ARG1, "read_stream_to_codes/3");
|
||||||
return FALSE;
|
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)
|
if (H == HBASE)
|
||||||
return Yap_unify(ARG2,ARG3);
|
return Yap_unify(ARG2,ARG3);
|
||||||
H[-1] = Deref(ARG3);
|
RESET_VARIABLE(H-1);
|
||||||
|
Yap_unify(H[-1],ARG3);
|
||||||
return Yap_unify(AbsPair(HBASE),ARG2);
|
return Yap_unify(AbsPair(HBASE),ARG2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
@ -162,7 +178,7 @@ Yap_InitReadUtil(void)
|
|||||||
CurrentModule = READUTIL_MODULE;
|
CurrentModule = READUTIL_MODULE;
|
||||||
Yap_InitCPred("read_line_to_codes", 2, p_rl_to_codes, SafePredFlag|SyncPredFlag);
|
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_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);
|
Yap_InitCPred("read_stream_to_terms", 3, p_stream_to_terms, SafePredFlag|SyncPredFlag);
|
||||||
CurrentModule = cm;
|
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);
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
sc = Yap_heap_regs;
|
sc = Yap_heap_regs;
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
if (vsc_count == 27) Yap_Portray_delays = TRUE;
|
|
||||||
else Yap_Portray_delays = TRUE;
|
|
||||||
#ifdef COMMENTED
|
#ifdef COMMENTED
|
||||||
if (worker_id != 04 || worker_id != 03) return;
|
if (worker_id != 04 || worker_id != 03) return;
|
||||||
// if (vsc_count == 218280)
|
// if (vsc_count == 218280)
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
read_stream_to_codes(Stream, Codes) :-
|
read_stream_to_codes(Stream, Codes) :-
|
||||||
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, _) :-
|
read_file_to_codes(File, Codes, _) :-
|
||||||
open(File, read, Stream),
|
open(File, read, Stream),
|
||||||
read_stream_to_codes(Stream, Codes, []),
|
read_stream_to_codes(Stream, Codes, []),
|
||||||
@ -42,7 +37,7 @@ read_file_to_codes(File, Codes, _) :-
|
|||||||
|
|
||||||
read_file_to_codes(File, Codes) :-
|
read_file_to_codes(File, Codes) :-
|
||||||
open(File, read, Stream),
|
open(File, read, Stream),
|
||||||
read_stream_to_terms(Stream, Codes, []),
|
read_stream_to_codes(Stream, Codes, []),
|
||||||
close(Stream).
|
close(Stream).
|
||||||
|
|
||||||
read_file_to_terms(File, Codes, _) :-
|
read_file_to_terms(File, Codes, _) :-
|
||||||
|
Reference in New Issue
Block a user