ekg2
|
00001 #ifdef __MINGW32__ 00002 # define NO_POSIX_SYSTEM "mingw" 00003 #else 00004 # define EKG2_WIN32_H 00005 # undef NO_POSIX_SYSTEM 00006 #endif 00007 00008 #ifndef EKG2_WIN32_H 00009 #define EKG2_WIN32_H 00010 00011 #include "ekg2-config.h" 00012 00013 #ifdef PLUGIN_SHARED_LIBS 00014 # define EKG2_WIN32_SHARED_LIB "da! we want shared libs...... DLL's HELL! :> yeah, let's rock." 00015 # define EKG2_WIN32_HELPERS 00016 #endif 00017 00018 #if 0 00019 typedef unsigned long uint32_t; 00020 typedef unsigned short uint16_t; 00021 typedef unsigned char uint8_t; 00022 #endif 00023 00024 #include <windef.h> 00025 #include <stdint.h> 00026 #include <stdlib.h> 00027 #include <winsock2.h> 00028 #include <ws2tcpip.h> 00029 00030 #include <sys/types.h> 00031 #include <sys/stat.h> 00032 #include <unistd.h> 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 #undef pipe 00039 typedef unsigned __int64 u_int64_t; 00040 00041 struct utsname { 00042 /* XXX, len */ 00043 char sysname[30]; 00044 char nodename[30]; 00045 char release[30]; 00046 char version[30]; 00047 char machine[30]; 00048 }; 00049 00050 struct timezone { /* XXX */ 00051 int tz_minuteswest; /* minutes west of Greenwich */ 00052 int tz_dsttime; /* type of DST correction */ 00053 }; 00054 /* shared */ 00055 #ifdef EKG2_WIN32_SHARED_LIB 00056 # define EKG2_WIN32_NOFUNCTION 1 00057 # error "Currently --enable-shared don't work automagicly pass --enable-static to ./configure if you really want. contact with me. (jid:darkjames@chrome.pl)" 00058 # include "win32_helper.h" 00059 #endif 00060 00061 #define THREAD(x) DWORD x(void *data) 00062 typedef THREAD(thread_func_t); 00063 00064 # ifndef EKG2_WIN32_NOFUNCTION 00065 pid_t fork(void); /* unimpl */ 00066 HANDLE win32_fork(thread_func_t *addr, void *data); 00067 00068 /* fcntl.h */ 00069 #define F_SETFL 4 00070 #define O_NONBLOCK 04000 00071 int fcntl(int fd, int cmd, long arg); 00072 /* ... */ 00073 00074 int fchmod(int fildes, mode_t mode); /* unimpl */ 00075 int pipe(int *filedes); 00076 00077 int gettimeofday(struct timeval *tv, struct timezone *tz); /* emulated */ 00078 int ioctl(int fd, int request, void *flags); /* BAD PROTOTYPE. I KNOW. XXX, emulate some things */ 00079 int uname(struct utsname *buf); /* emulated ? */ 00080 00081 #endif 00082 00083 #define EINPROGRESS WSAEINPROGRESS 00084 00085 #define fileno(__F) ((__F)->_file) 00086 #define sleep(x) Sleep(x * 1000) 00087 00088 #ifdef __cplusplus 00089 } 00090 #endif 00091 00092 #endif 00093