12 Log(const char *name) {
13 char fileName[_MAX_PATH];
14 _snprintf(fileName, _MAX_PATH, "%s.%u.xml", name, rand());
15 file = fopen(fileName, "wt");
16 Write("<?xml version='1.0' encoding='UTF-8'?>\n");
17 Write("<?xml-stylesheet type='text/xsl' href='d3dtrace.xsl'?>\n");
30 void Tag(const char *name) {
36 void BeginTag(const char *name) {
42 void BeginTag(const char *name,
43 const char *attr1, const char *value1) {
53 void BeginTag(const char *name,
54 const char *attr1, const char *value1,
55 const char *attr2, const char *value2) {
69 void EndTag(const char *name) {
75 void Text(const char *text) {
79 void TextF(const char *format, ...) {
82 vfprintf(file, format, ap);
86 void BeginCall(const char *function) {
88 BeginTag("call", "name", function);
98 void BeginParam(const char *type, const char *name) {
100 BeginTag("param", "type", type, "name", name);
103 void EndParam(void) {
108 void BeginReturn(const char *type, const char *name) {
110 BeginTag("return", "type", type);
113 void EndReturn(void) {
119 void Escape(const char *s) {
124 void Write(const char *s) {
128 void WriteF(const char *f, ...) {
131 vfprintf(file, f, ap);
140 #endif /* _LOG_HPP_ */