-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsturnus.tcl
58 lines (42 loc) · 1.23 KB
/
sturnus.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
namespace eval ::Sturnus {
namespace export *
# tail name of current qualified namespace
proc surname {} {
set curtail [namespace tail [namespace current]]
return $curtail
}
# limit quantity of standard input characters
proc sentinel {{argots {}} {caps 24}} {
set narc [llength $argots]
set item 0
while {$item < $narc} {
if {[string length [lindex $argots $item]] > $caps} {
# govern amount of characters in violator argument
lset argots $item [string range [lindex $argots $item] 0 $caps]
}
incr item
}
unset item narc
return $argots
}
# limit input arguments to be processed
proc governor {{argots {}} {caps 128}} {
if {[llength $argots] > $caps} {
set argots [lrange $argots 0 [expr {$caps - 1}]]
}
return $argots
}
# display help message with examples
proc examples {{gears {beadgcf cgdae eadgbe}}} {
global tcl_interactive
if {$tcl_interactive} then {
set mnemo filename
} else {
set mnemo [file tail [info script]]
}
set demos "\nTunings:\n\t%s\n\nExample:\n\ttclsh %s %s n0 j3\n"
puts [format $demos $gears $mnemo [lindex $gears 0]]
unset demos mnemo
return ok
}
} ;# close Sturnus