This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/OPTYap/opt.misc.c
ricroc de17f5cca4 Adding tabling support for mixed strategy evaluation (batched and local scheduling)
UPDATE: compilation flags -DTABLING_BATCHED_SCHEDULING and -DTABLING_LOCAL_SCHEDULING removed. To support tabling use -DTABLING in the Makefile or --enable-tabling in configure.
  NEW: yap_flag(tabling_mode,MODE) changes the tabling execution mode of all tabled predicates to MODE (batched, local or default).
  NEW: tabling_mode(PRED,MODE) changes the default tabling execution mode of predicate PRED to MODE (batched or local).


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1268 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2005-04-07 17:56:58 +00:00

109 lines
2.1 KiB
C

/* ------------------ **
** Includes **
** ------------------ */
#include "Yap.h"
#if defined(YAPOR) || defined(TABLING)
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "Yatom.h"
#include "yapio.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_STDARG_H
#include <stdarg.h>
#endif
/* ------------------------------------------- **
** Global variables are defined here **
** ------------------------------------------- */
struct local_data *LOCAL;
#ifdef YAPOR
struct worker WORKER;
#endif /* YAPOR */
/* -------------------------- **
** Global functions **
** -------------------------- */
#ifdef TABLING
void abort_yaptab(const char *msg, ...) {
va_list args;
va_start(args, msg);
fprintf(stderr, "%% YAPTAB FATAL ERROR: ");
vfprintf(stderr, msg, args);
fprintf(stderr, "\n");
exit (1);
}
#endif /* TABLING */
#ifdef YAPOR
void abort_yapor(const char *msg, ...) {
va_list args;
va_start(args, msg);
fprintf(stderr, "%% YAPOR FATAL ERROR: ");
vfprintf(stderr, msg, args);
fprintf(stderr, " (worker %d exiting...)\n", worker_id);
unmap_memory();
exit (1);
}
#endif /* YAPOR */
void itos(int i, char *s) {
int n,r,j;
n = 10;
while (n <= i) n *= 10;
j = 0;
while (n > 1) {
n = n / 10;
r = i / n;
i = i - r * n;
s[j++] = r + '0';
}
s[j] = 0;
return;
}
void information_message(const char *mesg,...) {
va_list args;
va_start(args, mesg);
fprintf(stderr, "[ ");
vfprintf(stderr, mesg, args);
fprintf(stderr, " ]\n");
return;
}
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
void error_message(const char *mesg, ...) {
va_list args;
va_start(args, mesg);
#ifdef YAPOR
LOCK(GLOBAL_LOCKS_stderr_messages);
#endif /* YAPOR */
fprintf(stderr, "[ ");
#ifdef YAPOR
fprintf(stderr, "W%d: ", worker_id);
#endif /* YAPOR */
fprintf(stderr, "Potencial Error -> ");
vfprintf(stderr, mesg, args);
fprintf(stderr, " ]\n");
#ifdef YAPOR
UNLOCK(GLOBAL_LOCKS_stderr_messages);
#endif /* YAPOR */
return;
}
#endif /* YAPOR_ERRORS || TABLING_ERRORS */
#endif /* YAPOR || TABLING */