aboutsummaryrefslogtreecommitdiff
path: root/pddp/pddpboot.tcl
blob: 3cec684b6f2b30e1202b183f12b9490d366f5458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# \
exec tclsh "$0" -- "$@"

# Synopsis
#   test run:
#     ./pddpboot.tcl [root [port [path]]]
#   from Pd:
#     source pddpboot.tcl
#     ::pddp::srvUse root (or ::pddp::srvStart root [port])
#     ::pddp::cliOpen path
#     ... (more "::pddp::cliOpen" calls) ...
#     ::pddp::srvStop

if {[namespace exists ::pddp]} {  ;# created by pddplink's setup
    puts stderr "Booting pddp"
    set ::pddp::testrun 0
} else {
    puts stderr "Booting pddp, test run..."
    namespace eval ::pddp { variable testrun 1 }
}

puts stderr "current directory: [pwd]"

source pddpclient.tcl
source pddpserver.tcl

if {[info exists ::pddp::theDir]} {
    puts stderr "restoring directory: $::pddp::theDir"
    cd $::pddp::theDir
    unset ::pddp::theDir
}