Julian Noble
10 months ago
58 changed files with 5029 additions and 115 deletions
@ -0,0 +1,27 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin overtype_module_overtype 0 1.5.1] |
||||
[copyright "2024"] |
||||
[titledesc {overtype text layout - ansi aware}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {overtype text layout}] [comment {-- Description at end of page heading --}] |
||||
[require overtype] |
||||
[keywords module text ansi] |
||||
[description] |
||||
[para] - |
||||
[section Overview] |
||||
[para] overview of overtype |
||||
[subsection Concepts] |
||||
[para] - |
||||
[subsection dependencies] |
||||
[para] packages used by overtype |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[item] [package textutil] |
||||
[item] [package punk::ansi] |
||||
[para] - required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
[item] [package punk::char] |
||||
[para] - box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
[list_end] |
||||
[section API] |
||||
[manpage_end] |
@ -0,0 +1,27 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin overtype_module_overtype 0 1.5.2] |
||||
[copyright "2024"] |
||||
[titledesc {overtype text layout - ansi aware}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {overtype text layout}] [comment {-- Description at end of page heading --}] |
||||
[require overtype] |
||||
[keywords module text ansi] |
||||
[description] |
||||
[para] - |
||||
[section Overview] |
||||
[para] overview of overtype |
||||
[subsection Concepts] |
||||
[para] - |
||||
[subsection dependencies] |
||||
[para] packages used by overtype |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[item] [package textutil] |
||||
[item] [package punk::ansi] |
||||
[para] - required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
[item] [package punk::char] |
||||
[para] - box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
[list_end] |
||||
[section API] |
||||
[manpage_end] |
@ -0,0 +1,27 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin overtype_module_overtype 0 1.5.3] |
||||
[copyright "2024"] |
||||
[titledesc {overtype text layout - ansi aware}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {overtype text layout}] [comment {-- Description at end of page heading --}] |
||||
[require overtype] |
||||
[keywords module text ansi] |
||||
[description] |
||||
[para] - |
||||
[section Overview] |
||||
[para] overview of overtype |
||||
[subsection Concepts] |
||||
[para] - |
||||
[subsection dependencies] |
||||
[para] packages used by overtype |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[item] [package textutil] |
||||
[item] [package punk::ansi] |
||||
[para] - required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
[item] [package punk::char] |
||||
[para] - box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
[list_end] |
||||
[section API] |
||||
[manpage_end] |
@ -0,0 +1,127 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin punkshell_module_punk::ansi 0 0.1.0] |
||||
[copyright "2023"] |
||||
[titledesc {Ansi string functions}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {punk Ansi library}] [comment {-- Description at end of page heading --}] |
||||
[require punk::ansi] |
||||
[keywords module ansi terminal console string] |
||||
[description] |
||||
[para]Ansi based terminal control string functions |
||||
[para]See [package punk::ansi::console] for related functions for controlling a console |
||||
[section Overview] |
||||
[para] overview of punk::ansi |
||||
[para]punk::ansi functions return their values - no implicit emission to console/stdout |
||||
[subsection Concepts] |
||||
[para]Ansi codes can be used to control most terminals on most platforms in an 'almost' standard manner |
||||
[para]There are many differences in terminal implementations - but most should support a core set of features |
||||
[para]punk::ansi does not contain any code for direct terminal manipulation via the local system APIs. |
||||
[para]Sticking to ansi codes where possible may be better for cross-platform and remote operation where such APIs are unlikely to be useable. |
||||
[subsection dependencies] |
||||
[para] packages used by punk::ansi |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[list_end] |
||||
[section API] |
||||
[subsection {Namespace punk::ansi}] |
||||
[para] Core API functions for punk::ansi |
||||
[list_begin definitions] |
||||
[call [fun stripansi] [arg text] ] |
||||
[para]Return a string with ansi codes stripped out |
||||
[call [fun a?] [opt {ansicode...}]] |
||||
[para]Return an ansi string representing a table of codes and a panel showing the colours |
||||
[call [fun a+] [opt {ansicode...}]] |
||||
[para]Returns the ansi code to apply those from the supplied list - without any reset being performed first |
||||
[para] e.g to set foreground red and bold |
||||
[para]punk::ansi::a red bold |
||||
[para]to set background red |
||||
[para]punk::ansi::a Red |
||||
[para]see [cmd punk::ansi::a?] to display a list of codes |
||||
[call [fun a] [opt {ansicode...}]] |
||||
[para]Returns the ansi code to reset any current settings and apply those from the supplied list |
||||
[para] by calling punk::ansi::a with no arguments - the result is a reset to plain text |
||||
[para] e.g to set foreground red and bold |
||||
[para]punk::ansi::a red bold |
||||
[para]to set background red |
||||
[para]punk::ansi::a Red |
||||
[para]see [cmd punk::ansi::a?] to display a list of codes |
||||
[call [fun get_code_name] [arg code]] |
||||
[para]for example |
||||
[para] get_code_name red will return 31 |
||||
[para] get_code_name 31 will return red |
||||
[call [fun reset]] |
||||
[para]reset console |
||||
[call [fun reset_soft]] |
||||
[call [fun reset_colour]] |
||||
[para]reset colour only |
||||
[call [fun clear]] |
||||
[call [fun clear_above]] |
||||
[call [fun clear_below]] |
||||
[call [fun cursor_on]] |
||||
[call [fun cursor_off]] |
||||
[call [fun move] [arg row] [arg col]] |
||||
[para]Return an ansi sequence to move to row,col |
||||
[para]aka cursor home |
||||
[call [fun move_emit] [arg row] [arg col] [arg data] [opt {row col data...}]] |
||||
[para]Return an ansi string representing a move to row col with data appended |
||||
[para]row col data can be repeated any number of times to return a string representing the output of the data elements at all those points |
||||
[para]Compare to punk::console::move_emit which calls this function - but writes it to stdout |
||||
[para]punk::console::move_emit_return will also return the cursor to the original position |
||||
[para]There is no punk::ansi::move_emit_return because in a standard console there is no ansi string which can represent a jump back to starting position. |
||||
[para]There is an ansi code to write the current cursor position to stdin (which will generally display on the console) - this is not quite the same thing. |
||||
[para]punk::console::move_emit_return does it by emitting that code and starting a loop to read stdin |
||||
[para]punk::ansi could implement a move_emit_return using the punk::console mechanism - but the resulting string would capture the cursor position at the time the string is built - which is not necessarily when the string is used. |
||||
[para]The following example shows how to do this manually, emitting the string blah at screen position 10,10 and emitting DONE back at the line we started: |
||||
[para][example {punk::ansi::move_emit 10 10 blah {*}[punk::console::get_cursor_pos_list] DONE}] |
||||
[para]A string created by any move_emit_return for punk::ansi would not behave in an intuitive manner compared to other punk::ansi move functions - so is deliberately omitted. |
||||
[call [fun move_forward] [arg n]] |
||||
[call [fun move_back] [arg n]] |
||||
[call [fun move_up] [arg n]] |
||||
[call [fun move_down] [arg n]] |
||||
[call [fun erase_line]] |
||||
[call [fun erase_sol]] |
||||
[para]Erase to start of line, leaving cursor position alone. |
||||
[call [fun erase_eol]] |
||||
[call [fun cursor_pos]] |
||||
[para]cursor_pos unlikely to be useful on it's own like this as when written to the terminal, this sequence causes the terminal to emit the row;col sequence to stdin |
||||
[para]The output on screen will look something like ^[lb][lb]47;3R |
||||
[para]Use punk::console::get_cursor_pos or punk::console::get_cursor_pos_list instead. |
||||
[para]These functions will emit the code - but read it in from stdin so that it doesn't display, and then return the row and column as a colon-delimited string or list respectively. |
||||
[para]The punk::ansi::cursor_pos function is used by punk::console::get_cursor_pos and punk::console::get_cursor_pos_list |
||||
[call [fun titleset] [arg windowtitles]] |
||||
[para]Returns the code to set the title of the terminal window to windowtitle |
||||
[para]This may not work on terminals which have multiple panes/windows |
||||
[list_end] [comment {--- end definitions namespace punk::ansi ---}] |
||||
[subsection {Namespace punk::ansi::ta}] |
||||
[para] text ansi functions |
||||
[para] based on but not identical to the Perl Text Ansi module: |
||||
[para] https://github.com/perlancar/perl-Text-ANSI-Util/blob/master/lib/Text/ANSI/BaseUtil.pm |
||||
[list_begin definitions] |
||||
[call [fun detect] [arg text]] |
||||
[para]Return a boolean indicating whether Ansi codes were detected in text |
||||
[para] |
||||
[call [fun detect_csi] [arg text]] |
||||
[para]Return a boolean indicating whether an Ansi Control Sequence Introducer (CSI) was detected in text |
||||
[para]The csi is often represented in code as \x1b or \033 followed by a left bracket [lb] |
||||
[para]The initial byte or escape is commonly referenced as ESC in Ansi documentation |
||||
[para]There is also a multi-byte escape sequence \u009b |
||||
[para]This is less commonly used but is also detected here |
||||
[para](This function is not in perl ta) |
||||
[call [fun detect_sgr] [arg text]] |
||||
[para]Return a boolean indicating whether an ansi Select Graphics Rendition code was detected. |
||||
[para]This is the set of CSI sequences ending in 'm' |
||||
[para]This is most commonly an Ansi colour code - but also things such as underline and italics |
||||
[para]An SGR with empty or a single zero argument is a reset of the SGR features - this is also detected. |
||||
[para](This function is not in perl ta) |
||||
[call [fun strip] [arg text]] |
||||
[para]Return text stripped of Ansi codes |
||||
[para]This is a tailcall to punk::ansi::stripansi |
||||
[call [fun length] [arg text]] |
||||
[para]Return the character length after stripping ansi codes - not the printing length |
||||
[list_end] [comment {--- end definitions namespace punk::ansi::ta ---}] |
||||
[subsection {Namespace punk::ansi::ansistring}] |
||||
[para]punk::ansi::string ensemble |
||||
[list_begin definitions] |
||||
[list_end] [comment {--- end definitions namespace punk::ansi::ta ---}] |
||||
[manpage_end] |
@ -0,0 +1,87 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin punkshell_module_punk::args 0 0.1.0] |
||||
[copyright "2024"] |
||||
[titledesc {args parsing}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {args to option-value dict and values dict}] [comment {-- Description at end of page heading --}] |
||||
[require punk::args] |
||||
[keywords module proc args arguments parse] |
||||
[description] |
||||
[para]Utilities for parsing proc args |
||||
[section Overview] |
||||
[para] overview of punk::args |
||||
[subsection Concepts] |
||||
[para]There are 2 main conventions for parsing a proc args list |
||||
[list_begin enumerated] |
||||
[enum] |
||||
[para]leading option-value pairs followed by a list of values (Tk style) |
||||
[enum] |
||||
[para]leading list of values followed by option-value pairs (Tcl style) |
||||
[list_end] |
||||
[para]punk::args is focused on the 1st convention (Tk style): parsing of args in leading option-value pair style - even for non-Tk usage. |
||||
[para]The proc can still contain some leading required values e.g [example "proc dostuff {arg1 arg2 args} {...}}"] |
||||
[para]but having the core values elements at the end of args is more generally useful - especially in cases where the number of trailing values is unknown and/or the proc is to be called in a functional 'pipeline' style. |
||||
[para]The basic principle is that a call to punk::args::opts_vals is made near the beginning of the proc e.g |
||||
[example_begin] |
||||
proc dofilestuff {args} { |
||||
lassign [lb]dict values [lb]punk::args { |
||||
-directory -default "" |
||||
-translation -default binary |
||||
} $args[rb][rb] opts values |
||||
|
||||
puts "translation is [lb]dict get $opts -translation[rb]" |
||||
foreach f [lb]dict values $values[rb] { |
||||
puts "doing stuff with file: $f" |
||||
} |
||||
} |
||||
[example_end] |
||||
[subsection Notes] |
||||
[para]There are alternative args parsing packages such as: |
||||
[list_begin enumerated] |
||||
[enum]argp |
||||
[enum]The tcllib set of TEPAM modules |
||||
[para]TEPAM requires an alternative procedure declaration syntax instead of proc - but has support for Tk and documentation generation. |
||||
[list_end] |
||||
[para]punk::args was designed initially without specific reference to TEPAM - and to handle some edge cases in specific projects where TEPAM wasn't suitable. |
||||
[para]In subsequent revisions of punk::args - some features were made to operate in a way that is similar to TEPAM - to avoid gratuitous differences where possible, but of course there are differences |
||||
[para]and those used TEPAM or mixing TEPAM and punk::args should take care to assess the differences. |
||||
[para]TEPAM is a mature solution and is widely available as it is included in tcllib. |
||||
[para]Serious consideration should be given to using TEPAM if suitable for your project. |
||||
[subsection dependencies] |
||||
[para] packages used by punk::args |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[list_end] |
||||
[section API] |
||||
[subsection {Namespace punk::args::class}] |
||||
[para] class definitions |
||||
[list_begin enumerated] |
||||
[list_end] [comment {--- end class enumeration ---}] |
||||
[subsection {Namespace punk::args}] |
||||
[para] Core API functions for punk::args |
||||
[list_begin definitions] |
||||
[call [fun opts_values] [arg optionspecs] [arg rawargs] [opt {option value...}]] |
||||
[para]Parse rawargs as a sequence of zero or more option-value pairs followed by zero or more values |
||||
[para]Returns a dict of the form: opts <options_dict> values <values_dict> |
||||
[para]ARGUMENTS: |
||||
[list_begin arguments] |
||||
[arg_def multiline-string optionspecs] |
||||
[para] This a block of text with records delimited by newlines (lf or crlf) - but with multiline values allowed if properly quoted/braced |
||||
[para]'info complete' is used to determine if a record spans multiple lines due to multiline values |
||||
[para]Each optionspec line must be of the form: |
||||
[para]-optionname -key val -key2 val2... |
||||
[para]where the valid keys for each option specification are: -default -type -range -choices -optional |
||||
[arg_def list rawargs] |
||||
[para] This is a list of the arguments to parse. Usually it will be the \$args value from the containing proc |
||||
[list_end] |
||||
[para] |
||||
[list_end] [comment {--- end definitions namespace punk::args ---}] |
||||
[subsection {Namespace punk::args::lib}] |
||||
[para] Secondary functions that are part of the API |
||||
[list_begin definitions] |
||||
[list_end] [comment {--- end definitions namespace punk::args::lib ---}] |
||||
[section Internal] |
||||
[subsection {Namespace punk::args::system}] |
||||
[para] Internal functions that are not part of the API |
||||
[manpage_end] |
@ -0,0 +1,27 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin punkshell_module_punk::char 0 0.1.0] |
||||
[copyright "2024"] |
||||
[titledesc {character-set and unicode utilities}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {character-set nad unicode}] [comment {-- Description at end of page heading --}] |
||||
[require punk::char] |
||||
[keywords module encodings] |
||||
[description] |
||||
[section Overview] |
||||
[para] overview of punk::char |
||||
[subsection Concepts] |
||||
[para] - |
||||
[subsection dependencies] |
||||
[para] packages used by punk::char |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[item] [package {overtype}] |
||||
[para] - |
||||
[item] [package {textblock}] |
||||
[para] - |
||||
[item] [package console] |
||||
[para] - |
||||
[list_end] |
||||
[section API] |
||||
[manpage_end] |
@ -0,0 +1,55 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin punkshell_module_punk::encmime 0 0.1.0] |
||||
[copyright "2024"] |
||||
[titledesc {mime encodings related subset of tcllib mime}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {mime encoding names and aliases}] [comment {-- Description at end of page heading --}] |
||||
[require punk::encmime] |
||||
[keywords module encodings] |
||||
[description] |
||||
[para] This is a workaround package to provide the mime encoding names used in tcllib's mime package - without additional dependencies |
||||
[para]tcllib mime loads either Trf or tcl::memchan functions. punk::encmime needs to work in a context where tcllib may not yet be loaded/available, and even these few dependencies are too much. |
||||
[para]MAINTENANCE NOTE: The data in this module needs to be checked against the latest tcllib mime package |
||||
[para]taken from tcllib mime version: 1.7.2 in 2024 |
||||
[section Overview] |
||||
[para] overview of punk::encmime |
||||
[subsection Concepts] |
||||
[para] Where practical - the actual tcllib mime package should be used instead. |
||||
[para]This set of encoding related functions is a snapshot of the data from the mime package - and may not be up to date. |
||||
[para]This pseudo-package was created to minimize dependencies for punk::char and punk::overtype |
||||
[subsection dependencies] |
||||
[para] packages used by punk::encmime |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[list_end] |
||||
[section API] |
||||
[subsection {Namespace punk::encmime::class}] |
||||
[para] class definitions |
||||
[list_begin enumerated] |
||||
[list_end] [comment {--- end class enumeration ---}] |
||||
[subsection {Namespace punk::encmime}] |
||||
[para] Core API functions for punk::encmime |
||||
[list_begin definitions] |
||||
[call mapencoding [arg enc]] |
||||
[para]maps tcl encodings onto the proper names for their MIME charset type. |
||||
[para]This is only done for encodings whose charset types were known. |
||||
[para]The remaining encodings return {} for now. |
||||
[para]NOTE: consider using tcllib's mime::mapencoding instead if mime package available |
||||
[call reversemapencoding [arg mimeType]] |
||||
[para]mime::reversemapencodings maps MIME charset types onto tcl encoding names. |
||||
[para]Returns the tcl encoding name for the specified mime charset, or {} if none is known |
||||
[para] Arguments: |
||||
[list_begin arguments] |
||||
[arg_def string mimeType] The MIME charset to convert into a tcl encoding type. |
||||
[list_end] |
||||
[para]NOTE: consider using tcllib's mime::reversemapencoding instead if mime package available |
||||
[list_end] [comment {--- end definitions namespace punk::encmime ---}] |
||||
[subsection {Namespace punk::encmime::lib}] |
||||
[para] Secondary functions that are part of the API |
||||
[list_begin definitions] |
||||
[list_end] [comment {--- end definitions namespace punk::encmime::lib ---}] |
||||
[section Internal] |
||||
[subsection {Namespace punk::encmime::system}] |
||||
[para] Internal functions that are not part of the API |
||||
[manpage_end] |
@ -0,0 +1,125 @@
|
||||
[comment {--- punk::docgen generated from inline doctools comments ---}] |
||||
[comment {--- punk::docgen DO NOT EDIT DOCS HERE UNLESS YOU REMOVE THESE COMMENT LINES ---}] |
||||
[comment {--- punk::docgen overwrites this file ---}] |
||||
[manpage_begin punkshell_module_punk::lib 0 0.1.0] |
||||
[copyright "2024"] |
||||
[titledesc {punk general utility functions}] [comment {-- Name section and table of contents description --}] |
||||
[moddesc {punk library}] [comment {-- Description at end of page heading --}] |
||||
[require punk::lib] |
||||
[keywords module utility lib] |
||||
[description] |
||||
[para]This is a set of utility functions that are commonly used across punk modules or are just considered to be general-purpose functions. |
||||
[para]The base set includes string and math functions but has no specific theme |
||||
[section Overview] |
||||
[para] overview of punk::lib |
||||
[subsection Concepts] |
||||
[para]The punk::lib modules should have no strong dependencies other than Tcl |
||||
[para]Dependendencies that only affect display or additional functionality may be included - but should fail gracefully if not present, and only when a function is called that uses one of these soft dependencies. |
||||
[para]This requirement for no strong dependencies, means that many utility functions that might otherwise seem worthy of inclusion here are not present. |
||||
[subsection dependencies] |
||||
[para] packages used by punk::lib |
||||
[list_begin itemized] |
||||
[item] [package {Tcl 8.6}] |
||||
[list_end] |
||||
[section API] |
||||
[subsection {Namespace punk::lib::class}] |
||||
[para] class definitions |
||||
[list_begin enumerated] |
||||
[list_end] [comment {--- end class enumeration ---}] |
||||
[subsection {Namespace punk::lib}] |
||||
[para] Core API functions for punk::lib |
||||
[list_begin definitions] |
||||
[call [fun K] [arg x] [arg y]] |
||||
[para]The K-combinator function - returns the first argument, x and discards y |
||||
[para]see [uri https://wiki.tcl-lang.org/page/K] |
||||
[para]It is used in cases where command-substitution at the calling-point performs some desired effect. |
||||
[call [fun hex2dec] [opt {option value...}] [arg list_largeHex]] |
||||
[para]Convert a list of (possibly large) unprefixed hex strings to their decimal values |
||||
[para]hex2dec accepts and ignores internal underscores in the same manner as Tcl 8.7+ numbers e.g hex2dec FF_FF returns 65535 |
||||
[para]Leading and trailing underscores are ignored as a matter of implementation convenience - but this shouldn't be relied upon. |
||||
[para]Leading or trailing whitespace in each list member is allowed e.g hex2dec " F" returns 15 |
||||
[para]Internal whitespace e.g "F F" is not permitted - but a completely empty element "" is allowed and will return 0 |
||||
[call [fun dex2hex] [opt {option value...}] [arg list_decimals]] |
||||
[para]Convert a list of decimal integers to a list of hex values |
||||
[para] -width <int> can be used to make each hex value at least int characters wide, with leading zeroes. |
||||
[para] -case upper|lower determines the case of the hex letters in the output |
||||
[call [fun log2] [arg x]] |
||||
[para]log base2 of x |
||||
[para]This uses a 'live' proc body - the divisor for the change of base is computed once at definition time |
||||
[para](courtesy of RS [uri https://wiki.tcl-lang.org/page/Additional+math+functions]) |
||||
[call [fun logbase] [arg b] [arg x]] |
||||
[para]log base b of x |
||||
[para]This function uses expr's natural log and the change of base division. |
||||
[para]This means for example that we can get results like: logbase 10 1000 = 2.9999999999999996 |
||||
[para]Use expr's log10() function or tcl::mathfunc::log10 for base 10 |
||||
[call [fun factors] [arg x]] |
||||
[para]Return a sorted list of the positive factors of x where x > 0 |
||||
[para]For x = 0 we return only 0 and 1 as technically any number divides zero and there are an infinite number of factors. (including zero itself in this context)* |
||||
[para]This is a simple brute-force implementation that iterates all numbers below the square root of x to check the factors |
||||
[para]Because the implementation is so simple - the performance is very reasonable for numbers below at least a few 10's of millions |
||||
[para]See tcllib math::numtheory::factors for a more complex implementation - which seems to be slower for 'small' numbers |
||||
[para]Comparisons were done with some numbers below 17 digits long |
||||
[para]For seriously big numbers - this simple algorithm would no doubt be outperformed by more complex algorithms. |
||||
[para]The numtheory library stores some data about primes etc with each call - so may become faster when being used on more numbers |
||||
but has the disadvantage of being slower for 'small' numbers and using more memory. |
||||
[para]If the largest factor below x is needed - the greatestOddFactorBelow and GreatestFactorBelow functions are a faster way to get there than computing the whole list, even for small values of x |
||||
[para]* Taking x=0; Notion of x being divisible by integer y being: There exists an integer p such that x = py |
||||
[para] In other mathematical contexts zero may be considered not to divide anything. |
||||
[call [fun oddFactors] [arg x]] |
||||
[para]Return a list of odd integer factors of x, sorted in ascending order |
||||
[call [fun greatestFactorBelow] [arg x]] |
||||
[para]Return the largest factor of x excluding itself |
||||
[para]factor functions can be useful for console layout calculations |
||||
[para]See Tcllib math::numtheory for more extensive implementations |
||||
[call [fun greatestOddFactorBelow] [arg x]] |
||||
[para]Return the largest odd integer factor of x excluding x itself |
||||
[call [fun greatestOddFactor] [arg x]] |
||||
[para]Return the largest odd integer factor of x |
||||
[para]For an odd value of x - this will always return x |
||||
[call [fun gcd] [arg n] [arg m]] |
||||
[para]Return the greatest common divisor of m and n |
||||
[para]Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
[para]Graphical use: |
||||
[para]An a by b rectangle can be covered with square tiles of side-length c, |
||||
[para]only if c is a common divisor of a and b |
||||
[call [fun gcd] [arg n] [arg m]] |
||||
[para]Return the lowest common multiple of m and n |
||||
[para]Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
[para] |
||||
[call [fun commonDivisors] [arg x] [arg y]] |
||||
[para]Return a list of all the common factors of x and y |
||||
[para](equivalent to factors of their gcd) |
||||
[call [fun hasglobs] [arg str]] |
||||
[para]Return a boolean indicating whether str contains any of the glob characters: * ? [lb] [rb] |
||||
[para]hasglobs uses append to preserve Tcls internal representation for str - so it should help avoid shimmering in the few cases where this may matter. |
||||
[call [fun trimzero] [arg number]] |
||||
[para]Return number with left-hand-side zeros trimmed off - unless all zero |
||||
[para]If number is all zero - a single 0 is returned |
||||
[call [fun substring_count] [arg str] [arg substring]] |
||||
[para]Search str and return number of occurrences of substring |
||||
[call [fun dict_merge_ordered] [arg defaults] [arg main]] |
||||
[para]The standard dict merge accepts multiple dicts with values from dicts to the right (2nd argument) taking precedence. |
||||
[para]When merging with a dict of default values - this means that any default key/vals that weren't in the main dict appear in the output before the main data. |
||||
[para]This function merges the two dicts whilst maintaining the key order of main followed by defaults. |
||||
[call [fun askuser] [arg question]] |
||||
[para]A very basic utility to read an answer from stdin |
||||
[para]The prompt is written to the terminal and then it waits for a user to type something |
||||
[para]stdin is temporarily configured to blocking and then put back in its original state in case it wasn't already so. |
||||
[para]The user must hit enter to submit the response |
||||
[para]The return value is the string if any that was typed prior to hitting enter. |
||||
[para]The question argument can be manually colourised using the various punk::ansi funcitons |
||||
[example_begin] |
||||
set answer [lb]punk::lib::askuser "[lb]a+ green bold[rb]Do you want to proceed? (Y|N)[lb]a[rb]"[rb] |
||||
if {[lb]string match y* [lb]string tolower $answer[rb][rb]} { |
||||
puts "Proceeding" |
||||
} else { |
||||
puts "Cancelled by user" |
||||
} |
||||
[example_end] |
||||
[list_end] [comment {--- end definitions namespace punk::lib ---}] |
||||
[section Internal] |
||||
[subsection {Namespace punk::lib::system}] |
||||
[para] Internal functions that are not part of the API |
||||
[list_begin definitions] |
||||
[list_end] [comment {--- end definitions namespace punk::lib::system ---}] |
||||
[manpage_end] |
@ -0,0 +1,312 @@
|
||||
'\" |
||||
'\" Generated from file '_module_overtype-1\&.5\&.1\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "overtype_module_overtype" 0 1\&.5\&.1 doc "overtype text layout" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
overtype_module_overtype \- overtype text layout - ansi aware |
||||
.SH SYNOPSIS |
||||
package require \fBovertype \fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.PP |
||||
- |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of overtype |
||||
.SS CONCEPTS |
||||
.PP |
||||
- |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by overtype |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.IP \(bu |
||||
\fBtextutil\fR |
||||
.IP \(bu |
||||
\fBpunk::ansi\fR |
||||
.sp |
||||
- required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
.IP \(bu |
||||
\fBpunk::char\fR |
||||
.sp |
||||
- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
.PP |
||||
.SH API |
||||
.SH KEYWORDS |
||||
ansi, module, text |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -0,0 +1,312 @@
|
||||
'\" |
||||
'\" Generated from file '_module_overtype-1\&.5\&.2\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "overtype_module_overtype" 0 1\&.5\&.2 doc "overtype text layout" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
overtype_module_overtype \- overtype text layout - ansi aware |
||||
.SH SYNOPSIS |
||||
package require \fBovertype \fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.PP |
||||
- |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of overtype |
||||
.SS CONCEPTS |
||||
.PP |
||||
- |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by overtype |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.IP \(bu |
||||
\fBtextutil\fR |
||||
.IP \(bu |
||||
\fBpunk::ansi\fR |
||||
.sp |
||||
- required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
.IP \(bu |
||||
\fBpunk::char\fR |
||||
.sp |
||||
- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
.PP |
||||
.SH API |
||||
.SH KEYWORDS |
||||
ansi, module, text |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -0,0 +1,312 @@
|
||||
'\" |
||||
'\" Generated from file '_module_overtype-1\&.5\&.3\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "overtype_module_overtype" 0 1\&.5\&.3 doc "overtype text layout" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
overtype_module_overtype \- overtype text layout - ansi aware |
||||
.SH SYNOPSIS |
||||
package require \fBovertype \fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.PP |
||||
- |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of overtype |
||||
.SS CONCEPTS |
||||
.PP |
||||
- |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by overtype |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.IP \(bu |
||||
\fBtextutil\fR |
||||
.IP \(bu |
||||
\fBpunk::ansi\fR |
||||
.sp |
||||
- required to detect, split, strip and calculate lengths of text possibly containing ansi codes |
||||
.IP \(bu |
||||
\fBpunk::char\fR |
||||
.sp |
||||
- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars |
||||
.PP |
||||
.SH API |
||||
.SH KEYWORDS |
||||
ansi, module, text |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -0,0 +1,312 @@
|
||||
'\" |
||||
'\" Generated from file '_module_char-0\&.1\&.0\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "punkshell_module_punk::char" 0 0\&.1\&.0 doc "character-set nad unicode" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
punkshell_module_punk::char \- character-set and unicode utilities |
||||
.SH SYNOPSIS |
||||
package require \fBpunk::char \fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of punk::char |
||||
.SS CONCEPTS |
||||
.PP |
||||
- |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by punk::char |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.IP \(bu |
||||
\fBovertype\fR |
||||
.sp |
||||
- |
||||
.IP \(bu |
||||
\fBtextblock\fR |
||||
.sp |
||||
- |
||||
.IP \(bu |
||||
\fBconsole\fR |
||||
.sp |
||||
- |
||||
.PP |
||||
.SH API |
||||
.SH KEYWORDS |
||||
encodings, module |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -0,0 +1,357 @@
|
||||
'\" |
||||
'\" Generated from file '_module_encmime-0\&.1\&.0\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "punkshell_module_punk::encmime" 0 0\&.1\&.0 doc "mime encoding names and aliases" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
punkshell_module_punk::encmime \- mime encodings related subset of tcllib mime |
||||
.SH SYNOPSIS |
||||
package require \fBpunk::encmime \fR |
||||
.sp |
||||
mapencoding \fIenc\fR |
||||
.sp |
||||
reversemapencoding \fImimeType\fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.PP |
||||
This is a workaround package to provide the mime encoding names used in tcllib's mime package - without additional dependencies |
||||
.PP |
||||
tcllib mime loads either Trf or tcl::memchan functions\&. punk::encmime needs to work in a context where tcllib may not yet be loaded/available, and even these few dependencies are too much\&. |
||||
.PP |
||||
MAINTENANCE NOTE: The data in this module needs to be checked against the latest tcllib mime package |
||||
.PP |
||||
taken from tcllib mime version: 1\&.7\&.2 in 2024 |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of punk::encmime |
||||
.SS CONCEPTS |
||||
.PP |
||||
Where practical - the actual tcllib mime package should be used instead\&. |
||||
.PP |
||||
This set of encoding related functions is a snapshot of the data from the mime package - and may not be up to date\&. |
||||
.PP |
||||
This pseudo-package was created to minimize dependencies for punk::char and punk::overtype |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by punk::encmime |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.PP |
||||
.SH API |
||||
.SS "NAMESPACE PUNK::ENCMIME::CLASS" |
||||
.PP |
||||
class definitions |
||||
.PP |
||||
.SS "NAMESPACE PUNK::ENCMIME" |
||||
.PP |
||||
Core API functions for punk::encmime |
||||
.TP |
||||
mapencoding \fIenc\fR |
||||
.sp |
||||
maps tcl encodings onto the proper names for their MIME charset type\&. |
||||
.sp |
||||
This is only done for encodings whose charset types were known\&. |
||||
.sp |
||||
The remaining encodings return {} for now\&. |
||||
.sp |
||||
NOTE: consider using tcllib's mime::mapencoding instead if mime package available |
||||
.TP |
||||
reversemapencoding \fImimeType\fR |
||||
.sp |
||||
mime::reversemapencodings maps MIME charset types onto tcl encoding names\&. |
||||
.sp |
||||
Returns the tcl encoding name for the specified mime charset, or {} if none is known |
||||
.sp |
||||
Arguments: |
||||
.RS |
||||
.TP |
||||
string \fImimeType\fR |
||||
The MIME charset to convert into a tcl encoding type\&. |
||||
.RE |
||||
.sp |
||||
NOTE: consider using tcllib's mime::reversemapencoding instead if mime package available |
||||
.PP |
||||
.SS "NAMESPACE PUNK::ENCMIME::LIB" |
||||
.PP |
||||
Secondary functions that are part of the API |
||||
.PP |
||||
.SH INTERNAL |
||||
.SS "NAMESPACE PUNK::ENCMIME::SYSTEM" |
||||
.PP |
||||
Internal functions that are not part of the API |
||||
.SH KEYWORDS |
||||
encodings, module |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -0,0 +1,524 @@
|
||||
'\" |
||||
'\" Generated from file '_module_lib-0\&.1\&.0\&.tm\&.man' by tcllib/doctools with format 'nroff' |
||||
'\" Copyright (c) 2024 |
||||
'\" |
||||
.TH "punkshell_module_punk::lib" 0 0\&.1\&.0 doc "punk library" |
||||
.\" The -*- nroff -*- definitions below are for supplemental macros used |
||||
.\" in Tcl/Tk manual entries. |
||||
.\" |
||||
.\" .AP type name in/out ?indent? |
||||
.\" Start paragraph describing an argument to a library procedure. |
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out", |
||||
.\" or "in/out" to describe whether procedure reads or modifies arg, |
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be |
||||
.\" needed; use .AS below instead) |
||||
.\" |
||||
.\" .AS ?type? ?name? |
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and |
||||
.\" name are examples of largest possible arguments that will be passed |
||||
.\" to .AP later. If args are omitted, default tab stops are used. |
||||
.\" |
||||
.\" .BS |
||||
.\" Start box enclosure. From here until next .BE, everything will be |
||||
.\" enclosed in one large box. |
||||
.\" |
||||
.\" .BE |
||||
.\" End of box enclosure. |
||||
.\" |
||||
.\" .CS |
||||
.\" Begin code excerpt. |
||||
.\" |
||||
.\" .CE |
||||
.\" End code excerpt. |
||||
.\" |
||||
.\" .VS ?version? ?br? |
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts |
||||
.\" of man pages. The first argument is ignored and used for recording |
||||
.\" the version when the .VS was added, so that the sidebars can be |
||||
.\" found and removed when they reach a certain age. If another argument |
||||
.\" is present, then a line break is forced before starting the sidebar. |
||||
.\" |
||||
.\" .VE |
||||
.\" End of vertical sidebar. |
||||
.\" |
||||
.\" .DS |
||||
.\" Begin an indented unfilled display. |
||||
.\" |
||||
.\" .DE |
||||
.\" End of indented unfilled display. |
||||
.\" |
||||
.\" .SO ?manpage? |
||||
.\" Start of list of standard options for a Tk widget. The manpage |
||||
.\" argument defines where to look up the standard options; if |
||||
.\" omitted, defaults to "options". The options follow on successive |
||||
.\" lines, in three columns separated by tabs. |
||||
.\" |
||||
.\" .SE |
||||
.\" End of list of standard options for a Tk widget. |
||||
.\" |
||||
.\" .OP cmdName dbName dbClass |
||||
.\" Start of description of a specific option. cmdName gives the |
||||
.\" option's name as specified in the class command, dbName gives |
||||
.\" the option's name in the option database, and dbClass gives |
||||
.\" the option's class in the option database. |
||||
.\" |
||||
.\" .UL arg1 arg2 |
||||
.\" Print arg1 underlined, then print arg2 normally. |
||||
.\" |
||||
.\" .QW arg1 ?arg2? |
||||
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). |
||||
.\" |
||||
.\" .PQ arg1 ?arg2? |
||||
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally |
||||
.\" (for trailing punctuation) and then a closing parenthesis. |
||||
.\" |
||||
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
||||
.if t .wh -1.3i ^B |
||||
.nr ^l \n(.l |
||||
.ad b |
||||
.\" # Start an argument description |
||||
.de AP |
||||
.ie !"\\$4"" .TP \\$4 |
||||
.el \{\ |
||||
. ie !"\\$2"" .TP \\n()Cu |
||||
. el .TP 15 |
||||
.\} |
||||
.ta \\n()Au \\n()Bu |
||||
.ie !"\\$3"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP (\\$3) |
||||
.\".b |
||||
.\} |
||||
.el \{\ |
||||
.br |
||||
.ie !"\\$2"" \{\ |
||||
\&\\$1 \\fI\\$2\\fP |
||||
.\} |
||||
.el \{\ |
||||
\&\\fI\\$1\\fP |
||||
.\} |
||||
.\} |
||||
.. |
||||
.\" # define tabbing values for .AP |
||||
.de AS |
||||
.nr )A 10n |
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n |
||||
.nr )B \\n()Au+15n |
||||
.\" |
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n |
||||
.. |
||||
.AS Tcl_Interp Tcl_CreateInterp in/out |
||||
.\" # BS - start boxed text |
||||
.\" # ^y = starting y location |
||||
.\" # ^b = 1 |
||||
.de BS |
||||
.br |
||||
.mk ^y |
||||
.nr ^b 1u |
||||
.if n .nf |
||||
.if n .ti 0 |
||||
.if n \l'\\n(.lu\(ul' |
||||
.if n .fi |
||||
.. |
||||
.\" # BE - end boxed text (draw box now) |
||||
.de BE |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
.ie n \l'\\n(^lu\(ul' |
||||
.el \{\ |
||||
.\" Draw four-sided box normally, but don't draw top of |
||||
.\" box if the box started on an earlier page. |
||||
.ie !\\n(^b-1 \{\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.el \}\ |
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
||||
.\} |
||||
.\} |
||||
.fi |
||||
.br |
||||
.nr ^b 0 |
||||
.. |
||||
.\" # VS - start vertical sidebar |
||||
.\" # ^Y = starting y location |
||||
.\" # ^v = 1 (for troff; for nroff this doesn't matter) |
||||
.de VS |
||||
.if !"\\$2"" .br |
||||
.mk ^Y |
||||
.ie n 'mc \s12\(br\s0 |
||||
.el .nr ^v 1u |
||||
.. |
||||
.\" # VE - end of vertical sidebar |
||||
.de VE |
||||
.ie n 'mc |
||||
.el \{\ |
||||
.ev 2 |
||||
.nf |
||||
.ti 0 |
||||
.mk ^t |
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
||||
.sp -1 |
||||
.fi |
||||
.ev |
||||
.\} |
||||
.nr ^v 0 |
||||
.. |
||||
.\" # Special macro to handle page bottom: finish off current |
||||
.\" # box/sidebar if in box/sidebar mode, then invoked standard |
||||
.\" # page bottom macro. |
||||
.de ^B |
||||
.ev 2 |
||||
'ti 0 |
||||
'nf |
||||
.mk ^t |
||||
.if \\n(^b \{\ |
||||
.\" Draw three-sided box if this is the box's first page, |
||||
.\" draw two sides but no top otherwise. |
||||
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.nr ^x \\n(^tu+1v-\\n(^Yu |
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
||||
.\} |
||||
.bp |
||||
'fi |
||||
.ev |
||||
.if \\n(^b \{\ |
||||
.mk ^y |
||||
.nr ^b 2 |
||||
.\} |
||||
.if \\n(^v \{\ |
||||
.mk ^Y |
||||
.\} |
||||
.. |
||||
.\" # DS - begin display |
||||
.de DS |
||||
.RS |
||||
.nf |
||||
.sp |
||||
.. |
||||
.\" # DE - end display |
||||
.de DE |
||||
.fi |
||||
.RE |
||||
.sp |
||||
.. |
||||
.\" # SO - start of list of standard options |
||||
.de SO |
||||
'ie '\\$1'' .ds So \\fBoptions\\fR |
||||
'el .ds So \\fB\\$1\\fR |
||||
.SH "STANDARD OPTIONS" |
||||
.LP |
||||
.nf |
||||
.ta 5.5c 11c |
||||
.ft B |
||||
.. |
||||
.\" # SE - end of list of standard options |
||||
.de SE |
||||
.fi |
||||
.ft R |
||||
.LP |
||||
See the \\*(So manual entry for details on the standard options. |
||||
.. |
||||
.\" # OP - start of full description for a single option |
||||
.de OP |
||||
.LP |
||||
.nf |
||||
.ta 4c |
||||
Command-Line Name: \\fB\\$1\\fR |
||||
Database Name: \\fB\\$2\\fR |
||||
Database Class: \\fB\\$3\\fR |
||||
.fi |
||||
.IP |
||||
.. |
||||
.\" # CS - begin code excerpt |
||||
.de CS |
||||
.RS |
||||
.nf |
||||
.ta .25i .5i .75i 1i |
||||
.. |
||||
.\" # CE - end code excerpt |
||||
.de CE |
||||
.fi |
||||
.RE |
||||
.. |
||||
.\" # UL - underline word |
||||
.de UL |
||||
\\$1\l'|0\(ul'\\$2 |
||||
.. |
||||
.\" # QW - apply quotation marks to word |
||||
.de QW |
||||
.ie '\\*(lq'"' ``\\$1''\\$2 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\$2 |
||||
.. |
||||
.\" # PQ - apply parens and quotation marks to word |
||||
.de PQ |
||||
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el (\\*(lq\\$1\\*(rq\\$2)\\$3 |
||||
.. |
||||
.\" # QR - quoted range |
||||
.de QR |
||||
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 |
||||
.\"" fix emacs highlighting |
||||
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 |
||||
.. |
||||
.\" # MT - "empty" string |
||||
.de MT |
||||
.QW "" |
||||
.. |
||||
.BS |
||||
.SH NAME |
||||
punkshell_module_punk::lib \- punk general utility functions |
||||
.SH SYNOPSIS |
||||
package require \fBpunk::lib \fR |
||||
.sp |
||||
\fBK\fR \fIx\fR \fIy\fR |
||||
.sp |
||||
\fBhex2dec\fR ?option value\&.\&.\&.? \fIlist_largeHex\fR |
||||
.sp |
||||
\fBdex2hex\fR ?option value\&.\&.\&.? \fIlist_decimals\fR |
||||
.sp |
||||
\fBlog2\fR \fIx\fR |
||||
.sp |
||||
\fBlogbase\fR \fIb\fR \fIx\fR |
||||
.sp |
||||
\fBfactors\fR \fIx\fR |
||||
.sp |
||||
\fBoddFactors\fR \fIx\fR |
||||
.sp |
||||
\fBgreatestFactorBelow\fR \fIx\fR |
||||
.sp |
||||
\fBgreatestOddFactorBelow\fR \fIx\fR |
||||
.sp |
||||
\fBgreatestOddFactor\fR \fIx\fR |
||||
.sp |
||||
\fBgcd\fR \fIn\fR \fIm\fR |
||||
.sp |
||||
\fBgcd\fR \fIn\fR \fIm\fR |
||||
.sp |
||||
\fBcommonDivisors\fR \fIx\fR \fIy\fR |
||||
.sp |
||||
\fBhasglobs\fR \fIstr\fR |
||||
.sp |
||||
\fBtrimzero\fR \fInumber\fR |
||||
.sp |
||||
\fBsubstring_count\fR \fIstr\fR \fIsubstring\fR |
||||
.sp |
||||
\fBdict_merge_ordered\fR \fIdefaults\fR \fImain\fR |
||||
.sp |
||||
\fBaskuser\fR \fIquestion\fR |
||||
.sp |
||||
.BE |
||||
.SH DESCRIPTION |
||||
.PP |
||||
This is a set of utility functions that are commonly used across punk modules or are just considered to be general-purpose functions\&. |
||||
.PP |
||||
The base set includes string and math functions but has no specific theme |
||||
.SH OVERVIEW |
||||
.PP |
||||
overview of punk::lib |
||||
.SS CONCEPTS |
||||
.PP |
||||
The punk::lib modules should have no strong dependencies other than Tcl |
||||
.PP |
||||
Dependendencies that only affect display or additional functionality may be included - but should fail gracefully if not present, and only when a function is called that uses one of these soft dependencies\&. |
||||
.PP |
||||
This requirement for no strong dependencies, means that many utility functions that might otherwise seem worthy of inclusion here are not present\&. |
||||
.SS DEPENDENCIES |
||||
.PP |
||||
packages used by punk::lib |
||||
.IP \(bu |
||||
\fBTcl 8\&.6\fR |
||||
.PP |
||||
.SH API |
||||
.SS "NAMESPACE PUNK::LIB::CLASS" |
||||
.PP |
||||
class definitions |
||||
.PP |
||||
.SS "NAMESPACE PUNK::LIB" |
||||
.PP |
||||
Core API functions for punk::lib |
||||
.TP |
||||
\fBK\fR \fIx\fR \fIy\fR |
||||
.sp |
||||
The K-combinator function - returns the first argument, x and discards y |
||||
.sp |
||||
see \fIhttps://wiki\&.tcl-lang\&.org/page/K\fR |
||||
.sp |
||||
It is used in cases where command-substitution at the calling-point performs some desired effect\&. |
||||
.TP |
||||
\fBhex2dec\fR ?option value\&.\&.\&.? \fIlist_largeHex\fR |
||||
.sp |
||||
Convert a list of (possibly large) unprefixed hex strings to their decimal values |
||||
.sp |
||||
hex2dec accepts and ignores internal underscores in the same manner as Tcl 8\&.7+ numbers e\&.g hex2dec FF_FF returns 65535 |
||||
.sp |
||||
Leading and trailing underscores are ignored as a matter of implementation convenience - but this shouldn't be relied upon\&. |
||||
.sp |
||||
Leading or trailing whitespace in each list member is allowed e\&.g hex2dec " F" returns 15 |
||||
.sp |
||||
Internal whitespace e\&.g "F F" is not permitted - but a completely empty element "" is allowed and will return 0 |
||||
.TP |
||||
\fBdex2hex\fR ?option value\&.\&.\&.? \fIlist_decimals\fR |
||||
.sp |
||||
Convert a list of decimal integers to a list of hex values |
||||
.sp |
||||
-width <int> can be used to make each hex value at least int characters wide, with leading zeroes\&. |
||||
.sp |
||||
-case upper|lower determines the case of the hex letters in the output |
||||
.TP |
||||
\fBlog2\fR \fIx\fR |
||||
.sp |
||||
log base2 of x |
||||
.sp |
||||
This uses a 'live' proc body - the divisor for the change of base is computed once at definition time |
||||
.sp |
||||
(courtesy of RS \fIhttps://wiki\&.tcl-lang\&.org/page/Additional+math+functions\fR) |
||||
.TP |
||||
\fBlogbase\fR \fIb\fR \fIx\fR |
||||
.sp |
||||
log base b of x |
||||
.sp |
||||
This function uses expr's natural log and the change of base division\&. |
||||
.sp |
||||
This means for example that we can get results like: logbase 10 1000 = 2\&.9999999999999996 |
||||
.sp |
||||
Use expr's log10() function or tcl::mathfunc::log10 for base 10 |
||||
.TP |
||||
\fBfactors\fR \fIx\fR |
||||
.sp |
||||
Return a sorted list of the positive factors of x where x > 0 |
||||
.sp |
||||
For x = 0 we return only 0 and 1 as technically any number divides zero and there are an infinite number of factors\&. (including zero itself in this context)* |
||||
.sp |
||||
This is a simple brute-force implementation that iterates all numbers below the square root of x to check the factors |
||||
.sp |
||||
Because the implementation is so simple - the performance is very reasonable for numbers below at least a few 10's of millions |
||||
.sp |
||||
See tcllib math::numtheory::factors for a more complex implementation - which seems to be slower for 'small' numbers |
||||
.sp |
||||
Comparisons were done with some numbers below 17 digits long |
||||
.sp |
||||
For seriously big numbers - this simple algorithm would no doubt be outperformed by more complex algorithms\&. |
||||
.sp |
||||
The numtheory library stores some data about primes etc with each call - so may become faster when being used on more numbers |
||||
but has the disadvantage of being slower for 'small' numbers and using more memory\&. |
||||
.sp |
||||
If the largest factor below x is needed - the greatestOddFactorBelow and GreatestFactorBelow functions are a faster way to get there than computing the whole list, even for small values of x |
||||
.sp |
||||
* Taking x=0; Notion of x being divisible by integer y being: There exists an integer p such that x = py |
||||
.sp |
||||
In other mathematical contexts zero may be considered not to divide anything\&. |
||||
.TP |
||||
\fBoddFactors\fR \fIx\fR |
||||
.sp |
||||
Return a list of odd integer factors of x, sorted in ascending order |
||||
.TP |
||||
\fBgreatestFactorBelow\fR \fIx\fR |
||||
.sp |
||||
Return the largest factor of x excluding itself |
||||
.sp |
||||
factor functions can be useful for console layout calculations |
||||
.sp |
||||
See Tcllib math::numtheory for more extensive implementations |
||||
.TP |
||||
\fBgreatestOddFactorBelow\fR \fIx\fR |
||||
.sp |
||||
Return the largest odd integer factor of x excluding x itself |
||||
.TP |
||||
\fBgreatestOddFactor\fR \fIx\fR |
||||
.sp |
||||
Return the largest odd integer factor of x |
||||
.sp |
||||
For an odd value of x - this will always return x |
||||
.TP |
||||
\fBgcd\fR \fIn\fR \fIm\fR |
||||
.sp |
||||
Return the greatest common divisor of m and n |
||||
.sp |
||||
Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
.sp |
||||
Graphical use: |
||||
.sp |
||||
An a by b rectangle can be covered with square tiles of side-length c, |
||||
.sp |
||||
only if c is a common divisor of a and b |
||||
.TP |
||||
\fBgcd\fR \fIn\fR \fIm\fR |
||||
.sp |
||||
Return the lowest common multiple of m and n |
||||
.sp |
||||
Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
.sp |
||||
.TP |
||||
\fBcommonDivisors\fR \fIx\fR \fIy\fR |
||||
.sp |
||||
Return a list of all the common factors of x and y |
||||
.sp |
||||
(equivalent to factors of their gcd) |
||||
.TP |
||||
\fBhasglobs\fR \fIstr\fR |
||||
.sp |
||||
Return a boolean indicating whether str contains any of the glob characters: * ? [ ] |
||||
.sp |
||||
hasglobs uses append to preserve Tcls internal representation for str - so it should help avoid shimmering in the few cases where this may matter\&. |
||||
.TP |
||||
\fBtrimzero\fR \fInumber\fR |
||||
.sp |
||||
Return number with left-hand-side zeros trimmed off - unless all zero |
||||
.sp |
||||
If number is all zero - a single 0 is returned |
||||
.TP |
||||
\fBsubstring_count\fR \fIstr\fR \fIsubstring\fR |
||||
.sp |
||||
Search str and return number of occurrences of substring |
||||
.TP |
||||
\fBdict_merge_ordered\fR \fIdefaults\fR \fImain\fR |
||||
.sp |
||||
The standard dict merge accepts multiple dicts with values from dicts to the right (2nd argument) taking precedence\&. |
||||
.sp |
||||
When merging with a dict of default values - this means that any default key/vals that weren't in the main dict appear in the output before the main data\&. |
||||
.sp |
||||
This function merges the two dicts whilst maintaining the key order of main followed by defaults\&. |
||||
.TP |
||||
\fBaskuser\fR \fIquestion\fR |
||||
.sp |
||||
A very basic utility to read an answer from stdin |
||||
.sp |
||||
The prompt is written to the terminal and then it waits for a user to type something |
||||
.sp |
||||
stdin is temporarily configured to blocking and then put back in its original state in case it wasn't already so\&. |
||||
.sp |
||||
The user must hit enter to submit the response |
||||
.sp |
||||
The return value is the string if any that was typed prior to hitting enter\&. |
||||
.sp |
||||
The question argument can be manually colourised using the various punk::ansi funcitons |
||||
.CS |
||||
|
||||
|
||||
set answer [punk::lib::askuser "[a+ green bold]Do you want to proceed? (Y|N)[a]"] |
||||
if {[string match y* [string tolower $answer]]} { |
||||
puts "Proceeding" |
||||
} else { |
||||
puts "Cancelled by user" |
||||
} |
||||
|
||||
.CE |
||||
.PP |
||||
.SH INTERNAL |
||||
.SS "NAMESPACE PUNK::LIB::SYSTEM" |
||||
.PP |
||||
Internal functions that are not part of the API |
||||
.PP |
||||
.SH KEYWORDS |
||||
lib, module, utility |
||||
.SH COPYRIGHT |
||||
.nf |
||||
Copyright (c) 2024 |
||||
|
||||
.fi |
@ -1,12 +1,18 @@
|
||||
[toc_begin {Table Of Contents} doc] |
||||
[item doc/files/_module_overtype-1.5.2.tm.md overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/_module_overtype-1.5.3.tm.md overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/_module_overtype-1.5.1.tm.md overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/main.md punkshell {punkshell - Core}] |
||||
[item doc/files/project_changes.md punkshell__project_changes {punkshell Changes}] |
||||
[item doc/files/project_intro.md punkshell__project_intro {Introduction to punkshell}] |
||||
[item doc/files/punk/_module_ansi-0.1.0.tm.md punkshell_module_punk::ansi {Ansi string functions}] |
||||
[item doc/files/punk/_module_args-0.1.0.tm.md punkshell_module_punk::args {args parsing}] |
||||
[item doc/files/punk/_module_cap-0.1.0.tm.md punkshell_module_punk::cap {capability provider and handler plugin system}] |
||||
[item doc/files/punk/_module_char-0.1.0.tm.md punkshell_module_punk::char {character-set and unicode utilities}] |
||||
[item doc/files/punk/_module_encmime-0.1.0.tm.md punkshell_module_punk::encmime {mime encodings related subset of tcllib mime}] |
||||
[item doc/files/punk/_module_fileline-0.1.0.tm.md punkshell_module_punk::fileline {file line-handling utilities}] |
||||
[item doc/files/punk/_module_flib-0.1.0.tm.md punkshell_module_punk::flib {Module API}] |
||||
[item doc/files/punk/mix/commandset/_module_project-0.1.0.tm.md punkshell_module_punk::mix::commandset::project {pmix commandset - project}] |
||||
[item doc/files/punk/_module_flib-0.1.0.tm.md punkshell_module_punk::flib {flib experimental}] |
||||
[item doc/files/punk/_module_lib-0.1.0.tm.md punkshell_module_punk::lib {punk general utility functions}] |
||||
[item doc/files/punk/mix/commandset/_module_project-0.1.0.tm.md punkshell_module_punk::mix::commandset::project {dec commandset - project}] |
||||
[item doc/files/punk/_module_path-0.1.0.tm.md punkshell_module_punk::path {Filesystem path utilities}] |
||||
[toc_end] |
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
doc {doc/toc {{doc/files/punk/_module_fileline-0.1.0.tm.md punkshell_module_punk::fileline {file line-handling utilities}} {doc/files/punk/_module_cap-0.1.0.tm.md punkshell_module_punk::cap {capability provider and handler plugin system}} {doc/files/project_intro.md punkshell__project_intro {Introduction to punkshell}} {doc/files/punk/_module_path-0.1.0.tm.md punkshell_module_punk::path {Filesystem path utilities}} {doc/files/punk/_module_flib-0.1.0.tm.md punkshell_module_punk::flib {Module API}} {doc/files/punk/_module_args-0.1.0.tm.md punkshell_module_punk::args {args parsing}} {doc/files/project_changes.md punkshell__project_changes {punkshell Changes}} {doc/files/punk/mix/commandset/_module_project-0.1.0.tm.md punkshell_module_punk::mix::commandset::project {pmix commandset - project}} {doc/files/punk/_module_ansi-0.1.0.tm.md punkshell_module_punk::ansi {Ansi string functions}} {doc/files/main.md punkshell {punkshell - Core}}}} |
||||
doc {doc/toc {{doc/files/project_intro.md punkshell__project_intro {Introduction to punkshell}} {doc/files/_module_overtype-1.5.2.tm.md overtype_module_overtype {overtype text layout - ansi aware}} {doc/files/_module_overtype-1.5.3.tm.md overtype_module_overtype {overtype text layout - ansi aware}} {doc/files/main.md punkshell {punkshell - Core}} {doc/files/punk/_module_flib-0.1.0.tm.md punkshell_module_punk::flib {flib experimental}} {doc/files/punk/mix/commandset/_module_project-0.1.0.tm.md punkshell_module_punk::mix::commandset::project {dec commandset - project}} {doc/files/punk/_module_fileline-0.1.0.tm.md punkshell_module_punk::fileline {file line-handling utilities}} {doc/files/punk/_module_ansi-0.1.0.tm.md punkshell_module_punk::ansi {Ansi string functions}} {doc/files/punk/_module_cap-0.1.0.tm.md punkshell_module_punk::cap {capability provider and handler plugin system}} {doc/files/punk/_module_path-0.1.0.tm.md punkshell_module_punk::path {Filesystem path utilities}} {doc/files/punk/_module_args-0.1.0.tm.md punkshell_module_punk::args {args parsing}} {doc/files/project_changes.md punkshell__project_changes {punkshell Changes}} {doc/files/punk/_module_encmime-0.1.0.tm.md punkshell_module_punk::encmime {mime encodings related subset of tcllib mime}} {doc/files/punk/_module_char-0.1.0.tm.md punkshell_module_punk::char {character-set and unicode utilities}} {doc/files/punk/_module_lib-0.1.0.tm.md punkshell_module_punk::lib {punk general utility functions}} {doc/files/_module_overtype-1.5.1.tm.md overtype_module_overtype {overtype text layout - ansi aware}}}} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,78 @@
|
||||
|
||||
[//000000001]: # (overtype\_module\_overtype \- overtype text layout) |
||||
[//000000002]: # (Generated from file '\_module\_overtype\-1\.5\.1\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (overtype\_module\_overtype\(0\) 1\.5\.1 doc "overtype text layout") |
||||
|
||||
<hr> [ <a href="../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../toc.md">Table Of Contents</a> | <a |
||||
href="../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
overtype\_module\_overtype \- overtype text layout \- ansi aware |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require overtype |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
\- |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of overtype |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
\- |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by overtype |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
- __textutil__ |
||||
|
||||
- __punk::ansi__ |
||||
|
||||
\- required to detect, split, strip and calculate lengths of text possibly |
||||
containing ansi codes |
||||
|
||||
- __punk::char__ |
||||
|
||||
\- box drawing \- and also unicode character width determination for proper |
||||
layout of text with double\-column\-width chars |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[ansi](\.\./\.\./index\.md\#ansi), [module](\.\./\.\./index\.md\#module), |
||||
[text](\.\./\.\./index\.md\#text) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -0,0 +1,78 @@
|
||||
|
||||
[//000000001]: # (overtype\_module\_overtype \- overtype text layout) |
||||
[//000000002]: # (Generated from file '\_module\_overtype\-1\.5\.2\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (overtype\_module\_overtype\(0\) 1\.5\.2 doc "overtype text layout") |
||||
|
||||
<hr> [ <a href="../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../toc.md">Table Of Contents</a> | <a |
||||
href="../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
overtype\_module\_overtype \- overtype text layout \- ansi aware |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require overtype |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
\- |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of overtype |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
\- |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by overtype |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
- __textutil__ |
||||
|
||||
- __punk::ansi__ |
||||
|
||||
\- required to detect, split, strip and calculate lengths of text possibly |
||||
containing ansi codes |
||||
|
||||
- __punk::char__ |
||||
|
||||
\- box drawing \- and also unicode character width determination for proper |
||||
layout of text with double\-column\-width chars |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[ansi](\.\./\.\./index\.md\#ansi), [module](\.\./\.\./index\.md\#module), |
||||
[text](\.\./\.\./index\.md\#text) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -0,0 +1,78 @@
|
||||
|
||||
[//000000001]: # (overtype\_module\_overtype \- overtype text layout) |
||||
[//000000002]: # (Generated from file '\_module\_overtype\-1\.5\.3\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (overtype\_module\_overtype\(0\) 1\.5\.3 doc "overtype text layout") |
||||
|
||||
<hr> [ <a href="../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../toc.md">Table Of Contents</a> | <a |
||||
href="../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
overtype\_module\_overtype \- overtype text layout \- ansi aware |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require overtype |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
\- |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of overtype |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
\- |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by overtype |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
- __textutil__ |
||||
|
||||
- __punk::ansi__ |
||||
|
||||
\- required to detect, split, strip and calculate lengths of text possibly |
||||
containing ansi codes |
||||
|
||||
- __punk::char__ |
||||
|
||||
\- box drawing \- and also unicode character width determination for proper |
||||
layout of text with double\-column\-width chars |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[ansi](\.\./\.\./index\.md\#ansi), [module](\.\./\.\./index\.md\#module), |
||||
[text](\.\./\.\./index\.md\#text) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -0,0 +1,76 @@
|
||||
|
||||
[//000000001]: # (punkshell\_module\_punk::char \- character\-set nad unicode) |
||||
[//000000002]: # (Generated from file '\_module\_char\-0\.1\.0\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (punkshell\_module\_punk::char\(0\) 0\.1\.0 doc "character\-set nad unicode") |
||||
|
||||
<hr> [ <a href="../../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../../toc.md">Table Of Contents</a> | <a |
||||
href="../../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
punkshell\_module\_punk::char \- character\-set and unicode utilities |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require punk::char |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of punk::char |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
\- |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by punk::char |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
- __overtype__ |
||||
|
||||
\- |
||||
|
||||
- __textblock__ |
||||
|
||||
\- |
||||
|
||||
- __[console](\.\./\.\./\.\./index\.md\#console)__ |
||||
|
||||
\- |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[encodings](\.\./\.\./\.\./index\.md\#encodings), |
||||
[module](\.\./\.\./\.\./index\.md\#module) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -0,0 +1,136 @@
|
||||
|
||||
[//000000001]: # (punkshell\_module\_punk::encmime \- mime encoding names and aliases) |
||||
[//000000002]: # (Generated from file '\_module\_encmime\-0\.1\.0\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (punkshell\_module\_punk::encmime\(0\) 0\.1\.0 doc "mime encoding names and aliases") |
||||
|
||||
<hr> [ <a href="../../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../../toc.md">Table Of Contents</a> | <a |
||||
href="../../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
punkshell\_module\_punk::encmime \- mime encodings related subset of tcllib mime |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Namespace punk::encmime::class](#subsection3) |
||||
|
||||
- [Namespace punk::encmime](#subsection4) |
||||
|
||||
- [Namespace punk::encmime::lib](#subsection5) |
||||
|
||||
- [Internal](#section4) |
||||
|
||||
- [Namespace punk::encmime::system](#subsection6) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require punk::encmime |
||||
|
||||
[mapencoding *enc*](#1) |
||||
[reversemapencoding *mimeType*](#2) |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
This is a workaround package to provide the mime encoding names used in tcllib's |
||||
mime package \- without additional dependencies |
||||
|
||||
tcllib mime loads either Trf or tcl::memchan functions\. punk::encmime needs to |
||||
work in a context where tcllib may not yet be loaded/available, and even these |
||||
few dependencies are too much\. |
||||
|
||||
MAINTENANCE NOTE: The data in this module needs to be checked against the latest |
||||
tcllib mime package |
||||
|
||||
taken from tcllib mime version: 1\.7\.2 in 2024 |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of punk::encmime |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
Where practical \- the actual tcllib mime package should be used instead\. |
||||
|
||||
This set of encoding related functions is a snapshot of the data from the mime |
||||
package \- and may not be up to date\. |
||||
|
||||
This pseudo\-package was created to minimize dependencies for punk::char and |
||||
punk::overtype |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by punk::encmime |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
## <a name='subsection3'></a>Namespace punk::encmime::class |
||||
|
||||
class definitions |
||||
|
||||
## <a name='subsection4'></a>Namespace punk::encmime |
||||
|
||||
- <a name='1'></a>mapencoding *enc* |
||||
|
||||
maps tcl encodings onto the proper names for their MIME charset type\. |
||||
|
||||
This is only done for encodings whose charset types were known\. |
||||
|
||||
The remaining encodings return \{\} for now\. |
||||
|
||||
NOTE: consider using tcllib's mime::mapencoding instead if mime package |
||||
available |
||||
|
||||
- <a name='2'></a>reversemapencoding *mimeType* |
||||
|
||||
mime::reversemapencodings maps MIME charset types onto tcl encoding names\. |
||||
|
||||
Returns the tcl encoding name for the specified mime charset, or \{\} if none |
||||
is known |
||||
|
||||
Arguments: |
||||
|
||||
* string *mimeType* |
||||
|
||||
The MIME charset to convert into a tcl encoding type\. |
||||
|
||||
NOTE: consider using tcllib's mime::reversemapencoding instead if mime |
||||
package available |
||||
|
||||
## <a name='subsection5'></a>Namespace punk::encmime::lib |
||||
|
||||
Secondary functions that are part of the API |
||||
|
||||
# <a name='section4'></a>Internal |
||||
|
||||
## <a name='subsection6'></a>Namespace punk::encmime::system |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[encodings](\.\./\.\./\.\./index\.md\#encodings), |
||||
[module](\.\./\.\./\.\./index\.md\#module) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -0,0 +1,307 @@
|
||||
|
||||
[//000000001]: # (punkshell\_module\_punk::lib \- punk library) |
||||
[//000000002]: # (Generated from file '\_module\_lib\-0\.1\.0\.tm\.man' by tcllib/doctools with format 'markdown') |
||||
[//000000003]: # (Copyright © 2024) |
||||
[//000000004]: # (punkshell\_module\_punk::lib\(0\) 0\.1\.0 doc "punk library") |
||||
|
||||
<hr> [ <a href="../../../toc.md">Main Table Of Contents</a> | <a |
||||
href="../../toc.md">Table Of Contents</a> | <a |
||||
href="../../../index.md">Keyword Index</a> ] <hr> |
||||
|
||||
# NAME |
||||
|
||||
punkshell\_module\_punk::lib \- punk general utility functions |
||||
|
||||
# <a name='toc'></a>Table Of Contents |
||||
|
||||
- [Table Of Contents](#toc) |
||||
|
||||
- [Synopsis](#synopsis) |
||||
|
||||
- [Description](#section1) |
||||
|
||||
- [Overview](#section2) |
||||
|
||||
- [Concepts](#subsection1) |
||||
|
||||
- [dependencies](#subsection2) |
||||
|
||||
- [API](#section3) |
||||
|
||||
- [Namespace punk::lib::class](#subsection3) |
||||
|
||||
- [Namespace punk::lib](#subsection4) |
||||
|
||||
- [Internal](#section4) |
||||
|
||||
- [Namespace punk::lib::system](#subsection5) |
||||
|
||||
- [Keywords](#keywords) |
||||
|
||||
- [Copyright](#copyright) |
||||
|
||||
# <a name='synopsis'></a>SYNOPSIS |
||||
|
||||
package require punk::lib |
||||
|
||||
[__K__ *x* *y*](#1) |
||||
[__hex2dec__ ?option value\.\.\.? *list\_largeHex*](#2) |
||||
[__dex2hex__ ?option value\.\.\.? *list\_decimals*](#3) |
||||
[__log2__ *x*](#4) |
||||
[__logbase__ *b* *x*](#5) |
||||
[__factors__ *x*](#6) |
||||
[__oddFactors__ *x*](#7) |
||||
[__greatestFactorBelow__ *x*](#8) |
||||
[__greatestOddFactorBelow__ *x*](#9) |
||||
[__greatestOddFactor__ *x*](#10) |
||||
[__gcd__ *n* *m*](#11) |
||||
[__gcd__ *n* *m*](#12) |
||||
[__commonDivisors__ *x* *y*](#13) |
||||
[__hasglobs__ *str*](#14) |
||||
[__trimzero__ *number*](#15) |
||||
[__substring\_count__ *str* *substring*](#16) |
||||
[__dict\_merge\_ordered__ *defaults* *main*](#17) |
||||
[__askuser__ *question*](#18) |
||||
|
||||
# <a name='description'></a>DESCRIPTION |
||||
|
||||
This is a set of utility functions that are commonly used across punk modules or |
||||
are just considered to be general\-purpose functions\. |
||||
|
||||
The base set includes string and math functions but has no specific theme |
||||
|
||||
# <a name='section2'></a>Overview |
||||
|
||||
overview of punk::lib |
||||
|
||||
## <a name='subsection1'></a>Concepts |
||||
|
||||
The punk::lib modules should have no strong dependencies other than Tcl |
||||
|
||||
Dependendencies that only affect display or additional functionality may be |
||||
included \- but should fail gracefully if not present, and only when a function |
||||
is called that uses one of these soft dependencies\. |
||||
|
||||
This requirement for no strong dependencies, means that many utility functions |
||||
that might otherwise seem worthy of inclusion here are not present\. |
||||
|
||||
## <a name='subsection2'></a>dependencies |
||||
|
||||
packages used by punk::lib |
||||
|
||||
- __Tcl 8\.6__ |
||||
|
||||
# <a name='section3'></a>API |
||||
|
||||
## <a name='subsection3'></a>Namespace punk::lib::class |
||||
|
||||
class definitions |
||||
|
||||
## <a name='subsection4'></a>Namespace punk::lib |
||||
|
||||
- <a name='1'></a>__K__ *x* *y* |
||||
|
||||
The K\-combinator function \- returns the first argument, x and discards y |
||||
|
||||
see [https://wiki\.tcl\-lang\.org/page/K](https://wiki\.tcl\-lang\.org/page/K) |
||||
|
||||
It is used in cases where command\-substitution at the calling\-point performs |
||||
some desired effect\. |
||||
|
||||
- <a name='2'></a>__hex2dec__ ?option value\.\.\.? *list\_largeHex* |
||||
|
||||
Convert a list of \(possibly large\) unprefixed hex strings to their decimal |
||||
values |
||||
|
||||
hex2dec accepts and ignores internal underscores in the same manner as Tcl |
||||
8\.7\+ numbers e\.g hex2dec FF\_FF returns 65535 |
||||
|
||||
Leading and trailing underscores are ignored as a matter of implementation |
||||
convenience \- but this shouldn't be relied upon\. |
||||
|
||||
Leading or trailing whitespace in each list member is allowed e\.g hex2dec " |
||||
F" returns 15 |
||||
|
||||
Internal whitespace e\.g "F F" is not permitted \- but a completely empty |
||||
element "" is allowed and will return 0 |
||||
|
||||
- <a name='3'></a>__dex2hex__ ?option value\.\.\.? *list\_decimals* |
||||
|
||||
Convert a list of decimal integers to a list of hex values |
||||
|
||||
\-width <int> can be used to make each hex value at least int characters |
||||
wide, with leading zeroes\. |
||||
|
||||
\-case upper|lower determines the case of the hex letters in the output |
||||
|
||||
- <a name='4'></a>__log2__ *x* |
||||
|
||||
log base2 of x |
||||
|
||||
This uses a 'live' proc body \- the divisor for the change of base is |
||||
computed once at definition time |
||||
|
||||
\(courtesy of RS |
||||
[https://wiki\.tcl\-lang\.org/page/Additional\+math\+functions](https://wiki\.tcl\-lang\.org/page/Additional\+math\+functions)\) |
||||
|
||||
- <a name='5'></a>__logbase__ *b* *x* |
||||
|
||||
log base b of x |
||||
|
||||
This function uses expr's natural log and the change of base division\. |
||||
|
||||
This means for example that we can get results like: logbase 10 1000 = |
||||
2\.9999999999999996 |
||||
|
||||
Use expr's log10\(\) function or tcl::mathfunc::log10 for base 10 |
||||
|
||||
- <a name='6'></a>__factors__ *x* |
||||
|
||||
Return a sorted list of the positive factors of x where x > 0 |
||||
|
||||
For x = 0 we return only 0 and 1 as technically any number divides zero and |
||||
there are an infinite number of factors\. \(including zero itself in this |
||||
context\)\* |
||||
|
||||
This is a simple brute\-force implementation that iterates all numbers below |
||||
the square root of x to check the factors |
||||
|
||||
Because the implementation is so simple \- the performance is very reasonable |
||||
for numbers below at least a few 10's of millions |
||||
|
||||
See tcllib math::numtheory::factors for a more complex implementation \- |
||||
which seems to be slower for 'small' numbers |
||||
|
||||
Comparisons were done with some numbers below 17 digits long |
||||
|
||||
For seriously big numbers \- this simple algorithm would no doubt be |
||||
outperformed by more complex algorithms\. |
||||
|
||||
The numtheory library stores some data about primes etc with each call \- so |
||||
may become faster when being used on more numbers but has the disadvantage |
||||
of being slower for 'small' numbers and using more memory\. |
||||
|
||||
If the largest factor below x is needed \- the greatestOddFactorBelow and |
||||
GreatestFactorBelow functions are a faster way to get there than computing |
||||
the whole list, even for small values of x |
||||
|
||||
\* Taking x=0; Notion of x being divisible by integer y being: There exists |
||||
an integer p such that x = py |
||||
|
||||
In other mathematical contexts zero may be considered not to divide |
||||
anything\. |
||||
|
||||
- <a name='7'></a>__oddFactors__ *x* |
||||
|
||||
Return a list of odd integer factors of x, sorted in ascending order |
||||
|
||||
- <a name='8'></a>__greatestFactorBelow__ *x* |
||||
|
||||
Return the largest factor of x excluding itself |
||||
|
||||
factor functions can be useful for console layout calculations |
||||
|
||||
See Tcllib math::numtheory for more extensive implementations |
||||
|
||||
- <a name='9'></a>__greatestOddFactorBelow__ *x* |
||||
|
||||
Return the largest odd integer factor of x excluding x itself |
||||
|
||||
- <a name='10'></a>__greatestOddFactor__ *x* |
||||
|
||||
Return the largest odd integer factor of x |
||||
|
||||
For an odd value of x \- this will always return x |
||||
|
||||
- <a name='11'></a>__gcd__ *n* *m* |
||||
|
||||
Return the greatest common divisor of m and n |
||||
|
||||
Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
|
||||
Graphical use: |
||||
|
||||
An a by b rectangle can be covered with square tiles of side\-length c, |
||||
|
||||
only if c is a common divisor of a and b |
||||
|
||||
- <a name='12'></a>__gcd__ *n* *m* |
||||
|
||||
Return the lowest common multiple of m and n |
||||
|
||||
Straight from Lars Hellström's math::numtheory library in Tcllib |
||||
|
||||
- <a name='13'></a>__commonDivisors__ *x* *y* |
||||
|
||||
Return a list of all the common factors of x and y |
||||
|
||||
\(equivalent to factors of their gcd\) |
||||
|
||||
- <a name='14'></a>__hasglobs__ *str* |
||||
|
||||
Return a boolean indicating whether str contains any of the glob characters: |
||||
\* ? \[ \] |
||||
|
||||
hasglobs uses append to preserve Tcls internal representation for str \- so |
||||
it should help avoid shimmering in the few cases where this may matter\. |
||||
|
||||
- <a name='15'></a>__trimzero__ *number* |
||||
|
||||
Return number with left\-hand\-side zeros trimmed off \- unless all zero |
||||
|
||||
If number is all zero \- a single 0 is returned |
||||
|
||||
- <a name='16'></a>__substring\_count__ *str* *substring* |
||||
|
||||
Search str and return number of occurrences of substring |
||||
|
||||
- <a name='17'></a>__dict\_merge\_ordered__ *defaults* *main* |
||||
|
||||
The standard dict merge accepts multiple dicts with values from dicts to the |
||||
right \(2nd argument\) taking precedence\. |
||||
|
||||
When merging with a dict of default values \- this means that any default |
||||
key/vals that weren't in the main dict appear in the output before the main |
||||
data\. |
||||
|
||||
This function merges the two dicts whilst maintaining the key order of main |
||||
followed by defaults\. |
||||
|
||||
- <a name='18'></a>__askuser__ *question* |
||||
|
||||
A very basic utility to read an answer from stdin |
||||
|
||||
The prompt is written to the terminal and then it waits for a user to type |
||||
something |
||||
|
||||
stdin is temporarily configured to blocking and then put back in its |
||||
original state in case it wasn't already so\. |
||||
|
||||
The user must hit enter to submit the response |
||||
|
||||
The return value is the string if any that was typed prior to hitting enter\. |
||||
|
||||
The question argument can be manually colourised using the various |
||||
punk::ansi funcitons |
||||
|
||||
set answer [punk::lib::askuser "[a+ green bold]Do you want to proceed? (Y|N)[a]"] |
||||
if {[string match y* [string tolower $answer]]} { |
||||
puts "Proceeding" |
||||
} else { |
||||
puts "Cancelled by user" |
||||
} |
||||
|
||||
# <a name='section4'></a>Internal |
||||
|
||||
## <a name='subsection5'></a>Namespace punk::lib::system |
||||
|
||||
Internal functions that are not part of the API |
||||
|
||||
# <a name='keywords'></a>KEYWORDS |
||||
|
||||
[lib](\.\./\.\./\.\./index\.md\#lib), [module](\.\./\.\./\.\./index\.md\#module), |
||||
[utility](\.\./\.\./\.\./index\.md\#utility) |
||||
|
||||
# <a name='copyright'></a>COPYRIGHT |
||||
|
||||
Copyright © 2024 |
@ -1,12 +1,18 @@
|
||||
[toc_begin {Table Of Contents} doc] |
||||
[item doc/files/_module_overtype-1.5.1.tm.html overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/_module_overtype-1.5.2.tm.html overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/_module_overtype-1.5.3.tm.html overtype_module_overtype {overtype text layout - ansi aware}] |
||||
[item doc/files/main.html punkshell {punkshell - Core}] |
||||
[item doc/files/project_changes.html punkshell__project_changes {punkshell Changes}] |
||||
[item doc/files/project_intro.html punkshell__project_intro {Introduction to punkshell}] |
||||
[item doc/files/punk/_module_ansi-0.1.0.tm.html punkshell_module_punk::ansi {Ansi string functions}] |
||||
[item doc/files/punk/_module_args-0.1.0.tm.html punkshell_module_punk::args {args parsing}] |
||||
[item doc/files/punk/_module_cap-0.1.0.tm.html punkshell_module_punk::cap {capability provider and handler plugin system}] |
||||
[item doc/files/punk/_module_char-0.1.0.tm.html punkshell_module_punk::char {character-set and unicode utilities}] |
||||
[item doc/files/punk/_module_encmime-0.1.0.tm.html punkshell_module_punk::encmime {mime encodings related subset of tcllib mime}] |
||||
[item doc/files/punk/_module_fileline-0.1.0.tm.html punkshell_module_punk::fileline {file line-handling utilities}] |
||||
[item doc/files/punk/_module_flib-0.1.0.tm.html punkshell_module_punk::flib {Module API}] |
||||
[item doc/files/punk/mix/commandset/_module_project-0.1.0.tm.html punkshell_module_punk::mix::commandset::project {pmix commandset - project}] |
||||
[item doc/files/punk/_module_flib-0.1.0.tm.html punkshell_module_punk::flib {flib experimental}] |
||||
[item doc/files/punk/_module_lib-0.1.0.tm.html punkshell_module_punk::lib {punk general utility functions}] |
||||
[item doc/files/punk/mix/commandset/_module_project-0.1.0.tm.html punkshell_module_punk::mix::commandset::project {dec commandset - project}] |
||||
[item doc/files/punk/_module_path-0.1.0.tm.html punkshell_module_punk::path {Filesystem path utilities}] |
||||
[toc_end] |
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
doc {doc/toc {{doc/files/punk/_module_fileline-0.1.0.tm.html punkshell_module_punk::fileline {file line-handling utilities}} {doc/files/punk/_module_cap-0.1.0.tm.html punkshell_module_punk::cap {capability provider and handler plugin system}} {doc/files/project_intro.html punkshell__project_intro {Introduction to punkshell}} {doc/files/punk/_module_path-0.1.0.tm.html punkshell_module_punk::path {Filesystem path utilities}} {doc/files/punk/_module_flib-0.1.0.tm.html punkshell_module_punk::flib {Module API}} {doc/files/punk/_module_args-0.1.0.tm.html punkshell_module_punk::args {args parsing}} {doc/files/project_changes.html punkshell__project_changes {punkshell Changes}} {doc/files/punk/mix/commandset/_module_project-0.1.0.tm.html punkshell_module_punk::mix::commandset::project {pmix commandset - project}} {doc/files/punk/_module_ansi-0.1.0.tm.html punkshell_module_punk::ansi {Ansi string functions}} {doc/files/main.html punkshell {punkshell - Core}}}} |
||||
doc {doc/toc {{doc/files/punk/_module_cap-0.1.0.tm.html punkshell_module_punk::cap {capability provider and handler plugin system}} {doc/files/punk/_module_path-0.1.0.tm.html punkshell_module_punk::path {Filesystem path utilities}} {doc/files/punk/_module_args-0.1.0.tm.html punkshell_module_punk::args {args parsing}} {doc/files/project_changes.html punkshell__project_changes {punkshell Changes}} {doc/files/punk/_module_encmime-0.1.0.tm.html punkshell_module_punk::encmime {mime encodings related subset of tcllib mime}} {doc/files/punk/_module_char-0.1.0.tm.html punkshell_module_punk::char {character-set and unicode utilities}} {doc/files/punk/_module_lib-0.1.0.tm.html punkshell_module_punk::lib {punk general utility functions}} {doc/files/_module_overtype-1.5.1.tm.html overtype_module_overtype {overtype text layout - ansi aware}} {doc/files/project_intro.html punkshell__project_intro {Introduction to punkshell}} {doc/files/_module_overtype-1.5.2.tm.html overtype_module_overtype {overtype text layout - ansi aware}} {doc/files/_module_overtype-1.5.3.tm.html overtype_module_overtype {overtype text layout - ansi aware}} {doc/files/main.html punkshell {punkshell - Core}} {doc/files/punk/_module_flib-0.1.0.tm.html punkshell_module_punk::flib {flib experimental}} {doc/files/punk/mix/commandset/_module_project-0.1.0.tm.html punkshell_module_punk::mix::commandset::project {dec commandset - project}} {doc/files/punk/_module_fileline-0.1.0.tm.html punkshell_module_punk::fileline {file line-handling utilities}} {doc/files/punk/_module_ansi-0.1.0.tm.html punkshell_module_punk::ansi {Ansi string functions}}}} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>overtype_module_overtype - overtype text layout</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_overtype-1.5.1.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- overtype_module_overtype.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../toc.html">Table Of Contents</a> |
||||
| <a href="../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">overtype_module_overtype(0) 1.5.1 doc "overtype text layout"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>overtype_module_overtype - overtype text layout - ansi aware</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a></li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">overtype</b></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of overtype</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by overtype</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
<li><p><b class="package">textutil</b></p></li> |
||||
<li><p><b class="package">punk::ansi</b></p> |
||||
<p>- required to detect, split, strip and calculate lengths of text possibly containing ansi codes</p></li> |
||||
<li><p><b class="package">punk::char</b></p> |
||||
<p>- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars</p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../index.html#ansi">ansi</a>, <a href="../../index.html#module">module</a>, <a href="../../index.html#text">text</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>overtype_module_overtype - overtype text layout</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_overtype-1.5.2.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- overtype_module_overtype.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../toc.html">Table Of Contents</a> |
||||
| <a href="../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">overtype_module_overtype(0) 1.5.2 doc "overtype text layout"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>overtype_module_overtype - overtype text layout - ansi aware</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a></li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">overtype</b></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of overtype</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by overtype</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
<li><p><b class="package">textutil</b></p></li> |
||||
<li><p><b class="package">punk::ansi</b></p> |
||||
<p>- required to detect, split, strip and calculate lengths of text possibly containing ansi codes</p></li> |
||||
<li><p><b class="package">punk::char</b></p> |
||||
<p>- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars</p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../index.html#ansi">ansi</a>, <a href="../../index.html#module">module</a>, <a href="../../index.html#text">text</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>overtype_module_overtype - overtype text layout</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_overtype-1.5.3.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- overtype_module_overtype.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../toc.html">Table Of Contents</a> |
||||
| <a href="../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">overtype_module_overtype(0) 1.5.3 doc "overtype text layout"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>overtype_module_overtype - overtype text layout - ansi aware</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a></li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">overtype</b></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of overtype</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by overtype</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
<li><p><b class="package">textutil</b></p></li> |
||||
<li><p><b class="package">punk::ansi</b></p> |
||||
<p>- required to detect, split, strip and calculate lengths of text possibly containing ansi codes</p></li> |
||||
<li><p><b class="package">punk::char</b></p> |
||||
<p>- box drawing - and also unicode character width determination for proper layout of text with double-column-width chars</p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../index.html#ansi">ansi</a>, <a href="../../index.html#module">module</a>, <a href="../../index.html#text">text</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>punkshell_module_punk::char - character-set nad unicode</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_char-0.1.0.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- punkshell_module_punk::char.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../../toc.html">Table Of Contents</a> |
||||
| <a href="../../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">punkshell_module_punk::char(0) 0.1.0 doc "character-set nad unicode"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>punkshell_module_punk::char - character-set and unicode utilities</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a></li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">punk::char</b></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of punk::char</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>-</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by punk::char</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
<li><p><b class="package">overtype</b></p> |
||||
<p>-</p></li> |
||||
<li><p><b class="package">textblock</b></p> |
||||
<p>-</p></li> |
||||
<li><p><b class="package"><a href="../../../index.html#console">console</a></b></p> |
||||
<p>-</p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../../index.html#encodings">encodings</a>, <a href="../../../index.html#module">module</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
@ -0,0 +1,211 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>punkshell_module_punk::encmime - mime encoding names and aliases</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_encmime-0.1.0.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- punkshell_module_punk::encmime.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../../toc.html">Table Of Contents</a> |
||||
| <a href="../../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">punkshell_module_punk::encmime(0) 0.1.0 doc "mime encoding names and aliases"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>punkshell_module_punk::encmime - mime encodings related subset of tcllib mime</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection3">Namespace punk::encmime::class</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection4">Namespace punk::encmime</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection5">Namespace punk::encmime::lib</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section4">Internal</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection6">Namespace punk::encmime::system</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">punk::encmime</b></li> |
||||
</ul> |
||||
<ul class="doctools_syntax"> |
||||
<li><a href="#1">mapencoding <i class="arg">enc</i></a></li> |
||||
<li><a href="#2">reversemapencoding <i class="arg">mimeType</i></a></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
<p>This is a workaround package to provide the mime encoding names used in tcllib's mime package - without additional dependencies</p> |
||||
<p>tcllib mime loads either Trf or tcl::memchan functions. punk::encmime needs to work in a context where tcllib may not yet be loaded/available, and even these few dependencies are too much.</p> |
||||
<p>MAINTENANCE NOTE: The data in this module needs to be checked against the latest tcllib mime package</p> |
||||
<p>taken from tcllib mime version: 1.7.2 in 2024</p> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of punk::encmime</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>Where practical - the actual tcllib mime package should be used instead.</p> |
||||
<p>This set of encoding related functions is a snapshot of the data from the mime package - and may not be up to date.</p> |
||||
<p>This pseudo-package was created to minimize dependencies for punk::char and punk::overtype</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by punk::encmime</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
<div id="subsection3" class="doctools_subsection"><h3><a name="subsection3">Namespace punk::encmime::class</a></h3> |
||||
<p>class definitions</p> |
||||
<ol class="doctools_enumerated"> |
||||
</ol> |
||||
</div> |
||||
<div id="subsection4" class="doctools_subsection"><h3><a name="subsection4">Namespace punk::encmime</a></h3> |
||||
<p>Core API functions for punk::encmime</p> |
||||
<dl class="doctools_definitions"> |
||||
<dt><a name="1">mapencoding <i class="arg">enc</i></a></dt> |
||||
<dd><p>maps tcl encodings onto the proper names for their MIME charset type.</p> |
||||
<p>This is only done for encodings whose charset types were known.</p> |
||||
<p>The remaining encodings return {} for now.</p> |
||||
<p>NOTE: consider using tcllib's mime::mapencoding instead if mime package available</p></dd> |
||||
<dt><a name="2">reversemapencoding <i class="arg">mimeType</i></a></dt> |
||||
<dd><p>mime::reversemapencodings maps MIME charset types onto tcl encoding names.</p> |
||||
<p>Returns the tcl encoding name for the specified mime charset, or {} if none is known</p> |
||||
<p>Arguments:</p> |
||||
<dl class="doctools_arguments"> |
||||
|
||||
<dt>string <i class="arg">mimeType</i></dt> |
||||
<dd><p>The MIME charset to convert into a tcl encoding type.</p></dd> |
||||
</dl> |
||||
<p>NOTE: consider using tcllib's mime::reversemapencoding instead if mime package available</p></dd> |
||||
</dl> |
||||
</div> |
||||
<div id="subsection5" class="doctools_subsection"><h3><a name="subsection5">Namespace punk::encmime::lib</a></h3> |
||||
<p>Secondary functions that are part of the API</p> |
||||
<dl class="doctools_definitions"> |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
<div id="section4" class="doctools_section"><h2><a name="section4">Internal</a></h2> |
||||
<div id="subsection6" class="doctools_subsection"><h3><a name="subsection6">Namespace punk::encmime::system</a></h3> |
||||
<p>Internal functions that are not part of the API</p> |
||||
</div> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../../index.html#encodings">encodings</a>, <a href="../../../index.html#module">module</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
@ -0,0 +1,293 @@
|
||||
<!DOCTYPE html><html><head> |
||||
<title>punkshell_module_punk::lib - punk library</title> |
||||
<style type="text/css"><!-- |
||||
HTML { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
BODY { |
||||
background: #FFFFFF; |
||||
color: black; |
||||
} |
||||
DIV.doctools { |
||||
margin-left: 10%; |
||||
margin-right: 10%; |
||||
} |
||||
DIV.doctools H1,DIV.doctools H2 { |
||||
margin-left: -5%; |
||||
} |
||||
H1, H2, H3, H4 { |
||||
margin-top: 1em; |
||||
font-family: sans-serif; |
||||
font-size: large; |
||||
color: #005A9C; |
||||
background: transparent; |
||||
text-align: left; |
||||
} |
||||
H1.doctools_title { |
||||
text-align: center; |
||||
} |
||||
UL,OL { |
||||
margin-right: 0em; |
||||
margin-top: 3pt; |
||||
margin-bottom: 3pt; |
||||
} |
||||
UL LI { |
||||
list-style: disc; |
||||
} |
||||
OL LI { |
||||
list-style: decimal; |
||||
} |
||||
DT { |
||||
padding-top: 1ex; |
||||
} |
||||
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL { |
||||
font: normal 12pt/14pt sans-serif; |
||||
list-style: none; |
||||
} |
||||
LI.doctools_section, LI.doctools_subsection { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
PRE { |
||||
display: block; |
||||
font-family: monospace; |
||||
white-space: pre; |
||||
margin: 0%; |
||||
padding-top: 0.5ex; |
||||
padding-bottom: 0.5ex; |
||||
padding-left: 1ex; |
||||
padding-right: 1ex; |
||||
width: 100%; |
||||
} |
||||
PRE.doctools_example { |
||||
color: black; |
||||
background: #f5dcb3; |
||||
border: 1px solid black; |
||||
} |
||||
UL.doctools_requirements LI, UL.doctools_syntax LI { |
||||
list-style: none; |
||||
margin-left: 0em; |
||||
text-indent: 0em; |
||||
padding: 0em; |
||||
} |
||||
DIV.doctools_synopsis { |
||||
color: black; |
||||
background: #80ffff; |
||||
border: 1px solid black; |
||||
font-family: serif; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
} |
||||
UL.doctools_syntax { |
||||
margin-top: 1em; |
||||
border-top: 1px solid black; |
||||
} |
||||
UL.doctools_requirements { |
||||
margin-bottom: 1em; |
||||
border-bottom: 1px solid black; |
||||
} |
||||
--></style> |
||||
</head> |
||||
<!-- Generated from file '_module_lib-0.1.0.tm.man' by tcllib/doctools with format 'html' |
||||
--> |
||||
<!-- Copyright &copy; 2024 |
||||
--> |
||||
<!-- punkshell_module_punk::lib.0 |
||||
--> |
||||
<body><hr> [ |
||||
<a href="../../../toc.html">Main Table Of Contents</a> |
||||
| <a href="../../toc.html">Table Of Contents</a> |
||||
| <a href="../../../index.html">Keyword Index</a> |
||||
] <hr> |
||||
<div class="doctools"> |
||||
<h1 class="doctools_title">punkshell_module_punk::lib(0) 0.1.0 doc "punk library"</h1> |
||||
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
||||
<p>punkshell_module_punk::lib - punk general utility functions</p> |
||||
</div> |
||||
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2> |
||||
<ul class="doctools_toc"> |
||||
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li> |
||||
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li> |
||||
<li class="doctools_section"><a href="#section1">Description</a></li> |
||||
<li class="doctools_section"><a href="#section2">Overview</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection1">Concepts</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection2">dependencies</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section3">API</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection3">Namespace punk::lib::class</a></li> |
||||
<li class="doctools_subsection"><a href="#subsection4">Namespace punk::lib</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#section4">Internal</a> |
||||
<ul> |
||||
<li class="doctools_subsection"><a href="#subsection5">Namespace punk::lib::system</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
||||
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
||||
</ul> |
||||
</div> |
||||
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2> |
||||
<div class="doctools_synopsis"> |
||||
<ul class="doctools_requirements"> |
||||
<li>package require <b class="pkgname">punk::lib</b></li> |
||||
</ul> |
||||
<ul class="doctools_syntax"> |
||||
<li><a href="#1"><b class="function">K</b> <i class="arg">x</i> <i class="arg">y</i></a></li> |
||||
<li><a href="#2"><b class="function">hex2dec</b> <span class="opt">?option value...?</span> <i class="arg">list_largeHex</i></a></li> |
||||
<li><a href="#3"><b class="function">dex2hex</b> <span class="opt">?option value...?</span> <i class="arg">list_decimals</i></a></li> |
||||
<li><a href="#4"><b class="function">log2</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#5"><b class="function">logbase</b> <i class="arg">b</i> <i class="arg">x</i></a></li> |
||||
<li><a href="#6"><b class="function">factors</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#7"><b class="function">oddFactors</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#8"><b class="function">greatestFactorBelow</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#9"><b class="function">greatestOddFactorBelow</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#10"><b class="function">greatestOddFactor</b> <i class="arg">x</i></a></li> |
||||
<li><a href="#11"><b class="function">gcd</b> <i class="arg">n</i> <i class="arg">m</i></a></li> |
||||
<li><a href="#12"><b class="function">gcd</b> <i class="arg">n</i> <i class="arg">m</i></a></li> |
||||
<li><a href="#13"><b class="function">commonDivisors</b> <i class="arg">x</i> <i class="arg">y</i></a></li> |
||||
<li><a href="#14"><b class="function">hasglobs</b> <i class="arg">str</i></a></li> |
||||
<li><a href="#15"><b class="function">trimzero</b> <i class="arg">number</i></a></li> |
||||
<li><a href="#16"><b class="function">substring_count</b> <i class="arg">str</i> <i class="arg">substring</i></a></li> |
||||
<li><a href="#17"><b class="function">dict_merge_ordered</b> <i class="arg">defaults</i> <i class="arg">main</i></a></li> |
||||
<li><a href="#18"><b class="function">askuser</b> <i class="arg">question</i></a></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
||||
<p>This is a set of utility functions that are commonly used across punk modules or are just considered to be general-purpose functions.</p> |
||||
<p>The base set includes string and math functions but has no specific theme</p> |
||||
</div> |
||||
<div id="section2" class="doctools_section"><h2><a name="section2">Overview</a></h2> |
||||
<p>overview of punk::lib</p> |
||||
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Concepts</a></h3> |
||||
<p>The punk::lib modules should have no strong dependencies other than Tcl</p> |
||||
<p>Dependendencies that only affect display or additional functionality may be included - but should fail gracefully if not present, and only when a function is called that uses one of these soft dependencies.</p> |
||||
<p>This requirement for no strong dependencies, means that many utility functions that might otherwise seem worthy of inclusion here are not present.</p> |
||||
</div> |
||||
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">dependencies</a></h3> |
||||
<p>packages used by punk::lib</p> |
||||
<ul class="doctools_itemized"> |
||||
<li><p><b class="package">Tcl 8.6</b></p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div id="section3" class="doctools_section"><h2><a name="section3">API</a></h2> |
||||
<div id="subsection3" class="doctools_subsection"><h3><a name="subsection3">Namespace punk::lib::class</a></h3> |
||||
<p>class definitions</p> |
||||
<ol class="doctools_enumerated"> |
||||
</ol> |
||||
</div> |
||||
<div id="subsection4" class="doctools_subsection"><h3><a name="subsection4">Namespace punk::lib</a></h3> |
||||
<p>Core API functions for punk::lib</p> |
||||
<dl class="doctools_definitions"> |
||||
<dt><a name="1"><b class="function">K</b> <i class="arg">x</i> <i class="arg">y</i></a></dt> |
||||
<dd><p>The K-combinator function - returns the first argument, x and discards y</p> |
||||
<p>see <a href="https://wiki.tcl-lang.org/page/K">https://wiki.tcl-lang.org/page/K</a></p> |
||||
<p>It is used in cases where command-substitution at the calling-point performs some desired effect.</p></dd> |
||||
<dt><a name="2"><b class="function">hex2dec</b> <span class="opt">?option value...?</span> <i class="arg">list_largeHex</i></a></dt> |
||||
<dd><p>Convert a list of (possibly large) unprefixed hex strings to their decimal values</p> |
||||
<p>hex2dec accepts and ignores internal underscores in the same manner as Tcl 8.7+ numbers e.g hex2dec FF_FF returns 65535</p> |
||||
<p>Leading and trailing underscores are ignored as a matter of implementation convenience - but this shouldn't be relied upon.</p> |
||||
<p>Leading or trailing whitespace in each list member is allowed e.g hex2dec " F" returns 15</p> |
||||
<p>Internal whitespace e.g "F F" is not permitted - but a completely empty element "" is allowed and will return 0</p></dd> |
||||
<dt><a name="3"><b class="function">dex2hex</b> <span class="opt">?option value...?</span> <i class="arg">list_decimals</i></a></dt> |
||||
<dd><p>Convert a list of decimal integers to a list of hex values</p> |
||||
<p>-width <int> can be used to make each hex value at least int characters wide, with leading zeroes.</p> |
||||
<p>-case upper|lower determines the case of the hex letters in the output</p></dd> |
||||
<dt><a name="4"><b class="function">log2</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>log base2 of x</p> |
||||
<p>This uses a 'live' proc body - the divisor for the change of base is computed once at definition time</p> |
||||
<p>(courtesy of RS <a href="https://wiki.tcl-lang.org/page/Additional+math+functions">https://wiki.tcl-lang.org/page/Additional+math+functions</a>)</p></dd> |
||||
<dt><a name="5"><b class="function">logbase</b> <i class="arg">b</i> <i class="arg">x</i></a></dt> |
||||
<dd><p>log base b of x</p> |
||||
<p>This function uses expr's natural log and the change of base division.</p> |
||||
<p>This means for example that we can get results like: logbase 10 1000 = 2.9999999999999996</p> |
||||
<p>Use expr's log10() function or tcl::mathfunc::log10 for base 10</p></dd> |
||||
<dt><a name="6"><b class="function">factors</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>Return a sorted list of the positive factors of x where x > 0</p> |
||||
<p>For x = 0 we return only 0 and 1 as technically any number divides zero and there are an infinite number of factors. (including zero itself in this context)*</p> |
||||
<p>This is a simple brute-force implementation that iterates all numbers below the square root of x to check the factors</p> |
||||
<p>Because the implementation is so simple - the performance is very reasonable for numbers below at least a few 10's of millions</p> |
||||
<p>See tcllib math::numtheory::factors for a more complex implementation - which seems to be slower for 'small' numbers</p> |
||||
<p>Comparisons were done with some numbers below 17 digits long</p> |
||||
<p>For seriously big numbers - this simple algorithm would no doubt be outperformed by more complex algorithms.</p> |
||||
<p>The numtheory library stores some data about primes etc with each call - so may become faster when being used on more numbers |
||||
but has the disadvantage of being slower for 'small' numbers and using more memory.</p> |
||||
<p>If the largest factor below x is needed - the greatestOddFactorBelow and GreatestFactorBelow functions are a faster way to get there than computing the whole list, even for small values of x</p> |
||||
<p>* Taking x=0; Notion of x being divisible by integer y being: There exists an integer p such that x = py</p> |
||||
<p>In other mathematical contexts zero may be considered not to divide anything.</p></dd> |
||||
<dt><a name="7"><b class="function">oddFactors</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>Return a list of odd integer factors of x, sorted in ascending order</p></dd> |
||||
<dt><a name="8"><b class="function">greatestFactorBelow</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>Return the largest factor of x excluding itself</p> |
||||
<p>factor functions can be useful for console layout calculations</p> |
||||
<p>See Tcllib math::numtheory for more extensive implementations</p></dd> |
||||
<dt><a name="9"><b class="function">greatestOddFactorBelow</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>Return the largest odd integer factor of x excluding x itself</p></dd> |
||||
<dt><a name="10"><b class="function">greatestOddFactor</b> <i class="arg">x</i></a></dt> |
||||
<dd><p>Return the largest odd integer factor of x</p> |
||||
<p>For an odd value of x - this will always return x</p></dd> |
||||
<dt><a name="11"><b class="function">gcd</b> <i class="arg">n</i> <i class="arg">m</i></a></dt> |
||||
<dd><p>Return the greatest common divisor of m and n</p> |
||||
<p>Straight from Lars Hellström's math::numtheory library in Tcllib</p> |
||||
<p>Graphical use:</p> |
||||
<p>An a by b rectangle can be covered with square tiles of side-length c,</p> |
||||
<p>only if c is a common divisor of a and b</p></dd> |
||||
<dt><a name="12"><b class="function">gcd</b> <i class="arg">n</i> <i class="arg">m</i></a></dt> |
||||
<dd><p>Return the lowest common multiple of m and n</p> |
||||
<p>Straight from Lars Hellström's math::numtheory library in Tcllib</p></dd> |
||||
<dt><a name="13"><b class="function">commonDivisors</b> <i class="arg">x</i> <i class="arg">y</i></a></dt> |
||||
<dd><p>Return a list of all the common factors of x and y</p> |
||||
<p>(equivalent to factors of their gcd)</p></dd> |
||||
<dt><a name="14"><b class="function">hasglobs</b> <i class="arg">str</i></a></dt> |
||||
<dd><p>Return a boolean indicating whether str contains any of the glob characters: * ? [ ]</p> |
||||
<p>hasglobs uses append to preserve Tcls internal representation for str - so it should help avoid shimmering in the few cases where this may matter.</p></dd> |
||||
<dt><a name="15"><b class="function">trimzero</b> <i class="arg">number</i></a></dt> |
||||
<dd><p>Return number with left-hand-side zeros trimmed off - unless all zero</p> |
||||
<p>If number is all zero - a single 0 is returned</p></dd> |
||||
<dt><a name="16"><b class="function">substring_count</b> <i class="arg">str</i> <i class="arg">substring</i></a></dt> |
||||
<dd><p>Search str and return number of occurrences of substring</p></dd> |
||||
<dt><a name="17"><b class="function">dict_merge_ordered</b> <i class="arg">defaults</i> <i class="arg">main</i></a></dt> |
||||
<dd><p>The standard dict merge accepts multiple dicts with values from dicts to the right (2nd argument) taking precedence.</p> |
||||
<p>When merging with a dict of default values - this means that any default key/vals that weren't in the main dict appear in the output before the main data.</p> |
||||
<p>This function merges the two dicts whilst maintaining the key order of main followed by defaults.</p></dd> |
||||
<dt><a name="18"><b class="function">askuser</b> <i class="arg">question</i></a></dt> |
||||
<dd><p>A very basic utility to read an answer from stdin</p> |
||||
<p>The prompt is written to the terminal and then it waits for a user to type something</p> |
||||
<p>stdin is temporarily configured to blocking and then put back in its original state in case it wasn't already so.</p> |
||||
<p>The user must hit enter to submit the response</p> |
||||
<p>The return value is the string if any that was typed prior to hitting enter.</p> |
||||
<p>The question argument can be manually colourised using the various punk::ansi funcitons</p> |
||||
<pre class="doctools_example"> |
||||
set answer [punk::lib::askuser "[a+ green bold]Do you want to proceed? (Y|N)[a]"] |
||||
if {[string match y* [string tolower $answer]]} { |
||||
puts "Proceeding" |
||||
} else { |
||||
puts "Cancelled by user" |
||||
} |
||||
</pre> |
||||
</dd> |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
<div id="section4" class="doctools_section"><h2><a name="section4">Internal</a></h2> |
||||
<div id="subsection5" class="doctools_subsection"><h3><a name="subsection5">Namespace punk::lib::system</a></h3> |
||||
<p>Internal functions that are not part of the API</p> |
||||
<dl class="doctools_definitions"> |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
||||
<p><a href="../../../index.html#lib">lib</a>, <a href="../../../index.html#module">module</a>, <a href="../../../index.html#utility">utility</a></p> |
||||
</div> |
||||
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
||||
<p>Copyright © 2024</p> |
||||
</div> |
||||
</div></body></html> |
Loading…
Reference in new issue