File: addset

package info (click to toggle)
epic5 2.0.1-1
  • links: PTS
  • area: main
  • in suites: buster, sid, stretch
  • size: 4,696 kB
  • ctags: 6,357
  • sloc: ansic: 69,814; makefile: 715; ruby: 227; sh: 178; perl: 13
file content (44 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (3)
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
if (word(2 $loadinfo()) != [pf]) {
	load -pf $word(1 $loadinfo());
	return;
};

#	Copyright 2005 EPIC Software Labs
#	Written by BlackJac@EFNet
#
#	Version: 1.0.2005.06.25.1
#
#	These commands provide a simple and standard method for creating
#	user-defined SETs.
#
#	Usage:
#		addset <name> <type> [<script>]
#
#			The <name> is the name of the set
#			The <type> must be one of: bool char int str
#			The <script> is optional and would include all code
#				associated with changing the value of the set
#
#		delset <name>
#
#			The <name> is the name of the set

package addset;

alias addset (name, type, ...) {
        if (@name && type) {
                @ symbolctl(create $name);
                @ symbolctl(set $name 1 builtin_variable type $type);
                if (@) {
                        @ symbolctl(set $name 1 builtin_variable script $*);
                };
        };
};

alias delset (name, void) {
        if (@name) {
                @ symbolctl(delete $name builtin_variable);
                @ symbolctl(check $name);
        };
};