Annotation of researchv9/cmd/cfront/CC/common/table.h, revision 1.1.1.1

1.1       root        1: class vector : public common {
                      2:        common** vec;
                      3:        int size;
                      4: public:
                      5:                vector(int sz) { size = (sz<=0) ? 1 : sz; vec = new common*[size]; }
                      6:                ~vector() {};
                      7:        virtual common* range_error() { return 0; }
                      8:        common& operator[](int i) { return (0<=i && i<size) ? vec[i] : range_error(); }
                      9:        int     max() { return size-1; }
                     10:        void    grow(int size);
                     11: };
                     12: 
                     13: class table : public vector {
                     14:        short*  hashtbl;
                     15:        table*  next;
                     16:        void    grow();
                     17:        common* lookup(char* s, common* p, int i);
                     18: public:
                     19:                table(int size);
                     20:                table(vector&);
                     21:        common* insert(common& oo)              { return lookup(oo.swho(),&oo,1); }
                     22:        common* look(char* s)                   { return lookup(s,0,1); } 
                     23:        common* look(common& oo, int i = 0)     { return lookup(oo.swho(),&oo,i); }
                     24: };
                     25: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.