diff --git a/Makefile.in b/Makefile.in index dee0f23eb..935fbc97f 100755 --- a/Makefile.in +++ b/Makefile.in @@ -511,13 +511,13 @@ JIT_Compiler.o: IT/JIT_Compiler.cpp $(CC) -c $(CFLAGS) $< -o $@ pl-ntcon.o: console/LGPL/pl-ntcon.c config.h - $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include $< -o $@ + $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir)/include $< -o $@ pl-ntconsole.o: console/LGPL/pl-ntconsole.c config.h - $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ + $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ pl-ntmain.o: console/LGPL/pl-ntmain.c config.h - $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ + $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ yapres.o: console/LGPL/yap.rc console/LGPL/manifest.xml config.h $(RC) $(RCFLAGS) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I. -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os -I$(srcdir)/console/LGPL @EXTRA_INCLUDES_FOR_WIN32@ -i $< -o $@ diff --git a/console/LGPL/pl-ntmain.c b/console/LGPL/pl-ntmain.c index fcc30ee93..a9da3abc3 100755 --- a/console/LGPL/pl-ntmain.c +++ b/console/LGPL/pl-ntmain.c @@ -28,7 +28,7 @@ #define MAX_FILE_NAME 1024 #include "config.h" #include "console/LGPL/resource.h" -#ifdef THREADSx +#ifdef THREADS #define O_PLMT 1 #endif #else @@ -1087,7 +1087,7 @@ set_window_title(rlc_console c) int v = (int)PL_query(PL_QUERY_VERSION); int major = v / 10000; int minor = (v / 100) % 100; - int patch = v % 100; + int patch = v / 100; #ifdef O_PLMT TCHAR *mt = _T("Multi-threaded, "); #else diff --git a/misc/mkwin.md b/misc/mkwin.md new file mode 100644 index 000000000..aeeedaf61 --- /dev/null +++ b/misc/mkwin.md @@ -0,0 +1,83 @@ + +AT the time of this writing (Nov 2014), YAP uses the mkwin script to +compile in WIN32. The script requires either a WIN32 environment, or a +cross-compiler/emulator package. + +YAP has been known to compile under VISUAL C++, and should compile and +work under cygwin, but the favorite approach is to use a native +msys/mingw environment. This approach has two key advantages: + + + it does not need an interface layer and a DLL, like cygwin. + + + it enables cross-compilation. + +YAP uses rge `mkwin` script to generate a new YAP installer. The script is +controlled by a set of of variables that should be defined early on in +the text. It executes by first calling `configure`, next running `make`, and +last (if all went well) executing `nsys`. + +In more detail, the following mingw based environments have been +tested to develop YAP: + + * MSYS 1 and mingw32/64: most WIN32 development did occur in this + native environment. Best results were achieved with + MSYS-1.0.* and TDM-GCC: + + mingw: http://www.mingw.org/ + original msys: http://www.mingw.org/wiki/MSYS + mingw64: http://mingw-w64.sourceforge.net/ + TDM-GCC: http://tdm-gcc.tdragon.net/ + + * This distribution was compiled with the MSYS2 integrated + development, that supports 32 and 64 bit compilation. Setting up + MSYS2 should be done with care, but it is worth it as the + distribution works nicely in MINGW32 and MINGW64 mode. A third + compilation mode, MSYS mode, has problems with compiling sockets. + + msys2: http://sourceforge.net/projects/msys2/ + + * cygwin and cygwin64 now can generate native applications + + cygwin: https://www.cygwin.com/ + + * Linux has a nice cross-compilation environment, with some of the best + work done for Fedora. + + fedora mingw cross-compiler: http://fedoraproject.org/wiki/MinGW/CrossCompilerFramework + + One problem is that this environment requires emulation of WIN32 + executables to generate the initial saved state and to compile + `chr`. `wine` sometimes does the task, but it sometimes fails. + + * OSX has the `mxe` package, a port of mingw that is in active + development. + + mxe: http://mxe.cc/ + + Note that OSX has technical limitations that preclude porting + wine64. wine32 is distributed with package managers such as ports + and brew. + +=== Setting up WIN32 compilation + +Compiling WIN32 packages depends on a number of parameters: chosen compiler, +packages to install, directory setup. You may have to change these ones that +control the `mkwin` script: + + * `VER`: major/minor number + * `PATCHID`: third digit + * `SRC`: directory containing yap sources, in the local environment notation. + * `SRC_WIN`: same, but in WIN32 standard notation. + * `THREADS`: yes or no? controllable from the command line. + * `ABI`: "32" or "64", controllable from the command line. + * `NSIS`: installer generator, usually "/c/Program Files (x86)/NSIS/makensis". + * `DOCS_DIR`: where you have the doxygen output. + * `GCC_DIR`: root of gcc seup. + * `HOST`: argument to `--host` configure command. + * `BUILD`: build directory + * `GMP`: multi-precision package; yes, no, or the installation directory; usually in the distribution. + * `CUDD`: BDD package, usually in the distribution. + * `JAVA`: Java sdk directory, usually in the distribution. + * `PYTHON`: Python package, usually in the distribution. + * `R`: R environment package, usually in the distribution. + * `GECODE`: constraint solver package, usually not in the WIN32 distribution. \ No newline at end of file diff --git a/misc/yap.nsi b/misc/yap.nsi index 958e5b9e5..e19ed40e2 100755 --- a/misc/yap.nsi +++ b/misc/yap.nsi @@ -18,9 +18,9 @@ ReserveFile "${NSISDIR}\Plugins\x86-unicode\InstallOptions.dll" ReserveFile "${OPTIONS}" !ifdef WIN64 -InstallDir "$PROGRAMFILES64\${ROOTDIR}" +InstallDir "$PROGRAMFILES64\${TARGET}" !else -InstallDir "$PROGRAMFILES\${ROOTDIR}" +InstallDir "$PROGRAMFILES\${TARGET}" !endif InstallDirRegKey HKLM ${REGKEY} "home" @@ -72,7 +72,7 @@ Section "Base system (required)" File /r ${ROOTDIR}\share\Yap\* SetOutPath $INSTDIR\share\doc\Yap - File ${ROOTDIR}\share\doc\Yap\html\index.html + File ${ROOTDIR}\share\doc\Yap\html\* ; File ${ROOTDIR}\share\doc\Yap\refman.pdf ; File ${ROOTDIR}\share\doc\Yap\yap.info File ${ROOTDIR}\share\doc\Yap\Artistic diff --git a/os/pl-stream.c b/os/pl-stream.c index 238a520f0..0231f128a 100755 --- a/os/pl-stream.c +++ b/os/pl-stream.c @@ -886,6 +886,13 @@ put_code(int c, IOSTREAM *s) unsigned char *q = (unsigned char *)&chr; unsigned char *e = &q[sizeof(pl_wchar_t)]; +#if __WINDOWS__ + if (s == Soutput || s == Serror ) { + if (!(*s->functions->write)(s->handle, (char *)q, sizeof(wchar_t))) + return -1; + break; + } +#endif while(q