LPSIZE = LPDWORD
LPSTR = String
+LPCSTR = Const(String)
LPWSTR = String
LARGE_INTEGER = Intrinsic("LARGE_INTEGER", "0x%llx")
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' case DLL_THREAD_ATTACH:'
print r' return TRUE;'
print r' case DLL_THREAD_DETACH:'
for function in self.functions:
type = 'P' + function.name
print function.prototype() + ' {'
- if 1:
+ if 0:
print ' Log::Close();'
print ' Log::Open("%s");' % self.name
#print ' Log::ReOpen();'
print ' }'
print ' pFunction = (%s)GetProcAddress( g_hDll, "%s");' % (type, function.name)
print ' if(!pFunction)'
- print ' ExitProcess(0);'
+ if function.fail is not None:
+ assert function.type is not Void
+ print ' return %s;' % function.fail
+ else:
+ print ' ExitProcess(0);'
print ' Log::BeginCall("%s");' % (function.name)
+ for type, name in function.args:
+ if not type.isoutput():
+ type.unwrap_instance(name)
+ print ' Log::BeginArg("%s", "%s");' % (type, name)
+ type.dump(name)
+ print ' Log::EndArg();'
print ' %spFunction(%s);' % (result, ', '.join([str(name) for type, name in function.args]))
- print ' Log::EndCall();'
for type, name in function.args:
if type.isoutput():
+ print ' Log::BeginArg("%s", "%s");' % (type, name)
+ type.dump(name)
+ print ' Log::EndArg();'
type.wrap_instance(name)
if function.type is not Void:
+ print ' Log::BeginReturn("%s");' % function.type
+ function.type.dump("result")
+ print ' Log::EndReturn();'
function.type.wrap_instance('result')
+ print ' Log::EndCall();'
if function.type is not Void:
print ' return result;'
print '}'