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
#include <jim.h>
int Jim_initjimshInit(Jim_Interp *interp)
{
if (Jim_PackageProvide(interp, "initjimsh", "1.0", JIM_ERRMSG)) return JIM_ERR;
return Jim_EvalSource(interp, "initjimsh.tcl", 1, "\n"
"\n"
"\n"
"proc _jimsh_init {} {\n"
" rename _jimsh_init {}\n"
" global jim::exe jim::argv0 tcl_interactive auto_path tcl_platform\n"
"\n"
"\n"
" if {[exists jim::argv0]} {\n"
" if {[string match \"*/*\" $jim::argv0]} {\n"
" set jim::exe [file join [pwd] $jim::argv0]\n"
" } else {\n"
" foreach path [split [env PATH \"\"] $tcl_platform(pathSeparator)] {\n"
" set exec [file join [pwd] [string map {\\\\ /} $path] $jim::argv0]\n"
" if {[file executable $exec]} {\n"
" set jim::exe $exec\n"
" break\n"
" }\n"
" }\n"
" }\n"
" }\n"
"\n"
"\n"
" lappend p {*}[split [env JIMLIB {}] $tcl_platform(pathSeparator)]\n"
" if {[exists jim::exe]} {\n"
" lappend p [file dirname $jim::exe]\n"
" }\n"
" lappend p {*}$auto_path\n"
" set auto_path $p\n"
"\n"
" if {$tcl_interactive && [env HOME {}] ne \"\"} {\n"
" foreach src {.jimrc jimrc.tcl} {\n"
" if {[file exists [env HOME]/$src]} {\n"
" uplevel #0 source [env HOME]/$src\n"
" break\n"
" }\n"
" }\n"
" }\n"
" return \"\"\n"
"}\n"
"\n"
"if {$tcl_platform(platform) eq \"windows\"} {\n"
" set jim::argv0 [string map {\\\\ /} $jim::argv0]\n"
"}\n"
"\n"
"\n"
"set tcl::autocomplete_commands {info tcl::prefix socket namespace array clock file package string dict signal history}\n"
"\n"
"\n"
"\n"
"proc tcl::autocomplete {prefix} {\n"
" if {[set space [string first \" \" $prefix]] != -1} {\n"
" set cmd [string range $prefix 0 $space-1]\n"
" if {$cmd in $::tcl::autocomplete_commands || [info channel $cmd] ne \"\"} {\n"
" set arg [string range $prefix $space+1 end]\n"
"\n"
" return [lmap p [$cmd -commands] {\n"
" if {![string match \"${arg}*\" $p]} continue\n"
" function \"$cmd $p\"\n"
" }]\n"
" }\n"
" }\n"
"\n"
" if {[string match \"source *\" $prefix]} {\n"
" set path [string range $prefix 7 end]\n"
" return [lmap p [glob -nocomplain \"${path}*\"] {\n"
" function \"source $p\"\n"
" }]\n"
" }\n"
"\n"
" return [lmap p [lsort [info commands $prefix*]] {\n"
" if {[string match \"* *\" $p]} {\n"
" continue\n"
" }\n"
" function $p\n"
" }]\n"
"}\n"
"\n"
"_jimsh_init\n");
}{ ... }