Skip to content

Commit b86df89

Browse files
windows lib added
1 parent 4c8ae3d commit b86df89

File tree

2,595 files changed

+790011
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,595 files changed

+790011
-0
lines changed

src/lib/windows/bin/bitmap-editor.tcl

Lines changed: 748 additions & 0 deletions
Large diffs are not rendered by default.

src/lib/windows/bin/critcl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
# -*-tcl -*-
3+
# hide next line from tcl \
4+
exec "C:/Users/build/AppData/Local/Temp/3/ActiveState-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bin/tclsh.exe" "$0" ${1+"$@"}
5+
6+
# Add location of critcl packages to the package load path, if not
7+
# yet present. Computed relative to the location of the application,
8+
# as per the installation paths.
9+
set libpath [file join [file dirname [info script]] .. lib]
10+
set libpath [file dirname [file normalize [file join $libpath ...]]]
11+
if {[lsearch -exact $auto_path $libpath] < 0} {
12+
set auto_path [linsert $auto_path[set auto_path {}] 0 $libpath]
13+
}
14+
unset libpath
15+
16+
package require critcl::app
17+
critcl::app::main $argv

src/lib/windows/bin/critcl.tcl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
# -*-tcl -*-
3+
# hide next line from tcl \
4+
exec "C:/Users/build/AppData/Local/Temp/3/ActiveState-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bin/tclsh.exe" "$0" ${1+"$@"}
5+
6+
# Add location of critcl packages to the package load path, if not
7+
# yet present. Computed relative to the location of the application,
8+
# as per the installation paths.
9+
set libpath [file join [file dirname [info script]] .. lib]
10+
set libpath [file dirname [file normalize [file join $libpath ...]]]
11+
if {[lsearch -exact $auto_path $libpath] < 0} {
12+
set auto_path [linsert $auto_path[set auto_path {}] 0 $libpath]
13+
}
14+
unset libpath
15+
16+
package require critcl::app
17+
critcl::app::main $argv
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env tclsh
2+
## -*- tcl -*-
3+
4+
# @@ Meta Begin
5+
# Application diagram-viewer 1.0
6+
# Meta platform tcl
7+
# Meta summary Lightweight Diagram Processor
8+
# Meta description This application is a processor for documents
9+
# Meta description written in the tklib diagram language. It
10+
# Meta description should cover the most common use cases,
11+
# Meta description rendering to canvas for display, and batch
12+
# Meta description conversion to raster images.
13+
# Meta category Processing tklib diagrams
14+
# Meta subject diagram drawing point line spline arrow ellipse box circle
15+
# Meta subject intersection interpolation picture drum arc diamond text
16+
# Meta subject ellipse plotting vector {plane geometry} {2D geometry} move
17+
# Meta subject canvas image {raster image}
18+
# Meta require diagram::application
19+
# Meta author Andreas Kupries
20+
# Meta license BSD
21+
# @@ Meta End
22+
23+
# # ## ### ##### ######## ############# #####################
24+
package require diagram::application
25+
if {[catch {
26+
diagram::application $argv
27+
} msg]} {
28+
#puts $::errorInfo
29+
diagram::application::showerror $msg
30+
}
31+
# # ## ### ##### ######## ############# #####################
32+
exit

src/lib/windows/bin/dtplite.tcl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /usr/bin/env tclsh
2+
# -*- tcl -*-
3+
4+
# @@ Meta Begin
5+
# Application dtplite 1.0.5
6+
# Meta platform tcl
7+
# Meta summary Lightweight DocTools Processor
8+
# Meta description This application is a simple processor
9+
# Meta description for documents written in the doctools
10+
# Meta description markup language. It covers the most
11+
# Meta description common use cases, but is not as
12+
# Meta description configurable as its big brother dtp.
13+
# Meta category Processing doctools documents
14+
# Meta subject doctools doctoc docidx
15+
# Meta require {dtplite 1.0.5}
16+
# Meta author Andreas Kupries
17+
# Meta license BSD
18+
# @@ Meta End
19+
20+
package require dtplite 1.0.5
21+
22+
# dtp lite - Lightweight DocTools Processor
23+
# ======== = ==============================
24+
25+
exit [dtplite::do $argv]
26+
27+
# ### ### ### ######### ######### #########
28+
exit

src/lib/windows/bin/nns.tcl

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
#! /usr/bin/env tclsh
2+
# -*- tcl -*-
3+
4+
# @@ Meta Begin
5+
# Application nns 1.2
6+
# Meta platform tcl
7+
# Meta summary Nano Name Service Client
8+
# Meta description This application connects to a name service demon
9+
# Meta description and either registers a name with associated data
10+
# Meta description (until exit) or searches for entries matching a
11+
# Meta description glob pattern. Operations to identify client and
12+
# Meta description server are made available as well. It will survive
13+
# Meta description the loss of the nameserver and automatically reconnect
14+
# Meta description and continue when it comes back (bind and search).
15+
# Meta description
16+
# Meta subject {name service} client
17+
# Meta require {Tcl 8.4}
18+
# Meta require logger
19+
# Meta require nameserv::auto
20+
# Meta require struct::matrix
21+
# Meta author Andreas Kupries
22+
# Meta license BSD
23+
# @@ Meta End
24+
25+
package provide nns 1.2
26+
27+
# nns - Nano Name Service Client
28+
# === = ========================
29+
#
30+
# Use cases
31+
# ---------
32+
#
33+
# (1) Register something at a nano name service
34+
# (2) Query protocol and feature information.
35+
# (3) Provide application version, and protocol information
36+
# (4) Search service for entries matching a glob-pattern
37+
#
38+
# Command syntax
39+
# --------------
40+
#
41+
# (Ad 1) nns bind ?-host NAME|IP? ?-port PORT? name data
42+
# (Ad 2) nns ident ?-host NAME|IP? ?-port PORT?
43+
# (Ad 3) nns who
44+
# (Ad 4) nns search ?-host NAME|IP? ?-port PORT? ?-continuous? ?pattern?
45+
#
46+
# Register a name with data. If no port is specified the default
47+
# port 38573 is used to connect to it. If no host is specified
48+
# the default (localhost) is used to connect to it.
49+
50+
# ### ### ### ######### ######### #########
51+
## Requirements
52+
53+
lappend auto_path [file join [file dirname [file dirname \
54+
[file normalize [info script]]]] modules]
55+
56+
package require nameserv::auto 0.3 ;# Need auto-restoring search.
57+
package require struct::matrix
58+
59+
logger::initNamespace ::nns
60+
namespace eval ::nns { log::setlevel info }
61+
62+
# ### ### ### ######### ######### #########
63+
## Process application command line
64+
65+
proc ::nns::ProcessCommandLine {} {
66+
global argv
67+
variable xcmd
68+
variable xname
69+
variable xdata
70+
variable xpat *
71+
variable xwatch 0
72+
73+
# Process the options, perform basic validation.
74+
75+
if {[llength $argv] < 1} Usage
76+
77+
set cmd [lindex $argv 0]
78+
set argv [lrange $argv 1 end]
79+
80+
switch -exact -- $cmd {
81+
bind - ident - who - search {set xcmd $cmd}
82+
default Usage
83+
}
84+
85+
while {[llength $argv]} {
86+
set opt [lindex $argv 0]
87+
if {![string match "-*" $opt]} break
88+
89+
switch -exact -- $opt {
90+
-host {
91+
if {$xcmd == "who"} Usage
92+
if {[llength $argv] < 2} Usage
93+
94+
set host [lindex $argv 1]
95+
set argv [lrange $argv 2 end]
96+
97+
nameserv::auto::configure -host $host
98+
}
99+
-port {
100+
if {$xcmd == "who"} Usage
101+
if {[llength $argv] < 2} Usage
102+
103+
# Todo: Check non-zero unsigned short integer
104+
set port [lindex $argv 1]
105+
set argv [lrange $argv 2 end]
106+
107+
nameserv::auto::configure -port $port
108+
}
109+
-continuous {
110+
set xwatch 1
111+
set argv [lrange $argv 1 end]
112+
}
113+
-debug {
114+
# Undocumented. Activate the logger services provided
115+
# by various packages.
116+
logger::setlevel debug
117+
set argv [lrange $argv 1 end]
118+
}
119+
default Usage
120+
}
121+
}
122+
123+
# Additional validation, and extraction of the non-option
124+
# arguments. Of which this application has none.
125+
126+
switch -exact -- $xcmd {
127+
bind {
128+
if {[llength $argv] != 2} Usage
129+
foreach {xname xdata} $argv break
130+
}
131+
search {
132+
if {[llength $argv] > 1} Usage
133+
if {[llength $argv] == 1} {
134+
set xpat [lindex $argv 0]
135+
}
136+
}
137+
who - ident {
138+
if {[llength $argv] != 0} Usage
139+
}
140+
}
141+
return
142+
}
143+
144+
proc ::nns::Usage {{sfx {}}} {
145+
global argv0 ; append argv0 $sfx
146+
set blank [blank $argv0]
147+
puts stderr "$argv0 wrong#args, expected: bind ?-host NAME|IP? ?-port PORT? NAME DATA"
148+
puts stderr "$blank ident ?-host NAME|IP? ?-port PORT?"
149+
puts stderr "$blank search ?-host NAME|IP? ?-port PORT? ?-continuous? ?PATTERN?"
150+
puts stderr "$blank who"
151+
exit 1
152+
}
153+
154+
proc ::nns::ArgError {text} {
155+
global argv0
156+
puts stderr "$argv0: $text"
157+
#puts $::errorInfo
158+
exit 1
159+
}
160+
161+
proc ::nns::blank {s} {
162+
regsub -all -- {[^ ]} $s { } s
163+
return $s
164+
}
165+
166+
# ### ### ### ######### ######### #########
167+
168+
proc ::nns::My {} {
169+
# Quick access to format the identity of the name service the
170+
# client talks to.
171+
return "[nameserv::auto::cget -host] @[nameserv::auto::cget -port]"
172+
}
173+
174+
proc ::nns::Connection {message args} {
175+
# args = tag event details, ignored
176+
log::info $message
177+
return
178+
}
179+
180+
proc ::nns::MonitorConnection {} {
181+
uevent::bind nameserv lost-connection [list ::nns::Connection "Disconnected name service at [My]"]
182+
uevent::bind nameserv re-connection [list ::nns::Connection "Reconnected2 name service at [My]"]
183+
return
184+
}
185+
186+
# ### ### ### ######### ######### #########
187+
## Main
188+
189+
proc ::nns::Do.bind {} {
190+
global argv0
191+
variable xname
192+
variable xdata
193+
194+
MonitorConnection
195+
log::info "Binding with name service at [My]: $xname = $xdata"
196+
nameserv::auto::bind $xname $xdata
197+
198+
vwait ::forever
199+
# Not reached.
200+
return
201+
}
202+
203+
proc ::nns::Do.ident {} {
204+
set sp [nameserv::auto::server_protocol]
205+
set sf [join [nameserv::auto::server_features] {, }]
206+
207+
if {[llength $sf] > 1} {
208+
set sf [linsert $sf end-1 and]
209+
}
210+
211+
puts "Server [My]"
212+
puts " Protocol: $sp"
213+
puts " Features: $sf"
214+
return
215+
}
216+
217+
proc ::nns::Do.search {} {
218+
variable xpat
219+
variable xwatch
220+
221+
struct::matrix M
222+
M add columns 2
223+
224+
if {$xwatch} {
225+
MonitorConnection
226+
set contents [nameserv::auto::search -continuous $xpat]
227+
$contents configure -command [list ::nns::Do.search.change $contents]
228+
229+
vwait ::forever
230+
# Not reached.
231+
} else {
232+
Do.search.print [nameserv::auto::search $xpat]
233+
}
234+
return
235+
}
236+
237+
proc ::nns::Do.search.change {res type response} {
238+
# Ignoring the arguments, we simply print the full results every
239+
# time.
240+
241+
if {$type eq "stop"} {
242+
# Cannot happen for nameserv::auto client, we are free to panic.
243+
$res destroy
244+
log::critical {Bad event 'stop' <=> Lost connection, search closed}
245+
return
246+
}
247+
248+
# Clear screen ...
249+
puts -nonewline stdout "\033\[H\033\[J"; # Home + Erase Down
250+
flush stdout
251+
252+
::nns::Do.search.print [$res getall]
253+
return
254+
}
255+
256+
proc ::nns::Do.search.print {contents} {
257+
log::info "Searching at name service at [My]"
258+
259+
if {![llength $contents]} {
260+
log info "Nothing found..."
261+
return
262+
}
263+
264+
catch {M delete rows [M rows]}
265+
foreach {name data} $contents {
266+
M add row [list $name $data]
267+
}
268+
269+
foreach line [split [M format 2string] \n] { log::info $line }
270+
return
271+
}
272+
273+
proc ::nns::Do.who {} {
274+
# FUTURE: access and print the metadata contained in ourselves.
275+
global argv0
276+
puts "$argv0 [package require nns] (Client Protocol [nameserv::auto::protocol])"
277+
return
278+
}
279+
280+
# ### ### ### ######### ######### #########
281+
## Invoking the functionality.
282+
283+
::nns::ProcessCommandLine
284+
if {[catch {
285+
::nns::Do.$::nns::xcmd
286+
} msg]} {
287+
::nns::ArgError $msg
288+
}
289+
290+
# ### ### ### ######### ######### #########
291+
exit

0 commit comments

Comments
 (0)