xref: /inferno-os/appl/lib/utils.m (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1Str_Hashtab : module
2{
3	PATH: con "/dis/lib/tcl_strhash.dis";
4
5	H_link : adt{
6		name : string;
7		val : string;
8	};
9
10	Hash : adt {
11		size : int;
12		lsize : int;
13		tab : array of list of H_link;
14		insert : fn(h:self ref Hash,name,val: string) : int;
15		dump: fn(h:self ref Hash) : string;
16		find: fn(h:self ref Hash,name : string) : (int,string);
17		delete: fn(h:self ref Hash,name : string) : int;
18	};
19
20	alloc : fn(size : int) : ref Hash;
21};
22
23Int_Hashtab : module
24{
25	PATH: con "/dis/lib/tcl_inthash.dis";
26
27	H_link : adt{
28		name : string;
29		val : int;
30	};
31
32	IHash : adt {
33		size : int;
34		tab : array of list of H_link;
35		insert : fn(h:self ref IHash,name: string,val : int) : int;
36		find: fn(h:self ref IHash,name : string) : (int,int);
37		delete: fn(h:self ref IHash,name : string) : int;
38	};
39
40	alloc : fn(size : int) : ref IHash;
41};
42
43Sym_Hashtab : module
44{
45	PATH: con "/dis/lib/tcl_symhash.dis";
46
47	H_link : adt{
48		name : string;
49		alias : string;
50		val : int;
51	};
52
53	SHash : adt {
54		size : int;
55		tab : array of list of H_link;
56		insert : fn(h:self ref SHash,name,alias: string,val : int) : int;
57		find: fn(h:self ref SHash,name : string) : (int,int,string);
58		delete: fn(h:self ref SHash,name : string) : int;
59	};
60
61	alloc : fn(size : int) : ref SHash;
62};
63
64Mod_Hashtab : module
65{
66	PATH: con "/dis/lib/tcl_modhash.dis";
67
68	H_link : adt{
69		name : string;
70		val : TclLib;
71	};
72
73	MHash : adt {
74		size : int;
75		tab : array of list of H_link;
76		insert : fn(h:self ref MHash,name: string,val : TclLib)
77								: int;
78		dump: fn(h:self ref MHash) : string;
79		find: fn(h:self ref MHash,name : string) : (int,TclLib);
80		delete: fn(h:self ref MHash,name : string) : int;
81	};
82
83	alloc : fn(size : int) : ref MHash;
84};
85
86Tcl_Stack : module
87{
88	PATH: con "/dis/lib/tcl_stack.dis";
89
90	level : fn() : int;
91	examine : fn(lev : int) :
92	      (ref Str_Hashtab->Hash,array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
93	push  : fn(s:ref Str_Hashtab->Hash,
94			a:array of (ref Str_Hashtab->Hash,string),t: ref Sym_Hashtab->SHash);
95	init : fn();
96	move : fn(lev :int) : int;
97	newframe : fn() :
98	      (ref Str_Hashtab->Hash,array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
99	pop   : fn() : (ref Str_Hashtab->Hash,
100			array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
101	dump : fn();
102};
103
104
105
106Tcl_Utils : module
107{
108	PATH: con "/dis/lib/tcl_utils.dis";
109	break_it : fn(s : string) : array of string;
110	arr_resize : fn(argv : array of string) : array of string;
111};
112
113