Mercurial > repo
view interps/boof/boof.h @ 5279:fde81dc48af6
<izabera> rm twolines.gz
author | HackBot |
---|---|
date | Sun, 22 Mar 2015 01:58:55 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
#ifndef boof_h_ #define boof_h_ /* A boolpit is an infinite array of bools (growable at both ends) */ /* boof.h - by Sam Hughes - boof@samuelhughes.com */ #include <string> #include <iostream> #include <vector> class boolpit { unsigned char * beg_; unsigned char * mid_; unsigned char * end_; public: boolpit(); boolpit(const boolpit & copyee); ~boolpit(); boolpit & operator=(const boolpit & assignee); void set(size_t offset, int i); int get(size_t offset); void flip(size_t offset); private: void copy(const boolpit & copyee); void grow_and_accommodate(unsigned char * & p); }; class boofer { struct size_triad { size_t lpos, rjump, bjump; size_triad(size_t a, size_t b, size_t c) : lpos(a), rjump(b), bjump(c) {} }; std::string prog_; std::vector<size_triad> brace_pos_; public: boofer(std::istream & istr); void execute(std::istream & in, std::ostream & out) const; }; #endif