1. pygame
  2. Untitled project
  3. imgblit

Commits

Lenard Lindstrom  committed e489a1e

Use a std::list in imgblit::Block so allow splicing of instructions.

Later compiler passes will transform high level blit code into pixel format
specific, low level instructions suitable for direct tranlation into libjit
code.

  • Participants
  • Parent commits df5ca4f
  • Branches default

Comments (0)

Files changed (2)

File include/imgblit/parser.hpp

View file
 #include "imgblit/scanner.hpp"
 #include <string>
 #include <map>
+#include <list>
 
 namespace imgblit {
     using std::string;
     using std::map;
+    using std::list;
 
     class Node : public Datum {
 
     class Block : public Node {
 
     public:
+        typedef list<InstructionRef> instructions;
         Block() : Node("<block>") { }
         Block(const char *identifier) : Node(identifier) { }
         Block(const string &identifier) : Node(identifier) { }
-        vector<InstructionRef> blk_instructions;
+        instructions blk_instructions;
         void write(ostream &os) const;
     };
 

File src/parser.cpp

View file
 void
 Block::write(ostream &os) const
 {
-    size_t sz = blk_instructions.size();
+    typedef instructions::const_iterator iterator;
+    iterator end = blk_instructions.end();
 
-    for (size_t i = 0; i < sz; ++i) {
-        os << blk_instructions[i] << endl;
+    for (iterator i = blk_instructions.begin(); i != end; ++i) {
+        os << *i << endl;
     }
 }