WIN32 and CYGWIN fixes.

This commit is contained in:
U-WIN-UA9ACS5GS9N\vitor 2012-04-18 14:14:56 -05:00
parent 81be229e22
commit 19807d46f7
7 changed files with 29 additions and 23 deletions

7
C/load_dl.c Normal file → Executable file
View File

@ -34,14 +34,17 @@ Yap_CallFunctionByName(const char *thing_string);
int
Yap_CallFunctionByName(const char *thing_string)
{
void * handle = dlopen(NULL, RTLD_LAZY | RTLD_NOLOAD);
void * handle = dlopen(NULL, RTLD_LAZY
#ifndef __CYGWIN__
| RTLD_NOLOAD
#endif
);
// you could do RTLD_NOW as well. shouldn't matter
if (!handle) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR, ARG1, "Dynamic linking on main module : %s\n", dlerror());
}
prismf * addr = (prismf *)dlsym(handle, thing_string);
fprintf(stderr, "%s is at %p\n", thing_string, addr);
if (addr)
(*addr)();
return TRUE;

2
C/pl-yap.c Normal file → Executable file
View File

@ -887,7 +887,7 @@ warning(const char *fm, ...)
return TRUE;
}
#if defined(HAVE_SELECT) && !defined(__WINDOWS__)
#if defined(HAVE_SELECT) && !defined(__WINDOWS__) && !defined(__CYGWIN__)
#ifdef __WINDOWS__
#include <winsock2.h>

3
C/sysbits.c Normal file → Executable file
View File

@ -81,7 +81,8 @@ static char SccsId[] = "%W% %G%";
#include <sys/param.h>
#endif
#endif
#if HAVE_FENV_H
/* CYGWIN seems to include this automatically */
#if HAVE_FENV_H && !defined(__CYGWIN__)
#include <fenv.h>
#endif
#if HAVE_READLINE_READLINE_H

1
H/Yap.h Normal file → Executable file
View File

@ -810,6 +810,7 @@ extern struct worker_local Yap_local;
#define REMOTE(wid) (&Yap_local)
#endif
#include <stdio.h>
#define YP_FILE FILE
#include "hglobals.h"
#include "dglobals.h"

3
H/arith2.h Normal file → Executable file
View File

@ -120,6 +120,7 @@ times_int(Int i1, Int i2) {
}
#ifdef USE_GMP
#ifndef __GNUC__X
static int
clrsb(Int i)
@ -147,7 +148,7 @@ clrsb(Int i)
return j;
}
#endif
#endif
inline static Term
do_sll(Int i, Int j) /* j > 0 */

32
OPTYap/tab.macros.h Normal file → Executable file
View File

@ -193,27 +193,27 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
#endif /* DETERMINISTIC_TABLING */
/* tagging nodes */
#define TAG_AS_SUBGOAL_LEAF_NODE(NODE) TrNode_child(NODE) = (sg_node_ptr)((unsigned long int) TrNode_child(NODE) | 0x1)
#define IS_SUBGOAL_LEAF_NODE(NODE) ((unsigned long int) TrNode_child(NODE) & 0x1)
#define TAG_AS_ANSWER_LEAF_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((unsigned long int) TrNode_parent(NODE) | 0x1)
#define IS_ANSWER_LEAF_NODE(NODE) ((unsigned long int) TrNode_parent(NODE) & 0x1)
#define TAG_AS_ANSWER_INVALID_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((unsigned long int) TrNode_parent(NODE) | 0x2)
#define IS_ANSWER_INVALID_NODE(NODE) ((unsigned long int) TrNode_parent(NODE) & 0x2)
#define UNTAG_SUBGOAL_NODE(NODE) ((unsigned long int) (NODE) & ~(0x1))
#define UNTAG_ANSWER_NODE(NODE) ((unsigned long int) (NODE) & ~(0x3))
#define TAG_AS_SUBGOAL_LEAF_NODE(NODE) TrNode_child(NODE) = (sg_node_ptr)((CELL) TrNode_child(NODE) | 0x1)
#define IS_SUBGOAL_LEAF_NODE(NODE) ((CELL) TrNode_child(NODE) & 0x1)
#define TAG_AS_ANSWER_LEAF_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((CELL) TrNode_parent(NODE) | 0x1)
#define IS_ANSWER_LEAF_NODE(NODE) ((CELL) TrNode_parent(NODE) & 0x1)
#define TAG_AS_ANSWER_INVALID_NODE(NODE) TrNode_parent(NODE) = (ans_node_ptr)((CELL) TrNode_parent(NODE) | 0x2)
#define IS_ANSWER_INVALID_NODE(NODE) ((CELL) TrNode_parent(NODE) & 0x2)
#define UNTAG_SUBGOAL_NODE(NODE) ((CELL) (NODE) & ~(0x1))
#define UNTAG_ANSWER_NODE(NODE) ((CELL) (NODE) & ~(0x3))
/* trie hashes */
#define MAX_NODES_PER_TRIE_LEVEL 8
#define MAX_NODES_PER_BUCKET (MAX_NODES_PER_TRIE_LEVEL / 2)
#define BASE_HASH_BUCKETS 64
#define HASH_ENTRY(ENTRY, NUM_BUCKETS) ((((unsigned long int) ENTRY) >> NumberOfLowTagBits) & (NUM_BUCKETS - 1))
#define HASH_ENTRY(ENTRY, NUM_BUCKETS) ((((CELL) ENTRY) >> NumberOfLowTagBits) & (NUM_BUCKETS - 1))
#define SUBGOAL_TRIE_HASH_MARK ((Term) MakeTableVarTerm(MAX_TABLE_VARS))
#define IS_SUBGOAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == SUBGOAL_TRIE_HASH_MARK)
#define ANSWER_TRIE_HASH_MARK 0
#define IS_ANSWER_TRIE_HASH(NODE) (TrNode_instr(NODE) == ANSWER_TRIE_HASH_MARK)
#define GLOBAL_TRIE_HASH_MARK ((Term) MakeTableVarTerm(MAX_TABLE_VARS))
#define IS_GLOBAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == GLOBAL_TRIE_HASH_MARK)
#define HASH_TRIE_LOCK(NODE) GLOBAL_trie_locks((((unsigned long int) (NODE)) >> 5) & (TRIE_LOCK_BUCKETS - 1))
#define HASH_TRIE_LOCK(NODE) GLOBAL_trie_locks((((CELL) (NODE)) >> 5) & (TRIE_LOCK_BUCKETS - 1))
/* auxiliary stack */
#define STACK_PUSH_UP(ITEM, STACK) *--(STACK) = (CELL)(ITEM)
@ -449,9 +449,9 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
/* ... pointing to SgEnt_first_answer(SgFr_sg_ent(SG_FR)) */ \
if (SG_FR) \
DepFr_last_answer(DEP_FR) = (ans_node_ptr) ( \
(unsigned long int) (SgFr_sg_ent((sg_fr_ptr)SG_FR)) + \
(unsigned long int) (&SgEnt_first_answer((sg_ent_ptr)DEP_FR)) - \
(unsigned long int) (&TrNode_child((ans_node_ptr)DEP_FR))); \
(CELL) (SgFr_sg_ent((sg_fr_ptr)SG_FR)) + \
(CELL) (&SgEnt_first_answer((sg_ent_ptr)DEP_FR)) - \
(CELL) (&TrNode_child((ans_node_ptr)DEP_FR))); \
else \
DepFr_last_answer(DEP_FR) = NULL
#else
@ -460,9 +460,9 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
/* ... pointing to SgFr_first_answer(SG_FR) */ \
if (SG_FR) \
DepFr_last_answer(DEP_FR) = (ans_node_ptr) ( \
(unsigned long int) (SG_FR) + \
(unsigned long int) (&SgFr_first_answer((sg_fr_ptr)DEP_FR)) - \
(unsigned long int) (&TrNode_child((ans_node_ptr)DEP_FR))); \
(CELL) (SG_FR) + \
(CELL) (&SgFr_first_answer((sg_fr_ptr)DEP_FR)) - \
(CELL) (&TrNode_child((ans_node_ptr)DEP_FR))); \
else \
DepFr_last_answer(DEP_FR) = NULL
#endif /* THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */

4
console/yap.c Normal file → Executable file
View File

@ -79,8 +79,8 @@
#include <ieeefp.h>
#endif
static void PROTO(do_top_goal,(YAP_Term));
static void PROTO(exec_top_level,(int, YAP_init_args *));
static void do_top_goal(YAP_Term Goal);
static void exec_top_level(int BootMode, YAP_init_args *iap);
#ifdef DEBUG
static int output_msg;