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
|
#test of string maps containing strings
global foo
probe begin {
for (i=0;i<11;i++)
foo[sprint(i)] = "The Result is ".sprint(i*i)
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# delete out of the middle
delete foo["5"]
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# delete first entry
delete foo["0"]
# and last entry
delete foo["10"]
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# change a couple
foo["9"] = "New result is -81"
foo["4"] = foo["4"]."(CHANGED)"
foo["3"] = foo["2"]."<------"
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# delete one
delete foo["4"]
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# delete all
delete foo
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
# load it again
for (i=0;i<11;i++)
foo[sprint(i)] = sprint(i*i)
for (i=0;i<11;i++)
foo[sprint(i)] = "# ".sprint(i*i)
printf("\n")
foreach (str in foo)
printf("foo[%s] = %s\n", str, foo[str])
exit()
}
|