}
}
- {
- char szMessage[PATH_MAX];
- snprintf(szMessage, PATH_MAX, "Tracing to %s\n", szFileName);
- OS::DebugMessage(szMessage);
- }
+ OS::DebugMessage("apitrace: tracing to %s\n", szFileName);
g_gzFile = gzopen(szFileName, "wb");
}
def wrap_ret(self, function, instance):
if function.name == "wglGetProcAddress":
print ' if (%s) {' % instance
+ else_ = ''
for f in wglapi.functions:
ptype = self.function_pointer_type(f)
pvalue = self.function_pointer_value(f)
- print ' if (!strcmp("%s", lpszProc)) {' % f.name
+ print ' %sif (!strcmp("%s", lpszProc)) {' % (else_, f.name)
print ' %s = (%s)%s;' % (pvalue, ptype, instance)
print ' %s = (%s)&%s;' % (instance, function.type, f.name);
print ' }'
+ else_ = 'else '
+ print ' %s{' % (else_,)
+ print ' OS::DebugMessage("apitrace: unknown function \\"%s\\"\\n", lpszProc);'
+ print ' }'
print ' }'
print '#include "glimports.hpp"'
print
print '#include "log.hpp"'
+ print '#include "os.hpp"'
print '#include "glsize.hpp"'
print
print '#ifndef PFD_SUPPORT_DIRECTDRAW'
#ifndef _OS_HPP_
#define _OS_HPP_
+#include <stdlib.h>
+#include <stdarg.h>
+
#ifdef WIN32
#ifndef snprintf
#define snprintf _snprintf
bool GetProcessName(char *str, size_t size);
bool GetCurrentDir(char *str, size_t size);
-void DebugMessage(const char *str);
+void DebugMessage(const char *format, ...);
void Abort(void);
}
void
-DebugMessage(const char *message)
+DebugMessage(const char *format, ...)
{
+ va_list ap;
+ va_start(ap, format);
fflush(stdout);
- fputs(message, stderr);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
}
void
}
void
-DebugMessage(const char *message)
+DebugMessage(const char *format, ...)
{
- OutputDebugStringA(message);
+ char buf[4096];
+
+ va_list ap;
+ va_start(ap, format);
+ fflush(stdout);
+ vsnprintf(buf, sizeof buf, format, ap);
+ va_end(ap);
+
+ OutputDebugStringA(buf);
if (!IsDebuggerPresent()) {
fflush(stdout);
- fputs(message, stderr);
+ fputs(buf, stderr);
fflush(stderr);
}
}
StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),
StdFunction(Int, "wglGetSwapIntervalEXT", [], sideeffects=False),
+ # WGL_NV_vertex_array_range
+ StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
+ StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
+
# must be last
StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),
])