You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.7 KiB
104 lines
2.7 KiB
# -*- tcl -*- |
|
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt |
|
# |
|
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem. |
|
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository. |
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
# (C) 2023 |
|
# |
|
# @@ Meta Begin |
|
# Application punk::tdl 999999.0a1.0 |
|
# Meta platform tcl |
|
# Meta license <unspecified> |
|
# @@ Meta End |
|
|
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
## Requirements |
|
##e.g package require frobz |
|
|
|
|
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
namespace eval punk::tdl { |
|
# https://wiki.tcl-lang.org/page/Config+file+using+slave+interp |
|
|
|
variable sample_script { |
|
server -name bsd1 -os FreeBSD |
|
server -name p1 -os linux |
|
server -name trillion -os windows |
|
|
|
server -name vmhost1 -os FreeBSD { |
|
guest -name bsd1 -vmmanager iocage |
|
guest -name p1 -vmmanager bhyve |
|
} |
|
|
|
} |
|
|
|
|
|
proc prettyparse {script} { |
|
set i [interp create -safe] |
|
try { |
|
# $i eval {unset {*}[info vars]} |
|
# foreach command [$i eval {info commands}] {$i hide $command} |
|
# $i invokehidden namespace delete {*}[$i invokehidden namespace children] |
|
$i alias unknown apply {{i tag args} { |
|
upvar 1 result result |
|
set e [concat [list tag $tag]\ |
|
[lrange $args 0 [expr {([llength $args] & ~1) - 1}]]] |
|
if {[llength $args] % 2} { |
|
set saved $result |
|
set result {} |
|
$i eval [lindex $args end] |
|
lappend e body $result |
|
set result $saved |
|
} |
|
lappend result $e |
|
list |
|
}} $i |
|
set result {} |
|
$i eval $script |
|
return $result |
|
} finally { |
|
interp delete $i |
|
} |
|
} |
|
proc prettyprint {data {level 0}} { |
|
set ind [string repeat " " $level] |
|
incr level |
|
set result {} |
|
foreach e $data { |
|
set line $ind[concat [list [dict get $e tag]] [dict remove $e tag body]] |
|
if {[dict exists $e body] && [llength [dict get $e body]]} { |
|
append line " {\n[prettyprint [dict get $e body] $level]\n$ind}" |
|
} |
|
lappend result $line |
|
} |
|
join $result \n |
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
## Ready |
|
package provide punk::tdl [namespace eval punk::tdl { |
|
variable version |
|
set version 999999.0a1.0 |
|
}] |
|
return
|
|
|