summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile8
-rw-r--r--windows.c139
-rw-r--r--windows.h28
4 files changed, 179 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b3a521..6a47d64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1998-08-02 Ben Elliston <bje@cygnus.com>
+
+ * windows.h: Remove duplicate TlsSetValue() prototype. Add
+ TlsGetValue() prototype.
+ (FALSE): Define.
+ (TRUE): Likewise.
+ Add forgotten errno values. Guard against multiple #includes.
+
+ * windows.c: New file. Implement stubs for Win32 functions.
+
+ * Makefile (SRCS): Remove. Not explicitly needed.
+ (CFLAGS): Add -Wall for all warnings with GCC.
+
Sun Aug 2 19:03:42 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* config.h: Create. This is a temporary stand-in for autoconf yet
diff --git a/Makefile b/Makefile
index c18458d..de64ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,5 @@
-CFLAGS = -I. -DHAVE_CONFIG_H
-
-SRCS = attr.c cancel.c cleanup.c condvar.c create.c dll.c \
- exit.c fork.c global.c misc.c mutex.c private.c sched.c \
- signal.c sync.c tsd.c
+CFLAGS = -I. -DHAVE_CONFIG_H -Wall
OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o \
exit.o fork.o global.o misc.o mutex.o private.o sched.o \
@@ -11,4 +7,4 @@ OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o \
INCL = implement.h pthread.h windows.h
-all: $(OBJS) \ No newline at end of file
+all: $(OBJS)
diff --git a/windows.c b/windows.c
new file mode 100644
index 0000000..2549f33
--- /dev/null
+++ b/windows.c
@@ -0,0 +1,139 @@
+/*
+ * windows.c
+ *
+ * This translation unit implements stubs for all of the Windows API
+ * calls. If debugging is on, we dump out diagnostic output for
+ * reassurance.
+ *
+ */
+
+#include <stdio.h>
+
+#include "windows.h"
+
+#define DEBUG 1
+
+#ifdef DEBUG
+#define DIAG(fn) fprintf(stderr, "called: %s\n", fn)
+#endif /* DEBUG */
+
+HANDLE CreateEvent(LPSECURITY_ATTRIBUTES security,
+ BOOL manualReset,
+ BOOL initialState,
+ LPCTSTR name)
+{
+ DIAG("CreateEvent");
+ return 0;
+}
+
+BOOL SetEvent(HANDLE event)
+{
+ DIAG("SetEvent");
+ return TRUE;
+}
+
+BOOL ResetEvent(HANDLE event)
+{
+ DIAG("ResetEvent");
+ return TRUE;
+}
+
+VOID EnterCriticalSection(LPCRITICAL_SECTION criticalSection)
+{
+ DIAG("EnterCriticalSection");
+}
+
+VOID LeaveCriticalSection(LPCRITICAL_SECTION criticalSection)
+{
+ DIAG("LeaveCriticalSection");
+}
+
+VOID DeleteCriticalSection(LPCRITICAL_SECTION criticalSection)
+{
+ DIAG("DeleteCriticalSection");
+}
+
+VOID InitializeCriticalSection(LPCRITICAL_SECTION criticalSection)
+{
+ DIAG("InitializeCriticalSection");
+}
+
+BOOL TryEnterCriticalSection(LPCRITICAL_SECTION criticalSection)
+{
+ DIAG("TryEnterCriticalSection");
+ return TRUE;
+}
+
+DWORD WaitForMultipleObjects(DWORD numObjects,
+ CONST HANDLE * objectArray,
+ BOOL waitForAll,
+ DWORD timeout)
+{
+ DIAG("WaitForMultipleObjects");
+ return 0;
+}
+
+DWORD WaitForSingleObject(HANDLE object,
+ DWORD timeout)
+{
+ DIAG("WaitForSingleObject");
+ return 0;
+}
+
+DWORD TlsAlloc()
+{
+ DIAG("TlsAlloc");
+ return 0;
+}
+
+BOOL TlsFree(DWORD index)
+{
+ DIAG("TlsFree");
+ return TRUE;
+}
+
+BOOL TlsSetValue(DWORD index, LPVOID value)
+{
+ DIAG("TlsSetValue");
+ return TRUE;
+}
+
+BOOL TlsGetValue(DWORD index, LPVOID value)
+{
+ DIAG("TlsGetValue");
+ return TRUE;
+}
+
+BOOL SetThreadPriority(HANDLE threadHandle, int priority)
+{
+ DIAG("SetThreadPriority");
+ return TRUE;
+}
+
+int GetThreadPriority(HANDLE threadHandle)
+{
+ DIAG("GetThreadPriority");
+ return 0;
+}
+
+HANDLE _beginthreadex(LPSECURITY_ATTRIBUTES security,
+ DWORD stack,
+ unsigned (* start_routine)(void *),
+ LPVOID param,
+ DWORD flags,
+ LPDWORD threadID)
+{
+ DIAG("_beginthreadex");
+ return 0;
+}
+
+VOID _endthreadex(DWORD thread)
+{
+ DIAG("_endthreadex");
+}
+
+DWORD GetVersion(VOID)
+{
+ DIAG("GetVersion");
+ return 0;
+}
diff --git a/windows.h b/windows.h
index 31e2d0c..08fd326 100644
--- a/windows.h
+++ b/windows.h
@@ -6,6 +6,17 @@
*
*/
+#ifndef WINDOWS_H
+#define WINDOWS_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+
+#ifndef FALSE
+#define FALSE 0
+#endif /* FALSE */
+
#define WINAPI
#define CONST const
@@ -18,13 +29,23 @@
#define DLL_PROCESS_DETACH 3
+#define INFINITE 42
+
+#define WAIT_OBJECT_0 0
+
+#define WAIT_FAILED 1
+
/* Error numbers */
enum {
EINVAL,
ENOMEM,
ENOSYS,
- EAGAIN
+ EAGAIN,
+ EDEADLK,
+ EBUSY,
+ ENOSUP,
+ ESRCH
};
typedef void VOID;
@@ -68,7 +89,7 @@ VOID DeleteCriticalSection(LPCRITICAL_SECTION criticalSection);
VOID InitializeCriticalSection(LPCRITICAL_SECTION criticalSection);
-VOID TryEnterCriticalSection(LPCRITICAL_SECTION criticalSection);
+BOOL TryEnterCriticalSection(LPCRITICAL_SECTION criticalSection);
DWORD WaitForMultipleObjects(DWORD numObjects,
CONST HANDLE * objectArray,
@@ -84,7 +105,7 @@ BOOL TlsFree(DWORD index);
BOOL TlsSetValue(DWORD index, LPVOID value);
-BOOL TlsSetValue(DWORD index, LPVOID value);
+LPVOID TlsGetValue(DWORD index);
BOOL SetThreadPriority(HANDLE threadHandle, int priority);
@@ -101,3 +122,4 @@ VOID _endthreadex(DWORD);
DWORD GetVersion(VOID);
+#endif /* WINDOWS_H */