| top | |
<!ELEMENT control (ver|namespace|command|language|manpage|testbase|export|import|make|prelude|postlude)*>
<!ATTLIST control tag CDATA #IMPLIED ab CDATA #IMPLIED>
| ^ | | | | | | section top | |
control.delegate %element
control.values {
*define control.define
*html control.html
*makescript control.makescript
}
| ^ | Definition continued at: 22, 26, 29, 32, 35, 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | |
proc control.define {mother props} {
set ::dna(tag) $::dna($mother.tag)
%root.define $mother $props
}
proc control.html {mother props} {
array set P {detail {}}
foreach daughter $::dna($mother:children) {
foreach {p vv} [$::dna($daughter.*control-html) $daughter] {
foreach v $vv {
lappend P($p) $v
}
}
}
h TABLE CLASS control CELLSPACING 0 CELLPADDING 0 FRAME box RULES all {
h TR {
h TD CLASS controldetail {
h DL CLASS nested {
h DT CLASS em {h %content DNA.}
h DD {h %content $::dna($mother.tag)}
foreach pv $P(detail) {
setp {p v} $pv
h DT CLASS em {h %content $p.}
html $v $props
}
set L [lsort -dictionary [array names P import.*]]
if {[llength $L]} {
h DT CLASS em {h %content Import.}
h DD {
h DL CLASS nested {
foreach x $L {
setp {im dt} [split $x .]
h DT CLASS em {h %content [string totitle $dt].}
foreach daughter $P($x) {
html $daughter $props
}
}
}
}
}
set L [lsort -dictionary [array names P export.*]]
if {[llength $L]} {
h DT CLASS em {h %content Export.}
h DD {
h DL CLASS nested {
foreach x $L {
setp {ex dt} [split $x .]
h DT CLASS em {h %content [string totitle $dt].}
foreach daughter $P($x) {
html $daughter $props
}
}
}
}
}
}
}
h TD CLASS controlabstract ROWSPAN 2 {
h H1 CLASS sectionabstract {h %content $::dna($mother.ab)}
}
}
h TR {
h TD CLASS controltoc {
h A NAME *TOC { }
if {[llength $::dna(ab)]} {
h DL CLASS nested {
set first 1
foreach ab $::dna(ab) {
if {$first} {
h DT CLASS em {h %content Sections.}
}
set first 0
h DD {
h A HREF [hash]$::dna($ab.*sectnum) {
h %content $::dna($ab.ab)
}
}
}
}
}
}
}
set L [lsort -dictionary [array names P make.*]]
if {[llength $L]} {
h TR {
h TD CLASS controlmakes COLSPAN 2 {
h DL CLASS nested {
h DT CLASS em {h %content Make.}
h DD {
h DL CLASS nested {
foreach x $L {
setp {mk dt} [split $x .]
h DT CLASS em {h %content [string totitle $dt].}
h DD {
h PRE CLASS controlmakes {
set T [string map {\t } [join $P($x) \n]]
h %content $T
}
}
}
}
}
}
}
}
}
}
}
| ^ | Definition continued at: 24, 27, 30, 33, 36, 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
proc MAKESCRIPT {} {
puts " makescript $::lib/make/$::base.make"
array set C {transport {} prelude "" postlude "" make ""}
foreach daughter $::dna(:children) {
array set C [makescript $daughter]
}
file delete $::lib/make/$::base.make
set channel [open $::lib/make/$::base.make w]
set control {}
foreach {p v} [array get C control.*] {
lappend control [lindex [split $p .] 1] $v
}
puts $channel ".transport $::base [list $control] {
[leftflush [join $C(prelude) \n]]
} {
[leftflush [join $C(make) \n]]
} {
[leftflush [join $C(postlude) \n]]
} $C(transport)"
close $channel
}
proc makescript {daughter} {
$::dna($daughter.*makescript) $daughter
}
proc %root.makescript daughter {
list
}
proc control.makescript mother {
array set P {transport {} prelude {} postlude {} make {}}
foreach daughter $::dna($mother:children) {
foreach {p v} [makescript $daughter] {
switch $p {
transport {
foreach {x y z} $v {
lappend P($p) $x $y $z
}
}
prelude - make - postlude {
foreach x $v {
lappend P($p) $x
}
}
default {
set P($p) $v
}
}
}
}
array get P
}
| ^ | | | | | | section top | |
proc dynamicMake {args} {
evaller eval {
array set ::serpiente {testbases {}}
proc rule {targets args} {
global serpiente
switch -- [lindex $args 0] {
: {set sep :; set args [lrange $args 1 end]}
:: {set sep ::; set args [lrange $args 1 end]}
default {set sep :}
}
switch -- [llength $args] {
0 {
error {no prerequisites nor make commands provided}
}
1 {
set prerequisites [lindex $args 0]
set commands ""
}
default {
set prerequisites [lindex $args 0]
set commands \n[join [lrange $args 1 end] \n]
}
}
set commands [string map {\n \n\t} $commands]
regsub -all {\n[ \t]*\n} $commands \n commands
puts $serpiente(makefile) "[join $targets { }]$sep [join $prerequisites { }]$commands"
}
proc control {element} {
global serpiente
if {[info exists serpiente(control:$element,$serpiente(dona))]} {
return [join $serpiente(control:$element,$serpiente(dona)) " "]
} else {
return ""
}
}
proc import {category args} {
global serpiente
switch -- [llength $args] {
0 {
if {[info exists serpiente(import:$category,$serpiente(dona))]} {
set imports [list]
foreach dona $serpiente(import:$category,$serpiente(dona)) {
if {[info exists serpiente(export:$category,$dona)]} {
set imports [concat $imports $serpiente(export:$category,$dona)]
}
}
return $imports
} else {
return [list]
}
}
1 {
set dona [lindex $args 0]
if {[info exists serpiente(export:$category,$dona)]} {
return $serpiente(export:$category,$dona)
} else {
return [list]
}
}
default {error {too many arguments to import}}
}
}
proc export {category} {
global serpiente
if {[info exists serpiente(export:$category,$serpiente(dona))]} {
return $serpiente(export:$category,$serpiente(dona))
} else {
return [list]
}
}
proc .transport {dona controls prelude script postlude args} {
global serpiente lib
if {[llength $args]%3!=0} {
error {.transport called with wrong number of arguments}
}
set ::base [file tail [file root $dona]]
set serpiente(dona) $::base.dna
lappend serpiente(donas) $serpiente(dona)
set serpiente(prelude:$serpiente(dona)) $prelude
if {[file exists $serpiente(dona)]} {
set serpiente(script:$serpiente(dona)) $script
} else {
set serpiente(script:$serpiente(dona)) ""
}
set serpiente(postlude:$serpiente(dona)) $postlude
set antecedents {}
set packages {}
foreach {port category path} $args {
# If port is import, the path is the dna name.
# The exports of the path are serpiente(export:$category,$path).
# If port is export, the path is the exported file name,
# and the exporting dna is $serpiente(dona)
set path [uplevel #0 [list subst $path]]
if {[string equal $port import]} {
set path [file tail [file root $path]].dna
}
lappend serpiente($port:$category,$serpiente(dona)) $path
if {[string equal $port:$category import:package]} {
lappend antecedents $path
} elseif {[string equal $port:$category export:package]} {
lappend packages $path
}
}
set serpiente(control:sysreq,$serpiente(dona)) ""
foreach {element value} $controls {
set serpiente(control:$element,$serpiente(dona)) $value
}
array set control $controls
if {[info exists control(testbase)]} {
lappend serpiente(testbases) [uplevel #0 [list subst $control(testbase)]]
}
foreach package $packages {
set fn [uplevel #0 [list subst $package]]
if {[info exists control(ver)]} {
set ver $control(ver)
} else {
set ver 1.0
}
set name [file root [file tail $fn]]
set serpiente(control:name,$serpiente(dona)) $name
if {[file exists $serpiente(dona)]} {
if {![info exists serpiente(control:language,$serpiente(dona))]} {
set serpiente(control:language,$serpiente(dona)) c
}
lappend serpiente(packages) $fn $name $ver $serpiente(control:language,$serpiente(dona)) \
[file tail $fn] $antecedents $serpiente(control:sysreq,$serpiente(dona))
}
}
}
proc .dynmake {} {
global serpiente lib
set serpiente(packages) {}
foreach makepiece [glob $lib/make/*.make] { #*/
uplevel #0 [list source $makepiece]
}
file delete makefile
set serpiente(makefile) [open makefile w]
rule pkgIndex.tcl $lib/pkgIndex.tcl
set dependents {}
set body "
rm -rf $lib/pkgIndex.tcl
echo '# pkg_mkIndex is too weak to use.' >$lib/pkgIndex.tcl
echo '# All the information necessary is already in the control element,' >>$lib/pkgIndex.tcl
echo '# so just use that.' >>$lib/pkgIndex.tcl
echo '' >>$lib/pkgIndex.tcl"
foreach {fn name ver language tailfn antecedents sysreq} $serpiente(packages) {
switch -glob $sysreq {
os=* {
if {![string equal $::tcl_platform(os) [lindex [split $sysreq =] end]]} continue
}
platform=* {
if {![string equal $::tcl_platform(platform) [lindex [split $sysreq =] end]]} continue
}
}
lappend dependents $fn
set script ""
foreach antecedent $antecedents {
if {[info exists serpiente(control:name,$antecedent)]} {
append script "package require {$serpiente(control:name,$antecedent)}; "
}
}
if {[string equal $language c]} {
append script "load {\[file join \$\$dir \$\$::tcl_platform(os) [
file root $tailfn]\[info sharedlibextension\]\]}"
} else {
append script "source {\[file join \$\$dir $tailfn\]}"
}
append body "\necho 'package ifneeded $name $ver \"$script\"' >>$lib/pkgIndex.tcl"
}
rule $lib/pkgIndex.tcl $dependents $body
foreach test $serpiente(testbases) {
rule test :: $test.html
rule $test.html [list pkgIndex.tcl $test] "
debug=\$\$debug $test -matrix -run | tee $test.out
"
}
foreach dona $serpiente(donas) {
set serpiente(dona) $dona
set ::base [file tail [file root $dona]]
uplevel #0 $serpiente(prelude:$serpiente(dona))
}
foreach dona $serpiente(donas) {
set serpiente(dona) $dona
set ::base [file tail [file root $dona]]
uplevel #0 $serpiente(script:$serpiente(dona))
}
foreach dona $serpiente(donas) {
set serpiente(dona) $dona
set ::base [file tail [file root $dona]]
uplevel #0 $serpiente(postlude:$serpiente(dona))
}
close $serpiente(makefile)
}
}
puts "constructing makefile"
evaller eval .dynmake
puts "make $args"
set ::making 1
set ::makepipe [open "|make $args |& cat" r]
fconfigure $::makepipe -blocking 0
fileevent $::makepipe readable "
puts -nonewline \[read $::makepipe\]
if {\[eof $::makepipe\]} {
close $::makepipe
set ::making 0
}
"
vwait ::making
puts "make complete"
}
| ^ | | | | | | section top | | | ^ | | | | | | section top | | | ^ | | | | | | section top | |
ver.delegate %element
ver.values {
*define ver.define
*html ver.html
*control-html ver.control-html
*makescript ver.makescript
%span 1
}
| ^ | Definition continued at: 26, 29, 32, 35, 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | | | ^ | Definition continued at: 39, 43, 50, 66. | | | | | section top | |
proc ver.define {mother props} {
set version [TEXT $mother]
if {![catch {uri get file:build-cycle} cycle]} {append version .[string trim $cycle]}
set ::dna(version) $version
return {}
}
proc ver.control-html {daughter} {
list detail [list [list Version $daughter]]
}
proc ver.html {daughter props} {
h DD {h %content $::dna(version)}
}
proc ver.makescript daughter {
list control.ver $::dna(version)
}
| ^ | Definition continued at: 27, 30, 33, 36, 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
<!ELEMENT sysreq (#PCDATA)>
| ^ | | | | section top | |
sysreq.delegate %element
sysreq.values {
*html sysreq.html
*control-html sysreq.control-html
*makescript sysreq.makescript
}
| ^ | Definition continued at: 29, 32, 35, 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | |
proc sysreq.control-html {daughter} {
list detail [list [list System-requirement $daughter]]
}
proc sysreq.html {daughter props} {
h DD {h %content [TEXT $daughter]}
}
proc sysreq.makescript daughter {
list control.sysreq [TEXT $daughter]
}
| ^ | Definition continued at: 30, 33, 36, 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
<!ELEMENT namespace (#PCDATA)>
| ^ | | | | | | section top | |
namespace.delegate %element
namespace.values {
*html namespace.html
*control-html namespace.control-html
*makescript namespace.makescript
%span 1
}
| ^ | Definition continued at: 32, 35, 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | |
proc namespace.control-html {daughter} {
list detail [list [list Namespace $daughter]]
}
proc namespace.html {daughter props} {
h DD {h %content [TEXT $daughter]}
}
proc namespace.makescript daughter {
list control.namespace [TEXT $daughter]
}
| ^ | Definition continued at: 33, 36, 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
<!ELEMENT command (#PCDATA)>
| ^ | | | | | | section top | |
command.delegate %element
command.values {
*html command.html
*control-html command.control-html
*makescript command.makescript
%span 1
}
| ^ | Definition continued at: 35, 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | |
proc command.control-html {daughter} {
list detail [list [list Command $daughter]]
}
proc command.html {daughter props} {
h DD {h %content [TEXT $daughter]}
}
proc command.makescript daughter {
list control.command [TEXT $daughter]
}
| ^ | Definition continued at: 36, 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
<!ELEMENT language (#PCDATA)>
| ^ | | | | | | section top | |
language.delegate %element
language.values {
*html language.html
*control-html language.control-html
*makescript language.makescript
%span 1
}
| ^ | Definition continued at: 38, 42, 46, 49, 53, 56, 59, 62, 65, 69, 72, 75, 78, 81, 84, 88, 91, 94, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 161, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192. | | | | | section top | |
proc language.control-html {daughter} {
list detail [list [list Language $daughter]]
}
proc language.html {daughter props} {
h DD {h %content [TEXT $daughter]}
}
proc language.makescript daughter {
list control.language [TEXT $daughter]
}
| ^ | Definition continued at: 40, 44, 47, 51, 54, 57, 60, 63, 67, 70, 73, 76, 79, 82, 85, 89, 92, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 162, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193. | | | | | section top | |
<!ELEMENT manpage EMPTY>
<!ATTLIST manpage title CDATA #REQUIRED msect CDATA #REQUIRED tag CDATA #REQUIRED>
| ^ | | < |
|