]> git.cworth.org Git - apitrace/blobdiff - retrace.hpp
D3D retrace checkpoint.
[apitrace] / retrace.hpp
index c87fc946c9e5e8e647473f2352179ccbfdd34669..33671411deb2a8b7841a078adfefc71d60fe273f 100644 (file)
 #ifndef _RETRACE_HPP_
 #define _RETRACE_HPP_
 
+#include <string.h>
+
+#include <list>
 #include <map>
+#include <ostream>
+
+#include "trace_model.hpp"
+#include "trace_parser.hpp"
+
 
 namespace retrace {
 
 
+extern trace::Parser parser;
+
+
 /**
  * Handle map.
  *
@@ -73,6 +84,68 @@ public:
 };
 
 
+void
+addRegion(unsigned long long address, void *buffer, unsigned long long size);
+
+void
+delRegionByPointer(void *ptr);
+
+void *
+toPointer(trace::Value &value, bool bind = false);
+
+
+/**
+ * Output verbosity when retracing files.
+ */
+extern int verbosity;
+
+
+std::ostream &warning(trace::Call &call);
+
+
+void ignore(trace::Call &call);
+void unsupported(trace::Call &call);
+
+
+typedef void (*Callback)(trace::Call &call);
+
+struct Entry {
+    const char *name;
+    Callback callback;
+};
+
+
+struct stringComparer {
+  bool operator() (const char *a, const  char *b) const {
+    return strcmp(a, b) < 0;
+  }
+};
+
+
+extern const Entry stdc_callbacks[];
+
+
+class Retracer
+{
+    typedef std::map<const char *, Callback, stringComparer> Map;
+    Map map;
+
+    std::vector<Callback> callbacks;
+
+public:
+    Retracer() {
+        addCallbacks(stdc_callbacks);
+    }
+
+    virtual ~Retracer() {}
+
+    void addCallback(const Entry *entry);
+    void addCallbacks(const Entry *entries);
+
+    void retrace(trace::Call &call);
+};
+
+
 } /* namespace retrace */
 
 #endif /* _RETRACE_HPP_ */