aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/os/os_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/os/os_misc.c')
-rw-r--r--src/gallium/auxiliary/os/os_misc.c120
1 files changed, 2 insertions, 118 deletions
diff --git a/src/gallium/auxiliary/os/os_misc.c b/src/gallium/auxiliary/os/os_misc.c
index 384988017b7..5744dd5b4fc 100644
--- a/src/gallium/auxiliary/os/os_misc.c
+++ b/src/gallium/auxiliary/os/os_misc.c
@@ -31,19 +31,7 @@
#include <stdarg.h>
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-
-#include <windows.h>
-#include <winddi.h>
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <types.h>
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
@@ -59,44 +47,16 @@
#endif
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-static INLINE void
-_EngDebugPrint(const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- EngDebugPrint("", (PCHAR)format, ap);
- va_end(ap);
-}
-#endif
-
-
void
os_log_message(const char *message)
{
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
- _EngDebugPrint("%s", message);
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
OutputDebugStringA(message);
if(GetConsoleWindow() && !IsDebuggerPresent()) {
fflush(stdout);
fputs(message, stderr);
fflush(stderr);
}
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
- wchar_t *wide_format;
- long wide_str_len;
- /* Format is ascii - needs to be converted to wchar_t for printing */
- wide_str_len = MultiByteToWideChar(CP_ACP, 0, message, -1, NULL, 0);
- wide_format = (wchar_t *) malloc((wide_str_len+1) * sizeof(wchar_t));
- if (wide_format) {
- MultiByteToWideChar(CP_ACP, 0, message, -1,
- wide_format, wide_str_len);
- NKDbgPrintfW(wide_format, wide_format);
- free(wide_format);
- }
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
- /* TODO */
#else /* !PIPE_SUBSYSTEM_WINDOWS */
fflush(stdout);
fputs(message, stderr);
@@ -104,85 +64,9 @@ os_log_message(const char *message)
}
-#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
-static const char *
-find(const char *start, const char *end, char c)
-{
- const char *p;
- for(p = start; !end || p != end; ++p) {
- if(*p == c)
- return p;
- if(*p < 32)
- break;
- }
- return NULL;
-}
-
-static int
-compare(const char *start, const char *end, const char *s)
-{
- const char *p, *q;
- for(p = start, q = s; p != end && *q != '\0'; ++p, ++q) {
- if(*p != *q)
- return 0;
- }
- return p == end && *q == '\0';
-}
-
-static void
-copy(char *dst, const char *start, const char *end, size_t n)
-{
- const char *p;
- char *q;
- for(p = start, q = dst, n = n - 1; p != end && n; ++p, ++q, --n)
- *q = *p;
- *q = '\0';
-}
-#endif
-
-
const char *
os_get_option(const char *name)
{
-#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
- /* EngMapFile creates the file if it does not exists, so it must either be
- * disabled on release versions (or put in a less conspicuous place). */
-#ifdef DEBUG
- const char *result = NULL;
- ULONG_PTR iFile = 0;
- const void *pMap = NULL;
- const char *sol, *eol, *sep;
- static char output[1024];
-
- pMap = EngMapFile(L"\\??\\c:\\gallium.cfg", 0, &iFile);
- if(pMap) {
- sol = (const char *)pMap;
- while(1) {
- /* TODO: handle LF line endings */
- eol = find(sol, NULL, '\r');
- if(!eol || eol == sol)
- break;
- sep = find(sol, eol, '=');
- if(!sep)
- break;
- if(compare(sol, sep, name)) {
- copy(output, sep + 1, eol, sizeof(output));
- result = output;
- break;
- }
- sol = eol + 2;
- }
- EngUnmapFile(iFile);
- }
- return result;
-#else
- return NULL;
-#endif
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
- /* TODO: implement */
- return NULL;
-#else
return getenv(name);
-#endif
}