Type.__init__(self, "String")
def __str__(self):
- return "char *"
+ return "const char *"
def dump(self, instance):
print ' Log::DumpString((const char *)%s);' % instance
String = _String()
+class _WString(Type):
+
+ def __init__(self):
+ Type.__init__(self, "WString")
+
+ def __str__(self):
+ return "const wchar_t *"
+
+ def dump(self, instance):
+ print ' Log::DumpWString(%s);' % instance
+
+WString = _WString()
+
SChar = Intrinsic("signed char", "%i")
UChar = Intrinsic("unsigned char", "%u")
Log::Text("\"");
}
+void DumpWString(const wchar_t *str) {
+ const wchar_t *p = str;
+ Log::Text("L\"");
+ wchar_t c;
+ while((c = *p++) != 0) {
+ if(c == '\"')
+ Text("\\\"");
+ else if(c == '\\')
+ Text("\\\\");
+ else if(c >= 0x20 && c <= 0x7e)
+ TextChar((char)c);
+ else if(c == '\t')
+ Text("\\t");
+ else if(c == '\r')
+ Text("\\r");
+ else if(c == '\n')
+ Text("\\n");
+ else {
+ unsigned octal0 = c & 0x7;
+ unsigned octal1 = (c >> 3) & 0x7;
+ unsigned octal2 = (c >> 3) & 0x7;
+ if(octal2)
+ TextF("\\%u%u%u", octal2, octal1, octal0);
+ else if(octal1)
+ TextF("\\%u%u", octal1, octal0);
+ else
+ TextF("\\%u", octal0);
+ }
+ }
+ Log::Text("\"");
+}
+
} /* namespace Log */
void EndReference(void);
void DumpString(const char *str);
+ void DumpWString(const wchar_t *str);
}
LPSTR = String
LPCSTR = Const(String)
-LPWSTR = String
+LPWSTR = WString
+LPCWSTR = WString
LARGE_INTEGER = Intrinsic("LARGE_INTEGER", "0x%llx")