summaryrefslogtreecommitdiff
path: root/appl/lib/utils.m
blob: 4e9a176a1af6d631fe273ae608770e13eceb7e1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Str_Hashtab : module
{
	PATH: con "/dis/lib/tcl_strhash.dis";
	
	H_link : adt{
		name : string;
		val : string;
	};

	Hash : adt {
		size : int;
		lsize : int;
		tab : array of list of H_link;
		insert : fn(h:self ref Hash,name,val: string) : int;
		dump: fn(h:self ref Hash) : string;
		find: fn(h:self ref Hash,name : string) : (int,string);
		delete: fn(h:self ref Hash,name : string) : int;
	};

	alloc : fn(size : int) : ref Hash;
};

Int_Hashtab : module
{
	PATH: con "/dis/lib/tcl_inthash.dis";
	
	H_link : adt{
		name : string;
		val : int;
	};

	IHash : adt {
		size : int;
		tab : array of list of H_link;
		insert : fn(h:self ref IHash,name: string,val : int) : int;
		find: fn(h:self ref IHash,name : string) : (int,int);
		delete: fn(h:self ref IHash,name : string) : int;
	};

	alloc : fn(size : int) : ref IHash;
};

Sym_Hashtab : module
{
	PATH: con "/dis/lib/tcl_symhash.dis";
	
	H_link : adt{
		name : string;
		alias : string;
		val : int;
	};

	SHash : adt {
		size : int;
		tab : array of list of H_link;
		insert : fn(h:self ref SHash,name,alias: string,val : int) : int;
		find: fn(h:self ref SHash,name : string) : (int,int,string);
		delete: fn(h:self ref SHash,name : string) : int;
	};

	alloc : fn(size : int) : ref SHash;
};

Mod_Hashtab : module
{
	PATH: con "/dis/lib/tcl_modhash.dis";
	
	H_link : adt{
		name : string;
		val : TclLib;
	};

	MHash : adt {
		size : int;
		tab : array of list of H_link;
		insert : fn(h:self ref MHash,name: string,val : TclLib) 
								: int;
		dump: fn(h:self ref MHash) : string;
		find: fn(h:self ref MHash,name : string) : (int,TclLib);
		delete: fn(h:self ref MHash,name : string) : int;
	};

	alloc : fn(size : int) : ref MHash;
};

Tcl_Stack : module
{
	PATH: con "/dis/lib/tcl_stack.dis";
	
	level : fn() : int;
	examine : fn(lev : int) : 
	      (ref Str_Hashtab->Hash,array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
	push  : fn(s:ref Str_Hashtab->Hash, 
			a:array of (ref Str_Hashtab->Hash,string),t: ref Sym_Hashtab->SHash);
	init : fn();
	move : fn(lev :int) : int;
	newframe : fn() : 
	      (ref Str_Hashtab->Hash,array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
	pop   : fn() : (ref Str_Hashtab->Hash,
			array of (ref Str_Hashtab->Hash,string),ref Sym_Hashtab->SHash);
	dump : fn();
};



Tcl_Utils : module
{
	PATH: con "/dis/lib/tcl_utils.dis";
	break_it : fn(s : string) : array of string;
	arr_resize : fn(argv : array of string) : array of string;
};