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:
vsc 2002-12-06 20:03:26 +00:00
parent 13e409c659
commit 1db1bb484e
9 changed files with 82 additions and 72 deletions

View File

@ -343,7 +343,7 @@ clean_atoms(void)
#endif
*patm = at->NextOfAE;
atm = at->NextOfAE;
agc_collected += Yap_SizeOfBlock((char *)at);
agc_collected += Yap_SizeOfBlock((CODEADDR)at);
Yap_FreeCodeSpace((char *)at);
}
}
@ -362,7 +362,7 @@ clean_atoms(void)
#endif
*patm = at->NextOfAE;
atm = at->NextOfAE;
agc_collected += Yap_SizeOfBlock((char *)at);
agc_collected += Yap_SizeOfBlock((CODEADDR)at);
Yap_FreeCodeSpace((char *)at);
}
}

View File

@ -81,7 +81,7 @@ STATIC_PROTO(Int p_call_count_reset, (void));
STATIC_PROTO(Int p_toggle_static_predicates_in_use, (void));
STATIC_PROTO(void list_all_predicates_in_use, (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 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:
{
Atom at;
Int arity;
UInt arity;
SMALLUNSGN mod;
if (PredForCode((CODEADDR)b_ptr->cp_ap, &at, &arity, &mod)) {
if (arity)
@ -2169,7 +2169,7 @@ p_toggle_static_predicates_in_use(void)
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;
int i = 1;
@ -2213,7 +2213,7 @@ code_in_pred(PredEntry *pp, Atom *pat, Int *parity, CODEADDR codeptr) {
}
static Int
PredForCode(CODEADDR codeptr, Atom *pat, Int *parity, SMALLUNSGN *pmodule) {
PredForCode(CODEADDR codeptr, Atom *pat, UInt *parity, SMALLUNSGN *pmodule) {
Int found = 0;
Int i_table;
@ -2232,7 +2232,7 @@ PredForCode(CODEADDR codeptr, Atom *pat, Int *parity, SMALLUNSGN *pmodule) {
}
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);
}
@ -2251,7 +2251,6 @@ p_pred_for_code(void) {
Yap_unify(ARG3,MkIntegerTerm(arity)) &&
Yap_unify(ARG4,ModuleName[module]) &&
Yap_unify(ARG5,MkIntegerTerm(cl)));
return(0);
}
static Int
@ -2445,7 +2444,7 @@ p_parent_pred(void)
/* This predicate is called from the debugger.
We assume a sequence of the form a -> b */
Atom at;
Int arity;
UInt arity;
SMALLUNSGN module;
if (!PredForCode((CODEADDR)P_before_spy, &at, &arity, &module)) {
return(Yap_unify(ARG1, MkIntTerm(0)) &&

View File

@ -193,7 +193,7 @@ static void
detect_bug_location(yamop *yap_pc, char *tp, int psize)
{
Atom pred_name;
Int pred_arity;
UInt pred_arity;
SMALLUNSGN pred_module;
Int cl;

View File

@ -22,7 +22,7 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
#include "yapio.h"
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_execute, (void));
STATIC_PROTO(Int p_execute0, (void));
@ -100,7 +100,7 @@ CallError(yap_error_number err, SMALLUNSGN mod)
}
static Int
CallClause(PredEntry *pen, unsigned int arity, Int position)
CallClause(PredEntry *pen, Int position)
{
CELL flags;
@ -159,7 +159,7 @@ CallClause(PredEntry *pen, unsigned int arity, Int position)
}
#else
if (!(ClauseCodeToClause(q)->ClFlags & InUseMask)) {
OPREG *opp = &(ClauseCodeToClause(q)->ClFlags);
CELL *opp = &(ClauseCodeToClause(q)->ClFlags);
TRAIL_CLREF(ClauseCodeToClause(q));
*opp |= InUseMask;
}
@ -1293,7 +1293,7 @@ p_at_execute(void)
return (FALSE);
/* N = arity; */
/* call may not define new system predicates!! */
return (CallClause(RepPredProp(pe), arity, IntOfTerm(t2)));
return (CallClause(RepPredProp(pe), IntOfTerm(t2)));
}
static int
@ -1349,7 +1349,7 @@ exec_absmi(int top)
}
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;
@ -1453,12 +1453,12 @@ Yap_execute_goal(Term t, int nargs, SMALLUNSGN mod)
if (IsAtomTerm(t)) {
CodeAdr = RepPredProp (pe)->CodeOfPred;
READ_UNLOCK(ppe->PRWLock);
out = do_goal(CodeAdr, 0, pt, nargs, FALSE);
out = do_goal(CodeAdr, 0, pt, FALSE);
} else {
Functor f = FunctorOfTerm(t);
CodeAdr = RepPredProp (pe)->CodeOfPred;
READ_UNLOCK(ppe->PRWLock);
out = do_goal(CodeAdr, ArityOfFunctor(f), pt, nargs, FALSE);
out = do_goal(CodeAdr, ArityOfFunctor(f), pt, FALSE);
}
if (out == 1) {
@ -1591,7 +1591,7 @@ Yap_RunTopGoal(Term t)
Yap_Error(SYSTEM_ERROR,TermNil,
"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);
}

View File

@ -1472,7 +1472,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
case _count_retry:
{
Atom at;
Int arity;
UInt arity;
SMALLUNSGN mod;
if (Yap_PredForCode((CODEADDR)gc_B->cp_ap, &at, &arity, &mod)) {
if (arity)

View File

@ -83,8 +83,8 @@ static char SccsId[] = "%W% %G%";
STATIC_PROTO (Int PlIOError, (yap_error_number, Term, char *));
STATIC_PROTO (int FilePutc, (int, int));
STATIC_PROTO (int MemPutc, (int, int));
STATIC_PROTO (int console_post_process_read_char, (int, StreamDesc *, int));
STATIC_PROTO (int 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 *));
#if USE_SOCKET
STATIC_PROTO (int SocketPutc, (int, int));
STATIC_PROTO (int ConsoleSocketPutc, (int, int));
@ -303,14 +303,14 @@ static int
is_same_tty(YP_File f1, YP_File f2)
{
#if HAVE_TTYNAME
return(ttyname(YP_fileno(f1)) == ttyname(YP_fileno(f1)));
return(ttyname(YP_fileno(f1)) == ttyname(YP_fileno(f2)));
#else
return(TRUE);
#endif
}
static void
InitStdStream (int sno, SMALLUNSGN flags, YP_File file, Atom name)
InitStdStream (int sno, SMALLUNSGN flags, YP_File file)
{
StreamDesc *s = &Stream[sno];
s->u.file.file = file;
@ -392,9 +392,9 @@ InitStdStream (int sno, SMALLUNSGN flags, YP_File file, Atom name)
static void
InitStdStreams (void)
{
InitStdStream (StdInStream, Input_Stream_f, stdin, AtomUsrIn);
InitStdStream (StdOutStream, Output_Stream_f, stdout, AtomUsrOut);
InitStdStream (StdErrStream, Output_Stream_f, stderr, AtomUsrErr);
InitStdStream (StdInStream, Input_Stream_f, stdin);
InitStdStream (StdOutStream, Output_Stream_f, stdout);
InitStdStream (StdErrStream, Output_Stream_f, stderr);
Yap_c_input_stream = StdInStream;
Yap_c_output_stream = StdOutStream;
Yap_c_error_stream = StdErrStream;
@ -452,7 +452,7 @@ PlIOError (yap_error_number type, Term culprit, char *who)
static int newline = TRUE;
static void
count_output_char(int ch, StreamDesc *s, int sno)
count_output_char(int ch, StreamDesc *s)
{
if (ch == '\n')
{
@ -483,7 +483,7 @@ count_output_char(int ch, StreamDesc *s, int sno)
}
static void
console_count_output_char(int ch, StreamDesc *s, int sno)
console_count_output_char(int ch, StreamDesc *s)
{
if (ch == '\n')
{
@ -612,7 +612,7 @@ FilePutc(int sno, int ch)
fflush(s->u.file.file);
}
#endif
count_output_char(ch,s,sno);
count_output_char(ch,s);
return ((int) ch);
}
@ -653,7 +653,7 @@ MemPutc(int sno, int ch)
s->u.mem_string.buf = newbuf;
s->u.mem_string.max_size = new_max_size;
}
count_output_char(ch,s,sno);
count_output_char(ch,s);
return ((int) ch);
}
@ -675,7 +675,7 @@ ConsoleSocketPutc (int sno, int ch)
#else
write(s->u.socket.fd, &c, sizeof(c));
#endif
count_output_char(ch,s,sno);
count_output_char(ch,s);
return ((int) ch);
}
@ -695,7 +695,7 @@ SocketPutc (int sno, int ch)
#else
write(s->u.socket.fd, &c, sizeof(c));
#endif
console_count_output_char(ch,s,sno);
console_count_output_char(ch,s);
return ((int) ch);
}
@ -724,7 +724,7 @@ ConsolePipePutc (int sno, int ch)
#else
write(s->u.pipe.fd, &c, sizeof(c));
#endif
count_output_char(ch,s,sno);
count_output_char(ch,s);
return ((int) ch);
}
@ -750,7 +750,7 @@ PipePutc (int sno, int ch)
#else
write(s->u.pipe.fd, &c, sizeof(c));
#endif
console_count_output_char(ch,s,sno);
console_count_output_char(ch,s);
return ((int) ch);
}
@ -764,7 +764,7 @@ NullPutc (int sno, int ch)
ch = '\n';
}
#endif
count_output_char(ch,s,sno);
count_output_char(ch,s);
return ((int) ch);
}
@ -780,7 +780,7 @@ ConsolePutc (int sno, int ch)
}
#endif
putc (ch, s->u.file.file);
console_count_output_char(ch,s,sno);
console_count_output_char(ch,s);
return ((int) ch);
}
@ -860,12 +860,12 @@ ReadlinePutc (int sno, int ch)
fputs( ReadlineBuf, Stream[sno].u.file.file);
ReadlinePos = ReadlineBuf;
if (ch == '\n') {
console_count_output_char(ch,Stream+sno,sno);
console_count_output_char(ch,Stream+sno);
return((int) '\n');
}
}
*ReadlinePos++ = ch;
console_count_output_char(ch,Stream+sno,sno);
console_count_output_char(ch,Stream+sno);
return ((int) ch);
}
@ -893,7 +893,7 @@ ReadlineGetc(int sno)
Stream[FileAliases[0].alias_stream].u.file.name == Stream[sno].u.file.name) {
/* don't just output the prompt */
while ((ch = *cptr++) != '\0') {
console_count_output_char(ch,Stream+StdErrStream,StdErrStream);
console_count_output_char(ch,Stream+StdErrStream);
}
Yap_PrologMode |= ConsoleGetcMode;
myrl_line = readline (Prompt);
@ -920,7 +920,7 @@ ReadlineGetc(int sno)
if (Yap_PrologMode & AbortMode) {
Yap_Error(PURE_ABORT, TermNil, "");
Yap_ErrorMessage = "Abort";
return(console_post_process_read_char(EOF, s, sno));
return(console_post_process_read_char(EOF, s));
}
continue;
} else {
@ -930,7 +930,7 @@ ReadlineGetc(int sno)
strncpy (Prompt, RepAtom (*AtPrompt)->StrOfAE, MAX_PROMPT);
/* window of vulnerability closed */
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')
add_history (myrl_line);
ttyptr = myrl_line;
@ -941,7 +941,7 @@ ReadlineGetc(int sno)
} else {
ch = *ttyptr++;
}
return(console_post_process_read_char(ch, s, sno));
return(console_post_process_read_char(ch, s));
}
#endif /* HAVE_LIBREADLINE */
@ -1046,14 +1046,14 @@ EOFGetc(int sno)
/* check if we read a newline or an EOF */
static int
post_process_read_char(int ch, StreamDesc *s, int sno)
post_process_read_char(int ch, StreamDesc *s)
{
if (ch == '\n') {
++s->linecount;
++s->charcount;
s->linepos = 0;
/* don't convert if the stream is binary */
if (!(Stream[sno].status & Binary_Stream_f))
if (!(s->status & Binary_Stream_f))
ch = 10;
} else if (ch == EOF) {
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 */
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') {
++s->linecount;
@ -1129,7 +1129,7 @@ SocketGetc(int sno)
#endif
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");
return(EOF);
}
return(console_post_process_read_char(ch, s, sno));
return(console_post_process_read_char(ch, s));
}
#endif
@ -1199,7 +1199,7 @@ PipeGetc(int sno)
Yap_Error(SYSTEM_ERROR, TermNil, "read");
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");
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 *.
@ -1262,7 +1262,7 @@ PlGetc (int sno)
register int ch;
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 */
@ -1279,7 +1279,7 @@ MemGetc (int sno)
ch = s->u.mem_string.buf[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!!!!! */
@ -1333,13 +1333,13 @@ ConsoleGetc(int sno)
if (Yap_PrologMode & AbortMode) {
Yap_Error(PURE_ABORT, TermNil, "");
Yap_ErrorMessage = "Abort";
return(console_post_process_read_char(EOF, s, sno));
return(console_post_process_read_char(EOF, s));
}
goto restart;
} else {
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 */
@ -1371,7 +1371,7 @@ PlUnGetc (int sno)
} else {
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)
{
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 */
return(FALSE);
}
return(buf1.st_ino == buf2.st_ino &&
buf1.st_dev == buf2.st_dev);
}
return(buf1.st_ino == buf2.st_ino
#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
);
}
#else
return(FALSE);
#endif
}
void
@ -5015,6 +5021,7 @@ Yap_InitBackIO (void)
Yap_InitCPredBack ("$current_stream", 3, 1, init_cur_s, cont_cur_s, SafePredFlag|SyncPredFlag);
}
void
Yap_InitIOPreds(void)
{

View File

@ -10,7 +10,7 @@
* File: Yap.proto *
* mods: *
* 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 */
@ -107,7 +107,7 @@ Int STD_PROTO(YAP_Execute,(struct pred_entry *, CPredicate));
void STD_PROTO(Yap_addclause,(Term,CODEADDR,int,int));
Term STD_PROTO(Yap_all_calls,(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));
#if EMACS
int STD_PROTO(where_new_clause, (Prop, int));

View File

@ -34,6 +34,10 @@
#define DefHeapSpace MinHeapSpace
#endif
#define DEFAULT_NUMBERWORKERS 1
#define DEFAULT_SCHEDULERLOOP 10
#define DEFAULT_DELAYEDRELEASELOAD 3
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
#ifdef HAVE_UNISTD_H
#undef HAVE_UNISTD_H
@ -210,7 +214,7 @@ do_bootfile (char *bootfilename)
}
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," -? Shows this screen\n");
@ -224,10 +228,10 @@ print_usage(const YAP_init_args *init_args)
DefTrailSpace, MinTrailSpace);
#ifdef YAPOR
fprintf(stderr," -w YapOr option: Number of workers (default: %d)\n",
init_args->NumberWorkers);
fprintf(stderr," -sl YapOr option: Loop scheduler executions before look for hiden shared work (default: %d)\n", init_args->SchedulerLoop);
DEFAULT_NUMBERWORKERS);
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",
init_args->DelayedReleaseLoad);
DEFAULT_DELAYEDRELEASELOAD);
#endif
fprintf(stderr,"\n");
}
@ -259,7 +263,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
argc--;
break;
case '?':
print_usage(iap);
print_usage();
exit(EXIT_SUCCESS);
case 'w':
ssize = &(iap->NumberWorkers);
@ -341,7 +345,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
else
{
fprintf(stderr,"[ YAP unrecoverable error: missing size in flag %s ]", argv[0]);
print_usage(iap);
print_usage();
exit(EXIT_FAILURE);
}
}
@ -402,7 +406,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
default:
{
fprintf(stderr,"[ YAP unrecoverable error: unknown switch -%c ]\n", *p);
print_usage(iap);
print_usage();
exit(EXIT_FAILURE);
}
}
@ -427,9 +431,9 @@ init_standard_system(int argc, char *argv[], YAP_init_args *iap)
iap->YapPrologRCFile = NULL;
iap->HaltAfterConsult = FALSE;
iap->FastBoot = FALSE;
iap->NumberWorkers = 1;
iap->SchedulerLoop = 10;
iap->DelayedReleaseLoad = 3;
iap->NumberWorkers = DEFAULT_NUMBERWORKERS;
iap->SchedulerLoop = DEFAULT_SCHEDULERLOOP;
iap->DelayedReleaseLoad = DEFAULT_DELAYEDRELEASELOAD;
iap->Argc = argc;
iap->Argv = argv;

View File

@ -10,7 +10,7 @@
* File: TermExt.h *
* mods: *
* 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
@ -82,7 +82,7 @@ typedef struct {
typedef enum {
empty_ext = 0*sizeof(ext_op), /* default op, this should never be called */
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 */
/* keep this one */
} exts;