698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
|
#
# NOTE: This procedure, which may only be used from an Eagle script, checks
# if a native Tcl library is loaded and ready. If not, a script error
# is raised.
#
proc tclMustBeReady {} {
#
# NOTE: This procedure is not allowed to actually load a native Tcl
# library; therefore, one must already be loaded.
#
if {![isEagle]} then {
error "already running in Tcl language"
}
if {![tcl ready]} then {
error "cannot use Tcl language, supporting library is not loaded"
}
}
#
# NOTE: This procedure, which may only be used from a native Tcl script,
# checks if Garuda and Eagle are loaded and ready. If not, a script
# error is raised.
#
proc eagleMustBeReady {} {
#
# NOTE: This procedure is not allowed to actually load Garuda (and
# Eagle); therefore, they must already be loaded.
#
if {[isEagle]} then {
error "already running in Eagle language"
}
if {[llength [info commands eagle]] == 0} then {
error "cannot use Eagle language, supporting package is not loaded"
}
}
#
# NOTE: This procedure returns non-zero if the current script is being
# evaluated in Eagle with signed-only script security enabled.
# There are no arguments.
#
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
>
>
>
>
|
|
>
>
>
>
>
|
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
|
#
# NOTE: This procedure, which may only be used from an Eagle script, checks
# if a native Tcl library is loaded and ready. If not, a script error
# is raised.
#
proc tclMustBeReady {} {
#
# NOTE: This procedure is useless when running in native Tcl; therefore,
# forbid its use there.
#
if {![isEagle]} then {
error "already running in Tcl language"
}
#
# NOTE: This procedure is not allowed to actually load a native Tcl
# library; therefore, one must already be loaded.
#
if {![tcl ready]} then {
error "cannot use Tcl language, supporting library is not loaded"
}
}
#
# NOTE: This procedure is designed for Eagle. It attempts to load the
# "best" native Tcl library. It may raise any number of script
# errors.
#
proc makeTclReady {} {
#
# NOTE: This procedure is useless when running in native Tcl; therefore,
# forbid its use there.
#
if {![isEagle]} then {
error "already running in Tcl language"
}
#
# NOTE: Load a native Tcl library. It absolutely must be signed with a
# valid Authenticode signature.
#
tcl load -findflags +TrustedOnly -loadflags +SetDllDirectory
#
# NOTE: Verify that the native Tcl library appears to have beed loaded
# into this interpreter.
#
tclMustBeReady
}
#
# NOTE: This procedure, which may only be used from a native Tcl script,
# checks if Garuda and Eagle are loaded and ready. If not, a script
# error is raised.
#
proc eagleMustBeReady {} {
#
# NOTE: This procedure is useless when running in Eagle; therefore,
# forbid its use there.
#
if {[isEagle]} then {
error "already running in Eagle language"
}
#
# NOTE: This procedure is not allowed to actually load Garuda (and
# Eagle); therefore, they must already be loaded.
#
if {[llength [info commands eagle]] == 0} then {
error "cannot use Eagle language, supporting package is not loaded"
}
}
#
# NOTE: This procedure is designed for native Tcl. It attempts to load
# the Garuda package and gain access to Eagle. It may raise any
# number of script errors.
#
proc makeEagleReady {} {
#
# NOTE: This procedure is useless when running in Eagle; therefore,
# forbid its use there.
#
if {[isEagle]} then {
error "already running in Eagle language"
}
#
# TODO: Assume the Garuda package is trusted? How can we verify it
# at this point?
#
package require Garuda
#
# NOTE: Verify that the Garuda package appears to have been fully and
# successfully loaded into this interpreter.
#
eagleMustBeReady
}
#
# NOTE: This procedure returns non-zero if the current script is being
# evaluated in Eagle with signed-only script security enabled.
# There are no arguments.
#
|
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
|
variable autoRequireGaruda
#
# NOTE: Should we attempt to automatically load the Garuda package for
# native Tcl?
#
if {$autoRequireGaruda && ![isEagle] && [isWindows]} then {
#
# TODO: Assume this package is trusted? How can we verify it
# at this point?
#
package require Garuda
}
#
# NOTE: Should we attempt to automatically load a native Tcl library
# for Eagle?
#
if {$autoLoadTcl && [isEagle]} then {
#
# NOTE: Load a native Tcl library. It must be signed with a valid
# Authenticode signature.
#
tcl load -findflags +TrustedOnly -loadflags +SetDllDirectory
}
#
# NOTE: Should we attempt to hook the [package unknown] handler. This
# is done for both native Tcl and Eagle.
#
if {$autoHook && ![isPackageUnknownHandlerHooked]} then {
|
<
<
<
<
|
<
<
<
<
<
>
|
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
|
variable autoRequireGaruda
#
# NOTE: Should we attempt to automatically load the Garuda package for
# native Tcl?
#
if {$autoRequireGaruda && ![isEagle] && [isWindows]} then {
makeEagleReady
}
#
# NOTE: Should we attempt to automatically load a native Tcl library
# for Eagle?
#
if {$autoLoadTcl && [isEagle]} then {
makeTclReady
}
#
# NOTE: Should we attempt to hook the [package unknown] handler. This
# is done for both native Tcl and Eagle.
#
if {$autoHook && ![isPackageUnknownHandlerHooked]} then {
|