]> git.cworth.org Git - apitrace/blobdiff - trace_parser.hpp
Remove some currently unused member variables.
[apitrace] / trace_parser.hpp
index 670db96794b35ae4f515ccff0551b00509824f50..1f87b6fed185c8959dd112a2aa4d2c3dce99f702 100644 (file)
 
 
 #include <iostream>
-#include <map>
 #include <list>
-#include <string>
+#include <set>
 
+#include "trace_file.hpp"
 #include "trace_format.hpp"
 #include "trace_model.hpp"
 
 
 namespace Trace {
 
-
 class Parser
 {
 protected:
-    void *file;
+    File *file;
 
     typedef std::list<Call *> CallList;
     CallList calls;
 
-    typedef std::vector<Call::Signature *> FunctionMap;
+    typedef std::vector<FunctionSig *> FunctionMap;
     FunctionMap functions;
 
-    typedef std::vector<Struct::Signature *> StructMap;
+    typedef std::vector<StructSig *> StructMap;
     StructMap structs;
 
-    typedef std::vector<Enum::Signature *> EnumMap;
+    typedef std::vector<EnumSig *> EnumMap;
     EnumMap enums;
 
-    typedef std::vector<Bitmask::Signature *> BitmaskMap;
+    typedef std::vector<BitmaskSig *> BitmaskMap;
     BitmaskMap bitmasks;
 
+    typedef std::set<File::Offset> TraceOffsets;
+    TraceOffsets m_callSigOffsets;
+    TraceOffsets m_structSigOffsets;
+    TraceOffsets m_enumSigOffsets;
+    TraceOffsets m_bitmaskSigOffsets;
+
+    typedef std::map<File::Offset, unsigned> CallNumOffsets;
+    CallNumOffsets m_callNumOffsets;
+
     unsigned next_call_no;
 
 public:
@@ -74,12 +82,44 @@ public:
 
     Call *parse_call(void);
 
+    bool supportsOffsets() const
+    {
+        return file->supportsOffsets();
+    }
+
+    File::Offset currentOffset()
+    {
+        return file->currentOffset();
+    }
+
+    void setCurrentOffset(const File::Offset &offset)
+    {
+        file->setCurrentOffset(offset);
+    }
+
+    bool callWithSignature(const File::Offset &offset) const;
+    bool structWithSignature(const File::Offset &offset) const;
+    bool enumWithSignature(const File::Offset &offset) const;
+    bool bitmaskWithSignature(const File::Offset &offset) const;
+
+    unsigned currentCallNumber() const
+    {
+        return next_call_no;
+    }
+
+    void setCurrentCallNumber(unsigned num)
+    {
+        next_call_no = num;
+    }
+
+    Call *scan_call();
+
 protected:
     void parse_enter(void);
 
     Call *parse_leave(void);
 
-    void parse_call_details(Call *call);
+    bool parse_call_details(Call *call);
 
     void parse_arg(Call *call);
 
@@ -107,11 +147,50 @@ protected:
 
     Value *parse_opaque();
 
-    std::string read_string(void);
+    const char * read_string(void);
 
     unsigned long long read_uint(void);
 
     inline int read_byte(void);
+
+protected:
+    void scan_enter(void);
+
+    Call *scan_leave(void);
+
+    bool scan_call_details(Call *call);
+
+    void scan_arg(Call *call);
+
+    void scan_value(void);
+
+    void scan_sint();
+
+    void scan_uint();
+
+    void scan_float();
+
+    void scan_double();
+
+    void scan_string();
+
+    void scan_enum();
+
+    void scan_bitmask();
+
+    void scan_array(void);
+
+    void scan_blob(void);
+
+    void scan_struct();
+
+    void scan_opaque();
+
+    void skip_string(void);
+
+    void skip_uint(void);
+
+    inline void skip_byte(void);
 };