log - > trace
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 26 Nov 2010 11:35:54 +0000 (11:35 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 26 Nov 2010 11:35:54 +0000 (11:35 +0000)
15 files changed:
CMakeLists.txt
d3d10_1.py
d3d10misc.py
d3d8.py
d3d9.py
d3dshader.py
ddraw.py
glxtrace.py
os_posix.cpp
os_win32.cpp
trace.py
trace_write.cpp [moved from log.cpp with 99% similarity]
trace_write.hpp [moved from log.hpp with 96% similarity]
wgltrace.py
winapi.py

index 2fc59ee..04c7a44 100644 (file)
@@ -102,7 +102,7 @@ if (WIN32)
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8.cpp
        #               DEPENDS d3d8.py d3d8types.py d3d8caps.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d8 SHARED d3d8.def d3d8.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d8 SHARED d3d8.def d3d8.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d8 PROPERTIES PREFIX "")
        #endif (DirectX_D3D8_FOUND)
 
@@ -114,7 +114,7 @@ if (WIN32)
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9.cpp
        #               DEPENDS d3d9.py d3d9types.py d3d9caps.py d3dshader.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d9 SHARED d3d9.def d3d9.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d9 SHARED d3d9.def d3d9.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d9 PROPERTIES PREFIX "")
        #endif (DirectX_D3DX9_FOUND)
 
@@ -126,7 +126,7 @@ if (WIN32)
        #               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp
        #               DEPENDS d3d10misc.py winapi.py stdapi.py
        #       )
-       #       add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp)
+       #       add_library (d3d10 SHARED d3d10.def d3d10.cpp trace_write.cpp os_win32.cpp)
        #       set_target_properties (d3d10 PROPERTIES PREFIX "")
        #endif (DirectX_D3D10_FOUND)
 
@@ -136,7 +136,7 @@ if (WIN32)
                COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/opengl32.cpp
                DEPENDS wgltrace.py trace.py wglapi.py glapi.py glenum.py winapi.py stdapi.py
        )
-       add_library (opengl SHARED opengl32.def opengl32.cpp log.cpp os_win32.cpp)
+       add_library (opengl SHARED opengl32.def opengl32.cpp trace_write.cpp os_win32.cpp)
        set_target_properties (opengl PROPERTIES
                PREFIX ""
                OUTPUT_NAME opengl32)
@@ -153,7 +153,7 @@ else ()
                DEPENDS glxtrace.py trace.py glxapi.py glapi.py glenum.py stdapi.py
        )
 
-       add_library (glxtrace SHARED glxtrace.cpp log.cpp os_posix.cpp)
+       add_library (glxtrace SHARED glxtrace.cpp trace_write.cpp os_posix.cpp)
        set_target_properties (glxtrace PROPERTIES PREFIX "")
        target_link_libraries (glxtrace dl)
 endif ()
index 14420da..c71e880 100644 (file)
@@ -72,6 +72,6 @@ if __name__ == '__main__':
     print
     print '#include <d3d10_1.h>'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print
     wrap()
index 9396a56..00bd0e9 100644 (file)
@@ -64,6 +64,6 @@ if __name__ == '__main__':
     print
     print '#include <d3d10.h>'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print
     wrap()
diff --git a/d3d8.py b/d3d8.py
index 7204554..fdf788f 100644 (file)
--- a/d3d8.py
+++ b/d3d8.py
@@ -283,7 +283,7 @@ if __name__ == '__main__':
     print '#include <tchar.h>'
     print '#include <d3d8.h>'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print
     wrap()
 
diff --git a/d3d9.py b/d3d9.py
index 4e1da90..572d328 100644 (file)
--- a/d3d9.py
+++ b/d3d9.py
@@ -411,7 +411,7 @@ if __name__ == '__main__':
     print
     print '#include <d3d9.h>'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print
     wrap()
 
index bb37678..6093336 100644 (file)
@@ -85,7 +85,7 @@ found:
         LPD3DXBUFFER pDisassembly = NULL;
    
         if (pfnD3DXDisassembleShader( (DWORD *)tokens, FALSE, NULL, &pDisassembly) == D3D_OK)
-            Log::LiteralString((char *)pDisassembly->GetBufferPointer());
+            Trace::LiteralString((char *)pDisassembly->GetBufferPointer());
 
         if(pDisassembly)
             pDisassembly->Release();
index bc1f8f2..0841a8a 100644 (file)
--- a/ddraw.py
+++ b/ddraw.py
@@ -1619,6 +1619,6 @@ if __name__ == '__main__':
     print '#include <tchar.h>'
     print '#include <ddraw.h>'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print
     wrap()
index b8cd151..14aca2a 100644 (file)
@@ -37,7 +37,7 @@ class GlxTracer(Tracer):
             print '    if (!pglXGetProcAddress) {'
             print '        pglXGetProcAddress = (PglXGetProcAddress)dlsym(RTLD_NEXT, "glXGetProcAddress");'
             print '        if (!pglXGetProcAddress)'
-            print '            Log::Abort();'
+            print '            Trace::Abort();'
             print '    }'
             return 'pglXGetProcAddress((const GLubyte *)"%s")' % (function.name,)
 
@@ -65,7 +65,7 @@ if __name__ == '__main__':
     print '#include <GL/glx.h>'
     print '#include "glxext.h"'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print '#include "glsize.hpp"'
     print
     print 'extern "C" {'
index 590738f..f4dbaab 100644 (file)
@@ -30,7 +30,7 @@
 #include <pthread.h>
 
 #include "os.hpp"
-#include "log.hpp"
+#include "trace_write.hpp"
 
 namespace OS {
 
@@ -108,6 +108,6 @@ Abort(void)
 
 static void _uninit(void) __attribute__((destructor));
 static void _uninit(void) {
-    Log::Close();
+    Trace::Close();
 }
 
index 5f8dddf..f9fb56a 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 #include "os.hpp"
-#include "log.hpp"
+#include "trace_write.hpp"
 
 
 namespace OS {
@@ -131,7 +131,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
     case DLL_THREAD_DETACH:
         return TRUE;
     case DLL_PROCESS_DETACH:
-        Log::Close();
+        Trace::Close();
         return TRUE;
     }
     (void)hinstDLL;
index 677faf3..388729a 100644 (file)
--- a/trace.py
+++ b/trace.py
@@ -51,12 +51,12 @@ class DumpDeclarator(stdapi.OnceVisitor):
         for type, name in struct.members:
             self.visit(type)
         print 'static void __traceStruct%s(const %s &value) {' % (struct.id, struct.expr)
-        print '    Log::BeginStruct(%u);' % len(struct.members)
+        print '    Trace::BeginStruct(%u);' % len(struct.members)
         for type, name in struct.members:
-            print '    Log::BeginMember("%s");' % (name,)
+            print '    Trace::BeginMember("%s");' % (name,)
             dump_instance(type, 'value.%s' % (name,))
-            print '    Log::EndMember();'
-        print '    Log::EndStruct();'
+            print '    Trace::EndMember();'
+        print '    Trace::EndStruct();'
         print '}'
         print
 
@@ -71,10 +71,10 @@ class DumpDeclarator(stdapi.OnceVisitor):
         print '    switch(value) {'
         for value in enum.values:
             print '    case %s:' % value
-            print '        Log::LiteralNamedConstant("%s", %s);' % (value, value)
+            print '        Trace::LiteralNamedConstant("%s", %s);' % (value, value)
             print '        break;'
         print '    default:'
-        print '        Log::LiteralSInt(value);'
+        print '        Trace::LiteralSInt(value);'
         print '        break;'
         print '    }'
         print '}'
@@ -82,16 +82,16 @@ class DumpDeclarator(stdapi.OnceVisitor):
 
     def visit_bitmask(self, bitmask):
         print 'static void __traceBitmask%s(%s value) {' % (bitmask.id, bitmask.type)
-        print '    Log::BeginBitmask();'
+        print '    Trace::BeginBitmask();'
         for value in bitmask.values:
             print '    if((value & %s) == %s) {' % (value, value)
-            print '        Log::LiteralNamedConstant("%s", %s);' % (value, value)
+            print '        Trace::LiteralNamedConstant("%s", %s);' % (value, value)
             print '        value &= ~%s;' % value
             print '    }'
         print '    if(value) {'
         dump_instance(bitmask.type, "value");
         print '    }'
-        print '    Log::EndBitmask();'
+        print '    Trace::EndBitmask();'
         print '}'
         print
 
@@ -115,13 +115,13 @@ class DumpImplementer(stdapi.Visitor):
     '''Dump an instance.'''
 
     def visit_literal(self, literal, instance):
-        print '    Log::Literal%s(%s);' % (literal.format, instance)
+        print '    Trace::Literal%s(%s);' % (literal.format, instance)
 
     def visit_string(self, string, instance):
         if string.length is not None:
-            print '    Log::LiteralString((const char *)%s, %s);' % (instance, string.length)
+            print '    Trace::LiteralString((const char *)%s, %s);' % (instance, string.length)
         else:
-            print '    Log::LiteralString((const char *)%s);' % instance
+            print '    Trace::LiteralString((const char *)%s);' % instance
 
     def visit_const(self, const, instance):
         self.visit(const.type, instance)
@@ -132,19 +132,19 @@ class DumpImplementer(stdapi.Visitor):
     def visit_array(self, array, instance):
         print '    if(%s) {' % instance
         index = '__i' + array.type.id
-        print '        Log::BeginArray(%s);' % (array.length,)
+        print '        Trace::BeginArray(%s);' % (array.length,)
         print '        for (int %s = 0; %s < %s; ++%s) {' % (index, index, array.length, index)
-        print '            Log::BeginElement();'
+        print '            Trace::BeginElement();'
         self.visit(array.type, '(%s)[%s]' % (instance, index))
-        print '            Log::EndElement();'
+        print '            Trace::EndElement();'
         print '        }'
-        print '        Log::EndArray();'
+        print '        Trace::EndArray();'
         print '    }'
         print '    else'
-        print '        Log::LiteralNull();'
+        print '        Trace::LiteralNull();'
 
     def visit_blob(self, blob, instance):
-        print '    Log::LiteralBlob(%s, %s);' % (instance, blob.size)
+        print '    Trace::LiteralBlob(%s, %s);' % (instance, blob.size)
 
     def visit_enum(self, enum, instance):
         print '    __traceEnum%s(%s);' % (enum.id, instance)
@@ -154,14 +154,14 @@ class DumpImplementer(stdapi.Visitor):
 
     def visit_pointer(self, pointer, instance):
         print '    if(%s) {' % instance
-        print '        Log::BeginArray(1);'
-        print '        Log::BeginElement();'
+        print '        Trace::BeginArray(1);'
+        print '        Trace::BeginElement();'
         dump_instance(pointer.type, "*" + instance)
-        print '        Log::EndElement();'
-        print '        Log::EndArray();'
+        print '        Trace::EndElement();'
+        print '        Trace::EndArray();'
         print '    }'
         print '    else'
-        print '        Log::LiteralNull();'
+        print '        Trace::LiteralNull();'
 
     def visit_handle(self, handle, instance):
         self.visit(handle.type, instance)
@@ -170,10 +170,10 @@ class DumpImplementer(stdapi.Visitor):
         self.visit(alias.type, instance)
 
     def visit_opaque(self, opaque, instance):
-        print '    Log::LiteralOpaque((const void *)%s);' % instance
+        print '    Trace::LiteralOpaque((const void *)%s);' % instance
 
     def visit_interface(self, interface, instance):
-        print '    Log::LiteralOpaque((const void *)%s);' % instance
+        print '    Trace::LiteralOpaque((const void *)%s);' % instance
 
 
 dump_instance = DumpImplementer().visit
@@ -297,7 +297,7 @@ class Tracer:
                 assert function.fail != ''
                 print '            return %s;' % function.fail
         else:
-            print '            Log::Abort();'
+            print '            Trace::Abort();'
 
     def get_function_address(self, function):
         raise NotImplementedError
@@ -320,21 +320,21 @@ class Tracer:
             print '    %s __result;' % function.type
             result = '__result = '
         self._get_true_pointer(function)
-        print '    unsigned __call = Log::BeginEnter("%s");' % (function.name)
+        print '    unsigned __call = Trace::BeginEnter("%s");' % (function.name)
         for arg in function.args:
             if not arg.output:
                 self.unwrap_arg(function, arg)
                 self.dump_arg(function, arg)
-        print '    Log::EndEnter();'
+        print '    Trace::EndEnter();'
         print '    %s%s(%s);' % (result, pvalue, ', '.join([str(arg.name) for arg in function.args]))
-        print '    Log::BeginLeave(__call);'
+        print '    Trace::BeginLeave(__call);'
         for arg in function.args:
             if arg.output:
                 self.dump_arg(function, arg)
                 self.wrap_arg(function, arg)
         if function.type is not stdapi.Void:
             self.dump_ret(function, "__result")
-        print '    Log::EndLeave();'
+        print '    Trace::EndLeave();'
         if function.type is not stdapi.Void:
             self.wrap_ret(function, "__result")
             print '    return __result;'
@@ -342,9 +342,9 @@ class Tracer:
         print
 
     def dump_arg(self, function, arg):
-        print '    Log::BeginArg(%u, "%s");' % (arg.index, arg.name,)
+        print '    Trace::BeginArg(%u, "%s");' % (arg.index, arg.name,)
         dump_instance(arg.type, arg.name)
-        print '    Log::EndArg();'
+        print '    Trace::EndArg();'
 
     def wrap_arg(self, function, arg):
         wrap_instance(arg.type, arg.name)
@@ -353,9 +353,9 @@ class Tracer:
         unwrap_instance(arg.type, arg.name)
 
     def dump_ret(self, function, instance):
-        print '    Log::BeginReturn();'
+        print '    Trace::BeginReturn();'
         dump_instance(function.type, instance)
-        print '    Log::EndReturn();'
+        print '    Trace::EndReturn();'
 
     def wrap_ret(self, function, instance):
         wrap_instance(function.type, instance)
@@ -403,10 +403,10 @@ class Tracer:
         else:
             print '    %s __result;' % method.type
             result = '__result = '
-        print '    Log::BeginCall("%s");' % (interface.name + '::' + method.name)
-        print '    Log::BeginArg(0, "this");'
-        print '    Log::LiteralOpaque((const void *)m_pInstance);'
-        print '    Log::EndArg();'
+        print '    Trace::BeginCall("%s");' % (interface.name + '::' + method.name)
+        print '    Trace::BeginArg(0, "this");'
+        print '    Trace::LiteralOpaque((const void *)m_pInstance);'
+        print '    Trace::EndArg();'
         for arg in method.args:
             if not arg.output:
                 self.unwrap_arg(method, arg)
@@ -417,11 +417,11 @@ class Tracer:
                 self.dump_arg(method, arg)
                 self.wrap_arg(method, arg)
         if method.type is not Void:
-            print '    Log::BeginReturn("%s");' % method.type
+            print '    Trace::BeginReturn("%s");' % method.type
             dump_instance(method.type, "__result")
-            print '    Log::EndReturn();'
+            print '    Trace::EndReturn();'
             wrap_instance(method.type, '__result')
-        print '    Log::EndCall();'
+        print '    Trace::EndCall();'
         if method.name == 'QueryInterface':
             print '    if (*ppvObj == m_pInstance)'
             print '        *ppvObj = this;'
similarity index 99%
rename from log.cpp
rename to trace_write.cpp
index 719666f..054303b 100644 (file)
--- a/log.cpp
 #include <zlib.h>
 
 #include "os.hpp"
-#include "log.hpp"
+#include "trace_write.hpp"
 #include "trace_format.hpp"
 
 
-namespace Log {
+namespace Trace {
 
 
 static gzFile g_gzFile = NULL;
@@ -321,4 +321,4 @@ void Abort(void) {
     OS::Abort();
 }
 
-} /* namespace Log */
+} /* namespace Trace */
similarity index 96%
rename from log.hpp
rename to trace_write.hpp
index edbf002..7b494e4 100644 (file)
--- a/log.hpp
  *
  **************************************************************************/
 
-#ifndef _LOG_HPP_
-#define _LOG_HPP_
+#ifndef _TRACE_HPP_
+#define _TRACE_HPP_
 
-namespace Log {
+namespace Trace {
 
     void Open(void);
     void Close(void);
@@ -74,4 +74,4 @@ namespace Log {
     void Abort(void);
 }
 
-#endif /* _LOG_HPP_ */
+#endif /* _TRACE_HPP_ */
index b5f94f3..f75ae80 100644 (file)
@@ -403,7 +403,7 @@ class WglTracer(Tracer):
             print '        if (!pwglGetProcAddress) {'
             print '            pwglGetProcAddress = (PwglGetProcAddress)__GetProcAddress("wglGetProcAddress");'
             print '            if (!pwglGetProcAddress)'
-            print '                Log::Abort();'
+            print '                Trace::Abort();'
             print '        }'
             return 'pwglGetProcAddress("%s")' % (function.name,)
 
@@ -431,7 +431,7 @@ if __name__ == '__main__':
     print
     print '#include "glimports.hpp"'
     print
-    print '#include "log.hpp"'
+    print '#include "trace_write.hpp"'
     print '#include "os.hpp"'
     print '#include "glsize.hpp"'
     print
index 30826e3..5345a0d 100644 (file)
--- a/winapi.py
+++ b/winapi.py
@@ -199,13 +199,13 @@ class Dll:
         print r'        if(!GetSystemDirectory(g_szDll, MAX_PATH))'
         print r'            return FALSE;'
         print r'        _tcscat(g_szDll, TEXT("\\%s.dll"));' % self.name
-        print r'        Log::Open("%s");' % self.name
+        print r'        Trace::Open("%s");' % self.name
         print r'    case DLL_THREAD_ATTACH:'
         print r'        return TRUE;'
         print r'    case DLL_THREAD_DETACH:'
         print r'        return TRUE;'
         print r'    case DLL_PROCESS_DETACH:'
-        print r'        Log::Close();'
+        print r'        Trace::Close();'
         print r'        if(g_hDll) {'
         print r'            FreeLibrary(g_hDll);'
         print r'            g_hDll = NULL;'