xref: /inferno-os/module/strinttab.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1StringIntTab: module
2{
3	PATH: con "/dis/lib/strinttab.dis";
4
5	StringInt: adt{
6		key: string;
7		val: int;
8	};
9
10	# Binary search of t (which must be sorted) for key.
11	# Returns (found, val).
12	lookup: fn(t: array of StringInt, key: string) : (int, int);
13
14	# Linear search of t for first pair with given val.
15	# Returns key (nil if no match).
16	revlookup: fn(t: array of StringInt, val: int) : string;
17};
18