]> git.cworth.org Git - apitrace/blobdiff - dispatch.py
format.py is not executable.
[apitrace] / dispatch.py
index bfd332bd5dfd029d54f98dcc43ff6b6ba94e338b..666f94aee775a351da699b9c0ea1f90560ef20bd 100644 (file)
@@ -49,7 +49,6 @@ class Dispatcher:
         #
         #  static __PROC __getPublicProcAddress(const char *name);
         #  static __PROC __getPrivateProcAddress(const char *name);
-        #  static void __abort(void);
         #
         raise NotImplementedError
 
@@ -62,7 +61,9 @@ class Dispatcher:
         # functions
         print '#ifdef RETRACE'
         for function in api.functions:
-            if not self.is_public_function(function):
+            if self.is_public_function(function):
+                print '#define __%s %s' % (function.name, function.name)
+            else:
                 print '#define %s __%s' % (function.name, function.name)
         print '#endif /* RETRACE */'
         print
@@ -77,6 +78,7 @@ class Dispatcher:
         print 'static %s %s = NULL;' % (ptype, pvalue)
         print
         print 'static inline ' + function.prototype('__' + function.name) + ' {'
+        print '    const char *__name = "%s";' % function.name
         if function.type is stdapi.Void:
             ret = ''
         else:
@@ -100,14 +102,14 @@ class Dispatcher:
         else:
             get_proc_address = '__getPrivateProcAddress'
         print '    if (!%s) {' % (pvalue,)
-        print '        %s = (%s)%s("%s");' % (pvalue, ptype, get_proc_address, function.name)
+        print '        %s = (%s)%s(__name);' % (pvalue, ptype, get_proc_address)
         print '        if (!%s) {' % (pvalue,)
         self.fail_function(function)
         print '        }'
         print '    }'
 
     def fail_function(self, function):
-        print '            OS::DebugMessage("error: unavailable function \\"%s\\"\\n");' % function.name
+        print r'            OS::DebugMessage("error: unavailable function \"%s\"\n", __name);'
         if function.fail is not None:
             if function.type is stdapi.Void:
                 assert function.fail == ''
@@ -116,6 +118,6 @@ class Dispatcher:
                 assert function.fail != ''
                 print '            return %s;' % function.fail
         else:
-            print '            __abort();'
+            print '            OS::Abort();'