-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules.tcl
131 lines (111 loc) · 3.7 KB
/
modules.tcl
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
set modules_module_deferred 0
set modules_module_ok 1
proc modules.module_deferred {} {
global modules_module_deferred
return $modules_module_deferred
}
proc modules.module_ok {} {
global modules_module_ok
return $modules_module_ok
}
proc modules.debug {} {
set debug [worlds.get_generic Off {} {} ModulesDebug]
if { [string tolower $debug] == "on" } {
return 1
}
return 0
}
proc modules.reconfigure_fonts {} {
global client_event_callbacks
foreach module $client_event_callbacks(reconfigure_fonts) {
if { [catch $module.reconfigure_fonts rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.reconfigure_fonts: $rv" window_highlight
}
}
}
proc modules.start {} {
global client_event_callbacks
foreach module $client_event_callbacks(start) {
if { [catch $module.start rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.start: $rv" window_highlight
}
}
}
proc modules.stop {} {
global client_event_callbacks
foreach module $client_event_callbacks(stop) {
if { [catch $module.stop rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.stop: $rv" window_highlight
}
}
}
proc modules.incoming_2 event {
global modules_module_ok modules_module_deferred \
client_event_callbacks
foreach module $client_event_callbacks(incoming_2) {
if { [catch { $module.incoming_2 $event } rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.incoming_2: $rv" window_highlight
} {
if { $rv == $modules_module_ok } {
return $rv
}
}
}
return $modules_module_deferred
}
proc modules.incoming event {
global modules_module_ok modules_module_deferred \
client_event_callbacks
foreach module $client_event_callbacks(incoming) {
if { [catch { $module.incoming $event } rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.incoming: $rv" window_highlight
} {
if { $rv == $modules_module_ok } {
return $rv
}
}
}
return $modules_module_deferred
}
proc modules.outgoing line {
global modules_module_ok modules_module_deferred \
client_event_callbacks
foreach module $client_event_callbacks(outgoing) {
if { [catch { $module.outgoing $line } rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.outgoing: $rv" window_highlight
} {
if { $rv == $modules_module_ok } {
return $rv
}
}
}
return $modules_module_deferred
}
proc modules.client_connected {} {
global modules_module_ok modules_module_deferred \
client_event_callbacks
foreach module $client_event_callbacks(client_connected) {
if { [catch $module.client_connected rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.client_connected: $rv" window_highlight
} {
if { $rv == $modules_module_ok } {
return $rv
}
}
}
return $modules_module_deferred
}
proc modules.client_disconnected {} {
global modules_module_ok modules_module_deferred \
client_event_callbacks
foreach module $client_event_callbacks(client_disconnected) {
if { [catch $module.client_disconnected rv] && [modules.debug] } {
window.displayCR "Internal Error in $module.client_disconnected: $rv" window_highlight
} {
if { $rv == $modules_module_ok } {
return $rv
}
}
}
return $modules_module_deferred
}