Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
Conflicts: library/dialect/swi/fli/swi.c packages/real
This commit is contained in:
commit
9e2a2b75b9
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -51,4 +51,4 @@
|
||||
url = git://git.code.sf.net/p/yap/ltx2htm
|
||||
[submodule "packages/raptor"]
|
||||
path = packages/raptor
|
||||
url = https://github.com/davidvaz/yap-raptor.git
|
||||
url = git://git.code.sf.net/p/yap/raptor
|
||||
|
@ -26,12 +26,12 @@ static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
#include "YapHeap.h"
|
||||
#include "pl-utf8.h"
|
||||
|
||||
#ifdef USE_GMP
|
||||
|
||||
#include "eval.h"
|
||||
#include "alloc.h"
|
||||
#include "pl-utf8.h"
|
||||
|
||||
Term
|
||||
Yap_MkBigIntTerm(MP_INT *big)
|
||||
|
@ -3225,21 +3225,6 @@ YAP_Init(YAP_init_args *yap_init)
|
||||
*/
|
||||
yap_flags[HALT_AFTER_CONSULT_FLAG] = yap_init->HaltAfterConsult;
|
||||
}
|
||||
#ifdef MYDDAS_MYSQL
|
||||
if (yap_init->myddas) {
|
||||
Yap_PutValue(AtomMyddasGoal,MkIntegerTerm(yap_init->myddas));
|
||||
|
||||
/* Mandatory Fields */
|
||||
Yap_PutValue(AtomMyddasUser,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_user)));
|
||||
Yap_PutValue(AtomMyddasDB,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_db)));
|
||||
|
||||
/* Non-Mandatory Fields */
|
||||
if (yap_init->myddas_pass != NULL)
|
||||
Yap_PutValue(AtomMyddasPass,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_pass)));
|
||||
if (yap_init->myddas_host != NULL)
|
||||
Yap_PutValue(AtomMyddasHost,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_host)));
|
||||
}
|
||||
#endif
|
||||
if (yap_init->YapPrologTopLevelGoal) {
|
||||
Yap_PutValue(AtomTopLevelGoal, MkAtomTerm(Yap_LookupAtom(yap_init->YapPrologTopLevelGoal)));
|
||||
}
|
||||
|
6
C/exec.c
6
C/exec.c
@ -25,9 +25,6 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
|
||||
#ifdef CUT_C
|
||||
#include "cut_c.h"
|
||||
#endif
|
||||
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
|
||||
#include "myddas.h"
|
||||
#endif
|
||||
|
||||
static Int CallPredicate(PredEntry *, choiceptr, yamop * CACHE_TYPE);
|
||||
static Int EnterCreepMode(Term, Term CACHE_TYPE);
|
||||
@ -1804,9 +1801,6 @@ Yap_InitYaamRegs( int myworker_id )
|
||||
Yap_InitPreAllocCodeSpace( myworker_id );
|
||||
#ifdef CUT_C
|
||||
cut_c_initialize( myworker_id );
|
||||
#endif
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
Yap_REGS.MYDDAS_GLOBAL_POINTER = NULL;
|
||||
#endif
|
||||
Yap_PrepGoal(0, NULL, NULL PASS_REGS);
|
||||
#ifdef TABLING
|
||||
|
7
C/init.c
7
C/init.c
@ -1234,10 +1234,6 @@ InitVersion(void)
|
||||
{
|
||||
Yap_PutValue(AtomVersionNumber,
|
||||
MkAtomTerm(Yap_LookupAtom(YAP_SVERSION)));
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
Yap_PutValue(AtomMyddasVersionName,
|
||||
MkAtomTerm(Yap_LookupAtom(MYDDAS_VERSION)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1402,9 +1398,6 @@ Yap_exit (int value)
|
||||
#ifdef LOW_PROF
|
||||
remove("PROFPREDS");
|
||||
remove("PROFILING");
|
||||
#endif
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
Yap_MYDDAS_delete_all_myddas_structs();
|
||||
#endif
|
||||
run_halt_hooks(value);
|
||||
Yap_ShutdownLoadForeign();
|
||||
|
@ -419,7 +419,7 @@ int
|
||||
get_string_text(word w, PL_chars_t *text ARG_LD)
|
||||
{
|
||||
text->text.t = (char *)StringOfTerm(w);
|
||||
text->encoding = ENC_ISO_LATIN_1;
|
||||
text->encoding = ENC_UTF8;
|
||||
text->length = strlen(text->text.t);
|
||||
text->storage = PL_CHARS_STACK;
|
||||
text->canonical = TRUE;
|
||||
|
21
C/stdpreds.c
21
C/stdpreds.c
@ -1961,15 +1961,6 @@ Yap_InitBackCPreds(void)
|
||||
Yap_InitBackIO();
|
||||
Yap_InitBackDB();
|
||||
Yap_InitUserBacks();
|
||||
#if defined MYDDAS_MYSQL && defined CUT_C
|
||||
Yap_InitBackMYDDAS_MySQLPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_ODBC && defined CUT_C
|
||||
Yap_InitBackMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
|
||||
Yap_InitBackMYDDAS_SharedPreds();
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef void (*Proc)(void);
|
||||
@ -2078,18 +2069,6 @@ Yap_InitCPreds(void)
|
||||
Yap_InitUnify();
|
||||
Yap_InitQLY();
|
||||
Yap_InitQLYR();
|
||||
#if defined CUT_C && defined MYDDAS_MYSQL
|
||||
Yap_InitMYDDAS_MySQLPreds();
|
||||
#endif
|
||||
#if defined CUT_C && defined MYDDAS_ODBC
|
||||
Yap_InitMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
|
||||
Yap_InitMYDDAS_SharedPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE
|
||||
Yap_InitMYDDAS_TopLevelPreds();
|
||||
#endif
|
||||
Yap_udi_init();
|
||||
Yap_udi_Interval_init();
|
||||
Yap_InitSignalCPreds();
|
||||
|
@ -140,12 +140,12 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
char *mname;
|
||||
Int arity;
|
||||
/* extern int gc_calls; */
|
||||
|
||||
vsc_count++;
|
||||
return;
|
||||
|
||||
// if (!worker_id) return;
|
||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
sc = Yap_heap_regs;
|
||||
vsc_count++;
|
||||
//if (vsc_count == 54) jmp_deb(1);
|
||||
// fprintf(stderr,"B=%p ", B);
|
||||
#ifdef THREADS
|
||||
|
55
C/yap-args.c
55
C/yap-args.c
@ -165,9 +165,6 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
int BootMode = YAP_FULL_BOOT_FROM_PROLOG;
|
||||
#else
|
||||
int BootMode = YAP_BOOT_FROM_SAVED_CODE;
|
||||
#endif
|
||||
#ifdef MYDDAS_MYSQL
|
||||
char *myddas_temp;
|
||||
#endif
|
||||
unsigned long int *ssize;
|
||||
|
||||
@ -199,13 +196,6 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
iap->Argc = argc;
|
||||
iap->Argv = argv;
|
||||
iap->def_c = 0;
|
||||
#ifdef MYDDAS_MYSQL
|
||||
iap->myddas = 0;
|
||||
iap->myddas_user = NULL;
|
||||
iap->myddas_pass = NULL;
|
||||
iap->myddas_db = NULL;
|
||||
iap->myddas_host = NULL;
|
||||
#endif
|
||||
iap->ErrorNo = 0;
|
||||
iap->ErrorCause = NULL;
|
||||
iap->QuietMode = FALSE;
|
||||
@ -259,36 +249,6 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#ifdef MYDDAS_MYSQL
|
||||
case 'm':
|
||||
if (strncmp(p,"myddas_",7) == 0)
|
||||
{
|
||||
iap->myddas = 1;
|
||||
if ((*argv)[0] == '\0')
|
||||
myddas_temp = *argv;
|
||||
else {
|
||||
argc--;
|
||||
if (argc == 0) {
|
||||
fprintf(stderr," [ YAP unrecoverable error: missing file name with option 'l' ]\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
argv++;
|
||||
myddas_temp = *argv;
|
||||
}
|
||||
|
||||
if (strstr(p,"user") != NULL)
|
||||
iap->myddas_user = myddas_temp;
|
||||
else if (strstr(p,"pass") != NULL)
|
||||
iap->myddas_pass = myddas_temp;
|
||||
else if (strstr(p,"db") != NULL)
|
||||
iap->myddas_db = myddas_temp;
|
||||
else if (strstr(p,"host") != NULL)
|
||||
iap->myddas_host = myddas_temp;
|
||||
else
|
||||
goto myddas_error_print;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// execution mode
|
||||
case 'J':
|
||||
switch (p[1]) {
|
||||
@ -498,7 +458,7 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
iap->PrologShouldHandleInterrupts = FALSE;
|
||||
break;
|
||||
}
|
||||
goto myddas_error_print;
|
||||
break;
|
||||
case 'p':
|
||||
if ((*argv)[0] == '\0')
|
||||
iap->YapPrologAddPath = *argv;
|
||||
@ -540,11 +500,7 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
break;
|
||||
default:
|
||||
{
|
||||
myddas_error_print :
|
||||
fprintf(stderr,"[ YAP unrecoverable error: unknown switch -%c ]\n", *p);
|
||||
#ifdef MYDDAS_MYSQL
|
||||
myddas_error :
|
||||
#endif
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -553,15 +509,6 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
iap->SavedState = p;
|
||||
}
|
||||
}
|
||||
#ifdef MYDDAS_MYSQL
|
||||
/* Check MYDDAS Arguments */
|
||||
if (iap->myddas_user != NULL || iap->myddas_pass != NULL
|
||||
|| iap->myddas_db != NULL || iap->myddas_host != NULL)
|
||||
if (iap->myddas_user == NULL || iap->myddas_db == NULL){
|
||||
fprintf(stderr,"[ YAP unrecoverable error: Missing Mandatory Arguments for MYDDAS ]\n");
|
||||
goto myddas_error;
|
||||
}
|
||||
#endif
|
||||
GD->cmdline.appl_argc = argc;
|
||||
GD->cmdline.appl_argv = argv;
|
||||
return BootMode;
|
||||
|
3
H/Regs.h
3
H/Regs.h
@ -20,9 +20,6 @@
|
||||
#include "cut_c.h"
|
||||
#endif
|
||||
|
||||
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
|
||||
#include "myddas.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MaxTemps 512
|
||||
|
@ -261,7 +261,6 @@ CpFloatUnaligned (CELL * ptr)
|
||||
INLINE_ONLY inline EXTERN Term
|
||||
__MkFloatTerm (Float dbl USES_REGS)
|
||||
{
|
||||
CACHE_REGS
|
||||
return (Term) ((AlignGlobalForDouble ( PASS_REGS1 ), HR[0] =
|
||||
(CELL) FunctorDouble, *(Float *) (HR + 1) = dbl, HR[3] =
|
||||
EndSpecials, HR +=
|
||||
|
74
H/Yapproto.h
74
H/Yapproto.h
@ -426,80 +426,6 @@ Int Yap_SkipList(Term *, Term **);
|
||||
void Yap_plwrite(Term, void *, int, int, int);
|
||||
int Yap_FormatFloat( Float f, const char *s, size_t sz );
|
||||
|
||||
/* MYDDAS */
|
||||
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
|
||||
/* myddas_initialization.c */
|
||||
MYDDAS_GLOBAL myddas_init_initialize_myddas(void);
|
||||
MYDDAS_UTIL_CONNECTION myddas_init_initialize_connection(void *,void *,MYDDAS_UTIL_CONNECTION);
|
||||
MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(char *, int, char *,MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
#ifdef MYDDAS_STATS
|
||||
/* myddas_statistics.c */
|
||||
MYDDAS_GLOBAL myddas_stats_initialize_global_stats(MYDDAS_GLOBAL);
|
||||
MYDDAS_STATS_STRUCT myddas_stats_initialize_connection_stats(void);
|
||||
void myddas_stats_delete_stats_list(MYDDAS_STATS_STRUCT);
|
||||
#endif /* MYDDAS_STATS */
|
||||
|
||||
#ifdef MYDDAS_MYSQL
|
||||
/* myddas_util.c */
|
||||
void myddas_util_table_write(MYSQL_RES *);
|
||||
#endif
|
||||
Short myddas_util_connection_type(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_connection(void *,void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_search_connection(void *);
|
||||
void myddas_util_delete_connection(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_predicate(char * ,Int , char *,void *);
|
||||
MYDDAS_UTIL_PREDICATE myddas_util_search_predicate(char * ,Int , char *);
|
||||
void myddas_util_delete_predicate(MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
/* Get's the number of queries to save */
|
||||
UInt myddas_util_get_total_multi_queries_number(MYDDAS_UTIL_CONNECTION);
|
||||
void myddas_util_set_total_multi_queries_number(MYDDAS_UTIL_CONNECTION,UInt);
|
||||
#ifdef MYDDAS_ODBC
|
||||
/* Return enviromment identifier*/
|
||||
SQLHENV myddas_util_get_odbc_enviromment(SQLHDBC);
|
||||
#endif
|
||||
|
||||
void * myddas_util_get_list_pred(MYDDAS_UTIL_CONNECTION);
|
||||
void * myddas_util_get_pred_next(void *);
|
||||
char * myddas_util_get_pred_module(void *);
|
||||
char * myddas_util_get_pred_name(void *);
|
||||
MyddasInt myddas_util_get_pred_arity(void *);
|
||||
//DELETE THIS WHEN DB_STATS IS COMPLETED
|
||||
MyddasInt get_myddas_top(void);
|
||||
|
||||
#ifdef DEBUG
|
||||
void check_int(void);
|
||||
#endif
|
||||
|
||||
#endif /* MYDDAS_MYSQL || MYDDAS_ODBC */
|
||||
|
||||
/* myddas_mysql.c */
|
||||
#if defined MYDDAS_MYSQL
|
||||
void Yap_InitMYDDAS_MySQLPreds(void);
|
||||
void Yap_InitBackMYDDAS_MySQLPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_odbc.c */
|
||||
#if defined MYDDAS_ODBC
|
||||
void Yap_InitMYDDAS_ODBCPreds(void);
|
||||
void Yap_InitBackMYDDAS_ODBCPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_shared.c */
|
||||
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
|
||||
void Yap_MYDDAS_delete_all_myddas_structs(void);
|
||||
void Yap_InitMYDDAS_SharedPreds(void);
|
||||
void Yap_InitBackMYDDAS_SharedPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_top_level.c */
|
||||
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL //&& defined HAVE_LIBREADLINE
|
||||
void Yap_InitMYDDAS_TopLevelPreds(void);
|
||||
#endif
|
||||
|
||||
/* yap2swi.c */
|
||||
void Yap_swi_install(void);
|
||||
void Yap_InitSWIHash(void);
|
||||
|
2
H/eval.h
2
H/eval.h
@ -366,7 +366,7 @@ add_int(Int i, Int j USES_REGS)
|
||||
overflow:
|
||||
return Yap_gmp_add_ints(i, j);
|
||||
#else
|
||||
RINT(x);
|
||||
RINT(i+j);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
53
Makefile.in
53
Makefile.in
@ -60,7 +60,7 @@ YAPSTARTUP=startup.yss
|
||||
#
|
||||
CC=@CC@
|
||||
MPI_CC=@MPI_CC@
|
||||
CPPFLAGS=@CPPFLAGS@ -I. -I$(srcdir)/H -I$(srcdir)/include -I$(srcdir)/os -I$(srcdir)/OPTYap -I$(srcdir)/BEAM -I$(srcdir)/MYDDAS
|
||||
CPPFLAGS=@CPPFLAGS@ -I. -I$(srcdir)/H -I$(srcdir)/include -I$(srcdir)/os -I$(srcdir)/OPTYap -I$(srcdir)/BEAM
|
||||
EXECUTABLE_CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
||||
CFLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
||||
C_INTERF_FLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS) -I$(srcdir)/include
|
||||
@ -202,11 +202,7 @@ HEADERS = \
|
||||
$(srcdir)/OPTYap/locks_pthread.h \
|
||||
$(srcdir)/H/cut_c.h \
|
||||
$(srcdir)/H/iatoms.h $(srcdir)/H/ratoms.h $(srcdir)/H/tatoms.h \
|
||||
$(srcdir)/library/dialect/swi/fli/swi.h \
|
||||
$(srcdir)/MYDDAS/myddas.h $(srcdir)/MYDDAS/myddas_structs.h \
|
||||
$(srcdir)/MYDDAS/myddas_statistics.h \
|
||||
$(srcdir)/MYDDAS/myddas_statistics_structs.h \
|
||||
$(srcdir)/MYDDAS/myddas_wkb.h $(srcdir)/MYDDAS/myddas_wkb2prolog.h
|
||||
$(srcdir)/library/dialect/swi/fli/swi.h
|
||||
|
||||
IOLIB_SOURCES=$(srcdir)/os/pl-buffer.c $(srcdir)/os/pl-ctype.c \
|
||||
$(srcdir)/os/pl-codelist.c \
|
||||
@ -285,15 +281,7 @@ C_SOURCES= \
|
||||
# $(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c \
|
||||
$(srcdir)/C/cut_c.c \
|
||||
$(srcdir)/library/dialect/swi/fli/swi.c \
|
||||
$(srcdir)/library/dialect/swi/fli/blobs.c \
|
||||
$(srcdir)/MYDDAS/myddas_mysql.c \
|
||||
$(srcdir)/MYDDAS/myddas_odbc.c \
|
||||
$(srcdir)/MYDDAS/myddas_util.c \
|
||||
$(srcdir)/MYDDAS/myddas_initialization.c \
|
||||
$(srcdir)/MYDDAS/myddas_shared.c \
|
||||
$(srcdir)/MYDDAS/myddas_statistics.c \
|
||||
$(srcdir)/MYDDAS/myddas_top_level.c \
|
||||
$(srcdir)/MYDDAS/myddas_wkb2prolog.c
|
||||
$(srcdir)/library/dialect/swi/fli/blobs.c
|
||||
|
||||
PLCONS_SOURCES = \
|
||||
$(srcdir)/console/LGPL/pl-nt.c \
|
||||
@ -369,9 +357,7 @@ ENGINE_OBJECTS = \
|
||||
exec.o exo.o exo_udi.o globals.o gmp_support.o gprof.o grow.o \
|
||||
heapgc.o index.o init.o inlines.o \
|
||||
iopreds.o depth_bound.o mavar.o \
|
||||
myddas_mysql.o myddas_odbc.o myddas_shared.o myddas_initialization.o \
|
||||
myddas_util.o myddas_statistics.o myddas_top_level.o \
|
||||
myddas_wkb2prolog.o modules.o other.o \
|
||||
modules.o other.o \
|
||||
parser.o qlyr.o qlyw.o range.o \
|
||||
save.o scanner.o signals.o text.o sort.o stdpreds.o \
|
||||
sysbits.o threads.o tracer.o \
|
||||
@ -493,30 +479,6 @@ mpi.o: $(srcdir)/library/mpi/mpi.c config.h
|
||||
mpe.o: $(srcdir)/library/mpi/mpe.c config.h
|
||||
$(MPI_CC) -c $(CFLAGS) $(srcdir)/library/mpi/mpe.c -o $@
|
||||
|
||||
myddas_mysql.o: $(srcdir)/MYDDAS/myddas_mysql.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_mysql.c -o $@
|
||||
|
||||
myddas_odbc.o: $(srcdir)/MYDDAS/myddas_odbc.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_odbc.c -o $@
|
||||
|
||||
myddas_shared.o: $(srcdir)/MYDDAS/myddas_shared.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_shared.c -o $@
|
||||
|
||||
myddas_util.o: $(srcdir)/MYDDAS/myddas_util.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_util.c -o $@
|
||||
|
||||
myddas_initialization.o: $(srcdir)/MYDDAS/myddas_initialization.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_initialization.c -o $@
|
||||
|
||||
myddas_top_level.o: $(srcdir)/MYDDAS/myddas_top_level.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_top_level.c -o $@
|
||||
|
||||
myddas_wkb2prolog.o: $(srcdir)/MYDDAS/myddas_wkb2prolog.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_wkb2prolog.c -o $@
|
||||
|
||||
myddas_statistics.o: $(srcdir)/MYDDAS/myddas_statistics.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_statistics.c -o $@
|
||||
|
||||
or.memory.o: $(srcdir)/OPTYap/or.memory.c config.h
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.memory.c -o $@
|
||||
|
||||
@ -741,6 +703,7 @@ all: startup.yss
|
||||
@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE))
|
||||
@ENABLE_PYTHON@ @INSTALL_DLLS@ (cd packages/python; $(MAKE))
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE))
|
||||
@ENABLE_MYDDAS@ @INSTALL_DLLS@ (cd packages/myddas; $(MAKE))
|
||||
|
||||
startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES)
|
||||
-rm -f startup.yss
|
||||
@ -811,7 +774,8 @@ install_unix: startup.yss @YAPLIB@
|
||||
@ENABLE_REAL@ @INSTALL_DLLS@ (cd packages/real; $(MAKE) install)
|
||||
@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE) install)
|
||||
@ENABLE_PYTHON@ @INSTALL_DLLS@ (cd packages/python; $(MAKE) install)
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE))
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE) install)
|
||||
@ENABLE_MYDDAS@ @INSTALL_DLLS@ (cd packages/myddas; $(MAKE) install)
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)/src
|
||||
$(INSTALL) $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/src
|
||||
@ -827,7 +791,6 @@ install_unix: startup.yss @YAPLIB@
|
||||
@ENABLE_RAPTOR@ @INSTALL_DLLS@ (cd packages/raptor; $(MAKE) install)
|
||||
@ENABLE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install)
|
||||
@ENABLE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) install)
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE) install)
|
||||
|
||||
|
||||
install_win32: startup.yss @ENABLE_WINCONSOLE@ yap-win@EXEC_SUFFIX@
|
||||
@ -887,6 +850,7 @@ install_win32: startup.yss @ENABLE_WINCONSOLE@ yap-win@EXEC_SUFFIX@
|
||||
@ENABLE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install)
|
||||
@ENABLE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) install)
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE) install)
|
||||
@ENABLE_MYDDAS@ @INSTALL_DLLS@ (cd packages/myddas; $(MAKE) install)
|
||||
|
||||
install_library: @YAPLIB@
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||
@ -961,6 +925,7 @@ clean: clean_docs
|
||||
@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE) clean)
|
||||
@ENABLE_PYTHON@ @INSTALL_DLLS@ (cd packages/python; $(MAKE) clean)
|
||||
@ENABLE_CUDA@ @INSTALL_DLLS@ (cd packages/cuda; $(MAKE) clean)
|
||||
@ENABLE_MYDDAS@ @INSTALL_DLLS@ (cd packages/myddas; $(MAKE) clean)
|
||||
|
||||
|
||||
|
||||
|
@ -356,9 +356,9 @@ sync_with_p:
|
||||
#ifndef TABLING
|
||||
REMOTE_reply_signal(worker_p) = worker_ready;
|
||||
#endif /* TABLING */
|
||||
TR = (tr_fr_ptr) LOCAL_end_trail_copy;
|
||||
LOCAL_reply_signal = worker_ready;
|
||||
PUT_IN_REQUESTABLE(worker_id);
|
||||
TR = (tr_fr_ptr) LOCAL_end_trail_copy;
|
||||
#ifdef TABLING
|
||||
adjust_freeze_registers();
|
||||
#endif /* TABLING */
|
||||
|
22
configure.in
22
configure.in
@ -751,12 +751,6 @@ else
|
||||
ENABLE_ZLIB="@# "
|
||||
fi
|
||||
|
||||
if test -e "$srcdir"/packages/raptor/Makefile.in; then
|
||||
ENABLE_RAPTOR=""
|
||||
else
|
||||
ENABLE_RAPTOR="@# "
|
||||
fi
|
||||
|
||||
if test "$cross_compiling" = "yes"
|
||||
then
|
||||
YAP_EXTRAS=
|
||||
@ -1811,7 +1805,7 @@ fi
|
||||
|
||||
|
||||
|
||||
m4_include([library/MYDDAS/configure.in])
|
||||
m4_include([packages/myddas/configure.in])
|
||||
|
||||
if test "$ENABLE_CLIB" = ""
|
||||
then
|
||||
@ -1899,9 +1893,8 @@ fi
|
||||
|
||||
m4_include([packages/gecode/configure.in])
|
||||
|
||||
if test "$ENABLE_RAPTOR" = ""
|
||||
then
|
||||
m4_include([packages/raptor/configure.in])
|
||||
if test -e "$srcdir"/packages/raptor/Makefile.in; then
|
||||
m4_include([packages/raptor/configure.in])
|
||||
fi
|
||||
|
||||
m4_include([library/lammpi/configure.in])
|
||||
@ -1954,6 +1947,7 @@ mkdir -p packages/jpl/examples
|
||||
mkdir -p packages/jpl/examples/java
|
||||
mkdir -p packages/ltx2htm
|
||||
mkdir -p packages/meld
|
||||
mkdir -p packages/myddas
|
||||
mkdir -p packages/PLStream
|
||||
mkdir -p packages/PLStream/libtai
|
||||
mkdir -p packages/pldoc
|
||||
@ -2084,6 +2078,10 @@ if test "$ENABLE_REAL" = ""; then
|
||||
AC_CONFIG_FILES([packages/real/Makefile])
|
||||
fi
|
||||
|
||||
if test "$ENABLE_MYDDAS" = ""; then
|
||||
AC_CONFIG_FILES([packages/myddas/Makefile])
|
||||
fi
|
||||
|
||||
if test "$ENABLE_CLPBN_BP" = ""; then
|
||||
AC_CONFIG_FILES([packages/CLPBN/horus/Makefile])
|
||||
fi
|
||||
@ -2092,10 +2090,6 @@ if test "$ENABLE_GECODE" = ""; then
|
||||
AC_CONFIG_FILES([packages/gecode/Makefile])
|
||||
fi
|
||||
|
||||
if test "$ENABLE_RAPTOR" = ""; then
|
||||
AC_CONFIG_FILES([packages/raptor/Makefile])
|
||||
fi
|
||||
|
||||
if test "$ENABLE_PRISM" = ""; then
|
||||
AC_CONFIG_FILES([packages/prism/src/c/Makefile])
|
||||
AC_CONFIG_FILES([packages/prism/src/prolog/Makefile])
|
||||
|
@ -447,6 +447,7 @@ extern X_API int PL_get_chars(term_t, char **, unsigned);
|
||||
extern X_API int PL_get_nchars(term_t, size_t *, char **, unsigned);
|
||||
extern X_API int PL_get_wchars(term_t, size_t *, wchar_t **, unsigned);
|
||||
extern X_API int PL_get_functor(term_t, functor_t *);
|
||||
extern X_API int PL_get_compound_name_arity(term_t t, atom_t *ap, int *ip);
|
||||
extern X_API int PL_get_float(term_t, double *);
|
||||
extern X_API int PL_get_head(term_t, term_t);
|
||||
extern X_API int PL_get_int64(term_t, int64_t *);
|
||||
@ -538,6 +539,7 @@ extern X_API int PL_is_functor(term_t, functor_t);
|
||||
extern X_API int PL_is_ground(term_t);
|
||||
extern X_API int PL_is_callable(term_t);
|
||||
extern X_API int PL_is_integer(term_t);
|
||||
extern X_API int PL_is_pair(term_t);
|
||||
extern X_API int PL_is_list(term_t);
|
||||
extern X_API int PL_is_pair(term_t);
|
||||
extern X_API int PL_is_number(term_t);
|
||||
|
@ -84,15 +84,6 @@ PROGRAMS= \
|
||||
$(srcdir)/flags.yap \
|
||||
$(srcdir)/block_diagram.yap
|
||||
|
||||
MYDDAS_PROGRAMS= $(srcdir)/MYDDAS/myddas.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_assert_predicates.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_mysql.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_top_level.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_errors.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_prolog2sql.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_util_predicates.ypp \
|
||||
$(srcdir)/MYDDAS/myddas_prolog2sql_optimizer.ypp
|
||||
|
||||
DIALECT_PROGRAMS= \
|
||||
$(srcdir)/dialect/commons.yap \
|
||||
$(srcdir)/dialect/bprolog.yap \
|
||||
@ -111,7 +102,7 @@ DIALECT_BP= \
|
||||
$(srcdir)/dialect/bprolog/foreach.pl \
|
||||
$(srcdir)/dialect/bprolog/hashtable.yap
|
||||
|
||||
install: $(PROGRAMS) install_myddas
|
||||
install: $(PROGRAMS)
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/dialect
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/dialect/swi
|
||||
@ -121,16 +112,3 @@ install: $(PROGRAMS) install_myddas
|
||||
for p in $(DIALECT_SWI); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap/dialect/swi; done
|
||||
for p in $(DIALECT_BP); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap/dialect/bprolog; done
|
||||
|
||||
install_myddas: $(MYDDAS_PROGRAMS)
|
||||
count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \
|
||||
if [ $$count -ne 0 ]; then \
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap; \
|
||||
for p in $(MYDDAS_PROGRAMS); \
|
||||
do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap; \
|
||||
done; \
|
||||
for p in $(DESTDIR)$(SHAREDIR)/Yap/myddas*.ypp; \
|
||||
do name=`basename $$p .ypp`; \
|
||||
cpp $(YAP_EXTRAS) -P -E -w $$p > $(DESTDIR)$(SHAREDIR)/Yap/$$name.yap; \
|
||||
rm -fr $$p; \
|
||||
done; \
|
||||
fi
|
||||
|
@ -211,6 +211,32 @@ X_API int PL_get_arg(int index, term_t ts, term_t a)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* SWI: int PL_get_arg(int index, term_t t, term_t a)
|
||||
YAP: YAP_Term YAP_ArgOfTerm(int argno, YAP_Term t)*/
|
||||
X_API int PL_get_compound_name_arity(term_t ts, atom_t *ap, int *ip)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
if ( !YAP_IsApplTerm(t) ) {
|
||||
if (YAP_IsPairTerm(t)) {
|
||||
if (ip)
|
||||
*ip = 2;
|
||||
if (ap)
|
||||
*ap = ATOM_nil;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
Functor f = FunctorOfTerm( t );
|
||||
if (IsExtensionFunctor(f)) return FALSE;
|
||||
if (ip)
|
||||
*ip = ArityOfFunctor( f );
|
||||
if (ap)
|
||||
*ap = AtomToSWIAtom( NameOfFunctor( f ));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
X_API int _PL_get_arg(int index, term_t ts, term_t a)
|
||||
{
|
||||
CACHE_REGS
|
||||
@ -344,10 +370,14 @@ X_API int PL_get_float(term_t ts, double *f) /* SAM type check*/
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
if ( YAP_IsFloatTerm(t)) {
|
||||
*f = YAP_FloatOfTerm(t);
|
||||
} else if ( YAP_IsIntTerm(t)) {
|
||||
*f = YAP_IntOfTerm(t);
|
||||
if ( IsFloatTerm(t)) {
|
||||
*f = FloatOfTerm(t);
|
||||
} else if ( IsIntegerTerm(t)) {
|
||||
*f = IntegerOfTerm(t);
|
||||
#if USE_GMP
|
||||
} else if (IsBigIntTerm(t)) {
|
||||
*f = Yap_gmp_to_float( t );
|
||||
#endif
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -438,7 +468,7 @@ X_API int PL_get_long(term_t ts, long *i)
|
||||
|
||||
X_API int PL_get_int64(term_t ts, int64_t *i)
|
||||
{
|
||||
#if SIZE_OF_LONG_INT==8
|
||||
#if SIZE_OF_INT_P==8
|
||||
return PL_get_long(ts, (long *)i);
|
||||
#else
|
||||
CACHE_REGS
|
||||
@ -1442,7 +1472,7 @@ int PL_unify_termv(term_t l, va_list ap)
|
||||
*pt++ = MkIntegerTerm((Int)va_arg(ap, intptr_t));
|
||||
break;
|
||||
case PL_INT64:
|
||||
#if SIZEOF_LONG_INT==8
|
||||
#if SIZEOF_INT_P==8
|
||||
*pt++ = MkIntegerTerm((Int)va_arg(ap, long int));
|
||||
#elif USE_GMP
|
||||
{
|
||||
@ -1646,14 +1676,14 @@ X_API int PL_is_atomic(term_t ts)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
return !YAP_IsVarTerm(t) || !YAP_IsApplTerm(t) || !YAP_IsPairTerm(t);
|
||||
return !IsVarTerm(t) || !IsApplTerm(t) || !IsPairTerm(t);
|
||||
}
|
||||
|
||||
X_API int PL_is_compound(term_t ts)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
return (YAP_IsApplTerm(t) || YAP_IsPairTerm(t));
|
||||
return (IsApplTerm(t) || IsPairTerm(t));
|
||||
}
|
||||
|
||||
X_API int PL_is_functor(term_t ts, functor_t f)
|
||||
@ -1673,7 +1703,7 @@ X_API int PL_is_float(term_t ts)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
return YAP_IsFloatTerm(t);
|
||||
return !IsVarTerm(t) && IsFloatTerm(t);
|
||||
}
|
||||
|
||||
X_API int PL_is_integer(term_t ts)
|
||||
@ -1740,7 +1770,7 @@ X_API int PL_is_number(term_t ts)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Term t = Yap_GetFromSlot(ts PASS_REGS);
|
||||
return YAP_IsIntTerm(t) || YAP_IsBigNumTerm(t) || YAP_IsFloatTerm(t);
|
||||
return IsIntegerTerm(t) || IsBigIntTerm(t) || IsFloatTerm(t);
|
||||
}
|
||||
|
||||
X_API int PL_is_string(term_t ts)
|
||||
@ -2635,7 +2665,7 @@ PL_eval_expression_to_int64_ex(term_t t, int64_t *val)
|
||||
if (IsIntegerTerm(res)) {
|
||||
*val = IntegerOfTerm(res);
|
||||
return TRUE;
|
||||
#if SIZEOF_LONG_INT==4 && USE_GMP
|
||||
#if SIZEOF_INT_P==4 && USE_GMP
|
||||
} else if (YAP_IsBigNumTerm(res)) {
|
||||
MP_INT g;
|
||||
char s[64];
|
||||
|
@ -53,7 +53,7 @@ Comments: This file provides a set of functions to convert a prolog term to a C
|
||||
|
||||
#endif
|
||||
|
||||
struct buffer_ds buffer;
|
||||
struct buffer_ds buffers[1024];
|
||||
|
||||
/*********************************************************************************************/
|
||||
// prototypes
|
||||
@ -100,7 +100,6 @@ expand_buffer(const size_t space ) {
|
||||
*/
|
||||
void
|
||||
change_buffer_size(const size_t newsize) {
|
||||
|
||||
if ( BUFFER_SIZE>=BLOCK_SIZE && BUFFER_SIZE>=newsize)
|
||||
return;
|
||||
if (BUFFER_PTR) {
|
||||
@ -143,6 +142,7 @@ size_t
|
||||
write_term_to_stream(const int fd,const YAP_Term term) {
|
||||
|
||||
RESET_BUFFER;
|
||||
printf("BUFFER_PTR=%p\n", BUFFER_PTR);
|
||||
p2c_putt(term);
|
||||
if (write(fd,(void*)BUFFER_PTR,BUFFER_LEN) < 0) { // write term
|
||||
YAP_Error(0,0,"Prolog2Term: IO error in write.\n");
|
||||
|
@ -70,6 +70,8 @@ void write_msg(const char *fun,const char *file, int line,const char *format, ..
|
||||
|
||||
extern int BLOCK_SIZE;
|
||||
|
||||
#define buffer (buffers[YAP_ThreadSelf()])
|
||||
|
||||
// deletes the buffer (all fields) but does not release the memory of the buffer.ptr
|
||||
#define DEL_BUFFER {buffer.ptr=NULL;buffer.size=0;buffer.len=0;buffer.pos=0;}
|
||||
// informs the prologterm2c module that the buffer is now used and should not be messed
|
||||
@ -92,6 +94,7 @@ struct buffer_ds {
|
||||
char *ptr; // pointer to the buffer
|
||||
size_t pos; // position (used while reading)
|
||||
};
|
||||
extern struct buffer_ds buffer;
|
||||
extern struct buffer_ds buffers[1024];
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -71,7 +71,9 @@ typedef struct broadcast_req BroadcastRequest;
|
||||
/********************************************************************
|
||||
* Auxiliary data
|
||||
********************************************************************/
|
||||
static int mpi_status;
|
||||
static int mpi_statuss[1024];
|
||||
#define mpi_status (mpi_statuss[YAP_ThreadSelf()])
|
||||
|
||||
extern int GLOBAL_argc;
|
||||
|
||||
#define HASHSIZE 1777
|
||||
@ -110,7 +112,11 @@ static double total_time_spent; // total time spend in communication code
|
||||
|
||||
#define RETURN(p) {PAUSE_TIMER();return (p);}
|
||||
|
||||
static struct timeval _tstart, _tend;
|
||||
static struct timeval _tstarts[1024], _tends[1024];
|
||||
|
||||
#define _tsart (_tstarts[YAP_ThreadSelf()])
|
||||
#define _tend (_tends[YAP_ThreadSelf()])
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
@ -260,7 +266,7 @@ mpi_init(void){
|
||||
char ** my_argv;
|
||||
int my_argc = YAP_Argv(&my_argv);
|
||||
// MPI_Init(&GLOBAL_argc, &GLOBAL_argv);
|
||||
MPI_Init_thread(&my_argc, &my_argv, MPI_THREAD_SINGLE, &thread_level);
|
||||
MPI_Init_thread(&my_argc, &my_argv, MPI_THREAD_MULTIPLE, &thread_level);
|
||||
#ifdef DEBUG
|
||||
write_msg(__FUNCTION__,__FILE__,__LINE__,"Thread level: %d\n",thread_level);
|
||||
#endif
|
||||
|
100
packages/myddas/Makefile.in
Normal file
100
packages/myddas/Makefile.in
Normal file
@ -0,0 +1,100 @@
|
||||
#
|
||||
# default base directory for YAP installation
|
||||
# (EROOT for architecture-dependent files)
|
||||
#
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
ROOTDIR = $(prefix)
|
||||
EROOTDIR = @exec_prefix@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
#
|
||||
# where the binary should be
|
||||
#
|
||||
BINDIR = $(EROOTDIR)/bin
|
||||
#
|
||||
# where YAP should look for libraries
|
||||
#
|
||||
LIBDIR=@libdir@
|
||||
SHAREDIR=$(ROOTDIR)/share/Yap
|
||||
YAPLIBDIR=@libdir@/Yap
|
||||
#
|
||||
#
|
||||
CC=@CC@
|
||||
YAP_EXTRAS=@YAP_EXTRAS@
|
||||
CFLAGS= $(YAP_EXTRAS) @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include -I$(srcdir)/../../H -I$(srcdir)/../../OPTYap -I$(srcdir)/../../os
|
||||
LDFLAGS=@LDFLAGS@
|
||||
#
|
||||
#
|
||||
# You shouldn't need to change what follows.
|
||||
#
|
||||
INSTALL=@INSTALL@
|
||||
INSTALL_DATA=@INSTALL_DATA@
|
||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||
SHELL=/bin/sh
|
||||
RANLIB=@RANLIB@
|
||||
srcdir=@srcdir@
|
||||
SO=@SO@
|
||||
#4.1VPATH=@srcdir@:@srcdir@/OPTYap
|
||||
CWD=$(PWD)
|
||||
#
|
||||
|
||||
MYDDAS_HEADERS= \
|
||||
$(srcdir)/myddas.h $(srcdir)/myddas_structs.h \
|
||||
$(srcdir)/myddas_statistics.h \
|
||||
$(srcdir)/myddas_statistics_structs.h \
|
||||
$(srcdir)/myddas_wkb.h $(srcdir)/myddas_wkb2prolog.h
|
||||
|
||||
MYDDAS_SOURCES= \
|
||||
myddas_mysql.c \
|
||||
myddas_odbc.c \
|
||||
myddas_util.c \
|
||||
myddas_initialization.c \
|
||||
myddas_shared.c \
|
||||
myddas_statistics.c \
|
||||
myddas_top_level.c \
|
||||
myddas_wkb2prolog.c
|
||||
|
||||
MYDDAS_PROLOG= \
|
||||
$(srcdir)/pl/myddas.ypp \
|
||||
$(srcdir)/pl/myddas_assert_predicates.ypp \
|
||||
$(srcdir)/pl/myddas_mysql.ypp \
|
||||
$(srcdir)/pl/myddas_top_level.ypp \
|
||||
$(srcdir)/pl/myddas_errors.ypp \
|
||||
$(srcdir)/pl/myddas_prolog2sql.ypp \
|
||||
$(srcdir)/pl/myddas_util_predicates.ypp \
|
||||
$(srcdir)/pl/myddas_prolog2sql_optimizer.ypp
|
||||
|
||||
OBJS= $(MYDDAS_SOURCES:.c=.o)
|
||||
SOBJS= myddas.@SO@
|
||||
|
||||
|
||||
#in some systems we just create a single object, in others we need to
|
||||
# create a libray
|
||||
|
||||
all: $(SOBJS)
|
||||
|
||||
.PRECIOUS: %.o
|
||||
|
||||
%.o: $(srcdir)/%.c
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
@DO_SECOND_LD@%.@SO@: $(OBJS)
|
||||
@DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o $@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@
|
||||
|
||||
install: all install_myddas
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)
|
||||
$(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(YAPLIBDIR)
|
||||
|
||||
install_myddas:
|
||||
count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \
|
||||
if [ $$count -ne 0 ]; then \
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR); \
|
||||
for p in $(MYDDAS_PROLOG); \
|
||||
do name=`basename $$p .ypp`; echo $$name;\
|
||||
cpp $(YAP_EXTRAS) -P -E -w $$p > $(DESTDIR)$(SHAREDIR)/$$name.yap; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ $(OBJS) $(SOBJS) *.BAK
|
||||
|
74
packages/myddas/MyddasProto.h
Normal file
74
packages/myddas/MyddasProto.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* MYDDAS */
|
||||
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
|
||||
/* myddas_initialization.c */
|
||||
MYDDAS_GLOBAL myddas_init_initialize_myddas(void);
|
||||
MYDDAS_UTIL_CONNECTION myddas_init_initialize_connection(void *,void *,MYDDAS_UTIL_CONNECTION);
|
||||
MYDDAS_UTIL_PREDICATE myddas_init_initialize_predicate(char *, int, char *,MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
#ifdef MYDDAS_STATS
|
||||
/* myddas_statistics.c */
|
||||
MYDDAS_GLOBAL myddas_stats_initialize_global_stats(MYDDAS_GLOBAL);
|
||||
MYDDAS_STATS_STRUCT myddas_stats_initialize_connection_stats(void);
|
||||
void myddas_stats_delete_stats_list(MYDDAS_STATS_STRUCT);
|
||||
#endif /* MYDDAS_STATS */
|
||||
|
||||
#ifdef MYDDAS_MYSQL
|
||||
/* myddas_util.c */
|
||||
void myddas_util_table_write(MYSQL_RES *);
|
||||
#endif
|
||||
Short myddas_util_connection_type(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_connection(void *,void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_search_connection(void *);
|
||||
void myddas_util_delete_connection(void *);
|
||||
MYDDAS_UTIL_CONNECTION myddas_util_add_predicate(char * ,Int , char *,void *);
|
||||
MYDDAS_UTIL_PREDICATE myddas_util_search_predicate(char * ,Int , char *);
|
||||
void myddas_util_delete_predicate(MYDDAS_UTIL_PREDICATE);
|
||||
|
||||
/* Get's the number of queries to save */
|
||||
UInt myddas_util_get_total_multi_queries_number(MYDDAS_UTIL_CONNECTION);
|
||||
void myddas_util_set_total_multi_queries_number(MYDDAS_UTIL_CONNECTION,UInt);
|
||||
#ifdef MYDDAS_ODBC
|
||||
/* Return enviromment identifier*/
|
||||
SQLHENV myddas_util_get_odbc_enviromment(SQLHDBC);
|
||||
#endif
|
||||
|
||||
void * myddas_util_get_list_pred(MYDDAS_UTIL_CONNECTION);
|
||||
void * myddas_util_get_pred_next(void *);
|
||||
char * myddas_util_get_pred_module(void *);
|
||||
char * myddas_util_get_pred_name(void *);
|
||||
MyddasInt myddas_util_get_pred_arity(void *);
|
||||
//DELETE THIS WHEN DB_STATS IS COMPLETED
|
||||
MyddasInt get_myddas_top(void);
|
||||
|
||||
#ifdef DEBUG
|
||||
void check_int(void);
|
||||
#endif
|
||||
|
||||
#endif /* MYDDAS_MYSQL || MYDDAS_ODBC */
|
||||
|
||||
/* myddas_mysql.c */
|
||||
#if defined MYDDAS_MYSQL
|
||||
void Yap_InitMYDDAS_MySQLPreds(void);
|
||||
void Yap_InitBackMYDDAS_MySQLPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_odbc.c */
|
||||
#if defined MYDDAS_ODBC
|
||||
void Yap_InitMYDDAS_ODBCPreds(void);
|
||||
void Yap_InitBackMYDDAS_ODBCPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_shared.c */
|
||||
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
|
||||
void Yap_MYDDAS_delete_all_myddas_structs(void);
|
||||
void Yap_InitMYDDAS_SharedPreds(void);
|
||||
void Yap_InitBackMYDDAS_SharedPreds(void);
|
||||
#endif
|
||||
|
||||
/* myddas_top_level.c */
|
||||
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL //&& defined HAVE_LIBREADLINE
|
||||
void Yap_InitMYDDAS_TopLevelPreds(void);
|
||||
#endif
|
||||
|
@ -31,6 +31,7 @@ AC_ARG_ENABLE(myddas-top-level,
|
||||
|
||||
if test "$yap_cv_myddas" != "no"
|
||||
then
|
||||
ENABLE_MYDDAS=""
|
||||
dnl check for mysql
|
||||
AC_SEARCH_LIBS(mysql_init, [mysqlclient], [yap_cv_mysql="yes"], [yap_cv_mysql="no"])
|
||||
if test "$yap_cv_mysql" = yes
|
||||
@ -71,9 +72,12 @@ then
|
||||
then
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
|
||||
fi
|
||||
|
||||
else
|
||||
ENABLE_MYDDAS="#@ "
|
||||
fi
|
||||
|
||||
AC_SUBST(ENABLE_MYDDAS)
|
||||
|
||||
if test "$yap_cv_myddas" != "no"
|
||||
then
|
||||
AC_CHECK_HEADERS(mysql/mysql.h)
|
17
packages/myddas/myddas.c
Normal file
17
packages/myddas/myddas.c
Normal file
@ -0,0 +1,17 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: myddas_mysql.c *
|
||||
* Last rev: 22/03/05 *
|
||||
* mods: *
|
||||
* comments: Predicates for comunicating with a mysql database system *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
@ -155,5 +155,7 @@ typedef struct myddas_stats_struct *MYDDAS_STATS_STRUCT;
|
||||
NUMBER = Yap_REGS.MYDDAS_GLOBAL_POINTER->memory_freed;
|
||||
#endif
|
||||
|
||||
#include "MyddasProto.h"
|
||||
|
||||
|
||||
#endif /*__MYDDAS_H__*/
|
@ -695,6 +695,75 @@ void Yap_MYDDAS_delete_all_myddas_structs(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
init_myddas(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
#if defined MYDDAS_MYSQL && defined CUT_C
|
||||
Yap_InitBackMYDDAS_MySQLPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_ODBC && defined CUT_C
|
||||
Yap_InitBackMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
|
||||
Yap_InitBackMYDDAS_SharedPreds();
|
||||
#endif
|
||||
#if defined CUT_C && defined MYDDAS_MYSQL
|
||||
Yap_InitMYDDAS_MySQLPreds();
|
||||
#endif
|
||||
#if defined CUT_C && defined MYDDAS_ODBC
|
||||
Yap_InitMYDDAS_ODBCPreds();
|
||||
#endif
|
||||
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
|
||||
Yap_InitMYDDAS_SharedPreds();
|
||||
#endif
|
||||
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE
|
||||
Yap_InitMYDDAS_TopLevelPreds();
|
||||
#endif
|
||||
#ifdef MYDDAS_MYSQL_INIT
|
||||
if (yap_init->myddas) {
|
||||
Yap_PutValue(AtomMyddasGoal,MkIntegerTerm(yap_init->myddas));
|
||||
|
||||
/* Mandatory Fields */
|
||||
Yap_PutValue(AtomMyddasUser,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_user)));
|
||||
Yap_PutValue(AtomMyddasDB,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_db)));
|
||||
|
||||
/* Non-Mandatory Fields */
|
||||
if (yap_init->myddas_pass != NULL)
|
||||
Yap_PutValue(AtomMyddasPass,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_pass)));
|
||||
if (yap_init->myddas_host != NULL)
|
||||
Yap_PutValue(AtomMyddasHost,MkAtomTerm(Yap_LookupAtom(yap_init->myddas_host)));
|
||||
}
|
||||
#endif
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
Yap_REGS.MYDDAS_GLOBAL_POINTER = NULL;
|
||||
Yap_PutValue(AtomMyddasVersionName,
|
||||
MkAtomTerm(Yap_LookupAtom(MYDDAS_VERSION)));
|
||||
Yap_HaltRegisterHook((HaltHookFunc)Yap_MYDDAS_delete_all_myddas_structs,NULL);
|
||||
Yap_MYDDAS_delete_all_myddas_structs();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
int WINAPI PROTO(win_myddas, (HANDLE, DWORD, LPVOID));
|
||||
|
||||
int WINAPI win_myddas(HANDLE hinst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Yap.h"
|
||||
#include "myddas_structs.h"
|
||||
#include "myddas_statistics.h"
|
||||
#include "Yap.h"
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -364,10 +364,10 @@ myddas_util_get_list_pred(MYDDAS_UTIL_CONNECTION node){
|
||||
#ifdef DEBUG
|
||||
void check_int( void ){
|
||||
CACHE_REGS
|
||||
Int i;
|
||||
|
||||
MYDDAS_UTIL_PREDICATE pred = NULL;
|
||||
MYDDAS_UTIL_CONNECTION top = Yap_REGS.MYDDAS_GLOBAL_POINTER->myddas_top_connections;
|
||||
for (i=1 ; top!=NULL ; top=top->next)
|
||||
for ( ; top!=NULL ; top=top->next)
|
||||
{
|
||||
printf ("***************\n");
|
||||
printf ("===== top =====\n");
|
@ -17,6 +17,8 @@
|
||||
|
||||
#if defined MYDDAS_MYSQL || defined MYDDAS_ODBC
|
||||
|
||||
:- load_foreign_files([myddas], [], init_myddas).
|
||||
|
||||
/* Initialize MYDDAS GLOBAL STRUCTURES */
|
||||
:- c_db_initialize_myddas.
|
||||
|
||||
@ -177,6 +179,7 @@
|
||||
]).
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% db_open/5
|
||||
% db_open/4
|
@ -1 +1 @@
|
||||
Subproject commit 099c16227d951355965cabd6afc1a94f3a98bf19
|
||||
Subproject commit 0f77a1e1b90b36bddb1844712380f4f3858123b7
|
Reference in New Issue
Block a user