Mercurial > repo
view interps/boof/boof.h @ 11633:a56795ce5d0a draft
<oerjan> le/rn hammurabi//If anyone creates a webpage that unexpectedly starts playing sounds, he shall be put to death. http://45338297.weebly.com/laws-on-property-and-theft.html
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Tue, 23 Oct 2018 23:09: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