Version 3 of Tcl/Tk man pages comments page

Updated 2004-06-28 17:52:21 by TV

started by Theo Verelst

Manual page discussions are (temporarily ?) stored here, at least by me for the moment, maybe this can be a transient page, or at least one which gets emptied with the next release.


Binary

Lsrge number of options, I didn't go over all the option examples, even though they're important. Bottom example:

 EXAMPLES
       This  is  a procedure write a Tcl string to a binary-encoded channel as
       UTF-8 data preceded by a length word: proc writeString {channel string}
       {
           set data [encoding convertto utf-8 $string]
           puts -nonewline [binary format Ia* \
                   [string length $data] $data] }

       This  procedure  reads  a string from a channel that was written by the
       previously presented writeString procedure: proc readString {channel} {
           if {![binary scan [read $channel 4] I length]} {
               error "missing length"
           }
           set data [read $channel $length]
           return [encoding convertfrom utf-8 $data] }

Formatting issue.

Interesting.

Mind that a non-blocking read of 4 can stall your whole program in case of error...

dict

oops a command I don't know about.

Mm, I'd need to know about the concept of a dict, I can't really find a neutral explanation for that on the page.

I'd guess this is the format that could appear in the example, in my MAN they are all messed up:

 EXAMPLE
       A localizable version of string toupper: 
       # Set up the  basic  C  locale
       set  capital  [dict  create  C  [dict  create]]
       foreach  c {abcdefghijklmnopqrstuvwxyz} {
           dict set capital C $c [string toupper $c] 
       }

       # English locales can luckily share the "C" locale
       dict set capital  en [dict get $capital C]
       dict set capital en_US [dict get $capital C]
       dict set capital en_GB [dict get $capital C]

       # ... and so on for other supported languages ...

       # Now get the mapping for the current locale and use  it.
       set  upperCaseMap  [dict  get  $capital  $env(LANG)]
       set  upperCase  [string map $upperCaseMap $string]

Tcl_GetEncoding(3)

Veeery long argument list.

examples in my (cygwin) man appear as:

       typedef   struct  Tcl_EncodingType  {       CONST  char  *encodingName;
            Tcl_EncodingConvertProc  *toUtfProc;       Tcl_EncodingConvertProc
       *fromUtfProc;        Tcl_EncodingFreeProc   *freeProc;       ClientData
       clientData;      int nullSize; } Tcl_EncodingType;

...

eof

ok, understandable, -recordsize I didn't know. First line of example source code isn't on a new line.

''