Artifact ddc438e19cac10d66b2ce8bfa12292599a5d0128:
- File
win/include/unistd.h
— part of check-in
[f66f414f]
at
2010-08-28 06:59:10
on branch windowscompilers
—
This is the first check-in on the windowscompilers branch and it adds the Digital Mars C compiler
The user should have dmc installed in c:\DM with zlib in c:\DM\extra\lib and c:\DM\extra\include.
typing c:\DM\bin\make -f win\Makefile.dmc builds fossil.exe in dmcobj
The following files were edited or added:
(user: renez size: 736) [more...]Checks if one of the windows compilers is used. If so we define _WIN32. Defining _WIN32 is normally done by
#include <windows.h>
However most of the time we don't use windows.h.Adding an other windows compiler is done by adding
"|| defined(__COMPILER_IDENTIFIER__)"
and maybe some special things in the files below. LikeThese have all __MINGW32__ replaced by _WIN32. And in some places special processing for either MINGW32 or DMC
In popen2 the _open_osfHandle call first parameter is cast to a long. DMC refused to compile without the cast.
DMC complained that it didn't knew of time_t in rss.h. time.h came after rss.h. Switching the two solved it!
added tcl code to generate Makefile.dmc. tclsh src/makemake.tcl dmc prints to stdout the makefile. As a convienience to the end-user I added the win/Makefile.dmc to the repository. There are few changeable variables in there for adjusting path, CFLAGS LIBS etc.
These are needed because DMC and MSVC doesn't provided them. dirent.h is copied verbatim from the net. unistd.h I found on the net too, but added some defines.
The problem with windows it doesn't have AWK standard installed. version.c creates VERSION.h. It is a very simple C-program and doesn't do a lot of checking.
#ifndef _UNISTD_H #define _UNISTD_H 1 /* This file intended to serve as a drop-in replacement for * unistd.h on Windows * Please add functionality as neeeded */ #include <stdlib.h> #include <io.h> #define srandom srand #define random rand #if defined(__DMC__) #endif #if defined(_WIN32) #define _CRT_SECURE_NO_WARNINGS 1 #ifndef F_OK #define F_OK 0 #endif /* not F_OK */ #ifndef X_OK #define X_OK 1 #endif /* not X_OK */ #ifndef R_OK #define R_OK 2 #endif /* not R_OK */ #ifndef W_OK #define W_OK 4 #endif /* not W_OK */ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #define access _access #define ftruncate _chsize #define ssize_t int #endif /* unistd.h */