diff --git a/src/doc/punk/_module_fileline-0.1.0.tm.man b/src/doc/punk/_module_fileline-0.1.0.tm.man index be45f826..525bc7b3 100644 --- a/src/doc/punk/_module_fileline-0.1.0.tm.man +++ b/src/doc/punk/_module_fileline-0.1.0.tm.man @@ -29,10 +29,20 @@ [para]No support for lone carriage-returns being interpreted as line-endings. [para]CR line-endings that are intended to be interpreted as such should be mapped to something else before the data is supplied to this module. [subsection dependencies] -[para] packages used by punk::fileline +[para] packages needed by punk::fileline [list_begin itemized] [item] [package {Tcl 8.6}] -[list_end] +[list_end] [comment {- end dependencies list -}] +[subsection {optional dependencies}] +[para] packages that add functionality but aren't strictly required +[list_begin itemized] +[item] [package {punk::ansi}] +[para] - recommended for class::textinfo [method chunk_boundary_display] +[item] [package {punk::char}] +[para] - recommended for class::textinfo [method chunk_boundary_display] +[item] [package {overtype}] +[para] - recommended for class::textinfo [method chunk_boundary_display] +[list_end] [comment {- end optional dependencies list -}] [section API] [subsection {Namespace punk::fileline::class}] [para] class definitions @@ -56,10 +66,11 @@ or [para] objName chunk 0 end [call class::textinfo [method chunklen]] [para] Number of bytes/characters in the raw data of the file +[call class::textinfo [method chunk_boundary_display]] +[para]Returns a string displaying the boundaries at chunksize bytes between chunkstart and chunkend +[para]Defaults to using ansi colour if punk::ansi module is available. Use -ansi 0 to disable colour [call class::textinfo [method linecount]] [para] Number of lines in the raw data of the file, counted as per the policy in effect -[call class::textinfo [method regenerate_lines]] -[para]generate a list of lines from the stored raw data chunk and keep a map of line-endings indexed by lineindex [call class::textinfo [method line] [arg lineindex]] [para]Reconstructs and returns the raw line using the payload and per-line stored line-ending metadata [para]A 'line' may be returned without a line-ending if the unerlying chunk had trailing data without a line-ending (or the chunk was loaded under a non-standard -policy setting) @@ -91,6 +102,8 @@ or [para]Return a dict of the metadata and text for the line indicated by the zero-based lineindex [para]This returns the same info as the [method linemeta] with an added key of 'payload' which is the text of the line without line-ending. [para]The 'payload' value is the same as is returned from the [method linepayload] method. +[call class::textinfo [method lineinfolist] [arg startidx] [arg endidx]] +[para]Returns list of lineinfo dicts for each line in line index range startidx to endidx [call class::textinfo [method linerange_to_chunkrange] [arg startidx] [arg endidx]] [call class::textinfo [method linerange_to_chunk] [arg startidx] [arg endidx]] [call class::textinfo [method lines] [arg startidx] [arg endidx]] @@ -111,6 +124,11 @@ or [para]Basic addition and subtraction expressions such as 4-1 5+2 are accepted [para]startidx higher than endidx is allowed [para]Unlike Tcl's index expressions - we raise an error if the calculated index is out of bounds 0 to max +[call class::textinfo [method regenerate_lines]] +[para]generate a list of lines from the current state of the stored raw data chunk and keep a map of line-endings indexed by lineindex +[para]This is called automatically by the Constructor during object creation +[para]It is exposed in the API experimentally - as chunk and line manipulation functions are considered. +[para]TODO - review whether such manual control will be necessary/desirable [list_end] [list_end] [comment {--- end class enumeration ---}] [subsection {Namespace punk::fileline}] @@ -143,4 +161,12 @@ or [section Internal] [subsection {Namespace punk::fileline::system}] [para] Internal functions that are not part of the API +[subsection {Namespace punk::fileline::ansi}] +[para]These are ansi functions imported from punk::ansi - or no-ops if that package is unavailable +[para]See [package punk::ansi] for documentation +[list_begin definitions] +[call [fun ansi::a]] +[call [fun ansi::a+]] +[call [fun ansi::stripansi]] +[list_end] [comment {--- end definitions namespace punk::fileline::ansi ---}] [manpage_end] diff --git a/src/embedded/man/files/punk/_module_fileline-0.1.0.tm.n b/src/embedded/man/files/punk/_module_fileline-0.1.0.tm.n index 49fdd12d..9fe9afc7 100644 --- a/src/embedded/man/files/punk/_module_fileline-0.1.0.tm.n +++ b/src/embedded/man/files/punk/_module_fileline-0.1.0.tm.n @@ -282,9 +282,9 @@ class::textinfo \fBchunk\fR \fIchunkstart\fR \fIchunkend\fR .sp class::textinfo \fBchunklen\fR .sp -class::textinfo \fBlinecount\fR +class::textinfo \fBchunk_boundary_display\fR .sp -class::textinfo \fBregenerate_lines\fR +class::textinfo \fBlinecount\fR .sp class::textinfo \fBline\fR \fIlineindex\fR .sp @@ -294,6 +294,8 @@ class::textinfo \fBlinemeta\fR \fIlineindex\fR .sp class::textinfo \fBlineinfo\fR \fIlineindex\fR .sp +class::textinfo \fBlineinfolist\fR \fIstartidx\fR \fIendidx\fR +.sp class::textinfo \fBlinerange_to_chunkrange\fR \fIstartidx\fR \fIendidx\fR .sp class::textinfo \fBlinerange_to_chunk\fR \fIstartidx\fR \fIendidx\fR @@ -312,8 +314,16 @@ class::textinfo \fBnumeric_chunkrange\fR \fIstartidx\fR \fIendidx\fR .sp class::textinfo \fBnormalize_indices\fR \fIstartidx\fR \fIendidx\fR \fImax\fR .sp +class::textinfo \fBregenerate_lines\fR +.sp \fBlib::range_spans_chunk_boundaries\fR \fIstart\fR \fIend\fR \fIchunksize\fR .sp +\fBansi::a\fR +.sp +\fBansi::a+\fR +.sp +\fBansi::stripansi\fR +.sp .BE .SH DESCRIPTION .PP @@ -351,10 +361,26 @@ No support for lone carriage-returns being interpreted as line-endings\&. CR line-endings that are intended to be interpreted as such should be mapped to something else before the data is supplied to this module\&. .SS DEPENDENCIES .PP -packages used by punk::fileline +packages needed by punk::fileline .IP \(bu \fBTcl 8\&.6\fR .PP +.SS "OPTIONAL DEPENDENCIES" +.PP +packages that add functionality but aren't strictly required +.IP \(bu +\fBpunk::ansi\fR +.sp +- recommended for class::textinfo \fBchunk_boundary_display\fR +.IP \(bu +\fBpunk::char\fR +.sp +- recommended for class::textinfo \fBchunk_boundary_display\fR +.IP \(bu +\fBovertype\fR +.sp +- recommended for class::textinfo \fBchunk_boundary_display\fR +.PP .SH API .SS "NAMESPACE PUNK::FILELINE::CLASS" .PP @@ -394,13 +420,15 @@ class::textinfo \fBchunklen\fR .sp Number of bytes/characters in the raw data of the file .TP -class::textinfo \fBlinecount\fR +class::textinfo \fBchunk_boundary_display\fR .sp -Number of lines in the raw data of the file, counted as per the policy in effect +Returns a string displaying the boundaries at chunksize bytes between chunkstart and chunkend +.sp +Defaults to using ansi colour if punk::ansi module is available\&. Use -ansi 0 to disable colour .TP -class::textinfo \fBregenerate_lines\fR +class::textinfo \fBlinecount\fR .sp -generate a list of lines from the stored raw data chunk and keep a map of line-endings indexed by lineindex +Number of lines in the raw data of the file, counted as per the policy in effect .TP class::textinfo \fBline\fR \fIlineindex\fR .sp @@ -462,6 +490,10 @@ This returns the same info as the \fBlinemeta\fR with an added key of 'payload' .sp The 'payload' value is the same as is returned from the \fBlinepayload\fR method\&. .TP +class::textinfo \fBlineinfolist\fR \fIstartidx\fR \fIendidx\fR +.sp +Returns list of lineinfo dicts for each line in line index range startidx to endidx +.TP class::textinfo \fBlinerange_to_chunkrange\fR \fIstartidx\fR \fIendidx\fR .TP class::textinfo \fBlinerange_to_chunk\fR \fIstartidx\fR \fIendidx\fR @@ -501,6 +533,16 @@ Basic addition and subtraction expressions such as 4-1 5+2 are accepted startidx higher than endidx is allowed .sp Unlike Tcl's index expressions - we raise an error if the calculated index is out of bounds 0 to max +.TP +class::textinfo \fBregenerate_lines\fR +.sp +generate a list of lines from the current state of the stored raw data chunk and keep a map of line-endings indexed by lineindex +.sp +This is called automatically by the Constructor during object creation +.sp +It is exposed in the API experimentally - as chunk and line manipulation functions are considered\&. +.sp +TODO - review whether such manual control will be necessary/desirable .RE .PP .SS "NAMESPACE PUNK::FILELINE" @@ -550,6 +592,18 @@ This function automatically uses lseq (if Tcl >= 8\&.7) when number of boundarie .SS "NAMESPACE PUNK::FILELINE::SYSTEM" .PP Internal functions that are not part of the API +.SS "NAMESPACE PUNK::FILELINE::ANSI" +.PP +These are ansi functions imported from punk::ansi - or no-ops if that package is unavailable +.PP +See \fBpunk::ansi\fR for documentation +.TP +\fBansi::a\fR +.TP +\fBansi::a+\fR +.TP +\fBansi::stripansi\fR +.PP .SH KEYWORDS file, module, parse, text .SH COPYRIGHT diff --git a/src/embedded/md/doc/files/punk/_module_fileline-0.1.0.tm.md b/src/embedded/md/doc/files/punk/_module_fileline-0.1.0.tm.md index 9ed788e3..c6e4c6d2 100644 --- a/src/embedded/md/doc/files/punk/_module_fileline-0.1.0.tm.md +++ b/src/embedded/md/doc/files/punk/_module_fileline-0.1.0.tm.md @@ -28,17 +28,21 @@ punkshell\_module\_punk::fileline \- file line\-handling utilities - [dependencies](#subsection3) + - [optional dependencies](#subsection4) + - [API](#section3) - - [Namespace punk::fileline::class](#subsection4) + - [Namespace punk::fileline::class](#subsection5) - - [Namespace punk::fileline](#subsection5) + - [Namespace punk::fileline](#subsection6) - - [Namespace punk::fileline::lib](#subsection6) + - [Namespace punk::fileline::lib](#subsection7) - [Internal](#section4) - - [Namespace punk::fileline::system](#subsection7) + - [Namespace punk::fileline::system](#subsection8) + + - [Namespace punk::fileline::ansi](#subsection9) - [Keywords](#keywords) @@ -51,22 +55,27 @@ package require punk::fileline [class::textinfo __constructor__ *datachunk* ?option value\.\.\.?](#1) [class::textinfo __chunk__ *chunkstart* *chunkend*](#2) [class::textinfo __chunklen__](#3) -[class::textinfo __linecount__](#4) -[class::textinfo __regenerate\_lines__](#5) +[class::textinfo __chunk\_boundary\_display__](#4) +[class::textinfo __linecount__](#5) [class::textinfo __line__ *lineindex*](#6) [class::textinfo __linepayload__ *lineindex*](#7) [class::textinfo __linemeta__ *lineindex*](#8) [class::textinfo __lineinfo__ *lineindex*](#9) -[class::textinfo __linerange\_to\_chunkrange__ *startidx* *endidx*](#10) -[class::textinfo __linerange\_to\_chunk__ *startidx* *endidx*](#11) -[class::textinfo __lines__ *startidx* *endidx*](#12) -[class::textinfo __linepayloads__ *startidx* *endidx*](#13) -[class::textinfo __chunkrange\_to\_linerange__ *chunkstart* *chunkend*](#14) -[class::textinfo __chunkrange\_to\_lineinfolist__ *chunkstart* *chunkend* ?option value\.\.\.?](#15) -[class::textinfo __numeric\_linerange__ *startidx* *endidx*](#16) -[class::textinfo __numeric\_chunkrange__ *startidx* *endidx*](#17) -[class::textinfo __normalize\_indices__ *startidx* *endidx* *max*](#18) -[__lib::range\_spans\_chunk\_boundaries__ *start* *end* *chunksize*](#19) +[class::textinfo __lineinfolist__ *startidx* *endidx*](#10) +[class::textinfo __linerange\_to\_chunkrange__ *startidx* *endidx*](#11) +[class::textinfo __linerange\_to\_chunk__ *startidx* *endidx*](#12) +[class::textinfo __lines__ *startidx* *endidx*](#13) +[class::textinfo __linepayloads__ *startidx* *endidx*](#14) +[class::textinfo __chunkrange\_to\_linerange__ *chunkstart* *chunkend*](#15) +[class::textinfo __chunkrange\_to\_lineinfolist__ *chunkstart* *chunkend* ?option value\.\.\.?](#16) +[class::textinfo __numeric\_linerange__ *startidx* *endidx*](#17) +[class::textinfo __numeric\_chunkrange__ *startidx* *endidx*](#18) +[class::textinfo __normalize\_indices__ *startidx* *endidx* *max*](#19) +[class::textinfo __regenerate\_lines__](#20) +[__lib::range\_spans\_chunk\_boundaries__ *start* *end* *chunksize*](#21) +[__ansi::a__](#22) +[__ansi::a\+__](#23) +[__ansi::stripansi__](#24) # DESCRIPTION @@ -114,13 +123,29 @@ something else before the data is supplied to this module\. ## dependencies -packages used by punk::fileline +packages needed by punk::fileline - __Tcl 8\.6__ +## optional dependencies + +packages that add functionality but aren't strictly required + + - __punk::ansi__ + + \- recommended for class::textinfo __chunk\_boundary\_display__ + + - __punk::char__ + + \- recommended for class::textinfo __chunk\_boundary\_display__ + + - __overtype__ + + \- recommended for class::textinfo __chunk\_boundary\_display__ + # API -## Namespace punk::fileline::class +## Namespace punk::fileline::class class definitions @@ -155,15 +180,18 @@ class definitions Number of bytes/characters in the raw data of the file - - class::textinfo __linecount__ + - class::textinfo __chunk\_boundary\_display__ - Number of lines in the raw data of the file, counted as per the policy - in effect + Returns a string displaying the boundaries at chunksize bytes between + chunkstart and chunkend + + Defaults to using ansi colour if punk::ansi module is available\. Use + \-ansi 0 to disable colour - - class::textinfo __regenerate\_lines__ + - class::textinfo __linecount__ - generate a list of lines from the stored raw data chunk and keep a map - of line\-endings indexed by lineindex + Number of lines in the raw data of the file, counted as per the policy + in effect - class::textinfo __line__ *lineindex* @@ -243,17 +271,22 @@ class definitions The 'payload' value is the same as is returned from the __linepayload__ method\. - - class::textinfo __linerange\_to\_chunkrange__ *startidx* *endidx* + - class::textinfo __lineinfolist__ *startidx* *endidx* + + Returns list of lineinfo dicts for each line in line index range + startidx to endidx - - class::textinfo __linerange\_to\_chunk__ *startidx* *endidx* + - class::textinfo __linerange\_to\_chunkrange__ *startidx* *endidx* - - class::textinfo __lines__ *startidx* *endidx* + - class::textinfo __linerange\_to\_chunk__ *startidx* *endidx* - - class::textinfo __linepayloads__ *startidx* *endidx* + - class::textinfo __lines__ *startidx* *endidx* - - class::textinfo __chunkrange\_to\_linerange__ *chunkstart* *chunkend* + - class::textinfo __linepayloads__ *startidx* *endidx* - - class::textinfo __chunkrange\_to\_lineinfolist__ *chunkstart* *chunkend* ?option value\.\.\.? + - class::textinfo __chunkrange\_to\_linerange__ *chunkstart* *chunkend* + + - class::textinfo __chunkrange\_to\_lineinfolist__ *chunkstart* *chunkend* ?option value\.\.\.? Return a list of dicts each with structure like the result of the __lineinfo__ method \- but possibly with extra keys for truncation @@ -270,7 +303,7 @@ class definitions method \- and will not be reflected in __lineinfo__ queries to the main chunk\. - - class::textinfo __numeric\_linerange__ *startidx* *endidx* + - class::textinfo __numeric\_linerange__ *startidx* *endidx* A helper to return any Tcl\-style end end\-x values given to startidx or endidx; converted to their specific values based on the current state @@ -279,13 +312,13 @@ class definitions This is used internally by API functions such as __line__ to enable it to accept more expressive indices - - class::textinfo __numeric\_chunkrange__ *startidx* *endidx* + - class::textinfo __numeric\_chunkrange__ *startidx* *endidx* A helper to return any Tcl\-style end end\-x entries supplied to startidx or endidx; converted to their specific values based on the current state of the underlying chunk data - - class::textinfo __normalize\_indices__ *startidx* *endidx* *max* + - class::textinfo __normalize\_indices__ *startidx* *endidx* *max* A utility to convert some of the of Tcl\-style list\-index expressions such as end, end\-1 etc to valid indices in the range 0 to the supplied @@ -298,13 +331,25 @@ class definitions Unlike Tcl's index expressions \- we raise an error if the calculated index is out of bounds 0 to max -## Namespace punk::fileline + - class::textinfo __regenerate\_lines__ + + generate a list of lines from the current state of the stored raw data + chunk and keep a map of line\-endings indexed by lineindex + + This is called automatically by the Constructor during object creation + + It is exposed in the API experimentally \- as chunk and line + manipulation functions are considered\. + + TODO \- review whether such manual control will be necessary/desirable + +## Namespace punk::fileline Core API functions for punk::fileline -## Namespace punk::fileline::lib +## Namespace punk::fileline::lib - - __lib::range\_spans\_chunk\_boundaries__ *start* *end* *chunksize* + - __lib::range\_spans\_chunk\_boundaries__ *start* *end* *chunksize* Takes start and end offset, generally representing bytes or character indices, and computes a list of boundaries at multiples of the chunksize @@ -339,10 +384,23 @@ Core API functions for punk::fileline # Internal -## Namespace punk::fileline::system +## Namespace punk::fileline::system Internal functions that are not part of the API +## Namespace punk::fileline::ansi + +These are ansi functions imported from punk::ansi \- or no\-ops if that package is +unavailable + +See __punk::ansi__ for documentation + + - __ansi::a__ + + - __ansi::a\+__ + + - __ansi::stripansi__ + # KEYWORDS [file](\.\./\.\./\.\./index\.md\#file), [module](\.\./\.\./\.\./index\.md\#module), diff --git a/src/embedded/www/doc/files/punk/_module_fileline-0.1.0.tm.html b/src/embedded/www/doc/files/punk/_module_fileline-0.1.0.tm.html index 5519d64f..590bcd09 100644 --- a/src/embedded/www/doc/files/punk/_module_fileline-0.1.0.tm.html +++ b/src/embedded/www/doc/files/punk/_module_fileline-0.1.0.tm.html @@ -117,18 +117,20 @@
CR line-endings that are intended to be interpreted as such should be mapped to something else before the data is supplied to this module.
+packages that add functionality but aren't strictly required
+punk::ansi
+- recommended for class::textinfo chunk_boundary_display
punk::char
+- recommended for class::textinfo chunk_boundary_display
overtype
+- recommended for class::textinfo chunk_boundary_display
class definitions
CLASS textinfo
@@ -217,10 +235,11 @@ orobjName chunk 0 end
Number of bytes/characters in the raw data of the file
Returns a string displaying the boundaries at chunksize bytes between chunkstart and chunkend
+Defaults to using ansi colour if punk::ansi module is available. Use -ansi 0 to disable colour
Number of lines in the raw data of the file, counted as per the policy in effect
generate a list of lines from the stored raw data chunk and keep a map of line-endings indexed by lineindex
Reconstructs and returns the raw line using the payload and per-line stored line-ending metadata
A 'line' may be returned without a line-ending if the unerlying chunk had trailing data without a line-ending (or the chunk was loaded under a non-standard -policy setting)
@@ -252,44 +271,51 @@ orReturn a dict of the metadata and text for the line indicated by the zero-based lineindex
This returns the same info as the linemeta with an added key of 'payload' which is the text of the line without line-ending.
The 'payload' value is the same as is returned from the linepayload method.
Returns list of lineinfo dicts for each line in line index range startidx to endidx
Return a list of dicts each with structure like the result of the lineinfo method - but possibly with extra keys for truncation information if -show_truncated 1 is supplied
The truncation key in a lineinfo dict may be returned for first and/or last line in the resulting list.
truncation shows the shortened (missing bytes on left and/or right side) part of the entire line (potentially including line-ending or even partial line-ending)
Note that this truncation info is only in the return value of this method - and will not be reflected in lineinfo queries to the main chunk.
A helper to return any Tcl-style end end-x values given to startidx or endidx; converted to their specific values based on the current state of the underlying line data
This is used internally by API functions such as line to enable it to accept more expressive indices
A helper to return any Tcl-style end end-x entries supplied to startidx or endidx; converted to their specific values based on the current state of the underlying chunk data
A utility to convert some of the of Tcl-style list-index expressions such as end, end-1 etc to valid indices in the range 0 to the supplied max
Basic addition and subtraction expressions such as 4-1 5+2 are accepted
startidx higher than endidx is allowed
Unlike Tcl's index expressions - we raise an error if the calculated index is out of bounds 0 to max
generate a list of lines from the current state of the stored raw data chunk and keep a map of line-endings indexed by lineindex
+This is called automatically by the Constructor during object creation
+It is exposed in the API experimentally - as chunk and line manipulation functions are considered.
+TODO - review whether such manual control will be necessary/desirable
Secondary functions that are part of the API
Takes start and end offset, generally representing bytes or character indices, and computes a list of boundaries at multiples of the chunksize that are spanned by the start and end range.
Internal functions that are not part of the API
These are ansi functions imported from punk::ansi - or no-ops if that package is unavailable
+See punk::ansi for documentation
+