File:  [Research Unix] / researchv9 / cmd / cfront / CC / common / table.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

class vector : public common {
	common** vec;
	int size;
public:
		vector(int sz) { size = (sz<=0) ? 1 : sz; vec = new common*[size]; }
		~vector() {};
	virtual common* range_error() { return 0; }
	common& operator[](int i) { return (0<=i && i<size) ? vec[i] : range_error(); }
	int	max() { return size-1; }
	void	grow(int size);
};

class table : public vector {
	short*	hashtbl;
	table*	next;
	void	grow();
	common* lookup(char* s, common* p, int i);
public:
		table(int size);
		table(vector&);
	common*	insert(common& oo)		{ return lookup(oo.swho(),&oo,1); }
	common* look(char* s)			{ return lookup(s,0,1); } 
	common* look(common& oo, int i = 0)	{ return lookup(oo.swho(),&oo,i); }
};


unix.superglobalmegacorp.com

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