1
2
3
4
5
6
7
8
9
10
11
12
13
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
-
+
|
###############################################################################
#
# helper.tcl -- Eagle Package for Tcl (Garuda)
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Package Loading Helper File
# Package Loading Helper File (Primary)
#
# Copyright (c) 2007-2012 by Joe Mistachkin. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
|
︙ | | |
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
+
+
+
|
if {[string length $which] > 0} then {
return $which
}
return $command
}
#
# NOTE: Also defined in and used by "dotnet.tcl".
#
proc fileNormalize { path {force false} } {
variable noNormalize
if {$force || !$noNormalize} then {
return [file normalize $path]
}
|
︙ | | |
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
}
}
}
return $result
}
proc getLibraryPathList {} {
#
# NOTE: Grab the list of volumes mounted on the local machine.
#
set volumes [file volumes]
#
# NOTE: If there are no volumes, the search loop in this procedure will
# not work correctly; therefore, just return an empty list in that
# case.
#
if {[llength $volumes] == 0} then {
return [list]
}
#
# TODO: Start out with an empty list of candidate paths. Then, use the
# Tcl core script library path as the basis for searching for the
# Eagle CLR assembly directory. In the future, additional script
# library paths may need to be added here.
#
set result [list]
foreach directory [list [info library]] {
#
# NOTE: The directory name cannot be an empty string. In addition,
# it cannot be the root of any volume, because that condition
# is used to mark the end of the search; however, within the
# loop body itself, the internal calls to [file dirname] MAY
# refer to the root of a volume (i.e. when joining candidate
# directory names with it).
#
while {[string length $directory] > 0 && \
[lsearch -exact $volumes $directory] == -1} {
set path [file join $directory Eagle bin]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set path [file join $directory bin]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set path [file join $directory Eagle]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set path [file join [file dirname $directory] Eagle bin]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set path [file join [file dirname $directory] bin]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set path [file join [file dirname $directory] Eagle]
if {[isValidDirectory $path] || [isValidFile $path]} then {
lappend result $path
}
set directory [file dirname $directory]
}
}
return $result
}
proc getRelativePathList { directories configurations } {
set result [list]
foreach directory $directories {
foreach configuration $configurations {
set path [file join $directory $configuration Eagle bin]
|
︙ | | |
942
943
944
945
946
947
948
949
950
951
952
953
954
955
|
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
|
+
+
+
+
+
+
+
+
+
+
|
#
variable methodFlags; # DEFAULT: 0x0
if {![info exists methodFlags]} then {
set methodFlags 0x0
}
#
# NOTE: Load the CLR immediately upon loading the package? This is used
# by the code in the CLR assembly manager contained in this package.
#
variable loadClr; # DEFAULT: true
if {![info exists loadClr]} then {
set loadClr true
}
#
# NOTE: Start the CLR immediately upon loading the package? This is used
# by the code in the CLR assembly manager contained in this package.
#
variable startClr; # DEFAULT: true
if {![info exists startClr]} then {
|
︙ | | |
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
|
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
|
+
+
+
+
+
+
+
+
+
+
|
#
variable useRegistry; # DEFAULT: true
if {![info exists useRegistry]} then {
set useRegistry true
}
#
# NOTE: Use the various Tcl script library directories when searching for
# the Eagle CLR assembly?
#
variable useLibrary; # DEFAULT: true
if {![info exists useLibrary]} then {
set useLibrary true
}
#
# NOTE: The registry key where all the versions of Eagle installed on this
# machine (via the setup) can be found.
#
variable rootRegistryKeyName; # DEFAULT: HKEY_LOCAL_MACHINE\Software\Eagle
if {![info exists rootRegistryKeyName]} then {
|
︙ | | |
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
|
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
|
+
|
variable envVars
variable envVarSuffixes
variable logCommand
variable packageBinaryFileName
variable packageName
variable rootRegistryKeyName
variable useEnvironment
variable useLibrary
variable useRegistry
variable useRelativePath
variable verbose
if {[info exists assemblyPath]} then {
#
# NOTE: The managed assembly path has been pre-configured by an external
|
︙ | | |
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
|
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
+
+
+
+
|
$envVars $envVarSuffixes]
}
if {$useRegistry} then {
eval lappendUnique directories [getRegistryPathList \
$rootRegistryKeyName Path]
}
if {$useLibrary} then {
eval lappendUnique directories [getLibraryPathList]
}
if {$verbose} then {
catch {
set caller [maybeFullName [lindex [info level 0] 0]]
eval $logCommand [list \
"$caller: Final list of directories to search: $directories"]
|
︙ | | |
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
|
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
|
+
+
|
set namespace [namespace current]; namespace export -clear haveEagle
namespace eval :: [list namespace forget ::${namespace}::*]
namespace eval :: [list namespace import -force ::${namespace}::haveEagle]
#
# NOTE: Next, save the package path for later use.
#
variable packagePath
if {![info exists packagePath]} then {
set packagePath [fileNormalize [file dirname [info script]] true]
}
#
# NOTE: Next, setup the script variables associated with this package.
#
|
︙ | | |