diff --git a/src/modules/punk/ansi-999999.0a1.0.tm b/src/modules/punk/ansi-999999.0a1.0.tm index cf1e5378..3ce6d7d0 100644 --- a/src/modules/punk/ansi-999999.0a1.0.tm +++ b/src/modules/punk/ansi-999999.0a1.0.tm @@ -5835,8 +5835,11 @@ tcl::namespace::eval punk::ansi::ta { #*** !doctools #[subsection {Namespace punk::ansi::ta}] #[para] text ansi functions - #[para] based on but not identical to the Perl Text Ansi module: + #[para] based on the API but not identical to the Perl Text Ansi module: Text::ANSI::Util + #[para] https://metacpan.org/pod/Text::ANSI::Util #[para] https://github.com/perlancar/perl-Text-ANSI-Util/blob/master/lib/Text/ANSI/BaseUtil.pm + #[para] These functions are not based on the source code of the perl functions, but the documented input and output + #[para] so algorithms and performance may differ. #[list_begin definitions] tcl::namespace::path ::punk::ansi namespace export detect detect_in_list detect_sgr extract length split_codes split_at_codes split_codes_single diff --git a/src/modules/punk/args-999999.0a1.0.tm b/src/modules/punk/args-999999.0a1.0.tm index 961fd07c..40d703cd 100644 --- a/src/modules/punk/args-999999.0a1.0.tm +++ b/src/modules/punk/args-999999.0a1.0.tm @@ -979,7 +979,9 @@ tcl::namespace::eval punk::args { # -arg -choices {${$DYN_CHOICES}} -help "${$RED}important info${$RST}" #} if {$defspace ne ""} { - set optionspecs [namespace eval $defspace [list punk::args::lib::tstr -return string -eval 1 -allowcommands $optionspecs]] + #set optionspecs [namespace eval $defspace [list punk::args::lib::tstr -return string -eval 1 -allowcommands $optionspecs]] + #JJJ - review + set optionspecs [namespace eval $defspace [list punk::args::lib::tstr -return string -eval 1 -allowcommands -paramindents none $optionspecs]] } #REVIEW - join also serves to unescape things such as \$\{$x\} \$\{[cmd]\} without subst'ing or evaling (?) if {[string first \$\{ $optionspecs] > 0} { @@ -2017,6 +2019,8 @@ tcl::namespace::eval punk::args { } ansi - ansistring {set normtype ansistring} string - globstring {set normtype $lc_firstword} + packageversion {set normtype packageversion} + packagerequirement {set normtype packagerequirement} literal { #value was split out by _split_type_expression set normtype literal([lindex $alt 1]) @@ -2390,8 +2394,13 @@ tcl::namespace::eval punk::args { as these arguments are already fully spec'd. The defaults from the source can be removed by adding @leaders, @opts @values to the -antiglobs list, but again - this won't affect the existing arguments. + Each argument can have members of its spec overridden using the - -override dictionary. + -override dictionary The members of each override sub dictionary are + usually options beginning with a dash. The key 'name' can be used to + override the name of the leader/option/value itself. + e.g + punk::args::resolved_def -types values -override {version {name version1 -optional 0}} (shared)::package version " @leaders -min 0 -max 0 @opts @@ -2608,8 +2617,9 @@ tcl::namespace::eval punk::args { if {[dict get $argspec -ARGTYPE] eq $tp} { set argspec [dict remove $argspec -ARGTYPE] if {[dict exists $opt_override $m]} { - append result \n "\"$m\" [dict merge $argspec [dict get $opt_override $m]]" - dict set resultdict $m [dict merge $argspec [dict get $opt_override $m]] + set overdict [dict get $opt_override $m] + append result \n "\"$m\" [dict merge $argspec $overdict]" + dict set resultdict $m [dict merge $argspec $overdict] } else { append result \n "\"$m\" $argspec" dict set resultdict $m $argspec @@ -2670,8 +2680,19 @@ tcl::namespace::eval punk::args { if {[dict get $argspec -ARGTYPE] eq [dict get $argtypes $type]} { set argspec [dict remove $argspec -ARGTYPE] if {[dict exists $opt_override $m]} { - append result \n "\"$m\" [dict merge $argspec [dict get $opt_override $m]]" - dict set resultdict $m [dict merge $argspec [dict get $opt_override $m]] + set overdict [dict get $opt_override $m] + if {[dict exists $opt_override $m name]} { + #special override for name of argument itself + #e.g + #punk::args::resolved_def -types values -override {version {name version1 -optional 1}} (shared)::package version + set newname [dict get $opt_override $m name] + dict unset overdict name + append result \n "\"$newname\" [dict merge $argspec $overdict]" + dict set resultdict $newname [dict merge $argspec $overdict] + } else { + append result \n "\"$m\" [dict merge $argspec $overdict]" + dict set resultdict $m [dict merge $argspec $overdict] + } } else { append result \n "\"$m\" $argspec" dict set resultdict $m $argspec @@ -3501,6 +3522,9 @@ tcl::namespace::eval punk::args { set docname [Dict_getdef $spec_dict doc_info -name "Manual:"] set docurl [Dict_getdef $spec_dict doc_info -url ""] + #set example [Dict_getdef $spec_dict examples_info -help ""] + set has_example [dict exists $spec_dict examples_info -help] + #review - when can there be more than one selected form? set argdisplay_header "" set argdisplay_body "" @@ -3546,6 +3570,12 @@ tcl::namespace::eval punk::args { } else { set docurl_display "" } + if {$has_example} { + lappend blank_header_col "" + set example_display "[a+ white]eg [dict get $spec_dict id]$RST" + } else { + set example_display "" + } #synopsis set synopsis "# [Dict_getdef $spec_dict cmd_info -summary {}]\n" set form_info [dict get $spec_dict form_info] @@ -3624,6 +3654,14 @@ tcl::namespace::eval punk::args { } incr h } + if {$has_example} { + if {$use_table} { + $t configure_header $h -colspans $arg_colspans -values [list Example: $example_display] + } else { + lappend errlines "Example: $docurl_display" + } + incr h + } if {$synopsis ne ""} { if {$use_table} { $t configure_header $h -colspans $arg_colspans -values [list Synopsis: [punk::ansi::ansiwrap brightwhite $synopsis]] @@ -5807,6 +5845,49 @@ tcl::namespace::eval punk::args { break } } + packageversion { + if {[catch {::package vsatisfies $e_check $e_check}]} { + set msg "$argclass $argname for %caller% requires type packageversion. A package version number as understood by 'package vsatifies'. Received: '$e_check'" + lset clause_results $c_idx $a_idx [list errorcode [list PUNKARGS VALIDATION [list typemismatch $type] -badarg $argname -argspecs $argspecs] msg $msg] + } else { + lset clause_results $c_idx $a_idx 1 + break + } + } + packagerequirement { + set parts [split $e_check -] + if {[llength $parts] > 2} { + set msg "$argclass $argname for %caller% requires type packagerequirement. (form min min- or min-max) Received: '$e_check'" + lset clause_results $c_idx $a_idx [list errorcode [list PUNKARGS VALIDATION [list typemismatch $type] -badarg $argname -argspecs $argspecs] msg $msg] + continue + } + set vchecklist [list] + if {[llength $parts] == 1} { + lappend vchecklist [lindex $parts 0] + } else { + lassign $parts vmin vmax + if {$vmax eq ""} { + #empty vmax allowed - ignore + lappend vchecklist $vmin + } else { + lappend vchecklist $vmin $vmax + } + } + #we have either just the min, or min and max + set v_ok 1 ;#default assumption + foreach vcheck $vchecklist { + if {[catch {::package vsatisfies $vcheck $vcheck}]} { + set msg "$argclass $argname for %caller% requires type packagerequirement. (from min min- or min-max) . Received: '$e_check'" + lset clause_results $c_idx $a_idx [list errorcode [list PUNKARGS VALIDATION [list typemismatch $type] -badarg $argname -argspecs $argspecs] msg $msg] + set v_ok 0 + break ;#inner loop + } + } + if {$v_ok} { + lset clause_results $c_idx $a_idx 1 + break + } + } string - ansistring - globstring { #we may commonly want exceptions that ignore validation rules - most commonly probably the empty string #we possibly don't want to always have to regex on things that don't pass the other more basic checks @@ -9167,6 +9248,7 @@ tcl::namespace::eval punk::args { append syn " $display" dict set ARGD type [dict get $arginfo -type] dict set ARGD optional [dict get $arginfo -optional] + dict set ARGD multiple [dict get $arginfo -multiple] dict set ARGD display $display #dict lappend SYND $f $ARGD @@ -9300,6 +9382,7 @@ tcl::namespace::eval punk::args { append syn " $display" dict set ARGD type [dict get $arginfo -type] dict set ARGD optional [dict get $arginfo -optional] + dict set ARGD multiple [dict get $arginfo -multiple] dict set ARGD display $display #dict lappend SYND $f $ARGD lappend FORMARGS $ARGD @@ -9417,10 +9500,23 @@ tcl::namespace::eval punk::args { append syn " $display" dict set ARGD type [dict get $arginfo -type] dict set ARGD optional [dict get $arginfo -optional] + dict set ARGD multiple [dict get $arginfo -multiple] dict set ARGD display $display #dict lappend SYND $f $ARGD lappend FORMARGS $ARGD } + + #accepts unnamed extra arguments e.g toplevel docid for ensembles and ensemble-like commands + if {[dict get $forminfo VAL_UNNAMED]} { + set display "?...?" + append syn " $display" + set ARGD [dict create argname "" class value] + dict set ARGD type any + dict set ARGD optional 1 + dict set ARGD multiple 1 + dict set ARGD display $display + lappend FORMARGS $ARGD + } append syn \n dict set SYND FORMS $f $FORMARGS } @@ -9640,7 +9736,8 @@ tcl::namespace::eval punk::args { dict for {g members} $opt_groupdict { lappend allgrouped {*}$members } - set choiceinfodict [dict create] + set choiceinfodict [dict create] + set choicelabelsdict [dict create] foreach {sc cmd} $subdict { if {$sc ni $allgrouped} { if {$sc ni $others} { @@ -9669,20 +9766,43 @@ tcl::namespace::eval punk::args { } } + + #could be more than one punk::args id - choose a precedence by how we order the id_exists checks. - if {[punk::args::id_exists [list $ensemble $sc]]} { - dict lappend choiceinfodict $sc {doctype punkargs} - dict lappend choiceinfodict $sc [list subhelp {*}$ensemble $sc] - } elseif {[punk::args::id_exists $cmd]} { - dict lappend choiceinfodict $sc {doctype punkargs} - dict lappend choiceinfodict $sc [list subhelp {*}$cmd] - } elseif {[punk::args::id_exists [dict get $cinfo origin]]} { - dict lappend choiceinfodict $sc {doctype punkargs} - dict lappend choiceinfodict $sc [list subhelp {*}[dict get $cinfo origin]] - } else { - #puts stderr "ensemble_subcommands_definition--- NO doc for [list $ensemble $sc] or $cmd or [dict get $cinfo origin]" + set id_checks [list\ + "$ensemble $sc"\ + $cmd\ + [dict get $cinfo origin]\ + ] + foreach checkid $id_checks { + if {[punk::args::id_exists $checkid]} { + dict lappend choiceinfodict $sc {doctype punkargs} + dict lappend choiceinfodict $sc [list subhelp {*}$checkid] + dict set choicelabelsdict $sc [punk::ansi::a+ normal][punk::ns::synopsis $checkid][punk::ansi::a] + break + } } + #if {[punk::args::id_exists [list $ensemble $sc]]} { + # dict lappend choiceinfodict $sc {doctype punkargs} + # dict lappend choiceinfodict $sc [list subhelp {*}$ensemble $sc] + #} elseif {[punk::args::id_exists $cmd]} { + # dict lappend choiceinfodict $sc {doctype punkargs} + # dict lappend choiceinfodict $sc [list subhelp {*}$cmd] + #} elseif {[punk::args::id_exists [dict get $cinfo origin]]} { + # dict lappend choiceinfodict $sc {doctype punkargs} + # dict lappend choiceinfodict $sc [list subhelp {*}[dict get $cinfo origin]] + #} + + #foreach id [punk::args::get_ids "::package *"] { + # if {[llength $id] == 2} { + # lassign $id _ sub + # dict set PACKAGE_CHOICEINFO $sub {{doctype native} {doctype punkargs}} + # #override manual synopsis entry + # dict set PACKAGE_CHOICELABELS $sub [punk::ns::synopsis "::package $sub"] + # } + #} + #if {[punk::args::id_exists [dict get $cinfo origin]] || [punk::args::id_exists [list $ensemble $sc]]} { # dict lappend choiceinfodict $sc {doctype punkargs} #} @@ -9694,7 +9814,7 @@ tcl::namespace::eval punk::args { dict for {g members} $opt_groupdict { append argdef " \"$g\" \{$members\}" \n } - append argdef " \} -choicecolumns $opt_columns -choiceinfo {$choiceinfodict}" \n + append argdef " \} -choicecolumns $opt_columns -choicelabels {$choicelabelsdict} -choiceinfo {$choiceinfodict}" \n #todo -choicelabels #detect subcommand further info available e.g if oo or ensemble or punk::args id exists.. diff --git a/src/modules/punk/args/moduledoc/tclcore-999999.0a1.0.tm b/src/modules/punk/args/moduledoc/tclcore-999999.0a1.0.tm index c40bc191..18517db3 100644 --- a/src/modules/punk/args/moduledoc/tclcore-999999.0a1.0.tm +++ b/src/modules/punk/args/moduledoc/tclcore-999999.0a1.0.tm @@ -34,7 +34,7 @@ #[para] overview of punk::args::moduledoc::tclcore #[subsection Concepts] #[para] This is a punk::args module documentation package. -#[para] It provides punk::args definitions for core Tcl commands, +#[para] It provides punk::args definitions for core Tcl commands # ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ ## Requirements @@ -158,7 +158,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { lappend PUNKARGS [list { @id -id ::parray - @cmd -name "Built-in: parray" -help\ + @cmd -name "Autoloading Built-in: parray" -help\ "Prints on standard output the names and values of all the elements in the array arrayName, or just the names that match pattern (using the matching rules of string_match) and their values if pattern is given. @@ -175,7 +175,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { @id -id ::foreachLine - @cmd -name "Built-in: foreachLine" -help\ + @cmd -name "Autoloading Built-in: foreachLine" -help\ "This reads in the text file named ${$I}filename${$NI} one line at a time (using system defaults for reading text files). It writes that line to the variable named by ${$I}varName${$NI} and then executes ${$I}body${$NI} for that line. The result value of ${$I}body${$NI} is @@ -192,7 +192,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { @id -id ::readFile - @cmd -name "Built-in: readFile" -help\ + @cmd -name "Autoloading Built-in: readFile" -help\ "Reads in the file named in ${$I}filename${$NI} and returns its contents. The second argument says how to read in the file, either as ${$B}text${$N} (using the system defaults for reading text files) or as ${$B}binary${$N} (as uninterpreted bytes). @@ -208,7 +208,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { @id -id ::writeFile - @cmd -name "Built-in: writeFile" -help\ + @cmd -name "Autoloading Built-in: writeFile" -help\ "Writes the contents to the file named in ${$I}filename${$NI}. The optional second argument says how to write to the file, either as ${$B}text${$N} (using the system defaults for writing text files) or as ${$B}binary${$N} (as uninterpreted bytes). @@ -221,40 +221,219 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { contents } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tcl_endOfWord + @cmd -name "Autoloading Built-in: tcl_endOfWord"\ + -summary\ + "end-of-word index after supplied index ${$I}start${$NI}"\ + -help\ + "Returns the index of the first end-of-word location that occurs after a starting index start + in the string ${$I}str${$NI}. An end-of-word location is defined to be the first non-word + character following the first word character after the starting point. Returns -1 if there are + no more end-of-word locations after the starting point. See the description of tcl_wordchars and + tcl_nonwordchars below for more details on how Tcl determines which characters are word characters." + #'below' here means in the man page + #todo - supplementary (shared)::tcl_wordchars (shared)::tcl_nonwordchars documentation ? + @values -min 2 -max 2 + str -type string + start -type indexexpression + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tcl_startOfNextWord + @cmd -name "Autoloading Built-in: tcl_startOfNextWord"\ + -summary\ + "first start-of-word index after supplied index ${$I}start${$NI}"\ + -help\ + "Returns the index of the first start-of-word location that occurs after a starting index start + in the string str. A start-of-word location is defined to be the first word character following a + non-word character. Returns -1 if there are no more start-of-word locations after the starting point. + + For example, to print the indices of the starts of each word in a string according to platform rules: + + set theString "The quick brown fox" + for {set idx 0} {$idx >= 0} { + set idx [tcl_startOfNextWord $theString $idx]} { + puts "Word start index: $idx" + } + " + @values -min 2 -max 2 + str -type string + start -type indexexpression + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tcl_startOfPreviousWord + @cmd -name "Autoloading Built-in: tcl_startOfPreviousWord"\ + -summary\ + "first start-of-word index before supplied index ${$I}start${$NI}"\ + -help\ + "Returns the index of the first start-of-word location that occurs before a starting index start + in the string str. Returns -1 if there are no more start-of-word locations before the starting point." + @values -min 2 -max 2 + str -type string + start -type indexexpression + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tcl_wordBreakAfter + @cmd -name "Autoloading Built-in: tcl_wordBreakAfter"\ + -summary\ + "first word boundary index after supplied index ${$I}start${$NI}"\ + -help\ + "Returns the index of the first word boundary after the starting index start in the string str. + Returns -1 if there are no more boundaries after the starting point in the given string. The index + returned refers to the second character of the pair that comprises a boundary." + @values -min 2 -max 2 + str -type string + start -type indexexpression + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tcl_wordBreakBefore + @cmd -name "Autoloading Built-in: tcl_wordBreakBefore"\ + -summary\ + "first word boundary index before supplied index ${$I}start${$NI}"\ + -help\ + "Returns the index of the first word boundary before the starting index start in the string str. + Returns -1 if there are no more boundaries before the starting point in the given string. The index + returned refers to the second character of the pair that comprises a boundary." + @values -min 2 -max 2 + str -type string + start -type indexexpression + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + + lappend PUNKARGS [list { + @id -id ::tcl_findLibrary + @cmd -name "Autoloading Built-in: tcl_findLibrary"\ + -summary\ + "Extension initialization search function."\ + -help\ + "This is a standard search procedure for use by extensions during their initialization. + They call this procedure to look for their script library in several standard directories. + The last component of the name of the library directory is normally basenameversion + (e.g., tk8.0), but it might be “library” when in the build hierarchies. The initScript file + will be sourced into the interpreter once it is found. The directory in which this file is + found is stored into the global variable varName. If this variable is already defined + (e.g., by C code during application initialization) then no searching is done. Otherwise + the search looks in these directories: the directory named by the environment variable + enVarName; relative to the Tcl library directory; relative to the executable file in the + standard installation bin or bin/arch directory; relative to the executable file in the + current build tree; relative to the executable file in a parallel build tree." + @values -min 6 -max 6 + basename -type string + version -type packageversion + patch -type any -help "UNUSED" + initScript -type string + enVarName -type string + varName -type string + + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + lappend PUNKARGS [list { + @id -id ::tclPkgSetup + @cmd -name "Autoloading Built-in: tclPkgSetup"\ + -summary\ + "DEPRECATED package utility"\ + -help\ + "${$B}DEPRECATED${$N} support/utility procedure used by pkgIndex.tcl files that + enables -lazy in package index script. + It is invoked as part of a ${$B}package ifneeded${$N} script. + It calls ${$B}package provide${$N} to indicate that a package is available, then sets entries + in the auto_index array so that the package's files will be auto-loaded when the + commands are used. + + Kept for backwards compatibility - may be removed at some point. + " + @values -min 2 -max 2 + dir -type string -help "Directory containing all the files for this package." + pkg -type string -help "Name of the package (no version number)" + version -type packageversion + files -type list -help\ + "List of files that constitute the package. Each element is a sub-list with three elements. + The first is the name of a file relative to $dir, the second is ${$B}load${$N} or ${$B}source${$N}, + indicating whether the file is a loadable binary or a script to source, and the third is a + list of commands defined by this file." + } "@doc -name Manpage: -url [manpage_tcl library]" ] } # -- --- --- --- --- --- --- --- --- --- --- --- --- --- # (end of auto_index commands) # -- --- --- --- --- --- --- --- --- --- --- --- --- --- + #other tcl_library commands + lappend PUNKARGS [list { + @id -id ::auto_execok + @cmd -name "tcl_library Built-in: auto_execok"\ + -summary\ + "Retrieve executable file or shell builtin for use with exec."\ + -help\ + "Determines whether there is an executable file or shell builtin by the name ${$I}cmd${$NI}. If so, it + returns a list of arguments to be passed to ${$B}exec${$N} to execute the executable file or shell + builtin named by ${$I}cmd${$NI}. If not, it returns an empty string. This command examines the + directories in the current search path (given by the PATH environment variable) in its + search for an executable file named ${$I}cmd${$NI}. On Windows platforms, the search is expanded with + the same directories and file extensions as used by ${$B}exec${$N}. ${$B}Auto_execok${$N} remembers information + about previous searches in an array named auto_execs; this avoids the path search in future + calls for the same ${$I}cmd${$NI}. The command ${$B}auto_reset${$N} may be used to force ${$B}auto_execok${$N} to forget + its cached information. + + For example, to run the umask shell builtin on Linux, you would do: + exec {*}[auto_execok umask] + + To run the DIR shell builtin on Windows, you would do: + exec {*}[auto_execok dir] + + To discover if there is a frobnicate binary on the user's PATH, you would do: + set mayFrob [expr {[llength [auto_execok frobnicate]] > 0}] + " + @values -min 2 -max 2 + cmd -type string + } "@doc -name Manpage: -url [manpage_tcl library]" ] + + namespace eval argdoc { punk::args::define { - @id -id ::tcl::info::args - @cmd -name "Built-in: tcl::info::args" -help\ + @id -id ::tcl::info::args + @cmd -name "Built-in: tcl::info::args"\ + -summary\ + "procedure parameters"\ + -help\ "Returns the names of the parameters to the procedure named ${$I}procname${$NI}." @values -min 1 -max 1 procname -type string -optional 0 } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::body - @cmd -name "Built-in: tcl::info::body" -help\ + @id -id ::tcl::info::body + @cmd -name "Built-in: tcl::info::body"\ + -summary\ + "procedure body"\ + -help\ "Returns the body procedure named ${$I}procname${$NI}." @values -min 1 -max 1 procname -type string -optional 0 } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::cmdcount - @cmd -name "Built-in: tcl::info::cmdcount" -help\ + @id -id ::tcl::info::cmdcount + @cmd -name "Built-in: tcl::info::cmdcount"\ + -summary\ + "Interp's total commands evaluated"\ + -help\ "Returns the total number of commands evaluated in this interpreter." @leaders -min 0 -max 0 @values -min 0 -max 0 } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::cmdtype - @cmd -name "Built-in: tcl::info::cmdtype" -help\ + @id -id ::tcl::info::cmdtype + @cmd -name "Built-in: tcl::info::cmdtype"\ + -summary\ + "command type: proc, ensemble etc"\ + -help\ "Returns the type of the command named ${$I}commandName${$NI}. Built-in types are: ${$B}alias${$N} @@ -287,8 +466,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::coroutine - @cmd -name "Built-in: tcl::info::coroutine" -help\ + @id -id ::tcl::info::coroutine + @cmd -name "Built-in: tcl::info::coroutine"\ + -summary\ + "current coroutine"\ + -help\ "Returns the name of the current ${$B}coroutine${$N}, or the empty string if there is no current coroutine or the current coroutine has been deleted." @leaders -min 0 -max 0 @@ -296,8 +478,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::default - @cmd -name "Built-in: tcl::info::default" -help\ + @id -id ::tcl::info::default + @cmd -name "Built-in: tcl::info::default"\ + -summary\ + "default parameter value"\ + -help\ "If the parameter ${$I}parameter${$NI} for the procedure named ${$I}procname${$NI} has a default value, stores that value in ${$I}varname${$NI} and returns ${$B}1${$N}. Otherwise, returns ${$B}0${$N}." @@ -308,8 +493,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::functions - @cmd -name "Built-in: tcl::info::functions" -help\ + @id -id ::tcl::info::functions + @cmd -name "Built-in: tcl::info::functions"\ + -summary\ + "defined math functions"\ + -help\ "If ${$I}pattern${$NI} is not given, returns a list of all the math functions currently defined. If ${$I}pattern${$NI} is given, returns only those names that match ${$I}pattern${$NI} according to ${$B}string match${$N}." @values -min 0 -max 2 @@ -317,8 +505,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::globals - @cmd -name "Built-in: tcl::info::globals" -help\ + @id -id ::tcl::info::globals + @cmd -name "Built-in: tcl::info::globals"\ + -summary\ + "defined global variables"\ + -help\ "If ${$I}pattern${$NI} is not given, returns a list of all the names of currently-defined global variables. Global variables are variables in the global namespace. If ${$I}pattern${$NI} is given, only those names matching ${$I}pattern${$NI} are returned. Matching is determined using the @@ -328,8 +519,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::hostname - @cmd -name "Built-in: tcl::info::hostname" -help\ + @id -id ::tcl::info::hostname + @cmd -name "Built-in: tcl::info::hostname"\ + -summary\ + "Current host name"\ + -help\ "Returns the name of the current host. This name is not guaranteed to be the fully-qualified domain name of the host. Where machines have several different names, as is common on systems with @@ -340,8 +534,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::level - @cmd -name "Built-in: tcl::info::level" -help\ + @id -id ::tcl::info::level + @cmd -name "Built-in: tcl::info::level"\ + -summary\ + "Calling level or command at level"\ + -help\ "If number is not given, the level this routine was called from. Otherwise returns the complete command active at the given level. If number is greater than ${$B}0${$N}, it is the desired level. Otherwise, it is number levels up from the @@ -353,8 +550,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::library - @cmd -name "Built-in: tcl::info::library" -help\ + @id -id ::tcl::info::library + @cmd -name "Built-in: tcl::info::library"\ + -summary\ + "library directory"\ + -help\ "Returns the value of ${$B}tcl_library${$N}, which is the name of the library directory in which the scripts distributed with Tcl scripts are stored." @leaders -min 0 -max 0 @@ -362,8 +562,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::loaded - @cmd -name "Built-in: tcl::info::loaded" -help\ + @id -id ::tcl::info::loaded + @cmd -name "Built-in: tcl::info::loaded"\ + -summary\ + "loaded binary library files"\ + -help\ "Returns the name of each file loaded in interp by the load command with prefix prefix . If prefix is not given, returns a list where each item is the name of the loaded file and the prefix for which the file was loaded. @@ -375,8 +578,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" punk::args::define { - @id -id ::tcl::info::locals - @cmd -name "Built-in: tcl::info::locals" -help\ + @id -id ::tcl::info::locals + @cmd -name "Built-in: tcl::info::locals"\ + -summary\ + "local variables (proc/apply)"\ + -help\ "If ${$I}pattern${$NI} is given, returns the name of each local variable matching pattern according to ${$B}string match${$N}. Otherwise, returns the name of each local variable. A variables defined with the ${$B}global${$N}, ${$B}upvar${$N} or ${$B}variable${$N} is not local." @@ -386,8 +592,11 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { punk::args::define { - @id -id ::tcl::info::nameofexecutable - @cmd -name "Built-in: tcl::info::nameofexecutable" -help\ + @id -id ::tcl::info::nameofexecutable + @cmd -name "Built-in: tcl::info::nameofexecutable"\ + -summary\ + "Executable absolute path"\ + -help\ "Returns the absolute pathname of the program for the current interpreter. If such a file can not be identified an empty string is returned." @leaders -min 0 -max 0 @@ -465,7 +674,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { dict set groups "variables" {constant consts exists globals locals vars} dict set groups "oo object introspection" {class object} - return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 4 info] + return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 2 info] } set DYN_INFO_SUBCOMMANDS {${[punk::args::moduledoc::tclcore::argdoc::info_subcommands]}} lappend PUNKARGS [list { @@ -476,11 +685,12 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { "Information about the state of the Tcl interpreter"\ -help\ "Information about the state of the Tcl interpreter" + #a root docid for an ensemble-like command must always specify a -max for @leaders @leaders -min 1 -max 1 ${$DYN_INFO_SUBCOMMANDS} - @values -min 0 + @values -unnamed true - } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl array]" ] + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl info]" ] } @@ -592,105 +802,156 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { data -type string } ] + #JJJ namespace eval argdoc { - lappend PUNKARGS [list { - @id -id "::tcl::encoding::convertfrom" - @cmd -name "encoding convertfrom" -help\ - "Converts data, which should be in the form of a binary string encoded as per encoding, - to a Tcl string. If encoding is not specified, the current system encoding is used." + if {[catch {encoding profiles} ENCODING_PROFILES]} { - @form -form basic - @values -min 1 -max 2 - encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 - data -type string -help "binary string" - - @form -form full - @leaders -min 0 -max 0 - @opts - -profile -type string -typesynopsis ${$I}profile${$NI} -help\ - "Determines the command behavior in the presence of conversion errors. - Any premature termination of processing due to errors is reported through an exception - if the -failindex option is not specified. - - Operations involving encoding transforms may encounter several types of errors such as - invalid sequences in the source data, characters that cannot be encoded in the target - encoding and so on. A profile prescribes the strategy for dealing with such errors in - one of two ways: - - Terminating further processing of the source data. The profile does not determine how - this premature termination is conveyed to the caller. By default, this is signalled - by raising an exception. If the -failindex option is specified, errors are reported - through that mechanism. - - Continue further processing of the source data using a fallback strategy such as - replacing or discarding the offending bytes in a profile-defined manner. - - The following profiles are currently implemented with strict being the default if the -profile is not specified."\ - -choicecolumns 1\ - -choices {strict tcl8 replace}\ - -choiceprefix 0\ - -choicelabels { - strict - " The strict profile always stops processing when an conversion error is encountered. - The error is signalled via an exception or the -failindex option mechanism. - The strict profile implements a Unicode standard conformant behavior." - tcl8 - " The tcl8 profile always follows the first strategy above and corresponds to the behavior - of encoding transforms in Tcl 8.6. When converting from an external encoding other than - utf-8 to Tcl strings with the encoding convertfrom command, invalid bytes are mapped to - their numerically equivalent code points. For example, the byte 0x80 which is invalid in - ASCII would be mapped to code point U+0080. When converting from utf-8, invalid bytes - that are defined in CP1252 are mapped to their Unicode equivalents while those that are - not fall back to the numerical equivalents. For example, byte 0x80 is defined by CP1252 - and is therefore mapped to its Unicode equivalent U+20AC while byte 0x81 which is not - defined by CP1252 is mapped to U+0081. As an additional special case, the sequence - 0xC0 0x80 is mapped to U+0000. When converting from Tcl strings to an external encoding - format using encoding convertto, characters that cannot be represented in the target - encoding are replaced by an encoding-dependent character, usually the question mark ?." - replace - " Like the tcl8 profile, the replace profile always continues processing on conversion - errors but follows a Unicode standard conformant method for substitution of invalid - source data. When converting an encoded byte sequence to a Tcl string using encoding - convertfrom, invalid bytes are replaced by the U+FFFD REPLACEMENT CHARACTER code point. - When encoding a Tcl string with encoding convertto, code points that cannot be represented - in the target encoding are transformed to an encoding-specific fallback character, U+FFFD - REPLACEMENT CHARACTER for UTF targets and generally `?` for other encodings." - } - -failindex -type string -typesynopsis ${$I}var${$NI} -help\ - "If specified, instead of an exception being raised on premature termination, - the result of the conversion up to the point of the error is returned as the - result of the command. In addition, the index of the source byte triggering - the error is stored in var. If no errors are encountered, the entire result - of the conversion is returned and the value -1 is stored in var." - @values -min 2 -max 2 - encoding -type string -optional 0 - data -type string -help "binary string" - } "@doc -name Manpage: -url [manpage_tcl encoding]" ] + #tcl <= 8.6x? - no profiles + lappend PUNKARGS [list { + @id -id "::tcl::encoding::convertfrom" + @cmd -name "encoding convertfrom"\ + -summary\ + "encoded binary string data to string"\ + -help\ + "Converts data, which should be in the form of a binary string encoded as per encoding, + to a Tcl string. If encoding is not specified, the current system encoding is used." + + @form -form basic + @values -min 1 -max 2 + encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 + data -type string -help "binary string" + } "@doc -name Manpage: -url [manpage_tcl encoding]" ] + + lappend PUNKARGS [list { + @id -id "::tcl::encoding::convertto" + @cmd -name "encoding convertto"\ + -summary\ + "encoded binary string from string data"\ + -help\ + "Convert string to the specified encoding. The result is a Tcl binary string that + contains the sequence of bytes representing the converted string in the specified + encoding. If encoding is not specified, the current system encoding is used." + @form -form basic + @values -min 1 -max 2 + encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 + data -type string + } "@doc -name Manpage: -url [manpage_tcl encoding]" ] + + } else { + #tcl 9- + lappend PUNKARGS [list { + @id -id "::tcl::encoding::convertfrom" + @cmd -name "encoding convertfrom"\ + -summary\ + "encoded binary string data to string"\ + -help\ + "Converts data, which should be in the form of a binary string encoded as per encoding, + to a Tcl string. If encoding is not specified, the current system encoding is used." + + @form -form basic + @values -min 1 -max 2 + encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 + data -type string -help "binary string" + + #todo - load choices from result of [encoding profiles] + + @form -form full + @leaders -min 0 -max 0 + @opts + -profile -type string -typesynopsis ${$I}profile${$NI} -help\ + "Determines the command behavior in the presence of conversion errors. + Any premature termination of processing due to errors is reported through an exception + if the -failindex option is not specified. + + Operations involving encoding transforms may encounter several types of errors such as + invalid sequences in the source data, characters that cannot be encoded in the target + encoding and so on. A profile prescribes the strategy for dealing with such errors in + one of two ways: + + Terminating further processing of the source data. The profile does not determine how + this premature termination is conveyed to the caller. By default, this is signalled + by raising an exception. If the -failindex option is specified, errors are reported + through that mechanism. + + Continue further processing of the source data using a fallback strategy such as + replacing or discarding the offending bytes in a profile-defined manner. + + The following profiles are currently implemented with strict being the default if the -profile is not specified."\ + -choicecolumns 1\ + -choices {${$ENCODING_PROFILES}}\ + -choiceprefix 0\ + -choicelabels { + strict + " The strict profile always stops processing when an conversion error is encountered. + The error is signalled via an exception or the -failindex option mechanism. + The strict profile implements a Unicode standard conformant behavior." + tcl8 + " The tcl8 profile always follows the first strategy above and corresponds to the behavior + of encoding transforms in Tcl 8.6. When converting from an external encoding other than + utf-8 to Tcl strings with the encoding convertfrom command, invalid bytes are mapped to + their numerically equivalent code points. For example, the byte 0x80 which is invalid in + ASCII would be mapped to code point U+0080. When converting from utf-8, invalid bytes + that are defined in CP1252 are mapped to their Unicode equivalents while those that are + not fall back to the numerical equivalents. For example, byte 0x80 is defined by CP1252 + and is therefore mapped to its Unicode equivalent U+20AC while byte 0x81 which is not + defined by CP1252 is mapped to U+0081. As an additional special case, the sequence + 0xC0 0x80 is mapped to U+0000. When converting from Tcl strings to an external encoding + format using encoding convertto, characters that cannot be represented in the target + encoding are replaced by an encoding-dependent character, usually the question mark ?." + replace + " Like the tcl8 profile, the replace profile always continues processing on conversion + errors but follows a Unicode standard conformant method for substitution of invalid + source data. When converting an encoded byte sequence to a Tcl string using encoding + convertfrom, invalid bytes are replaced by the U+FFFD REPLACEMENT CHARACTER code point. + When encoding a Tcl string with encoding convertto, code points that cannot be represented + in the target encoding are transformed to an encoding-specific fallback character, U+FFFD + REPLACEMENT CHARACTER for UTF targets and generally `?` for other encodings." + } + -failindex -type string -typesynopsis ${$I}var${$NI} -help\ + "If specified, instead of an exception being raised on premature termination, + the result of the conversion up to the point of the error is returned as the + result of the command. In addition, the index of the source byte triggering + the error is stored in var. If no errors are encountered, the entire result + of the conversion is returned and the value -1 is stored in var." + @values -min 2 -max 2 + encoding -type string -optional 0 + data -type string -help "binary string" + } "@doc -name Manpage: -url [manpage_tcl encoding]" ] + + + lappend PUNKARGS [list { + @id -id "::tcl::encoding::convertto" + @cmd -name "encoding convertto"\ + -summary\ + "encoded binary string from string data"\ + -help\ + "Convert string to the specified encoding. The result is a Tcl binary string that + contains the sequence of bytes representing the converted string in the specified + encoding. If encoding is not specified, the current system encoding is used." + @form -form basic + @values -min 1 -max 2 + encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 + data -type string + + @form -form full + @leaders -min 0 -max 0 + @opts + ${[punk::args::resolved_def -form 1 -types opts ::tcl::encoding::convertfrom -*]} + @values -min 2 -max 2 + encoding -type string -optional 0 + data -type string + } "@doc -name Manpage: -url [manpage_tcl encoding]" ] - lappend PUNKARGS [list { - @id -id "::tcl::encoding::convertto" - @cmd -name "encoding convertto" -help\ - "Convert string to the specified encoding. The result is a Tcl binary string that - contains the sequence of bytes representing the converted string in the specified - encoding. If encoding is not specified, the current system encoding is used." - @form -form basic - @values -min 1 -max 2 - encoding -type string -typesynopsis ${$I}encoding${$NI} -optional 1 - data -type string + } - @form -form full - @leaders -min 0 -max 0 - @opts - ${[punk::args::resolved_def -form 1 -types opts ::tcl::encoding::convertfrom -*]} - @values -min 2 -max 2 - encoding -type string -optional 0 - data -type string - } "@doc -name Manpage: -url [manpage_tcl encoding]" ] } namespace eval argdoc { lappend PUNKARGS [list { @id -id "::tcl::encoding::dirs" - @cmd -name "encoding dirs" -help\ + @cmd -name "encoding dirs"\ + -summary\ + "get/set encoding data-file search directories"\ + -help\ "Tcl can load encoding data files from the file system that describe additional encodings for it to work with. This command sets the search path for ${$B}*.enc${$N} encoding data files to the list of directories @@ -703,48 +964,136 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { @values -min 0 -max 1 directoryList -optional 1 -type list } "@doc -name Manpage: -url [manpage_tcl encoding]" ] - } - namespace eval argdoc { + lappend PUNKARGS [list { @id -id "::tcl::encoding::names" - @cmd -name "encoding names" -help\ + @cmd -name "encoding names"\ + -summary\ + "list available encodings"\ + -help\ "Returns a list containing the names of all of the encodings that are currently available. The encodings “utf-8” and “iso8859-1” are guaranteed to be present in the list." @values -min 0 -max 0 } "@doc -name Manpage: -url [manpage_tcl encoding]" ] - } - namespace eval argdoc { + + lappend PUNKARGS [list { @id -id "::tcl::encoding::profiles" - @cmd -name "encoding profiles" -help\ + @cmd -name "encoding profiles"\ + -summary\ + "list encoding profile names"\ + -help\ "Returns a list of the names of encoding profiles. See PROFILES below." @values -min 0 -max 0 } "@doc -name Manpage: -url [manpage_tcl encoding]" ] - } - namespace eval argdoc { + + lappend PUNKARGS [list { @id -id "::tcl::encoding::system" - @cmd -name "encoding system" -help\ + @cmd -name "encoding system"\ + -summary\ + "set or query system encoding."\ + -help\ "Set the system encoding to ${$I}encoding${$NI}. If ${$I}encoding${$NI} is omitted then the command returns the current system encoding. The system encoding is used whenever Tcl passes strings to system calls." @values -min 0 -max 1 encoding -type string -optional 1 } "@doc -name Manpage: -url [manpage_tcl encoding]" ] - } - namespace eval argdoc { + + lappend PUNKARGS [list { @id -id "::tcl::encoding::user" - @cmd -name "encoding user" -help\ + @cmd -name "encoding user"\ + -summary\ + "get user encoding"\ + -help\ "Returns the name of encoding as per the user's preferences. On Windows systems, this is based on the user's code page settings in the registry. On other platforms, the returned value is the same as returned by encoding system." @values -min 0 -max 0 } "@doc -name Manpage: -url [manpage_tcl encoding]" ] + + proc encoding_subcommands {} { + #package require punk::ns + #set subdict [punk::ns::ensemble_subcommands -return dict info] + #set allsubs [dict keys $subdict] + dict set groups "" {convertfrom convertto dirs names profiles system user} + + return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 1 encoding] + } + set ENCODING_SUBCOMMANDS {${[punk::args::moduledoc::tclcore::argdoc::encoding_subcommands]}} + #by making the doc for the ensemble @dynamic - any additional subcommands added to the ensemble at runtime will show as subcommands in the documentation for ::encoding + punk::args::define { + @dynamic + @id -id ::encoding + @cmd -name "Built-in: encoding"\ + -summary\ + "Manipulate encodings."\ + -help\ + "Strings in Tcl are logically a sequence of Unicode characters. These strings are represented + in memory as a sequence of bytes that may be in one of several encodings: modified UTF-8 + (which uses 1 to 4 bytes per character), or a custom encoding start as 8 bit binary data. + Different operating system interfaces or applications may generate strings in other encodings + such as Shift-JIS. The encoding command helps to bridge the gap between Unicode and these + other formats." + @leaders -min 1 -max 1 + ${$ENCODING_SUBCOMMANDS} + @values -unnamed true + + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl encoding]"\ + {@examples -help { + These examples use the utility proc below that prints the Unicode code points comprising a Tcl string. + ${[punk::args::moduledoc::tclcore::argdoc::example { + proc codepoints s {join [lmap c [split $s {}] { + string cat U+ [format %.6X [scan $c %c]]}] + } + }]} + + Example 1: convert a byte sequence in Japanese euc-jp encoding to a TCL string: + ${[punk::args::moduledoc::tclcore::argdoc::example { + % codepoints [encoding convertfrom euc-jp "\xA4\xCF"] + U+00306F + }]} + The result is the unicode codepoint “\u306F”, which is the Hiragana letter HA. + + Example 2: Error handling based on profiles: + The letter A is Unicode character U+0041 and the byte "\x80" is invalid in ASCII encoding. + ${[punk::args::moduledoc::tclcore::argdoc::example { + % codepoints [encoding convertfrom -profile tcl8 ascii A\x80] + U+000041 U+000080 + % codepoints [encoding convertfrom -profile replace ascii A\x80] + U+000041 U+00FFFD + % codepoints [encoding convertfrom -profile strict ascii A\x80] + unexpected byte sequence starting at index 1: '\x80' + }]} + + Example 3: Get partial data and the error location: + ${[punk::args::moduledoc::tclcore::argdoc::example { + % codepoints [encoding convertfrom -profile strict -failindex idx ascii AB\x80] + U+000041 U+000042 + % set idx + 2 + }]} + + Example 4: Encode a character that is not representable in ISO8859-1: + ${[punk::args::moduledoc::tclcore::argdoc::example { + % encoding convertto iso8859-1 A\u0141 + A? + % encoding convertto -profile strict iso8859-1 A\u0141 + unexpected character at index 1: 'U+000141' + % encoding convertto -profile strict -failindex idx iso8859-1 A\u0141 + A + % set idx + 1 + }]} + } + } } + lappend PUNKARGS [list { @id -id ::time @cmd -name "Built-in: time" -help\ @@ -763,7 +1112,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { lappend PUNKARGS [list { - @id -id ::tcl::chan::blocked + @id -id ::tcl::chan::blocked @cmd -name "Built-in: tcl::chan::blocked" -help\ "This tests whether the last input operation on the channel called ${$I}channel${$NI} failed because it would otherwise have caused the process to block, and returns 1 @@ -776,7 +1125,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::close + @id -id ::tcl::chan::close @cmd -name "Built-in: tcl::chan::close" -help\ "Close and destroy the channel called channel. Note that this deletes all existing file-events registered on the channel. If the direction argument (which must be read or write or any @@ -830,7 +1179,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::fconfigure + @id -id ::fconfigure @cmd -name "Built-in: chan configure" -help\ "Query or set the configuration options of the channel named ${$I}channel${$NI} If no ${$I}optionName${$NI} or ${$I}value${$NI} arguments are supplied, the @@ -898,7 +1247,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { lappend PUNKARGS [list { - @id -id ::tcl::chan::eof + @id -id ::tcl::chan::eof @cmd -name "Built-in: tcl::chan::eof"\ -summary\ "Check for end of file condition on channel"\ @@ -913,7 +1262,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #event lappend PUNKARGS [list { - @id -id ::tcl::chan::flush + @id -id ::tcl::chan::flush @cmd -name "Built-in: tcl::chan::flush"\ -summary\ "Flush pending output."\ @@ -928,7 +1277,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::gets + @id -id ::tcl::chan::gets @cmd -name "Built-in: tcl::chan::gets"\ -summary\ "Read a line from channel."\ @@ -970,7 +1319,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #names #pending lappend PUNKARGS [list { - @id -id ::tcl::chan::pipe + @id -id ::tcl::chan::pipe @cmd -name "Built-in: tcl::chan::pipe"\ -summary\ "Create a standalone pipe."\ @@ -995,7 +1344,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::pop + @id -id ::tcl::chan::pop @cmd -name "Built-in: tcl::chan::pop"\ -summary\ "Remove topmost channel transform."\ @@ -1010,7 +1359,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::puts + @id -id ::tcl::chan::puts @cmd -name "Built-in: tcl::chan::puts"\ -summary\ "Write to a channel."\ @@ -1057,7 +1406,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } lappend PUNKARGS [list { - @id -id ::tcl::chan::read + @id -id ::tcl::chan::read @cmd -name "Built-in: tcl::chan::read"\ -summary\ "Read from a channel."\ @@ -1121,7 +1470,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::seek + @id -id ::tcl::chan::seek @cmd -name "Built-in: tcl::chan::seek"\ -summary\ "Set channel access position as byte offset."\ @@ -1160,7 +1509,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl chan]" ] lappend PUNKARGS [list { - @id -id ::tcl::chan::tell + @id -id ::tcl::chan::tell @cmd -name "Built-in: tcl::chan::tell"\ -summary\ "Report channel access position as byte offset."\ @@ -1178,7 +1527,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { lappend PUNKARGS [list { - @id -id ::tcl::chan::truncate + @id -id ::tcl::chan::truncate @cmd -name "Built-in: tcl::chan::truncate"\ -summary\ "Truncate channel to specified length or current byte offset."\ @@ -1201,7 +1550,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- namespace eval argdoc { lappend PUNKARGS [list { - @id -id ::tcl::dict::append + @id -id ::tcl::dict::append @cmd -name "Built-in: tcl::dict::append" -help\ "This appends the given string (or strings) to the value that the given key maps to in the dictionary value contained in the given variable, @@ -1216,17 +1565,17 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl dict]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::create + @id -id ::tcl::dict::create @cmd -name "Built-in: tcl::dict::create" -help\ "Return a new dictionary that contains each of the key/value mappings listed as arguments (keys and values alternating, with each key being followed by its associated value)" - @values -min 2 -max -1 + @values -min 0 -max -1 "key value" -type {string string} -typesynopsis {${$I}key${$NI} ${$I}value${$NI}} -optional 1 -multiple 1 } "@doc -name Manpage: -url [manpage_tcl dict]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::exists + @id -id ::tcl::dict::exists @cmd -name "Built-in: tcl::dict::exists" -help\ "This returns a boolean value indicating whether the given key (or path of keys through a set of nested dictionaries) exists in the given dictionary @@ -1239,7 +1588,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::for + @id -id ::tcl::dict::for @cmd -name "Built-in: tcl::dict::for" -help\ "This command takes three arguments, the first a two-element list of variable names (for the key and value respectively of each mapping in @@ -1250,7 +1599,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { body generates a ${$B}TCL_BREAK${$N} result, no further pairs from the dictionary will be iterated over and the ${$B}dict for${$N} command will terminate successfully immediately. If any evaluation of the body generates - a ${$B}TCL_CONTINUE${$N} result, this shall be treated exactly like a + a ${$B}TCL_CONTINUE${$N} result, this shall be treated exactly like a normal ${$B}TCL_OK${$N} result. The order of iteration is the order in which the keys were inserted into the dictionary." @values -min 3 -max 3 @@ -1262,7 +1611,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::tcl::dict::get + @id -id ::tcl::dict::get @cmd -name "Built-in: tcl::dict::get" -help\ "Given a dictionary value (first argument) and a key (second argument), this will retrieve the value for that key. Where several keys are supplied, the @@ -1280,7 +1629,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { of elements in a manner similar to ${$B}array get${$N}. That is, the first element of each pair would be the key and the second element would be the value for that key. - It is an error to attempt to retrieve a value for a key that is not present in + It is an error to attempt to retrieve a value for a key that is not present in the dictionary. " @values -min 1 -max -1 @@ -1291,7 +1640,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::tcl::dict::getdef + @id -id ::tcl::dict::getdef @cmd -name "Built-in: tcl::dict::getdef" -help\ "This behaves the same as ${$B}dict get${$N} (with at least one ${$I}key${$NI} argument), returning the value that the key path maps to in the dictionary @@ -1316,7 +1665,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::incr + @id -id ::tcl::dict::incr @cmd -name "Built-in: tcl::dict::incr" -help\ "This adds the given ${$I}increment${$NI} value (an integer that defaults to 1 if not specified) to the value that the given key maps to in the dictionary @@ -1336,7 +1685,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::info + @id -id ::tcl::dict::info @cmd -name "Built-in: tcl::dict::info" -help\ "This returns information (intended for display to people) about the given dictionary though the format of this data is dependent on the @@ -1349,7 +1698,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::keys + @id -id ::tcl::dict::keys @cmd -name "Built-in: tcl::dict::keys" -help\ "Return a list of all keys in the given dictionary value. If a pattern is supplied, only those keys that match it (according to the rules of ${$B}string @@ -1362,7 +1711,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::lappend + @id -id ::tcl::dict::lappend @cmd -name "Built-in: tcl::dict::lappend" -help\ "This appends the given items to the list value that the given key maps to in the dictionary value contained in the given variable, writing the @@ -1383,7 +1732,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::map + @id -id ::tcl::dict::map @cmd -name "Built-in: tcl::dict::map" -help\ "This command applies a transformation to each element of a dictionary, returning a new dictionary. It takes three arguments: the first is a @@ -1413,7 +1762,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::merge + @id -id ::tcl::dict::merge @cmd -name "Built-in: tcl::dict::merge" -help\ "Return a dictionary that contains the contents of each of the ${$I}dictionaryValue${$NI} arguments. Where two (or more) dictionaries @@ -1426,7 +1775,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::remove + @id -id ::tcl::dict::remove @cmd -name "Built-in: tcl::dict::remove" -help\ "Return a new dictionary that is a copy of an old one passed in as first argument except without mappings for each of the keys listed. It is legal @@ -1439,7 +1788,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::replace + @id -id ::tcl::dict::replace @cmd -name "Built-in: tcl::dict::replace" -help\ "Return a new dictionary that is a copy of an old one passed in as first argument except with some values different or some extra key/value pairs @@ -1452,7 +1801,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::set + @id -id ::tcl::dict::set @cmd -name "Built-in: tcl::dict::set" -help\ "This operation takes the name of a variable containing a dictionary value and places an updated dictionary value in that variable containing a @@ -1470,7 +1819,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::size + @id -id ::tcl::dict::size @cmd -name "Built-in: tcl::dict::size" -help\ "Return the number of key/value mappings in the given dictionary value." @values -min 1 -max 1 @@ -1479,7 +1828,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::unset + @id -id ::tcl::dict::unset @cmd -name "Built-in: tcl::dict::unset" -help\ "This operation (the companion to ${$B}dict set${$NI}) takes the name of a variable containing a dictionary value and places an updated dictionary value in @@ -1498,7 +1847,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::update + @id -id ::tcl::dict::update @cmd -name "Built-in: tcl::dict::update" -help\ "Execute the Tcl script in ${$I}body${$NI} with the value for each ${$I}key${$NI} (as found by reading the dictionary value in ${$I}dictionaryVariable${$NI}) mapped to the variable @@ -1528,7 +1877,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl dict]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::dict::with + @id -id ::tcl::dict::with @cmd -name "Built-in: tcl::dict::with" -help\ "Execute the Tcl script in body with the value for each key in dictionaryVariable mapped (in a manner similarly to dict update) to a variable with the same name. Where one or more keys are available, @@ -1566,7 +1915,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- namespace eval argdoc { lappend PUNKARGS [list { - @id -id ::tcl::file::channels + @id -id ::tcl::file::channels @cmd -name "Built-in: tcl::file::channels" -help\ "If ${$I}pattern${$NI} is not specified, returns a list of names of all registered copen channels in this interpreter. If ${$I}pattern${$NI} is @@ -1578,7 +1927,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::delete + @id -id ::tcl::file::delete @cmd -name "Built-in: tcl::file::delete" -help\ "Removes the file or directory specified by each ${$I}pathname${$NI} argument. Non-empty directories will be removed only if the ${$B}-force${$N} option is @@ -1600,7 +1949,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::copy + @id -id ::tcl::file::copy @cmd -name "Built-in: tcl::file::copy" -help\ "The first form makes a copy of the file or directory ${$I}source${$NI} under the pathname ${$I}target${$NI}. If ${$I}target${$NI} is an existing directory then the second form is used. @@ -1634,7 +1983,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::executable + @id -id ::tcl::file::executable @cmd -name "Built-in: tcl::file::executable" -help\ "Returns ${$B}1${$N} if file ${$I}name${$NI} is executable by the current user, ${$B}0${$N} otherwise. On Windows, which does not have an executable attribute, the command treats @@ -1644,7 +1993,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::exists + @id -id ::tcl::file::exists @cmd -name "Built-in: tcl::file::exists" -help\ "Returns ${$B}1${$N} if the file ${$I}name${$NI} exists and the current user has search privileges for the directories leading to it, ${$B}0${$N} otherwise." @@ -1653,7 +2002,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::extension + @id -id ::tcl::file::extension @cmd -name "Built-in: tcl::file::extension" -help\ "Returns all of the characters in ${$I}name${$NI} after and including the last dot in the last element of name. If there is no dot in the last element of ${$I}name${$NI} then returns the @@ -1663,7 +2012,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::home + @id -id ::tcl::file::home @cmd -name "Built-in: tcl::file::home" -help\ "If no argument is specified, the command returns the home directory of the current user. This is generally the value of the ${$B}$HOME${$N} environment variable except that on Windows @@ -1678,7 +2027,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::isdirectory + @id -id ::tcl::file::isdirectory @cmd -name "Built-in: tcl::file::isdirectory" -help\ "Returns ${$B}1${$N} if the file name is a directory, ${$B}0${$N} otherwise." @values -min 1 -max 1 @@ -1686,7 +2035,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::isfile + @id -id ::tcl::file::isfile @cmd -name "Built-in: tcl::file::isfile" -help\ "Returns ${$B}1${$N} if the file name is a regular file, ${$B}0${$N} otherwise." @values -min 1 -max 1 @@ -1698,7 +2047,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #lstat lappend PUNKARGS [list { - @id -id ::tcl::file::mkdir + @id -id ::tcl::file::mkdir @cmd -name "Built-in: tcl::file::mkdir" -help\ "Creates each directory specified. For each pathname ${$I}dir${$NI} specified, this command will create all non-existing parent directories @@ -1711,7 +2060,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl file]" ] lappend PUNKARGS [list { - @id -id ::tcl::file::mtime + @id -id ::tcl::file::mtime @cmd -name "Built-in: tcl::file::mtime" -help\ "Returns a decimal string giving the time at which file ${$I}name${$NI} was last modified. If ${$I}time${$NI} is specified, it is a modification time to set for the file (equivalent @@ -1728,7 +2077,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #owned #pathtype lappend PUNKARGS [list { - @id -id ::tcl::file::readable + @id -id ::tcl::file::readable @cmd -name "Built-in: tcl::file::readable" -help\ "Returns ${$B}1${$N} if the file ${$I}name${$NI} is readable by the current user, ${$B}0${$N} otherwise." @values -min 1 -max 1 @@ -1749,7 +2098,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #type #volumes lappend PUNKARGS [list { - @id -id ::tcl::file::writable + @id -id ::tcl::file::writable @cmd -name "Built-in: tcl::file::writable" -help\ "Returns ${$B}1${$N} if the file ${$I}name${$NI} is writable by the current user, ${$B}0${$N} otherwise." @values -min 1 -max 1 @@ -1761,7 +2110,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::mathfunc::abs + @id -id ::tcl::mathfunc::abs @cmd -name "Built-in: tcl::mathfunc::abs" -help\ "Returns the absolute value of ${$I}arg${$NI}. ${$I}Arg${$NI} may be either integer or floating-point, and the result is returned in the same form." @@ -1771,7 +2120,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl mathfunc]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::mathfunc::acos + @id -id ::tcl::mathfunc::acos @cmd -name "Built-in: tcl::mathfunc::acos" -help\ "Returns the arc cosine of ${$I}arg${$NI}, in the range [0,pi] radians. ${$I}Arg${$NI} should be in the range [-1,1]." @@ -1783,7 +2132,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { #atan # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::tcl::mathfunc::atan2 + @id -id ::tcl::mathfunc::atan2 @cmd -name "Built-in: tcl::mathfunc::atan2" -help\ "Returns the arc tangent of ${$I}y/x${$NI}, in the range [-pi,pi] radians. ${$I}x${$NI} and ${$I}y${$NI} cannot both be 0. If ${$I}x${$NI} is greater @@ -1815,7 +2164,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl namespace]" ] lappend PUNKARGS [list { - @id -id ::tcl::namespace::origin + @id -id ::tcl::namespace::origin @cmd -name "Built-in: tcl::namespace::origin" -help\ "Returns the fully-qualified name of the original command to which the imported command command refers. When a command is imported into a @@ -1832,7 +2181,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl namespace]" ] lappend PUNKARGS [list { - @id -id ::tcl::namespace::path + @id -id ::tcl::namespace::path @cmd -name "Built-in: tcl::namespace::path" -help\ "Returns the command resolution path of the current namespace. If namespaceList is specified as a list of named namespaces, the current @@ -1845,7 +2194,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { "List of existing namespaces" } "@doc -name Manpage: -url [manpage_tcl namespace]" ] lappend PUNKARGS [list { - @id -id ::tcl::namespace::unknown + @id -id ::tcl::namespace::unknown @cmd -name "Built-in: tcl::namespace::unknown" -help\ "Sets or returns the unknown command handler for the current namespace. The handler is invoked when a command called from within the namespace cannot @@ -1860,7 +2209,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { "A well formed list representing a command name and optional arguments." } "@doc -name Manpage: -url [manpage_tcl namespace]" ] lappend PUNKARGS [list { - @id -id ::tcl::namespace::which + @id -id ::tcl::namespace::which @cmd -name "Built-in: tcl::namespace::which" -help\ "Looks up name as either a command or variable and returns its fully-qulified name. For example, if name does not exist in the current namespace but does exist in the @@ -1883,8 +2232,125 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl namespace]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + namespace eval argdoc { + #JJJ + #define tcl::prefix::* subcommand documentation first + lappend PUNKARGS [list { + @id -id ::tcl::prefix::all + @cmd -name "Built-in: tcl::prefix::all"\ + -summary\ + "List all in table that begin with ${$I}string${$NI}"\ + -help\ + "Returns a list of all elements in table that begin with the prefix string." + @values -min 2 -max 2 + table -type list + string -type string + } "@doc -name Manpage: -url [manpage_tcl prefix]" ] + + lappend PUNKARGS [list { + @id -id ::tcl::prefix::longest + @cmd -name "Built-in: tcl::prefix::longest"\ + -summary\ + "longest common prefix of table elements that begin with ${$I}string${$NI}"\ + -help\ + "Returns the longest common prefix of all elements in table that begin with the prefix ${$I}string${$NI}" + @values -min 2 -max 2 + table -type list + string -type string + } "@doc -name Manpage: -url [manpage_tcl prefix]" ] + + lappend PUNKARGS [list { + @id -id ::tcl::prefix::match + @cmd -name "Built-in: tcl::prefix::match"\ + -summary\ + "match one element in table to prefix ${$I}string${$NI}"\ + -help\ + "If string equals one element in table or is a prefix to exactly one element, the matched + element is returned. If not, the result depends on the -error option. (It is recommended + that the table be sorted before use with this subcommand, so that the list of matches + presented in the error message also becomes sorted, though this is not strictly necessary + for the operation of this subcommand itself.)" + @opts + -exact -type none -help\ + "Accept only exact matches" + -message -type string -default option -help\ + "Use ${$I}string${$NI} in the error message at a mismatch. Default is “option”." + -error -type list -typesynopsis ${$I}options${$NI} -help\ + "The options are used when no match is found. If options is empty, no error is + generated and an empty string is returned. Otherwise the options are used as + return options when generating the error message. The default corresponds to + setting “-level 0”. + Example: If “-error {-errorcode MyError -level 1}” is used, an error would be + generated as: + + return -errorcode MyError -level 1 -code error \"ambiguous option ...\"" + @values -min 2 -max 2 + table -type list + string -type string + } "@doc -name Manpage: -url [manpage_tcl prefix]" ] + + # --------------------------------------------------------------------------------------------------------------------------- + proc tclprefix_subcommands {} { + dict set groups "" {all longest match} + return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 1 tcl::prefix] + } + set DYN_TCLPREFIX_SUBCOMMANDS {${[punk::args::moduledoc::tclcore::argdoc::tclprefix_subcommands]}} + lappend PUNKARGS [list { + @dynamic + @id -id ::tcl::prefix + @cmd -name "Built-in: tcl::prefix"\ + -summary\ + "Facilities for prefix matching"\ + -help\ + "Facilities for prefix matching" + @leaders -min 1 -max 1 + ${$DYN_TCLPREFIX_SUBCOMMANDS} + @values -unnamed true + + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl prefix]" \ + {@examples -help { + Basic use: + ${[punk::args::moduledoc::tclcore::argdoc::example { + + namespace import ::tcl::prefix + prefix match {apa bepa cepa} apa + → apa + prefix match {apa bepa cepa} a + → apa + prefix match -exact {apa bepa cepa} a + → bad option "a": must be apa, bepa, or cepa + prefix match -message "switch" {apa ada bepa cepa} a + → ambiguous switch "a": must be apa, ada, bepa, or cepa + prefix longest {fblocked fconfigure fcopy file fileevent flush} fc + → fco + prefix all {fblocked fconfigure fcopy file fileevent flush} fc + → fconfigure fcopy + }]} + + Simplifying option matching: + ${[punk::args::moduledoc::tclcore::argdoc::example { + array set opts {-apa 1 -bepa "" -cepa 0} + foreach {arg val} $args { + set opts([prefix match {-apa -bepa -cepa} $arg]) $val + } + }]} + + Creating a switch that supports prefixes: + ${[punk::args::moduledoc::tclcore::argdoc::example { + switch [prefix match {apa bepa cepa} $arg] { + apa { } + bepa { } + cepa { } + } + }]} + } + }] + # --------------------------------------------------------------------------------------------------------------------------- + } + + # lappend PUNKARGS [list { - @id -id ::tcl::process::status + @id -id ::tcl::process::status @cmd -name "Built-in: tcl::process::status" -help\ "Returns a dictionary mapping subprocess PIDs to their respective status. If ${$I}pids${$NI} is specified as a list of PIDs then the command @@ -1922,7 +2388,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl namespace]" ] lappend PUNKARGS [list { - @id -id ::tcl::process::purge + @id -id ::tcl::process::purge @cmd -name "Built-in: tcl::process::purge" -help\ "Cleans up all data associated with terminated subprocesses. If pids is specified as a list of PIDs then the command only cleans up data for @@ -2017,7 +2483,6 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @dynamic @id -id ::append @cmd -name "Built-in: append"\ -summary\ @@ -2092,7 +2557,35 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { arg -type any -optional 1 -multiple 1 - } "@doc -name Manpage: -url [manpage_tcl append]" + } "@doc -name Manpage: -url [manpage_tcl append]"\ + {@examples -help { + This shows how to make a simple general command that applies a transformation to each element of a list. + ${[punk::args::moduledoc::tclcore::argdoc::example { + proc map {lambda list} { + set result {} + foreach item $list { + lappend result [apply $lambda $item] + } + return $result + } + map {x {return [string length $x]:$x}} {a bb ccc dddd} + → 1:a 2:bb 3:ccc 4:dddd + map {x {expr {$x**2 + 3*$x - 2}}} {-4 -3 -2 -1 0 1 2 3 4} + → 2 -2 -4 -4 -2 2 8 16 26 + }]} + + The apply command is also useful for defining callbacks for use in the trace command: + ${[punk::args::moduledoc::tclcore::argdoc::example { + set vbl "123abc" + trace add variable vbl write {apply {{v1 v2 op} { + upvar 1 $v1 v + puts "updated variable to \"$v\"" + }}} + set vbl 123 + set vbl abc + }]} + } + } # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- #categorise array subcommands based on currently known groupings. @@ -2100,7 +2593,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { proc array_subcommands {} { #dict set groups "" {bogus names} ;#test adding both existant and nonexistant to the default group dict set groups "search" {startsearch anymore nextelement donesearch} - return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 4 array] + return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 2 array] } lappend PUNKARGS [list { @dynamic @@ -2115,7 +2608,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { argument determines what action is carried out by the command." @leaders ${[punk::args::moduledoc::tclcore::argdoc::array_subcommands]} - + @values -unnamed true } "@doc -name Manpage: -url [manpage_tcl array]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -2501,7 +2994,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::eof + @id -id ::eof @cmd -name "Built-in: eof"\ -summary\ "Check for end of file condition on channel"\ @@ -2562,7 +3055,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl error]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::eval + @id -id ::eval @cmd -name "Built-in: eval"\ -summary\ "Evaluate a Tcl script."\ @@ -2628,7 +3121,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { }] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::exit + @id -id ::exit @cmd -name "Built-in: exit"\ -summary\ "End the application."\ @@ -3059,7 +3552,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::if + @id -id ::if @cmd -name "Built-in: if"\ -summary\ "Execute scripts conditionally."\ @@ -3093,7 +3586,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::incr + @id -id ::incr @cmd -name "Built-in: incr"\ -summary\ "Increment the value of a variable."\ @@ -3133,7 +3626,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl concat]" ] # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::lappend + @id -id ::lappend @cmd -name "Built-in: lappend"\ -summary\ "Append list elements onto a variable."\ @@ -3159,7 +3652,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- lappend PUNKARGS [list { - @id -id ::lassign + @id -id ::lassign @cmd -name "Built-in: lassign"\ -summary\ "Assign list elements to variables."\ @@ -3179,7 +3672,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::ledit + @id -id ::ledit @cmd -name "Built-in: ledit"\ -summary\ "Replace elements of a list stored in variable."\ @@ -3250,7 +3743,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lindex + @id -id ::lindex @cmd -name "Built-in: lindex"\ -summary\ "Retrieve an element from a list."\ @@ -3289,7 +3782,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::linsert + @id -id ::linsert @cmd -name "Built-in: linsert"\ -summary\ "Insert elements into a list."\ @@ -3318,7 +3811,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::list + @id -id ::list @cmd -name "Built-in: list"\ -summary\ "Create a list."\ @@ -3337,7 +3830,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::llength + @id -id ::llength @cmd -name "Built-in: llength"\ -summary\ "Count the number of elements in a list."\ @@ -3389,7 +3882,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lpop + @id -id ::lpop @cmd -name "Built-in: lpop"\ -summary\ "Get and remove an element in a list."\ @@ -3416,7 +3909,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lrange + @id -id ::lrange @cmd -name "Built-in: lrange"\ -summary\ "return one or more adjacent elements from a list."\ @@ -3438,7 +3931,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lrepeat + @id -id ::lrepeat @cmd -name "Built-in: lrepeat"\ -summary\ "Build a list by repeating elements."\ @@ -3455,7 +3948,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lreplace + @id -id ::lreplace @cmd -name "Built-in: lreplace"\ -summary\ "Replace elements in a list with new elements."\ @@ -3493,7 +3986,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lremove + @id -id ::lremove @cmd -name "Built-in: lremove"\ -summary\ "Remove elements from a list by index."\ @@ -3516,7 +4009,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lreverse + @id -id ::lreverse @cmd -name "Built-in: lreverse"\ -summary\ "Reverse the order of a list."\ @@ -3532,7 +4025,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lset + @id -id ::lset @cmd -name "Built-in: lset"\ -summary\ "Change an element in a list."\ @@ -3601,7 +4094,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lseq + @id -id ::lseq @cmd -name "Built-in: lseq"\ -summary\ "Build a numeric sequence returned as a list."\ @@ -3664,7 +4157,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lsearch + @id -id ::lsearch @cmd -name "Built-in: lsearch"\ -summary\ "See if a list contains a particular element."\ @@ -3770,7 +4263,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::lsort + @id -id ::lsort @cmd -name "Built-in: lsort"\ -summary\ "Sort the elements of a list."\ @@ -3885,12 +4378,363 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ############################################################################################################################################################ + namespace eval argdoc { + #PACKAGE + #JJJ + #define subcommand documentation first + # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + punk::args::define { + @id -id "(shared)::package" + @values + #used by 'package present' and 'package require' and (with override of -optional) 'package vsatisfies' + requirement -type packagerequirement -multiple 1 -optional 1 -help\ + "A requirement string checks, if a compatible version number of a package is present. Most commands + accept a list of requirement strings where the highest suitable version is matched. + + ${$I}min${$NI} + This form is called “min-bounded” + ${$I}min-${$NI} + This form is called “min-unbound” + ${$I}min-max${$NI} + This form is called “bounded” + + where “min” and “max” are valid version numbers. The legacy syntax is a special case of the extended + syntax, keeping backward compatibility. Regarding satisfaction the rules are: + + 1. The version has to pass at least one of the listed requirements to be satisfactory. + 2. A version satisfies a “bounded” requirement when + 1. For min equal to the max if, and only if the version is equal to the min + 2. Otherwise if, and only if the version is greater than or equal to the min, and less than the max, + where both min and max have been padded internally with “a0”. Note that while the comparison to + min is inclusive, the comparison to max is exclusive. + 3. A “min-bounded” requirement is a “bounded” requirement in disguise, with the max part implicitly + specified as the next higher major version number of the min part. A version satisfies it per the rules + above. + 4. A version satisfies a “min-unbound” requirement if, and only if it is greater than or equal to the min, + where the min has been padded internally with “a0”. There is no constraint to a maximum." + #used by 'package present' 'package require' etc - be careful to override -optional as needed + version -type packageversion -optional 0 -help\ + "Version numbers consist of one or more decimal numbers separated by dots, such as 2 or 1.162 or 3.1.13.1. + The first number is called the major version number. Larger numbers correspond to later versions of a package, with + leftmost numbers having greater significance. For example, version 2.1 is later than 1.3 and version 3.4.6 is later + than 3.3.5. Missing fields are equivalent to zeroes: version 1.3 is the same as version 1.3.0 and 1.3.0.0, so it is + earlier than 1.3.1 or 1.3.0.2. In addition, the letters “a” (alpha) and/or “b” (beta) may appear exactly once to + replace a dot for separation. These letters semantically add a negative specifier into the version, where “a” is -2, + and “b” is -1. Each may be specified only once, and “a” or “b” are mutually exclusive in a specifier. Thus 1.3a1 + becomes (semantically) 1.3.-2.1, 1.3b1 is 1.3.-1.1. Negative numbers are not directly allowed in version specifiers. + A version number not containing the letters “a” or “b” as specified above is called a stable version, whereas presence + of the letters causes the version to be called is unstable. A later version number is assumed to be upwards compatible + with an earlier version number as long as both versions have the same major version number. For example, Tcl scripts + written for version 2.3 of a package should work unchanged under versions 2.3.2, 2.4, and 2.5.1. Changes in the major + version number signify incompatible changes: if code is written to use version 2.1 of a package, it is not guaranteed + to work unmodified with either version 1.7.3 or version 3.1." + } + #for retrieval using: + #${[punk::args::resolved_def -form 1 -types values (shared)::package requirement]} + # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + + punk::args::define { + @id -id "::package files" + @cmd -name "Built-in: ::package files"\ + -summary\ + "List files forming part of package."\ + -help\ + "Lists all files forming part of package. Auto-loaded files are not included in this list, + only files which were directly sourced during package initialization. The list order + corresponds with the order in which the files were sourced." + @values -min 1 -max 1 + package -type string + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package forget" + @cmd -name "Built-in: ::package forget"\ + -summary\ + "Remove package info from the package database."\ + -help\ + "Removes all information about each specified package from this interpreter, + including information provided by both ${$B}package ifneeded${$N} and ${$B}package provide${$N}." + @values -min 0 -max -1 + package -type string -multiple 1 -optional 1 + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package ifneeded" + @cmd -name "Built-in: ::package ifneeded"\ + -summary\ + "Query/configure a package script."\ + -help\ + "This command typically appears only in system configuration scripts to set up the package database. + It indicates that a particular version of a particular package is available if needed, and that the + package can be added to the interpreter by executing script. The script is saved in a database for + use by subsequent package require commands; typically, script sets up auto-loading for the commands + in the package (or calls load and/or source directly), then invokes package provide to indicate that + the package is present. There may be information in the database for several different versions of a + single package. If the database already contains information for package and version, the new script + replaces the existing one. If the script argument is omitted, the current script for version version + of package package is returned, or an empty string if no package ifneeded command has been invoked + for this package and version." + @values -min 2 -max 3 + package -type string + ${[punk::args::resolved_def -types values (shared)::package version]} + script -type script -optional 1 + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package names" + @cmd -name "Built-in: ::package names"\ + -summary\ + "List package names (scanned so far)"\ + -help\ + "Returns a list of the names of all packages in the interpreter for which a version has been provided + (via package provide) or for which a package ifneeded script is available. The order of elements in + the list is arbitrary." + @values -min 0 -max 0 + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package present" + @cmd -name "Built-in: ::package present"\ + -summary\ + "Test package presence vs requirement(s)."\ + -help\ + "This command is equivalent to package require except that it does not try and load the package + if it is not already loaded." + + @form -form requirements + @opts + @values -min 1 -max -1 + package -type string + ${[punk::args::resolved_def -types values (shared)::package requirement]} + + @form -form exact + @opts + #-exact is not optional for this form + -exact -type none -optional 0 + @values -min 2 -max 2 + package -type string + ${[punk::args::resolved_def -types values (shared)::package version]} + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package provide" + @cmd -name "Built-in: ::package provide"\ + -summary\ + "Declare package provision with version or query if provided."\ + -help\ + "This command is invoked to indicate that version version of package package is now present in the interpreter. + It is typically invoked once as part of an ifneeded script, and again by the package itself when it is finally + loaded. An error occurs if a different version of package has been provided by a previous package provide + command. If the version argument is omitted, then the command returns the version number that is currently + provided, or an empty string if no package provide command has been invoked for package in this interpreter." + @values -min 1 -max 2 + package -type string + ${[punk::args::resolved_def -types values -override {version {-optional 1}} (shared)::package version]} + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package require" + @cmd -name "Built-in: ::package require"\ + -summary\ + "Source/load a package into the interp"\ + -help\ + "This command is typically invoked by Tcl code that wishes to use a particular version of a particular package. + The arguments indicate which package is wanted, and the command ensures that a suitable version of the package + is loaded into the interpreter. If the command succeeds, it returns the version number that is loaded; + otherwise it generates an error. + + A suitable version of the package is any version which satisfies at least one of the requirements as defined in + for the ${$I}requirment${$NI} argument below. If multiple versions are suitable the implementation with the highest version is + chosen. This last part is additionally influenced by the selection mode set with package prefer. + + In the “stable” selection mode the command will select the highest stable version satisfying the requirements, + if any. If no stable version satisfies the requirements, the highest unstable version satisfying the requirements + will be selected. In the “latest” selection mode the command will accept the highest version satisfying all the + requirements, regardless of its stableness. + + If a version of package has already been provided (by invoking the package provide command), then its version + number must satisfy the requirements and the command returns immediately. Otherwise, the command searches the + database of information provided by previous package ifneeded commands to see if an acceptable version of the + package is available. If so, the script for the highest acceptable version number is evaluated in the global + namespace; it must do whatever is necessary to load the package, including calling package provide for the + package. If the package ifneeded database does not contain an acceptable version of the package and a package + unknown command has been specified for the interpreter then that command is evaluated in the global namespace; + when it completes, Tcl checks again to see if the package is now provided or if there is a package ifneeded + script for it. If all of these steps fail to provide an acceptable version of the package, then the command + returns an error. + " + @form -form requirements + @opts + @values -min 1 -max -1 + package -type string + ${[punk::args::resolved_def -types values (shared)::package requirement]} + + @form -form exact + @opts + #-exact is not optional for this form + -exact -type none -optional 0 + @values -min 2 -max 2 + package -type string + ${[punk::args::resolved_def -types values -override {version {-optional 0}} (shared)::package version]} + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package unknown" + @cmd -name "Built-in: ::package unknown"\ + -summary\ + "Set/Query the package unknown handler function."\ + -help\ + "This command supplies a “last resort” command to invoke during ${$B}package require${$N} if no suitable version + of a package can be found in the ${$B}package ifneeded${$N} database. If the ${$I}command${$NI} argument is supplied, it + contains the first part of a command; when the command is invoked during a package require command, Tcl + appends one or more additional arguments giving the desired package name and requirements. For example, + if ${$I}command${$NI} is ${$B}foo bar${$N} and later the command ${$B}package require test 2.4${$N} is invoked, then Tcl will execute + the command ${$B}foo bar test 2.4${$N} to load the package. If no requirements are supplied to the ${$B}package require${$N} + command, then only the name will be added to invoked command. If the ${$B}package unknown${$N} command is invoked + without a ${$I}command${$NI} argument, then the current ${$B}package unknown${$N} script is returned, or an empty string if + there is none. If ${$I}command${$NI} is specified as an empty string, then the current ${$B}package unknown${$N} script is + removed, if there is one." + @values -min 0 -max 1 + command -type string -optional 1 + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + + punk::args::define { + @id -id "::package vcompare" + @cmd -name "Built-in: ::package vcompare"\ + -summary\ + "Compare two version numbers."\ + -help\ + "Compares the two version numbers given by version1 and version2. + Returns -1 if version1 is an earlier version than version2, 0 if + they are equal, and 1 if version1 is later than version2." + @values -min 2 -max 2 + ${[punk::args::resolved_def -types values -override {version {name version1 -optional 0}} (shared)::package version]} + #don't reuse def for version2 - we don't need to show the version help twice + version2 -type packageversion -optional 0 -help "(as above)" + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package versions" + @cmd -name "Built-in: ::package versions"\ + -summary\ + "List versions for package (if scanned)"\ + -help\ + "Returns a list of all the version numbers of package for which information + has been provided by ${$B}package ifneeded${$N} commands." + @values -min 1 -max 1 + package -type string + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + punk::args::define { + @id -id "::package vsatisfies" + @cmd -name "Built-in: ::package versions"\ + -summary\ + "List versions for package (if scanned)"\ + -help\ + "Returns a list of all the version numbers of package for which information + has been provided by ${$B}package ifneeded${$N} commands." + @values -min 2 -max -1 + ${[punk::args::resolved_def -types values -override {version {-optional 0}} (shared)::package version]} + ${[punk::args::resolved_def -types values -override {requirement {-optional 0}} (shared)::package requirement]} + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + + punk::args::define { + @id -id "::package prefer" + @cmd -name "Built-in: ::package prefer"\ + -summary\ + "Configure/query latest vs stable for package require."\ + -help\ + "With no arguments, the commands returns either “latest” or “stable”, whichever describes the current mode + of selection logic used by package require. + + When passed the argument “latest”, it sets the selection logic mode to “latest”. + + When passed the argument “stable”, if the mode is already “stable”, that value is kept. If the mode is already + “latest”, then the attempt to set it back to “stable” is ineffective and the mode value remains “latest”. + + When passed any other value as an argument, raise an invalid argument error. + + When an interpreter is created, its initial selection mode value is set to “stable” unless the environment + variable TCL_PKG_PREFER_LATEST is set (to any value) or the Tcl package itself is unstable. Otherwise the + initial (and permanent) selection mode value is set to “latest”." + @values -min 0 -max 1 + stability -type {literalprefix(latest)|literalprefix(stable)} -optional 1 + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]" + + # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + # ::package + # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + set PACKAGE_CHOICES [list files forget ifneeded names present provide require unknown vcompare versions vsatisfies prefer] + #manual synopses for subcommands not yet defined + set PACKAGE_CHOICELABELS [subst -novariables { + files "package files [punk::ansi::a+ italic]package[punk::ansi::a+ noitalic]" + names "package names" + }] + set PACKAGE_CHOICEINFO [dict create] + foreach sub $PACKAGE_CHOICES { + #default for all + dict set PACKAGE_CHOICEINFO $sub {{doctype native}} + } + foreach id [punk::args::get_ids "::package *"] { + if {[llength $id] == 2} { + lassign $id _ sub + dict set PACKAGE_CHOICEINFO $sub {{doctype native} {doctype punkargs}} + #override manual synopsis entry + #puts stderr "override manual synopsis entry with [punk::ns::synopsis "::package $sub"]" + dict set PACKAGE_CHOICELABELS $sub [punk::ansi::a+ normal][punk::ns::synopsis "::package $sub"] + } + } + + punk::args::define { + @id -id ::package + @cmd -name "Built-in: ::package"\ + -summary\ + "Facilities for package loading and version control."\ + -help\ + "This command keeps a simple database of the packages available for use by the current + interpreter and how to load them into the interpreter. It supports multiple versions of + each package and arranges for the correct version of a package to be loaded based on + what is needed by the application. This command also detects and reports version clashes. + Typically, only the package require and package provide commands are invoked in normal + Tcl scripts; the other commands are used primarily by system scripts that maintain the + package database." + @leaders -min 1 -max 1 + subcommand -type string\ + -choicecolumns 2\ + -choicegroups { + "" {files forget names present provide require vcompare versions vsatisfies} + configuration {prefer unknown ifneeded} + }\ + -choicelabels {${$PACKAGE_CHOICELABELS}}\ + -choiceinfo {${$PACKAGE_CHOICEINFO}} + @values -unnamed true + } "@doc -name Manpage: -url [punk::args::moduledoc::tclcore::manpage_tcl package]"\ + {@examples -help { + To state that a Tcl script requires the Tk and http packages, put this at the top of the script: + ${[punk::args::moduledoc::tclcore::argdoc::example { + package require Tk + package require http + }]} + To test to see if the Snack package is available and load if it is (often useful for optional + enhancements to programs where the loss of the functionality is not critical) do this: + ${[punk::args::moduledoc::tclcore::argdoc::example { + if {[catch {package require Snack}]} { + # Error thrown - package not found. + # Set up a dummy interface to work around the absence + } else { + # We have the package, configure the app to use it + } + }]} + }} + } # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::proc + @id -id ::proc @cmd -name "Built-in: proc"\ -summary\ "Create a Tcl procedure."\ @@ -3955,7 +4799,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::puts + @id -id ::puts @cmd -name "Built-in: puts"\ -summary\ "Write to a channel."\ @@ -3970,7 +4814,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl puts]" # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::pwd + @id -id ::pwd @cmd -name "Built-in: pwd"\ -summary\ "Return the absolute path of the current working directory."\ @@ -4012,7 +4856,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::read + @id -id ::read @cmd -name "Built-in: read"\ -summary\ "Read from a channel."\ @@ -4034,7 +4878,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::rename + @id -id ::rename @cmd -name "Built-in: rename"\ -summary\ "Rename or delete a command."\ @@ -4052,7 +4896,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::return + @id -id ::return @cmd -name "Built-in: return"\ -summary\ "Return from a procedure, or set return code of script."\ @@ -4234,7 +5078,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::set + @id -id ::set @cmd -name "Built-in: set"\ -summary\ "Read and write variables."\ @@ -4277,7 +5121,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::socket + @id -id ::socket @cmd -name "Built-in: socket"\ -summary\ "Open a TCP network connection."\ @@ -4466,7 +5310,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { }} # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::source + @id -id ::source @cmd -name "Built-in: source"\ -summary\ "Evaluate a file or resource as a Tcl script."\ @@ -4512,7 +5356,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::split + @id -id ::split @cmd -name "Built-in: split"\ -summary\ "Split a string into a proper Tcl list."\ @@ -4536,7 +5380,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- namespace eval argdoc { punk::args::define { - @id -id ::tcl::string::cat + @id -id ::tcl::string::cat @cmd -name "Built-in: tcl::string::cat"\ -summary\ @@ -4554,7 +5398,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::compare + @id -id ::tcl::string::compare @cmd -name "Built-in: tcl::string::compare" -help\ "Perform a character-by-character comparison of strings string1 and string2. @@ -4574,7 +5418,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::equal + @id -id ::tcl::string::equal @cmd -name "Built-in: tcl::string::equal"\ -summary\ @@ -4596,7 +5440,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::first + @id -id ::tcl::string::first @cmd -name "Built-in: tcl::string::first" -help\ "Search ${$I}haystackString${$NI} for a sequence of characters that exactly match the characters in ${$I}needleString${$NI}. If found, return the index of the first character in the first such @@ -4619,7 +5463,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::index + @id -id ::tcl::string::index @cmd -name "Built-in: tcl::string::index" -help\ "Returns the ${$I}charIndex${$NI}'th character of the ${$I}string${$NI} argument. A ${$I}charIndex${$NI} of 0 corresponds to the first character of the string. ${$I}charIndex${$NI} may be specified @@ -4630,7 +5474,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::insert + @id -id ::tcl::string::insert @cmd -name "Built-in: tcl::string::insert" -help\ "Returns a copy of string with insertString inserted at the index'th character. If index is start-relative, the first character inserted in the returned string will be @@ -4651,7 +5495,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { punk::args::define { - @id -id ::tcl::string::last + @id -id ::tcl::string::last @cmd -name "Built-in: tcl::string::last" -help\ "Search ${$I}haystackString${$NI} for a sequence of characters that exactly match the characters in ${$I}needleString${$NI}. If found, return the index of the first character in the last such @@ -4673,7 +5517,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::length + @id -id ::tcl::string::length @cmd -name "Built-in: tcl::string::length" -help\ "Returns a decimal string giving the number of characters in ${$I}string${$NI}. Note that this is not necessarily the same as the number of bytes used to store the string. If the value @@ -4684,7 +5528,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::map + @id -id ::tcl::string::map @cmd -name "Built-in: tcl::string::map" -help\ "Replaces substrings in string based on the key-value pairs in ${$I}mapping${$NI}. ${$I}mapping${$NI} is a list of key value key value ... as in the form returned by ${$B}array get${$N}. Each instance @@ -4711,7 +5555,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::match + @id -id ::tcl::string::match @cmd -name "Built-in: tcl::string::match" -help\ {See if pattern matches string; return 1 if it does, 0 if it does not. If -nocase is specified, then the pattern attempts to match against the string in a case insensitive @@ -4739,7 +5583,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::range + @id -id ::tcl::string::range @cmd -name "Built-in: tcl::string::range" -help\ "Returns a range of consecutive characters from ${$I}string${$NI}, starting with the character whose index is ${$I}first${$NI} and ending with the character whose index is ${$I}last${$NI} (using the forms described @@ -4755,7 +5599,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::repeat + @id -id ::tcl::string::repeat @cmd -name "Built-in: tcl::string::repeat"\ -summary\ "Build a string by repeating elements."\ @@ -4768,7 +5612,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::replace + @id -id ::tcl::string::replace @cmd -name "Built-in: tcl::string::replace" -help\ "Removes a range of consecutive characters from string, starting with the character whose index is first and ending with the character whose index is last @@ -4788,7 +5632,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::reverse + @id -id ::tcl::string::reverse @cmd -name "Built-in: tcl::string::reverse" -help\ "Returns a string that is the same length as ${$I}string${$NI} but with its characters in reverse order." @@ -4797,7 +5641,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::tolower + @id -id ::tcl::string::tolower @cmd -name "Built-in: tcl::string::tolower" -help\ "Returns a value equal to ${$I}string${$NI} except that all upper (or title) case case letters have been converted to lower case. @@ -4813,7 +5657,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::totitle + @id -id ::tcl::string::totitle @cmd -name "Built-in: tcl::string::totitle" -help\ "Returns a value equal to string except that the first character in string is converted to its Unicode title case variant (or upper case if there is no title case variant) and the @@ -4831,7 +5675,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::toupper + @id -id ::tcl::string::toupper @cmd -name "Built-in: tcl::string::toupper" -help\ "Returns a value equal to ${$I}string${$NI} except that all lower (or title) case case letters have been converted to upper case. @@ -4847,7 +5691,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::trim + @id -id ::tcl::string::trim @cmd -name "Built-in: tcl::string::trim" -help\ {Returns a value equal to ${$I}string${$NI} except that any leading or trailing characters present in the string given by ${$I}chars${$NI} are removed. if ${$I}chars${$NI} is not specified @@ -4857,7 +5701,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { chars -type string -optional 1 } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::trimleft + @id -id ::tcl::string::trimleft @cmd -name "Built-in: tcl::string::trimleft" -help\ {Returns a value equal to ${$I}string${$NI} except that any leading characters present in the string given by ${$I}chars${$NI} are removed. if ${$I}chars${$NI} is not specified @@ -4867,7 +5711,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { chars -type string -optional 1 } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::trimright + @id -id ::tcl::string::trimright @cmd -name "Built-in: tcl::string::trimright" -help\ {Returns a value equal to ${$I}string${$NI} except that any trailing characters present in the string given by ${$I}chars${$NI} are removed. if ${$I}chars${$NI} is not specified @@ -4879,7 +5723,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { punk::args::define { - @id -id ::tcl::string::wordend + @id -id ::tcl::string::wordend @cmd -name "Built-in: tcl::string::wordend" -help\ "Returns the index of the character just after the last one in the word containing character ${$I}charIndex${$NI} of ${$I}string${$NI}. @@ -4895,7 +5739,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl string]" punk::args::define { - @id -id ::tcl::string::wordstart + @id -id ::tcl::string::wordstart @cmd -name "Built-in: tcl::string::wordstart" -help\ "Returns the index of the first character in the word containing character ${$I}charIndex${$NI} of ${$I}string${$NI}. @@ -4913,7 +5757,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } punk::args::define [punk::args::lib::tstr -return string { - @id -id ::tcl::string::is + @id -id ::tcl::string::is @cmd -name "Built-in: tcl::string::is" -help\ "Returns 1 if string is a valid member of the specified character class, otherwise returns 0. " @@ -5075,7 +5919,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { set string_class_choicelabels [dict get [lrange [punk::args::resolved_def -types leaders ::tcl::string::is class] 1 end] -choicelabels] dict for {sclass slabel} $string_class_choicelabels { punk::args::define [string map [list %sc% $sclass %slabel% $slabel] { - @id -id "::tcl::string::is %sc%" + @id -id "::tcl::string::is %sc%" @cmd -name "Built-in: string is %sc%" -help\ {%slabel%} ${[punk::args::resolved_def -types opts ::tcl::string::is -*]} @@ -5086,7 +5930,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- namespace eval argdoc { punk::args::define { - @id -id ::subst + @id -id ::subst @cmd -name "Built-in: subst"\ -summary\ "Perform backslash, command, and variable substitutions."\ @@ -5139,7 +5983,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::switch + @id -id ::switch @cmd -name "Built-in: switch"\ -summary\ "Evaluate one of several scripts, depending on a given value."\ @@ -5225,7 +6069,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl switch]" # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::tailcall + @id -id ::tailcall @cmd -name "Built-in: tailcall"\ -summary\ "Replace the current procedure with another command."\ @@ -5246,7 +6090,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl tailcall]" # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::throw + @id -id ::throw @cmd -name "Built-in: throw"\ -summary\ "Generate a machine-readable error."\ @@ -5282,7 +6126,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::trace + @id -id ::trace @cmd -name "Built-in: trace"\ -summary\ "Monitor variable accesses, command usages and command executions."\ @@ -5300,12 +6144,12 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { add {{doctype punkargs} {subhelp ::trace add}} remove {{doctype punkargs} {subhelp ::trace remove}} } - @values -min 0 -max 0 + @values -unnamed true } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace add" + @id -id "::trace add" @cmd -name "Built-in: trace add"\ -summary\ "Add a command, execution or variable trace."\ @@ -5325,7 +6169,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace add command" + @id -id "::trace add command" @cmd -name "Built-in: trace add command"\ -summary\ "Add command trace for operation(s): rename delete"\ @@ -5374,7 +6218,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace add variable" + @id -id "::trace add variable" @cmd -name "Built-in: trace add variable"\ -summary\ "Add variable trace for operation(s): array read write unset."\ @@ -5488,7 +6332,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { punk::args::define { - @id -id "::trace add execution" + @id -id "::trace add execution" @cmd -name "Built-in: trace add execution"\ -summary\ "Add execution trace for operation(s): enter leave enterstep leavestep."\ @@ -5593,7 +6437,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace remove" + @id -id "::trace remove" @cmd -name "Built-in: trace remove"\ -summary\ "Remove a command, execution or variable trace."\ @@ -5612,7 +6456,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace remove command" + @id -id "::trace remove command" @cmd -name "Built-in: trace remove command" -help\ "If there is a trace set on command name with the operations and command given by opList and commandPrefix, then the trace is removed, so that @@ -5629,7 +6473,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace remove execution" + @id -id "::trace remove execution" @cmd -name "Built-in: trace remove execution" -help\ "If there is a trace set on command name with the operations and command given by opList and commandPrefix, then the trace is removed, so that @@ -5648,7 +6492,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { } "@doc -name Manpage: -url [manpage_tcl trace]" punk::args::define { - @id -id "::trace remove variable" + @id -id "::trace remove variable" @cmd -name "Built-in: trace remove variable" -help\ "If there is a trace set on command name with the operations and command given by opList and commandPrefix, then the trace is removed, so that @@ -5671,7 +6515,7 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { namespace eval argdoc { # -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- punk::args::define { - @id -id ::try + @id -id ::try @cmd -name "Built-in: try"\ -summary\ "Trap and process errors and exceptions"\ @@ -5735,7 +6579,6 @@ tcl::namespace::eval punk::args::moduledoc::tclcore { handler -optional 1 -multiple 1 -type {literal(on)|literal(trap) string list string}\ -typesynopsis {"" code|pattern variableList script} #todo? - #JJJJ #a way to define a compound type? #handler -optional 1 -multiple 1 -type {|} ## -type {literal(on)