make lcc happy.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@717 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
13e409c659
commit
1db1bb484e
4
C/agc.c
4
C/agc.c
@ -343,7 +343,7 @@ clean_atoms(void)
|
|||||||
#endif
|
#endif
|
||||||
*patm = at->NextOfAE;
|
*patm = at->NextOfAE;
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
agc_collected += Yap_SizeOfBlock((char *)at);
|
agc_collected += Yap_SizeOfBlock((CODEADDR)at);
|
||||||
Yap_FreeCodeSpace((char *)at);
|
Yap_FreeCodeSpace((char *)at);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ clean_atoms(void)
|
|||||||
#endif
|
#endif
|
||||||
*patm = at->NextOfAE;
|
*patm = at->NextOfAE;
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
agc_collected += Yap_SizeOfBlock((char *)at);
|
agc_collected += Yap_SizeOfBlock((CODEADDR)at);
|
||||||
Yap_FreeCodeSpace((char *)at);
|
Yap_FreeCodeSpace((char *)at);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
C/cdmgr.c
13
C/cdmgr.c
@ -81,7 +81,7 @@ STATIC_PROTO(Int p_call_count_reset, (void));
|
|||||||
STATIC_PROTO(Int p_toggle_static_predicates_in_use, (void));
|
STATIC_PROTO(Int p_toggle_static_predicates_in_use, (void));
|
||||||
STATIC_PROTO(void list_all_predicates_in_use, (void));
|
STATIC_PROTO(void list_all_predicates_in_use, (void));
|
||||||
STATIC_PROTO(Atom YapConsultingFile, (void));
|
STATIC_PROTO(Atom YapConsultingFile, (void));
|
||||||
STATIC_PROTO(Int PredForCode,(CODEADDR, Atom *, Int *, SMALLUNSGN *));
|
STATIC_PROTO(Int PredForCode,(CODEADDR, Atom *, UInt *, SMALLUNSGN *));
|
||||||
|
|
||||||
#define PredArity(p) (p->ArityOfPE)
|
#define PredArity(p) (p->ArityOfPE)
|
||||||
#define TRYCODE(G,F,N) ( (N)<5 ? (op_numbers)((int)F+(N)*3) : G)
|
#define TRYCODE(G,F,N) ( (N)<5 ? (op_numbers)((int)F+(N)*3) : G)
|
||||||
@ -1969,7 +1969,7 @@ list_all_predicates_in_use(void)
|
|||||||
case _count_retry:
|
case _count_retry:
|
||||||
{
|
{
|
||||||
Atom at;
|
Atom at;
|
||||||
Int arity;
|
UInt arity;
|
||||||
SMALLUNSGN mod;
|
SMALLUNSGN mod;
|
||||||
if (PredForCode((CODEADDR)b_ptr->cp_ap, &at, &arity, &mod)) {
|
if (PredForCode((CODEADDR)b_ptr->cp_ap, &at, &arity, &mod)) {
|
||||||
if (arity)
|
if (arity)
|
||||||
@ -2169,7 +2169,7 @@ p_toggle_static_predicates_in_use(void)
|
|||||||
|
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
code_in_pred(PredEntry *pp, Atom *pat, Int *parity, CODEADDR codeptr) {
|
code_in_pred(PredEntry *pp, Atom *pat, UInt *parity, CODEADDR codeptr) {
|
||||||
CODEADDR clcode, cl;
|
CODEADDR clcode, cl;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
@ -2213,7 +2213,7 @@ code_in_pred(PredEntry *pp, Atom *pat, Int *parity, CODEADDR codeptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
PredForCode(CODEADDR codeptr, Atom *pat, Int *parity, SMALLUNSGN *pmodule) {
|
PredForCode(CODEADDR codeptr, Atom *pat, UInt *parity, SMALLUNSGN *pmodule) {
|
||||||
Int found = 0;
|
Int found = 0;
|
||||||
Int i_table;
|
Int i_table;
|
||||||
|
|
||||||
@ -2232,7 +2232,7 @@ PredForCode(CODEADDR codeptr, Atom *pat, Int *parity, SMALLUNSGN *pmodule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Int
|
Int
|
||||||
Yap_PredForCode(CODEADDR codeptr, Atom *pat, Int *parity, SMALLUNSGN *pmodule) {
|
Yap_PredForCode(CODEADDR codeptr, Atom *pat, UInt *parity, SMALLUNSGN *pmodule) {
|
||||||
return PredForCode(codeptr, pat, parity, pmodule);
|
return PredForCode(codeptr, pat, parity, pmodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2251,7 +2251,6 @@ p_pred_for_code(void) {
|
|||||||
Yap_unify(ARG3,MkIntegerTerm(arity)) &&
|
Yap_unify(ARG3,MkIntegerTerm(arity)) &&
|
||||||
Yap_unify(ARG4,ModuleName[module]) &&
|
Yap_unify(ARG4,ModuleName[module]) &&
|
||||||
Yap_unify(ARG5,MkIntegerTerm(cl)));
|
Yap_unify(ARG5,MkIntegerTerm(cl)));
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
@ -2445,7 +2444,7 @@ p_parent_pred(void)
|
|||||||
/* This predicate is called from the debugger.
|
/* This predicate is called from the debugger.
|
||||||
We assume a sequence of the form a -> b */
|
We assume a sequence of the form a -> b */
|
||||||
Atom at;
|
Atom at;
|
||||||
Int arity;
|
UInt arity;
|
||||||
SMALLUNSGN module;
|
SMALLUNSGN module;
|
||||||
if (!PredForCode((CODEADDR)P_before_spy, &at, &arity, &module)) {
|
if (!PredForCode((CODEADDR)P_before_spy, &at, &arity, &module)) {
|
||||||
return(Yap_unify(ARG1, MkIntTerm(0)) &&
|
return(Yap_unify(ARG1, MkIntTerm(0)) &&
|
||||||
|
@ -193,7 +193,7 @@ static void
|
|||||||
detect_bug_location(yamop *yap_pc, char *tp, int psize)
|
detect_bug_location(yamop *yap_pc, char *tp, int psize)
|
||||||
{
|
{
|
||||||
Atom pred_name;
|
Atom pred_name;
|
||||||
Int pred_arity;
|
UInt pred_arity;
|
||||||
SMALLUNSGN pred_module;
|
SMALLUNSGN pred_module;
|
||||||
Int cl;
|
Int cl;
|
||||||
|
|
||||||
|
16
C/exec.c
16
C/exec.c
@ -22,7 +22,7 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
|
|||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
|
||||||
STATIC_PROTO(Int CallPredicate, (PredEntry *, choiceptr));
|
STATIC_PROTO(Int CallPredicate, (PredEntry *, choiceptr));
|
||||||
STATIC_PROTO(Int CallClause, (PredEntry *, unsigned int, Int));
|
STATIC_PROTO(Int CallClause, (PredEntry *, Int));
|
||||||
STATIC_PROTO(Int p_save_cp, (void));
|
STATIC_PROTO(Int p_save_cp, (void));
|
||||||
STATIC_PROTO(Int p_execute, (void));
|
STATIC_PROTO(Int p_execute, (void));
|
||||||
STATIC_PROTO(Int p_execute0, (void));
|
STATIC_PROTO(Int p_execute0, (void));
|
||||||
@ -100,7 +100,7 @@ CallError(yap_error_number err, SMALLUNSGN mod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
CallClause(PredEntry *pen, unsigned int arity, Int position)
|
CallClause(PredEntry *pen, Int position)
|
||||||
{
|
{
|
||||||
CELL flags;
|
CELL flags;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ CallClause(PredEntry *pen, unsigned int arity, Int position)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!(ClauseCodeToClause(q)->ClFlags & InUseMask)) {
|
if (!(ClauseCodeToClause(q)->ClFlags & InUseMask)) {
|
||||||
OPREG *opp = &(ClauseCodeToClause(q)->ClFlags);
|
CELL *opp = &(ClauseCodeToClause(q)->ClFlags);
|
||||||
TRAIL_CLREF(ClauseCodeToClause(q));
|
TRAIL_CLREF(ClauseCodeToClause(q));
|
||||||
*opp |= InUseMask;
|
*opp |= InUseMask;
|
||||||
}
|
}
|
||||||
@ -1293,7 +1293,7 @@ p_at_execute(void)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
/* N = arity; */
|
/* N = arity; */
|
||||||
/* call may not define new system predicates!! */
|
/* call may not define new system predicates!! */
|
||||||
return (CallClause(RepPredProp(pe), arity, IntOfTerm(t2)));
|
return (CallClause(RepPredProp(pe), IntOfTerm(t2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1349,7 +1349,7 @@ exec_absmi(int top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_goal(CODEADDR CodeAdr, int arity, CELL *pt, int args_to_save, int top)
|
do_goal(CODEADDR CodeAdr, int arity, CELL *pt, int top)
|
||||||
{
|
{
|
||||||
choiceptr saved_b = B;
|
choiceptr saved_b = B;
|
||||||
|
|
||||||
@ -1453,12 +1453,12 @@ Yap_execute_goal(Term t, int nargs, SMALLUNSGN mod)
|
|||||||
if (IsAtomTerm(t)) {
|
if (IsAtomTerm(t)) {
|
||||||
CodeAdr = RepPredProp (pe)->CodeOfPred;
|
CodeAdr = RepPredProp (pe)->CodeOfPred;
|
||||||
READ_UNLOCK(ppe->PRWLock);
|
READ_UNLOCK(ppe->PRWLock);
|
||||||
out = do_goal(CodeAdr, 0, pt, nargs, FALSE);
|
out = do_goal(CodeAdr, 0, pt, FALSE);
|
||||||
} else {
|
} else {
|
||||||
Functor f = FunctorOfTerm(t);
|
Functor f = FunctorOfTerm(t);
|
||||||
CodeAdr = RepPredProp (pe)->CodeOfPred;
|
CodeAdr = RepPredProp (pe)->CodeOfPred;
|
||||||
READ_UNLOCK(ppe->PRWLock);
|
READ_UNLOCK(ppe->PRWLock);
|
||||||
out = do_goal(CodeAdr, ArityOfFunctor(f), pt, nargs, FALSE);
|
out = do_goal(CodeAdr, ArityOfFunctor(f), pt, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == 1) {
|
if (out == 1) {
|
||||||
@ -1591,7 +1591,7 @@ Yap_RunTopGoal(Term t)
|
|||||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||||
"unable to boot because of too little heap space");
|
"unable to boot because of too little heap space");
|
||||||
}
|
}
|
||||||
goal_out = do_goal(CodeAdr, arity, pt, 0, TRUE);
|
goal_out = do_goal(CodeAdr, arity, pt, TRUE);
|
||||||
return(goal_out);
|
return(goal_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
|||||||
case _count_retry:
|
case _count_retry:
|
||||||
{
|
{
|
||||||
Atom at;
|
Atom at;
|
||||||
Int arity;
|
UInt arity;
|
||||||
SMALLUNSGN mod;
|
SMALLUNSGN mod;
|
||||||
if (Yap_PredForCode((CODEADDR)gc_B->cp_ap, &at, &arity, &mod)) {
|
if (Yap_PredForCode((CODEADDR)gc_B->cp_ap, &at, &arity, &mod)) {
|
||||||
if (arity)
|
if (arity)
|
||||||
|
85
C/iopreds.c
85
C/iopreds.c
@ -83,8 +83,8 @@ static char SccsId[] = "%W% %G%";
|
|||||||
STATIC_PROTO (Int PlIOError, (yap_error_number, Term, char *));
|
STATIC_PROTO (Int PlIOError, (yap_error_number, Term, char *));
|
||||||
STATIC_PROTO (int FilePutc, (int, int));
|
STATIC_PROTO (int FilePutc, (int, int));
|
||||||
STATIC_PROTO (int MemPutc, (int, int));
|
STATIC_PROTO (int MemPutc, (int, int));
|
||||||
STATIC_PROTO (int console_post_process_read_char, (int, StreamDesc *, int));
|
STATIC_PROTO (int console_post_process_read_char, (int, StreamDesc *));
|
||||||
STATIC_PROTO (int post_process_read_char, (int, StreamDesc *, int));
|
STATIC_PROTO (int post_process_read_char, (int, StreamDesc *));
|
||||||
#if USE_SOCKET
|
#if USE_SOCKET
|
||||||
STATIC_PROTO (int SocketPutc, (int, int));
|
STATIC_PROTO (int SocketPutc, (int, int));
|
||||||
STATIC_PROTO (int ConsoleSocketPutc, (int, int));
|
STATIC_PROTO (int ConsoleSocketPutc, (int, int));
|
||||||
@ -303,14 +303,14 @@ static int
|
|||||||
is_same_tty(YP_File f1, YP_File f2)
|
is_same_tty(YP_File f1, YP_File f2)
|
||||||
{
|
{
|
||||||
#if HAVE_TTYNAME
|
#if HAVE_TTYNAME
|
||||||
return(ttyname(YP_fileno(f1)) == ttyname(YP_fileno(f1)));
|
return(ttyname(YP_fileno(f1)) == ttyname(YP_fileno(f2)));
|
||||||
#else
|
#else
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
InitStdStream (int sno, SMALLUNSGN flags, YP_File file, Atom name)
|
InitStdStream (int sno, SMALLUNSGN flags, YP_File file)
|
||||||
{
|
{
|
||||||
StreamDesc *s = &Stream[sno];
|
StreamDesc *s = &Stream[sno];
|
||||||
s->u.file.file = file;
|
s->u.file.file = file;
|
||||||
@ -392,9 +392,9 @@ InitStdStream (int sno, SMALLUNSGN flags, YP_File file, Atom name)
|
|||||||
static void
|
static void
|
||||||
InitStdStreams (void)
|
InitStdStreams (void)
|
||||||
{
|
{
|
||||||
InitStdStream (StdInStream, Input_Stream_f, stdin, AtomUsrIn);
|
InitStdStream (StdInStream, Input_Stream_f, stdin);
|
||||||
InitStdStream (StdOutStream, Output_Stream_f, stdout, AtomUsrOut);
|
InitStdStream (StdOutStream, Output_Stream_f, stdout);
|
||||||
InitStdStream (StdErrStream, Output_Stream_f, stderr, AtomUsrErr);
|
InitStdStream (StdErrStream, Output_Stream_f, stderr);
|
||||||
Yap_c_input_stream = StdInStream;
|
Yap_c_input_stream = StdInStream;
|
||||||
Yap_c_output_stream = StdOutStream;
|
Yap_c_output_stream = StdOutStream;
|
||||||
Yap_c_error_stream = StdErrStream;
|
Yap_c_error_stream = StdErrStream;
|
||||||
@ -452,7 +452,7 @@ PlIOError (yap_error_number type, Term culprit, char *who)
|
|||||||
static int newline = TRUE;
|
static int newline = TRUE;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
count_output_char(int ch, StreamDesc *s, int sno)
|
count_output_char(int ch, StreamDesc *s)
|
||||||
{
|
{
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
{
|
{
|
||||||
@ -483,7 +483,7 @@ count_output_char(int ch, StreamDesc *s, int sno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
console_count_output_char(int ch, StreamDesc *s, int sno)
|
console_count_output_char(int ch, StreamDesc *s)
|
||||||
{
|
{
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
{
|
{
|
||||||
@ -612,7 +612,7 @@ FilePutc(int sno, int ch)
|
|||||||
fflush(s->u.file.file);
|
fflush(s->u.file.file);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
count_output_char(ch,s,sno);
|
count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ MemPutc(int sno, int ch)
|
|||||||
s->u.mem_string.buf = newbuf;
|
s->u.mem_string.buf = newbuf;
|
||||||
s->u.mem_string.max_size = new_max_size;
|
s->u.mem_string.max_size = new_max_size;
|
||||||
}
|
}
|
||||||
count_output_char(ch,s,sno);
|
count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ ConsoleSocketPutc (int sno, int ch)
|
|||||||
#else
|
#else
|
||||||
write(s->u.socket.fd, &c, sizeof(c));
|
write(s->u.socket.fd, &c, sizeof(c));
|
||||||
#endif
|
#endif
|
||||||
count_output_char(ch,s,sno);
|
count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ SocketPutc (int sno, int ch)
|
|||||||
#else
|
#else
|
||||||
write(s->u.socket.fd, &c, sizeof(c));
|
write(s->u.socket.fd, &c, sizeof(c));
|
||||||
#endif
|
#endif
|
||||||
console_count_output_char(ch,s,sno);
|
console_count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +724,7 @@ ConsolePipePutc (int sno, int ch)
|
|||||||
#else
|
#else
|
||||||
write(s->u.pipe.fd, &c, sizeof(c));
|
write(s->u.pipe.fd, &c, sizeof(c));
|
||||||
#endif
|
#endif
|
||||||
count_output_char(ch,s,sno);
|
count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ PipePutc (int sno, int ch)
|
|||||||
#else
|
#else
|
||||||
write(s->u.pipe.fd, &c, sizeof(c));
|
write(s->u.pipe.fd, &c, sizeof(c));
|
||||||
#endif
|
#endif
|
||||||
console_count_output_char(ch,s,sno);
|
console_count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ NullPutc (int sno, int ch)
|
|||||||
ch = '\n';
|
ch = '\n';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
count_output_char(ch,s,sno);
|
count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ ConsolePutc (int sno, int ch)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
putc (ch, s->u.file.file);
|
putc (ch, s->u.file.file);
|
||||||
console_count_output_char(ch,s,sno);
|
console_count_output_char(ch,s);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -860,12 +860,12 @@ ReadlinePutc (int sno, int ch)
|
|||||||
fputs( ReadlineBuf, Stream[sno].u.file.file);
|
fputs( ReadlineBuf, Stream[sno].u.file.file);
|
||||||
ReadlinePos = ReadlineBuf;
|
ReadlinePos = ReadlineBuf;
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
console_count_output_char(ch,Stream+sno,sno);
|
console_count_output_char(ch,Stream+sno);
|
||||||
return((int) '\n');
|
return((int) '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*ReadlinePos++ = ch;
|
*ReadlinePos++ = ch;
|
||||||
console_count_output_char(ch,Stream+sno,sno);
|
console_count_output_char(ch,Stream+sno);
|
||||||
return ((int) ch);
|
return ((int) ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,7 +893,7 @@ ReadlineGetc(int sno)
|
|||||||
Stream[FileAliases[0].alias_stream].u.file.name == Stream[sno].u.file.name) {
|
Stream[FileAliases[0].alias_stream].u.file.name == Stream[sno].u.file.name) {
|
||||||
/* don't just output the prompt */
|
/* don't just output the prompt */
|
||||||
while ((ch = *cptr++) != '\0') {
|
while ((ch = *cptr++) != '\0') {
|
||||||
console_count_output_char(ch,Stream+StdErrStream,StdErrStream);
|
console_count_output_char(ch,Stream+StdErrStream);
|
||||||
}
|
}
|
||||||
Yap_PrologMode |= ConsoleGetcMode;
|
Yap_PrologMode |= ConsoleGetcMode;
|
||||||
myrl_line = readline (Prompt);
|
myrl_line = readline (Prompt);
|
||||||
@ -920,7 +920,7 @@ ReadlineGetc(int sno)
|
|||||||
if (Yap_PrologMode & AbortMode) {
|
if (Yap_PrologMode & AbortMode) {
|
||||||
Yap_Error(PURE_ABORT, TermNil, "");
|
Yap_Error(PURE_ABORT, TermNil, "");
|
||||||
Yap_ErrorMessage = "Abort";
|
Yap_ErrorMessage = "Abort";
|
||||||
return(console_post_process_read_char(EOF, s, sno));
|
return(console_post_process_read_char(EOF, s));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@ -930,7 +930,7 @@ ReadlineGetc(int sno)
|
|||||||
strncpy (Prompt, RepAtom (*AtPrompt)->StrOfAE, MAX_PROMPT);
|
strncpy (Prompt, RepAtom (*AtPrompt)->StrOfAE, MAX_PROMPT);
|
||||||
/* window of vulnerability closed */
|
/* window of vulnerability closed */
|
||||||
if (myrl_line == NULL || myrl_line == (char *) EOF)
|
if (myrl_line == NULL || myrl_line == (char *) EOF)
|
||||||
return(console_post_process_read_char(EOF, s, sno));
|
return(console_post_process_read_char(EOF, s));
|
||||||
if (myrl_line[0] != '\0' && myrl_line[1] != '\0')
|
if (myrl_line[0] != '\0' && myrl_line[1] != '\0')
|
||||||
add_history (myrl_line);
|
add_history (myrl_line);
|
||||||
ttyptr = myrl_line;
|
ttyptr = myrl_line;
|
||||||
@ -941,7 +941,7 @@ ReadlineGetc(int sno)
|
|||||||
} else {
|
} else {
|
||||||
ch = *ttyptr++;
|
ch = *ttyptr++;
|
||||||
}
|
}
|
||||||
return(console_post_process_read_char(ch, s, sno));
|
return(console_post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LIBREADLINE */
|
#endif /* HAVE_LIBREADLINE */
|
||||||
@ -1046,14 +1046,14 @@ EOFGetc(int sno)
|
|||||||
|
|
||||||
/* check if we read a newline or an EOF */
|
/* check if we read a newline or an EOF */
|
||||||
static int
|
static int
|
||||||
post_process_read_char(int ch, StreamDesc *s, int sno)
|
post_process_read_char(int ch, StreamDesc *s)
|
||||||
{
|
{
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
++s->linecount;
|
++s->linecount;
|
||||||
++s->charcount;
|
++s->charcount;
|
||||||
s->linepos = 0;
|
s->linepos = 0;
|
||||||
/* don't convert if the stream is binary */
|
/* don't convert if the stream is binary */
|
||||||
if (!(Stream[sno].status & Binary_Stream_f))
|
if (!(s->status & Binary_Stream_f))
|
||||||
ch = 10;
|
ch = 10;
|
||||||
} else if (ch == EOF) {
|
} else if (ch == EOF) {
|
||||||
s->status |= Eof_Stream_f;
|
s->status |= Eof_Stream_f;
|
||||||
@ -1072,7 +1072,7 @@ post_process_read_char(int ch, StreamDesc *s, int sno)
|
|||||||
|
|
||||||
/* check if we read a newline or an EOF */
|
/* check if we read a newline or an EOF */
|
||||||
static int
|
static int
|
||||||
console_post_process_read_char(int ch, StreamDesc *s, int sno)
|
console_post_process_read_char(int ch, StreamDesc *s)
|
||||||
{
|
{
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
++s->linecount;
|
++s->linecount;
|
||||||
@ -1129,7 +1129,7 @@ SocketGetc(int sno)
|
|||||||
#endif
|
#endif
|
||||||
return(EOF);
|
return(EOF);
|
||||||
}
|
}
|
||||||
return(post_process_read_char(ch, s, sno));
|
return(post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1170,7 +1170,7 @@ ConsoleSocketGetc(int sno)
|
|||||||
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
||||||
return(EOF);
|
return(EOF);
|
||||||
}
|
}
|
||||||
return(console_post_process_read_char(ch, s, sno));
|
return(console_post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1199,7 +1199,7 @@ PipeGetc(int sno)
|
|||||||
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
||||||
return(EOF);
|
return(EOF);
|
||||||
}
|
}
|
||||||
return(post_process_read_char(ch, s, sno));
|
return(post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1249,7 +1249,7 @@ ConsolePipeGetc(int sno)
|
|||||||
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
Yap_Error(SYSTEM_ERROR, TermNil, "read");
|
||||||
return(EOF);
|
return(EOF);
|
||||||
}
|
}
|
||||||
return(console_post_process_read_char(ch, s, sno));
|
return(console_post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* standard routine, it should read from anything pointed by a FILE *.
|
/* standard routine, it should read from anything pointed by a FILE *.
|
||||||
@ -1262,7 +1262,7 @@ PlGetc (int sno)
|
|||||||
register int ch;
|
register int ch;
|
||||||
|
|
||||||
ch = YP_getc (s->u.file.file);
|
ch = YP_getc (s->u.file.file);
|
||||||
return(post_process_read_char(ch, s, sno));
|
return(post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read from memory */
|
/* read from memory */
|
||||||
@ -1279,7 +1279,7 @@ MemGetc (int sno)
|
|||||||
ch = s->u.mem_string.buf[spos];
|
ch = s->u.mem_string.buf[spos];
|
||||||
s->u.mem_string.pos = ++spos;
|
s->u.mem_string.pos = ++spos;
|
||||||
}
|
}
|
||||||
return(post_process_read_char(ch, s, sno));
|
return(post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I dispise this code!!!!! */
|
/* I dispise this code!!!!! */
|
||||||
@ -1333,13 +1333,13 @@ ConsoleGetc(int sno)
|
|||||||
if (Yap_PrologMode & AbortMode) {
|
if (Yap_PrologMode & AbortMode) {
|
||||||
Yap_Error(PURE_ABORT, TermNil, "");
|
Yap_Error(PURE_ABORT, TermNil, "");
|
||||||
Yap_ErrorMessage = "Abort";
|
Yap_ErrorMessage = "Abort";
|
||||||
return(console_post_process_read_char(EOF, s, sno));
|
return(console_post_process_read_char(EOF, s));
|
||||||
}
|
}
|
||||||
goto restart;
|
goto restart;
|
||||||
} else {
|
} else {
|
||||||
Yap_PrologMode &= ~ConsoleGetcMode;
|
Yap_PrologMode &= ~ConsoleGetcMode;
|
||||||
}
|
}
|
||||||
return(console_post_process_read_char(ch, s, sno));
|
return(console_post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reads a character from a buffer and does the rest */
|
/* reads a character from a buffer and does the rest */
|
||||||
@ -1371,7 +1371,7 @@ PlUnGetc (int sno)
|
|||||||
} else {
|
} else {
|
||||||
s->stream_getc = PlGetc;
|
s->stream_getc = PlGetc;
|
||||||
}
|
}
|
||||||
return(post_process_read_char(ch, s, sno));
|
return(post_process_read_char(ch, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2439,7 +2439,7 @@ Yap_CloseStreams (int loud)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
CloseStream(int sno)
|
CloseStream(int sno)
|
||||||
{
|
{
|
||||||
if (!(Stream[sno].status & (Null_Stream_f|Socket_Stream_f|InMemory_Stream_f|Pipe_Stream_f)))
|
if (!(Stream[sno].status & (Null_Stream_f|Socket_Stream_f|InMemory_Stream_f|Pipe_Stream_f)))
|
||||||
@ -5002,11 +5002,17 @@ p_same_file(void) {
|
|||||||
/* file does not exist, but was opened? Return -1 */
|
/* file does not exist, but was opened? Return -1 */
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
return(buf1.st_ino == buf2.st_ino &&
|
return(buf1.st_ino == buf2.st_ino
|
||||||
buf1.st_dev == buf2.st_dev);
|
#ifdef __LCC__
|
||||||
}
|
&& memcmp((const void *)&(buf1.st_dev),(const void *)&(buf2.st_dev),sizeof(buf1.st_dev)) == 0
|
||||||
|
#else
|
||||||
|
&& buf1.st_dev == buf2.st_dev
|
||||||
#endif
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#else
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -5015,6 +5021,7 @@ Yap_InitBackIO (void)
|
|||||||
Yap_InitCPredBack ("$current_stream", 3, 1, init_cur_s, cont_cur_s, SafePredFlag|SyncPredFlag);
|
Yap_InitCPredBack ("$current_stream", 3, 1, init_cur_s, cont_cur_s, SafePredFlag|SyncPredFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_InitIOPreds(void)
|
Yap_InitIOPreds(void)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* File: Yap.proto *
|
* File: Yap.proto *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Function declarations for YAP *
|
* comments: Function declarations for YAP *
|
||||||
* version: $Id: Yapproto.h,v 1.29 2002-11-18 18:13:25 vsc Exp $ *
|
* version: $Id: Yapproto.h,v 1.30 2002-12-06 20:03:25 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* prototype file for Yap */
|
/* prototype file for Yap */
|
||||||
@ -107,7 +107,7 @@ Int STD_PROTO(YAP_Execute,(struct pred_entry *, CPredicate));
|
|||||||
void STD_PROTO(Yap_addclause,(Term,CODEADDR,int,int));
|
void STD_PROTO(Yap_addclause,(Term,CODEADDR,int,int));
|
||||||
Term STD_PROTO(Yap_all_calls,(void));
|
Term STD_PROTO(Yap_all_calls,(void));
|
||||||
Atom STD_PROTO(Yap_ConsultingFile,(void));
|
Atom STD_PROTO(Yap_ConsultingFile,(void));
|
||||||
Int STD_PROTO(Yap_PredForCode,(CODEADDR, Atom *, Int *, SMALLUNSGN *));
|
Int STD_PROTO(Yap_PredForCode,(CODEADDR, Atom *, UInt *, SMALLUNSGN *));
|
||||||
void STD_PROTO(Yap_InitCdMgr,(void));
|
void STD_PROTO(Yap_InitCdMgr,(void));
|
||||||
#if EMACS
|
#if EMACS
|
||||||
int STD_PROTO(where_new_clause, (Prop, int));
|
int STD_PROTO(where_new_clause, (Prop, int));
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
#define DefHeapSpace MinHeapSpace
|
#define DefHeapSpace MinHeapSpace
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_NUMBERWORKERS 1
|
||||||
|
#define DEFAULT_SCHEDULERLOOP 10
|
||||||
|
#define DEFAULT_DELAYEDRELEASELOAD 3
|
||||||
|
|
||||||
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
|
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
@ -210,7 +214,7 @@ do_bootfile (char *bootfilename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_usage(const YAP_init_args *init_args)
|
print_usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"\n[ Valid switches for command line arguments: ]\n");
|
fprintf(stderr,"\n[ Valid switches for command line arguments: ]\n");
|
||||||
fprintf(stderr," -? Shows this screen\n");
|
fprintf(stderr," -? Shows this screen\n");
|
||||||
@ -224,10 +228,10 @@ print_usage(const YAP_init_args *init_args)
|
|||||||
DefTrailSpace, MinTrailSpace);
|
DefTrailSpace, MinTrailSpace);
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
fprintf(stderr," -w YapOr option: Number of workers (default: %d)\n",
|
fprintf(stderr," -w YapOr option: Number of workers (default: %d)\n",
|
||||||
init_args->NumberWorkers);
|
DEFAULT_NUMBERWORKERS);
|
||||||
fprintf(stderr," -sl YapOr option: Loop scheduler executions before look for hiden shared work (default: %d)\n", init_args->SchedulerLoop);
|
fprintf(stderr," -sl YapOr option: Loop scheduler executions before look for hiden shared work (default: %d)\n", DEFAULT_SCHEDULERLOOP);
|
||||||
fprintf(stderr," -d YapOr option: Value of delayed release of load (default: %d)\n",
|
fprintf(stderr," -d YapOr option: Value of delayed release of load (default: %d)\n",
|
||||||
init_args->DelayedReleaseLoad);
|
DEFAULT_DELAYEDRELEASELOAD);
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
}
|
}
|
||||||
@ -259,7 +263,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
argc--;
|
argc--;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
print_usage(iap);
|
print_usage();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
case 'w':
|
case 'w':
|
||||||
ssize = &(iap->NumberWorkers);
|
ssize = &(iap->NumberWorkers);
|
||||||
@ -341,7 +345,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,"[ YAP unrecoverable error: missing size in flag %s ]", argv[0]);
|
fprintf(stderr,"[ YAP unrecoverable error: missing size in flag %s ]", argv[0]);
|
||||||
print_usage(iap);
|
print_usage();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,7 +406,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
fprintf(stderr,"[ YAP unrecoverable error: unknown switch -%c ]\n", *p);
|
fprintf(stderr,"[ YAP unrecoverable error: unknown switch -%c ]\n", *p);
|
||||||
print_usage(iap);
|
print_usage();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -427,9 +431,9 @@ init_standard_system(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
iap->YapPrologRCFile = NULL;
|
iap->YapPrologRCFile = NULL;
|
||||||
iap->HaltAfterConsult = FALSE;
|
iap->HaltAfterConsult = FALSE;
|
||||||
iap->FastBoot = FALSE;
|
iap->FastBoot = FALSE;
|
||||||
iap->NumberWorkers = 1;
|
iap->NumberWorkers = DEFAULT_NUMBERWORKERS;
|
||||||
iap->SchedulerLoop = 10;
|
iap->SchedulerLoop = DEFAULT_SCHEDULERLOOP;
|
||||||
iap->DelayedReleaseLoad = 3;
|
iap->DelayedReleaseLoad = DEFAULT_DELAYEDRELEASELOAD;
|
||||||
iap->Argc = argc;
|
iap->Argc = argc;
|
||||||
iap->Argv = argv;
|
iap->Argv = argv;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* File: TermExt.h *
|
* File: TermExt.h *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Extensions to standard terms for YAP *
|
* comments: Extensions to standard terms for YAP *
|
||||||
* version: $Id: TermExt.h.m4,v 1.8 2002-11-18 18:17:04 vsc Exp $ *
|
* version: $Id: TermExt.h.m4,v 1.9 2002-12-06 20:03:26 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#if USE_OFFSETS
|
#if USE_OFFSETS
|
||||||
@ -82,7 +82,7 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
empty_ext = 0*sizeof(ext_op), /* default op, this should never be called */
|
empty_ext = 0*sizeof(ext_op), /* default op, this should never be called */
|
||||||
susp_ext = 1*sizeof(ext_op), /* support for delayable goals */
|
susp_ext = 1*sizeof(ext_op), /* support for delayable goals */
|
||||||
attvars_ext = 2*sizeof(ext_op), /* support for attributed variables */
|
attvars_ext = 2*sizeof(ext_op) /* support for attributed variables */
|
||||||
/* add your own extensions here */
|
/* add your own extensions here */
|
||||||
/* keep this one */
|
/* keep this one */
|
||||||
} exts;
|
} exts;
|
||||||
|
Reference in New Issue
Block a user