WIN32 fixes: work in progress.
This commit is contained in:
parent
2c00c4a00b
commit
50207cb52a
@ -17,7 +17,7 @@ LIBDIR=$(EROOTDIR)/lib/Yap
|
||||
#
|
||||
#
|
||||
CC=@CC@
|
||||
CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include
|
||||
CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include -I$(srcdir)/uxnt
|
||||
#
|
||||
#
|
||||
# You shouldn't need to change what follows.
|
||||
@ -35,23 +35,25 @@ CWD=$(PWD)
|
||||
#
|
||||
|
||||
HEADERS=$(srcdir)/atoms.h $(srcdir)/pl-buffer.h $(srcdir)/pl-ctype.h \
|
||||
$(srcdir)/pl-incl.h $(srcdir)/pl-opts.h \
|
||||
$(srcdir)/pl-incl.h \
|
||||
$(srcdir)/pl-mswchar.h \
|
||||
$(srcdir)/pl-opts.h \
|
||||
$(srcdir)/pl-os.h \
|
||||
$(srcdir)/pl-stream.h \
|
||||
$(srcdir)/pl-table.h \
|
||||
$(srcdir)/pl-text.h $(srcdir)/pl-utf8.h \
|
||||
$(srcdir)/pl-yap.h
|
||||
$(srcdir)/pl-yap.h @ENABLE_WINCONSOLE@ $(srcdir)/uxnt/dirent.h $(srcdir)/uxnt/utf8.h $(srcdir)/uxnt/uxnt.h
|
||||
C_SOURCES=$(srcdir)/pl-buffer.c $(srcdir)/pl-ctype.c \
|
||||
$(srcdir)/pl-error.c $(srcdir)/pl-feature.c \
|
||||
$(srcdir)/pl-file.c $(srcdir)/pl-os.c \
|
||||
$(srcdir)/pl-stream.c $(srcdir)/pl-string.c \
|
||||
$(srcdir)/pl-table.c \
|
||||
$(srcdir)/pl-text.c $(srcdir)/pl-utf8.c \
|
||||
$(srcdir)/pl-yap.c
|
||||
$(srcdir)/pl-yap.c @ENABLE_WINCONSOLE@ $(srcdir)/uxnt/utf8.c $(srcdir)/uxnt/uxnt.c
|
||||
OBJS=pl-buffer.o pl-ctype.o pl-error.o pl-feature.o \
|
||||
pl-file.o pl-os.o \
|
||||
pl-stream.o pl-string.o pl-table.o pl-text.o pl-utf8.o \
|
||||
pl-yap.o
|
||||
pl-yap.o @ENABLE_WINCONSOLE@ utf8.o uxnt.o
|
||||
SOBJS=plstream@SHLIB_SUFFIX@
|
||||
|
||||
#in some systems we just create a single object, in others we need to
|
||||
@ -95,6 +97,12 @@ pl-utf8.o: $(srcdir)/pl-utf8.c
|
||||
pl-yap.o: $(srcdir)/pl-yap.c
|
||||
$(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(srcdir)/pl-yap.c -o pl-yap.o
|
||||
|
||||
uxnt.o: $(srcdir)/uxnt/uxnt.c
|
||||
$(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(srcdir)/uxnt/uxnt.c -o uxnt.o
|
||||
|
||||
utf8.o: $(srcdir)/uxnt/utf8.c
|
||||
$(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(srcdir)/uxnt/utf8.c -o utf8.o
|
||||
|
||||
@DO_SECOND_LD@%@SHLIB_SUFFIX@: %.o
|
||||
@DO_SECOND_LD@ @SHLIB_LD@ -o $@ $<
|
||||
|
||||
|
@ -837,7 +837,7 @@ static const enc_map map[] =
|
||||
{ NULL, ENC_UNKNOWN }
|
||||
};
|
||||
|
||||
static IOENC
|
||||
IOENC
|
||||
initEncoding(void)
|
||||
{ if ( LD )
|
||||
{ if ( !LD->encoding )
|
||||
|
@ -348,7 +348,7 @@ releaseStream(IOSTREAM *s)
|
||||
|
||||
#endif /*O_PLMT*/
|
||||
|
||||
int
|
||||
int
|
||||
PL_release_stream(IOSTREAM *s)
|
||||
{ if ( Sferror(s) )
|
||||
return streamStatus(s);
|
||||
@ -446,14 +446,14 @@ noent:
|
||||
#define get_stream_handle(t, sp, flags) \
|
||||
get_stream_handle__LD(t, sp, flags PASS_LD)
|
||||
|
||||
int
|
||||
int
|
||||
PL_get_stream_handle(term_t t, IOSTREAM **s)
|
||||
{ GET_LD
|
||||
return get_stream_handle(t, s, SH_ERRORS|SH_ALIAS);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
PL_unify_stream_or_alias(term_t t, IOSTREAM *s)
|
||||
{ GET_LD
|
||||
int rval;
|
||||
@ -481,7 +481,7 @@ PL_unify_stream_or_alias(term_t t, IOSTREAM *s)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
PL_unify_stream(term_t t, IOSTREAM *s)
|
||||
{ GET_LD
|
||||
stream_context *ctx;
|
||||
@ -503,7 +503,7 @@ PL_unify_stream(term_t t, IOSTREAM *s)
|
||||
}
|
||||
|
||||
|
||||
bool /* old FLI name (compatibility) */
|
||||
bool /* old FLI name (compatibility) */
|
||||
PL_open_stream(term_t handle, IOSTREAM *s)
|
||||
{ return PL_unify_stream(handle, s);
|
||||
}
|
||||
@ -609,7 +609,7 @@ isConsoleStream(IOSTREAM *s)
|
||||
#endif
|
||||
|
||||
|
||||
static bool
|
||||
bool
|
||||
reportStreamError(IOSTREAM *s)
|
||||
{ if ( GD->cleaning == CLN_NORMAL &&
|
||||
!isConsoleStream(s) &&
|
||||
@ -782,7 +782,7 @@ closeFiles(int all)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PL_cleanup_fork(void)
|
||||
{ TableEnum e;
|
||||
Symbol symb;
|
||||
@ -1030,7 +1030,7 @@ PRED_IMPL("with_output_to", 2, with_output_to, PL_FA_TRANSPARENT)
|
||||
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PL_write_prompt(int dowrite)
|
||||
{ GET_LD
|
||||
IOSTREAM *s = getStream(Suser_output);
|
||||
@ -1169,14 +1169,14 @@ readLine(IOSTREAM *in, IOSTREAM *out, char *buffer)
|
||||
}
|
||||
|
||||
|
||||
IOSTREAM *
|
||||
IOSTREAM *
|
||||
PL_current_input()
|
||||
{ GET_LD
|
||||
return getStream(Scurin);
|
||||
}
|
||||
|
||||
|
||||
IOSTREAM *
|
||||
IOSTREAM *
|
||||
PL_current_output()
|
||||
{ GET_LD
|
||||
return getStream(Scurout);
|
||||
@ -1951,7 +1951,7 @@ PRED_IMPL("read_pending_input", 3, read_pending_input, 0)
|
||||
fail;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
PL_get_char(term_t c, int *p, int eof)
|
||||
{ GET_LD
|
||||
int chr;
|
||||
@ -1988,7 +1988,7 @@ PL_unify_char(term_t chr, int c, int how)
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
int
|
||||
PL_unify_char(term_t chr, int c, int how)
|
||||
PL_unify_char(term_t chr, int c, int how)
|
||||
{ GET_LD
|
||||
int c2 = -1;
|
||||
|
||||
@ -3355,7 +3355,7 @@ pl_stream_property(term_t stream, term_t property, control_t h)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( PL_get_functor(property, &f) )
|
||||
{ const sprop *p = sprop_list;
|
||||
|
||||
@ -4271,6 +4271,11 @@ pl_delete_directory(term_t name)
|
||||
}
|
||||
|
||||
|
||||
/* mkdir/2 works in SWI, and not in YAP, why? */
|
||||
#ifdef __WINDOWS__
|
||||
#define mkdir(X,Y) mkdir(X)
|
||||
#endif
|
||||
|
||||
static word
|
||||
pl_make_directory(term_t name)
|
||||
{ char *n;
|
||||
|
@ -1,5 +1,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define PL_KERNEL 1
|
||||
|
||||
#include <SWI-Prolog.h>
|
||||
typedef int bool;
|
||||
|
||||
@ -389,6 +392,24 @@ typedef double real;
|
||||
|
||||
#define forwards static /* forwards function declarations */
|
||||
|
||||
/* uxnt package interface */
|
||||
#if defined(__YAP_PROLOG__) && defined(__MINGW32__)
|
||||
#define O_XOS 1
|
||||
|
||||
#define _XOS_ISFILE 0x01
|
||||
#define _XOS_ISDIR 0x02
|
||||
|
||||
#define _XOS_FILE 0x0001 /* is a file */
|
||||
#define _XOS_DIR 0x0002 /* is a directory */
|
||||
|
||||
#define XOS_DOWNCASE 0x01 /* _xos_canonical_filename() */
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#define __WINDOWS__ 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define PL_dispatch(FD, COM)
|
||||
extern int PL_unify_char(term_t chr, int c, int how);
|
||||
extern int PL_get_char(term_t chr, int *c, int eof);
|
||||
@ -460,10 +481,7 @@ word pl_noprotocol(void);
|
||||
|
||||
IOSTREAM *PL_current_input(void);
|
||||
IOSTREAM *PL_current_output(void);
|
||||
extern int PL_release_stream(IOSTREAM *s);
|
||||
extern int PL_get_stream_handle(term_t t, IOSTREAM **s);
|
||||
extern int PL_unify_stream_or_alias(term_t t, IOSTREAM *s);
|
||||
extern int PL_unify_stream(term_t t, IOSTREAM *s);
|
||||
extern bool PL_open_stream(term_t handle, IOSTREAM *s);
|
||||
extern void PL_write_prompt(int dowrite);
|
||||
|
||||
|
@ -34,6 +34,12 @@
|
||||
#endif
|
||||
|
||||
#include "pl-incl.h"
|
||||
#ifdef __YAP_PROLOG__
|
||||
#ifdef __MINGW32__
|
||||
#define O_XOS 1
|
||||
#define statfunc _xos_stat
|
||||
#endif
|
||||
#endif
|
||||
#include "pl-ctype.h"
|
||||
#include "pl-utf8.h"
|
||||
#undef abs
|
||||
@ -485,7 +491,8 @@ static void
|
||||
initRandom(void)
|
||||
{ unsigned int seed;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
|
||||
seed = (unsigned int)GetTickCount();
|
||||
#else
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
@ -810,6 +817,7 @@ OsPath(const char *p, char *buf)
|
||||
#endif /*__unix__*/
|
||||
|
||||
#if O_XOS
|
||||
|
||||
char *
|
||||
PrologPath(const char *p, char *buf, size_t len)
|
||||
{ int flags = (trueFeature(FILE_CASE_FEATURE) ? 0 : XOS_DOWNCASE);
|
||||
|
@ -22,13 +22,22 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define __WINDOWS__ 1
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <uxnt.h>
|
||||
#ifdef __MINGW32__
|
||||
#include "config.h"
|
||||
#include <windows.h>
|
||||
#else
|
||||
#ifdef WIN64
|
||||
#define MD "config/win64.h"
|
||||
#else
|
||||
#define MD "config/win32.h"
|
||||
#endif
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#include "pl-mswchar.h"
|
||||
#define CRLF_MAPPING 1
|
||||
|
@ -32,14 +32,14 @@
|
||||
#include <sys/_mbstate_t.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__WINDOWS__)
|
||||
#if (defined(_MSC_VER) || defined(__MINGW32__)) && !defined(__WINDOWS__)
|
||||
#define __WINDOWS__ 1
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
#include <stddef.h>
|
||||
#ifdef __WINDOWS__
|
||||
#if defined(__WINDOWS__) && !defined(__MINGW32__)
|
||||
typedef __int64 int64_t;
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef long intptr_t;
|
||||
|
Reference in New Issue
Block a user