Browse Source

build outputs: bootsupport punk::console 0.3.0 snapshots (supersedes interim 0.2.0-stamped copies)

From 'tclsh src/make.tcl bootsupport' run after commit 0ee66dce -
correctly stamped and containing the final 0.3.0 content (per-console
facts + PUNKARGS @leaders restructure).

Note: the punk.shell-0.1 layout retains console-0.1.0.tm and
console-0.2.0.tm alongside the new 0.3.0 - the prune kept them (no
qualifying punkcheck install record); pending manual removal if
unwanted, per the established prune-leftovers handling.
master
Julian Noble 3 weeks ago
parent
commit
f61b31879e
  1. 221
      src/bootsupport/modules/punk/console-0.3.0.tm
  2. 221
      src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.3.0.tm
  3. 5560
      src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.3.0.tm

221
src/bootsupport/modules/punk/console-0.2.0.tm → src/bootsupport/modules/punk/console-0.3.0.tm

@ -7,7 +7,7 @@
# (C) 2023
#
# @@ Meta Begin
# Application punk::console 0.2.0
# Application punk::console 0.3.0
# Meta platform tcl
# Meta license <unspecified>
# @@ Meta End
@ -17,7 +17,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin punkshell_module_punk::console 0 0.2.0]
#[manpage_begin punkshell_module_punk::console 0 0.3.0]
#[copyright "2024"]
#[titledesc {punk console}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk console}] [comment {-- Description at end of page heading --}]
@ -304,7 +304,21 @@ namespace eval punk::console {
#(safe for tails that otherwise hold row/col/data triples - a well-formed triple never has
#the literal '-console' in its 2nd-last position)
#The non-var forms additionally require that nothing else remains in the tail.
punk::args::define {
@id -id ::punk::console::internal::opt_console_out_var
@cmd -name punk::console::internal::opt_console_out_var -summary\
"Strip a trailing '-console <consolespec>' pair from the named args variable, returning the resolved output channel."\
-help\
"The variable named by argsvar in the caller's frame is modified in place (the
-console pair is removed if present; other content such as row/col/data triples
is left alone). Returns stdout when no -console pair is present."
@leaders
argsvar -type string -help\
"Name of an args-tail list variable in the caller's frame."
@values -min 0 -max 0
}
proc opt_console_out_var {argsvar} {
#see PUNKARGS id ::punk::console::internal::opt_console_out_var
upvar 1 $argsvar tail
if {[llength $tail] >= 2 && [lindex $tail end-1] eq "-console"} {
set out [dict get [punk::console::console_spec_resolve [lindex $tail end]] out]
@ -313,7 +327,21 @@ namespace eval punk::console {
}
return stdout
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_channels_var
@cmd -name punk::console::internal::opt_console_channels_var -summary\
"Strip a trailing '-console <consolespec>' pair from the named args variable, returning the canonical {in out} channel pair."\
-help\
"The variable named by argsvar in the caller's frame is modified in place (the
-console pair is removed if present; other content such as row/col/data triples
is left alone). Returns {stdin stdout} when no -console pair is present."
@leaders
argsvar -type string -help\
"Name of an args-tail list variable in the caller's frame."
@values -min 0 -max 0
}
proc opt_console_channels_var {argsvar} {
#see PUNKARGS id ::punk::console::internal::opt_console_channels_var
upvar 1 $argsvar tail
if {[llength $tail] >= 2 && [lindex $tail end-1] eq "-console"} {
set cinfo [punk::console::console_spec_resolve [lindex $tail end]]
@ -322,14 +350,40 @@ namespace eval punk::console {
}
return {stdin stdout}
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_out
@cmd -name punk::console::internal::opt_console_out -summary\
"Resolve an emit-function args-tail (empty or exactly '-console <consolespec>') to an output channel."\
-help\
"Errors if the tail contains anything other than a single optional -console pair.
Returns stdout for an empty tail."
@leaders
argstail -type list -help\
"The args-tail value: {} or {-console <consolespec>}."
@values -min 0 -max 0
}
proc opt_console_out {argstail} {
#see PUNKARGS id ::punk::console::internal::opt_console_out
set out [opt_console_out_var argstail]
if {[llength $argstail]} {
error "expected optional trailing '-console <consolespec>' - got '$argstail'"
}
return $out
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_channels
@cmd -name punk::console::internal::opt_console_channels -summary\
"Resolve an emit-function args-tail (empty or exactly '-console <consolespec>') to a canonical {in out} channel pair."\
-help\
"Errors if the tail contains anything other than a single optional -console pair.
Returns {stdin stdout} for an empty tail."
@leaders
argstail -type list -help\
"The args-tail value: {} or {-console <consolespec>}."
@values -min 0 -max 0
}
proc opt_console_channels {argstail} {
#see PUNKARGS id ::punk::console::internal::opt_console_channels
set channels [opt_console_channels_var argstail]
if {[llength $argstail]} {
error "expected optional trailing '-console <consolespec>' - got '$argstail'"
@ -1004,13 +1058,14 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::vt52
@cmd -name punk::console::vt52 -summary "Query or set vt52 terminal mode."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 1
@leaders
onoff -type boolean -optional 1 -help\
"Omit to query the current vt52 state.
The vt52 state is a per-console fact (see console_fact_get); the process-default
console's state is mirrored in the legacy ::punk::console::is_vt52 variable."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc vt52 {args} {
#see PUNKARGS id ::punk::console::vt52
@ -1604,13 +1659,14 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::set_tabstop_width
@cmd -name punk::console::set_tabstop_width -summary "Emit sequences setting evenly spaced terminal tabstops."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 1
w -type integer -default 8 -help\
@leaders
w -type integer -default 8 -optional 1 -help\
"Tabstop spacing in character cells.
The tabwidth record is a per-console fact (see console_fact_get); the process-default
console's record is mirrored in the legacy ::punk::console::tabwidth variable."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc set_tabstop_width {args} {
#see PUNKARGS id ::punk::console::set_tabstop_width
@ -3472,12 +3528,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::test_char_width
@cmd -name punk::console::test_char_width -summary "Measure a string's rendered width via cursor position reports."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 2
@leaders
char_or_string -type string
emit -type boolean -default 0 -optional 1 -help\
"Leave the test string visible instead of erasing the line around the test."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc test_char_width {char_or_string args} {
#see PUNKARGS id ::punk::console::test_char_width
@ -3548,12 +3605,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::test_string_cursor
@cmd -name punk::console::test_string_cursor -summary "Report cursor row/column offsets produced by emitting a string (uses alt screen)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 2
@leaders
teststring -type string
emit -type boolean -default 0 -optional 1 -help\
"Leave the test string visible instead of erasing the line around the test."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc test_string_cursor {teststring args} {
#see PUNKARGS id ::punk::console::test_string_cursor
@ -3960,13 +4018,14 @@ namespace eval punk::console {
modes are supported.
}
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 2 -max 2
@leaders
row -type integer -help\
"row number - starting at 1"
col -type integer -help\
"column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move {row col args} {
#see PUNKARGS id ::punk::console::ansi::move
@ -3982,10 +4041,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_forward
@cmd -name punk::console::ansi::move_forward -summary "Emit cursor-forward sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of columns to move forward"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of columns to move forward"
@values -min 0 -max 0
}]
proc move_forward {n args} {
#see PUNKARGS id ::punk::console::ansi::move_forward
@ -4000,10 +4060,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_back
@cmd -name punk::console::ansi::move_back -summary "Emit cursor-back sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of columns to move back"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of columns to move back"
@values -min 0 -max 0
}]
proc move_back {n args} {
#see PUNKARGS id ::punk::console::ansi::move_back
@ -4018,10 +4079,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_up
@cmd -name punk::console::ansi::move_up -summary "Emit cursor-up sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of rows to move up"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to move up"
@values -min 0 -max 0
}]
proc move_up {n args} {
#see PUNKARGS id ::punk::console::ansi::move_up
@ -4036,10 +4098,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_down
@cmd -name punk::console::ansi::move_down -summary "Emit cursor-down sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of rows to move down"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to move down"
@values -min 0 -max 0
}]
proc move_down {n args} {
#see PUNKARGS id ::punk::console::ansi::move_down
@ -4054,10 +4117,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_column
@cmd -name punk::console::ansi::move_column -summary "Emit move-to-column sequence (ANSI or vt52)."
@leaders
col -type integer -help "column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
col -type integer -help "column number - starting at 1"
@values -min 0 -max 0
}]
proc move_column {col args} {
#see PUNKARGS id ::punk::console::ansi::move_column
@ -4072,10 +4136,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_row
@cmd -name punk::console::ansi::move_row -summary "Emit move-to-row sequence."
@leaders
row -type integer -help "row number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
row -type integer -help "row number - starting at 1"
@values -min 0 -max 0
}]
proc move_row {row args} {
#see PUNKARGS id ::punk::console::ansi::move_row
@ -4084,14 +4149,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emit
@cmd -name punk::console::ansi::move_emit -summary "Emit data at row,col (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emit {row col data args} {
#see PUNKARGS id ::punk::console::ansi::move_emit
@ -4106,14 +4172,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emit_return
@cmd -name punk::console::ansi::move_emit_return -summary "Emit data at row,col then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emit_return {row col data args} {
#see PUNKARGS id ::punk::console::ansi::move_emit_return
@ -4137,12 +4204,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emitblock_return
@cmd -name punk::console::ansi::move_emitblock_return -summary "Emit a multiline textblock at row,col then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
textblock -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emitblock_return {row col textblock args} {
#see PUNKARGS id ::punk::console::ansi::move_emitblock_return
@ -4164,14 +4232,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::cursorsave_move_emit_return
@cmd -name punk::console::ansi::cursorsave_move_emit_return -summary "Emit data at row,col bracketed by cursor save/restore (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc cursorsave_move_emit_return {row col data args} {
#see PUNKARGS id ::punk::console::ansi::cursorsave_move_emit_return
@ -4199,12 +4268,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::cursorsave_move_emitblock_return
@cmd -name punk::console::ansi::cursorsave_move_emitblock_return -summary "Emit a multiline textblock at row,col bracketed by cursor save/restore (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
textblock -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc cursorsave_move_emitblock_return {row col textblock args} {
#see PUNKARGS id ::punk::console::ansi::cursorsave_move_emitblock_return
@ -4232,12 +4302,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_call_return
@cmd -name punk::console::ansi::move_call_return -summary "Move cursor to row,col, run script, then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
script -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_call_return {row col script args} {
#see PUNKARGS id ::punk::console::ansi::move_call_return
@ -4252,10 +4323,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::scroll_up
@cmd -name punk::console::ansi::scroll_up -summary "Emit scroll-up sequence."
@leaders
n -type integer -help "number of rows to scroll"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to scroll"
@values -min 0 -max 0
}]
proc scroll_up {n args} {
#see PUNKARGS id ::punk::console::ansi::scroll_up
@ -4264,10 +4336,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::scroll_down
@cmd -name punk::console::ansi::scroll_down -summary "Emit scroll-down sequence."
@leaders
n -type integer -help "number of rows to scroll"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to scroll"
@values -min 0 -max 0
}]
proc scroll_down {n args} {
#see PUNKARGS id ::punk::console::ansi::scroll_down
@ -4355,10 +4428,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::insert_spaces
@cmd -name punk::console::ansi::insert_spaces -summary "Emit insert-spaces (ICH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc insert_spaces {count args} {
#see PUNKARGS id ::punk::console::ansi::insert_spaces
@ -4367,10 +4441,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::delete_characters
@cmd -name punk::console::ansi::delete_characters -summary "Emit delete-characters (DCH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc delete_characters {count args} {
#see PUNKARGS id ::punk::console::ansi::delete_characters
@ -4379,10 +4454,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::erase_characters
@cmd -name punk::console::ansi::erase_characters -summary "Emit erase-characters (ECH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc erase_characters {count args} {
#see PUNKARGS id ::punk::console::ansi::erase_characters
@ -4391,10 +4467,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::insert_lines
@cmd -name punk::console::ansi::insert_lines -summary "Emit insert-lines (IL) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc insert_lines {count args} {
#see PUNKARGS id ::punk::console::ansi::insert_lines
@ -4403,10 +4480,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::delete_lines
@cmd -name punk::console::ansi::delete_lines -summary "Emit delete-lines (DL) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc delete_lines {count args} {
#see PUNKARGS id ::punk::console::ansi::delete_lines
@ -4415,10 +4493,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::titleset
@cmd -name punk::console::ansi::titleset -summary "Emit window-title (OSC) sequence."
@leaders
windowtitle -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
windowtitle -type string
@values -min 0 -max 0
}]
proc titleset {windowtitle args} {
#see PUNKARGS id ::punk::console::ansi::titleset
@ -4447,10 +4526,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::titleset
@cmd -name punk::console::titleset -summary "Set the terminal window title (ANSI or local mechanism)."
@leaders
windowtitle -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
windowtitle -type string
@values -min 0 -max 0
}]
proc titleset {windowtitle args} {
#see PUNKARGS id ::punk::console::titleset
@ -4472,11 +4552,12 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::move
@cmd -name punk::console::move -summary "Emit ANSI or vt52 sequence moving the cursor to row,col."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 2 -max 2
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
catch {rename move ""}
proc move {row col args} {
@ -5471,7 +5552,7 @@ namespace eval ::punk::args::register {
## Ready
package provide punk::console [namespace eval punk::console {
variable version
set version 0.2.0
set version 0.3.0
}]
return

221
src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.2.0.tm → src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk/console-0.3.0.tm

@ -7,7 +7,7 @@
# (C) 2023
#
# @@ Meta Begin
# Application punk::console 0.2.0
# Application punk::console 0.3.0
# Meta platform tcl
# Meta license <unspecified>
# @@ Meta End
@ -17,7 +17,7 @@
# doctools header
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
#*** !doctools
#[manpage_begin punkshell_module_punk::console 0 0.2.0]
#[manpage_begin punkshell_module_punk::console 0 0.3.0]
#[copyright "2024"]
#[titledesc {punk console}] [comment {-- Name section and table of contents description --}]
#[moddesc {punk console}] [comment {-- Description at end of page heading --}]
@ -304,7 +304,21 @@ namespace eval punk::console {
#(safe for tails that otherwise hold row/col/data triples - a well-formed triple never has
#the literal '-console' in its 2nd-last position)
#The non-var forms additionally require that nothing else remains in the tail.
punk::args::define {
@id -id ::punk::console::internal::opt_console_out_var
@cmd -name punk::console::internal::opt_console_out_var -summary\
"Strip a trailing '-console <consolespec>' pair from the named args variable, returning the resolved output channel."\
-help\
"The variable named by argsvar in the caller's frame is modified in place (the
-console pair is removed if present; other content such as row/col/data triples
is left alone). Returns stdout when no -console pair is present."
@leaders
argsvar -type string -help\
"Name of an args-tail list variable in the caller's frame."
@values -min 0 -max 0
}
proc opt_console_out_var {argsvar} {
#see PUNKARGS id ::punk::console::internal::opt_console_out_var
upvar 1 $argsvar tail
if {[llength $tail] >= 2 && [lindex $tail end-1] eq "-console"} {
set out [dict get [punk::console::console_spec_resolve [lindex $tail end]] out]
@ -313,7 +327,21 @@ namespace eval punk::console {
}
return stdout
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_channels_var
@cmd -name punk::console::internal::opt_console_channels_var -summary\
"Strip a trailing '-console <consolespec>' pair from the named args variable, returning the canonical {in out} channel pair."\
-help\
"The variable named by argsvar in the caller's frame is modified in place (the
-console pair is removed if present; other content such as row/col/data triples
is left alone). Returns {stdin stdout} when no -console pair is present."
@leaders
argsvar -type string -help\
"Name of an args-tail list variable in the caller's frame."
@values -min 0 -max 0
}
proc opt_console_channels_var {argsvar} {
#see PUNKARGS id ::punk::console::internal::opt_console_channels_var
upvar 1 $argsvar tail
if {[llength $tail] >= 2 && [lindex $tail end-1] eq "-console"} {
set cinfo [punk::console::console_spec_resolve [lindex $tail end]]
@ -322,14 +350,40 @@ namespace eval punk::console {
}
return {stdin stdout}
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_out
@cmd -name punk::console::internal::opt_console_out -summary\
"Resolve an emit-function args-tail (empty or exactly '-console <consolespec>') to an output channel."\
-help\
"Errors if the tail contains anything other than a single optional -console pair.
Returns stdout for an empty tail."
@leaders
argstail -type list -help\
"The args-tail value: {} or {-console <consolespec>}."
@values -min 0 -max 0
}
proc opt_console_out {argstail} {
#see PUNKARGS id ::punk::console::internal::opt_console_out
set out [opt_console_out_var argstail]
if {[llength $argstail]} {
error "expected optional trailing '-console <consolespec>' - got '$argstail'"
}
return $out
}
punk::args::define {
@id -id ::punk::console::internal::opt_console_channels
@cmd -name punk::console::internal::opt_console_channels -summary\
"Resolve an emit-function args-tail (empty or exactly '-console <consolespec>') to a canonical {in out} channel pair."\
-help\
"Errors if the tail contains anything other than a single optional -console pair.
Returns {stdin stdout} for an empty tail."
@leaders
argstail -type list -help\
"The args-tail value: {} or {-console <consolespec>}."
@values -min 0 -max 0
}
proc opt_console_channels {argstail} {
#see PUNKARGS id ::punk::console::internal::opt_console_channels
set channels [opt_console_channels_var argstail]
if {[llength $argstail]} {
error "expected optional trailing '-console <consolespec>' - got '$argstail'"
@ -1004,13 +1058,14 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::vt52
@cmd -name punk::console::vt52 -summary "Query or set vt52 terminal mode."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 1
@leaders
onoff -type boolean -optional 1 -help\
"Omit to query the current vt52 state.
The vt52 state is a per-console fact (see console_fact_get); the process-default
console's state is mirrored in the legacy ::punk::console::is_vt52 variable."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc vt52 {args} {
#see PUNKARGS id ::punk::console::vt52
@ -1604,13 +1659,14 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::set_tabstop_width
@cmd -name punk::console::set_tabstop_width -summary "Emit sequences setting evenly spaced terminal tabstops."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 1
w -type integer -default 8 -help\
@leaders
w -type integer -default 8 -optional 1 -help\
"Tabstop spacing in character cells.
The tabwidth record is a per-console fact (see console_fact_get); the process-default
console's record is mirrored in the legacy ::punk::console::tabwidth variable."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc set_tabstop_width {args} {
#see PUNKARGS id ::punk::console::set_tabstop_width
@ -3472,12 +3528,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::test_char_width
@cmd -name punk::console::test_char_width -summary "Measure a string's rendered width via cursor position reports."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 2
@leaders
char_or_string -type string
emit -type boolean -default 0 -optional 1 -help\
"Leave the test string visible instead of erasing the line around the test."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc test_char_width {char_or_string args} {
#see PUNKARGS id ::punk::console::test_char_width
@ -3548,12 +3605,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::test_string_cursor
@cmd -name punk::console::test_string_cursor -summary "Report cursor row/column offsets produced by emitting a string (uses alt screen)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 2
@leaders
teststring -type string
emit -type boolean -default 0 -optional 1 -help\
"Leave the test string visible instead of erasing the line around the test."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc test_string_cursor {teststring args} {
#see PUNKARGS id ::punk::console::test_string_cursor
@ -3960,13 +4018,14 @@ namespace eval punk::console {
modes are supported.
}
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 2 -max 2
@leaders
row -type integer -help\
"row number - starting at 1"
col -type integer -help\
"column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move {row col args} {
#see PUNKARGS id ::punk::console::ansi::move
@ -3982,10 +4041,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_forward
@cmd -name punk::console::ansi::move_forward -summary "Emit cursor-forward sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of columns to move forward"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of columns to move forward"
@values -min 0 -max 0
}]
proc move_forward {n args} {
#see PUNKARGS id ::punk::console::ansi::move_forward
@ -4000,10 +4060,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_back
@cmd -name punk::console::ansi::move_back -summary "Emit cursor-back sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of columns to move back"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of columns to move back"
@values -min 0 -max 0
}]
proc move_back {n args} {
#see PUNKARGS id ::punk::console::ansi::move_back
@ -4018,10 +4079,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_up
@cmd -name punk::console::ansi::move_up -summary "Emit cursor-up sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of rows to move up"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to move up"
@values -min 0 -max 0
}]
proc move_up {n args} {
#see PUNKARGS id ::punk::console::ansi::move_up
@ -4036,10 +4098,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_down
@cmd -name punk::console::ansi::move_down -summary "Emit cursor-down sequence (ANSI or vt52)."
@leaders
n -type integer -help "number of rows to move down"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to move down"
@values -min 0 -max 0
}]
proc move_down {n args} {
#see PUNKARGS id ::punk::console::ansi::move_down
@ -4054,10 +4117,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_column
@cmd -name punk::console::ansi::move_column -summary "Emit move-to-column sequence (ANSI or vt52)."
@leaders
col -type integer -help "column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
col -type integer -help "column number - starting at 1"
@values -min 0 -max 0
}]
proc move_column {col args} {
#see PUNKARGS id ::punk::console::ansi::move_column
@ -4072,10 +4136,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_row
@cmd -name punk::console::ansi::move_row -summary "Emit move-to-row sequence."
@leaders
row -type integer -help "row number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
row -type integer -help "row number - starting at 1"
@values -min 0 -max 0
}]
proc move_row {row args} {
#see PUNKARGS id ::punk::console::ansi::move_row
@ -4084,14 +4149,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emit
@cmd -name punk::console::ansi::move_emit -summary "Emit data at row,col (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emit {row col data args} {
#see PUNKARGS id ::punk::console::ansi::move_emit
@ -4106,14 +4172,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emit_return
@cmd -name punk::console::ansi::move_emit_return -summary "Emit data at row,col then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emit_return {row col data args} {
#see PUNKARGS id ::punk::console::ansi::move_emit_return
@ -4137,12 +4204,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_emitblock_return
@cmd -name punk::console::ansi::move_emitblock_return -summary "Emit a multiline textblock at row,col then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
textblock -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_emitblock_return {row col textblock args} {
#see PUNKARGS id ::punk::console::ansi::move_emitblock_return
@ -4164,14 +4232,15 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::cursorsave_move_emit_return
@cmd -name punk::console::ansi::cursorsave_move_emit_return -summary "Emit data at row,col bracketed by cursor save/restore (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max -1
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
data -type string
triple -type any -optional 1 -multiple 1 -help\
"additional row col data triples"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc cursorsave_move_emit_return {row col data args} {
#see PUNKARGS id ::punk::console::ansi::cursorsave_move_emit_return
@ -4199,12 +4268,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::cursorsave_move_emitblock_return
@cmd -name punk::console::ansi::cursorsave_move_emitblock_return -summary "Emit a multiline textblock at row,col bracketed by cursor save/restore (ANSI or vt52)."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
textblock -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc cursorsave_move_emitblock_return {row col textblock args} {
#see PUNKARGS id ::punk::console::ansi::cursorsave_move_emitblock_return
@ -4232,12 +4302,13 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::move_call_return
@cmd -name punk::console::ansi::move_call_return -summary "Move cursor to row,col, run script, then return cursor to its previous position."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 3 -max 3
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
script -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
proc move_call_return {row col script args} {
#see PUNKARGS id ::punk::console::ansi::move_call_return
@ -4252,10 +4323,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::scroll_up
@cmd -name punk::console::ansi::scroll_up -summary "Emit scroll-up sequence."
@leaders
n -type integer -help "number of rows to scroll"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to scroll"
@values -min 0 -max 0
}]
proc scroll_up {n args} {
#see PUNKARGS id ::punk::console::ansi::scroll_up
@ -4264,10 +4336,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::scroll_down
@cmd -name punk::console::ansi::scroll_down -summary "Emit scroll-down sequence."
@leaders
n -type integer -help "number of rows to scroll"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
n -type integer -help "number of rows to scroll"
@values -min 0 -max 0
}]
proc scroll_down {n args} {
#see PUNKARGS id ::punk::console::ansi::scroll_down
@ -4355,10 +4428,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::insert_spaces
@cmd -name punk::console::ansi::insert_spaces -summary "Emit insert-spaces (ICH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc insert_spaces {count args} {
#see PUNKARGS id ::punk::console::ansi::insert_spaces
@ -4367,10 +4441,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::delete_characters
@cmd -name punk::console::ansi::delete_characters -summary "Emit delete-characters (DCH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc delete_characters {count args} {
#see PUNKARGS id ::punk::console::ansi::delete_characters
@ -4379,10 +4454,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::erase_characters
@cmd -name punk::console::ansi::erase_characters -summary "Emit erase-characters (ECH) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc erase_characters {count args} {
#see PUNKARGS id ::punk::console::ansi::erase_characters
@ -4391,10 +4467,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::insert_lines
@cmd -name punk::console::ansi::insert_lines -summary "Emit insert-lines (IL) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc insert_lines {count args} {
#see PUNKARGS id ::punk::console::ansi::insert_lines
@ -4403,10 +4480,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::delete_lines
@cmd -name punk::console::ansi::delete_lines -summary "Emit delete-lines (DL) sequence."
@leaders
count -type integer
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
count -type integer
@values -min 0 -max 0
}]
proc delete_lines {count args} {
#see PUNKARGS id ::punk::console::ansi::delete_lines
@ -4415,10 +4493,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::ansi::titleset
@cmd -name punk::console::ansi::titleset -summary "Emit window-title (OSC) sequence."
@leaders
windowtitle -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
windowtitle -type string
@values -min 0 -max 0
}]
proc titleset {windowtitle args} {
#see PUNKARGS id ::punk::console::ansi::titleset
@ -4447,10 +4526,11 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::titleset
@cmd -name punk::console::titleset -summary "Set the terminal window title (ANSI or local mechanism)."
@leaders
windowtitle -type string
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 1 -max 1
windowtitle -type string
@values -min 0 -max 0
}]
proc titleset {windowtitle args} {
#see PUNKARGS id ::punk::console::titleset
@ -4472,11 +4552,12 @@ namespace eval punk::console {
lappend PUNKARGS [list {
@id -id ::punk::console::move
@cmd -name punk::console::move -summary "Emit ANSI or vt52 sequence moving the cursor to row,col."
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 2 -max 2
@leaders
row -type integer -help "row number - starting at 1"
col -type integer -help "column number - starting at 1"
@opts
${[punk::args::resolved_def -types opts ::punk::console::argdoc::console_emit_opts -console]}
@values -min 0 -max 0
}]
catch {rename move ""}
proc move {row col args} {
@ -5471,7 +5552,7 @@ namespace eval ::punk::args::register {
## Ready
package provide punk::console [namespace eval punk::console {
variable version
set version 0.2.0
set version 0.3.0
}]
return

5560
src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk/console-0.3.0.tm

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save