Tcl Source Code

Changes On Branch info-linkedname
Login
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch info-linkedname Excluding Merge-Ins

This is equivalent to a diff from 49e104fa48 to ee78d5d0a9

2018-10-30
19:16
Handle global/namespace variables better. Leaf check-in: ee78d5d0a9 user: dkf tags: info-linkedname
18:57
Tidy up further (comments, helper macros). More tests check-in: e9b8f2dd62 user: dkf tags: info-linkedname
2017-11-13
08:59
merge tcl-9-cleanup (and also a minor bug-fix from core-8-branch). check-in: b03c4194f0 user: jan.nijtmans tags: trunk
2017-11-09
15:47
Rebase branch to trunk. check-in: f714eca8f2 user: dgp tags: dgp-refactor
14:44
merge trunk check-in: d27981d722 user: dgp tags: no-wideint
14:40
merge trunk Closed-Leaf check-in: 844ae11ba0 user: dgp tags: tcl-9-cleanup
13:46
merge trunk check-in: a10fc87c05 user: dgp tags: dgp-properbytearray
12:52
merge trunk check-in: 54f289e311 user: jan.nijtmans tags: novem
12:51
merge core-8-branch check-in: 49e104fa48 user: jan.nijtmans tags: trunk
12:50
merge core-8-6-branch check-in: ef4cc04bc1 user: jan.nijtmans tags: core-8-branch
2017-11-08
09:38
merge core-8-branch check-in: 3885b08997 user: jan.nijtmans tags: trunk

Changes to .fossil-settings/crlf-glob.

     8      8   libtommath/*.vcproj
     9      9   tools/tcl.hpj.in
    10     10   tools/tcl.wse.in
    11     11   win/buildall.vc.bat
    12     12   win/coffbase.txt
    13     13   win/makefile.vc
    14     14   win/rules.vc
           15  +win/rules-ext.vc
           16  +win/targets.vc
    15     17   win/tcl.dsp
    16     18   win/tcl.dsw
    17     19   win/tcl.hpj.in

Deleted .fossil-settings/crnl-glob.

     1         -compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
     2         -compat/zlib/contrib/vstudio/readme.txt
     3         -compat/zlib/contrib/vstudio/*/zlib.rc
     4         -compat/zlib/win32/*.txt
     5         -compat/zlib/win64/*.txt
     6         -libtommath/*.dsp
     7         -libtommath/*.sln
     8         -libtommath/*.vcproj
     9         -tools/tcl.hpj.in
    10         -tools/tcl.wse.in
    11         -win/buildall.vc.bat
    12         -win/coffbase.txt
    13         -win/makefile.vc
    14         -win/rules.vc
    15         -win/tcl.dsp
    16         -win/tcl.dsw
    17         -win/tcl.hpj.in

Changes to .fossil-settings/ignore-glob.

    40     40   unix/dltest.marker
    41     41   unix/tcl.pc
    42     42   unix/tclIndex
    43     43   unix/pkgs/*
    44     44   win/Debug*
    45     45   win/Release*
    46     46   win/pkgs/*
           47  +win/coffbase.txt
    47     48   win/tcl.hpj
    48     49   win/nmhlp-out.txt

Added .github/ISSUE_TEMPLATE.md.

            1  +Important Note
            2  +==========
            3  +Please do not file issues with Tcl on Github. They are unlikely to be noticed in a timely fashion. Tcl issues are hosted in the [tcl fossil repository on core.tcl.tk](https://core.tcl.tk/tcl/tktnew); please post them there.

Added .github/PULL_REQUEST_TEMPLATE.md.

            1  +Important Note
            2  +==========
            3  +Please do not file pull requests with Tcl on Github. They are unlikely to be noticed in a timely fashion. Tcl issues (including patches) are hosted in the [tcl fossil repository on core.tcl.tk](https://core.tcl.tk/tcl/tktnew); please post them there.

Changes to .project.

     1      1   <?xml version="1.0" encoding="UTF-8"?>
     2      2   <projectDescription>
     3         -	<name>tcl9</name>
            3  +	<name>tcl8</name>
     4      4   	<comment></comment>
     5      5   	<projects>
     6      6   	</projects>
     7      7   	<buildSpec>
     8      8   	</buildSpec>
     9      9   	<natures>
    10     10   	</natures>
    11     11   </projectDescription>

Changes to ChangeLog.2007.

  1422   1422   	an expr syntax error (masked by a [catch]).
  1423   1423   
  1424   1424   	* generic/tclCompCmds.c (TclCompileReturnCmd):	Added crash protection
  1425   1425   	to handle callers other than TclCompileScript() failing to meet the
  1426   1426   	initialization assumptions of the TIP 280 code in CompileWord().
  1427   1427   
  1428   1428   	* generic/tclCompExpr.c:	Suppress the attempt to convert to
  1429         -	numeric when pre-compiling a constant expresion indicates an error.
         1429  +	numeric when pre-compiling a constant expression indicates an error.
  1430   1430   
  1431   1431   2007-08-22  Miguel Sofer  <[email protected]>
  1432   1432   
  1433   1433   	* generic/tclExecute.c (TEBC): disable the new shortcut to frequent
  1434   1434   	INSTs for debug builds. REVERTED (collision with alternative fix)
  1435   1435   
  1436   1436   2007-08-21  Don Porter	<[email protected]>

Changes to README.

     1      1   README:  Tcl
     2         -    This is the Tcl 9.0a0 source distribution.
            2  +    This is the Tcl 8.7a2 source distribution.
     3      3   	http://sourceforge.net/projects/tcl/files/Tcl/
     4      4       You can get any source release of Tcl from the URL above.
     5      5   
     6      6   Contents
     7      7   --------
     8      8       1. Introduction
     9      9       2. Documentation

Changes to changes.

  8230   8230   
  8231   8231   2013-05-06 (platform support) Cygwin64 (nijtmans)
  8232   8232   
  8233   8233   2013-05-15 (enhancement) Improved [list {*}...] compile (fellows)
  8234   8234   
  8235   8235   2013-05-16 (platform support) mingw-4.0 (nijtmans)
  8236   8236   
  8237         -2013-05-19 (platform support) FreeBSD updates (gahr)
         8237  +2013-05-19 (platform support) FreeBSD updates (cerutti)
  8238   8238   
  8239   8239   2013-05-20 (bug fix)[3613567] access error temp file creation (keene)
  8240   8240   
  8241   8241   2013-05-20 (bug fix)[3613569] temp file open fail can crash [load] (keene)
  8242   8242   
  8243   8243   2013-05-22 (bug fix)[3613609] [lsort -nocase] failed on non-ASCII (fellows)
  8244   8244   
................................................................................
  8653   8653   2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny)
  8654   8654   
  8655   8655   2016-05-13 (bug) registry package support any Unicode env (nijtmans)
  8656   8656   => registry 1.3.2
  8657   8657   
  8658   8658   2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows)
  8659   8659   
  8660         -2016-06-02 (TIP 447) execution time verbosity option (gahr)
         8660  +2016-06-02 (TIP 447) execution time verbosity option (cerutti)
  8661   8661   => tcltest 2.4.0
  8662   8662   
  8663   8663   2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter)
  8664   8664   
  8665   8665   2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric)
  8666   8666   
  8667   8667   2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter)
................................................................................
  8792   8792   
  8793   8793   2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter)
  8794   8794   
  8795   8795   2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans)
  8796   8796   
  8797   8797   --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details
  8798   8798   
         8799  +2017-08-10 [array names -regexp] supports backrefs (goth)
         8800  +
         8801  +2017-08-10 Fix gcc build failures due to #pragma placement (cassoff,fellows)
         8802  +
         8803  +2017-08-29 (bug)[b50fb2] exec redir append stdout and stderr to file (coulter)
         8804  +
         8805  +2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
         8806  +=> http 2.8.12
         8807  +
         8808  +2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
         8809  +
         8810  +2017-10-19 (bug)[1a5655] [info * methods] includes mixins (fellows)
         8811  +
         8812  +2017-10-23 tzdata updated to Olson's tzdata2017c (jima)
         8813  +
         8814  +2017-10-24 (bug)[fc1409] segfault in method cloning, oo-15.15 (coulter,fellows)
         8815  +
         8816  +2017-11-03 (bug)[6f2f83] More robust [load] for ReactOS (werner)
         8817  +
         8818  +2017-11-08 (bug)[3298012] Stop crash when hash tables overflow 32 bits (porter)
         8819  +
         8820  +2017-11-14 (bug)[5d6de6] Close failing case of [package prefer stable] (kupries)
         8821  +
         8822  +2017-11-17 (bug)[fab924] Fix misleading [load] message on Windows (oehlmann)
         8823  +
         8824  +2017-12-05 (bug)[4f6a1e] Crash when ensemble map and list are same (sebres)
         8825  +
         8826  +2017-12-06 (bug)[ce3a21] file normalize failure when tail is empty (porter)
         8827  +
         8828  +2017-12-08 (new)[TIP 477] nmake build system reform (nadkarni)
         8829  +
         8830  +2017-12-19 (bug)[586e71] EvalObjv exception handling at level #0 (sebres,porter)
         8831  +
         8832  +--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tcl/ for details
         8833  +
         8834  +Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7,
         8835  +plus the following, which focuses on the high-level feature changes
         8836  +in this changeset (new minor version) rather than bug fixes:
         8837  +
  8799   8838   2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter)
  8800   8839           *** POTENTIAL INCOMPATIBILITY ***
  8801   8840   
  8802   8841   2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter)
  8803   8842   
  8804   8843   2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans)
  8805   8844   
................................................................................
  8832   8871   
  8833   8872   2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows)
  8834   8873   => TclOO 1.2.0
  8835   8874   
  8836   8875   2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin)
  8837   8876   
  8838   8877   2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann)
  8839         -=> http 2.8.12
  8840   8878   
  8841   8879   2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter)
  8842   8880   
  8843   8881   --- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details
         8882  +
         8883  +2018-03-12 (TIP 490) add oo support for msgcat => msgcat 1.7.0 (oehlmann)
         8884  +
         8885  +2018-03-12 (TIP 499) custom locale preference list (oehlmann)
         8886  +=> msgcat 1.7.0

Deleted compat/float.h.

     1         -/*
     2         - * float.h --
     3         - *
     4         - *	This is a dummy header file to #include in Tcl when there
     5         - *	is no float.h in /usr/include.  Right now this file is empty:
     6         - *	Tcl contains #ifdefs to deal with the lack of definitions;
     7         - *	all it needs is for the #include statement to work.
     8         - *
     9         - * Copyright (c) 1993 The Regents of the University of California.
    10         - * Copyright (c) 1994 Sun Microsystems, Inc.
    11         - *
    12         - * See the file "license.terms" for information on usage and redistribution
    13         - * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    14         - */

Changes to compat/zlib/contrib/minizip/minizip.c.

     8      8            Modifications of Unzip for Zip64
     9      9            Copyright (C) 2007-2008 Even Rouault
    10     10   
    11     11            Modifications for Zip64 support on both zip and unzip
    12     12            Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
    13     13   */
    14     14   
    15         -
    16     15   #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
    17     16           #ifndef __USE_FILE_OFFSET64
    18     17                   #define __USE_FILE_OFFSET64
    19     18           #endif
    20     19           #ifndef __USE_LARGEFILE64
    21     20                   #define __USE_LARGEFILE64
    22     21           #endif
................................................................................
    24     23                   #define _LARGEFILE64_SOURCE
    25     24           #endif
    26     25           #ifndef _FILE_OFFSET_BIT
    27     26                   #define _FILE_OFFSET_BIT 64
    28     27           #endif
    29     28   #endif
    30     29   
    31         -#ifdef __APPLE__
           30  +#if defined(__APPLE__) || defined(IOAPI_NO_64)
    32     31   // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
    33     32   #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
    34     33   #define FTELLO_FUNC(stream) ftello(stream)
    35     34   #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
    36     35   #else
    37     36   #define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
    38     37   #define FTELLO_FUNC(stream) ftello64(stream)
    39     38   #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
    40     39   #endif
    41     40   
    42         -
    43         -
           41  +#include "tinydir.h"
    44     42   #include <stdio.h>
    45     43   #include <stdlib.h>
    46     44   #include <string.h>
    47     45   #include <time.h>
    48     46   #include <errno.h>
    49     47   #include <fcntl.h>
    50     48   
................................................................................
   168    166       printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
   169    167       printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
   170    168   }
   171    169   
   172    170   void do_help()
   173    171   {
   174    172       printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
          173  +           "  -r  Scan directories recursively\n" \
   175    174              "  -o  Overwrite existing file.zip\n" \
   176    175              "  -a  Append to existing file.zip\n" \
   177    176              "  -0  Store only\n" \
   178    177              "  -1  Compress faster\n" \
   179    178              "  -9  Compress better\n\n" \
   180    179              "  -j  exclude path. store only the file name.\n\n");
   181    180   }
................................................................................
   238    237        largeFile = 1;
   239    238   
   240    239                   fclose(pFile);
   241    240     }
   242    241   
   243    242    return largeFile;
   244    243   }
          244  +
          245  +void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
          246  +    FILE * fin;
          247  +    int size_read;
          248  +    const char *savefilenameinzip;
          249  +    zip_fileinfo zi;
          250  +    unsigned long crcFile=0;
          251  +    int zip64 = 0;
          252  +    int err=0;
          253  +    int size_buf=WRITEBUFFERSIZE;
          254  +    unsigned char buf[WRITEBUFFERSIZE];
          255  +    zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
          256  +    zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
          257  +    zi.dosDate = 0;
          258  +    zi.internal_fa = 0;
          259  +    zi.external_fa = 0;
          260  +    filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
          261  +
          262  +/*
          263  +    err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
          264  +                     NULL,0,NULL,0,NULL / * comment * /,
          265  +                     (opt_compress_level != 0) ? Z_DEFLATED : 0,
          266  +                     opt_compress_level);
          267  +*/
          268  +    if ((password != NULL) && (err==ZIP_OK))
          269  +        err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
          270  +
          271  +    zip64 = isLargeFile(filenameinzip);
          272  +
          273  +   /* The path name saved, should not include a leading slash. */
          274  +   /*if it did, windows/xp and dynazip couldn't read the zip file. */
          275  +     savefilenameinzip = filenameinzip;
          276  +     while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
          277  +     {
          278  +         savefilenameinzip++;
          279  +     }
          280  +
          281  +     /*should the zip file contain any path at all?*/
          282  +     if( opt_exclude_path )
          283  +     {
          284  +         const char *tmpptr;
          285  +         const char *lastslash = 0;
          286  +         for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
          287  +         {
          288  +             if( *tmpptr == '\\' || *tmpptr == '/')
          289  +             {
          290  +                 lastslash = tmpptr;
          291  +             }
          292  +         }
          293  +         if( lastslash != NULL )
          294  +         {
          295  +             savefilenameinzip = lastslash+1; // base filename follows last slash.
          296  +         }
          297  +     }
          298  +
          299  +     /**/
          300  +    err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
          301  +                     NULL,0,NULL,0,NULL /* comment*/,
          302  +                     (opt_compress_level != 0) ? Z_DEFLATED : 0,
          303  +                     opt_compress_level,0,
          304  +                     /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
          305  +                     -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
          306  +                     password,crcFile, zip64);
          307  +
          308  +    if (err != ZIP_OK)
          309  +        printf("error in opening %s in zipfile\n",filenameinzip);
          310  +    else
          311  +    {
          312  +        fin = FOPEN_FUNC(filenameinzip,"rb");
          313  +        if (fin==NULL)
          314  +        {
          315  +            err=ZIP_ERRNO;
          316  +            printf("error in opening %s for reading\n",filenameinzip);
          317  +        }
          318  +    }
          319  +
          320  +    if (err == ZIP_OK)
          321  +        do
          322  +        {
          323  +            err = ZIP_OK;
          324  +            size_read = (int)fread(buf,1,size_buf,fin);
          325  +            if (size_read < size_buf)
          326  +                if (feof(fin)==0)
          327  +            {
          328  +                printf("error in reading %s\n",filenameinzip);
          329  +                err = ZIP_ERRNO;
          330  +            }
          331  +
          332  +            if (size_read>0)
          333  +            {
          334  +                err = zipWriteInFileInZip (zf,buf,size_read);
          335  +                if (err<0)
          336  +                {
          337  +                    printf("error in writing %s in the zipfile\n",
          338  +                                     filenameinzip);
          339  +                }
          340  +
          341  +            }
          342  +        } while ((err == ZIP_OK) && (size_read>0));
          343  +
          344  +    if (fin)
          345  +        fclose(fin);
          346  +
          347  +    if (err<0)
          348  +        err=ZIP_ERRNO;
          349  +    else
          350  +    {
          351  +        err = zipCloseFileInZip(zf);
          352  +        if (err!=ZIP_OK)
          353  +            printf("error in closing %s in the zipfile\n",
          354  +                        filenameinzip);
          355  +    }
          356  +}
          357  +
          358  +
          359  +void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
          360  +    tinydir_dir dir;
          361  +    int i;
          362  +    char newname[512];
          363  +
          364  +    tinydir_open_sorted(&dir, filenameinzip);
          365  +
          366  +    for (i = 0; i < dir.n_files; i++)
          367  +    {
          368  +        tinydir_file file;
          369  +        tinydir_readfile_n(&dir, &file, i);
          370  +        if(strcmp(file.name,".")==0) continue;
          371  +        if(strcmp(file.name,"..")==0) continue;
          372  +        sprintf(newname,"%s/%s",dir.path,file.name);
          373  +        if (file.is_dir)
          374  +        {
          375  +            addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
          376  +        } else {
          377  +            addFileToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
          378  +        }
          379  +    }
          380  +
          381  +    tinydir_close(&dir);
          382  +}
          383  +
   245    384   
   246    385   int main(argc,argv)
   247    386       int argc;
   248    387       char *argv[];
   249    388   {
   250    389       int i;
   251         -    int opt_overwrite=0;
          390  +    int opt_recursive=0;
          391  +    int opt_overwrite=1;
   252    392       int opt_compress_level=Z_DEFAULT_COMPRESSION;
   253    393       int opt_exclude_path=0;
   254    394       int zipfilenamearg = 0;
   255    395       char filename_try[MAXFILENAME+16];
   256    396       int zipok;
   257    397       int err=0;
   258    398       int size_buf=0;
................................................................................
   281    421                           opt_overwrite = 1;
   282    422                       if ((c=='a') || (c=='A'))
   283    423                           opt_overwrite = 2;
   284    424                       if ((c>='0') && (c<='9'))
   285    425                           opt_compress_level = c-'0';
   286    426                       if ((c=='j') || (c=='J'))
   287    427                           opt_exclude_path = 1;
   288         -
          428  +                    if ((c=='r') || (c=='R'))
          429  +                        opt_recursive = 1;
   289    430                       if (((c=='p') || (c=='P')) && (i+1<argc))
   290    431                       {
   291    432                           password=argv[i+1];
   292    433                           i++;
   293    434                       }
   294    435                   }
   295    436               }
................................................................................
   388    529   
   389    530           for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
   390    531           {
   391    532               if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
   392    533                     ((argv[i][1]=='o') || (argv[i][1]=='O') ||
   393    534                      (argv[i][1]=='a') || (argv[i][1]=='A') ||
   394    535                      (argv[i][1]=='p') || (argv[i][1]=='P') ||
          536  +                   (argv[i][1]=='r') || (argv[i][1]=='R') ||
   395    537                      ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
   396    538                     (strlen(argv[i]) == 2)))
   397    539               {
   398         -                FILE * fin;
   399         -                int size_read;
   400         -                const char* filenameinzip = argv[i];
   401         -                const char *savefilenameinzip;
   402         -                zip_fileinfo zi;
   403         -                unsigned long crcFile=0;
   404         -                int zip64 = 0;
   405         -
   406         -                zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
   407         -                zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
   408         -                zi.dosDate = 0;
   409         -                zi.internal_fa = 0;
   410         -                zi.external_fa = 0;
   411         -                filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
   412         -
   413         -/*
   414         -                err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
   415         -                                 NULL,0,NULL,0,NULL / * comment * /,
   416         -                                 (opt_compress_level != 0) ? Z_DEFLATED : 0,
   417         -                                 opt_compress_level);
   418         -*/
   419         -                if ((password != NULL) && (err==ZIP_OK))
   420         -                    err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
   421         -
   422         -                zip64 = isLargeFile(filenameinzip);
   423         -
   424         -                                                         /* The path name saved, should not include a leading slash. */
   425         -               /*if it did, windows/xp and dynazip couldn't read the zip file. */
   426         -                 savefilenameinzip = filenameinzip;
   427         -                 while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
   428         -                 {
   429         -                     savefilenameinzip++;
   430         -                 }
   431         -
   432         -                 /*should the zip file contain any path at all?*/
   433         -                 if( opt_exclude_path )
   434         -                 {
   435         -                     const char *tmpptr;
   436         -                     const char *lastslash = 0;
   437         -                     for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
   438         -                     {
   439         -                         if( *tmpptr == '\\' || *tmpptr == '/')
   440         -                         {
   441         -                             lastslash = tmpptr;
   442         -                         }
   443         -                     }
   444         -                     if( lastslash != NULL )
   445         -                     {
   446         -                         savefilenameinzip = lastslash+1; // base filename follows last slash.
   447         -                     }
   448         -                 }
   449         -
   450         -                 /**/
   451         -                err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
   452         -                                 NULL,0,NULL,0,NULL /* comment*/,
   453         -                                 (opt_compress_level != 0) ? Z_DEFLATED : 0,
   454         -                                 opt_compress_level,0,
   455         -                                 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
   456         -                                 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
   457         -                                 password,crcFile, zip64);
   458         -
   459         -                if (err != ZIP_OK)
   460         -                    printf("error in opening %s in zipfile\n",filenameinzip);
   461         -                else
   462         -                {
   463         -                    fin = FOPEN_FUNC(filenameinzip,"rb");
   464         -                    if (fin==NULL)
   465         -                    {
   466         -                        err=ZIP_ERRNO;
   467         -                        printf("error in opening %s for reading\n",filenameinzip);
   468         -                    }
   469         -                }
   470         -
   471         -                if (err == ZIP_OK)
   472         -                    do
   473         -                    {
   474         -                        err = ZIP_OK;
   475         -                        size_read = (int)fread(buf,1,size_buf,fin);
   476         -                        if (size_read < size_buf)
   477         -                            if (feof(fin)==0)
   478         -                        {
   479         -                            printf("error in reading %s\n",filenameinzip);
   480         -                            err = ZIP_ERRNO;
   481         -                        }
   482         -
   483         -                        if (size_read>0)
   484         -                        {
   485         -                            err = zipWriteInFileInZip (zf,buf,size_read);
   486         -                            if (err<0)
   487         -                            {
   488         -                                printf("error in writing %s in the zipfile\n",
   489         -                                                 filenameinzip);
   490         -                            }
   491         -
   492         -                        }
   493         -                    } while ((err == ZIP_OK) && (size_read>0));
   494         -
   495         -                if (fin)
   496         -                    fclose(fin);
   497         -
   498         -                if (err<0)
   499         -                    err=ZIP_ERRNO;
   500         -                else
   501         -                {
   502         -                    err = zipCloseFileInZip(zf);
   503         -                    if (err!=ZIP_OK)
   504         -                        printf("error in closing %s in the zipfile\n",
   505         -                                    filenameinzip);
          540  +                if(opt_recursive) {
          541  +                    addPathToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
          542  +                } else {
          543  +                    addFileToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
   506    544                   }
   507    545               }
   508    546           }
   509    547           errclose = zipClose(zf,NULL);
   510    548           if (errclose != ZIP_OK)
   511    549               printf("error in closing %s\n",filename_try);
   512    550       }

Added compat/zlib/contrib/minizip/tinydir.h.

            1  +/*
            2  +Copyright (c) 2013-2017, tinydir authors:
            3  +- Cong Xu
            4  +- Lautis Sun
            5  +- Baudouin Feildel
            6  +- Andargor <[email protected]>
            7  +All rights reserved.
            8  +
            9  +Redistribution and use in source and binary forms, with or without
           10  +modification, are permitted provided that the following conditions are met:
           11  +
           12  +1. Redistributions of source code must retain the above copyright notice, this
           13  +   list of conditions and the following disclaimer.
           14  +2. Redistributions in binary form must reproduce the above copyright notice,
           15  +   this list of conditions and the following disclaimer in the documentation
           16  +   and/or other materials provided with the distribution.
           17  +
           18  +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
           19  +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
           20  +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
           21  +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
           22  +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
           23  +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
           24  +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
           25  +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
           26  +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
           27  +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           28  +*/
           29  +#ifndef TINYDIR_H
           30  +#define TINYDIR_H
           31  +
           32  +#ifdef __cplusplus
           33  +extern "C" {
           34  +#endif
           35  +
           36  +#if ((defined _UNICODE) && !(defined UNICODE))
           37  +#define UNICODE
           38  +#endif
           39  +
           40  +#if ((defined UNICODE) && !(defined _UNICODE))
           41  +#define _UNICODE
           42  +#endif
           43  +
           44  +#include <errno.h>
           45  +#include <stdlib.h>
           46  +#include <string.h>
           47  +#ifdef _MSC_VER
           48  +# define WIN32_LEAN_AND_MEAN
           49  +# include <windows.h>
           50  +# include <tchar.h>
           51  +# pragma warning(push)
           52  +# pragma warning (disable : 4996)
           53  +#else
           54  +# include <dirent.h>
           55  +# include <libgen.h>
           56  +# include <sys/stat.h>
           57  +# include <stddef.h>
           58  +#endif
           59  +#ifdef __MINGW32__
           60  +# include <tchar.h>
           61  +#endif
           62  +
           63  +
           64  +/* types */
           65  +
           66  +/* Windows UNICODE wide character support */
           67  +#if defined _MSC_VER || defined __MINGW32__
           68  +# define _tinydir_char_t TCHAR
           69  +# define TINYDIR_STRING(s) _TEXT(s)
           70  +# define _tinydir_strlen _tcslen
           71  +# define _tinydir_strcpy _tcscpy
           72  +# define _tinydir_strcat _tcscat
           73  +# define _tinydir_strcmp _tcscmp
           74  +# define _tinydir_strrchr _tcsrchr
           75  +# define _tinydir_strncmp _tcsncmp
           76  +#else
           77  +# define _tinydir_char_t char
           78  +# define TINYDIR_STRING(s) s
           79  +# define _tinydir_strlen strlen
           80  +# define _tinydir_strcpy strcpy
           81  +# define _tinydir_strcat strcat
           82  +# define _tinydir_strcmp strcmp
           83  +# define _tinydir_strrchr strrchr
           84  +# define _tinydir_strncmp strncmp
           85  +#endif
           86  +
           87  +#if (defined _MSC_VER || defined __MINGW32__)
           88  +# include <windows.h>
           89  +# define _TINYDIR_PATH_MAX MAX_PATH
           90  +#elif defined  __linux__
           91  +# include <limits.h>
           92  +# define _TINYDIR_PATH_MAX PATH_MAX
           93  +#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
           94  +# include <sys/param.h>
           95  +# if defined(BSD)
           96  +#  include <limits.h>
           97  +#  define _TINYDIR_PATH_MAX PATH_MAX
           98  +# endif
           99  +#endif
          100  +
          101  +#ifndef _TINYDIR_PATH_MAX
          102  +#define _TINYDIR_PATH_MAX 4096
          103  +#endif
          104  +
          105  +#ifdef _MSC_VER
          106  +/* extra chars for the "\\*" mask */
          107  +# define _TINYDIR_PATH_EXTRA 2
          108  +#else
          109  +# define _TINYDIR_PATH_EXTRA 0
          110  +#endif
          111  +
          112  +#define _TINYDIR_FILENAME_MAX 256
          113  +
          114  +#if (defined _MSC_VER || defined __MINGW32__)
          115  +#define _TINYDIR_DRIVE_MAX 3
          116  +#endif
          117  +
          118  +#ifdef _MSC_VER
          119  +# define _TINYDIR_FUNC static __inline
          120  +#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
          121  +# define _TINYDIR_FUNC static __inline__
          122  +#else
          123  +# define _TINYDIR_FUNC static inline
          124  +#endif
          125  +
          126  +/* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */
          127  +#ifdef TINYDIR_USE_READDIR_R
          128  +
          129  +/* readdir_r is a POSIX-only function, and may not be available under various
          130  + * environments/settings, e.g. MinGW. Use readdir fallback */
          131  +#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE ||\
          132  +	_POSIX_SOURCE
          133  +# define _TINYDIR_HAS_READDIR_R
          134  +#endif
          135  +#if _POSIX_C_SOURCE >= 200112L
          136  +# define _TINYDIR_HAS_FPATHCONF
          137  +# include <unistd.h>
          138  +#endif
          139  +#if _BSD_SOURCE || _SVID_SOURCE || \
          140  +	(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
          141  +# define _TINYDIR_HAS_DIRFD
          142  +# include <sys/types.h>
          143  +#endif
          144  +#if defined _TINYDIR_HAS_FPATHCONF && defined _TINYDIR_HAS_DIRFD &&\
          145  +	defined _PC_NAME_MAX
          146  +# define _TINYDIR_USE_FPATHCONF
          147  +#endif
          148  +#if defined __MINGW32__ || !defined _TINYDIR_HAS_READDIR_R ||\
          149  +	!(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX)
          150  +# define _TINYDIR_USE_READDIR
          151  +#endif
          152  +
          153  +/* Use readdir by default */
          154  +#else
          155  +# define _TINYDIR_USE_READDIR
          156  +#endif
          157  +
          158  +/* MINGW32 has two versions of dirent, ASCII and UNICODE*/
          159  +#ifndef _MSC_VER
          160  +#if (defined __MINGW32__) && (defined _UNICODE)
          161  +#define _TINYDIR_DIR _WDIR
          162  +#define _tinydir_dirent _wdirent
          163  +#define _tinydir_opendir _wopendir
          164  +#define _tinydir_readdir _wreaddir
          165  +#define _tinydir_closedir _wclosedir
          166  +#else
          167  +#define _TINYDIR_DIR DIR
          168  +#define _tinydir_dirent dirent
          169  +#define _tinydir_opendir opendir
          170  +#define _tinydir_readdir readdir
          171  +#define _tinydir_closedir closedir
          172  +#endif
          173  +#endif
          174  +
          175  +/* Allow user to use a custom allocator by defining _TINYDIR_MALLOC and _TINYDIR_FREE. */
          176  +#if    defined(_TINYDIR_MALLOC) &&  defined(_TINYDIR_FREE)
          177  +#elif !defined(_TINYDIR_MALLOC) && !defined(_TINYDIR_FREE)
          178  +#else
          179  +#error "Either define both alloc and free or none of them!"
          180  +#endif
          181  +
          182  +#if !defined(_TINYDIR_MALLOC)
          183  +	#define _TINYDIR_MALLOC(_size) malloc(_size)
          184  +	#define _TINYDIR_FREE(_ptr)    free(_ptr)
          185  +#endif /* !defined(_TINYDIR_MALLOC) */
          186  +
          187  +typedef struct tinydir_file
          188  +{
          189  +	_tinydir_char_t path[_TINYDIR_PATH_MAX];
          190  +	_tinydir_char_t name[_TINYDIR_FILENAME_MAX];
          191  +	_tinydir_char_t *extension;
          192  +	int is_dir;
          193  +	int is_reg;
          194  +
          195  +#ifndef _MSC_VER
          196  +#ifdef __MINGW32__
          197  +	struct _stat _s;
          198  +#else
          199  +	struct stat _s;
          200  +#endif
          201  +#endif
          202  +} tinydir_file;
          203  +
          204  +typedef struct tinydir_dir
          205  +{
          206  +	_tinydir_char_t path[_TINYDIR_PATH_MAX];
          207  +	int has_next;
          208  +	size_t n_files;
          209  +
          210  +	tinydir_file *_files;
          211  +#ifdef _MSC_VER
          212  +	HANDLE _h;
          213  +	WIN32_FIND_DATA _f;
          214  +#else
          215  +	_TINYDIR_DIR *_d;
          216  +	struct _tinydir_dirent *_e;
          217  +#ifndef _TINYDIR_USE_READDIR
          218  +	struct _tinydir_dirent *_ep;
          219  +#endif
          220  +#endif
          221  +} tinydir_dir;
          222  +
          223  +
          224  +/* declarations */
          225  +
          226  +_TINYDIR_FUNC
          227  +int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path);
          228  +_TINYDIR_FUNC
          229  +int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path);
          230  +_TINYDIR_FUNC
          231  +void tinydir_close(tinydir_dir *dir);
          232  +
          233  +_TINYDIR_FUNC
          234  +int tinydir_next(tinydir_dir *dir);
          235  +_TINYDIR_FUNC
          236  +int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file);
          237  +_TINYDIR_FUNC
          238  +int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i);
          239  +_TINYDIR_FUNC
          240  +int tinydir_open_subdir_n(tinydir_dir *dir, size_t i);
          241  +
          242  +_TINYDIR_FUNC
          243  +int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path);
          244  +_TINYDIR_FUNC
          245  +void _tinydir_get_ext(tinydir_file *file);
          246  +_TINYDIR_FUNC
          247  +int _tinydir_file_cmp(const void *a, const void *b);
          248  +#ifndef _MSC_VER
          249  +#ifndef _TINYDIR_USE_READDIR
          250  +_TINYDIR_FUNC
          251  +size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp);
          252  +#endif
          253  +#endif
          254  +
          255  +
          256  +/* definitions*/
          257  +
          258  +_TINYDIR_FUNC
          259  +int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path)
          260  +{
          261  +#ifndef _MSC_VER
          262  +#ifndef _TINYDIR_USE_READDIR
          263  +	int error;
          264  +	int size;	/* using int size */
          265  +#endif
          266  +#else
          267  +	_tinydir_char_t path_buf[_TINYDIR_PATH_MAX];
          268  +#endif
          269  +	_tinydir_char_t *pathp;
          270  +
          271  +	if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0)
          272  +	{
          273  +		errno = EINVAL;
          274  +		return -1;
          275  +	}
          276  +	if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
          277  +	{
          278  +		errno = ENAMETOOLONG;
          279  +		return -1;
          280  +	}
          281  +
          282  +	/* initialise dir */
          283  +	dir->_files = NULL;
          284  +#ifdef _MSC_VER
          285  +	dir->_h = INVALID_HANDLE_VALUE;
          286  +#else
          287  +	dir->_d = NULL;
          288  +#ifndef _TINYDIR_USE_READDIR
          289  +	dir->_ep = NULL;
          290  +#endif
          291  +#endif
          292  +	tinydir_close(dir);
          293  +
          294  +	_tinydir_strcpy(dir->path, path);
          295  +	/* Remove trailing slashes */
          296  +	pathp = &dir->path[_tinydir_strlen(dir->path) - 1];
          297  +	while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/')))
          298  +	{
          299  +		*pathp = TINYDIR_STRING('\0');
          300  +		pathp++;
          301  +	}
          302  +#ifdef _MSC_VER
          303  +	_tinydir_strcpy(path_buf, dir->path);
          304  +	_tinydir_strcat(path_buf, TINYDIR_STRING("\\*"));
          305  +#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
          306  +	dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0);
          307  +#else
          308  +	dir->_h = FindFirstFile(path_buf, &dir->_f);
          309  +#endif
          310  +	if (dir->_h == INVALID_HANDLE_VALUE)
          311  +	{
          312  +		errno = ENOENT;
          313  +#else
          314  +	dir->_d = _tinydir_opendir(path);
          315  +	if (dir->_d == NULL)
          316  +	{
          317  +#endif
          318  +		goto bail;
          319  +	}
          320  +
          321  +	/* read first file */
          322  +	dir->has_next = 1;
          323  +#ifndef _MSC_VER
          324  +#ifdef _TINYDIR_USE_READDIR
          325  +	dir->_e = _tinydir_readdir(dir->_d);
          326  +#else
          327  +	/* allocate dirent buffer for readdir_r */
          328  +	size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */
          329  +	if (size == -1) return -1;
          330  +	dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size);
          331  +	if (dir->_ep == NULL) return -1;
          332  +
          333  +	error = readdir_r(dir->_d, dir->_ep, &dir->_e);
          334  +	if (error != 0) return -1;
          335  +#endif
          336  +	if (dir->_e == NULL)
          337  +	{
          338  +		dir->has_next = 0;
          339  +	}
          340  +#endif
          341  +
          342  +	return 0;
          343  +
          344  +bail:
          345  +	tinydir_close(dir);
          346  +	return -1;
          347  +}
          348  +
          349  +_TINYDIR_FUNC
          350  +int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path)
          351  +{
          352  +	/* Count the number of files first, to pre-allocate the files array */
          353  +	size_t n_files = 0;
          354  +	if (tinydir_open(dir, path) == -1)
          355  +	{
          356  +		return -1;
          357  +	}
          358  +	while (dir->has_next)
          359  +	{
          360  +		n_files++;
          361  +		if (tinydir_next(dir) == -1)
          362  +		{
          363  +			goto bail;
          364  +		}
          365  +	}
          366  +	tinydir_close(dir);
          367  +
          368  +	if (tinydir_open(dir, path) == -1)
          369  +	{
          370  +		return -1;
          371  +	}
          372  +
          373  +	dir->n_files = 0;
          374  +	dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
          375  +	if (dir->_files == NULL)
          376  +	{
          377  +		goto bail;
          378  +	}
          379  +	while (dir->has_next)
          380  +	{
          381  +		tinydir_file *p_file;
          382  +		dir->n_files++;
          383  +
          384  +		p_file = &dir->_files[dir->n_files - 1];
          385  +		if (tinydir_readfile(dir, p_file) == -1)
          386  +		{
          387  +			goto bail;
          388  +		}
          389  +
          390  +		if (tinydir_next(dir) == -1)
          391  +		{
          392  +			goto bail;
          393  +		}
          394  +
          395  +		/* Just in case the number of files has changed between the first and
          396  +		second reads, terminate without writing into unallocated memory */
          397  +		if (dir->n_files == n_files)
          398  +		{
          399  +			break;
          400  +		}
          401  +	}
          402  +
          403  +	qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);
          404  +
          405  +	return 0;
          406  +
          407  +bail:
          408  +	tinydir_close(dir);
          409  +	return -1;
          410  +}
          411  +
          412  +_TINYDIR_FUNC
          413  +void tinydir_close(tinydir_dir *dir)
          414  +{
          415  +	if (dir == NULL)
          416  +	{
          417  +		return;
          418  +	}
          419  +
          420  +	memset(dir->path, 0, sizeof(dir->path));
          421  +	dir->has_next = 0;
          422  +	dir->n_files = 0;
          423  +	_TINYDIR_FREE(dir->_files);
          424  +	dir->_files = NULL;
          425  +#ifdef _MSC_VER
          426  +	if (dir->_h != INVALID_HANDLE_VALUE)
          427  +	{
          428  +		FindClose(dir->_h);
          429  +	}
          430  +	dir->_h = INVALID_HANDLE_VALUE;
          431  +#else
          432  +	if (dir->_d)
          433  +	{
          434  +		_tinydir_closedir(dir->_d);
          435  +	}
          436  +	dir->_d = NULL;
          437  +	dir->_e = NULL;
          438  +#ifndef _TINYDIR_USE_READDIR
          439  +	_TINYDIR_FREE(dir->_ep);
          440  +	dir->_ep = NULL;
          441  +#endif
          442  +#endif
          443  +}
          444  +
          445  +_TINYDIR_FUNC
          446  +int tinydir_next(tinydir_dir *dir)
          447  +{
          448  +	if (dir == NULL)
          449  +	{
          450  +		errno = EINVAL;
          451  +		return -1;
          452  +	}
          453  +	if (!dir->has_next)
          454  +	{
          455  +		errno = ENOENT;
          456  +		return -1;
          457  +	}
          458  +
          459  +#ifdef _MSC_VER
          460  +	if (FindNextFile(dir->_h, &dir->_f) == 0)
          461  +#else
          462  +#ifdef _TINYDIR_USE_READDIR
          463  +	dir->_e = _tinydir_readdir(dir->_d);
          464  +#else
          465  +	if (dir->_ep == NULL)
          466  +	{
          467  +		return -1;
          468  +	}
          469  +	if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0)
          470  +	{
          471  +		return -1;
          472  +	}
          473  +#endif
          474  +	if (dir->_e == NULL)
          475  +#endif
          476  +	{
          477  +		dir->has_next = 0;
          478  +#ifdef _MSC_VER
          479  +		if (GetLastError() != ERROR_SUCCESS &&
          480  +			GetLastError() != ERROR_NO_MORE_FILES)
          481  +		{
          482  +			tinydir_close(dir);
          483  +			errno = EIO;
          484  +			return -1;
          485  +		}
          486  +#endif
          487  +	}
          488  +
          489  +	return 0;
          490  +}
          491  +
          492  +_TINYDIR_FUNC
          493  +int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
          494  +{
          495  +	if (dir == NULL || file == NULL)
          496  +	{
          497  +		errno = EINVAL;
          498  +		return -1;
          499  +	}
          500  +#ifdef _MSC_VER
          501  +	if (dir->_h == INVALID_HANDLE_VALUE)
          502  +#else
          503  +	if (dir->_e == NULL)
          504  +#endif
          505  +	{
          506  +		errno = ENOENT;
          507  +		return -1;
          508  +	}
          509  +	if (_tinydir_strlen(dir->path) +
          510  +		_tinydir_strlen(
          511  +#ifdef _MSC_VER
          512  +			dir->_f.cFileName
          513  +#else
          514  +			dir->_e->d_name
          515  +#endif
          516  +		) + 1 + _TINYDIR_PATH_EXTRA >=
          517  +		_TINYDIR_PATH_MAX)
          518  +	{
          519  +		/* the path for the file will be too long */
          520  +		errno = ENAMETOOLONG;
          521  +		return -1;
          522  +	}
          523  +	if (_tinydir_strlen(
          524  +#ifdef _MSC_VER
          525  +			dir->_f.cFileName
          526  +#else
          527  +			dir->_e->d_name
          528  +#endif
          529  +		) >= _TINYDIR_FILENAME_MAX)
          530  +	{
          531  +		errno = ENAMETOOLONG;
          532  +		return -1;
          533  +	}
          534  +
          535  +	_tinydir_strcpy(file->path, dir->path);
          536  +	_tinydir_strcat(file->path, TINYDIR_STRING("/"));
          537  +	_tinydir_strcpy(file->name,
          538  +#ifdef _MSC_VER
          539  +		dir->_f.cFileName
          540  +#else
          541  +		dir->_e->d_name
          542  +#endif
          543  +	);
          544  +	_tinydir_strcat(file->path, file->name);
          545  +#ifndef _MSC_VER
          546  +#ifdef __MINGW32__
          547  +	if (_tstat(
          548  +#else
          549  +	if (stat(
          550  +#endif
          551  +		file->path, &file->_s) == -1)
          552  +	{
          553  +		return -1;
          554  +	}
          555  +#endif
          556  +	_tinydir_get_ext(file);
          557  +
          558  +	file->is_dir =
          559  +#ifdef _MSC_VER
          560  +		!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
          561  +#else
          562  +		S_ISDIR(file->_s.st_mode);
          563  +#endif
          564  +	file->is_reg =
          565  +#ifdef _MSC_VER
          566  +		!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
          567  +		(
          568  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) &&
          569  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
          570  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) &&
          571  +#ifdef FILE_ATTRIBUTE_INTEGRITY_STREAM
          572  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) &&
          573  +#endif
          574  +#ifdef FILE_ATTRIBUTE_NO_SCRUB_DATA
          575  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) &&
          576  +#endif
          577  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
          578  +			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY));
          579  +#else
          580  +		S_ISREG(file->_s.st_mode);
          581  +#endif
          582  +
          583  +	return 0;
          584  +}
          585  +
          586  +_TINYDIR_FUNC
          587  +int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
          588  +{
          589  +	if (dir == NULL || file == NULL)
          590  +	{
          591  +		errno = EINVAL;
          592  +		return -1;
          593  +	}
          594  +	if (i >= dir->n_files)
          595  +	{
          596  +		errno = ENOENT;
          597  +		return -1;
          598  +	}
          599  +
          600  +	memcpy(file, &dir->_files[i], sizeof(tinydir_file));
          601  +	_tinydir_get_ext(file);
          602  +
          603  +	return 0;
          604  +}
          605  +
          606  +_TINYDIR_FUNC
          607  +int tinydir_open_subdir_n(tinydir_dir *dir, size_t i)
          608  +{
          609  +	_tinydir_char_t path[_TINYDIR_PATH_MAX];
          610  +	if (dir == NULL)
          611  +	{
          612  +		errno = EINVAL;
          613  +		return -1;
          614  +	}
          615  +	if (i >= dir->n_files || !dir->_files[i].is_dir)
          616  +	{
          617  +		errno = ENOENT;
          618  +		return -1;
          619  +	}
          620  +
          621  +	_tinydir_strcpy(path, dir->_files[i].path);
          622  +	tinydir_close(dir);
          623  +	if (tinydir_open_sorted(dir, path) == -1)
          624  +	{
          625  +		return -1;
          626  +	}
          627  +
          628  +	return 0;
          629  +}
          630  +
          631  +/* Open a single file given its path */
          632  +_TINYDIR_FUNC
          633  +int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
          634  +{
          635  +	tinydir_dir dir;
          636  +	int result = 0;
          637  +	int found = 0;
          638  +	_tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
          639  +	_tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
          640  +	_tinydir_char_t *dir_name;
          641  +	_tinydir_char_t *base_name;
          642  +#if (defined _MSC_VER || defined __MINGW32__)
          643  +	_tinydir_char_t drive_buf[_TINYDIR_PATH_MAX];
          644  +	_tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX];
          645  +#endif
          646  +
          647  +	if (file == NULL || path == NULL || _tinydir_strlen(path) == 0)
          648  +	{
          649  +		errno = EINVAL;
          650  +		return -1;
          651  +	}
          652  +	if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
          653  +	{
          654  +		errno = ENAMETOOLONG;
          655  +		return -1;
          656  +	}
          657  +
          658  +	/* Get the parent path */
          659  +#if (defined _MSC_VER || defined __MINGW32__)
          660  +#if ((defined _MSC_VER) && (_MSC_VER >= 1400))
          661  +		_tsplitpath_s(
          662  +			path,
          663  +			drive_buf, _TINYDIR_DRIVE_MAX,
          664  +			dir_name_buf, _TINYDIR_FILENAME_MAX,
          665  +			file_name_buf, _TINYDIR_FILENAME_MAX,
          666  +			ext_buf, _TINYDIR_FILENAME_MAX);
          667  +#else
          668  +		_tsplitpath(
          669  +			path,
          670  +			drive_buf,
          671  +			dir_name_buf,
          672  +			file_name_buf,
          673  +			ext_buf);
          674  +#endif
          675  +
          676  +/* _splitpath_s not work fine with only filename and widechar support */
          677  +#ifdef _UNICODE
          678  +		if (drive_buf[0] == L'\xFEFE')
          679  +			drive_buf[0] = '\0';
          680  +		if (dir_name_buf[0] == L'\xFEFE')
          681  +			dir_name_buf[0] = '\0';
          682  +#endif
          683  +
          684  +	if (errno)
          685  +	{
          686  +		errno = EINVAL;
          687  +		return -1;
          688  +	}
          689  +	/* Emulate the behavior of dirname by returning "." for dir name if it's
          690  +	empty */
          691  +	if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
          692  +	{
          693  +		_tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
          694  +	}
          695  +	/* Concatenate the drive letter and dir name to form full dir name */
          696  +	_tinydir_strcat(drive_buf, dir_name_buf);
          697  +	dir_name = drive_buf;
          698  +	/* Concatenate the file name and extension to form base name */
          699  +	_tinydir_strcat(file_name_buf, ext_buf);
          700  +	base_name = file_name_buf;
          701  +#else
          702  +	_tinydir_strcpy(dir_name_buf, path);
          703  +	dir_name = dirname(dir_name_buf);
          704  +	_tinydir_strcpy(file_name_buf, path);
          705  +	base_name =basename(file_name_buf);
          706  +#endif
          707  +
          708  +	/* Open the parent directory */
          709  +	if (tinydir_open(&dir, dir_name) == -1)
          710  +	{
          711  +		return -1;
          712  +	}
          713  +
          714  +	/* Read through the parent directory and look for the file */
          715  +	while (dir.has_next)
          716  +	{
          717  +		if (tinydir_readfile(&dir, file) == -1)
          718  +		{
          719  +			result = -1;
          720  +			goto bail;
          721  +		}
          722  +		if (_tinydir_strcmp(file->name, base_name) == 0)
          723  +		{
          724  +			/* File found */
          725  +			found = 1;
          726  +			break;
          727  +		}
          728  +		tinydir_next(&dir);
          729  +	}
          730  +	if (!found)
          731  +	{
          732  +		result = -1;
          733  +		errno = ENOENT;
          734  +	}
          735  +
          736  +bail:
          737  +	tinydir_close(&dir);
          738  +	return result;
          739  +}
          740  +
          741  +_TINYDIR_FUNC
          742  +void _tinydir_get_ext(tinydir_file *file)
          743  +{
          744  +	_tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.'));
          745  +	if (period == NULL)
          746  +	{
          747  +		file->extension = &(file->name[_tinydir_strlen(file->name)]);
          748  +	}
          749  +	else
          750  +	{
          751  +		file->extension = period + 1;
          752  +	}
          753  +}
          754  +
          755  +_TINYDIR_FUNC
          756  +int _tinydir_file_cmp(const void *a, const void *b)
          757  +{
          758  +	const tinydir_file *fa = (const tinydir_file *)a;
          759  +	const tinydir_file *fb = (const tinydir_file *)b;
          760  +	if (fa->is_dir != fb->is_dir)
          761  +	{
          762  +		return -(fa->is_dir - fb->is_dir);
          763  +	}
          764  +	return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX);
          765  +}
          766  +
          767  +#ifndef _MSC_VER
          768  +#ifndef _TINYDIR_USE_READDIR
          769  +/*
          770  +The following authored by Ben Hutchings <[email protected]>
          771  +from https://womble.decadent.org.uk/readdir_r-advisory.html
          772  +*/
          773  +/* Calculate the required buffer size (in bytes) for directory      *
          774  +* entries read from the given directory handle.  Return -1 if this  *
          775  +* this cannot be done.                                              *
          776  +*                                                                   *
          777  +* This code does not trust values of NAME_MAX that are less than    *
          778  +* 255, since some systems (including at least HP-UX) incorrectly    *
          779  +* define it to be a smaller value.                                  */
          780  +_TINYDIR_FUNC
          781  +size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp)
          782  +{
          783  +	long name_max;
          784  +	size_t name_end;
          785  +	/* parameter may be unused */
          786  +	(void)dirp;
          787  +
          788  +#if defined _TINYDIR_USE_FPATHCONF
          789  +	name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
          790  +	if (name_max == -1)
          791  +#if defined(NAME_MAX)
          792  +		name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
          793  +#else
          794  +		return (size_t)(-1);
          795  +#endif
          796  +#elif defined(NAME_MAX)
          797  + 	name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
          798  +#else
          799  +#error "buffer size for readdir_r cannot be determined"
          800  +#endif
          801  +	name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1;
          802  +	return (name_end > sizeof(struct _tinydir_dirent) ?
          803  +		name_end : sizeof(struct _tinydir_dirent));
          804  +}
          805  +#endif
          806  +#endif
          807  +
          808  +#ifdef __cplusplus
          809  +}
          810  +#endif
          811  +
          812  +# if defined (_MSC_VER)
          813  +# pragma warning(pop)
          814  +# endif
          815  +
          816  +#endif

Changes to doc/CrtObjCmd.3.

     4      4   '\" See the file "license.terms" for information on usage and redistribution
     5      5   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      6   '\"
     7      7   .TH Tcl_CreateObjCommand 3 8.0 Tcl "Tcl Library Procedures"
     8      8   .so man.macros
     9      9   .BS
    10     10   .SH NAME
    11         -Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_DeleteCommandFromToken, Tcl_GetCommandInfo, Tcl_GetCommandInfoFromToken, Tcl_SetCommandInfo, Tcl_SetCommandInfoFromToken, Tcl_GetCommandName, Tcl_GetCommandFullName, Tcl_GetCommandFromObj \- implement new commands in C
           11  +Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_DeleteCommandFromToken, Tcl_GetCommandInfo, Tcl_GetCommandInfoFromToken, Tcl_SetCommandInfo, Tcl_SetCommandInfoFromToken, Tcl_GetCommandName, Tcl_GetCommandFullName, Tcl_GetCommandFromObj, Tcl_RegisterCommandTypeName, Tcl_GetCommandTypeName \- implement new commands in C
    12     12   .SH SYNOPSIS
    13     13   .nf
    14     14   \fB#include <tcl.h>\fR
    15     15   .sp
    16     16   Tcl_Command
    17     17   \fBTcl_CreateObjCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR)
    18     18   .sp
................................................................................
    38     38   \fBTcl_GetCommandName\fR(\fIinterp, token\fR)
    39     39   .sp
    40     40   void
    41     41   \fBTcl_GetCommandFullName\fR(\fIinterp, token, objPtr\fR)
    42     42   .sp
    43     43   Tcl_Command
    44     44   \fBTcl_GetCommandFromObj\fR(\fIinterp, objPtr\fR)
           45  +.sp
           46  +.VS "info cmdtype feature"
           47  +void
           48  +\fBTcl_RegisterCommandTypeName\fR(\fIproc, typeName\fR)
           49  +.sp
           50  +const char *
           51  +\fBTcl_GetCommandTypeName\fR(\fItoken\fR)
           52  +.VE "info cmdtype feature"
    45     53   .SH ARGUMENTS
    46     54   .AS Tcl_CmdDeleteProc *deleteProc in/out
    47     55   .AP Tcl_Interp *interp in
    48     56   Interpreter in which to create a new command or that contains a command.
    49     57   .AP char *cmdName in
    50     58   Name of command.
    51     59   .AP Tcl_ObjCmdProc *proc in
................................................................................
    61     69   Token for command, returned by previous call to \fBTcl_CreateObjCommand\fR.
    62     70   The command must not have been deleted.
    63     71   .AP Tcl_CmdInfo *infoPtr in/out
    64     72   Pointer to structure containing various information about a
    65     73   Tcl command.
    66     74   .AP Tcl_Obj *objPtr in
    67     75   Value containing the name of a Tcl command.
           76  +.AP "const char" *typeName in
           77  +Indicates the name of the type of command implementation associated
           78  +with a particular \fIproc\fR, or NULL to break the association.
    68     79   .BE
    69     80   .SH DESCRIPTION
    70     81   .PP
    71     82   \fBTcl_CreateObjCommand\fR defines a new command in \fIinterp\fR
    72     83   and associates it with procedure \fIproc\fR
    73     84   such that whenever \fIname\fR is
    74     85   invoked as a Tcl command (e.g., via a call to \fBTcl_EvalObjEx\fR)
................................................................................
   292    303   The name, including all namespace prefixes,
   293    304   is appended to the value specified by \fIobjPtr\fR.
   294    305   .PP
   295    306   \fBTcl_GetCommandFromObj\fR returns a token for the command
   296    307   specified by the name in a \fBTcl_Obj\fR.
   297    308   The command name is resolved relative to the current namespace.
   298    309   Returns NULL if the command is not found.
          310  +.PP
          311  +.VS "info cmdtype feature"
          312  +\fBTcl_RegisterCommandTypeName\fR is used to associate a name (the
          313  +\fItypeName\fR argument) with a particular implementation function so that it
          314  +can then be looked up with \fBTcl_GetCommandTypeName\fR, which in turn is
          315  +called with a command token that information is wanted for and which returns
          316  +the name of the type that was registered for the implementation function used
          317  +for that command. (The lookup functionality is surfaced virtually directly in Tcl via
          318  +\fBinfo cmdtype\fR.) If there is no function registered for a particular
          319  +function, the result will be the string literal
          320  +.QW \fBnative\fR .
          321  +The registration of a name can be undone by registering a mapping to NULL
          322  +instead. The result from \fBTcl_GetCommandTypeName\fR will be exactly that
          323  +string which was registered, and not a copy; use of a compile-time constant
          324  +string is \fIstrongly recommended\fR.
          325  +.VE "info cmdtype feature"
   299    326   .SH "SEE ALSO"
   300    327   Tcl_CreateCommand(3), Tcl_ResetResult(3), Tcl_SetObjResult(3)
   301    328   .SH KEYWORDS
   302    329   bind, command, create, delete, namespace, value

Changes to doc/Encoding.3.

   256    256   \fBTcl_ExternalToUtf\fR.
   257    257   .PP
   258    258   \fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR are
   259    259   Windows-only convenience
   260    260   functions for converting between UTF-8 and Windows strings
   261    261   based on the TCHAR type which is by convention
   262    262   a Unicode character on Windows NT.
   263         -These functions are essentially wrappers around
   264         -\fBTcl_UtfToExternalDString\fR and
   265         -\fBTcl_ExternalToUtfDString\fR that convert to and from the
   266         -Unicode encoding.
   267    263   .PP
   268    264   \fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR.
   269    265   Given an \fIencoding\fR, the return value is the \fIname\fR argument that
   270    266   was used to create the encoding.  The string returned by
   271    267   \fBTcl_GetEncodingName\fR is only guaranteed to persist until the
   272    268   \fIencoding\fR is deleted.  The caller must not modify this string.
   273    269   .PP

Changes to doc/Eval.3.

   172    172   \fBTCL_EVAL_DIRECT\fR flag is useful in situations where the
   173    173   contents of a value are going to change immediately, so the
   174    174   bytecodes will not be reused in a future execution.  In this case,
   175    175   it is faster to execute the script directly.
   176    176   .TP 23
   177    177   \fBTCL_EVAL_GLOBAL\fR
   178    178   .
   179         -If this flag is set, the script is processed at global level.  This
   180         -means that it is evaluated in the global namespace and its variable
   181         -context consists of global variables only (it ignores any Tcl
   182         -procedures that are active).
          179  +If this flag is set, the script is evaluated in the global namespace instead of
          180  +the current namespace and its variable context consists of global variables
          181  +only (it ignores any Tcl procedures that are active).
          182  +.\" TODO: document TCL_EVAL_INVOKE and TCL_EVAL_NOERR.
   183    183   
   184    184   .SH "MISCELLANEOUS DETAILS"
   185    185   .PP
   186    186   During the processing of a Tcl command it is legal to make nested
   187    187   calls to evaluate other commands (this is how procedures and
   188    188   some control structures are implemented).
   189    189   If a code other than \fBTCL_OK\fR is returned

Changes to doc/GetInt.3.

    60     60   .QW \fB0d\fR
    61     61   then \fIsrc\fR is expected to be in decimal form; otherwise,
    62     62   if the first such characters are
    63     63   .QW \fB0o\fR
    64     64   then \fIsrc\fR is expected to be in octal form;  otherwise,
    65     65   if the first such characters are
    66     66   .QW \fB0b\fR
           67  +then \fIsrc\fR is expected to be in binary form;  otherwise,
           68  +if the first such character is
           69  +.QW \fB0\fR
    67     70   then \fIsrc\fR
    68         -is expected to be in binary form;  otherwise, \fIsrc\fR is
    69         -expected to be in decimal form.
           71  +is expected to be in octal form;  otherwise, \fIsrc\fR
           72  +is expected to be in decimal form.
    70     73   .PP
    71     74   \fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
    72     75   number, which is:  white space;  a sign; a sequence of digits;  a
    73     76   decimal point
    74     77   .QW \fB.\fR ;
    75     78   a sequence of digits;  the letter
    76     79   .QW \fBe\fR ;

Changes to doc/IntObj.3.

    93     93   with which values might be exchanged.  The C integral types for which Tcl
    94     94   provides value exchange routines are \fBint\fR, \fBlong int\fR,
    95     95   \fBTcl_WideInt\fR, and \fBmp_int\fR.  The \fBint\fR and \fBlong int\fR types
    96     96   are provided by the C language standard.  The \fBTcl_WideInt\fR type is a
    97     97   typedef defined to be whatever signed integral type covers at least the
    98     98   64-bit integer range (-9223372036854775808 to 9223372036854775807).  Depending
    99     99   on the platform and the C compiler, the actual type might be
   100         -\fBlong int\fR, \fBlong long int\fR, \fB__int64\fR, or something else.
          100  +\fBlong long int\fR, \fB__int64\fR, or something else.
   101    101   The \fBmp_int\fR type is a multiple-precision integer type defined
   102    102   by the LibTomMath multiple-precision integer library.
   103    103   .PP
   104    104   The \fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR, \fBTcl_NewWideIntObj\fR,
   105    105   and \fBTcl_NewBignumObj\fR routines each create and return a new
   106    106   Tcl value initialized to the integral value of the argument.  The
   107    107   returned Tcl value is unshared.

Changes to doc/Interp.3.

    29     29   structure.  Callers of \fBTcl_CreateInterp\fR should use this pointer
    30     30   as an opaque token, suitable for nothing other than passing back to
    31     31   other routines in the Tcl interface.  Accessing fields directly through
    32     32   the pointer as described below is no longer supported.  The supported
    33     33   public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR,
    34     34   \fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead.
    35     35   .PP
           36  +For legacy programs and extensions no longer being maintained, compiles
           37  +against the Tcl 8.6 header files are only possible with the compiler
           38  +directives
           39  +.CS
           40  +#define USE_INTERP_RESULT
           41  +.CE
           42  +and/or
           43  +.CS
           44  +#define USE_INTERP_ERRORLINE
           45  +.CE
           46  +depending on which fields of the \fBTcl_Interp\fR struct are accessed.
           47  +These directives may be embedded in code or supplied via compiler options.
           48  +.PP
    36     49   The \fIresult\fR and \fIfreeProc\fR fields are used to return
    37     50   results or error messages from commands.
    38     51   This information is returned by command procedures back to \fBTcl_Eval\fR,
    39     52   and by \fBTcl_Eval\fR back to its callers.
    40     53   The \fIresult\fR field points to the string that represents the
    41     54   result or error message, and the \fIfreeProc\fR field tells how
    42     55   to dispose of the storage for the string when it is not needed anymore.
................................................................................
    84     97   As part of processing each command, \fBTcl_Eval\fR initializes
    85     98   \fIinterp->result\fR
    86     99   and \fIinterp->freeProc\fR just before calling the command procedure for
    87    100   the command.  The \fIfreeProc\fR field will be initialized to zero,
    88    101   and \fIinterp->result\fR will point to an empty string.  Commands that
    89    102   do not return any value can simply leave the fields alone.
    90    103   Furthermore, the empty string pointed to by \fIresult\fR is actually
    91         -part of an array of \fBTCL_RESULT_SIZE\fR characters (approximately 200).
          104  +part of an array of approximately 200 characters.
    92    105   If a command wishes to return a short string, it can simply copy
    93    106   it to the area pointed to by \fIinterp->result\fR.  Or, it can use
    94    107   the sprintf procedure to generate a short result string at the location
    95    108   pointed to by \fIinterp->result\fR.
    96    109   .PP
    97    110   It is a general convention in Tcl-based applications that the result
    98    111   of an interpreter is normally in the initialized state described

Changes to doc/Method.3.

     5      5   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      6   '\"
     7      7   .TH Tcl_Method 3 0.1 TclOO "TclOO Library Functions"
     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12         -Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
           12  +Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsPrivate, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
    13     13   .SH SYNOPSIS
    14     14   .nf
    15     15   \fB#include <tclOO.h>\fR
    16     16   .sp
    17     17   Tcl_Method
    18         -\fBTcl_NewMethod\fR(\fIinterp, class, nameObj, isPublic,
    19         -              methodTypePtr, clientData\fR)
           18  +\fBTcl_NewMethod\fR(\fIinterp, class, nameObj, flags, methodTypePtr,
           19  +              clientData\fR)
    20     20   .sp
    21     21   Tcl_Method
    22         -\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, isPublic,
    23         -                      methodTypePtr, clientData\fR)
           22  +\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, flags, methodTypePtr,
           23  +                      clientData\fR)
    24     24   .sp
    25     25   \fBTcl_ClassSetConstructor\fR(\fIinterp, class, method\fR)
    26     26   .sp
    27     27   \fBTcl_ClassSetDestructor\fR(\fIinterp, class, method\fR)
    28     28   .sp
    29     29   Tcl_Class
    30     30   \fBTcl_MethodDeclarerClass\fR(\fImethod\fR)
................................................................................
    31     31   .sp
    32     32   Tcl_Object
    33     33   \fBTcl_MethodDeclarerObject\fR(\fImethod\fR)
    34     34   .sp
    35     35   Tcl_Obj *
    36     36   \fBTcl_MethodName\fR(\fImethod\fR)
    37     37   .sp
           38  +.VS TIP500
    38     39   int
    39     40   \fBTcl_MethodIsPublic\fR(\fImethod\fR)
           41  +.VE TIP500
           42  +.sp
           43  +int
           44  +\fBTcl_MethodIsPrivate\fR(\fImethod\fR)
    40     45   .sp
    41     46   int
    42     47   \fBTcl_MethodIsType\fR(\fImethod, methodTypePtr, clientDataPtr\fR)
    43     48   .sp
    44     49   int
    45     50   \fBTcl_ObjectContextInvokeNext\fR(\fIinterp, context, objc, objv, skip\fR)
    46     51   .sp
................................................................................
    62     67   .AP Tcl_Object object in
    63     68   The object to create the method in.
    64     69   .AP Tcl_Class class in
    65     70   The class to create the method in.
    66     71   .AP Tcl_Obj *nameObj in
    67     72   The name of the method to create. Should not be NULL unless creating
    68     73   constructors or destructors.
    69         -.AP int isPublic in
    70         -A flag saying what the visibility of the method is. The only supported public
    71         -values of this flag are 0 for a non-exported method, and 1 for an exported
    72         -method.
           74  +.AP int flags in
           75  +A flag saying (currently) what the visibility of the method is. The supported
           76  +public values of this flag are \fBTCL_OO_METHOD_PUBLIC\fR (which is fixed at 1
           77  +for backward compatibility) for an exported method,
           78  +\fBTCL_OO_METHOD_UNEXPORTED\fR (which is fixed at 0 for backward
           79  +compatibility) for a non-exported method,
           80  +.VS TIP500
           81  +and \fBTCL_OO_METHOD_PRIVATE\fR for a private method.
           82  +.VE TIP500
    73     83   .AP Tcl_MethodType *methodTypePtr in
    74     84   A description of the type of the method to create, or the type of method to
    75     85   compare against.
    76     86   .AP ClientData clientData in
    77     87   A piece of data that is passed to the implementation of the method without
    78     88   interpretation.
    79     89   .AP ClientData *clientDataPtr out
................................................................................
   101    111   that class.
   102    112   .PP
   103    113   Given a method, the entity that declared it can be found using
   104    114   \fBTcl_MethodDeclarerClass\fR which returns the class that the method is
   105    115   attached to (or NULL if the method is not attached to any class) and
   106    116   \fBTcl_MethodDeclarerObject\fR which returns the object that the method is
   107    117   attached to (or NULL if the method is not attached to an object). The name of
   108         -the method can be retrieved with \fBTcl_MethodName\fR and whether the method
   109         -is exported is retrieved with \fBTcl_MethodIsPublic\fR. The type of the method
          118  +the method can be retrieved with \fBTcl_MethodName\fR, whether the method
          119  +is exported is retrieved with \fBTcl_MethodIsPublic\fR,
          120  +.VS TIP500
          121  +and whether the method is private is retrieved with \fBTcl_MethodIsPrivate\fR.
          122  +.VE TIP500
          123  +The type of the method
   110    124   can also be introspected upon to a limited degree; the function
   111    125   \fBTcl_MethodIsType\fR returns whether a method is of a particular type,
   112    126   assigning the per-method \fIclientData\fR to the variable pointed to by
   113    127   \fIclientDataPtr\fR if (that is non-NULL) if the type is matched.
   114    128   .SS "METHOD CREATION"
   115    129   .PP
   116    130   Methods are created by \fBTcl_NewMethod\fR and \fBTcl_NewInstanceMethod\fR,
   117    131   which
   118    132   create a method attached to a class or an object respectively. In both cases,
   119    133   the \fInameObj\fR argument gives the name of the method to create, the
   120         -\fIisPublic\fR argument states whether the method should be exported
   121         -initially, the \fImethodTypePtr\fR argument describes the implementation of
          134  +\fIflags\fR argument states whether the method should be exported
          135  +initially
          136  +.VS TIP500
          137  +or be marked as a private method,
          138  +.VE TIP500
          139  +the \fImethodTypePtr\fR argument describes the implementation of
   122    140   the method (see the \fBMETHOD TYPES\fR section below) and the \fIclientData\fR
   123    141   argument gives some implementation-specific data that is passed on to the
   124    142   implementation of the method when it is called.
   125    143   .PP
   126    144   When the \fInameObj\fR argument to \fBTcl_NewMethod\fR is NULL, an
   127    145   unnamed method is created, which is used for constructors and destructors.
   128    146   Constructors should be installed into their class using the

Changes to doc/NRE.3.

     1      1   .\"
     2      2   .\" Copyright (c) 2008 by Kevin B. Kenny.
            3  +.\" Copyright (c) 2018 by Nathan Coulter.
     3      4   .\"
     4      5   '\" See the file "license.terms" for information on usage and redistribution
     5      6   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      7   '\"
     7      8   .TH NRE 3 8.6 Tcl "Tcl Library Procedures"
     8      9   .so man.macros
     9     10   .BS
................................................................................
    34     35   .sp
    35     36   void
    36     37   \fBTcl_NRAddCallback\fR(\fIinterp, postProcPtr, data0, data1, data2, data3\fR)
    37     38   .fi
    38     39   .SH ARGUMENTS
    39     40   .AS Tcl_CmdDeleteProc *interp in
    40     41   .AP Tcl_Interp *interp in
    41         -Interpreter in which to create or evaluate a command.
           42  +The relevant Interpreter.
    42     43   .AP char *cmdName in
    43         -Name of a new command to create.
           44  +Name of the command to create.
    44     45   .AP Tcl_ObjCmdProc *proc in
    45         -Implementation of a command that will be called whenever \fIcmdName\fR
    46         -is invoked as a command in the unoptimized way.
           46  +Called in order to evaluate a command.  Is often just a small wrapper that uses
           47  +\fBTcl_NRCallObjProc\fR to call \fInreProc\fR using a new trampoline.  Behaves
           48  +in the same way as the \fIproc\fR argument to \fBTcl_CreateObjCommand\fR(3)
           49  +(\fIq.v.\fR).
    47     50   .AP Tcl_ObjCmdProc *nreProc in
    48         -Implementation of a command that will be called whenever \fIcmdName\fR
    49         -is invoked and requested to conserve the C stack.
           51  +Called instead of \fIproc\fR when a trampoline is already in use.
    50     52   .AP ClientData clientData in
    51         -Arbitrary one-word value that will be passed to \fIproc\fR, \fInreProc\fR,
    52         -\fIdeleteProc\fR and \fIobjProc\fR.
           53  +Arbitrary one-word value passed to \fIproc\fR, \fInreProc\fR, \fIdeleteProc\fR
           54  +and \fIobjProc\fR.
    53     55   .AP Tcl_CmdDeleteProc *deleteProc in/out
    54         -Procedure to call before \fIcmdName\fR is deleted from the interpreter.
    55         -This procedure allows for command-specific cleanup. If \fIdeleteProc\fR
    56         -is \fBNULL\fR, then no procedure is called before the command is deleted.
           56  +Called before \fIcmdName\fR is deleted from the interpreter, allowing for
           57  +command-specific cleanup. May be NULL.
    57     58   .AP int objc in
    58         -Count of parameters provided to the implementation of a command.
           59  +Number of items in \fIobjv\fR.
    59     60   .AP Tcl_Obj **objv in
    60         -Pointer to an array of Tcl values. Each value holds the value of a
    61         -single word in the command to execute.
           61  +Words in the command.
    62     62   .AP Tcl_Obj *objPtr in
    63         -Pointer to a Tcl_Obj whose value is a script or expression to execute.
           63  +A script or expression to evaluate.
    64     64   .AP int flags in
    65         -ORed combination of flag bits that specify additional options.
    66         -\fBTCL_EVAL_GLOBAL\fR is the only flag that is currently supported.
    67         -.\" TODO: This is a lie. But kbk didn't grasp TCL_EVAL_INVOKE and
    68         -.\"       TCL_EVAL_NOERR well enough to document them.
           65  +As described for \fITcl_EvalObjv\fR.
           66  +.PP
    69     67   .AP Tcl_Command cmd in
    70         -Token for a command that is to be used instead of the currently
    71         -executing command.
           68  +Token to use instead of one derived from the first word of \fIobjv\fR in order
           69  +to evaluate a command.
    72     70   .AP Tcl_Obj *resultPtr out
    73         -Pointer to an unshared Tcl_Obj where the result of expression
    74         -evaluation is written.
           71  +Pointer to an unshared Tcl_Obj where the result of the evaluation is stored if
           72  +the return code is TCL_OK.
    75     73   .AP Tcl_NRPostProc *postProcPtr in
    76         -Pointer to a function that will be invoked when the command currently
    77         -executing in the interpreter designated by \fIinterp\fR completes.
           74  +A function to push.
    78     75   .AP ClientData data0 in
    79     76   .AP ClientData data1 in
    80     77   .AP ClientData data2 in
    81     78   .AP ClientData data3 in
    82     79   \fIdata0\fR through \fIdata3\fR are four one-word values that will be passed
    83     80   to the function designated by \fIpostProcPtr\fR when it is invoked.
    84     81   .BE
    85     82   .SH DESCRIPTION
    86     83   .PP
    87         -This series of C functions provides an interface whereby commands that
    88         -are implemented in C can be evaluated, and invoke Tcl commands scripts
    89         -and scripts, without consuming space on the C stack. The non-recursive
    90         -evaluation is done by installing a \fItrampoline\fR, a small piece of
    91         -code that invokes a command or script, and then executes a series of
    92         -callbacks when the command or script returns.
    93         -.PP
    94         -The \fBTcl_NRCreateCommand\fR function creates a Tcl command in the
    95         -interpreter designated by \fIinterp\fR that is prepared to handle
    96         -nonrecursive evaluation with a trampoline. The \fIcmdName\fR argument
    97         -gives the name of the new command. If \fIcmdName\fR contains any
    98         -namespace qualifiers, then the new command is added to the specified
    99         -namespace; otherwise, it is added to the global namespace. \fIproc\fR
   100         -gives the procedure that will be called when the interpreter wishes to
   101         -evaluate the command in an unoptimized manner, and \fInreProc\fR is
   102         -the procedure that will be called when the interpreter wishes to
   103         -evaluate the command using a trampoline. \fIdeleteProc\fR is a
   104         -function that will be called before the command is deleted from the
   105         -interpreter. When any of the three functions is invoked, it is passed
   106         -the \fIclientData\fR parameter.
   107         -.PP
   108         -\fBTcl_NRCreateCommand\fR deletes any existing command
   109         -\fIname\fR already associated with the interpreter
   110         -(however see below for an exception where the existing command
   111         -is not deleted).
   112         -It returns a token that may be used to refer
   113         -to the command in subsequent calls to \fBTcl_GetCommandName\fR.
   114         -If \fBTcl_NRCreateCommand\fR is called for an interpreter that is in
   115         -the process of being deleted, then it does not create a new command,
   116         -does not delete any existing command of the same name, and returns NULL.
           84  +These functions provide an interface to the function stack that an interpreter
           85  +iterates through to evaluate commands.  The routine behind a command is
           86  +implemented by an initial function and any additional functions that the
           87  +routine pushes onto the stack as it progresses.  The interpreter itself pushes
           88  +functions onto the stack to react to the end of a routine and to exercise other
           89  +forms of control such as switching between in-progress stacks and the
           90  +evaluation of other scripts at additional levels without adding frames to the C
           91  +stack.  To execute a routine, the initial function for the routine is called
           92  +and then a small bit of code called a \fItrampoline\fR iteratively takes
           93  +functions off the stack and calls them, using the value of the last call as the
           94  +value of the routine.
           95  +.PP
           96  +\fBTcl_NRCallObjProc\fR calls \fInreProc\fR using a new trampoline.
           97  +.PP
           98  +\fBTcl_NRCreateCommand\fR, an alternative to \fBTcl_CreateObjCommand\fR,
           99  +resolves \fIcmdName\fR, which may contain namespace qualifiers, relative to the
          100  +current namespace, creates a command by that name, and returns a token for the
          101  +command which may be used in subsequent calls to \fBTcl_GetCommandName\fR.
          102  +Except for a few cases noted below any existing command by the same name is
          103  +first deleted.  If \fIinterp\fR is in the process of being deleted
          104  +\fBTcl_NRCreateCommand\fR does not create any command, does not delete any
          105  +command, and returns NULL.
          106  +.PP
          107  +\fBTcl_NREvalObj\fR pushes a function that is like \fBTcl_EvalObjEx\fR but
          108  +consumes no space on the C stack.
          109  +.PP
          110  +\fBTcl_NREvalObjv\fR pushes a function that is like \fBTcl_EvalObjv\fR but
          111  +consumes no space on the C stack.
          112  +.PP
          113  +\fBTcl_NRCmdSwap\fR is like \fBTcl_NREvalObjv\fR, but uses \fIcmd\fR, a token
          114  +previously returned by \fBTcl_CreateObjCommand\fR or
          115  +\fBTcl_GetCommandFromObj\fR, instead of resolving the first word of \fIobjv\fR.
          116  +.  The name of this command must be the same as \fIobjv[0]\fR.
          117  +.PP
          118  +\fBTcl_NRExprObj\fR pushes a function that evaluates \fIobjPtr\fR as an
          119  +expression in the same manner as \fBTcl_ExprObj\fR but without consuming space
          120  +on the C stack.
   117    121   .PP
   118         -The \fIproc\fR and \fInreProc\fR function are expected to conform to
   119         -all the rules set forth for the \fIproc\fR argument to
   120         -\fBTcl_CreateObjCommand\fR(3) (\fIq.v.\fR).
   121         -.PP
   122         -When a command that is written to cope with evaluation via trampoline
   123         -is invoked without a trampoline on the stack, it will usually respond
   124         -to the invocation by creating a trampoline and calling the
   125         -trampoline-enabled implementation of the same command. This call is done by
   126         -means of \fBTcl_NRCallObjProc\fR. In the call to
   127         -\fBTcl_NRCallObjProc\fR, the \fIinterp\fR, \fIclientData\fR,
   128         -\fIobjc\fR and \fIobjv\fR parameters should be the same ones that were
   129         -passed to \fIproc\fR. The \fInreProc\fR parameter should designate the
   130         -trampoline-enabled implementation of the command.
          122  +All of the functions return \fBTCL_OK\fR if the evaluation of the script,
          123  +command, or expression has been scheduled successfully.  Otherwise (for example
          124  +if the command name cannot be resolved), they return \fBTCL_ERROR\fR and store
          125  +a message as the interpreter's result.
   131    126   .PP
   132         -\fBTcl_NREvalObj\fR arranges for the script contained in \fIobjPtr\fR
   133         -to be evaluated in the interpreter designated by \fIinterp\fR after
   134         -the current command (which must be trampoline-enabled) returns. It is
   135         -the method by which a command may invoke a script without consuming
   136         -space on the C stack. Similarly, \fBTcl_NREvalObjv\fR arranges to
   137         -invoke a single Tcl command whose words have already been separated
   138         -and substituted. The \fIobjc\fR and \fIobjv\fR parameters give the
   139         -words of the command to be evaluated when execution reaches the
   140         -trampoline.
   141         -.PP
   142         -\fBTcl_NRCmdSwap\fR allows for trampoline evaluation of a command whose
   143         -resolution is already known.  The \fIcmd\fR parameter gives a
   144         -\fBTcl_Command\fR token (returned from \fBTcl_CreateObjCommand\fR or
   145         -\fBTcl_GetCommandFromObj\fR) identifying the command to be invoked in
   146         -the trampoline; this command must match the word in \fIobjv[0]\fR.
   147         -The remaining arguments are as for \fBTcl_NREvalObjv\fR.
   148         -.PP
   149         -\fBTcl_NREvalObj\fR, \fBTcl_NREvalObjv\fR and \fBTcl_NRCmdSwap\fR
   150         -all accept a \fIflags\fR parameter, which is an OR-ed-together set of
   151         -bits to control evaluation. At the present time, the only supported flag
   152         -available to callers is \fBTCL_EVAL_GLOBAL\fR.
   153         -.\" TODO: Again, this is a lie. Do we want to explain TCL_EVAL_INVOKE
   154         -.\"       and TCL_EVAL_NOERR?
   155         -If the \fBTCL_EVAL_GLOBAL\fR flag is set, the script or command is
   156         -evaluated in the global namespace. If it is not set, it is evaluated
   157         -in the current namespace.
   158         -.PP
   159         -\fBTcl_NRExprObj\fR arranges for the expression contained in \fIobjPtr\fR
   160         -to be evaluated in the interpreter designated by \fIinterp\fR after
   161         -the current command (which must be trampoline-enabled) returns. It is
   162         -the method by which a command may evaluate a Tcl expression without consuming
   163         -space on the C stack.  The argument \fIresultPtr\fR is a pointer to an
   164         -unshared Tcl_Obj where the result of expression evaluation is to be written.
   165         -If expression evaluation returns any code other than TCL_OK, the
   166         -\fIresultPtr\fR value is left untouched.
   167         -.PP
   168         -All of the routines return \fBTCL_OK\fR if command or expression invocation
   169         -has been scheduled successfully. If for any reason the scheduling cannot
   170         -be completed (for example, if the interpreter is unable to find
   171         -the requested command), they return \fBTCL_ERROR\fR with an
   172         -appropriate message left in the interpreter's result.
   173         -.PP
   174         -\fBTcl_NRAddCallback\fR arranges to have a C function called when the
   175         -current trampoline-enabled command in the Tcl interpreter designated
   176         -by \fIinterp\fR returns.  The \fIpostProcPtr\fR argument is a pointer
   177         -to the callback function, which must have arguments and return value
   178         -consistent with the \fBTcl_NRPostProc\fR data type:
          127  +\fBTcl_NRAddCallback\fR pushes \fIpostProcPtr\fR.  The signature for
          128  +\fBTcl_NRPostProc\fR is:
   179    129   .PP
   180    130   .CS
   181    131   typedef int
   182    132   \fBTcl_NRPostProc\fR(
   183    133           \fBClientData\fR \fIdata\fR[],
   184    134           \fBTcl_Interp\fR *\fIinterp\fR,
   185    135           int \fIresult\fR);
   186    136   .CE
   187    137   .PP
   188         -When the trampoline invokes the callback function, the \fIdata\fR
   189         -parameter will point to an array containing the four one-word
   190         -quantities that were passed to \fBTcl_NRAddCallback\fR in the
   191         -\fIdata0\fR through \fIdata3\fR parameters. The Tcl interpreter will
   192         -be designated by the \fIinterp\fR parameter, and the \fIresult\fR
   193         -parameter will contain the result (\fBTCL_OK\fR, \fBTCL_ERROR\fR,
   194         -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR) that was
   195         -returned by the command evaluation. The callback function is expected,
   196         -in turn, either to return a \fIresult\fR to control further evaluation.
   197         -.PP
   198         -Multiple \fBTcl_NRAddCallback\fR invocations may request multiple
   199         -callbacks, which may be to the same or different callback
   200         -functions. If multiple callbacks are requested, they are executed in
   201         -last-in, first-out order, that is, the most recently requested
   202         -callback is executed first.
          138  +\fIdata\fR is a pointer to an array containing \fIdata0\fR through \fIdata3\fR.
          139  +\fIresult\fR is the value returned by the previous function implementing part
          140  +the routine.
   203    141   .SH EXAMPLE
   204    142   .PP
   205         -The usual pattern for Tcl commands that invoke other Tcl commands
   206         -is something like:
          143  +The following command uses \fBTcl_EvalObjEx\fR, which consumes space on the C
          144  +stack, to evalute a script:
   207    145   .PP
   208    146   .CS
   209    147   int
   210    148   \fITheCmdOldObjProc\fR(
   211    149       ClientData clientData,
   212    150       Tcl_Interp *interp,
   213    151       int objc,
................................................................................
   224    162   
   225    163       return result;
   226    164   }
   227    165   \fBTcl_CreateObjCommand\fR(interp, "theCommand",
   228    166           \fITheCmdOldObjProc\fR, clientData, TheCmdDeleteProc);
   229    167   .CE
   230    168   .PP
   231         -To enable a command like this one for trampoline-based evaluation,
   232         -it must be split into three pieces:
   233         -.IP \(bu
   234         -A non-trampoline implementation, \fITheCmdNewObjProc\fR,
   235         -which will simply create a trampoline
   236         -and invoke the trampoline-based implementation.
   237         -.IP \(bu
   238         -A trampoline-enabled implementation, \fITheCmdNRObjProc\fR.  This
   239         -function will perform the initialization, request that the trampoline
   240         -call the postprocessing routine after command evaluation, and finally,
   241         -request that the trampoline call the inner command.
   242         -.IP \(bu
   243         -A postprocessing routine, \fITheCmdPostProc\fR. This function will
   244         -perform the postprocessing formerly done after the return from the
   245         -inner command in \fITheCmdObjProc\fR.
   246         -.PP
   247         -The non-trampoline implementation is simple and stylized, containing
   248         -a single statement:
          169  +To avoid consuming space on the C stack, \fITheCmdOldObjProc\fR is renamed to
          170  +\fITheCmdNRObjProc\fR and the postprocessing step is split into a separate
          171  +function, \fITheCmdPostProc\fR, which is pushed onto the function stack.
          172  +\fITcl_EvalObjEx\fR is replaced with \fITcl_NREvalObj\fR, which uses a
          173  +trampoline instead of consuming space on the C stack.  A new version of
          174  +\fITheCmdOldObjProc\fR is just a a wrapper that uses \fBTcl_NRCallObjProc\fR to
          175  +call \fITheCmdNRObjProc\fR:
   249    176   .PP
   250    177   .CS
   251    178   int
   252         -\fITheCmdNewObjProc\fR(
          179  +\fITheCmdOldObjProc\fR(
   253    180       ClientData clientData,
   254    181       Tcl_Interp *interp,
   255    182       int objc,
   256    183       Tcl_Obj *const objv[])
   257    184   {
   258    185       return \fBTcl_NRCallObjProc\fR(interp, \fITheCmdNRObjProc\fR,
   259    186               clientData, objc, objv);
   260    187   }
   261    188   .CE
   262    189   .PP
   263         -The trampoline-enabled implementation requests postprocessing,
   264         -and returns to the trampoline requesting command evaluation.
   265         -.PP
   266    190   .CS
   267    191   int
   268    192   \fITheCmdNRObjProc\fR
   269    193       ClientData clientData,
   270    194       Tcl_Interp *interp,
   271    195       int objc,
   272    196       Tcl_Obj *const objv[])
................................................................................
   280    204       /* \fIdata0 .. data3\fR are up to four one-word items to
   281    205        * pass to the postprocessing procedure */
   282    206   
   283    207       return \fBTcl_NREvalObj\fR(interp, objPtr, 0);
   284    208   }
   285    209   .CE
   286    210   .PP
   287         -The postprocessing procedure does whatever the original command did
   288         -upon return from the inner evaluation.
   289         -.PP
   290    211   .CS
   291    212   int
   292    213   \fITheCmdNRPostProc\fR(
   293    214       ClientData data[],
   294    215       Tcl_Interp *interp,
   295    216       int result)
   296    217   {
................................................................................
   299    220   
   300    221       \fI... postprocessing ...\fR
   301    222   
   302    223       return result;
   303    224   }
   304    225   .CE
   305    226   .PP
   306         -If \fItheCommand\fR is a command that results in multiple commands or
   307         -scripts being evaluated, its postprocessing routine may schedule
   308         -additional postprocessing and then request another command evaluation
   309         -by means of \fBTcl_NREvalObj\fR or one of the other evaluation
   310         -routines. Looping and sequencing constructs may be implemented in this way.
          227  +Any function comprising a routine can push other functions, making it possible
          228  +implement looping and sequencing constructs using the function stack.
   311    229   .PP
   312         -Finally, to install a trampoline-enabled command in the interpreter,
   313         -\fBTcl_NRCreateCommand\fR is used in place of
   314         -\fBTcl_CreateObjCommand\fR.  It accepts two command procedures instead
   315         -of one. The first is for use when no trampoline is yet on the stack,
   316         -and the second is for use when there is already a trampoline in place.
   317         -.PP
   318         -.CS
   319         -\fBTcl_NRCreateCommand\fR(interp, "theCommand",
   320         -        \fITheCmdNewObjProc\fR, \fITheCmdNRObjProc\fR, clientData,
   321         -        TheCmdDeleteProc);
   322         -.CE
   323    230   .SH "SEE ALSO"
   324    231   Tcl_CreateCommand(3), Tcl_CreateObjCommand(3), Tcl_EvalObjEx(3), Tcl_GetCommandFromObj(3), Tcl_ExprObj(3)
   325    232   .SH KEYWORDS
   326    233   stackless, nonrecursive, execute, command, global, value, result, script
   327    234   .SH COPYRIGHT
   328         -Copyright (c) 2008 by Kevin B. Kenny
          235  +Copyright (c) 2008 by Kevin B. Kenny.
          236  +Copyright (c) 2018 by Nathan Coulter.

Changes to doc/Object.3.

   253    253   \fBincr x\fR
   254    254   .CE
   255    255   .PP
   256    256   The \fBincr\fR command first gets an integer from \fIx\fR's value
   257    257   by calling \fBTcl_GetIntFromObj\fR.
   258    258   This procedure checks whether the value is already an integer value.
   259    259   Since it is not, it converts the value
   260         -by setting the value's \fIinternalRep.longValue\fR member
          260  +by setting the value's internal representation
   261    261   to the integer \fB123\fR
   262    262   and setting the value's \fItypePtr\fR
   263    263   to point to the integer Tcl_ObjType structure.
   264    264   Both representations are now valid.
   265    265   \fBincr\fR increments the value's integer internal representation
   266    266   then invalidates its string representation
   267    267   (by calling \fBTcl_InvalidateStringRep\fR)

Changes to doc/Panic.3.

     3      3   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     4      4   '\"
     5      5   .TH Tcl_Panic 3 8.4 Tcl "Tcl Library Procedures"
     6      6   .so man.macros
     7      7   .BS
     8      8   '\"  Note:  do not modify the .SH NAME line immediately below!
     9      9   .SH NAME
    10         -Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc \- report fatal error and abort
           10  +Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc, Tcl_ConsolePanic \- report fatal error and abort
    11     11   .SH SYNOPSIS
    12     12   .nf
    13     13   \fB#include <tcl.h>\fR
    14     14   .sp
    15     15   void
    16     16   \fBTcl_Panic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR)
    17     17   .sp
    18     18   void
    19     19   \fBTcl_PanicVA\fR(\fIformat\fR, \fIargList\fR)
    20     20   .sp
    21     21   void
    22     22   \fBTcl_SetPanicProc\fR(\fIpanicProc\fR)
    23     23   .sp
           24  +void
           25  +\fBTcl_ConsolePanic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR)
           26  +.sp
    24     27   .SH ARGUMENTS
    25     28   .AS Tcl_PanicProc *panicProc
    26     29   .AP "const char*" format in
    27     30   A printf-style format string.
    28     31   .AP "" arg in
    29     32   Arguments matching the format string.
    30     33   .AP va_list argList in
................................................................................
    49     52   In a freshly loaded Tcl library, \fBTcl_Panic\fR prints the formatted
    50     53   error message to the standard error file of the process, and then
    51     54   calls \fBabort\fR to terminate the process.  \fBTcl_Panic\fR does not
    52     55   return. On Windows, when a debugger is running, the formatted error
    53     56   message is sent to the debugger in stead. If the windows executable
    54     57   does not have a stderr channel (e.g. \fBwish.exe\fR), then a
    55     58   system dialog box is used to display the panic message.
           59  +.PP
           60  +If your application doesn't use \fBTcl_Main\fR or \fBTk_Main\fR
           61  +and you want to implicitly use the stderr channel of your
           62  +application's C runtime (in stead of the stderr channel of the
           63  +C runtime used by Tcl), you can call \fBTcl_SetPanicProc\fR
           64  +with \fBTcl_ConsolePanic\fR as its argument. On platforms which
           65  +only have one C runtime (almost all platforms except Windows)
           66  +\fBTcl_ConsolePanic\fR is equivalent to NULL.
    56     67   .PP
    57     68   \fBTcl_SetPanicProc\fR may be used to modify the behavior of
    58     69   \fBTcl_Panic\fR.  The \fIpanicProc\fR argument should match the
    59     70   type \fBTcl_PanicProc\fR:
    60     71   .PP
    61     72   .CS
    62     73   typedef void \fBTcl_PanicProc\fR(

Changes to doc/SaveResult.3.

     1      1   '\"
     2      2   '\" Copyright (c) 1997 by Sun Microsystems, Inc.
     3      3   '\" Contributions from Don Porter, NIST, 2004. (not subject to US copyright)
            4  +'\" Copyright (c) 2018 Nathan Coulter.
     4      5   '\"
     5      6   '\" See the file "license.terms" for information on usage and redistribution
     6      7   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     7      8   '\"
     8      9   .TH Tcl_SaveResult 3 8.1 Tcl "Tcl Library Procedures"
     9     10   .so man.macros
    10     11   .BS
    11     12   .SH NAME
    12         -Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState, Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- save and restore an interpreter's state
           13  +Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState,
           14  +Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- Save and restore the
           15  +state of an an interpreter.
    13     16   .SH SYNOPSIS
    14     17   .nf
    15     18   \fB#include <tcl.h>\fR
    16     19   .sp
    17     20   Tcl_InterpState
    18     21   \fBTcl_SaveInterpState\fR(\fIinterp, status\fR)
    19     22   .sp
................................................................................
    26     29   .sp
    27     30   \fBTcl_RestoreResult\fR(\fIinterp, savedPtr\fR)
    28     31   .sp
    29     32   \fBTcl_DiscardResult\fR(\fIsavedPtr\fR)
    30     33   .SH ARGUMENTS
    31     34   .AS Tcl_InterpState savedPtr
    32     35   .AP Tcl_Interp *interp in
    33         -Interpreter for which state should be saved.
           36  +The interpreter for the operation.
    34     37   .AP int status in
    35         -Return code value to save as part of interpreter state.
           38  +The return code for the state.
    36     39   .AP Tcl_InterpState state in
    37         -Saved state token to be restored or discarded.
           40  +A token for saved state.
    38     41   .AP Tcl_SavedResult *savedPtr in
    39         -Pointer to location where interpreter result should be saved or restored.
           42  +A pointer to storage for saved state.
    40     43   .BE
    41     44   .SH DESCRIPTION
    42     45   .PP
    43         -These routines allows a C procedure to take a snapshot of the current
    44         -state of an interpreter so that it can be restored after a call
    45         -to \fBTcl_Eval\fR or some other routine that modifies the interpreter
    46         -state.  There are two triplets of routines meant to work together.
           46  +These routines save the state of an interpreter before a call to a routine such
           47  +as \fBTcl_Eval\fR, and restore the state afterwards.
           48  +.PP
           49  +\fBTcl_SaveInterpState\fR saves the parts of \fIinterp\fR that comprise the
           50  +result of a script, including the resulting value, the return code passed as
           51  +\fIstatus\fR, and any options such as \fB\-errorinfo\fR and \fB\-errorcode\fR.
           52  +It returns a token for the saved state.  The interpreter result is not reset
           53  +and no interpreter state is changed.
           54  +.PP
           55  +\fBTcl_RestoreInterpState\fR restores the state indicated by \fIstate\fR and
           56  +returns the \fIstatus\fR originally passed in the corresponding call to
           57  +\fBTcl_SaveInterpState\fR.
           58  +.PP
           59  +If a saved state is not restored, \fBTcl_DiscardInterpState\fR must be called
           60  +to release it.  A token used to discard or restore state must not be used
           61  +again.
    47     62   .PP
    48         -The first triplet stores the snapshot of interpreter state in
    49         -an opaque token returned by \fBTcl_SaveInterpState\fR.  That token
    50         -value may then be passed back to one of \fBTcl_RestoreInterpState\fR
    51         -or \fBTcl_DiscardInterpState\fR, depending on whether the interp
    52         -state is to be restored.  So long as one of the latter two routines
    53         -is called, Tcl will take care of memory management.
           63  +\fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR, and \fBTcl_DiscardResult\fR are
           64  +deprecated.  Instead use \fBTcl_SaveInterpState\fR,
           65  +\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR, which are more
           66  +capable.
    54     67   .PP
    55         -The second triplet stores the snapshot of only the interpreter
    56         -result (not its complete state) in memory allocated by the caller.
    57         -These routines are passed a pointer to \fBTcl_SavedResult\fR
    58         -that is used to store enough information to restore the interpreter result.
    59         -\fBTcl_SavedResult\fR can be allocated on the stack of the calling
    60         -procedure.  These routines do not save the state of any error
    61         -information in the interpreter (e.g. the \fB\-errorcode\fR or
    62         -\fB\-errorinfo\fR return options, when an error is in progress).
           68  +\fBTcl_SaveResult\fR moves the result of \fIinterp\fR to the location
           69  +\fIstatePtr\fR points to and returns the interpreter result to its initial
           70  +state.  It does not save options such as \fB\-errorcode\fR or
           71  +\fB\-errorinfo\fR.
    63     72   .PP
    64         -Because the routines \fBTcl_SaveInterpState\fR,
    65         -\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR perform
    66         -a superset of the functions provided by the other routines,
    67         -any new code should only make use of the more powerful routines.
    68         -The older, weaker routines \fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR,
    69         -and \fBTcl_DiscardResult\fR continue to exist only for the sake
    70         -of existing programs that may already be using them.
           73  +\fBTcl_RestoreResult\fR clears any existing result or error in \fIinterp\fR and
           74  +moves the result from \fIstatePtr\fR back to \fIinterp\fR.  \fIstatePtr\fR is
           75  +then in an undefined state and must not be used until passed again to
           76  +\fBTcl_SaveResult\fR.
    71     77   .PP
    72         -\fBTcl_SaveInterpState\fR takes a snapshot of those portions of
    73         -interpreter state that make up the full result of script evaluation.
    74         -This include the interpreter result, the return code (passed in
    75         -as the \fIstatus\fR argument, and any return options, including
    76         -\fB\-errorinfo\fR and \fB\-errorcode\fR when an error is in progress.
    77         -This snapshot is returned as an opaque token of type \fBTcl_InterpState\fR.
    78         -The call to \fBTcl_SaveInterpState\fR does not itself change the
    79         -state of the interpreter.  Unlike \fBTcl_SaveResult\fR, it does
    80         -not reset the interpreter.
    81         -.PP
    82         -\fBTcl_RestoreInterpState\fR accepts a \fBTcl_InterpState\fR token
    83         -previously returned by \fBTcl_SaveInterpState\fR and restores the
    84         -state of the interp to the state held in that snapshot.  The return
    85         -value of \fBTcl_RestoreInterpState\fR is the status value originally
    86         -passed to \fBTcl_SaveInterpState\fR when the snapshot token was
    87         -created.
    88         -.PP
    89         -\fBTcl_DiscardInterpState\fR is called to release a \fBTcl_InterpState\fR
    90         -token previously returned by \fBTcl_SaveInterpState\fR when that
    91         -snapshot is not to be restored to an interp.
    92         -.PP
    93         -The \fBTcl_InterpState\fR token returned by \fBTcl_SaveInterpState\fR
    94         -must eventually be passed to either \fBTcl_RestoreInterpState\fR
    95         -or \fBTcl_DiscardInterpState\fR to avoid a memory leak.  Once
    96         -the \fBTcl_InterpState\fR token is passed to one of them, the
    97         -token is no longer valid and should not be used anymore.
    98         -.PP
    99         -\fBTcl_SaveResult\fR moves the string and value results
   100         -of \fIinterp\fR into the location specified by \fIstatePtr\fR.
   101         -\fBTcl_SaveResult\fR clears the result for \fIinterp\fR and
   102         -leaves the result in its normal empty initialized state.
   103         -.PP
   104         -\fBTcl_RestoreResult\fR moves the string and value results from
   105         -\fIstatePtr\fR back into \fIinterp\fR.  Any result or error that was
   106         -already in the interpreter will be cleared.  The \fIstatePtr\fR is left
   107         -in an uninitialized state and cannot be used until another call to
           78  +\fBTcl_DiscardResult\fR releases the state stored at \fBstatePtr\fR, which is
           79  +then in an undefined state and must not be used until passed again to
   108     80   \fBTcl_SaveResult\fR.
   109     81   .PP
   110         -\fBTcl_DiscardResult\fR releases the saved interpreter state
   111         -stored at \fBstatePtr\fR.  The state structure is left in an
   112         -uninitialized state and cannot be used until another call to
   113         -\fBTcl_SaveResult\fR.
   114         -.PP
   115         -Once \fBTcl_SaveResult\fR is called to save the interpreter
   116         -result, either \fBTcl_RestoreResult\fR or
   117         -\fBTcl_DiscardResult\fR must be called to properly clean up the
   118         -memory associated with the saved state.
           82  +If a saved result is not restored, \fBTcl_DiscardResult\fR must be called to
           83  +release it.
   119     84   .SH KEYWORDS
   120     85   result, state, interp

Changes to doc/SetResult.3.

   193    193   \fBTcl_FreeResult\fR performs part of the work
   194    194   of \fBTcl_ResetResult\fR.
   195    195   It frees up the memory associated with \fIinterp\fR's result.
   196    196   It also sets \fIinterp->freeProc\fR to zero, but does not
   197    197   change \fIinterp->result\fR or clear error state.
   198    198   \fBTcl_FreeResult\fR is most commonly used when a procedure
   199    199   is about to replace one result value with another.
          200  +.SS "DIRECT ACCESS TO INTERP->RESULT"
          201  +.PP
          202  +It used to be legal for programs to
          203  +directly read and write \fIinterp->result\fR
          204  +to manipulate the interpreter result.  The Tcl headers no longer
          205  +permit this access by default, and C code still doing this must
          206  +be updated to use supported routines \fBTcl_GetObjResult\fR,
          207  +\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR.
          208  +As a migration aid, access can be restored with the compiler directive
          209  +.CS
          210  +#define USE_INTERP_RESULT
          211  +.CE
          212  +but this is meant only to offer life support to otherwise dead code.
   200    213   .SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
   201    214   .PP
   202    215   \fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
   203    216   the Tcl system is to manage the storage for the \fIresult\fR argument.
   204    217   If \fBTcl_SetResult\fR or \fBTcl_SetObjResult\fR are called
   205    218   at a time when \fIinterp\fR holds a string result,
   206    219   they do whatever is necessary to dispose of the old string result

Changes to doc/StringObj.3.

    33     33   .sp
    34     34   Tcl_UniChar *
    35     35   \fBTcl_GetUnicodeFromObj\fR(\fIobjPtr, lengthPtr\fR)
    36     36   .sp
    37     37   Tcl_UniChar *
    38     38   \fBTcl_GetUnicode\fR(\fIobjPtr\fR)
    39     39   .sp
    40         -Tcl_UniChar
           40  +int
    41     41   \fBTcl_GetUniChar\fR(\fIobjPtr, index\fR)
    42     42   .sp
    43     43   int
    44     44   \fBTcl_GetCharLength\fR(\fIobjPtr\fR)
    45     45   .sp
    46     46   Tcl_Obj *
    47     47   \fBTcl_GetRange\fR(\fIobjPtr, first, last\fR)
................................................................................
   200    200   \fIlengthPtr\fR if it is non-NULL.  The storage referenced by the returned
   201    201   byte pointer is owned by the value manager and should not be modified by
   202    202   the caller.  The procedure \fBTcl_GetUnicode\fR is used in the common case
   203    203   where the caller does not need the length of the unicode string
   204    204   representation.
   205    205   .PP
   206    206   \fBTcl_GetUniChar\fR returns the \fIindex\fR'th character in the
   207         -value's Unicode representation.
          207  +value's Unicode representation. If the index is out of range or
          208  +it references a low surrogate preceded by a high surrogate, it returns -1;
   208    209   .PP
   209    210   \fBTcl_GetRange\fR returns a newly created value comprised of the
   210    211   characters between \fIfirst\fR and \fIlast\fR (inclusive) in the
   211    212   value's Unicode representation.  If the value's Unicode
   212    213   representation is invalid, the Unicode representation is regenerated
   213    214   from the value's string representation.
   214    215   .PP

Changes to doc/Thread.3.

    41     41   int
    42     42   \fBTcl_JoinThread\fR(\fIid, result\fR)
    43     43   .SH ARGUMENTS
    44     44   .AS Tcl_CreateThreadProc proc out
    45     45   .AP Tcl_Condition *condPtr in
    46     46   A condition variable, which must be associated with a mutex lock.
    47     47   .AP Tcl_Mutex *mutexPtr in
    48         -A mutex lock.
           48  +.VS TIP509
           49  +A recursive mutex lock.
           50  +.VE TIP509
    49     51   .AP "const Tcl_Time" *timePtr in
    50     52   A time limit on the condition wait.  NULL to wait forever.
    51     53   Note that a polling value of 0 seconds does not make much sense.
    52     54   .AP Tcl_ThreadDataKey *keyPtr in
    53     55   This identifies a block of thread local storage.  The key should be
    54     56   static and process-wide, yet each thread will end up associating
    55     57   a different block of storage with this key.
................................................................................
   136    138   the \fBNotifier\fR manual page for more information on these procedures.
   137    139   .PP
   138    140   A mutex is a lock that is used to serialize all threads through a piece
   139    141   of code by calling \fBTcl_MutexLock\fR and \fBTcl_MutexUnlock\fR.
   140    142   If one thread holds a mutex, any other thread calling \fBTcl_MutexLock\fR will
   141    143   block until \fBTcl_MutexUnlock\fR is called.
   142    144   A mutex can be destroyed after its use by calling \fBTcl_MutexFinalize\fR.
   143         -The result of locking a mutex twice from the same thread is undefined.
   144         -On some platforms it will result in a deadlock.
          145  +.VS TIP509
          146  +Mutexes are reentrant: they can be locked several times from the same
          147  +thread. However there must be exactly one call to
          148  +\fBTcl_MutexUnlock\fR for each call to \fBTcl_MutexLock\fR in order
          149  +for a thread to release a mutex completely.
          150  +.VE TIP509
   145    151   The \fBTcl_MutexLock\fR, \fBTcl_MutexUnlock\fR and \fBTcl_MutexFinalize\fR
   146    152   procedures are defined as empty macros if not compiling with threads enabled.
   147    153   For declaration of mutexes the \fBTCL_DECLARE_MUTEX\fR macro should be used.
   148    154   This macro assures correct mutex handling even when the core is compiled
   149    155   without threads enabled.
   150    156   .PP
   151    157   A condition variable is used as a signaling mechanism:

Changes to doc/ToUpper.3.

     9      9   .BS
    10     10   .SH NAME
    11     11   Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, Tcl_UtfToTitle \- routines for manipulating the case of Unicode characters and UTF-8 strings
    12     12   .SH SYNOPSIS
    13     13   .nf
    14     14   \fB#include <tcl.h>\fR
    15     15   .sp
    16         -Tcl_UniChar
           16  +int
    17     17   \fBTcl_UniCharToUpper\fR(\fIch\fR)
    18     18   .sp
    19         -Tcl_UniChar
           19  +int
    20     20   \fBTcl_UniCharToLower\fR(\fIch\fR)
    21     21   .sp
    22         -Tcl_UniChar
           22  +int
    23     23   \fBTcl_UniCharToTitle\fR(\fIch\fR)
    24     24   .sp
    25     25   int
    26     26   \fBTcl_UtfToUpper\fR(\fIstr\fR)
    27     27   .sp
    28     28   int
    29     29   \fBTcl_UtfToLower\fR(\fIstr\fR)
    30     30   .sp
    31     31   int
    32     32   \fBTcl_UtfToTitle\fR(\fIstr\fR)
    33     33   .SH ARGUMENTS
    34     34   .AS char *str in/out
    35     35   .AP int ch in
    36         -The Tcl_UniChar to be converted.
           36  +The Unicode character to be converted.
    37     37   .AP char *str in/out
    38     38   Pointer to UTF-8 string to be converted in place.
    39     39   .BE
    40     40   
    41     41   .SH DESCRIPTION
    42     42   .PP
    43     43   The first three routines convert the case of individual Unicode characters:

Changes to doc/UniCharIsAlpha.3.

    44     44   \fBTcl_UniCharIsUpper\fR(\fIch\fR)
    45     45   .sp
    46     46   int
    47     47   \fBTcl_UniCharIsWordChar\fR(\fIch\fR)
    48     48   .SH ARGUMENTS
    49     49   .AS int ch
    50     50   .AP int ch in
    51         -The Tcl_UniChar to be examined.
           51  +The Unicode character to be examined.
    52     52   .BE
    53     53   
    54     54   .SH DESCRIPTION
    55     55   .PP
    56         -All of the routines described examine Tcl_UniChars and return a
           56  +All of the routines described examine Unicode characters and return a
    57     57   boolean value. A non-zero return value means that the character does
    58     58   belong to the character class associated with the called routine. The
    59     59   rest of this document just describes the character classes associated
    60     60   with the various routines.
    61         -.PP
    62         -Note: A Tcl_UniChar is a Unicode character represented as an unsigned,
    63         -fixed-size quantity.
    64     61   
    65     62   .SH "CHARACTER CLASSES"
    66     63   .PP
    67     64   \fBTcl_UniCharIsAlnum\fR tests if the character is an alphanumeric Unicode character.
    68     65   .PP
    69     66   \fBTcl_UniCharIsAlpha\fR tests if the character is an alphabetic Unicode character.
    70     67   .PP

Changes to doc/Utf.3.

    59     59   .sp
    60     60   const char *
    61     61   \fBTcl_UtfNext\fR(\fIsrc\fR)
    62     62   .sp
    63     63   const char *
    64     64   \fBTcl_UtfPrev\fR(\fIsrc, start\fR)
    65     65   .sp
    66         -Tcl_UniChar
           66  +int
    67     67   \fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR)
    68     68   .sp
    69     69   const char *
    70     70   \fBTcl_UtfAtIndex\fR(\fIsrc, index\fR)
    71     71   .sp
    72     72   int
    73     73   \fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR)
    74     74   .SH ARGUMENTS
    75     75   .AS "const Tcl_UniChar" *uniPattern in/out
    76     76   .AP char *buf out
    77     77   Buffer in which the UTF-8 representation of the Tcl_UniChar is stored.  At most
    78     78   \fBTCL_UTF_MAX\fR bytes are stored in the buffer.
    79     79   .AP int ch in
    80         -The Tcl_UniChar to be converted or examined.
           80  +The Unicode character to be converted or examined.
    81     81   .AP Tcl_UniChar *chPtr out
    82     82   Filled with the Tcl_UniChar represented by the head of the UTF-8 string.
    83     83   .AP "const char" *src in
    84     84   Pointer to a UTF-8 string.
    85     85   .AP "const char" *cs in
    86     86   Pointer to a UTF-8 string.
    87     87   .AP "const char" *ct in
................................................................................
   117    117   .AP int nocase in
   118    118   Specifies whether the match should be done case-sensitive (0) or
   119    119   case-insensitive (1).
   120    120   .BE
   121    121   
   122    122   .SH DESCRIPTION
   123    123   .PP
   124         -These routines convert between UTF-8 strings and Tcl_UniChars.  A
   125         -Tcl_UniChar is a Unicode character represented as an unsigned, fixed-size
          124  +These routines convert between UTF-8 strings and Unicode characters.  An
          125  +Unicode character represented as an unsigned, fixed-size
   126    126   quantity.  A UTF-8 character is a Unicode character represented as
   127    127   a varying-length sequence of up to \fBTCL_UTF_MAX\fR bytes.  A multibyte UTF-8
   128    128   sequence consists of a lead byte followed by some number of trail bytes.
   129    129   .PP
   130    130   \fBTCL_UTF_MAX\fR is the maximum number of bytes that it takes to
   131    131   represent one Unicode character in the UTF-8 representation.
   132    132   .PP
   133         -\fBTcl_UniCharToUtf\fR stores the Tcl_UniChar \fIch\fR as a UTF-8 string
          133  +\fBTcl_UniCharToUtf\fR stores the character \fIch\fR as a UTF-8 string
   134    134   in starting at \fIbuf\fR.  The return value is the number of bytes stored
   135         -in \fIbuf\fR.
          135  +in \fIbuf\fR. If ch is an upper surrogate (range U+D800 - U+DBFF), then
          136  +the return value will be 0 and nothing will be stored. If you still
          137  +want to produce UTF-8 output for it (even though knowing it's an illegal
          138  +code-point on its own), just call \fBTcl_UniCharToUtf\fR again using ch = -1.
   136    139   .PP
   137    140   \fBTcl_UtfToUniChar\fR reads one UTF-8 character starting at \fIsrc\fR
   138    141   and stores it as a Tcl_UniChar in \fI*chPtr\fR.  The return value is the
   139    142   number of bytes read from \fIsrc\fR.  The caller must ensure that the
   140    143   source buffer is long enough such that this routine does not run off the
   141    144   end and dereference non-existent or random memory; if the source buffer
   142    145   is known to be null-terminated, this will not happen.  If the input is
          146  +a byte in the range 0x80 - 0x9F, \fBTcl_UtfToUniChar\fR assumes the
          147  +cp1252 encoding, stores the corresponding Tcl_UniChar in \fI*chPtr\fR
          148  +and returns 1. If the input is otherwise
   143    149   not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first
   144    150   byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and
   145    151   0x00ff and return 1.
   146    152   .PP
   147    153   \fBTcl_UniCharToUtfDString\fR converts the given Unicode string
   148    154   to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR.
   149    155   You must specify \fIuniLength\fR, the length of the given Unicode string.
................................................................................
   196    202   characters.
   197    203   .PP
   198    204   \fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR
   199    205   of \fIlength\fR bytes is long enough to be decoded by
   200    206   \fBTcl_UtfToUniChar\fR, or 0 otherwise.  This function does not guarantee
   201    207   that the UTF-8 string is properly formed.  This routine is used by
   202    208   procedures that are operating on a byte at a time and need to know if a
   203         -full Tcl_UniChar has been seen.
          209  +full Unicode character has been seen.
   204    210   .PP
   205    211   \fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings.  It
   206    212   returns the number of Tcl_UniChars that are represented by the UTF-8 string
   207    213   \fIsrc\fR.  The length of the source string is \fIlength\fR bytes.  If the
   208    214   length is negative, all bytes up to the first null byte are used.
   209    215   .PP
   210    216   \fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings.  It
   211         -returns a pointer to the first occurrence of the Tcl_UniChar \fIch\fR
          217  +returns a pointer to the first occurrence of the Unicode character \fIch\fR
   212    218   in the null-terminated UTF-8 string \fIsrc\fR.  The null terminator is
   213    219   considered part of the UTF-8 string.
   214    220   .PP
   215    221   \fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings.  It
   216         -returns a pointer to the last occurrence of the Tcl_UniChar \fIch\fR
          222  +returns a pointer to the last occurrence of the Unicode character \fIch\fR
   217    223   in the null-terminated UTF-8 string \fIsrc\fR.  The null terminator is
   218    224   considered part of the UTF-8 string.
   219    225   .PP
   220    226   Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
   221    227   \fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
   222    228   string.  The caller must not ask for the next character after the last
   223    229   character in the string if the string is not terminated by a null

Added doc/abstract.n.

            1  +'\"
            2  +'\" Copyright (c) 2018 Donal K. Fellows
            3  +'\"
            4  +'\" See the file "license.terms" for information on usage and redistribution
            5  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            6  +'\"
            7  +.TH abstract n 0.3 TclOO "TclOO Commands"
            8  +.so man.macros
            9  +.BS
           10  +'\" Note:  do not modify the .SH NAME line immediately below!
           11  +.SH NAME
           12  +oo::abstract \- a class that does not allow direct instances of itself
           13  +.SH SYNOPSIS
           14  +.nf
           15  +package require TclOO
           16  +
           17  +\fBoo::abstract\fI method \fR?\fIarg ...\fR?
           18  +.fi
           19  +.SH "CLASS HIERARCHY"
           20  +.nf
           21  +\fBoo::object\fR
           22  +   \(-> \fBoo::class\fR
           23  +       \(-> \fBoo::abstract\fR
           24  +.fi
           25  +.BE
           26  +.SH DESCRIPTION
           27  +Abstract classes are classes that can contain definitions, but which cannot be
           28  +directly manufactured; they are intended to only ever be inherited from and
           29  +instantiated indirectly. The characteristic methods of \fBoo::class\fR
           30  +(\fBcreate\fR and \fBnew\fR) are not exported by an instance of
           31  +\fBoo::abstract\fR.
           32  +.PP
           33  +Note that \fBoo::abstract\fR is not itself an instance of \fBoo::abstract\fR.
           34  +.SS CONSTRUCTOR
           35  +The \fBoo::abstract\fR class does not define an explicit constructor; this
           36  +means that it is effectively the same as the constructor of the
           37  +\fBoo::class\fR class.
           38  +.SS DESTRUCTOR
           39  +The \fBoo::abstract\fR class does not define an explicit destructor;
           40  +destroying an instance of it is just like destroying an ordinary class (and
           41  +will destroy all its subclasses).
           42  +.SS "EXPORTED METHODS"
           43  +The \fBoo::abstract\fR class defines no new exported methods.
           44  +.SS "NON-EXPORTED METHODS"
           45  +The \fBoo::abstract\fR class explicitly states that \fBcreate\fR,
           46  +\fBcreateWithNamespace\fR, and \fBnew\fR are unexported.
           47  +.SH EXAMPLES
           48  +.PP
           49  +This example defines a simple class hierarchy and creates a new instance of
           50  +it. It then invokes a method of the object before destroying the hierarchy and
           51  +showing that the destruction is transitive.
           52  +.PP
           53  +.CS
           54  +\fBoo::abstract\fR create fruit {
           55  +    method eat {} {
           56  +        puts "yummy!"
           57  +    }
           58  +}
           59  +oo::class create banana {
           60  +    superclass fruit
           61  +    method peel {} {
           62  +        puts "skin now off"
           63  +    }
           64  +}
           65  +set b [banana \fBnew\fR]
           66  +$b peel              \fI\(-> prints 'skin now off'\fR
           67  +$b eat               \fI\(-> prints 'yummy!'\fR
           68  +set f [fruit new]    \fI\(-> error 'unknown method "new"...'\fR
           69  +.CE
           70  +.SH "SEE ALSO"
           71  +oo::define(n), oo::object(n)
           72  +.SH KEYWORDS
           73  +abstract class, class, metaclass, object
           74  +.\" Local variables:
           75  +.\" mode: nroff
           76  +.\" fill-column: 78
           77  +.\" End:

Changes to doc/append.n.

    16     16   .BE
    17     17   .SH DESCRIPTION
    18     18   .PP
    19     19   Append all of the \fIvalue\fR arguments to the current value
    20     20   of variable \fIvarName\fR.  If \fIvarName\fR does not exist,
    21     21   it is given a value equal to the concatenation of all the
    22     22   \fIvalue\fR arguments.
           23  +.VS TIP508
           24  +If \fIvarName\fR indicate an element that does not exist of an array that has
           25  +a default value set, the concatenation of the default value and all the
           26  +\fIvalue\fR arguments will be stored in the array element.
           27  +.VE TIP508
    23     28   The result of this command is the new value stored in variable
    24     29   \fIvarName\fR.
    25     30   This command provides an efficient way to build up long
    26     31   variables incrementally.
    27     32   For example,
    28     33   .QW "\fBappend a $b\fR"
    29     34   is much more efficient than
................................................................................
    40     45   puts $var
    41     46   # Prints 0,1,2,3,4,5,6,7,8,9,10
    42     47   .CE
    43     48   .SH "SEE ALSO"
    44     49   concat(n), lappend(n)
    45     50   .SH KEYWORDS
    46     51   append, variable
    47         -'\" Local Variables:
    48         -'\" mode: nroff
    49         -'\" End:
           52  +.\" Local variables:
           53  +.\" mode: nroff
           54  +.\" fill-column: 78
           55  +.\" End:

Changes to doc/array.n.

     1      1   '\"
     2      2   '\" Copyright (c) 1993-1994 The Regents of the University of California.
     3      3   '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
     4      4   '\"
     5      5   '\" See the file "license.terms" for information on usage and redistribution
     6      6   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     7      7   '\"
     8         -.TH array n 8.3 Tcl "Tcl Built-In Commands"
            8  +.TH array n 8.7 Tcl "Tcl Built-In Commands"
     9      9   .so man.macros
    10     10   .BS
    11     11   '\" Note:  do not modify the .SH NAME line immediately below!
    12     12   .SH NAME
    13     13   array \- Manipulate array variables
    14     14   .SH SYNOPSIS
    15     15   \fBarray \fIoption arrayName\fR ?\fIarg arg ...\fR?
................................................................................
    31     31   \fISearchId\fR indicates which search on \fIarrayName\fR to
    32     32   check, and must have been the return value from a previous
    33     33   invocation of \fBarray startsearch\fR.
    34     34   This option is particularly useful if an array has an element
    35     35   with an empty name, since the return value from
    36     36   \fBarray nextelement\fR will not indicate whether the search
    37     37   has been completed.
           38  +.TP
           39  +\fBarray default \fIsubcommand arrayName args...\fR
           40  +.VS TIP508
           41  +Manages the default value of the array. Arrays initially have no default
           42  +value, but this command allows you to set one; the default value will be
           43  +returned when reading from an element of the array \farrayName\fR if the read
           44  +would otherwise result in an error. Note that this may cause the \fBappend\fR,
           45  +\fBdict\fR, \fBincr\fR and \fBlappend\fR commands to change their behavior in
           46  +relation to non-existing array elements.
           47  +.RS
           48  +.PP
           49  +The \fIsubcommand\fR argument controls what exact operation will be performed
           50  +on the default value of \fIarrayName\fR. Supported \fIsubcommand\fRs are:
           51  +.VE TIP508
           52  +.TP
           53  +\fBarray default exists \fIarrayName\fR
           54  +.VS TIP508
           55  +This returns a boolean value indicating whether a default value has been set
           56  +for the array \fIarrayName\fR. Returns a false value if \fIarrayName\fR does
           57  +not exist. Raises an error if \fIarrayName\fR is an existing variable that is
           58  +not an array.
           59  +.VE TIP508
           60  +.TP
           61  +\fBarray default get \fIarrayName\fR
           62  +.VS TIP508
           63  +This returns the current default value for the array \fIarrayName\fR.  Raises
           64  +an error if \fIarrayName\fR is an existing variable that is not an array, or
           65  +if \fIarrayName\fR is an array without a default value.
           66  +.VE TIP508
           67  +.TP
           68  +\fBarray default set \fIarrayName value\fR
           69  +.VS TIP508
           70  +This sets the default value for the array \fIarrayName\fR to \fIvalue\fR.
           71  +Returns the empty string. Raises an error if \fIarrayName\fR is an existing
           72  +variable that is not an array, or if \fIarrayName\fR is an illegal name for an
           73  +array. If \fIarrayName\fR does not currently exist, it is created as an empty
           74  +array as well as having its default value set.
           75  +.VE TIP508
           76  +.TP
           77  +\fBarray default unset \fIarrayName\fR
           78  +.VS TIP508
           79  +This removes the default value for the array \fIarrayName\fR and returns the
           80  +empty string. Does nothing if \fIarrayName\fR does not have a default
           81  +value. Raises an error if \fIarrayName\fR is an existing variable that is not
           82  +an array.
           83  +.VE TIP508
           84  +.RE
    38     85   .TP
    39     86   \fBarray donesearch \fIarrayName searchId\fR
    40     87   This command terminates an array search and destroys all the
    41     88   state associated with that search.  \fISearchId\fR indicates
    42     89   which search on \fIarrayName\fR to destroy, and must have
    43     90   been the return value from a previous invocation of
    44     91   \fBarray startsearch\fR.  Returns an empty string.
    45     92   .TP
    46     93   \fBarray exists \fIarrayName\fR
    47     94   Returns 1 if \fIarrayName\fR is an array variable, 0 if there
    48     95   is no variable by that name or if it is a scalar variable.
    49     96   .TP
           97  +\fBarray for {\fIkeyVariable valueVariable\fB} \fIarrayName body\fP
           98  +The first argument is a two element list of variable names for the
           99  +key and value of each entry in the array.  The second argument is the
          100  +array name to iterate over.  The third argument is the body to execute
          101  +for each key and value returned.
          102  +The ordering of the returned keys is undefined.
          103  +If an array element is deleted or a new array element is inserted during
          104  +the \fIarray for\fP process, the command will terminate with an error.
          105  +.TP
    50    106   \fBarray get \fIarrayName\fR ?\fIpattern\fR?
    51    107   Returns a list containing pairs of elements.  The first
    52    108   element in each pair is the name of an element in \fIarrayName\fR
    53    109   and the second element of each pair is the value of the
    54    110   array element.  The order of the pairs is undefined.
    55    111   If \fIpattern\fR is not specified, then all of the elements of the
    56    112   array are included in the result.
................................................................................
   181    237       number of buckets with 10 or more entries: 0
   182    238       average search distance for entry: 1.2
   183    239   .CE
   184    240   .SH "SEE ALSO"
   185    241   list(n), string(n), variable(n), trace(n), foreach(n)
   186    242   .SH KEYWORDS
   187    243   array, element names, search
          244  +.\" Local variables:
          245  +.\" mode: nroff
          246  +.\" fill-column: 78
          247  +.\" End:

Added doc/callback.n.

            1  +'\"
            2  +'\" Copyright (c) 2018 Donal K. Fellows
            3  +'\"
            4  +'\" See the file "license.terms" for information on usage and redistribution
            5  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            6  +'\"
            7  +.TH callback n 0.3 TclOO "TclOO Commands"
            8  +.so man.macros
            9  +.BS
           10  +'\" Note:  do not modify the .SH NAME line immediately below!
           11  +.SH NAME
           12  +callback, mymethod \- generate callbacks to methods
           13  +.SH SYNOPSIS
           14  +.nf
           15  +package require TclOO
           16  +
           17  +\fBcallback\fR \fImethodName\fR ?\fIarg ...\fR?
           18  +\fBmymethod\fR \fImethodName\fR ?\fIarg ...\fR?
           19  +.fi
           20  +.BE
           21  +.SH DESCRIPTION
           22  +The \fBcallback\fR command,
           23  +'\" Based on notes in the tcllib docs, we know the provenance of mymethod
           24  +also called \fBmymethod\fR for compatibility with the ooutil and snit packages
           25  +of Tcllib,
           26  +and which should only be used from within the context of a call to a method
           27  +(i.e. inside a method, constructor or destructor body) is used to generate a
           28  +script fragment that will invoke the method, \fImethodName\fR, on the current
           29  +object (as reported by \fBself\fR) when executed. Any additional arguments
           30  +provided will be provided as leading arguments to the callback. The resulting
           31  +script fragment shall be a proper list.
           32  +.PP
           33  +Note that it is up to the caller to ensure that the current object is able to
           34  +handle the call of \fImethodName\fR; this command does not check that.
           35  +\fImethodName\fR may refer to any exported or unexported method, but may not
           36  +refer to a private method as those can only be invoked directly from within
           37  +methods. If there is no such method present at the point when the callback is
           38  +invoked, the standard \fBunknown\fR method handler will be called.
           39  +.SH EXAMPLE
           40  +This is a simple echo server class. The \fBcallback\fR command is used in two
           41  +places, to arrange for the incoming socket connections to be handled by the
           42  +\fIAccept\fR method, and to arrange for the incoming bytes on those
           43  +connections to be handled by the \fIReceive\fR method.
           44  +.PP
           45  +.CS
           46  +oo::class create EchoServer {
           47  +    variable server clients
           48  +    constructor {port} {
           49  +        set server [socket -server [\fBcallback\fR Accept] $port]
           50  +        set clients {}
           51  +    }
           52  +    destructor {
           53  +        chan close $server
           54  +        foreach client [dict keys $clients] {
           55  +            chan close $client
           56  +        }
           57  +    }
           58  +
           59  +    method Accept {channel clientAddress clientPort} {
           60  +        dict set clients $channel [dict create \e
           61  +                address $clientAddress port $clientPort]
           62  +        chan event $channel readable [\fBcallback\fR Receive $channel]
           63  +    }
           64  +    method Receive {channel} {
           65  +        if {[chan gets $channel line] >= 0} {
           66  +            my echo $channel $line
           67  +        } else {
           68  +            chan close $channel
           69  +            dict unset clients $channel
           70  +        }
           71  +    }
           72  +
           73  +    method echo {channel line} {
           74  +        dict with clients $channel {
           75  +            chan puts $channel \e
           76  +                    [format {[%s:%d] %s} $address $port $line]
           77  +        }
           78  +    }
           79  +}
           80  +.CE
           81  +.SH "SEE ALSO"
           82  +chan(n), fileevent(n), my(n), self(n), socket(n), trace(n)
           83  +.SH KEYWORDS
           84  +callback, object
           85  +.\" Local Variables:
           86  +.\" mode: nroff
           87  +.\" fill-column: 78
           88  +.\" End:

Changes to doc/cd.n.

    37     37   .CS
    38     38   \fBcd\fR ../lib
    39     39   .CE
    40     40   .SH "SEE ALSO"
    41     41   filename(n), glob(n), pwd(n)
    42     42   .SH KEYWORDS
    43     43   working directory
           44  +'\" Local Variables:
           45  +'\" mode: nroff
           46  +'\" fill-column: 78
           47  +'\" End:

Added doc/classvariable.n.

            1  +'\"
            2  +'\" Copyright (c) 2011-2015 Andreas Kupries
            3  +'\" Copyright (c) 2018 Donal K. Fellows
            4  +'\"
            5  +'\" See the file "license.terms" for information on usage and redistribution
            6  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            7  +'\"
            8  +.TH classvariable n 0.3 TclOO "TclOO Commands"
            9  +.so man.macros
           10  +.BS
           11  +'\" Note:  do not modify the .SH NAME line immediately below!
           12  +.SH NAME
           13  +classvariable \- create link from local variable to variable in class
           14  +.SH SYNOPSIS
           15  +.nf
           16  +package require TclOO
           17  +
           18  +\fBclassvariable\fR \fIvariableName\fR ?\fI...\fR?
           19  +.fi
           20  +.BE
           21  +.SH DESCRIPTION
           22  +The \fBclassvariable\fR command is available within methods. It takes a series
           23  +of one or more variable names and makes them available in the method's scope;
           24  +those variable names must not be qualified and must not refer to array
           25  +elements. The originating scope for the variables is the namespace of the
           26  +class that the method was defined by. In other words, the referenced variables
           27  +are shared between all instances of that class.
           28  +.PP
           29  +Note: This command is equivalent to the command \fBtypevariable\fR provided by
           30  +the snit package in tcllib for approximately the same purpose. If used in a
           31  +method defined directly on a class instance (e.g., through the
           32  +\fBoo::objdefine\fR \fBmethod\fR definition) this is very much like just
           33  +using:
           34  +.PP
           35  +.CS
           36  +namespace upvar [namespace current] $var $var
           37  +.CE
           38  +.PP
           39  +for each variable listed to \fBclassvariable\fR.
           40  +.SH EXAMPLE
           41  +This class counts how many instances of it have been made.
           42  +.PP
           43  +.CS
           44  +oo::class create Counted {
           45  +    initialise {
           46  +        variable count 0
           47  +    }
           48  +
           49  +    variable number
           50  +    constructor {} {
           51  +        \fBclassvariable\fR count
           52  +        set number [incr count]
           53  +    }
           54  +
           55  +    method report {} {
           56  +        \fBclassvariable\fR count
           57  +        puts "This is instance $number of $count"
           58  +    }
           59  +}
           60  +
           61  +set a [Counted new]
           62  +set b [Counted new]
           63  +$a report
           64  +        \fI\(-> This is instance 1 of 2\fR
           65  +set c [Counted new]
           66  +$b report
           67  +        \fI\(-> This is instance 2 of 3\fR
           68  +$c report
           69  +        \fI\(-> This is instance 3 of 3\fR
           70  +.CE
           71  +.SH "SEE ALSO"
           72  +global(n), namespace(n), oo::class(n), oo::define(n), upvar(n), variable(n)
           73  +.SH KEYWORDS
           74  +class, class variable, variable
           75  +.\" Local Variables:
           76  +.\" mode: nroff
           77  +.\" fill-column: 78
           78  +.\" End:

Changes to doc/clock.n.

   448    448   If a format string lacks a \fB%z\fR or \fB%Z\fR format group,
   449    449   it is possible for the time to be ambiguous because it appears twice
   450    450   in the same day, once without and once with Daylight Saving Time.
   451    451   If this situation occurs, the first occurrence of the time is chosen.
   452    452   (For this reason, it is wise to have the input string contain the
   453    453   time zone when converting local times.  This caveat does not apply to
   454    454   UTC times.)
          455  +.PP
          456  +If the interpretation of the groups yields an impossible time because
          457  +a field is out of range, enough of that field's unit will be added to
          458  +or subtracted from the time to bring it in range. Thus, if attempting to
          459  +scan or format day 0 of the month, one day will be subtracted from day
          460  +1 of the month, yielding the last day of the previous month.
          461  +.PP
          462  +If the interpretation of the groups yields an impossible time because
          463  +a Daylight Saving Time change skips over that time, or an ambiguous
          464  +time because a Daylight Saving Time change skips back so that the clock
          465  +observes the given time twice, and no time zone specifier (\fB%z\fR
          466  +or \fB%Z\fR) is present in the format, the time is interpreted as
          467  +if the clock had not changed.
   455    468   .SH "FORMAT GROUPS"
   456    469   .PP
   457    470   The following format groups are recognized by the \fBclock scan\fR and
   458    471   \fBclock format\fR commands.
   459    472   .TP
   460    473   \fB%a\fR
   461    474   On output, receives an abbreviation (\fIe.g.,\fR \fBMon\fR) for the day
................................................................................
   869    882   time.  This is useful for determining the time on a specific day or
   870    883   doing other date-relative conversions.
   871    884   .PP
   872    885   The \fIinputString\fR argument consists of zero or more specifications of the
   873    886   following form:
   874    887   .TP
   875    888   \fItime\fR
   876         -A time of day, which is of the form: \fBhh?:mm?:ss?? ?meridian? ?zone?\fR
   877         -or \fBhhmm ?meridian? ?zone?\fR
   878         -If no meridian is specified, \fBhh\fR is interpreted on
          889  +.
          890  +A time of day, which is of the form:
          891  +.QW "\fIhh\fR?\fB:\fImm\fR?\fB:\fIss\fR?? ?\fImeridian\fR? ?\fIzone\fR?"
          892  +or
          893  +.QW "\fBhhmm \fR?\fBmeridian\fR? ?\fBzone\fR?" .
          894  +If no \fImeridian\fR is specified, \fIhh\fR is interpreted on
   879    895   a 24-hour clock.
   880    896   .TP
   881    897   \fIdate\fR
          898  +.
   882    899   A specific month and day with optional year.  The
   883    900   acceptable formats are
   884         -.QW "\fBmm/dd\fR?\fB/yy\fR?" ,
   885         -.QW "\fBmonthname dd\fR?\fB, yy\fR?" ,
   886         -.QW "\fBday, dd monthname \fR?\fByy\fR?" ,
   887         -.QW "\fBdd monthname yy\fR" ,
   888         -.QW "?\fBCC\fR?\fByymmdd\fR" ,
          901  +.QW "\fImm\fB/\fIdd\fR?\fB/\fIyy\fR?" ,
          902  +.QW "\fImonthname dd\fR?\fB, \fIyy\fR?" ,
          903  +.QW "\fIday\fB, \fIdd monthname \fR?\fIyy\fR?" ,
          904  +.QW "\fIdd monthname yy\fR" ,
          905  +.QW "?\fICC\fR?\fIyymmdd\fR" ,
   889    906   and
   890         -.QW "\fBdd-monthname-\fR?\fBCC\fR?\fByy\fR" .
          907  +.QW "\fIdd\fB-\fImonthname\fB-\fR?\fICC\fR?\fIyy\fR" .
   891    908   The default year is the current year.  If the year is less
   892    909   than 100, we treat the years 00-68 as 2000-2068 and the years 69-99
   893    910   as 1969-1999.  Not all platforms can represent the years 38-70, so
   894    911   an error may result if these years are used.
   895    912   .TP
   896    913   \fIISO 8601 point-in-time\fR
          914  +.
   897    915   An ISO 8601 point-in-time specification, such as
   898    916   .QW \fICCyymmdd\fBT\fIhhmmss\fR,
   899    917   where \fBT\fR is the literal
   900    918   .QW T ,
   901    919   .QW "\fICCyymmdd hhmmss\fR" ,
   902    920   or
   903         -.QW \fICCyymmdd\fBT\fIhh:mm:ss\fR .
          921  +.QW \fICCyymmdd\fBT\fIhh\fB:\fImm\fB:\fIss\fR .
   904    922   Note that only these three formats are accepted.
   905    923   The command does \fInot\fR accept the full range of point-in-time
   906    924   specifications specified in ISO8601.  Other formats can be recognized by
   907    925   giving an explicit \fB\-format\fR option to the \fBclock scan\fR command.
   908    926   .TP
   909    927   \fIrelative time\fR
          928  +.
   910    929   A specification relative to the current time.  The format is \fBnumber
   911    930   unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
   912    931   \fBmonth\fR, \fBweek\fR, \fBday\fR,
   913    932   \fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR).  The
   914    933   unit can be specified as a singular or plural, as in \fB3 weeks\fR.
   915    934   These modifiers may also be specified:
   916    935   \fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR,

Changes to doc/define.n.

     1      1   '\"
     2         -'\" Copyright (c) 2007 Donal K. Fellows
            2  +'\" Copyright (c) 2007-2018 Donal K. Fellows
     3      3   '\"
     4      4   '\" See the file "license.terms" for information on usage and redistribution
     5      5   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      6   '\"
     7      7   .TH define n 0.3 TclOO "TclOO Commands"
     8      8   .so man.macros
     9      9   .BS
................................................................................
    34     34   \fIarg\fR arguments; when the second is present, it is exactly as if all the
    35     35   arguments from \fIsubcommand\fR onwards are made into a list and that list is
    36     36   used as the \fIdefScript\fR argument.
    37     37   .SS "CONFIGURING CLASSES"
    38     38   .PP
    39     39   The following commands are supported in the \fIdefScript\fR for
    40     40   \fBoo::define\fR, each of which may also be used in the \fIsubcommand\fR form:
           41  +.TP
           42  +\fBclassmethod\fI name\fR ?\fIargList bodyScrip\fR?
           43  +.VS TIP478
           44  +This creates a class method, or (if \fIargList\fR and \fIbodyScript\fR are
           45  +omitted) promotes an existing method on the class object to be a class
           46  +method. The \fIname\fR, \fIargList\fR and \fIbodyScript\fR arguments are as in
           47  +the \fBmethod\fR definition, below.
           48  +.RS
           49  +.PP
           50  +Class methods can be called on either the class itself or on the instances of
           51  +that class. When they are called, the current object (see the \fBself\R and
           52  +\fBmy\fR commands) is the class on which they are called or the class of the
           53  +instance on which they are called, depending on whether they are called on the
           54  +class or an instance of the class, respectively. If called on a subclass or
           55  +instance of the subclass, the current object is the subclass.
           56  +.PP
           57  +In a private definition context, the methods as invoked on classes are
           58  +\fInot\fR private, but the methods as invoked on instances of classes are
           59  +private.
           60  +.RE
           61  +.VE TIP478
    41     62   .TP
    42     63   \fBconstructor\fI argList bodyScript\fR
    43     64   .
    44     65   This creates or updates the constructor for a class. The formal arguments to
    45     66   the constructor (defined using the same format as for the Tcl \fBproc\fR
    46     67   command) will be \fIargList\fR, and the body of the constructor will be
    47     68   \fIbodyScript\fR. When the body of the constructor is evaluated, the current
    48     69   namespace of the constructor will be a namespace that is unique to the object
    49     70   being constructed. Within the constructor, the \fBnext\fR command should be
    50     71   used to call the superclasses' constructors. If \fIbodyScript\fR is the empty
    51     72   string, the constructor will be deleted.
    52     73   .TP
    53         -\fBdeletemethod\fI name\fR ?\fIname ...\fR
           74  +\fBdeletemethod\fI name\fR ?\fIname ...\fR?
    54     75   .
    55     76   This deletes each of the methods called \fIname\fR from a class. The methods
    56     77   must have previously existed in that class. Does not affect the superclasses
    57     78   of the class, nor does it affect the subclasses or instances of the class
    58     79   (except when they have a call chain through the class being modified).
    59     80   .TP
    60     81   \fBdestructor\fI bodyScript\fR
................................................................................
    78     99   This arranges for each of the named methods, \fIname\fR, to be exported
    79    100   (i.e. usable outside an instance through the instance object's command) by the
    80    101   class being defined. Note that the methods themselves may be actually defined
    81    102   by a superclass; subclass exports override superclass visibility, and may in
    82    103   turn be overridden by instances.
    83    104   .TP
    84    105   \fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR?
    85         -.VS
          106  +.
    86    107   This slot (see \fBSLOTTED DEFINITIONS\fR below)
    87         -.VE
    88    108   sets or updates the list of method names that are used to guard whether
    89    109   method call to instances of the class may be called and what the method's
    90    110   results are. Each \fImethodName\fR names a single filtering method (which may
    91    111   be exposed or not exposed); it is not an error for a non-existent method to be
    92    112   named since they may be defined by subclasses.
    93         -.VS
    94    113   By default, this slot works by appending.
    95         -.VE
    96    114   .TP
    97    115   \fBforward\fI name cmdName \fR?\fIarg ...\fR?
    98    116   .
    99    117   This creates or updates a forwarded method called \fIname\fR. The method is
   100    118   defined be forwarded to the command called \fIcmdName\fR, with additional
   101    119   arguments, \fIarg\fR etc., added before those arguments specified by the
   102    120   caller of the method. The \fIcmdName\fR will always be resolved using the
   103    121   rules of the invoking objects' namespaces, i.e., when \fIcmdName\fR is not
   104    122   fully-qualified, the command will be searched for in each object's namespace,
   105    123   using the instances' namespace's path, or by looking in the global namespace.
   106    124   The method will be exported if \fIname\fR starts with a lower-case letter, and
   107    125   non-exported otherwise.
          126  +.RS
          127  +.PP
          128  +.VS TIP500
          129  +If in a private definition context (see the \fBprivate\fR definition command,
          130  +below), this command creates private forwarded methods.
          131  +.VE TIP500
          132  +.RE
          133  +.TP
          134  +\fBinitialise\fI script\fR
          135  +.TP
          136  +\fBinitialize\fI script\fR
          137  +.VS TIP478
          138  +This evaluates \fIscript\fR in a context which supports local variables and
          139  +where the current namespace is the instance namespace of the class object
          140  +itself. This is useful for setting up, e.g., class-scoped variables.
          141  +.VE TIP478
   108    142   .TP
   109    143   \fBmethod\fI name argList bodyScript\fR
   110    144   .
   111    145   This creates or updates a method that is implemented as a procedure-like
   112    146   script. The name of the method is \fIname\fR, the formal arguments to the
   113    147   method (defined using the same format as for the Tcl \fBproc\fR command) will
   114    148   be \fIargList\fR, and the body of the method will be \fIbodyScript\fR. When
   115    149   the body of the method is evaluated, the current namespace of the method will
   116    150   be a namespace that is unique to the current object. The method will be
   117    151   exported if \fIname\fR starts with a lower-case letter, and non-exported
   118    152   otherwise; this behavior can be overridden via \fBexport\fR and
   119    153   \fBunexport\fR.
          154  +.RS
          155  +.PP
          156  +.VS TIP500
          157  +If in a private definition context (see the \fBprivate\fR definition command,
          158  +below), this command creates private procedure-like methods.
          159  +.VE TIP500
          160  +.RE
   120    161   .TP
   121    162   \fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
   122         -.VS
          163  +.
   123    164   This slot (see \fBSLOTTED DEFINITIONS\fR below)
   124         -.VE
   125    165   sets or updates the list of additional classes that are to be mixed into
   126    166   all the instances of the class being defined. Each \fIclassName\fR argument
   127    167   names a single class that is to be mixed in.
   128         -.VS
   129    168   By default, this slot works by replacement.
   130         -.VE
          169  +.TP
          170  +\fBprivate \fIcmd arg...\fR
          171  +.TP
          172  +\fBprivate \fIscript\fR
          173  +.
          174  +.VS TIP500
          175  +This evaluates the \fIscript\fR (or the list of command and arguments given by
          176  +\fIcmd\fR and \fIarg\fRs) in a context where the definitions made on the
          177  +current class will be private definitions.
          178  +.RS
          179  +.PP
          180  +The following class definition commands are affected by \fBprivate\fR:
          181  +\fBforward\fR, \fBmethod\fR, \fBself\fR, and \fBvariable\fR. Nesting
          182  +\fBprivate\fR inside \fBprivate\fR has no cumulative effect; the innermost
          183  +definition context is just a private definition context. All other definition
          184  +commands have no difference in behavior when used in a private definition
          185  +context.
          186  +.RE
          187  +.VE TIP500
   131    188   .TP
   132    189   \fBrenamemethod\fI fromName toName\fR
   133    190   .
   134    191   This renames the method called \fIfromName\fR in a class to \fItoName\fR. The
   135    192   method must have previously existed in the class, and \fItoName\fR must not
   136    193   previously refer to a method in that class. Does not affect the superclasses
   137    194   of the class, nor does it affect the subclasses or instances of the class
................................................................................
   155    212   .QW "\fBoo::objdefine \fIcls subcommand ...\fR" .
   156    213   .RS
   157    214   .PP
   158    215   .VS TIP470
   159    216   If no arguments at all are used, this gives the name of the class currently
   160    217   being configured.
   161    218   .VE TIP470
          219  +.VS TIP500
          220  +If in a private definition context (see the \fBprivate\fR definition command,
          221  +below), the definitions on the class object will also be made in a private
          222  +definition context.
          223  +.VE TIP500
   162    224   .RE
   163    225   .TP
   164    226   \fBsuperclass\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
   165         -.VS
          227  +.
   166    228   This slot (see \fBSLOTTED DEFINITIONS\fR below)
   167         -.VE
   168    229   allows the alteration of the superclasses of the class being defined.
   169    230   Each \fIclassName\fR argument names one class that is to be a superclass of
   170    231   the defined class. Note that objects must not be changed from being classes to
   171    232   being non-classes or vice-versa, that an empty parent class is equivalent to
   172    233   \fBoo::object\fR, and that the parent classes of \fBoo::object\fR and
   173    234   \fBoo::class\fR may not be modified.
   174         -.VS
   175    235   By default, this slot works by replacement.
   176         -.VE
   177    236   .TP
   178    237   \fBunexport\fI name \fR?\fIname ...\fR?
   179    238   .
   180    239   This arranges for each of the named methods, \fIname\fR, to be not exported
   181    240   (i.e. not usable outside the instance through the instance object's command,
   182    241   but instead just through the \fBmy\fR command visible in each object's
   183    242   context) by the class being defined. Note that the methods themselves may be
   184    243   actually defined by a superclass; subclass unexports override superclass
   185    244   visibility, and may be overridden by instance unexports.
   186    245   .TP
   187    246   \fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR?
   188         -.VS
          247  +.
   189    248   This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named
   190    249   variables to be automatically made
   191    250   available in the methods, constructor and destructor declared by the class
   192    251   being defined. Each variable name must not have any namespace
   193    252   separators and must not look like an array access. All variables will be
   194         -actually present in the instance object on which the method is executed. Note
          253  +actually present in the namespace of the instance object on which the method
          254  +is executed. Note
   195    255   that the variable lists declared by a superclass or subclass are completely
   196    256   disjoint, as are variable lists declared by instances; the list of variable
   197    257   names is just for methods (and constructors and destructors) declared by this
   198    258   class. By default, this slot works by appending.
   199         -.VE
          259  +.RS
          260  +.PP
          261  +.VS TIP500
          262  +If in a private definition context (see the \fBprivate\fR definition command,
          263  +below), this slot manipulates the list of private variable bindings for this
          264  +class. In a private variable binding, the name of the variable within the
          265  +instance object is different to the name given in the definition; the name
          266  +used in the definition is the name that you use to access the variable within
          267  +the methods of this class, and the name of the variable in the instance
          268  +namespace has a unique prefix that makes accidental use from other classes
          269  +extremely unlikely.
          270  +.VE TIP500
          271  +.RE
   200    272   .SS "CONFIGURING OBJECTS"
   201    273   .PP
   202    274   The following commands are supported in the \fIdefScript\fR for
   203    275   \fBoo::objdefine\fR, each of which may also be used in the \fIsubcommand\fR
   204    276   form:
   205    277   .TP
   206    278   \fBclass\fI className\fR
................................................................................
   219    291   .
   220    292   This arranges for each of the named methods, \fIname\fR, to be exported
   221    293   (i.e. usable outside the object through the object's command) by the object
   222    294   being defined. Note that the methods themselves may be actually defined by a
   223    295   class or superclass; object exports override class visibility.
   224    296   .TP
   225    297   \fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR?
   226         -.VS
          298  +.
   227    299   This slot (see \fBSLOTTED DEFINITIONS\fR below)
   228         -.VE
   229    300   sets or updates the list of method names that are used to guard whether a
   230    301   method call to the object may be called and what the method's results are.
   231    302   Each \fImethodName\fR names a single filtering method (which may be exposed or
   232    303   not exposed); it is not an error for a non-existent method to be named. Note
   233    304   that the actual list of filters also depends on the filters set upon any
   234    305   classes that the object is an instance of.
   235         -.VS
   236    306   By default, this slot works by appending.
   237         -.VE
   238    307   .TP
   239    308   \fBforward\fI name cmdName \fR?\fIarg ...\fR?
   240    309   .
   241    310   This creates or updates a forwarded object method called \fIname\fR. The
   242    311   method is defined be forwarded to the command called \fIcmdName\fR, with
   243    312   additional arguments, \fIarg\fR etc., added before those arguments specified
   244    313   by the caller of the method. Forwarded methods should be deleted using the
   245    314   \fBmethod\fR subcommand. The method will be exported if \fIname\fR starts with
   246    315   a lower-case letter, and non-exported otherwise.
          316  +.RS
          317  +.PP
          318  +.VS TIP500
          319  +If in a private definition context (see the \fBprivate\fR definition command,
          320  +below), this command creates private forwarded methods.
          321  +.VE TIP500
          322  +.RE
   247    323   .TP
   248    324   \fBmethod\fI name argList bodyScript\fR
   249    325   .
   250    326   This creates, updates or deletes an object method. The name of the method is
   251    327   \fIname\fR, the formal arguments to the method (defined using the same format
   252    328   as for the Tcl \fBproc\fR command) will be \fIargList\fR, and the body of the
   253    329   method will be \fIbodyScript\fR. When the body of the method is evaluated, the
   254    330   current namespace of the method will be a namespace that is unique to the
   255    331   object. The method will be exported if \fIname\fR starts with a lower-case
   256    332   letter, and non-exported otherwise.
          333  +.RS
          334  +.PP
          335  +.VS TIP500
          336  +If in a private definition context (see the \fBprivate\fR definition command,
          337  +below), this command creates private procedure-like methods.
          338  +.VE TIP500
          339  +.RE
   257    340   .TP
   258    341   \fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR?
   259         -.VS
          342  +.
   260    343   This slot (see \fBSLOTTED DEFINITIONS\fR below)
   261         -.VE
   262    344   sets or updates a per-object list of additional classes that are to be
   263    345   mixed into the object. Each argument, \fIclassName\fR, names a single class
   264    346   that is to be mixed in.
   265         -.VS
   266    347   By default, this slot works by replacement.
   267         -.VE
          348  +.TP
          349  +\fBprivate \fIcmd arg...\fR
          350  +.TP
          351  +\fBprivate \fIscript\fR
          352  +.VS TIP500
          353  +This evaluates the \fIscript\fR (or the list of command and arguments given by
          354  +\fIcmd\fR and \fIarg\fRs) in a context where the definitions made on the
          355  +current object will be private definitions.
          356  +.RS
          357  +.PP
          358  +The following class definition commands are affected by \fBprivate\fR:
          359  +\fBforward\fR, \fBmethod\fR, and \fBvariable\fR. Nesting \fBprivate\fR inside
          360  +\fBprivate\fR has no cumulative effect; the innermost definition context is
          361  +just a private definition context. All other definition commands have no
          362  +difference in behavior when used in a private definition context.
          363  +.RE
          364  +.VE TIP500
   268    365   .TP
   269    366   \fBrenamemethod\fI fromName toName\fR
   270    367   .
   271    368   This renames the method called \fIfromName\fR in an object to \fItoName\fR.
   272    369   The method must have previously existed in the object, and \fItoName\fR must
   273    370   not previously refer to a method in that object. Does not affect the classes
   274    371   that the object is an instance of. Does not change the export status of the
   275    372   method; if it was exported before, it will be afterwards.
   276    373   .TP
   277    374   \fBself \fR
   278         -.
   279    375   .VS TIP470
   280    376   This gives the name of the object currently being configured.
   281    377   .VE TIP470
   282    378   .TP
   283    379   \fBunexport\fI name \fR?\fIname ...\fR?
   284    380   .
   285    381   This arranges for each of the named methods, \fIname\fR, to be not exported
   286    382   (i.e. not usable outside the object through the object's command, but instead
   287    383   just through the \fBmy\fR command visible in the object's context) by the
   288    384   object being defined. Note that the methods themselves may be actually defined
   289    385   by a class; instance unexports override class visibility.
   290    386   .TP
   291    387   \fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR?
   292         -.VS
          388  +.
   293    389   This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named
   294    390   variables to be automatically made available in the methods declared by the
   295    391   object being defined.  Each variable name must not have any namespace
   296    392   separators and must not look like an array access. All variables will be
   297         -actually present in the object on which the method is executed. Note that the
          393  +actually present in the namespace of the object on which the method is
          394  +executed. Note that the
   298    395   variable lists declared by the classes and mixins of which the object is an
   299    396   instance are completely disjoint; the list of variable names is just for
   300    397   methods declared by this object. By default, this slot works by appending.
          398  +.RS
          399  +.PP
          400  +.VS TIP500
          401  +If in a private definition context (see the \fBprivate\fR definition command,
          402  +below), this slot manipulates the list of private variable bindings for this
          403  +object.  In a private variable binding, the name of the variable within the
          404  +instance object is different to the name given in the definition; the name
          405  +used in the definition is the name that you use to access the variable within
          406  +the methods of this instance object, and the name of the variable in the
          407  +instance namespace has a unique prefix that makes accidental use from
          408  +superclass methods extremely unlikely.
          409  +.VE TIP500
          410  +.RE
          411  +.SH "PRIVATE METHODS"
          412  +.VS TIP500
          413  +When a class or instance has a private method, that private method can only be
          414  +invoked from within methods of that class or instance. Other callers of the
          415  +object's methods \fIcannot\fR invoke private methods, it is as if the private
          416  +methods do not exist. However, a private method of a class \fIcan\fR be
          417  +invoked from the class's methods when those methods are being used on another
          418  +instance object; this means that a class can use them to coordinate behaviour
          419  +between several instances of itself without interfering with how other
          420  +classes (especially either subclasses or superclasses) interact. Private
          421  +methods precede all mixed in classes in the method call order (as reported by
          422  +\fBself call\fR).
          423  +.VE TIP500
   301    424   .SH "SLOTTED DEFINITIONS"
   302    425   Some of the configurable definitions of a class or object are \fIslotted
   303    426   definitions\fR. This means that the configuration is implemented by a slot
   304    427   object, that is an instance of the class \fBoo::Slot\fR, which manages a list
   305    428   of values (class names, variable names, etc.) that comprises the contents of
   306         -the slot. The class defines three operations (as methods) that may be done on
          429  +the slot. The class defines five operations (as methods) that may be done on
   307    430   the slot:
   308         -.VE
   309    431   .TP
   310    432   \fIslot\fR \fB\-append\fR ?\fImember ...\fR?
   311         -.VS
          433  +.
   312    434   This appends the given \fImember\fR elements to the slot definition.
   313         -.VE
   314    435   .TP
   315    436   \fIslot\fR \fB\-clear\fR
   316         -.VS
          437  +.
   317    438   This sets the slot definition to the empty list.
   318         -.VE
          439  +.TP
          440  +\fIslot\fR \fB\-prepend\fR ?\fImember ...\fR?
          441  +.VS TIP516
          442  +This prepends the given \fImember\fR elements to the slot definition.
          443  +.VE TIP516
          444  +.TP
          445  +\fIslot\fR \fB\-remove\fR ?\fImember ...\fR?
          446  +.VS TIP516
          447  +This removes the given \fImember\fR elements from the slot definition.
          448  +.VE TIP516
   319    449   .TP
   320    450   \fIslot\fR \fB\-set\fR ?\fImember ...\fR?
   321         -.VS
          451  +.
   322    452   This replaces the slot definition with the given \fImember\fR elements.
   323    453   .PP
   324    454   A consequence of this is that any use of a slot's default operation where the
   325    455   first member argument begins with a hyphen will be an error. One of the above
   326    456   operations should be used explicitly in those circumstances.
   327    457   .SS "SLOT IMPLEMENTATION"
   328    458   Internally, slot objects also define a method \fB\-\-default\-operation\fR
   329    459   which is forwarded to the default operation of the slot (thus, for the class
   330    460   .QW \fBvariable\fR
   331    461   slot, this is forwarded to
   332    462   .QW "\fBmy \-append\fR" ),
   333    463   and these methods which provide the implementation interface:
   334         -.VE
   335    464   .TP
   336    465   \fIslot\fR \fBGet\fR
   337         -.VS
   338         -Returns a list that is the current contents of the slot. This method must
   339         -always be called from a stack frame created by a call to \fBoo::define\fR or
   340         -\fBoo::objdefine\fR.
   341         -.VE
          466  +.
          467  +Returns a list that is the current contents of the slot, but does not modify
          468  +the slot. This method must always be called from a stack frame created by a
          469  +call to \fBoo::define\fR or \fBoo::objdefine\fR. This method \fIshould not\fR
          470  +return an error unless it is called from outside a definition context or with
          471  +the wrong number of arguments.
          472  +.RS
          473  +.PP
          474  +.VS TIP516
          475  +The elements of the list should be fully resolved, if that is a meaningful
          476  +concept to the slot.
          477  +.VE TIP516
          478  +.RE
          479  +.TP
          480  +\fIslot\fR \fBResolve\fR \fIslotElement\fR
          481  +.VS TIP516
          482  +Returns \fIslotElement\fR with a resolution operation applied to it, but does
          483  +not modify the slot. For slots of simple strings, this is an operation that
          484  +does nothing, whereas for slots of classes, this maps a class name to its
          485  +fully-qualified class name.  This method must always be called from a stack
          486  +frame created by a call to \fBoo::define\fR or \fBoo::objdefine\fR.  This
          487  +method \fIshould not\fR return an error unless it is called from outside a
          488  +definition context or with the wrong number of arguments; unresolvable
          489  +arguments should be returned as is (as not all slot operations strictly
          490  +require that values are resolvable to work).
          491  +.RS
          492  +.PP
          493  +Implementations \fIshould not\fR enforce uniqueness and ordering constraints
          494  +in this method; that is the responsibility of the \fBSet\fR method.
          495  +.RE
          496  +.VE TIP516
   342    497   .TP
   343    498   \fIslot\fR \fBSet \fIelementList\fR
   344         -.VS
          499  +.
   345    500   Sets the contents of the slot to the list \fIelementList\fR and returns the
   346    501   empty string. This method must always be called from a stack frame created by
   347         -a call to \fBoo::define\fR or \fBoo::objdefine\fR.
          502  +a call to \fBoo::define\fR or \fBoo::objdefine\fR. This method may return an
          503  +error if it rejects the change to the slot contents (e.g., because of invalid
          504  +values) as well as if it is called from outside a definition context or with
          505  +the wrong number of arguments.
          506  +.RS
          507  +.PP
          508  +This method \fImay\fR reorder and filter the elements if this is necessary in
          509  +order to satisfy the underlying constraints of the slot. (For example, slots
          510  +of classes enforce a uniqueness constraint that places each element in the
          511  +earliest location in the slot that it can.)
          512  +.RE
   348    513   .PP
   349    514   The implementation of these methods is slot-dependent (and responsible for
   350    515   accessing the correct part of the class or object definition). Slots also have
   351    516   an unknown method handler to tie all these pieces together, and they hide
   352    517   their \fBdestroy\fR method so that it is not invoked inadvertently. It is
   353    518   \fIrecommended\fR that any user changes to the slot mechanism be restricted to
   354    519   defining new operations whose names start with a hyphen.
   355         -.VE
          520  +.PP
          521  +.VS TIP516
          522  +Most slot operations will initially \fBResolve\fR their argument list, combine
          523  +it with the results of the \fBGet\fR method, and then \fBSet\fR the result.
          524  +Some operations omit one or both of the first two steps; omitting the third
          525  +would result in an idempotent read-only operation (but the standard mechanism
          526  +for reading from slots is via \fBinfo class\fR and \fBinfo object\fR).
          527  +.VE TIP516
   356    528   .SH EXAMPLES
   357    529   This example demonstrates how to use both forms of the \fBoo::define\fR and
   358    530   \fBoo::objdefine\fR commands (they work in the same way), as well as
   359    531   illustrating four of the subcommands of them.
   360    532   .PP
   361    533   .CS
   362    534   oo::class create c
................................................................................
   405    577   }
   406    578   \fBoo::objdefine\fR inst {
   407    579       \fBmixin -append\fR B
   408    580   }
   409    581   inst m1              \fI\(-> prints "red brick"\fR
   410    582   inst m2              \fI\(-> prints "blue brick"\fR
   411    583   .CE
          584  +.PP
          585  +.VS TIP478
          586  +This example shows how to create and use class variables. It is a class that
          587  +counts how many instances of itself have been made.
          588  +.PP
          589  +.CS
          590  +oo::class create Counted
          591  +\fBoo::define\fR Counted {
          592  +    \fBinitialise\fR {
          593  +        variable count 0
          594  +    }
          595  +
          596  +    \fBvariable\fR number
          597  +    \fBconstructor\fR {} {
          598  +        classvariable count
          599  +        set number [incr count]
          600  +    }
          601  +
          602  +    \fBmethod\fR report {} {
          603  +        classvariable count
          604  +        puts "This is instance $number of $count"
          605  +    }
          606  +}
          607  +
          608  +set a [Counted new]
          609  +set b [Counted new]
          610  +$a report
          611  +        \fI\(-> This is instance 1 of 2\fR
          612  +set c [Counted new]
          613  +$b report
          614  +        \fI\(-> This is instance 2 of 3\fR
          615  +$c report
          616  +        \fI\(-> This is instance 3 of 3\fR
          617  +.CE
          618  +.PP
          619  +This example demonstrates how to use class methods. (Note that the constructor
          620  +for \fBoo::class\fR calls \fBoo::define\fR on the class.)
          621  +.PP
          622  +.CS
          623  +oo::class create DBTable {
          624  +    \fBclassmethod\fR find {description} {
          625  +        puts "DB: locate row from [self] matching $description"
          626  +        return [my new]
          627  +    }
          628  +    \fBclassmethod\fR insert {description} {
          629  +        puts "DB: create row in [self] matching $description"
          630  +        return [my new]
          631  +    }
          632  +    \fBmethod\fR update {description} {
          633  +        puts "DB: update row [self] with $description"
          634  +    }
          635  +    \fBmethod\fR delete {} {
          636  +        puts "DB: delete row [self]"
          637  +        my destroy; # Just delete the object, not the DB row
          638  +    }
          639  +}
          640  +
          641  +oo::class create Users {
          642  +    \fBsuperclass\fR DBTable
          643  +}
          644  +oo::class create Groups {
          645  +    \fBsuperclass\fR DBTable
          646  +}
          647  +
          648  +set u1 [Users insert "username=abc"]
          649  +        \fI\(-> DB: create row from ::Users matching username=abc\fR
          650  +set u2 [Users insert "username=def"]
          651  +        \fI\(-> DB: create row from ::Users matching username=def\fR
          652  +$u2 update "group=NULL"
          653  +        \fI\(-> DB: update row ::oo::Obj124 with group=NULL\fR
          654  +$u1 delete
          655  +        \fI\(-> DB: delete row ::oo::Obj123\fR
          656  +set g [Group find "groupname=webadmins"]
          657  +        \fI\(-> DB: locate row ::Group with groupname=webadmins\fR
          658  +$g update "emailaddress=admins"
          659  +        \fI\(-> DB: update row ::oo::Obj125 with emailaddress=admins\fR
          660  +.CE
          661  +.VE TIP478
   412    662   .SH "SEE ALSO"
   413    663   next(n), oo::class(n), oo::object(n)
   414    664   .SH KEYWORDS
   415    665   class, definition, method, object, slot
   416    666   .\" Local variables:
   417    667   .\" mode: nroff
   418    668   .\" fill-column: 78
   419    669   .\" End:

Changes to doc/dict.n.

    23     23   \fBdict append \fIdictionaryVariable key \fR?\fIstring ...\fR?
    24     24   .
    25     25   This appends the given string (or strings) to the value that the given
    26     26   key maps to in the dictionary value contained in the given variable,
    27     27   writing the resulting dictionary value back to that variable.
    28     28   Non-existent keys are treated as if they map to an empty string. The
    29     29   updated dictionary value is returned.
           30  +.VS TIP508
           31  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
           32  +array that has a default value set, the default value and will be used as the
           33  +value of the dictionary prior to the appending operation.
           34  +.VE TIP508
    30     35   .TP
    31     36   \fBdict create \fR?\fIkey value ...\fR?
    32     37   .
    33     38   Return a new dictionary that contains each of the key/value mappings
    34     39   listed as arguments (keys and values alternating, with each key being
    35     40   followed by its associated value.)
    36     41   .TP
................................................................................
   120    125   This adds the given increment value (an integer that defaults to 1 if
   121    126   not specified) to the value that the given key maps to in the
   122    127   dictionary value contained in the given variable, writing the
   123    128   resulting dictionary value back to that variable. Non-existent keys
   124    129   are treated as if they map to 0. It is an error to increment a value
   125    130   for an existing key if that value is not an integer. The updated
   126    131   dictionary value is returned.
          132  +.VS TIP508
          133  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          134  +array that has a default value set, the default value and will be used as the
          135  +value of the dictionary prior to the incrementing operation.
          136  +.VE TIP508
   127    137   .TP
   128    138   \fBdict info \fIdictionaryValue\fR
   129    139   .
   130    140   This returns information (intended for display to people) about the
   131    141   given dictionary though the format of this data is dependent on the
   132    142   implementation of the dictionary. For dictionaries that are
   133    143   implemented by hash tables, it is expected that this will return the
................................................................................
   145    155   This appends the given items to the list value that the given key maps
   146    156   to in the dictionary value contained in the given variable, writing
   147    157   the resulting dictionary value back to that variable. Non-existent
   148    158   keys are treated as if they map to an empty list, and it is legal for
   149    159   there to be no items to append to the list. It is an error for the
   150    160   value that the key maps to to not be representable as a list. The
   151    161   updated dictionary value is returned.
          162  +.VS TIP508
          163  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          164  +array that has a default value set, the default value and will be used as the
          165  +value of the dictionary prior to the list-appending operation.
          166  +.VE TIP508
   152    167   .TP
   153    168   \fBdict map \fR{\fIkeyVariable valueVariable\fR} \fIdictionaryValue body\fR
   154    169   .
   155    170   This command applies a transformation to each element of a dictionary,
   156    171   returning a new dictionary. It takes three arguments: the first is a
   157    172   two-element list of variable names (for the key and value respectively of each
   158    173   mapping in the dictionary), the second the dictionary value to iterate across,
................................................................................
   202    217   \fBdict set \fIdictionaryVariable key \fR?\fIkey ...\fR? \fIvalue\fR
   203    218   .
   204    219   This operation takes the name of a variable containing a dictionary
   205    220   value and places an updated dictionary value in that variable
   206    221   containing a mapping from the given key to the given value. When
   207    222   multiple keys are present, this operation creates or updates a chain
   208    223   of nested dictionaries. The updated dictionary value is returned.
          224  +.VS TIP508
          225  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          226  +array that has a default value set, the default value and will be used as the
          227  +value of the dictionary prior to the value insert/update operation.
          228  +.VE TIP508
   209    229   .TP
   210    230   \fBdict size \fIdictionaryValue\fR
   211    231   .
   212    232   Return the number of key/value mappings in the given dictionary value.
   213    233   .TP
   214    234   \fBdict unset \fIdictionaryVariable key \fR?\fIkey ...\fR?
   215    235   .
................................................................................
   217    237   variable containing a dictionary value and places an updated
   218    238   dictionary value in that variable that does not contain a mapping for
   219    239   the given key. Where multiple keys are present, this describes a path
   220    240   through nested dictionaries to the mapping to remove. At least one key
   221    241   must be specified, but the last key on the key-path need not exist.
   222    242   All other components on the path must exist. The updated dictionary
   223    243   value is returned.
          244  +.VS TIP508
          245  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          246  +array that has a default value set, the default value and will be used as the
          247  +value of the dictionary prior to the value remove operation.
          248  +.VE TIP508
   224    249   .TP
   225    250   \fBdict update \fIdictionaryVariable key varName \fR?\fIkey varName ...\fR? \fIbody\fR
   226    251   .
   227    252   Execute the Tcl script in \fIbody\fR with the value for each \fIkey\fR
   228    253   (as found by reading the dictionary value in \fIdictionaryVariable\fR)
   229    254   mapped to the variable \fIvarName\fR. There may be multiple
   230    255   \fIkey\fR/\fIvarName\fR pairs. If a \fIkey\fR does not have a mapping,
................................................................................
   232    257   terminates, any changes made to the \fIvarName\fRs is reflected back
   233    258   to the dictionary within \fIdictionaryVariable\fR (unless
   234    259   \fIdictionaryVariable\fR itself becomes unreadable, when all updates
   235    260   are silently discarded), even if the result of \fIbody\fR is an error
   236    261   or some other kind of exceptional exit. The result of \fBdict
   237    262   update\fR is (unless some kind of error occurs) the result of the
   238    263   evaluation of \fIbody\fR.
          264  +.VS TIP508
          265  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          266  +array that has a default value set, the default value and will be used as the
          267  +value of the dictionary prior to the update operation.
          268  +.VE TIP508
   239    269   .RS
   240    270   .PP
   241    271   Each \fIvarName\fR is mapped in the scope enclosing the \fBdict update\fR;
   242    272   it is recommended that this command only be used in a local scope
   243    273   (\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of
   244    274   this, the variables set by \fBdict update\fR will continue to
   245    275   exist after the command finishes (unless explicitly \fBunset\fR).
................................................................................
   266    296   for the execution of \fIbody\fR. As with \fBdict update\fR, making
   267    297   \fIdictionaryVariable\fR unreadable will make the updates to the
   268    298   dictionary be discarded, and this also happens if the contents of
   269    299   \fIdictionaryVariable\fR are adjusted so that the chain of
   270    300   dictionaries no longer exists. The result of \fBdict with\fR is
   271    301   (unless some kind of error occurs) the result of the evaluation of
   272    302   \fIbody\fR.
          303  +.VS TIP508
          304  +If \fIdictionaryVarable\fR indicates an element that does not exist of an
          305  +array that has a default value set, the default value and will be used as the
          306  +value of the dictionary prior to the updating operation.
          307  +.VE TIP508
   273    308   .RS
   274    309   .PP
   275    310   The variables are mapped in the scope enclosing the \fBdict with\fR;
   276    311   it is recommended that this command only be used in a local scope
   277    312   (\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of
   278    313   this, the variables set by \fBdict with\fR will continue to
   279    314   exist after the command finishes (unless explicitly \fBunset\fR).

Changes to doc/eof.n.

    55     55       puts "Read record: $record"
    56     56   }
    57     57   .CE
    58     58   .SH "SEE ALSO"
    59     59   file(n), open(n), close(n), fblocked(n), Tcl_StandardChannels(3)
    60     60   .SH KEYWORDS
    61     61   channel, end of file
           62  +'\" Local Variables:
           63  +'\" mode: nroff
           64  +'\" fill-column: 78
           65  +'\" End:

Changes to doc/exec.n.

   212    212   .QW \[email protected]\0\fIfileId\fR
   213    213   notation, does not work.  When reading from a socket, a 16-bit DOS
   214    214   application will hang and a 32-bit application will return immediately with
   215    215   end-of-file.  When either type of application writes to a socket, the
   216    216   information is instead sent to the console, if one is present, or is
   217    217   discarded.
   218    218   .RS
          219  +.PP
          220  +Note that the current escape resp. quoting of arguments for windows works only
          221  +with executables using CommandLineToArgv, CRT-library or similar, as well as
          222  +with the windows batch files (excepting the newline, see below).
          223  +Although it is the common escape algorithm, but, in fact, the way how the
          224  +executable parses the command-line (resp. splits it into single arguments)
          225  +is decisive.
          226  +.PP
          227  +Unfortunately, there is currently no way to supply newline character within
          228  +an argument to the batch files (\fB.cmd\fR or \fB.bat\fR) or to the command
          229  +processor (\fBcmd.exe /c\fR), because this causes truncation of command-line
          230  +(also the argument chain) on the first newline character.
          231  +But it works properly with an executable (using CommandLineToArgv, etc).
   219    232   .PP
   220    233   The Tk console text widget does not provide real standard IO capabilities.
   221    234   Under Tk, when redirecting from standard input, all applications will see an
   222    235   immediate end-of-file; information redirected to standard output or standard
   223    236   error will be discarded.
   224    237   .PP
   225    238   Either forward or backward slashes are accepted as path separators for
................................................................................
   405    418   .CS
   406    419   \fBexec\fR cmp.bat somefile.c -o somefile
   407    420   .CE
   408    421   .PP
   409    422   With the file \fIcmp.bat\fR looking something like:
   410    423   .PP
   411    424   .CS
          425  +@gcc %*
          426  +.CE
          427  +or like another variant using single parameters:
          428  +.CS
   412    429   @gcc %1 %2 %3 %4 %5 %6 %7 %8 %9
   413    430   .CE
   414    431   .SS "WORKING WITH COMMAND BUILT-INS"
   415    432   .PP
   416    433   Sometimes you need to be careful, as different programs may have the
   417    434   same name and be in the path. It can then happen that typing a command
   418    435   at the DOS prompt finds \fIa different program\fR than the same

Changes to doc/exit.n.

    45     45       \fBexit\fR 2
    46     46   }
    47     47   .CE
    48     48   .SH "SEE ALSO"
    49     49   exec(n)
    50     50   .SH KEYWORDS
    51     51   abort, exit, process
           52  +'\" Local Variables:
           53  +'\" mode: nroff
           54  +'\" fill-column: 78
           55  +'\" End:

Changes to doc/expr.n.

    46     46   An expression consists of a combination of operands, operators, parentheses and
    47     47   commas, possibly with whitespace between any of these elements, which is
    48     48   ignored.
    49     49   An integer operand may be specified in decimal (the normal case, the optional
    50     50   first two characters are \fB0d\fR), binary
    51     51   (the first two characters are \fB0b\fR), octal
    52     52   (the first two characters are \fB0o\fR), or hexadecimal
    53         -(the first two characters are \fB0x\fR) form.
           53  +(the first two characters are \fB0x\fR) form.  For
           54  +compatibility with older Tcl releases, an operand that begins with \fB0\fR is
           55  +interpreted as an octal integer even if the second character is not \fBo\fR.
    54     56   A floating-point number may be specified in any of several
    55     57   common decimal formats, and may use the decimal point \fB.\fR,
    56     58   \fBe\fR or \fBE\fR for scientific notation, and
    57     59   the sign characters \fB+\fR and \fB\-\fR.  The
    58     60   following are all valid floating-point numbers:  2.1, 3., 6e4, 7.91e+16.
    59     61   The strings \fBInf\fR
    60     62   and \fBNaN\fR, in any combination of case, are also recognized as floating point

Changes to doc/fblocked.n.

    61     61   socket -server connect 12345
    62     62   vwait forever
    63     63   .CE
    64     64   .SH "SEE ALSO"
    65     65   gets(n), open(n), read(n), socket(n), Tcl_StandardChannels(3)
    66     66   .SH KEYWORDS
    67     67   blocking, nonblocking
           68  +'\" Local Variables:
           69  +'\" mode: nroff
           70  +'\" fill-column: 78
           71  +'\" End:

Changes to doc/fileevent.n.

   150    150   \fBfileevent\fR is based on the \fBaddinput\fR command created
   151    151   by Mark Diekhans.
   152    152   .SH "SEE ALSO"
   153    153   fconfigure(n), gets(n), interp(n), puts(n), read(n), Tcl_StandardChannels(3)
   154    154   .SH KEYWORDS
   155    155   asynchronous I/O, blocking, channel, event handler, nonblocking, readable,
   156    156   script, writable.
          157  +'\" Local Variables:
          158  +'\" mode: nroff
          159  +'\" fill-column: 78
          160  +'\" End:

Changes to doc/filename.n.

   172    172   .QW .....abc
   173    173   is illegal.
   174    174   .SH "SEE ALSO"
   175    175   file(n), glob(n)
   176    176   .SH KEYWORDS
   177    177   current directory, absolute file name, relative file name,
   178    178   volume-relative file name, portability
          179  +'\" Local Variables:
          180  +'\" mode: nroff
          181  +'\" fill-column: 78
          182  +'\" End:

Changes to doc/flush.n.

    39     39   gets stdin name
    40     40   puts "Hello there, $name!"
    41     41   .CE
    42     42   .SH "SEE ALSO"
    43     43   file(n), open(n), socket(n), Tcl_StandardChannels(3)
    44     44   .SH KEYWORDS
    45     45   blocking, buffer, channel, flush, nonblocking, output
           46  +'\" Local Variables:
           47  +'\" mode: nroff
           48  +'\" fill-column: 78
           49  +'\" End:

Changes to doc/foreach.n.

    98     98   .CE
    99     99   
   100    100   .SH "SEE ALSO"
   101    101   for(n), while(n), break(n), continue(n)
   102    102   
   103    103   .SH KEYWORDS
   104    104   foreach, iteration, list, loop
          105  +'\" Local Variables:
          106  +'\" mode: nroff
          107  +'\" fill-column: 78
          108  +'\" End:

Changes to doc/format.n.

    79     79   number if the first character is not a sign.
    80     80   .TP 10
    81     81   \fB0\fR
    82     82   Specifies that the number should be padded on the left with
    83     83   zeroes instead of spaces.
    84     84   .TP 10
    85     85   \fB#\fR
    86         -Requests an alternate output form. For \fBo\fR and \fBO\fR
    87         -conversions it guarantees that the first digit is always \fB0\fR.
    88         -For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively)
           86  +Requests an alternate output form. For \fBo\fR conversions,
           87  +\fB0o\fR will be added to the beginning of the result unless
           88  +it is zero. For \fBx\fR or \fBX\fR conversions, \fB0x\fR
    89     89   will be added to the beginning of the result unless it is zero.
    90     90   For \fBb\fR conversions, \fB0b\fR
    91     91   will be added to the beginning of the result unless it is zero.
    92         -For \fBd\fR conversions, \fB0d\fR will be added to the beginning
    93         -of the result unless it is zero.
           92  +For \fBd\fR conversions, \fB0d\fR there is no effect unless
           93  +the \fB0\fR specifier is used as well: In that case, \fB0d\fR
           94  +will be added to the beginning.
    94     95   For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR,
    95     96   \fBg\fR, and \fBG\fR) it guarantees that the result always
    96     97   has a decimal point.
    97     98   For \fBg\fR and \fBG\fR conversions it specifies that
    98     99   trailing zeroes should not be removed.
    99    100   .SS "OPTIONAL FIELD WIDTH"
   100    101   .PP
................................................................................
   128    129   printed; if the string is longer than this then the trailing characters will be dropped.
   129    130   If the precision is specified with \fB*\fR rather than a number
   130    131   then the next argument to the \fBformat\fR command determines the precision;
   131    132   it must be a numeric string.
   132    133   .SS "OPTIONAL SIZE MODIFIER"
   133    134   .PP
   134    135   The fifth part of a conversion specifier is a size modifier,
   135         -which must be \fBll\fR, \fBh\fR, or \fBl\fR.
          136  +which must be \fBll\fR, \fBh\fR, \fBl\fR, or \fBL\fR.
   136    137   If it is \fBll\fR it specifies that an integer value is taken
   137    138   without truncation for conversion to a formatted substring.
   138    139   If it is \fBh\fR it specifies that an integer value is
   139    140   truncated to a 16-bit range before converting.  This option is rarely useful.
   140    141   If it is \fBl\fR it specifies that the integer value is
   141    142   truncated to the same range as that produced by the \fBwide()\fR
   142    143   function of the \fBexpr\fR command (at least a 64-bit range).
   143         -If neither \fBh\fR nor \fBl\fR are present, the integer value is
          144  +If it is \fBL\fR it specifies that an integer or double value is taken
          145  +without truncation for conversion to a formatted substring.
          146  +If neither \fBh\fR nor \fBl\fR nor \fBL\fR are present, the integer value is
   144    147   truncated to the same range as that produced by the \fBint()\fR
   145    148   function of the \fBexpr\fR command (at least a 32-bit range, but
   146    149   determined by the value of the \fBwordSize\fR element of the
   147    150   \fBtcl_platform\fR array).
   148    151   .SS "MANDATORY CONVERSION TYPE"
   149    152   .PP
   150    153   The last thing in a conversion specifier is an alphabetic character
................................................................................
   167    170   Convert integer to unsigned hexadecimal string, using digits
   168    171   .QW 0123456789abcdef
   169    172   for \fBx\fR and
   170    173   .QW 0123456789ABCDEF
   171    174   for \fBX\fR).
   172    175   .TP 10
   173    176   \fBb\fR
   174         -Convert integer to binary string, using digits 0 and 1.
          177  +Convert integer to unsigned binary string, using digits 0 and 1.
   175    178   .TP 10
   176    179   \fBc\fR
   177    180   Convert integer to the Unicode character it represents.
   178    181   .TP 10
   179    182   \fBs\fR
   180    183   No conversion; just insert string.
   181    184   .TP 10
................................................................................
   196    199   \fBg\fR or \fBG\fR
   197    200   If the exponent is less than \-4 or greater than or equal to the
   198    201   precision, then convert number as for \fB%e\fR or
   199    202   \fB%E\fR.
   200    203   Otherwise convert as for \fB%f\fR.
   201    204   Trailing zeroes and a trailing decimal point are omitted.
   202    205   .TP 10
          206  +\fBa\fR or \fBA\fR
          207  +Convert double to hexadecimal notation in the form
          208  +\fI0x1.yyy\fBp\(+-\fIzz\fR, where the number of \fIy\fR's is
          209  +determined by the precision (default: 13).
          210  +If the \fBA\fR form is used then the hex characters
          211  +are printed in uppercase.
          212  +.TP 10
   203    213   \fB%\fR
   204    214   No conversion: just insert \fB%\fR.
          215  +.TP 10
          216  +\fBp\fR
          217  +Shorthand form for \fB0x%zx\fR, so it outputs the integer in
          218  +hexadecimal form with \fB0x\fR prefix.
   205    219   .SH "DIFFERENCES FROM ANSI SPRINTF"
   206    220   .PP
   207    221   The behavior of the format command is the same as the
   208    222   ANSI C \fBsprintf\fR procedure except for the following
   209    223   differences:
   210    224   .IP [1]
   211    225   Tcl guarantees that it will be working with UNICODE characters.
   212    226   .IP [2]
   213         -\fB%p\fR and \fB%n\fR specifiers are not supported.
          227  +\fB%n\fR specifier is not supported.
   214    228   .IP [3]
   215    229   For \fB%c\fR conversions the argument must be an integer value,
   216    230   which will then be converted to the corresponding character value.
   217    231   .IP [4]
   218    232   The size modifiers are ignored when formatting floating-point values.
   219         -The \fBll\fR modifier has no \fBsprintf\fR counterpart.
   220    233   The \fBb\fR specifier has no \fBsprintf\fR counterpart.
   221    234   .SH EXAMPLES
   222    235   .PP
   223    236   Convert the numeric value of a UNICODE character to the character
   224    237   itself:
   225    238   .PP
   226    239   .CS

Changes to doc/global.n.

    52     52       append accumulator $string \en
    53     53   }
    54     54   .CE
    55     55   .SH "SEE ALSO"
    56     56   namespace(n), upvar(n), variable(n)
    57     57   .SH KEYWORDS
    58     58   global, namespace, procedure, variable
           59  +'\" Local Variables:
           60  +'\" mode: nroff
           61  +'\" fill-column: 78
           62  +'\" End:

Changes to doc/history.n.

    96     96   is modified to eliminate the history command and replace it with
    97     97   the result of the history command.
    98     98   If you want to redo an event without modifying history, then use
    99     99   the \fBevent\fR operation to retrieve some event,
   100    100   and the \fBadd\fR operation to add it to history and execute it.
   101    101   .SH KEYWORDS
   102    102   event, history, record
          103  +'\" Local Variables:
          104  +'\" mode: nroff
          105  +'\" fill-column: 78
          106  +'\" End:

Changes to doc/http.n.

     2      2   '\" Copyright (c) 1995-1997 Sun Microsystems, Inc.
     3      3   '\" Copyright (c) 1998-2000 by Ajuba Solutions.
     4      4   '\" Copyright (c) 2004 ActiveState Corporation.
     5      5   '\"
     6      6   '\" See the file "license.terms" for information on usage and redistribution
     7      7   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     8      8   '\"
     9         -.TH "http" n 2.7 http "Tcl Bundled Packages"
            9  +.TH "http" n 2.9 http "Tcl Bundled Packages"
    10     10   .so man.macros
    11     11   .BS
    12     12   '\" Note:  do not modify the .SH NAME line immediately below!
    13     13   .SH NAME
    14     14   http \- Client-side implementation of the HTTP/1.1 protocol
    15     15   .SH SYNOPSIS
    16         -\fBpackage require http ?2.7?\fR
           16  +\fBpackage require http\fI ?\fB2.8\fR?
    17     17   .\" See Also -useragent option documentation in body!
    18     18   .sp
    19         -\fB::http::config ?\fI\-option value\fR ...?
           19  +\fB::http::config\fR ?\fI\-option value\fR ...?
    20     20   .sp
    21     21   \fB::http::geturl \fIurl\fR ?\fI\-option value\fR ...?
    22     22   .sp
    23     23   \fB::http::formatQuery\fR \fIkey value\fR ?\fIkey value\fR ...?
           24  +.sp
           25  +\fB::http::quoteString\fR \fIvalue\fR
    24     26   .sp
    25     27   \fB::http::reset\fR \fItoken\fR ?\fIwhy\fR?
    26     28   .sp
    27     29   \fB::http::wait \fItoken\fR
    28     30   .sp
    29     31   \fB::http::status \fItoken\fR
    30     32   .sp
................................................................................
    40     42   .sp
    41     43   \fB::http::error \fItoken\fR
    42     44   .sp
    43     45   \fB::http::cleanup \fItoken\fR
    44     46   .sp
    45     47   \fB::http::register \fIproto port command\fR
    46     48   .sp
           49  +\fB::http::registerError \fIport\fR ?\fImessage\fR?
           50  +.sp
    47     51   \fB::http::unregister \fIproto\fR
    48     52   .BE
    49     53   .SH DESCRIPTION
    50     54   .PP
    51     55   The \fBhttp\fR package provides the client side of the HTTP/1.1
    52         -protocol, as defined in RFC 2616.
           56  +protocol, as defined in RFC 7230 to RFC 7235, which supersede RFC 2616.
    53     57   The package implements the GET, POST, and HEAD operations
    54     58   of HTTP/1.1.  It allows configuration of a proxy host to get through
    55     59   firewalls.  The package is compatible with the \fBSafesock\fR security
    56     60   policy, so it can be used by untrusted applets to do URL fetching from
    57     61   a restricted set of hosts. This package can be extended to support
    58     62   additional HTTP transport protocols, such as HTTPS, by providing
    59     63   a custom \fBsocket\fR command, via \fB::http::register\fR.
................................................................................
    90     94   \fB\-accept\fR \fImimetypes\fR
    91     95   .
    92     96   The Accept header of the request.  The default is */*, which means that
    93     97   all types of documents are accepted.  Otherwise you can supply a
    94     98   comma-separated list of mime type patterns that you are
    95     99   willing to receive.  For example,
    96    100   .QW "image/gif, image/jpeg, text/*" .
          101  +.TP
          102  +\fB\-pipeline\fR \fIboolean\fR
          103  +.
          104  +Specifies whether HTTP/1.1 transactions on a persistent socket will be
          105  +pipelined.  See the \fBPERSISTENT SOCKETS\fR section for details. The default
          106  +is 1.
          107  +.TP
          108  +\fB\-postfresh\fR \fIboolean\fR
          109  +.
          110  +Specifies whether requests that use the \fBPOST\fR method will always use a
          111  +fresh socket, overriding the \fB-keepalive\fR option of
          112  +command \fBhttp::geturl\fR.  See the \fBPERSISTENT SOCKETS\fR section for details.
          113  +The default is 0.
    97    114   .TP
    98    115   \fB\-proxyhost\fR \fIhostname\fR
    99    116   .
   100    117   The name of the proxy host, if any.  If this value is the
   101    118   empty string, the URL host is contacted directly.
   102    119   .TP
   103    120   \fB\-proxyport\fR \fInumber\fR
................................................................................
   111    128   to determine if a proxy is required for a given host.  One argument, a
   112    129   host name, is added to \fIcommand\fR when it is invoked.  If a proxy
   113    130   is required, the callback should return a two-element list containing
   114    131   the proxy server and proxy port.  Otherwise the filter should return
   115    132   an empty list.  The default filter returns the values of the
   116    133   \fB\-proxyhost\fR and \fB\-proxyport\fR settings if they are
   117    134   non-empty.
          135  +.TP
          136  +\fB\-repost\fR \fIboolean\fR
          137  +.
          138  +Specifies what to do if a POST request over a persistent connection fails
          139  +because the server has half-closed the connection.  If boolean \fBtrue\fR, the
          140  +request
          141  +will be automatically retried; if boolean \fBfalse\fR it will not, and the
          142  +application
          143  +that uses \fBhttp::geturl\fR is expected to seek user confirmation before
          144  +retrying the POST.  The value \fBtrue\fR should be used only under certain
          145  +conditions. See the \fBPERSISTENT SOCKETS\fR section for details. The
          146  +default is 0.
   118    147   .TP
   119    148   \fB\-urlencoding\fR \fIencoding\fR
   120    149   .
   121    150   The \fIencoding\fR used for creating the x-url-encoded URLs with
   122         -\fB::http::formatQuery\fR.  The default is \fButf-8\fR, as specified by RFC
          151  +\fB::http::formatQuery\fR and \fB::http::quoteString\fR.
          152  +The default is \fButf-8\fR, as specified by RFC
   123    153   2718.  Prior to http 2.5 this was unspecified, and that behavior can be
   124    154   returned by specifying the empty string (\fB{}\fR), although
   125    155   \fIiso8859-1\fR is recommended to restore similar behavior but without the
   126         -\fB::http::formatQuery\fR throwing an error processing non-latin-1
   127         -characters.
          156  +\fB::http::formatQuery\fR or \fB::http::quoteString\fR
          157  +throwing an error processing non-latin-1 characters.
   128    158   .TP
   129    159   \fB\-useragent\fR \fIstring\fR
   130    160   .
   131         -The value of the User-Agent header in the HTTP request.  The default is
   132         -.QW "\fBTcl http client package 2.7\fR" .
          161  +The value of the User-Agent header in the HTTP request.  In an unsafe
          162  +interpreter, the default value depends upon the operating system, and
          163  +the version numbers of \fBhttp\fR and \fBTcl\fR, and is (for example)
          164  +.QW "\fBMozilla/5.0 (Windows; U; Windows NT 10.0) http/2.8.12 Tcl/8.6.8\fR" .
          165  +A safe interpreter cannot determine its operating system, and so the default
          166  +in a safe interpreter is to use a Windows 10 value with the current version
          167  +numbers of \fBhttp\fR and \fBTcl\fR.
          168  +.TP
          169  +\fB\-zip\fR \fIboolean\fR
          170  +.
          171  +If the value is boolean \fBtrue\fR, then by default requests will send a header
          172  +.QW "\fBAccept-Encoding: gzip,deflate,compress\fR" .
          173  +If the value is boolean \fBfalse\fR, then by default this header will not be sent.
          174  +In either case the default can be overridden for an individual request by
          175  +supplying a custom \fBAccept-Encoding\fR header in the \fB-headers\fR option
          176  +of \fBhttp::geturl\fR. The default is 1.
   133    177   .RE
   134    178   .TP
   135    179   \fB::http::geturl\fR \fIurl\fR ?\fIoptions\fR?
   136    180   .
   137    181   The \fB::http::geturl\fR command is the main procedure in the package.
   138    182   The \fB\-query\fR option causes a POST operation and
   139    183   the \fB\-validate\fR option causes a HEAD operation;
................................................................................
   223    267   .CS
   224    268   Pragma: no-cache
   225    269   .CE
   226    270   .RE
   227    271   .TP
   228    272   \fB\-keepalive\fR \fIboolean\fR
   229    273   .
   230         -If true, attempt to keep the connection open for servicing
          274  +If boolean \fBtrue\fR, attempt to keep the connection open for servicing
   231    275   multiple requests.  Default is 0.
   232    276   .TP
   233    277   \fB\-method\fR \fItype\fR
   234    278   .
   235    279   Force the HTTP request method to \fItype\fR. \fB::http::geturl\fR will
   236    280   auto-select GET, POST or HEAD based on other options, but this option
   237    281   enables choices like PUT and DELETE for webdav support.
................................................................................
   329    373   \fB::http::formatQuery\fR \fIkey value\fR ?\fIkey value\fR ...?
   330    374   .
   331    375   This procedure does x-url-encoding of query data.  It takes an even
   332    376   number of arguments that are the keys and values of the query.  It
   333    377   encodes the keys and values, and generates one string that has the
   334    378   proper & and = separators.  The result is suitable for the
   335    379   \fB\-query\fR value passed to \fB::http::geturl\fR.
          380  +.TP
          381  +\fB::http::quoteString\fR \fIvalue\fR
          382  +.
          383  +This procedure does x-url-encoding of string.  It takes a single argument and
          384  +encodes it.
   336    385   .TP
   337    386   \fB::http::reset\fR \fItoken\fR ?\fIwhy\fR?
   338    387   .
   339    388   This command resets the HTTP transaction identified by \fItoken\fR, if any.
   340    389   This sets the \fBstate(status)\fR value to \fIwhy\fR, which defaults to
   341    390   \fBreset\fR, and then calls the registered \fB\-command\fR callback.
   342    391   .TP
................................................................................
   410    459   package require tls
   411    460   
   412    461   ::http::register https 443 ::tls::socket
   413    462   
   414    463   set token [::http::geturl https://my.secure.site/]
   415    464   .CE
   416    465   .RE
          466  +.TP
          467  +\fB::http::registerError\fR \fIport\fR ?\fImessage\fR?
          468  +.
          469  +This procedure allows a registered protocol handler to deliver an error
          470  +message for use by \fBhttp\fR.  Calling this command does not raise an
          471  +error. The command is useful when a registered protocol detects an problem
          472  +(for example, an invalid TLS certificate) that will cause an error to
          473  +propagate to \fBhttp\fR.  The command allows \fBhttp\fR to provide a
          474  +precise error message rather than a general one.  The command returns the
          475  +value provided by the last call with argument \fImessage\fR, or the empty
          476  +string if no such call has been made.
   417    477   .TP
   418    478   \fB::http::unregister\fR \fIproto\fR
   419    479   .
   420    480   This procedure unregisters a protocol handler that was previously
   421    481   registered via \fB::http::register\fR, returning a two-item list of
   422    482   the default port and handler command that was previously installed
   423    483   (via \fB::http::register\fR) if there was such a handler, and an error if
................................................................................
   500    560   Once the data associated with the URL is no longer needed, the state
   501    561   array should be unset to free up storage.
   502    562   The \fB::http::cleanup\fR procedure is provided for that purpose.
   503    563   The following elements of
   504    564   the array are supported:
   505    565   .RS
   506    566   .TP
          567  +\fBbinary\fR
          568  +.
          569  +This is boolean \fBtrue\fR if (after decoding any compression specified
          570  +by the
          571  +.QW "Content-Encoding"
          572  +response header) the HTTP response is binary.  It is boolean \fBfalse\fR
          573  +if the HTTP response is text.
          574  +.TP
   507    575   \fBbody\fR
   508    576   .
   509    577   The contents of the URL.  This will be empty if the \fB\-channel\fR
   510    578   option has been specified.  This value is returned by the \fB::http::data\fR command.
   511    579   .TP
   512    580   \fBcharset\fR
   513    581   .
................................................................................
   598    666   .
   599    667   A copy of the \fBContent-Type\fR meta-data value.
   600    668   .TP
   601    669   \fBurl\fR
   602    670   .
   603    671   The requested URL.
   604    672   .RE
          673  +.SH "PERSISTENT CONNECTIONS"
          674  +.PP
          675  +.SS "BASICS"
          676  +.PP
          677  +See RFC 7230 Sec 6, which supersedes RFC 2616 Sec 8.1.
          678  +.PP
          679  +A persistent connection allows multiple HTTP/1.1 transactions to be
          680  +carried over the same TCP connection.  Pipelining allows a
          681  +client to make multiple requests over a persistent connection without
          682  +waiting for each response.  The server sends responses in the same order
          683  +that the requests were received.
          684  +.PP
          685  +If a POST request fails to complete, typically user confirmation is
          686  +needed before sending the request again.  The user may wish to verify
          687  +whether the server was modified by the failed POST request, before
          688  +sending the same request again.
          689  +.PP
          690  +A HTTP request will use a persistent socket if the call to
          691  +\fBhttp::geturl\fR has the option \fB-keepalive true\fR. It will use
          692  +pipelining where permitted if the \fBhttp::config\fR option
          693  +\fB-pipeline\fR is boolean \fBtrue\fR (its default value).
          694  +.PP
          695  +The http package maintains no more than one persistent connection to each
          696  +server (i.e. each value of
          697  +.QW "domain:port" ).
          698  +If \fBhttp::geturl\fR is called to make a request over a persistent
          699  +connection while the connection is busy with another request, the new
          700  +request will be held in a queue until the connection is free.
          701  +.PP
          702  +The http package does not support HTTP/1.0 persistent connections
          703  +controlled by the \fBKeep-Alive\fR header.
          704  +.SS "SPECIAL CASES"
          705  +.PP
          706  +This subsection discusses issues related to closure of the
          707  +persistent connection by the server, automatic retry of failed requests,
          708  +the special treatment necessary for POST requests, and the options for
          709  +dealing with these cases.
          710  +.PP
          711  +In accordance with RFC 7230, \fBhttp::geturl\fR does not pipeline
          712  +requests that use the POST method.  If a POST uses a persistent
          713  +connection and is not the first request on that connection,
          714  +\fBhttp::geturl\fR waits until it has received the response for the previous
          715  +request; or (if \fBhttp::config\fR option \fB-postfresh\fR is boolean \fBtrue\fR) it
          716  +uses a new connection for each POST.
          717  +.PP
          718  +If the server is processing a number of pipelined requests, and sends a
          719  +response header
          720  +.QW "\fBConnection: close\fR"
          721  +with one of the responses (other than the last), then subsequent responses
          722  +are unfulfilled. \fBhttp::geturl\fR will send the unfulfilled requests again
          723  +over a new connection.
          724  +.PP
          725  +A difficulty arises when a HTTP client sends a request over a persistent
          726  +connection that has been idle for a while.  The HTTP server may
          727  +half-close an apparently idle connection while the client is sending a
          728  +request, but before the request arrives at the server: in this case (an
          729  +.QW "asynchronous close event" )
          730  +the request will fail.  The difficulty arises because the client cannot
          731  +be certain whether the POST modified the state of the server.  For HEAD or
          732  +GET requests, \fBhttp::geturl\fR opens another connection and retransmits
          733  +the failed request. However, if the request was a POST, RFC 7230 forbids
          734  +automatic retry by default, suggesting either user confirmation, or
          735  +confirmation by user-agent software that has semantic understanding of
          736  +the application.  The \fBhttp::config\fR option \fB-repost\fR allows for
          737  +either possibility.
          738  +.PP
          739  +Asynchronous close events can occur only in a short interval of time.  The
          740  +\fBhttp\fR package monitors each persistent connection for closure by the
          741  +server.  Upon detection, the connection is also closed at the client end,
          742  +and subsequent requests will use a fresh connection.
          743  +.PP
          744  +If the \fBhttp::geturl\fR command is called with option \fB-keepalive true\fR,
          745  +then it will both try to use an existing persistent connection
          746  +(if one is available), and it will send the server a
          747  +.QW "\fBConnection: keep-alive\fR"
          748  +request header asking to keep the connection open for future requests.
          749  +.PP
          750  +The \fBhttp::config\fR options \fB-pipeline\fR, \fB-postfresh\fR, and
          751  +\fB-repost\fR relate to persistent connections.
          752  +.PP
          753  +Option \fB-pipeline\fR, if boolean \fBtrue\fR, will pipeline GET and HEAD requests
          754  +made
          755  +over a persistent connection.  POST requests will not be pipelined - if the
          756  +POST is not the first transaction on the connection, its request will not
          757  +be sent until the previous response has finished.  GET and HEAD requests
          758  +made after a POST will not be sent until the POST response has been
          759  +delivered, and will not be sent if the POST fails.
          760  +.PP
          761  +Option \fB-postfresh\fR, if boolean \fBtrue\fR, will override the \fBhttp::geturl\fR option
          762  +\fB-keepalive\fR, and always open a fresh connection for a POST request.
          763  +.PP
          764  +Option \fB-repost\fR, if \fBtrue\fR, permits automatic retry of a POST request
          765  +that fails because it uses a persistent connection that the server has
          766  +half-closed (an
          767  +.QW "asynchronous close event" ).
          768  +Subsequent GET and HEAD requests in a failed pipeline will also be retried.
          769  +\fIThe -repost option should be used only if the application understands
          770  +that the retry is appropriate\fR - specifically, the application must know
          771  +that if the failed POST successfully modified the state of the server, a repeat POST
          772  +would have no adverse effect.
   605    773   .SH EXAMPLE
   606    774   .PP
   607    775   This example creates a procedure to copy a URL to a file while printing a
   608    776   progress meter, and prints the meta-data associated with the URL.
   609    777   .PP
   610    778   .CS
   611    779   proc httpcopy { url file {chunk 4096} } {

Changes to doc/incr.n.

    23     23   1 is added to \fIvarName\fR.
    24     24   The new value is stored as a decimal string in variable \fIvarName\fR
    25     25   and also returned as result.
    26     26   .PP
    27     27   Starting with the Tcl 8.5 release, the variable \fIvarName\fR passed
    28     28   to \fBincr\fR may be unset, and in that case, it will be set to
    29     29   the value \fIincrement\fR or to the default increment value of \fB1\fR.
           30  +.VS TIP508
           31  +If \fIvarName\fR indicate an element that does not exist of an array that has
           32  +a default value set, the sum of the default value and the \fIincrement\fR (or
           33  +1) will be stored in the array element.
           34  +.VE TIP508
    30     35   .SH EXAMPLES
    31     36   .PP
    32     37   Add one to the contents of the variable \fIx\fR:
    33     38   .PP
    34     39   .CS
    35     40   \fBincr\fR x
    36     41   .CE
................................................................................
    55     60   .CS
    56     61   \fBincr\fR x 0
    57     62   .CE
    58     63   .SH "SEE ALSO"
    59     64   expr(n), set(n)
    60     65   .SH KEYWORDS
    61     66   add, increment, variable, value
           67  +.\" Local variables:
           68  +.\" mode: nroff
           69  +.\" fill-column: 78
           70  +.\" End:

Changes to doc/info.n.

    31     31   .TP
    32     32   \fBinfo body \fIprocname\fR
    33     33   .
    34     34   Returns the body of procedure \fIprocname\fR.  \fIProcname\fR must be
    35     35   the name of a Tcl command procedure.
    36     36   .TP
    37     37   \fBinfo class\fI subcommand class\fR ?\fIarg ...\fR
    38         -.VS 8.6
           38  +.
    39     39   Returns information about the class, \fIclass\fR. The \fIsubcommand\fRs are
    40     40   described in \fBCLASS INTROSPECTION\fR below.
    41         -.VE 8.6
    42     41   .TP
    43     42   \fBinfo cmdcount\fR
    44     43   .
    45     44   Returns a count of the total number of commands that have been invoked
    46     45   in this interpreter.
           46  +.TP
           47  +\fBinfo cmdtype \fIcommandName\fR
           48  +.VS TIP426
           49  +Returns a description of the kind of command named by \fIcommandName\fR.  The
           50  +supported types are:
           51  +.RS
           52  +.IP \fBalias\fR
           53  +Indicates that \fIcommandName\fR was created by \fBinterp alias\fR. Note that
           54  +safe interpreters can only see a subset of aliases (specifically those between
           55  +two commands within themselves).
           56  +.IP \fBcoroutine\fR
           57  +Indicates that \fIcommandName\fR was created by \fBcoroutine\fR.
           58  +.IP \fBensemble\fR
           59  +Indicates that \fIcommandName\fR was created by \fBnamespace ensemble\fR.
           60  +.IP \fBimport\fR
           61  +Indicates that \fIcommandName\fR was created by \fBnamespace import\fR.
           62  +.IP \fBnative\fR
           63  +Indicates that \fIcommandName\fR was created by the \fBTcl_CreateObjProc\fR
           64  +interface directly without further registration of the type of command.
           65  +.IP \fBobject\fR
           66  +Indicates that \fIcommandName\fR is the public command that represents an
           67  +instance of \fBoo::object\fR or one of its subclasses.
           68  +.IP \fBprivateObject\fR
           69  +Indicates that \fIcommandName\fR is the private command (\fBmy\fR by default)
           70  +that represents an instance of \fBoo::object\fR or one of its subclasses.
           71  +.IP \fBproc\fR
           72  +Indicates that \fIcommandName\fR was created by \fBproc\fR.
           73  +.IP \fBslave\fR
           74  +Indicates that \fIcommandName\fR was created by \fBinterp create\fR.
           75  +.IP \fBzlibStream\fR
           76  +Indicates that \fIcommandName\fR was created by \fBzlib stream\fR.
           77  +.PP
           78  +There may be other registered types as well; this is a set that is extensible
           79  +at the implementation level with \fBTcl_RegisterCommandTypeName\fR.
           80  +.RE
           81  +.VE TIP426
    47     82   .TP
    48     83   \fBinfo commands \fR?\fIpattern\fR?
    49     84   .
    50     85   If \fIpattern\fR is not specified,
    51     86   returns a list of names of all the Tcl commands visible
    52     87   (i.e. executable without using a qualified name) to the current namespace,
    53     88   including both the built-in commands written in C and
................................................................................
    74    109   If the command does not appear to be complete then 0 is returned.
    75    110   This command is typically used in line-oriented input environments
    76    111   to allow users to type in commands that span multiple lines;  if the
    77    112   command is not complete, the script can delay evaluating it until additional
    78    113   lines have been typed to complete the command.
    79    114   .TP
    80    115   \fBinfo coroutine\fR
    81         -.VS 8.6
          116  +.
    82    117   Returns the name of the currently executing \fBcoroutine\fR, or the empty
    83    118   string if either no coroutine is currently executing, or the current coroutine
    84    119   has been deleted (but has not yet returned or yielded since deletion).
    85         -.VE 8.6
    86    120   .TP
    87    121   \fBinfo default \fIprocname arg varname\fR
    88    122   .
    89    123   \fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR
    90    124   must be the name of an argument to that procedure.  If \fIarg\fR
    91    125   does not have a default value then the command returns \fB0\fR.
    92    126   Otherwise it returns \fB1\fR and places the default value of \fIarg\fR
    93    127   into variable \fIvarname\fR.
    94    128   .TP
    95    129   \fBinfo errorstack \fR?\fIinterp\fR?
    96         -.VS 8.6
          130  +.
    97    131   Returns, in a form that is programmatically easy to parse, the function names
    98    132   and arguments at each level from the call stack of the last error in the given
    99    133   \fIinterp\fR, or in the current one if not specified.
   100    134   .RS
   101    135   .PP
   102    136   This form is an even-sized list alternating tokens and parameters. Tokens are
   103    137   currently either \fBCALL\fR, \fBUP\fR, or \fBINNER\fR, but other values may be
................................................................................
   114    148   granularity.
   115    149   .PP
   116    150   This information is also present in the \fB\-errorstack\fR entry of the
   117    151   options dictionary returned by 3-argument \fBcatch\fR; \fBinfo errorstack\fR
   118    152   is a convenient way of retrieving it for uncaught errors at top-level in an
   119    153   interactive \fBtclsh\fR.
   120    154   .RE
   121         -.VE 8.6
   122    155   .TP
   123    156   \fBinfo exists \fIvarName\fR
   124    157   .
   125    158   Returns \fB1\fR if the variable named \fIvarName\fR exists in the
   126    159   current context (either as a global or local variable) and has been
   127    160   defined by being given a value, returns \fB0\fR otherwise.
   128    161   .TP
................................................................................
   292    325   .TP
   293    326   \fBinfo library\fR
   294    327   .
   295    328   Returns the name of the library directory in which standard Tcl
   296    329   scripts are stored.
   297    330   This is actually the value of the \fBtcl_library\fR
   298    331   variable and may be changed by setting \fBtcl_library\fR.
          332  +.TP
          333  +\fBinfo linkedname \fIvarname\fR
          334  +.VS TIP471
          335  +Returns the name of the variable that link variable \fIvarname\fR is
          336  +ultimately linked to. This will be a fully qualified name if the variable
          337  +ultimately linked to is in a namespace (including the global namespace). Array
          338  +elements will be indicated by having
          339  +.QW \fB(\fR ,
          340  +the name of the element, and
          341  +.QW \fB)\fR
          342  +appended.
          343  +.RS
          344  +.PP
          345  +Link variables are (usually) local variables created by \fBupvar\fR,
          346  +\fBglobal\fR, \fBnamespace upvar\fR, and \fBvariable\fR.
          347  +.RE
          348  +.VE TIP471
   299    349   .TP
   300    350   \fBinfo loaded \fR?\fIinterp\fR? ?\fIpackage\fR?
   301    351   .
   302    352   Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR
   303    353   is not specified, returns a list describing all of the packages
   304    354   that have been loaded into \fIinterp\fR with the \fBload\fR command.
   305    355   Each list element is a sub-list with two elements consisting of the
................................................................................
   325    375   \fBinfo nameofexecutable\fR
   326    376   .
   327    377   Returns the full path name of the binary file from which the application
   328    378   was invoked.  If Tcl was unable to identify the file, then an empty
   329    379   string is returned.
   330    380   .TP
   331    381   \fBinfo object\fI subcommand object\fR ?\fIarg ...\fR
   332         -.VS 8.6
          382  +.
   333    383   Returns information about the object, \fIobject\fR. The \fIsubcommand\fRs are
   334    384   described in \fBOBJECT INTROSPECTION\fR below.
   335         -.VE 8.6
   336    385   .TP
   337    386   \fBinfo patchlevel\fR
   338    387   .
   339    388   Returns the value of the global variable \fBtcl_patchLevel\fR, which holds
   340    389   the exact version of the Tcl library by default.
   341    390   .TP
   342    391   \fBinfo procs \fR?\fIpattern\fR?
................................................................................
   395    444   has each matching namespace variable qualified with the name
   396    445   of its namespace.
   397    446   Note that a currently-visible variable may not yet
   398    447   .QW exist
   399    448   if it has not
   400    449   been set (e.g. a variable declared but not set by \fBvariable\fR).
   401    450   .SS "CLASS INTROSPECTION"
   402         -.VS 8.6
   403    451   .PP
   404    452   The following \fIsubcommand\fR values are supported by \fBinfo class\fR:
   405         -.VE 8.6
   406    453   .TP
   407    454   \fBinfo class call\fI class method\fR
   408         -.VS
          455  +.
   409    456   Returns a description of the method implementations that are used to provide a
   410    457   stereotypical instance of \fIclass\fR's implementation of \fImethod\fR
   411    458   (stereotypical instances being objects instantiated by a class without having
   412    459   any object-specific definitions added). This consists of a list of lists of
   413    460   four elements, where each sublist consists of a word that describes the
   414    461   general type of method implementation (being one of \fBmethod\fR for an
   415         -ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a
          462  +ordinary method, \fBfilter\fR for an applied filter,
          463  +.VS TIP500
          464  +\fBprivate\fR for a private method,
          465  +.VE TIP500
          466  +and \fBunknown\fR for a
   416    467   method that is invoked as part of unknown method handling), a word giving the
   417    468   name of the particular method invoked (which is always the same as
   418    469   \fImethod\fR for the \fBmethod\fR type, and
   419    470   .QW \fBunknown\fR
   420    471   for the \fBunknown\fR type), a word giving the fully qualified name of the
   421    472   class that defined the method, and a word describing the type of method
   422    473   implementation (see \fBinfo class methodtype\fR).
   423    474   .RS
   424    475   .PP
   425    476   Note that there is no inspection of whether the method implementations
   426         -actually use \fBnext\fR to transfer control along the call chain.
          477  +actually use \fBnext\fR to transfer control along the call chain,
          478  +.VS TIP500
          479  +and the call chains that this command files do not actually contain private
          480  +methods.
          481  +.VE TIP500
   427    482   .RE
   428         -.VE 8.6
   429    483   .TP
   430    484   \fBinfo class constructor\fI class\fR
   431         -.VS 8.6
          485  +.
   432    486   This subcommand returns a description of the definition of the constructor of
   433    487   class \fIclass\fR. The definition is described as a two element list; the first
   434    488   element is the list of arguments to the constructor in a form suitable for
   435    489   passing to another call to \fBproc\fR or a method definition, and the second
   436    490   element is the body of the constructor. If no constructor is present, this
   437    491   returns the empty list.
   438         -.VE 8.6
   439    492   .TP
   440    493   \fBinfo class definition\fI class method\fR
   441         -.VS 8.6
          494  +.
   442    495   This subcommand returns a description of the definition of the method named
   443    496   \fImethod\fR of class \fIclass\fR. The definition is described as a two element
   444    497   list; the first element is the list of arguments to the method in a form
   445    498   suitable for passing to another call to \fBproc\fR or a method definition, and
   446    499   the second element is the body of the method.
   447         -.VE 8.6
   448    500   .TP
   449    501   \fBinfo class destructor\fI class\fR
   450         -.VS 8.6
          502  +.
   451    503   This subcommand returns the body of the destructor of class \fIclass\fR. If no
   452    504   destructor is present, this returns the empty string.
   453         -.VE 8.6
   454    505   .TP
   455    506   \fBinfo class filters\fI class\fR
   456         -.VS 8.6
          507  +.
   457    508   This subcommand returns the list of filter methods set on the class.
   458         -.VE 8.6
   459    509   .TP
   460    510   \fBinfo class forward\fI class method\fR
   461         -.VS 8.6
          511  +.
   462    512   This subcommand returns the argument list for the method forwarding called
   463    513   \fImethod\fR that is set on the class called \fIclass\fR.
   464         -.VE 8.6
   465    514   .TP
   466    515   \fBinfo class instances\fI class\fR ?\fIpattern\fR?
   467         -.VS 8.6
          516  +.
   468    517   This subcommand returns a list of instances of class \fIclass\fR. If the
   469    518   optional \fIpattern\fR argument is present, it constrains the list of returned
   470    519   instances to those that match it according to the rules of \fBstring match\fR.
   471         -.VE 8.6
   472    520   .TP
   473    521   \fBinfo class methods\fI class\fR ?\fIoptions...\fR?
   474         -.VS 8.6
          522  +.
   475    523   This subcommand returns a list of all public (i.e. exported) methods of the
   476    524   class called \fIclass\fR. Any of the following \fIoption\fRs may be
   477    525   specified, controlling exactly which method names are returned:
   478    526   .RS
   479         -.VE 8.6
   480    527   .TP
   481    528   \fB\-all\fR
   482         -.VS 8.6
   483         -If the \fB\-all\fR flag is given, the list of methods will include those
          529  +.
          530  +If the \fB\-all\fR flag is given,
          531  +.VS TIP500
          532  +and the \fB\-scope\fR flag is not given,
          533  +.VE TIP500
          534  +the list of methods will include those
   484    535   methods defined not just by the class, but also by the class's superclasses
   485    536   and mixins.
   486         -.VE 8.6
   487    537   .TP
   488    538   \fB\-private\fR
   489         -.VS 8.6
   490         -If the \fB\-private\fR flag is given, the list of methods will also include
   491         -the private (i.e. non-exported) methods of the class (and superclasses and
          539  +.
          540  +If the \fB\-private\fR flag is given,
          541  +.VS TIP500
          542  +and the \fB\-scope\fR flag is not given,
          543  +.VE TIP500
          544  +the list of methods will also include
          545  +the non-exported methods of the class (and superclasses and
   492    546   mixins, if \fB\-all\fR is also given).
          547  +.VS TIP500
          548  +Note that this naming is an unfortunate clash with true private methods; this
          549  +option name is retained for backward compatibility.
          550  +.VE TIP500
          551  +.TP
          552  +\fB\-scope\fI scope\fR
          553  +.VS TIP500
          554  +Returns a list of all methods on \fIclass\fR that have the given visibility
          555  +\fIscope\fR.  When this option is supplied, both the \fB\-all\fR and
          556  +\fB\-private\fR options are ignored. The valid values for \fIscope\fR are:
          557  +.RS
          558  +.IP \fBpublic\fR 3
          559  +Only methods with \fIpublic\fR scope (i.e., callable from anywhere by any instance
          560  +of this class) are to be returned.
          561  +.IP \fBunexported\fR 3
          562  +Only methods with \fIunexported\fR scope (i.e., only callable via \fBmy\fR) are to
          563  +be returned.
          564  +.IP \fBprivate\fR 3
          565  +Only methods with \fIprivate\fR scope (i.e., only callable from within this class's
          566  +methods) are to be returned.
   493    567   .RE
   494         -.VE 8.6
          568  +.VE TIP500
          569  +.RE
   495    570   .TP
   496    571   \fBinfo class methodtype\fI class method\fR
   497         -.VS 8.6
          572  +.
   498    573   This subcommand returns a description of the type of implementation used for
   499    574   the method named \fImethod\fR of class \fIclass\fR. When the result is
   500    575   \fBmethod\fR, further information can be discovered with \fBinfo class
   501    576   definition\fR, and when the result is \fBforward\fR, further information can
   502    577   be discovered with \fBinfo class forward\fR.
   503         -.VE 8.6
   504    578   .TP
   505    579   \fBinfo class mixins\fI class\fR
   506         -.VS 8.6
          580  +.
   507    581   This subcommand returns a list of all classes that have been mixed into the
   508    582   class named \fIclass\fR.
   509         -.VE 8.6
   510    583   .TP
   511    584   \fBinfo class subclasses\fI class\fR ?\fIpattern\fR?
   512         -.VS 8.6
          585  +.
   513    586   This subcommand returns a list of direct subclasses of class \fIclass\fR. If
   514    587   the optional \fIpattern\fR argument is present, it constrains the list of
   515    588   returned classes to those that match it according to the rules of
   516    589   \fBstring match\fR.
   517         -.VE 8.6
   518    590   .TP
   519    591   \fBinfo class superclasses\fI class\fR
   520         -.VS 8.6
          592  +.
   521    593   This subcommand returns a list of direct superclasses of class \fIclass\fR in
   522    594   inheritance precedence order.
   523         -.VE 8.6
   524    595   .TP
   525         -\fBinfo class variables\fI class\fR
   526         -.VS 8.6
          596  +\fBinfo class variables\fI class\fR ?\fB\-private\fR?
          597  +.
   527    598   This subcommand returns a list of all variables that have been declared for
   528    599   the class named \fIclass\fR (i.e. that are automatically present in the
   529    600   class's methods, constructor and destructor).
          601  +.VS TIP500
          602  +If the \fB\-private\fR option is specified, this lists the private variables
          603  +declared instead.
          604  +.VE TIP500
   530    605   .SS "OBJECT INTROSPECTION"
   531    606   .PP
   532    607   The following \fIsubcommand\fR values are supported by \fBinfo object\fR:
   533         -.VE 8.6
   534    608   .TP
   535    609   \fBinfo object call\fI object method\fR
   536         -.VS 8.6
          610  +.
   537    611   Returns a description of the method implementations that are used to provide
   538    612   \fIobject\fR's implementation of \fImethod\fR.  This consists of a list of
   539    613   lists of four elements, where each sublist consists of a word that describes
   540    614   the general type of method implementation (being one of \fBmethod\fR for an
   541         -ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a
          615  +ordinary method, \fBfilter\fR for an applied filter,
          616  +.VS TIP500
          617  +\fBprivate\fR for a private method,
          618  +.VE TIP500
          619  +and \fBunknown\fR for a
   542    620   method that is invoked as part of unknown method handling), a word giving the
   543    621   name of the particular method invoked (which is always the same as
   544    622   \fImethod\fR for the \fBmethod\fR type, and
   545    623   .QW \fBunknown\fR
   546    624   for the \fBunknown\fR type), a word giving what defined the method (the fully
   547    625   qualified name of the class, or the literal string \fBobject\fR if the method
   548    626   implementation is on an instance), and a word describing the type of method
   549    627   implementation (see \fBinfo object methodtype\fR).
   550    628   .RS
   551    629   .PP
   552    630   Note that there is no inspection of whether the method implementations
   553         -actually use \fBnext\fR to transfer control along the call chain.
          631  +actually use \fBnext\fR to transfer control along the call chain,
          632  +.VS TIP500
          633  +and the call chains that this command files do not actually contain private
          634  +methods.
          635  +.VE TIP500
   554    636   .RE
   555         -.VE 8.6
   556    637   .TP
   557    638   \fBinfo object class\fI object\fR ?\fIclassName\fR?
   558         -.VS 8.6
          639  +.
   559    640   If \fIclassName\fR is unspecified, this subcommand returns class of the
   560    641   \fIobject\fR object. If \fIclassName\fR is present, this subcommand returns a
   561    642   boolean value indicating whether the \fIobject\fR is of that class.
   562         -.VE 8.6
          643  +.TP
          644  +\fBinfo object creationid\fI object\fR
          645  +.VS TIP500
          646  +Returns the unique creation identifier for the \fIobject\fR object. This
          647  +creation identifier is unique to the object (within a Tcl interpreter) and
          648  +cannot be controlled at object creation time or altered afterwards.
          649  +.RS
          650  +.PP
          651  +\fIImplementation note:\fR the creation identifier is used to generate unique
          652  +identifiers associated with the object, especially for private variables.
          653  +.RE
          654  +.VE TIP500
   563    655   .TP
   564    656   \fBinfo object definition\fI object method\fR
   565         -.VS 8.6
          657  +.
   566    658   This subcommand returns a description of the definition of the method named
   567    659   \fImethod\fR of object \fIobject\fR. The definition is described as a two
   568    660   element list; the first element is the list of arguments to the method in a
   569    661   form suitable for passing to another call to \fBproc\fR or a method definition,
   570    662   and the second element is the body of the method.
   571         -.VE 8.6
   572    663   .TP
   573    664   \fBinfo object filters\fI object\fR
   574         -.VS 8.6
          665  +.
   575    666   This subcommand returns the list of filter methods set on the object.
   576         -.VE 8.6
   577    667   .TP
   578    668   \fBinfo object forward\fI object method\fR
   579         -.VS 8.6
          669  +.
   580    670   This subcommand returns the argument list for the method forwarding called
   581    671   \fImethod\fR that is set on the object called \fIobject\fR.
   582         -.VE 8.6
   583    672   .TP
   584    673   \fBinfo object isa\fI category object\fR ?\fIarg\fR?
   585         -.VS 8.6
          674  +.
   586    675   This subcommand tests whether an object belongs to a particular category,
   587    676   returning a boolean value that indicates whether the \fIobject\fR argument
   588    677   meets the criteria for the category. The supported categories are:
   589         -.VE 8.6
   590    678   .RS
   591    679   .TP
   592    680   \fBinfo object isa class\fI object\fR
   593         -.VS 8.6
          681  +.
   594    682   This returns whether \fIobject\fR is a class (i.e. an instance of
   595    683   \fBoo::class\fR or one of its subclasses).
   596         -.VE 8.6
   597    684   .TP
   598    685   \fBinfo object isa metaclass\fI object\fR
   599         -.VS 8.6
          686  +.
   600    687   This returns whether \fIobject\fR is a class that can manufacture classes
   601    688   (i.e. is \fBoo::class\fR or a subclass of it).
   602         -.VE 8.6
   603    689   .TP
   604    690   \fBinfo object isa mixin\fI object class\fR
   605         -.VS 8.6
          691  +.
   606    692   This returns whether \fIclass\fR is directly mixed into \fIobject\fR.
   607         -.VE 8.6
   608    693   .TP
   609    694   \fBinfo object isa object\fI object\fR
   610         -.VS 8.6
          695  +.
   611    696   This returns whether \fIobject\fR really is an object.
   612         -.VE 8.6
   613    697   .TP
   614    698   \fBinfo object isa typeof\fI object class\fR
   615         -.VS 8.6
          699  +.
   616    700   This returns whether \fIclass\fR is the type of \fIobject\fR (i.e. whether
   617    701   \fIobject\fR is an instance of \fIclass\fR or one of its subclasses, whether
   618    702   direct or indirect).
   619    703   .RE
   620         -.VE 8.6
   621    704   .TP
   622    705   \fBinfo object methods\fI object\fR ?\fIoption...\fR?
   623         -.VS 8.6
          706  +.
   624    707   This subcommand returns a list of all public (i.e. exported) methods of the
   625    708   object called \fIobject\fR. Any of the following \fIoption\fRs may be
   626    709   specified, controlling exactly which method names are returned:
   627    710   .RS
   628         -.VE 8.6
   629    711   .TP
   630    712   \fB\-all\fR
   631         -.VS 8.6
   632         -If the \fB\-all\fR flag is given, the list of methods will include those
          713  +.
          714  +If the \fB\-all\fR flag is given,
          715  +.VS TIP500
          716  +and the \fB\-scope\fR flag is not given,
          717  +.VE TIP500
          718  +the list of methods will include those
   633    719   methods defined not just by the object, but also by the object's class and
   634    720   mixins, plus the superclasses of those classes.
   635         -.VE 8.6
   636    721   .TP
   637    722   \fB\-private\fR
   638         -.VS 8.6
   639         -If the \fB\-private\fR flag is given, the list of methods will also include
   640         -the private (i.e. non-exported) methods of the object (and classes, if
          723  +.
          724  +If the \fB\-private\fR flag is given,
          725  +.VS TIP500
          726  +and the \fB\-scope\fR flag is not given,
          727  +.VE TIP500
          728  +the list of methods will also include
          729  +the non-exported methods of the object (and classes, if
   641    730   \fB\-all\fR is also given).
          731  +.VS TIP500
          732  +Note that this naming is an unfortunate clash with true private methods; this
          733  +option name is retained for backward compatibility.
          734  +.VE TIP500
          735  +.TP
          736  +\fB\-scope\fI scope\fR
          737  +.VS TIP500
          738  +Returns a list of all methods on \fIobject\fR that have the given visibility
          739  +\fIscope\fR.  When this option is supplied, both the \fB\-all\fR and
          740  +\fB\-private\fR options are ignored. The valid values for \fIscope\fR are:
          741  +.RS
          742  +.IP \fBpublic\fR 3
          743  +Only methods with \fIpublic\fR scope (i.e., callable from anywhere) are to be
          744  +returned.
          745  +.IP \fBunexported\fR 3
          746  +Only methods with \fIunexported\fR scope (i.e., only callable via \fBmy\fR) are to
          747  +be returned.
          748  +.IP \fBprivate\fR 3
          749  +Only methods with \fIprivate\fR scope (i.e., only callable from within this object's
          750  +instance methods) are to be returned.
   642    751   .RE
   643         -.VE 8.6
          752  +.VE TIP500
          753  +.RE
   644    754   .TP
   645    755   \fBinfo object methodtype\fI object method\fR
   646         -.VS 8.6
          756  +.
   647    757   This subcommand returns a description of the type of implementation used for
   648    758   the method named \fImethod\fR of object \fIobject\fR. When the result is
   649    759   \fBmethod\fR, further information can be discovered with \fBinfo object
   650    760   definition\fR, and when the result is \fBforward\fR, further information can
   651    761   be discovered with \fBinfo object forward\fR.
   652         -.VE 8.6
   653    762   .TP
   654    763   \fBinfo object mixins\fI object\fR
   655         -.VS 8.6
          764  +.
   656    765   This subcommand returns a list of all classes that have been mixed into the
   657    766   object named \fIobject\fR.
   658         -.VE 8.6
   659    767   .TP
   660    768   \fBinfo object namespace\fI object\fR
   661         -.VS 8.6
          769  +.
   662    770   This subcommand returns the name of the internal namespace of the object named
   663    771   \fIobject\fR.
   664         -.VE 8.6
   665    772   .TP
   666         -\fBinfo object variables\fI object\fR
   667         -.VS 8.6
          773  +\fBinfo object variables\fI object\fRR ?\fB\-private\fR?
          774  +.
   668    775   This subcommand returns a list of all variables that have been declared for
   669    776   the object named \fIobject\fR (i.e. that are automatically present in the
   670    777   object's methods).
   671         -.VE 8.6
          778  +.VS TIP500
          779  +If the \fB\-private\fR option is specified, this lists the private variables
          780  +declared instead.
          781  +.VE TIP500
   672    782   .TP
   673    783   \fBinfo object vars\fI object\fR ?\fIpattern\fR?
   674         -.VS 8.6
          784  +.
   675    785   This subcommand returns a list of all variables in the private namespace of
   676    786   the object named \fIobject\fR. If the optional \fIpattern\fR argument is
   677    787   given, it is a filter (in the syntax of a \fBstring match\fR glob pattern)
   678    788   that constrains the list of variables returned. Note that this is different
   679    789   from the list returned by \fBinfo object variables\fR; that can include
   680    790   variables that are currently unset, whereas this can include variables that
   681    791   are not automatically included by any of \fIobject\fR's methods (or those of
   682    792   its class, superclasses or mixins).
   683         -.VE 8.6
   684    793   .SH EXAMPLES
   685    794   .PP
   686    795   This command prints out a procedure suitable for saving in a Tcl
   687    796   script:
   688    797   .PP
   689    798   .CS
   690    799   proc printProc {procName} {
................................................................................
   699    808               lappend formals [list $var]
   700    809           }
   701    810       }
   702    811       puts [lappend result $formals [\fBinfo body\fR $procName]]
   703    812   }
   704    813   .CE
   705    814   .SS "EXAMPLES WITH OBJECTS"
   706         -.VS 8.6
   707    815   .PP
   708    816   Every object necessarily knows what its class is; this information is
   709    817   trivially extractable through introspection:
   710    818   .PP
   711    819   .CS
   712    820   oo::class create c
   713    821   c create o
................................................................................
   720    828   The introspection capabilities can be used to discover what class implements a
   721    829   method and get how it is defined. This procedure illustrates how:
   722    830   .PP
   723    831   .CS
   724    832   proc getDef {obj method} {
   725    833       foreach inf [\fBinfo object call\fR $obj $method] {
   726    834           lassign $inf calltype name locus methodtype
          835  +
   727    836           # Assume no forwards or filters, and hence no $calltype
   728    837           # or $methodtype checks...
          838  +
   729    839           if {$locus eq "object"} {
   730    840               return [\fBinfo object definition\fR $obj $name]
   731    841           } else {
   732    842               return [\fBinfo class definition\fR $locus $name]
   733    843           }
   734    844       }
   735    845       error "no definition for $method"
................................................................................
   744    854   .PP
   745    855   .CS
   746    856   proc getDef {obj method} {
   747    857       if {$method in [\fBinfo object methods\fR $obj]} {
   748    858           # Assume no forwards
   749    859           return [\fBinfo object definition\fR $obj $method]
   750    860       }
          861  +
   751    862       set cls [\fBinfo object class\fR $obj]
          863  +
   752    864       while {$method ni [\fBinfo class methods\fR $cls]} {
   753    865           # Assume the simple case
   754    866           set cls [lindex [\fBinfo class superclass\fR $cls] 0]
   755    867           if {$cls eq ""} {
   756    868               error "no definition for $method"
   757    869           }
   758    870       }
          871  +
   759    872       # Assume no forwards
   760    873       return [\fBinfo class definition\fR $cls $method]
   761    874   }
   762    875   .CE
   763         -.VE 8.6
   764    876   .SH "SEE ALSO"
   765         -.VS 8.6
   766    877   global(n), oo::class(n), oo::define(n), oo::object(n), proc(n), self(n),
   767         -.VE 8.6
   768    878   tcl_library(n), tcl_patchLevel(n), tcl_version(n)
   769    879   .SH KEYWORDS
   770    880   command, information, interpreter, introspection, level, namespace,
   771         -.VS 8.6
   772         -object,
   773         -.VE 8.6
   774         -procedure, variable
          881  +object, procedure, variable
   775    882   '\" Local Variables:
   776    883   '\" mode: nroff
   777    884   '\" fill-column: 78
   778    885   '\" End:

Changes to doc/interp.n.

   232    232   execution of all commands.
   233    233   .PP
   234    234   Note that once it is on, this flag cannot be switched back off: such
   235    235   attempts are silently ignored. This is needed to maintain the
   236    236   consistency of the underlying interpreter's state.
   237    237   .RE
   238    238   .TP
   239         -\fBinterp\fR \fBdelete \fR?\fIpath ...?\fR
          239  +\fBinterp\fR \fBdelete \fR?\fIpath ...\fR?
   240    240   .
   241    241   Deletes zero or more interpreters given by the optional \fIpath\fR
   242    242   arguments, and for each interpreter, it also deletes its slaves. The
   243    243   command also deletes the slave command for each interpreter deleted.
   244    244   For each \fIpath\fR argument, if no interpreter by that name
   245    245   exists, the command raises an error.
   246    246   .TP

Changes to doc/join.n.

    38     38   \fBjoin\fR $data
    39     39        \fB\(-> 1 2 3 4 5 {6 7} 8\fR
    40     40   .CE
    41     41   .SH "SEE ALSO"
    42     42   list(n), lappend(n), split(n)
    43     43   .SH KEYWORDS
    44     44   element, join, list, separator
           45  +'\" Local Variables:
           46  +'\" mode: nroff
           47  +'\" fill-column: 78
           48  +'\" End:

Changes to doc/lappend.n.

    18     18   .SH DESCRIPTION
    19     19   .PP
    20     20   This command treats the variable given by \fIvarName\fR as a list
    21     21   and appends each of the \fIvalue\fR arguments to that list as a separate
    22     22   element, with spaces between elements.
    23     23   If \fIvarName\fR does not exist, it is created as a list with elements
    24     24   given by the \fIvalue\fR arguments.
           25  +.VS TIP508
           26  +If \fIvarName\fR indicate an element that does not exist of an array that has
           27  +a default value set, list that is comprised of the default value with all the
           28  +\fIvalue\fR arguments appended as elements will be stored in the array
           29  +element.
           30  +.VE TIP508
    25     31   \fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs
    26     32   are appended as list elements rather than raw text.
    27     33   This command provides a relatively efficient way to build up
    28     34   large lists.  For example,
    29     35   .QW "\fBlappend a $b\fR"
    30     36   is much more efficient than
    31     37   .QW "\fBset a [concat $a [list $b]]\fR"
................................................................................
    43     49   1 2 3 4 5
    44     50   .CE
    45     51   .SH "SEE ALSO"
    46     52   list(n), lindex(n), linsert(n), llength(n), lset(n),
    47     53   lsort(n), lrange(n)
    48     54   .SH KEYWORDS
    49     55   append, element, list, variable
           56  +.\" Local variables:
           57  +.\" mode: nroff
           58  +.\" fill-column: 78
           59  +.\" End:

Changes to doc/lindex.n.

     9      9   .TH lindex n 8.4 Tcl "Tcl Built-In Commands"
    10     10   .so man.macros
    11     11   .BS
    12     12   '\" Note:  do not modify the .SH NAME line immediately below!
    13     13   .SH NAME
    14     14   lindex \- Retrieve an element from a list
    15     15   .SH SYNOPSIS
    16         -\fBlindex \fIlist ?index ...?\fR
           16  +\fBlindex \fIlist\fR ?\fIindex ...\fR?
    17     17   .BE
    18     18   .SH DESCRIPTION
    19     19   .PP
    20     20   The \fBlindex\fR command accepts a parameter, \fIlist\fR, which
    21     21   it treats as a Tcl list. It also accepts zero or more \fIindices\fR into
    22     22   the list.  The indices may be presented either consecutively on the
    23     23   command line, or grouped in a

Added doc/link.n.

            1  +'\"
            2  +'\" Copyright (c) 2011-2015 Andreas Kupries
            3  +'\" Copyright (c) 2018 Donal K. Fellows
            4  +'\"
            5  +'\" See the file "license.terms" for information on usage and redistribution
            6  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            7  +'\"
            8  +.TH link n 0.3 TclOO "TclOO Commands"
            9  +.so man.macros
           10  +.BS
           11  +'\" Note:  do not modify the .SH NAME line immediately below!
           12  +.SH NAME
           13  +link \- create link from command to method of object
           14  +.SH SYNOPSIS
           15  +.nf
           16  +package require TclOO
           17  +
           18  +\fBlink\fR \fImethodName\fR ?\fI...\fR?
           19  +\fBlink\fR \fB{\fIcommandName methodName\fB}\fR ?\fI...\fR?
           20  +.fi
           21  +.BE
           22  +.SH DESCRIPTION
           23  +The \fBlink\fR command is available within methods. It takes a series of one
           24  +or more method names (\fImethodName ...\fR) and/or pairs of command- and
           25  +method-name (\fB{\fIcommandName methodName\fB}\fR) and makes the named methods
           26  +available as commands without requiring the explicit use of the name of the
           27  +object or the \fBmy\fR command. The method does not need to exist at the time
           28  +that the link is made; if the link command is invoked when the method does not
           29  +exist, the standard \fBunknown\fR method handling system is used.
           30  +.PP
           31  +The command name under which the method becomes available defaults to the
           32  +method name, except where explicitly specified through an alias/method pair.
           33  +Formally, every argument must be a list; if the list has two elements, the
           34  +first element is the name of the command to create and the second element is
           35  +the name of the method of the current object to which the command links;
           36  +otherwise, the name of the command and the name of the method are the same
           37  +string (the first element of the list).
           38  +.PP
           39  +If the name of the command is not a fully-qualified command name, it will be
           40  +resolved with respect to the current namespace (i.e., the object namespace).
           41  +.SH EXAMPLES
           42  +This demonstrates linking a single method in various ways. First it makes a
           43  +simple link, then a renamed link, then an external link. Note that the method
           44  +itself is unexported, but that it can still be called directly from outside
           45  +the class.
           46  +.PP
           47  +.CS
           48  +oo::class create ABC {
           49  +    method Foo {} {
           50  +        puts "This is Foo in [self]"
           51  +    }
           52  +
           53  +    constructor {} {
           54  +        \fBlink\fR Foo
           55  +        # The method foo is now directly accessible as foo here
           56  +        \fBlink\fR {bar Foo}
           57  +        # The method foo is now directly accessible as bar
           58  +        \fBlink\fR {::ExternalCall Foo}
           59  +        # The method foo is now directly accessible in the global
           60  +        # namespace as ExternalCall
           61  +    }
           62  +
           63  +    method grill {} {
           64  +        puts "Step 1:"
           65  +        Foo
           66  +        puts "Step 2:"
           67  +        bar
           68  +    }
           69  +}
           70  +
           71  +ABC create abc
           72  +abc grill
           73  +        \fI\(-> Step 1:\fR
           74  +        \fI\(-> This is foo in ::abc\fR
           75  +        \fI\(-> Step 2:\fR
           76  +        \fI\(-> This is foo in ::abc\fR
           77  +# Direct access via the linked command
           78  +puts "Step 3:"; ExternalCall
           79  +        \fI\(-> Step 3:\fR
           80  +        \fI\(-> This is foo in ::abc\fR
           81  +.CE
           82  +.PP
           83  +This example shows that multiple linked commands can be made in a call to
           84  +\fBlink\fR, and that they can handle arguments.
           85  +.PP
           86  +.CS
           87  +oo::class create Ex {
           88  +    constructor {} {
           89  +        \fBlink\fR a b c
           90  +        # The methods a, b, and c (defined below) are all now
           91  +        # directly acessible within methods under their own names.
           92  +    }
           93  +
           94  +    method a {} {
           95  +        puts "This is a"
           96  +    }
           97  +    method b {x} {
           98  +        puts "This is b($x)"
           99  +    }
          100  +    method c {y z} {
          101  +        puts "This is c($y,$z)"
          102  +    }
          103  +
          104  +    method call {p q r} {
          105  +        a
          106  +        b $p
          107  +        c $q $r
          108  +    }
          109  +}
          110  +
          111  +set o [Ex new]
          112  +$o 3 5 7
          113  +        \fI\(-> This is a\fR
          114  +        \fI\(-> This is b(3)\fR
          115  +        \fI\(-> This is c(5,7)\fR
          116  +.CE
          117  +.SH "SEE ALSO"
          118  +interp(n), my(n), oo::class(n), oo::define(n)
          119  +.SH KEYWORDS
          120  +command, method, object
          121  +.\" Local Variables:
          122  +.\" mode: nroff
          123  +.\" fill-column: 78
          124  +.\" End:

Changes to doc/llength.n.

    49     49   1,0
    50     50   .CE
    51     51   .SH "SEE ALSO"
    52     52   list(n), lappend(n), lindex(n), linsert(n), lsearch(n),
    53     53   lset(n), lsort(n), lrange(n), lreplace(n)
    54     54   .SH KEYWORDS
    55     55   element, list, length
           56  +'\" Local Variables:
           57  +'\" mode: nroff
           58  +'\" fill-column: 78
           59  +'\" End:

Changes to doc/lrange.n.

    72     72   .CE
    73     73   .SH "SEE ALSO"
    74     74   list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
    75     75   lset(n), lreplace(n), lsort(n),
    76     76   string(n)
    77     77   .SH KEYWORDS
    78     78   element, list, range, sublist
           79  +'\" Local Variables:
           80  +'\" mode: nroff
           81  +'\" fill-column: 78
           82  +'\" End:

Changes to doc/lrepeat.n.

    29     29   \fBlrepeat\fR 3 a b c
    30     30         \fI\(-> a b c a b c a b c\fR
    31     31   \fBlrepeat\fR 3 [\fBlrepeat\fR 2 a] b c
    32     32         \fI\(-> {a a} b c {a a} b c {a a} b c\fR
    33     33   .CE
    34     34   .SH "SEE ALSO"
    35     35   list(n), lappend(n), linsert(n), llength(n), lset(n)
    36         -
    37     36   .SH KEYWORDS
    38     37   element, index, list
           38  +'\" Local Variables:
           39  +'\" mode: nroff
           40  +'\" fill-column: 78
           41  +'\" End:

Changes to doc/lreplace.n.

    13     13   .SH NAME
    14     14   lreplace \- Replace elements in a list with new elements
    15     15   .SH SYNOPSIS
    16     16   \fBlreplace \fIlist first last \fR?\fIelement element ...\fR?
    17     17   .BE
    18     18   .SH DESCRIPTION
    19     19   .PP
    20         -\fBlreplace\fR returns a new list formed by replacing one or more elements of
           20  +\fBlreplace\fR returns a new list formed by replacing zero or more elements of
    21     21   \fIlist\fR with the \fIelement\fR arguments.
    22     22   \fIfirst\fR and \fIlast\fR are index values specifying the first and
    23     23   last elements of the range to replace.
    24     24   The index values \fIfirst\fR and \fIlast\fR are interpreted
    25     25   the same as index values for the command \fBstring index\fR,
    26     26   supporting simple index arithmetic and indices relative to the
    27     27   end of the list.
    28     28   0 refers to the first element of the
    29     29   list, and \fBend\fR refers to the last element of the list.
    30         -If \fIlist\fR is empty, then \fIfirst\fR and \fIlast\fR are ignored.
    31     30   .PP
    32         -If \fIfirst\fR is less than zero, it is considered to refer to before the
    33         -first element of the list.  For non-empty lists, the element indicated
    34         -by \fIfirst\fR must exist or \fIfirst\fR must indicate before the
    35         -start of the list.
           31  +If either \fIfirst\fR or \fIlast\fR is less than zero, it is considered
           32  +to refer to before the first element of the list. This allows \fBlreplace\fR
           33  +to prepend elements to \fIlist\fR.
           34  +.VS TIP505
           35  +If either \fIfirst\fR or \fIlast\fR indicates a position greater than the
           36  +index of the last element of the list, it is treated as if it is an
           37  +index one greater than the last element. This allows \fBlreplace\fR to
           38  +append elements to \fIlist\fR.
           39  +.VE TIP505
    36     40   .PP
    37     41   If \fIlast\fR is less than \fIfirst\fR, then any specified elements
    38         -will be inserted into the list before the point specified by \fIfirst\fR
           42  +will be inserted into the list before the element specified by \fIfirst\fR
    39     43   with no elements being deleted.
    40     44   .PP
    41         -The \fIelement\fR arguments specify zero or more new arguments to
           45  +The \fIelement\fR arguments specify zero or more new elements to
    42     46   be added to the list in place of those that were deleted.
    43     47   Each \fIelement\fR argument will become a separate element of
    44     48   the list.  If no \fIelement\fR arguments are specified, then the elements
    45         -between \fIfirst\fR and \fIlast\fR are simply deleted.  If \fIlist\fR
    46         -is empty, any \fIelement\fR arguments are added to the end of the list.
           49  +between \fIfirst\fR and \fIlast\fR are simply deleted.
    47     50   .SH EXAMPLES
    48     51   .PP
    49     52   Replacing an element of a list with another:
    50     53   .PP
    51     54   .CS
    52     55   % \fBlreplace\fR {a b c d e} 1 1 foo
    53     56   a foo c d e
................................................................................
    74     77   .CS
    75     78   proc lremove {listVariable value} {
    76     79       upvar 1 $listVariable var
    77     80       set idx [lsearch -exact $var $value]
    78     81       set var [\fBlreplace\fR $var $idx $idx]
    79     82   }
    80     83   .CE
           84  +.PP
           85  +.VS TIP505
           86  +Appending elements to the list; note that \fBend+2\fR will initially
           87  +be treated as if it is \fB6\fR here, but both that and \fB12345\fR are greater
           88  +than the index of the final item so they behave identically:
           89  +.PP
           90  +.CS
           91  +% set var {a b c d e}
           92  +a b c d e
           93  +% set var [\fBlreplace\fR $var 12345 end+2 f g h i]
           94  +a b c d e f g h i
           95  +.CE
           96  +.VE TIP505
    81     97   .SH "SEE ALSO"
    82     98   list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
    83     99   lset(n), lrange(n), lsort(n),
    84    100   string(n)
    85    101   .SH KEYWORDS
    86    102   element, list, replace
          103  +.\" Local variables:
          104  +.\" mode: nroff
          105  +.\" fill-column: 78
          106  +.\" End:

Changes to doc/lsearch.n.

   143    143   This option implies \fB\-sorted\fR and cannot be used with either \fB\-all\fR
   144    144   or \fB\-not\fR.
   145    145   .VE 8.6
   146    146   .SS "NESTED LIST OPTIONS"
   147    147   .PP
   148    148   These options are used to search lists of lists.  They may be used
   149    149   with any other options.
          150  +.TP
          151  +\fB\-stride\0\fIstrideLength\fR
          152  +.
          153  +If this option is specified, the list is treated as consisting of
          154  +groups of \fIstrideLength\fR elements and the groups are searched by
          155  +either their first element or, if the \fB\-index\fR option is used,
          156  +by the element within each group given by the first index passed to
          157  +\fB\-index\fR (which is then ignored by \fB\-index\fR). The resulting
          158  +index always points to the first element in a group.
          159  +.PP
          160  +The list length must be an integer multiple of \fIstrideLength\fR, which
          161  +in turn must be at least 1. A \fIstrideLength\fR of 1 is the default and
          162  +indicates no grouping.
   150    163   .TP
   151    164   \fB\-index\fR\0\fIindexList\fR
   152    165   .
   153    166   This option is designed for use when searching within nested lists.
   154    167   The \fIindexList\fR argument gives a path of indices (much as might be
   155    168   used with the \fBlindex\fR or \fBlset\fR commands) within each element
   156    169   to allow the location of the term being matched against.
................................................................................
   204    217   .PP
   205    218   It is also possible to search inside elements:
   206    219   .PP
   207    220   .CS
   208    221   \fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
   209    222         \fI\(-> {a abc} {b bcd}\fR
   210    223   .CE
          224  +.PP
          225  +The same thing for a flattened list:
          226  +.PP
          227  +.CS
          228  +\fBlsearch\fR -stride 2 -index 1 -all -inline {a abc b bcd c cde} *bc*
          229  +      \fI\(-> {a abc b bcd}\fR
          230  +.CE
   211    231   .SH "SEE ALSO"
   212    232   foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
   213    233   lset(n), lsort(n), lrange(n), lreplace(n),
   214    234   string(n)
   215    235   .SH KEYWORDS
   216    236   binary search, linear search,
   217    237   list, match, pattern, regular expression, search, string
   218    238   '\" Local Variables:
   219    239   '\" mode: nroff
   220    240   '\" End:

Changes to doc/msgcat.n.

     7      7   .TH "msgcat" n 1.5 msgcat "Tcl Bundled Packages"
     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12     12   msgcat \- Tcl message catalog
    13     13   .SH SYNOPSIS
    14         -\fBpackage require Tcl 8.5\fR
           14  +\fBpackage require Tcl 8.7\fR
    15     15   .sp
    16         -\fBpackage require msgcat 1.6\fR
           16  +\fBpackage require msgcat 1.7\fR
    17     17   .sp
    18     18   \fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
    19     19   .sp
    20     20   \fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR?
    21     21   .sp
    22     22   .VS "TIP 412"
    23     23   \fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
    24     24   .VE "TIP 412"
           25  +.sp
           26  +.VS "TIP 490"
           27  +\fB::msgcat::mcpackagenamespaceget\fR
           28  +.VE "TIP 490"
    25     29   .sp
    26     30   \fB::msgcat::mclocale \fR?\fInewLocale\fR?
    27     31   .sp
    28         -\fB::msgcat::mcpreferences\fR
           32  +.VS "TIP 499"
           33  +\fB::msgcat::mcpreferences\fR ?\fIlocale preference\fR? ...
           34  +.VE "TIP 499"
    29     35   .sp
    30     36   .VS "TIP 412"
    31     37   \fB::msgcat::mcloadedlocales subcommand\fR ?\fIlocale\fR?
    32     38   .VE "TIP 412"
    33     39   .sp
    34     40   \fB::msgcat::mcload \fIdirname\fR
    35     41   .sp
................................................................................
    46     52   .VS "TIP 412"
    47     53   \fB::msgcat::mcpackagelocale subcommand\fR ?\fIlocale\fR?
    48     54   .sp
    49     55   \fB::msgcat::mcpackageconfig subcommand\fR \fIoption\fR ?\fIvalue\fR?
    50     56   .sp
    51     57   \fB::msgcat::mcforgetpackage\fR
    52     58   .VE "TIP 412"
           59  +.sp
           60  +.VS "TIP 499"
           61  +\fB::msgcat::mcutil subcommand\fR ?\fIlocale\fR?
           62  +.VS "TIP 499"
    53     63   .BE
    54     64   .SH DESCRIPTION
    55     65   .PP
    56     66   The \fBmsgcat\fR package provides a set of functions
    57     67   that can be used to manage multi-lingual user interfaces.
    58     68   Text strings are defined in a
    59     69   .QW "message catalog"
................................................................................
    67     77   Each package has its own message catalog and configuration settings in \fBmsgcat\fR.
    68     78   .PP
    69     79   A \fIlocale\fR is a specification string describing a user language like \fBde_ch\fR for Swiss German.
    70     80   In \fBmsgcat\fR, there is a global locale initialized by the system locale of the current system.
    71     81   Each package may decide to use the global locale or to use a package specific locale.
    72     82   .PP
    73     83   The global locale may be changed on demand, for example by a user initiated language change or within a multi user application like a web server.
           84  +.PP
           85  +.VS tip490
           86  +Object oriented programming is supported by the use of a package namespace.
           87  +.VE tip490
           88  +.PP
    74     89   .SH COMMANDS
    75     90   .TP
    76     91   \fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
    77     92   .
    78     93   Returns a translation of \fIsrc-string\fR according to the
    79     94   current locale.  If additional arguments past \fIsrc-string\fR
    80     95   are given, the \fBformat\fR command is used to substitute the
................................................................................
    91    106   \fB::msgcat::mc\fR is the main function used to localize an
    92    107   application.  Instead of using an English string directly, an
    93    108   application can pass the English string through \fB::msgcat::mc\fR and
    94    109   use the result.  If an application is written for a single language in
    95    110   this fashion, then it is easy to add support for additional languages
    96    111   later simply by defining new message catalog entries.
    97    112   .RE
          113  +.VS "TIP 490"
          114  +.TP
          115  +\fB::msgcat::mcn \fInamespace\fR \fIsrc-string\fR ?\fIarg arg ...\fR?
          116  +.
          117  +Like \fB::msgcat::mc\fR, but with the message namespace specified as first argument.
          118  +.PP
          119  +.RS
          120  +\fBmcn\fR may be used for cases where the package namespace is not the namespace of the caller.
          121  +An example is shown within the description of the command \fB::msgcat::mcpackagenamespaceget\fR below.
          122  +.RE
          123  +.PP
    98    124   .TP
    99    125   \fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR?
   100    126   .
   101    127   Given several source strings, \fB::msgcat::mcmax\fR returns the length
   102    128   of the longest translated string.  This is useful when designing
   103    129   localized GUIs, which may require that all buttons, for example, be a
   104    130   fixed width (which will be the width of the widest button).
   105         -.TP
   106         -\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR
   107         -.
   108    131   .VS "TIP 412"
          132  +.TP
          133  +\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? ?\fB-namespace\fR \fInamespace\fR? \fIsrc-string\fR
          134  +.
   109    135   Return true, if there is a translation for the given \fIsrc-string\fR.
   110    136   .PP
   111    137   .RS
   112    138   The search may be limited by the option \fB\-exactnamespace\fR to only check the current namespace and not any parent namespaces.
   113    139   .PP
   114    140   It may also be limited by the option \fB\-exactlocale\fR to only check the first prefered locale (e.g. first element returned by \fB::msgcat::mcpreferences\fR if global locale is used).
   115         -.RE
          141  +.PP
   116    142   .VE "TIP 412"
          143  +.VS "TIP 490"
          144  +An explicit package namespace may be specified by the option \fB-namespace\fR.
          145  +The namespace of the caller is used if not explicitly specified.
          146  +.RE
          147  +.PP
          148  +.VE "TIP 490"
          149  +.VS "TIP 490"
          150  +.TP
          151  +\fB::msgcat::mcpackagenamespaceget\fR
          152  +.
          153  +Return the package namespace of the caller.
          154  +This command handles all cases described in section \fBOBJECT ORIENTED PROGRAMMING\fR.
          155  +.PP
          156  +.RS
          157  +Example usage is a tooltip package, which saves the caller package namespace to update the translation each time the tooltip is shown:
          158  +.CS
          159  +proc ::tooltip::tooltip {widget message} {
          160  +    ...
          161  +    set messagenamespace [uplevel 1 {::msgcat::mcpackagenamespaceget}]
          162  +    ...
          163  +    bind $widget  [list ::tooltip::show $widget $messagenamespace $message]
          164  +}
          165  +
          166  +proc ::tooltip::show {widget messagenamespace message} {
          167  +    ...
          168  +    set message [::msgcat::mcn $messagenamespace $message]
          169  +    ...
          170  +}
          171  +.CE
          172  +.RE
          173  +.PP
          174  +.VE "TIP 490"
   117    175   .TP
   118    176   \fB::msgcat::mclocale \fR?\fInewLocale\fR?
   119    177   .
   120         -This function sets the locale to \fInewLocale\fR.  If \fInewLocale\fR
   121         -is omitted, the current locale is returned, otherwise the current locale
   122         -is set to \fInewLocale\fR.  msgcat stores and compares the locale in a
          178  +If \fInewLocale\fR is omitted, the current locale is returned, otherwise the current locale
          179  +is set to \fInewLocale\fR.
          180  +.PP
          181  +.RS
          182  +If the new locale is set to \fInewLocale\fR, the corresponding preferences are calculated and set.
          183  +For example, if the current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR returns \fB{en_us_funky en_us en {}}\fR.
          184  +.PP
          185  +The same result may be acheved by \fB::msgcat::mcpreferences\fR {*}[\fB::msgcat::mcutil getpreferences\fR \fInewLocale\fR].
          186  +.PP
          187  +The current locale is always the first element of the list returned by \fBmcpreferences\fR.
          188  +.PP
          189  +msgcat stores and compares the locale in a
   123    190   case-insensitive manner, and returns locales in lowercase.
   124    191   The initial locale is determined by the locale specified in
   125    192   the user's environment.  See \fBLOCALE SPECIFICATION\fR
   126    193   below for a description of the locale string format.
   127         -.RS
   128    194   .PP
   129    195   .VS "TIP 412"
   130    196   If the locale is set, the preference list of locales is evaluated.
   131    197   Locales in this list are loaded now, if not jet loaded.
   132    198   .VE "TIP 412"
   133    199   .RE
   134    200   .TP
   135         -\fB::msgcat::mcpreferences\fR
          201  +\fB::msgcat::mcpreferences\fR ?\fIlocale preference\fR? ...
   136    202   .
   137         -Returns an ordered list of the locales preferred by
   138         -the user, based on the user's language specification.
   139         -The list is ordered from most specific to least
   140         -preference.  The list is derived from the current
   141         -locale set in msgcat by \fB::msgcat::mclocale\fR, and
   142         -cannot be set independently.  For example, if the
   143         -current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
   144         -returns \fB{en_us_funky en_us en {}}\fR.
          203  +Without arguments, returns an ordered list of the locales preferred by
          204  +the user.
          205  +The list is ordered from most specific to least preference.
          206  +.PP
          207  +.VS "TIP 499"
          208  +.RS
          209  +A set of locale preferences may be given to set the list of locale preferences.
          210  +The current locale is also set, which is the first element of the locale preferences list.
          211  +.PP
          212  +Locale preferences are loaded now, if not jet loaded.
          213  +.PP
          214  +As an example, the user may prefer French or English text. This may be configured by:
          215  +.CS
          216  +::msgcat::mcpreferences fr en {}
          217  +.CE
          218  +.RE
          219  +.PP
          220  +.VS "TIP 499"
   145    221   .TP
   146    222   \fB::msgcat:mcloadedlocales subcommand\fR ?\fIlocale\fR?
   147    223   .
   148    224   This group of commands manage the list of loaded locales for packages not setting a package locale.
   149    225   .PP
   150    226   .RS
   151    227   The subcommand \fBget\fR returns the list of currently loaded locales.
................................................................................
   227    303   Note that this routine is only called if the concerned package did not set a package locale unknown command name.
   228    304   .RE
   229    305   .TP
   230    306   \fB::msgcat::mcforgetpackage\fR
   231    307   .
   232    308   The calling package clears all its state within the \fBmsgcat\fR package including all settings and translations.
   233    309   .VE "TIP 412"
          310  +.PP
          311  +.VS "TIP 499"
          312  +.TP
          313  +\fB::msgcat::mcutil getpreferences\fR \fIlocale\fR
          314  +.
          315  +Return the preferences list of the given locale as described in section \fBLOCALE SPECIFICATION\fR.
          316  +An example is the composition of a preference list for the bilingual region "Biel/Bienne" as a concatenation of swiss german and swiss french:
          317  +.CS
          318  +% concat [lrange [msgcat::mcutil getpreferences fr_CH] 0 end-1] [msgcat::mcutil getpreferences de_CH]
          319  +fr_ch fr de_ch de {}
          320  +.CE
          321  +.TP
          322  +\fB::msgcat::mcutil getsystemlocale\fR
          323  +.
          324  +The system locale is returned as described by the section \fBLOCALE SPECIFICATION\fR.
          325  +.VE "TIP 499"
   234    326   .PP
   235    327   .SH "LOCALE SPECIFICATION"
   236    328   .PP
   237    329   The locale is specified to \fBmsgcat\fR by a locale string
   238    330   passed to \fB::msgcat::mclocale\fR.
   239    331   The locale string consists of
   240    332   a language code, an optional country code, and an optional
................................................................................
   433    525   .PP
   434    526   .CS
   435    527   \fBmsgcat::mc\fR {Produced %1$d at %2$s} $num $city
   436    528   # ... where that key is mapped to one of the
   437    529   # human-oriented versions by \fBmsgcat::mcset\fR
   438    530   .CE
   439    531   .VS "TIP 412"
   440         -.SH Package private locale
          532  +.SH "PACKAGE PRIVATE LOCALE"
   441    533   .PP
   442    534   A package using \fBmsgcat\fR may choose to use its own package private
   443    535   locale and its own set of loaded locales, independent to the global
   444    536   locale set by \fB::msgcat::mclocale\fR.
   445    537   .PP
   446    538   This allows a package to change its locale without causing any locales load or removal in other packages and not to invoke the global locale change callback (see below).
   447    539   .PP
................................................................................
   457    549   This command may cause the load of locales.
   458    550   .RE
   459    551   .TP
   460    552   \fB::msgcat::mcpackagelocale get\fR
   461    553   .
   462    554   Return the package private locale or the global locale, if no package private locale is set.
   463    555   .TP
   464         -\fB::msgcat::mcpackagelocale preferences\fR
          556  +\fB::msgcat::mcpackagelocale preferences\fR ?\fIlocale preference\fR? ...
   465    557   .
   466         -Return the package private preferences or the global preferences,
          558  +With no parameters, return the package private preferences or the global preferences,
   467    559   if no package private locale is set.
          560  +The package locale state (set or not) is not changed (in contrast to the command \fB::msgcat::mcpackagelocale set\fR).
          561  +.PP
          562  +.RS
          563  +.VS "TIP 499"
          564  +If a set of locale preferences is given, it is set as package locale preference list.
          565  +The package locale is set to the first element of the preference list.
          566  +A package locale is activated, if it was not set so far.
          567  +.PP
          568  +Locale preferences are loaded now for the package, if not jet loaded.
          569  +.VE "TIP 499"
          570  +.RE
          571  +.PP
   468    572   .TP
   469    573   \fB::msgcat::mcpackagelocale loaded\fR
   470    574   .
   471    575   Return the list of locales loaded for this package.
   472    576   .TP
   473    577   \fB::msgcat::mcpackagelocale isset\fR
   474    578   .
................................................................................
   484    588   .
   485    589   Returns true, if the given locale is loaded for the package.
   486    590   .TP
   487    591   \fB::msgcat::mcpackagelocale clear\fR
   488    592   .
   489    593   Clear any loaded locales of the package not present in the package preferences.
   490    594   .PP
   491         -.SH Changing package options
          595  +.SH "CHANGING PACKAGE OPTIONS"
   492    596   .PP
   493    597   Each package using msgcat has a set of options within \fBmsgcat\fR.
   494    598   The package options are described in the next sectionPackage options.
   495    599   Each package option may be set or unset individually using the following ensemble:
   496    600   .TP
   497    601   \fB::msgcat::mcpackageconfig get\fR \fIoption\fR
   498    602   .
................................................................................
   559    663   The called procedure must return the formatted message which will finally be returned by msgcat::mc.
   560    664   .PP
   561    665   A generic unknown handler is used if set to the empty string. This consists in returning the key if no arguments are given. With given arguments, format is used to process the arguments.
   562    666   .PP
   563    667   See section \fBcallback invocation\fR below.
   564    668   The appended arguments are identical to \fB::msgcat::mcunknown\fR.
   565    669   .RE
   566         -.SS Callback invocation
          670  +.SH "Callback invocation"
   567    671   A package may decide to register one or multiple callbacks, as described above.
   568    672   .PP
   569    673   Callbacks are invoked, if:
   570    674   .PP
   571    675   1. the callback command is set,
   572    676   .PP
   573    677   2. the command is not the empty string,
   574    678   .PP
   575    679   3. the registering namespace exists.
   576    680   .PP
   577    681   If a called routine fails with an error, the \fBbgerror\fR routine for the interpreter is invoked after command completion.
   578    682   Only exception is the callback \fBunknowncmd\fR, where an error causes the invoking \fBmc\fR-command to fail with that error.
   579    683   .PP
   580         -.SS Examples
          684  +.VS tip490
          685  +.SH "OBJECT ORIENTED PROGRAMMING"
          686  +\fBmsgcat\fR supports packages implemented by object oriented programming.
          687  +Objects and classes should be defined within a package namespace.
          688  +.PP
          689  +There are 3 supported cases where package namespace sensitive commands of msgcat (\fBmc\fR, \fBmcexists\fR, \fBmcpackagelocale\fR, \fBmcforgetpackage\fR, \fBmcpackagenamespaceget\fR, \fBmcpackageconfig\fR, \fBmcset\fR and \fBmcmset\fR) may be called:
          690  +.PP
          691  +.TP
          692  +\fB1) In class definition script\fR
          693  +.
          694  +\fBmsgcat\fR command is called within a class definition script.
          695  +.CS
          696  +namespace eval ::N2 {
          697  +    mcload $dir/msgs
          698  +    oo::class create C1 {puts [mc Hi!]}
          699  +}
          700  +.CE
          701  +.PP
          702  +.TP
          703  +\fB2) method defined in a class\fR
          704  +.
          705  +\fBmsgcat\fR command is called from a method in an object and the method is defined in a class.
          706  +.CS
          707  +namespace eval ::N3Class {
          708  +    mcload $dir/msgs
          709  +    oo::class create C1
          710  +    oo::define C1 method m1 {
          711  +        puts [mc Hi!]
          712  +    }
          713  +}
          714  +.CE
          715  +.PP
          716  +.TP
          717  +\fB3) method defined in a classless object\fR
          718  +.
          719  +\fBmsgcat\fR command is called from a method of a classless object.
          720  +.CS
          721  +namespace eval ::N4 {
          722  +    mcload $dir/msgs
          723  +    oo::object create O1
          724  +    oo::objdefine O1 method m1 {} {
          725  +        puts [mc Hi!]
          726  +    }
          727  +}
          728  +.CE
          729  +.PP
          730  +.VE tip490
          731  +.SH EXAMPLES
   581    732   Packages which display a GUI may update their widgets when the global locale changes.
   582    733   To register to a callback, use:
   583    734   .CS
   584    735   namespace eval gui {
   585    736       msgcat::mcpackageconfig changecmd updateGUI
   586    737   
   587    738       proc updateGui args {
................................................................................
   639    790   }
   640    791   .CE
   641    792   .VE "TIP 412"
   642    793   .SH CREDITS
   643    794   .PP
   644    795   The message catalog code was developed by Mark Harrison.
   645    796   .SH "SEE ALSO"
   646         -format(n), scan(n), namespace(n), package(n)
          797  +format(n), scan(n), namespace(n), package(n), oo::class(n), oo::object
   647    798   .SH KEYWORDS
   648         -internationalization, i18n, localization, l10n, message, text, translation
          799  +internationalization, i18n, localization, l10n, message, text, translation, class, object
   649    800   .\" Local Variables:
   650    801   .\" mode: nroff
   651    802   .\" End:

Changes to doc/my.n.

     5      5   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      6   '\"
     7      7   .TH my n 0.1 TclOO "TclOO Commands"
     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12         -my \- invoke any method of current object
           12  +my, myclass \- invoke any method of current object or its class
    13     13   .SH SYNOPSIS
    14     14   .nf
    15     15   package require TclOO
    16     16   
    17     17   \fBmy\fI methodName\fR ?\fIarg ...\fR?
           18  +\fBmyclass\fI methodName\fR ?\fIarg ...\fR?
    18     19   .fi
    19     20   .BE
    20     21   .SH DESCRIPTION
    21     22   .PP
    22         -The \fBmy\fR command is used to allow methods of objects to invoke any method
    23         -of the object (or its class). In particular, the set of valid values for
           23  +The \fBmy\fR command is used to allow methods of objects to invoke methods
           24  +of the object (or its class),
           25  +.VS TIP478
           26  +and he \fBmyclass\fR command is used to allow methods of objects to invoke
           27  +methods of the current class of the object \fIas an object\fR.
           28  +.VE TIP478
           29  +In particular, the set of valid values for
    24     30   \fImethodName\fR is the set of all methods supported by an object and its
    25         -superclasses, including those that are not exported. The object upon which the
    26         -method is invoked is always the one that is the current context of the method
    27         -(i.e. the object that is returned by \fBself object\fR) from which the
    28         -\fBmy\fR command is invoked.
           31  +superclasses, including those that are not exported
           32  +.VS TIP500
           33  +and private methods of the object or class when used within another method
           34  +defined by that object or class.
           35  +.VE TIP500
           36  +.PP
           37  +The object upon which the method is invoked via \fBmy\fR is the one that owns
           38  +the namespace that the \fBmy\fR command is contained in initially (\fBNB:\fR the link
           39  +remains if the command is renamed), which is the currently invoked object by
           40  +default.
           41  +.VS TIP478
           42  +Similarly, the object on which the method is invoked via \fBmyclass\fR is the
           43  +object that is the current class of the object that owns the namespace that
           44  +the \fBmyclass\fR command is contained in initially. As with \fBmy\fR, the
           45  +link remains even if the command is renamed into another namespace, and
           46  +defaults to being the manufacturing class of the current object.
           47  +.VE TIP478
    29     48   .PP
    30         -Each object has its own \fBmy\fR command, contained in its instance namespace.
           49  +Each object has its own \fBmy\fR and \fBmyclass\fR commands, contained in its
           50  +instance namespace.
    31     51   .SH EXAMPLES
    32     52   .PP
    33     53   This example shows basic use of \fBmy\fR to use the \fBvariables\fR method of
    34     54   the \fBoo::object\fR class, which is not publicly visible by default:
    35     55   .PP
    36     56   .CS
    37     57   oo::class create c {
    38     58       method count {} {
    39     59           \fBmy\fR variable counter
    40     60           puts [incr counter]
    41     61       }
    42     62   }
           63  +
    43     64   c create o
    44     65   o count              \fI\(-> prints "1"\fR
    45     66   o count              \fI\(-> prints "2"\fR
    46     67   o count              \fI\(-> prints "3"\fR
    47     68   .CE
           69  +.PP
           70  +This example shows how you can use \fBmy\fR to make callbacks to private
           71  +methods from outside the object (from a \fBtrace\fR), using
           72  +\fBnamespace code\fR to enter the correct context. (See the \fBcallback\fR
           73  +command for the recommended way of doing this.)
           74  +.PP
           75  +.CS
           76  +oo::class create HasCallback {
           77  +    method makeCallback {} {
           78  +        return [namespace code {
           79  +            \fBmy\fR Callback
           80  +        }]
           81  +    }
           82  +
           83  +    method Callback {args} {
           84  +        puts "callback: $args"
           85  +    }
           86  +}
           87  +
           88  +set o [HasCallback new]
           89  +trace add variable xyz write [$o makeCallback]
           90  +set xyz "called"     \fI\(-> prints "callback: xyz {} write"\fR
           91  +.CE
           92  +.PP
           93  +.VS TIP478
           94  +This example shows how to access a private method of a class from an instance
           95  +of that class. (See the \fBclassmethod\fR declaration in \fBoo::define\fR for
           96  +a higher level interface for doing this.)
           97  +.PP
           98  +.CS
           99  +oo::class create CountedSteps {
          100  +    self {
          101  +        variable count
          102  +        method Count {} {
          103  +            return [incr count]
          104  +        }
          105  +    }
          106  +    method advanceTwice {} {
          107  +        puts "in [self] step A: [\fBmyclass\fR Count]"
          108  +        puts "in [self] step B: [\fBmyclass\fR Count]"
          109  +    }
          110  +}
          111  +
          112  +CountedSteps create x
          113  +CountedSteps create y
          114  +x advanceTwice       \fI\(-> prints "in ::x step A: 1"\fR
          115  +                     \fI\(-> prints "in ::x step B: 2"\fR
          116  +y advanceTwice       \fI\(-> prints "in ::y step A: 3"\fR
          117  +                     \fI\(-> prints "in ::y step B: 4"\fR
          118  +x advanceTwice       \fI\(-> prints "in ::x step A: 5"\fR
          119  +                     \fI\(-> prints "in ::x step B: 6"\fR
          120  +y advanceTwice       \fI\(-> prints "in ::y step A: 7"\fR
          121  +                     \fI\(-> prints "in ::y step B: 8"\fR
          122  +.CE
          123  +.VE TIP478
    48    124   .SH "SEE ALSO"
    49    125   next(n), oo::object(n), self(n)
    50    126   .SH KEYWORDS
    51    127   method, method visibility, object, private method, public method
    52         -
    53    128   .\" Local variables:
    54    129   .\" mode: nroff
    55    130   .\" fill-column: 78
    56    131   .\" End:

Changes to doc/next.n.

   108    108   .PP
   109    109   .CS
   110    110   oo::class create theSuperclass {
   111    111       method example {args} {
   112    112           puts "in the superclass, args = $args"
   113    113       }
   114    114   }
          115  +
   115    116   oo::class create theSubclass {
   116    117       superclass theSuperclass
   117    118       method example {args} {
   118    119           puts "before chaining from subclass, args = $args"
   119    120           \fBnext\fR a {*}$args b
   120    121           \fBnext\fR pureSynthesis
   121    122           puts "after chaining from subclass"
   122    123       }
   123    124   }
          125  +
   124    126   theSubclass create obj
   125    127   oo::objdefine obj method example args {
   126    128       puts "per-object method, args = $args"
   127    129       \fBnext\fR x {*}$args y
   128    130       \fBnext\fR
   129    131   }
   130    132   obj example 1 2 3
................................................................................
   163    165           if {[info exist ValueCache($key)]} {
   164    166               return $ValueCache($key)
   165    167           }
   166    168   
   167    169           \fI# Compute value, insert into cache, and return it\fR
   168    170           return [set ValueCache($key) [\fBnext\fR {*}$args]]
   169    171       }
          172  +
   170    173       method flushCache {} {
   171    174           my variable ValueCache
   172    175           unset ValueCache
   173    176           \fI# Skip the caching\fR
   174    177           return -level 2 ""
   175    178       }
   176    179   }
   177    180   
   178    181   oo::object create demo
   179    182   oo::objdefine demo {
   180    183       mixin cache
          184  +
   181    185       method compute {a b c} {
   182    186           after 3000 \fI;# Simulate deep thought\fR
   183    187           return [expr {$a + $b * $c}]
   184    188       }
          189  +
   185    190       method compute2 {a b c} {
   186    191           after 3000 \fI;# Simulate deep thought\fR
   187    192           return [expr {$a * $b + $c}]
   188    193       }
   189    194   }
   190    195   
   191    196   puts [demo compute  1 2 3]      \fI\(-> prints "7" after delay\fR

Changes to doc/packagens.n.

    44     44   specified.
    45     45   .PP
    46     46   At least one \fB\-load\fR or \fB\-source\fR parameter must be given.
    47     47   .SH "SEE ALSO"
    48     48   package(n)
    49     49   .SH KEYWORDS
    50     50   auto-load, index, package, version
           51  +'\" Local Variables:
           52  +'\" mode: nroff
           53  +'\" fill-column: 78
           54  +'\" End:

Changes to doc/pid.n.

    39     39   puts [string repeat - 70]
    40     40   puts [read $pipeline]
    41     41   close $pipeline
    42     42   .CE
    43     43   
    44     44   .SH "SEE ALSO"
    45     45   exec(n), open(n)
    46         -
    47     46   .SH KEYWORDS
    48     47   file, pipeline, process identifier
           48  +'\" Local Variables:
           49  +'\" mode: nroff
           50  +'\" fill-column: 78
           51  +'\" End:

Changes to doc/platform.n.

     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12     12   platform \- System identification support code and utilities
    13     13   .SH SYNOPSIS
    14     14   .nf
    15         -\fBpackage require platform ?1.0.10?\fR
           15  +\fBpackage require platform\fR ?\fB1.0.10\fR?
    16     16   .sp
    17     17   \fBplatform::generic\fR
    18     18   \fBplatform::identify\fR
    19     19   \fBplatform::patterns \fIidentifier\fR
    20     20   .fi
    21     21   .BE
    22     22   .SH DESCRIPTION

Changes to doc/platform_shell.n.

     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12     12   platform::shell \- System identification support code and utilities
    13     13   .SH SYNOPSIS
    14     14   .nf
    15         -\fBpackage require platform::shell ?1.1.4?\fR
           15  +\fBpackage require platform::shell\fR ?\fB1.1.4\fR?
    16     16   .sp
    17     17   \fBplatform::shell::generic \fIshell\fR
    18     18   \fBplatform::shell::identify \fIshell\fR
    19     19   \fBplatform::shell::platform \fIshell\fR
    20     20   .fi
    21     21   .BE
    22     22   .SH DESCRIPTION
................................................................................
    51     51   for the specified Tcl shell, in contrast to the running shell.
    52     52   .TP
    53     53   \fBplatform::shell::platform \fIshell\fR
    54     54   This command returns the contents of \fBtcl_platform(platform)\fR for
    55     55   the specified Tcl shell.
    56     56   .SH KEYWORDS
    57     57   operating system, cpu architecture, platform, architecture
           58  +'\" Local Variables:
           59  +'\" mode: nroff
           60  +'\" fill-column: 78
           61  +'\" End:

Changes to doc/prefix.n.

     8      8   .so man.macros
     9      9   .BS
    10     10   '\" Note:  do not modify the .SH NAME line immediately below!
    11     11   .SH NAME
    12     12   tcl::prefix \- facilities for prefix matching
    13     13   .SH SYNOPSIS
    14     14   .nf
    15         -\fB::tcl::prefix all\fR \fItable\fR \fIstring\fR
    16         -\fB::tcl::prefix longest\fR \fItable\fR \fIstring\fR
    17         -\fB::tcl::prefix match\fR \fI?option ...?\fR \fItable\fR \fIstring\fR
           15  +\fB::tcl::prefix all\fR \fItable string\fR
           16  +\fB::tcl::prefix longest\fR \fItable string\fR
           17  +\fB::tcl::prefix match\fR ?\fIoption ...\fR? \fItable string\fR
    18     18   .fi
    19     19   .BE
    20     20   .SH DESCRIPTION
    21     21   .PP
    22     22   This document describes commands looking up a prefix in a list of strings.
    23     23   The following commands are supported:
    24     24   .TP
    25         -\fB::tcl::prefix all\fR \fItable\fR \fIstring\fR
           25  +\fB::tcl::prefix all\fR \fItable string\fR
    26     26   .
    27     27   Returns a list of all elements in \fItable\fR that begin with the prefix
    28     28   \fIstring\fR.
    29     29   .TP
    30         -\fB::tcl::prefix longest\fR \fItable\fR \fIstring\fR
           30  +\fB::tcl::prefix longest\fR \fItable string\fR
    31     31   .
    32     32   Returns the longest common prefix of all elements in \fItable\fR that
    33     33   begin with the prefix \fIstring\fR.
    34     34   .TP
    35         -\fB::tcl::prefix match\fR ?\fIoptions\fR? \fItable\fR \fIstring\fR
           35  +\fB::tcl::prefix match\fR ?\fIoptions\fR? \fItable string\fR
    36     36   .
    37     37   If \fIstring\fR equals one element in \fItable\fR or is a prefix to exactly
    38     38   one element, the matched element is returned. If not, the result depends
    39     39   on the \fB\-error\fR option. (It is recommended that the \fItable\fR be sorted
    40     40   before use with this subcommand, so that the list of matches presented in the
    41     41   error message also becomes sorted, though this is not strictly necessary for
    42     42   the operation of this subcommand itself.)

Added doc/process.n.

            1  +'\"
            2  +'\" Copyright (c) 2017 Frederic Bonnet.
            3  +'\"
            4  +'\" See the file "license.terms" for information on usage and redistribution
            5  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            6  +'\"
            7  +.TH process n 8.7 Tcl "Tcl Built-In Commands"
            8  +.so man.macros
            9  +.BS
           10  +'\" Note:  do not modify the .SH NAME line immediately below!
           11  +.SH NAME
           12  +tcl::process \- Subprocess management
           13  +.SH SYNOPSIS
           14  +\fB::tcl::process \fIoption \fR?\fIarg arg ...\fR?
           15  +.BE
           16  +.SH DESCRIPTION
           17  +.PP
           18  +This command provides a way to manage subprocesses created by the \fBopen\fR
           19  +and \fBexec\fR commands, as identified by the process identifiers (PIDs) of
           20  +those subprocesses. The legal \fIoptions\fR (which may be abbreviated) are:
           21  +.TP
           22  +\fB::tcl::process autopurge\fR ?\fIflag\fR?
           23  +.
           24  +Automatic purge facility. If \fIflag\fR is specified as a boolean value then
           25  +it activates or deactivate autopurge. In all cases it returns the current
           26  +status as a boolean value. When autopurge is active,
           27  +\fBTcl_ReapDetachedProcs\fR is called each time the \fBexec\fR command is
           28  +executed or a pipe channel created by \fBopen\fR is closed. When autopurge is
           29  +inactive, \fB::tcl::process\fR purge must be called explicitly. By default
           30  +autopurge is active.
           31  +.TP
           32  +\fB::tcl::process list\fR
           33  +.
           34  +Returns the list of subprocess PIDs. This includes all currently executing
           35  +subprocesses and all terminated subprocesses that have not yet had their
           36  +corresponding process table entries purged.
           37  +.TP
           38  +\fB::tcl::process purge\fR ?\fIpids\fR?
           39  +.
           40  +Cleans up all data associated with terminated subprocesses. If \fIpids\fR is
           41  +specified as a list of PIDs then the command only cleanup data for the matching
           42  +subprocesses if they exist, and raises an error otherwise. If a process listed is
           43  +still active, this command does nothing to that process.
           44  +.TP
           45  +\fB::tcl::process status\fR ?\fIswitches\fR? ?\fIpids\fR?
           46  +.
           47  +Returns a dictionary mapping subprocess PIDs to their respective status. If
           48  +\fIpids\fR is specified as a list of PIDs then the command only returns the
           49  +status of the matching subprocesses if they exist, and raises an error
           50  +otherwise. For active processes, the status is an empty value. For terminated
           51  +processes, the status is a list with the following format:
           52  +.QW "\fB{\fIcode\fR ?\fImsg errorCode\fR?\fB}\fR" ,
           53  +where:
           54  +.RS
           55  +.TP
           56  +\fIcode\fR\0
           57  +.
           58  +is a standard Tcl return code, i.e., \fB0\fR for TCL_OK and \fB1\fR
           59  +for TCL_ERROR,
           60  +.TP
           61  +\fImsg\fR\0
           62  +.
           63  +is the human-readable error message,
           64  +.TP
           65  +\fIerrorCode\fR\0
           66  +.
           67  +uses the same format as the \fBerrorCode\fR global variable
           68  +.PP
           69  +Note that \fBmsg\fR and \fBerrorCode\fR are only present for abnormally
           70  +terminated processes (i.e. those where the \fIcode\fR is nonzero). Under the
           71  +hood this command calls \fBTcl_WaitPid\fR with the \fBWNOHANG\fR flag set for
           72  +non-blocking behavior, unless the \fB\-wait\fR switch is set (see below).
           73  +.PP
           74  +Additionally, \fB::tcl::process status\fR accepts the following switches:
           75  +.TP
           76  +\fB\-wait\fR\0
           77  +.
           78  +By default the command returns immediately (the underlying \fBTcl_WaitPid\fR is
           79  +called with the \fBWNOHANG\fR flag set) unless this switch is set. If \fIpids\fR
           80  +is specified as a list of PIDs then the command waits until the status of the
           81  +matching subprocesses are available. If \fIpids\fR was not specified, this
           82  +command will wait for all known subprocesses.
           83  +.TP
           84  +\fB\-\|\-\fR
           85  +.
           86  +Marks the end of switches.  The argument following this one will
           87  +be treated as the first \fIarg\fR even if it starts with a \fB\-\fR.
           88  +.RE
           89  +.SH "EXAMPLES"
           90  +.PP
           91  +These show the use of \fB::tcl::process\fR. Some of the results from
           92  +\fB::tcl::process status\fR are split over multiple lines for readability.
           93  +.PP
           94  +.CS
           95  +\fB::tcl::process autopurge\fR
           96  +     \fI\(-> true\fR
           97  +\fB::tcl::process autopurge\fR false
           98  +     \fI\(-> false\fR
           99  +
          100  +set pid1 [exec command1 a b c | command2 d e f &]
          101  +     \fI\(-> 123 456\fR
          102  +set chan [open "|command1 a b c | command2 d e f"]
          103  +     \fI\(-> file123\fR
          104  +set pid2 [pid $chan]
          105  +     \fI\(-> 789 1011\fR
          106  +
          107  +\fB::tcl::process list\fR
          108  +     \fI\(-> 123 456 789 1011\fR
          109  +
          110  +\fB::tcl::process status\fR
          111  +     \fI\(-> 123 0
          112  +       456 {1 "child killed: write on pipe with no readers" {
          113  +         CHILDKILLED 456 SIGPIPE "write on pipe with no readers"}}
          114  +       789 {1 "child suspended: background tty read" {
          115  +         CHILDSUSP 789 SIGTTIN "background tty read"}}
          116  +       1011 {}\fR
          117  +
          118  +\fB::tcl::process status\fR 123
          119  +     \fI\(-> 123 0\fR
          120  +
          121  +\fB::tcl::process status\fR 1011
          122  +     \fI\(-> 1011 {}\fR
          123  +
          124  +\fB::tcl::process status\fR -wait
          125  +     \fI\(-> 123 0
          126  +       456 {1 "child killed: write on pipe with no readers" {
          127  +         CHILDKILLED 456 SIGPIPE "write on pipe with no readers"}}
          128  +       789 {1 "child suspended: background tty read" {
          129  +         CHILDSUSP 789 SIGTTIN "background tty read"}}
          130  +       1011 {1 "child process exited abnormally" {
          131  +         CHILDSTATUS 1011 -1}}\fR
          132  +
          133  +\fB::tcl::process status\fR 1011
          134  +     \fI\(-> 1011 {1 "child process exited abnormally" {
          135  +         CHILDSTATUS 1011 -1}}\fR
          136  +
          137  +\fB::tcl::process purge\fR
          138  +exec command1 1 2 3 &
          139  +     \fI\(-> 1213\fR
          140  +\fB::tcl::process list\fR
          141  +     \fI\(-> 1213\fR
          142  +.CE
          143  +.SH "SEE ALSO"
          144  +exec(n), open(n), pid(n),
          145  +Tcl_DetachPids(3), Tcl_WaitPid(3), Tcl_ReapDetachedProcs(3)
          146  +.SH "KEYWORDS"
          147  +background, child, detach, process, wait
          148  +'\" Local Variables:
          149  +'\" mode: nroff
          150  +'\" End:

Changes to doc/puts.n.

    92     92   \fBputs\fR $chan "$timestamp - Hello, World!"
    93     93   close $chan
    94     94   .CE
    95     95   .SH "SEE ALSO"
    96     96   file(n), fileevent(n), Tcl_StandardChannels(3)
    97     97   .SH KEYWORDS
    98     98   channel, newline, output, write
           99  +'\" Local Variables:
          100  +'\" mode: nroff
          101  +'\" fill-column: 78
          102  +'\" End:

Changes to doc/pwd.n.

    33     33   exec tar -xf $tarFile
    34     34   cd $savedDir
    35     35   .CE
    36     36   .SH "SEE ALSO"
    37     37   file(n), cd(n), glob(n), filename(n)
    38     38   .SH KEYWORDS
    39     39   working directory
           40  +'\" Local Variables:
           41  +'\" mode: nroff
           42  +'\" fill-column: 78
           43  +'\" End:

Changes to doc/rename.n.

    39     39       uplevel 1 ::theRealSource $args
    40     40   }
    41     41   .CE
    42     42   .SH "SEE ALSO"
    43     43   namespace(n), proc(n)
    44     44   .SH KEYWORDS
    45     45   command, delete, namespace, rename
           46  +'\" Local Variables:
           47  +'\" mode: nroff
           48  +'\" fill-column: 78
           49  +'\" End:

Changes to doc/scan.n.

   220    220   hexadecimal conversions with substring sizes:
   221    221   .PP
   222    222   .CS
   223    223   set string "#08D03F"
   224    224   \fBscan\fR $string "#%2x%2x%2x" r g b
   225    225   .CE
   226    226   .PP
   227         -Parse a \fIHH:MM\fR time string:
          227  +Parse a \fIHH:MM\fR time string, noting that this avoids problems with
          228  +octal numbers by forcing interpretation as decimals (if we did not
          229  +care, we would use the \fB%i\fR conversion instead):
   228    230   .PP
   229    231   .CS
   230         -set string "08:08"
          232  +set string "08:08"   ;# *Not* octal!
   231    233   if {[\fBscan\fR $string "%d:%d" hours minutes] != 2} {
   232    234       error "not a valid time string"
   233    235   }
   234    236   # We have to understand numeric ranges ourselves...
   235    237   if {$minutes < 0 || $minutes > 59} {
   236    238       error "invalid number of minutes"
   237    239   }

Changes to doc/self.n.

    28     28   \fBself call\fR
    29     29   .
    30     30   This returns a two-element list describing the method implementations used to
    31     31   implement the current call chain. The first element is the same as would be
    32     32   reported by \fBinfo object\fR \fBcall\fR for the current method (except that this
    33     33   also reports useful values from within constructors and destructors, whose
    34     34   names are reported as \fB<constructor>\fR and \fB<destructor>\fR
    35         -respectively), and the second element is an index into the first element's
           35  +respectively,
           36  +.VS TIP500
           37  +and for private methods, which are described as being \fBprivate\fR instead of
           38  +being a \fBmethod\fR),
           39  +.VE TIP500
           40  +and the second element is an index into the first element's
    36     41   list that indicates which actual implementation is currently executing (the
    37     42   first implementation to execute is always at index 0).
    38     43   .TP
    39     44   \fBself caller\fR
    40     45   .
    41     46   When the method was invoked from inside another object method, this subcommand
    42     47   returns a three element list describing the containing object and method. The

Changes to doc/set.n.

    69     69   \fBset\fR vbl in[expr {rand() >= 0.5}]
    70     70   \fBset\fR out [\fBset\fR $vbl]
    71     71   .CE
    72     72   .SH "SEE ALSO"
    73     73   expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n)
    74     74   .SH KEYWORDS
    75     75   read, write, variable
           76  +'\" Local Variables:
           77  +'\" mode: nroff
           78  +'\" fill-column: 78
           79  +'\" End:

Added doc/singleton.n.

            1  +'\"
            2  +'\" Copyright (c) 2018 Donal K. Fellows
            3  +'\"
            4  +'\" See the file "license.terms" for information on usage and redistribution
            5  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            6  +'\"
            7  +.TH singleton n 0.3 TclOO "TclOO Commands"
            8  +.so man.macros
            9  +.BS
           10  +'\" Note:  do not modify the .SH NAME line immediately below!
           11  +.SH NAME
           12  +oo::singleton \- a class that does only allows one instance of itself
           13  +.SH SYNOPSIS
           14  +.nf
           15  +package require TclOO
           16  +
           17  +\fBoo::singleton\fI method \fR?\fIarg ...\fR?
           18  +.fi
           19  +.SH "CLASS HIERARCHY"
           20  +.nf
           21  +\fBoo::object\fR
           22  +   \(-> \fBoo::class\fR
           23  +       \(-> \fBoo::singleton\fR
           24  +.fi
           25  +.BE
           26  +.SH DESCRIPTION
           27  +Singleton classes are classes that only permit at most one instance of
           28  +themselves to exist. They unexport the \fBcreate\fR and
           29  +\fBcreateWithNamespace\fR methods entirely, and override the \fBnew\fR method
           30  +so that it only makes a new instance if there is no existing instance.  It is
           31  +not recommended to inherit from a singleton class; singleton-ness is \fInot\fR
           32  +inherited. It is not recommended that a singleton class's constructor take any
           33  +arguments.
           34  +.PP
           35  +Instances have their\fB destroy\fR method overridden with a method that always
           36  +returns an error in order to discourage destruction of the object, but
           37  +destruction remains possible if strictly necessary (e.g., by destroying the
           38  +class or using \fBrename\fR to delete it). They also have a (non-exported)
           39  +\fB<cloned>\fR method defined on them that similarly always returns errors to
           40  +make attempts to use the singleton instance with \fBoo::copy\fR fail.
           41  +.SS CONSTRUCTOR
           42  +The \fBoo::singleton\fR class does not define an explicit constructor; this
           43  +means that it is effectively the same as the constructor of the
           44  +\fBoo::class\fR class.
           45  +.SS DESTRUCTOR
           46  +The \fBoo::singleton\fR class does not define an explicit destructor;
           47  +destroying an instance of it is just like destroying an ordinary class (and
           48  +will destroy the singleton object).
           49  +.SS "EXPORTED METHODS"
           50  +.TP
           51  +\fIcls \fBnew \fR?\fIarg ...\fR?
           52  +.
           53  +This returns the current instance of the singleton class, if one exists, and
           54  +creates a new instance only if there is no existing instance. The additional
           55  +arguments, \fIarg ...\fR, are only used if a new instance is actually
           56  +manufactured; that construction is via the \fBoo::class\fR class's \fBnew\fR
           57  +method.
           58  +.RS
           59  +.PP
           60  +This is an override of the behaviour of a superclass's method with an
           61  +identical call signature to the superclass's implementation.
           62  +.RE
           63  +.SS "NON-EXPORTED METHODS"
           64  +The \fBoo::singleton\fR class explicitly states that \fBcreate\fR and
           65  +\fBcreateWithNamespace\fR are unexported; callers should not assume that they
           66  +have control over either the name or the namespace name of the singleton instance.
           67  +.SH EXAMPLE
           68  +.PP
           69  +This example demonstrates that there is only one instance even though the
           70  +\fBnew\fR method is called three times.
           71  +.PP
           72  +.CS
           73  +\fBoo::singleton\fR create Highlander {
           74  +    method say {} {
           75  +        puts "there can be only one"
           76  +    }
           77  +}
           78  +
           79  +set h1 [Highlander new]
           80  +set h2 [Highlander new]
           81  +if {$h1 eq $h2} {
           82  +    puts "equal objects"    \fI\(-> prints "equal objects"\fR
           83  +}
           84  +set h3 [Highlander new]
           85  +if {$h1 eq $h3} {
           86  +    puts "equal objects"    \fI\(-> prints "equal objects"\fR
           87  +}
           88  +.CE
           89  +.PP
           90  +Note that the name of the instance of the singleton is not guaranteed to be
           91  +anything in particular.
           92  +.SH "SEE ALSO"
           93  +oo::class(n)
           94  +.SH KEYWORDS
           95  +class, metaclass, object, single instance
           96  +.\" Local variables:
           97  +.\" mode: nroff
           98  +.\" fill-column: 78
           99  +.\" End:

Changes to doc/source.n.

    65     65       \fBsource\fR $scriptFile
    66     66   }
    67     67   .CE
    68     68   .SH "SEE ALSO"
    69     69   file(n), cd(n), encoding(n), info(n)
    70     70   .SH KEYWORDS
    71     71   file, script
           72  +'\" Local Variables:
           73  +'\" mode: nroff
           74  +'\" fill-column: 78
           75  +'\" End:

Changes to doc/string.n.

     8      8   .TH string n 8.1 Tcl "Tcl Built-In Commands"
     9      9   .so man.macros
    10     10   .BS
    11     11   .\" Note:  do not modify the .SH NAME line immediately below!
    12     12   .SH NAME
    13     13   string \- Manipulate strings
    14     14   .SH SYNOPSIS
    15         -\fBstring \fIoption arg \fR?\fIarg ...?\fR
           15  +\fBstring \fIoption arg \fR?\fIarg ...\fR?
    16     16   .BE
    17     17   .SH DESCRIPTION
    18     18   .PP
    19     19   Performs one of several string operations, depending on \fIoption\fR.
    20     20   The legal \fIoption\fRs (which may be abbreviated) are:
    21     21   .TP
    22     22   \fBstring cat\fR ?\fIstring1\fR? ?\fIstring2...\fR?
................................................................................
   111    111   Any of the forms allowed to \fBTcl_GetBoolean\fR.
   112    112   .IP \fBcontrol\fR 12
   113    113   Any Unicode control character.
   114    114   .IP \fBdigit\fR 12
   115    115   Any Unicode digit character.  Note that this includes characters
   116    116   outside of the [0\-9] range.
   117    117   .IP \fBdouble\fR 12
   118         -Any of the valid forms for a double in Tcl, with optional surrounding
   119         -whitespace.  In case of under/overflow in the value, 0 is returned and
   120         -the \fIvarname\fR will contain \-1.
          118  +Any of the forms allowed to \fBTcl_GetDoubleFromObj\fR.
   121    119   .IP \fBentier\fR 12
   122    120   .VS 8.6
   123    121   Any of the valid string formats for an integer value of arbitrary size
   124    122   in Tcl, with optional surrounding whitespace. The formats accepted are
   125    123   exactly those accepted by the C routine \fBTcl_GetBignumFromObj\fR.
   126    124   .VE
   127    125   .IP \fBfalse\fR 12
   128    126   Any of the forms allowed to \fBTcl_GetBoolean\fR where the value is
   129    127   false.
   130    128   .IP \fBgraph\fR 12
   131    129   Any Unicode printing character, except space.
   132    130   .IP \fBinteger\fR 12
   133    131   Any of the valid string formats for a 32-bit integer value in Tcl,
   134         -with optional surrounding whitespace.  In case of under/overflow in
          132  +with optional surrounding whitespace.  In case of overflow in
   135    133   the value, 0 is returned and the \fIvarname\fR will contain \-1.
   136    134   .IP \fBlist\fR 12
   137    135   Any proper list structure, with optional surrounding whitespace. In
   138    136   case of improper list structure, 0 is returned and the \fIvarname\fR
   139    137   will contain the index of the
   140    138   .QW element
   141    139   where the list parsing fails, or \-1 if this cannot be determined.
................................................................................
   152    150   .IP \fBtrue\fR 12
   153    151   Any of the forms allowed to \fBTcl_GetBoolean\fR where the value is
   154    152   true.
   155    153   .IP \fBupper\fR 12
   156    154   Any upper case alphabet character in the Unicode character set.
   157    155   .IP \fBwideinteger\fR 12
   158    156   Any of the valid forms for a wide integer in Tcl, with optional
   159         -surrounding whitespace.  In case of under/overflow in the value, 0 is
          157  +surrounding whitespace.  In case of overflow in the value, 0 is
   160    158   returned and the \fIvarname\fR will contain \-1.
   161    159   .IP \fBwordchar\fR 12
   162    160   Any Unicode word character.  That is any alphanumeric character, and
   163    161   any Unicode connector punctuation characters (e.g. underscore).
   164    162   .IP \fBxdigit\fR 12
   165    163   Any hexadecimal digit character ([0\-9A\-Fa\-f]).
   166    164   .PP

Changes to doc/tclsh.1.

   139    139   The variable \fBtcl_prompt2\fR is used in a similar way when
   140    140   a newline is typed but the current command is not yet complete;
   141    141   if \fBtcl_prompt2\fR is not set then no prompt is output for
   142    142   incomplete commands.
   143    143   .SH "STANDARD CHANNELS"
   144    144   .PP
   145    145   See \fBTcl_StandardChannels\fR for more explanations.
          146  +.SH ZIPVFS
          147  +.PP
          148  +When a zipfile is concatenated to the end of a \fBtclsh\fR, on
          149  +startup the contents of the zip archive will be mounted as the
          150  +virtual file system /zvfs. If a top level directory tcl8.6 is
          151  +present in the zip archive, it will become the directory loaded
          152  +as env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present
          153  +in the top level directory of the zip archive, it will be sourced
          154  +instead of the shell's normal command line handing.
   146    155   .SH "SEE ALSO"
   147    156   auto_path(n), encoding(n), env(n), fconfigure(n)
   148    157   .SH KEYWORDS
   149    158   application, argument, interpreter, prompt, script file, shell

Changes to doc/tcltest.n.

     4      4   '\" Copyright (c) 1998-1999 Scriptics Corporation
     5      5   '\" Copyright (c) 2000 Ajuba Solutions
     6      6   '\" Contributions from Don Porter, NIST, 2002. (not subject to US copyright)
     7      7   '\"
     8      8   '\" See the file "license.terms" for information on usage and redistribution
     9      9   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    10     10   '\"
    11         -.TH "tcltest" n 2.3 tcltest "Tcl Bundled Packages"
           11  +.TH "tcltest" n 2.5 tcltest "Tcl Bundled Packages"
    12     12   .so man.macros
    13     13   .BS
    14     14   '\" Note:  do not modify the .SH NAME line immediately below!
    15     15   .SH NAME
    16     16   tcltest \- Test harness support code and utilities
    17     17   .SH SYNOPSIS
    18     18   .nf
    19         -\fBpackage require tcltest\fR ?\fB2.3\fR?
           19  +\fBpackage require tcltest\fR ?\fB2.5\fR?
    20     20   
    21     21   \fBtcltest::test \fIname description\fR ?\fI\-option value ...\fR?
    22     22   \fBtcltest::test \fIname description\fR ?\fIconstraints\fR? \fIbody result\fR
    23     23   
    24     24   \fBtcltest::loadTestedCommands\fR
    25     25   \fBtcltest::makeDirectory \fIname\fR ?\fIdirectory\fR?
    26     26   \fBtcltest::removeDirectory \fIname\fR ?\fIdirectory\fR?
................................................................................
   450    450           ?\fB\-setup \fIsetupScript\fR?
   451    451           ?\fB\-body \fItestScript\fR?
   452    452           ?\fB\-cleanup \fIcleanupScript\fR?
   453    453           ?\fB\-result \fIexpectedAnswer\fR?
   454    454           ?\fB\-output \fIexpectedOutput\fR?
   455    455           ?\fB\-errorOutput \fIexpectedError\fR?
   456    456           ?\fB\-returnCodes \fIcodeList\fR?
          457  +        ?\fB\-errorCode \fIexpectedErrorCode\fR?
   457    458           ?\fB\-match \fImode\fR?
   458    459   .CE
   459    460   .PP
   460    461   The \fIname\fR may be any string.  It is conventional to choose
   461    462   a \fIname\fR according to the pattern:
   462    463   .PP
   463    464   .CS
................................................................................
   573    574   a list of return codes that may be accepted from evaluation of the
   574    575   \fB\-body\fR script.  If evaluation of the \fB\-body\fR script returns
   575    576   a code not in the \fIexpectedCodeList\fR, the test fails.  All
   576    577   return codes known to \fBreturn\fR, in both numeric and symbolic
   577    578   form, including extended return codes, are acceptable elements in
   578    579   the \fIexpectedCodeList\fR.  Default value is
   579    580   .QW "\fBok return\fR" .
          581  +.TP
          582  +\fB\-errorCode \fIexpectedErrorCode\fR
          583  +.
          584  +The optional \fB\-errorCode\fR attribute supplies \fIexpectedErrorCode\fR,
          585  +a glob pattern that should match the error code reported from evaluation of the
          586  +\fB\-body\fR script.  If evaluation of the \fB\-body\fR script returns
          587  +a code not matching \fIexpectedErrorCode\fR, the test fails.  Default value is
          588  +.QW "\fB*\fR" .
          589  +If \fB\-returnCodes\fR does not include \fBerror\fR it is set to \fBerror\fR.
   580    590   .PP
   581    591   To pass, a test must successfully evaluate its \fB\-setup\fR, \fB\-body\fR,
   582    592   and \fB\-cleanup\fR scripts.  The return code of the \fB\-body\fR script and
   583    593   its result must match expected values, and if specified, output and error
   584    594   data from the test must match expected \fB\-output\fR and \fB\-errorOutput\fR
   585    595   values.  If any of these conditions are not met, then the test fails.
   586    596   Note that all scripts are evaluated in the context of the caller

Changes to doc/tell.n.

    42     42       seek $chan $offset
    43     43   }
    44     44   .CE
    45     45   .SH "SEE ALSO"
    46     46   file(n), open(n), close(n), gets(n), seek(n), Tcl_StandardChannels(3)
    47     47   .SH KEYWORDS
    48     48   access position, channel, seeking
           49  +'\" Local Variables:
           50  +'\" mode: nroff
           51  +'\" fill-column: 78
           52  +'\" End:

Changes to doc/trace.n.

    16     16   \fBtrace \fIoption\fR ?\fIarg arg ...\fR?
    17     17   .BE
    18     18   .SH DESCRIPTION
    19     19   .PP
    20     20   This command causes Tcl commands to be executed whenever certain operations are
    21     21   invoked.  The legal \fIoption\fRs (which may be abbreviated) are:
    22     22   .TP
    23         -\fBtrace add \fItype name ops ?args?\fR
           23  +\fBtrace add \fItype name ops\fR ?\fIargs\fR?
           24  +.
    24     25   Where \fItype\fR is \fBcommand\fR, \fBexecution\fR, or \fBvariable\fR.
    25     26   .RS
    26     27   .TP
    27     28   \fBtrace add command\fR \fIname ops commandPrefix\fR
    28     29   .
    29     30   Arrange for \fIcommandPrefix\fR to be executed (with additional arguments)
    30     31   whenever command \fIname\fR is modified in one of the ways given by the list

Changes to doc/unknown.n.

    85     85       uplevel 1 [list _original_unknown {*}$args]
    86     86   }
    87     87   .CE
    88     88   .SH "SEE ALSO"
    89     89   info(n), proc(n), interp(n), library(n), namespace(n)
    90     90   .SH KEYWORDS
    91     91   error, non-existent command, unknown
           92  +'\" Local Variables:
           93  +'\" mode: nroff
           94  +'\" fill-column: 78
           95  +'\" End:

Changes to doc/update.n.

    59     59       \fBupdate\fR
    60     60   }
    61     61   .CE
    62     62   .SH "SEE ALSO"
    63     63   after(n), interp(n)
    64     64   .SH KEYWORDS
    65     65   asynchronous I/O, event, flush, handler, idle, update
           66  +'\" Local Variables:
           67  +'\" mode: nroff
           68  +'\" fill-column: 78
           69  +'\" End:

Changes to doc/uplevel.n.

    20     20   been passed to \fBconcat\fR; the result is then evaluated in the
    21     21   variable context indicated by \fIlevel\fR.  \fBUplevel\fR returns
    22     22   the result of that evaluation.
    23     23   .PP
    24     24   If \fIlevel\fR is an integer then
    25     25   it gives a distance (up the procedure calling stack) to move before
    26     26   executing the command.  If \fIlevel\fR consists of \fB#\fR followed by
    27         -a number then the number gives an absolute level number.  If \fIlevel\fR
           27  +a integer then the level gives an absolute level.  If \fIlevel\fR
    28     28   is omitted then it defaults to \fB1\fR.  \fILevel\fR cannot be
    29         -defaulted if the first \fIcommand\fR argument starts with a digit or \fB#\fR.
           29  +defaulted if the first \fIcommand\fR argument is an integer or starts with \fB#\fR.
    30     30   .PP
    31     31   For example, suppose that procedure \fBa\fR was invoked
    32     32   from top-level, and that it called \fBb\fR, and that \fBb\fR called \fBc\fR.
    33     33   Suppose that \fBc\fR invokes the \fBuplevel\fR command.  If \fIlevel\fR
    34     34   is \fB1\fR or \fB#2\fR  or omitted, then the command will be executed
    35     35   in the variable context of \fBb\fR.  If \fIlevel\fR is \fB2\fR or \fB#1\fR
    36     36   then the command will be executed in the variable context of \fBa\fR.

Changes to doc/while.n.

    59     59       puts "[incr lineCount]: $line"
    60     60   }
    61     61   .CE
    62     62   .SH "SEE ALSO"
    63     63   break(n), continue(n), for(n), foreach(n)
    64     64   .SH KEYWORDS
    65     65   boolean, loop, test, while
           66  +'\" Local Variables:
           67  +'\" mode: nroff
           68  +'\" fill-column: 78
           69  +'\" End:

Added doc/zipfs.3.

            1  +'\"
            2  +'\" Copyright (c) 2015 Jan Nijtmans <[email protected]>
            3  +'\" Copyright (c) 2015 Christian Werner <[email protected]>
            4  +'\" Copyright (c) 2017 Sean Woods <[email protected]>
            5  +'\"
            6  +'\" See the file "license.terms" for information on usage and redistribution
            7  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            8  +'\"
            9  +.TH Tclzipfs 3 8.7 Tcl "Tcl Library Procedures"
           10  +.so man.macros
           11  +.BS
           12  +.SH NAME
           13  +TclZipfs_AppHook, Tclzipfs_Mount, TclZipfs_MountBuffer, Tclzipfs_Unmount \- handle ZIP files as Tcl virtual filesystems
           14  +.SH SYNOPSIS
           15  +.nf
           16  +int
           17  +\fBTclZipfs_AppHook(\fIargcPtr, argvPtr\fR)
           18  +.sp
           19  +int
           20  +\fBTclzipfs_Mount\fR(\fIinterp, mountpoint, zipname, password\fR)
           21  +.sp
           22  +int
           23  +\fBTclZipfs_MountBuffer\fR(\fIinterp, mountpoint, data, dataLen, copy\fR)
           24  +.sp
           25  +int
           26  +\fBTclzipfs_Unmount\fR(\fIinterp, mountpoint\fR)
           27  +.fi
           28  +.SH ARGUMENTS
           29  +.AS Tcl_Interp *mountpoint in
           30  +.AP "int" *argcPtr in
           31  +Pointer to a variable holding the number of command line arguments from
           32  +\fBmain\fR().
           33  +.AP "char" ***argvPtr in
           34  +Pointer to an array of strings containing the command line arguments to
           35  +\fBmain\fR().
           36  +.AP Tcl_Interp *interp in
           37  +Interpreter in which the ZIP file system is mounted.  The interpreter's result is
           38  +modified to hold the result or error message from the script.
           39  +.AP "const char" *zipname in
           40  +Name of a ZIP file. Must not be NULL when either mounting or unmounting a ZIP.
           41  +.AP "const char" *mountpoint in
           42  +Name of a mount point, which must be a legal Tcl file or directory name. May
           43  +be NULL to query current mount points.
           44  +.AP "const char" *password in
           45  +An (optional) password. Use NULL if no password is wanted to read the file.
           46  +.AP "unsigned char" *data in
           47  +A data buffer to mount. The data buffer must hold the contents of a ZIP
           48  +archive, and must not be NULL.
           49  +.AP size_t dataLen in
           50  +The number of bytes in the supplied data buffer argument, \fIdata\fR.
           51  +.AP int copy in
           52  +If non-zero, the ZIP archive in the data buffer will be internally copied
           53  +before mounting, allowing the data buffer to be disposed once
           54  +\fBTclZipfs_MountBuffer\fR returns. If zero, the caller guarantees that the
           55  +buffer will be valid to read from for the duration of the mount.
           56  +.BE
           57  +.SH DESCRIPTION
           58  +\fBTclZipfs_AppHook\fR is a utility function to perform standard application
           59  +initialization procedures, taking into account available ZIP archives as
           60  +follows:
           61  +.IP [1]
           62  +If the current application has a mountable ZIP archive, that archive is
           63  +mounted under \fIZIPFS_VOLUME\fB/app\fR as a read-only Tcl virtual file
           64  +system. \fIZIPFS_VOLUME\fR is usually \fB//zipfs:\fR on all platforms, but
           65  +\fBzipfs:\fR may also be used on Windows (due to differences in the
           66  +platform's filename parsing).
           67  +.IP [2]
           68  +If a file named \fBmain.tcl\fR is located in the root directory of that file
           69  +system (i.e., at \fIZIPROOT\fB/app/main.tcl\fR after the ZIP archive is
           70  +mounted as described above) it is treated as the startup script for the
           71  +process.
           72  +.IP [3]
           73  +If the file \fIZIPROOT\fB/app/tcl_library/init.tcl\fR is present, the
           74  +\fBtcl_library\fR global variable in the initial Tcl interpreter is set to
           75  +\fIZIPROOT\fB/app/tcl_library\fR.
           76  +.IP [4]
           77  +If the directory \fBtcl_library\fR was not found in the main application
           78  +mount, the system will then search for it as either a VFS attached to the
           79  +application dynamic library, or as a zip archive named
           80  +\fBlibtcl_\fImajor\fB_\fIminor\fB_\fIpatchlevel\fB.zip\fR either in the
           81  +present working directory or in the standard Tcl install location. (For
           82  +example, the Tcl 8.7.2 release would be searched for in a file
           83  +\fBlibtcl_8_7_2.zip\fR.) That archive, if located, is also mounted read-only.
           84  +.PP
           85  +On Windows, \fBTclZipfs_AppHook\fR has a slightly different signature, since
           86  +it uses WCHAR in stead of char. As a result, it requires your application to
           87  +be compiled with the UNICODE preprocessor symbol defined (e.g., via the
           88  +\fB-DUNICODE\fR compiler flag).
           89  +.PP
           90  +The result of \fBTclZipfs_AppHook\fR is a Tcl result code (e.g., \fBTCL_OK\fR
           91  +when the function is successful). The function \fImay\fR modify the variables
           92  +pointed to by \fIargcPtr\fR and \fIargvPtr\fR to remove arguments; the
           93  +current implementation does not do so, but callers \fIshould not\fR assume
           94  +that this will be true in the future.
           95  +.PP
           96  +\fBTclzipfs_Mount\fR mounts the ZIP archive \fIzipname\fR on the mount point
           97  +given in \fImountpoint\fR using the optional ZIP password \fIpassword\fR.
           98  +Errors during that process are reported in the interpreter \fIinterp\fR.  If
           99  +\fImountpoint\fR is a NULL pointer, information on all currently mounted ZIP
          100  +file systems is written into \fIinterp\fR's result as a sequence of mount
          101  +points and ZIP file names.  The result of this call is a standard Tcl result
          102  +code.
          103  +.PP
          104  +\fBTclzipfs_MountBuffer\fR mounts the ZIP archive in the buffer pointed to by
          105  +\fIdata\fR on the mount point given in \fImountpoint\fR. The ZIP archive is
          106  +assumed to be not password protected.  Errors during that process are reported
          107  +in the interpreter \fIinterp\fR. The \fIcopy\fR argument determines whether
          108  +the buffer is internally copied before mounting or not. The result of this
          109  +call is a standard Tcl result code.
          110  +.PP
          111  +\fBTclzipfs_Unmount\fR undoes the effect of \fBTclzipfs_Mount\fR, i.e., it
          112  +unmounts the mounted ZIP file system that was mounted from \fIzipname\fR (at
          113  +\fImountpoint\fR). Errors are reported in the interpreter \fIinterp\fR.  The
          114  +result of this call is a standard Tcl result code.
          115  +.SH "SEE ALSO"
          116  +zipfs(n)
          117  +.SH KEYWORDS
          118  +compress, filesystem, zip

Added doc/zipfs.n.

            1  +'\"
            2  +'\" Copyright (c) 2015 Jan Nijtmans <[email protected]>
            3  +'\" Copyright (c) 2015 Christian Werner <[email protected]>
            4  +'\" Copyright (c) 2015 Sean Woods <[email protected]>
            5  +'\"
            6  +'\" See the file "license.terms" for information on usage and redistribution
            7  +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
            8  +'\"
            9  +.TH zipfs n 1.0 Zipfs "zipfs Commands"
           10  +.so man.macros
           11  +.BS
           12  +'\" Note:  do not modify the .SH NAME line immediately below!
           13  +.SH NAME
           14  +zipfs \- Mount and work with ZIP files within Tcl
           15  +.SH SYNOPSIS
           16  +.nf
           17  +\fBpackage require zipfs \fR?\fB1.0\fR?
           18  +.sp
           19  +\fBzipfs canonical\fR ?\fImntpnt\fR? \fIfilename\fR ?\fIZIPFS\fR?
           20  +\fBzipfs exists\fR \fIfilename\fR
           21  +\fBzipfs find\fR \fIdirectoryName\fR
           22  +\fBzipfs info\fR \fIfilename\fR
           23  +\fBzipfs list\fR ?(\fB\-glob\fR|\fB\-regexp\fR)? ?\fIpattern\fR?
           24  +\fBzipfs lmkimg\fR \fIoutfile inlist\fR ?\fIpassword infile\fR?
           25  +\fBzipfs lmkzip\fR \fIoutfile inlist\fR ?\fIpassword\fR?
           26  +\fBzipfs mkimg\fR \fIoutfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR? ?\fIinfile\fR?
           27  +\fBzipfs mkkey\fR \fIpassword\fR
           28  +\fBzipfs mkzip\fR \fIoutfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR?
           29  +\fBzipfs mount\fR ?\fImountpoint\fR? ?\fIzipfile\fR? ?\fIpassword\fR?
           30  +\fBzipfs root\fR
           31  +\fBzipfs unmount\fR \fImountpoint\fR
           32  +.fi
           33  +'\" The following subcommand is *UNDOCUMENTED*
           34  +'\" \fBzipfs mount_data\fR ?\fImountpoint\fR? ?\fIdata\fR?
           35  +.BE
           36  +.SH DESCRIPTION
           37  +.PP
           38  +The \fBzipfs\fR command (the sole public command provided by the built-in
           39  +package with the same name) provides Tcl with the ability to mount the
           40  +contents of a ZIP archive file as a virtual file system. ZIP archives support
           41  +simple encryption, sufficient to prevent casual inspection of their contents
           42  +but not able to prevent access by even a moderately determined attacker.
           43  +.TP
           44  +\fBzipfs canonical\fR ?\fImountpoint\fR? \fIfilename\fR ?\fIinZipfs\fR?
           45  +.
           46  +This takes the name of a file, \fIfilename\fR, and produces where it would be
           47  +mapped into a zipfs mount as its result. If specified, \fImountpoint\fR says
           48  +within which mount the mapping will be done; if omitted, the main root of the
           49  +zipfs system is used. The \fIinZipfs\fR argument is a an optional boolean
           50  +which controls whether to fully canonicalise the name; it defaults to true.
           51  +.TP
           52  +\fBzipfs exists\fR \fIfilename\fR
           53  +.
           54  +Return 1 if the given filename exists in the mounted zipfs and 0 if it does not.
           55  +.TP
           56  +\fBzipfs find\fR \fIdirectoryName\fR
           57  +.
           58  +Recursively lists files including and below the directory \fIdirectoryName\fR.
           59  +The result list consists of relative path names starting from the given
           60  +directory. This command is also used by the \fBzipfs mkzip\fR and \fBzipfs
           61  +mkimg\fR commands.
           62  +.TP
           63  +\fBzipfs info\fR \fIfile\fR
           64  +.
           65  +Return information about the given \fIfile\fR in the mounted zipfs.  The
           66  +information consists of:
           67  +.RS
           68  +.IP (1)
           69  +the name of the ZIP archive file that contains the file,
           70  +.IP (2)
           71  +the size of the file after decompressions,
           72  +.IP (3)
           73  +the compressed size of the file, and
           74  +.IP (4)
           75  +the offset of the compressed data in the ZIP archive file.
           76  +.PP
           77  +Note: querying the mount point gives the start of the zip data as the offset
           78  +in (4), which can be used to truncate the zip information from an executable.
           79  +.RE
           80  +.TP
           81  +\fBzipfs list\fR ?(\fB\-glob\fR|\fB\-regexp\fR)? ?\fIpattern\fR?
           82  +.
           83  +Return a list of all files in the mounted zipfs, or just those matching
           84  +\fIpattern\fR (optionally controlled by the option parameters).  The order of
           85  +the names in the list is arbitrary.
           86  +.TP
           87  +\fBzipfs mount ?\fImountpoint\fR? ?\fIzipfile\fR? ?\fIpassword\fR?
           88  +.
           89  +The \fBzipfs mount\fR command mounts a ZIP archive file as a Tcl virtual
           90  +filesystem at \fImountpoint\fR.  After this command executes, files contained
           91  +in \fIzipfile\fR will appear to Tcl to be regular files at the mount point.
           92  +.RS
           93  +.PP
           94  +With no \fIzipfile\fR, returns the zipfile mounted at \fImountpoint\fR.  With
           95  +no \fImountpoint\fR, return all zipfile/mount pairs.  If \fImountpoint\fR is
           96  +specified as an empty string, mount on file path.
           97  +.PP
           98  +\fBNB:\fR because the current working directory is a concept maintained by the
           99  +operating system, using \fBcd\fR into a mounted archive will only work in the
          100  +current process, and then not entirely consistently (e.g., if a shared library
          101  +uses direct access to the OS rather than through Tcl's filesystem API, it will
          102  +not see the current directory as being inside the mount and will not be able
          103  +to access the files inside the mount).
          104  +.RE
          105  +.TP
          106  +\fBzipfs root\fR
          107  +.
          108  +Returns a constant string which indicates the mount point for zipfs volumes
          109  +for the current platform. On Windows, this value is
          110  +.QW \fBzipfs:/\fR .
          111  +On Unix, this value is
          112  +.QW \fB//zipfs:/\fR .
          113  +.RE
          114  +.TP
          115  +\fBzipfs unmount \fImountpoint\fR
          116  +.
          117  +Unmounts a previously mounted ZIP archive mounted to \fImountpoint\fR.
          118  +.SS "ZIP CREATION COMMANDS"
          119  +This package also provides several commands to aid the creation of ZIP
          120  +archives as Tcl applications.
          121  +.TP
          122  +\fBzipfs mkzip\fR \fIoutfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR?
          123  +.
          124  +Creates a ZIP archive file named \fIoutfile\fR from the contents of the input
          125  +directory \fIindir\fR (contained regular files only) with optional ZIP
          126  +password \fIpassword\fR. While processing the files below \fIindir\fR the
          127  +optional file name prefix given in \fIstrip\fR is stripped off the beginning
          128  +of the respective file name.  When stripping, it is common to remove either
          129  +the whole source directory name or the name of its parent directory.
          130  +.RS
          131  +.PP
          132  +\fBCaution:\fR the choice of the \fIindir\fR parameter (less the optional
          133  +stripped prefix) determines the later root name of the archive's content.
          134  +.RE
          135  +.TP
          136  +\fBzipfs mkimg\fR \fIoutfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR? ?\fIinfile\fR?
          137  +.
          138  +Creates an image (potentially a new executable file) similar to \fBzipfs
          139  +mkzip\fR; see that command for a description of most parameters to this
          140  +command, as they behave identically here.
          141  +.RS
          142  +.PP
          143  +If the \fIinfile\fR parameter is specified, this file is prepended in front of
          144  +the ZIP archive, otherwise the file returned by \fBinfo nameofexecutable\fR
          145  +(i.e., the executable file of the running process) is used. If the
          146  +\fIpassword\fR parameter is not empty, an obfuscated version of that password
          147  +(see \fBzipfs mkkey\fR) is placed between the image and ZIP chunks of the
          148  +output file and the contents of the ZIP chunk are protected with that
          149  +password.
          150  +.PP
          151  +If there is a file, \fBmain.tcl\fR, in the root directory of the resulting
          152  +archive and the image file that the archive is attached to is a \fBtclsh\fR
          153  +(or \fBwish\fR) instance (true by default, but depends on your configuration),
          154  +then the resulting image is an executable that will \fBsource\fR the script in
          155  +that \fBmain.tcl\fR after mounting the ZIP archive, and will \fBexit\fR once
          156  +that script has been executed.
          157  +.PP
          158  +\fBCaution:\fR highly experimental, not usable on Android, only partially
          159  +tested on Linux and Windows.
          160  +.RE
          161  +.TP
          162  +\fBzipfs mkkey\fR \fIpassword\fR
          163  +.
          164  +Given the clear text \fIpassword\fR argument, an obfuscated string version is
          165  +returned with the same format used in the \fBzipfs mkimg\fR command.
          166  +.TP
          167  +\fBzipfs lmkimg\fR \fIoutfile inlist\fR ?\fIpassword infile\fR?
          168  +.
          169  +This command is like \fBzipfs mkimg\fR, but instead of an input directory,
          170  +\fIinlist\fR must be a Tcl list where the odd elements are the names of files
          171  +to be copied into the archive in the image, and the even elements are their
          172  +respective names within that archive.
          173  +.TP
          174  +\fBzipfs lmkzip\fR \fIoutfile inlist\fR ?\fIpassword\fR?
          175  +.
          176  +This command is like \fBzipfs mkzip\fR, but instead of an input directory,
          177  +\fIinlist\fR must be a Tcl list where the odd elements are the names of files
          178  +to be copied into the archive, and the even elements are their respective
          179  +names within that archive.
          180  +.SH "EXAMPLES"
          181  +.PP
          182  +Mounting an ZIP archive as an application directory and running code out of it
          183  +before unmounting it again:
          184  +.PP
          185  +.CS
          186  +set zip myApp.zip
          187  +set base [file join [\fbzipfs root\fR] myApp]
          188  +
          189  +\fBzipfs mount\fR $base $zip
          190  +# $base now has the contents of myApp.zip
          191  +
          192  +source [file join $base app.tcl]
          193  +# use the contents, load libraries from it, etc...
          194  +
          195  +\fBzipfs unmount\fR $zip
          196  +.CE
          197  +.PP
          198  +Creating a ZIP archive, given that a directory exists containing the content
          199  +to put in the archive. Note that the source directory is given twice, in order
          200  +to strip the exterior directory name from each filename in the archive.
          201  +.PP
          202  +.CS
          203  +set sourceDirectory [file normalize myApp]
          204  +set targetZip myApp.zip
          205  +
          206  +\fBzipfs mkzip\fR $targetZip $sourceDirectory $sourceDirectory
          207  +.CE
          208  +.PP
          209  +Encryption can be applied to ZIP archives by providing a password when
          210  +building the ZIP and when mounting it.
          211  +.PP
          212  +.CS
          213  +set zip myApp.zip
          214  +set sourceDir [file normalize myApp]
          215  +set password "hunter2"
          216  +set base [file join [\fbzipfs root\fR] myApp]
          217  +
          218  +# Create with password
          219  +\fBzipfs mkzip\fR $targetZip $sourceDir $sourceDir $password
          220  +
          221  +# Mount with password
          222  +\fBzipfs mount\fR $base $zip $password
          223  +.CE
          224  +.PP
          225  +When creating an executable image with a password, the password is placed
          226  +within the executable in a shrouded form so that the application can read
          227  +files inside the embedded ZIP archive yet casual inspection cannot read it.
          228  +.PP
          229  +.CS
          230  +set appDir [file normalize myApp]
          231  +set img "myApp.bin"
          232  +set password "hunter2"
          233  +
          234  +# Create some simple content to define a basic application
          235  +file mkdir $appDir
          236  +set f [open $appDir/main.tcl]
          237  +puts $f {
          238  +    puts "Hi. This is [info script]"
          239  +}
          240  +close $f
          241  +
          242  +# Create the executable
          243  +\fBzipfs mkimg\fR $img $appDir $appDir $password
          244  +
          245  +# Launch the executable, printing its output to stdout
          246  +exec $img >@stdout
          247  +#    prints: \fIHi. This is //zipfs:/app/main.tcl\fR
          248  +.CE
          249  +.SH "SEE ALSO"
          250  +tclsh(1), file(n), zipfs(3), zlib(n)
          251  +.SH "KEYWORDS"
          252  +compress, filesystem, zip
          253  +'\" Local Variables:
          254  +'\" mode: nroff
          255  +'\" End:

Changes to generic/regc_locale.c.

   133    133    * Unicode: alphabetic characters.
   134    134    */
   135    135   
   136    136   static const crange alphaRangeTable[] = {
   137    137       {0x41, 0x5a}, {0x61, 0x7a}, {0xc0, 0xd6}, {0xd8, 0xf6},
   138    138       {0xf8, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, {0x370, 0x374},
   139    139       {0x37a, 0x37d}, {0x388, 0x38a}, {0x38e, 0x3a1}, {0x3a3, 0x3f5},
   140         -    {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587},
   141         -    {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3},
          140  +    {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x560, 0x588},
          141  +    {0x5d0, 0x5ea}, {0x5ef, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3},
   142    142       {0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea},
   143    143       {0x800, 0x815}, {0x840, 0x858}, {0x860, 0x86a}, {0x8a0, 0x8b4},
   144    144       {0x8b6, 0x8bd}, {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980},
   145    145       {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9},
   146    146       {0x9df, 0x9e1}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30},
   147    147       {0xa59, 0xa5c}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91},
   148    148       {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c},
................................................................................
   161    161       {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288},
   162    162       {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be},
   163    163       {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315},
   164    164       {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd},
   165    165       {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea},
   166    166       {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731},
   167    167       {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3},
   168         -    {0x1820, 0x1877}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5},
          168  +    {0x1820, 0x1878}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5},
   169    169       {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
   170    170       {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33},
   171    171       {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23},
   172         -    {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec},
   173         -    {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d},
   174         -    {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d},
   175         -    {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc},
   176         -    {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4},
   177         -    {0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d},
   178         -    {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149},
   179         -    {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee},
   180         -    {0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6},
   181         -    {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
   182         -    {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035},
   183         -    {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff},
   184         -    {0x3105, 0x312e}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff},
   185         -    {0x3400, 0x4db5}, {0x4e00, 0x9fea}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd},
   186         -    {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d},
   187         -    {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae},
   188         -    {0xa7b0, 0xa7b7}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a},
   189         -    {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7},
   190         -    {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2},
   191         -    {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28},
   192         -    {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf},
   193         -    {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4},
   194         -    {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26},
   195         -    {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2},
   196         -    {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e},
   197         -    {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e},
   198         -    {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e},
   199         -    {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e},
   200         -    {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d},
   201         -    {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28},
   202         -    {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d},
   203         -    {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74},
   204         -    {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe},
   205         -    {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}
   206         -#if TCL_UTF_MAX > 4
          172  +    {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1c90, 0x1cba},
          173  +    {0x1cbd, 0x1cbf}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf},
          174  +    {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d},
          175  +    {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
          176  +    {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb},
          177  +    {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2090, 0x209c},
          178  +    {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d}, {0x212f, 0x2139},
          179  +    {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e},
          180  +    {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, {0x2d30, 0x2d67},
          181  +    {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6},
          182  +    {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6},
          183  +    {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096}, {0x309d, 0x309f},
          184  +    {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312f}, {0x3131, 0x318e},
          185  +    {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5}, {0x4e00, 0x9fef},
          186  +    {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, {0xa610, 0xa61f},
          187  +    {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, {0xa717, 0xa71f},
          188  +    {0xa722, 0xa788}, {0xa78b, 0xa7b9}, {0xa7f7, 0xa801}, {0xa803, 0xa805},
          189  +    {0xa807, 0xa80a}, {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3},
          190  +    {0xa8f2, 0xa8f7}, {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c},
          191  +    {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe},
          192  +    {0xaa00, 0xaa28}, {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76},
          193  +    {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea},
          194  +    {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16},
          195  +    {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65},
          196  +    {0xab70, 0xabe2}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb},
          197  +    {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
          198  +    {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1},
          199  +    {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb},
          200  +    {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a},
          201  +    {0xff66, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7},
          202  +    {0xffda, 0xffdc}
          203  +#if CHRBITS > 16
   207    204       ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
   208    205       {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0},
   209    206       {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375},
   210    207       {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d},
   211    208       {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563},
   212    209       {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805},
   213    210       {0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e},
   214    211       {0x108e0, 0x108f2}, {0x10900, 0x10915}, {0x10920, 0x10939}, {0x10980, 0x109b7},
   215         -    {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a60, 0x10a7c},
          212  +    {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a35}, {0x10a60, 0x10a7c},
   216    213       {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35},
   217    214       {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48},
   218         -    {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x11003, 0x11037}, {0x11083, 0x110af},
   219         -    {0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2},
   220         -    {0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286},
   221         -    {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de},
   222         -    {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339},
   223         -    {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af},
   224         -    {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
   225         -    {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83},
          215  +    {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10d00, 0x10d23}, {0x10f00, 0x10f1c},
          216  +    {0x10f30, 0x10f45}, {0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8},
          217  +    {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4},
          218  +    {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, {0x1128a, 0x1128d},
          219  +    {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, {0x11305, 0x1130c},
          220  +    {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361},
          221  +    {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, {0x11580, 0x115ae},
          222  +    {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, {0x11700, 0x1171a},
          223  +    {0x11800, 0x1182b}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83},
   226    224       {0x11a86, 0x11a89}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c2e},
   227         -    {0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x12000, 0x12399},
   228         -    {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
   229         -    {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43},
   230         -    {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f},
   231         -    {0x17000, 0x187ec}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb},
          225  +    {0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x11d60, 0x11d65},
          226  +    {0x11d6a, 0x11d89}, {0x11ee0, 0x11ef2}, {0x12000, 0x12399}, {0x12480, 0x12543},
          227  +    {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e},
          228  +    {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, {0x16b63, 0x16b77},
          229  +    {0x16b7d, 0x16b8f}, {0x16e40, 0x16e7f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f},
          230  +    {0x17000, 0x187f1}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb},
   232    231       {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
   233    232       {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
   234    233       {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
   235    234       {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
   236    235       {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da},
   237    236       {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e},
   238    237       {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2},
................................................................................
   260    259       0xcf2, 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84,
   261    260       0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2,
   262    261       0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e,
   263    262       0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae,
   264    263       0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f,
   265    264       0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184,
   266    265       0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b,
   267         -    0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5,
   268         -    0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44
   269         -#if TCL_UTF_MAX > 4
          266  +    0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa8fe, 0xa9cf, 0xaa7a, 0xaab1,
          267  +    0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43,
          268  +    0xfb44
          269  +#if CHRBITS > 16
   270    270       ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be,
   271         -    0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332,
   272         -    0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11a00,
   273         -    0x11a3a, 0x11a50, 0x11c40, 0x11d08, 0x11d09, 0x11d46, 0x16f50, 0x16fe0, 0x16fe1,
   274         -    0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22,
   275         -    0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51,
   276         -    0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62,
   277         -    0x1ee64, 0x1ee7e
          271  +    0x109bf, 0x10a00, 0x10f27, 0x11144, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f,
          272  +    0x11310, 0x11332, 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644,
          273  +    0x118ff, 0x11a00, 0x11a3a, 0x11a50, 0x11a9d, 0x11c40, 0x11d08, 0x11d09, 0x11d46,
          274  +    0x11d67, 0x11d68, 0x11d98, 0x16f50, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, 0x1d4a2,
          275  +    0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39,
          276  +    0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57,
          277  +    0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
   278    278   #endif
   279    279   };
   280    280   
   281    281   #define NUM_ALPHA_CHAR (sizeof(alphaCharTable)/sizeof(chr))
   282    282   
   283    283   /*
   284    284    * Unicode: control characters.
   285    285    */
   286    286   
   287    287   static const crange controlRangeTable[] = {
   288    288       {0x0, 0x1f}, {0x7f, 0x9f}, {0x600, 0x605}, {0x200b, 0x200f},
   289    289       {0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff},
   290    290       {0xfff9, 0xfffb}
   291         -#if TCL_UTF_MAX > 4
          291  +#if CHRBITS > 16
   292    292       ,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd},
   293    293       {0x100000, 0x10fffd}
   294    294   #endif
   295    295   };
   296    296   
   297    297   #define NUM_CONTROL_RANGE (sizeof(controlRangeTable)/sizeof(crange))
   298    298   
   299    299   static const chr controlCharTable[] = {
   300    300       0xad, 0x61c, 0x6dd, 0x70f, 0x8e2, 0x180e, 0xfeff
   301         -#if TCL_UTF_MAX > 4
   302         -    ,0x110bd, 0xe0001
          301  +#if CHRBITS > 16
          302  +    ,0x110bd, 0x110cd, 0xe0001
   303    303   #endif
   304    304   };
   305    305   
   306    306   #define NUM_CONTROL_CHAR (sizeof(controlCharTable)/sizeof(chr))
   307    307   
   308    308   /*
   309    309    * Unicode: decimal digit characters.
................................................................................
   316    316       {0xd66, 0xd6f}, {0xde6, 0xdef}, {0xe50, 0xe59}, {0xed0, 0xed9},
   317    317       {0xf20, 0xf29}, {0x1040, 0x1049}, {0x1090, 0x1099}, {0x17e0, 0x17e9},
   318    318       {0x1810, 0x1819}, {0x1946, 0x194f}, {0x19d0, 0x19d9}, {0x1a80, 0x1a89},
   319    319       {0x1a90, 0x1a99}, {0x1b50, 0x1b59}, {0x1bb0, 0x1bb9}, {0x1c40, 0x1c49},
   320    320       {0x1c50, 0x1c59}, {0xa620, 0xa629}, {0xa8d0, 0xa8d9}, {0xa900, 0xa909},
   321    321       {0xa9d0, 0xa9d9}, {0xa9f0, 0xa9f9}, {0xaa50, 0xaa59}, {0xabf0, 0xabf9},
   322    322       {0xff10, 0xff19}
   323         -#if TCL_UTF_MAX > 4
   324         -    ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f},
   325         -    {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9},
   326         -    {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9},
   327         -    {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59},
   328         -    {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959}
          323  +#if CHRBITS > 16
          324  +    ,{0x104a0, 0x104a9}, {0x10d30, 0x10d39}, {0x11066, 0x1106f}, {0x110f0, 0x110f9},
          325  +    {0x11136, 0x1113f}, {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459},
          326  +    {0x114d0, 0x114d9}, {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739},
          327  +    {0x118e0, 0x118e9}, {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x11da0, 0x11da9},
          328  +    {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959}
   329    329   #endif
   330    330   };
   331    331   
   332    332   #define NUM_DIGIT_RANGE (sizeof(digitRangeTable)/sizeof(crange))
   333    333   
   334    334   /*
   335    335    * no singletons of digit characters.
................................................................................
   344    344       {0x55a, 0x55f}, {0x66a, 0x66d}, {0x700, 0x70d}, {0x7f7, 0x7f9},
   345    345       {0x830, 0x83e}, {0xf04, 0xf12}, {0xf3a, 0xf3d}, {0xfd0, 0xfd4},
   346    346       {0x104a, 0x104f}, {0x1360, 0x1368}, {0x16eb, 0x16ed}, {0x17d4, 0x17d6},
   347    347       {0x17d8, 0x17da}, {0x1800, 0x180a}, {0x1aa0, 0x1aa6}, {0x1aa8, 0x1aad},
   348    348       {0x1b5a, 0x1b60}, {0x1bfc, 0x1bff}, {0x1c3b, 0x1c3f}, {0x1cc0, 0x1cc7},
   349    349       {0x2010, 0x2027}, {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x205e},
   350    350       {0x2308, 0x230b}, {0x2768, 0x2775}, {0x27e6, 0x27ef}, {0x2983, 0x2998},
   351         -    {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e49},
          351  +    {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e4e},
   352    352       {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, {0xa60d, 0xa60f},
   353    353       {0xa6f2, 0xa6f7}, {0xa874, 0xa877}, {0xa8f8, 0xa8fa}, {0xa9c1, 0xa9cd},
   354    354       {0xaa5c, 0xaa5f}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61},
   355    355       {0xff01, 0xff03}, {0xff05, 0xff0a}, {0xff0c, 0xff0f}, {0xff3b, 0xff3d},
   356    356       {0xff5f, 0xff65}
   357         -#if TCL_UTF_MAX > 4
          357  +#if CHRBITS > 16
   358    358       ,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f},
   359         -    {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143},
   360         -    {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f},
   361         -    {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e},
   362         -    {0x11a3f, 0x11a46}, {0x11a9a, 0x11a9c}, {0x11a9e, 0x11aa2}, {0x11c41, 0x11c45},
   363         -    {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b}
          359  +    {0x10b99, 0x10b9c}, {0x10f55, 0x10f59}, {0x11047, 0x1104d}, {0x110be, 0x110c1},
          360  +    {0x11140, 0x11143}, {0x111c5, 0x111c8}, {0x111dd, 0x111df}, {0x11238, 0x1123d},
          361  +    {0x1144b, 0x1144f}, {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c},
          362  +    {0x1173c, 0x1173e}, {0x11a3f, 0x11a46}, {0x11a9a, 0x11a9c}, {0x11a9e, 0x11aa2},
          363  +    {0x11c41, 0x11c45}, {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x16e97, 0x16e9a},
          364  +    {0x1da87, 0x1da8b}
   364    365   #endif
   365    366   };
   366    367   
   367    368   #define NUM_PUNCT_RANGE (sizeof(punctRangeTable)/sizeof(crange))
   368    369   
   369    370   static const chr punctCharTable[] = {
   370    371       0x3a, 0x3b, 0x3f, 0x40, 0x5f, 0x7b, 0x7d, 0xa1, 0xa7,
   371    372       0xab, 0xb6, 0xb7, 0xbb, 0xbf, 0x37e, 0x387, 0x589, 0x58a,
   372    373       0x5be, 0x5c0, 0x5c3, 0x5c6, 0x5f3, 0x5f4, 0x609, 0x60a, 0x60c,
   373    374       0x60d, 0x61b, 0x61e, 0x61f, 0x6d4, 0x85e, 0x964, 0x965, 0x970,
   374         -    0x9fd, 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9,
   375         -    0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736,
   376         -    0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e,
   377         -    0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe,
   378         -    0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673,
   379         -    0xa67e, 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df,
   380         -    0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68,
   381         -    0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d
   382         -#if TCL_UTF_MAX > 4
          375  +    0x9fd, 0xa76, 0xaf0, 0xc84, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14,
          376  +    0xf85, 0xfd9, 0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c,
          377  +    0x1735, 0x1736, 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3,
          378  +    0x207d, 0x207e, 0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc,
          379  +    0x29fd, 0x2cfe, 0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe,
          380  +    0xa4ff, 0xa673, 0xa67e, 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f,
          381  +    0xa9de, 0xa9df, 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f,
          382  +    0xfe63, 0xfe68, 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f,
          383  +    0xff5b, 0xff5d
          384  +#if CHRBITS > 16
   383    385       ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc,
   384         -    0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70,
   385         -    0x11c71, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f, 0x1e95e, 0x1e95f
          386  +    0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x1183b,
          387  +    0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f,
          388  +    0x1e95e, 0x1e95f
   386    389   #endif
   387    390   };
   388    391   
   389    392   #define NUM_PUNCT_CHAR (sizeof(punctCharTable)/sizeof(chr))
   390    393   
   391    394   /*
   392    395    * Unicode: white space characters.
................................................................................
   409    412    * Unicode: lowercase characters.
   410    413    */
   411    414   
   412    415   static const crange lowerRangeTable[] = {
   413    416       {0x61, 0x7a}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x17e, 0x180},
   414    417       {0x199, 0x19b}, {0x1bd, 0x1bf}, {0x233, 0x239}, {0x24f, 0x293},
   415    418       {0x295, 0x2af}, {0x37b, 0x37d}, {0x3ac, 0x3ce}, {0x3d5, 0x3d7},
   416         -    {0x3ef, 0x3f3}, {0x430, 0x45f}, {0x561, 0x587}, {0x13f8, 0x13fd},
   417         -    {0x1c80, 0x1c88}, {0x1d00, 0x1d2b}, {0x1d6b, 0x1d77}, {0x1d79, 0x1d9a},
   418         -    {0x1e95, 0x1e9d}, {0x1eff, 0x1f07}, {0x1f10, 0x1f15}, {0x1f20, 0x1f27},
   419         -    {0x1f30, 0x1f37}, {0x1f40, 0x1f45}, {0x1f50, 0x1f57}, {0x1f60, 0x1f67},
   420         -    {0x1f70, 0x1f7d}, {0x1f80, 0x1f87}, {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7},
   421         -    {0x1fb0, 0x1fb4}, {0x1fc2, 0x1fc4}, {0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7},
   422         -    {0x1ff2, 0x1ff4}, {0x2146, 0x2149}, {0x2c30, 0x2c5e}, {0x2c76, 0x2c7b},
   423         -    {0x2d00, 0x2d25}, {0xa72f, 0xa731}, {0xa771, 0xa778}, {0xa793, 0xa795},
   424         -    {0xab30, 0xab5a}, {0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06},
   425         -    {0xfb13, 0xfb17}, {0xff41, 0xff5a}
   426         -#if TCL_UTF_MAX > 4
          419  +    {0x3ef, 0x3f3}, {0x430, 0x45f}, {0x560, 0x588}, {0x10d0, 0x10fa},
          420  +    {0x10fd, 0x10ff}, {0x13f8, 0x13fd}, {0x1c80, 0x1c88}, {0x1d00, 0x1d2b},
          421  +    {0x1d6b, 0x1d77}, {0x1d79, 0x1d9a}, {0x1e95, 0x1e9d}, {0x1eff, 0x1f07},
          422  +    {0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45},
          423  +    {0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87},
          424  +    {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fc2, 0x1fc4},
          425  +    {0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x2146, 0x2149},
          426  +    {0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25}, {0xa72f, 0xa731},
          427  +    {0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a}, {0xab60, 0xab65},
          428  +    {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a}
          429  +#if CHRBITS > 16
   427    430       ,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df},
   428         -    {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b},
   429         -    {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503},
   430         -    {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3},
   431         -    {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5},
   432         -    {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b},
   433         -    {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f},
   434         -    {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943}
          431  +    {0x16e60, 0x16e7f}, {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467},
          432  +    {0x1d482, 0x1d49b}, {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf},
          433  +    {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f},
          434  +    {0x1d5ba, 0x1d5d3}, {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f},
          435  +    {0x1d68a, 0x1d6a5}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714},
          436  +    {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788},
          437  +    {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943}
   435    438   #endif
   436    439   };
   437    440   
   438    441   #define NUM_LOWER_RANGE (sizeof(lowerRangeTable)/sizeof(crange))
   439    442   
   440    443   static const chr lowerCharTable[] = {
   441    444       0xb5, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10b, 0x10d, 0x10f,
................................................................................
   497    500       0xa691, 0xa693, 0xa695, 0xa697, 0xa699, 0xa69b, 0xa723, 0xa725, 0xa727,
   498    501       0xa729, 0xa72b, 0xa72d, 0xa733, 0xa735, 0xa737, 0xa739, 0xa73b, 0xa73d,
   499    502       0xa73f, 0xa741, 0xa743, 0xa745, 0xa747, 0xa749, 0xa74b, 0xa74d, 0xa74f,
   500    503       0xa751, 0xa753, 0xa755, 0xa757, 0xa759, 0xa75b, 0xa75d, 0xa75f, 0xa761,
   501    504       0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c,
   502    505       0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0xa78e, 0xa791, 0xa797,
   503    506       0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9,
   504         -    0xa7b5, 0xa7b7, 0xa7fa
   505         -#if TCL_UTF_MAX > 4
          507  +    0xa7af, 0xa7b5, 0xa7b7, 0xa7b9, 0xa7fa
          508  +#if CHRBITS > 16
   506    509       ,0x1d4bb, 0x1d7cb
   507    510   #endif
   508    511   };
   509    512   
   510    513   #define NUM_LOWER_CHAR (sizeof(lowerCharTable)/sizeof(chr))
   511    514   
   512    515   /*
................................................................................
   514    517    */
   515    518   
   516    519   static const crange upperRangeTable[] = {
   517    520       {0x41, 0x5a}, {0xc0, 0xd6}, {0xd8, 0xde}, {0x189, 0x18b},
   518    521       {0x18e, 0x191}, {0x196, 0x198}, {0x1b1, 0x1b3}, {0x1f6, 0x1f8},
   519    522       {0x243, 0x246}, {0x388, 0x38a}, {0x391, 0x3a1}, {0x3a3, 0x3ab},
   520    523       {0x3d2, 0x3d4}, {0x3fd, 0x42f}, {0x531, 0x556}, {0x10a0, 0x10c5},
   521         -    {0x13a0, 0x13f5}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f},
   522         -    {0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb},
   523         -    {0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb},
   524         -    {0x210b, 0x210d}, {0x2110, 0x2112}, {0x2119, 0x211d}, {0x212a, 0x212d},
   525         -    {0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70},
   526         -    {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a}
   527         -#if TCL_UTF_MAX > 4
          524  +    {0x13a0, 0x13f5}, {0x1c90, 0x1cba}, {0x1cbd, 0x1cbf}, {0x1f08, 0x1f0f},
          525  +    {0x1f18, 0x1f1d}, {0x1f28, 0x1f2f}, {0x1f38, 0x1f3f}, {0x1f48, 0x1f4d},
          526  +    {0x1f68, 0x1f6f}, {0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb},
          527  +    {0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb}, {0x210b, 0x210d}, {0x2110, 0x2112},
          528  +    {0x2119, 0x211d}, {0x212a, 0x212d}, {0x2130, 0x2133}, {0x2c00, 0x2c2e},
          529  +    {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae},
          530  +    {0xa7b0, 0xa7b4}, {0xff21, 0xff3a}
          531  +#if CHRBITS > 16
   528    532       ,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf},
   529         -    {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac},
   530         -    {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
   531         -    {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550},
   532         -    {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621},
   533         -    {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa},
   534         -    {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}, {0x1e900, 0x1e921}
          533  +    {0x16e40, 0x16e5f}, {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481},
          534  +    {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a},
          535  +    {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544},
          536  +    {0x1d54a, 0x1d550}, {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed},
          537  +    {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0},
          538  +    {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8},
          539  +    {0x1e900, 0x1e921}
   535    540   #endif
   536    541   };
   537    542   
   538    543   #define NUM_UPPER_RANGE (sizeof(upperRangeTable)/sizeof(crange))
   539    544   
   540    545   static const chr upperCharTable[] = {
   541    546       0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, 0x110,
................................................................................
   596    601       0xa686, 0xa688, 0xa68a, 0xa68c, 0xa68e, 0xa690, 0xa692, 0xa694, 0xa696,
   597    602       0xa698, 0xa69a, 0xa722, 0xa724, 0xa726, 0xa728, 0xa72a, 0xa72c, 0xa72e,
   598    603       0xa732, 0xa734, 0xa736, 0xa738, 0xa73a, 0xa73c, 0xa73e, 0xa740, 0xa742,
   599    604       0xa744, 0xa746, 0xa748, 0xa74a, 0xa74c, 0xa74e, 0xa750, 0xa752, 0xa754,
   600    605       0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766,
   601    606       0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77d, 0xa77e, 0xa780,
   602    607       0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798,
   603         -    0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6
   604         -#if TCL_UTF_MAX > 4
          608  +    0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6,
          609  +    0xa7b8
          610  +#if CHRBITS > 16
   605    611       ,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538,
   606    612       0x1d539, 0x1d546, 0x1d7ca
   607    613   #endif
   608    614   };
   609    615   
   610    616   #define NUM_UPPER_CHAR (sizeof(upperCharTable)/sizeof(chr))
   611    617   
................................................................................
   612    618   /*
   613    619    * Unicode: unicode print characters excluding space.
   614    620    */
   615    621   
   616    622   static const crange graphRangeTable[] = {
   617    623       {0x21, 0x7e}, {0xa1, 0xac}, {0xae, 0x377}, {0x37a, 0x37f},
   618    624       {0x384, 0x38a}, {0x38e, 0x3a1}, {0x3a3, 0x52f}, {0x531, 0x556},
   619         -    {0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7},
   620         -    {0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc},
   621         -    {0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa},
   622         -    {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x860, 0x86a},
   623         -    {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983},
   624         -    {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9},
   625         -    {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fd},
   626         -    {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30},
   627         -    {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75},
   628         -    {0xa81, 0xa83}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8},
   629         -    {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9},
   630         -    {0xacb, 0xacd}, {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xaf9, 0xaff},
   631         -    {0xb01, 0xb03}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30},
   632         -    {0xb35, 0xb39}, {0xb3c, 0xb44}, {0xb4b, 0xb4d}, {0xb5f, 0xb63},
   633         -    {0xb66, 0xb77}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95},
   634         -    {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
   635         -    {0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c},
   636         -    {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44},
   637         -    {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63},
   638         -    {0xc66, 0xc6f}, {0xc78, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90},
   639         -    {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4},
   640         -    {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef},
   641         -    {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd44},
   642         -    {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f},
   643         -    {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6},
   644         -    {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4},
   645         -    {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f},
   646         -    {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4},
   647         -    {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47},
   648         -    {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc},
   649         -    {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d},
   650         -    {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d},
   651         -    {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5},
   652         -    {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a},
   653         -    {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd},
   654         -    {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c},
   655         -    {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c},
   656         -    {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9},
   657         -    {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa},
   658         -    {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b},
   659         -    {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9},
   660         -    {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c},
   661         -    {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe},
   662         -    {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37},
   663         -    {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf9},
   664         -    {0x1d00, 0x1df9}, {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
   665         -    {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4},
   666         -    {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef},
   667         -    {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e},
   668         -    {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bf}, {0x20d0, 0x20f0},
   669         -    {0x2100, 0x218b}, {0x2190, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73},
   670         -    {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd2},
   671         -    {0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
          625  +    {0x559, 0x58a}, {0x58d, 0x58f}, {0x591, 0x5c7}, {0x5d0, 0x5ea},
          626  +    {0x5ef, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc}, {0x6de, 0x70d},
          627  +    {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa}, {0x7fd, 0x82d},
          628  +    {0x830, 0x83e}, {0x840, 0x85b}, {0x860, 0x86a}, {0x8a0, 0x8b4},
          629  +    {0x8b6, 0x8bd}, {0x8d3, 0x8e1}, {0x8e3, 0x983}, {0x985, 0x98c},
          630  +    {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9bc, 0x9c4},
          631  +    {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fe}, {0xa01, 0xa03},
          632  +    {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa3e, 0xa42},
          633  +    {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa76}, {0xa81, 0xa83},
          634  +    {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0},
          635  +    {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd},
          636  +    {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xaf9, 0xaff}, {0xb01, 0xb03},
          637  +    {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39},
          638  +    {0xb3c, 0xb44}, {0xb4b, 0xb4d}, {0xb5f, 0xb63}, {0xb66, 0xb77},
          639  +    {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa},
          640  +    {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd},
          641  +    {0xbe6, 0xbfa}, {0xc00, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
          642  +    {0xc2a, 0xc39}, {0xc3d, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d},
          643  +    {0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc78, 0xc8c},
          644  +    {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
          645  +    {0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3},
          646  +    {0xce6, 0xcef}, {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
          647  +    {0xd12, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63},
          648  +    {0xd66, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb},
          649  +    {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef},
          650  +    {0xdf2, 0xdf4}, {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97},
          651  +    {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd},
          652  +    {0xec0, 0xec4}, {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf},
          653  +    {0xf00, 0xf47}, {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc},
          654  +    {0xfbe, 0xfcc}, {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248},
          655  +    {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288},
          656  +    {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be},
          657  +    {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315},
          658  +    {0x1318, 0x135a}, {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5},
          659  +    {0x13f8, 0x13fd}, {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8},
          660  +    {0x1700, 0x170c}, {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753},
          661  +    {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9},
          662  +    {0x17f0, 0x17f9}, {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1878},
          663  +    {0x1880, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b},
          664  +    {0x1930, 0x193b}, {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
          665  +    {0x19b0, 0x19c9}, {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e},
          666  +    {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad},
          667  +    {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3},
          668  +    {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1c90, 0x1cba},
          669  +    {0x1cbd, 0x1cc7}, {0x1cd0, 0x1cf9}, {0x1d00, 0x1df9}, {0x1dfb, 0x1f15},
          670  +    {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57},
          671  +    {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3},
          672  +    {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe},
          673  +    {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e}, {0x2090, 0x209c},
          674  +    {0x20a0, 0x20bf}, {0x20d0, 0x20f0}, {0x2100, 0x218b}, {0x2190, 0x2426},
          675  +    {0x2440, 0x244a}, {0x2460, 0x2b73}, {0x2b76, 0x2b95}, {0x2b98, 0x2bc8},
          676  +    {0x2bca, 0x2bfe}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
   672    677       {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6},
   673    678       {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
   674         -    {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e49},
          679  +    {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e4e},
   675    680       {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb},
   676         -    {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312e},
          681  +    {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312f},
   677    682       {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e},
   678         -    {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fea}, {0xa000, 0xa48c},
   679         -    {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ae},
   680         -    {0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877},
   681         -    {0xa880, 0xa8c5}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953},
   682         -    {0xa95f, 0xa97c}, {0xa980, 0xa9cd}, {0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe},
   683         -    {0xaa00, 0xaa36}, {0xaa40, 0xaa4d}, {0xaa50, 0xaa59}, {0xaa5c, 0xaac2},
   684         -    {0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16},
   685         -    {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed},
   686         -    {0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb},
   687         -    {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe},
   688         -    {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe},
   689         -    {0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe},
   690         -    {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe},
   691         -    {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
   692         -    {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f},
   693         -    {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19},
   694         -    {0xfe20, 0xfe52}, {0xfe54, 0xfe66}, {0xfe68, 0xfe6b}, {0xfe70, 0xfe74},
   695         -    {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf},
   696         -    {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee}
   697         -#if TCL_UTF_MAX > 4
          683  +    {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fef}, {0xa000, 0xa48c},
          684  +    {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7b9},
          685  +    {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c5},
          686  +    {0xa8ce, 0xa8d9}, {0xa8e0, 0xa953}, {0xa95f, 0xa97c}, {0xa980, 0xa9cd},
          687  +    {0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe}, {0xaa00, 0xaa36}, {0xaa40, 0xaa4d},
          688  +    {0xaa50, 0xaa59}, {0xaa5c, 0xaac2}, {0xaadb, 0xaaf6}, {0xab01, 0xab06},
          689  +    {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
          690  +    {0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3},
          691  +    {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9},
          692  +    {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c},
          693  +    {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7},
          694  +    {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19}, {0xfe20, 0xfe52}, {0xfe54, 0xfe66},
          695  +    {0xfe68, 0xfe6b}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff01, 0xffbe},
          696  +    {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc},
          697  +    {0xffe0, 0xffe6}, {0xffe8, 0xffee}
          698  +#if CHRBITS > 16
   698    699       ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d},
   699    700       {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133},
   700    701       {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c},
   701    702       {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x1032d, 0x1034a},
   702    703       {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5},
   703    704       {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb},
   704    705       {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755},
   705    706       {0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855},
   706    707       {0x10857, 0x1089e}, {0x108a7, 0x108af}, {0x108e0, 0x108f2}, {0x108fb, 0x1091b},
   707    708       {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x109bc, 0x109cf}, {0x109d2, 0x10a03},
   708         -    {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a},
   709         -    {0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6},
          709  +    {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a35}, {0x10a38, 0x10a3a},
          710  +    {0x10a3f, 0x10a48}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6},
   710    711       {0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72},
   711    712       {0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48},
   712         -    {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10cff}, {0x10e60, 0x10e7e},
   713         -    {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1},
   714         -    {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11143},
   715         -    {0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4},
   716         -    {0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d},
   717         -    {0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9},
   718         -    {0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330},
   719         -    {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363},
   720         -    {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7},
   721         -    {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644},
   722         -    {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9},
   723         -    {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2},
   724         -    {0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11a9c}, {0x11a9e, 0x11aa2},
   725         -    {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45},
   726         -    {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6},
   727         -    {0x11d00, 0x11d06}, {0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59},
          713  +    {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10d27}, {0x10d30, 0x10d39},
          714  +    {0x10e60, 0x10e7e}, {0x10f00, 0x10f27}, {0x10f30, 0x10f59}, {0x11000, 0x1104d},
          715  +    {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, {0x110d0, 0x110e8},
          716  +    {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11146}, {0x11150, 0x11176},
          717  +    {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, {0x11200, 0x11211},
          718  +    {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d},
          719  +    {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, {0x11300, 0x11303},
          720  +    {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339},
          721  +    {0x1133b, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, {0x11366, 0x1136c},
          722  +    {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, {0x114d0, 0x114d9},
          723  +    {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, {0x11650, 0x11659},
          724  +    {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, {0x11700, 0x1171a},
          725  +    {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x11800, 0x1183b}, {0x118a0, 0x118f2},
          726  +    {0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11aa2}, {0x11ac0, 0x11af8},
          727  +    {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, {0x11c50, 0x11c6c},
          728  +    {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, {0x11d00, 0x11d06},
          729  +    {0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59}, {0x11d60, 0x11d65},
          730  +    {0x11d6a, 0x11d8e}, {0x11d93, 0x11d98}, {0x11da0, 0x11da9}, {0x11ee0, 0x11ef8},
   728    731       {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543},
   729    732       {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e},
   730    733       {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45},
   731    734       {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f},
   732         -    {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec},
   733         -    {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, {0x1bc00, 0x1bc6a},
   734         -    {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f},
   735         -    {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8},
   736         -    {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454},
   737         -    {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3},
   738         -    {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c},
   739         -    {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550},
   740         -    {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f},
   741         -    {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, {0x1e008, 0x1e018}, {0x1e01b, 0x1e021},
   742         -    {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a},
   743         -    {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32},
   744         -    {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72},
   745         -    {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b},
   746         -    {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b},
   747         -    {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf},
   748         -    {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b},
   749         -    {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, {0x1f210, 0x1f23b}, {0x1f240, 0x1f248},
   750         -    {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f8},
   751         -    {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847},
   752         -    {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b},
   753         -    {0x1f910, 0x1f93e}, {0x1f940, 0x1f94c}, {0x1f950, 0x1f96b}, {0x1f980, 0x1f997},
   754         -    {0x1f9d0, 0x1f9e6}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
   755         -    {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
          735  +    {0x16e40, 0x16e9a}, {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f},
          736  +    {0x17000, 0x187f1}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb},
          737  +    {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
          738  +    {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172},
          739  +    {0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d2e0, 0x1d2f3}, {0x1d300, 0x1d356},
          740  +    {0x1d360, 0x1d378}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac},
          741  +    {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a},
          742  +    {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e},
          743  +    {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb},
          744  +    {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006},
          745  +    {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4},
          746  +    {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, {0x1e950, 0x1e959}, {0x1ec71, 0x1ecb4},
          747  +    {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37},
          748  +    {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77},
          749  +    {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3},
          750  +    {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093},
          751  +    {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5},
          752  +    {0x1f100, 0x1f10c}, {0x1f110, 0x1f16b}, {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202},
          753  +    {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4},
          754  +    {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f9}, {0x1f700, 0x1f773}, {0x1f780, 0x1f7d8},
          755  +    {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, {0x1f850, 0x1f859}, {0x1f860, 0x1f887},
          756  +    {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b}, {0x1f910, 0x1f93e}, {0x1f940, 0x1f970},
          757  +    {0x1f973, 0x1f976}, {0x1f97c, 0x1f9a2}, {0x1f9b0, 0x1f9b9}, {0x1f9c0, 0x1f9c2},
          758  +    {0x1f9d0, 0x1f9ff}, {0x1fa60, 0x1fa6d}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734},
          759  +    {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d},
          760  +    {0xe0100, 0xe01ef}
   756    761   #endif
   757    762   };
   758    763   
   759    764   #define NUM_GRAPH_RANGE (sizeof(graphRangeTable)/sizeof(crange))
   760    765   
   761    766   static const chr graphCharTable[] = {
   762         -    0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8,
   763         -    0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36,
   764         -    0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3,
   765         -    0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57,
   766         -    0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f,
   767         -    0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde,
   768         -    0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82,
   769         -    0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab,
   770         -    0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59,
   771         -    0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e,
   772         -    0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd
   773         -#if TCL_UTF_MAX > 4
          767  +    0x38c, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8, 0x9d7, 0x9dc,
          768  +    0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, 0xa39,
          769  +    0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3, 0xad0, 0xb0f,
          770  +    0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57, 0xb5c, 0xb5d,
          771  +    0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4,
          772  +    0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde, 0xcf1, 0xcf2,
          773  +    0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, 0xe84, 0xe87,
          774  +    0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xec6, 0x10c7,
          775  +    0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59, 0x1f5b, 0x1f5d,
          776  +    0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41,
          777  +    0xfb43, 0xfb44, 0xfffc, 0xfffd
          778  +#if CHRBITS > 16
   774    779       ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4,
   775    780       0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333,
   776         -    0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x11d08, 0x11d09,
   777         -    0x11d3a, 0x11d3c, 0x11d3d, 0x16a6e, 0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f,
   778         -    0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f,
   779         -    0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49,
   780         -    0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f,
   781         -    0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0
          781  +    0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x1145e, 0x118ff, 0x11d08,
          782  +    0x11d09, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d67, 0x11d68, 0x11d90, 0x11d91, 0x16a6e,
          783  +    0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb,
          784  +    0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27,
          785  +    0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54,
          786  +    0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e,
          787  +    0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f97a
   782    788   #endif
   783    789   };
   784    790   
   785    791   #define NUM_GRAPH_CHAR (sizeof(graphCharTable)/sizeof(chr))
   786    792   
   787    793   /*
   788    794    *	End of auto-generated Unicode character ranges declarations.

Changes to generic/regcustom.h.

    87     87   typedef int celt;		/* Type to hold chr, or NOCELT */
    88     88   #define	NOCELT (-1)		/* Celt value which is not valid chr */
    89     89   #define	CHR(c) (UCHAR(c))	/* Turn char literal into chr literal */
    90     90   #define	DIGITVAL(c) ((c)-'0')	/* Turn chr digit into its value */
    91     91   #if TCL_UTF_MAX > 4
    92     92   #define	CHRBITS	32		/* Bits in a chr; must not use sizeof */
    93     93   #define	CHR_MIN	0x00000000	/* Smallest and largest chr; the value */
    94         -#define	CHR_MAX	0xffffffff	/* CHR_MAX-CHR_MIN+1 should fit in uchr */
           94  +#define	CHR_MAX	0x10ffff	/* CHR_MAX-CHR_MIN+1 should fit in uchr */
    95     95   #else
    96     96   #define	CHRBITS	16		/* Bits in a chr; must not use sizeof */
    97     97   #define	CHR_MIN	0x0000		/* Smallest and largest chr; the value */
    98     98   #define	CHR_MAX	0xffff		/* CHR_MAX-CHR_MIN+1 should fit in uchr */
    99     99   #endif
   100    100   
   101    101   /*

Changes to generic/tcl.decls.

    28     28   # to preserve backwards compatibility.
    29     29   
    30     30   declare 0 {
    31     31       int Tcl_PkgProvideEx(Tcl_Interp *interp, const char *name,
    32     32   	    const char *version, const void *clientData)
    33     33   }
    34     34   declare 1 {
    35         -    CONST84_RETURN char *Tcl_PkgRequireEx(Tcl_Interp *interp,
           35  +    const char *Tcl_PkgRequireEx(Tcl_Interp *interp,
    36     36   	    const char *name, const char *version, int exact,
    37     37   	    void *clientDataPtr)
    38     38   }
    39     39   declare 2 {
    40     40       TCL_NORETURN void Tcl_Panic(const char *format, ...)
    41     41   }
    42     42   declare 3 {
................................................................................
   100    100   }
   101    101   declare 20 {
   102    102       void Tcl_DbIncrRefCount(Tcl_Obj *objPtr, const char *file, int line)
   103    103   }
   104    104   declare 21 {
   105    105       int Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file, int line)
   106    106   }
   107         -declare 22 {
          107  +declare 22 {deprecated {No longer in use, changed to macro}} {
   108    108       Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line)
   109    109   }
   110    110   declare 23 {
   111    111       Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int length,
   112    112   	    const char *file, int line)
   113    113   }
   114    114   declare 24 {
................................................................................
   115    115       Tcl_Obj *Tcl_DbNewDoubleObj(double doubleValue, const char *file,
   116    116   	    int line)
   117    117   }
   118    118   declare 25 {
   119    119       Tcl_Obj *Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv,
   120    120   	    const char *file, int line)
   121    121   }
   122         -declare 26 {
          122  +declare 26 {deprecated {No longer in use, changed to macro}} {
   123    123       Tcl_Obj *Tcl_DbNewLongObj(long longValue, const char *file, int line)
   124    124   }
   125    125   declare 27 {
   126    126       Tcl_Obj *Tcl_DbNewObj(const char *file, int line)
   127    127   }
   128    128   declare 28 {
   129    129       Tcl_Obj *Tcl_DbNewStringObj(const char *bytes, int length,
................................................................................
   148    148   declare 34 {
   149    149       int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr)
   150    150   }
   151    151   declare 35 {
   152    152       int Tcl_GetDoubleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
   153    153   	    double *doublePtr)
   154    154   }
   155         -declare 36 {
          155  +declare 36 {deprecated {No longer in use, changed to macro}} {
   156    156       int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
   157         -	    CONST84 char *const *tablePtr, const char *msg, int flags, int *indexPtr)
          157  +	    const char *const *tablePtr, const char *msg, int flags, int *indexPtr)
   158    158   }
   159    159   declare 37 {
   160    160       int Tcl_GetInt(Tcl_Interp *interp, const char *src, int *intPtr)
   161    161   }
   162    162   declare 38 {
   163    163       int Tcl_GetIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr)
   164    164   }
................................................................................
   194    194       int Tcl_ListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr,
   195    195   	    int *lengthPtr)
   196    196   }
   197    197   declare 48 {
   198    198       int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, int first,
   199    199   	    int count, int objc, Tcl_Obj *const objv[])
   200    200   }
   201         -declare 49 {
          201  +declare 49 {deprecated {No longer in use, changed to macro}} {
   202    202       Tcl_Obj *Tcl_NewBooleanObj(int boolValue)
   203    203   }
   204    204   declare 50 {
   205    205       Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int length)
   206    206   }
   207    207   declare 51 {
   208    208       Tcl_Obj *Tcl_NewDoubleObj(double doubleValue)
   209    209   }
   210         -declare 52 {
          210  +declare 52 {deprecated {No longer in use, changed to macro}} {
   211    211       Tcl_Obj *Tcl_NewIntObj(int intValue)
   212    212   }
   213    213   declare 53 {
   214    214       Tcl_Obj *Tcl_NewListObj(int objc, Tcl_Obj *const objv[])
   215    215   }
   216         -declare 54 {
          216  +declare 54 {deprecated {No longer in use, changed to macro}} {
   217    217       Tcl_Obj *Tcl_NewLongObj(long longValue)
   218    218   }
   219    219   declare 55 {
   220    220       Tcl_Obj *Tcl_NewObj(void)
   221    221   }
   222    222   declare 56 {
   223    223       Tcl_Obj *Tcl_NewStringObj(const char *bytes, int length)
   224    224   }
   225         -declare 57 {
          225  +declare 57 {deprecated {No longer in use, changed to macro}} {
   226    226       void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue)
   227    227   }
   228    228   declare 58 {
   229    229       unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length)
   230    230   }
   231    231   declare 59 {
   232    232       void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, const unsigned char *bytes,
   233    233   	    int length)
   234    234   }
   235    235   declare 60 {
   236    236       void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue)
   237    237   }
   238         -declare 61 {
          238  +declare 61 {deprecated {No longer in use, changed to macro}} {
   239    239       void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue)
   240    240   }
   241    241   declare 62 {
   242    242       void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[])
   243    243   }
   244         -declare 63 {
          244  +declare 63 {deprecated {No longer in use, changed to macro}} {
   245    245       void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue)
   246    246   }
   247    247   declare 64 {
   248    248       void Tcl_SetObjLength(Tcl_Obj *objPtr, int length)
   249    249   }
   250    250   declare 65 {
   251    251       void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, int length)
   252    252   }
   253         -declare 66 {
          253  +declare 66 {deprecated {No longer in use, changed to macro}} {
   254    254       void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
   255    255   }
   256         -declare 67 {
          256  +declare 67 {deprecated {No longer in use, changed to macro}} {
   257    257       void Tcl_AddObjErrorInfo(Tcl_Interp *interp, const char *message,
   258    258   	    int length)
   259    259   }
   260    260   declare 68 {
   261    261       void Tcl_AllowExceptions(Tcl_Interp *interp)
   262    262   }
   263    263   declare 69 {
................................................................................
   281    281   }
   282    282   declare 75 {
   283    283       int Tcl_AsyncReady(void)
   284    284   }
   285    285   declare 76 {
   286    286       void Tcl_BackgroundError(Tcl_Interp *interp)
   287    287   }
   288         -declare 77 {
          288  +declare 77 {deprecated {Use Tcl_UtfBackslash}} {
   289    289       char Tcl_Backslash(const char *src, int *readPtr)
   290    290   }
   291    291   declare 78 {
   292    292       int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName,
   293    293   	    const char *optionList)
   294    294   }
   295    295   declare 79 {
................................................................................
   302    302   declare 81 {
   303    303       int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan)
   304    304   }
   305    305   declare 82 {
   306    306       int Tcl_CommandComplete(const char *cmd)
   307    307   }
   308    308   declare 83 {
   309         -    char *Tcl_Concat(int argc, CONST84 char *const *argv)
          309  +    char *Tcl_Concat(int argc, const char *const *argv)
   310    310   }
   311    311   declare 84 {
   312    312       int Tcl_ConvertElement(const char *src, char *dst, int flags)
   313    313   }
   314    314   declare 85 {
   315    315       int Tcl_ConvertCountedElement(const char *src, int length, char *dst,
   316    316   	    int flags)
   317    317   }
   318    318   declare 86 {
   319    319       int Tcl_CreateAlias(Tcl_Interp *slave, const char *slaveCmd,
   320    320   	    Tcl_Interp *target, const char *targetCmd, int argc,
   321         -	    CONST84 char *const *argv)
          321  +	    const char *const *argv)
   322    322   }
   323    323   declare 87 {
   324    324       int Tcl_CreateAliasObj(Tcl_Interp *slave, const char *slaveCmd,
   325    325   	    Tcl_Interp *target, const char *targetCmd, int objc,
   326    326   	    Tcl_Obj *const objv[])
   327    327   }
   328    328   declare 88 {
................................................................................
   348    348   }
   349    349   declare 93 {
   350    350       void Tcl_CreateExitHandler(Tcl_ExitProc *proc, ClientData clientData)
   351    351   }
   352    352   declare 94 {
   353    353       Tcl_Interp *Tcl_CreateInterp(void)
   354    354   }
   355         -declare 95 {
          355  +declare 95 {deprecated {}} {
   356    356       void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name,
   357    357   	    int numArgs, Tcl_ValueType *argTypes,
   358    358   	    Tcl_MathProc *proc, ClientData clientData)
   359    359   }
   360    360   declare 96 {
   361    361       Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp,
   362    362   	    const char *cmdName,
................................................................................
   457    457   declare 125 {
   458    458       void Tcl_DStringStartSublist(Tcl_DString *dsPtr)
   459    459   }
   460    460   declare 126 {
   461    461       int Tcl_Eof(Tcl_Channel chan)
   462    462   }
   463    463   declare 127 {
   464         -    CONST84_RETURN char *Tcl_ErrnoId(void)
          464  +    const char *Tcl_ErrnoId(void)
   465    465   }
   466    466   declare 128 {
   467         -    CONST84_RETURN char *Tcl_ErrnoMsg(int err)
          467  +    const char *Tcl_ErrnoMsg(int err)
   468    468   }
   469    469   declare 129 {
   470    470       int Tcl_Eval(Tcl_Interp *interp, const char *script)
   471    471   }
   472         -# This is obsolete, use Tcl_FSEvalFile
   473    472   declare 130 {
   474    473       int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName)
   475    474   }
   476         -declare 131 {
          475  +declare 131 {deprecated {No longer in use, changed to macro}} {
   477    476       int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
   478    477   }
   479    478   declare 132 {
   480    479       void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
   481    480   }
   482    481   declare 133 {
   483    482       TCL_NORETURN void Tcl_Exit(int status)
................................................................................
   525    524       int Tcl_Flush(Tcl_Channel chan)
   526    525   }
   527    526   declare 147 {
   528    527       void Tcl_FreeResult(Tcl_Interp *interp)
   529    528   }
   530    529   declare 148 {
   531    530       int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd,
   532         -	    Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr,
   533         -	    int *argcPtr, CONST84 char ***argvPtr)
          531  +	    Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
          532  +	    int *argcPtr, const char ***argvPtr)
   534    533   }
   535    534   declare 149 {
   536    535       int Tcl_GetAliasObj(Tcl_Interp *interp, const char *slaveCmd,
   537         -	    Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr,
          536  +	    Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
   538    537   	    int *objcPtr, Tcl_Obj ***objv)
   539    538   }
   540    539   declare 150 {
   541    540       ClientData Tcl_GetAssocData(Tcl_Interp *interp, const char *name,
   542    541   	    Tcl_InterpDeleteProc **procPtr)
   543    542   }
   544    543   declare 151 {
................................................................................
   555    554   declare 154 {
   556    555       ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan)
   557    556   }
   558    557   declare 155 {
   559    558       int Tcl_GetChannelMode(Tcl_Channel chan)
   560    559   }
   561    560   declare 156 {
   562         -    CONST84_RETURN char *Tcl_GetChannelName(Tcl_Channel chan)
          561  +    const char *Tcl_GetChannelName(Tcl_Channel chan)
   563    562   }
   564    563   declare 157 {
   565    564       int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan,
   566    565   	    const char *optionName, Tcl_DString *dsPtr)
   567    566   }
   568    567   declare 158 {
   569    568       CONST86 Tcl_ChannelType *Tcl_GetChannelType(Tcl_Channel chan)
   570    569   }
   571    570   declare 159 {
   572    571       int Tcl_GetCommandInfo(Tcl_Interp *interp, const char *cmdName,
   573    572   	    Tcl_CmdInfo *infoPtr)
   574    573   }
   575    574   declare 160 {
   576         -    CONST84_RETURN char *Tcl_GetCommandName(Tcl_Interp *interp,
          575  +    const char *Tcl_GetCommandName(Tcl_Interp *interp,
   577    576   	    Tcl_Command command)
   578    577   }
   579    578   declare 161 {
   580    579       int Tcl_GetErrno(void)
   581    580   }
   582    581   declare 162 {
   583         -    CONST84_RETURN char *Tcl_GetHostName(void)
          582  +    const char *Tcl_GetHostName(void)
   584    583   }
   585    584   declare 163 {
   586    585       int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp)
   587    586   }
   588    587   declare 164 {
   589    588       Tcl_Interp *Tcl_GetMaster(Tcl_Interp *interp)
   590    589   }
................................................................................
   619    618   declare 172 {
   620    619       Tcl_Interp *Tcl_GetSlave(Tcl_Interp *interp, const char *slaveName)
   621    620   }
   622    621   declare 173 {
   623    622       Tcl_Channel Tcl_GetStdChannel(int type)
   624    623   }
   625    624   declare 174 {
   626         -    CONST84_RETURN char *Tcl_GetStringResult(Tcl_Interp *interp)
          625  +    const char *Tcl_GetStringResult(Tcl_Interp *interp)
   627    626   }
   628         -declare 175 {
   629         -    CONST84_RETURN char *Tcl_GetVar(Tcl_Interp *interp, const char *varName,
          627  +declare 175 {deprecated {No longer in use, changed to macro}} {
          628  +    const char *Tcl_GetVar(Tcl_Interp *interp, const char *varName,
   630    629   	    int flags)
   631    630   }
   632    631   declare 176 {
   633         -    CONST84_RETURN char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
          632  +    const char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
   634    633   	    const char *part2, int flags)
   635    634   }
   636    635   declare 177 {
   637    636       int Tcl_GlobalEval(Tcl_Interp *interp, const char *command)
   638    637   }
   639         -declare 178 {
          638  +declare 178 {deprecated {No longer in use, changed to macro}} {
   640    639       int Tcl_GlobalEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
   641    640   }
   642    641   declare 179 {
   643    642       int Tcl_HideCommand(Tcl_Interp *interp, const char *cmdName,
   644    643   	    const char *hiddenCmdToken)
   645    644   }
   646    645   declare 180 {
................................................................................
   659    658       int Tcl_InterpDeleted(Tcl_Interp *interp)
   660    659   }
   661    660   declare 185 {
   662    661       int Tcl_IsSafe(Tcl_Interp *interp)
   663    662   }
   664    663   # Obsolete, use Tcl_FSJoinPath
   665    664   declare 186 {
   666         -    char *Tcl_JoinPath(int argc, CONST84 char *const *argv,
          665  +    char *Tcl_JoinPath(int argc, const char *const *argv,
   667    666   	    Tcl_DString *resultPtr)
   668    667   }
   669    668   declare 187 {
   670    669       int Tcl_LinkVar(Tcl_Interp *interp, const char *varName, char *addr,
   671    670   	    int type)
   672    671   }
   673    672   
................................................................................
   682    681   declare 190 {
   683    682       int Tcl_MakeSafe(Tcl_Interp *interp)
   684    683   }
   685    684   declare 191 {
   686    685       Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket)
   687    686   }
   688    687   declare 192 {
   689         -    char *Tcl_Merge(int argc, CONST84 char *const *argv)
          688  +    char *Tcl_Merge(int argc, const char *const *argv)
   690    689   }
   691    690   declare 193 {
   692    691       Tcl_HashEntry *Tcl_NextHashEntry(Tcl_HashSearch *searchPtr)
   693    692   }
   694    693   declare 194 {
   695    694       void Tcl_NotifyChannel(Tcl_Channel channel, int mask)
   696    695   }
................................................................................
   700    699   }
   701    700   declare 196 {
   702    701       Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
   703    702   	    Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags)
   704    703   }
   705    704   declare 197 {
   706    705       Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc,
   707         -	    CONST84 char **argv, int flags)
          706  +	    const char **argv, int flags)
   708    707   }
   709    708   # This is obsolete, use Tcl_FSOpenFileChannel
   710    709   declare 198 {
   711    710       Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, const char *fileName,
   712    711   	    const char *modeString, int permissions)
   713    712   }
   714    713   declare 199 {
................................................................................
   726    725   declare 202 {
   727    726       void Tcl_PrintDouble(Tcl_Interp *interp, double value, char *dst)
   728    727   }
   729    728   declare 203 {
   730    729       int Tcl_PutEnv(const char *assignment)
   731    730   }
   732    731   declare 204 {
   733         -    CONST84_RETURN char *Tcl_PosixError(Tcl_Interp *interp)
          732  +    const char *Tcl_PosixError(Tcl_Interp *interp)
   734    733   }
   735    734   declare 205 {
   736    735       void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
   737    736   }
   738    737   declare 206 {
   739    738       int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead)
   740    739   }
................................................................................
   762    761   }
   763    762   declare 214 {
   764    763       int Tcl_RegExpMatch(Tcl_Interp *interp, const char *text,
   765    764   	    const char *pattern)
   766    765   }
   767    766   declare 215 {
   768    767       void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
   769         -	    CONST84 char **startPtr, CONST84 char **endPtr)
          768  +	    const char **startPtr, const char **endPtr)
   770    769   }
   771    770   declare 216 {
   772    771       void Tcl_Release(ClientData clientData)
   773    772   }
   774    773   declare 217 {
   775    774       void Tcl_ResetResult(Tcl_Interp *interp)
   776    775   }
   777    776   declare 218 {
   778    777       int Tcl_ScanElement(const char *src, int *flagPtr)
   779    778   }
   780    779   declare 219 {
   781    780       int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr)
   782    781   }
   783         -# Obsolete
   784         -declare 220 {
          782  +declare 220 {deprecated {}} {
   785    783       int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode)
   786    784   }
   787    785   declare 221 {
   788    786       int Tcl_ServiceAll(void)
   789    787   }
   790    788   declare 222 {
   791    789       int Tcl_ServiceEvent(int flags)
................................................................................
   832    830   }
   833    831   declare 235 {
   834    832       void Tcl_SetObjResult(Tcl_Interp *interp, Tcl_Obj *resultObjPtr)
   835    833   }
   836    834   declare 236 {
   837    835       void Tcl_SetStdChannel(Tcl_Channel channel, int type)
   838    836   }
   839         -declare 237 {
   840         -    CONST84_RETURN char *Tcl_SetVar(Tcl_Interp *interp, const char *varName,
          837  +declare 237 {deprecated {No longer in use, changed to macro}} {
          838  +    const char *Tcl_SetVar(Tcl_Interp *interp, const char *varName,
   841    839   	    const char *newValue, int flags)
   842    840   }
   843    841   declare 238 {
   844         -    CONST84_RETURN char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
          842  +    const char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
   845    843   	    const char *part2, const char *newValue, int flags)
   846    844   }
   847    845   declare 239 {
   848         -    CONST84_RETURN char *Tcl_SignalId(int sig)
          846  +    const char *Tcl_SignalId(int sig)
   849    847   }
   850    848   declare 240 {
   851         -    CONST84_RETURN char *Tcl_SignalMsg(int sig)
          849  +    const char *Tcl_SignalMsg(int sig)
   852    850   }
   853    851   declare 241 {
   854    852       void Tcl_SourceRCFile(Tcl_Interp *interp)
   855    853   }
   856    854   declare 242 {
   857    855       int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr,
   858         -	    CONST84 char ***argvPtr)
          856  +	    const char ***argvPtr)
   859    857   }
   860    858   # Obsolete, use Tcl_FSSplitPath
   861    859   declare 243 {
   862         -    void Tcl_SplitPath(const char *path, int *argcPtr, CONST84 char ***argvPtr)
          860  +    void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr)
   863    861   }
   864    862   declare 244 {
   865    863       void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName,
   866    864   	    Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
   867    865   }
   868    866   declare 245 {
   869    867       int Tcl_StringMatch(const char *str, const char *pattern)
   870    868   }
   871         -# Obsolete
   872         -declare 246 {
          869  +declare 246 {deprecated {}} {
   873    870       int Tcl_TellOld(Tcl_Channel chan)
   874    871   }
   875         -declare 247 {
          872  +declare 247 {deprecated {No longer in use, changed to macro}} {
   876    873       int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags,
   877    874   	    Tcl_VarTraceProc *proc, ClientData clientData)
   878    875   }
   879    876   declare 248 {
   880    877       int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1, const char *part2,
   881    878   	    int flags, Tcl_VarTraceProc *proc, ClientData clientData)
   882    879   }
................................................................................
   889    886   }
   890    887   declare 251 {
   891    888       void Tcl_UnlinkVar(Tcl_Interp *interp, const char *varName)
   892    889   }
   893    890   declare 252 {
   894    891       int Tcl_UnregisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
   895    892   }
   896         -declare 253 {
          893  +declare 253 {deprecated {No longer in use, changed to macro}} {
   897    894       int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName, int flags)
   898    895   }
   899    896   declare 254 {
   900    897       int Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1, const char *part2,
   901    898   	    int flags)
   902    899   }
   903         -declare 255 {
          900  +declare 255 {deprecated {No longer in use, changed to macro}} {
   904    901       void Tcl_UntraceVar(Tcl_Interp *interp, const char *varName, int flags,
   905    902   	    Tcl_VarTraceProc *proc, ClientData clientData)
   906    903   }
   907    904   declare 256 {
   908    905       void Tcl_UntraceVar2(Tcl_Interp *interp, const char *part1,
   909    906   	    const char *part2, int flags, Tcl_VarTraceProc *proc,
   910    907   	    ClientData clientData)
   911    908   }
   912    909   declare 257 {
   913    910       void Tcl_UpdateLinkedVar(Tcl_Interp *interp, const char *varName)
   914    911   }
   915         -declare 258 {
          912  +declare 258 {deprecated {No longer in use, changed to macro}} {
   916    913       int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
   917    914   	    const char *varName, const char *localName, int flags)
   918    915   }
   919    916   declare 259 {
   920    917       int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, const char *part1,
   921    918   	    const char *part2, const char *localName, int flags)
   922    919   }
   923    920   declare 260 {
   924    921       int Tcl_VarEval(Tcl_Interp *interp, ...)
   925    922   }
   926         -declare 261 {
          923  +declare 261 {deprecated {No longer in use, changed to macro}} {
   927    924       ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName,
   928    925   	    int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData)
   929    926   }
   930    927   declare 262 {
   931    928       ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
   932    929   	    const char *part2, int flags, Tcl_VarTraceProc *procPtr,
   933    930   	    ClientData prevClientData)
................................................................................
   941    938   }
   942    939   declare 265 {
   943    940       int Tcl_DumpActiveMemory(const char *fileName)
   944    941   }
   945    942   declare 266 {
   946    943       void Tcl_ValidateAllMemory(const char *file, int line)
   947    944   }
   948         -declare 267 {
          945  +declare 267 {deprecated {see TIP #422}} {
   949    946       void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
   950    947   }
   951         -declare 268 {
          948  +declare 268 {deprecated {see TIP #422}} {
   952    949       void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList)
   953    950   }
   954    951   declare 269 {
   955    952       char *Tcl_HashStats(Tcl_HashTable *tablePtr)
   956    953   }
   957    954   declare 270 {
   958         -    CONST84_RETURN char *Tcl_ParseVar(Tcl_Interp *interp, const char *start,
   959         -	    CONST84 char **termPtr)
          955  +    const char *Tcl_ParseVar(Tcl_Interp *interp, const char *start,
          956  +	    const char **termPtr)
   960    957   }
   961         -declare 271 {
   962         -    CONST84_RETURN char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
          958  +declare 271 {deprecated {No longer in use, changed to macro}} {
          959  +    const char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
   963    960   	    const char *version, int exact)
   964    961   }
   965    962   declare 272 {
   966         -    CONST84_RETURN char *Tcl_PkgPresentEx(Tcl_Interp *interp,
          963  +    const char *Tcl_PkgPresentEx(Tcl_Interp *interp,
   967    964   	    const char *name, const char *version, int exact,
   968    965   	    void *clientDataPtr)
   969    966   }
   970         -declare 273 {
          967  +declare 273 {deprecated {No longer in use, changed to macro}} {
   971    968       int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
   972    969   	    const char *version)
   973    970   }
   974    971   # TIP #268: The internally used new Require function is in slot 573.
   975         -declare 274 {
   976         -    CONST84_RETURN char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
          972  +declare 274 {deprecated {No longer in use, changed to macro}} {
          973  +    const char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
   977    974   	    const char *version, int exact)
   978    975   }
   979         -declare 275 {
          976  +declare 275 {deprecated {see TIP #422}} {
   980    977       void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList)
   981    978   }
   982         -declare 276 {
          979  +declare 276 {deprecated {see TIP #422}} {
   983    980       int  Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList)
   984    981   }
   985    982   declare 277 {
   986    983       Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
   987    984   }
   988         -declare 278 {
          985  +declare 278 {deprecated {see TIP #422}} {
   989    986       TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList)
   990    987   }
   991    988   declare 279 {
   992    989       void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type)
   993    990   }
   994    991   declare 280 {
   995    992       void Tcl_InitMemory(Tcl_Interp *interp)
................................................................................
  1083   1080   declare 300 {
  1084   1081       Tcl_ThreadId Tcl_GetCurrentThread(void)
  1085   1082   }
  1086   1083   declare 301 {
  1087   1084       Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, const char *name)
  1088   1085   }
  1089   1086   declare 302 {
  1090         -    CONST84_RETURN char *Tcl_GetEncodingName(Tcl_Encoding encoding)
         1087  +    const char *Tcl_GetEncodingName(Tcl_Encoding encoding)
  1091   1088   }
  1092   1089   declare 303 {
  1093   1090       void Tcl_GetEncodingNames(Tcl_Interp *interp)
  1094   1091   }
  1095   1092   declare 304 {
  1096   1093       int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr,
  1097   1094   	    const void *tablePtr, int offset, const char *msg, int flags,
................................................................................
  1144   1141       void Tcl_ThreadAlert(Tcl_ThreadId threadId)
  1145   1142   }
  1146   1143   declare 319 {
  1147   1144       void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, Tcl_Event *evPtr,
  1148   1145   	    Tcl_QueuePosition position)
  1149   1146   }
  1150   1147   declare 320 {
  1151         -    Tcl_UniChar Tcl_UniCharAtIndex(const char *src, int index)
         1148  +    int Tcl_UniCharAtIndex(const char *src, int index)
  1152   1149   }
  1153   1150   declare 321 {
  1154         -    Tcl_UniChar Tcl_UniCharToLower(int ch)
         1151  +    int Tcl_UniCharToLower(int ch)
  1155   1152   }
  1156   1153   declare 322 {
  1157         -    Tcl_UniChar Tcl_UniCharToTitle(int ch)
         1154  +    int Tcl_UniCharToTitle(int ch)
  1158   1155   }
  1159   1156   declare 323 {
  1160         -    Tcl_UniChar Tcl_UniCharToUpper(int ch)
         1157  +    int Tcl_UniCharToUpper(int ch)
  1161   1158   }
  1162   1159   declare 324 {
  1163   1160       int Tcl_UniCharToUtf(int ch, char *buf)
  1164   1161   }
  1165   1162   declare 325 {
  1166         -    CONST84_RETURN char *Tcl_UtfAtIndex(const char *src, int index)
         1163  +    const char *Tcl_UtfAtIndex(const char *src, int index)
  1167   1164   }
  1168   1165   declare 326 {
  1169   1166       int Tcl_UtfCharComplete(const char *src, int length)
  1170   1167   }
  1171   1168   declare 327 {
  1172   1169       int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
  1173   1170   }
  1174   1171   declare 328 {
  1175         -    CONST84_RETURN char *Tcl_UtfFindFirst(const char *src, int ch)
         1172  +    const char *Tcl_UtfFindFirst(const char *src, int ch)
  1176   1173   }
  1177   1174   declare 329 {
  1178         -    CONST84_RETURN char *Tcl_UtfFindLast(const char *src, int ch)
         1175  +    const char *Tcl_UtfFindLast(const char *src, int ch)
  1179   1176   }
  1180   1177   declare 330 {
  1181         -    CONST84_RETURN char *Tcl_UtfNext(const char *src)
         1178  +    const char *Tcl_UtfNext(const char *src)
  1182   1179   }
  1183   1180   declare 331 {
  1184         -    CONST84_RETURN char *Tcl_UtfPrev(const char *src, const char *start)
         1181  +    const char *Tcl_UtfPrev(const char *src, const char *start)
  1185   1182   }
  1186   1183   declare 332 {
  1187   1184       int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding,
  1188   1185   	    const char *src, int srcLen, int flags,
  1189   1186   	    Tcl_EncodingState *statePtr, char *dst, int dstLen,
  1190   1187   	    int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
  1191   1188   }
................................................................................
  1210   1207   }
  1211   1208   declare 339 {
  1212   1209       int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
  1213   1210   }
  1214   1211   declare 340 {
  1215   1212       char *Tcl_GetString(Tcl_Obj *objPtr)
  1216   1213   }
  1217         -declare 341 {
  1218         -    CONST84_RETURN char *Tcl_GetDefaultEncodingDir(void)
         1214  +declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} {
         1215  +    const char *Tcl_GetDefaultEncodingDir(void)
  1219   1216   }
  1220         -declare 342 {
         1217  +declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} {
  1221   1218       void Tcl_SetDefaultEncodingDir(const char *path)
  1222   1219   }
  1223   1220   declare 343 {
  1224   1221       void Tcl_AlertNotifier(ClientData clientData)
  1225   1222   }
  1226   1223   declare 344 {
  1227   1224       void Tcl_ServiceModeHook(int mode)
................................................................................
  1262   1259       Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
  1263   1260   	    int length, Tcl_DString *dsPtr)
  1264   1261   }
  1265   1262   declare 356 {
  1266   1263       Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
  1267   1264   	    int flags)
  1268   1265   }
  1269         -declare 357 {
         1266  +declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
  1270   1267       Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
  1271   1268   	    int count)
  1272   1269   }
  1273   1270   declare 358 {
  1274   1271       void Tcl_FreeParse(Tcl_Parse *parsePtr)
  1275   1272   }
  1276   1273   declare 359 {
  1277   1274       void Tcl_LogCommandInfo(Tcl_Interp *interp, const char *script,
  1278   1275   	    const char *command, int length)
  1279   1276   }
  1280   1277   declare 360 {
  1281   1278       int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, int numBytes,
  1282         -	    Tcl_Parse *parsePtr, int append, CONST84 char **termPtr)
         1279  +	    Tcl_Parse *parsePtr, int append, const char **termPtr)
  1283   1280   }
  1284   1281   declare 361 {
  1285   1282       int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes,
  1286   1283   	    int nested, Tcl_Parse *parsePtr)
  1287   1284   }
  1288   1285   declare 362 {
  1289   1286       int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, int numBytes,
  1290   1287   	    Tcl_Parse *parsePtr)
  1291   1288   }
  1292   1289   declare 363 {
  1293   1290       int Tcl_ParseQuotedString(Tcl_Interp *interp, const char *start,
  1294   1291   	    int numBytes, Tcl_Parse *parsePtr, int append,
  1295         -	    CONST84 char **termPtr)
         1292  +	    const char **termPtr)
  1296   1293   }
  1297   1294   declare 364 {
  1298   1295       int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, int numBytes,
  1299   1296   	    Tcl_Parse *parsePtr, int append)
  1300   1297   }
  1301   1298   # These 4 functions are obsolete, use Tcl_FSGetCwd, Tcl_FSChdir,
  1302   1299   # Tcl_FSAccess and Tcl_FSStat
................................................................................
  1347   1344       void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
  1348   1345   	    int numChars)
  1349   1346   }
  1350   1347   declare 380 {
  1351   1348       int Tcl_GetCharLength(Tcl_Obj *objPtr)
  1352   1349   }
  1353   1350   declare 381 {
  1354         -    Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index)
         1351  +    int Tcl_GetUniChar(Tcl_Obj *objPtr, int index)
  1355   1352   }
  1356         -declare 382 {
         1353  +declare 382 {deprecated {No longer in use, changed to macro}} {
  1357   1354       Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr)
  1358   1355   }
  1359   1356   declare 383 {
  1360   1357       Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
  1361   1358   }
  1362   1359   declare 384 {
  1363   1360       void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
................................................................................
  1404   1401   declare 396 {
  1405   1402       Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan)
  1406   1403   }
  1407   1404   declare 397 {
  1408   1405       int Tcl_ChannelBuffered(Tcl_Channel chan)
  1409   1406   }
  1410   1407   declare 398 {
  1411         -    CONST84_RETURN char *Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr)
         1408  +    const char *Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr)
  1412   1409   }
  1413   1410   declare 399 {
  1414   1411       Tcl_ChannelTypeVersion Tcl_ChannelVersion(
  1415   1412   	    const Tcl_ChannelType *chanTypePtr)
  1416   1413   }
  1417   1414   declare 400 {
  1418   1415       Tcl_DriverBlockModeProc *Tcl_ChannelBlockModeProc(
................................................................................
  1544   1541   
  1545   1542   # introduced in 8.4a3
  1546   1543   declare 434 {
  1547   1544       Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr)
  1548   1545   }
  1549   1546   
  1550   1547   # TIP#15 (math function introspection) dkf
  1551         -declare 435 {
         1548  +declare 435 {deprecated {}} {
  1552   1549       int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name,
  1553   1550   	    int *numArgsPtr, Tcl_ValueType **argTypesPtr,
  1554   1551   	    Tcl_MathProc **procPtr, ClientData *clientDataPtr)
  1555   1552   }
  1556         -declare 436 {
         1553  +declare 436 {deprecated {}} {
  1557   1554       Tcl_Obj *Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern)
  1558   1555   }
  1559   1556   
  1560   1557   # TIP#36 (better access to 'subst') dkf
  1561   1558   declare 437 {
  1562   1559       Tcl_Obj *Tcl_SubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags)
  1563   1560   }
................................................................................
  2328   2325   
  2329   2326   # TIP #456
  2330   2327   declare 631 {
  2331   2328       Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, const char *service,
  2332   2329   	    const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc,
  2333   2330   	    ClientData callbackData)
  2334   2331   }
         2332  +
         2333  +# TIP #430
         2334  +declare 632 {
         2335  +    int TclZipfs_Mount(Tcl_Interp *interp, const char *mountPoint,
         2336  +	    const char *zipname, const char *passwd)
         2337  +}
         2338  +declare 633 {
         2339  +    int TclZipfs_Unmount(Tcl_Interp *interp, const char *mountPoint)
         2340  +}
         2341  +declare 634 {
         2342  +    Tcl_Obj *TclZipfs_TclLibrary(void)
         2343  +}
         2344  +declare 635 {
         2345  +    int TclZipfs_MountBuffer(Tcl_Interp *interp, const char *mountPoint,
         2346  +	    unsigned char *data, size_t datalen, int copy)
         2347  +}
  2335   2348   
  2336   2349   # ----- BASELINE -- FOR -- 8.7.0 ----- #
  2337         -
  2338         -
  2339   2350   
  2340   2351   ##############################################################################
  2341   2352   
  2342   2353   # Define the platform specific public Tcl interface. These functions are only
  2343   2354   # available on the designated platform.
  2344   2355   
  2345   2356   interface tclPlat
................................................................................
  2377   2388   ##############################################################################
  2378   2389   
  2379   2390   # Public functions that are not accessible via the stubs table.
  2380   2391   
  2381   2392   export {
  2382   2393       void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
  2383   2394   }
         2395  +export {
         2396  +    void Tcl_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
         2397  +    Tcl_Interp *interp)
         2398  +}
  2384   2399   export {
  2385   2400       const char *Tcl_InitStubs(Tcl_Interp *interp, const char *version,
  2386   2401   	int exact)
  2387   2402   }
  2388   2403   export {
  2389   2404       const char *TclTomMathInitializeStubs(Tcl_Interp* interp,
  2390   2405   	const char* version, int epoch, int revision)

Changes to generic/tcl.h.

    48     48    * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC
    49     49    * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC
    50     50    * win/README		(not patchlevel) (sections 0 and 2)
    51     51    * unix/tcl.spec	(1 LOC patch)
    52     52    * tools/tcl.hpj.in	(not patchlevel, for windows installer)
    53     53    */
    54     54   
    55         -#define TCL_MAJOR_VERSION   9
    56         -#define TCL_MINOR_VERSION   0
           55  +#define TCL_MAJOR_VERSION   8
           56  +#define TCL_MINOR_VERSION   7
    57     57   #define TCL_RELEASE_LEVEL   TCL_ALPHA_RELEASE
    58         -#define TCL_RELEASE_SERIAL  0
           58  +#define TCL_RELEASE_SERIAL  2
    59     59   
    60         -#define TCL_VERSION	    "9.0"
    61         -#define TCL_PATCH_LEVEL	    "9.0a0"
           60  +#define TCL_VERSION	    "8.7"
           61  +#define TCL_PATCH_LEVEL	    "8.7a2"
    62     62   
    63     63   #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED)
    64     64   /*
    65     65    *----------------------------------------------------------------------------
    66     66    * The following definitions set up the proper options for Windows compilers.
    67     67    * We use this method because there is no autoconf equivalent.
    68     68    */
................................................................................
    85     85   #  define STRINGIFY(x) STRINGIFY1(x)
    86     86   #  define STRINGIFY1(x) #x
    87     87   #endif
    88     88   #ifndef JOIN
    89     89   #  define JOIN(a,b) JOIN1(a,b)
    90     90   #  define JOIN1(a,b) a##b
    91     91   #endif
           92  +
           93  +#ifndef TCL_THREADS
           94  +#   define TCL_THREADS 1
           95  +#endif
    92     96   #endif /* !TCL_NO_DEPRECATED */
    93     97   
    94     98   /*
    95     99    * A special definition used to allow this header file to be included from
    96    100    * windows resource files so that they can obtain version information.
    97    101    * RC_INVOKED is defined by default by the windows RC tool.
    98    102    *
................................................................................
    99    103    * Resource compilers don't like all the C stuff, like typedefs and function
   100    104    * declarations, that occur below, so block them out.
   101    105    */
   102    106   
   103    107   #ifndef RC_INVOKED
   104    108   
   105    109   /*
   106         - * Special macro to define mutexes, that doesn't do anything if we are not
   107         - * using threads.
          110  + * Special macro to define mutexes.
   108    111    */
   109    112   
   110         -#ifdef TCL_THREADS
   111    113   #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name;
   112         -#else
   113         -#define TCL_DECLARE_MUTEX(name)
   114         -#endif
   115    114   
   116    115   /*
   117    116    * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and
   118    117    * SEEK_END, all #define'd by stdio.h .
   119    118    *
   120    119    * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h
   121    120    * providing it for them rather than #include-ing it themselves as they
................................................................................
   133    132    * written for older versions of Tcl where the macros permitted
   134    133    * support for the varargs.h system as well as stdarg.h .
   135    134    *
   136    135    * New code should just directly be written to use stdarg.h conventions.
   137    136    */
   138    137   
   139    138   #include <stdarg.h>
   140         -#ifndef TCL_NO_DEPRECATED
          139  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   141    140   #    define TCL_VARARGS(type, name) (type name, ...)
   142    141   #    define TCL_VARARGS_DEF(type, name) (type name, ...)
   143    142   #    define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
   144    143   #endif /* !TCL_NO_DEPRECATED */
   145    144   #if defined(__GNUC__) && (__GNUC__ > 2)
   146    145   #   define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
   147    146   #   define TCL_NORETURN __attribute__ ((noreturn))
................................................................................
   221    220   
   222    221   /*
   223    222    * These macros are used to control whether functions are being declared for
   224    223    * import or export. If a function is being declared while it is being built
   225    224    * to be included in a shared library, then it should have the DLLEXPORT
   226    225    * storage class. If is being declared for use by a module that is going to
   227    226    * link against the shared library, then it should have the DLLIMPORT storage
   228         - * class. If the symbol is beind declared for a static build or for use from a
          227  + * class. If the symbol is being declared for a static build or for use from a
   229    228    * stub library, then the storage class should be empty.
   230    229    *
   231    230    * The convention is that a macro called BUILD_xxxx, where xxxx is the name of
   232    231    * a library we are building, is set on the compile line for sources that are
   233    232    * to be placed in the library. When this macro is set, the storage class will
   234    233    * be set to DLLEXPORT. At the end of the header file, the storage class will
   235    234    * be reset to DLLIMPORT.
................................................................................
   250    249    * The following _ANSI_ARGS_ macro is to support old extensions
   251    250    * written for older versions of Tcl where it permitted support
   252    251    * for compilers written in the pre-prototype era of C.
   253    252    *
   254    253    * New code should use prototypes.
   255    254    */
   256    255   
   257         -#ifndef TCL_NO_DEPRECATED
          256  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   258    257   #   undef _ANSI_ARGS_
   259    258   #   define _ANSI_ARGS_(x)	x
   260         -#endif /* !TCL_NO_DEPRECATED */
   261    259   
   262    260   /*
   263    261    * Definitions that allow this header file to be used either with or without
   264    262    * ANSI C features.
   265    263    */
   266    264   
   267    265   #ifndef INLINE
   268    266   #   define INLINE
   269    267   #endif
   270         -
   271         -#ifdef NO_CONST
   272         -#   ifndef const
   273         -#      define const
   274         -#   endif
   275         -#endif
   276    268   #ifndef CONST
   277    269   #   define CONST const
   278    270   #endif
   279    271   
   280         -#ifdef USE_NON_CONST
   281         -#   ifdef USE_COMPAT_CONST
   282         -#      error define at most one of USE_NON_CONST and USE_COMPAT_CONST
   283         -#   endif
   284         -#   define CONST84
   285         -#   define CONST84_RETURN
   286         -#else
   287         -#   ifdef USE_COMPAT_CONST
   288         -#      define CONST84
   289         -#      define CONST84_RETURN const
   290         -#   else
   291         -#      define CONST84 const
   292         -#      define CONST84_RETURN const
   293         -#   endif
   294         -#endif
          272  +#endif /* !TCL_NO_DEPRECATED */
   295    273   
   296    274   #ifndef CONST86
   297         -#      define CONST86 CONST84
          275  +#      define CONST86 const
   298    276   #endif
   299    277   
   300    278   /*
   301    279    * Make sure EXTERN isn't defined elsewhere.
   302    280    */
   303    281   
   304    282   #ifdef EXTERN
................................................................................
   314    292   /*
   315    293    *----------------------------------------------------------------------------
   316    294    * The following code is copied from winnt.h. If we don't replicate it here,
   317    295    * then <windows.h> can't be included after tcl.h, since tcl.h also defines
   318    296    * VOID. This block is skipped under Cygwin and Mingw.
   319    297    */
   320    298   
          299  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   321    300   #if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID)
   322    301   #ifndef VOID
   323    302   #define VOID void
   324    303   typedef char CHAR;
   325    304   typedef short SHORT;
   326    305   typedef long LONG;
   327    306   #endif
................................................................................
   329    308   
   330    309   /*
   331    310    * Macro to use instead of "void" for arguments that must have type "void *"
   332    311    * in ANSI C; maps them to type "char *" in non-ANSI systems.
   333    312    */
   334    313   
   335    314   #ifndef __VXWORKS__
   336         -#   ifndef NO_VOID
   337         -#	define VOID void
   338         -#   else
   339         -#	define VOID char
   340         -#   endif
          315  +#   define VOID void
   341    316   #endif
          317  +#endif /* !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 */
   342    318   
   343    319   /*
   344    320    * Miscellaneous declarations.
   345    321    */
   346    322   
   347    323   #ifndef _CLIENTDATA
   348         -#   ifndef NO_VOID
   349         -	typedef void *ClientData;
   350         -#   else
   351         -	typedef int *ClientData;
   352         -#   endif
          324  +    typedef void *ClientData;
   353    325   #   define _CLIENTDATA
   354    326   #endif
   355    327   
   356    328   /*
   357    329    * Darwin specific configure overrides (to support fat compiles, where
   358    330    * configure runs only once for multiple architectures):
   359    331    */
................................................................................
   392    364    * sprintf(...,"%" TCL_LL_MODIFIER "d",...).
   393    365    */
   394    366   
   395    367   #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
   396    368   #   if defined(_WIN32)
   397    369   #      define TCL_WIDE_INT_TYPE __int64
   398    370   #      define TCL_LL_MODIFIER	"I64"
          371  +#      if defined(_WIN64)
          372  +#         define TCL_Z_MODIFIER	"I"
          373  +#      endif
   399    374   #   elif defined(__GNUC__)
   400         -#      define TCL_WIDE_INT_TYPE long long
   401         -#      define TCL_LL_MODIFIER	"ll"
          375  +#      define TCL_Z_MODIFIER	"z"
   402    376   #   else /* ! _WIN32 && ! __GNUC__ */
   403    377   /*
   404    378    * Don't know what platform it is and configure hasn't discovered what is
   405    379    * going on for us. Try to guess...
   406    380    */
   407    381   #      include <limits.h>
   408         -#      if (INT_MAX < LONG_MAX)
          382  +#      if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX)
   409    383   #         define TCL_WIDE_INT_IS_LONG	1
   410         -#      else
   411         -#         define TCL_WIDE_INT_TYPE long long
   412    384   #      endif
   413    385   #   endif /* _WIN32 */
   414    386   #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
   415         -#ifdef TCL_WIDE_INT_IS_LONG
   416         -#   undef TCL_WIDE_INT_TYPE
   417         -#   define TCL_WIDE_INT_TYPE	long
   418         -#endif /* TCL_WIDE_INT_IS_LONG */
          387  +
          388  +#ifndef TCL_WIDE_INT_TYPE
          389  +#   define TCL_WIDE_INT_TYPE		long long
          390  +#endif /* !TCL_WIDE_INT_TYPE */
   419    391   
   420    392   typedef TCL_WIDE_INT_TYPE		Tcl_WideInt;
   421    393   typedef unsigned TCL_WIDE_INT_TYPE	Tcl_WideUInt;
   422    394   
   423         -#ifdef TCL_WIDE_INT_IS_LONG
   424         -#   ifndef TCL_LL_MODIFIER
   425         -#      define TCL_LL_MODIFIER		"l"
   426         -#   endif /* !TCL_LL_MODIFIER */
   427         -#else /* TCL_WIDE_INT_IS_LONG */
   428         -/*
   429         - * The next short section of defines are only done when not running on Windows
   430         - * or some other strange platform.
   431         - */
   432         -#   ifndef TCL_LL_MODIFIER
   433         -#      define TCL_LL_MODIFIER		"ll"
   434         -#   endif /* !TCL_LL_MODIFIER */
   435         -#endif /* TCL_WIDE_INT_IS_LONG */
   436         -
          395  +#ifndef TCL_LL_MODIFIER
          396  +#   define TCL_LL_MODIFIER	"ll"
          397  +#endif /* !TCL_LL_MODIFIER */
          398  +#ifndef TCL_Z_MODIFIER
          399  +#   if defined(__GNUC__) && !defined(_WIN32)
          400  +#	define TCL_Z_MODIFIER	"z"
          401  +#   else
          402  +#	define TCL_Z_MODIFIER	""
          403  +#   endif
          404  +#endif /* !TCL_Z_MODIFIER */
   437    405   #define Tcl_WideAsLong(val)	((long)((Tcl_WideInt)(val)))
   438    406   #define Tcl_LongAsWide(val)	((Tcl_WideInt)((long)(val)))
   439    407   #define Tcl_WideAsDouble(val)	((double)((Tcl_WideInt)(val)))
   440    408   #define Tcl_DoubleAsWide(val)	((Tcl_WideInt)((double)(val)))
   441    409   
   442    410   #if defined(_WIN32)
   443    411   #   ifdef __BORLANDC__
................................................................................
   488    456    * "real" definition in tclInt.h.
   489    457    *
   490    458    * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
   491    459    * Instead, they set a Tcl_Obj member in the "real" structure that can be
   492    460    * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
   493    461    */
   494    462   
   495         -typedef struct Tcl_Interp Tcl_Interp;
          463  +typedef struct Tcl_Interp
          464  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
          465  +{
          466  +    /* TIP #330: Strongly discourage extensions from using the string
          467  +     * result. */
          468  +    char *resultDontUse; /* Don't use in extensions! */
          469  +    void (*freeProcDontUse) (char *); /* Don't use in extensions! */
          470  +    int errorLineDontUse; /* Don't use in extensions! */
          471  +}
          472  +#endif /* !TCL_NO_DEPRECATED */
          473  +Tcl_Interp;
   496    474   
   497    475   typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
   498    476   typedef struct Tcl_Channel_ *Tcl_Channel;
   499    477   typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion;
   500    478   typedef struct Tcl_Command_ *Tcl_Command;
   501    479   typedef struct Tcl_Condition_ *Tcl_Condition;
   502    480   typedef struct Tcl_Dict_ *Tcl_Dict;
................................................................................
   637    615   
   638    616   #define TCL_OK			0
   639    617   #define TCL_ERROR		1
   640    618   #define TCL_RETURN		2
   641    619   #define TCL_BREAK		3
   642    620   #define TCL_CONTINUE		4
   643    621   
          622  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
          623  +#define TCL_RESULT_SIZE		200
          624  +#endif
          625  +
   644    626   /*
   645    627    *----------------------------------------------------------------------------
   646    628    * Flags to control what substitutions are performed by Tcl_SubstObj():
   647    629    */
   648    630   
   649    631   #define TCL_SUBST_COMMANDS	001
   650    632   #define TCL_SUBST_VARIABLES	002
................................................................................
   651    633   #define TCL_SUBST_BACKSLASHES	004
   652    634   #define TCL_SUBST_ALL		007
   653    635   
   654    636   /*
   655    637    * Argument descriptors for math function callbacks in expressions:
   656    638    */
   657    639   
          640  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   658    641   typedef enum {
   659    642       TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
   660    643   } Tcl_ValueType;
   661    644   
   662    645   typedef struct Tcl_Value {
   663    646       Tcl_ValueType type;		/* Indicates intValue or doubleValue is valid,
   664    647   				 * or both. */
   665    648       long intValue;		/* Integer value. */
   666    649       double doubleValue;		/* Double-precision floating value. */
   667    650       Tcl_WideInt wideValue;	/* Wide (min. 64-bit) integer value. */
   668    651   } Tcl_Value;
          652  +#else
          653  +#define Tcl_ValueType void /* Just enough to prevent compilation error in Tcl */
          654  +#define Tcl_Value void /* Just enough to prevent compilation error in Tcl */
          655  +#endif
   669    656   
   670    657   /*
   671    658    * Forward declaration of Tcl_Obj to prevent an error when the forward
   672    659    * reference to Tcl_Obj is encountered in the function types declared below.
   673    660    */
   674    661   
   675    662   struct Tcl_Obj;
................................................................................
   682    669   typedef int (Tcl_AppInitProc) (Tcl_Interp *interp);
   683    670   typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp,
   684    671   	int code);
   685    672   typedef void (Tcl_ChannelProc) (ClientData clientData, int mask);
   686    673   typedef void (Tcl_CloseProc) (ClientData data);
   687    674   typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
   688    675   typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp,
   689         -	int argc, CONST84 char *argv[]);
          676  +	int argc, const char *argv[]);
   690    677   typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp,
   691    678   	int level, char *command, Tcl_CmdProc *proc,
   692         -	ClientData cmdClientData, int argc, CONST84 char *argv[]);
          679  +	ClientData cmdClientData, int argc, const char *argv[]);
   693    680   typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp,
   694    681   	int level, const char *command, Tcl_Command commandInfo, int objc,
   695    682   	struct Tcl_Obj *const *objv);
   696    683   typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData);
   697    684   typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
   698    685   	struct Tcl_Obj *dupPtr);
   699    686   typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src,
................................................................................
   722    709   typedef void (Tcl_PanicProc) (const char *format, ...);
   723    710   typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan,
   724    711   	char *address, int port);
   725    712   typedef void (Tcl_TimerProc) (ClientData clientData);
   726    713   typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr);
   727    714   typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr);
   728    715   typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
   729         -	CONST84 char *part1, CONST84 char *part2, int flags);
          716  +	const char *part1, const char *part2, int flags);
   730    717   typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp,
   731    718   	const char *oldName, const char *newName, int flags);
   732    719   typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc,
   733    720   	ClientData clientData);
   734    721   typedef void (Tcl_DeleteFileHandlerProc) (int fd);
   735    722   typedef void (Tcl_AlertNotifierProc) (ClientData clientData);
   736    723   typedef void (Tcl_ServiceModeHookProc) (int mode);
................................................................................
   821    808   
   822    809   void		Tcl_IncrRefCount(Tcl_Obj *objPtr);
   823    810   void		Tcl_DecrRefCount(Tcl_Obj *objPtr);
   824    811   int		Tcl_IsShared(Tcl_Obj *objPtr);
   825    812   
   826    813   /*
   827    814    *----------------------------------------------------------------------------
   828         - * The following type contains the state needed by Tcl_SaveResult. It
   829         - * is typically allocated on the stack.
          815  + * The following structure contains the state needed by Tcl_SaveResult. No-one
          816  + * outside of Tcl should access any of these fields. This structure is
          817  + * typically allocated on the stack.
   830    818    */
   831    819   
   832         -typedef Tcl_Obj *Tcl_SavedResult;
          820  +typedef struct Tcl_SavedResult {
          821  +    char *result;
          822  +    Tcl_FreeProc *freeProc;
          823  +    Tcl_Obj *objResultPtr;
          824  +    char *appendResult;
          825  +    int appendAvl;
          826  +    int appendUsed;
          827  +    char resultSpace[200+1];
          828  +} Tcl_SavedResult;
   833    829   
   834    830   /*
   835    831    *----------------------------------------------------------------------------
   836    832    * The following definitions support Tcl's namespace facility. Note: the first
   837    833    * five fields must match exactly the fields in a Namespace structure (see
   838    834    * tclInt.h).
   839    835    */
................................................................................
   950    946       char staticSpace[TCL_DSTRING_STATIC_SIZE];
   951    947   				/* Space to use in common case where string is
   952    948   				 * small. */
   953    949   } Tcl_DString;
   954    950   
   955    951   #define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
   956    952   #define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
   957         -#ifndef TCL_NO_DEPRECATED
          953  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   958    954   #   define Tcl_DStringTrunc Tcl_DStringSetLength
   959    955   #endif /* !TCL_NO_DEPRECATED */
   960    956   
   961    957   /*
   962    958    * Definitions for the maximum number of digits of precision that may be
   963    959    * specified in the "tcl_precision" variable, and the number of bytes of
   964    960    * buffer space required by Tcl_PrintDouble.
................................................................................
  1078   1074   /*
  1079   1075    * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  1080   1076    * always parsed whenever the part2 is NULL. (This is to avoid a common error
  1081   1077    * when converting code to use the new object based APIs and forgetting to
  1082   1078    * give the flag)
  1083   1079    */
  1084   1080   
  1085         -#ifndef TCL_NO_DEPRECATED
         1081  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
  1086   1082   #   define TCL_PARSE_PART1	0x400
  1087   1083   #endif /* !TCL_NO_DEPRECATED */
  1088   1084   
  1089   1085   /*
  1090   1086    * Types for linked variables:
  1091   1087    */
  1092   1088   
................................................................................
  1431   1427   typedef int	(Tcl_DriverCloseProc) (ClientData instanceData,
  1432   1428   			Tcl_Interp *interp);
  1433   1429   typedef int	(Tcl_DriverClose2Proc) (ClientData instanceData,
  1434   1430   			Tcl_Interp *interp, int flags);
  1435   1431   typedef int	(Tcl_DriverInputProc) (ClientData instanceData, char *buf,
  1436   1432   			int toRead, int *errorCodePtr);
  1437   1433   typedef int	(Tcl_DriverOutputProc) (ClientData instanceData,
  1438         -			CONST84 char *buf, int toWrite, int *errorCodePtr);
         1434  +			const char *buf, int toWrite, int *errorCodePtr);
  1439   1435   typedef int	(Tcl_DriverSeekProc) (ClientData instanceData, long offset,
  1440   1436   			int mode, int *errorCodePtr);
  1441   1437   typedef int	(Tcl_DriverSetOptionProc) (ClientData instanceData,
  1442   1438   			Tcl_Interp *interp, const char *optionName,
  1443   1439   			const char *value);
  1444   1440   typedef int	(Tcl_DriverGetOptionProc) (ClientData instanceData,
  1445         -			Tcl_Interp *interp, CONST84 char *optionName,
         1441  +			Tcl_Interp *interp, const char *optionName,
  1446   1442   			Tcl_DString *dsPtr);
  1447   1443   typedef void	(Tcl_DriverWatchProc) (ClientData instanceData, int mask);
  1448   1444   typedef int	(Tcl_DriverGetHandleProc) (ClientData instanceData,
  1449   1445   			int direction, ClientData *handlePtr);
  1450   1446   typedef int	(Tcl_DriverFlushProc) (ClientData instanceData);
  1451   1447   typedef int	(Tcl_DriverHandlerProc) (ClientData instanceData,
  1452   1448   			int interestMask);
................................................................................
  1931   1927    *				is described by a TCL_TOKEN_SUB_EXPR token
  1932   1928    *				followed by the TCL_TOKEN_OPERATOR token for
  1933   1929    *				the operator, then TCL_TOKEN_SUB_EXPR tokens
  1934   1930    *				for the left then the right operands.
  1935   1931    * TCL_TOKEN_OPERATOR -		The token describes one expression operator.
  1936   1932    *				An operator might be the name of a math
  1937   1933    *				function such as "abs". A TCL_TOKEN_OPERATOR
  1938         - *				token is always preceeded by one
         1934  + *				token is always preceded by one
  1939   1935    *				TCL_TOKEN_SUB_EXPR token for the operator's
  1940   1936    *				subexpression, and is followed by zero or more
  1941   1937    *				TCL_TOKEN_SUB_EXPR tokens for the operator's
  1942   1938    *				operands. NumComponents is always 0.
  1943   1939    * TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
  1944   1940    *				that it marks a word that began with the
  1945   1941    *				literal character prefix "{*}". This word is
................................................................................
  2145   2141   #define TCL_CONVERT_MULTIBYTE	(-1)
  2146   2142   #define TCL_CONVERT_SYNTAX	(-2)
  2147   2143   #define TCL_CONVERT_UNKNOWN	(-3)
  2148   2144   #define TCL_CONVERT_NOSPACE	(-4)
  2149   2145   
  2150   2146   /*
  2151   2147    * The maximum number of bytes that are necessary to represent a single
  2152         - * Unicode character in UTF-8. The valid values should be 3, 4 or 6
  2153         - * (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or
  2154         - * 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
         2148  + * Unicode character in UTF-8. The valid values are 4 and 6
         2149  + * (or perhaps 1 if we want to support a non-unicode enabled core). If 4,
         2150  + * then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
  2155   2151    * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
  2156   2152    * is the default and recommended mode. UCS-4 is experimental and not
  2157   2153    * recommended. It works for the core, but most extensions expect UCS-2.
  2158   2154    */
  2159   2155   
  2160   2156   #ifndef TCL_UTF_MAX
  2161         -#define TCL_UTF_MAX		3
         2157  +#define TCL_UTF_MAX		4
  2162   2158   #endif
  2163   2159   
  2164   2160   /*
  2165   2161    * This represents a Unicode character. Any changes to this should also be
  2166   2162    * reflected in regcustom.h.
  2167   2163    */
  2168   2164   
................................................................................
  2333   2329   /*
  2334   2330    *----------------------------------------------------------------------------
  2335   2331    * Definitions needed for the Tcl_OpenTcpServerEx function. [TIP #456]
  2336   2332    */
  2337   2333   #define TCL_TCPSERVER_REUSEADDR (1<<0)
  2338   2334   #define TCL_TCPSERVER_REUSEPORT (1<<1)
  2339   2335   
         2336  +/*
         2337  + * Constants for special int-typed values, see TIP #494
         2338  + */
         2339  +
         2340  +#define TCL_IO_FAILURE	(-1)
         2341  +#define TCL_AUTO_LENGTH	(-1)
         2342  +
  2340   2343   /*
  2341   2344    *----------------------------------------------------------------------------
  2342   2345    * Single public declaration for NRE.
  2343   2346    */
  2344   2347   
  2345   2348   typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
  2346   2349   				int result);
  2347   2350   
  2348   2351   /*
  2349   2352    *----------------------------------------------------------------------------
  2350   2353    * The following constant is used to test for older versions of Tcl in the
  2351         - * stubs tables.
         2354  + * stubs tables. If TCL_UTF_MAX>4 use a different value.
  2352   2355    */
  2353   2356   
  2354         -#define TCL_STUB_MAGIC		((int) 0xFCA3BACF)
         2357  +#define TCL_STUB_MAGIC		((int) 0xFCA3BACF + (TCL_UTF_MAX>4))
  2355   2358   
  2356   2359   /*
  2357   2360    * The following function is required to be defined in all stubs aware
  2358   2361    * extensions. The function is actually implemented in the stub library, not
  2359   2362    * the main Tcl library, although there is a trivial implementation in the
  2360   2363    * main library in case an extension is statically linked into an application.
  2361   2364    */
  2362   2365   
  2363   2366   const char *		Tcl_InitStubs(Tcl_Interp *interp, const char *version,
  2364   2367   			    int exact, int magic);
  2365   2368   const char *		TclTomMathInitializeStubs(Tcl_Interp *interp,
  2366   2369   			    const char *version, int epoch, int revision);
         2370  +#if defined(_WIN32)
         2371  +    TCL_NORETURN void Tcl_ConsolePanic(const char *format, ...);
         2372  +#else
         2373  +#   define Tcl_ConsolePanic ((Tcl_PanicProc *)0)
         2374  +#endif
  2367   2375   
  2368   2376   #ifdef USE_TCL_STUBS
  2369   2377   #if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
  2370   2378   #   define Tcl_InitStubs(interp, version, exact) \
  2371   2379   	(Tcl_InitStubs)(interp, version, \
  2372   2380   	    (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \
  2373   2381   	    TCL_STUB_MAGIC)
................................................................................
  2391   2399   
  2392   2400   /*
  2393   2401    * Public functions that are not accessible via the stubs table.
  2394   2402    * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171]
  2395   2403    */
  2396   2404   
  2397   2405   #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
  2398         -	    ((Tcl_CreateInterp)()))
         2406  +	    (((Tcl_SetPanicProc)(Tcl_ConsolePanic), Tcl_CreateInterp)()))
  2399   2407   EXTERN void		Tcl_MainEx(int argc, char **argv,
  2400   2408   			    Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
  2401   2409   EXTERN const char *	Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
  2402   2410   			    const char *version, int exact);
  2403   2411   EXTERN void		Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
         2412  +#ifndef _WIN32
         2413  +EXTERN int		TclZipfs_AppHook(int *argc, char ***argv);
         2414  +#endif
  2404   2415   
  2405   2416   /*
  2406   2417    *----------------------------------------------------------------------------
  2407   2418    * Include the public function declarations that are accessible via the stubs
  2408   2419    * table.
  2409   2420    */
  2410   2421   
................................................................................
  2510   2521        Tcl_DbNewLongObj((val)!=0, __FILE__, __LINE__)
  2511   2522   #  undef  Tcl_NewByteArrayObj
  2512   2523   #  define Tcl_NewByteArrayObj(bytes, len) \
  2513   2524        Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
  2514   2525   #  undef  Tcl_NewDoubleObj
  2515   2526   #  define Tcl_NewDoubleObj(val) \
  2516   2527        Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
  2517         -#  undef  Tcl_NewIntObj
  2518         -#  define Tcl_NewIntObj(val) \
  2519         -     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
  2520   2528   #  undef  Tcl_NewListObj
  2521   2529   #  define Tcl_NewListObj(objc, objv) \
  2522   2530        Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)
  2523         -#  undef  Tcl_NewLongObj
  2524         -#  define Tcl_NewLongObj(val) \
  2525         -     Tcl_DbNewLongObj(val, __FILE__, __LINE__)
  2526   2531   #  undef  Tcl_NewObj
  2527   2532   #  define Tcl_NewObj() \
  2528   2533        Tcl_DbNewObj(__FILE__, __LINE__)
  2529   2534   #  undef  Tcl_NewStringObj
  2530   2535   #  define Tcl_NewStringObj(bytes, len) \
  2531   2536        Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__)
  2532   2537   #  undef  Tcl_NewWideIntObj
................................................................................
  2555   2560   #undef  Tcl_FindHashEntry
  2556   2561   #define Tcl_FindHashEntry(tablePtr, key) \
  2557   2562   	(*((tablePtr)->findProc))(tablePtr, (const char *)(key))
  2558   2563   #undef  Tcl_CreateHashEntry
  2559   2564   #define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
  2560   2565   	(*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr)
  2561   2566   
  2562         -/*
  2563         - *----------------------------------------------------------------------------
  2564         - * Macros that eliminate the overhead of the thread synchronization functions
  2565         - * when compiling without thread support.
  2566         - */
  2567         -
  2568         -#ifndef TCL_THREADS
  2569         -#undef  Tcl_MutexLock
  2570         -#define Tcl_MutexLock(mutexPtr)
  2571         -#undef  Tcl_MutexUnlock
  2572         -#define Tcl_MutexUnlock(mutexPtr)
  2573         -#undef  Tcl_MutexFinalize
  2574         -#define Tcl_MutexFinalize(mutexPtr)
  2575         -#undef  Tcl_ConditionNotify
  2576         -#define Tcl_ConditionNotify(condPtr)
  2577         -#undef  Tcl_ConditionWait
  2578         -#define Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
  2579         -#undef  Tcl_ConditionFinalize
  2580         -#define Tcl_ConditionFinalize(condPtr)
  2581         -#endif /* TCL_THREADS */
  2582         -
  2583   2567   /*
  2584   2568    *----------------------------------------------------------------------------
  2585   2569    * Deprecated Tcl functions:
  2586   2570    */
  2587   2571   
  2588         -#ifndef TCL_NO_DEPRECATED
         2572  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
  2589   2573   /*
  2590   2574    * These function have been renamed. The old names are deprecated, but we
  2591         - * define these macros for backwards compatibilty.
         2575  + * define these macros for backwards compatibility.
  2592   2576    */
  2593   2577   
  2594   2578   #   define Tcl_Ckalloc		Tcl_Alloc
  2595   2579   #   define Tcl_Ckfree		Tcl_Free
  2596   2580   #   define Tcl_Ckrealloc	Tcl_Realloc
  2597   2581   #   define Tcl_Return		Tcl_SetResult
  2598   2582   #   define Tcl_TildeSubst	Tcl_TranslateFileName

Changes to generic/tclAlloc.c.

    18     18   
    19     19   /*
    20     20    * Windows and Unix use an alternative allocator when building with threads
    21     21    * that has significantly reduced lock contention.
    22     22    */
    23     23   
    24     24   #include "tclInt.h"
    25         -#if !defined(TCL_THREADS) || !defined(USE_THREAD_ALLOC)
           25  +#if !TCL_THREADS || !defined(USE_THREAD_ALLOC)
    26     26   
    27     27   #if USE_TCLALLOC
    28     28   
    29     29   /*
    30     30    * We should really make use of AC_CHECK_TYPE(caddr_t) here, but it can wait
    31     31    * until Tcl uses config.h properly.
    32     32    */
................................................................................
   117    117   /*
   118    118    * The allocator is protected by a special mutex that must be explicitly
   119    119    * initialized. Futhermore, because Tcl_Alloc may be used before anything else
   120    120    * in Tcl, we make this module self-initializing after all with the allocInit
   121    121    * variable.
   122    122    */
   123    123   
   124         -#ifdef TCL_THREADS
          124  +#if TCL_THREADS
   125    125   static Tcl_Mutex *allocMutexPtr;
   126    126   #endif
   127    127   static int allocInit = 0;
   128    128   
   129    129   #ifdef MSTATS
   130    130   
   131    131   /*
................................................................................
   167    167    */
   168    168   
   169    169   void
   170    170   TclInitAlloc(void)
   171    171   {
   172    172       if (!allocInit) {
   173    173   	allocInit = 1;
   174         -#ifdef TCL_THREADS
          174  +#if TCL_THREADS
   175    175   	allocMutexPtr = Tcl_GetAllocMutex();
   176    176   #endif
   177    177       }
   178    178   }
   179    179   
   180    180   /*
   181    181    *-------------------------------------------------------------------------
................................................................................
   657    657   	    fprintf(stderr, " %u", j);
   658    658   	}
   659    659   	totalFree += ((size_t)j) * (1 << (i + 3));
   660    660       }
   661    661   
   662    662       fprintf(stderr, "\nused:\t");
   663    663       for (i = 0; i < NBUCKETS; i++) {
   664         -	fprintf(stderr, " %" TCL_LL_MODIFIER "d", (Tcl_WideInt)numMallocs[i]);
          664  +	fprintf(stderr, " %" TCL_Z_MODIFIER "u", numMallocs[i]);
   665    665   	totalUsed += numMallocs[i] * (1 << (i + 3));
   666    666       }
   667    667   
   668         -    fprintf(stderr, "\n\tTotal small in use: %" TCL_LL_MODIFIER "d, total free: %" TCL_LL_MODIFIER "d\n",
   669         -	(Tcl_WideInt)totalUsed, (Tcl_WideInt)totalFree);
   670         -    fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_LL_MODIFIER "d\n",
   671         -	    MAXMALLOC, (Tcl_WideInt)numMallocs[NBUCKETS]);
          668  +    fprintf(stderr, "\n\tTotal small in use: %" TCL_Z_MODIFIER "u, total free: %" TCL_Z_MODIFIER "u\n",
          669  +	totalUsed, totalFree);
          670  +    fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_Z_MODIFIER "u\n",
          671  +	    MAXMALLOC, numMallocs[NBUCKETS]);
   672    672   
   673    673       Tcl_MutexUnlock(allocMutexPtr);
   674    674   }
   675    675   #endif
   676    676   
   677    677   #else	/* !USE_TCLALLOC */
   678    678   

Changes to generic/tclAssembly.c.

  2242   2242       CompileEnv* envPtr = assemEnvPtr->envPtr;
  2243   2243   				/* Compilation environment */
  2244   2244       Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
  2245   2245   				/* Tcl interpreter */
  2246   2246       Tcl_Token* tokenPtr = *tokenPtrPtr;
  2247   2247   				/* INOUT: Pointer to the next token in the
  2248   2248   				 * source code */
  2249         -    Tcl_Obj* intObj;		/* Integer from the source code */
  2250         -    int status;			/* Tcl status return */
         2249  +    Tcl_Obj *value;
         2250  +    int status;
  2251   2251   
  2252         -    /*
  2253         -     * Extract the next token as a string.
  2254         -     */
  2255         -
  2256         -    if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &intObj) != TCL_OK) {
         2252  +    /* General operand validity check */
         2253  +    if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &value) != TCL_OK) {
  2257   2254   	return TCL_ERROR;
  2258   2255       }
  2259   2256   
         2257  +    /* Convert to an integer, advance to the next token and return. */
  2260   2258       /*
  2261         -     * Convert to an integer, advance to the next token and return.
         2259  +     * NOTE: Indexing a list with an index before it yields the
         2260  +     * same result as indexing after it, and might be more easily portable
         2261  +     * when list size limits grow.
  2262   2262        */
         2263  +    status = TclIndexEncode(interp, value,
         2264  +	    TCL_INDEX_BEFORE,TCL_INDEX_BEFORE, result);
  2263   2265   
  2264         -    status = TclGetIntForIndex(interp, intObj, -2, result);
  2265         -    Tcl_DecrRefCount(intObj);
         2266  +    Tcl_DecrRefCount(value);
  2266   2267       *tokenPtrPtr = TokenAfter(tokenPtr);
  2267   2268       return status;
  2268   2269   }
  2269   2270   
  2270   2271   /*
  2271   2272    *-----------------------------------------------------------------------------
  2272   2273    *
................................................................................
  4262   4263   
  4263   4264       Tcl_AddErrorInfo(interp, "\n    in assembly code between lines ");
  4264   4265       lineNo = Tcl_NewIntObj(bbPtr->startLine);
  4265   4266       Tcl_IncrRefCount(lineNo);
  4266   4267       Tcl_AppendObjToErrorInfo(interp, lineNo);
  4267   4268       Tcl_AddErrorInfo(interp, " and ");
  4268   4269       if (bbPtr->successor1 != NULL) {
  4269         -	TclSetLongObj(lineNo, bbPtr->successor1->startLine);
         4270  +	TclSetIntObj(lineNo, bbPtr->successor1->startLine);
  4270   4271   	Tcl_AppendObjToErrorInfo(interp, lineNo);
  4271   4272       } else {
  4272   4273   	Tcl_AddErrorInfo(interp, "end of assembly code");
  4273   4274       }
  4274   4275       Tcl_DecrRefCount(lineNo);
  4275   4276   }
  4276   4277   

Changes to generic/tclBasic.c.

    67     67   				 * a default result. */
    68     68       int length;			/* Length of the above error message. */
    69     69       ClientData clientData;	/* Ignored */
    70     70       int flags;			/* Additional flags */
    71     71   } CancelInfo;
    72     72   static Tcl_HashTable cancelTable;
    73     73   static int cancelTableInitialized = 0;	/* 0 means not yet initialized. */
    74         -TCL_DECLARE_MUTEX(cancelLock)
           74  +TCL_DECLARE_MUTEX(cancelLock);
           75  +
           76  +/*
           77  + * Table used to map command implementation functions to a human-readable type
           78  + * name, for [info type]. The keys in the table are function addresses, and
           79  + * the values in the table are static char* containing strings in Tcl's
           80  + * internal encoding (almost UTF-8).
           81  + */
           82  +
           83  +static Tcl_HashTable commandTypeTable;
           84  +static int commandTypeInit = 0;
           85  +TCL_DECLARE_MUTEX(commandTypeLock);
    75     86   
    76     87   /*
    77     88    * Declarations for managing contexts for non-recursive coroutines. Contexts
    78     89    * are used to save the evaluation state between NR calls to each coro.
    79     90    */
    80     91   
    81     92   #define SAVE_CONTEXT(context)				\
................................................................................
    90    101       iPtr->cmdFramePtr = (context).cmdFramePtr;		\
    91    102       iPtr->lineLABCPtr = (context).lineLABCPtr
    92    103   
    93    104   /*
    94    105    * Static functions in this file:
    95    106    */
    96    107   
          108  +static Tcl_ObjCmdProc   BadEnsembleSubcommand;
    97    109   static char *		CallCommandTraces(Interp *iPtr, Command *cmdPtr,
    98    110   			    const char *oldName, const char *newName,
    99    111   			    int flags);
   100    112   static int		CancelEvalProc(ClientData clientData,
   101    113   			    Tcl_Interp *interp, int code);
   102    114   static int		CheckDoubleResult(Tcl_Interp *interp, double dResult);
   103    115   static void		DeleteCoroutine(ClientData clientData);
................................................................................
   110    122   #   define DTraceCmdReturn	NULL
   111    123   #endif /* USE_DTRACE */
   112    124   static Tcl_ObjCmdProc	ExprAbsFunc;
   113    125   static Tcl_ObjCmdProc	ExprBinaryFunc;
   114    126   static Tcl_ObjCmdProc	ExprBoolFunc;
   115    127   static Tcl_ObjCmdProc	ExprCeilFunc;
   116    128   static Tcl_ObjCmdProc	ExprDoubleFunc;
   117         -static Tcl_ObjCmdProc	ExprEntierFunc;
   118    129   static Tcl_ObjCmdProc	ExprFloorFunc;
   119    130   static Tcl_ObjCmdProc	ExprIntFunc;
   120    131   static Tcl_ObjCmdProc	ExprIsqrtFunc;
          132  +static Tcl_ObjCmdProc	ExprMaxFunc;
          133  +static Tcl_ObjCmdProc	ExprMinFunc;
   121    134   static Tcl_ObjCmdProc	ExprRandFunc;
   122    135   static Tcl_ObjCmdProc	ExprRoundFunc;
   123    136   static Tcl_ObjCmdProc	ExprSqrtFunc;
   124    137   static Tcl_ObjCmdProc	ExprSrandFunc;
   125    138   static Tcl_ObjCmdProc	ExprUnaryFunc;
   126    139   static Tcl_ObjCmdProc	ExprWideFunc;
   127    140   static void		MathFuncWrongNumArgs(Tcl_Interp *interp, int expected,
   128    141   			    int actual, Tcl_Obj *const *objv);
   129    142   static Tcl_NRPostProc	NRCoroutineCallerCallback;
   130    143   static Tcl_NRPostProc	NRCoroutineExitCallback;
   131    144   static Tcl_NRPostProc	NRCommand;
   132    145   
          146  +#if !defined(TCL_NO_DEPRECATED)
   133    147   static Tcl_ObjCmdProc	OldMathFuncProc;
   134    148   static void		OldMathFuncDeleteProc(ClientData clientData);
          149  +#endif /* !defined(TCL_NO_DEPRECATED) */
   135    150   static void		ProcessUnexpectedResult(Tcl_Interp *interp,
   136    151   			    int returnCode);
   137    152   static int		RewindCoroutine(CoroutineData *corPtr, int result);
   138    153   static void		TEOV_SwitchVarFrame(Tcl_Interp *interp);
   139    154   static void		TEOV_PushExceptionHandlers(Tcl_Interp *interp,
   140    155   			    int objc, Tcl_Obj *const objv[], int flags);
   141    156   static inline Command *	TEOV_LookupCmdFromObj(Tcl_Interp *interp,
................................................................................
   187    202   #define CMD_IS_SAFE         1   /* Whether this command is part of the set of
   188    203                                    * commands present by default in a safe
   189    204                                    * interpreter. */
   190    205   /* CMD_COMPILES_EXPANDED - Whether the compiler for this command can handle
   191    206    * expansion for itself rather than needing the generic layer to take care of
   192    207    * it for it. Defined in tclInt.h. */
   193    208   
          209  +/*
          210  + * The following struct states that the command it talks about (a subcommand
          211  + * of one of Tcl's built-in ensembles) is unsafe and must be hidden when an
          212  + * interpreter is made safe. (TclHideUnsafeCommands accesses an array of these
          213  + * structs.) Alas, we can't sensibly just store the information directly in
          214  + * the commands.
          215  + */
          216  +
          217  +typedef struct {
          218  +    const char *ensembleNsName; /* The ensemble's name within ::tcl. NULL for
          219  +                                 * the end of the list of commands to hide. */
          220  +    const char *commandName;    /* The name of the command within the
          221  +                                 * ensemble. If this is NULL, we want to also
          222  +                                 * make the overall command be hidden, an ugly
          223  +                                 * hack because it is expected by security
          224  +                                 * policies in the wild. */
          225  +} UnsafeEnsembleInfo;
          226  +
   194    227   /*
   195    228    * The built-in commands, and the functions that implement them:
   196    229    */
   197    230   
   198    231   static const CmdInfo builtInCmds[] = {
   199    232       /*
   200    233        * Commands in the generic core.
   201    234        */
   202    235   
   203    236       {"append",		Tcl_AppendObjCmd,	TclCompileAppendCmd,	NULL,	CMD_IS_SAFE},
   204    237       {"apply",		Tcl_ApplyObjCmd,	NULL,			TclNRApplyObjCmd,	CMD_IS_SAFE},
   205    238       {"break",		Tcl_BreakObjCmd,	TclCompileBreakCmd,	NULL,	CMD_IS_SAFE},
   206         -#ifndef TCL_NO_DEPRECATED
          239  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   207    240       {"case",		Tcl_CaseObjCmd,		NULL,			NULL,	CMD_IS_SAFE},
   208    241   #endif
   209    242       {"catch",		Tcl_CatchObjCmd,	TclCompileCatchCmd,	TclNRCatchObjCmd,	CMD_IS_SAFE},
   210    243       {"concat",		Tcl_ConcatObjCmd,	TclCompileConcatCmd,	NULL,	CMD_IS_SAFE},
   211    244       {"continue",	Tcl_ContinueObjCmd,	TclCompileContinueCmd,	NULL,	CMD_IS_SAFE},
   212    245       {"coroutine",	NULL,			NULL,			TclNRCoroutineObjCmd,	CMD_IS_SAFE},
   213    246       {"error",		Tcl_ErrorObjCmd,	TclCompileErrorCmd,	NULL,	CMD_IS_SAFE},
................................................................................
   230    263       {"lrange",		Tcl_LrangeObjCmd,	TclCompileLrangeCmd,	NULL,	CMD_IS_SAFE},
   231    264       {"lrepeat",		Tcl_LrepeatObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   232    265       {"lreplace",	Tcl_LreplaceObjCmd,	TclCompileLreplaceCmd,	NULL,	CMD_IS_SAFE},
   233    266       {"lreverse",	Tcl_LreverseObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   234    267       {"lsearch",		Tcl_LsearchObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   235    268       {"lset",		Tcl_LsetObjCmd,		TclCompileLsetCmd,	NULL,	CMD_IS_SAFE},
   236    269       {"lsort",		Tcl_LsortObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   237         -    {"package",		Tcl_PackageObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
          270  +    {"package",		Tcl_PackageObjCmd,	NULL,			TclNRPackageObjCmd,	CMD_IS_SAFE},
   238    271       {"proc",		Tcl_ProcObjCmd,		NULL,			NULL,	CMD_IS_SAFE},
   239    272       {"regexp",		Tcl_RegexpObjCmd,	TclCompileRegexpCmd,	NULL,	CMD_IS_SAFE},
   240    273       {"regsub",		Tcl_RegsubObjCmd,	TclCompileRegsubCmd,	NULL,	CMD_IS_SAFE},
   241    274       {"rename",		Tcl_RenameObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   242    275       {"return",		Tcl_ReturnObjCmd,	TclCompileReturnCmd,	NULL,	CMD_IS_SAFE},
   243    276       {"scan",		Tcl_ScanObjCmd,		NULL,			NULL,	CMD_IS_SAFE},
   244    277       {"set",		Tcl_SetObjCmd,		TclCompileSetCmd,	NULL,	CMD_IS_SAFE},
................................................................................
   287    320       {"time",		Tcl_TimeObjCmd,		NULL,			NULL,	CMD_IS_SAFE},
   288    321       {"unload",		Tcl_UnloadObjCmd,	NULL,			NULL,	0},
   289    322       {"update",		Tcl_UpdateObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   290    323       {"vwait",		Tcl_VwaitObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   291    324       {NULL,		NULL,			NULL,			NULL,	0}
   292    325   };
   293    326   
          327  +/*
          328  + * Information about which pieces of ensembles to hide when making an
          329  + * interpreter safe:
          330  + */
          331  +
          332  +static const UnsafeEnsembleInfo unsafeEnsembleCommands[] = {
          333  +    /* [encoding] has two unsafe commands. Assumed by older security policies
          334  +     * to be overall unsafe; it isn't but... */
          335  +    {"encoding", NULL},
          336  +    {"encoding", "dirs"},
          337  +    {"encoding", "system"},
          338  +    /* [file] has MANY unsafe commands! Assumed by older security policies to
          339  +     * be overall unsafe; it isn't but... */
          340  +    {"file", NULL},
          341  +    {"file", "atime"},
          342  +    {"file", "attributes"},
          343  +    {"file", "copy"},
          344  +    {"file", "delete"},
          345  +    {"file", "dirname"},
          346  +    {"file", "executable"},
          347  +    {"file", "exists"},
          348  +    {"file", "extension"},
          349  +    {"file", "isdirectory"},
          350  +    {"file", "isfile"},
          351  +    {"file", "link"},
          352  +    {"file", "lstat"},
          353  +    {"file", "mtime"},
          354  +    {"file", "mkdir"},
          355  +    {"file", "nativename"},
          356  +    {"file", "normalize"},
          357  +    {"file", "owned"},
          358  +    {"file", "readable"},
          359  +    {"file", "readlink"},
          360  +    {"file", "rename"},
          361  +    {"file", "rootname"},
          362  +    {"file", "size"},
          363  +    {"file", "stat"},
          364  +    {"file", "tail"},
          365  +    {"file", "tempfile"},
          366  +    {"file", "type"},
          367  +    {"file", "volumes"},
          368  +    {"file", "writable"},
          369  +    /* [info] has two unsafe commands */
          370  +    {"info", "cmdtype"},
          371  +    {"info", "nameofexecutable"},
          372  +    /* [tcl::process] has ONLY unsafe commands! */
          373  +    {"process", "list"},
          374  +    {"process", "status"},
          375  +    {"process", "purge"},
          376  +    {"process", "autopurge"},
          377  +    /* [zipfs] has MANY unsafe commands! */
          378  +    {"zipfs", "lmkimg"},
          379  +    {"zipfs", "lmkzip"},
          380  +    {"zipfs", "mkimg"},
          381  +    {"zipfs", "mkkey"},
          382  +    {"zipfs", "mkzip"},
          383  +    {"zipfs", "mount"},
          384  +    {"zipfs", "mount_data"},
          385  +    {"zipfs", "unmount"},
          386  +    {NULL, NULL}
          387  +};
          388  +
   294    389   /*
   295    390    * Math functions. All are safe.
   296    391    */
   297    392   
   298    393   typedef struct {
   299    394       const char *name;		/* Name of the function. The full name is
   300    395   				 * "::tcl::mathfunc::<name>". */
................................................................................
   308    403       { "atan",	ExprUnaryFunc,	(ClientData) atan	},
   309    404       { "atan2",	ExprBinaryFunc,	(ClientData) atan2	},
   310    405       { "bool",	ExprBoolFunc,	NULL			},
   311    406       { "ceil",	ExprCeilFunc,	NULL			},
   312    407       { "cos",	ExprUnaryFunc,	(ClientData) cos	},
   313    408       { "cosh",	ExprUnaryFunc,	(ClientData) cosh	},
   314    409       { "double",	ExprDoubleFunc,	NULL			},
   315         -    { "entier",	ExprEntierFunc,	NULL			},
          410  +    { "entier",	ExprIntFunc,	NULL			},
   316    411       { "exp",	ExprUnaryFunc,	(ClientData) exp	},
   317    412       { "floor",	ExprFloorFunc,	NULL			},
   318    413       { "fmod",	ExprBinaryFunc,	(ClientData) fmod	},
   319    414       { "hypot",	ExprBinaryFunc,	(ClientData) hypot	},
   320    415       { "int",	ExprIntFunc,	NULL			},
   321    416       { "isqrt",	ExprIsqrtFunc,	NULL			},
   322    417       { "log",	ExprUnaryFunc,	(ClientData) log	},
   323    418       { "log10",	ExprUnaryFunc,	(ClientData) log10	},
          419  +    { "max",	ExprMaxFunc,	NULL			},
          420  +    { "min",	ExprMinFunc,	NULL			},
   324    421       { "pow",	ExprBinaryFunc,	(ClientData) pow	},
   325    422       { "rand",	ExprRandFunc,	NULL			},
   326    423       { "round",	ExprRoundFunc,	NULL			},
   327    424       { "sin",	ExprUnaryFunc,	(ClientData) sin	},
   328    425       { "sinh",	ExprUnaryFunc,	(ClientData) sinh	},
   329    426       { "sqrt",	ExprSqrtFunc,	NULL			},
   330    427       { "srand",	ExprSrandFunc,	NULL			},
................................................................................
   421    518   {
   422    519       Tcl_MutexLock(&cancelLock);
   423    520       if (cancelTableInitialized == 1) {
   424    521   	Tcl_DeleteHashTable(&cancelTable);
   425    522   	cancelTableInitialized = 0;
   426    523       }
   427    524       Tcl_MutexUnlock(&cancelLock);
          525  +
          526  +    Tcl_MutexLock(&commandTypeLock);
          527  +    if (commandTypeInit) {
          528  +        Tcl_DeleteHashTable(&commandTypeTable);
          529  +        commandTypeInit = 0;
          530  +    }
          531  +    Tcl_MutexUnlock(&commandTypeLock);
   428    532   }
   429    533   
   430    534   /*
   431    535    *----------------------------------------------------------------------
   432    536    *
   433    537    * Tcl_CreateInterp --
   434    538    *
................................................................................
   494    598   
   495    599       if (cancelTableInitialized == 0) {
   496    600   	Tcl_MutexLock(&cancelLock);
   497    601   	if (cancelTableInitialized == 0) {
   498    602   	    Tcl_InitHashTable(&cancelTable, TCL_ONE_WORD_KEYS);
   499    603   	    cancelTableInitialized = 1;
   500    604   	}
          605  +
   501    606   	Tcl_MutexUnlock(&cancelLock);
   502    607       }
          608  +
          609  +    if (commandTypeInit == 0) {
          610  +        TclRegisterCommandTypeName(TclObjInterpProc, "proc");
          611  +        TclRegisterCommandTypeName(TclEnsembleImplementationCmd, "ensemble");
          612  +        TclRegisterCommandTypeName(TclAliasObjCmd, "alias");
          613  +        TclRegisterCommandTypeName(TclLocalAliasObjCmd, "alias");
          614  +        TclRegisterCommandTypeName(TclSlaveObjCmd, "slave");
          615  +        TclRegisterCommandTypeName(TclInvokeImportedCmd, "import");
          616  +        TclRegisterCommandTypeName(TclOOPublicObjectCmd, "object");
          617  +        TclRegisterCommandTypeName(TclOOPrivateObjectCmd, "privateObject");
          618  +        TclRegisterCommandTypeName(TclOOMyClassObjCmd, "privateClass");
          619  +        TclRegisterCommandTypeName(TclNRInterpCoroutine, "coroutine");
          620  +    }
   503    621   
   504    622       /*
   505    623        * Initialize support for namespaces and create the global namespace
   506    624        * (whose name is ""; an alias is "::"). This also initializes the Tcl
   507    625        * object type table and other object management code.
   508    626        */
   509    627   
   510    628       iPtr = ckalloc(sizeof(Interp));
   511    629       interp = (Tcl_Interp *) iPtr;
   512    630   
   513         -    iPtr->legacyResult = NULL;
   514         -    /* Special invalid value: Any attempt to free the legacy result
   515         -     * will cause a crash. */
   516         -    iPtr->legacyFreeProc = (void (*) (void))-1;
          631  +#ifdef TCL_NO_DEPRECATED
          632  +    iPtr->result = &tclEmptyString;
          633  +#else
          634  +    iPtr->result = iPtr->resultSpace;
          635  +#endif
          636  +    iPtr->freeProc = NULL;
   517    637       iPtr->errorLine = 0;
   518         -    iPtr->stubTable = &tclStubs;
   519    638       iPtr->objResultPtr = Tcl_NewObj();
   520    639       Tcl_IncrRefCount(iPtr->objResultPtr);
   521    640       iPtr->handle = TclHandleCreate(iPtr);
   522    641       iPtr->globalNsPtr = NULL;
   523    642       iPtr->hiddenCmdTablePtr = NULL;
   524    643       iPtr->interpInfo = NULL;
   525    644   
................................................................................
   568    687       TclNewLiteralStringObj(iPtr->ecVar, "::errorCode");
   569    688       Tcl_IncrRefCount(iPtr->ecVar);
   570    689       iPtr->returnLevel = 1;
   571    690       iPtr->returnCode = TCL_OK;
   572    691   
   573    692       iPtr->rootFramePtr = NULL;	/* Initialise as soon as :: is available */
   574    693       iPtr->lookupNsPtr = NULL;
          694  +
          695  +#ifndef TCL_NO_DEPRECATED
          696  +    iPtr->appendResult = NULL;
          697  +    iPtr->appendAvl = 0;
          698  +    iPtr->appendUsed = 0;
          699  +#endif
   575    700   
   576    701       Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
   577    702       iPtr->packageUnknown = NULL;
   578    703   
   579    704       /* TIP #268 */
   580    705   #if (TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE)
   581    706       if (getenv("TCL_PKG_PREFER_LATEST") == NULL) {
................................................................................
   597    722       iPtr->activeCmdTracePtr = NULL;
   598    723       iPtr->activeInterpTracePtr = NULL;
   599    724       iPtr->assocData = NULL;
   600    725       iPtr->execEnvPtr = NULL;	/* Set after namespaces initialized. */
   601    726       iPtr->emptyObjPtr = Tcl_NewObj();
   602    727   				/* Another empty object. */
   603    728       Tcl_IncrRefCount(iPtr->emptyObjPtr);
          729  +#ifndef TCL_NO_DEPRECATED
          730  +    iPtr->resultSpace[0] = 0;
          731  +#endif
   604    732       iPtr->threadId = Tcl_GetCurrentThread();
   605    733   
   606    734       /* TIP #378 */
   607    735   #ifdef TCL_INTERP_DEBUG_FRAME
   608    736       iPtr->flags |= INTERP_DEBUG_FRAME;
   609    737   #else
   610    738       if (getenv("TCL_INTERP_DEBUG_FRAME") != NULL) {
................................................................................
   706    834   
   707    835       statsPtr->numLiteralsCreated = 0;
   708    836       statsPtr->totalLitStringBytes = 0.0;
   709    837       statsPtr->currentLitStringBytes = 0.0;
   710    838       memset(statsPtr->literalCount, 0, sizeof(statsPtr->literalCount));
   711    839   #endif /* TCL_COMPILE_STATS */
   712    840   
          841  +    /*
          842  +     * Initialise the stub table pointer.
          843  +     */
          844  +
          845  +    iPtr->stubTable = &tclStubs;
          846  +
   713    847       /*
   714    848        * Initialize the ensemble error message rewriting support.
   715    849        */
   716    850   
   717    851       TclResetRewriteEnsemble(interp, 1);
   718    852   
   719    853       /*
................................................................................
   723    857       TclInitLimitSupport(interp);
   724    858   
   725    859       /*
   726    860        * Initialise the thread-specific data ekeko. Note that the thread's alloc
   727    861        * cache was already initialised by the call to alloc the interp struct.
   728    862        */
   729    863   
   730         -#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
          864  +#if TCL_THREADS && defined(USE_THREAD_ALLOC)
   731    865       iPtr->allocCache = TclpGetAllocCache();
   732    866   #else
   733    867       iPtr->allocCache = NULL;
   734    868   #endif
   735    869       iPtr->pendingObjDataPtr = NULL;
   736    870       iPtr->asyncReadyPtr = TclGetAsyncReadyPtr();
   737    871       iPtr->deferredCallbacks = NULL;
................................................................................
   793    927       TclInitDictCmd(interp);
   794    928       TclInitEncodingCmd(interp);
   795    929       TclInitFileCmd(interp);
   796    930       TclInitInfoCmd(interp);
   797    931       TclInitNamespaceCmd(interp);
   798    932       TclInitStringCmd(interp);
   799    933       TclInitPrefixCmd(interp);
          934  +    TclInitProcessCmd(interp);
   800    935   
   801    936       /*
   802    937        * Register "clock" subcommands. These *do* go through
   803    938        * Tcl_CreateObjCommand, since they aren't in the global namespace and
   804    939        * involve ensembles.
   805    940        */
   806    941   
................................................................................
   930   1065   
   931   1066       /*
   932   1067        * Set up other variables such as tcl_version and tcl_library
   933   1068        */
   934   1069   
   935   1070       Tcl_SetVar2(interp, "tcl_patchLevel", NULL, TCL_PATCH_LEVEL, TCL_GLOBAL_ONLY);
   936   1071       Tcl_SetVar2(interp, "tcl_version", NULL, TCL_VERSION, TCL_GLOBAL_ONLY);
         1072  +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
   937   1073       Tcl_TraceVar2(interp, "tcl_precision", NULL,
   938   1074   	    TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
   939   1075   	    TclPrecTraceProc, NULL);
         1076  +#endif /* !TCL_NO_DEPRECATED */
   940   1077       TclpSetVariables(interp);
   941   1078   
   942         -#ifdef TCL_THREADS
         1079  +#if TCL_THREADS
   943   1080       /*
   944   1081        * The existence of the "threaded" element of the tcl_platform array
   945   1082        * indicates that this particular Tcl shell has been compiled with threads
   946   1083        * turned on. Using "info exists tcl_platform(threaded)" a Tcl script can
   947   1084        * introspect on the interpreter level of thread safety.
   948   1085        */
   949   1086   
................................................................................
   970   1107        * compile and link against.
   971   1108        */
   972   1109   
   973   1110   #ifdef HAVE_ZLIB
   974   1111       if (TclZlibInit(interp) != TCL_OK) {
   975   1112   	Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
   976   1113       }
         1114  +    if (TclZipfs_Init(interp) != TCL_OK) {
         1115  +	Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
         1116  +    }
   977   1117   #endif
   978   1118   
   979   1119       TOP_CB(iPtr) = NULL;
   980   1120       return interp;
   981   1121   }
   982   1122   
   983   1123   static void
................................................................................
   984   1124   DeleteOpCmdClientData(
   985   1125       ClientData clientData)
   986   1126   {
   987   1127       TclOpCmdClientData *occdPtr = clientData;
   988   1128   
   989   1129       ckfree(occdPtr);
   990   1130   }
         1131  +
         1132  +/*
         1133  + * ---------------------------------------------------------------------
         1134  + *
         1135  + * TclRegisterCommandTypeName, TclGetCommandTypeName --
         1136  + *
         1137  + *      Command type registration and lookup mechanism. Everything is keyed by
         1138  + *      the Tcl_ObjCmdProc for the command, and that is used as the *key* into
         1139  + *      the hash table that maps to constant strings that are names. (It is
         1140  + *      recommended that those names be ASCII.)
         1141  + *
         1142  + * ---------------------------------------------------------------------
         1143  + */
         1144  +
         1145  +void
         1146  +TclRegisterCommandTypeName(
         1147  +    Tcl_ObjCmdProc *implementationProc,
         1148  +    const char *nameStr)
         1149  +{
         1150  +    Tcl_HashEntry *hPtr;
         1151  +
         1152  +    Tcl_MutexLock(&commandTypeLock);
         1153  +    if (commandTypeInit == 0) {
         1154  +        Tcl_InitHashTable(&commandTypeTable, TCL_ONE_WORD_KEYS);
         1155  +        commandTypeInit = 1;
         1156  +    }
         1157  +    if (nameStr != NULL) {
         1158  +        int isNew;
         1159  +
         1160  +        hPtr = Tcl_CreateHashEntry(&commandTypeTable,
         1161  +                (void *) implementationProc, &isNew);
         1162  +        Tcl_SetHashValue(hPtr, (void *) nameStr);
         1163  +    } else {
         1164  +        hPtr = Tcl_FindHashEntry(&commandTypeTable,
         1165  +                (void *) implementationProc);
         1166  +        if (hPtr != NULL) {
         1167  +            Tcl_DeleteHashEntry(hPtr);
         1168  +        }
         1169  +    }
         1170  +    Tcl_MutexUnlock(&commandTypeLock);
         1171  +}
         1172  +
         1173  +const char *
         1174  +TclGetCommandTypeName(
         1175  +    Tcl_Command command)
         1176  +{
         1177  +    Command *cmdPtr = (Command *) command;
         1178  +    void *procPtr = cmdPtr->objProc;
         1179  +    const char *name = "native";
         1180  +
         1181  +    if (procPtr == NULL) {
         1182  +        procPtr = cmdPtr->nreProc;
         1183  +    }
         1184  +    Tcl_MutexLock(&commandTypeLock);
         1185  +    if (commandTypeInit) {
         1186  +        Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&commandTypeTable, procPtr);
         1187  +
         1188  +        if (hPtr && Tcl_GetHashValue(hPtr)) {
         1189  +            name = (const char *) Tcl_GetHashValue(hPtr);
         1190  +        }
         1191  +    }
         1192  +    Tcl_MutexUnlock(&commandTypeLock);
         1193  +
         1194  +    return name;
         1195  +}
   991   1196   
   992   1197   /*
   993   1198    *----------------------------------------------------------------------
   994   1199    *
   995   1200    * TclHideUnsafeCommands --
   996   1201    *
   997   1202    *	Hides base commands that are not marked as safe from this interpreter.
................................................................................
  1006   1211    */
  1007   1212   
  1008   1213   int
  1009   1214   TclHideUnsafeCommands(
  1010   1215       Tcl_Interp *interp)		/* Hide commands in this interpreter. */
  1011   1216   {
  1012   1217       register const CmdInfo *cmdInfoPtr;
         1218  +    register const UnsafeEnsembleInfo *unsafePtr;
  1013   1219   
  1014   1220       if (interp == NULL) {
  1015   1221   	return TCL_ERROR;
  1016   1222       }
  1017   1223       for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
  1018   1224   	if (!(cmdInfoPtr->flags & CMD_IS_SAFE)) {
  1019   1225   	    Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name);
  1020   1226   	}
  1021   1227       }
  1022         -    TclMakeEncodingCommandSafe(interp); /* Ugh! */
  1023         -    TclMakeFileCommandSafe(interp);     /* Ugh! */
         1228  +
         1229  +    for (unsafePtr = unsafeEnsembleCommands;
         1230  +            unsafePtr->ensembleNsName; unsafePtr++) {
         1231  +        if (unsafePtr->commandName) {
         1232  +            /*
         1233  +             * Hide an ensemble subcommand.
         1234  +             */
         1235  +
         1236  +            Tcl_Obj *cmdName = Tcl_ObjPrintf("::tcl::%s::%s",
         1237  +                    unsafePtr->ensembleNsName, unsafePtr->commandName);
         1238  +            Tcl_Obj *hideName = Tcl_ObjPrintf("tcl:%s:%s",
         1239  +                    unsafePtr->ensembleNsName, unsafePtr->commandName);
         1240  +
         1241  +            if (TclRenameCommand(interp, TclGetString(cmdName),
         1242  +                        "___tmp") != TCL_OK
         1243  +                    || Tcl_HideCommand(interp, "___tmp",
         1244  +                            TclGetString(hideName)) != TCL_OK) {
         1245  +                Tcl_Panic("problem making '%s %s' safe: %s",
         1246  +                        unsafePtr->ensembleNsName, unsafePtr->commandName,
         1247  +                        Tcl_GetString(Tcl_GetObjResult(interp)));
         1248  +            }
         1249  +            Tcl_CreateObjCommand(interp, TclGetString(cmdName),
         1250  +                    BadEnsembleSubcommand, (ClientData) unsafePtr, NULL);
         1251  +            TclDecrRefCount(cmdName);
         1252  +            TclDecrRefCount(hideName);
         1253  +        } else {
         1254  +            /*
         1255  +             * Hide an ensemble main command (for compatibility).
         1256  +             */
         1257  +
         1258  +            if (Tcl_HideCommand(interp, unsafePtr->ensembleNsName,
         1259  +                    unsafePtr->ensembleNsName) != TCL_OK) {
         1260  +                Tcl_Panic("problem making '%s' safe: %s",
         1261  +                        unsafePtr->ensembleNsName,
         1262  +                        Tcl_GetString(Tcl_GetObjResult(interp)));
         1263  +            }
         1264  +        }
         1265  +    }
         1266  +
  1024   1267       return TCL_OK;
  1025   1268   }
         1269  +
         1270  +/*
         1271  + *----------------------------------------------------------------------
         1272  + *
         1273  + * BadEnsembleSubcommand --
         1274  + *
         1275  + *	Command used to act as a backstop implementation when subcommands of
         1276  + *	ensembles are unsafe (the real implementations of the subcommands are
         1277  + *	hidden). The clientData is description of what was hidden.
         1278  + *
         1279  + * Results:
         1280  + *	A standard Tcl result (always a TCL_ERROR).
         1281  + *
         1282  + * Side effects:
         1283  + *	None.
         1284  + *
         1285  + *----------------------------------------------------------------------
         1286  + */
         1287  +
         1288  +static int
         1289  +BadEnsembleSubcommand(
         1290  +    ClientData clientData,
         1291  +    Tcl_Interp *interp,
         1292  +    int objc,
         1293  +    Tcl_Obj *const objv[])
         1294  +{
         1295  +    const UnsafeEnsembleInfo *infoPtr = clientData;
         1296  +
         1297  +    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
         1298  +            "not allowed to invoke subcommand %s of %s",
         1299  +            infoPtr->commandName, infoPtr->ensembleNsName));
         1300  +    Tcl_SetErrorCode(interp, "TCL", "SAFE", "SUBCOMMAND", NULL);
         1301  +    return TCL_ERROR;
         1302  +}
  1026   1303   
  1027   1304   /*
  1028   1305    *--------------------------------------------------------------
  1029   1306    *
  1030   1307    * Tcl_CallWhenDeleted --
  1031   1308    *
  1032   1309    *	Arrange for a function to be called before a given interpreter is
................................................................................
  1501   1778   
  1502   1779       /*
  1503   1780        * Free up the result *after* deleting variables, since variable deletion
  1504   1781        * could have transferred ownership of the result string to Tcl.
  1505   1782        */
  1506   1783   
  1507   1784       Tcl_FreeResult(interp);
         1785  +    iPtr->result = NULL;
  1508   1786       Tcl_DecrRefCount(iPtr->objResultPtr);
  1509   1787       iPtr->objResultPtr = NULL;
  1510   1788       Tcl_DecrRefCount(iPtr->ecVar);
  1511   1789       if (iPtr->errorCode) {
  1512   1790   	Tcl_DecrRefCount(iPtr->errorCode);
  1513   1791   	iPtr->errorCode = NULL;
  1514   1792       }
................................................................................
  1522   1800       Tcl_DecrRefCount(iPtr->upLiteral);
  1523   1801       Tcl_DecrRefCount(iPtr->callLiteral);
  1524   1802       Tcl_DecrRefCount(iPtr->innerLiteral);
  1525   1803       Tcl_DecrRefCount(iPtr->innerContext);
  1526   1804       if (iPtr->returnOpts) {
  1527   1805   	Tcl_DecrRefCount(iPtr->returnOpts);
  1528   1806       }
         1807  +#ifndef TCL_NO_DEPRECATED
         1808  +    if (iPtr->appendResult != NULL) {
         1809  +	ckfree(iPtr->appendResult);
         1810  +	iPtr->appendResult = NULL;
         1811  +    }
         1812  +#endif
  1529   1813       TclFreePackageInfo(iPtr);
  1530   1814       while (iPtr->tracePtr != NULL) {
  1531   1815   	Tcl_DeleteTrace((Tcl_Interp *) iPtr, (Tcl_Trace) iPtr->tracePtr);
  1532   1816       }
  1533   1817       if (iPtr->execEnvPtr != NULL) {
  1534   1818   	TclDeleteExecEnv(iPtr->execEnvPtr);
  1535   1819       }
................................................................................
  2071   2355           } else {
  2072   2356   	    nsPtr = iPtr->globalNsPtr;
  2073   2357   	    tail = cmdName;
  2074   2358           }
  2075   2359   
  2076   2360           hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew);
  2077   2361   
  2078         -        if (isNew || deleted) {
         2362  +	if (isNew || deleted) {
  2079   2363   	    /*
  2080   2364   	     * isNew - No conflict with existing command.
  2081   2365   	     * deleted - We've already deleted a conflicting command
  2082   2366   	     */
  2083   2367   	    break;
  2084         -        }
         2368  +	}
  2085   2369   
  2086   2370   	/* An existing command conflicts. Try to delete it.. */
  2087   2371   	cmdPtr = Tcl_GetHashValue(hPtr);
  2088   2372   
  2089   2373   	/*
  2090   2374   	 * Be careful to preserve
  2091   2375   	 * any existing import links so we can restore them down below. That
................................................................................
  2218   2502   				 * qualifiers, the new command is put in the
  2219   2503   				 * specified namespace; otherwise it is put in
  2220   2504   				 * the global namespace. */
  2221   2505       Tcl_ObjCmdProc *proc,	/* Object-based function to associate with
  2222   2506   				 * name. */
  2223   2507       ClientData clientData,	/* Arbitrary value to pass to object
  2224   2508   				 * function. */
  2225         -    Tcl_CmdDeleteProc *deleteProc)
         2509  +    Tcl_CmdDeleteProc *deleteProc
  2226   2510   				/* If not NULL, gives a function to call when
  2227   2511   				 * this command is deleted. */
         2512  +)
  2228   2513   {
  2229   2514       Interp *iPtr = (Interp *) interp;
  2230         -    ImportRef *oldRefPtr = NULL;
  2231   2515       Namespace *nsPtr;
  2232         -    Command *cmdPtr;
  2233         -    Tcl_HashEntry *hPtr;
  2234   2516       const char *tail;
  2235         -    int isNew = 0, deleted = 0;
  2236         -    ImportedCmdData *dataPtr;
  2237   2517   
  2238   2518       if (iPtr->flags & DELETED) {
  2239   2519   	/*
  2240   2520   	 * The interpreter is being deleted. Don't create any new commands;
  2241   2521   	 * it's not safe to muck with the interpreter anymore.
  2242   2522   	 */
  2243         -
  2244   2523   	return (Tcl_Command) NULL;
  2245   2524       }
  2246   2525   
  2247   2526       /*
  2248         -     * If the command name we seek to create already exists, we need to
  2249         -     * delete that first.  That can be tricky in the presence of traces.
  2250         -     * Loop until we no longer find an existing command in the way, or
  2251         -     * until we've deleted one command and that didn't finish the job.
         2527  +     * Determine where the command should reside. If its name contains
         2528  +     * namespace qualifiers, we put it in the specified namespace;
         2529  +     * otherwise, we always put it in the global namespace.
         2530  +     */
         2531  +
         2532  +    if (strstr(cmdName, "::") != NULL) {
         2533  +	Namespace *dummy1, *dummy2;
         2534  +
         2535  +	TclGetNamespaceForQualName(interp, cmdName, NULL,
         2536  +	    TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
         2537  +	if ((nsPtr == NULL) || (tail == NULL)) {
         2538  +	    return (Tcl_Command) NULL;
         2539  +	}
         2540  +    } else {
         2541  +	nsPtr = iPtr->globalNsPtr;
         2542  +	tail = cmdName;
         2543  +    }
         2544  +
         2545  +    return TclCreateObjCommandInNs(interp, tail, (Tcl_Namespace *) nsPtr,
         2546  +	proc, clientData, deleteProc);
         2547  +}
         2548  +
         2549  +Tcl_Command
         2550  +TclCreateObjCommandInNs(
         2551  +    Tcl_Interp *interp,
         2552  +    const char *cmdName,	/* Name of command, without any namespace
         2553  +                                 * components. */
         2554  +    Tcl_Namespace *namespace,   /* The namespace to create the command in */
         2555  +    Tcl_ObjCmdProc *proc,	/* Object-based function to associate with
         2556  +				 * name. */
         2557  +    ClientData clientData,	/* Arbitrary value to pass to object
         2558  +				 * function. */
         2559  +    Tcl_CmdDeleteProc *deleteProc)
         25