changeset 573:d300e9a049fa

merge
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Thu, 04 Sep 2008 17:05:51 +0200
parents 91d436eaedee (diff) 6d9cf3f74f93 (current diff)
children aee6217b4084
files
diffstat 10 files changed, 36 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/attrib.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/attrib.c	Thu Sep 04 17:05:51 2008 +0200
@@ -14,7 +14,7 @@
 
 #if _WIN32 || IN_GCC || IN_LLVM
 #include "mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #endif
 
--- a/dmd/doc.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/doc.c	Thu Sep 04 17:05:51 2008 +0200
@@ -21,7 +21,7 @@
 #else
 #if _WIN32
 #include "..\root\mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #else
 #error "fix this"
--- a/dmd/expression.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/expression.c	Thu Sep 04 17:05:51 2008 +0200
@@ -44,7 +44,7 @@
 #include "mem.h"
 #elif _WIN32
 #include "..\root\mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #endif
 
--- a/dmd/hdrgen.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/hdrgen.c	Thu Sep 04 17:05:51 2008 +0200
@@ -29,7 +29,7 @@
 #else
 #if _WIN32
 #include "..\root\mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #else
 #error "fix this"
--- a/dmd/inifile.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/inifile.c	Thu Sep 04 17:05:51 2008 +0200
@@ -79,7 +79,7 @@
 		filename = FileName::replaceName(argv0, inifile);
 		if (!FileName::exists(filename))
 		{
-#if linux || __APPLE__
+#if POSIX
 
 #if 0
 #if __GLIBC__	    // This fix by Thomas Kuehne
--- a/dmd/macro.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/macro.c	Thu Sep 04 17:05:51 2008 +0200
@@ -21,7 +21,7 @@
 #else
 #if _WIN32
 #include "..\root\mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #else
 #error "fix this"
--- a/dmd/mars.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/mars.c	Thu Sep 04 17:05:51 2008 +0200
@@ -19,7 +19,7 @@
 #include <dos.h>
 #endif
 
-#if linux || __APPLE__
+#if POSIX
 #include <errno.h>
 #elif _WIN32
 #include <windows.h>
@@ -60,7 +60,7 @@
     bc_ext  = "bc";
 #if _WIN32
     nativeobj_ext = "obj";
-#elif linux || __APPLE__
+#elif POSIX
     nativeobj_ext = "o";
 #else
 #error "fix this"
@@ -344,7 +344,7 @@
 
 #if _WIN32
     inifile(global.params.argv0, "llvmdc.ini");
-#elif linux || __APPLE__
+#elif POSIX
     inifile(global.params.argv0, "llvmdc.conf");
 #else
 #error
--- a/dmd/opover.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/opover.c	Thu Sep 04 17:05:51 2008 +0200
@@ -20,7 +20,7 @@
 
 #if IN_GCC || IN_LLVM
 #include "mem.h"
-#elif linux || __APPLE__
+#elif POSIX
 #include "../root/mem.h"
 #elif _WIN32
 #include "..\root\mem.h"
--- a/dmd/root.c	Thu Sep 04 16:14:07 2008 +0200
+++ b/dmd/root.c	Thu Sep 04 17:05:51 2008 +0200
@@ -23,7 +23,7 @@
 #include <direct.h>
 #endif
 
-#if linux || __APPLE__
+#if POSIX
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -370,13 +370,10 @@
 			instring ^= 1;	// toggle inside/outside of string
 			continue;
 
-/*#if MACINTOSH
-		    case ',':
-#endif*/
 #if _WIN32
 		    case ';':
 #endif
-#if linux || __APPLE__
+#if POSIX
 		    case ':':
 #endif
 			p++;
@@ -390,7 +387,7 @@
 		    case '\r':
 			continue;	// ignore carriage returns
 
-#if linux || __APPLE__
+#if POSIX
 		    case '~':
 			buf.writestring(getenv("HOME"));
 			continue;
@@ -714,7 +711,7 @@
 	return 1;
     if (!e || !ext)
 	return 0;
-#if linux || __APPLE__
+#if POSIX
     return strcmp(e,ext) == 0;
 #endif
 #if _WIN32
@@ -733,7 +730,7 @@
 #if _WIN32
     file.touchtime = mem.malloc(sizeof(WIN32_FIND_DATAA));	// keep same file time
 #endif
-#if linux || __APPLE__
+#if POSIX
     file.touchtime = mem.malloc(sizeof(struct stat)); // keep same file time
 #endif
     file.readv();
@@ -775,7 +772,7 @@
 
 int FileName::exists(const char *name)
 {
-#if linux || __APPLE__
+#if POSIX
     struct stat st;
 
     if (stat(name, &st) < 0)
@@ -822,7 +819,7 @@
 #if _WIN32
 	    if (path[strlen(path) - 1] != '\\')
 #endif
-#if linux || __APPLE__
+#if POSIX
 	    if (path[strlen(path) - 1] != '\\')
 #endif
 	    {
@@ -830,7 +827,7 @@
 #if _WIN32
 		if (mkdir(path))
 #endif
-#if linux || __APPLE__
+#if POSIX
 		if (mkdir(path, 0777))
 #endif
 		    error("cannot create directory %s", path);
@@ -886,7 +883,7 @@
 
 int File::read()
 {
-#if linux || __APPLE__
+#if POSIX
     off_t size;
     ssize_t numread;
     int fd;
@@ -1018,7 +1015,7 @@
 
 int File::mmread()
 {
-#if linux || __APPLE__
+#if POSIX
     return read();
 #endif
 #if _WIN32
@@ -1072,7 +1069,7 @@
 
 int File::write()
 {
-#if linux || __APPLE__
+#if POSIX
     int fd;
     ssize_t numwritten;
     char *name;
@@ -1145,7 +1142,7 @@
 
 int File::append()
 {
-#if linux || __APPLE__
+#if POSIX
     return 1;
 #endif
 #if _WIN32
@@ -1225,7 +1222,7 @@
 
 int File::exists()
 {
-#if linux || __APPLE__
+#if POSIX
     return 0;
 #endif
 #if _WIN32
@@ -1250,7 +1247,7 @@
 
 void File::remove()
 {
-#if linux || __APPLE__
+#if POSIX
     ::remove(this->name->toChars());
 #endif
 #if _WIN32
@@ -1265,7 +1262,7 @@
 
 Array *File::match(FileName *n)
 {
-#if linux || __APPLE__
+#if POSIX
     return NULL;
 #endif
 #if _WIN32
@@ -1303,7 +1300,7 @@
 
 int File::compareTime(File *f)
 {
-#if linux || __APPLE__
+#if POSIX
     return 0;
 #endif
 #if _WIN32
@@ -1317,7 +1314,7 @@
 
 void File::stat()
 {
-#if linux || __APPLE__
+#if POSIX
     if (!touchtime)
     {
 	touchtime = mem.calloc(1, sizeof(struct stat));
@@ -1622,7 +1619,7 @@
 	    break;
 	psize *= 2;
 #endif
-#if linux || __APPLE__
+#if POSIX
 	count = vsnprintf(p,psize,format,args);
 	if (count == -1)
 	    psize *= 2;
@@ -1654,7 +1651,7 @@
 	    break;
 	psize *= 2;
 #endif
-#if linux || __APPLE__
+#if POSIX
 	count = vsnwprintf(p,psize,format,args);
 	if (count == -1)
 	    psize *= 2;
--- a/premake.lua	Thu Sep 04 16:14:07 2008 +0200
+++ b/premake.lua	Thu Sep 04 17:05:51 2008 +0200
@@ -15,6 +15,12 @@
     end
 end
 
+-- are we on a Posix system?
+POSIX = 1
+if OS == "windows" then
+    POSIX = 0
+end
+
 -- D version - don't change these !!!
 DMDV1 = "1"
 
@@ -58,6 +64,7 @@
     "OPAQUE_VTBLS="..OPAQUE_VTBLS,
     "USE_BOEHM_GC="..USE_BOEHM_GC,
     "DMDV1="..DMDV1,
+    "POSIX="..POSIX,
 }
 package.config.Release.defines = { "LLVMD_NO_LOGGER" }
 package.config.Debug.buildoptions = { "-g -O0" }