Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sh.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sk.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sl.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sq.msg +54 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sr.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sv.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sw.msg +49 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ta.msg +39 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ta_in.msg +6 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/te.msg +47 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/te_in.msg +8 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/th.msg +54 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/tr.msg +50 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/uk.msg +52 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/vi.msg +50 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh.msg +55 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_cn.msg +7 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_hk.msg +28 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_sg.msg +8 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_tw.msg +8 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/opt0.4/optparse.tcl +1072 -0
- miniconda3/envs/active_proaction/lib/tcl8.6/opt0.4/pkgIndex.tcl +12 -0
- miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbc1.1.9.so +0 -0
- miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbcstub1.1.9.a +0 -0
- miniconda3/envs/active_proaction/lib/tdbc1.1.9/pkgIndex.tcl +26 -0
- miniconda3/envs/active_proaction/lib/tdbc1.1.9/tdbc.tcl +922 -0
- miniconda3/envs/active_proaction/lib/tdbc1.1.9/tdbcConfig.sh +81 -0
- miniconda3/envs/active_proaction/lib/tdbcmysql1.1.9/libtdbcmysql1.1.9.so +0 -0
- miniconda3/envs/active_proaction/lib/tdbcmysql1.1.9/pkgIndex.tcl +14 -0
- miniconda3/envs/active_proaction/lib/tdbcmysql1.1.9/tdbcmysql.tcl +193 -0
- miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/libtdbcodbc1.1.9.so +0 -0
- miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/pkgIndex.tcl +14 -0
- miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/tdbcodbc.tcl +554 -0
- miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/libtdbcpostgres1.1.9.so +0 -0
- miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/pkgIndex.tcl +14 -0
- miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/tdbcpostgres.tcl +135 -0
- miniconda3/envs/active_proaction/lib/thread2.8.10/libthread2.8.10.so +0 -0
- miniconda3/envs/active_proaction/lib/thread2.8.10/pkgIndex.tcl +68 -0
- miniconda3/envs/active_proaction/lib/thread2.8.10/ttrace.tcl +942 -0
- miniconda3/envs/active_proaction/lib/tk8.6/bgerror.tcl +272 -0
- miniconda3/envs/active_proaction/lib/tk8.6/button.tcl +782 -0
- miniconda3/envs/active_proaction/lib/tk8.6/choosedir.tcl +310 -0
- miniconda3/envs/active_proaction/lib/tk8.6/clrpick.tcl +694 -0
- miniconda3/envs/active_proaction/lib/tk8.6/comdlg.tcl +322 -0
- miniconda3/envs/active_proaction/lib/tk8.6/console.tcl +1154 -0
- miniconda3/envs/active_proaction/lib/tk8.6/demos/README +44 -0
- miniconda3/envs/active_proaction/lib/tk8.6/demos/anilabel.tcl +160 -0
- miniconda3/envs/active_proaction/lib/tk8.6/demos/aniwave.tcl +104 -0
- miniconda3/envs/active_proaction/lib/tk8.6/demos/arrow.tcl +241 -0
- miniconda3/envs/active_proaction/lib/tk8.6/demos/bind.tcl +78 -0
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sh.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sh DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Ned"\
|
| 5 |
+
"Pon"\
|
| 6 |
+
"Uto"\
|
| 7 |
+
"Sre"\
|
| 8 |
+
"\u010cet"\
|
| 9 |
+
"Pet"\
|
| 10 |
+
"Sub"]
|
| 11 |
+
::msgcat::mcset sh DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Nedelja"\
|
| 13 |
+
"Ponedeljak"\
|
| 14 |
+
"Utorak"\
|
| 15 |
+
"Sreda"\
|
| 16 |
+
"\u010cetvrtak"\
|
| 17 |
+
"Petak"\
|
| 18 |
+
"Subota"]
|
| 19 |
+
::msgcat::mcset sh MONTHS_ABBREV [list \
|
| 20 |
+
"Jan"\
|
| 21 |
+
"Feb"\
|
| 22 |
+
"Mar"\
|
| 23 |
+
"Apr"\
|
| 24 |
+
"Maj"\
|
| 25 |
+
"Jun"\
|
| 26 |
+
"Jul"\
|
| 27 |
+
"Avg"\
|
| 28 |
+
"Sep"\
|
| 29 |
+
"Okt"\
|
| 30 |
+
"Nov"\
|
| 31 |
+
"Dec"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sh MONTHS_FULL [list \
|
| 34 |
+
"Januar"\
|
| 35 |
+
"Februar"\
|
| 36 |
+
"Mart"\
|
| 37 |
+
"April"\
|
| 38 |
+
"Maj"\
|
| 39 |
+
"Juni"\
|
| 40 |
+
"Juli"\
|
| 41 |
+
"Avgust"\
|
| 42 |
+
"Septembar"\
|
| 43 |
+
"Oktobar"\
|
| 44 |
+
"Novembar"\
|
| 45 |
+
"Decembar"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sh BCE "p. n. e."
|
| 48 |
+
::msgcat::mcset sh CE "n. e."
|
| 49 |
+
::msgcat::mcset sh DATE_FORMAT "%d.%m.%Y."
|
| 50 |
+
::msgcat::mcset sh TIME_FORMAT "%k.%M.%S"
|
| 51 |
+
::msgcat::mcset sh DATE_TIME_FORMAT "%d.%m.%Y. %k.%M.%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sk.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sk DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Ne"\
|
| 5 |
+
"Po"\
|
| 6 |
+
"Ut"\
|
| 7 |
+
"St"\
|
| 8 |
+
"\u0160t"\
|
| 9 |
+
"Pa"\
|
| 10 |
+
"So"]
|
| 11 |
+
::msgcat::mcset sk DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Nede\u013ee"\
|
| 13 |
+
"Pondelok"\
|
| 14 |
+
"Utorok"\
|
| 15 |
+
"Streda"\
|
| 16 |
+
"\u0160tvrtok"\
|
| 17 |
+
"Piatok"\
|
| 18 |
+
"Sobota"]
|
| 19 |
+
::msgcat::mcset sk MONTHS_ABBREV [list \
|
| 20 |
+
"jan"\
|
| 21 |
+
"feb"\
|
| 22 |
+
"mar"\
|
| 23 |
+
"apr"\
|
| 24 |
+
"m\u00e1j"\
|
| 25 |
+
"j\u00fan"\
|
| 26 |
+
"j\u00fal"\
|
| 27 |
+
"aug"\
|
| 28 |
+
"sep"\
|
| 29 |
+
"okt"\
|
| 30 |
+
"nov"\
|
| 31 |
+
"dec"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sk MONTHS_FULL [list \
|
| 34 |
+
"janu\u00e1r"\
|
| 35 |
+
"febru\u00e1r"\
|
| 36 |
+
"marec"\
|
| 37 |
+
"apr\u00edl"\
|
| 38 |
+
"m\u00e1j"\
|
| 39 |
+
"j\u00fan"\
|
| 40 |
+
"j\u00fal"\
|
| 41 |
+
"august"\
|
| 42 |
+
"september"\
|
| 43 |
+
"okt\u00f3ber"\
|
| 44 |
+
"november"\
|
| 45 |
+
"december"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sk BCE "pred n.l."
|
| 48 |
+
::msgcat::mcset sk CE "n.l."
|
| 49 |
+
::msgcat::mcset sk DATE_FORMAT "%e.%m.%Y"
|
| 50 |
+
::msgcat::mcset sk TIME_FORMAT "%k:%M:%S"
|
| 51 |
+
::msgcat::mcset sk DATE_TIME_FORMAT "%e.%m.%Y %k:%M:%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sl.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sl DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Ned"\
|
| 5 |
+
"Pon"\
|
| 6 |
+
"Tor"\
|
| 7 |
+
"Sre"\
|
| 8 |
+
"\u010cet"\
|
| 9 |
+
"Pet"\
|
| 10 |
+
"Sob"]
|
| 11 |
+
::msgcat::mcset sl DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Nedelja"\
|
| 13 |
+
"Ponedeljek"\
|
| 14 |
+
"Torek"\
|
| 15 |
+
"Sreda"\
|
| 16 |
+
"\u010cetrtek"\
|
| 17 |
+
"Petek"\
|
| 18 |
+
"Sobota"]
|
| 19 |
+
::msgcat::mcset sl MONTHS_ABBREV [list \
|
| 20 |
+
"jan"\
|
| 21 |
+
"feb"\
|
| 22 |
+
"mar"\
|
| 23 |
+
"apr"\
|
| 24 |
+
"maj"\
|
| 25 |
+
"jun"\
|
| 26 |
+
"jul"\
|
| 27 |
+
"avg"\
|
| 28 |
+
"sep"\
|
| 29 |
+
"okt"\
|
| 30 |
+
"nov"\
|
| 31 |
+
"dec"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sl MONTHS_FULL [list \
|
| 34 |
+
"januar"\
|
| 35 |
+
"februar"\
|
| 36 |
+
"marec"\
|
| 37 |
+
"april"\
|
| 38 |
+
"maj"\
|
| 39 |
+
"junij"\
|
| 40 |
+
"julij"\
|
| 41 |
+
"avgust"\
|
| 42 |
+
"september"\
|
| 43 |
+
"oktober"\
|
| 44 |
+
"november"\
|
| 45 |
+
"december"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sl BCE "pr.n.\u0161."
|
| 48 |
+
::msgcat::mcset sl CE "po Kr."
|
| 49 |
+
::msgcat::mcset sl DATE_FORMAT "%Y.%m.%e"
|
| 50 |
+
::msgcat::mcset sl TIME_FORMAT "%k:%M:%S"
|
| 51 |
+
::msgcat::mcset sl DATE_TIME_FORMAT "%Y.%m.%e %k:%M:%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sq.msg
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sq DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Die"\
|
| 5 |
+
"H\u00ebn"\
|
| 6 |
+
"Mar"\
|
| 7 |
+
"M\u00ebr"\
|
| 8 |
+
"Enj"\
|
| 9 |
+
"Pre"\
|
| 10 |
+
"Sht"]
|
| 11 |
+
::msgcat::mcset sq DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"e diel"\
|
| 13 |
+
"e h\u00ebn\u00eb"\
|
| 14 |
+
"e mart\u00eb"\
|
| 15 |
+
"e m\u00ebrkur\u00eb"\
|
| 16 |
+
"e enjte"\
|
| 17 |
+
"e premte"\
|
| 18 |
+
"e shtun\u00eb"]
|
| 19 |
+
::msgcat::mcset sq MONTHS_ABBREV [list \
|
| 20 |
+
"Jan"\
|
| 21 |
+
"Shk"\
|
| 22 |
+
"Mar"\
|
| 23 |
+
"Pri"\
|
| 24 |
+
"Maj"\
|
| 25 |
+
"Qer"\
|
| 26 |
+
"Kor"\
|
| 27 |
+
"Gsh"\
|
| 28 |
+
"Sht"\
|
| 29 |
+
"Tet"\
|
| 30 |
+
"N\u00ebn"\
|
| 31 |
+
"Dhj"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sq MONTHS_FULL [list \
|
| 34 |
+
"janar"\
|
| 35 |
+
"shkurt"\
|
| 36 |
+
"mars"\
|
| 37 |
+
"prill"\
|
| 38 |
+
"maj"\
|
| 39 |
+
"qershor"\
|
| 40 |
+
"korrik"\
|
| 41 |
+
"gusht"\
|
| 42 |
+
"shtator"\
|
| 43 |
+
"tetor"\
|
| 44 |
+
"n\u00ebntor"\
|
| 45 |
+
"dhjetor"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sq BCE "p.e.r."
|
| 48 |
+
::msgcat::mcset sq CE "n.e.r."
|
| 49 |
+
::msgcat::mcset sq AM "PD"
|
| 50 |
+
::msgcat::mcset sq PM "MD"
|
| 51 |
+
::msgcat::mcset sq DATE_FORMAT "%Y-%m-%d"
|
| 52 |
+
::msgcat::mcset sq TIME_FORMAT_12 "%l:%M:%S.%P"
|
| 53 |
+
::msgcat::mcset sq DATE_TIME_FORMAT "%Y-%m-%d %l:%M:%S.%P %z"
|
| 54 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sr.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sr DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u041d\u0435\u0434"\
|
| 5 |
+
"\u041f\u043e\u043d"\
|
| 6 |
+
"\u0423\u0442\u043e"\
|
| 7 |
+
"\u0421\u0440\u0435"\
|
| 8 |
+
"\u0427\u0435\u0442"\
|
| 9 |
+
"\u041f\u0435\u0442"\
|
| 10 |
+
"\u0421\u0443\u0431"]
|
| 11 |
+
::msgcat::mcset sr DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u041d\u0435\u0434\u0435\u0459\u0430"\
|
| 13 |
+
"\u041f\u043e\u043d\u0435\u0434\u0435\u0459\u0430\u043a"\
|
| 14 |
+
"\u0423\u0442\u043e\u0440\u0430\u043a"\
|
| 15 |
+
"\u0421\u0440\u0435\u0434\u0430"\
|
| 16 |
+
"\u0427\u0435\u0442\u0432\u0440\u0442\u0430\u043a"\
|
| 17 |
+
"\u041f\u0435\u0442\u0430\u043a"\
|
| 18 |
+
"\u0421\u0443\u0431\u043e\u0442\u0430"]
|
| 19 |
+
::msgcat::mcset sr MONTHS_ABBREV [list \
|
| 20 |
+
"\u0408\u0430\u043d"\
|
| 21 |
+
"\u0424\u0435\u0431"\
|
| 22 |
+
"\u041c\u0430\u0440"\
|
| 23 |
+
"\u0410\u043f\u0440"\
|
| 24 |
+
"\u041c\u0430\u0458"\
|
| 25 |
+
"\u0408\u0443\u043d"\
|
| 26 |
+
"\u0408\u0443\u043b"\
|
| 27 |
+
"\u0410\u0432\u0433"\
|
| 28 |
+
"\u0421\u0435\u043f"\
|
| 29 |
+
"\u041e\u043a\u0442"\
|
| 30 |
+
"\u041d\u043e\u0432"\
|
| 31 |
+
"\u0414\u0435\u0446"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sr MONTHS_FULL [list \
|
| 34 |
+
"\u0408\u0430\u043d\u0443\u0430\u0440"\
|
| 35 |
+
"\u0424\u0435\u0431\u0440\u0443\u0430\u0440"\
|
| 36 |
+
"\u041c\u0430\u0440\u0442"\
|
| 37 |
+
"\u0410\u043f\u0440\u0438\u043b"\
|
| 38 |
+
"\u041c\u0430\u0458"\
|
| 39 |
+
"\u0408\u0443\u043d\u0438"\
|
| 40 |
+
"\u0408\u0443\u043b\u0438"\
|
| 41 |
+
"\u0410\u0432\u0433\u0443\u0441\u0442"\
|
| 42 |
+
"\u0421\u0435\u043f\u0442\u0435\u043c\u0431\u0430\u0440"\
|
| 43 |
+
"\u041e\u043a\u0442\u043e\u0431\u0430\u0440"\
|
| 44 |
+
"\u041d\u043e\u0432\u0435\u043c\u0431\u0430\u0440"\
|
| 45 |
+
"\u0414\u0435\u0446\u0435\u043c\u0431\u0430\u0440"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sr BCE "\u043f. \u043d. \u0435."
|
| 48 |
+
::msgcat::mcset sr CE "\u043d. \u0435"
|
| 49 |
+
::msgcat::mcset sr DATE_FORMAT "%Y.%m.%e"
|
| 50 |
+
::msgcat::mcset sr TIME_FORMAT "%k.%M.%S"
|
| 51 |
+
::msgcat::mcset sr DATE_TIME_FORMAT "%Y.%m.%e %k.%M.%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sv.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sv DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"s\u00f6"\
|
| 5 |
+
"m\u00e5"\
|
| 6 |
+
"ti"\
|
| 7 |
+
"on"\
|
| 8 |
+
"to"\
|
| 9 |
+
"fr"\
|
| 10 |
+
"l\u00f6"]
|
| 11 |
+
::msgcat::mcset sv DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"s\u00f6ndag"\
|
| 13 |
+
"m\u00e5ndag"\
|
| 14 |
+
"tisdag"\
|
| 15 |
+
"onsdag"\
|
| 16 |
+
"torsdag"\
|
| 17 |
+
"fredag"\
|
| 18 |
+
"l\u00f6rdag"]
|
| 19 |
+
::msgcat::mcset sv MONTHS_ABBREV [list \
|
| 20 |
+
"jan"\
|
| 21 |
+
"feb"\
|
| 22 |
+
"mar"\
|
| 23 |
+
"apr"\
|
| 24 |
+
"maj"\
|
| 25 |
+
"jun"\
|
| 26 |
+
"jul"\
|
| 27 |
+
"aug"\
|
| 28 |
+
"sep"\
|
| 29 |
+
"okt"\
|
| 30 |
+
"nov"\
|
| 31 |
+
"dec"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sv MONTHS_FULL [list \
|
| 34 |
+
"januari"\
|
| 35 |
+
"februari"\
|
| 36 |
+
"mars"\
|
| 37 |
+
"april"\
|
| 38 |
+
"maj"\
|
| 39 |
+
"juni"\
|
| 40 |
+
"juli"\
|
| 41 |
+
"augusti"\
|
| 42 |
+
"september"\
|
| 43 |
+
"oktober"\
|
| 44 |
+
"november"\
|
| 45 |
+
"december"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sv BCE "f.Kr."
|
| 48 |
+
::msgcat::mcset sv CE "e.Kr."
|
| 49 |
+
::msgcat::mcset sv DATE_FORMAT "%Y-%m-%d"
|
| 50 |
+
::msgcat::mcset sv TIME_FORMAT "%H:%M:%S"
|
| 51 |
+
::msgcat::mcset sv DATE_TIME_FORMAT "%Y-%m-%d %H:%M:%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/sw.msg
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset sw DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Jpi"\
|
| 5 |
+
"Jtt"\
|
| 6 |
+
"Jnn"\
|
| 7 |
+
"Jtn"\
|
| 8 |
+
"Alh"\
|
| 9 |
+
"Iju"\
|
| 10 |
+
"Jmo"]
|
| 11 |
+
::msgcat::mcset sw DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Jumapili"\
|
| 13 |
+
"Jumatatu"\
|
| 14 |
+
"Jumanne"\
|
| 15 |
+
"Jumatano"\
|
| 16 |
+
"Alhamisi"\
|
| 17 |
+
"Ijumaa"\
|
| 18 |
+
"Jumamosi"]
|
| 19 |
+
::msgcat::mcset sw MONTHS_ABBREV [list \
|
| 20 |
+
"Jan"\
|
| 21 |
+
"Feb"\
|
| 22 |
+
"Mar"\
|
| 23 |
+
"Apr"\
|
| 24 |
+
"Mei"\
|
| 25 |
+
"Jun"\
|
| 26 |
+
"Jul"\
|
| 27 |
+
"Ago"\
|
| 28 |
+
"Sep"\
|
| 29 |
+
"Okt"\
|
| 30 |
+
"Nov"\
|
| 31 |
+
"Des"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset sw MONTHS_FULL [list \
|
| 34 |
+
"Januari"\
|
| 35 |
+
"Februari"\
|
| 36 |
+
"Machi"\
|
| 37 |
+
"Aprili"\
|
| 38 |
+
"Mei"\
|
| 39 |
+
"Juni"\
|
| 40 |
+
"Julai"\
|
| 41 |
+
"Agosti"\
|
| 42 |
+
"Septemba"\
|
| 43 |
+
"Oktoba"\
|
| 44 |
+
"Novemba"\
|
| 45 |
+
"Desemba"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset sw BCE "KK"
|
| 48 |
+
::msgcat::mcset sw CE "BK"
|
| 49 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ta.msg
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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0baa\u0bb0\u0bcd"\
|
| 21 |
+
"\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\
|
| 22 |
+
"\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\
|
| 23 |
+
"\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"]
|
| 24 |
+
::msgcat::mcset ta MONTHS_FULL [list \
|
| 25 |
+
"\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf"\
|
| 26 |
+
"\u0baa\u0bc6\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf"\
|
| 27 |
+
"\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd"\
|
| 28 |
+
"\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd"\
|
| 29 |
+
"\u0bae\u0bc7"\
|
| 30 |
+
"\u0b9c\u0bc2\u0ba9\u0bcd"\
|
| 31 |
+
"\u0b9c\u0bc2\u0bb2\u0bc8"\
|
| 32 |
+
"\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd"\
|
| 33 |
+
"\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\
|
| 34 |
+
"\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\
|
| 35 |
+
"\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\
|
| 36 |
+
"\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"]
|
| 37 |
+
::msgcat::mcset ta AM "\u0b95\u0bbf\u0bae\u0bc1"
|
| 38 |
+
::msgcat::mcset ta PM "\u0b95\u0bbf\u0baa\u0bbf"
|
| 39 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ta_in.msg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset ta_IN DATE_FORMAT "%d %M %Y"
|
| 4 |
+
::msgcat::mcset ta_IN TIME_FORMAT_12 "%I:%M:%S %P"
|
| 5 |
+
::msgcat::mcset ta_IN DATE_TIME_FORMAT "%d %M %Y %I:%M:%S %P %z"
|
| 6 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/te.msg
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset te DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u0c06\u0c26\u0c3f"\
|
| 5 |
+
"\u0c38\u0c4b\u0c2e"\
|
| 6 |
+
"\u0c2e\u0c02\u0c17\u0c33"\
|
| 7 |
+
"\u0c2c\u0c41\u0c27"\
|
| 8 |
+
"\u0c17\u0c41\u0c30\u0c41"\
|
| 9 |
+
"\u0c36\u0c41\u0c15\u0c4d\u0c30"\
|
| 10 |
+
"\u0c36\u0c28\u0c3f"]
|
| 11 |
+
::msgcat::mcset te DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u0c06\u0c26\u0c3f\u0c35\u0c3e\u0c30\u0c02"\
|
| 13 |
+
"\u0c38\u0c4b\u0c2e\u0c35\u0c3e\u0c30\u0c02"\
|
| 14 |
+
"\u0c2e\u0c02\u0c17\u0c33\u0c35\u0c3e\u0c30\u0c02"\
|
| 15 |
+
"\u0c2c\u0c41\u0c27\u0c35\u0c3e\u0c30\u0c02"\
|
| 16 |
+
"\u0c17\u0c41\u0c30\u0c41\u0c35\u0c3e\u0c30\u0c02"\
|
| 17 |
+
"\u0c36\u0c41\u0c15\u0c4d\u0c30\u0c35\u0c3e\u0c30\u0c02"\
|
| 18 |
+
"\u0c36\u0c28\u0c3f\u0c35\u0c3e\u0c30\u0c02"]
|
| 19 |
+
::msgcat::mcset te MONTHS_ABBREV [list \
|
| 20 |
+
"\u0c1c\u0c28\u0c35\u0c30\u0c3f"\
|
| 21 |
+
"\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\
|
| 22 |
+
"\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\
|
| 23 |
+
"\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\
|
| 24 |
+
"\u0c2e\u0c47"\
|
| 25 |
+
"\u0c1c\u0c42\u0c28\u0c4d"\
|
| 26 |
+
"\u0c1c\u0c42\u0c32\u0c48"\
|
| 27 |
+
"\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\
|
| 28 |
+
"\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\
|
| 29 |
+
"\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\
|
| 30 |
+
"\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\
|
| 31 |
+
"\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset te MONTHS_FULL [list \
|
| 34 |
+
"\u0c1c\u0c28\u0c35\u0c30\u0c3f"\
|
| 35 |
+
"\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\
|
| 36 |
+
"\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\
|
| 37 |
+
"\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\
|
| 38 |
+
"\u0c2e\u0c47"\
|
| 39 |
+
"\u0c1c\u0c42\u0c28\u0c4d"\
|
| 40 |
+
"\u0c1c\u0c42\u0c32\u0c48"\
|
| 41 |
+
"\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\
|
| 42 |
+
"\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\
|
| 43 |
+
"\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\
|
| 44 |
+
"\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\
|
| 45 |
+
"\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\
|
| 46 |
+
""]
|
| 47 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/te_in.msg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset te_IN AM "\u0c2a\u0c42\u0c30\u0c4d\u0c35\u0c3e\u0c39\u0c4d\u0c28"
|
| 4 |
+
::msgcat::mcset te_IN PM "\u0c05\u0c2a\u0c30\u0c3e\u0c39\u0c4d\u0c28"
|
| 5 |
+
::msgcat::mcset te_IN DATE_FORMAT "%d/%m/%Y"
|
| 6 |
+
::msgcat::mcset te_IN TIME_FORMAT_12 "%I:%M:%S %P"
|
| 7 |
+
::msgcat::mcset te_IN DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z"
|
| 8 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/th.msg
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset th DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u0e2d\u0e32."\
|
| 5 |
+
"\u0e08."\
|
| 6 |
+
"\u0e2d."\
|
| 7 |
+
"\u0e1e."\
|
| 8 |
+
"\u0e1e\u0e24."\
|
| 9 |
+
"\u0e28."\
|
| 10 |
+
"\u0e2a."]
|
| 11 |
+
::msgcat::mcset th DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c"\
|
| 13 |
+
"\u0e27\u0e31\u0e19\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c"\
|
| 14 |
+
"\u0e27\u0e31\u0e19\u0e2d\u0e31\u0e07\u0e04\u0e32\u0e23"\
|
| 15 |
+
"\u0e27\u0e31\u0e19\u0e1e\u0e38\u0e18"\
|
| 16 |
+
"\u0e27\u0e31\u0e19\u0e1e\u0e24\u0e2b\u0e31\u0e2a\u0e1a\u0e14\u0e35"\
|
| 17 |
+
"\u0e27\u0e31\u0e19\u0e28\u0e38\u0e01\u0e23\u0e4c"\
|
| 18 |
+
"\u0e27\u0e31\u0e19\u0e40\u0e2a\u0e32\u0e23\u0e4c"]
|
| 19 |
+
::msgcat::mcset th MONTHS_ABBREV [list \
|
| 20 |
+
"\u0e21.\u0e04."\
|
| 21 |
+
"\u0e01.\u0e1e."\
|
| 22 |
+
"\u0e21\u0e35.\u0e04."\
|
| 23 |
+
"\u0e40\u0e21.\u0e22."\
|
| 24 |
+
"\u0e1e.\u0e04."\
|
| 25 |
+
"\u0e21\u0e34.\u0e22."\
|
| 26 |
+
"\u0e01.\u0e04."\
|
| 27 |
+
"\u0e2a.\u0e04."\
|
| 28 |
+
"\u0e01.\u0e22."\
|
| 29 |
+
"\u0e15.\u0e04."\
|
| 30 |
+
"\u0e1e.\u0e22."\
|
| 31 |
+
"\u0e18.\u0e04."\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset th MONTHS_FULL [list \
|
| 34 |
+
"\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21"\
|
| 35 |
+
"\u0e01\u0e38\u0e21\u0e20\u0e32\u0e1e\u0e31\u0e19\u0e18\u0e4c"\
|
| 36 |
+
"\u0e21\u0e35\u0e19\u0e32\u0e04\u0e21"\
|
| 37 |
+
"\u0e40\u0e21\u0e29\u0e32\u0e22\u0e19"\
|
| 38 |
+
"\u0e1e\u0e24\u0e29\u0e20\u0e32\u0e04\u0e21"\
|
| 39 |
+
"\u0e21\u0e34\u0e16\u0e38\u0e19\u0e32\u0e22\u0e19"\
|
| 40 |
+
"\u0e01\u0e23\u0e01\u0e0e\u0e32\u0e04\u0e21"\
|
| 41 |
+
"\u0e2a\u0e34\u0e07\u0e2b\u0e32\u0e04\u0e21"\
|
| 42 |
+
"\u0e01\u0e31\u0e19\u0e22\u0e32\u0e22\u0e19"\
|
| 43 |
+
"\u0e15\u0e38\u0e25\u0e32\u0e04\u0e21"\
|
| 44 |
+
"\u0e1e\u0e24\u0e28\u0e08\u0e34\u0e01\u0e32\u0e22\u0e19"\
|
| 45 |
+
"\u0e18\u0e31\u0e19\u0e27\u0e32\u0e04\u0e21"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset th BCE "\u0e25\u0e17\u0e35\u0e48"
|
| 48 |
+
::msgcat::mcset th CE "\u0e04.\u0e28."
|
| 49 |
+
::msgcat::mcset th AM "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07"
|
| 50 |
+
::msgcat::mcset th PM "\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07"
|
| 51 |
+
::msgcat::mcset th DATE_FORMAT "%e/%m/%Y"
|
| 52 |
+
::msgcat::mcset th TIME_FORMAT "%k:%M:%S"
|
| 53 |
+
::msgcat::mcset th DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z"
|
| 54 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/tr.msg
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset tr DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Paz"\
|
| 5 |
+
"Pzt"\
|
| 6 |
+
"Sal"\
|
| 7 |
+
"\u00c7ar"\
|
| 8 |
+
"Per"\
|
| 9 |
+
"Cum"\
|
| 10 |
+
"Cmt"]
|
| 11 |
+
::msgcat::mcset tr DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Pazar"\
|
| 13 |
+
"Pazartesi"\
|
| 14 |
+
"Sal\u0131"\
|
| 15 |
+
"\u00c7ar\u015famba"\
|
| 16 |
+
"Per\u015fembe"\
|
| 17 |
+
"Cuma"\
|
| 18 |
+
"Cumartesi"]
|
| 19 |
+
::msgcat::mcset tr MONTHS_ABBREV [list \
|
| 20 |
+
"Oca"\
|
| 21 |
+
"\u015eub"\
|
| 22 |
+
"Mar"\
|
| 23 |
+
"Nis"\
|
| 24 |
+
"May"\
|
| 25 |
+
"Haz"\
|
| 26 |
+
"Tem"\
|
| 27 |
+
"A\u011fu"\
|
| 28 |
+
"Eyl"\
|
| 29 |
+
"Eki"\
|
| 30 |
+
"Kas"\
|
| 31 |
+
"Ara"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset tr MONTHS_FULL [list \
|
| 34 |
+
"Ocak"\
|
| 35 |
+
"\u015eubat"\
|
| 36 |
+
"Mart"\
|
| 37 |
+
"Nisan"\
|
| 38 |
+
"May\u0131s"\
|
| 39 |
+
"Haziran"\
|
| 40 |
+
"Temmuz"\
|
| 41 |
+
"A\u011fustos"\
|
| 42 |
+
"Eyl\u00fcl"\
|
| 43 |
+
"Ekim"\
|
| 44 |
+
"Kas\u0131m"\
|
| 45 |
+
"Aral\u0131k"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset tr DATE_FORMAT "%d.%m.%Y"
|
| 48 |
+
::msgcat::mcset tr TIME_FORMAT "%H:%M:%S"
|
| 49 |
+
::msgcat::mcset tr DATE_TIME_FORMAT "%d.%m.%Y %H:%M:%S %z"
|
| 50 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/uk.msg
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset uk DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u043d\u0434"\
|
| 5 |
+
"\u043f\u043d"\
|
| 6 |
+
"\u0432\u0442"\
|
| 7 |
+
"\u0441\u0440"\
|
| 8 |
+
"\u0447\u0442"\
|
| 9 |
+
"\u043f\u0442"\
|
| 10 |
+
"\u0441\u0431"]
|
| 11 |
+
::msgcat::mcset uk DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u043d\u0435\u0434\u0456\u043b\u044f"\
|
| 13 |
+
"\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a"\
|
| 14 |
+
"\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a"\
|
| 15 |
+
"\u0441\u0435\u0440\u0435\u0434\u0430"\
|
| 16 |
+
"\u0447\u0435\u0442\u0432\u0435\u0440"\
|
| 17 |
+
"\u043f'\u044f\u0442\u043d\u0438\u0446\u044f"\
|
| 18 |
+
"\u0441\u0443\u0431\u043e\u0442\u0430"]
|
| 19 |
+
::msgcat::mcset uk MONTHS_ABBREV [list \
|
| 20 |
+
"\u0441\u0456\u0447"\
|
| 21 |
+
"\u043b\u044e\u0442"\
|
| 22 |
+
"\u0431\u0435\u0440"\
|
| 23 |
+
"\u043a\u0432\u0456\u0442"\
|
| 24 |
+
"\u0442\u0440\u0430\u0432"\
|
| 25 |
+
"\u0447\u0435\u0440\u0432"\
|
| 26 |
+
"\u043b\u0438\u043f"\
|
| 27 |
+
"\u0441\u0435\u0440\u043f"\
|
| 28 |
+
"\u0432\u0435\u0440"\
|
| 29 |
+
"\u0436\u043e\u0432\u0442"\
|
| 30 |
+
"\u043b\u0438\u0441\u0442"\
|
| 31 |
+
"\u0433\u0440\u0443\u0434"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset uk MONTHS_FULL [list \
|
| 34 |
+
"\u0441\u0456\u0447\u043d\u044f"\
|
| 35 |
+
"\u043b\u044e\u0442\u043e\u0433\u043e"\
|
| 36 |
+
"\u0431\u0435\u0440\u0435\u0437\u043d\u044f"\
|
| 37 |
+
"\u043a\u0432\u0456\u0442\u043d\u044f"\
|
| 38 |
+
"\u0442\u0440\u0430\u0432\u043d\u044f"\
|
| 39 |
+
"\u0447\u0435\u0440\u0432\u043d\u044f"\
|
| 40 |
+
"\u043b\u0438\u043f\u043d\u044f"\
|
| 41 |
+
"\u0441\u0435\u0440\u043f\u043d\u044f"\
|
| 42 |
+
"\u0432\u0435\u0440\u0435\u0441\u043d\u044f"\
|
| 43 |
+
"\u0436\u043e\u0432\u0442\u043d\u044f"\
|
| 44 |
+
"\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430"\
|
| 45 |
+
"\u0433\u0440\u0443\u0434\u043d\u044f"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset uk BCE "\u0434\u043e \u043d.\u0435."
|
| 48 |
+
::msgcat::mcset uk CE "\u043f\u0456\u0441\u043b\u044f \u043d.\u0435."
|
| 49 |
+
::msgcat::mcset uk DATE_FORMAT "%e/%m/%Y"
|
| 50 |
+
::msgcat::mcset uk TIME_FORMAT "%k:%M:%S"
|
| 51 |
+
::msgcat::mcset uk DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z"
|
| 52 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/vi.msg
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset vi DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"Th 2"\
|
| 5 |
+
"Th 3"\
|
| 6 |
+
"Th 4"\
|
| 7 |
+
"Th 5"\
|
| 8 |
+
"Th 6"\
|
| 9 |
+
"Th 7"\
|
| 10 |
+
"CN"]
|
| 11 |
+
::msgcat::mcset vi DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"Th\u01b0\u0301 hai"\
|
| 13 |
+
"Th\u01b0\u0301 ba"\
|
| 14 |
+
"Th\u01b0\u0301 t\u01b0"\
|
| 15 |
+
"Th\u01b0\u0301 n\u0103m"\
|
| 16 |
+
"Th\u01b0\u0301 s\u00e1u"\
|
| 17 |
+
"Th\u01b0\u0301 ba\u0309y"\
|
| 18 |
+
"Chu\u0309 nh\u00e2\u0323t"]
|
| 19 |
+
::msgcat::mcset vi MONTHS_ABBREV [list \
|
| 20 |
+
"Thg 1"\
|
| 21 |
+
"Thg 2"\
|
| 22 |
+
"Thg 3"\
|
| 23 |
+
"Thg 4"\
|
| 24 |
+
"Thg 5"\
|
| 25 |
+
"Thg 6"\
|
| 26 |
+
"Thg 7"\
|
| 27 |
+
"Thg 8"\
|
| 28 |
+
"Thg 9"\
|
| 29 |
+
"Thg 10"\
|
| 30 |
+
"Thg 11"\
|
| 31 |
+
"Thg 12"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset vi MONTHS_FULL [list \
|
| 34 |
+
"Th\u00e1ng m\u00f4\u0323t"\
|
| 35 |
+
"Th\u00e1ng hai"\
|
| 36 |
+
"Th\u00e1ng ba"\
|
| 37 |
+
"Th\u00e1ng t\u01b0"\
|
| 38 |
+
"Th\u00e1ng n\u0103m"\
|
| 39 |
+
"Th\u00e1ng s\u00e1u"\
|
| 40 |
+
"Th\u00e1ng ba\u0309y"\
|
| 41 |
+
"Th\u00e1ng t\u00e1m"\
|
| 42 |
+
"Th\u00e1ng ch\u00edn"\
|
| 43 |
+
"Th\u00e1ng m\u01b0\u01a1\u0300i"\
|
| 44 |
+
"Th\u00e1ng m\u01b0\u01a1\u0300i m\u00f4\u0323t"\
|
| 45 |
+
"Th\u00e1ng m\u01b0\u01a1\u0300i hai"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset vi DATE_FORMAT "%d %b %Y"
|
| 48 |
+
::msgcat::mcset vi TIME_FORMAT "%H:%M:%S"
|
| 49 |
+
::msgcat::mcset vi DATE_TIME_FORMAT "%d %b %Y %H:%M:%S %z"
|
| 50 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh.msg
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset zh DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u661f\u671f\u65e5"\
|
| 5 |
+
"\u661f\u671f\u4e00"\
|
| 6 |
+
"\u661f\u671f\u4e8c"\
|
| 7 |
+
"\u661f\u671f\u4e09"\
|
| 8 |
+
"\u661f\u671f\u56db"\
|
| 9 |
+
"\u661f\u671f\u4e94"\
|
| 10 |
+
"\u661f\u671f\u516d"]
|
| 11 |
+
::msgcat::mcset zh DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u661f\u671f\u65e5"\
|
| 13 |
+
"\u661f\u671f\u4e00"\
|
| 14 |
+
"\u661f\u671f\u4e8c"\
|
| 15 |
+
"\u661f\u671f\u4e09"\
|
| 16 |
+
"\u661f\u671f\u56db"\
|
| 17 |
+
"\u661f\u671f\u4e94"\
|
| 18 |
+
"\u661f\u671f\u516d"]
|
| 19 |
+
::msgcat::mcset zh MONTHS_ABBREV [list \
|
| 20 |
+
"\u4e00\u6708"\
|
| 21 |
+
"\u4e8c\u6708"\
|
| 22 |
+
"\u4e09\u6708"\
|
| 23 |
+
"\u56db\u6708"\
|
| 24 |
+
"\u4e94\u6708"\
|
| 25 |
+
"\u516d\u6708"\
|
| 26 |
+
"\u4e03\u6708"\
|
| 27 |
+
"\u516b\u6708"\
|
| 28 |
+
"\u4e5d\u6708"\
|
| 29 |
+
"\u5341\u6708"\
|
| 30 |
+
"\u5341\u4e00\u6708"\
|
| 31 |
+
"\u5341\u4e8c\u6708"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset zh MONTHS_FULL [list \
|
| 34 |
+
"\u4e00\u6708"\
|
| 35 |
+
"\u4e8c\u6708"\
|
| 36 |
+
"\u4e09\u6708"\
|
| 37 |
+
"\u56db\u6708"\
|
| 38 |
+
"\u4e94\u6708"\
|
| 39 |
+
"\u516d\u6708"\
|
| 40 |
+
"\u4e03\u6708"\
|
| 41 |
+
"\u516b\u6708"\
|
| 42 |
+
"\u4e5d\u6708"\
|
| 43 |
+
"\u5341\u6708"\
|
| 44 |
+
"\u5341\u4e00\u6708"\
|
| 45 |
+
"\u5341\u4e8c\u6708"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset zh BCE "\u516c\u5143\u524d"
|
| 48 |
+
::msgcat::mcset zh CE "\u516c\u5143"
|
| 49 |
+
::msgcat::mcset zh AM "\u4e0a\u5348"
|
| 50 |
+
::msgcat::mcset zh PM "\u4e0b\u5348"
|
| 51 |
+
::msgcat::mcset zh LOCALE_NUMERALS "\u3007 \u4e00 \u4e8c \u4e09 \u56db \u4e94 \u516d \u4e03 \u516b \u4e5d \u5341 \u5341\u4e00 \u5341\u4e8c \u5341\u4e09 \u5341\u56db \u5341\u4e94 \u5341\u516d \u5341\u4e03 \u5341\u516b \u5341\u4e5d \u4e8c\u5341 \u5eff\u4e00 \u5eff\u4e8c \u5eff\u4e09 \u5eff\u56db \u5eff\u4e94 \u5eff\u516d \u5eff\u4e03 \u5eff\u516b \u5eff\u4e5d \u4e09\u5341 \u5345\u4e00 \u5345\u4e8c \u5345\u4e09 \u5345\u56db \u5345\u4e94 \u5345\u516d \u5345\u4e03 \u5345\u516b \u5345\u4e5d \u56db\u5341 \u56db\u5341\u4e00 \u56db\u5341\u4e8c \u56db\u5341\u4e09 \u56db\u5341\u56db \u56db\u5341\u4e94 \u56db\u5341\u516d \u56db\u5341\u4e03 \u56db\u5341\u516b \u56db\u5341\u4e5d \u4e94\u5341 \u4e94\u5341\u4e00 \u4e94\u5341\u4e8c \u4e94\u5341\u4e09 \u4e94\u5341\u56db \u4e94\u5341\u4e94 \u4e94\u5341\u516d \u4e94\u5341\u4e03 \u4e94\u5341\u516b \u4e94\u5341\u4e5d \u516d\u5341 \u516d\u5341\u4e00 \u516d\u5341\u4e8c \u516d\u5341\u4e09 \u516d\u5341\u56db \u516d\u5341\u4e94 \u516d\u5341\u516d \u516d\u5341\u4e03 \u516d\u5341\u516b \u516d\u5341\u4e5d \u4e03\u5341 \u4e03\u5341\u4e00 \u4e03\u5341\u4e8c \u4e03\u5341\u4e09 \u4e03\u5341\u56db \u4e03\u5341\u4e94 \u4e03\u5341\u516d \u4e03\u5341\u4e03 \u4e03\u5341\u516b \u4e03\u5341\u4e5d \u516b\u5341 \u516b\u5341\u4e00 \u516b\u5341\u4e8c \u516b\u5341\u4e09 \u516b\u5341\u56db \u516b\u5341\u4e94 \u516b\u5341\u516d \u516b\u5341\u4e03 \u516b\u5341\u516b \u516b\u5341\u4e5d \u4e5d\u5341 \u4e5d\u5341\u4e00 \u4e5d\u5341\u4e8c \u4e5d\u5341\u4e09 \u4e5d\u5341\u56db \u4e5d\u5341\u4e94 \u4e5d\u5341\u516d \u4e5d\u5341\u4e03 \u4e5d\u5341\u516b \u4e5d\u5341\u4e5d"
|
| 52 |
+
::msgcat::mcset zh LOCALE_DATE_FORMAT "\u516c\u5143%Y\u5e74%B%Od\u65e5"
|
| 53 |
+
::msgcat::mcset zh LOCALE_TIME_FORMAT "%OH\u65f6%OM\u5206%OS\u79d2"
|
| 54 |
+
::msgcat::mcset zh LOCALE_DATE_TIME_FORMAT "%A %Y\u5e74%B%Od\u65e5%OH\u65f6%OM\u5206%OS\u79d2 %z"
|
| 55 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_cn.msg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset zh_CN DATE_FORMAT "%Y-%m-%e"
|
| 4 |
+
::msgcat::mcset zh_CN TIME_FORMAT "%k:%M:%S"
|
| 5 |
+
::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%I\u65f6%M\u5206%S\u79d2"
|
| 6 |
+
::msgcat::mcset zh_CN DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z"
|
| 7 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_hk.msg
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset zh_HK DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u65e5"\
|
| 5 |
+
"\u4e00"\
|
| 6 |
+
"\u4e8c"\
|
| 7 |
+
"\u4e09"\
|
| 8 |
+
"\u56db"\
|
| 9 |
+
"\u4e94"\
|
| 10 |
+
"\u516d"]
|
| 11 |
+
::msgcat::mcset zh_HK MONTHS_ABBREV [list \
|
| 12 |
+
"1\u6708"\
|
| 13 |
+
"2\u6708"\
|
| 14 |
+
"3\u6708"\
|
| 15 |
+
"4\u6708"\
|
| 16 |
+
"5\u6708"\
|
| 17 |
+
"6\u6708"\
|
| 18 |
+
"7\u6708"\
|
| 19 |
+
"8\u6708"\
|
| 20 |
+
"9\u6708"\
|
| 21 |
+
"10\u6708"\
|
| 22 |
+
"11\u6708"\
|
| 23 |
+
"12\u6708"\
|
| 24 |
+
""]
|
| 25 |
+
::msgcat::mcset zh_HK DATE_FORMAT "%Y\u5e74%m\u6708%e\u65e5"
|
| 26 |
+
::msgcat::mcset zh_HK TIME_FORMAT_12 "%P%I:%M:%S"
|
| 27 |
+
::msgcat::mcset zh_HK DATE_TIME_FORMAT "%Y\u5e74%m\u6708%e\u65e5 %P%I:%M:%S %z"
|
| 28 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_sg.msg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset zh_SG AM "\u4e0a\u5348"
|
| 4 |
+
::msgcat::mcset zh_SG PM "\u4e2d\u5348"
|
| 5 |
+
::msgcat::mcset zh_SG DATE_FORMAT "%d %B %Y"
|
| 6 |
+
::msgcat::mcset zh_SG TIME_FORMAT_12 "%P %I:%M:%S"
|
| 7 |
+
::msgcat::mcset zh_SG DATE_TIME_FORMAT "%d %B %Y %P %I:%M:%S %z"
|
| 8 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/msgs/zh_tw.msg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset zh_TW BCE "\u6c11\u570b\u524d"
|
| 4 |
+
::msgcat::mcset zh_TW CE "\u6c11\u570b"
|
| 5 |
+
::msgcat::mcset zh_TW DATE_FORMAT "%Y/%m/%e"
|
| 6 |
+
::msgcat::mcset zh_TW TIME_FORMAT_12 "%P %I:%M:%S"
|
| 7 |
+
::msgcat::mcset zh_TW DATE_TIME_FORMAT "%Y/%m/%e %P %I:%M:%S %z"
|
| 8 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/opt0.4/optparse.tcl
ADDED
|
@@ -0,0 +1,1072 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# optparse.tcl --
|
| 2 |
+
#
|
| 3 |
+
# (private) Option parsing package
|
| 4 |
+
# Primarily used internally by the safe:: code.
|
| 5 |
+
#
|
| 6 |
+
# WARNING: This code will go away in a future release
|
| 7 |
+
# of Tcl. It is NOT supported and you should not rely
|
| 8 |
+
# on it. If your code does rely on this package you
|
| 9 |
+
# may directly incorporate this code into your application.
|
| 10 |
+
|
| 11 |
+
package require Tcl 8.5-
|
| 12 |
+
# When this version number changes, update the pkgIndex.tcl file
|
| 13 |
+
# and the install directory in the Makefiles.
|
| 14 |
+
package provide opt 0.4.9
|
| 15 |
+
|
| 16 |
+
namespace eval ::tcl {
|
| 17 |
+
|
| 18 |
+
# Exported APIs
|
| 19 |
+
namespace export OptKeyRegister OptKeyDelete OptKeyError OptKeyParse \
|
| 20 |
+
OptProc OptProcArgGiven OptParse \
|
| 21 |
+
Lempty Lget \
|
| 22 |
+
Lassign Lvarpop Lvarpop1 Lvarset Lvarincr \
|
| 23 |
+
SetMax SetMin
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
################# Example of use / 'user documentation' ###################
|
| 27 |
+
|
| 28 |
+
proc OptCreateTestProc {} {
|
| 29 |
+
|
| 30 |
+
# Defines ::tcl::OptParseTest as a test proc with parsed arguments
|
| 31 |
+
# (can't be defined before the code below is loaded (before "OptProc"))
|
| 32 |
+
|
| 33 |
+
# Every OptProc give usage information on "procname -help".
|
| 34 |
+
# Try "tcl::OptParseTest -help" and "tcl::OptParseTest -a" and
|
| 35 |
+
# then other arguments.
|
| 36 |
+
#
|
| 37 |
+
# example of 'valid' call:
|
| 38 |
+
# ::tcl::OptParseTest save -4 -pr 23 -libsok SybTcl\
|
| 39 |
+
# -nostatics false ch1
|
| 40 |
+
OptProc OptParseTest {
|
| 41 |
+
{subcommand -choice {save print} "sub command"}
|
| 42 |
+
{arg1 3 "some number"}
|
| 43 |
+
{-aflag}
|
| 44 |
+
{-intflag 7}
|
| 45 |
+
{-weirdflag "help string"}
|
| 46 |
+
{-noStatics "Not ok to load static packages"}
|
| 47 |
+
{-nestedloading1 true "OK to load into nested children"}
|
| 48 |
+
{-nestedloading2 -boolean true "OK to load into nested children"}
|
| 49 |
+
{-libsOK -choice {Tk SybTcl}
|
| 50 |
+
"List of packages that can be loaded"}
|
| 51 |
+
{-precision -int 12 "Number of digits of precision"}
|
| 52 |
+
{-intval 7 "An integer"}
|
| 53 |
+
{-scale -float 1.0 "Scale factor"}
|
| 54 |
+
{-zoom 1.0 "Zoom factor"}
|
| 55 |
+
{-arbitrary foobar "Arbitrary string"}
|
| 56 |
+
{-random -string 12 "Random string"}
|
| 57 |
+
{-listval -list {} "List value"}
|
| 58 |
+
{-blahflag -blah abc "Funny type"}
|
| 59 |
+
{arg2 -boolean "a boolean"}
|
| 60 |
+
{arg3 -choice "ch1 ch2"}
|
| 61 |
+
{?optarg? -list {} "optional argument"}
|
| 62 |
+
} {
|
| 63 |
+
foreach v [info locals] {
|
| 64 |
+
puts stderr [format "%14s : %s" $v [set $v]]
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
################### No User serviceable part below ! ###############
|
| 70 |
+
|
| 71 |
+
# Array storing the parsed descriptions
|
| 72 |
+
variable OptDesc
|
| 73 |
+
array set OptDesc {}
|
| 74 |
+
# Next potentially free key id (numeric)
|
| 75 |
+
variable OptDescN 0
|
| 76 |
+
|
| 77 |
+
# Inside algorithm/mechanism description:
|
| 78 |
+
# (not for the faint-hearted ;-)
|
| 79 |
+
#
|
| 80 |
+
# The argument description is parsed into a "program tree"
|
| 81 |
+
# It is called a "program" because it is the program used by
|
| 82 |
+
# the state machine interpreter that use that program to
|
| 83 |
+
# actually parse the arguments at run time.
|
| 84 |
+
#
|
| 85 |
+
# The general structure of a "program" is
|
| 86 |
+
# notation (pseudo bnf like)
|
| 87 |
+
# name :== definition defines "name" as being "definition"
|
| 88 |
+
# { x y z } means list of x, y, and z
|
| 89 |
+
# x* means x repeated 0 or more time
|
| 90 |
+
# x+ means "x x*"
|
| 91 |
+
# x? means optionally x
|
| 92 |
+
# x | y means x or y
|
| 93 |
+
# "cccc" means the literal string
|
| 94 |
+
#
|
| 95 |
+
# program :== { programCounter programStep* }
|
| 96 |
+
#
|
| 97 |
+
# programStep :== program | singleStep
|
| 98 |
+
#
|
| 99 |
+
# programCounter :== {"P" integer+ }
|
| 100 |
+
#
|
| 101 |
+
# singleStep :== { instruction parameters* }
|
| 102 |
+
#
|
| 103 |
+
# instruction :== single element list
|
| 104 |
+
#
|
| 105 |
+
# (the difference between singleStep and program is that \
|
| 106 |
+
# llength [lindex $program 0] >= 2
|
| 107 |
+
# while
|
| 108 |
+
# llength [lindex $singleStep 0] == 1
|
| 109 |
+
# )
|
| 110 |
+
#
|
| 111 |
+
# And for this application:
|
| 112 |
+
#
|
| 113 |
+
# singleStep :== { instruction varname {hasBeenSet currentValue} type
|
| 114 |
+
# typeArgs help }
|
| 115 |
+
# instruction :== "flags" | "value"
|
| 116 |
+
# type :== knowType | anyword
|
| 117 |
+
# knowType :== "string" | "int" | "boolean" | "boolflag" | "float"
|
| 118 |
+
# | "choice"
|
| 119 |
+
#
|
| 120 |
+
# for type "choice" typeArgs is a list of possible choices, the first one
|
| 121 |
+
# is the default value. for all other types the typeArgs is the default value
|
| 122 |
+
#
|
| 123 |
+
# a "boolflag" is the type for a flag whose presence or absence, without
|
| 124 |
+
# additional arguments means respectively true or false (default flag type).
|
| 125 |
+
#
|
| 126 |
+
# programCounter is the index in the list of the currently processed
|
| 127 |
+
# programStep (thus starting at 1 (0 is {"P" prgCounterValue}).
|
| 128 |
+
# If it is a list it points toward each currently selected programStep.
|
| 129 |
+
# (like for "flags", as they are optional, form a set and programStep).
|
| 130 |
+
|
| 131 |
+
# Performance/Implementation issues
|
| 132 |
+
# ---------------------------------
|
| 133 |
+
# We use tcl lists instead of arrays because with tcl8.0
|
| 134 |
+
# they should start to be much faster.
|
| 135 |
+
# But this code use a lot of helper procs (like Lvarset)
|
| 136 |
+
# which are quite slow and would be helpfully optimized
|
| 137 |
+
# for instance by being written in C. Also our structure
|
| 138 |
+
# is complex and there is maybe some places where the
|
| 139 |
+
# string rep might be calculated at great expense. to be checked.
|
| 140 |
+
|
| 141 |
+
#
|
| 142 |
+
# Parse a given description and saves it here under the given key
|
| 143 |
+
# generate a unused keyid if not given
|
| 144 |
+
#
|
| 145 |
+
proc ::tcl::OptKeyRegister {desc {key ""}} {
|
| 146 |
+
variable OptDesc
|
| 147 |
+
variable OptDescN
|
| 148 |
+
if {[string equal $key ""]} {
|
| 149 |
+
# in case a key given to us as a parameter was a number
|
| 150 |
+
while {[info exists OptDesc($OptDescN)]} {incr OptDescN}
|
| 151 |
+
set key $OptDescN
|
| 152 |
+
incr OptDescN
|
| 153 |
+
}
|
| 154 |
+
# program counter
|
| 155 |
+
set program [list [list "P" 1]]
|
| 156 |
+
|
| 157 |
+
# are we processing flags (which makes a single program step)
|
| 158 |
+
set inflags 0
|
| 159 |
+
|
| 160 |
+
set state {}
|
| 161 |
+
|
| 162 |
+
# flag used to detect that we just have a single (flags set) subprogram.
|
| 163 |
+
set empty 1
|
| 164 |
+
|
| 165 |
+
foreach item $desc {
|
| 166 |
+
if {$state == "args"} {
|
| 167 |
+
# more items after 'args'...
|
| 168 |
+
return -code error "'args' special argument must be the last one"
|
| 169 |
+
}
|
| 170 |
+
set res [OptNormalizeOne $item]
|
| 171 |
+
set state [lindex $res 0]
|
| 172 |
+
if {$inflags} {
|
| 173 |
+
if {$state == "flags"} {
|
| 174 |
+
# add to 'subprogram'
|
| 175 |
+
lappend flagsprg $res
|
| 176 |
+
} else {
|
| 177 |
+
# put in the flags
|
| 178 |
+
# structure for flag programs items is a list of
|
| 179 |
+
# {subprgcounter {prg flag 1} {prg flag 2} {...}}
|
| 180 |
+
lappend program $flagsprg
|
| 181 |
+
# put the other regular stuff
|
| 182 |
+
lappend program $res
|
| 183 |
+
set inflags 0
|
| 184 |
+
set empty 0
|
| 185 |
+
}
|
| 186 |
+
} else {
|
| 187 |
+
if {$state == "flags"} {
|
| 188 |
+
set inflags 1
|
| 189 |
+
# sub program counter + first sub program
|
| 190 |
+
set flagsprg [list [list "P" 1] $res]
|
| 191 |
+
} else {
|
| 192 |
+
lappend program $res
|
| 193 |
+
set empty 0
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
if {$inflags} {
|
| 198 |
+
if {$empty} {
|
| 199 |
+
# We just have the subprogram, optimize and remove
|
| 200 |
+
# unneeded level:
|
| 201 |
+
set program $flagsprg
|
| 202 |
+
} else {
|
| 203 |
+
lappend program $flagsprg
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
set OptDesc($key) $program
|
| 208 |
+
|
| 209 |
+
return $key
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
#
|
| 213 |
+
# Free the storage for that given key
|
| 214 |
+
#
|
| 215 |
+
proc ::tcl::OptKeyDelete {key} {
|
| 216 |
+
variable OptDesc
|
| 217 |
+
unset OptDesc($key)
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
# Get the parsed description stored under the given key.
|
| 221 |
+
proc OptKeyGetDesc {descKey} {
|
| 222 |
+
variable OptDesc
|
| 223 |
+
if {![info exists OptDesc($descKey)]} {
|
| 224 |
+
return -code error "Unknown option description key \"$descKey\""
|
| 225 |
+
}
|
| 226 |
+
set OptDesc($descKey)
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
# Parse entry point for people who don't want to register with a key,
|
| 230 |
+
# for instance because the description changes dynamically.
|
| 231 |
+
# (otherwise one should really use OptKeyRegister once + OptKeyParse
|
| 232 |
+
# as it is way faster or simply OptProc which does it all)
|
| 233 |
+
# Assign a temporary key, call OptKeyParse and then free the storage
|
| 234 |
+
proc ::tcl::OptParse {desc arglist} {
|
| 235 |
+
set tempkey [OptKeyRegister $desc]
|
| 236 |
+
set ret [catch {uplevel 1 [list ::tcl::OptKeyParse $tempkey $arglist]} res]
|
| 237 |
+
OptKeyDelete $tempkey
|
| 238 |
+
return -code $ret $res
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
# Helper function, replacement for proc that both
|
| 242 |
+
# register the description under a key which is the name of the proc
|
| 243 |
+
# (and thus unique to that code)
|
| 244 |
+
# and add a first line to the code to call the OptKeyParse proc
|
| 245 |
+
# Stores the list of variables that have been actually given by the user
|
| 246 |
+
# (the other will be sets to their default value)
|
| 247 |
+
# into local variable named "Args".
|
| 248 |
+
proc ::tcl::OptProc {name desc body} {
|
| 249 |
+
set namespace [uplevel 1 [list ::namespace current]]
|
| 250 |
+
if {[string match "::*" $name] || [string equal $namespace "::"]} {
|
| 251 |
+
# absolute name or global namespace, name is the key
|
| 252 |
+
set key $name
|
| 253 |
+
} else {
|
| 254 |
+
# we are relative to some non top level namespace:
|
| 255 |
+
set key "${namespace}::${name}"
|
| 256 |
+
}
|
| 257 |
+
OptKeyRegister $desc $key
|
| 258 |
+
uplevel 1 [list ::proc $name args "set Args \[::tcl::OptKeyParse $key \$args\]\n$body"]
|
| 259 |
+
return $key
|
| 260 |
+
}
|
| 261 |
+
# Check that a argument has been given
|
| 262 |
+
# assumes that "OptProc" has been used as it will check in "Args" list
|
| 263 |
+
proc ::tcl::OptProcArgGiven {argname} {
|
| 264 |
+
upvar Args alist
|
| 265 |
+
expr {[lsearch $alist $argname] >=0}
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
#######
|
| 269 |
+
# Programs/Descriptions manipulation
|
| 270 |
+
|
| 271 |
+
# Return the instruction word/list of a given step/(sub)program
|
| 272 |
+
proc OptInstr {lst} {
|
| 273 |
+
lindex $lst 0
|
| 274 |
+
}
|
| 275 |
+
# Is a (sub) program or a plain instruction ?
|
| 276 |
+
proc OptIsPrg {lst} {
|
| 277 |
+
expr {[llength [OptInstr $lst]]>=2}
|
| 278 |
+
}
|
| 279 |
+
# Is this instruction a program counter or a real instr
|
| 280 |
+
proc OptIsCounter {item} {
|
| 281 |
+
expr {[lindex $item 0]=="P"}
|
| 282 |
+
}
|
| 283 |
+
# Current program counter (2nd word of first word)
|
| 284 |
+
proc OptGetPrgCounter {lst} {
|
| 285 |
+
Lget $lst {0 1}
|
| 286 |
+
}
|
| 287 |
+
# Current program counter (2nd word of first word)
|
| 288 |
+
proc OptSetPrgCounter {lstName newValue} {
|
| 289 |
+
upvar $lstName lst
|
| 290 |
+
set lst [lreplace $lst 0 0 [concat "P" $newValue]]
|
| 291 |
+
}
|
| 292 |
+
# returns a list of currently selected items.
|
| 293 |
+
proc OptSelection {lst} {
|
| 294 |
+
set res {}
|
| 295 |
+
foreach idx [lrange [lindex $lst 0] 1 end] {
|
| 296 |
+
lappend res [Lget $lst $idx]
|
| 297 |
+
}
|
| 298 |
+
return $res
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
# Advance to next description
|
| 302 |
+
proc OptNextDesc {descName} {
|
| 303 |
+
uplevel 1 [list Lvarincr $descName {0 1}]
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
# Get the current description, eventually descend
|
| 307 |
+
proc OptCurDesc {descriptions} {
|
| 308 |
+
lindex $descriptions [OptGetPrgCounter $descriptions]
|
| 309 |
+
}
|
| 310 |
+
# get the current description, eventually descend
|
| 311 |
+
# through sub programs as needed.
|
| 312 |
+
proc OptCurDescFinal {descriptions} {
|
| 313 |
+
set item [OptCurDesc $descriptions]
|
| 314 |
+
# Descend untill we get the actual item and not a sub program
|
| 315 |
+
while {[OptIsPrg $item]} {
|
| 316 |
+
set item [OptCurDesc $item]
|
| 317 |
+
}
|
| 318 |
+
return $item
|
| 319 |
+
}
|
| 320 |
+
# Current final instruction adress
|
| 321 |
+
proc OptCurAddr {descriptions {start {}}} {
|
| 322 |
+
set adress [OptGetPrgCounter $descriptions]
|
| 323 |
+
lappend start $adress
|
| 324 |
+
set item [lindex $descriptions $adress]
|
| 325 |
+
if {[OptIsPrg $item]} {
|
| 326 |
+
return [OptCurAddr $item $start]
|
| 327 |
+
} else {
|
| 328 |
+
return $start
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
# Set the value field of the current instruction.
|
| 332 |
+
proc OptCurSetValue {descriptionsName value} {
|
| 333 |
+
upvar $descriptionsName descriptions
|
| 334 |
+
# Get the current item full address.
|
| 335 |
+
set adress [OptCurAddr $descriptions]
|
| 336 |
+
# Use the 3rd field of the item (see OptValue / OptNewInst).
|
| 337 |
+
lappend adress 2
|
| 338 |
+
Lvarset descriptions $adress [list 1 $value]
|
| 339 |
+
# ^hasBeenSet flag
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
# Empty state means done/paste the end of the program.
|
| 343 |
+
proc OptState {item} {
|
| 344 |
+
lindex $item 0
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
# current state
|
| 348 |
+
proc OptCurState {descriptions} {
|
| 349 |
+
OptState [OptCurDesc $descriptions]
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
#######
|
| 353 |
+
# Arguments manipulation
|
| 354 |
+
|
| 355 |
+
# Returns the argument that has to be processed now.
|
| 356 |
+
proc OptCurrentArg {lst} {
|
| 357 |
+
lindex $lst 0
|
| 358 |
+
}
|
| 359 |
+
# Advance to next argument.
|
| 360 |
+
proc OptNextArg {argsName} {
|
| 361 |
+
uplevel 1 [list Lvarpop1 $argsName]
|
| 362 |
+
}
|
| 363 |
+
#######
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
# Loop over all descriptions, calling OptDoOne which will
|
| 370 |
+
# eventually eat all the arguments.
|
| 371 |
+
proc OptDoAll {descriptionsName argumentsName} {
|
| 372 |
+
upvar $descriptionsName descriptions
|
| 373 |
+
upvar $argumentsName arguments
|
| 374 |
+
# puts "entered DoAll"
|
| 375 |
+
# Nb: the places where "state" can be set are tricky to figure
|
| 376 |
+
# because DoOne sets the state to flagsValue and return -continue
|
| 377 |
+
# when needed...
|
| 378 |
+
set state [OptCurState $descriptions]
|
| 379 |
+
# We'll exit the loop in "OptDoOne" or when state is empty.
|
| 380 |
+
while 1 {
|
| 381 |
+
set curitem [OptCurDesc $descriptions]
|
| 382 |
+
# Do subprograms if needed, call ourselves on the sub branch
|
| 383 |
+
while {[OptIsPrg $curitem]} {
|
| 384 |
+
OptDoAll curitem arguments
|
| 385 |
+
# puts "done DoAll sub"
|
| 386 |
+
# Insert back the results in current tree
|
| 387 |
+
Lvarset1nc descriptions [OptGetPrgCounter $descriptions]\
|
| 388 |
+
$curitem
|
| 389 |
+
OptNextDesc descriptions
|
| 390 |
+
set curitem [OptCurDesc $descriptions]
|
| 391 |
+
set state [OptCurState $descriptions]
|
| 392 |
+
}
|
| 393 |
+
# puts "state = \"$state\" - arguments=($arguments)"
|
| 394 |
+
if {[Lempty $state]} {
|
| 395 |
+
# Nothing left to do, we are done in this branch:
|
| 396 |
+
break
|
| 397 |
+
}
|
| 398 |
+
# The following statement can make us terminate/continue
|
| 399 |
+
# as it use return -code {break, continue, return and error}
|
| 400 |
+
# codes
|
| 401 |
+
OptDoOne descriptions state arguments
|
| 402 |
+
# If we are here, no special return code where issued,
|
| 403 |
+
# we'll step to next instruction :
|
| 404 |
+
# puts "new state = \"$state\""
|
| 405 |
+
OptNextDesc descriptions
|
| 406 |
+
set state [OptCurState $descriptions]
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
# Process one step for the state machine,
|
| 411 |
+
# eventually consuming the current argument.
|
| 412 |
+
proc OptDoOne {descriptionsName stateName argumentsName} {
|
| 413 |
+
upvar $argumentsName arguments
|
| 414 |
+
upvar $descriptionsName descriptions
|
| 415 |
+
upvar $stateName state
|
| 416 |
+
|
| 417 |
+
# the special state/instruction "args" eats all
|
| 418 |
+
# the remaining args (if any)
|
| 419 |
+
if {($state == "args")} {
|
| 420 |
+
if {![Lempty $arguments]} {
|
| 421 |
+
# If there is no additional arguments, leave the default value
|
| 422 |
+
# in.
|
| 423 |
+
OptCurSetValue descriptions $arguments
|
| 424 |
+
set arguments {}
|
| 425 |
+
}
|
| 426 |
+
# puts "breaking out ('args' state: consuming every reminding args)"
|
| 427 |
+
return -code break
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
if {[Lempty $arguments]} {
|
| 431 |
+
if {$state == "flags"} {
|
| 432 |
+
# no argument and no flags : we're done
|
| 433 |
+
# puts "returning to previous (sub)prg (no more args)"
|
| 434 |
+
return -code return
|
| 435 |
+
} elseif {$state == "optValue"} {
|
| 436 |
+
set state next; # not used, for debug only
|
| 437 |
+
# go to next state
|
| 438 |
+
return
|
| 439 |
+
} else {
|
| 440 |
+
return -code error [OptMissingValue $descriptions]
|
| 441 |
+
}
|
| 442 |
+
} else {
|
| 443 |
+
set arg [OptCurrentArg $arguments]
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
switch $state {
|
| 447 |
+
flags {
|
| 448 |
+
# A non-dash argument terminates the options, as does --
|
| 449 |
+
|
| 450 |
+
# Still a flag ?
|
| 451 |
+
if {![OptIsFlag $arg]} {
|
| 452 |
+
# don't consume the argument, return to previous prg
|
| 453 |
+
return -code return
|
| 454 |
+
}
|
| 455 |
+
# consume the flag
|
| 456 |
+
OptNextArg arguments
|
| 457 |
+
if {[string equal "--" $arg]} {
|
| 458 |
+
# return from 'flags' state
|
| 459 |
+
return -code return
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
set hits [OptHits descriptions $arg]
|
| 463 |
+
if {$hits > 1} {
|
| 464 |
+
return -code error [OptAmbigous $descriptions $arg]
|
| 465 |
+
} elseif {$hits == 0} {
|
| 466 |
+
return -code error [OptFlagUsage $descriptions $arg]
|
| 467 |
+
}
|
| 468 |
+
set item [OptCurDesc $descriptions]
|
| 469 |
+
if {[OptNeedValue $item]} {
|
| 470 |
+
# we need a value, next state is
|
| 471 |
+
set state flagValue
|
| 472 |
+
} else {
|
| 473 |
+
OptCurSetValue descriptions 1
|
| 474 |
+
}
|
| 475 |
+
# continue
|
| 476 |
+
return -code continue
|
| 477 |
+
}
|
| 478 |
+
flagValue -
|
| 479 |
+
value {
|
| 480 |
+
set item [OptCurDesc $descriptions]
|
| 481 |
+
# Test the values against their required type
|
| 482 |
+
if {[catch {OptCheckType $arg\
|
| 483 |
+
[OptType $item] [OptTypeArgs $item]} val]} {
|
| 484 |
+
return -code error [OptBadValue $item $arg $val]
|
| 485 |
+
}
|
| 486 |
+
# consume the value
|
| 487 |
+
OptNextArg arguments
|
| 488 |
+
# set the value
|
| 489 |
+
OptCurSetValue descriptions $val
|
| 490 |
+
# go to next state
|
| 491 |
+
if {$state == "flagValue"} {
|
| 492 |
+
set state flags
|
| 493 |
+
return -code continue
|
| 494 |
+
} else {
|
| 495 |
+
set state next; # not used, for debug only
|
| 496 |
+
return ; # will go on next step
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
optValue {
|
| 500 |
+
set item [OptCurDesc $descriptions]
|
| 501 |
+
# Test the values against their required type
|
| 502 |
+
if {![catch {OptCheckType $arg\
|
| 503 |
+
[OptType $item] [OptTypeArgs $item]} val]} {
|
| 504 |
+
# right type, so :
|
| 505 |
+
# consume the value
|
| 506 |
+
OptNextArg arguments
|
| 507 |
+
# set the value
|
| 508 |
+
OptCurSetValue descriptions $val
|
| 509 |
+
}
|
| 510 |
+
# go to next state
|
| 511 |
+
set state next; # not used, for debug only
|
| 512 |
+
return ; # will go on next step
|
| 513 |
+
}
|
| 514 |
+
}
|
| 515 |
+
# If we reach this point: an unknown
|
| 516 |
+
# state as been entered !
|
| 517 |
+
return -code error "Bug! unknown state in DoOne \"$state\"\
|
| 518 |
+
(prg counter [OptGetPrgCounter $descriptions]:\
|
| 519 |
+
[OptCurDesc $descriptions])"
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
# Parse the options given the key to previously registered description
|
| 523 |
+
# and arguments list
|
| 524 |
+
proc ::tcl::OptKeyParse {descKey arglist} {
|
| 525 |
+
|
| 526 |
+
set desc [OptKeyGetDesc $descKey]
|
| 527 |
+
|
| 528 |
+
# make sure -help always give usage
|
| 529 |
+
if {[string equal -nocase "-help" $arglist]} {
|
| 530 |
+
return -code error [OptError "Usage information:" $desc 1]
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
OptDoAll desc arglist
|
| 534 |
+
|
| 535 |
+
if {![Lempty $arglist]} {
|
| 536 |
+
return -code error [OptTooManyArgs $desc $arglist]
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
# Analyse the result
|
| 540 |
+
# Walk through the tree:
|
| 541 |
+
OptTreeVars $desc "#[expr {[info level]-1}]"
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
# determine string length for nice tabulated output
|
| 545 |
+
proc OptTreeVars {desc level {vnamesLst {}}} {
|
| 546 |
+
foreach item $desc {
|
| 547 |
+
if {[OptIsCounter $item]} continue
|
| 548 |
+
if {[OptIsPrg $item]} {
|
| 549 |
+
set vnamesLst [OptTreeVars $item $level $vnamesLst]
|
| 550 |
+
} else {
|
| 551 |
+
set vname [OptVarName $item]
|
| 552 |
+
upvar $level $vname var
|
| 553 |
+
if {[OptHasBeenSet $item]} {
|
| 554 |
+
# puts "adding $vname"
|
| 555 |
+
# lets use the input name for the returned list
|
| 556 |
+
# it is more useful, for instance you can check that
|
| 557 |
+
# no flags at all was given with expr
|
| 558 |
+
# {![string match "*-*" $Args]}
|
| 559 |
+
lappend vnamesLst [OptName $item]
|
| 560 |
+
set var [OptValue $item]
|
| 561 |
+
} else {
|
| 562 |
+
set var [OptDefaultValue $item]
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
}
|
| 566 |
+
return $vnamesLst
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
|
| 570 |
+
# Check the type of a value
|
| 571 |
+
# and emit an error if arg is not of the correct type
|
| 572 |
+
# otherwise returns the canonical value of that arg (ie 0/1 for booleans)
|
| 573 |
+
proc ::tcl::OptCheckType {arg type {typeArgs ""}} {
|
| 574 |
+
# puts "checking '$arg' against '$type' ($typeArgs)"
|
| 575 |
+
|
| 576 |
+
# only types "any", "choice", and numbers can have leading "-"
|
| 577 |
+
|
| 578 |
+
switch -exact -- $type {
|
| 579 |
+
int {
|
| 580 |
+
if {![string is integer -strict $arg]} {
|
| 581 |
+
error "not an integer"
|
| 582 |
+
}
|
| 583 |
+
return $arg
|
| 584 |
+
}
|
| 585 |
+
float {
|
| 586 |
+
return [expr {double($arg)}]
|
| 587 |
+
}
|
| 588 |
+
script -
|
| 589 |
+
list {
|
| 590 |
+
# if llength fail : malformed list
|
| 591 |
+
if {[llength $arg]==0 && [OptIsFlag $arg]} {
|
| 592 |
+
error "no values with leading -"
|
| 593 |
+
}
|
| 594 |
+
return $arg
|
| 595 |
+
}
|
| 596 |
+
boolean {
|
| 597 |
+
if {![string is boolean -strict $arg]} {
|
| 598 |
+
error "non canonic boolean"
|
| 599 |
+
}
|
| 600 |
+
# convert true/false because expr/if is broken with "!,...
|
| 601 |
+
return [expr {$arg ? 1 : 0}]
|
| 602 |
+
}
|
| 603 |
+
choice {
|
| 604 |
+
if {$arg ni $typeArgs} {
|
| 605 |
+
error "invalid choice"
|
| 606 |
+
}
|
| 607 |
+
return $arg
|
| 608 |
+
}
|
| 609 |
+
any {
|
| 610 |
+
return $arg
|
| 611 |
+
}
|
| 612 |
+
string -
|
| 613 |
+
default {
|
| 614 |
+
if {[OptIsFlag $arg]} {
|
| 615 |
+
error "no values with leading -"
|
| 616 |
+
}
|
| 617 |
+
return $arg
|
| 618 |
+
}
|
| 619 |
+
}
|
| 620 |
+
return neverReached
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
# internal utilities
|
| 624 |
+
|
| 625 |
+
# returns the number of flags matching the given arg
|
| 626 |
+
# sets the (local) prg counter to the list of matches
|
| 627 |
+
proc OptHits {descName arg} {
|
| 628 |
+
upvar $descName desc
|
| 629 |
+
set hits 0
|
| 630 |
+
set hitems {}
|
| 631 |
+
set i 1
|
| 632 |
+
|
| 633 |
+
set larg [string tolower $arg]
|
| 634 |
+
set len [string length $larg]
|
| 635 |
+
set last [expr {$len-1}]
|
| 636 |
+
|
| 637 |
+
foreach item [lrange $desc 1 end] {
|
| 638 |
+
set flag [OptName $item]
|
| 639 |
+
# lets try to match case insensitively
|
| 640 |
+
# (string length ought to be cheap)
|
| 641 |
+
set lflag [string tolower $flag]
|
| 642 |
+
if {$len == [string length $lflag]} {
|
| 643 |
+
if {[string equal $larg $lflag]} {
|
| 644 |
+
# Exact match case
|
| 645 |
+
OptSetPrgCounter desc $i
|
| 646 |
+
return 1
|
| 647 |
+
}
|
| 648 |
+
} elseif {[string equal $larg [string range $lflag 0 $last]]} {
|
| 649 |
+
lappend hitems $i
|
| 650 |
+
incr hits
|
| 651 |
+
}
|
| 652 |
+
incr i
|
| 653 |
+
}
|
| 654 |
+
if {$hits} {
|
| 655 |
+
OptSetPrgCounter desc $hitems
|
| 656 |
+
}
|
| 657 |
+
return $hits
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
# Extract fields from the list structure:
|
| 661 |
+
|
| 662 |
+
proc OptName {item} {
|
| 663 |
+
lindex $item 1
|
| 664 |
+
}
|
| 665 |
+
proc OptHasBeenSet {item} {
|
| 666 |
+
Lget $item {2 0}
|
| 667 |
+
}
|
| 668 |
+
proc OptValue {item} {
|
| 669 |
+
Lget $item {2 1}
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
proc OptIsFlag {name} {
|
| 673 |
+
string match "-*" $name
|
| 674 |
+
}
|
| 675 |
+
proc OptIsOpt {name} {
|
| 676 |
+
string match {\?*} $name
|
| 677 |
+
}
|
| 678 |
+
proc OptVarName {item} {
|
| 679 |
+
set name [OptName $item]
|
| 680 |
+
if {[OptIsFlag $name]} {
|
| 681 |
+
return [string range $name 1 end]
|
| 682 |
+
} elseif {[OptIsOpt $name]} {
|
| 683 |
+
return [string trim $name "?"]
|
| 684 |
+
} else {
|
| 685 |
+
return $name
|
| 686 |
+
}
|
| 687 |
+
}
|
| 688 |
+
proc OptType {item} {
|
| 689 |
+
lindex $item 3
|
| 690 |
+
}
|
| 691 |
+
proc OptTypeArgs {item} {
|
| 692 |
+
lindex $item 4
|
| 693 |
+
}
|
| 694 |
+
proc OptHelp {item} {
|
| 695 |
+
lindex $item 5
|
| 696 |
+
}
|
| 697 |
+
proc OptNeedValue {item} {
|
| 698 |
+
expr {![string equal [OptType $item] boolflag]}
|
| 699 |
+
}
|
| 700 |
+
proc OptDefaultValue {item} {
|
| 701 |
+
set val [OptTypeArgs $item]
|
| 702 |
+
switch -exact -- [OptType $item] {
|
| 703 |
+
choice {return [lindex $val 0]}
|
| 704 |
+
boolean -
|
| 705 |
+
boolflag {
|
| 706 |
+
# convert back false/true to 0/1 because expr !$bool
|
| 707 |
+
# is broken..
|
| 708 |
+
if {$val} {
|
| 709 |
+
return 1
|
| 710 |
+
} else {
|
| 711 |
+
return 0
|
| 712 |
+
}
|
| 713 |
+
}
|
| 714 |
+
}
|
| 715 |
+
return $val
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
# Description format error helper
|
| 719 |
+
proc OptOptUsage {item {what ""}} {
|
| 720 |
+
return -code error "invalid description format$what: $item\n\
|
| 721 |
+
should be a list of {varname|-flagname ?-type? ?defaultvalue?\
|
| 722 |
+
?helpstring?}"
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
|
| 726 |
+
# Generate a canonical form single instruction
|
| 727 |
+
proc OptNewInst {state varname type typeArgs help} {
|
| 728 |
+
list $state $varname [list 0 {}] $type $typeArgs $help
|
| 729 |
+
# ^ ^
|
| 730 |
+
# | |
|
| 731 |
+
# hasBeenSet=+ +=currentValue
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
# Translate one item to canonical form
|
| 735 |
+
proc OptNormalizeOne {item} {
|
| 736 |
+
set lg [Lassign $item varname arg1 arg2 arg3]
|
| 737 |
+
# puts "called optnormalizeone '$item' v=($varname), lg=$lg"
|
| 738 |
+
set isflag [OptIsFlag $varname]
|
| 739 |
+
set isopt [OptIsOpt $varname]
|
| 740 |
+
if {$isflag} {
|
| 741 |
+
set state "flags"
|
| 742 |
+
} elseif {$isopt} {
|
| 743 |
+
set state "optValue"
|
| 744 |
+
} elseif {![string equal $varname "args"]} {
|
| 745 |
+
set state "value"
|
| 746 |
+
} else {
|
| 747 |
+
set state "args"
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
# apply 'smart' 'fuzzy' logic to try to make
|
| 751 |
+
# description writer's life easy, and our's difficult :
|
| 752 |
+
# let's guess the missing arguments :-)
|
| 753 |
+
|
| 754 |
+
switch $lg {
|
| 755 |
+
1 {
|
| 756 |
+
if {$isflag} {
|
| 757 |
+
return [OptNewInst $state $varname boolflag false ""]
|
| 758 |
+
} else {
|
| 759 |
+
return [OptNewInst $state $varname any "" ""]
|
| 760 |
+
}
|
| 761 |
+
}
|
| 762 |
+
2 {
|
| 763 |
+
# varname default
|
| 764 |
+
# varname help
|
| 765 |
+
set type [OptGuessType $arg1]
|
| 766 |
+
if {[string equal $type "string"]} {
|
| 767 |
+
if {$isflag} {
|
| 768 |
+
set type boolflag
|
| 769 |
+
set def false
|
| 770 |
+
} else {
|
| 771 |
+
set type any
|
| 772 |
+
set def ""
|
| 773 |
+
}
|
| 774 |
+
set help $arg1
|
| 775 |
+
} else {
|
| 776 |
+
set help ""
|
| 777 |
+
set def $arg1
|
| 778 |
+
}
|
| 779 |
+
return [OptNewInst $state $varname $type $def $help]
|
| 780 |
+
}
|
| 781 |
+
3 {
|
| 782 |
+
# varname type value
|
| 783 |
+
# varname value comment
|
| 784 |
+
|
| 785 |
+
if {[regexp {^-(.+)$} $arg1 x type]} {
|
| 786 |
+
# flags/optValue as they are optional, need a "value",
|
| 787 |
+
# on the contrary, for a variable (non optional),
|
| 788 |
+
# default value is pointless, 'cept for choices :
|
| 789 |
+
if {$isflag || $isopt || ($type == "choice")} {
|
| 790 |
+
return [OptNewInst $state $varname $type $arg2 ""]
|
| 791 |
+
} else {
|
| 792 |
+
return [OptNewInst $state $varname $type "" $arg2]
|
| 793 |
+
}
|
| 794 |
+
} else {
|
| 795 |
+
return [OptNewInst $state $varname\
|
| 796 |
+
[OptGuessType $arg1] $arg1 $arg2]
|
| 797 |
+
}
|
| 798 |
+
}
|
| 799 |
+
4 {
|
| 800 |
+
if {[regexp {^-(.+)$} $arg1 x type]} {
|
| 801 |
+
return [OptNewInst $state $varname $type $arg2 $arg3]
|
| 802 |
+
} else {
|
| 803 |
+
return -code error [OptOptUsage $item]
|
| 804 |
+
}
|
| 805 |
+
}
|
| 806 |
+
default {
|
| 807 |
+
return -code error [OptOptUsage $item]
|
| 808 |
+
}
|
| 809 |
+
}
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
# Auto magic lazy type determination
|
| 813 |
+
proc OptGuessType {arg} {
|
| 814 |
+
if { $arg == "true" || $arg == "false" } {
|
| 815 |
+
return boolean
|
| 816 |
+
}
|
| 817 |
+
if {[string is integer -strict $arg]} {
|
| 818 |
+
return int
|
| 819 |
+
}
|
| 820 |
+
if {[string is double -strict $arg]} {
|
| 821 |
+
return float
|
| 822 |
+
}
|
| 823 |
+
return string
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
# Error messages front ends
|
| 827 |
+
|
| 828 |
+
proc OptAmbigous {desc arg} {
|
| 829 |
+
OptError "ambigous option \"$arg\", choose from:" [OptSelection $desc]
|
| 830 |
+
}
|
| 831 |
+
proc OptFlagUsage {desc arg} {
|
| 832 |
+
OptError "bad flag \"$arg\", must be one of" $desc
|
| 833 |
+
}
|
| 834 |
+
proc OptTooManyArgs {desc arguments} {
|
| 835 |
+
OptError "too many arguments (unexpected argument(s): $arguments),\
|
| 836 |
+
usage:"\
|
| 837 |
+
$desc 1
|
| 838 |
+
}
|
| 839 |
+
proc OptParamType {item} {
|
| 840 |
+
if {[OptIsFlag $item]} {
|
| 841 |
+
return "flag"
|
| 842 |
+
} else {
|
| 843 |
+
return "parameter"
|
| 844 |
+
}
|
| 845 |
+
}
|
| 846 |
+
proc OptBadValue {item arg {err {}}} {
|
| 847 |
+
# puts "bad val err = \"$err\""
|
| 848 |
+
OptError "bad value \"$arg\" for [OptParamType $item]"\
|
| 849 |
+
[list $item]
|
| 850 |
+
}
|
| 851 |
+
proc OptMissingValue {descriptions} {
|
| 852 |
+
# set item [OptCurDescFinal $descriptions]
|
| 853 |
+
set item [OptCurDesc $descriptions]
|
| 854 |
+
OptError "no value given for [OptParamType $item] \"[OptName $item]\"\
|
| 855 |
+
(use -help for full usage) :"\
|
| 856 |
+
[list $item]
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
proc ::tcl::OptKeyError {prefix descKey {header 0}} {
|
| 860 |
+
OptError $prefix [OptKeyGetDesc $descKey] $header
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
# determine string length for nice tabulated output
|
| 864 |
+
proc OptLengths {desc nlName tlName dlName} {
|
| 865 |
+
upvar $nlName nl
|
| 866 |
+
upvar $tlName tl
|
| 867 |
+
upvar $dlName dl
|
| 868 |
+
foreach item $desc {
|
| 869 |
+
if {[OptIsCounter $item]} continue
|
| 870 |
+
if {[OptIsPrg $item]} {
|
| 871 |
+
OptLengths $item nl tl dl
|
| 872 |
+
} else {
|
| 873 |
+
SetMax nl [string length [OptName $item]]
|
| 874 |
+
SetMax tl [string length [OptType $item]]
|
| 875 |
+
set dv [OptTypeArgs $item]
|
| 876 |
+
if {[OptState $item] != "header"} {
|
| 877 |
+
set dv "($dv)"
|
| 878 |
+
}
|
| 879 |
+
set l [string length $dv]
|
| 880 |
+
# limit the space allocated to potentially big "choices"
|
| 881 |
+
if {([OptType $item] != "choice") || ($l<=12)} {
|
| 882 |
+
SetMax dl $l
|
| 883 |
+
} else {
|
| 884 |
+
if {![info exists dl]} {
|
| 885 |
+
set dl 0
|
| 886 |
+
}
|
| 887 |
+
}
|
| 888 |
+
}
|
| 889 |
+
}
|
| 890 |
+
}
|
| 891 |
+
# output the tree
|
| 892 |
+
proc OptTree {desc nl tl dl} {
|
| 893 |
+
set res ""
|
| 894 |
+
foreach item $desc {
|
| 895 |
+
if {[OptIsCounter $item]} continue
|
| 896 |
+
if {[OptIsPrg $item]} {
|
| 897 |
+
append res [OptTree $item $nl $tl $dl]
|
| 898 |
+
} else {
|
| 899 |
+
set dv [OptTypeArgs $item]
|
| 900 |
+
if {[OptState $item] != "header"} {
|
| 901 |
+
set dv "($dv)"
|
| 902 |
+
}
|
| 903 |
+
append res [string trimright [format "\n %-*s %-*s %-*s %s" \
|
| 904 |
+
$nl [OptName $item] $tl [OptType $item] \
|
| 905 |
+
$dl $dv [OptHelp $item]]]
|
| 906 |
+
}
|
| 907 |
+
}
|
| 908 |
+
return $res
|
| 909 |
+
}
|
| 910 |
+
|
| 911 |
+
# Give nice usage string
|
| 912 |
+
proc ::tcl::OptError {prefix desc {header 0}} {
|
| 913 |
+
# determine length
|
| 914 |
+
if {$header} {
|
| 915 |
+
# add faked instruction
|
| 916 |
+
set h [list [OptNewInst header Var/FlagName Type Value Help]]
|
| 917 |
+
lappend h [OptNewInst header ------------ ---- ----- ----]
|
| 918 |
+
lappend h [OptNewInst header {(-help} "" "" {gives this help)}]
|
| 919 |
+
set desc [concat $h $desc]
|
| 920 |
+
}
|
| 921 |
+
OptLengths $desc nl tl dl
|
| 922 |
+
# actually output
|
| 923 |
+
return "$prefix[OptTree $desc $nl $tl $dl]"
|
| 924 |
+
}
|
| 925 |
+
|
| 926 |
+
|
| 927 |
+
################ General Utility functions #######################
|
| 928 |
+
|
| 929 |
+
#
|
| 930 |
+
# List utility functions
|
| 931 |
+
# Naming convention:
|
| 932 |
+
# "Lvarxxx" take the list VARiable name as argument
|
| 933 |
+
# "Lxxxx" take the list value as argument
|
| 934 |
+
# (which is not costly with Tcl8 objects system
|
| 935 |
+
# as it's still a reference and not a copy of the values)
|
| 936 |
+
#
|
| 937 |
+
|
| 938 |
+
# Is that list empty ?
|
| 939 |
+
proc ::tcl::Lempty {list} {
|
| 940 |
+
expr {[llength $list]==0}
|
| 941 |
+
}
|
| 942 |
+
|
| 943 |
+
# Gets the value of one leaf of a lists tree
|
| 944 |
+
proc ::tcl::Lget {list indexLst} {
|
| 945 |
+
if {[llength $indexLst] <= 1} {
|
| 946 |
+
return [lindex $list $indexLst]
|
| 947 |
+
}
|
| 948 |
+
Lget [lindex $list [lindex $indexLst 0]] [lrange $indexLst 1 end]
|
| 949 |
+
}
|
| 950 |
+
# Sets the value of one leaf of a lists tree
|
| 951 |
+
# (we use the version that does not create the elements because
|
| 952 |
+
# it would be even slower... needs to be written in C !)
|
| 953 |
+
# (nb: there is a non trivial recursive problem with indexes 0,
|
| 954 |
+
# which appear because there is no difference between a list
|
| 955 |
+
# of 1 element and 1 element alone : [list "a"] == "a" while
|
| 956 |
+
# it should be {a} and [listp a] should be 0 while [listp {a b}] would be 1
|
| 957 |
+
# and [listp "a b"] maybe 0. listp does not exist either...)
|
| 958 |
+
proc ::tcl::Lvarset {listName indexLst newValue} {
|
| 959 |
+
upvar $listName list
|
| 960 |
+
if {[llength $indexLst] <= 1} {
|
| 961 |
+
Lvarset1nc list $indexLst $newValue
|
| 962 |
+
} else {
|
| 963 |
+
set idx [lindex $indexLst 0]
|
| 964 |
+
set targetList [lindex $list $idx]
|
| 965 |
+
# reduce refcount on targetList (not really usefull now,
|
| 966 |
+
# could be with optimizing compiler)
|
| 967 |
+
# Lvarset1 list $idx {}
|
| 968 |
+
# recursively replace in targetList
|
| 969 |
+
Lvarset targetList [lrange $indexLst 1 end] $newValue
|
| 970 |
+
# put updated sub list back in the tree
|
| 971 |
+
Lvarset1nc list $idx $targetList
|
| 972 |
+
}
|
| 973 |
+
}
|
| 974 |
+
# Set one cell to a value, eventually create all the needed elements
|
| 975 |
+
# (on level-1 of lists)
|
| 976 |
+
variable emptyList {}
|
| 977 |
+
proc ::tcl::Lvarset1 {listName index newValue} {
|
| 978 |
+
upvar $listName list
|
| 979 |
+
if {$index < 0} {return -code error "invalid negative index"}
|
| 980 |
+
set lg [llength $list]
|
| 981 |
+
if {$index >= $lg} {
|
| 982 |
+
variable emptyList
|
| 983 |
+
for {set i $lg} {$i<$index} {incr i} {
|
| 984 |
+
lappend list $emptyList
|
| 985 |
+
}
|
| 986 |
+
lappend list $newValue
|
| 987 |
+
} else {
|
| 988 |
+
set list [lreplace $list $index $index $newValue]
|
| 989 |
+
}
|
| 990 |
+
}
|
| 991 |
+
# same as Lvarset1 but no bound checking / creation
|
| 992 |
+
proc ::tcl::Lvarset1nc {listName index newValue} {
|
| 993 |
+
upvar $listName list
|
| 994 |
+
set list [lreplace $list $index $index $newValue]
|
| 995 |
+
}
|
| 996 |
+
# Increments the value of one leaf of a lists tree
|
| 997 |
+
# (which must exists)
|
| 998 |
+
proc ::tcl::Lvarincr {listName indexLst {howMuch 1}} {
|
| 999 |
+
upvar $listName list
|
| 1000 |
+
if {[llength $indexLst] <= 1} {
|
| 1001 |
+
Lvarincr1 list $indexLst $howMuch
|
| 1002 |
+
} else {
|
| 1003 |
+
set idx [lindex $indexLst 0]
|
| 1004 |
+
set targetList [lindex $list $idx]
|
| 1005 |
+
# reduce refcount on targetList
|
| 1006 |
+
Lvarset1nc list $idx {}
|
| 1007 |
+
# recursively replace in targetList
|
| 1008 |
+
Lvarincr targetList [lrange $indexLst 1 end] $howMuch
|
| 1009 |
+
# put updated sub list back in the tree
|
| 1010 |
+
Lvarset1nc list $idx $targetList
|
| 1011 |
+
}
|
| 1012 |
+
}
|
| 1013 |
+
# Increments the value of one cell of a list
|
| 1014 |
+
proc ::tcl::Lvarincr1 {listName index {howMuch 1}} {
|
| 1015 |
+
upvar $listName list
|
| 1016 |
+
set newValue [expr {[lindex $list $index]+$howMuch}]
|
| 1017 |
+
set list [lreplace $list $index $index $newValue]
|
| 1018 |
+
return $newValue
|
| 1019 |
+
}
|
| 1020 |
+
# Removes the first element of a list
|
| 1021 |
+
# and returns the new list value
|
| 1022 |
+
proc ::tcl::Lvarpop1 {listName} {
|
| 1023 |
+
upvar $listName list
|
| 1024 |
+
set list [lrange $list 1 end]
|
| 1025 |
+
}
|
| 1026 |
+
# Same but returns the removed element
|
| 1027 |
+
# (Like the tclX version)
|
| 1028 |
+
proc ::tcl::Lvarpop {listName} {
|
| 1029 |
+
upvar $listName list
|
| 1030 |
+
set el [lindex $list 0]
|
| 1031 |
+
set list [lrange $list 1 end]
|
| 1032 |
+
return $el
|
| 1033 |
+
}
|
| 1034 |
+
# Assign list elements to variables and return the length of the list
|
| 1035 |
+
proc ::tcl::Lassign {list args} {
|
| 1036 |
+
# faster than direct blown foreach (which does not byte compile)
|
| 1037 |
+
set i 0
|
| 1038 |
+
set lg [llength $list]
|
| 1039 |
+
foreach vname $args {
|
| 1040 |
+
if {$i>=$lg} break
|
| 1041 |
+
uplevel 1 [list ::set $vname [lindex $list $i]]
|
| 1042 |
+
incr i
|
| 1043 |
+
}
|
| 1044 |
+
return $lg
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
# Misc utilities
|
| 1048 |
+
|
| 1049 |
+
# Set the varname to value if value is greater than varname's current value
|
| 1050 |
+
# or if varname is undefined
|
| 1051 |
+
proc ::tcl::SetMax {varname value} {
|
| 1052 |
+
upvar 1 $varname var
|
| 1053 |
+
if {![info exists var] || $value > $var} {
|
| 1054 |
+
set var $value
|
| 1055 |
+
}
|
| 1056 |
+
}
|
| 1057 |
+
|
| 1058 |
+
# Set the varname to value if value is smaller than varname's current value
|
| 1059 |
+
# or if varname is undefined
|
| 1060 |
+
proc ::tcl::SetMin {varname value} {
|
| 1061 |
+
upvar 1 $varname var
|
| 1062 |
+
if {![info exists var] || $value < $var} {
|
| 1063 |
+
set var $value
|
| 1064 |
+
}
|
| 1065 |
+
}
|
| 1066 |
+
|
| 1067 |
+
|
| 1068 |
+
# everything loaded fine, lets create the test proc:
|
| 1069 |
+
# OptCreateTestProc
|
| 1070 |
+
# Don't need the create temp proc anymore:
|
| 1071 |
+
# rename OptCreateTestProc {}
|
| 1072 |
+
}
|
miniconda3/envs/active_proaction/lib/tcl8.6/opt0.4/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tcl package index file, version 1.1
|
| 2 |
+
# This file is generated by the "pkg_mkIndex -direct" command
|
| 3 |
+
# and sourced either when an application starts up or
|
| 4 |
+
# by a "package unknown" script. It invokes the
|
| 5 |
+
# "package ifneeded" command to set up package-related
|
| 6 |
+
# information so that packages will be loaded automatically
|
| 7 |
+
# in response to "package require" commands. When this
|
| 8 |
+
# script is sourced, the variable $dir must contain the
|
| 9 |
+
# full path name of this file's directory.
|
| 10 |
+
|
| 11 |
+
if {![package vsatisfies [package provide Tcl] 8.5-]} {return}
|
| 12 |
+
package ifneeded opt 0.4.9 [list source -encoding utf-8 [file join $dir optparse.tcl]]
|
miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbc1.1.9.so
ADDED
|
Binary file (24.3 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbcstub1.1.9.a
ADDED
|
Binary file (3.04 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/tdbc1.1.9/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- tcl -*-
|
| 2 |
+
# Tcl package index file, version 1.1
|
| 3 |
+
#
|
| 4 |
+
# Make sure that TDBC is running in a compatible version of Tcl, and
|
| 5 |
+
# that TclOO is available.
|
| 6 |
+
|
| 7 |
+
if {![package vsatisfies [package provide Tcl] 8.6-]} {
|
| 8 |
+
return
|
| 9 |
+
}
|
| 10 |
+
apply {{dir} {
|
| 11 |
+
set libraryfile [file join $dir tdbc.tcl]
|
| 12 |
+
if {![file exists $libraryfile] && [info exists ::env(TDBC_LIBRARY)]} {
|
| 13 |
+
set libraryfile [file join $::env(TDBC_LIBRARY) tdbc.tcl]
|
| 14 |
+
}
|
| 15 |
+
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| 16 |
+
package ifneeded tdbc 1.1.9 \
|
| 17 |
+
"package require TclOO;\
|
| 18 |
+
[list load [file join $dir libtcl9tdbc1.1.9.so] [string totitle tdbc]]\;\
|
| 19 |
+
[list source -encoding utf-8 $libraryfile]"
|
| 20 |
+
} else {
|
| 21 |
+
package ifneeded tdbc 1.1.9 \
|
| 22 |
+
"package require TclOO;\
|
| 23 |
+
[list load [file join $dir libtdbc1.1.9.so] [string totitle tdbc]]\;\
|
| 24 |
+
[list source -encoding utf-8 $libraryfile]"
|
| 25 |
+
}
|
| 26 |
+
}} $dir
|
miniconda3/envs/active_proaction/lib/tdbc1.1.9/tdbc.tcl
ADDED
|
@@ -0,0 +1,922 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
| 1 |
+
# tdbc.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Definitions of base classes from which TDBC drivers' connections,
|
| 4 |
+
# statements and result sets may inherit.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2008 by Kevin B. Kenny
|
| 7 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 8 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 9 |
+
#
|
| 10 |
+
# RCS: @(#) $Id$
|
| 11 |
+
#
|
| 12 |
+
#------------------------------------------------------------------------------
|
| 13 |
+
|
| 14 |
+
package require TclOO
|
| 15 |
+
|
| 16 |
+
namespace eval ::tdbc {
|
| 17 |
+
namespace export connection statement resultset
|
| 18 |
+
variable generalError [list TDBC GENERAL_ERROR HY000 {}]
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
#------------------------------------------------------------------------------
|
| 22 |
+
#
|
| 23 |
+
# tdbc::ParseConvenienceArgs --
|
| 24 |
+
#
|
| 25 |
+
# Parse the convenience arguments to a TDBC 'execute',
|
| 26 |
+
# 'executewithdictionary', or 'foreach' call.
|
| 27 |
+
#
|
| 28 |
+
# Parameters:
|
| 29 |
+
# argv - Arguments to the call
|
| 30 |
+
# optsVar -- Name of a variable in caller's scope that will receive
|
| 31 |
+
# a dictionary of the supplied options
|
| 32 |
+
#
|
| 33 |
+
# Results:
|
| 34 |
+
# Returns any args remaining after parsing the options.
|
| 35 |
+
#
|
| 36 |
+
# Side effects:
|
| 37 |
+
# Sets the 'opts' dictionary to the options.
|
| 38 |
+
#
|
| 39 |
+
#------------------------------------------------------------------------------
|
| 40 |
+
|
| 41 |
+
proc tdbc::ParseConvenienceArgs {argv optsVar} {
|
| 42 |
+
|
| 43 |
+
variable generalError
|
| 44 |
+
upvar 1 $optsVar opts
|
| 45 |
+
|
| 46 |
+
set opts [dict create -as dicts]
|
| 47 |
+
set i 0
|
| 48 |
+
|
| 49 |
+
# Munch keyword options off the front of the command arguments
|
| 50 |
+
|
| 51 |
+
foreach {key value} $argv {
|
| 52 |
+
if {[string index $key 0] eq {-}} {
|
| 53 |
+
switch -regexp -- $key {
|
| 54 |
+
-as? {
|
| 55 |
+
if {$value ne {dicts} && $value ne {lists}} {
|
| 56 |
+
set errorcode $generalError
|
| 57 |
+
lappend errorcode badVarType $value
|
| 58 |
+
return -code error \
|
| 59 |
+
-errorcode $errorcode \
|
| 60 |
+
"bad variable type \"$value\":\
|
| 61 |
+
must be lists or dicts"
|
| 62 |
+
}
|
| 63 |
+
dict set opts -as $value
|
| 64 |
+
}
|
| 65 |
+
-c(?:o(?:l(?:u(?:m(?:n(?:s(?:v(?:a(?:r(?:i(?:a(?:b(?:le?)?)?)?)?)?)?)?)?)?)?)?)?) {
|
| 66 |
+
dict set opts -columnsvariable $value
|
| 67 |
+
}
|
| 68 |
+
-- {
|
| 69 |
+
incr i
|
| 70 |
+
break
|
| 71 |
+
}
|
| 72 |
+
default {
|
| 73 |
+
set errorcode $generalError
|
| 74 |
+
lappend errorcode badOption $key
|
| 75 |
+
return -code error \
|
| 76 |
+
-errorcode $errorcode \
|
| 77 |
+
"bad option \"$key\":\
|
| 78 |
+
must be -as or -columnsvariable"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
} else {
|
| 82 |
+
break
|
| 83 |
+
}
|
| 84 |
+
incr i 2
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
return [lrange $argv[set argv {}] $i end]
|
| 88 |
+
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#------------------------------------------------------------------------------
|
| 94 |
+
#
|
| 95 |
+
# tdbc::connection --
|
| 96 |
+
#
|
| 97 |
+
# Class that represents a generic connection to a database.
|
| 98 |
+
#
|
| 99 |
+
#-----------------------------------------------------------------------------
|
| 100 |
+
|
| 101 |
+
oo::class create ::tdbc::connection {
|
| 102 |
+
|
| 103 |
+
# statementSeq is the sequence number of the last statement created.
|
| 104 |
+
# statementClass is the name of the class that implements the
|
| 105 |
+
# 'statement' API.
|
| 106 |
+
# primaryKeysStatement is the statement that queries primary keys
|
| 107 |
+
# foreignKeysStatement is the statement that queries foreign keys
|
| 108 |
+
|
| 109 |
+
variable statementSeq primaryKeysStatement foreignKeysStatement
|
| 110 |
+
|
| 111 |
+
# The base class constructor accepts no arguments. It sets up the
|
| 112 |
+
# machinery to do the bookkeeping to keep track of what statements
|
| 113 |
+
# are associated with the connection. The derived class constructor
|
| 114 |
+
# is expected to set the variable, 'statementClass' to the name
|
| 115 |
+
# of the class that represents statements, so that the 'prepare'
|
| 116 |
+
# method can invoke it.
|
| 117 |
+
|
| 118 |
+
constructor {} {
|
| 119 |
+
set statementSeq 0
|
| 120 |
+
namespace eval Stmt {}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
# The 'close' method is simply an alternative syntax for destroying
|
| 124 |
+
# the connection.
|
| 125 |
+
|
| 126 |
+
method close {} {
|
| 127 |
+
my destroy
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
# The 'prepare' method creates a new statement against the connection,
|
| 131 |
+
# giving its constructor the current statement and the SQL code to
|
| 132 |
+
# prepare. It uses the 'statementClass' variable set by the constructor
|
| 133 |
+
# to get the class to instantiate.
|
| 134 |
+
|
| 135 |
+
method prepare {sqlcode} {
|
| 136 |
+
return [my statementCreate Stmt::[incr statementSeq] [self] $sqlcode]
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
# The 'statementCreate' method delegates to the constructor
|
| 140 |
+
# of the class specified by the 'statementClass' variable. It's
|
| 141 |
+
# intended for drivers designed before tdbc 1.0b10. Current ones
|
| 142 |
+
# should forward this method to the constructor directly.
|
| 143 |
+
|
| 144 |
+
method statementCreate {name instance sqlcode} {
|
| 145 |
+
my variable statementClass
|
| 146 |
+
return [$statementClass create $name $instance $sqlcode]
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
# Derived classes are expected to implement the 'prepareCall' method,
|
| 150 |
+
# and have it call 'prepare' as needed (or do something else and
|
| 151 |
+
# install the resulting statement)
|
| 152 |
+
|
| 153 |
+
# The 'statements' method lists the statements active against this
|
| 154 |
+
# connection.
|
| 155 |
+
|
| 156 |
+
method statements {} {
|
| 157 |
+
info commands Stmt::*
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
# The 'resultsets' method lists the result sets active against this
|
| 161 |
+
# connection.
|
| 162 |
+
|
| 163 |
+
method resultsets {} {
|
| 164 |
+
set retval {}
|
| 165 |
+
foreach statement [my statements] {
|
| 166 |
+
foreach resultset [$statement resultsets] {
|
| 167 |
+
lappend retval $resultset
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
return $retval
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
# The 'transaction' method executes a block of Tcl code as an
|
| 174 |
+
# ACID transaction against the database.
|
| 175 |
+
|
| 176 |
+
method transaction {script} {
|
| 177 |
+
my begintransaction
|
| 178 |
+
set status [catch {uplevel 1 $script} result options]
|
| 179 |
+
if {$status in {0 2 3 4}} {
|
| 180 |
+
set status2 [catch {my commit} result2 options2]
|
| 181 |
+
if {$status2 == 1} {
|
| 182 |
+
set status 1
|
| 183 |
+
set result $result2
|
| 184 |
+
set options $options2
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
switch -exact -- $status {
|
| 188 |
+
0 {
|
| 189 |
+
# do nothing
|
| 190 |
+
}
|
| 191 |
+
2 - 3 - 4 {
|
| 192 |
+
set options [dict merge {-level 1} $options[set options {}]]
|
| 193 |
+
dict incr options -level
|
| 194 |
+
}
|
| 195 |
+
default {
|
| 196 |
+
my rollback
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
return -options $options $result
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
# The 'allrows' method prepares a statement, then executes it with
|
| 203 |
+
# a given set of substituents, returning a list of all the rows
|
| 204 |
+
# that the statement returns. Optionally, it stores the names of
|
| 205 |
+
# the columns in '-columnsvariable'.
|
| 206 |
+
# Usage:
|
| 207 |
+
# $db allrows ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
| 208 |
+
# sql ?dictionary?
|
| 209 |
+
|
| 210 |
+
method allrows args {
|
| 211 |
+
|
| 212 |
+
variable ::tdbc::generalError
|
| 213 |
+
|
| 214 |
+
# Grab keyword-value parameters
|
| 215 |
+
|
| 216 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 217 |
+
|
| 218 |
+
# Check postitional parameters
|
| 219 |
+
|
| 220 |
+
set cmd [list [self] prepare]
|
| 221 |
+
if {[llength $args] == 1} {
|
| 222 |
+
set sqlcode [lindex $args 0]
|
| 223 |
+
} elseif {[llength $args] == 2} {
|
| 224 |
+
lassign $args sqlcode dict
|
| 225 |
+
} else {
|
| 226 |
+
set errorcode $generalError
|
| 227 |
+
lappend errorcode wrongNumArgs
|
| 228 |
+
return -code error -errorcode $errorcode \
|
| 229 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 230 |
+
?-option value?... ?--? sqlcode ?dictionary?"
|
| 231 |
+
}
|
| 232 |
+
lappend cmd $sqlcode
|
| 233 |
+
|
| 234 |
+
# Prepare the statement
|
| 235 |
+
|
| 236 |
+
set stmt [uplevel 1 $cmd]
|
| 237 |
+
|
| 238 |
+
# Delegate to the statement to accumulate the results
|
| 239 |
+
|
| 240 |
+
set cmd [list $stmt allrows {*}$opts --]
|
| 241 |
+
if {[info exists dict]} {
|
| 242 |
+
lappend cmd $dict
|
| 243 |
+
}
|
| 244 |
+
set status [catch {
|
| 245 |
+
uplevel 1 $cmd
|
| 246 |
+
} result options]
|
| 247 |
+
|
| 248 |
+
# Destroy the statement
|
| 249 |
+
|
| 250 |
+
catch {
|
| 251 |
+
$stmt close
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
return -options $options $result
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
# The 'foreach' method prepares a statement, then executes it with
|
| 258 |
+
# a supplied set of substituents. For each row of the result,
|
| 259 |
+
# it sets a variable to the row and invokes a script in the caller's
|
| 260 |
+
# scope.
|
| 261 |
+
#
|
| 262 |
+
# Usage:
|
| 263 |
+
# $db foreach ?-as lists|dicts? ?-columnsVariable varName? ?--?
|
| 264 |
+
# varName sql ?dictionary? script
|
| 265 |
+
|
| 266 |
+
method foreach args {
|
| 267 |
+
|
| 268 |
+
variable ::tdbc::generalError
|
| 269 |
+
|
| 270 |
+
# Grab keyword-value parameters
|
| 271 |
+
|
| 272 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 273 |
+
|
| 274 |
+
# Check postitional parameters
|
| 275 |
+
|
| 276 |
+
set cmd [list [self] prepare]
|
| 277 |
+
if {[llength $args] == 3} {
|
| 278 |
+
lassign $args varname sqlcode script
|
| 279 |
+
} elseif {[llength $args] == 4} {
|
| 280 |
+
lassign $args varname sqlcode dict script
|
| 281 |
+
} else {
|
| 282 |
+
set errorcode $generalError
|
| 283 |
+
lappend errorcode wrongNumArgs
|
| 284 |
+
return -code error -errorcode $errorcode \
|
| 285 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 286 |
+
?-option value?... ?--? varname sqlcode ?dictionary? script"
|
| 287 |
+
}
|
| 288 |
+
lappend cmd $sqlcode
|
| 289 |
+
|
| 290 |
+
# Prepare the statement
|
| 291 |
+
|
| 292 |
+
set stmt [uplevel 1 $cmd]
|
| 293 |
+
|
| 294 |
+
# Delegate to the statement to iterate over the results
|
| 295 |
+
|
| 296 |
+
set cmd [list $stmt foreach {*}$opts -- $varname]
|
| 297 |
+
if {[info exists dict]} {
|
| 298 |
+
lappend cmd $dict
|
| 299 |
+
}
|
| 300 |
+
lappend cmd $script
|
| 301 |
+
set status [catch {
|
| 302 |
+
uplevel 1 $cmd
|
| 303 |
+
} result options]
|
| 304 |
+
|
| 305 |
+
# Destroy the statement
|
| 306 |
+
|
| 307 |
+
catch {
|
| 308 |
+
$stmt close
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
# Adjust return level in the case that the script [return]s
|
| 312 |
+
|
| 313 |
+
if {$status == 2} {
|
| 314 |
+
set options [dict merge {-level 1} $options[set options {}]]
|
| 315 |
+
dict incr options -level
|
| 316 |
+
}
|
| 317 |
+
return -options $options $result
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
# The 'BuildPrimaryKeysStatement' method builds a SQL statement to
|
| 321 |
+
# retrieve the primary keys from a database. (It executes once the
|
| 322 |
+
# first time the 'primaryKeys' method is executed, and retains the
|
| 323 |
+
# prepared statement for reuse.)
|
| 324 |
+
|
| 325 |
+
method BuildPrimaryKeysStatement {} {
|
| 326 |
+
|
| 327 |
+
# On some databases, CONSTRAINT_CATALOG is always NULL and
|
| 328 |
+
# JOINing to it fails. Check for this case and include that
|
| 329 |
+
# JOIN only if catalog names are supplied.
|
| 330 |
+
|
| 331 |
+
set catalogClause {}
|
| 332 |
+
if {[lindex [set count [my allrows -as lists {
|
| 333 |
+
SELECT COUNT(*)
|
| 334 |
+
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
|
| 335 |
+
WHERE CONSTRAINT_CATALOG IS NOT NULL}]] 0 0] != 0} {
|
| 336 |
+
set catalogClause \
|
| 337 |
+
{AND xtable.CONSTRAINT_CATALOG = xcolumn.CONSTRAINT_CATALOG}
|
| 338 |
+
}
|
| 339 |
+
set primaryKeysStatement [my prepare "
|
| 340 |
+
SELECT xtable.TABLE_SCHEMA AS \"tableSchema\",
|
| 341 |
+
xtable.TABLE_NAME AS \"tableName\",
|
| 342 |
+
xtable.CONSTRAINT_CATALOG AS \"constraintCatalog\",
|
| 343 |
+
xtable.CONSTRAINT_SCHEMA AS \"constraintSchema\",
|
| 344 |
+
xtable.CONSTRAINT_NAME AS \"constraintName\",
|
| 345 |
+
xcolumn.COLUMN_NAME AS \"columnName\",
|
| 346 |
+
xcolumn.ORDINAL_POSITION AS \"ordinalPosition\"
|
| 347 |
+
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS xtable
|
| 348 |
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE xcolumn
|
| 349 |
+
ON xtable.CONSTRAINT_SCHEMA = xcolumn.CONSTRAINT_SCHEMA
|
| 350 |
+
AND xtable.TABLE_NAME = xcolumn.TABLE_NAME
|
| 351 |
+
AND xtable.CONSTRAINT_NAME = xcolumn.CONSTRAINT_NAME
|
| 352 |
+
$catalogClause
|
| 353 |
+
WHERE xtable.TABLE_NAME = :tableName
|
| 354 |
+
AND xtable.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
| 355 |
+
"]
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
# The default implementation of the 'primarykeys' method uses the
|
| 359 |
+
# SQL INFORMATION_SCHEMA to retrieve primary key information. Databases
|
| 360 |
+
# that might not have INFORMATION_SCHEMA must overload this method.
|
| 361 |
+
|
| 362 |
+
method primarykeys {tableName} {
|
| 363 |
+
if {![info exists primaryKeysStatement]} {
|
| 364 |
+
my BuildPrimaryKeysStatement
|
| 365 |
+
}
|
| 366 |
+
tailcall $primaryKeysStatement allrows [list tableName $tableName]
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
# The 'BuildForeignKeysStatements' method builds a SQL statement to
|
| 370 |
+
# retrieve the foreign keys from a database. (It executes once the
|
| 371 |
+
# first time the 'foreignKeys' method is executed, and retains the
|
| 372 |
+
# prepared statements for reuse.)
|
| 373 |
+
|
| 374 |
+
method BuildForeignKeysStatement {} {
|
| 375 |
+
|
| 376 |
+
# On some databases, CONSTRAINT_CATALOG is always NULL and
|
| 377 |
+
# JOINing to it fails. Check for this case and include that
|
| 378 |
+
# JOIN only if catalog names are supplied.
|
| 379 |
+
|
| 380 |
+
set catalogClause1 {}
|
| 381 |
+
set catalogClause2 {}
|
| 382 |
+
if {[lindex [set count [my allrows -as lists {
|
| 383 |
+
SELECT COUNT(*)
|
| 384 |
+
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
|
| 385 |
+
WHERE CONSTRAINT_CATALOG IS NOT NULL}]] 0 0] != 0} {
|
| 386 |
+
set catalogClause1 \
|
| 387 |
+
{AND fkc.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG}
|
| 388 |
+
set catalogClause2 \
|
| 389 |
+
{AND pkc.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG}
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
foreach {exists1 clause1} {
|
| 393 |
+
0 {}
|
| 394 |
+
1 { AND pkc.TABLE_NAME = :primary}
|
| 395 |
+
} {
|
| 396 |
+
foreach {exists2 clause2} {
|
| 397 |
+
0 {}
|
| 398 |
+
1 { AND fkc.TABLE_NAME = :foreign}
|
| 399 |
+
} {
|
| 400 |
+
set stmt [my prepare "
|
| 401 |
+
SELECT rc.CONSTRAINT_CATALOG AS \"foreignConstraintCatalog\",
|
| 402 |
+
rc.CONSTRAINT_SCHEMA AS \"foreignConstraintSchema\",
|
| 403 |
+
rc.CONSTRAINT_NAME AS \"foreignConstraintName\",
|
| 404 |
+
rc.UNIQUE_CONSTRAINT_CATALOG
|
| 405 |
+
AS \"primaryConstraintCatalog\",
|
| 406 |
+
rc.UNIQUE_CONSTRAINT_SCHEMA AS \"primaryConstraintSchema\",
|
| 407 |
+
rc.UNIQUE_CONSTRAINT_NAME AS \"primaryConstraintName\",
|
| 408 |
+
rc.UPDATE_RULE AS \"updateAction\",
|
| 409 |
+
rc.DELETE_RULE AS \"deleteAction\",
|
| 410 |
+
pkc.TABLE_CATALOG AS \"primaryCatalog\",
|
| 411 |
+
pkc.TABLE_SCHEMA AS \"primarySchema\",
|
| 412 |
+
pkc.TABLE_NAME AS \"primaryTable\",
|
| 413 |
+
pkc.COLUMN_NAME AS \"primaryColumn\",
|
| 414 |
+
fkc.TABLE_CATALOG AS \"foreignCatalog\",
|
| 415 |
+
fkc.TABLE_SCHEMA AS \"foreignSchema\",
|
| 416 |
+
fkc.TABLE_NAME AS \"foreignTable\",
|
| 417 |
+
fkc.COLUMN_NAME AS \"foreignColumn\",
|
| 418 |
+
pkc.ORDINAL_POSITION AS \"ordinalPosition\"
|
| 419 |
+
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
|
| 420 |
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkc
|
| 421 |
+
ON fkc.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
|
| 422 |
+
AND fkc.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
|
| 423 |
+
$catalogClause1
|
| 424 |
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkc
|
| 425 |
+
ON pkc.CONSTRAINT_NAME = rc.UNIQUE_CONSTRAINT_NAME
|
| 426 |
+
AND pkc.CONSTRAINT_SCHEMA = rc.UNIQUE_CONSTRAINT_SCHEMA
|
| 427 |
+
$catalogClause2
|
| 428 |
+
AND pkc.ORDINAL_POSITION = fkc.ORDINAL_POSITION
|
| 429 |
+
WHERE 1=1
|
| 430 |
+
$clause1
|
| 431 |
+
$clause2
|
| 432 |
+
ORDER BY \"foreignConstraintCatalog\", \"foreignConstraintSchema\", \"foreignConstraintName\", \"ordinalPosition\"
|
| 433 |
+
"]
|
| 434 |
+
dict set foreignKeysStatement $exists1 $exists2 $stmt
|
| 435 |
+
}
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
# The default implementation of the 'foreignkeys' method uses the
|
| 440 |
+
# SQL INFORMATION_SCHEMA to retrieve primary key information. Databases
|
| 441 |
+
# that might not have INFORMATION_SCHEMA must overload this method.
|
| 442 |
+
|
| 443 |
+
method foreignkeys {args} {
|
| 444 |
+
|
| 445 |
+
variable ::tdbc::generalError
|
| 446 |
+
|
| 447 |
+
# Check arguments
|
| 448 |
+
|
| 449 |
+
set argdict {}
|
| 450 |
+
if {[llength $args] % 2 != 0} {
|
| 451 |
+
set errorcode $generalError
|
| 452 |
+
lappend errorcode wrongNumArgs
|
| 453 |
+
return -code error -errorcode $errorcode \
|
| 454 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 455 |
+
?-option value?..."
|
| 456 |
+
}
|
| 457 |
+
foreach {key value} $args {
|
| 458 |
+
if {$key ni {-primary -foreign}} {
|
| 459 |
+
set errorcode $generalError
|
| 460 |
+
lappend errorcode badOption
|
| 461 |
+
return -code error -errorcode $errorcode \
|
| 462 |
+
"bad option \"$key\", must be -primary or -foreign"
|
| 463 |
+
}
|
| 464 |
+
set key [string range $key 1 end]
|
| 465 |
+
if {[dict exists $argdict $key]} {
|
| 466 |
+
set errorcode $generalError
|
| 467 |
+
lappend errorcode dupOption
|
| 468 |
+
return -code error -errorcode $errorcode \
|
| 469 |
+
"duplicate option \"$key\" supplied"
|
| 470 |
+
}
|
| 471 |
+
dict set argdict $key $value
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
# Build the statements that query foreign keys. There are four
|
| 475 |
+
# of them, one for each combination of whether -primary
|
| 476 |
+
# and -foreign is specified.
|
| 477 |
+
|
| 478 |
+
if {![info exists foreignKeysStatement]} {
|
| 479 |
+
my BuildForeignKeysStatement
|
| 480 |
+
}
|
| 481 |
+
set stmt [dict get $foreignKeysStatement \
|
| 482 |
+
[dict exists $argdict primary] \
|
| 483 |
+
[dict exists $argdict foreign]]
|
| 484 |
+
tailcall $stmt allrows $argdict
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
# Derived classes are expected to implement the 'begintransaction',
|
| 488 |
+
# 'commit', and 'rollback' methods.
|
| 489 |
+
|
| 490 |
+
# Derived classes are expected to implement 'tables' and 'columns' method.
|
| 491 |
+
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
#------------------------------------------------------------------------------
|
| 495 |
+
#
|
| 496 |
+
# Class: tdbc::statement
|
| 497 |
+
#
|
| 498 |
+
# Class that represents a SQL statement in a generic database
|
| 499 |
+
#
|
| 500 |
+
#------------------------------------------------------------------------------
|
| 501 |
+
|
| 502 |
+
oo::class create tdbc::statement {
|
| 503 |
+
|
| 504 |
+
# resultSetSeq is the sequence number of the last result set created.
|
| 505 |
+
# resultSetClass is the name of the class that implements the 'resultset'
|
| 506 |
+
# API.
|
| 507 |
+
|
| 508 |
+
variable resultSetClass resultSetSeq
|
| 509 |
+
|
| 510 |
+
# The base class constructor accepts no arguments. It initializes
|
| 511 |
+
# the machinery for tracking the ownership of result sets. The derived
|
| 512 |
+
# constructor is expected to invoke the base constructor, and to
|
| 513 |
+
# set a variable 'resultSetClass' to the fully-qualified name of the
|
| 514 |
+
# class that represents result sets.
|
| 515 |
+
|
| 516 |
+
constructor {} {
|
| 517 |
+
set resultSetSeq 0
|
| 518 |
+
namespace eval ResultSet {}
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
# The 'execute' method on a statement runs the statement with
|
| 522 |
+
# a particular set of substituted variables. It actually works
|
| 523 |
+
# by creating the result set object and letting that objects
|
| 524 |
+
# constructor do the work of running the statement. The creation
|
| 525 |
+
# is wrapped in an [uplevel] call because the substitution proces
|
| 526 |
+
# may need to access variables in the caller's scope.
|
| 527 |
+
|
| 528 |
+
# WORKAROUND: Take out the '0 &&' from the next line when
|
| 529 |
+
# Bug 2649975 is fixed
|
| 530 |
+
if {0 && [package vsatisfies [package provide Tcl] 8.6]} {
|
| 531 |
+
method execute args {
|
| 532 |
+
tailcall my resultSetCreate \
|
| 533 |
+
[namespace current]::ResultSet::[incr resultSetSeq] \
|
| 534 |
+
[self] {*}$args
|
| 535 |
+
}
|
| 536 |
+
} else {
|
| 537 |
+
method execute args {
|
| 538 |
+
return \
|
| 539 |
+
[uplevel 1 \
|
| 540 |
+
[list \
|
| 541 |
+
[self] resultSetCreate \
|
| 542 |
+
[namespace current]::ResultSet::[incr resultSetSeq] \
|
| 543 |
+
[self] {*}$args]]
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
# The 'ResultSetCreate' method is expected to be a forward to the
|
| 548 |
+
# appropriate result set constructor. If it's missing, the driver must
|
| 549 |
+
# have been designed for tdbc 1.0b9 and earlier, and the 'resultSetClass'
|
| 550 |
+
# variable holds the class name.
|
| 551 |
+
|
| 552 |
+
method resultSetCreate {name instance args} {
|
| 553 |
+
return [uplevel 1 [list $resultSetClass create \
|
| 554 |
+
$name $instance {*}$args]]
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
# The 'resultsets' method returns a list of result sets produced by
|
| 558 |
+
# the current statement
|
| 559 |
+
|
| 560 |
+
method resultsets {} {
|
| 561 |
+
info commands ResultSet::*
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
# The 'allrows' method executes a statement with a given set of
|
| 565 |
+
# substituents, and returns a list of all the rows that the statement
|
| 566 |
+
# returns. Optionally, it stores the names of columns in
|
| 567 |
+
# '-columnsvariable'.
|
| 568 |
+
#
|
| 569 |
+
# Usage:
|
| 570 |
+
# $statement allrows ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
| 571 |
+
# ?dictionary?
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
method allrows args {
|
| 575 |
+
|
| 576 |
+
variable ::tdbc::generalError
|
| 577 |
+
|
| 578 |
+
# Grab keyword-value parameters
|
| 579 |
+
|
| 580 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 581 |
+
|
| 582 |
+
# Check postitional parameters
|
| 583 |
+
|
| 584 |
+
set cmd [list [self] execute]
|
| 585 |
+
if {[llength $args] == 0} {
|
| 586 |
+
# do nothing
|
| 587 |
+
} elseif {[llength $args] == 1} {
|
| 588 |
+
lappend cmd [lindex $args 0]
|
| 589 |
+
} else {
|
| 590 |
+
set errorcode $generalError
|
| 591 |
+
lappend errorcode wrongNumArgs
|
| 592 |
+
return -code error -errorcode $errorcode \
|
| 593 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 594 |
+
?-option value?... ?--? ?dictionary?"
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
# Get the result set
|
| 598 |
+
|
| 599 |
+
set resultSet [uplevel 1 $cmd]
|
| 600 |
+
|
| 601 |
+
# Delegate to the result set's [allrows] method to accumulate
|
| 602 |
+
# the rows of the result.
|
| 603 |
+
|
| 604 |
+
set cmd [list $resultSet allrows {*}$opts]
|
| 605 |
+
set status [catch {
|
| 606 |
+
uplevel 1 $cmd
|
| 607 |
+
} result options]
|
| 608 |
+
|
| 609 |
+
# Destroy the result set
|
| 610 |
+
|
| 611 |
+
catch {
|
| 612 |
+
rename $resultSet {}
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
# Adjust return level in the case that the script [return]s
|
| 616 |
+
|
| 617 |
+
if {$status == 2} {
|
| 618 |
+
set options [dict merge {-level 1} $options[set options {}]]
|
| 619 |
+
dict incr options -level
|
| 620 |
+
}
|
| 621 |
+
return -options $options $result
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
# The 'foreach' method executes a statement with a given set of
|
| 625 |
+
# substituents. It runs the supplied script, substituting the supplied
|
| 626 |
+
# named variable. Optionally, it stores the names of columns in
|
| 627 |
+
# '-columnsvariable'.
|
| 628 |
+
#
|
| 629 |
+
# Usage:
|
| 630 |
+
# $statement foreach ?-as lists|dicts? ?-columnsvariable varName? ?--?
|
| 631 |
+
# variableName ?dictionary? script
|
| 632 |
+
|
| 633 |
+
method foreach args {
|
| 634 |
+
|
| 635 |
+
variable ::tdbc::generalError
|
| 636 |
+
|
| 637 |
+
# Grab keyword-value parameters
|
| 638 |
+
|
| 639 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 640 |
+
|
| 641 |
+
# Check positional parameters
|
| 642 |
+
|
| 643 |
+
set cmd [list [self] execute]
|
| 644 |
+
if {[llength $args] == 2} {
|
| 645 |
+
lassign $args varname script
|
| 646 |
+
} elseif {[llength $args] == 3} {
|
| 647 |
+
lassign $args varname dict script
|
| 648 |
+
lappend cmd $dict
|
| 649 |
+
} else {
|
| 650 |
+
set errorcode $generalError
|
| 651 |
+
lappend errorcode wrongNumArgs
|
| 652 |
+
return -code error -errorcode $errorcode \
|
| 653 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 654 |
+
?-option value?... ?--? varName ?dictionary? script"
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
# Get the result set
|
| 658 |
+
|
| 659 |
+
set resultSet [uplevel 1 $cmd]
|
| 660 |
+
|
| 661 |
+
# Delegate to the result set's [foreach] method to evaluate
|
| 662 |
+
# the script for each row of the result.
|
| 663 |
+
|
| 664 |
+
set cmd [list $resultSet foreach {*}$opts -- $varname $script]
|
| 665 |
+
set status [catch {
|
| 666 |
+
uplevel 1 $cmd
|
| 667 |
+
} result options]
|
| 668 |
+
|
| 669 |
+
# Destroy the result set
|
| 670 |
+
|
| 671 |
+
catch {
|
| 672 |
+
rename $resultSet {}
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
# Adjust return level in the case that the script [return]s
|
| 676 |
+
|
| 677 |
+
if {$status == 2} {
|
| 678 |
+
set options [dict merge {-level 1} $options[set options {}]]
|
| 679 |
+
dict incr options -level
|
| 680 |
+
}
|
| 681 |
+
return -options $options $result
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
# The 'close' method is syntactic sugar for invoking the destructor
|
| 685 |
+
|
| 686 |
+
method close {} {
|
| 687 |
+
my destroy
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
# Derived classes are expected to implement their own constructors,
|
| 691 |
+
# plus the following methods:
|
| 692 |
+
|
| 693 |
+
# paramtype paramName ?direction? type ?scale ?precision??
|
| 694 |
+
# Declares the type of a parameter in the statement
|
| 695 |
+
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
#------------------------------------------------------------------------------
|
| 699 |
+
#
|
| 700 |
+
# Class: tdbc::resultset
|
| 701 |
+
#
|
| 702 |
+
# Class that represents a result set in a generic database.
|
| 703 |
+
#
|
| 704 |
+
#------------------------------------------------------------------------------
|
| 705 |
+
|
| 706 |
+
oo::class create tdbc::resultset {
|
| 707 |
+
|
| 708 |
+
constructor {} { }
|
| 709 |
+
|
| 710 |
+
# The 'allrows' method returns a list of all rows that a given
|
| 711 |
+
# result set returns.
|
| 712 |
+
|
| 713 |
+
method allrows args {
|
| 714 |
+
|
| 715 |
+
variable ::tdbc::generalError
|
| 716 |
+
|
| 717 |
+
# Parse args
|
| 718 |
+
|
| 719 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 720 |
+
if {[llength $args] != 0} {
|
| 721 |
+
set errorcode $generalError
|
| 722 |
+
lappend errorcode wrongNumArgs
|
| 723 |
+
return -code error -errorcode $errorcode \
|
| 724 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 725 |
+
?-option value?... ?--? varName script"
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
# Do -columnsvariable if requested
|
| 729 |
+
|
| 730 |
+
if {[dict exists $opts -columnsvariable]} {
|
| 731 |
+
upvar 1 [dict get $opts -columnsvariable] columns
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
# Assemble the results
|
| 735 |
+
|
| 736 |
+
if {[dict get $opts -as] eq {lists}} {
|
| 737 |
+
set delegate nextlist
|
| 738 |
+
} else {
|
| 739 |
+
set delegate nextdict
|
| 740 |
+
}
|
| 741 |
+
set results [list]
|
| 742 |
+
while {1} {
|
| 743 |
+
set columns [my columns]
|
| 744 |
+
while {[my $delegate row]} {
|
| 745 |
+
lappend results $row
|
| 746 |
+
}
|
| 747 |
+
if {![my nextresults]} break
|
| 748 |
+
}
|
| 749 |
+
return $results
|
| 750 |
+
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
# The 'foreach' method runs a script on each row from a result set.
|
| 754 |
+
|
| 755 |
+
method foreach args {
|
| 756 |
+
|
| 757 |
+
variable ::tdbc::generalError
|
| 758 |
+
|
| 759 |
+
# Grab keyword-value parameters
|
| 760 |
+
|
| 761 |
+
set args [::tdbc::ParseConvenienceArgs $args[set args {}] opts]
|
| 762 |
+
|
| 763 |
+
# Check positional parameters
|
| 764 |
+
|
| 765 |
+
if {[llength $args] != 2} {
|
| 766 |
+
set errorcode $generalError
|
| 767 |
+
lappend errorcode wrongNumArgs
|
| 768 |
+
return -code error -errorcode $errorcode \
|
| 769 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 770 |
+
?-option value?... ?--? varName script"
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
# Do -columnsvariable if requested
|
| 774 |
+
|
| 775 |
+
if {[dict exists $opts -columnsvariable]} {
|
| 776 |
+
upvar 1 [dict get $opts -columnsvariable] columns
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
# Iterate over the groups of results
|
| 780 |
+
while {1} {
|
| 781 |
+
|
| 782 |
+
# Export column names to caller
|
| 783 |
+
|
| 784 |
+
set columns [my columns]
|
| 785 |
+
|
| 786 |
+
# Iterate over the rows of one group of results
|
| 787 |
+
|
| 788 |
+
upvar 1 [lindex $args 0] row
|
| 789 |
+
if {[dict get $opts -as] eq {lists}} {
|
| 790 |
+
set delegate nextlist
|
| 791 |
+
} else {
|
| 792 |
+
set delegate nextdict
|
| 793 |
+
}
|
| 794 |
+
while {[my $delegate row]} {
|
| 795 |
+
set status [catch {
|
| 796 |
+
uplevel 1 [lindex $args 1]
|
| 797 |
+
} result options]
|
| 798 |
+
switch -exact -- $status {
|
| 799 |
+
0 - 4 { # OK or CONTINUE
|
| 800 |
+
}
|
| 801 |
+
2 { # RETURN
|
| 802 |
+
set options \
|
| 803 |
+
[dict merge {-level 1} $options[set options {}]]
|
| 804 |
+
dict incr options -level
|
| 805 |
+
return -options $options $result
|
| 806 |
+
}
|
| 807 |
+
3 { # BREAK
|
| 808 |
+
set broken 1
|
| 809 |
+
break
|
| 810 |
+
}
|
| 811 |
+
default { # ERROR or unknown status
|
| 812 |
+
return -options $options $result
|
| 813 |
+
}
|
| 814 |
+
}
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
# Advance to the next group of results if there is one
|
| 818 |
+
|
| 819 |
+
if {[info exists broken] || ![my nextresults]} {
|
| 820 |
+
break
|
| 821 |
+
}
|
| 822 |
+
}
|
| 823 |
+
|
| 824 |
+
return
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
|
| 828 |
+
# The 'nextrow' method retrieves a row in the form of either
|
| 829 |
+
# a list or a dictionary.
|
| 830 |
+
|
| 831 |
+
method nextrow {args} {
|
| 832 |
+
|
| 833 |
+
variable ::tdbc::generalError
|
| 834 |
+
|
| 835 |
+
set opts [dict create -as dicts]
|
| 836 |
+
set i 0
|
| 837 |
+
|
| 838 |
+
# Munch keyword options off the front of the command arguments
|
| 839 |
+
|
| 840 |
+
foreach {key value} $args {
|
| 841 |
+
if {[string index $key 0] eq {-}} {
|
| 842 |
+
switch -regexp -- $key {
|
| 843 |
+
-as? {
|
| 844 |
+
dict set opts -as $value
|
| 845 |
+
}
|
| 846 |
+
-- {
|
| 847 |
+
incr i
|
| 848 |
+
break
|
| 849 |
+
}
|
| 850 |
+
default {
|
| 851 |
+
set errorcode $generalError
|
| 852 |
+
lappend errorcode badOption $key
|
| 853 |
+
return -code error -errorcode $errorcode \
|
| 854 |
+
"bad option \"$key\":\
|
| 855 |
+
must be -as or -columnsvariable"
|
| 856 |
+
}
|
| 857 |
+
}
|
| 858 |
+
} else {
|
| 859 |
+
break
|
| 860 |
+
}
|
| 861 |
+
incr i 2
|
| 862 |
+
}
|
| 863 |
+
|
| 864 |
+
set args [lrange $args $i end]
|
| 865 |
+
if {[llength $args] != 1} {
|
| 866 |
+
set errorcode $generalError
|
| 867 |
+
lappend errorcode wrongNumArgs
|
| 868 |
+
return -code error -errorcode $errorcode \
|
| 869 |
+
"wrong # args: should be [lrange [info level 0] 0 1]\
|
| 870 |
+
?-option value?... ?--? varName"
|
| 871 |
+
}
|
| 872 |
+
upvar 1 [lindex $args 0] row
|
| 873 |
+
if {[dict get $opts -as] eq {lists}} {
|
| 874 |
+
set delegate nextlist
|
| 875 |
+
} else {
|
| 876 |
+
set delegate nextdict
|
| 877 |
+
}
|
| 878 |
+
return [my $delegate row]
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
# Derived classes must override 'nextresults' if a single
|
| 882 |
+
# statement execution can yield multiple sets of results
|
| 883 |
+
|
| 884 |
+
method nextresults {} {
|
| 885 |
+
return 0
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
# Derived classes must override 'outputparams' if statements can
|
| 889 |
+
# have output parameters.
|
| 890 |
+
|
| 891 |
+
method outputparams {} {
|
| 892 |
+
return {}
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
# The 'close' method is syntactic sugar for destroying the result set.
|
| 896 |
+
|
| 897 |
+
method close {} {
|
| 898 |
+
my destroy
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
# Derived classes are expected to implement the following methods:
|
| 902 |
+
|
| 903 |
+
# constructor and destructor.
|
| 904 |
+
# Constructor accepts a statement and an optional
|
| 905 |
+
# a dictionary of substituted parameters and
|
| 906 |
+
# executes the statement against the database. If
|
| 907 |
+
# the dictionary is not supplied, then the default
|
| 908 |
+
# is to get params from variables in the caller's scope).
|
| 909 |
+
# columns
|
| 910 |
+
# -- Returns a list of the names of the columns in the result.
|
| 911 |
+
# nextdict variableName
|
| 912 |
+
# -- Stores the next row of the result set in the given variable
|
| 913 |
+
# in caller's scope, in the form of a dictionary that maps
|
| 914 |
+
# column names to values.
|
| 915 |
+
# nextlist variableName
|
| 916 |
+
# -- Stores the next row of the result set in the given variable
|
| 917 |
+
# in caller's scope, in the form of a list of cells.
|
| 918 |
+
# rowcount
|
| 919 |
+
# -- Returns a count of rows affected by the statement, or -1
|
| 920 |
+
# if the count of rows has not been determined.
|
| 921 |
+
|
| 922 |
+
}
|
miniconda3/envs/active_proaction/lib/tdbc1.1.9/tdbcConfig.sh
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tdbcConfig.sh --
|
| 2 |
+
#
|
| 3 |
+
# This shell script (for sh) is generated automatically by TDBC's configure
|
| 4 |
+
# script. It will create shell variables for most of the configuration options
|
| 5 |
+
# discovered by the configure script. This script is intended to be included
|
| 6 |
+
# by the configure scripts for TDBC extensions so that they don't have to
|
| 7 |
+
# figure this all out for themselves.
|
| 8 |
+
#
|
| 9 |
+
# The information in this file is specific to a single platform.
|
| 10 |
+
#
|
| 11 |
+
# RCS: @(#) $Id$
|
| 12 |
+
|
| 13 |
+
# TDBC's version number
|
| 14 |
+
tdbc_VERSION=1.1.9
|
| 15 |
+
TDBC_VERSION=1.1.9
|
| 16 |
+
|
| 17 |
+
# Name of the TDBC library - may be either a static or shared library
|
| 18 |
+
tdbc_LIB_FILE=libtdbc1.1.9.so
|
| 19 |
+
TDBC_LIB_FILE=libtdbc1.1.9.so
|
| 20 |
+
|
| 21 |
+
# String to pass to the linker to pick up the TDBC library from its build dir
|
| 22 |
+
tdbc_BUILD_LIB_SPEC="-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9 -ltdbc1.1.9"
|
| 23 |
+
TDBC_BUILD_LIB_SPEC="-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9 -ltdbc1.1.9"
|
| 24 |
+
|
| 25 |
+
# String to pass to the linker to pick up the TDBC library from its installed
|
| 26 |
+
# dir.
|
| 27 |
+
tdbc_LIB_SPEC="-L/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9 -ltdbc1.1.9"
|
| 28 |
+
TDBC_LIB_SPEC="-L/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9 -ltdbc1.1.9"
|
| 29 |
+
|
| 30 |
+
# Name of the TBDC stub library
|
| 31 |
+
tdbc_STUB_LIB_FILE="libtdbcstub1.1.9.a"
|
| 32 |
+
TDBC_STUB_LIB_FILE="libtdbcstub1.1.9.a"
|
| 33 |
+
|
| 34 |
+
# String to pass to the linker to pick up the TDBC stub library from its
|
| 35 |
+
# build directory
|
| 36 |
+
tdbc_BUILD_STUB_LIB_SPEC="-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9 -ltdbcstub1.1.9"
|
| 37 |
+
TDBC_BUILD_STUB_LIB_SPEC="-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9 -ltdbcstub1.1.9"
|
| 38 |
+
|
| 39 |
+
# String to pass to the linker to pick up the TDBC stub library from its
|
| 40 |
+
# installed directory
|
| 41 |
+
tdbc_STUB_LIB_SPEC="-L/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9 -ltdbcstub1.1.9"
|
| 42 |
+
TDBC_STUB_LIB_SPEC="-L/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9 -ltdbcstub1.1.9"
|
| 43 |
+
|
| 44 |
+
# Path name of the TDBC stub library in its build directory
|
| 45 |
+
tdbc_BUILD_STUB_LIB_PATH="/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9/libtdbcstub1.1.9.a"
|
| 46 |
+
TDBC_BUILD_STUB_LIB_PATH="/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/tdbc1.1.9/libtdbcstub1.1.9.a"
|
| 47 |
+
|
| 48 |
+
# Path name of the TDBC stub library in its installed directory
|
| 49 |
+
tdbc_STUB_LIB_PATH="/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbcstub1.1.9.a"
|
| 50 |
+
TDBC_STUB_LIB_PATH="/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9/libtdbcstub1.1.9.a"
|
| 51 |
+
|
| 52 |
+
# Location of the top-level source directories from which TDBC was built.
|
| 53 |
+
# This is the directory that contains doc/, generic/ and so on. If TDBC
|
| 54 |
+
# was compiled in a directory other than the source directory, this still
|
| 55 |
+
# points to the location of the sources, not the location where TDBC was
|
| 56 |
+
# compiled.
|
| 57 |
+
tdbc_SRC_DIR="/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9"
|
| 58 |
+
TDBC_SRC_DIR="/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9"
|
| 59 |
+
|
| 60 |
+
# String to pass to the compiler so that an extension can find installed TDBC
|
| 61 |
+
# headers
|
| 62 |
+
tdbc_INCLUDE_SPEC="-I/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/include"
|
| 63 |
+
TDBC_INCLUDE_SPEC="-I/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/include"
|
| 64 |
+
|
| 65 |
+
# String to pass to the compiler so that an extension can find TDBC headers
|
| 66 |
+
# in the source directory
|
| 67 |
+
tdbc_BUILD_INCLUDE_SPEC="-I/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9/generic"
|
| 68 |
+
TDBC_BUILD_INCLUDE_SPEC="-I/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9/generic"
|
| 69 |
+
|
| 70 |
+
# Path name where .tcl files in the tdbc package appear at run time.
|
| 71 |
+
tdbc_LIBRARY_PATH="/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9"
|
| 72 |
+
TDBC_LIBRARY_PATH="/mnt/bn/bohanzhainas1/jiashuo/miniconda3/envs/active_proaction/lib/tdbc1.1.9"
|
| 73 |
+
|
| 74 |
+
# Path name where .tcl files in the tdbc package appear at build time.
|
| 75 |
+
tdbc_BUILD_LIBRARY_PATH="/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9/library"
|
| 76 |
+
TDBC_BUILD_LIBRARY_PATH="/croot/tk_1755243777296/work/tcl8.6.15/pkgs/tdbc1.1.9/library"
|
| 77 |
+
|
| 78 |
+
# Additional flags that must be passed to the C compiler to use tdbc
|
| 79 |
+
tdbc_CFLAGS=
|
| 80 |
+
TDBC_CFLAGS=
|
| 81 |
+
|
miniconda3/envs/active_proaction/lib/tdbcmysql1.1.9/libtdbcmysql1.1.9.so
ADDED
|
Binary file (52.4 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/tdbcmysql1.1.9/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Index file to load the TDBC MySQL package.
|
| 2 |
+
|
| 3 |
+
if {![package vsatisfies [package provide Tcl] 8.6-]} {
|
| 4 |
+
return
|
| 5 |
+
}
|
| 6 |
+
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| 7 |
+
package ifneeded tdbc::mysql 1.1.9 \
|
| 8 |
+
"[list source -encoding utf-8 [file join $dir tdbcmysql.tcl]]\;\
|
| 9 |
+
[list load [file join $dir libtcl9tdbcmysql1.1.9.so] [string totitle tdbcmysql]]"
|
| 10 |
+
} else {
|
| 11 |
+
package ifneeded tdbc::mysql 1.1.9 \
|
| 12 |
+
"[list source -encoding utf-8 [file join $dir tdbcmysql.tcl]]\;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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tdbcmysql.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Class definitions and Tcl-level methods for the tdbc::mysql bridge.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2008 by Kevin B. Kenny
|
| 6 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 7 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 8 |
+
#
|
| 9 |
+
# RCS: @(#) $Id: tdbcmysql.tcl,v 1.47 2008/02/27 02:08:27 kennykb Exp $
|
| 10 |
+
#
|
| 11 |
+
#------------------------------------------------------------------------------
|
| 12 |
+
|
| 13 |
+
package require tdbc
|
| 14 |
+
|
| 15 |
+
::namespace eval ::tdbc::mysql {
|
| 16 |
+
|
| 17 |
+
namespace export connection datasources drivers
|
| 18 |
+
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
#------------------------------------------------------------------------------
|
| 22 |
+
#
|
| 23 |
+
# tdbc::mysql::connection --
|
| 24 |
+
#
|
| 25 |
+
# Class representing a connection to a database through MYSQL.
|
| 26 |
+
#
|
| 27 |
+
#-------------------------------------------------------------------------------
|
| 28 |
+
|
| 29 |
+
::oo::class create ::tdbc::mysql::connection {
|
| 30 |
+
|
| 31 |
+
superclass ::tdbc::connection
|
| 32 |
+
|
| 33 |
+
# The constructor is written in C. It takes alternating keywords
|
| 34 |
+
# and values pairs as its argumenta. (See the manual page for the
|
| 35 |
+
# available options.)
|
| 36 |
+
|
| 37 |
+
variable foreignKeysStatement
|
| 38 |
+
|
| 39 |
+
# The 'statementCreate' method delegates to the constructor of the
|
| 40 |
+
# statement class
|
| 41 |
+
|
| 42 |
+
forward statementCreate ::tdbc::mysql::statement create
|
| 43 |
+
|
| 44 |
+
# The 'columns' method returns a dictionary describing the tables
|
| 45 |
+
# in the database
|
| 46 |
+
|
| 47 |
+
method columns {table {pattern %}} {
|
| 48 |
+
|
| 49 |
+
# To return correct lengths of CHARACTER and BINARY columns,
|
| 50 |
+
# we need to know the maximum lengths of characters in each
|
| 51 |
+
# collation. We cache this information only once, on the first
|
| 52 |
+
# call to 'columns'.
|
| 53 |
+
|
| 54 |
+
if {[my NeedCollationInfo]} {
|
| 55 |
+
my SetCollationInfo {*}[my allrows -as lists {
|
| 56 |
+
SELECT coll.id, cs.maxlen
|
| 57 |
+
FROM INFORMATION_SCHEMA.COLLATIONS coll,
|
| 58 |
+
INFORMATION_SCHEMA.CHARACTER_SETS cs
|
| 59 |
+
WHERE cs.CHARACTER_SET_NAME = coll.CHARACTER_SET_NAME
|
| 60 |
+
ORDER BY coll.id DESC
|
| 61 |
+
}]
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
return [my Columns $table $pattern]
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
# The 'preparecall' method gives a portable interface to prepare
|
| 68 |
+
# calls to stored procedures. It delegates to 'prepare' to do the
|
| 69 |
+
# actual work.
|
| 70 |
+
|
| 71 |
+
method preparecall {call} {
|
| 72 |
+
regexp {^[[:space:]]*(?:([A-Za-z_][A-Za-z_0-9]*)[[:space:]]*=)?(.*)} \
|
| 73 |
+
$call -> varName rest
|
| 74 |
+
if {$varName eq {}} {
|
| 75 |
+
my prepare "CALL $rest"
|
| 76 |
+
} else {
|
| 77 |
+
my prepare \\{:$varName=$rest\\}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
# The 'init', 'begintransaction', 'commit, 'rollback', 'tables'
|
| 82 |
+
# 'NeedCollationInfo', 'SetCollationInfo', and 'Columns' methods
|
| 83 |
+
# are implemented in C.
|
| 84 |
+
|
| 85 |
+
# The 'BuildForeignKeysStatements' method builds a SQL statement to
|
| 86 |
+
# retrieve the foreign keys from a database. (It executes once the
|
| 87 |
+
# first time the 'foreignKeys' method is executed, and retains the
|
| 88 |
+
# prepared statements for reuse.) It is slightly nonstandard because
|
| 89 |
+
# MYSQL doesn't name the PRIMARY constraints uniquely.
|
| 90 |
+
|
| 91 |
+
method BuildForeignKeysStatement {} {
|
| 92 |
+
|
| 93 |
+
foreach {exists1 clause1} {
|
| 94 |
+
0 {}
|
| 95 |
+
1 { AND fkc.REFERENCED_TABLE_NAME = :primary}
|
| 96 |
+
} {
|
| 97 |
+
foreach {exists2 clause2} {
|
| 98 |
+
0 {}
|
| 99 |
+
1 { AND fkc.TABLE_NAME = :foreign}
|
| 100 |
+
} {
|
| 101 |
+
set stmt [my prepare "
|
| 102 |
+
SELECT rc.CONSTRAINT_SCHEMA AS \"foreignConstraintSchema\",
|
| 103 |
+
rc.CONSTRAINT_NAME AS \"foreignConstraintName\",
|
| 104 |
+
rc.UPDATE_RULE AS \"updateAction\",
|
| 105 |
+
rc.DELETE_RULE AS \"deleteAction\",
|
| 106 |
+
fkc.REFERENCED_TABLE_SCHEMA AS \"primarySchema\",
|
| 107 |
+
fkc.REFERENCED_TABLE_NAME AS \"primaryTable\",
|
| 108 |
+
fkc.REFERENCED_COLUMN_NAME AS \"primaryColumn\",
|
| 109 |
+
fkc.TABLE_SCHEMA AS \"foreignSchema\",
|
| 110 |
+
fkc.TABLE_NAME AS \"foreignTable\",
|
| 111 |
+
fkc.COLUMN_NAME AS \"foreignColumn\",
|
| 112 |
+
fkc.ORDINAL_POSITION AS \"ordinalPosition\"
|
| 113 |
+
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
|
| 114 |
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkc
|
| 115 |
+
ON fkc.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
|
| 116 |
+
AND fkc.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
|
| 117 |
+
WHERE 1=1
|
| 118 |
+
$clause1
|
| 119 |
+
$clause2
|
| 120 |
+
"]
|
| 121 |
+
dict set foreignKeysStatement $exists1 $exists2 $stmt
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
#------------------------------------------------------------------------------
|
| 128 |
+
#
|
| 129 |
+
# tdbc::mysql::statement --
|
| 130 |
+
#
|
| 131 |
+
# The class 'tdbc::mysql::statement' models one statement against a
|
| 132 |
+
# database accessed through an MYSQL connection
|
| 133 |
+
#
|
| 134 |
+
#------------------------------------------------------------------------------
|
| 135 |
+
|
| 136 |
+
::oo::class create ::tdbc::mysql::statement {
|
| 137 |
+
|
| 138 |
+
superclass ::tdbc::statement
|
| 139 |
+
|
| 140 |
+
# The 'resultSetCreate' method forwards to the constructor of the
|
| 141 |
+
# result set.
|
| 142 |
+
|
| 143 |
+
forward resultSetCreate ::tdbc::mysql::resultset create
|
| 144 |
+
|
| 145 |
+
# Methods implemented in C:
|
| 146 |
+
#
|
| 147 |
+
# constructor connection SQLCode
|
| 148 |
+
# The constructor accepts the handle to the connection and the SQL code
|
| 149 |
+
# for the statement to prepare. It creates a subordinate namespace to
|
| 150 |
+
# hold the statement's active result sets, and then delegates to the
|
| 151 |
+
# 'init' method, written in C, to do the actual work of preparing the
|
| 152 |
+
# statement.
|
| 153 |
+
# params
|
| 154 |
+
# Returns descriptions of the parameters of a statement.
|
| 155 |
+
# paramtype paramname ?direction? type ?precision ?scale??
|
| 156 |
+
# Declares the type of a parameter in the statement
|
| 157 |
+
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
#------------------------------------------------------------------------------
|
| 161 |
+
#
|
| 162 |
+
# tdbc::mysql::resultset --
|
| 163 |
+
#
|
| 164 |
+
# The class 'tdbc::mysql::resultset' models the result set that is
|
| 165 |
+
# produced by executing a statement against an MYSQL database.
|
| 166 |
+
#
|
| 167 |
+
#------------------------------------------------------------------------------
|
| 168 |
+
|
| 169 |
+
::oo::class create ::tdbc::mysql::resultset {
|
| 170 |
+
|
| 171 |
+
superclass ::tdbc::resultset
|
| 172 |
+
|
| 173 |
+
# Methods implemented in C include:
|
| 174 |
+
|
| 175 |
+
# constructor statement ?dictionary?
|
| 176 |
+
# -- Executes the statement against the database, optionally providing
|
| 177 |
+
# a dictionary of substituted parameters (default is to get params
|
| 178 |
+
# from variables in the caller's scope).
|
| 179 |
+
# columns
|
| 180 |
+
# -- Returns a list of the names of the columns in the result.
|
| 181 |
+
# nextdict
|
| 182 |
+
# -- Stores the next row of the result set in the given variable in
|
| 183 |
+
# the caller's scope as a dictionary whose keys are
|
| 184 |
+
# column names and whose values are column values, or else
|
| 185 |
+
# as a list of cells.
|
| 186 |
+
# nextlist
|
| 187 |
+
# -- Stores the next row of the result set in the given variable in
|
| 188 |
+
# the caller's scope as a list of cells.
|
| 189 |
+
# rowcount
|
| 190 |
+
# -- Returns a count of rows affected by the statement, or -1
|
| 191 |
+
# if the count of rows has not been determined.
|
| 192 |
+
|
| 193 |
+
}
|
miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/libtdbcodbc1.1.9.so
ADDED
|
Binary file (66 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Index file to load the TDBC ODBC package.
|
| 2 |
+
|
| 3 |
+
if {![package vsatisfies [package provide Tcl] 8.6-]} {
|
| 4 |
+
return
|
| 5 |
+
}
|
| 6 |
+
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| 7 |
+
package ifneeded tdbc::odbc 1.1.9 \
|
| 8 |
+
"[list source -encoding utf-8 [file join $dir tdbcodbc.tcl]]\;\
|
| 9 |
+
[list load [file join $dir libtcl9tdbcodbc1.1.9.so] [string totitle tdbcodbc]]"
|
| 10 |
+
} else {
|
| 11 |
+
package ifneeded tdbc::odbc 1.1.9 \
|
| 12 |
+
"[list source -encoding utf-8 [file join $dir tdbcodbc.tcl]]\;\
|
| 13 |
+
[list load [file join $dir libtdbcodbc1.1.9.so] [string totitle tdbcodbc]]"
|
| 14 |
+
}
|
miniconda3/envs/active_proaction/lib/tdbcodbc1.1.9/tdbcodbc.tcl
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tdbcodbc.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Class definitions and Tcl-level methods for the tdbc::odbc bridge.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2008 by Kevin B. Kenny
|
| 6 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 7 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 8 |
+
#
|
| 9 |
+
# RCS: @(#) $Id: tdbcodbc.tcl,v 1.47 2008/02/27 02:08:27 kennykb Exp $
|
| 10 |
+
#
|
| 11 |
+
#------------------------------------------------------------------------------
|
| 12 |
+
|
| 13 |
+
package require tdbc
|
| 14 |
+
|
| 15 |
+
::namespace eval ::tdbc::odbc {
|
| 16 |
+
|
| 17 |
+
namespace export connection datasources drivers
|
| 18 |
+
|
| 19 |
+
# Data types that are predefined in ODBC
|
| 20 |
+
|
| 21 |
+
variable sqltypes [dict create \
|
| 22 |
+
1 char \
|
| 23 |
+
2 numeric \
|
| 24 |
+
3 decimal \
|
| 25 |
+
4 integer \
|
| 26 |
+
5 smallint \
|
| 27 |
+
6 float \
|
| 28 |
+
7 real \
|
| 29 |
+
8 double \
|
| 30 |
+
9 datetime \
|
| 31 |
+
12 varchar \
|
| 32 |
+
91 date \
|
| 33 |
+
92 time \
|
| 34 |
+
93 timestamp \
|
| 35 |
+
-1 longvarchar \
|
| 36 |
+
-2 binary \
|
| 37 |
+
-3 varbinary \
|
| 38 |
+
-4 longvarbinary \
|
| 39 |
+
-5 bigint \
|
| 40 |
+
-6 tinyint \
|
| 41 |
+
-7 bit \
|
| 42 |
+
-8 wchar \
|
| 43 |
+
-9 wvarchar \
|
| 44 |
+
-10 wlongvarchar \
|
| 45 |
+
-11 guid]
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
#------------------------------------------------------------------------------
|
| 49 |
+
#
|
| 50 |
+
# tdbc::odbc::connection --
|
| 51 |
+
#
|
| 52 |
+
# Class representing a connection to a database through ODBC.
|
| 53 |
+
#
|
| 54 |
+
#-------------------------------------------------------------------------------
|
| 55 |
+
|
| 56 |
+
::oo::class create ::tdbc::odbc::connection {
|
| 57 |
+
|
| 58 |
+
superclass ::tdbc::connection
|
| 59 |
+
|
| 60 |
+
variable statementSeq typemap
|
| 61 |
+
|
| 62 |
+
# The constructor is written in C. It takes the connection string
|
| 63 |
+
# as its argument It sets up a namespace to hold the statements
|
| 64 |
+
# associated with the connection, and then delegates to the 'init'
|
| 65 |
+
# method (written in C) to do the actual work of attaching to the
|
| 66 |
+
# database. When that comes back, it sets up a statement to query
|
| 67 |
+
# the support types, makes a dictionary to enumerate them, and
|
| 68 |
+
# calls back to set a flag if WVARCHAR is seen (If WVARCHAR is
|
| 69 |
+
# seen, the database supports Unicode.)
|
| 70 |
+
|
| 71 |
+
# The 'statementCreate' method forwards to the constructor of the
|
| 72 |
+
# statement class
|
| 73 |
+
|
| 74 |
+
forward statementCreate ::tdbc::odbc::statement create
|
| 75 |
+
|
| 76 |
+
# The 'tables' method returns a dictionary describing the tables
|
| 77 |
+
# in the database
|
| 78 |
+
|
| 79 |
+
method tables {{pattern %}} {
|
| 80 |
+
set stmt [::tdbc::odbc::tablesStatement create \
|
| 81 |
+
Stmt::[incr statementSeq] [self] $pattern]
|
| 82 |
+
set status [catch {
|
| 83 |
+
set retval {}
|
| 84 |
+
$stmt foreach -as dicts row {
|
| 85 |
+
if {[dict exists $row TABLE_NAME]} {
|
| 86 |
+
dict set retval [dict get $row TABLE_NAME] $row
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
set retval
|
| 90 |
+
} result options]
|
| 91 |
+
catch {rename $stmt {}}
|
| 92 |
+
return -level 0 -options $options $result
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
# The 'columns' method returns a dictionary describing the tables
|
| 96 |
+
# in the database
|
| 97 |
+
|
| 98 |
+
method columns {table {pattern %}} {
|
| 99 |
+
# Make sure that the type map is initialized
|
| 100 |
+
my typemap
|
| 101 |
+
|
| 102 |
+
# Query the columns from the database
|
| 103 |
+
|
| 104 |
+
set stmt [::tdbc::odbc::columnsStatement create \
|
| 105 |
+
Stmt::[incr statementSeq] [self] $table $pattern]
|
| 106 |
+
set status [catch {
|
| 107 |
+
set retval {}
|
| 108 |
+
$stmt foreach -as dicts origrow {
|
| 109 |
+
|
| 110 |
+
# Map the type, precision, scale and nullable indicators
|
| 111 |
+
# to tdbc's notation
|
| 112 |
+
|
| 113 |
+
set row {}
|
| 114 |
+
dict for {key value} $origrow {
|
| 115 |
+
dict set row [string tolower $key] $value
|
| 116 |
+
}
|
| 117 |
+
if {[dict exists $row column_name]} {
|
| 118 |
+
if {[dict exists $typemap \
|
| 119 |
+
[dict get $row data_type]]} {
|
| 120 |
+
dict set row type \
|
| 121 |
+
[dict get $typemap \
|
| 122 |
+
[dict get $row data_type]]
|
| 123 |
+
} else {
|
| 124 |
+
dict set row type [dict get $row type_name]
|
| 125 |
+
}
|
| 126 |
+
if {[dict exists $row column_size]} {
|
| 127 |
+
dict set row precision \
|
| 128 |
+
[dict get $row column_size]
|
| 129 |
+
}
|
| 130 |
+
if {[dict exists $row decimal_digits]} {
|
| 131 |
+
dict set row scale \
|
| 132 |
+
[dict get $row decimal_digits]
|
| 133 |
+
}
|
| 134 |
+
if {![dict exists $row nullable]} {
|
| 135 |
+
dict set row nullable \
|
| 136 |
+
[expr {!![string trim [dict get $row is_nullable]]}]
|
| 137 |
+
}
|
| 138 |
+
dict set retval [dict get $row column_name] $row
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
set retval
|
| 142 |
+
} result options]
|
| 143 |
+
catch {rename $stmt {}}
|
| 144 |
+
return -level 0 -options $options $result
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
# The 'primarykeys' method returns a dictionary describing the primary
|
| 148 |
+
# keys of a table
|
| 149 |
+
|
| 150 |
+
method primarykeys {tableName} {
|
| 151 |
+
set stmt [::tdbc::odbc::primarykeysStatement create \
|
| 152 |
+
Stmt::[incr statementSeq] [self] $tableName]
|
| 153 |
+
set status [catch {
|
| 154 |
+
set retval {}
|
| 155 |
+
$stmt foreach -as dicts row {
|
| 156 |
+
foreach {odbcKey tdbcKey} {
|
| 157 |
+
TABLE_CAT tableCatalog
|
| 158 |
+
TABLE_SCHEM tableSchema
|
| 159 |
+
TABLE_NAME tableName
|
| 160 |
+
COLUMN_NAME columnName
|
| 161 |
+
KEY_SEQ ordinalPosition
|
| 162 |
+
PK_NAME constraintName
|
| 163 |
+
} {
|
| 164 |
+
if {[dict exists $row $odbcKey]} {
|
| 165 |
+
dict set row $tdbcKey [dict get $row $odbcKey]
|
| 166 |
+
dict unset row $odbcKey
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
lappend retval $row
|
| 170 |
+
}
|
| 171 |
+
set retval
|
| 172 |
+
} result options]
|
| 173 |
+
catch {rename $stmt {}}
|
| 174 |
+
return -level 0 -options $options $result
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
# The 'foreignkeys' method returns a dictionary describing the foreign
|
| 178 |
+
# keys of a table
|
| 179 |
+
|
| 180 |
+
method foreignkeys {args} {
|
| 181 |
+
set stmt [::tdbc::odbc::foreignkeysStatement create \
|
| 182 |
+
Stmt::[incr statementSeq] [self] {*}$args]
|
| 183 |
+
set status [catch {
|
| 184 |
+
set fkseq 0
|
| 185 |
+
set retval {}
|
| 186 |
+
$stmt foreach -as dicts row {
|
| 187 |
+
foreach {odbcKey tdbcKey} {
|
| 188 |
+
PKTABLE_CAT primaryCatalog
|
| 189 |
+
PKTABLE_SCHEM primarySchema
|
| 190 |
+
PKTABLE_NAME primaryTable
|
| 191 |
+
PKCOLUMN_NAME primaryColumn
|
| 192 |
+
FKTABLE_CAT foreignCatalog
|
| 193 |
+
FKTABLE_SCHEM foreignSchema
|
| 194 |
+
FKTABLE_NAME foreignTable
|
| 195 |
+
FKCOLUMN_NAME foreignColumn
|
| 196 |
+
UPDATE_RULE updateRule
|
| 197 |
+
DELETE_RULE deleteRule
|
| 198 |
+
DEFERRABILITY deferrable
|
| 199 |
+
KEY_SEQ ordinalPosition
|
| 200 |
+
FK_NAME foreignConstraintName
|
| 201 |
+
} {
|
| 202 |
+
if {[dict exists $row $odbcKey]} {
|
| 203 |
+
dict set row $tdbcKey [dict get $row $odbcKey]
|
| 204 |
+
dict unset row $odbcKey
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
# Horrible kludge: If the driver doesn't report FK_NAME,
|
| 208 |
+
# make one up.
|
| 209 |
+
if {![dict exists $row foreignConstraintName]} {
|
| 210 |
+
if {![dict exists $row ordinalPosition]
|
| 211 |
+
|| [dict get $row ordinalPosition] == 1} {
|
| 212 |
+
set fkname ?[dict get $row foreignTable]?[incr fkseq]
|
| 213 |
+
}
|
| 214 |
+
dict set row foreignConstraintName $fkname
|
| 215 |
+
}
|
| 216 |
+
lappend retval $row
|
| 217 |
+
}
|
| 218 |
+
set retval
|
| 219 |
+
} result options]
|
| 220 |
+
catch {rename $stmt {}}
|
| 221 |
+
return -level 0 -options $options $result
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
# The 'evaldirect' evaluates driver-native SQL code without preparing it,
|
| 225 |
+
# and returns a list of dicts (similar to '$connection allrows -as dicts').
|
| 226 |
+
|
| 227 |
+
method evaldirect {sqlStatement} {
|
| 228 |
+
set stmt [::tdbc::odbc::evaldirectStatement create \
|
| 229 |
+
Stmt::[incr statementSeq] [self] $sqlStatement]
|
| 230 |
+
set status [catch {
|
| 231 |
+
$stmt allrows -as dicts
|
| 232 |
+
} result options]
|
| 233 |
+
catch {rename $stmt {}}
|
| 234 |
+
return -level 0 -options $options $result
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
# The 'prepareCall' method gives a portable interface to prepare
|
| 238 |
+
# calls to stored procedures. It delegates to 'prepare' to do the
|
| 239 |
+
# actual work.
|
| 240 |
+
|
| 241 |
+
method preparecall {call} {
|
| 242 |
+
|
| 243 |
+
regexp {^[[:space:]]*(?:([A-Za-z_][A-Za-z_0-9]*)[[:space:]]*=)?(.*)} \
|
| 244 |
+
$call -> varName rest
|
| 245 |
+
if {$varName eq {}} {
|
| 246 |
+
my prepare \\{CALL $rest\\}
|
| 247 |
+
} else {
|
| 248 |
+
my prepare \\{:$varName=CALL $rest\\}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
if 0 {
|
| 252 |
+
# Kevin thinks this is going to be
|
| 253 |
+
|
| 254 |
+
if {![regexp -expanded {
|
| 255 |
+
^\s* # leading whitespace
|
| 256 |
+
(?::([[:alpha:]_][[:alnum:]_]*)\s*=\s*) # possible variable name
|
| 257 |
+
(?:(?:([[:alpha:]_][[:alnum:]_]*)\s*[.]\s*)? # catalog
|
| 258 |
+
([[:alpha:]_][[:alnum:]_]*)\s*[.]\s*)? # schema
|
| 259 |
+
([[:alpha:]_][[:alnum:]_]*)\s* # procedure
|
| 260 |
+
(.*)$ # argument list
|
| 261 |
+
} $call -> varName catalog schema procedure arglist]} {
|
| 262 |
+
return -code error \
|
| 263 |
+
-errorCode [list TDBC \
|
| 264 |
+
SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION \
|
| 265 |
+
42000 ODBC -1] \
|
| 266 |
+
"Syntax error in stored procedure call"
|
| 267 |
+
} else {
|
| 268 |
+
my PrepareCall $varName $catalog $schema $procedure $arglist
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
# at least if making all parameters 'inout' doesn't work.
|
| 272 |
+
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
# The 'typemap' method returns the type map
|
| 278 |
+
|
| 279 |
+
method typemap {} {
|
| 280 |
+
if {![info exists typemap]} {
|
| 281 |
+
set typemap $::tdbc::odbc::sqltypes
|
| 282 |
+
set typesStmt [tdbc::odbc::typesStatement new [self]]
|
| 283 |
+
$typesStmt foreach row {
|
| 284 |
+
set typeNum [dict get $row DATA_TYPE]
|
| 285 |
+
if {![dict exists $typemap $typeNum]} {
|
| 286 |
+
dict set typemap $typeNum [string tolower \
|
| 287 |
+
[dict get $row TYPE_NAME]]
|
| 288 |
+
}
|
| 289 |
+
switch -exact -- $typeNum {
|
| 290 |
+
-9 {
|
| 291 |
+
[self] HasWvarchar 1
|
| 292 |
+
}
|
| 293 |
+
-5 {
|
| 294 |
+
[self] HasBigint 1
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
rename $typesStmt {}
|
| 299 |
+
}
|
| 300 |
+
return $typemap
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
# The 'begintransaction', 'commit' and 'rollback' methods are
|
| 304 |
+
# implemented in C.
|
| 305 |
+
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
#-------------------------------------------------------------------------------
|
| 309 |
+
#
|
| 310 |
+
# tdbc::odbc::statement --
|
| 311 |
+
#
|
| 312 |
+
# The class 'tdbc::odbc::statement' models one statement against a
|
| 313 |
+
# database accessed through an ODBC connection
|
| 314 |
+
#
|
| 315 |
+
#-------------------------------------------------------------------------------
|
| 316 |
+
|
| 317 |
+
::oo::class create ::tdbc::odbc::statement {
|
| 318 |
+
|
| 319 |
+
superclass ::tdbc::statement
|
| 320 |
+
|
| 321 |
+
# The constructor is implemented in C. It accepts the handle to
|
| 322 |
+
# the connection and the SQL code for the statement to prepare.
|
| 323 |
+
# It creates a subordinate namespace to hold the statement's
|
| 324 |
+
# active result sets, and then delegates to the 'init' method,
|
| 325 |
+
# written in C, to do the actual work of preparing the statement.
|
| 326 |
+
|
| 327 |
+
# The 'resultSetCreate' method forwards to the result set constructor
|
| 328 |
+
|
| 329 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 330 |
+
|
| 331 |
+
# The 'params' method describes the parameters to the statement
|
| 332 |
+
|
| 333 |
+
method params {} {
|
| 334 |
+
set typemap [[my connection] typemap]
|
| 335 |
+
set result {}
|
| 336 |
+
foreach {name flags typeNum precision scale nullable} [my ParamList] {
|
| 337 |
+
set lst [dict create \
|
| 338 |
+
name $name \
|
| 339 |
+
direction [lindex {unknown in out inout} \
|
| 340 |
+
[expr {($flags & 0x06) >> 1}]] \
|
| 341 |
+
type [dict get $typemap $typeNum] \
|
| 342 |
+
precision $precision \
|
| 343 |
+
scale $scale]
|
| 344 |
+
if {$nullable in {0 1}} {
|
| 345 |
+
dict set list nullable $nullable
|
| 346 |
+
}
|
| 347 |
+
dict set result $name $lst
|
| 348 |
+
}
|
| 349 |
+
return $result
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
# Methods implemented in C:
|
| 353 |
+
# init statement ?dictionary?
|
| 354 |
+
# Does the heavy lifting for the constructor
|
| 355 |
+
# connection
|
| 356 |
+
# Returns the connection handle to which this statement belongs
|
| 357 |
+
# paramtype paramname ?direction? type ?precision ?scale??
|
| 358 |
+
# Declares the type of a parameter in the statement
|
| 359 |
+
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
#------------------------------------------------------------------------------
|
| 363 |
+
#
|
| 364 |
+
# tdbc::odbc::tablesStatement --
|
| 365 |
+
#
|
| 366 |
+
# The class 'tdbc::odbc::tablesStatement' represents the special
|
| 367 |
+
# statement that queries the tables in a database through an ODBC
|
| 368 |
+
# connection.
|
| 369 |
+
#
|
| 370 |
+
#------------------------------------------------------------------------------
|
| 371 |
+
|
| 372 |
+
oo::class create ::tdbc::odbc::tablesStatement {
|
| 373 |
+
|
| 374 |
+
superclass ::tdbc::statement
|
| 375 |
+
|
| 376 |
+
# The constructor is written in C. It accepts the handle to the
|
| 377 |
+
# connection and a pattern to match table names. It works in all
|
| 378 |
+
# ways like the constructor of the 'statement' class except that
|
| 379 |
+
# its 'init' method sets up to enumerate tables and not run a SQL
|
| 380 |
+
# query.
|
| 381 |
+
|
| 382 |
+
# The 'resultSetCreate' method forwards to the result set constructor
|
| 383 |
+
|
| 384 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 385 |
+
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
#------------------------------------------------------------------------------
|
| 389 |
+
#
|
| 390 |
+
# tdbc::odbc::columnsStatement --
|
| 391 |
+
#
|
| 392 |
+
# The class 'tdbc::odbc::tablesStatement' represents the special
|
| 393 |
+
# statement that queries the columns of a table or view
|
| 394 |
+
# in a database through an ODBC connection.
|
| 395 |
+
#
|
| 396 |
+
#------------------------------------------------------------------------------
|
| 397 |
+
|
| 398 |
+
oo::class create ::tdbc::odbc::columnsStatement {
|
| 399 |
+
|
| 400 |
+
superclass ::tdbc::statement
|
| 401 |
+
|
| 402 |
+
# The constructor is written in C. It accepts the handle to the
|
| 403 |
+
# connection, a table name, and a pattern to match column
|
| 404 |
+
# names. It works in all ways like the constructor of the
|
| 405 |
+
# 'statement' class except that its 'init' method sets up to
|
| 406 |
+
# enumerate tables and not run a SQL query.
|
| 407 |
+
|
| 408 |
+
# The 'resultSetCreate' class forwards to the constructor of the
|
| 409 |
+
# result set
|
| 410 |
+
|
| 411 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 412 |
+
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
#------------------------------------------------------------------------------
|
| 416 |
+
#
|
| 417 |
+
# tdbc::odbc::primarykeysStatement --
|
| 418 |
+
#
|
| 419 |
+
# The class 'tdbc::odbc::primarykeysStatement' represents the special
|
| 420 |
+
# statement that queries the primary keys on a table through an ODBC
|
| 421 |
+
# connection.
|
| 422 |
+
#
|
| 423 |
+
#------------------------------------------------------------------------------
|
| 424 |
+
|
| 425 |
+
oo::class create ::tdbc::odbc::primarykeysStatement {
|
| 426 |
+
|
| 427 |
+
superclass ::tdbc::statement
|
| 428 |
+
|
| 429 |
+
# The constructor is written in C. It accepts the handle to the
|
| 430 |
+
# connection and a table name. It works in all
|
| 431 |
+
# ways like the constructor of the 'statement' class except that
|
| 432 |
+
# its 'init' method sets up to enumerate primary keys and not run a SQL
|
| 433 |
+
# query.
|
| 434 |
+
|
| 435 |
+
# The 'resultSetCreate' method forwards to the result set constructor
|
| 436 |
+
|
| 437 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 438 |
+
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
#------------------------------------------------------------------------------
|
| 442 |
+
#
|
| 443 |
+
# tdbc::odbc::foreignkeysStatement --
|
| 444 |
+
#
|
| 445 |
+
# The class 'tdbc::odbc::foreignkeysStatement' represents the special
|
| 446 |
+
# statement that queries the foreign keys on a table through an ODBC
|
| 447 |
+
# connection.
|
| 448 |
+
#
|
| 449 |
+
#------------------------------------------------------------------------------
|
| 450 |
+
|
| 451 |
+
oo::class create ::tdbc::odbc::foreignkeysStatement {
|
| 452 |
+
|
| 453 |
+
superclass ::tdbc::statement
|
| 454 |
+
|
| 455 |
+
# The constructor is written in C. It accepts the handle to the
|
| 456 |
+
# connection and the -primary and -foreign options. It works in all
|
| 457 |
+
# ways like the constructor of the 'statement' class except that
|
| 458 |
+
# its 'init' method sets up to enumerate foreign keys and not run a SQL
|
| 459 |
+
# query.
|
| 460 |
+
|
| 461 |
+
# The 'resultSetCreate' method forwards to the result set constructor
|
| 462 |
+
|
| 463 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 464 |
+
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
#------------------------------------------------------------------------------
|
| 468 |
+
#
|
| 469 |
+
# tdbc::odbc::evaldirectStatement --
|
| 470 |
+
#
|
| 471 |
+
# The class 'tdbc::odbc::evaldirectStatement' provides a mechanism to
|
| 472 |
+
# execute driver-name SQL code through an ODBC connection. The SQL code
|
| 473 |
+
# is not prepared and no tokenization or variable substitution is done.
|
| 474 |
+
#
|
| 475 |
+
#------------------------------------------------------------------------------
|
| 476 |
+
|
| 477 |
+
oo::class create ::tdbc::odbc::evaldirectStatement {
|
| 478 |
+
|
| 479 |
+
superclass ::tdbc::statement
|
| 480 |
+
|
| 481 |
+
# The constructor is written in C. It accepts the handle to the
|
| 482 |
+
# connection and a SQL statement. It works in all
|
| 483 |
+
# ways like the constructor of the 'statement' class except that
|
| 484 |
+
# its 'init' method does not tokenize or prepare the SQL statement, and
|
| 485 |
+
# sets up to run the SQL query without performing variable substitution.
|
| 486 |
+
|
| 487 |
+
# The 'resultSetCreate' method forwards to the result set constructor
|
| 488 |
+
|
| 489 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 490 |
+
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
#------------------------------------------------------------------------------
|
| 494 |
+
#
|
| 495 |
+
# tdbc::odbc::typesStatement --
|
| 496 |
+
#
|
| 497 |
+
# The class 'tdbc::odbc::typesStatement' represents the special
|
| 498 |
+
# statement that queries the types available in a database through
|
| 499 |
+
# an ODBC connection.
|
| 500 |
+
#
|
| 501 |
+
#------------------------------------------------------------------------------
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
oo::class create ::tdbc::odbc::typesStatement {
|
| 505 |
+
|
| 506 |
+
superclass ::tdbc::statement
|
| 507 |
+
|
| 508 |
+
# The constructor is written in C. It accepts the handle to the
|
| 509 |
+
# connection, and (optionally) a data type number. It works in all
|
| 510 |
+
# ways like the constructor of the 'statement' class except that
|
| 511 |
+
# its 'init' method sets up to enumerate types and not run a SQL
|
| 512 |
+
# query.
|
| 513 |
+
|
| 514 |
+
# The 'resultSetCreate' method forwards to the constructor of result sets
|
| 515 |
+
|
| 516 |
+
forward resultSetCreate ::tdbc::odbc::resultset create
|
| 517 |
+
|
| 518 |
+
# The C code contains a variant implementation of the 'init' method.
|
| 519 |
+
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
#------------------------------------------------------------------------------
|
| 523 |
+
#
|
| 524 |
+
# tdbc::odbc::resultset --
|
| 525 |
+
#
|
| 526 |
+
# The class 'tdbc::odbc::resultset' models the result set that is
|
| 527 |
+
# produced by executing a statement against an ODBC database.
|
| 528 |
+
#
|
| 529 |
+
#------------------------------------------------------------------------------
|
| 530 |
+
|
| 531 |
+
::oo::class create ::tdbc::odbc::resultset {
|
| 532 |
+
|
| 533 |
+
superclass ::tdbc::resultset
|
| 534 |
+
|
| 535 |
+
# Methods implemented in C include:
|
| 536 |
+
|
| 537 |
+
# constructor statement ?dictionary?
|
| 538 |
+
# -- Executes the statement against the database, optionally providing
|
| 539 |
+
# a dictionary of substituted parameters (default is to get params
|
| 540 |
+
# from variables in the caller's scope).
|
| 541 |
+
# columns
|
| 542 |
+
# -- Returns a list of the names of the columns in the result.
|
| 543 |
+
# nextdict
|
| 544 |
+
# -- Stores the next row of the result set in the given variable in
|
| 545 |
+
# the caller's scope as a dictionary whose keys are
|
| 546 |
+
# column names and whose values are column values.
|
| 547 |
+
# nextlist
|
| 548 |
+
# -- Stores the next row of the result set in the given variable in
|
| 549 |
+
# the caller's scope as a list of cells.
|
| 550 |
+
# rowcount
|
| 551 |
+
# -- Returns a count of rows affected by the statement, or -1
|
| 552 |
+
# if the count of rows has not been determined.
|
| 553 |
+
|
| 554 |
+
}
|
miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/libtdbcpostgres1.1.9.so
ADDED
|
Binary file (48.2 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Index file to load the TDBC Postgres package.
|
| 2 |
+
|
| 3 |
+
if {![package vsatisfies [package provide Tcl] 8.6-]} {
|
| 4 |
+
return
|
| 5 |
+
}
|
| 6 |
+
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| 7 |
+
package ifneeded tdbc::postgres 1.1.9 \
|
| 8 |
+
"[list source -encoding utf-8 [file join $dir tdbcpostgres.tcl]]\;\
|
| 9 |
+
[list load [file join $dir libtcl9tdbcpostgres1.1.9.so] [string totitle tdbcpostgres]]"
|
| 10 |
+
} else {
|
| 11 |
+
package ifneeded tdbc::postgres 1.1.9 \
|
| 12 |
+
"[list source -encoding utf-8 [file join $dir tdbcpostgres.tcl]]\;\
|
| 13 |
+
[list load [file join $dir libtdbcpostgres1.1.9.so] [string totitle tdbcpostgres]]"
|
| 14 |
+
}
|
miniconda3/envs/active_proaction/lib/tdbcpostgres1.1.9/tdbcpostgres.tcl
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tdbcpostgres.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Class definitions and Tcl-level methods for the tdbc::postgres bridge.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2009 by Slawomir Cygan
|
| 6 |
+
#
|
| 7 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 8 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 9 |
+
#
|
| 10 |
+
#------------------------------------------------------------------------------
|
| 11 |
+
|
| 12 |
+
package require tdbc
|
| 13 |
+
|
| 14 |
+
::namespace eval ::tdbc::mypostgres {
|
| 15 |
+
|
| 16 |
+
namespace export connection datasources drivers
|
| 17 |
+
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
#------------------------------------------------------------------------------
|
| 21 |
+
#
|
| 22 |
+
# tdbc::postgres::connection --
|
| 23 |
+
#
|
| 24 |
+
# Class representing a connection to a Postgres database.
|
| 25 |
+
#
|
| 26 |
+
#-------------------------------------------------------------------------------
|
| 27 |
+
|
| 28 |
+
::oo::class create ::tdbc::postgres::connection {
|
| 29 |
+
|
| 30 |
+
superclass ::tdbc::connection
|
| 31 |
+
|
| 32 |
+
# The constructor is written in C. It takes alternating keywords
|
| 33 |
+
# and values pairs as its arguments. (See the manual page for the
|
| 34 |
+
# available options.)
|
| 35 |
+
|
| 36 |
+
# The 'statementCreate' method delegates to the constructor of the
|
| 37 |
+
# statement class
|
| 38 |
+
|
| 39 |
+
forward statementCreate ::tdbc::postgres::statement create
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# The 'prepareCall' method gives a portable interface to prepare
|
| 43 |
+
# calls to stored procedures. It delegates to 'prepare' to do the
|
| 44 |
+
# actual work.
|
| 45 |
+
|
| 46 |
+
method preparecall {call} {
|
| 47 |
+
regexp {^[[:space:]]*(?:([A-Za-z_][A-Za-z_0-9]*)[[:space:]]*=)?(.*)} \
|
| 48 |
+
$call -> varName rest
|
| 49 |
+
if {$varName eq {}} {
|
| 50 |
+
my prepare \\{$rest\\}
|
| 51 |
+
} else {
|
| 52 |
+
my prepare \\{:$varName=$rest\\}
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
# The 'init', 'begintransaction', 'commit, 'rollback', 'tables'
|
| 57 |
+
# and 'columns' methods are implemented in C.
|
| 58 |
+
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
#------------------------------------------------------------------------------
|
| 62 |
+
#
|
| 63 |
+
# tdbc::postgres::statement --
|
| 64 |
+
#
|
| 65 |
+
# The class 'tdbc::postgres::statement' models one statement against a
|
| 66 |
+
# database accessed through a Postgres connection
|
| 67 |
+
#
|
| 68 |
+
#------------------------------------------------------------------------------
|
| 69 |
+
|
| 70 |
+
::oo::class create ::tdbc::postgres::statement {
|
| 71 |
+
|
| 72 |
+
superclass ::tdbc::statement
|
| 73 |
+
|
| 74 |
+
# The 'resultSetCreate' method forwards to the constructor of the
|
| 75 |
+
# result set.
|
| 76 |
+
|
| 77 |
+
forward resultSetCreate ::tdbc::postgres::resultset create
|
| 78 |
+
|
| 79 |
+
# Methods implemented in C:
|
| 80 |
+
#
|
| 81 |
+
# constructor connection SQLCode
|
| 82 |
+
# The constructor accepts the handle to the connection and the SQL code
|
| 83 |
+
# for the statement to prepare. It creates a subordinate namespace to
|
| 84 |
+
# hold the statement's active result sets, and then delegates to the
|
| 85 |
+
# 'init' method, written in C, to do the actual work of preparing the
|
| 86 |
+
# statement.
|
| 87 |
+
# params
|
| 88 |
+
# Returns descriptions of the parameters of a statement.
|
| 89 |
+
# paramtype paramname ?direction? type ?precision ?scale??
|
| 90 |
+
# Declares the type of a parameter in the statement
|
| 91 |
+
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
#------------------------------------------------------------------------------
|
| 95 |
+
#
|
| 96 |
+
# tdbc::postgres::resultset --
|
| 97 |
+
#
|
| 98 |
+
# The class 'tdbc::postgres::resultset' models the result set that is
|
| 99 |
+
# produced by executing a statement against a Postgres database.
|
| 100 |
+
#
|
| 101 |
+
#------------------------------------------------------------------------------
|
| 102 |
+
|
| 103 |
+
::oo::class create ::tdbc::postgres::resultset {
|
| 104 |
+
|
| 105 |
+
superclass ::tdbc::resultset
|
| 106 |
+
|
| 107 |
+
# The 'nextresults' method is stubbed out; tdbcpostgres does not
|
| 108 |
+
# allow a single call to return multiple results.
|
| 109 |
+
|
| 110 |
+
method nextresults {} {
|
| 111 |
+
while {[my nextdict rubbish]} {}
|
| 112 |
+
return 0
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
# Methods implemented in C include:
|
| 116 |
+
|
| 117 |
+
# constructor statement ?dictionary?
|
| 118 |
+
# -- Executes the statement against the database, optionally providing
|
| 119 |
+
# a dictionary of substituted parameters (default is to get params
|
| 120 |
+
# from variables in the caller's scope).
|
| 121 |
+
# columns
|
| 122 |
+
# -- Returns a list of the names of the columns in the result.
|
| 123 |
+
# nextdict
|
| 124 |
+
# -- Stores the next row of the result set in the given variable in
|
| 125 |
+
# the caller's scope as a dictionary whose keys are
|
| 126 |
+
# column names and whose values are column values, or else
|
| 127 |
+
# as a list of cells.
|
| 128 |
+
# nextlist
|
| 129 |
+
# -- Stores the next row of the result set in the given variable in
|
| 130 |
+
# the caller's scope as a list of cells.
|
| 131 |
+
# rowcount
|
| 132 |
+
# -- Returns a count of rows affected by the statement, or -1
|
| 133 |
+
# if the count of rows has not been determined.
|
| 134 |
+
|
| 135 |
+
}
|
miniconda3/envs/active_proaction/lib/thread2.8.10/libthread2.8.10.so
ADDED
|
Binary file (98.1 kB). View file
|
|
|
miniconda3/envs/active_proaction/lib/thread2.8.10/pkgIndex.tcl
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- tcl -*-
|
| 2 |
+
# Tcl package index file, version 1.1
|
| 3 |
+
#
|
| 4 |
+
|
| 5 |
+
if {![package vsatisfies [package provide Tcl] 8.4]} {
|
| 6 |
+
# Pre-8.4 Tcl interps we dont support at all. Bye!
|
| 7 |
+
# 9.0+ Tcl interps are only supported on 32-bit platforms.
|
| 8 |
+
if {![package vsatisfies [package provide Tcl] 9.0]
|
| 9 |
+
|| ($::tcl_platform(pointerSize) != 4)} {
|
| 10 |
+
return
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
# All Tcl 8.4+ interps can [load] Thread 2.8.10
|
| 15 |
+
#
|
| 16 |
+
# For interps that are not thread-enabled, we still call [package ifneeded].
|
| 17 |
+
# This is contrary to the usual convention, but is a good idea because we
|
| 18 |
+
# cannot imagine any other version of Thread that might succeed in a
|
| 19 |
+
# thread-disabled interp. There's nothing to gain by yielding to other
|
| 20 |
+
# competing callers of [package ifneeded Thread]. On the other hand,
|
| 21 |
+
# deferring the error has the advantage that a script calling
|
| 22 |
+
# [package require Thread] in a thread-disabled interp gets an error message
|
| 23 |
+
# about a thread-disabled interp, instead of the message
|
| 24 |
+
# "can't find package Thread".
|
| 25 |
+
|
| 26 |
+
package ifneeded Thread 2.8.10 [list load [file join $dir libthread2.8.10.so] [string totitle thread]]
|
| 27 |
+
|
| 28 |
+
# package Ttrace uses some support machinery.
|
| 29 |
+
|
| 30 |
+
# In Tcl 8.4 interps we use some older interfaces
|
| 31 |
+
if {![package vsatisfies [package provide Tcl] 8.5]} {
|
| 32 |
+
package ifneeded Ttrace 2.8.10 "
|
| 33 |
+
[list proc thread_source {dir} {
|
| 34 |
+
if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
|
| 35 |
+
[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
|
| 36 |
+
source -encoding utf-8 $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
|
| 37 |
+
} elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
|
| 38 |
+
source -encoding utf-8 [file join $dir .. lib ttrace.tcl]
|
| 39 |
+
} elseif {[file readable [file join $dir ttrace.tcl]]} {
|
| 40 |
+
source -encoding utf-8 [file join $dir ttrace.tcl]
|
| 41 |
+
}
|
| 42 |
+
if {[namespace which ::ttrace::update] ne ""} {
|
| 43 |
+
::ttrace::update
|
| 44 |
+
}
|
| 45 |
+
}]
|
| 46 |
+
[list thread_source $dir]
|
| 47 |
+
[list rename thread_source {}]"
|
| 48 |
+
return
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# In Tcl 8.5+ interps; use [::apply]
|
| 52 |
+
|
| 53 |
+
package ifneeded Ttrace 2.8.10 [list ::apply {{dir} {
|
| 54 |
+
if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
|
| 55 |
+
[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
|
| 56 |
+
source -encoding utf-8 $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
|
| 57 |
+
} elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
|
| 58 |
+
source -encoding utf-8 [file join $dir .. lib ttrace.tcl]
|
| 59 |
+
} elseif {[file readable [file join $dir ttrace.tcl]]} {
|
| 60 |
+
source -encoding utf-8 [file join $dir ttrace.tcl]
|
| 61 |
+
}
|
| 62 |
+
if {[namespace which ::ttrace::update] ne ""} {
|
| 63 |
+
::ttrace::update
|
| 64 |
+
}
|
| 65 |
+
}} $dir]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
miniconda3/envs/active_proaction/lib/thread2.8.10/ttrace.tcl
ADDED
|
@@ -0,0 +1,942 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# ttrace.tcl --
|
| 3 |
+
#
|
| 4 |
+
# Copyright (C) 2003 Zoran Vasiljevic, Archiware GmbH. All Rights Reserved.
|
| 5 |
+
#
|
| 6 |
+
# See the file "license.terms" for information on usage and redistribution of
|
| 7 |
+
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 8 |
+
# ----------------------------------------------------------------------------
|
| 9 |
+
#
|
| 10 |
+
# User level commands:
|
| 11 |
+
#
|
| 12 |
+
# ttrace::eval top-level wrapper (ttrace-savvy eval)
|
| 13 |
+
# ttrace::enable activates registered Tcl command traces
|
| 14 |
+
# ttrace::disable terminates tracing of Tcl commands
|
| 15 |
+
# ttrace::isenabled returns true if ttrace is enabled
|
| 16 |
+
# ttrace::cleanup bring the interp to a pristine state
|
| 17 |
+
# ttrace::update update interp to the latest trace epoch
|
| 18 |
+
# ttrace::config setup some configuration options
|
| 19 |
+
# ttrace::getscript returns a script for initializing interps
|
| 20 |
+
#
|
| 21 |
+
# Commands used for/from trace callbacks:
|
| 22 |
+
#
|
| 23 |
+
# ttrace::atenable register callback to be done at trace enable
|
| 24 |
+
# ttrace::atdisable register callback to be done at trace disable
|
| 25 |
+
# ttrace::addtrace register user-defined tracer callback
|
| 26 |
+
# ttrace::addscript register user-defined script generator
|
| 27 |
+
# ttrace::addresolver register user-defined command resolver
|
| 28 |
+
# ttrace::addcleanup register user-defined cleanup procedures
|
| 29 |
+
# ttrace::addentry adds one entry into the named trace store
|
| 30 |
+
# ttrace::getentry returns the entry value from the named store
|
| 31 |
+
# ttrace::delentry removes the entry from the named store
|
| 32 |
+
# ttrace::getentries returns all entries from the named store
|
| 33 |
+
# ttrace::preload register procedures to be preloaded always
|
| 34 |
+
#
|
| 35 |
+
#
|
| 36 |
+
# Limitations:
|
| 37 |
+
#
|
| 38 |
+
# o. [namespace forget] is still not implemented
|
| 39 |
+
# o. [namespace origin cmd] breaks if cmd is not already defined
|
| 40 |
+
#
|
| 41 |
+
# I left this deliberately. I didn't want to override the [namespace]
|
| 42 |
+
# command in order to avoid potential slowdown.
|
| 43 |
+
#
|
| 44 |
+
|
| 45 |
+
namespace eval ttrace {
|
| 46 |
+
|
| 47 |
+
# Setup some compatibility wrappers
|
| 48 |
+
if {[info commands nsv_set] != ""} {
|
| 49 |
+
variable tvers 0
|
| 50 |
+
variable mutex ns_mutex
|
| 51 |
+
variable elock [$mutex create traceepochmutex]
|
| 52 |
+
# Import the underlying API; faster than recomputing
|
| 53 |
+
interp alias {} [namespace current]::_array {} nsv_array
|
| 54 |
+
interp alias {} [namespace current]::_incr {} nsv_incr
|
| 55 |
+
interp alias {} [namespace current]::_lappend {} nsv_lappend
|
| 56 |
+
interp alias {} [namespace current]::_names {} nsv_names
|
| 57 |
+
interp alias {} [namespace current]::_set {} nsv_set
|
| 58 |
+
interp alias {} [namespace current]::_unset {} nsv_unset
|
| 59 |
+
} elseif {![catch {
|
| 60 |
+
variable tvers [package require Thread]
|
| 61 |
+
}]} {
|
| 62 |
+
variable mutex thread::mutex
|
| 63 |
+
variable elock [$mutex create]
|
| 64 |
+
# Import the underlying API; faster than recomputing
|
| 65 |
+
interp alias {} [namespace current]::_array {} tsv::array
|
| 66 |
+
interp alias {} [namespace current]::_incr {} tsv::incr
|
| 67 |
+
interp alias {} [namespace current]::_lappend {} tsv::lappend
|
| 68 |
+
interp alias {} [namespace current]::_names {} tsv::names
|
| 69 |
+
interp alias {} [namespace current]::_set {} tsv::set
|
| 70 |
+
interp alias {} [namespace current]::_unset {} tsv::unset
|
| 71 |
+
} else {
|
| 72 |
+
error "requires NaviServer/AOLserver or Tcl threading extension"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
# Keep in sync with the Thread package
|
| 76 |
+
package provide Ttrace 2.8.10
|
| 77 |
+
|
| 78 |
+
# Package variables
|
| 79 |
+
variable resolvers "" ; # List of registered resolvers
|
| 80 |
+
variable tracers "" ; # List of registered cmd tracers
|
| 81 |
+
variable scripts "" ; # List of registered script makers
|
| 82 |
+
variable enables "" ; # List of trace-enable callbacks
|
| 83 |
+
variable disables "" ; # List of trace-disable callbacks
|
| 84 |
+
variable preloads "" ; # List of procedure names to preload
|
| 85 |
+
variable enabled 0 ; # True if trace is enabled
|
| 86 |
+
variable config ; # Array with config options
|
| 87 |
+
|
| 88 |
+
variable epoch -1 ; # The initialization epoch
|
| 89 |
+
variable cleancnt 0 ; # Counter of registered cleaners
|
| 90 |
+
|
| 91 |
+
# Package private namespaces
|
| 92 |
+
namespace eval resolve "" ; # Commands for resolving commands
|
| 93 |
+
namespace eval trace "" ; # Commands registered for tracing
|
| 94 |
+
namespace eval enable "" ; # Commands invoked at trace enable
|
| 95 |
+
namespace eval disable "" ; # Commands invoked at trace disable
|
| 96 |
+
namespace eval script "" ; # Commands for generating scripts
|
| 97 |
+
|
| 98 |
+
# Exported commands
|
| 99 |
+
namespace export unknown
|
| 100 |
+
|
| 101 |
+
# Initialize ttrace shared state
|
| 102 |
+
if {[_array exists ttrace] == 0} {
|
| 103 |
+
_set ttrace lastepoch $epoch
|
| 104 |
+
_set ttrace epochlist ""
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# Initially, allow creation of epochs
|
| 108 |
+
set config(-doepochs) 1
|
| 109 |
+
|
| 110 |
+
proc eval {cmd args} {
|
| 111 |
+
enable
|
| 112 |
+
set code [catch {uplevel 1 [concat $cmd $args]} result]
|
| 113 |
+
disable
|
| 114 |
+
if {$code == 0} {
|
| 115 |
+
if {[llength [info commands ns_ictl]]} {
|
| 116 |
+
ns_ictl save [getscript]
|
| 117 |
+
} else {
|
| 118 |
+
thread::broadcast {
|
| 119 |
+
package require Ttrace
|
| 120 |
+
ttrace::update
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
return -code $code \
|
| 125 |
+
-errorinfo $::errorInfo -errorcode $::errorCode $result
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
proc config {args} {
|
| 129 |
+
variable config
|
| 130 |
+
if {[llength $args] == 0} {
|
| 131 |
+
array get config
|
| 132 |
+
} elseif {[llength $args] == 1} {
|
| 133 |
+
set opt [lindex $args 0]
|
| 134 |
+
set config($opt)
|
| 135 |
+
} else {
|
| 136 |
+
set opt [lindex $args 0]
|
| 137 |
+
set val [lindex $args 1]
|
| 138 |
+
set config($opt) $val
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
proc enable {} {
|
| 143 |
+
variable config
|
| 144 |
+
variable tracers
|
| 145 |
+
variable enables
|
| 146 |
+
variable enabled
|
| 147 |
+
incr enabled 1
|
| 148 |
+
if {$enabled > 1} {
|
| 149 |
+
return
|
| 150 |
+
}
|
| 151 |
+
if {$config(-doepochs) != 0} {
|
| 152 |
+
variable epoch [_newepoch]
|
| 153 |
+
}
|
| 154 |
+
set nsp [namespace current]
|
| 155 |
+
foreach enabler $enables {
|
| 156 |
+
enable::_$enabler
|
| 157 |
+
}
|
| 158 |
+
foreach trace $tracers {
|
| 159 |
+
if {[info commands $trace] != ""} {
|
| 160 |
+
trace add execution $trace leave ${nsp}::trace::_$trace
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
proc disable {} {
|
| 166 |
+
variable enabled
|
| 167 |
+
variable tracers
|
| 168 |
+
variable disables
|
| 169 |
+
incr enabled -1
|
| 170 |
+
if {$enabled > 0} {
|
| 171 |
+
return
|
| 172 |
+
}
|
| 173 |
+
set nsp [namespace current]
|
| 174 |
+
foreach disabler $disables {
|
| 175 |
+
disable::_$disabler
|
| 176 |
+
}
|
| 177 |
+
foreach trace $tracers {
|
| 178 |
+
if {[info commands $trace] != ""} {
|
| 179 |
+
trace remove execution $trace leave ${nsp}::trace::_$trace
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
proc isenabled {} {
|
| 185 |
+
variable enabled
|
| 186 |
+
expr {$enabled > 0}
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
proc update {{from -1}} {
|
| 190 |
+
if {$from < 0} {
|
| 191 |
+
variable epoch [_set ttrace lastepoch]
|
| 192 |
+
} else {
|
| 193 |
+
if {[lsearch [_set ttrace epochlist] $from] < 0} {
|
| 194 |
+
error "no such epoch: $from"
|
| 195 |
+
}
|
| 196 |
+
variable epoch $from
|
| 197 |
+
}
|
| 198 |
+
uplevel 1 [getscript]
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
proc getscript {} {
|
| 202 |
+
variable preloads
|
| 203 |
+
variable epoch
|
| 204 |
+
variable scripts
|
| 205 |
+
append script [_serializensp] \n
|
| 206 |
+
append script "::namespace eval [namespace current] {" \n
|
| 207 |
+
append script "::namespace export unknown" \n
|
| 208 |
+
append script "_useepoch $epoch" \n
|
| 209 |
+
append script "}" \n
|
| 210 |
+
foreach cmd $preloads {
|
| 211 |
+
append script [_serializeproc $cmd] \n
|
| 212 |
+
}
|
| 213 |
+
foreach maker $scripts {
|
| 214 |
+
append script [script::_$maker]
|
| 215 |
+
}
|
| 216 |
+
return $script
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
proc cleanup {args} {
|
| 220 |
+
foreach cmd [info commands resolve::cleaner_*] {
|
| 221 |
+
uplevel 1 $cmd $args
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
proc preload {cmd} {
|
| 226 |
+
variable preloads
|
| 227 |
+
if {[lsearch $preloads $cmd] < 0} {
|
| 228 |
+
lappend preloads $cmd
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
proc atenable {cmd arglist body} {
|
| 233 |
+
variable enables
|
| 234 |
+
if {[lsearch $enables $cmd] < 0} {
|
| 235 |
+
lappend enables $cmd
|
| 236 |
+
set cmd [namespace current]::enable::_$cmd
|
| 237 |
+
proc $cmd $arglist $body
|
| 238 |
+
return $cmd
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
proc atdisable {cmd arglist body} {
|
| 243 |
+
variable disables
|
| 244 |
+
if {[lsearch $disables $cmd] < 0} {
|
| 245 |
+
lappend disables $cmd
|
| 246 |
+
set cmd [namespace current]::disable::_$cmd
|
| 247 |
+
proc $cmd $arglist $body
|
| 248 |
+
return $cmd
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
proc addtrace {cmd arglist body} {
|
| 253 |
+
variable tracers
|
| 254 |
+
if {[lsearch $tracers $cmd] < 0} {
|
| 255 |
+
lappend tracers $cmd
|
| 256 |
+
set tracer [namespace current]::trace::_$cmd
|
| 257 |
+
proc $tracer $arglist $body
|
| 258 |
+
if {[isenabled]} {
|
| 259 |
+
trace add execution $cmd leave $tracer
|
| 260 |
+
}
|
| 261 |
+
return $tracer
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
proc addscript {cmd body} {
|
| 266 |
+
variable scripts
|
| 267 |
+
if {[lsearch $scripts $cmd] < 0} {
|
| 268 |
+
lappend scripts $cmd
|
| 269 |
+
set cmd [namespace current]::script::_$cmd
|
| 270 |
+
proc $cmd args $body
|
| 271 |
+
return $cmd
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
proc addresolver {cmd arglist body} {
|
| 276 |
+
variable resolvers
|
| 277 |
+
if {[lsearch $resolvers $cmd] < 0} {
|
| 278 |
+
lappend resolvers $cmd
|
| 279 |
+
set cmd [namespace current]::resolve::$cmd
|
| 280 |
+
proc $cmd $arglist $body
|
| 281 |
+
return $cmd
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
proc addcleanup {body} {
|
| 286 |
+
variable cleancnt
|
| 287 |
+
set cmd [namespace current]::resolve::cleaner_[incr cleancnt]
|
| 288 |
+
proc $cmd args $body
|
| 289 |
+
return $cmd
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
proc addentry {cmd var val} {
|
| 293 |
+
variable epoch
|
| 294 |
+
_set ${epoch}-$cmd $var $val
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
proc delentry {cmd var} {
|
| 298 |
+
variable epoch
|
| 299 |
+
set ei $::errorInfo
|
| 300 |
+
set ec $::errorCode
|
| 301 |
+
catch {_unset ${epoch}-$cmd $var}
|
| 302 |
+
set ::errorInfo $ei
|
| 303 |
+
set ::errorCode $ec
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
proc getentry {cmd var} {
|
| 307 |
+
variable epoch
|
| 308 |
+
set ei $::errorInfo
|
| 309 |
+
set ec $::errorCode
|
| 310 |
+
if {[catch {_set ${epoch}-$cmd $var} val]} {
|
| 311 |
+
set ::errorInfo $ei
|
| 312 |
+
set ::errorCode $ec
|
| 313 |
+
set val ""
|
| 314 |
+
}
|
| 315 |
+
return $val
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
proc getentries {cmd {pattern *}} {
|
| 319 |
+
variable epoch
|
| 320 |
+
_array names ${epoch}-$cmd $pattern
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
proc unknown {args} {
|
| 324 |
+
set cmd [lindex $args 0]
|
| 325 |
+
if {[uplevel 1 ttrace::_resolve [list $cmd]]} {
|
| 326 |
+
set c [catch {uplevel 1 $cmd [lrange $args 1 end]} r]
|
| 327 |
+
} else {
|
| 328 |
+
set c [catch {uplevel 1 ::tcl::unknown $args} r]
|
| 329 |
+
}
|
| 330 |
+
return -code $c -errorcode $::errorCode -errorinfo $::errorInfo $r
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
proc _resolve {cmd} {
|
| 334 |
+
variable resolvers
|
| 335 |
+
foreach resolver $resolvers {
|
| 336 |
+
if {[uplevel 1 [info comm resolve::$resolver] [list $cmd]]} {
|
| 337 |
+
return 1
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
return 0
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
proc _getthread {} {
|
| 344 |
+
if {[info commands ns_thread] == ""} {
|
| 345 |
+
thread::id
|
| 346 |
+
} else {
|
| 347 |
+
ns_thread getid
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
proc _getthreads {} {
|
| 352 |
+
if {[info commands ns_thread] == ""} {
|
| 353 |
+
return [thread::names]
|
| 354 |
+
} else {
|
| 355 |
+
foreach entry [ns_info threads] {
|
| 356 |
+
lappend threads [lindex $entry 2]
|
| 357 |
+
}
|
| 358 |
+
return $threads
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
proc _newepoch {} {
|
| 363 |
+
variable elock
|
| 364 |
+
variable mutex
|
| 365 |
+
$mutex lock $elock
|
| 366 |
+
set old [_set ttrace lastepoch]
|
| 367 |
+
set new [_incr ttrace lastepoch]
|
| 368 |
+
_lappend ttrace $new [_getthread]
|
| 369 |
+
if {$old >= 0} {
|
| 370 |
+
_copyepoch $old $new
|
| 371 |
+
_delepochs
|
| 372 |
+
}
|
| 373 |
+
_lappend ttrace epochlist $new
|
| 374 |
+
$mutex unlock $elock
|
| 375 |
+
return $new
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
proc _copyepoch {old new} {
|
| 379 |
+
foreach var [_names $old-*] {
|
| 380 |
+
set cmd [lindex [split $var -] 1]
|
| 381 |
+
_array reset $new-$cmd [_array get $var]
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
proc _delepochs {} {
|
| 386 |
+
set tlist [_getthreads]
|
| 387 |
+
set elist ""
|
| 388 |
+
foreach epoch [_set ttrace epochlist] {
|
| 389 |
+
if {[_dropepoch $epoch $tlist] == 0} {
|
| 390 |
+
lappend elist $epoch
|
| 391 |
+
} else {
|
| 392 |
+
_unset ttrace $epoch
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
_set ttrace epochlist $elist
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
proc _dropepoch {epoch threads} {
|
| 399 |
+
set self [_getthread]
|
| 400 |
+
foreach tid [_set ttrace $epoch] {
|
| 401 |
+
if {$tid != $self && [lsearch $threads $tid] >= 0} {
|
| 402 |
+
lappend alive $tid
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
if {[info exists alive]} {
|
| 406 |
+
_set ttrace $epoch $alive
|
| 407 |
+
return 0
|
| 408 |
+
} else {
|
| 409 |
+
foreach var [_names $epoch-*] {
|
| 410 |
+
_unset $var
|
| 411 |
+
}
|
| 412 |
+
return 1
|
| 413 |
+
}
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
proc _useepoch {epoch} {
|
| 417 |
+
if {$epoch >= 0} {
|
| 418 |
+
set tid [_getthread]
|
| 419 |
+
if {[lsearch [_set ttrace $epoch] $tid] == -1} {
|
| 420 |
+
_lappend ttrace $epoch $tid
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
proc _serializeproc {cmd} {
|
| 426 |
+
set dargs [info args $cmd]
|
| 427 |
+
set pbody [info body $cmd]
|
| 428 |
+
set pargs ""
|
| 429 |
+
foreach arg $dargs {
|
| 430 |
+
if {![info default $cmd $arg def]} {
|
| 431 |
+
lappend pargs $arg
|
| 432 |
+
} else {
|
| 433 |
+
lappend pargs [list $arg $def]
|
| 434 |
+
}
|
| 435 |
+
}
|
| 436 |
+
set nsp [namespace qual $cmd]
|
| 437 |
+
if {$nsp == ""} {
|
| 438 |
+
set nsp "::"
|
| 439 |
+
}
|
| 440 |
+
append res [list ::namespace eval $nsp] " {" \n
|
| 441 |
+
append res [list ::proc [namespace tail $cmd] $pargs $pbody] \n
|
| 442 |
+
append res "}" \n
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
proc _serializensp {{nsp ""} {result _}} {
|
| 446 |
+
upvar $result res
|
| 447 |
+
if {$nsp == ""} {
|
| 448 |
+
set nsp [namespace current]
|
| 449 |
+
}
|
| 450 |
+
append res [list ::namespace eval $nsp] " {" \n
|
| 451 |
+
foreach var [info vars ${nsp}::*] {
|
| 452 |
+
set vname [namespace tail $var]
|
| 453 |
+
if {[array exists $var] == 0} {
|
| 454 |
+
append res [list ::variable $vname [set $var]] \n
|
| 455 |
+
} else {
|
| 456 |
+
append res [list ::variable $vname] \n
|
| 457 |
+
append res [list ::array set $vname [array get $var]] \n
|
| 458 |
+
}
|
| 459 |
+
}
|
| 460 |
+
foreach cmd [info procs ${nsp}::*] {
|
| 461 |
+
append res [_serializeproc $cmd] \n
|
| 462 |
+
}
|
| 463 |
+
append res "}" \n
|
| 464 |
+
foreach nn [namespace children $nsp] {
|
| 465 |
+
_serializensp $nn res
|
| 466 |
+
}
|
| 467 |
+
return $res
|
| 468 |
+
}
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
#
|
| 472 |
+
# The code below is ment to be run once during the application start. It
|
| 473 |
+
# provides implementation of tracing callbacks for some Tcl commands. Users
|
| 474 |
+
# can supply their own tracer implementations on-the-fly.
|
| 475 |
+
#
|
| 476 |
+
# The code below will create traces for the following Tcl commands:
|
| 477 |
+
# "namespace", "variable", "load", "proc" and "rename"
|
| 478 |
+
#
|
| 479 |
+
# Also, the Tcl object extension XOTcl 1.1.0 is handled and all XOTcl related
|
| 480 |
+
# things, like classes and objects are traced (many thanks to Gustaf Neumann
|
| 481 |
+
# from XOTcl for his kind help and support).
|
| 482 |
+
#
|
| 483 |
+
|
| 484 |
+
eval {
|
| 485 |
+
|
| 486 |
+
#
|
| 487 |
+
# Register the "load" trace. This will create the following key/value pair
|
| 488 |
+
# in the "load" store:
|
| 489 |
+
#
|
| 490 |
+
# --- key ---- --- value ---
|
| 491 |
+
# <path_of_loaded_image> <name_of_the_init_proc>
|
| 492 |
+
#
|
| 493 |
+
# We normally need only the name_of_the_init_proc for being able to load
|
| 494 |
+
# the package in other interpreters, but we store the path to the image
|
| 495 |
+
# file as well.
|
| 496 |
+
#
|
| 497 |
+
|
| 498 |
+
ttrace::addtrace load {cmdline code args} {
|
| 499 |
+
if {$code != 0} {
|
| 500 |
+
return
|
| 501 |
+
}
|
| 502 |
+
set image [lindex $cmdline 1]
|
| 503 |
+
set initp [lindex $cmdline 2]
|
| 504 |
+
if {$initp == ""} {
|
| 505 |
+
foreach pkg [info loaded] {
|
| 506 |
+
if {[lindex $pkg 0] == $image} {
|
| 507 |
+
set initp [lindex $pkg 1]
|
| 508 |
+
}
|
| 509 |
+
}
|
| 510 |
+
}
|
| 511 |
+
ttrace::addentry load $image $initp
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
ttrace::addscript load {
|
| 515 |
+
append res "\n"
|
| 516 |
+
foreach entry [ttrace::getentries load] {
|
| 517 |
+
set initp [ttrace::getentry load $entry]
|
| 518 |
+
append res "::load {} $initp" \n
|
| 519 |
+
}
|
| 520 |
+
return $res
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
#
|
| 524 |
+
# Register the "namespace" trace. This will create the following key/value
|
| 525 |
+
# entry in "namespace" store:
|
| 526 |
+
#
|
| 527 |
+
# --- key ---- --- value ---
|
| 528 |
+
# ::fully::qualified::namespace 1
|
| 529 |
+
#
|
| 530 |
+
# It will also fill the "proc" store for procedures and commands imported
|
| 531 |
+
# in this namespace with following:
|
| 532 |
+
#
|
| 533 |
+
# --- key ---- --- value ---
|
| 534 |
+
# ::fully::qualified::proc [list <ns> "" ""]
|
| 535 |
+
#
|
| 536 |
+
# The <ns> is the name of the namespace where the command or procedure is
|
| 537 |
+
# imported from.
|
| 538 |
+
#
|
| 539 |
+
|
| 540 |
+
ttrace::addtrace namespace {cmdline code args} {
|
| 541 |
+
if {$code != 0} {
|
| 542 |
+
return
|
| 543 |
+
}
|
| 544 |
+
set nop [lindex $cmdline 1]
|
| 545 |
+
set cns [uplevel 1 namespace current]
|
| 546 |
+
if {$cns == "::"} {
|
| 547 |
+
set cns ""
|
| 548 |
+
}
|
| 549 |
+
switch -glob $nop {
|
| 550 |
+
eva* {
|
| 551 |
+
set nsp [lindex $cmdline 2]
|
| 552 |
+
if {![string match "::*" $nsp]} {
|
| 553 |
+
set nsp ${cns}::$nsp
|
| 554 |
+
}
|
| 555 |
+
ttrace::addentry namespace $nsp 1
|
| 556 |
+
}
|
| 557 |
+
imp* {
|
| 558 |
+
# - parse import arguments (skip opt "-force")
|
| 559 |
+
set opts [lrange $cmdline 2 end]
|
| 560 |
+
if {[string match "-fo*" [lindex $opts 0]]} {
|
| 561 |
+
set opts [lrange $cmdline 3 end]
|
| 562 |
+
}
|
| 563 |
+
# - register all imported procs and commands
|
| 564 |
+
foreach opt $opts {
|
| 565 |
+
if {![string match "::*" [::namespace qual $opt]]} {
|
| 566 |
+
set opt ${cns}::$opt
|
| 567 |
+
}
|
| 568 |
+
# - first import procs
|
| 569 |
+
foreach entry [ttrace::getentries proc $opt] {
|
| 570 |
+
set cmd ${cns}::[::namespace tail $entry]
|
| 571 |
+
set nsp [::namespace qual $entry]
|
| 572 |
+
set done($cmd) 1
|
| 573 |
+
set entry [list 0 $nsp "" ""]
|
| 574 |
+
ttrace::addentry proc $cmd $entry
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
# - then import commands
|
| 578 |
+
foreach entry [info commands $opt] {
|
| 579 |
+
set cmd ${cns}::[::namespace tail $entry]
|
| 580 |
+
set nsp [::namespace qual $entry]
|
| 581 |
+
if {[info exists done($cmd)] == 0} {
|
| 582 |
+
set entry [list 0 $nsp "" ""]
|
| 583 |
+
ttrace::addentry proc $cmd $entry
|
| 584 |
+
}
|
| 585 |
+
}
|
| 586 |
+
}
|
| 587 |
+
}
|
| 588 |
+
}
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
ttrace::addscript namespace {
|
| 592 |
+
append res \n
|
| 593 |
+
foreach entry [ttrace::getentries namespace] {
|
| 594 |
+
append res "::namespace eval $entry {}" \n
|
| 595 |
+
}
|
| 596 |
+
return $res
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
#
|
| 600 |
+
# Register the "variable" trace. This will create the following key/value
|
| 601 |
+
# entry in the "variable" store:
|
| 602 |
+
#
|
| 603 |
+
# --- key ---- --- value ---
|
| 604 |
+
# ::fully::qualified::variable 1
|
| 605 |
+
#
|
| 606 |
+
# The variable value itself is ignored at the time of
|
| 607 |
+
# trace/collection. Instead, we take the real value at the time of script
|
| 608 |
+
# generation.
|
| 609 |
+
#
|
| 610 |
+
|
| 611 |
+
ttrace::addtrace variable {cmdline code args} {
|
| 612 |
+
if {$code != 0} {
|
| 613 |
+
return
|
| 614 |
+
}
|
| 615 |
+
set opts [lrange $cmdline 1 end]
|
| 616 |
+
if {[llength $opts]} {
|
| 617 |
+
set cns [uplevel 1 namespace current]
|
| 618 |
+
if {$cns == "::"} {
|
| 619 |
+
set cns ""
|
| 620 |
+
}
|
| 621 |
+
foreach {var val} $opts {
|
| 622 |
+
if {![string match "::*" $var]} {
|
| 623 |
+
set var ${cns}::$var
|
| 624 |
+
}
|
| 625 |
+
ttrace::addentry variable $var 1
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
ttrace::addscript variable {
|
| 631 |
+
append res \n
|
| 632 |
+
foreach entry [ttrace::getentries variable] {
|
| 633 |
+
set cns [namespace qual $entry]
|
| 634 |
+
set var [namespace tail $entry]
|
| 635 |
+
append res "::namespace eval $cns {" \n
|
| 636 |
+
append res "::variable $var"
|
| 637 |
+
if {[array exists $entry]} {
|
| 638 |
+
append res "\n::array set $var [list [array get $entry]]" \n
|
| 639 |
+
} elseif {[info exists $entry]} {
|
| 640 |
+
append res " [list [set $entry]]" \n
|
| 641 |
+
} else {
|
| 642 |
+
append res \n
|
| 643 |
+
}
|
| 644 |
+
append res "}" \n
|
| 645 |
+
}
|
| 646 |
+
return $res
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
|
| 650 |
+
#
|
| 651 |
+
# Register the "rename" trace. It will create the following key/value pair
|
| 652 |
+
# in "rename" store:
|
| 653 |
+
#
|
| 654 |
+
# --- key ---- --- value ---
|
| 655 |
+
# ::fully::qualified::old ::fully::qualified::new
|
| 656 |
+
#
|
| 657 |
+
# The "new" value may be empty, for commands that have been deleted. In
|
| 658 |
+
# such cases we also remove any traced procedure definitions.
|
| 659 |
+
#
|
| 660 |
+
|
| 661 |
+
ttrace::addtrace rename {cmdline code args} {
|
| 662 |
+
if {$code != 0} {
|
| 663 |
+
return
|
| 664 |
+
}
|
| 665 |
+
set cns [uplevel 1 namespace current]
|
| 666 |
+
if {$cns == "::"} {
|
| 667 |
+
set cns ""
|
| 668 |
+
}
|
| 669 |
+
set old [lindex $cmdline 1]
|
| 670 |
+
if {![string match "::*" $old]} {
|
| 671 |
+
set old ${cns}::$old
|
| 672 |
+
}
|
| 673 |
+
set new [lindex $cmdline 2]
|
| 674 |
+
if {$new != ""} {
|
| 675 |
+
if {![string match "::*" $new]} {
|
| 676 |
+
set new ${cns}::$new
|
| 677 |
+
}
|
| 678 |
+
ttrace::addentry rename $old $new
|
| 679 |
+
} else {
|
| 680 |
+
ttrace::delentry proc $old
|
| 681 |
+
}
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
ttrace::addscript rename {
|
| 685 |
+
append res \n
|
| 686 |
+
foreach old [ttrace::getentries rename] {
|
| 687 |
+
set new [ttrace::getentry rename $old]
|
| 688 |
+
append res "::rename $old {$new}" \n
|
| 689 |
+
}
|
| 690 |
+
return $res
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
#
|
| 694 |
+
# Register the "proc" trace. This will create the following key/value pair
|
| 695 |
+
# in the "proc" store:
|
| 696 |
+
#
|
| 697 |
+
# --- key ---- --- value ---
|
| 698 |
+
# ::fully::qualified::proc [list <epoch> <ns> <arglist> <body>]
|
| 699 |
+
#
|
| 700 |
+
# The <epoch> chages anytime one (re)defines a proc. The <ns> is the
|
| 701 |
+
# namespace where the command was imported from. If empty, the <arglist>
|
| 702 |
+
# and <body> will hold the actual procedure definition. See the
|
| 703 |
+
# "namespace" tracer implementation also.
|
| 704 |
+
#
|
| 705 |
+
|
| 706 |
+
ttrace::addtrace proc {cmdline code args} {
|
| 707 |
+
if {$code != 0} {
|
| 708 |
+
return
|
| 709 |
+
}
|
| 710 |
+
set cns [uplevel 1 namespace current]
|
| 711 |
+
if {$cns == "::"} {
|
| 712 |
+
set cns ""
|
| 713 |
+
}
|
| 714 |
+
set cmd [lindex $cmdline 1]
|
| 715 |
+
if {![string match "::*" $cmd]} {
|
| 716 |
+
set cmd ${cns}::$cmd
|
| 717 |
+
}
|
| 718 |
+
set dargs [info args $cmd]
|
| 719 |
+
set pbody [info body $cmd]
|
| 720 |
+
set pargs ""
|
| 721 |
+
foreach arg $dargs {
|
| 722 |
+
if {![info default $cmd $arg def]} {
|
| 723 |
+
lappend pargs $arg
|
| 724 |
+
} else {
|
| 725 |
+
lappend pargs [list $arg $def]
|
| 726 |
+
}
|
| 727 |
+
}
|
| 728 |
+
set pdef [ttrace::getentry proc $cmd]
|
| 729 |
+
if {$pdef == ""} {
|
| 730 |
+
set epoch -1 ; # never traced before
|
| 731 |
+
} else {
|
| 732 |
+
set epoch [lindex $pdef 0]
|
| 733 |
+
}
|
| 734 |
+
ttrace::addentry proc $cmd [list [incr epoch] "" $pargs $pbody]
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
ttrace::addscript proc {
|
| 738 |
+
return {
|
| 739 |
+
if {[info command ::tcl::unknown] == ""} {
|
| 740 |
+
rename ::unknown ::tcl::unknown
|
| 741 |
+
namespace import -force ::ttrace::unknown
|
| 742 |
+
}
|
| 743 |
+
if {[info command ::tcl::info] == ""} {
|
| 744 |
+
rename ::info ::tcl::info
|
| 745 |
+
}
|
| 746 |
+
proc ::info args {
|
| 747 |
+
set cmd [lindex $args 0]
|
| 748 |
+
set hit [lsearch -glob {commands procs args default body} $cmd*]
|
| 749 |
+
if {$hit > 1} {
|
| 750 |
+
if {[catch {uplevel 1 ::tcl::info $args}]} {
|
| 751 |
+
uplevel 1 ttrace::_resolve [list [lindex $args 1]]
|
| 752 |
+
}
|
| 753 |
+
return [uplevel 1 ::tcl::info $args]
|
| 754 |
+
}
|
| 755 |
+
if {$hit == -1} {
|
| 756 |
+
return [uplevel 1 ::tcl::info $args]
|
| 757 |
+
}
|
| 758 |
+
set cns [uplevel 1 namespace current]
|
| 759 |
+
if {$cns == "::"} {
|
| 760 |
+
set cns ""
|
| 761 |
+
}
|
| 762 |
+
set pat [lindex $args 1]
|
| 763 |
+
if {![string match "::*" $pat]} {
|
| 764 |
+
set pat ${cns}::$pat
|
| 765 |
+
}
|
| 766 |
+
set fns [ttrace::getentries proc $pat]
|
| 767 |
+
if {[string match $cmd* commands]} {
|
| 768 |
+
set fns [concat $fns [ttrace::getentries xotcl $pat]]
|
| 769 |
+
}
|
| 770 |
+
foreach entry $fns {
|
| 771 |
+
if {$cns != [namespace qual $entry]} {
|
| 772 |
+
set lazy($entry) 1
|
| 773 |
+
} else {
|
| 774 |
+
set lazy([namespace tail $entry]) 1
|
| 775 |
+
}
|
| 776 |
+
}
|
| 777 |
+
foreach entry [uplevel 1 ::tcl::info $args] {
|
| 778 |
+
set lazy($entry) 1
|
| 779 |
+
}
|
| 780 |
+
array names lazy
|
| 781 |
+
}
|
| 782 |
+
}
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
#
|
| 786 |
+
# Register procedure resolver. This will try to resolve the command in the
|
| 787 |
+
# current namespace first, and if not found, in global namespace. It also
|
| 788 |
+
# handles commands imported from other namespaces.
|
| 789 |
+
#
|
| 790 |
+
|
| 791 |
+
ttrace::addresolver resolveprocs {cmd {export 0}} {
|
| 792 |
+
set cns [uplevel 1 namespace current]
|
| 793 |
+
set name [namespace tail $cmd]
|
| 794 |
+
if {$cns == "::"} {
|
| 795 |
+
set cns ""
|
| 796 |
+
}
|
| 797 |
+
if {![string match "::*" $cmd]} {
|
| 798 |
+
set ncmd ${cns}::$cmd
|
| 799 |
+
set gcmd ::$cmd
|
| 800 |
+
} else {
|
| 801 |
+
set ncmd $cmd
|
| 802 |
+
set gcmd $cmd
|
| 803 |
+
}
|
| 804 |
+
set pdef [ttrace::getentry proc $ncmd]
|
| 805 |
+
if {$pdef == ""} {
|
| 806 |
+
set pdef [ttrace::getentry proc $gcmd]
|
| 807 |
+
if {$pdef == ""} {
|
| 808 |
+
return 0
|
| 809 |
+
}
|
| 810 |
+
set cmd $gcmd
|
| 811 |
+
} else {
|
| 812 |
+
set cmd $ncmd
|
| 813 |
+
}
|
| 814 |
+
set epoch [lindex $pdef 0]
|
| 815 |
+
set pnsp [lindex $pdef 1]
|
| 816 |
+
if {$pnsp != ""} {
|
| 817 |
+
set nsp [namespace qual $cmd]
|
| 818 |
+
if {$nsp == ""} {
|
| 819 |
+
set nsp ::
|
| 820 |
+
}
|
| 821 |
+
set cmd ${pnsp}::$name
|
| 822 |
+
if {[resolveprocs $cmd 1] == 0 && [info commands $cmd] == ""} {
|
| 823 |
+
return 0
|
| 824 |
+
}
|
| 825 |
+
namespace eval $nsp "namespace import -force $cmd"
|
| 826 |
+
} else {
|
| 827 |
+
uplevel 0 [list ::proc $cmd [lindex $pdef 2] [lindex $pdef 3]]
|
| 828 |
+
if {$export} {
|
| 829 |
+
set nsp [namespace qual $cmd]
|
| 830 |
+
if {$nsp == ""} {
|
| 831 |
+
set nsp ::
|
| 832 |
+
}
|
| 833 |
+
namespace eval $nsp "namespace export $name"
|
| 834 |
+
}
|
| 835 |
+
}
|
| 836 |
+
variable resolveproc
|
| 837 |
+
set resolveproc($cmd) $epoch
|
| 838 |
+
return 1
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
#
|
| 842 |
+
# For XOTcl, the entire item introspection/tracing is delegated to XOTcl
|
| 843 |
+
# itself. The xotcl store is filled with this:
|
| 844 |
+
#
|
| 845 |
+
# --- key ---- --- value ---
|
| 846 |
+
# ::fully::qualified::item <body>
|
| 847 |
+
#
|
| 848 |
+
# The <body> is the script used to generate the entire item (class,
|
| 849 |
+
# object). Note that we do not fill in this during code tracing. It is
|
| 850 |
+
# done during the script generation. In this step, only the placeholder is
|
| 851 |
+
# set.
|
| 852 |
+
#
|
| 853 |
+
# NOTE: we assume all XOTcl commands are imported in global namespace
|
| 854 |
+
#
|
| 855 |
+
|
| 856 |
+
ttrace::atenable XOTclEnabler {args} {
|
| 857 |
+
if {[info commands ::xotcl::Class] == ""} {
|
| 858 |
+
return
|
| 859 |
+
}
|
| 860 |
+
if {[info commands ::xotcl::_creator] == ""} {
|
| 861 |
+
::xotcl::Class create ::xotcl::_creator -instproc create {args} {
|
| 862 |
+
set result [next]
|
| 863 |
+
if {![string match ::xotcl::_* $result]} {
|
| 864 |
+
ttrace::addentry xotcl $result ""
|
| 865 |
+
}
|
| 866 |
+
return $result
|
| 867 |
+
}
|
| 868 |
+
}
|
| 869 |
+
::xotcl::Class instmixin ::xotcl::_creator
|
| 870 |
+
}
|
| 871 |
+
|
| 872 |
+
ttrace::atdisable XOTclDisabler {args} {
|
| 873 |
+
if { [info commands ::xotcl::Class] == ""
|
| 874 |
+
|| [info commands ::xotcl::_creator] == ""} {
|
| 875 |
+
return
|
| 876 |
+
}
|
| 877 |
+
::xotcl::Class instmixin ""
|
| 878 |
+
::xotcl::_creator destroy
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
set resolver [ttrace::addresolver resolveclasses {classname} {
|
| 882 |
+
set cns [uplevel 1 namespace current]
|
| 883 |
+
set script [ttrace::getentry xotcl $classname]
|
| 884 |
+
if {$script == ""} {
|
| 885 |
+
set name [namespace tail $classname]
|
| 886 |
+
if {$cns == "::"} {
|
| 887 |
+
set script [ttrace::getentry xotcl ::$name]
|
| 888 |
+
} else {
|
| 889 |
+
set script [ttrace::getentry xotcl ${cns}::$name]
|
| 890 |
+
if {$script == ""} {
|
| 891 |
+
set script [ttrace::getentry xotcl ::$name]
|
| 892 |
+
}
|
| 893 |
+
}
|
| 894 |
+
if {$script == ""} {
|
| 895 |
+
return 0
|
| 896 |
+
}
|
| 897 |
+
}
|
| 898 |
+
uplevel 1 [list namespace eval $cns $script]
|
| 899 |
+
return 1
|
| 900 |
+
}]
|
| 901 |
+
|
| 902 |
+
ttrace::addscript xotcl [subst -nocommands {
|
| 903 |
+
if {![catch {Serializer new} ss]} {
|
| 904 |
+
foreach entry [ttrace::getentries xotcl] {
|
| 905 |
+
if {[ttrace::getentry xotcl \$entry] == ""} {
|
| 906 |
+
ttrace::addentry xotcl \$entry [\$ss serialize \$entry]
|
| 907 |
+
}
|
| 908 |
+
}
|
| 909 |
+
\$ss destroy
|
| 910 |
+
return {::xotcl::Class proc __unknown name {$resolver \$name}}
|
| 911 |
+
}
|
| 912 |
+
}]
|
| 913 |
+
|
| 914 |
+
#
|
| 915 |
+
# Register callback to be called on cleanup. This will trash lazily loaded
|
| 916 |
+
# procs which have changed since.
|
| 917 |
+
#
|
| 918 |
+
|
| 919 |
+
ttrace::addcleanup {
|
| 920 |
+
variable resolveproc
|
| 921 |
+
foreach cmd [array names resolveproc] {
|
| 922 |
+
set def [ttrace::getentry proc $cmd]
|
| 923 |
+
if {$def != ""} {
|
| 924 |
+
set new [lindex $def 0]
|
| 925 |
+
set old $resolveproc($cmd)
|
| 926 |
+
if {[info command $cmd] != "" && $new != $old} {
|
| 927 |
+
catch {rename $cmd ""}
|
| 928 |
+
}
|
| 929 |
+
}
|
| 930 |
+
}
|
| 931 |
+
}
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
# EOF
|
| 935 |
+
return
|
| 936 |
+
|
| 937 |
+
# Local Variables:
|
| 938 |
+
# mode: tcl
|
| 939 |
+
# fill-column: 78
|
| 940 |
+
# tab-width: 8
|
| 941 |
+
# indent-tabs-mode: nil
|
| 942 |
+
# End:
|
miniconda3/envs/active_proaction/lib/tk8.6/bgerror.tcl
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# bgerror.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Implementation of the bgerror procedure. It posts a dialog box with
|
| 4 |
+
# the error message and gives the user a chance to see a more detailed
|
| 5 |
+
# stack trace, and possible do something more interesting with that
|
| 6 |
+
# trace (like save it to a log). This is adapted from work done by
|
| 7 |
+
# Donal K. Fellows.
|
| 8 |
+
#
|
| 9 |
+
# Copyright (c) 1998-2000 by Ajuba Solutions.
|
| 10 |
+
# Copyright (c) 2007 by ActiveState Software Inc.
|
| 11 |
+
# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
|
| 12 |
+
# Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
|
| 13 |
+
|
| 14 |
+
namespace eval ::tk::dialog::error {
|
| 15 |
+
namespace import -force ::tk::msgcat::*
|
| 16 |
+
namespace export bgerror
|
| 17 |
+
option add *ErrorDialog.function.text [mc "Save To Log"] \
|
| 18 |
+
widgetDefault
|
| 19 |
+
option add *ErrorDialog.function.command [namespace code SaveToLog]
|
| 20 |
+
option add *ErrorDialog*Label.font TkCaptionFont widgetDefault
|
| 21 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 22 |
+
option add *ErrorDialog*background systemAlertBackgroundActive \
|
| 23 |
+
widgetDefault
|
| 24 |
+
option add *ErrorDialog*info.text.background \
|
| 25 |
+
systemTextBackgroundColor widgetDefault
|
| 26 |
+
option add *ErrorDialog*Button.highlightBackground \
|
| 27 |
+
systemAlertBackgroundActive widgetDefault
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
proc ::tk::dialog::error::Return {which code} {
|
| 32 |
+
variable button
|
| 33 |
+
|
| 34 |
+
.bgerrorDialog.$which state {active selected focus}
|
| 35 |
+
update idletasks
|
| 36 |
+
after 100
|
| 37 |
+
set button $code
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
proc ::tk::dialog::error::Details {} {
|
| 41 |
+
set w .bgerrorDialog
|
| 42 |
+
set caption [option get $w.function text {}]
|
| 43 |
+
set command [option get $w.function command {}]
|
| 44 |
+
if {($caption eq "") || ($command eq "")} {
|
| 45 |
+
grid forget $w.function
|
| 46 |
+
}
|
| 47 |
+
lappend command [$w.top.info.text get 1.0 end-1c]
|
| 48 |
+
$w.function configure -text $caption -command $command
|
| 49 |
+
grid $w.top.info - -sticky nsew -padx 3m -pady 3m
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
proc ::tk::dialog::error::SaveToLog {text} {
|
| 53 |
+
if {$::tcl_platform(platform) eq "windows"} {
|
| 54 |
+
set allFiles *.*
|
| 55 |
+
} else {
|
| 56 |
+
set allFiles *
|
| 57 |
+
}
|
| 58 |
+
set types [list \
|
| 59 |
+
[list [mc "Log Files"] .log] \
|
| 60 |
+
[list [mc "Text Files"] .txt] \
|
| 61 |
+
[list [mc "All Files"] $allFiles] \
|
| 62 |
+
]
|
| 63 |
+
set filename [tk_getSaveFile -title [mc "Select Log File"] \
|
| 64 |
+
-filetypes $types -defaultextension .log -parent .bgerrorDialog]
|
| 65 |
+
if {$filename ne {}} {
|
| 66 |
+
set f [open $filename w]
|
| 67 |
+
puts -nonewline $f $text
|
| 68 |
+
close $f
|
| 69 |
+
}
|
| 70 |
+
return
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
proc ::tk::dialog::error::Destroy {w} {
|
| 74 |
+
if {$w eq ".bgerrorDialog"} {
|
| 75 |
+
variable button
|
| 76 |
+
set button -1
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
proc ::tk::dialog::error::DeleteByProtocol {} {
|
| 81 |
+
variable button
|
| 82 |
+
set button 1
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
proc ::tk::dialog::error::ReturnInDetails w {
|
| 86 |
+
bind $w <Return> {}; # Remove this binding
|
| 87 |
+
$w invoke
|
| 88 |
+
return -code break
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
# ::tk::dialog::error::bgerror --
|
| 92 |
+
#
|
| 93 |
+
# This is the default version of bgerror.
|
| 94 |
+
# It tries to execute tkerror, if that fails it posts a dialog box
|
| 95 |
+
# containing the error message and gives the user a chance to ask
|
| 96 |
+
# to see a stack trace.
|
| 97 |
+
#
|
| 98 |
+
# Arguments:
|
| 99 |
+
# err - The error message.
|
| 100 |
+
#
|
| 101 |
+
proc ::tk::dialog::error::bgerror {err {flag 1}} {
|
| 102 |
+
global errorInfo
|
| 103 |
+
variable button
|
| 104 |
+
|
| 105 |
+
set info $errorInfo
|
| 106 |
+
|
| 107 |
+
set ret [catch {::tkerror $err} msg];
|
| 108 |
+
if {$ret != 1} {return -code $ret $msg}
|
| 109 |
+
|
| 110 |
+
# The application's tkerror either failed or was not found
|
| 111 |
+
# so we use the default dialog. But on Aqua we cannot display
|
| 112 |
+
# the dialog if the background error occurs in an idle task
|
| 113 |
+
# being processed inside of [NSView drawRect]. In that case
|
| 114 |
+
# we post the dialog as an after task instead.
|
| 115 |
+
set windowingsystem [tk windowingsystem]
|
| 116 |
+
if {$windowingsystem eq "aqua"} {
|
| 117 |
+
if $flag {
|
| 118 |
+
set errorInfo $info
|
| 119 |
+
after 500 [list bgerror "$err" 0]
|
| 120 |
+
return
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
set ok [mc OK]
|
| 125 |
+
# Truncate the message if it is too wide (>maxLine characters) or
|
| 126 |
+
# too tall (>4 lines). Truncation occurs at the first point at
|
| 127 |
+
# which one of those conditions is met.
|
| 128 |
+
set displayedErr ""
|
| 129 |
+
set lines 0
|
| 130 |
+
set maxLine 45
|
| 131 |
+
foreach line [split $err \n] {
|
| 132 |
+
if {[string length $line] > $maxLine} {
|
| 133 |
+
append displayedErr "[string range $line 0 $maxLine-3]..."
|
| 134 |
+
break
|
| 135 |
+
}
|
| 136 |
+
if {$lines > 4} {
|
| 137 |
+
append displayedErr "..."
|
| 138 |
+
break
|
| 139 |
+
} else {
|
| 140 |
+
append displayedErr "${line}\n"
|
| 141 |
+
}
|
| 142 |
+
incr lines
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
set title [mc "Application Error"]
|
| 146 |
+
set text [mc "Error: %1\$s" $displayedErr]
|
| 147 |
+
set buttons [list ok $ok dismiss [mc "Skip Messages"] \
|
| 148 |
+
function [mc "Details >>"]]
|
| 149 |
+
|
| 150 |
+
# 1. Create the top-level window and divide it into top
|
| 151 |
+
# and bottom parts.
|
| 152 |
+
|
| 153 |
+
set dlg .bgerrorDialog
|
| 154 |
+
set bg [ttk::style lookup . -background]
|
| 155 |
+
destroy $dlg
|
| 156 |
+
toplevel $dlg -class ErrorDialog -background $bg
|
| 157 |
+
wm withdraw $dlg
|
| 158 |
+
wm title $dlg $title
|
| 159 |
+
wm iconname $dlg ErrorDialog
|
| 160 |
+
wm protocol $dlg WM_DELETE_WINDOW [namespace code DeleteByProtocol]
|
| 161 |
+
|
| 162 |
+
if {$windowingsystem eq "aqua"} {
|
| 163 |
+
::tk::unsupported::MacWindowStyle style $dlg moveableAlert {}
|
| 164 |
+
} elseif {$windowingsystem eq "x11"} {
|
| 165 |
+
wm attributes $dlg -type dialog
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
ttk::frame $dlg.bot
|
| 169 |
+
ttk::frame $dlg.top
|
| 170 |
+
pack $dlg.bot -side bottom -fill both
|
| 171 |
+
pack $dlg.top -side top -fill both -expand 1
|
| 172 |
+
|
| 173 |
+
set W [ttk::frame $dlg.top.info]
|
| 174 |
+
text $W.text -setgrid true -height 10 -wrap char \
|
| 175 |
+
-yscrollcommand [list $W.scroll set]
|
| 176 |
+
if {$windowingsystem ne "aqua"} {
|
| 177 |
+
$W.text configure -width 40
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
ttk::scrollbar $W.scroll -command [list $W.text yview]
|
| 181 |
+
pack $W.scroll -side right -fill y
|
| 182 |
+
pack $W.text -side left -expand yes -fill both
|
| 183 |
+
$W.text insert 0.0 "$err\n$info"
|
| 184 |
+
$W.text mark set insert 0.0
|
| 185 |
+
bind $W.text <Button-1> {focus %W}
|
| 186 |
+
$W.text configure -state disabled
|
| 187 |
+
|
| 188 |
+
# 2. Fill the top part with bitmap and message
|
| 189 |
+
|
| 190 |
+
# Max-width of message is the width of the screen...
|
| 191 |
+
set wrapwidth [winfo screenwidth $dlg]
|
| 192 |
+
# ...minus the width of the icon, padding and a fudge factor for
|
| 193 |
+
# the window manager decorations and aesthetics.
|
| 194 |
+
set wrapwidth [expr {$wrapwidth-60-[winfo pixels $dlg 9m]}]
|
| 195 |
+
ttk::label $dlg.msg -justify left -text $text -wraplength $wrapwidth
|
| 196 |
+
ttk::label $dlg.bitmap -image ::tk::icons::error
|
| 197 |
+
|
| 198 |
+
grid $dlg.bitmap $dlg.msg -in $dlg.top -row 0 -padx 3m -pady 3m
|
| 199 |
+
grid configure $dlg.bitmap -sticky ne
|
| 200 |
+
grid configure $dlg.msg -sticky nsw -padx {0 3m}
|
| 201 |
+
grid rowconfigure $dlg.top 1 -weight 1
|
| 202 |
+
grid columnconfigure $dlg.top 1 -weight 1
|
| 203 |
+
|
| 204 |
+
# 3. Create a row of buttons at the bottom of the dialog.
|
| 205 |
+
|
| 206 |
+
set i 0
|
| 207 |
+
foreach {name caption} $buttons {
|
| 208 |
+
ttk::button $dlg.$name -text $caption -default normal \
|
| 209 |
+
-command [namespace code [list set button $i]]
|
| 210 |
+
grid $dlg.$name -in $dlg.bot -column $i -row 0 -sticky ew -padx 10
|
| 211 |
+
grid columnconfigure $dlg.bot $i -weight 1
|
| 212 |
+
# We boost the size of some Mac buttons for l&f
|
| 213 |
+
if {$windowingsystem eq "aqua"} {
|
| 214 |
+
if {($name eq "ok") || ($name eq "dismiss")} {
|
| 215 |
+
grid columnconfigure $dlg.bot $i -minsize 90
|
| 216 |
+
}
|
| 217 |
+
grid configure $dlg.$name -pady 7
|
| 218 |
+
}
|
| 219 |
+
incr i
|
| 220 |
+
}
|
| 221 |
+
# The "OK" button is the default for this dialog.
|
| 222 |
+
$dlg.ok configure -default active
|
| 223 |
+
|
| 224 |
+
bind $dlg <Return> [namespace code {Return ok 0}]
|
| 225 |
+
bind $dlg <Escape> [namespace code {Return dismiss 1}]
|
| 226 |
+
bind $dlg <Destroy> [namespace code {Destroy %W}]
|
| 227 |
+
bind $dlg.function <Return> [namespace code {ReturnInDetails %W}]
|
| 228 |
+
$dlg.function configure -command [namespace code Details]
|
| 229 |
+
|
| 230 |
+
# 6. Withdraw the window, then update all the geometry information
|
| 231 |
+
# so we know how big it wants to be, then center the window in the
|
| 232 |
+
# display (Motif style) and de-iconify it.
|
| 233 |
+
|
| 234 |
+
::tk::PlaceWindow $dlg
|
| 235 |
+
|
| 236 |
+
# 7. Set a grab and claim the focus too.
|
| 237 |
+
|
| 238 |
+
::tk::SetFocusGrab $dlg $dlg.ok
|
| 239 |
+
|
| 240 |
+
# 8. Ensure that we are topmost.
|
| 241 |
+
|
| 242 |
+
raise $dlg
|
| 243 |
+
if {[tk windowingsystem] eq "win32"} {
|
| 244 |
+
# Place it topmost if we aren't at the top of the stacking
|
| 245 |
+
# order to ensure that it's seen
|
| 246 |
+
if {[lindex [wm stackorder .] end] ne "$dlg"} {
|
| 247 |
+
wm attributes $dlg -topmost 1
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
# 9. Wait for the user to respond, then restore the focus and
|
| 252 |
+
# return the index of the selected button. Restore the focus
|
| 253 |
+
# before deleting the window, since otherwise the window manager
|
| 254 |
+
# may take the focus away so we can't redirect it. Finally,
|
| 255 |
+
# restore any grab that was in effect.
|
| 256 |
+
|
| 257 |
+
vwait [namespace which -variable button]
|
| 258 |
+
set copy $button; # Save a copy...
|
| 259 |
+
|
| 260 |
+
::tk::RestoreFocusGrab $dlg $dlg.ok destroy
|
| 261 |
+
|
| 262 |
+
if {$copy == 1} {
|
| 263 |
+
return -code break
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
namespace eval :: {
|
| 268 |
+
# Fool the indexer
|
| 269 |
+
proc bgerror err {}
|
| 270 |
+
rename bgerror {}
|
| 271 |
+
namespace import ::tk::dialog::error::bgerror
|
| 272 |
+
}
|
miniconda3/envs/active_proaction/lib/tk8.6/button.tcl
ADDED
|
@@ -0,0 +1,782 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# button.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file defines the default bindings for Tk label, button,
|
| 4 |
+
# checkbutton, and radiobutton widgets and provides procedures
|
| 5 |
+
# that help in implementing those bindings.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 1992-1994 The Regents of the University of California.
|
| 8 |
+
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
| 9 |
+
# Copyright (c) 2002 ActiveState Corporation.
|
| 10 |
+
#
|
| 11 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 12 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
#-------------------------------------------------------------------------
|
| 16 |
+
# The code below creates the default class bindings for buttons.
|
| 17 |
+
#-------------------------------------------------------------------------
|
| 18 |
+
|
| 19 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 20 |
+
|
| 21 |
+
bind Radiobutton <Enter> {
|
| 22 |
+
tk::ButtonEnter %W
|
| 23 |
+
}
|
| 24 |
+
bind Radiobutton <1> {
|
| 25 |
+
tk::ButtonDown %W
|
| 26 |
+
}
|
| 27 |
+
bind Radiobutton <ButtonRelease-1> {
|
| 28 |
+
tk::ButtonUp %W
|
| 29 |
+
}
|
| 30 |
+
bind Checkbutton <Enter> {
|
| 31 |
+
tk::ButtonEnter %W
|
| 32 |
+
}
|
| 33 |
+
bind Checkbutton <1> {
|
| 34 |
+
tk::ButtonDown %W
|
| 35 |
+
}
|
| 36 |
+
bind Checkbutton <ButtonRelease-1> {
|
| 37 |
+
tk::ButtonUp %W
|
| 38 |
+
}
|
| 39 |
+
bind Checkbutton <Leave> {
|
| 40 |
+
tk::ButtonLeave %W
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
if {"win32" eq [tk windowingsystem]} {
|
| 44 |
+
bind Checkbutton <equal> {
|
| 45 |
+
tk::CheckRadioInvoke %W select
|
| 46 |
+
}
|
| 47 |
+
bind Checkbutton <plus> {
|
| 48 |
+
tk::CheckRadioInvoke %W select
|
| 49 |
+
}
|
| 50 |
+
bind Checkbutton <minus> {
|
| 51 |
+
tk::CheckRadioInvoke %W deselect
|
| 52 |
+
}
|
| 53 |
+
bind Checkbutton <1> {
|
| 54 |
+
tk::CheckRadioDown %W
|
| 55 |
+
}
|
| 56 |
+
bind Checkbutton <ButtonRelease-1> {
|
| 57 |
+
tk::ButtonUp %W
|
| 58 |
+
}
|
| 59 |
+
bind Checkbutton <Enter> {
|
| 60 |
+
tk::CheckRadioEnter %W
|
| 61 |
+
}
|
| 62 |
+
bind Checkbutton <Leave> {
|
| 63 |
+
tk::ButtonLeave %W
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
bind Radiobutton <1> {
|
| 67 |
+
tk::CheckRadioDown %W
|
| 68 |
+
}
|
| 69 |
+
bind Radiobutton <ButtonRelease-1> {
|
| 70 |
+
tk::ButtonUp %W
|
| 71 |
+
}
|
| 72 |
+
bind Radiobutton <Enter> {
|
| 73 |
+
tk::CheckRadioEnter %W
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
if {"x11" eq [tk windowingsystem]} {
|
| 77 |
+
bind Checkbutton <Return> {
|
| 78 |
+
if {!$tk_strictMotif} {
|
| 79 |
+
tk::CheckInvoke %W
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
bind Radiobutton <Return> {
|
| 83 |
+
if {!$tk_strictMotif} {
|
| 84 |
+
tk::CheckRadioInvoke %W
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
bind Checkbutton <1> {
|
| 88 |
+
tk::CheckInvoke %W
|
| 89 |
+
}
|
| 90 |
+
bind Radiobutton <1> {
|
| 91 |
+
tk::CheckRadioInvoke %W
|
| 92 |
+
}
|
| 93 |
+
bind Checkbutton <Enter> {
|
| 94 |
+
tk::CheckEnter %W
|
| 95 |
+
}
|
| 96 |
+
bind Radiobutton <Enter> {
|
| 97 |
+
tk::ButtonEnter %W
|
| 98 |
+
}
|
| 99 |
+
bind Checkbutton <Leave> {
|
| 100 |
+
tk::CheckLeave %W
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
bind Button <space> {
|
| 105 |
+
tk::ButtonInvoke %W
|
| 106 |
+
}
|
| 107 |
+
bind Checkbutton <space> {
|
| 108 |
+
tk::CheckRadioInvoke %W
|
| 109 |
+
}
|
| 110 |
+
bind Radiobutton <space> {
|
| 111 |
+
tk::CheckRadioInvoke %W
|
| 112 |
+
}
|
| 113 |
+
bind Button <<Invoke>> {
|
| 114 |
+
tk::ButtonInvoke %W
|
| 115 |
+
}
|
| 116 |
+
bind Checkbutton <<Invoke>> {
|
| 117 |
+
tk::CheckRadioInvoke %W
|
| 118 |
+
}
|
| 119 |
+
bind Radiobutton <<Invoke>> {
|
| 120 |
+
tk::CheckRadioInvoke %W
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
bind Button <FocusIn> {}
|
| 124 |
+
bind Button <Enter> {
|
| 125 |
+
tk::ButtonEnter %W
|
| 126 |
+
}
|
| 127 |
+
bind Button <Leave> {
|
| 128 |
+
tk::ButtonLeave %W
|
| 129 |
+
}
|
| 130 |
+
bind Button <1> {
|
| 131 |
+
tk::ButtonDown %W
|
| 132 |
+
}
|
| 133 |
+
bind Button <ButtonRelease-1> {
|
| 134 |
+
tk::ButtonUp %W
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
bind Checkbutton <FocusIn> {}
|
| 138 |
+
|
| 139 |
+
bind Radiobutton <FocusIn> {}
|
| 140 |
+
bind Radiobutton <Leave> {
|
| 141 |
+
tk::ButtonLeave %W
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
if {"win32" eq [tk windowingsystem]} {
|
| 145 |
+
|
| 146 |
+
#########################
|
| 147 |
+
# Windows implementation
|
| 148 |
+
#########################
|
| 149 |
+
|
| 150 |
+
# ::tk::ButtonEnter --
|
| 151 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 152 |
+
# button widget. It records the button we're in and changes the
|
| 153 |
+
# state of the button to active unless the button is disabled.
|
| 154 |
+
#
|
| 155 |
+
# Arguments:
|
| 156 |
+
# w - The name of the widget.
|
| 157 |
+
|
| 158 |
+
proc ::tk::ButtonEnter w {
|
| 159 |
+
variable ::tk::Priv
|
| 160 |
+
if {[$w cget -state] ne "disabled"} {
|
| 161 |
+
|
| 162 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 163 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 164 |
+
|
| 165 |
+
set Priv($w,relief) [$w cget -relief]
|
| 166 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 167 |
+
$w configure -relief sunken -state active
|
| 168 |
+
set Priv($w,prelief) sunken
|
| 169 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 170 |
+
$w configure -relief $over
|
| 171 |
+
set Priv($w,prelief) $over
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
set Priv(window) $w
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
# ::tk::ButtonLeave --
|
| 178 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 179 |
+
# button widget. It changes the state of the button back to inactive.
|
| 180 |
+
# Restore any modified relief too.
|
| 181 |
+
#
|
| 182 |
+
# Arguments:
|
| 183 |
+
# w - The name of the widget.
|
| 184 |
+
|
| 185 |
+
proc ::tk::ButtonLeave w {
|
| 186 |
+
variable ::tk::Priv
|
| 187 |
+
if {[$w cget -state] ne "disabled"} {
|
| 188 |
+
$w configure -state normal
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
# Restore the original button relief if it was changed by Tk.
|
| 192 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 193 |
+
|
| 194 |
+
if {[info exists Priv($w,relief)]} {
|
| 195 |
+
if {[info exists Priv($w,prelief)] && \
|
| 196 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 197 |
+
$w configure -relief $Priv($w,relief)
|
| 198 |
+
}
|
| 199 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
set Priv(window) ""
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
# ::tk::ButtonDown --
|
| 206 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 207 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 208 |
+
# saves the button's relief so it can be restored later, and changes
|
| 209 |
+
# the relief to sunken.
|
| 210 |
+
#
|
| 211 |
+
# Arguments:
|
| 212 |
+
# w - The name of the widget.
|
| 213 |
+
|
| 214 |
+
proc ::tk::ButtonDown w {
|
| 215 |
+
variable ::tk::Priv
|
| 216 |
+
|
| 217 |
+
# Only save the button's relief if it does not yet exist. If there
|
| 218 |
+
# is an overrelief setting, Priv($w,relief) will already have been set,
|
| 219 |
+
# and the current value of the -relief option will be incorrect.
|
| 220 |
+
|
| 221 |
+
if {![info exists Priv($w,relief)]} {
|
| 222 |
+
set Priv($w,relief) [$w cget -relief]
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
if {[$w cget -state] ne "disabled"} {
|
| 226 |
+
set Priv(buttonWindow) $w
|
| 227 |
+
$w configure -relief sunken -state active
|
| 228 |
+
set Priv($w,prelief) sunken
|
| 229 |
+
|
| 230 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 231 |
+
after cancel $Priv(afterId)
|
| 232 |
+
set delay [$w cget -repeatdelay]
|
| 233 |
+
set Priv(repeated) 0
|
| 234 |
+
if {$delay > 0} {
|
| 235 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
# ::tk::ButtonUp --
|
| 241 |
+
# The procedure below is invoked when the mouse button is released
|
| 242 |
+
# in a button widget. It restores the button's relief and invokes
|
| 243 |
+
# the command as long as the mouse hasn't left the button.
|
| 244 |
+
#
|
| 245 |
+
# Arguments:
|
| 246 |
+
# w - The name of the widget.
|
| 247 |
+
|
| 248 |
+
proc ::tk::ButtonUp w {
|
| 249 |
+
variable ::tk::Priv
|
| 250 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 251 |
+
set Priv(buttonWindow) ""
|
| 252 |
+
|
| 253 |
+
# Restore the button's relief if it was cached.
|
| 254 |
+
|
| 255 |
+
if {[info exists Priv($w,relief)]} {
|
| 256 |
+
if {[info exists Priv($w,prelief)] && \
|
| 257 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 258 |
+
$w configure -relief $Priv($w,relief)
|
| 259 |
+
}
|
| 260 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
# Clean up the after event from the auto-repeater
|
| 264 |
+
after cancel $Priv(afterId)
|
| 265 |
+
|
| 266 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 267 |
+
$w configure -state normal
|
| 268 |
+
|
| 269 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 270 |
+
# auto-repeater functionality
|
| 271 |
+
if { $Priv(repeated) == 0 } {
|
| 272 |
+
uplevel #0 [list $w invoke]
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
# ::tk::CheckRadioEnter --
|
| 279 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 280 |
+
# checkbutton or radiobutton widget. It records the button we're in
|
| 281 |
+
# and changes the state of the button to active unless the button is
|
| 282 |
+
# disabled.
|
| 283 |
+
#
|
| 284 |
+
# Arguments:
|
| 285 |
+
# w - The name of the widget.
|
| 286 |
+
|
| 287 |
+
proc ::tk::CheckRadioEnter w {
|
| 288 |
+
variable ::tk::Priv
|
| 289 |
+
if {[$w cget -state] ne "disabled"} {
|
| 290 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 291 |
+
$w configure -state active
|
| 292 |
+
}
|
| 293 |
+
if {[set over [$w cget -overrelief]] ne ""} {
|
| 294 |
+
set Priv($w,relief) [$w cget -relief]
|
| 295 |
+
set Priv($w,prelief) $over
|
| 296 |
+
$w configure -relief $over
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
set Priv(window) $w
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
# ::tk::CheckRadioDown --
|
| 303 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 304 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 305 |
+
# saves the button's relief so it can be restored later, and changes
|
| 306 |
+
# the relief to sunken.
|
| 307 |
+
#
|
| 308 |
+
# Arguments:
|
| 309 |
+
# w - The name of the widget.
|
| 310 |
+
|
| 311 |
+
proc ::tk::CheckRadioDown w {
|
| 312 |
+
variable ::tk::Priv
|
| 313 |
+
if {![info exists Priv($w,relief)]} {
|
| 314 |
+
set Priv($w,relief) [$w cget -relief]
|
| 315 |
+
}
|
| 316 |
+
if {[$w cget -state] ne "disabled"} {
|
| 317 |
+
set Priv(buttonWindow) $w
|
| 318 |
+
set Priv(repeated) 0
|
| 319 |
+
$w configure -state active
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
if {"x11" eq [tk windowingsystem]} {
|
| 326 |
+
|
| 327 |
+
#####################
|
| 328 |
+
# Unix implementation
|
| 329 |
+
#####################
|
| 330 |
+
|
| 331 |
+
# ::tk::ButtonEnter --
|
| 332 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 333 |
+
# button widget. It records the button we're in and changes the
|
| 334 |
+
# state of the button to active unless the button is disabled.
|
| 335 |
+
#
|
| 336 |
+
# Arguments:
|
| 337 |
+
# w - The name of the widget.
|
| 338 |
+
|
| 339 |
+
proc ::tk::ButtonEnter {w} {
|
| 340 |
+
variable ::tk::Priv
|
| 341 |
+
if {[$w cget -state] ne "disabled"} {
|
| 342 |
+
# On unix the state is active just with mouse-over
|
| 343 |
+
$w configure -state active
|
| 344 |
+
|
| 345 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 346 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 347 |
+
|
| 348 |
+
set Priv($w,relief) [$w cget -relief]
|
| 349 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 350 |
+
$w configure -relief sunken
|
| 351 |
+
set Priv($w,prelief) sunken
|
| 352 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 353 |
+
$w configure -relief $over
|
| 354 |
+
set Priv($w,prelief) $over
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
set Priv(window) $w
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
# ::tk::ButtonLeave --
|
| 361 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 362 |
+
# button widget. It changes the state of the button back to inactive.
|
| 363 |
+
# Restore any modified relief too.
|
| 364 |
+
#
|
| 365 |
+
# Arguments:
|
| 366 |
+
# w - The name of the widget.
|
| 367 |
+
|
| 368 |
+
proc ::tk::ButtonLeave w {
|
| 369 |
+
variable ::tk::Priv
|
| 370 |
+
if {[$w cget -state] ne "disabled"} {
|
| 371 |
+
$w configure -state normal
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
# Restore the original button relief if it was changed by Tk.
|
| 375 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 376 |
+
|
| 377 |
+
if {[info exists Priv($w,relief)]} {
|
| 378 |
+
if {[info exists Priv($w,prelief)] && \
|
| 379 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 380 |
+
$w configure -relief $Priv($w,relief)
|
| 381 |
+
}
|
| 382 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
set Priv(window) ""
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
# ::tk::ButtonDown --
|
| 389 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 390 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 391 |
+
# saves the button's relief so it can be restored later, and changes
|
| 392 |
+
# the relief to sunken.
|
| 393 |
+
#
|
| 394 |
+
# Arguments:
|
| 395 |
+
# w - The name of the widget.
|
| 396 |
+
|
| 397 |
+
proc ::tk::ButtonDown w {
|
| 398 |
+
variable ::tk::Priv
|
| 399 |
+
|
| 400 |
+
# Only save the button's relief if it does not yet exist. If there
|
| 401 |
+
# is an overrelief setting, Priv($w,relief) will already have been set,
|
| 402 |
+
# and the current value of the -relief option will be incorrect.
|
| 403 |
+
|
| 404 |
+
if {![info exists Priv($w,relief)]} {
|
| 405 |
+
set Priv($w,relief) [$w cget -relief]
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
if {[$w cget -state] ne "disabled"} {
|
| 409 |
+
set Priv(buttonWindow) $w
|
| 410 |
+
$w configure -relief sunken
|
| 411 |
+
set Priv($w,prelief) sunken
|
| 412 |
+
|
| 413 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 414 |
+
after cancel $Priv(afterId)
|
| 415 |
+
set delay [$w cget -repeatdelay]
|
| 416 |
+
set Priv(repeated) 0
|
| 417 |
+
if {$delay > 0} {
|
| 418 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
# ::tk::ButtonUp --
|
| 424 |
+
# The procedure below is invoked when the mouse button is released
|
| 425 |
+
# in a button widget. It restores the button's relief and invokes
|
| 426 |
+
# the command as long as the mouse hasn't left the button.
|
| 427 |
+
#
|
| 428 |
+
# Arguments:
|
| 429 |
+
# w - The name of the widget.
|
| 430 |
+
|
| 431 |
+
proc ::tk::ButtonUp w {
|
| 432 |
+
variable ::tk::Priv
|
| 433 |
+
if {$w eq $Priv(buttonWindow)} {
|
| 434 |
+
set Priv(buttonWindow) ""
|
| 435 |
+
|
| 436 |
+
# Restore the button's relief if it was cached.
|
| 437 |
+
|
| 438 |
+
if {[info exists Priv($w,relief)]} {
|
| 439 |
+
if {[info exists Priv($w,prelief)] && \
|
| 440 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 441 |
+
$w configure -relief $Priv($w,relief)
|
| 442 |
+
}
|
| 443 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
# Clean up the after event from the auto-repeater
|
| 447 |
+
after cancel $Priv(afterId)
|
| 448 |
+
|
| 449 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 450 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 451 |
+
# auto-repeater functionality
|
| 452 |
+
if { $Priv(repeated) == 0 } {
|
| 453 |
+
uplevel #0 [list $w invoke]
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 462 |
+
|
| 463 |
+
####################
|
| 464 |
+
# Mac implementation
|
| 465 |
+
####################
|
| 466 |
+
|
| 467 |
+
# ::tk::ButtonEnter --
|
| 468 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 469 |
+
# button widget. It records the button we're in and changes the
|
| 470 |
+
# state of the button to active unless the button is disabled.
|
| 471 |
+
#
|
| 472 |
+
# Arguments:
|
| 473 |
+
# w - The name of the widget.
|
| 474 |
+
|
| 475 |
+
proc ::tk::ButtonEnter {w} {
|
| 476 |
+
variable ::tk::Priv
|
| 477 |
+
if {[$w cget -state] ne "disabled"} {
|
| 478 |
+
|
| 479 |
+
# If there's an -overrelief value, set the relief to that.
|
| 480 |
+
|
| 481 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 482 |
+
$w configure -state active
|
| 483 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 484 |
+
set Priv($w,relief) [$w cget -relief]
|
| 485 |
+
set Priv($w,prelief) $over
|
| 486 |
+
$w configure -relief $over
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
set Priv(window) $w
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
# ::tk::ButtonLeave --
|
| 493 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 494 |
+
# button widget. It changes the state of the button back to
|
| 495 |
+
# inactive. If we're leaving the button window with a mouse button
|
| 496 |
+
# pressed (Priv(buttonWindow) == $w), restore the relief of the
|
| 497 |
+
# button too.
|
| 498 |
+
#
|
| 499 |
+
# Arguments:
|
| 500 |
+
# w - The name of the widget.
|
| 501 |
+
|
| 502 |
+
proc ::tk::ButtonLeave w {
|
| 503 |
+
variable ::tk::Priv
|
| 504 |
+
if {$w eq $Priv(buttonWindow)} {
|
| 505 |
+
$w configure -state normal
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
# Restore the original button relief if it was changed by Tk.
|
| 509 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 510 |
+
|
| 511 |
+
if {[info exists Priv($w,relief)]} {
|
| 512 |
+
if {[info exists Priv($w,prelief)] && \
|
| 513 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 514 |
+
$w configure -relief $Priv($w,relief)
|
| 515 |
+
}
|
| 516 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
set Priv(window) ""
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
# ::tk::ButtonDown --
|
| 523 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 524 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 525 |
+
# saves the button's relief so it can be restored later, and changes
|
| 526 |
+
# the relief to sunken.
|
| 527 |
+
#
|
| 528 |
+
# Arguments:
|
| 529 |
+
# w - The name of the widget.
|
| 530 |
+
|
| 531 |
+
proc ::tk::ButtonDown w {
|
| 532 |
+
variable ::tk::Priv
|
| 533 |
+
|
| 534 |
+
if {[$w cget -state] ne "disabled"} {
|
| 535 |
+
set Priv(buttonWindow) $w
|
| 536 |
+
$w configure -state active
|
| 537 |
+
|
| 538 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 539 |
+
after cancel $Priv(afterId)
|
| 540 |
+
set Priv(repeated) 0
|
| 541 |
+
if { ![catch {$w cget -repeatdelay} delay] } {
|
| 542 |
+
if {$delay > 0} {
|
| 543 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
# ::tk::ButtonUp --
|
| 550 |
+
# The procedure below is invoked when the mouse button is released
|
| 551 |
+
# in a button widget. It restores the button's relief and invokes
|
| 552 |
+
# the command as long as the mouse hasn't left the button.
|
| 553 |
+
#
|
| 554 |
+
# Arguments:
|
| 555 |
+
# w - The name of the widget.
|
| 556 |
+
|
| 557 |
+
proc ::tk::ButtonUp w {
|
| 558 |
+
variable ::tk::Priv
|
| 559 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 560 |
+
set Priv(buttonWindow) ""
|
| 561 |
+
$w configure -state normal
|
| 562 |
+
|
| 563 |
+
# Restore the button's relief if it was cached.
|
| 564 |
+
|
| 565 |
+
if {[info exists Priv($w,relief)]} {
|
| 566 |
+
if {[info exists Priv($w,prelief)] && \
|
| 567 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 568 |
+
$w configure -relief $Priv($w,relief)
|
| 569 |
+
}
|
| 570 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
# Clean up the after event from the auto-repeater
|
| 574 |
+
after cancel $Priv(afterId)
|
| 575 |
+
|
| 576 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 577 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 578 |
+
# auto-repeater functionality
|
| 579 |
+
if { $Priv(repeated) == 0 } {
|
| 580 |
+
uplevel #0 [list $w invoke]
|
| 581 |
+
}
|
| 582 |
+
}
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
##################
|
| 589 |
+
# Shared routines
|
| 590 |
+
##################
|
| 591 |
+
|
| 592 |
+
# ::tk::ButtonInvoke --
|
| 593 |
+
# The procedure below is called when a button is invoked through
|
| 594 |
+
# the keyboard. It simulate a press of the button via the mouse.
|
| 595 |
+
#
|
| 596 |
+
# Arguments:
|
| 597 |
+
# w - The name of the widget.
|
| 598 |
+
|
| 599 |
+
proc ::tk::ButtonInvoke w {
|
| 600 |
+
if {[winfo exists $w] && [$w cget -state] ne "disabled"} {
|
| 601 |
+
set oldRelief [$w cget -relief]
|
| 602 |
+
set oldState [$w cget -state]
|
| 603 |
+
$w configure -state active -relief sunken
|
| 604 |
+
after 100 [list ::tk::ButtonInvokeEnd $w $oldState $oldRelief]
|
| 605 |
+
}
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
# ::tk::ButtonInvokeEnd --
|
| 609 |
+
# The procedure below is called after a button is invoked through
|
| 610 |
+
# the keyboard. It simulate a release of the button via the mouse.
|
| 611 |
+
#
|
| 612 |
+
# Arguments:
|
| 613 |
+
# w - The name of the widget.
|
| 614 |
+
# oldState - Old state to be set back.
|
| 615 |
+
# oldRelief - Old relief to be set back.
|
| 616 |
+
|
| 617 |
+
proc ::tk::ButtonInvokeEnd {w oldState oldRelief} {
|
| 618 |
+
if {[winfo exists $w]} {
|
| 619 |
+
$w configure -state $oldState -relief $oldRelief
|
| 620 |
+
uplevel #0 [list $w invoke]
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
# ::tk::ButtonAutoInvoke --
|
| 625 |
+
#
|
| 626 |
+
# Invoke an auto-repeating button, and set it up to continue to repeat.
|
| 627 |
+
#
|
| 628 |
+
# Arguments:
|
| 629 |
+
# w button to invoke.
|
| 630 |
+
#
|
| 631 |
+
# Results:
|
| 632 |
+
# None.
|
| 633 |
+
#
|
| 634 |
+
# Side effects:
|
| 635 |
+
# May create an after event to call ::tk::ButtonAutoInvoke.
|
| 636 |
+
|
| 637 |
+
proc ::tk::ButtonAutoInvoke {w} {
|
| 638 |
+
variable ::tk::Priv
|
| 639 |
+
after cancel $Priv(afterId)
|
| 640 |
+
set delay [$w cget -repeatinterval]
|
| 641 |
+
if {$Priv(window) eq $w} {
|
| 642 |
+
incr Priv(repeated)
|
| 643 |
+
uplevel #0 [list $w invoke]
|
| 644 |
+
}
|
| 645 |
+
if {$delay > 0} {
|
| 646 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 647 |
+
}
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
# ::tk::CheckRadioInvoke --
|
| 651 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 652 |
+
# a checkbutton or radiobutton widget, or when the widget is invoked
|
| 653 |
+
# through the keyboard. It invokes the widget if it
|
| 654 |
+
# isn't disabled.
|
| 655 |
+
#
|
| 656 |
+
# Arguments:
|
| 657 |
+
# w - The name of the widget.
|
| 658 |
+
# cmd - The subcommand to invoke (one of invoke, select, or deselect).
|
| 659 |
+
|
| 660 |
+
proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
|
| 661 |
+
if {[$w cget -state] ne "disabled"} {
|
| 662 |
+
uplevel #0 [list $w $cmd]
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
# Special versions of the handlers for checkbuttons on Unix that do the magic
|
| 667 |
+
# to make things work right when the checkbutton indicator is hidden;
|
| 668 |
+
# radiobuttons don't need this complexity.
|
| 669 |
+
|
| 670 |
+
# ::tk::CheckInvoke --
|
| 671 |
+
# The procedure below invokes the checkbutton, like ButtonInvoke, but handles
|
| 672 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 673 |
+
#
|
| 674 |
+
# Arguments:
|
| 675 |
+
# w - The name of the widget.
|
| 676 |
+
|
| 677 |
+
proc ::tk::CheckInvoke {w} {
|
| 678 |
+
variable ::tk::Priv
|
| 679 |
+
if {[$w cget -state] ne "disabled"} {
|
| 680 |
+
# Additional logic to switch the "selected" colors around if necessary
|
| 681 |
+
# (when we're indicator-less).
|
| 682 |
+
|
| 683 |
+
if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
|
| 684 |
+
if {[$w cget -selectcolor] eq $Priv($w,aselectcolor)} {
|
| 685 |
+
$w configure -selectcolor $Priv($w,selectcolor)
|
| 686 |
+
} else {
|
| 687 |
+
$w configure -selectcolor $Priv($w,aselectcolor)
|
| 688 |
+
}
|
| 689 |
+
}
|
| 690 |
+
uplevel #0 [list $w invoke]
|
| 691 |
+
}
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
# ::tk::CheckEnter --
|
| 695 |
+
# The procedure below enters the checkbutton, like ButtonEnter, but handles
|
| 696 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 697 |
+
#
|
| 698 |
+
# Arguments:
|
| 699 |
+
# w - The name of the widget.
|
| 700 |
+
|
| 701 |
+
proc ::tk::CheckEnter {w} {
|
| 702 |
+
variable ::tk::Priv
|
| 703 |
+
if {[$w cget -state] ne "disabled"} {
|
| 704 |
+
# On unix the state is active just with mouse-over
|
| 705 |
+
$w configure -state active
|
| 706 |
+
|
| 707 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 708 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 709 |
+
|
| 710 |
+
set Priv($w,relief) [$w cget -relief]
|
| 711 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 712 |
+
$w configure -relief sunken
|
| 713 |
+
set Priv($w,prelief) sunken
|
| 714 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 715 |
+
$w configure -relief $over
|
| 716 |
+
set Priv($w,prelief) $over
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
# Compute what the "selected and active" color should be.
|
| 720 |
+
|
| 721 |
+
if {![$w cget -indicatoron] && [$w cget -selectcolor] ne ""} {
|
| 722 |
+
set Priv($w,selectcolor) [$w cget -selectcolor]
|
| 723 |
+
lassign [winfo rgb $w [$w cget -selectcolor]] r1 g1 b1
|
| 724 |
+
lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
|
| 725 |
+
set Priv($w,aselectcolor) \
|
| 726 |
+
[format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
|
| 727 |
+
[expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]
|
| 728 |
+
# use uplevel to work with other var resolvers
|
| 729 |
+
if {[uplevel #0 [list set [$w cget -variable]]]
|
| 730 |
+
eq [$w cget -onvalue]} {
|
| 731 |
+
$w configure -selectcolor $Priv($w,aselectcolor)
|
| 732 |
+
}
|
| 733 |
+
}
|
| 734 |
+
}
|
| 735 |
+
set Priv(window) $w
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
# ::tk::CheckLeave --
|
| 739 |
+
# The procedure below leaves the checkbutton, like ButtonLeave, but handles
|
| 740 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 741 |
+
#
|
| 742 |
+
# Arguments:
|
| 743 |
+
# w - The name of the widget.
|
| 744 |
+
|
| 745 |
+
proc ::tk::CheckLeave {w} {
|
| 746 |
+
variable ::tk::Priv
|
| 747 |
+
if {[$w cget -state] ne "disabled"} {
|
| 748 |
+
$w configure -state normal
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
# Restore the original button "selected" color; but only if the user
|
| 752 |
+
# has not changed it in the meantime.
|
| 753 |
+
|
| 754 |
+
if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
|
| 755 |
+
if {[$w cget -selectcolor] eq $Priv($w,selectcolor)
|
| 756 |
+
|| ([info exist Priv($w,aselectcolor)] &&
|
| 757 |
+
[$w cget -selectcolor] eq $Priv($w,aselectcolor))} {
|
| 758 |
+
$w configure -selectcolor $Priv($w,selectcolor)
|
| 759 |
+
}
|
| 760 |
+
}
|
| 761 |
+
unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor)
|
| 762 |
+
|
| 763 |
+
# Restore the original button relief if it was changed by Tk. That is
|
| 764 |
+
# signaled by the existence of Priv($w,prelief).
|
| 765 |
+
|
| 766 |
+
if {[info exists Priv($w,relief)]} {
|
| 767 |
+
if {[info exists Priv($w,prelief)] && \
|
| 768 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 769 |
+
$w configure -relief $Priv($w,relief)
|
| 770 |
+
}
|
| 771 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
set Priv(window) ""
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
return
|
| 778 |
+
|
| 779 |
+
# Local Variables:
|
| 780 |
+
# mode: tcl
|
| 781 |
+
# fill-column: 78
|
| 782 |
+
# End:
|
miniconda3/envs/active_proaction/lib/tk8.6/choosedir.tcl
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# choosedir.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Choose directory dialog implementation for Unix/Mac.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 1998-2000 by Scriptics Corporation.
|
| 6 |
+
# All rights reserved.
|
| 7 |
+
|
| 8 |
+
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
|
| 9 |
+
namespace eval ::tk::dialog {}
|
| 10 |
+
namespace eval ::tk::dialog::file {}
|
| 11 |
+
|
| 12 |
+
# Make the chooseDir namespace inside the dialog namespace
|
| 13 |
+
namespace eval ::tk::dialog::file::chooseDir {
|
| 14 |
+
namespace import -force ::tk::msgcat::*
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
# ::tk::dialog::file::chooseDir:: --
|
| 18 |
+
#
|
| 19 |
+
# Implements the TK directory selection dialog.
|
| 20 |
+
#
|
| 21 |
+
# Arguments:
|
| 22 |
+
# args Options parsed by the procedure.
|
| 23 |
+
#
|
| 24 |
+
proc ::tk::dialog::file::chooseDir:: {args} {
|
| 25 |
+
variable ::tk::Priv
|
| 26 |
+
set dataName __tk_choosedir
|
| 27 |
+
upvar ::tk::dialog::file::$dataName data
|
| 28 |
+
Config $dataName $args
|
| 29 |
+
|
| 30 |
+
if {$data(-parent) eq "."} {
|
| 31 |
+
set w .$dataName
|
| 32 |
+
} else {
|
| 33 |
+
set w $data(-parent).$dataName
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# (re)create the dialog box if necessary
|
| 37 |
+
#
|
| 38 |
+
if {![winfo exists $w]} {
|
| 39 |
+
::tk::dialog::file::Create $w TkChooseDir
|
| 40 |
+
} elseif {[winfo class $w] ne "TkChooseDir"} {
|
| 41 |
+
destroy $w
|
| 42 |
+
::tk::dialog::file::Create $w TkChooseDir
|
| 43 |
+
} else {
|
| 44 |
+
set data(dirMenuBtn) $w.contents.f1.menu
|
| 45 |
+
set data(dirMenu) $w.contents.f1.menu.menu
|
| 46 |
+
set data(upBtn) $w.contents.f1.up
|
| 47 |
+
set data(icons) $w.contents.icons
|
| 48 |
+
set data(ent) $w.contents.f2.ent
|
| 49 |
+
set data(okBtn) $w.contents.f2.ok
|
| 50 |
+
set data(cancelBtn) $w.contents.f2.cancel
|
| 51 |
+
set data(hiddenBtn) $w.contents.f2.hidden
|
| 52 |
+
}
|
| 53 |
+
if {$::tk::dialog::file::showHiddenBtn} {
|
| 54 |
+
$data(hiddenBtn) configure -state normal
|
| 55 |
+
grid $data(hiddenBtn)
|
| 56 |
+
} else {
|
| 57 |
+
$data(hiddenBtn) configure -state disabled
|
| 58 |
+
grid remove $data(hiddenBtn)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# When using -mustexist, manage the OK button state for validity
|
| 62 |
+
$data(okBtn) configure -state normal
|
| 63 |
+
if {$data(-mustexist)} {
|
| 64 |
+
$data(ent) configure -validate key \
|
| 65 |
+
-validatecommand [list ::tk::dialog::file::chooseDir::IsOK? $w %P]
|
| 66 |
+
} else {
|
| 67 |
+
$data(ent) configure -validate none
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
# Dialog boxes should be transient with respect to their parent,
|
| 71 |
+
# so that they will always stay on top of their parent window. However,
|
| 72 |
+
# some window managers will create the window as withdrawn if the parent
|
| 73 |
+
# window is withdrawn or iconified. Combined with the grab we put on the
|
| 74 |
+
# window, this can hang the entire application. Therefore we only make
|
| 75 |
+
# the dialog transient if the parent is viewable.
|
| 76 |
+
|
| 77 |
+
if {[winfo viewable [winfo toplevel $data(-parent)]] } {
|
| 78 |
+
wm transient $w $data(-parent)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
trace add variable data(selectPath) write \
|
| 82 |
+
[list ::tk::dialog::file::SetPath $w]
|
| 83 |
+
$data(dirMenuBtn) configure \
|
| 84 |
+
-textvariable ::tk::dialog::file::${dataName}(selectPath)
|
| 85 |
+
|
| 86 |
+
set data(filter) "*"
|
| 87 |
+
set data(previousEntryText) ""
|
| 88 |
+
::tk::dialog::file::UpdateWhenIdle $w
|
| 89 |
+
|
| 90 |
+
# Withdraw the window, then update all the geometry information
|
| 91 |
+
# so we know how big it wants to be, then center the window in the
|
| 92 |
+
# display (Motif style) and de-iconify it.
|
| 93 |
+
|
| 94 |
+
::tk::PlaceWindow $w widget $data(-parent)
|
| 95 |
+
wm title $w $data(-title)
|
| 96 |
+
|
| 97 |
+
# Set a grab and claim the focus too.
|
| 98 |
+
|
| 99 |
+
::tk::SetFocusGrab $w $data(ent)
|
| 100 |
+
$data(ent) delete 0 end
|
| 101 |
+
$data(ent) insert 0 $data(selectPath)
|
| 102 |
+
$data(ent) selection range 0 end
|
| 103 |
+
$data(ent) icursor end
|
| 104 |
+
|
| 105 |
+
# Wait for the user to respond, then restore the focus and
|
| 106 |
+
# return the index of the selected button. Restore the focus
|
| 107 |
+
# before deleting the window, since otherwise the window manager
|
| 108 |
+
# may take the focus away so we can't redirect it. Finally,
|
| 109 |
+
# restore any grab that was in effect.
|
| 110 |
+
|
| 111 |
+
vwait ::tk::Priv(selectFilePath)
|
| 112 |
+
|
| 113 |
+
::tk::RestoreFocusGrab $w $data(ent) withdraw
|
| 114 |
+
|
| 115 |
+
# Cleanup traces on selectPath variable
|
| 116 |
+
#
|
| 117 |
+
|
| 118 |
+
foreach trace [trace info variable data(selectPath)] {
|
| 119 |
+
trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
|
| 120 |
+
}
|
| 121 |
+
if {[winfo exists $data(dirMenuBtn)]} {
|
| 122 |
+
$data(dirMenuBtn) configure -textvariable {}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
# Return value to user
|
| 126 |
+
#
|
| 127 |
+
|
| 128 |
+
return $Priv(selectFilePath)
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
# ::tk::dialog::file::chooseDir::Config --
|
| 132 |
+
#
|
| 133 |
+
# Configures the Tk choosedir dialog according to the argument list
|
| 134 |
+
#
|
| 135 |
+
proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
|
| 136 |
+
upvar ::tk::dialog::file::$dataName data
|
| 137 |
+
|
| 138 |
+
# 0: Delete all variable that were set on data(selectPath) the
|
| 139 |
+
# last time the file dialog is used. The traces may cause troubles
|
| 140 |
+
# if the dialog is now used with a different -parent option.
|
| 141 |
+
#
|
| 142 |
+
foreach trace [trace info variable data(selectPath)] {
|
| 143 |
+
trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
# 1: the configuration specs
|
| 147 |
+
#
|
| 148 |
+
set specs {
|
| 149 |
+
{-mustexist "" "" 0}
|
| 150 |
+
{-initialdir "" "" ""}
|
| 151 |
+
{-parent "" "" "."}
|
| 152 |
+
{-title "" "" ""}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
# 2: default values depending on the type of the dialog
|
| 156 |
+
#
|
| 157 |
+
if {![info exists data(selectPath)]} {
|
| 158 |
+
# first time the dialog has been popped up
|
| 159 |
+
set data(selectPath) [pwd]
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
# 3: parse the arguments
|
| 163 |
+
#
|
| 164 |
+
tclParseConfigSpec ::tk::dialog::file::$dataName $specs "" $argList
|
| 165 |
+
|
| 166 |
+
if {$data(-title) eq ""} {
|
| 167 |
+
set data(-title) "[mc "Choose Directory"]"
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
# Stub out the -multiple value for the dialog; it doesn't make sense for
|
| 171 |
+
# choose directory dialogs, but we have to have something there because we
|
| 172 |
+
# share so much code with the file dialogs.
|
| 173 |
+
set data(-multiple) 0
|
| 174 |
+
|
| 175 |
+
# 4: set the default directory and selection according to the -initial
|
| 176 |
+
# settings
|
| 177 |
+
#
|
| 178 |
+
if {$data(-initialdir) ne ""} {
|
| 179 |
+
# Ensure that initialdir is an absolute path name.
|
| 180 |
+
if {[file isdirectory $data(-initialdir)]} {
|
| 181 |
+
set old [pwd]
|
| 182 |
+
cd $data(-initialdir)
|
| 183 |
+
set data(selectPath) [pwd]
|
| 184 |
+
cd $old
|
| 185 |
+
} else {
|
| 186 |
+
set data(selectPath) [pwd]
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if {![winfo exists $data(-parent)]} {
|
| 191 |
+
return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
|
| 192 |
+
"bad window path name \"$data(-parent)\""
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
# Gets called when user presses Return in the "Selection" entry or presses OK.
|
| 197 |
+
#
|
| 198 |
+
proc ::tk::dialog::file::chooseDir::OkCmd {w} {
|
| 199 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 200 |
+
|
| 201 |
+
# This is the brains behind selecting non-existant directories. Here's
|
| 202 |
+
# the flowchart:
|
| 203 |
+
# 1. If the icon list has a selection, join it with the current dir,
|
| 204 |
+
# and return that value.
|
| 205 |
+
# 1a. If the icon list does not have a selection ...
|
| 206 |
+
# 2. If the entry is empty, do nothing.
|
| 207 |
+
# 3. If the entry contains an invalid directory, then...
|
| 208 |
+
# 3a. If the value is the same as last time through here, end dialog.
|
| 209 |
+
# 3b. If the value is different than last time, save it and return.
|
| 210 |
+
# 4. If entry contains a valid directory, then...
|
| 211 |
+
# 4a. If the value is the same as the current directory, end dialog.
|
| 212 |
+
# 4b. If the value is different from the current directory, change to
|
| 213 |
+
# that directory.
|
| 214 |
+
|
| 215 |
+
set selection [$data(icons) selection get]
|
| 216 |
+
if {[llength $selection] != 0} {
|
| 217 |
+
set iconText [$data(icons) get [lindex $selection 0]]
|
| 218 |
+
set iconText [file join $data(selectPath) $iconText]
|
| 219 |
+
Done $w $iconText
|
| 220 |
+
} else {
|
| 221 |
+
set text [$data(ent) get]
|
| 222 |
+
if {$text eq ""} {
|
| 223 |
+
return
|
| 224 |
+
}
|
| 225 |
+
set text [file join {*}[file split [string trim $text]]]
|
| 226 |
+
if {![file exists $text] || ![file isdirectory $text]} {
|
| 227 |
+
# Entry contains an invalid directory. If it's the same as the
|
| 228 |
+
# last time they came through here, reset the saved value and end
|
| 229 |
+
# the dialog. Otherwise, save the value (so we can do this test
|
| 230 |
+
# next time).
|
| 231 |
+
if {$text eq $data(previousEntryText)} {
|
| 232 |
+
set data(previousEntryText) ""
|
| 233 |
+
Done $w $text
|
| 234 |
+
} else {
|
| 235 |
+
set data(previousEntryText) $text
|
| 236 |
+
}
|
| 237 |
+
} else {
|
| 238 |
+
# Entry contains a valid directory. If it is the same as the
|
| 239 |
+
# current directory, end the dialog. Otherwise, change to that
|
| 240 |
+
# directory.
|
| 241 |
+
if {$text eq $data(selectPath)} {
|
| 242 |
+
Done $w $text
|
| 243 |
+
} else {
|
| 244 |
+
set data(selectPath) $text
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
return
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
# Change state of OK button to match -mustexist correctness of entry
|
| 252 |
+
#
|
| 253 |
+
proc ::tk::dialog::file::chooseDir::IsOK? {w text} {
|
| 254 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 255 |
+
|
| 256 |
+
set ok [file isdirectory $text]
|
| 257 |
+
$data(okBtn) configure -state [expr {$ok ? "normal" : "disabled"}]
|
| 258 |
+
|
| 259 |
+
# always return 1
|
| 260 |
+
return 1
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
proc ::tk::dialog::file::chooseDir::DblClick {w} {
|
| 264 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 265 |
+
set selection [$data(icons) selection get]
|
| 266 |
+
if {[llength $selection] != 0} {
|
| 267 |
+
set filenameFragment [$data(icons) get [lindex $selection 0]]
|
| 268 |
+
set file $data(selectPath)
|
| 269 |
+
if {[file isdirectory $file]} {
|
| 270 |
+
::tk::dialog::file::ListInvoke $w [list $filenameFragment]
|
| 271 |
+
return
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
# Gets called when user browses the IconList widget (dragging mouse, arrow
|
| 277 |
+
# keys, etc)
|
| 278 |
+
#
|
| 279 |
+
proc ::tk::dialog::file::chooseDir::ListBrowse {w text} {
|
| 280 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 281 |
+
|
| 282 |
+
if {$text eq ""} {
|
| 283 |
+
return
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
set file [::tk::dialog::file::JoinFile $data(selectPath) $text]
|
| 287 |
+
$data(ent) delete 0 end
|
| 288 |
+
$data(ent) insert 0 $file
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
# ::tk::dialog::file::chooseDir::Done --
|
| 292 |
+
#
|
| 293 |
+
# Gets called when user has input a valid filename. Pops up a
|
| 294 |
+
# dialog box to confirm selection when necessary. Sets the
|
| 295 |
+
# Priv(selectFilePath) variable, which will break the "vwait"
|
| 296 |
+
# loop in tk_chooseDirectory and return the selected filename to the
|
| 297 |
+
# script that calls tk_getOpenFile or tk_getSaveFile
|
| 298 |
+
#
|
| 299 |
+
proc ::tk::dialog::file::chooseDir::Done {w {selectFilePath ""}} {
|
| 300 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 301 |
+
variable ::tk::Priv
|
| 302 |
+
|
| 303 |
+
if {$selectFilePath eq ""} {
|
| 304 |
+
set selectFilePath $data(selectPath)
|
| 305 |
+
}
|
| 306 |
+
if {$data(-mustexist) && ![file isdirectory $selectFilePath]} {
|
| 307 |
+
return
|
| 308 |
+
}
|
| 309 |
+
set Priv(selectFilePath) $selectFilePath
|
| 310 |
+
}
|
miniconda3/envs/active_proaction/lib/tk8.6/clrpick.tcl
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# clrpick.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Color selection dialog for platforms that do not support a
|
| 4 |
+
# standard color selection dialog.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1996 Sun Microsystems, Inc.
|
| 7 |
+
#
|
| 8 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 9 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 10 |
+
#
|
| 11 |
+
# ToDo:
|
| 12 |
+
#
|
| 13 |
+
# (1): Find out how many free colors are left in the colormap and
|
| 14 |
+
# don't allocate too many colors.
|
| 15 |
+
# (2): Implement HSV color selection.
|
| 16 |
+
#
|
| 17 |
+
|
| 18 |
+
# Make sure namespaces exist
|
| 19 |
+
namespace eval ::tk {}
|
| 20 |
+
namespace eval ::tk::dialog {}
|
| 21 |
+
namespace eval ::tk::dialog::color {
|
| 22 |
+
namespace import ::tk::msgcat::*
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
# ::tk::dialog::color:: --
|
| 26 |
+
#
|
| 27 |
+
# Create a color dialog and let the user choose a color. This function
|
| 28 |
+
# should not be called directly. It is called by the tk_chooseColor
|
| 29 |
+
# function when a native color selector widget does not exist
|
| 30 |
+
#
|
| 31 |
+
proc ::tk::dialog::color:: {args} {
|
| 32 |
+
variable ::tk::Priv
|
| 33 |
+
set dataName __tk__color
|
| 34 |
+
upvar ::tk::dialog::color::$dataName data
|
| 35 |
+
set w .$dataName
|
| 36 |
+
|
| 37 |
+
# The lines variables track the start and end indices of the line
|
| 38 |
+
# elements in the colorbar canvases.
|
| 39 |
+
set data(lines,red,start) 0
|
| 40 |
+
set data(lines,red,last) -1
|
| 41 |
+
set data(lines,green,start) 0
|
| 42 |
+
set data(lines,green,last) -1
|
| 43 |
+
set data(lines,blue,start) 0
|
| 44 |
+
set data(lines,blue,last) -1
|
| 45 |
+
|
| 46 |
+
# This is the actual number of lines that are drawn in each color strip.
|
| 47 |
+
# Note that the bars may be of any width.
|
| 48 |
+
# However, NUM_COLORBARS must be a number that evenly divides 256.
|
| 49 |
+
# Such as 256, 128, 64, etc.
|
| 50 |
+
set data(NUM_COLORBARS) 16
|
| 51 |
+
|
| 52 |
+
# BARS_WIDTH is the number of pixels wide the color bar portion of the
|
| 53 |
+
# canvas is. This number must be a multiple of NUM_COLORBARS
|
| 54 |
+
set data(BARS_WIDTH) 160
|
| 55 |
+
|
| 56 |
+
# PLGN_WIDTH is the number of pixels wide of the triangular selection
|
| 57 |
+
# polygon. This also results in the definition of the padding on the
|
| 58 |
+
# left and right sides which is half of PLGN_WIDTH. Make this number even.
|
| 59 |
+
set data(PLGN_HEIGHT) 10
|
| 60 |
+
|
| 61 |
+
# PLGN_HEIGHT is the height of the selection polygon and the height of the
|
| 62 |
+
# selection rectangle at the bottom of the color bar. No restrictions.
|
| 63 |
+
set data(PLGN_WIDTH) 10
|
| 64 |
+
|
| 65 |
+
Config $dataName $args
|
| 66 |
+
InitValues $dataName
|
| 67 |
+
|
| 68 |
+
set sc [winfo screen $data(-parent)]
|
| 69 |
+
set winExists [winfo exists $w]
|
| 70 |
+
if {!$winExists || $sc ne [winfo screen $w]} {
|
| 71 |
+
if {$winExists} {
|
| 72 |
+
destroy $w
|
| 73 |
+
}
|
| 74 |
+
toplevel $w -class TkColorDialog -screen $sc
|
| 75 |
+
if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
|
| 76 |
+
BuildDialog $w
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
# Dialog boxes should be transient with respect to their parent,
|
| 80 |
+
# so that they will always stay on top of their parent window. However,
|
| 81 |
+
# some window managers will create the window as withdrawn if the parent
|
| 82 |
+
# window is withdrawn or iconified. Combined with the grab we put on the
|
| 83 |
+
# window, this can hang the entire application. Therefore we only make
|
| 84 |
+
# the dialog transient if the parent is viewable.
|
| 85 |
+
|
| 86 |
+
if {[winfo viewable [winfo toplevel $data(-parent)]] } {
|
| 87 |
+
wm transient $w $data(-parent)
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
# 5. Withdraw the window, then update all the geometry information
|
| 91 |
+
# so we know how big it wants to be, then center the window in the
|
| 92 |
+
# display (Motif style) and de-iconify it.
|
| 93 |
+
|
| 94 |
+
::tk::PlaceWindow $w widget $data(-parent)
|
| 95 |
+
wm title $w $data(-title)
|
| 96 |
+
|
| 97 |
+
# 6. Set a grab and claim the focus too.
|
| 98 |
+
|
| 99 |
+
::tk::SetFocusGrab $w $data(okBtn)
|
| 100 |
+
|
| 101 |
+
# 7. Wait for the user to respond, then restore the focus and
|
| 102 |
+
# return the index of the selected button. Restore the focus
|
| 103 |
+
# before deleting the window, since otherwise the window manager
|
| 104 |
+
# may take the focus away so we can't redirect it. Finally,
|
| 105 |
+
# restore any grab that was in effect.
|
| 106 |
+
|
| 107 |
+
vwait ::tk::Priv(selectColor)
|
| 108 |
+
set result $Priv(selectColor)
|
| 109 |
+
::tk::RestoreFocusGrab $w $data(okBtn)
|
| 110 |
+
unset data
|
| 111 |
+
|
| 112 |
+
return $result
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
# ::tk::dialog::color::InitValues --
|
| 116 |
+
#
|
| 117 |
+
# Get called during initialization or when user resets NUM_COLORBARS
|
| 118 |
+
#
|
| 119 |
+
proc ::tk::dialog::color::InitValues {dataName} {
|
| 120 |
+
upvar ::tk::dialog::color::$dataName data
|
| 121 |
+
|
| 122 |
+
# IntensityIncr is the difference in color intensity between a colorbar
|
| 123 |
+
# and its neighbors.
|
| 124 |
+
set data(intensityIncr) [expr {256 / $data(NUM_COLORBARS)}]
|
| 125 |
+
|
| 126 |
+
# ColorbarWidth is the width of each colorbar
|
| 127 |
+
set data(colorbarWidth) [expr {$data(BARS_WIDTH) / $data(NUM_COLORBARS)}]
|
| 128 |
+
|
| 129 |
+
# Indent is the width of the space at the left and right side of the
|
| 130 |
+
# colorbar. It is always half the selector polygon width, because the
|
| 131 |
+
# polygon extends into the space.
|
| 132 |
+
set data(indent) [expr {$data(PLGN_WIDTH) / 2}]
|
| 133 |
+
|
| 134 |
+
set data(colorPad) 2
|
| 135 |
+
set data(selPad) [expr {$data(PLGN_WIDTH) / 2}]
|
| 136 |
+
|
| 137 |
+
#
|
| 138 |
+
# minX is the x coordinate of the first colorbar
|
| 139 |
+
#
|
| 140 |
+
set data(minX) $data(indent)
|
| 141 |
+
|
| 142 |
+
#
|
| 143 |
+
# maxX is the x coordinate of the last colorbar
|
| 144 |
+
#
|
| 145 |
+
set data(maxX) [expr {$data(BARS_WIDTH) + $data(indent)-1}]
|
| 146 |
+
|
| 147 |
+
#
|
| 148 |
+
# canvasWidth is the width of the entire canvas, including the indents
|
| 149 |
+
#
|
| 150 |
+
set data(canvasWidth) [expr {$data(BARS_WIDTH) + $data(PLGN_WIDTH)}]
|
| 151 |
+
|
| 152 |
+
# Set the initial color, specified by -initialcolor, or the
|
| 153 |
+
# color chosen by the user the last time.
|
| 154 |
+
set data(selection) $data(-initialcolor)
|
| 155 |
+
set data(finalColor) $data(-initialcolor)
|
| 156 |
+
set rgb [winfo rgb . $data(selection)]
|
| 157 |
+
|
| 158 |
+
set data(red,intensity) [expr {[lindex $rgb 0]/0x100}]
|
| 159 |
+
set data(green,intensity) [expr {[lindex $rgb 1]/0x100}]
|
| 160 |
+
set data(blue,intensity) [expr {[lindex $rgb 2]/0x100}]
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
# ::tk::dialog::color::Config --
|
| 164 |
+
#
|
| 165 |
+
# Parses the command line arguments to tk_chooseColor
|
| 166 |
+
#
|
| 167 |
+
proc ::tk::dialog::color::Config {dataName argList} {
|
| 168 |
+
variable ::tk::Priv
|
| 169 |
+
upvar ::tk::dialog::color::$dataName data
|
| 170 |
+
|
| 171 |
+
# 1: the configuration specs
|
| 172 |
+
#
|
| 173 |
+
if {[info exists Priv(selectColor)] && $Priv(selectColor) ne ""} {
|
| 174 |
+
set defaultColor $Priv(selectColor)
|
| 175 |
+
} else {
|
| 176 |
+
set defaultColor [. cget -background]
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
set specs [list \
|
| 180 |
+
[list -initialcolor "" "" $defaultColor] \
|
| 181 |
+
[list -parent "" "" "."] \
|
| 182 |
+
[list -title "" "" [mc "Color"]] \
|
| 183 |
+
]
|
| 184 |
+
|
| 185 |
+
# 2: parse the arguments
|
| 186 |
+
#
|
| 187 |
+
tclParseConfigSpec ::tk::dialog::color::$dataName $specs "" $argList
|
| 188 |
+
|
| 189 |
+
if {$data(-title) eq ""} {
|
| 190 |
+
set data(-title) " "
|
| 191 |
+
}
|
| 192 |
+
if {[catch {winfo rgb . $data(-initialcolor)} err]} {
|
| 193 |
+
return -code error -errorcode [list TK LOOKUP COLOR $data(-initialcolor)] \
|
| 194 |
+
$err
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
if {![winfo exists $data(-parent)]} {
|
| 198 |
+
return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
|
| 199 |
+
"bad window path name \"$data(-parent)\""
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
# ::tk::dialog::color::BuildDialog --
|
| 204 |
+
#
|
| 205 |
+
# Build the dialog.
|
| 206 |
+
#
|
| 207 |
+
proc ::tk::dialog::color::BuildDialog {w} {
|
| 208 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 209 |
+
|
| 210 |
+
# TopFrame contains the color strips and the color selection
|
| 211 |
+
#
|
| 212 |
+
set topFrame [frame $w.top -relief raised -bd 1]
|
| 213 |
+
|
| 214 |
+
# StripsFrame contains the colorstrips and the individual RGB entries
|
| 215 |
+
set stripsFrame [frame $topFrame.colorStrip]
|
| 216 |
+
|
| 217 |
+
set maxWidth [::tk::mcmaxamp &Red &Green &Blue]
|
| 218 |
+
set maxWidth [expr {$maxWidth<6 ? 6 : $maxWidth}]
|
| 219 |
+
set colorList {
|
| 220 |
+
red "&Red"
|
| 221 |
+
green "&Green"
|
| 222 |
+
blue "&Blue"
|
| 223 |
+
}
|
| 224 |
+
foreach {color l} $colorList {
|
| 225 |
+
# each f frame contains an [R|G|B] entry and the equiv. color strip.
|
| 226 |
+
set f [frame $stripsFrame.$color]
|
| 227 |
+
|
| 228 |
+
# The box frame contains the label and entry widget for an [R|G|B]
|
| 229 |
+
set box [frame $f.box]
|
| 230 |
+
|
| 231 |
+
::tk::AmpWidget label $box.label -text "[mc $l]:" \
|
| 232 |
+
-width $maxWidth -anchor ne
|
| 233 |
+
bind $box.label <<AltUnderlined>> [list focus $box.entry]
|
| 234 |
+
|
| 235 |
+
entry $box.entry -textvariable \
|
| 236 |
+
::tk::dialog::color::[winfo name $w]($color,intensity) \
|
| 237 |
+
-width 4
|
| 238 |
+
pack $box.label -side left -fill y -padx 2 -pady 3
|
| 239 |
+
pack $box.entry -side left -anchor n -pady 0
|
| 240 |
+
pack $box -side left -fill both
|
| 241 |
+
|
| 242 |
+
set height [expr {
|
| 243 |
+
[winfo reqheight $box.entry] -
|
| 244 |
+
2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd])
|
| 245 |
+
}]
|
| 246 |
+
|
| 247 |
+
canvas $f.color -height $height \
|
| 248 |
+
-width $data(BARS_WIDTH) -relief sunken -bd 2
|
| 249 |
+
canvas $f.sel -height $data(PLGN_HEIGHT) \
|
| 250 |
+
-width $data(canvasWidth) -highlightthickness 0
|
| 251 |
+
pack $f.color -expand yes -fill both
|
| 252 |
+
pack $f.sel -expand yes -fill both
|
| 253 |
+
|
| 254 |
+
pack $f -side top -fill x -padx 0 -pady 2
|
| 255 |
+
|
| 256 |
+
set data($color,entry) $box.entry
|
| 257 |
+
set data($color,col) $f.color
|
| 258 |
+
set data($color,sel) $f.sel
|
| 259 |
+
|
| 260 |
+
bind $data($color,col) <Configure> \
|
| 261 |
+
[list tk::dialog::color::DrawColorScale $w $color 1]
|
| 262 |
+
bind $data($color,col) <Enter> \
|
| 263 |
+
[list tk::dialog::color::EnterColorBar $w $color]
|
| 264 |
+
bind $data($color,col) <Leave> \
|
| 265 |
+
[list tk::dialog::color::LeaveColorBar $w $color]
|
| 266 |
+
|
| 267 |
+
bind $data($color,sel) <Enter> \
|
| 268 |
+
[list tk::dialog::color::EnterColorBar $w $color]
|
| 269 |
+
bind $data($color,sel) <Leave> \
|
| 270 |
+
[list tk::dialog::color::LeaveColorBar $w $color]
|
| 271 |
+
|
| 272 |
+
bind $box.entry <Return> [list tk::dialog::color::HandleRGBEntry $w]
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
pack $stripsFrame -side left -fill both -padx 4 -pady 10
|
| 276 |
+
|
| 277 |
+
# The selFrame contains a frame that demonstrates the currently
|
| 278 |
+
# selected color
|
| 279 |
+
#
|
| 280 |
+
set selFrame [frame $topFrame.sel]
|
| 281 |
+
set lab [::tk::AmpWidget label $selFrame.lab \
|
| 282 |
+
-text [mc "&Selection:"] -anchor sw]
|
| 283 |
+
set ent [entry $selFrame.ent \
|
| 284 |
+
-textvariable ::tk::dialog::color::[winfo name $w](selection) \
|
| 285 |
+
-width 16]
|
| 286 |
+
set f1 [frame $selFrame.f1 -relief sunken -bd 2]
|
| 287 |
+
set data(finalCanvas) [frame $f1.demo -bd 0 -width 100 -height 70]
|
| 288 |
+
|
| 289 |
+
pack $lab $ent -side top -fill x -padx 4 -pady 2
|
| 290 |
+
pack $f1 -expand yes -anchor nw -fill both -padx 6 -pady 10
|
| 291 |
+
pack $data(finalCanvas) -expand yes -fill both
|
| 292 |
+
|
| 293 |
+
bind $ent <Return> [list tk::dialog::color::HandleSelEntry $w]
|
| 294 |
+
|
| 295 |
+
pack $selFrame -side left -fill none -anchor nw
|
| 296 |
+
pack $topFrame -side top -expand yes -fill both -anchor nw
|
| 297 |
+
|
| 298 |
+
# the botFrame frame contains the buttons
|
| 299 |
+
#
|
| 300 |
+
set botFrame [frame $w.bot -relief raised -bd 1]
|
| 301 |
+
|
| 302 |
+
::tk::AmpWidget button $botFrame.ok -text [mc "&OK"] \
|
| 303 |
+
-command [list tk::dialog::color::OkCmd $w]
|
| 304 |
+
::tk::AmpWidget button $botFrame.cancel -text [mc "&Cancel"] \
|
| 305 |
+
-command [list tk::dialog::color::CancelCmd $w]
|
| 306 |
+
|
| 307 |
+
set data(okBtn) $botFrame.ok
|
| 308 |
+
set data(cancelBtn) $botFrame.cancel
|
| 309 |
+
|
| 310 |
+
grid x $botFrame.ok x $botFrame.cancel x -sticky ew
|
| 311 |
+
grid configure $botFrame.ok $botFrame.cancel -padx 10 -pady 10
|
| 312 |
+
grid columnconfigure $botFrame {0 4} -weight 1 -uniform space
|
| 313 |
+
grid columnconfigure $botFrame {1 3} -weight 1 -uniform button
|
| 314 |
+
grid columnconfigure $botFrame 2 -weight 2 -uniform space
|
| 315 |
+
pack $botFrame -side bottom -fill x
|
| 316 |
+
|
| 317 |
+
# Accelerator bindings
|
| 318 |
+
bind $lab <<AltUnderlined>> [list focus $ent]
|
| 319 |
+
bind $w <Escape> [list tk::ButtonInvoke $data(cancelBtn)]
|
| 320 |
+
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
|
| 321 |
+
|
| 322 |
+
wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w]
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
# ::tk::dialog::color::SetRGBValue --
|
| 326 |
+
#
|
| 327 |
+
# Sets the current selection of the dialog box
|
| 328 |
+
#
|
| 329 |
+
proc ::tk::dialog::color::SetRGBValue {w color} {
|
| 330 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 331 |
+
|
| 332 |
+
set data(red,intensity) [lindex $color 0]
|
| 333 |
+
set data(green,intensity) [lindex $color 1]
|
| 334 |
+
set data(blue,intensity) [lindex $color 2]
|
| 335 |
+
|
| 336 |
+
RedrawColorBars $w all
|
| 337 |
+
|
| 338 |
+
# Now compute the new x value of each colorbars pointer polygon
|
| 339 |
+
foreach color {red green blue} {
|
| 340 |
+
set x [RgbToX $w $data($color,intensity)]
|
| 341 |
+
MoveSelector $w $data($color,sel) $color $x 0
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
# ::tk::dialog::color::XToRgb --
|
| 346 |
+
#
|
| 347 |
+
# Converts a screen coordinate to intensity
|
| 348 |
+
#
|
| 349 |
+
proc ::tk::dialog::color::XToRgb {w x} {
|
| 350 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 351 |
+
|
| 352 |
+
set x [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}]
|
| 353 |
+
if {$x > 255} {
|
| 354 |
+
set x 255
|
| 355 |
+
}
|
| 356 |
+
return $x
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
# ::tk::dialog::color::RgbToX
|
| 360 |
+
#
|
| 361 |
+
# Converts an intensity to screen coordinate.
|
| 362 |
+
#
|
| 363 |
+
proc ::tk::dialog::color::RgbToX {w color} {
|
| 364 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 365 |
+
|
| 366 |
+
return [expr {($color * $data(colorbarWidth)/ $data(intensityIncr))}]
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
# ::tk::dialog::color::DrawColorScale --
|
| 370 |
+
#
|
| 371 |
+
# Draw color scale is called whenever the size of one of the color
|
| 372 |
+
# scale canvases is changed.
|
| 373 |
+
#
|
| 374 |
+
proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
|
| 375 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 376 |
+
|
| 377 |
+
# col: color bar canvas
|
| 378 |
+
# sel: selector canvas
|
| 379 |
+
set col $data($c,col)
|
| 380 |
+
set sel $data($c,sel)
|
| 381 |
+
|
| 382 |
+
# First handle the case that we are creating everything for the first time.
|
| 383 |
+
if {$create} {
|
| 384 |
+
# First remove all the lines that already exist.
|
| 385 |
+
if { $data(lines,$c,last) > $data(lines,$c,start)} {
|
| 386 |
+
for {set i $data(lines,$c,start)} \
|
| 387 |
+
{$i <= $data(lines,$c,last)} {incr i} {
|
| 388 |
+
$sel delete $i
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
# Delete the selector if it exists
|
| 392 |
+
if {[info exists data($c,index)]} {
|
| 393 |
+
$sel delete $data($c,index)
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
# Draw the selection polygons
|
| 397 |
+
CreateSelector $w $sel $c
|
| 398 |
+
$sel bind $data($c,index) <Button-1> \
|
| 399 |
+
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1]
|
| 400 |
+
$sel bind $data($c,index) <B1-Motion> \
|
| 401 |
+
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
|
| 402 |
+
$sel bind $data($c,index) <ButtonRelease-1> \
|
| 403 |
+
[list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(selPad)]
|
| 404 |
+
|
| 405 |
+
set height [winfo height $col]
|
| 406 |
+
# Create an invisible region under the colorstrip to catch mouse clicks
|
| 407 |
+
# that aren't on the selector.
|
| 408 |
+
set data($c,clickRegion) [$sel create rectangle 0 0 \
|
| 409 |
+
$data(canvasWidth) $height -fill {} -outline {}]
|
| 410 |
+
|
| 411 |
+
bind $col <Button-1> \
|
| 412 |
+
[list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)]
|
| 413 |
+
bind $col <B1-Motion> \
|
| 414 |
+
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)]
|
| 415 |
+
bind $col <ButtonRelease-1> \
|
| 416 |
+
[list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)]
|
| 417 |
+
|
| 418 |
+
$sel bind $data($c,clickRegion) <Button-1> \
|
| 419 |
+
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)]
|
| 420 |
+
$sel bind $data($c,clickRegion) <B1-Motion> \
|
| 421 |
+
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
|
| 422 |
+
$sel bind $data($c,clickRegion) <ButtonRelease-1> \
|
| 423 |
+
[list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(selPad)]
|
| 424 |
+
} else {
|
| 425 |
+
# l is the canvas index of the first colorbar.
|
| 426 |
+
set l $data(lines,$c,start)
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
# Draw the color bars.
|
| 430 |
+
set highlightW [expr {[$col cget -highlightthickness] + [$col cget -bd]}]
|
| 431 |
+
for {set i 0} { $i < $data(NUM_COLORBARS)} { incr i} {
|
| 432 |
+
set intensity [expr {$i * $data(intensityIncr)}]
|
| 433 |
+
set startx [expr {$i * $data(colorbarWidth) + $highlightW}]
|
| 434 |
+
if {$c eq "red"} {
|
| 435 |
+
set color [format "#%02x%02x%02x" \
|
| 436 |
+
$intensity $data(green,intensity) $data(blue,intensity)]
|
| 437 |
+
} elseif {$c eq "green"} {
|
| 438 |
+
set color [format "#%02x%02x%02x" \
|
| 439 |
+
$data(red,intensity) $intensity $data(blue,intensity)]
|
| 440 |
+
} else {
|
| 441 |
+
set color [format "#%02x%02x%02x" \
|
| 442 |
+
$data(red,intensity) $data(green,intensity) $intensity]
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
if {$create} {
|
| 446 |
+
set index [$col create rect $startx $highlightW \
|
| 447 |
+
[expr {$startx +$data(colorbarWidth)}] \
|
| 448 |
+
[expr {[winfo height $col] + $highlightW}] \
|
| 449 |
+
-fill $color -outline $color]
|
| 450 |
+
} else {
|
| 451 |
+
$col itemconfigure $l -fill $color -outline $color
|
| 452 |
+
incr l
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
$sel raise $data($c,index)
|
| 456 |
+
|
| 457 |
+
if {$create} {
|
| 458 |
+
set data(lines,$c,last) $index
|
| 459 |
+
set data(lines,$c,start) [expr {$index - $data(NUM_COLORBARS) + 1}]
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
RedrawFinalColor $w
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
# ::tk::dialog::color::CreateSelector --
|
| 466 |
+
#
|
| 467 |
+
# Creates and draws the selector polygon at the position
|
| 468 |
+
# $data($c,intensity).
|
| 469 |
+
#
|
| 470 |
+
proc ::tk::dialog::color::CreateSelector {w sel c } {
|
| 471 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 472 |
+
set data($c,index) [$sel create polygon \
|
| 473 |
+
0 $data(PLGN_HEIGHT) \
|
| 474 |
+
$data(PLGN_WIDTH) $data(PLGN_HEIGHT) \
|
| 475 |
+
$data(indent) 0]
|
| 476 |
+
set data($c,x) [RgbToX $w $data($c,intensity)]
|
| 477 |
+
$sel move $data($c,index) $data($c,x) 0
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
# ::tk::dialog::color::RedrawFinalColor
|
| 481 |
+
#
|
| 482 |
+
# Combines the intensities of the three colors into the final color
|
| 483 |
+
#
|
| 484 |
+
proc ::tk::dialog::color::RedrawFinalColor {w} {
|
| 485 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 486 |
+
|
| 487 |
+
set color [format "#%02x%02x%02x" $data(red,intensity) \
|
| 488 |
+
$data(green,intensity) $data(blue,intensity)]
|
| 489 |
+
|
| 490 |
+
$data(finalCanvas) configure -bg $color
|
| 491 |
+
set data(finalColor) $color
|
| 492 |
+
set data(selection) $color
|
| 493 |
+
set data(finalRGB) [list \
|
| 494 |
+
$data(red,intensity) \
|
| 495 |
+
$data(green,intensity) \
|
| 496 |
+
$data(blue,intensity)]
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
# ::tk::dialog::color::RedrawColorBars --
|
| 500 |
+
#
|
| 501 |
+
# Only redraws the colors on the color strips that were not manipulated.
|
| 502 |
+
# Params: color of colorstrip that changed. If color is not [red|green|blue]
|
| 503 |
+
# Then all colorstrips will be updated
|
| 504 |
+
#
|
| 505 |
+
proc ::tk::dialog::color::RedrawColorBars {w colorChanged} {
|
| 506 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 507 |
+
|
| 508 |
+
switch $colorChanged {
|
| 509 |
+
red {
|
| 510 |
+
DrawColorScale $w green
|
| 511 |
+
DrawColorScale $w blue
|
| 512 |
+
}
|
| 513 |
+
green {
|
| 514 |
+
DrawColorScale $w red
|
| 515 |
+
DrawColorScale $w blue
|
| 516 |
+
}
|
| 517 |
+
blue {
|
| 518 |
+
DrawColorScale $w red
|
| 519 |
+
DrawColorScale $w green
|
| 520 |
+
}
|
| 521 |
+
default {
|
| 522 |
+
DrawColorScale $w red
|
| 523 |
+
DrawColorScale $w green
|
| 524 |
+
DrawColorScale $w blue
|
| 525 |
+
}
|
| 526 |
+
}
|
| 527 |
+
RedrawFinalColor $w
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
#----------------------------------------------------------------------
|
| 531 |
+
# Event handlers
|
| 532 |
+
#----------------------------------------------------------------------
|
| 533 |
+
|
| 534 |
+
# ::tk::dialog::color::StartMove --
|
| 535 |
+
#
|
| 536 |
+
# Handles a mousedown button event over the selector polygon.
|
| 537 |
+
# Adds the bindings for moving the mouse while the button is
|
| 538 |
+
# pressed. Sets the binding for the button-release event.
|
| 539 |
+
#
|
| 540 |
+
# Params: sel is the selector canvas window, color is the color of the strip.
|
| 541 |
+
#
|
| 542 |
+
proc ::tk::dialog::color::StartMove {w sel color x delta {dontMove 0}} {
|
| 543 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 544 |
+
|
| 545 |
+
if {!$dontMove} {
|
| 546 |
+
MoveSelector $w $sel $color $x $delta
|
| 547 |
+
}
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
# ::tk::dialog::color::MoveSelector --
|
| 551 |
+
#
|
| 552 |
+
# Moves the polygon selector so that its middle point has the same
|
| 553 |
+
# x value as the specified x. If x is outside the bounds [0,255],
|
| 554 |
+
# the selector is set to the closest endpoint.
|
| 555 |
+
#
|
| 556 |
+
# Params: sel is the selector canvas, c is [red|green|blue]
|
| 557 |
+
# x is a x-coordinate.
|
| 558 |
+
#
|
| 559 |
+
proc ::tk::dialog::color::MoveSelector {w sel color x delta} {
|
| 560 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 561 |
+
|
| 562 |
+
incr x -$delta
|
| 563 |
+
|
| 564 |
+
if { $x < 0 } {
|
| 565 |
+
set x 0
|
| 566 |
+
} elseif { $x > $data(BARS_WIDTH)} {
|
| 567 |
+
set x $data(BARS_WIDTH)
|
| 568 |
+
}
|
| 569 |
+
set diff [expr {$x - $data($color,x)}]
|
| 570 |
+
$sel move $data($color,index) $diff 0
|
| 571 |
+
set data($color,x) [expr {$data($color,x) + $diff}]
|
| 572 |
+
|
| 573 |
+
# Return the x value that it was actually set at
|
| 574 |
+
return $x
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
# ::tk::dialog::color::ReleaseMouse
|
| 578 |
+
#
|
| 579 |
+
# Removes mouse tracking bindings, updates the colorbars.
|
| 580 |
+
#
|
| 581 |
+
# Params: sel is the selector canvas, color is the color of the strip,
|
| 582 |
+
# x is the x-coord of the mouse.
|
| 583 |
+
#
|
| 584 |
+
proc ::tk::dialog::color::ReleaseMouse {w sel color x delta} {
|
| 585 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 586 |
+
|
| 587 |
+
set x [MoveSelector $w $sel $color $x $delta]
|
| 588 |
+
|
| 589 |
+
# Determine exactly what color we are looking at.
|
| 590 |
+
set data($color,intensity) [XToRgb $w $x]
|
| 591 |
+
|
| 592 |
+
RedrawColorBars $w $color
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
# ::tk::dialog::color::ResizeColorbars --
|
| 596 |
+
#
|
| 597 |
+
# Completely redraws the colorbars, including resizing the
|
| 598 |
+
# colorstrips
|
| 599 |
+
#
|
| 600 |
+
proc ::tk::dialog::color::ResizeColorBars {w} {
|
| 601 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 602 |
+
|
| 603 |
+
if {
|
| 604 |
+
($data(BARS_WIDTH) < $data(NUM_COLORBARS)) ||
|
| 605 |
+
(($data(BARS_WIDTH) % $data(NUM_COLORBARS)) != 0)
|
| 606 |
+
} then {
|
| 607 |
+
set data(BARS_WIDTH) $data(NUM_COLORBARS)
|
| 608 |
+
}
|
| 609 |
+
InitValues [winfo name $w]
|
| 610 |
+
foreach color {red green blue} {
|
| 611 |
+
$data($color,col) configure -width $data(canvasWidth)
|
| 612 |
+
DrawColorScale $w $color 1
|
| 613 |
+
}
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
# ::tk::dialog::color::HandleSelEntry --
|
| 617 |
+
#
|
| 618 |
+
# Handles the return keypress event in the "Selection:" entry
|
| 619 |
+
#
|
| 620 |
+
proc ::tk::dialog::color::HandleSelEntry {w} {
|
| 621 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 622 |
+
|
| 623 |
+
set text [string trim $data(selection)]
|
| 624 |
+
# Check to make sure that the color is valid
|
| 625 |
+
if {[catch {set color [winfo rgb . $text]} ]} {
|
| 626 |
+
set data(selection) $data(finalColor)
|
| 627 |
+
return
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
set R [expr {[lindex $color 0]/0x100}]
|
| 631 |
+
set G [expr {[lindex $color 1]/0x100}]
|
| 632 |
+
set B [expr {[lindex $color 2]/0x100}]
|
| 633 |
+
|
| 634 |
+
SetRGBValue $w "$R $G $B"
|
| 635 |
+
set data(selection) $text
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
# ::tk::dialog::color::HandleRGBEntry --
|
| 639 |
+
#
|
| 640 |
+
# Handles the return keypress event in the R, G or B entry
|
| 641 |
+
#
|
| 642 |
+
proc ::tk::dialog::color::HandleRGBEntry {w} {
|
| 643 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 644 |
+
|
| 645 |
+
foreach c {red green blue} {
|
| 646 |
+
if {[catch {
|
| 647 |
+
set data($c,intensity) [expr {int($data($c,intensity))}]
|
| 648 |
+
}]} {
|
| 649 |
+
set data($c,intensity) 0
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
if {$data($c,intensity) < 0} {
|
| 653 |
+
set data($c,intensity) 0
|
| 654 |
+
}
|
| 655 |
+
if {$data($c,intensity) > 255} {
|
| 656 |
+
set data($c,intensity) 255
|
| 657 |
+
}
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
SetRGBValue $w "$data(red,intensity) \
|
| 661 |
+
$data(green,intensity) $data(blue,intensity)"
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
# mouse cursor enters a color bar
|
| 665 |
+
#
|
| 666 |
+
proc ::tk::dialog::color::EnterColorBar {w color} {
|
| 667 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 668 |
+
|
| 669 |
+
$data($color,sel) itemconfigure $data($color,index) -fill red
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
# mouse leaves enters a color bar
|
| 673 |
+
#
|
| 674 |
+
proc ::tk::dialog::color::LeaveColorBar {w color} {
|
| 675 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 676 |
+
|
| 677 |
+
$data($color,sel) itemconfigure $data($color,index) -fill black
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
# user hits OK button
|
| 681 |
+
#
|
| 682 |
+
proc ::tk::dialog::color::OkCmd {w} {
|
| 683 |
+
variable ::tk::Priv
|
| 684 |
+
upvar ::tk::dialog::color::[winfo name $w] data
|
| 685 |
+
|
| 686 |
+
set Priv(selectColor) $data(finalColor)
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
# user hits Cancel button or destroys window
|
| 690 |
+
#
|
| 691 |
+
proc ::tk::dialog::color::CancelCmd {w} {
|
| 692 |
+
variable ::tk::Priv
|
| 693 |
+
set Priv(selectColor) ""
|
| 694 |
+
}
|
miniconda3/envs/active_proaction/lib/tk8.6/comdlg.tcl
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# comdlg.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Some functions needed for the common dialog boxes. Probably need to go
|
| 4 |
+
# in a different file.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1996 Sun Microsystems, Inc.
|
| 7 |
+
#
|
| 8 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 9 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 10 |
+
#
|
| 11 |
+
|
| 12 |
+
# tclParseConfigSpec --
|
| 13 |
+
#
|
| 14 |
+
# Parses a list of "-option value" pairs. If all options and
|
| 15 |
+
# values are legal, the values are stored in
|
| 16 |
+
# $data($option). Otherwise an error message is returned. When
|
| 17 |
+
# an error happens, the data() array may have been partially
|
| 18 |
+
# modified, but all the modified members of the data(0 array are
|
| 19 |
+
# guaranteed to have valid values. This is different than
|
| 20 |
+
# Tk_ConfigureWidget() which does not modify the value of a
|
| 21 |
+
# widget record if any error occurs.
|
| 22 |
+
#
|
| 23 |
+
# Arguments:
|
| 24 |
+
#
|
| 25 |
+
# w = widget record to modify. Must be the pathname of a widget.
|
| 26 |
+
#
|
| 27 |
+
# specs = {
|
| 28 |
+
# {-commandlineswitch resourceName ResourceClass defaultValue verifier}
|
| 29 |
+
# {....}
|
| 30 |
+
# }
|
| 31 |
+
#
|
| 32 |
+
# flags = a list of flags. Currently supported flags are:
|
| 33 |
+
# DONTSETDEFAULTS = skip default values setting
|
| 34 |
+
#
|
| 35 |
+
# argList = The list of "-option value" pairs.
|
| 36 |
+
#
|
| 37 |
+
proc tclParseConfigSpec {w specs flags argList} {
|
| 38 |
+
upvar #0 $w data
|
| 39 |
+
|
| 40 |
+
# 1: Put the specs in associative arrays for faster access
|
| 41 |
+
#
|
| 42 |
+
foreach spec $specs {
|
| 43 |
+
if {[llength $spec] < 4} {
|
| 44 |
+
return -code error -errorcode {TK VALUE CONFIG_SPEC} \
|
| 45 |
+
"\"spec\" should contain 5 or 4 elements"
|
| 46 |
+
}
|
| 47 |
+
set cmdsw [lindex $spec 0]
|
| 48 |
+
set cmd($cmdsw) ""
|
| 49 |
+
set rname($cmdsw) [lindex $spec 1]
|
| 50 |
+
set rclass($cmdsw) [lindex $spec 2]
|
| 51 |
+
set def($cmdsw) [lindex $spec 3]
|
| 52 |
+
set verproc($cmdsw) [lindex $spec 4]
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if {[llength $argList] & 1} {
|
| 56 |
+
set cmdsw [lindex $argList end]
|
| 57 |
+
if {![info exists cmd($cmdsw)]} {
|
| 58 |
+
return -code error -errorcode [list TK LOOKUP OPTION $cmdsw] \
|
| 59 |
+
"bad option \"$cmdsw\": must be [tclListValidFlags cmd]"
|
| 60 |
+
}
|
| 61 |
+
return -code error -errorcode {TK VALUE_MISSING} \
|
| 62 |
+
"value for \"$cmdsw\" missing"
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
# 2: set the default values
|
| 66 |
+
#
|
| 67 |
+
if {"DONTSETDEFAULTS" ni $flags} {
|
| 68 |
+
foreach cmdsw [array names cmd] {
|
| 69 |
+
set data($cmdsw) $def($cmdsw)
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# 3: parse the argument list
|
| 74 |
+
#
|
| 75 |
+
foreach {cmdsw value} $argList {
|
| 76 |
+
if {![info exists cmd($cmdsw)]} {
|
| 77 |
+
return -code error -errorcode [list TK LOOKUP OPTION $cmdsw] \
|
| 78 |
+
"bad option \"$cmdsw\": must be [tclListValidFlags cmd]"
|
| 79 |
+
}
|
| 80 |
+
set data($cmdsw) $value
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
# Done!
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
proc tclListValidFlags {v} {
|
| 87 |
+
upvar $v cmd
|
| 88 |
+
|
| 89 |
+
set len [llength [array names cmd]]
|
| 90 |
+
set i 1
|
| 91 |
+
set separator ""
|
| 92 |
+
set errormsg ""
|
| 93 |
+
foreach cmdsw [lsort [array names cmd]] {
|
| 94 |
+
append errormsg "$separator$cmdsw"
|
| 95 |
+
incr i
|
| 96 |
+
if {$i == $len} {
|
| 97 |
+
set separator ", or "
|
| 98 |
+
} else {
|
| 99 |
+
set separator ", "
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
return $errormsg
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
#----------------------------------------------------------------------
|
| 106 |
+
#
|
| 107 |
+
# Focus Group
|
| 108 |
+
#
|
| 109 |
+
# Focus groups are used to handle the user's focusing actions inside a
|
| 110 |
+
# toplevel.
|
| 111 |
+
#
|
| 112 |
+
# One example of using focus groups is: when the user focuses on an
|
| 113 |
+
# entry, the text in the entry is highlighted and the cursor is put to
|
| 114 |
+
# the end of the text. When the user changes focus to another widget,
|
| 115 |
+
# the text in the previously focused entry is validated.
|
| 116 |
+
#
|
| 117 |
+
#----------------------------------------------------------------------
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
# ::tk::FocusGroup_Create --
|
| 121 |
+
#
|
| 122 |
+
# Create a focus group. All the widgets in a focus group must be
|
| 123 |
+
# within the same focus toplevel. Each toplevel can have only
|
| 124 |
+
# one focus group, which is identified by the name of the
|
| 125 |
+
# toplevel widget.
|
| 126 |
+
#
|
| 127 |
+
proc ::tk::FocusGroup_Create {t} {
|
| 128 |
+
variable ::tk::Priv
|
| 129 |
+
if {[winfo toplevel $t] ne $t} {
|
| 130 |
+
return -code error -errorcode [list TK LOOKUP TOPLEVEL $t] \
|
| 131 |
+
"$t is not a toplevel window"
|
| 132 |
+
}
|
| 133 |
+
if {![info exists Priv(fg,$t)]} {
|
| 134 |
+
set Priv(fg,$t) 1
|
| 135 |
+
set Priv(focus,$t) ""
|
| 136 |
+
bind $t <FocusIn> [list tk::FocusGroup_In $t %W %d]
|
| 137 |
+
bind $t <FocusOut> [list tk::FocusGroup_Out $t %W %d]
|
| 138 |
+
bind $t <Destroy> [list tk::FocusGroup_Destroy $t %W]
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
# ::tk::FocusGroup_BindIn --
|
| 143 |
+
#
|
| 144 |
+
# Add a widget into the "FocusIn" list of the focus group. The $cmd will be
|
| 145 |
+
# called when the widget is focused on by the user.
|
| 146 |
+
#
|
| 147 |
+
proc ::tk::FocusGroup_BindIn {t w cmd} {
|
| 148 |
+
variable FocusIn
|
| 149 |
+
variable ::tk::Priv
|
| 150 |
+
if {![info exists Priv(fg,$t)]} {
|
| 151 |
+
return -code error -errorcode [list TK LOOKUP FOCUS_GROUP $t] \
|
| 152 |
+
"focus group \"$t\" doesn't exist"
|
| 153 |
+
}
|
| 154 |
+
set FocusIn($t,$w) $cmd
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
# ::tk::FocusGroup_BindOut --
|
| 159 |
+
#
|
| 160 |
+
# Add a widget into the "FocusOut" list of the focus group. The
|
| 161 |
+
# $cmd will be called when the widget loses the focus (User
|
| 162 |
+
# types Tab or click on another widget).
|
| 163 |
+
#
|
| 164 |
+
proc ::tk::FocusGroup_BindOut {t w cmd} {
|
| 165 |
+
variable FocusOut
|
| 166 |
+
variable ::tk::Priv
|
| 167 |
+
if {![info exists Priv(fg,$t)]} {
|
| 168 |
+
return -code error -errorcode [list TK LOOKUP FOCUS_GROUP $t] \
|
| 169 |
+
"focus group \"$t\" doesn't exist"
|
| 170 |
+
}
|
| 171 |
+
set FocusOut($t,$w) $cmd
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
# ::tk::FocusGroup_Destroy --
|
| 175 |
+
#
|
| 176 |
+
# Cleans up when members of the focus group is deleted, or when the
|
| 177 |
+
# toplevel itself gets deleted.
|
| 178 |
+
#
|
| 179 |
+
proc ::tk::FocusGroup_Destroy {t w} {
|
| 180 |
+
variable FocusIn
|
| 181 |
+
variable FocusOut
|
| 182 |
+
variable ::tk::Priv
|
| 183 |
+
|
| 184 |
+
if {$t eq $w} {
|
| 185 |
+
unset Priv(fg,$t)
|
| 186 |
+
unset Priv(focus,$t)
|
| 187 |
+
|
| 188 |
+
foreach name [array names FocusIn $t,*] {
|
| 189 |
+
unset FocusIn($name)
|
| 190 |
+
}
|
| 191 |
+
foreach name [array names FocusOut $t,*] {
|
| 192 |
+
unset FocusOut($name)
|
| 193 |
+
}
|
| 194 |
+
} else {
|
| 195 |
+
if {[info exists Priv(focus,$t)] && ($Priv(focus,$t) eq $w)} {
|
| 196 |
+
set Priv(focus,$t) ""
|
| 197 |
+
}
|
| 198 |
+
unset -nocomplain FocusIn($t,$w) FocusOut($t,$w)
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
# ::tk::FocusGroup_In --
|
| 203 |
+
#
|
| 204 |
+
# Handles the <FocusIn> event. Calls the FocusIn command for the newly
|
| 205 |
+
# focused widget in the focus group.
|
| 206 |
+
#
|
| 207 |
+
proc ::tk::FocusGroup_In {t w detail} {
|
| 208 |
+
variable FocusIn
|
| 209 |
+
variable ::tk::Priv
|
| 210 |
+
|
| 211 |
+
if {$detail ne "NotifyNonlinear" && $detail ne "NotifyNonlinearVirtual"} {
|
| 212 |
+
# This is caused by mouse moving out&in of the window *or*
|
| 213 |
+
# ordinary keypresses some window managers (ie: CDE [Bug: 2960]).
|
| 214 |
+
return
|
| 215 |
+
}
|
| 216 |
+
if {![info exists FocusIn($t,$w)]} {
|
| 217 |
+
set FocusIn($t,$w) ""
|
| 218 |
+
return
|
| 219 |
+
}
|
| 220 |
+
if {![info exists Priv(focus,$t)]} {
|
| 221 |
+
return
|
| 222 |
+
}
|
| 223 |
+
if {$Priv(focus,$t) eq $w} {
|
| 224 |
+
# This is already in focus
|
| 225 |
+
#
|
| 226 |
+
return
|
| 227 |
+
} else {
|
| 228 |
+
set Priv(focus,$t) $w
|
| 229 |
+
eval $FocusIn($t,$w)
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
# ::tk::FocusGroup_Out --
|
| 234 |
+
#
|
| 235 |
+
# Handles the <FocusOut> event. Checks if this is really a lose
|
| 236 |
+
# focus event, not one generated by the mouse moving out of the
|
| 237 |
+
# toplevel window. Calls the FocusOut command for the widget
|
| 238 |
+
# who loses its focus.
|
| 239 |
+
#
|
| 240 |
+
proc ::tk::FocusGroup_Out {t w detail} {
|
| 241 |
+
variable FocusOut
|
| 242 |
+
variable ::tk::Priv
|
| 243 |
+
|
| 244 |
+
if {$detail ne "NotifyNonlinear" && $detail ne "NotifyNonlinearVirtual"} {
|
| 245 |
+
# This is caused by mouse moving out of the window
|
| 246 |
+
return
|
| 247 |
+
}
|
| 248 |
+
if {![info exists Priv(focus,$t)]} {
|
| 249 |
+
return
|
| 250 |
+
}
|
| 251 |
+
if {![info exists FocusOut($t,$w)]} {
|
| 252 |
+
return
|
| 253 |
+
} else {
|
| 254 |
+
eval $FocusOut($t,$w)
|
| 255 |
+
set Priv(focus,$t) ""
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
# ::tk::FDGetFileTypes --
|
| 260 |
+
#
|
| 261 |
+
# Process the string given by the -filetypes option of the file
|
| 262 |
+
# dialogs. Similar to the C function TkGetFileFilters() on the Mac
|
| 263 |
+
# and Windows platform.
|
| 264 |
+
#
|
| 265 |
+
proc ::tk::FDGetFileTypes {string} {
|
| 266 |
+
foreach t $string {
|
| 267 |
+
if {[llength $t] < 2 || [llength $t] > 3} {
|
| 268 |
+
return -code error -errorcode {TK VALUE FILE_TYPE} \
|
| 269 |
+
"bad file type \"$t\", should be \"typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?\""
|
| 270 |
+
}
|
| 271 |
+
lappend fileTypes([lindex $t 0]) {*}[lindex $t 1]
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
set types {}
|
| 275 |
+
foreach t $string {
|
| 276 |
+
set label [lindex $t 0]
|
| 277 |
+
set exts {}
|
| 278 |
+
|
| 279 |
+
if {[info exists hasDoneType($label)]} {
|
| 280 |
+
continue
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
# Validate each macType. This is to agree with the
|
| 284 |
+
# behaviour of TkGetFileFilters(). This list may be
|
| 285 |
+
# empty.
|
| 286 |
+
foreach macType [lindex $t 2] {
|
| 287 |
+
if {[string length $macType] != 4} {
|
| 288 |
+
return -code error -errorcode {TK VALUE MAC_TYPE} \
|
| 289 |
+
"bad Macintosh file type \"$macType\""
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
set name "$label \("
|
| 294 |
+
set sep ""
|
| 295 |
+
set doAppend 1
|
| 296 |
+
foreach ext $fileTypes($label) {
|
| 297 |
+
if {$ext eq ""} {
|
| 298 |
+
continue
|
| 299 |
+
}
|
| 300 |
+
regsub {^[.]} $ext "*." ext
|
| 301 |
+
if {![info exists hasGotExt($label,$ext)]} {
|
| 302 |
+
if {$doAppend} {
|
| 303 |
+
if {[string length $sep] && [string length $name]>40} {
|
| 304 |
+
set doAppend 0
|
| 305 |
+
append name $sep...
|
| 306 |
+
} else {
|
| 307 |
+
append name $sep$ext
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
lappend exts $ext
|
| 311 |
+
set hasGotExt($label,$ext) 1
|
| 312 |
+
}
|
| 313 |
+
set sep ","
|
| 314 |
+
}
|
| 315 |
+
append name "\)"
|
| 316 |
+
lappend types [list $name $exts]
|
| 317 |
+
|
| 318 |
+
set hasDoneType($label) 1
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
return $types
|
| 322 |
+
}
|
miniconda3/envs/active_proaction/lib/tk8.6/console.tcl
ADDED
|
@@ -0,0 +1,1154 @@
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# console.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This code constructs the console window for an application. It
|
| 4 |
+
# can be used by non-unix systems that do not have built-in support
|
| 5 |
+
# for shells.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
|
| 8 |
+
# Copyright (c) 1998-2000 Ajuba Solutions.
|
| 9 |
+
# Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
|
| 10 |
+
#
|
| 11 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 12 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
# TODO: history - remember partially written command
|
| 16 |
+
|
| 17 |
+
namespace eval ::tk::console {
|
| 18 |
+
variable blinkTime 500 ; # msecs to blink braced range for
|
| 19 |
+
variable blinkRange 1 ; # enable blinking of the entire braced range
|
| 20 |
+
variable magicKeys 1 ; # enable brace matching and proc/var recognition
|
| 21 |
+
variable maxLines 600 ; # maximum # of lines buffered in console
|
| 22 |
+
variable showMatches 1 ; # show multiple expand matches
|
| 23 |
+
variable useFontchooser [llength [info command ::tk::fontchooser]]
|
| 24 |
+
variable inPlugin [info exists embed_args]
|
| 25 |
+
variable defaultPrompt ; # default prompt if tcl_prompt1 isn't used
|
| 26 |
+
|
| 27 |
+
if {$inPlugin} {
|
| 28 |
+
set defaultPrompt {subst {[history nextid] % }}
|
| 29 |
+
} else {
|
| 30 |
+
set defaultPrompt {subst {([file tail [pwd]]) [history nextid] % }}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
# simple compat function for tkcon code added for this console
|
| 35 |
+
interp alias {} EvalAttached {} consoleinterp eval
|
| 36 |
+
|
| 37 |
+
# ::tk::ConsoleInit --
|
| 38 |
+
# This procedure constructs and configures the console windows.
|
| 39 |
+
#
|
| 40 |
+
# Arguments:
|
| 41 |
+
# None.
|
| 42 |
+
|
| 43 |
+
proc ::tk::ConsoleInit {} {
|
| 44 |
+
if {![consoleinterp eval {set tcl_interactive}]} {
|
| 45 |
+
wm withdraw .
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 49 |
+
set mod "Cmd"
|
| 50 |
+
} else {
|
| 51 |
+
set mod "Ctrl"
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if {[catch {menu .menubar} err]} {
|
| 55 |
+
bgerror "INIT: $err"
|
| 56 |
+
}
|
| 57 |
+
AmpMenuArgs .menubar add cascade -label [mc &File] -menu .menubar.file
|
| 58 |
+
AmpMenuArgs .menubar add cascade -label [mc &Edit] -menu .menubar.edit
|
| 59 |
+
|
| 60 |
+
menu .menubar.file -tearoff 0
|
| 61 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Source..."] \
|
| 62 |
+
-command {tk::ConsoleSource}
|
| 63 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Hide Console"] \
|
| 64 |
+
-command {wm withdraw .}
|
| 65 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Clear Console"] \
|
| 66 |
+
-command {.console delete 1.0 "promptEnd linestart"}
|
| 67 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 68 |
+
AmpMenuArgs .menubar.file add command -label [mc E&xit] -command {exit}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
menu .menubar.edit -tearoff 0
|
| 72 |
+
AmpMenuArgs .menubar.edit add command -label [mc Cu&t] -accel "$mod+X"\
|
| 73 |
+
-command {event generate .console <<Cut>>}
|
| 74 |
+
AmpMenuArgs .menubar.edit add command -label [mc &Copy] -accel "$mod+C"\
|
| 75 |
+
-command {event generate .console <<Copy>>}
|
| 76 |
+
AmpMenuArgs .menubar.edit add command -label [mc P&aste] -accel "$mod+V"\
|
| 77 |
+
-command {event generate .console <<Paste>>}
|
| 78 |
+
|
| 79 |
+
if {[tk windowingsystem] ne "win32"} {
|
| 80 |
+
AmpMenuArgs .menubar.edit add command -label [mc Cl&ear] \
|
| 81 |
+
-command {event generate .console <<Clear>>}
|
| 82 |
+
} else {
|
| 83 |
+
AmpMenuArgs .menubar.edit add command -label [mc &Delete] \
|
| 84 |
+
-command {event generate .console <<Clear>>} -accel "Del"
|
| 85 |
+
|
| 86 |
+
AmpMenuArgs .menubar add cascade -label [mc &Help] -menu .menubar.help
|
| 87 |
+
menu .menubar.help -tearoff 0
|
| 88 |
+
AmpMenuArgs .menubar.help add command -label [mc &About...] \
|
| 89 |
+
-command tk::ConsoleAbout
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
AmpMenuArgs .menubar.edit add separator
|
| 93 |
+
if {$::tk::console::useFontchooser} {
|
| 94 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 95 |
+
.menubar.edit add command -label tk_choose_font_marker
|
| 96 |
+
set index [.menubar.edit index tk_choose_font_marker]
|
| 97 |
+
.menubar.edit entryconfigure $index \
|
| 98 |
+
-label [mc "Show Fonts"]\
|
| 99 |
+
-accelerator "$mod-T"\
|
| 100 |
+
-command [list ::tk::console::FontchooserToggle]
|
| 101 |
+
bind Console <<TkFontchooserVisibility>> \
|
| 102 |
+
[list ::tk::console::FontchooserVisibility $index]
|
| 103 |
+
::tk::console::FontchooserVisibility $index
|
| 104 |
+
} else {
|
| 105 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Font..."] \
|
| 106 |
+
-command [list ::tk::console::FontchooserToggle]
|
| 107 |
+
}
|
| 108 |
+
bind Console <FocusIn> [list ::tk::console::FontchooserFocus %W 1]
|
| 109 |
+
bind Console <FocusOut> [list ::tk::console::FontchooserFocus %W 0]
|
| 110 |
+
}
|
| 111 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Increase Font Size"] \
|
| 112 |
+
-accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>}
|
| 113 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \
|
| 114 |
+
-accel "$mod+-" -command {event generate .console <<Console_FontSizeDecr>>}
|
| 115 |
+
AmpMenuArgs .menubar.edit add command -label [mc "Fit To Screen Width"] \
|
| 116 |
+
-command {event generate .console <<Console_FitScreenWidth>>}
|
| 117 |
+
|
| 118 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 119 |
+
.menubar add cascade -label [mc Window] -menu [menu .menubar.window]
|
| 120 |
+
.menubar add cascade -label [mc Help] -menu [menu .menubar.help]
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
. configure -menu .menubar
|
| 124 |
+
|
| 125 |
+
# See if we can find a better font than the TkFixedFont
|
| 126 |
+
catch {font create TkConsoleFont {*}[font configure TkFixedFont]}
|
| 127 |
+
set families [font families]
|
| 128 |
+
switch -exact -- [tk windowingsystem] {
|
| 129 |
+
aqua { set preferred {Monaco 10} }
|
| 130 |
+
win32 { set preferred {ProFontWindows 8 Consolas 8} }
|
| 131 |
+
default { set preferred {} }
|
| 132 |
+
}
|
| 133 |
+
foreach {family size} $preferred {
|
| 134 |
+
if {$family in $families} {
|
| 135 |
+
font configure TkConsoleFont -family $family -size $size
|
| 136 |
+
break
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
# Provide the right border for the text widget (platform dependent).
|
| 141 |
+
::ttk::style layout ConsoleFrame {
|
| 142 |
+
Entry.field -sticky news -border 1 -children {
|
| 143 |
+
ConsoleFrame.padding -sticky news
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
::ttk::frame .consoleframe -style ConsoleFrame
|
| 147 |
+
|
| 148 |
+
set con [text .console -yscrollcommand [list .sb set] -setgrid true \
|
| 149 |
+
-borderwidth 0 -highlightthickness 0 -font TkConsoleFont]
|
| 150 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 151 |
+
scrollbar .sb -command [list $con yview]
|
| 152 |
+
} else {
|
| 153 |
+
::ttk::scrollbar .sb -command [list $con yview]
|
| 154 |
+
}
|
| 155 |
+
pack .sb -in .consoleframe -fill both -side right -padx 1 -pady 1
|
| 156 |
+
pack $con -in .consoleframe -fill both -expand 1 -side left -padx 1 -pady 1
|
| 157 |
+
pack .consoleframe -fill both -expand 1 -side left
|
| 158 |
+
|
| 159 |
+
ConsoleBind $con
|
| 160 |
+
|
| 161 |
+
$con tag configure stderr -foreground red
|
| 162 |
+
$con tag configure stdin -foreground blue
|
| 163 |
+
$con tag configure prompt -foreground \#8F4433
|
| 164 |
+
$con tag configure proc -foreground \#008800
|
| 165 |
+
$con tag configure var -background \#FFC0D0
|
| 166 |
+
$con tag raise sel
|
| 167 |
+
$con tag configure blink -background \#FFFF00
|
| 168 |
+
$con tag configure find -background \#FFFF00
|
| 169 |
+
|
| 170 |
+
focus $con
|
| 171 |
+
|
| 172 |
+
# Avoid listing this console in [winfo interps]
|
| 173 |
+
if {[info command ::send] eq "::send"} {rename ::send {}}
|
| 174 |
+
|
| 175 |
+
wm protocol . WM_DELETE_WINDOW { wm withdraw . }
|
| 176 |
+
wm title . [mc "Console"]
|
| 177 |
+
flush stdout
|
| 178 |
+
$con mark set output [$con index "end - 1 char"]
|
| 179 |
+
tk::TextSetCursor $con end
|
| 180 |
+
$con mark set promptEnd insert
|
| 181 |
+
$con mark gravity promptEnd left
|
| 182 |
+
|
| 183 |
+
# A variant of ConsolePrompt to avoid a 'puts' call
|
| 184 |
+
set w $con
|
| 185 |
+
set temp [$w index "end - 1 char"]
|
| 186 |
+
$w mark set output end
|
| 187 |
+
if {![consoleinterp eval "info exists tcl_prompt1"]} {
|
| 188 |
+
set string [EvalAttached $::tk::console::defaultPrompt]
|
| 189 |
+
$w insert output $string stdout
|
| 190 |
+
}
|
| 191 |
+
$w mark set output $temp
|
| 192 |
+
::tk::TextSetCursor $w end
|
| 193 |
+
$w mark set promptEnd insert
|
| 194 |
+
$w mark gravity promptEnd left
|
| 195 |
+
|
| 196 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 197 |
+
# Subtle work-around to erase the '% ' that tclMain.c prints out
|
| 198 |
+
after idle [subst -nocommand {
|
| 199 |
+
if {[$con get 1.0 output] eq "% "} { $con delete 1.0 output }
|
| 200 |
+
}]
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
# ::tk::ConsoleSource --
|
| 205 |
+
#
|
| 206 |
+
# Prompts the user for a file to source in the main interpreter.
|
| 207 |
+
#
|
| 208 |
+
# Arguments:
|
| 209 |
+
# None.
|
| 210 |
+
|
| 211 |
+
proc ::tk::ConsoleSource {} {
|
| 212 |
+
set filename [tk_getOpenFile -defaultextension .tcl -parent . \
|
| 213 |
+
-title [mc "Select a file to source"] \
|
| 214 |
+
-filetypes [list \
|
| 215 |
+
[list [mc "Tcl Scripts"] .tcl] \
|
| 216 |
+
[list [mc "All Files"] *]]]
|
| 217 |
+
if {$filename ne ""} {
|
| 218 |
+
set cmd [list source -encoding utf-8 $filename]
|
| 219 |
+
if {[catch {consoleinterp eval $cmd} result]} {
|
| 220 |
+
ConsoleOutput stderr "$result\n"
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
# ::tk::ConsoleInvoke --
|
| 226 |
+
# Processes the command line input. If the command is complete it
|
| 227 |
+
# is evaled in the main interpreter. Otherwise, the continuation
|
| 228 |
+
# prompt is added and more input may be added.
|
| 229 |
+
#
|
| 230 |
+
# Arguments:
|
| 231 |
+
# None.
|
| 232 |
+
|
| 233 |
+
proc ::tk::ConsoleInvoke {args} {
|
| 234 |
+
set ranges [.console tag ranges input]
|
| 235 |
+
set cmd ""
|
| 236 |
+
if {[llength $ranges]} {
|
| 237 |
+
set pos 0
|
| 238 |
+
while {[lindex $ranges $pos] ne ""} {
|
| 239 |
+
set start [lindex $ranges $pos]
|
| 240 |
+
set end [lindex $ranges [incr pos]]
|
| 241 |
+
append cmd [.console get $start $end]
|
| 242 |
+
incr pos
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
if {$cmd eq ""} {
|
| 246 |
+
ConsolePrompt
|
| 247 |
+
} elseif {[info complete $cmd]} {
|
| 248 |
+
.console mark set output end
|
| 249 |
+
.console tag delete input
|
| 250 |
+
set result [consoleinterp record $cmd]
|
| 251 |
+
if {$result ne ""} {
|
| 252 |
+
puts $result
|
| 253 |
+
}
|
| 254 |
+
ConsoleHistory reset
|
| 255 |
+
ConsolePrompt
|
| 256 |
+
} else {
|
| 257 |
+
ConsolePrompt partial
|
| 258 |
+
}
|
| 259 |
+
.console yview -pickplace insert
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
# ::tk::ConsoleHistory --
|
| 263 |
+
# This procedure implements command line history for the
|
| 264 |
+
# console. In general is evals the history command in the
|
| 265 |
+
# main interpreter to obtain the history. The variable
|
| 266 |
+
# ::tk::HistNum is used to store the current location in the history.
|
| 267 |
+
#
|
| 268 |
+
# Arguments:
|
| 269 |
+
# cmd - Which action to take: prev, next, reset.
|
| 270 |
+
|
| 271 |
+
set ::tk::HistNum 1
|
| 272 |
+
proc ::tk::ConsoleHistory {cmd} {
|
| 273 |
+
variable HistNum
|
| 274 |
+
|
| 275 |
+
switch $cmd {
|
| 276 |
+
prev {
|
| 277 |
+
incr HistNum -1
|
| 278 |
+
if {$HistNum == 0} {
|
| 279 |
+
set cmd {history event [expr {[history nextid] -1}]}
|
| 280 |
+
} else {
|
| 281 |
+
set cmd "history event $HistNum"
|
| 282 |
+
}
|
| 283 |
+
if {[catch {consoleinterp eval $cmd} cmd]} {
|
| 284 |
+
incr HistNum
|
| 285 |
+
return
|
| 286 |
+
}
|
| 287 |
+
.console delete promptEnd end
|
| 288 |
+
.console insert promptEnd $cmd {input stdin}
|
| 289 |
+
.console see end
|
| 290 |
+
}
|
| 291 |
+
next {
|
| 292 |
+
incr HistNum
|
| 293 |
+
if {$HistNum == 0} {
|
| 294 |
+
set cmd {history event [expr {[history nextid] -1}]}
|
| 295 |
+
} elseif {$HistNum > 0} {
|
| 296 |
+
set cmd ""
|
| 297 |
+
set HistNum 1
|
| 298 |
+
} else {
|
| 299 |
+
set cmd "history event $HistNum"
|
| 300 |
+
}
|
| 301 |
+
if {$cmd ne ""} {
|
| 302 |
+
catch {consoleinterp eval $cmd} cmd
|
| 303 |
+
}
|
| 304 |
+
.console delete promptEnd end
|
| 305 |
+
.console insert promptEnd $cmd {input stdin}
|
| 306 |
+
.console see end
|
| 307 |
+
}
|
| 308 |
+
reset {
|
| 309 |
+
set HistNum 1
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
# ::tk::ConsolePrompt --
|
| 315 |
+
# This procedure draws the prompt. If tcl_prompt1 or tcl_prompt2
|
| 316 |
+
# exists in the main interpreter it will be called to generate the
|
| 317 |
+
# prompt. Otherwise, a hard coded default prompt is printed.
|
| 318 |
+
#
|
| 319 |
+
# Arguments:
|
| 320 |
+
# partial - Flag to specify which prompt to print.
|
| 321 |
+
|
| 322 |
+
proc ::tk::ConsolePrompt {{partial normal}} {
|
| 323 |
+
set w .console
|
| 324 |
+
if {$partial eq "normal"} {
|
| 325 |
+
set temp [$w index "end - 1 char"]
|
| 326 |
+
$w mark set output end
|
| 327 |
+
if {[consoleinterp eval "info exists tcl_prompt1"]} {
|
| 328 |
+
consoleinterp eval "eval \[set tcl_prompt1\]"
|
| 329 |
+
} else {
|
| 330 |
+
puts -nonewline [EvalAttached $::tk::console::defaultPrompt]
|
| 331 |
+
}
|
| 332 |
+
} else {
|
| 333 |
+
set temp [$w index output]
|
| 334 |
+
$w mark set output end
|
| 335 |
+
if {[consoleinterp eval "info exists tcl_prompt2"]} {
|
| 336 |
+
consoleinterp eval "eval \[set tcl_prompt2\]"
|
| 337 |
+
} else {
|
| 338 |
+
puts -nonewline "> "
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
flush stdout
|
| 342 |
+
$w mark set output $temp
|
| 343 |
+
::tk::TextSetCursor $w end
|
| 344 |
+
$w mark set promptEnd insert
|
| 345 |
+
$w mark gravity promptEnd left
|
| 346 |
+
::tk::console::ConstrainBuffer $w $::tk::console::maxLines
|
| 347 |
+
$w see end
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
# Copy selected text from the console
|
| 351 |
+
proc ::tk::console::Copy {w} {
|
| 352 |
+
if {![catch {set data [$w get sel.first sel.last]}]} {
|
| 353 |
+
clipboard clear -displayof $w
|
| 354 |
+
clipboard append -displayof $w $data
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
# Copies selected text. If the selection is within the current active edit
|
| 358 |
+
# region then it will be cut, if not it is only copied.
|
| 359 |
+
proc ::tk::console::Cut {w} {
|
| 360 |
+
if {![catch {set data [$w get sel.first sel.last]}]} {
|
| 361 |
+
clipboard clear -displayof $w
|
| 362 |
+
clipboard append -displayof $w $data
|
| 363 |
+
if {[$w compare sel.first >= output]} {
|
| 364 |
+
$w delete sel.first sel.last
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
}
|
| 368 |
+
# Paste text from the clipboard
|
| 369 |
+
proc ::tk::console::Paste {w} {
|
| 370 |
+
catch {
|
| 371 |
+
set clip [::tk::GetSelection $w CLIPBOARD]
|
| 372 |
+
set list [split $clip \n\r]
|
| 373 |
+
tk::ConsoleInsert $w [lindex $list 0]
|
| 374 |
+
foreach x [lrange $list 1 end] {
|
| 375 |
+
$w mark set insert {end - 1c}
|
| 376 |
+
tk::ConsoleInsert $w "\n"
|
| 377 |
+
tk::ConsoleInvoke
|
| 378 |
+
tk::ConsoleInsert $w $x
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
# Fit TkConsoleFont to window width
|
| 384 |
+
proc ::tk::console::FitScreenWidth {w} {
|
| 385 |
+
set width [winfo screenwidth $w]
|
| 386 |
+
set cwidth [$w cget -width]
|
| 387 |
+
set s -50
|
| 388 |
+
set fit 0
|
| 389 |
+
array set fi [font configure TkConsoleFont]
|
| 390 |
+
while {$s < 0} {
|
| 391 |
+
set fi(-size) $s
|
| 392 |
+
set f [font create {*}[array get fi]]
|
| 393 |
+
set c [font measure $f "eM"]
|
| 394 |
+
font delete $f
|
| 395 |
+
if {$c * $cwidth < 1.667 * $width} {
|
| 396 |
+
font configure TkConsoleFont -size $s
|
| 397 |
+
break
|
| 398 |
+
}
|
| 399 |
+
incr s 2
|
| 400 |
+
}
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
# ::tk::ConsoleBind --
|
| 404 |
+
# This procedure first ensures that the default bindings for the Text
|
| 405 |
+
# class have been defined. Then certain bindings are overridden for
|
| 406 |
+
# the class.
|
| 407 |
+
#
|
| 408 |
+
# Arguments:
|
| 409 |
+
# None.
|
| 410 |
+
|
| 411 |
+
proc ::tk::ConsoleBind {w} {
|
| 412 |
+
bindtags $w [list $w Console PostConsole [winfo toplevel $w] all]
|
| 413 |
+
|
| 414 |
+
## Get all Text bindings into Console
|
| 415 |
+
foreach ev [bind Text] {
|
| 416 |
+
bind Console $ev [bind Text $ev]
|
| 417 |
+
}
|
| 418 |
+
## We really didn't want the newline insertion...
|
| 419 |
+
bind Console <Control-o> {}
|
| 420 |
+
## ...or any Control-v binding (would block <<Paste>>)
|
| 421 |
+
bind Console <Control-v> {}
|
| 422 |
+
|
| 423 |
+
# For the moment, transpose isn't enabled until the console
|
| 424 |
+
# gets and overhaul of how it handles input -- hobbs
|
| 425 |
+
bind Console <Control-t> {}
|
| 426 |
+
|
| 427 |
+
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
| 428 |
+
# Otherwise, if a widget binding for one of these is defined, the
|
| 429 |
+
# <Keypress> class binding will also fire and insert the character
|
| 430 |
+
# which is wrong.
|
| 431 |
+
|
| 432 |
+
bind Console <Alt-Key> {# nothing }
|
| 433 |
+
bind Console <Meta-Key> {# nothing}
|
| 434 |
+
bind Console <Control-Key> {# nothing}
|
| 435 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 436 |
+
bind Console <Command-Key> {# nothing}
|
| 437 |
+
bind Console <Mod4-Key> {# nothing}
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
foreach {ev key} {
|
| 441 |
+
<<Console_NextImmediate>> <Control-n>
|
| 442 |
+
<<Console_PrevImmediate>> <Control-p>
|
| 443 |
+
<<Console_PrevSearch>> <Control-r>
|
| 444 |
+
<<Console_NextSearch>> <Control-s>
|
| 445 |
+
|
| 446 |
+
<<Console_Expand>> <Tab>
|
| 447 |
+
<<Console_Expand>> <Escape>
|
| 448 |
+
<<Console_ExpandFile>> <Control-Shift-F>
|
| 449 |
+
<<Console_ExpandProc>> <Control-Shift-P>
|
| 450 |
+
<<Console_ExpandVar>> <Control-Shift-V>
|
| 451 |
+
<<Console_Tab>> <Control-i>
|
| 452 |
+
<<Console_Tab>> <Meta-i>
|
| 453 |
+
<<Console_Eval>> <Return>
|
| 454 |
+
<<Console_Eval>> <KP_Enter>
|
| 455 |
+
|
| 456 |
+
<<Console_Clear>> <Control-l>
|
| 457 |
+
<<Console_KillLine>> <Control-k>
|
| 458 |
+
<<Console_Transpose>> <Control-t>
|
| 459 |
+
<<Console_ClearLine>> <Control-u>
|
| 460 |
+
<<Console_SaveCommand>> <Control-z>
|
| 461 |
+
<<Console_FontSizeIncr>> <Control-plus>
|
| 462 |
+
<<Console_FontSizeDecr>> <Control-minus>
|
| 463 |
+
} {
|
| 464 |
+
event add $ev $key
|
| 465 |
+
bind Console $key {}
|
| 466 |
+
}
|
| 467 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 468 |
+
foreach {ev key} {
|
| 469 |
+
<<Console_FontSizeIncr>> <Command-plus>
|
| 470 |
+
<<Console_FontSizeDecr>> <Command-minus>
|
| 471 |
+
} {
|
| 472 |
+
event add $ev $key
|
| 473 |
+
bind Console $key {}
|
| 474 |
+
}
|
| 475 |
+
if {$::tk::console::useFontchooser} {
|
| 476 |
+
bind Console <Command-t> [list ::tk::console::FontchooserToggle]
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
bind Console <<Console_Expand>> {
|
| 480 |
+
if {[%W compare insert > promptEnd]} {
|
| 481 |
+
::tk::console::Expand %W
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
bind Console <<Console_ExpandFile>> {
|
| 485 |
+
if {[%W compare insert > promptEnd]} {
|
| 486 |
+
::tk::console::Expand %W path
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
bind Console <<Console_ExpandProc>> {
|
| 490 |
+
if {[%W compare insert > promptEnd]} {
|
| 491 |
+
::tk::console::Expand %W proc
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
bind Console <<Console_ExpandVar>> {
|
| 495 |
+
if {[%W compare insert > promptEnd]} {
|
| 496 |
+
::tk::console::Expand %W var
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
bind Console <<Console_Eval>> {
|
| 500 |
+
%W mark set insert {end - 1c}
|
| 501 |
+
tk::ConsoleInsert %W "\n"
|
| 502 |
+
tk::ConsoleInvoke
|
| 503 |
+
break
|
| 504 |
+
}
|
| 505 |
+
bind Console <Delete> {
|
| 506 |
+
if {{} ne [%W tag nextrange sel 1.0 end] \
|
| 507 |
+
&& [%W compare sel.first >= promptEnd]} {
|
| 508 |
+
%W delete sel.first sel.last
|
| 509 |
+
} elseif {[%W compare insert >= promptEnd]} {
|
| 510 |
+
%W delete insert
|
| 511 |
+
%W see insert
|
| 512 |
+
}
|
| 513 |
+
}
|
| 514 |
+
bind Console <BackSpace> {
|
| 515 |
+
if {{} ne [%W tag nextrange sel 1.0 end] \
|
| 516 |
+
&& [%W compare sel.first >= promptEnd]} {
|
| 517 |
+
%W delete sel.first sel.last
|
| 518 |
+
} elseif {[%W compare insert != 1.0] && \
|
| 519 |
+
[%W compare insert > promptEnd]} {
|
| 520 |
+
%W delete insert-1c
|
| 521 |
+
%W see insert
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
bind Console <Control-h> [bind Console <BackSpace>]
|
| 525 |
+
|
| 526 |
+
bind Console <<LineStart>> {
|
| 527 |
+
if {[%W compare insert < promptEnd]} {
|
| 528 |
+
tk::TextSetCursor %W {insert linestart}
|
| 529 |
+
} else {
|
| 530 |
+
tk::TextSetCursor %W promptEnd
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
bind Console <<LineEnd>> {
|
| 534 |
+
tk::TextSetCursor %W {insert lineend}
|
| 535 |
+
}
|
| 536 |
+
bind Console <Control-d> {
|
| 537 |
+
if {[%W compare insert < promptEnd]} {
|
| 538 |
+
break
|
| 539 |
+
}
|
| 540 |
+
%W delete insert
|
| 541 |
+
}
|
| 542 |
+
bind Console <<Console_KillLine>> {
|
| 543 |
+
if {[%W compare insert < promptEnd]} {
|
| 544 |
+
break
|
| 545 |
+
}
|
| 546 |
+
if {[%W compare insert == {insert lineend}]} {
|
| 547 |
+
%W delete insert
|
| 548 |
+
} else {
|
| 549 |
+
%W delete insert {insert lineend}
|
| 550 |
+
}
|
| 551 |
+
}
|
| 552 |
+
bind Console <<Console_Clear>> {
|
| 553 |
+
## Clear console display
|
| 554 |
+
%W delete 1.0 "promptEnd linestart"
|
| 555 |
+
}
|
| 556 |
+
bind Console <<Console_ClearLine>> {
|
| 557 |
+
## Clear command line (Unix shell staple)
|
| 558 |
+
%W delete promptEnd end
|
| 559 |
+
}
|
| 560 |
+
bind Console <Meta-d> {
|
| 561 |
+
if {[%W compare insert >= promptEnd]} {
|
| 562 |
+
%W delete insert {insert wordend}
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
bind Console <Meta-BackSpace> {
|
| 566 |
+
if {[%W compare {insert -1c wordstart} >= promptEnd]} {
|
| 567 |
+
%W delete {insert -1c wordstart} insert
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
bind Console <Meta-d> {
|
| 571 |
+
if {[%W compare insert >= promptEnd]} {
|
| 572 |
+
%W delete insert {insert wordend}
|
| 573 |
+
}
|
| 574 |
+
}
|
| 575 |
+
bind Console <Meta-BackSpace> {
|
| 576 |
+
if {[%W compare {insert -1c wordstart} >= promptEnd]} {
|
| 577 |
+
%W delete {insert -1c wordstart} insert
|
| 578 |
+
}
|
| 579 |
+
}
|
| 580 |
+
bind Console <Meta-Delete> {
|
| 581 |
+
if {[%W compare insert >= promptEnd]} {
|
| 582 |
+
%W delete insert {insert wordend}
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
bind Console <<PrevLine>> {
|
| 586 |
+
tk::ConsoleHistory prev
|
| 587 |
+
}
|
| 588 |
+
bind Console <<NextLine>> {
|
| 589 |
+
tk::ConsoleHistory next
|
| 590 |
+
}
|
| 591 |
+
bind Console <Insert> {
|
| 592 |
+
catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
|
| 593 |
+
}
|
| 594 |
+
bind Console <Key> {
|
| 595 |
+
tk::ConsoleInsert %W %A
|
| 596 |
+
}
|
| 597 |
+
bind Console <F9> {
|
| 598 |
+
destroy {*}[winfo children .]
|
| 599 |
+
source -encoding utf-8 [file join $tk_library console.tcl]
|
| 600 |
+
}
|
| 601 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 602 |
+
bind Console <Command-q> {
|
| 603 |
+
exit
|
| 604 |
+
}
|
| 605 |
+
}
|
| 606 |
+
bind Console <<Cut>> { ::tk::console::Cut %W }
|
| 607 |
+
bind Console <<Copy>> { ::tk::console::Copy %W }
|
| 608 |
+
bind Console <<Paste>> { ::tk::console::Paste %W }
|
| 609 |
+
|
| 610 |
+
bind Console <<Console_FontSizeIncr>> {
|
| 611 |
+
set size [font configure TkConsoleFont -size]
|
| 612 |
+
if {$size < 0} {set sign -1} else {set sign 1}
|
| 613 |
+
set size [expr {(abs($size) + 1) * $sign}]
|
| 614 |
+
font configure TkConsoleFont -size $size
|
| 615 |
+
if {$::tk::console::useFontchooser} {
|
| 616 |
+
tk fontchooser configure -font TkConsoleFont
|
| 617 |
+
}
|
| 618 |
+
}
|
| 619 |
+
bind Console <<Console_FontSizeDecr>> {
|
| 620 |
+
set size [font configure TkConsoleFont -size]
|
| 621 |
+
if {abs($size) < 2} { return }
|
| 622 |
+
if {$size < 0} {set sign -1} else {set sign 1}
|
| 623 |
+
set size [expr {(abs($size) - 1) * $sign}]
|
| 624 |
+
font configure TkConsoleFont -size $size
|
| 625 |
+
if {$::tk::console::useFontchooser} {
|
| 626 |
+
tk fontchooser configure -font TkConsoleFont
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
bind Console <<Console_FitScreenWidth>> {
|
| 630 |
+
::tk::console::FitScreenWidth %W
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
##
|
| 634 |
+
## Bindings for doing special things based on certain keys
|
| 635 |
+
##
|
| 636 |
+
bind PostConsole <parenright> {
|
| 637 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 638 |
+
::tk::console::MatchPair %W \( \) promptEnd
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
bind PostConsole <bracketright> {
|
| 642 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 643 |
+
::tk::console::MatchPair %W \[ \] promptEnd
|
| 644 |
+
}
|
| 645 |
+
}
|
| 646 |
+
bind PostConsole <braceright> {
|
| 647 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 648 |
+
::tk::console::MatchPair %W \{ \} promptEnd
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
bind PostConsole <quotedbl> {
|
| 652 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 653 |
+
::tk::console::MatchQuote %W promptEnd
|
| 654 |
+
}
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
bind PostConsole <Key> {
|
| 658 |
+
if {"%A" ne ""} {
|
| 659 |
+
::tk::console::TagProc %W
|
| 660 |
+
}
|
| 661 |
+
}
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
# ::tk::ConsoleInsert --
|
| 665 |
+
# Insert a string into a text at the point of the insertion cursor.
|
| 666 |
+
# If there is a selection in the text, and it covers the point of the
|
| 667 |
+
# insertion cursor, then delete the selection before inserting. Insertion
|
| 668 |
+
# is restricted to the prompt area.
|
| 669 |
+
#
|
| 670 |
+
# Arguments:
|
| 671 |
+
# w - The text window in which to insert the string
|
| 672 |
+
# s - The string to insert (usually just a single character)
|
| 673 |
+
|
| 674 |
+
proc ::tk::ConsoleInsert {w s} {
|
| 675 |
+
if {$s eq ""} {
|
| 676 |
+
return
|
| 677 |
+
}
|
| 678 |
+
catch {
|
| 679 |
+
if {[$w compare sel.first <= insert] \
|
| 680 |
+
&& [$w compare sel.last >= insert]} {
|
| 681 |
+
$w tag remove sel sel.first promptEnd
|
| 682 |
+
$w delete sel.first sel.last
|
| 683 |
+
}
|
| 684 |
+
}
|
| 685 |
+
if {[$w compare insert < promptEnd]} {
|
| 686 |
+
$w mark set insert end
|
| 687 |
+
}
|
| 688 |
+
$w insert insert $s {input stdin}
|
| 689 |
+
$w see insert
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
# ::tk::ConsoleOutput --
|
| 693 |
+
#
|
| 694 |
+
# This routine is called directly by ConsolePutsCmd to cause a string
|
| 695 |
+
# to be displayed in the console.
|
| 696 |
+
#
|
| 697 |
+
# Arguments:
|
| 698 |
+
# dest - The output tag to be used: either "stderr" or "stdout".
|
| 699 |
+
# string - The string to be displayed.
|
| 700 |
+
|
| 701 |
+
proc ::tk::ConsoleOutput {dest string} {
|
| 702 |
+
set w .console
|
| 703 |
+
$w insert output $string $dest
|
| 704 |
+
::tk::console::ConstrainBuffer $w $::tk::console::maxLines
|
| 705 |
+
$w see insert
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
# ::tk::ConsoleExit --
|
| 709 |
+
#
|
| 710 |
+
# This routine is called by ConsoleEventProc when the main window of
|
| 711 |
+
# the application is destroyed. Don't call exit - that probably already
|
| 712 |
+
# happened. Just delete our window.
|
| 713 |
+
#
|
| 714 |
+
# Arguments:
|
| 715 |
+
# None.
|
| 716 |
+
|
| 717 |
+
proc ::tk::ConsoleExit {} {
|
| 718 |
+
destroy .
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
# ::tk::ConsoleAbout --
|
| 722 |
+
#
|
| 723 |
+
# This routine displays an About box to show Tcl/Tk version info.
|
| 724 |
+
#
|
| 725 |
+
# Arguments:
|
| 726 |
+
# None.
|
| 727 |
+
|
| 728 |
+
proc ::tk::ConsoleAbout {} {
|
| 729 |
+
tk_messageBox -type ok -message "[mc {Tcl for Windows}]
|
| 730 |
+
|
| 731 |
+
Tcl $::tcl_patchLevel
|
| 732 |
+
Tk $::tk_patchLevel"
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
# ::tk::console::Fontchooser* --
|
| 736 |
+
# Let the user select the console font (TIP 324).
|
| 737 |
+
|
| 738 |
+
proc ::tk::console::FontchooserToggle {} {
|
| 739 |
+
if {[tk fontchooser configure -visible]} {
|
| 740 |
+
tk fontchooser hide
|
| 741 |
+
} else {
|
| 742 |
+
tk fontchooser show
|
| 743 |
+
}
|
| 744 |
+
}
|
| 745 |
+
proc ::tk::console::FontchooserVisibility {index} {
|
| 746 |
+
if {[tk fontchooser configure -visible]} {
|
| 747 |
+
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
|
| 748 |
+
} else {
|
| 749 |
+
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
|
| 750 |
+
}
|
| 751 |
+
}
|
| 752 |
+
proc ::tk::console::FontchooserFocus {w isFocusIn} {
|
| 753 |
+
if {$isFocusIn} {
|
| 754 |
+
tk fontchooser configure -parent $w -font TkConsoleFont \
|
| 755 |
+
-command [namespace code [list FontchooserApply]]
|
| 756 |
+
} else {
|
| 757 |
+
tk fontchooser configure -parent $w -font {} -command {}
|
| 758 |
+
}
|
| 759 |
+
}
|
| 760 |
+
proc ::tk::console::FontchooserApply {font args} {
|
| 761 |
+
catch {font configure TkConsoleFont {*}[font actual $font]}
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
# ::tk::console::TagProc --
|
| 765 |
+
#
|
| 766 |
+
# Tags a procedure in the console if it's recognized
|
| 767 |
+
# This procedure is not perfect. However, making it perfect wastes
|
| 768 |
+
# too much CPU time...
|
| 769 |
+
#
|
| 770 |
+
# Arguments:
|
| 771 |
+
# w - console text widget
|
| 772 |
+
|
| 773 |
+
proc ::tk::console::TagProc w {
|
| 774 |
+
if {!$::tk::console::magicKeys} {
|
| 775 |
+
return
|
| 776 |
+
}
|
| 777 |
+
set exp "\[^\\\\\]\[\[ \t\n\r\;{}\"\$\]"
|
| 778 |
+
set i [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
|
| 779 |
+
if {$i eq ""} {
|
| 780 |
+
set i promptEnd
|
| 781 |
+
} else {
|
| 782 |
+
append i +2c
|
| 783 |
+
}
|
| 784 |
+
regsub -all "\[\[\\\\\\?\\*\]" [$w get $i "insert-1c wordend"] {\\\0} c
|
| 785 |
+
if {[llength [EvalAttached [list info commands $c]]]} {
|
| 786 |
+
$w tag add proc $i "insert-1c wordend"
|
| 787 |
+
} else {
|
| 788 |
+
$w tag remove proc $i "insert-1c wordend"
|
| 789 |
+
}
|
| 790 |
+
if {[llength [EvalAttached [list info vars $c]]]} {
|
| 791 |
+
$w tag add var $i "insert-1c wordend"
|
| 792 |
+
} else {
|
| 793 |
+
$w tag remove var $i "insert-1c wordend"
|
| 794 |
+
}
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
# ::tk::console::MatchPair --
|
| 798 |
+
#
|
| 799 |
+
# Blinks a matching pair of characters
|
| 800 |
+
# c2 is assumed to be at the text index 'insert'.
|
| 801 |
+
# This proc is really loopy and took me an hour to figure out given
|
| 802 |
+
# all possible combinations with escaping except for escaped \'s.
|
| 803 |
+
# It doesn't take into account possible commenting... Oh well. If
|
| 804 |
+
# anyone has something better, I'd like to see/use it. This is really
|
| 805 |
+
# only efficient for small contexts.
|
| 806 |
+
#
|
| 807 |
+
# Arguments:
|
| 808 |
+
# w - console text widget
|
| 809 |
+
# c1 - first char of pair
|
| 810 |
+
# c2 - second char of pair
|
| 811 |
+
#
|
| 812 |
+
# Calls: ::tk::console::Blink
|
| 813 |
+
|
| 814 |
+
proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} {
|
| 815 |
+
if {!$::tk::console::magicKeys} {
|
| 816 |
+
return
|
| 817 |
+
}
|
| 818 |
+
if {{} ne [set ix [$w search -back $c1 insert $lim]]} {
|
| 819 |
+
while {
|
| 820 |
+
[string match {\\} [$w get $ix-1c]] &&
|
| 821 |
+
[set ix [$w search -back $c1 $ix-1c $lim]] ne {}
|
| 822 |
+
} {}
|
| 823 |
+
set i1 insert-1c
|
| 824 |
+
while {$ix ne {}} {
|
| 825 |
+
set i0 $ix
|
| 826 |
+
set j 0
|
| 827 |
+
while {[set i0 [$w search $c2 $i0 $i1]] ne {}} {
|
| 828 |
+
append i0 +1c
|
| 829 |
+
if {[string match {\\} [$w get $i0-2c]]} {
|
| 830 |
+
continue
|
| 831 |
+
}
|
| 832 |
+
incr j
|
| 833 |
+
}
|
| 834 |
+
if {!$j} {
|
| 835 |
+
break
|
| 836 |
+
}
|
| 837 |
+
set i1 $ix
|
| 838 |
+
while {$j && [set ix [$w search -back $c1 $ix $lim]] ne {}} {
|
| 839 |
+
if {[string match {\\} [$w get $ix-1c]]} {
|
| 840 |
+
continue
|
| 841 |
+
}
|
| 842 |
+
incr j -1
|
| 843 |
+
}
|
| 844 |
+
}
|
| 845 |
+
if {[string match {} $ix]} {
|
| 846 |
+
set ix [$w index $lim]
|
| 847 |
+
}
|
| 848 |
+
} else {
|
| 849 |
+
set ix [$w index $lim]
|
| 850 |
+
}
|
| 851 |
+
if {$::tk::console::blinkRange} {
|
| 852 |
+
Blink $w $ix [$w index insert]
|
| 853 |
+
} else {
|
| 854 |
+
Blink $w $ix $ix+1c [$w index insert-1c] [$w index insert]
|
| 855 |
+
}
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
# ::tk::console::MatchQuote --
|
| 859 |
+
#
|
| 860 |
+
# Blinks between matching quotes.
|
| 861 |
+
# Blinks just the quote if it's unmatched, otherwise blinks quoted string
|
| 862 |
+
# The quote to match is assumed to be at the text index 'insert'.
|
| 863 |
+
#
|
| 864 |
+
# Arguments:
|
| 865 |
+
# w - console text widget
|
| 866 |
+
#
|
| 867 |
+
# Calls: ::tk::console::Blink
|
| 868 |
+
|
| 869 |
+
proc ::tk::console::MatchQuote {w {lim 1.0}} {
|
| 870 |
+
if {!$::tk::console::magicKeys} {
|
| 871 |
+
return
|
| 872 |
+
}
|
| 873 |
+
set i insert-1c
|
| 874 |
+
set j 0
|
| 875 |
+
while {[set i [$w search -back \" $i $lim]] ne {}} {
|
| 876 |
+
if {[string match {\\} [$w get $i-1c]]} {
|
| 877 |
+
continue
|
| 878 |
+
}
|
| 879 |
+
if {!$j} {
|
| 880 |
+
set i0 $i
|
| 881 |
+
}
|
| 882 |
+
incr j
|
| 883 |
+
}
|
| 884 |
+
if {$j&1} {
|
| 885 |
+
if {$::tk::console::blinkRange} {
|
| 886 |
+
Blink $w $i0 [$w index insert]
|
| 887 |
+
} else {
|
| 888 |
+
Blink $w $i0 $i0+1c [$w index insert-1c] [$w index insert]
|
| 889 |
+
}
|
| 890 |
+
} else {
|
| 891 |
+
Blink $w [$w index insert-1c] [$w index insert]
|
| 892 |
+
}
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
# ::tk::console::Blink --
|
| 896 |
+
#
|
| 897 |
+
# Blinks between n index pairs for a specified duration.
|
| 898 |
+
#
|
| 899 |
+
# Arguments:
|
| 900 |
+
# w - console text widget
|
| 901 |
+
# i1 - start index to blink region
|
| 902 |
+
# i2 - end index of blink region
|
| 903 |
+
# dur - duration in usecs to blink for
|
| 904 |
+
#
|
| 905 |
+
# Outputs:
|
| 906 |
+
# blinks selected characters in $w
|
| 907 |
+
|
| 908 |
+
proc ::tk::console::Blink {w args} {
|
| 909 |
+
eval [list $w tag add blink] $args
|
| 910 |
+
after $::tk::console::blinkTime [list $w] tag remove blink $args
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
# ::tk::console::ConstrainBuffer --
|
| 914 |
+
#
|
| 915 |
+
# This limits the amount of data in the text widget
|
| 916 |
+
# Called by Prompt and ConsoleOutput
|
| 917 |
+
#
|
| 918 |
+
# Arguments:
|
| 919 |
+
# w - console text widget
|
| 920 |
+
# size - # of lines to constrain to
|
| 921 |
+
#
|
| 922 |
+
# Outputs:
|
| 923 |
+
# may delete data in console widget
|
| 924 |
+
|
| 925 |
+
proc ::tk::console::ConstrainBuffer {w size} {
|
| 926 |
+
if {[$w index end] > $size} {
|
| 927 |
+
$w delete 1.0 [expr {int([$w index end])-$size}].0
|
| 928 |
+
}
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
# ::tk::console::Expand --
|
| 932 |
+
#
|
| 933 |
+
# Arguments:
|
| 934 |
+
# ARGS: w - text widget in which to expand str
|
| 935 |
+
# type - type of expansion (path / proc / variable)
|
| 936 |
+
#
|
| 937 |
+
# Calls: ::tk::console::Expand(Pathname|Procname|Variable)
|
| 938 |
+
#
|
| 939 |
+
# Outputs: The string to match is expanded to the longest possible match.
|
| 940 |
+
# If ::tk::console::showMatches is non-zero and the longest match
|
| 941 |
+
# equaled the string to expand, then all possible matches are
|
| 942 |
+
# output to stdout. Triggers bell if no matches are found.
|
| 943 |
+
#
|
| 944 |
+
# Returns: number of matches found
|
| 945 |
+
|
| 946 |
+
proc ::tk::console::Expand {w {type ""}} {
|
| 947 |
+
set exp "\[^\\\\\]\[\[ \t\n\r\\\{\"\\\\\$\]"
|
| 948 |
+
set tmp [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
|
| 949 |
+
if {$tmp eq ""} {
|
| 950 |
+
set tmp promptEnd
|
| 951 |
+
} else {
|
| 952 |
+
append tmp +2c
|
| 953 |
+
}
|
| 954 |
+
if {[$w compare $tmp >= insert]} {
|
| 955 |
+
return
|
| 956 |
+
}
|
| 957 |
+
set str [$w get $tmp insert]
|
| 958 |
+
switch -glob $type {
|
| 959 |
+
path* {
|
| 960 |
+
set res [ExpandPathname $str]
|
| 961 |
+
}
|
| 962 |
+
proc* {
|
| 963 |
+
set res [ExpandProcname $str]
|
| 964 |
+
}
|
| 965 |
+
var* {
|
| 966 |
+
set res [ExpandVariable $str]
|
| 967 |
+
}
|
| 968 |
+
default {
|
| 969 |
+
set res {}
|
| 970 |
+
foreach t {Pathname Procname Variable} {
|
| 971 |
+
if {![catch {Expand$t $str} res] && ($res ne "")} {
|
| 972 |
+
break
|
| 973 |
+
}
|
| 974 |
+
}
|
| 975 |
+
}
|
| 976 |
+
}
|
| 977 |
+
set len [llength $res]
|
| 978 |
+
if {$len} {
|
| 979 |
+
set repl [lindex $res 0]
|
| 980 |
+
$w delete $tmp insert
|
| 981 |
+
$w insert $tmp $repl {input stdin}
|
| 982 |
+
if {($len > 1) && ($::tk::console::showMatches) && ($repl eq $str)} {
|
| 983 |
+
puts stdout [lsort [lreplace $res 0 0]]
|
| 984 |
+
}
|
| 985 |
+
} else {
|
| 986 |
+
bell
|
| 987 |
+
}
|
| 988 |
+
return [incr len -1]
|
| 989 |
+
}
|
| 990 |
+
|
| 991 |
+
# ::tk::console::ExpandPathname --
|
| 992 |
+
#
|
| 993 |
+
# Expand a file pathname based on $str
|
| 994 |
+
# This is based on UNIX file name conventions
|
| 995 |
+
#
|
| 996 |
+
# Arguments:
|
| 997 |
+
# str - partial file pathname to expand
|
| 998 |
+
#
|
| 999 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1000 |
+
#
|
| 1001 |
+
# Returns: list containing longest unique match followed by all the
|
| 1002 |
+
# possible further matches
|
| 1003 |
+
|
| 1004 |
+
proc ::tk::console::ExpandPathname str {
|
| 1005 |
+
set pwd [EvalAttached pwd]
|
| 1006 |
+
if {[catch {EvalAttached [list cd [file dirname $str]]} err opt]} {
|
| 1007 |
+
return -options $opt $err
|
| 1008 |
+
}
|
| 1009 |
+
set dir [file tail $str]
|
| 1010 |
+
## Check to see if it was known to be a directory and keep the trailing
|
| 1011 |
+
## slash if so (file tail cuts it off)
|
| 1012 |
+
if {[string match */ $str]} {
|
| 1013 |
+
append dir /
|
| 1014 |
+
}
|
| 1015 |
+
if {[catch {lsort [EvalAttached [list glob $dir*]]} m]} {
|
| 1016 |
+
set match {}
|
| 1017 |
+
} else {
|
| 1018 |
+
if {[llength $m] > 1} {
|
| 1019 |
+
if { $::tcl_platform(platform) eq "windows" } {
|
| 1020 |
+
## Windows is screwy because it's case insensitive
|
| 1021 |
+
set tmp [ExpandBestMatch [string tolower $m] \
|
| 1022 |
+
[string tolower $dir]]
|
| 1023 |
+
## Don't change case if we haven't changed the word
|
| 1024 |
+
if {[string length $dir]==[string length $tmp]} {
|
| 1025 |
+
set tmp $dir
|
| 1026 |
+
}
|
| 1027 |
+
} else {
|
| 1028 |
+
set tmp [ExpandBestMatch $m $dir]
|
| 1029 |
+
}
|
| 1030 |
+
if {[string match ?*/* $str]} {
|
| 1031 |
+
set tmp [file dirname $str]/$tmp
|
| 1032 |
+
} elseif {[string match /* $str]} {
|
| 1033 |
+
set tmp /$tmp
|
| 1034 |
+
}
|
| 1035 |
+
regsub -all { } $tmp {\\ } tmp
|
| 1036 |
+
set match [linsert $m 0 $tmp]
|
| 1037 |
+
} else {
|
| 1038 |
+
## This may look goofy, but it handles spaces in path names
|
| 1039 |
+
eval append match $m
|
| 1040 |
+
if {[file isdir $match]} {
|
| 1041 |
+
append match /
|
| 1042 |
+
}
|
| 1043 |
+
if {[string match ?*/* $str]} {
|
| 1044 |
+
set match [file dirname $str]/$match
|
| 1045 |
+
} elseif {[string match /* $str]} {
|
| 1046 |
+
set match /$match
|
| 1047 |
+
}
|
| 1048 |
+
regsub -all { } $match {\\ } match
|
| 1049 |
+
## Why is this one needed and the ones below aren't!!
|
| 1050 |
+
set match [list $match]
|
| 1051 |
+
}
|
| 1052 |
+
}
|
| 1053 |
+
EvalAttached [list cd $pwd]
|
| 1054 |
+
return $match
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
# ::tk::console::ExpandProcname --
|
| 1058 |
+
#
|
| 1059 |
+
# Expand a tcl proc name based on $str
|
| 1060 |
+
#
|
| 1061 |
+
# Arguments:
|
| 1062 |
+
# str - partial proc name to expand
|
| 1063 |
+
#
|
| 1064 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1065 |
+
#
|
| 1066 |
+
# Returns: list containing longest unique match followed by all the
|
| 1067 |
+
# possible further matches
|
| 1068 |
+
|
| 1069 |
+
proc ::tk::console::ExpandProcname str {
|
| 1070 |
+
set match [EvalAttached [list info commands $str*]]
|
| 1071 |
+
if {[llength $match] == 0} {
|
| 1072 |
+
set ns [EvalAttached \
|
| 1073 |
+
"namespace children \[namespace current\] [list $str*]"]
|
| 1074 |
+
if {[llength $ns]==1} {
|
| 1075 |
+
set match [EvalAttached [list info commands ${ns}::*]]
|
| 1076 |
+
} else {
|
| 1077 |
+
set match $ns
|
| 1078 |
+
}
|
| 1079 |
+
}
|
| 1080 |
+
if {[llength $match] > 1} {
|
| 1081 |
+
regsub -all { } [ExpandBestMatch $match $str] {\\ } str
|
| 1082 |
+
set match [linsert $match 0 $str]
|
| 1083 |
+
} else {
|
| 1084 |
+
regsub -all { } $match {\\ } match
|
| 1085 |
+
}
|
| 1086 |
+
return $match
|
| 1087 |
+
}
|
| 1088 |
+
|
| 1089 |
+
# ::tk::console::ExpandVariable --
|
| 1090 |
+
#
|
| 1091 |
+
# Expand a tcl variable name based on $str
|
| 1092 |
+
#
|
| 1093 |
+
# Arguments:
|
| 1094 |
+
# str - partial tcl var name to expand
|
| 1095 |
+
#
|
| 1096 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1097 |
+
#
|
| 1098 |
+
# Returns: list containing longest unique match followed by all the
|
| 1099 |
+
# possible further matches
|
| 1100 |
+
|
| 1101 |
+
proc ::tk::console::ExpandVariable str {
|
| 1102 |
+
if {[regexp {([^\(]*)\((.*)} $str -> ary str]} {
|
| 1103 |
+
## Looks like they're trying to expand an array.
|
| 1104 |
+
set match [EvalAttached [list array names $ary $str*]]
|
| 1105 |
+
if {[llength $match] > 1} {
|
| 1106 |
+
set vars $ary\([ExpandBestMatch $match $str]
|
| 1107 |
+
foreach var $match {
|
| 1108 |
+
lappend vars $ary\($var\)
|
| 1109 |
+
}
|
| 1110 |
+
return $vars
|
| 1111 |
+
} elseif {[llength $match] == 1} {
|
| 1112 |
+
set match $ary\($match\)
|
| 1113 |
+
}
|
| 1114 |
+
## Space transformation avoided for array names.
|
| 1115 |
+
} else {
|
| 1116 |
+
set match [EvalAttached [list info vars $str*]]
|
| 1117 |
+
if {[llength $match] > 1} {
|
| 1118 |
+
regsub -all { } [ExpandBestMatch $match $str] {\\ } str
|
| 1119 |
+
set match [linsert $match 0 $str]
|
| 1120 |
+
} else {
|
| 1121 |
+
regsub -all { } $match {\\ } match
|
| 1122 |
+
}
|
| 1123 |
+
}
|
| 1124 |
+
return $match
|
| 1125 |
+
}
|
| 1126 |
+
|
| 1127 |
+
# ::tk::console::ExpandBestMatch --
|
| 1128 |
+
#
|
| 1129 |
+
# Finds the best unique match in a list of names.
|
| 1130 |
+
# The extra $e in this argument allows us to limit the innermost loop a little
|
| 1131 |
+
# further. This improves speed as $l becomes large or $e becomes long.
|
| 1132 |
+
#
|
| 1133 |
+
# Arguments:
|
| 1134 |
+
# l - list to find best unique match in
|
| 1135 |
+
# e - currently best known unique match
|
| 1136 |
+
#
|
| 1137 |
+
# Returns: longest unique match in the list
|
| 1138 |
+
|
| 1139 |
+
proc ::tk::console::ExpandBestMatch {l {e {}}} {
|
| 1140 |
+
set ec [lindex $l 0]
|
| 1141 |
+
if {[llength $l]>1} {
|
| 1142 |
+
set e [expr {[string length $e] - 1}]
|
| 1143 |
+
set ei [expr {[string length $ec] - 1}]
|
| 1144 |
+
foreach l $l {
|
| 1145 |
+
while {$ei>=$e && [string first $ec $l]} {
|
| 1146 |
+
set ec [string range $ec 0 [incr ei -1]]
|
| 1147 |
+
}
|
| 1148 |
+
}
|
| 1149 |
+
}
|
| 1150 |
+
return $ec
|
| 1151 |
+
}
|
| 1152 |
+
|
| 1153 |
+
# now initialize the console
|
| 1154 |
+
::tk::ConsoleInit
|
miniconda3/envs/active_proaction/lib/tk8.6/demos/README
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This directory contains a collection of programs to demonstrate
|
| 2 |
+
the features of the Tk toolkit. The programs are all scripts for
|
| 3 |
+
"wish", a windowing shell. If wish has been installed on your path
|
| 4 |
+
then you can invoke any of the programs in this directory just
|
| 5 |
+
by typing its file name to your command shell under Unix. Otherwise
|
| 6 |
+
invoke wish with the file as its first argument, e.g., "wish hello".
|
| 7 |
+
The rest of this file contains a brief description of each program.
|
| 8 |
+
Files with names ending in ".tcl" are procedure packages used by one
|
| 9 |
+
or more of the demo programs; they can't be used as programs by
|
| 10 |
+
themselves so they aren't described below.
|
| 11 |
+
|
| 12 |
+
hello - Creates a single button; if you click on it, a message
|
| 13 |
+
is typed and the application terminates.
|
| 14 |
+
|
| 15 |
+
widget - Contains a collection of demonstrations of the widgets
|
| 16 |
+
currently available in the Tk library. Most of the .tcl
|
| 17 |
+
files are scripts for individual demos available through
|
| 18 |
+
the "widget" program.
|
| 19 |
+
|
| 20 |
+
ixset - A simple Tk-based wrapper for the "xset" program, which
|
| 21 |
+
allows you to interactively query and set various X options
|
| 22 |
+
such as mouse acceleration and bell volume. Thanks to
|
| 23 |
+
Pierre David for contributing this example.
|
| 24 |
+
|
| 25 |
+
rolodex - A mock-up of a simple rolodex application. It has much of
|
| 26 |
+
the user interface for such an application but no back-end
|
| 27 |
+
database. This program was written in response to Tom
|
| 28 |
+
LaStrange's toolkit benchmark challenge.
|
| 29 |
+
|
| 30 |
+
tcolor - A color editor. Allows you to edit colors in several
|
| 31 |
+
different ways, and will also perform automatic updates
|
| 32 |
+
using "send".
|
| 33 |
+
|
| 34 |
+
rmt - Allows you to "hook-up" remotely to any Tk application
|
| 35 |
+
on the display. Select an application with the menu,
|
| 36 |
+
then just type commands: they'll go to that application.
|
| 37 |
+
|
| 38 |
+
timer - Displays a seconds timer with start and stop buttons.
|
| 39 |
+
Control-c and control-q cause it to exit.
|
| 40 |
+
|
| 41 |
+
browse - A simple directory browser. Invoke it with and argument
|
| 42 |
+
giving the name of the directory you'd like to browse.
|
| 43 |
+
Double-click on files or subdirectories to browse them.
|
| 44 |
+
Control-c and control-q cause the program to exit.
|
miniconda3/envs/active_proaction/lib/tk8.6/demos/anilabel.tcl
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# anilabel.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# several animated label widgets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .anilabel
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Animated Label Demonstration"
|
| 16 |
+
wm iconname $w "anilabel"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "Four animated labels are displayed below; each of the labels on the left is animated by making the text message inside it appear to scroll, and the label on the right is animated by animating the image that it displays."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
# Ensure that this this is an array
|
| 27 |
+
array set animationCallbacks {}
|
| 28 |
+
|
| 29 |
+
## This callback is the core of how to do animation in Tcl/Tk; all
|
| 30 |
+
## animations work in basically the same way, with a procedure that
|
| 31 |
+
## uses the [after] command to reschedule itself at some point in the
|
| 32 |
+
## future. Of course, the details of how to update the state will vary
|
| 33 |
+
## according to what is being animated.
|
| 34 |
+
proc RotateLabelText {w interval} {
|
| 35 |
+
global animationCallbacks
|
| 36 |
+
|
| 37 |
+
# Schedule the calling of this procedure again in the future
|
| 38 |
+
set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
|
| 39 |
+
|
| 40 |
+
# We do marquee-like scrolling text by chopping characters off the
|
| 41 |
+
# front of the text and sticking them on the end.
|
| 42 |
+
set text [$w cget -text]
|
| 43 |
+
set newText [string range $text 1 end][string index $text 0]
|
| 44 |
+
$w configure -text $newText
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
## A helper procedure to start the animation happening.
|
| 48 |
+
proc animateLabelText {w text interval} {
|
| 49 |
+
global animationCallbacks
|
| 50 |
+
|
| 51 |
+
# Install the text into the widget
|
| 52 |
+
$w configure -text $text
|
| 53 |
+
|
| 54 |
+
# Schedule the start of the animation loop
|
| 55 |
+
set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
|
| 56 |
+
|
| 57 |
+
# Make sure that the animation stops and is cleaned up after itself
|
| 58 |
+
# when the animated label is destroyed. Note that at this point we
|
| 59 |
+
# cannot manipulate the widget itself, as that has already died.
|
| 60 |
+
bind $w <Destroy> {
|
| 61 |
+
after cancel $animationCallbacks(%W)
|
| 62 |
+
unset animationCallbacks(%W)
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
## Next, a similar pair of procedures to animate a GIF loaded into a
|
| 67 |
+
## photo image.
|
| 68 |
+
proc SelectNextImageFrame {w interval} {
|
| 69 |
+
global animationCallbacks
|
| 70 |
+
set animationCallbacks($w) \
|
| 71 |
+
[after $interval SelectNextImageFrame $w $interval]
|
| 72 |
+
set image [$w cget -image]
|
| 73 |
+
|
| 74 |
+
# The easy way to animate a GIF!
|
| 75 |
+
set idx -1
|
| 76 |
+
scan [$image cget -format] "GIF -index %d" idx
|
| 77 |
+
if {[catch {
|
| 78 |
+
# Note that we get an error if the index is out of range
|
| 79 |
+
$image configure -format "GIF -index [incr idx]"
|
| 80 |
+
}]} then {
|
| 81 |
+
$image configure -format "GIF -index 0"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
proc animateLabelImage {w imageData interval} {
|
| 85 |
+
global animationCallbacks
|
| 86 |
+
|
| 87 |
+
# Create a multi-frame GIF from base-64-encoded data
|
| 88 |
+
set image [image create photo -format GIF -data $imageData]
|
| 89 |
+
|
| 90 |
+
# Install the image into the widget
|
| 91 |
+
$w configure -image $image
|
| 92 |
+
|
| 93 |
+
# Schedule the start of the animation loop
|
| 94 |
+
set animationCallbacks($w) \
|
| 95 |
+
[after $interval SelectNextImageFrame $w $interval]
|
| 96 |
+
|
| 97 |
+
# Make sure that the animation stops and is cleaned up after itself
|
| 98 |
+
# when the animated label is destroyed. Note that at this point we
|
| 99 |
+
# cannot manipulate the widget itself, as that has already died.
|
| 100 |
+
# Also note that this script is in double-quotes; this is always OK
|
| 101 |
+
# because image names are chosen automatically to be simple words.
|
| 102 |
+
bind $w <Destroy> "
|
| 103 |
+
after cancel \$animationCallbacks(%W)
|
| 104 |
+
unset animationCallbacks(%W)
|
| 105 |
+
rename $image {}
|
| 106 |
+
"
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
# Make some widgets to contain the animations
|
| 110 |
+
labelframe $w.left -text "Scrolling Texts"
|
| 111 |
+
labelframe $w.right -text "GIF Image"
|
| 112 |
+
pack $w.left $w.right -side left -padx 10 -pady 10 -expand yes
|
| 113 |
+
|
| 114 |
+
# This method of scrolling text looks far better with a fixed-width font
|
| 115 |
+
label $w.left.l1 -bd 4 -relief ridge -font fixedFont
|
| 116 |
+
label $w.left.l2 -bd 4 -relief groove -font fixedFont
|
| 117 |
+
label $w.left.l3 -bd 4 -relief flat -font fixedFont -width 18
|
| 118 |
+
pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -padx 10 -pady 10 -anchor w
|
| 119 |
+
# Don't need to do very much with this label except turn off the border
|
| 120 |
+
label $w.right.l -bd 0
|
| 121 |
+
pack $w.right.l -side top -expand yes -padx 10 -pady 10
|
| 122 |
+
|
| 123 |
+
# This is a base-64-encoded animated GIF file.
|
| 124 |
+
set tclPoweredData {
|
| 125 |
+
R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM
|
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
| 141 |
+
4CIHHGzgwYw01ujBBhvAqKOLLq5AAk9kuSPkkKO40NB+h1gnypJIIvkBf09a
|
| 142 |
+
N5QIRz5p5ZJXJpmlIVhOGQA2TmIJZZhKKmmll2BqyWSXWUrZpQtpatlmk1c2
|
| 143 |
+
KaWRHeTZEJF8SqLDn/hhsOeQgBbqAh6DGqronxeARUIIACH5BAUeAAAALAUA
|
| 144 |
+
LgAFAAUAAAUM4CeKz/OV5YmqaRkCACH5BAUeAAEALAUALgAKAAUAAAUUICCK
|
| 145 |
+
z/OdJVCaa7p+7aOWcDvTZwgAIfkEBR4AAQAsCwAuAAkABQAABRPgA4zP95zA
|
| 146 |
+
eZqoWqqpyqLkZ38hACH5BAUKAAEALAcALgANAA4AAAU7ICA+jwiUJEqeKau+
|
| 147 |
+
r+vGaTmac63v/GP9HM7GQyx+jsgkkoRUHJ3Qx0cK/VQVTKtWwbVKn9suNunc
|
| 148 |
+
WkMAIfkEBQoAAAAsBwA3AAcABQAABRGgIHzk842j+Yjlt5KuO8JmCAAh+QQF
|
| 149 |
+
CgAAACwLADcABwAFAAAFEeAnfN9TjqP5oOWziq05lmUIACH5BAUKAAAALA8A
|
| 150 |
+
NwAHAAUAAAUPoPCJTymS3yiQj4qOcPmEACH5BAUKAAAALBMANwAHAAUAAAUR
|
| 151 |
+
oCB+z/MJX2o+I2miKimiawgAIfkEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j
|
| 152 |
+
Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7
|
| 153 |
+
ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw==
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
# Finally, set up the text scrolling animation
|
| 157 |
+
animateLabelText $w.left.l1 "* Slow Animation *" 300
|
| 158 |
+
animateLabelText $w.left.l2 "* Fast Animation *" 80
|
| 159 |
+
animateLabelText $w.left.l3 "This is a longer scrolling text in a widget that will not show the whole message at once. " 150
|
| 160 |
+
animateLabelImage $w.right.l $tclPoweredData 100
|
miniconda3/envs/active_proaction/lib/tk8.6/demos/aniwave.tcl
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# aniwave.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script illustrates how to adjust canvas item
|
| 4 |
+
# coordinates in a way that does something fairly similar to waveform
|
| 5 |
+
# display.
|
| 6 |
+
|
| 7 |
+
if {![info exists widgetDemo]} {
|
| 8 |
+
error "This script should be run from the \"widget\" demo."
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
package require Tk
|
| 12 |
+
|
| 13 |
+
set w .aniwave
|
| 14 |
+
catch {destroy $w}
|
| 15 |
+
toplevel $w
|
| 16 |
+
wm title $w "Animated Wave Demonstration"
|
| 17 |
+
wm iconname $w "aniwave"
|
| 18 |
+
positionWindow $w
|
| 19 |
+
|
| 20 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line."
|
| 21 |
+
pack $w.msg -side top
|
| 22 |
+
|
| 23 |
+
## See Code / Dismiss buttons
|
| 24 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 25 |
+
pack $btns -side bottom -fill x
|
| 26 |
+
|
| 27 |
+
# Create a canvas large enough to hold the wave. In fact, the wave
|
| 28 |
+
# sticks off both sides of the canvas to prevent visual glitches.
|
| 29 |
+
pack [canvas $w.c -width 300 -height 200 -background black] -padx 10 -pady 10 -expand yes
|
| 30 |
+
|
| 31 |
+
# Ensure that this this is an array
|
| 32 |
+
array set animationCallbacks {}
|
| 33 |
+
|
| 34 |
+
# Creates a coordinates list of a wave. This code does a very sketchy
|
| 35 |
+
# job and relies on Tk's line smoothing to make things look better.
|
| 36 |
+
set waveCoords {}
|
| 37 |
+
for {set x -10} {$x<=300} {incr x 5} {
|
| 38 |
+
lappend waveCoords $x 100
|
| 39 |
+
}
|
| 40 |
+
lappend waveCoords $x 0 [incr x 5] 200
|
| 41 |
+
|
| 42 |
+
# Create a smoothed line and arrange for its coordinates to be the
|
| 43 |
+
# contents of the variable waveCoords.
|
| 44 |
+
$w.c create line $waveCoords -tags wave -width 1 -fill green -smooth 1
|
| 45 |
+
proc waveCoordsTracer {w args} {
|
| 46 |
+
global waveCoords
|
| 47 |
+
# Actual visual update will wait until we have finished
|
| 48 |
+
# processing; Tk does that for us automatically.
|
| 49 |
+
$w.c coords wave $waveCoords
|
| 50 |
+
}
|
| 51 |
+
trace add variable waveCoords write [list waveCoordsTracer $w]
|
| 52 |
+
|
| 53 |
+
# Basic motion handler. Given what direction the wave is travelling
|
| 54 |
+
# in, it advances the y coordinates in the coordinate-list one step in
|
| 55 |
+
# that direction.
|
| 56 |
+
proc basicMotion {} {
|
| 57 |
+
global waveCoords direction
|
| 58 |
+
set oc $waveCoords
|
| 59 |
+
for {set i 1} {$i<[llength $oc]} {incr i 2} {
|
| 60 |
+
if {$direction eq "left"} {
|
| 61 |
+
lset waveCoords $i [lindex $oc \
|
| 62 |
+
[expr {$i+2>[llength $oc] ? 1 : $i+2}]]
|
| 63 |
+
} else {
|
| 64 |
+
lset waveCoords $i \
|
| 65 |
+
[lindex $oc [expr {$i-2<0 ? "end" : $i-2}]]
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
# Oscillation handler. This detects whether to reverse the direction
|
| 71 |
+
# of the wave by checking to see if the peak of the wave has moved off
|
| 72 |
+
# the screen (whose size we know already.)
|
| 73 |
+
proc reverser {} {
|
| 74 |
+
global waveCoords direction
|
| 75 |
+
if {[lindex $waveCoords 1] < 10} {
|
| 76 |
+
set direction "right"
|
| 77 |
+
} elseif {[lindex $waveCoords end] < 10} {
|
| 78 |
+
set direction "left"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
# Main animation "loop". This calls the two procedures that handle the
|
| 83 |
+
# movement repeatedly by scheduling asynchronous calls back to itself
|
| 84 |
+
# using the [after] command. This procedure is the fundamental basis
|
| 85 |
+
# for all animated effect handling in Tk.
|
| 86 |
+
proc move {} {
|
| 87 |
+
basicMotion
|
| 88 |
+
reverser
|
| 89 |
+
|
| 90 |
+
# Theoretically 100 frames-per-second (==10ms between frames)
|
| 91 |
+
global animationCallbacks
|
| 92 |
+
set animationCallbacks(simpleWave) [after 10 move]
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
# Initialise our remaining animation variables
|
| 96 |
+
set direction "left"
|
| 97 |
+
set animateAfterCallback {}
|
| 98 |
+
# Arrange for the animation loop to stop when the canvas is deleted
|
| 99 |
+
bind $w.c <Destroy> {
|
| 100 |
+
after cancel $animationCallbacks(simpleWave)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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# arrow.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a canvas widget that displays a
|
| 4 |
+
# large line with an arrowhead whose shape can be edited interactively.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
# arrowSetup --
|
| 13 |
+
# This procedure regenerates all the text and graphics in the canvas
|
| 14 |
+
# window. It's called when the canvas is initially created, and also
|
| 15 |
+
# whenever any of the parameters of the arrow head are changed
|
| 16 |
+
# interactively.
|
| 17 |
+
#
|
| 18 |
+
# Arguments:
|
| 19 |
+
# c - Name of the canvas widget.
|
| 20 |
+
|
| 21 |
+
proc arrowSetup c {
|
| 22 |
+
upvar #0 demo_arrowInfo v
|
| 23 |
+
|
| 24 |
+
# Remember the current box, if there is one.
|
| 25 |
+
|
| 26 |
+
set tags [$c gettags current]
|
| 27 |
+
if {$tags != ""} {
|
| 28 |
+
set cur [lindex $tags [lsearch -glob $tags box?]]
|
| 29 |
+
} else {
|
| 30 |
+
set cur ""
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
# Create the arrow and outline.
|
| 34 |
+
|
| 35 |
+
$c delete all
|
| 36 |
+
eval {$c create line $v(x1) $v(y) $v(x2) $v(y) -arrow last \
|
| 37 |
+
-width [expr {10*$v(width)}] -arrowshape [list \
|
| 38 |
+
[expr {10*$v(a)}] [expr {10*$v(b)}] [expr {10*$v(c)}]]} \
|
| 39 |
+
$v(bigLineStyle)
|
| 40 |
+
set xtip [expr {$v(x2)-10*$v(b)}]
|
| 41 |
+
set deltaY [expr {10*$v(c)+5*$v(width)}]
|
| 42 |
+
$c create line $v(x2) $v(y) $xtip [expr {$v(y)+$deltaY}] \
|
| 43 |
+
[expr {$v(x2)-10*$v(a)}] $v(y) $xtip [expr {$v(y)-$deltaY}] \
|
| 44 |
+
$v(x2) $v(y) -width 2 -capstyle round -joinstyle round
|
| 45 |
+
|
| 46 |
+
# Create the boxes for reshaping the line and arrowhead.
|
| 47 |
+
|
| 48 |
+
eval {$c create rect [expr {$v(x2)-10*$v(a)-5}] [expr {$v(y)-5}] \
|
| 49 |
+
[expr {$v(x2)-10*$v(a)+5}] [expr {$v(y)+5}] \
|
| 50 |
+
-tags {box1 box}} $v(boxStyle)
|
| 51 |
+
eval {$c create rect [expr {$xtip-5}] [expr {$v(y)-$deltaY-5}] \
|
| 52 |
+
[expr {$xtip+5}] [expr {$v(y)-$deltaY+5}] \
|
| 53 |
+
-tags {box2 box}} $v(boxStyle)
|
| 54 |
+
eval {$c create rect [expr {$v(x1)-5}] [expr {$v(y)-5*$v(width)-5}] \
|
| 55 |
+
[expr {$v(x1)+5}] [expr {$v(y)-5*$v(width)+5}] \
|
| 56 |
+
-tags {box3 box}} $v(boxStyle)
|
| 57 |
+
if {$cur != ""} {
|
| 58 |
+
eval $c itemconfigure $cur $v(activeStyle)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# Create three arrows in actual size with the same parameters
|
| 62 |
+
|
| 63 |
+
$c create line [expr {$v(x2)+50}] 0 [expr {$v(x2)+50}] 1000 \
|
| 64 |
+
-width 2
|
| 65 |
+
set tmp [expr {$v(x2)+100}]
|
| 66 |
+
$c create line $tmp [expr {$v(y)-125}] $tmp [expr {$v(y)-75}] \
|
| 67 |
+
-width $v(width) \
|
| 68 |
+
-arrow both -arrowshape "$v(a) $v(b) $v(c)"
|
| 69 |
+
$c create line [expr {$tmp-25}] $v(y) [expr {$tmp+25}] $v(y) \
|
| 70 |
+
-width $v(width) \
|
| 71 |
+
-arrow both -arrowshape "$v(a) $v(b) $v(c)"
|
| 72 |
+
$c create line [expr {$tmp-25}] [expr {$v(y)+75}] [expr {$tmp+25}] \
|
| 73 |
+
[expr {$v(y)+125}] -width $v(width) \
|
| 74 |
+
-arrow both -arrowshape "$v(a) $v(b) $v(c)"
|
| 75 |
+
|
| 76 |
+
# Create a bunch of other arrows and text items showing the
|
| 77 |
+
# current dimensions.
|
| 78 |
+
|
| 79 |
+
set tmp [expr {$v(x2)+10}]
|
| 80 |
+
$c create line $tmp [expr {$v(y)-5*$v(width)}] \
|
| 81 |
+
$tmp [expr {$v(y)-$deltaY}] \
|
| 82 |
+
-arrow both -arrowshape $v(smallTips)
|
| 83 |
+
$c create text [expr {$v(x2)+15}] [expr {$v(y)-$deltaY+5*$v(c)}] \
|
| 84 |
+
-text $v(c) -anchor w
|
| 85 |
+
set tmp [expr {$v(x1)-10}]
|
| 86 |
+
$c create line $tmp [expr {$v(y)-5*$v(width)}] \
|
| 87 |
+
$tmp [expr {$v(y)+5*$v(width)}] \
|
| 88 |
+
-arrow both -arrowshape $v(smallTips)
|
| 89 |
+
$c create text [expr {$v(x1)-15}] $v(y) -text $v(width) -anchor e
|
| 90 |
+
set tmp [expr {$v(y)+5*$v(width)+10*$v(c)+10}]
|
| 91 |
+
$c create line [expr {$v(x2)-10*$v(a)}] $tmp $v(x2) $tmp \
|
| 92 |
+
-arrow both -arrowshape $v(smallTips)
|
| 93 |
+
$c create text [expr {$v(x2)-5*$v(a)}] [expr {$tmp+5}] \
|
| 94 |
+
-text $v(a) -anchor n
|
| 95 |
+
set tmp [expr {$tmp+25}]
|
| 96 |
+
$c create line [expr {$v(x2)-10*$v(b)}] $tmp $v(x2) $tmp \
|
| 97 |
+
-arrow both -arrowshape $v(smallTips)
|
| 98 |
+
$c create text [expr {$v(x2)-5*$v(b)}] [expr {$tmp+5}] \
|
| 99 |
+
-text $v(b) -anchor n
|
| 100 |
+
|
| 101 |
+
$c create text $v(x1) 310 -text "-width $v(width)" \
|
| 102 |
+
-anchor w -font {Helvetica 18}
|
| 103 |
+
$c create text $v(x1) 330 -text "-arrowshape {$v(a) $v(b) $v(c)}" \
|
| 104 |
+
-anchor w -font {Helvetica 18}
|
| 105 |
+
|
| 106 |
+
incr v(count)
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
set w .arrow
|
| 110 |
+
catch {destroy $w}
|
| 111 |
+
toplevel $w
|
| 112 |
+
wm title $w "Arrowhead Editor Demonstration"
|
| 113 |
+
wm iconname $w "arrow"
|
| 114 |
+
positionWindow $w
|
| 115 |
+
set c $w.c
|
| 116 |
+
|
| 117 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."
|
| 118 |
+
pack $w.msg -side top
|
| 119 |
+
|
| 120 |
+
## See Code / Dismiss buttons
|
| 121 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 122 |
+
pack $btns -side bottom -fill x
|
| 123 |
+
|
| 124 |
+
canvas $c -width 500 -height 350 -relief sunken -borderwidth 2
|
| 125 |
+
pack $c -expand yes -fill both
|
| 126 |
+
|
| 127 |
+
set demo_arrowInfo(a) 8
|
| 128 |
+
set demo_arrowInfo(b) 10
|
| 129 |
+
set demo_arrowInfo(c) 3
|
| 130 |
+
set demo_arrowInfo(width) 2
|
| 131 |
+
set demo_arrowInfo(motionProc) arrowMoveNull
|
| 132 |
+
set demo_arrowInfo(x1) 40
|
| 133 |
+
set demo_arrowInfo(x2) 350
|
| 134 |
+
set demo_arrowInfo(y) 150
|
| 135 |
+
set demo_arrowInfo(smallTips) {5 5 2}
|
| 136 |
+
set demo_arrowInfo(count) 0
|
| 137 |
+
if {[winfo depth $c] > 1} {
|
| 138 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 139 |
+
set demo_arrowInfo(bigLineStyle) "-fill systemSelectedTextBackgroundColor"
|
| 140 |
+
} else {
|
| 141 |
+
set demo_arrowInfo(bigLineStyle) "-fill LightSeaGreen"
|
| 142 |
+
}
|
| 143 |
+
set demo_arrowInfo(boxStyle) "-fill {} -width 1"
|
| 144 |
+
set demo_arrowInfo(activeStyle) "-fill red -width 1"
|
| 145 |
+
} else {
|
| 146 |
+
# Main widget program sets variable tk_demoDirectory
|
| 147 |
+
set demo_arrowInfo(bigLineStyle) "-fill black \
|
| 148 |
+
-stipple @[file join $tk_demoDirectory images grey.25]"
|
| 149 |
+
set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
|
| 150 |
+
set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1"
|
| 151 |
+
}
|
| 152 |
+
arrowSetup $c
|
| 153 |
+
$c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
|
| 154 |
+
$c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
|
| 155 |
+
$c bind box <B1-Enter> " "
|
| 156 |
+
$c bind box <B1-Leave> " "
|
| 157 |
+
$c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
|
| 158 |
+
$c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
|
| 159 |
+
$c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
|
| 160 |
+
$c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
|
| 161 |
+
bind $c <ButtonRelease-1> "arrowSetup $c"
|
| 162 |
+
|
| 163 |
+
# arrowMove1 --
|
| 164 |
+
# This procedure is called for each mouse motion event on box1 (the
|
| 165 |
+
# one at the vertex of the arrow). It updates the controlling parameters
|
| 166 |
+
# for the line and arrowhead.
|
| 167 |
+
#
|
| 168 |
+
# Arguments:
|
| 169 |
+
# c - The name of the canvas window.
|
| 170 |
+
# x, y - The coordinates of the mouse.
|
| 171 |
+
|
| 172 |
+
proc arrowMove1 {c x y} {
|
| 173 |
+
upvar #0 demo_arrowInfo v
|
| 174 |
+
set newA [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
|
| 175 |
+
if {$newA < 0} {
|
| 176 |
+
set newA 0
|
| 177 |
+
}
|
| 178 |
+
if {$newA > 25} {
|
| 179 |
+
set newA 25
|
| 180 |
+
}
|
| 181 |
+
if {$newA != $v(a)} {
|
| 182 |
+
$c move box1 [expr {10*($v(a)-$newA)}] 0
|
| 183 |
+
set v(a) $newA
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
# arrowMove2 --
|
| 188 |
+
# This procedure is called for each mouse motion event on box2 (the
|
| 189 |
+
# one at the trailing tip of the arrowhead). It updates the controlling
|
| 190 |
+
# parameters for the line and arrowhead.
|
| 191 |
+
#
|
| 192 |
+
# Arguments:
|
| 193 |
+
# c - The name of the canvas window.
|
| 194 |
+
# x, y - The coordinates of the mouse.
|
| 195 |
+
|
| 196 |
+
proc arrowMove2 {c x y} {
|
| 197 |
+
upvar #0 demo_arrowInfo v
|
| 198 |
+
set newB [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
|
| 199 |
+
if {$newB < 0} {
|
| 200 |
+
set newB 0
|
| 201 |
+
}
|
| 202 |
+
if {$newB > 25} {
|
| 203 |
+
set newB 25
|
| 204 |
+
}
|
| 205 |
+
set newC [expr {($v(y)+5-round([$c canvasy $y])-5*$v(width))/10}]
|
| 206 |
+
if {$newC < 0} {
|
| 207 |
+
set newC 0
|
| 208 |
+
}
|
| 209 |
+
if {$newC > 20} {
|
| 210 |
+
set newC 20
|
| 211 |
+
}
|
| 212 |
+
if {($newB != $v(b)) || ($newC != $v(c))} {
|
| 213 |
+
$c move box2 [expr {10*($v(b)-$newB)}] [expr {10*($v(c)-$newC)}]
|
| 214 |
+
set v(b) $newB
|
| 215 |
+
set v(c) $newC
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
# arrowMove3 --
|
| 220 |
+
# This procedure is called for each mouse motion event on box3 (the
|
| 221 |
+
# one that controls the thickness of the line). It updates the
|
| 222 |
+
# controlling parameters for the line and arrowhead.
|
| 223 |
+
#
|
| 224 |
+
# Arguments:
|
| 225 |
+
# c - The name of the canvas window.
|
| 226 |
+
# x, y - The coordinates of the mouse.
|
| 227 |
+
|
| 228 |
+
proc arrowMove3 {c x y} {
|
| 229 |
+
upvar #0 demo_arrowInfo v
|
| 230 |
+
set newWidth [expr {($v(y)+2-round([$c canvasy $y]))/5}]
|
| 231 |
+
if {$newWidth < 0} {
|
| 232 |
+
set newWidth 0
|
| 233 |
+
}
|
| 234 |
+
if {$newWidth > 20} {
|
| 235 |
+
set newWidth 20
|
| 236 |
+
}
|
| 237 |
+
if {$newWidth != $v(width)} {
|
| 238 |
+
$c move box3 0 [expr {5*($v(width)-$newWidth)}]
|
| 239 |
+
set v(width) $newWidth
|
| 240 |
+
}
|
| 241 |
+
}
|
miniconda3/envs/active_proaction/lib/tk8.6/demos/bind.tcl
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# bind.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a text widget with bindings set
|
| 4 |
+
# up for hypertext-like effects.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .bind
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Text Demonstration - Tag Bindings"
|
| 16 |
+
wm iconname $w "bind"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
## See Code / Dismiss buttons
|
| 20 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 21 |
+
pack $btns -side bottom -fill x
|
| 22 |
+
|
| 23 |
+
text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
|
| 24 |
+
-width 60 -height 24 -font $font -wrap word
|
| 25 |
+
ttk::scrollbar $w.scroll -command "$w.text yview"
|
| 26 |
+
pack $w.scroll -side right -fill y
|
| 27 |
+
pack $w.text -expand yes -fill both
|
| 28 |
+
|
| 29 |
+
# Set up display styles.
|
| 30 |
+
|
| 31 |
+
if {[winfo depth $w] > 1} {
|
| 32 |
+
set bold "-background #43ce80 -relief raised -borderwidth 1"
|
| 33 |
+
set normal "-background {} -relief flat"
|
| 34 |
+
} else {
|
| 35 |
+
set bold "-foreground white -background black"
|
| 36 |
+
set normal "-foreground {} -background {}"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Add text to widget.
|
| 40 |
+
|
| 41 |
+
$w.text insert 0.0 {\
|
| 42 |
+
The same tag mechanism that controls display styles in text widgets can also be used to associate Tcl commands with regions of text, so that mouse or keyboard actions on the text cause particular Tcl commands to be invoked. For example, in the text below the descriptions of the canvas demonstrations have been tagged. When you move the mouse over a demo description the description lights up, and when you press button 1 over a description then that particular demonstration is invoked.
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
$w.text insert end \
|
| 46 |
+
{1. Samples of all the different types of items that can be created in canvas widgets.} d1
|
| 47 |
+
$w.text insert end \n\n
|
| 48 |
+
$w.text insert end \
|
| 49 |
+
{2. A simple two-dimensional plot that allows you to adjust the positions of the data points.} d2
|
| 50 |
+
$w.text insert end \n\n
|
| 51 |
+
$w.text insert end \
|
| 52 |
+
{3. Anchoring and justification modes for text items.} d3
|
| 53 |
+
$w.text insert end \n\n
|
| 54 |
+
$w.text insert end \
|
| 55 |
+
{4. An editor for arrow-head shapes for line items.} d4
|
| 56 |
+
$w.text insert end \n\n
|
| 57 |
+
$w.text insert end \
|
| 58 |
+
{5. A ruler with facilities for editing tab stops.} d5
|
| 59 |
+
$w.text insert end \n\n
|
| 60 |
+
$w.text insert end \
|
| 61 |
+
{6. A grid that demonstrates how canvases can be scrolled.} d6
|
| 62 |
+
|
| 63 |
+
# Create bindings for tags.
|
| 64 |
+
|
| 65 |
+
foreach tag {d1 d2 d3 d4 d5 d6} {
|
| 66 |
+
$w.text tag bind $tag <Enter> "$w.text tag configure $tag $bold"
|
| 67 |
+
$w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
|
| 68 |
+
}
|
| 69 |
+
# Main widget program sets variable tk_demoDirectory
|
| 70 |
+
$w.text tag bind d1 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
|
| 71 |
+
$w.text tag bind d2 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
|
| 72 |
+
$w.text tag bind d3 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
|
| 73 |
+
$w.text tag bind d4 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
|
| 74 |
+
$w.text tag bind d5 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
|
| 75 |
+
$w.text tag bind d6 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
|
| 76 |
+
|
| 77 |
+
$w.text mark set insert 0.0
|
| 78 |
+
$w.text configure -state disabled
|