Tcl Source Code

Check-in [740dc47d3e]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:merge 8.7
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | tip-465
Files: files | file ages | folders
SHA3-256: 740dc47d3ebaa034a9f8a4e373aa17ea6d52ec247e8b157f4ea08c585a7e7aa4
User & Date: dgp 2018-10-17 19:47:01
Context
2018-10-17
19:47
merge 8.7 Leaf check-in: 740dc47d3e user: dgp tags: tip-465
16:24
merge 8.6 check-in: 85a4914711 user: dgp tags: core-8-branch
2018-06-04
13:16
merge 8.7 check-in: d7d8dd7da7 user: dgp tags: tip-465
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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/rules-ext.vc
    16         -win/targets.vc
    17         -win/tcl.dsp
    18         -win/tcl.dsw
    19         -win/tcl.hpj.in

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 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 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

compat/zlib/win32/zdll.lib became a regular file.

cannot compute difference between binary files

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/NRE.3.

     1      1   .\"
     2      2   .\" Copyright (c) 2008 by Kevin B. Kenny.
     3         -.\" Copyright (c) 2018 by Nathan Coulter. 
            3  +.\" Copyright (c) 2018 by Nathan Coulter.
     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      8   .TH NRE 3 8.6 Tcl "Tcl Library Procedures"
     9      9   .so man.macros
    10     10   .BS

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/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/Utf.3.

   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
................................................................................
   199    202   characters.
   200    203   .PP
   201    204   \fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR
   202    205   of \fIlength\fR bytes is long enough to be decoded by
   203    206   \fBTcl_UtfToUniChar\fR, or 0 otherwise.  This function does not guarantee
   204    207   that the UTF-8 string is properly formed.  This routine is used by
   205    208   procedures that are operating on a byte at a time and need to know if a
   206         -full Tcl_UniChar has been seen.
          209  +full Unicode character has been seen.
   207    210   .PP
   208    211   \fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings.  It
   209    212   returns the number of Tcl_UniChars that are represented by the UTF-8 string
   210    213   \fIsrc\fR.  The length of the source string is \fIlength\fR bytes.  If the
   211    214   length is negative, all bytes up to the first null byte are used.
   212    215   .PP
   213    216   \fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings.  It
   214         -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
   215    218   in the null-terminated UTF-8 string \fIsrc\fR.  The null terminator is
   216    219   considered part of the UTF-8 string.
   217    220   .PP
   218    221   \fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings.  It
   219         -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
   220    223   in the null-terminated UTF-8 string \fIsrc\fR.  The null terminator is
   221    224   considered part of the UTF-8 string.
   222    225   .PP
   223    226   Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
   224    227   \fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
   225    228   string.  The caller must not ask for the next character after the last
   226    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.
................................................................................
   190    237       number of buckets with 10 or more entries: 0
   191    238       average search distance for entry: 1.2
   192    239   .CE
   193    240   .SH "SEE ALSO"
   194    241   list(n), string(n), variable(n), trace(n), foreach(n)
   195    242   .SH KEYWORDS
   196    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
................................................................................
   105    126   .RS
   106    127   .PP
   107    128   .VS TIP500
   108    129   If in a private definition context (see the \fBprivate\fR definition command,
   109    130   below), this command creates private forwarded methods.
   110    131   .VE TIP500
   111    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
   112    142   .TP
   113    143   \fBmethod\fI name argList bodyScript\fR
   114    144   .
   115    145   This creates or updates a method that is implemented as a procedure-like
   116    146   script. The name of the method is \fIname\fR, the formal arguments to the
   117    147   method (defined using the same format as for the Tcl \fBproc\fR command) will
   118    148   be \fIargList\fR, and the body of the method will be \fIbodyScript\fR. When
................................................................................
   392    422   \fBself call\fR).
   393    423   .VE TIP500
   394    424   .SH "SLOTTED DEFINITIONS"
   395    425   Some of the configurable definitions of a class or object are \fIslotted
   396    426   definitions\fR. This means that the configuration is implemented by a slot
   397    427   object, that is an instance of the class \fBoo::Slot\fR, which manages a list
   398    428   of values (class names, variable names, etc.) that comprises the contents of
   399         -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
   400    430   the slot:
   401    431   .TP
   402    432   \fIslot\fR \fB\-append\fR ?\fImember ...\fR?
   403    433   .
   404    434   This appends the given \fImember\fR elements to the slot definition.
   405    435   .TP
   406    436   \fIslot\fR \fB\-clear\fR
   407    437   .
   408    438   This sets the slot definition to the empty list.
          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
   409    449   .TP
   410    450   \fIslot\fR \fB\-set\fR ?\fImember ...\fR?
   411    451   .
   412    452   This replaces the slot definition with the given \fImember\fR elements.
   413    453   .PP
   414    454   A consequence of this is that any use of a slot's default operation where the
   415    455   first member argument begins with a hyphen will be an error. One of the above
................................................................................
   420    460   .QW \fBvariable\fR
   421    461   slot, this is forwarded to
   422    462   .QW "\fBmy \-append\fR" ),
   423    463   and these methods which provide the implementation interface:
   424    464   .TP
   425    465   \fIslot\fR \fBGet\fR
   426    466   .
   427         -Returns a list that is the current contents of the slot. This method must
   428         -always be called from a stack frame created by a call to \fBoo::define\fR or
   429         -\fBoo::objdefine\fR.
          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
   430    497   .TP
   431    498   \fIslot\fR \fBSet \fIelementList\fR
   432    499   .
   433    500   Sets the contents of the slot to the list \fIelementList\fR and returns the
   434    501   empty string. This method must always be called from a stack frame created by
   435         -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
   436    513   .PP
   437    514   The implementation of these methods is slot-dependent (and responsible for
   438    515   accessing the correct part of the class or object definition). Slots also have
   439    516   an unknown method handler to tie all these pieces together, and they hide
   440    517   their \fBdestroy\fR method so that it is not invoked inadvertently. It is
   441    518   \fIrecommended\fR that any user changes to the slot mechanism be restricted to
   442    519   defining new operations whose names start with a hyphen.
          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
   443    528   .SH EXAMPLES
   444    529   This example demonstrates how to use both forms of the \fBoo::define\fR and
   445    530   \fBoo::objdefine\fR commands (they work in the same way), as well as
   446    531   illustrating four of the subcommands of them.
   447    532   .PP
   448    533   .CS
   449    534   oo::class create c
................................................................................
   492    577   }
   493    578   \fBoo::objdefine\fR inst {
   494    579       \fBmixin -append\fR B
   495    580   }
   496    581   inst m1              \fI\(-> prints "red brick"\fR
   497    582   inst m2              \fI\(-> prints "blue brick"\fR
   498    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
   499    662   .SH "SEE ALSO"
   500    663   next(n), oo::class(n), oo::object(n)
   501    664   .SH KEYWORDS
   502    665   class, definition, method, object, slot
   503    666   .\" Local variables:
   504    667   .\" mode: nroff
   505    668   .\" fill-column: 78
   506    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/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/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.

    39     39   Returns information about the class, \fIclass\fR. The \fIsubcommand\fRs are
    40     40   described in \fBCLASS INTROSPECTION\fR below.
    41     41   .TP
    42     42   \fBinfo cmdcount\fR
    43     43   .
    44     44   Returns a count of the total number of commands that have been invoked
    45     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
    46     82   .TP
    47     83   \fBinfo commands \fR?\fIpattern\fR?
    48     84   .
    49     85   If \fIpattern\fR is not specified,
    50     86   returns a list of names of all the Tcl commands visible
    51     87   (i.e. executable without using a qualified name) to the current namespace,
    52     88   including both the built-in commands written in C and

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/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     23   The \fBmy\fR command is used to allow methods of objects to invoke methods
    23         -of the object (or its class). In particular, the set of valid values for
           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     31   superclasses, including those that are not exported
    26     32   .VS TIP500
    27     33   and private methods of the object or class when used within another method
    28     34   defined by that object or class.
    29     35   .VE TIP500
    30         -The object upon which the method is invoked is the one that owns the namespace
    31         -that the \fBmy\fR command is contained in initially (\fBNB:\fR the link
           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
    32     39   remains if the command is renamed), which is the currently invoked object by
    33     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
    34     48   .PP
    35         -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.
    36     51   .SH EXAMPLES
    37     52   .PP
    38     53   This example shows basic use of \fBmy\fR to use the \fBvariables\fR method of
    39     54   the \fBoo::object\fR class, which is not publicly visible by default:
    40     55   .PP
    41     56   .CS
    42     57   oo::class create c {
................................................................................
    50     65   o count              \fI\(-> prints "1"\fR
    51     66   o count              \fI\(-> prints "2"\fR
    52     67   o count              \fI\(-> prints "3"\fR
    53     68   .CE
    54     69   .PP
    55     70   This example shows how you can use \fBmy\fR to make callbacks to private
    56     71   methods from outside the object (from a \fBtrace\fR), using
    57         -\fBnamespace code\fR to enter the correct context:
           72  +\fBnamespace code\fR to enter the correct context. (See the \fBcallback\fR
           73  +command for the recommended way of doing this.)
    58     74   .PP
    59     75   .CS
    60     76   oo::class create HasCallback {
    61     77       method makeCallback {} {
    62     78           return [namespace code {
    63     79               \fBmy\fR Callback
    64     80           }]
................................................................................
    69     85       }
    70     86   }
    71     87   
    72     88   set o [HasCallback new]
    73     89   trace add variable xyz write [$o makeCallback]
    74     90   set xyz "called"     \fI\(-> prints "callback: xyz {} write"\fR
    75     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
    76    124   .SH "SEE ALSO"
    77    125   next(n), oo::object(n), self(n)
    78    126   .SH KEYWORDS
    79    127   method, method visibility, object, private method, public method
    80    128   .\" Local variables:
    81    129   .\" mode: nroff
    82    130   .\" fill-column: 78
    83    131   .\" End:

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.)

Changes to doc/process.n.

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

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/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/tcl.decls.

   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    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 {
................................................................................
   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 {
................................................................................
   468    468   }
   469    469   declare 129 {
   470    470       int Tcl_Eval(Tcl_Interp *interp, const char *script)
   471    471   }
   472    472   declare 130 {
   473    473       int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName)
   474    474   }
   475         -declare 131 {
          475  +declare 131 {deprecated {No longer in use, changed to macro}} {
   476    476       int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
   477    477   }
   478    478   declare 132 {
   479    479       void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
   480    480   }
   481    481   declare 133 {
   482    482       TCL_NORETURN void Tcl_Exit(int status)
................................................................................
   620    620   }
   621    621   declare 173 {
   622    622       Tcl_Channel Tcl_GetStdChannel(int type)
   623    623   }
   624    624   declare 174 {
   625    625       const char *Tcl_GetStringResult(Tcl_Interp *interp)
   626    626   }
   627         -declare 175 {
          627  +declare 175 {deprecated {No longer in use, changed to macro}} {
   628    628       const char *Tcl_GetVar(Tcl_Interp *interp, const char *varName,
   629    629   	    int flags)
   630    630   }
   631    631   declare 176 {
   632    632       const char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
   633    633   	    const char *part2, int flags)
   634    634   }
   635    635   declare 177 {
   636    636       int Tcl_GlobalEval(Tcl_Interp *interp, const char *command)
   637    637   }
   638         -declare 178 {
          638  +declare 178 {deprecated {No longer in use, changed to macro}} {
   639    639       int Tcl_GlobalEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
   640    640   }
   641    641   declare 179 {
   642    642       int Tcl_HideCommand(Tcl_Interp *interp, const char *cmdName,
   643    643   	    const char *hiddenCmdToken)
   644    644   }
   645    645   declare 180 {
................................................................................
   830    830   }
   831    831   declare 235 {
   832    832       void Tcl_SetObjResult(Tcl_Interp *interp, Tcl_Obj *resultObjPtr)
   833    833   }
   834    834   declare 236 {
   835    835       void Tcl_SetStdChannel(Tcl_Channel channel, int type)
   836    836   }
   837         -declare 237 {
          837  +declare 237 {deprecated {No longer in use, changed to macro}} {
   838    838       const char *Tcl_SetVar(Tcl_Interp *interp, const char *varName,
   839    839   	    const char *newValue, int flags)
   840    840   }
   841    841   declare 238 {
   842    842       const char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
   843    843   	    const char *part2, const char *newValue, int flags)
   844    844   }
................................................................................
   865    865   }
   866    866   declare 245 {
   867    867       int Tcl_StringMatch(const char *str, const char *pattern)
   868    868   }
   869    869   declare 246 {deprecated {}} {
   870    870       int Tcl_TellOld(Tcl_Channel chan)
   871    871   }
   872         -declare 247 {
          872  +declare 247 {deprecated {No longer in use, changed to macro}} {
   873    873       int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags,
   874    874   	    Tcl_VarTraceProc *proc, ClientData clientData)
   875    875   }
   876    876   declare 248 {
   877    877       int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1, const char *part2,
   878    878   	    int flags, Tcl_VarTraceProc *proc, ClientData clientData)
   879    879   }
................................................................................
   886    886   }
   887    887   declare 251 {
   888    888       void Tcl_UnlinkVar(Tcl_Interp *interp, const char *varName)
   889    889   }
   890    890   declare 252 {
   891    891       int Tcl_UnregisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
   892    892   }
   893         -declare 253 {
          893  +declare 253 {deprecated {No longer in use, changed to macro}} {
   894    894       int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName, int flags)
   895    895   }
   896    896   declare 254 {
   897    897       int Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1, const char *part2,
   898    898   	    int flags)
   899    899   }
   900         -declare 255 {
          900  +declare 255 {deprecated {No longer in use, changed to macro}} {
   901    901       void Tcl_UntraceVar(Tcl_Interp *interp, const char *varName, int flags,
   902    902   	    Tcl_VarTraceProc *proc, ClientData clientData)
   903    903   }
   904    904   declare 256 {
   905    905       void Tcl_UntraceVar2(Tcl_Interp *interp, const char *part1,
   906    906   	    const char *part2, int flags, Tcl_VarTraceProc *proc,
   907    907   	    ClientData clientData)
   908    908   }
   909    909   declare 257 {
   910    910       void Tcl_UpdateLinkedVar(Tcl_Interp *interp, const char *varName)
   911    911   }
   912         -declare 258 {
          912  +declare 258 {deprecated {No longer in use, changed to macro}} {
   913    913       int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
   914    914   	    const char *varName, const char *localName, int flags)
   915    915   }
   916    916   declare 259 {
   917    917       int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, const char *part1,
   918    918   	    const char *part2, const char *localName, int flags)
   919    919   }
   920    920   declare 260 {
   921    921       int Tcl_VarEval(Tcl_Interp *interp, ...)
   922    922   }
   923         -declare 261 {
          923  +declare 261 {deprecated {No longer in use, changed to macro}} {
   924    924       ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName,
   925    925   	    int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData)
   926    926   }
   927    927   declare 262 {
   928    928       ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
   929    929   	    const char *part2, int flags, Tcl_VarTraceProc *procPtr,
   930    930   	    ClientData prevClientData)
................................................................................
   951    951   declare 269 {
   952    952       char *Tcl_HashStats(Tcl_HashTable *tablePtr)
   953    953   }
   954    954   declare 270 {
   955    955       const char *Tcl_ParseVar(Tcl_Interp *interp, const char *start,
   956    956   	    const char **termPtr)
   957    957   }
   958         -declare 271 {
          958  +declare 271 {deprecated {No longer in use, changed to macro}} {
   959    959       const char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
   960    960   	    const char *version, int exact)
   961    961   }
   962    962   declare 272 {
   963    963       const char *Tcl_PkgPresentEx(Tcl_Interp *interp,
   964    964   	    const char *name, const char *version, int exact,
   965    965   	    void *clientDataPtr)
   966    966   }
   967         -declare 273 {
          967  +declare 273 {deprecated {No longer in use, changed to macro}} {
   968    968       int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
   969    969   	    const char *version)
   970    970   }
   971    971   # TIP #268: The internally used new Require function is in slot 573.
   972         -declare 274 {
          972  +declare 274 {deprecated {No longer in use, changed to macro}} {
   973    973       const char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
   974    974   	    const char *version, int exact)
   975    975   }
   976    976   declare 275 {deprecated {see TIP #422}} {
   977    977       void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList)
   978    978   }
   979    979   declare 276 {deprecated {see TIP #422}} {
................................................................................
  1346   1346   }
  1347   1347   declare 380 {
  1348   1348       int Tcl_GetCharLength(Tcl_Obj *objPtr)
  1349   1349   }
  1350   1350   declare 381 {
  1351   1351       int Tcl_GetUniChar(Tcl_Obj *objPtr, int index)
  1352   1352   }
  1353         -declare 382 {
         1353  +declare 382 {deprecated {No longer in use, changed to macro}} {
  1354   1354       Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr)
  1355   1355   }
  1356   1356   declare 383 {
  1357   1357       Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
  1358   1358   }
  1359   1359   declare 384 {
  1360   1360       void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
................................................................................
  2325   2325   
  2326   2326   # TIP #456
  2327   2327   declare 631 {
  2328   2328       Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, const char *service,
  2329   2329   	    const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc,
  2330   2330   	    ClientData callbackData)
  2331   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  +}
  2332   2348   
  2333   2349   # ----- BASELINE -- FOR -- 8.7.0 ----- #
  2334         -
  2335         -
  2336   2350   
  2337   2351   ##############################################################################
  2338   2352   
  2339   2353   # Define the platform specific public Tcl interface. These functions are only
  2340   2354   # available on the designated platform.
  2341   2355   
  2342   2356   interface tclPlat
................................................................................
  2374   2388   ##############################################################################
  2375   2389   
  2376   2390   # Public functions that are not accessible via the stubs table.
  2377   2391   
  2378   2392   export {
  2379   2393       void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
  2380   2394   }
         2395  +export {
         2396  +    void Tcl_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc,
         2397  +    Tcl_Interp *interp)
         2398  +}
  2381   2399   export {
  2382   2400       const char *Tcl_InitStubs(Tcl_Interp *interp, const char *version,
  2383   2401   	int exact)
  2384   2402   }
  2385   2403   export {
  2386   2404       const char *TclTomMathInitializeStubs(Tcl_Interp* interp,
  2387   2405   	const char* version, int epoch, int revision)

Changes to generic/tcl.h.

   220    220   
   221    221   /*
   222    222    * These macros are used to control whether functions are being declared for
   223    223    * import or export. If a function is being declared while it is being built
   224    224    * to be included in a shared library, then it should have the DLLEXPORT
   225    225    * storage class. If is being declared for use by a module that is going to
   226    226    * link against the shared library, then it should have the DLLIMPORT storage
   227         - * 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
   228    228    * stub library, then the storage class should be empty.
   229    229    *
   230    230    * The convention is that a macro called BUILD_xxxx, where xxxx is the name of
   231    231    * a library we are building, is set on the compile line for sources that are
   232    232    * to be placed in the library. When this macro is set, the storage class will
   233    233    * be set to DLLEXPORT. At the end of the header file, the storage class will
   234    234    * be reset to DLLIMPORT.
................................................................................
  2329   2329   /*
  2330   2330    *----------------------------------------------------------------------------
  2331   2331    * Definitions needed for the Tcl_OpenTcpServerEx function. [TIP #456]
  2332   2332    */
  2333   2333   #define TCL_TCPSERVER_REUSEADDR (1<<0)
  2334   2334   #define TCL_TCPSERVER_REUSEPORT (1<<1)
  2335   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  +
  2336   2343   /*
  2337   2344    *----------------------------------------------------------------------------
  2338   2345    * Single public declaration for NRE.
  2339   2346    */
  2340   2347   
  2341   2348   typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
  2342   2349   				int result);
................................................................................
  2392   2399   
  2393   2400   /*
  2394   2401    * Public functions that are not accessible via the stubs table.
  2395   2402    * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171]
  2396   2403    */
  2397   2404   
  2398   2405   #define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
  2399         -	    ((Tcl_SetPanicProc(Tcl_ConsolePanic), Tcl_CreateInterp)()))
         2406  +	    (((Tcl_SetPanicProc)(Tcl_ConsolePanic), Tcl_CreateInterp)()))
  2400   2407   EXTERN void		Tcl_MainEx(int argc, char **argv,
  2401   2408   			    Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
  2402   2409   EXTERN const char *	Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
  2403   2410   			    const char *version, int exact);
  2404   2411   EXTERN void		Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
         2412  +#ifndef _WIN32
         2413  +EXTERN int		TclZipfs_AppHook(int *argc, char ***argv);
         2414  +#endif
  2405   2415   
  2406   2416   /*
  2407   2417    *----------------------------------------------------------------------------
  2408   2418    * Include the public function declarations that are accessible via the stubs
  2409   2419    * table.
  2410   2420    */
  2411   2421   

Changes to generic/tclAssembly.c.

  2249   2249       Tcl_Obj *value;
  2250   2250       int status;
  2251   2251   
  2252   2252       /* General operand validity check */
  2253   2253       if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &value) != TCL_OK) {
  2254   2254   	return TCL_ERROR;
  2255   2255       }
  2256         -     
         2256  +
  2257   2257       /* Convert to an integer, advance to the next token and return. */
  2258   2258       /*
  2259   2259        * NOTE: Indexing a list with an index before it yields the
  2260   2260        * same result as indexing after it, and might be more easily portable
  2261   2261        * when list size limits grow.
  2262   2262        */
  2263   2263       status = TclIndexEncode(interp, value,

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;
   121    132   static Tcl_ObjCmdProc	ExprMaxFunc;
   122    133   static Tcl_ObjCmdProc	ExprMinFunc;
   123    134   static Tcl_ObjCmdProc	ExprRandFunc;
   124    135   static Tcl_ObjCmdProc	ExprRoundFunc;
................................................................................
   191    202   #define CMD_IS_SAFE         1   /* Whether this command is part of the set of
   192    203                                    * commands present by default in a safe
   193    204                                    * interpreter. */
   194    205   /* CMD_COMPILES_EXPANDED - Whether the compiler for this command can handle
   195    206    * expansion for itself rather than needing the generic layer to take care of
   196    207    * it for it. Defined in tclInt.h. */
   197    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  +
   198    227   /*
   199    228    * The built-in commands, and the functions that implement them:
   200    229    */
   201    230   
   202    231   static const CmdInfo builtInCmds[] = {
   203    232       /*
   204    233        * Commands in the generic core.
................................................................................
   291    320       {"time",		Tcl_TimeObjCmd,		NULL,			NULL,	CMD_IS_SAFE},
   292    321       {"unload",		Tcl_UnloadObjCmd,	NULL,			NULL,	0},
   293    322       {"update",		Tcl_UpdateObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   294    323       {"vwait",		Tcl_VwaitObjCmd,	NULL,			NULL,	CMD_IS_SAFE},
   295    324       {NULL,		NULL,			NULL,			NULL,	0}
   296    325   };
   297    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  +
   298    389   /*
   299    390    * Math functions. All are safe.
   300    391    */
   301    392   
   302    393   typedef struct {
   303    394       const char *name;		/* Name of the function. The full name is
   304    395   				 * "::tcl::mathfunc::<name>". */
................................................................................
   312    403       { "atan",	ExprUnaryFunc,	(ClientData) atan	},
   313    404       { "atan2",	ExprBinaryFunc,	(ClientData) atan2	},
   314    405       { "bool",	ExprBoolFunc,	NULL			},
   315    406       { "ceil",	ExprCeilFunc,	NULL			},
   316    407       { "cos",	ExprUnaryFunc,	(ClientData) cos	},
   317    408       { "cosh",	ExprUnaryFunc,	(ClientData) cosh	},
   318    409       { "double",	ExprDoubleFunc,	NULL			},
   319         -    { "entier",	ExprEntierFunc,	NULL			},
          410  +    { "entier",	ExprIntFunc,	NULL			},
   320    411       { "exp",	ExprUnaryFunc,	(ClientData) exp	},
   321    412       { "floor",	ExprFloorFunc,	NULL			},
   322    413       { "fmod",	ExprBinaryFunc,	(ClientData) fmod	},
   323    414       { "hypot",	ExprBinaryFunc,	(ClientData) hypot	},
   324    415       { "int",	ExprIntFunc,	NULL			},
   325    416       { "isqrt",	ExprIsqrtFunc,	NULL			},
   326    417       { "log",	ExprUnaryFunc,	(ClientData) log	},
................................................................................
   427    518   {
   428    519       Tcl_MutexLock(&cancelLock);
   429    520       if (cancelTableInitialized == 1) {
   430    521   	Tcl_DeleteHashTable(&cancelTable);
   431    522   	cancelTableInitialized = 0;
   432    523       }
   433    524       Tcl_MutexUnlock(&cancelLock);
          525  +
          526  +    Tcl_MutexLock(&commandTypeLock);
          527  +    if (commandTypeInit) {
          528  +        Tcl_DeleteHashTable(&commandTypeTable);
          529  +        commandTypeInit = 0;
          530  +    }
          531  +    Tcl_MutexUnlock(&commandTypeLock);
   434    532   }
   435    533   
   436    534   /*
   437    535    *----------------------------------------------------------------------
   438    536    *
   439    537    * Tcl_CreateInterp --
   440    538    *
................................................................................
   500    598   
   501    599       if (cancelTableInitialized == 0) {
   502    600   	Tcl_MutexLock(&cancelLock);
   503    601   	if (cancelTableInitialized == 0) {
   504    602   	    Tcl_InitHashTable(&cancelTable, TCL_ONE_WORD_KEYS);
   505    603   	    cancelTableInitialized = 1;
   506    604   	}
          605  +
   507    606   	Tcl_MutexUnlock(&cancelLock);
   508    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  +    }
   509    621   
   510    622       /*
   511    623        * Initialize support for namespaces and create the global namespace
   512    624        * (whose name is ""; an alias is "::"). This also initializes the Tcl
   513    625        * object type table and other object management code.
   514    626        */
   515    627   
................................................................................
   995   1107        * compile and link against.
   996   1108        */
   997   1109   
   998   1110   #ifdef HAVE_ZLIB
   999   1111       if (TclZlibInit(interp) != TCL_OK) {
  1000   1112   	Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp)));
  1001   1113       }
         1114  +    if (TclZipfs_Init(interp) != TCL_OK) {
         1115  +	Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
         1116  +    }
  1002   1117   #endif
  1003   1118   
  1004   1119       TOP_CB(iPtr) = NULL;
  1005   1120       return interp;
  1006   1121   }
  1007   1122   
  1008   1123   static void
................................................................................
  1009   1124   DeleteOpCmdClientData(
  1010   1125       ClientData clientData)
  1011   1126   {
  1012   1127       TclOpCmdClientData *occdPtr = clientData;
  1013   1128   
  1014   1129       ckfree(occdPtr);
  1015   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  +}
  1016   1196   
  1017   1197   /*
  1018   1198    *----------------------------------------------------------------------
  1019   1199    *
  1020   1200    * TclHideUnsafeCommands --
  1021   1201    *
  1022   1202    *	Hides base commands that are not marked as safe from this interpreter.
................................................................................
  1031   1211    */
  1032   1212   
  1033   1213   int
  1034   1214   TclHideUnsafeCommands(
  1035   1215       Tcl_Interp *interp)		/* Hide commands in this interpreter. */
  1036   1216   {
  1037   1217       register const CmdInfo *cmdInfoPtr;
         1218  +    register const UnsafeEnsembleInfo *unsafePtr;
  1038   1219   
  1039   1220       if (interp == NULL) {
  1040   1221   	return TCL_ERROR;
  1041   1222       }
  1042   1223       for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
  1043   1224   	if (!(cmdInfoPtr->flags & CMD_IS_SAFE)) {
  1044   1225   	    Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name);
  1045   1226   	}
  1046   1227       }
  1047         -    TclMakeEncodingCommandSafe(interp); /* Ugh! */
  1048         -    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  +
  1049   1267       return TCL_OK;
  1050   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  +}
  1051   1303   
  1052   1304   /*
  1053   1305    *--------------------------------------------------------------
  1054   1306    *
  1055   1307    * Tcl_CallWhenDeleted --
  1056   1308    *
  1057   1309    *	Arrange for a function to be called before a given interpreter is
................................................................................
  6516   6768   	Tcl_DecrRefCount(resultPtr);
  6517   6769   	if (Tcl_InitBignumFromDouble(interp, d, &big) != TCL_OK) {
  6518   6770   	    return TCL_ERROR;
  6519   6771   	}
  6520   6772   	resultPtr = Tcl_NewBignumObj(&big);
  6521   6773   	/* FALLTHROUGH */
  6522   6774       }
  6523         -    case TCL_NUMBER_WIDE:
         6775  +    case TCL_NUMBER_INT:
  6524   6776       case TCL_NUMBER_BIG:
  6525   6777   	result = TclGetLongFromObj(interp, resultPtr, ptr);
  6526   6778   	break;
  6527   6779   
  6528   6780       case TCL_NUMBER_NAN:
  6529   6781   	Tcl_GetDoubleFromObj(interp, resultPtr, &d);
  6530   6782   	result = TCL_ERROR;
................................................................................
  7492   7744   	return TCL_ERROR;
  7493   7745       }
  7494   7746   
  7495   7747       if (TclGetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
  7496   7748   	return TCL_ERROR;
  7497   7749       }
  7498   7750   
  7499         -    if (type == TCL_NUMBER_WIDE) {
         7751  +    if (type == TCL_NUMBER_INT) {
  7500   7752   	Tcl_WideInt l = *((const Tcl_WideInt *) ptr);
  7501   7753   
  7502   7754   	if (l > (Tcl_WideInt)0) {
  7503   7755   	    goto unChanged;
  7504   7756   	} else if (l == (Tcl_WideInt)0) {
  7505   7757   	    const char *string = objv[1]->bytes;
  7506   7758   	    if (string) {
................................................................................
  7509   7761   			Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
  7510   7762   			return TCL_OK;
  7511   7763   		    }
  7512   7764   		    string++;
  7513   7765   		}
  7514   7766   	    }
  7515   7767   	    goto unChanged;
  7516         -	} else if (l == LLONG_MIN) {
         7768  +	} else if (l == WIDE_MIN) {
  7517   7769   	    TclInitBignumFromWideInt(&big, l);
  7518   7770   	    goto tooLarge;
  7519   7771   	}
  7520   7772   	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-l));
  7521   7773   	return TCL_OK;
  7522   7774       }
  7523   7775   
................................................................................
  7613   7865   	return TCL_ERROR;
  7614   7866       }
  7615   7867       Tcl_SetObjResult(interp, Tcl_NewDoubleObj(dResult));
  7616   7868       return TCL_OK;
  7617   7869   }
  7618   7870   
  7619   7871   static int
  7620         -ExprEntierFunc(
         7872  +ExprIntFunc(
  7621   7873       ClientData clientData,	/* Ignored. */
  7622   7874       Tcl_Interp *interp,		/* The interpreter in which to execute the
  7623   7875   				 * function. */
  7624   7876       int objc,			/* Actual parameter count. */
  7625   7877       Tcl_Obj *const *objv)	/* Actual parameter vector. */
  7626   7878   {
  7627   7879       double d;
................................................................................
  7634   7886       }
  7635   7887       if (TclGetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
  7636   7888   	return TCL_ERROR;
  7637   7889       }
  7638   7890   
  7639   7891       if (type == TCL_NUMBER_DOUBLE) {
  7640   7892   	d = *((const double *) ptr);
  7641         -	if ((d >= (double)LONG_MAX) || (d <= (double)LONG_MIN)) {
         7893  +	if ((d >= (double)WIDE_MAX) || (d <= (double)WIDE_MIN)) {
  7642   7894   	    mp_int big;
  7643   7895   
  7644   7896   	    if (Tcl_InitBignumFromDouble(interp, d, &big) != TCL_OK) {
  7645   7897   		/* Infinity */
  7646   7898   		return TCL_ERROR;
  7647   7899   	    }
  7648   7900   	    Tcl_SetObjResult(interp, Tcl_NewBignumObj(&big));
  7649   7901   	    return TCL_OK;
  7650   7902   	} else {
  7651         -	    long result = (long) d;
         7903  +	    Tcl_WideInt result = (Tcl_WideInt) d;
  7652   7904   
  7653         -	    Tcl_SetObjResult(interp, Tcl_NewLongObj(result));
         7905  +	    Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
  7654   7906   	    return TCL_OK;
  7655   7907   	}
  7656   7908       }
  7657   7909   
  7658   7910       if (type != TCL_NUMBER_NAN) {
  7659   7911   	/*
  7660   7912   	 * All integers are already of integer type.
................................................................................
  7668   7920        * Get the error message for NaN.
  7669   7921        */
  7670   7922   
  7671   7923       Tcl_GetDoubleFromObj(interp, objv[1], &d);
  7672   7924       return TCL_ERROR;
  7673   7925   }
  7674   7926   
  7675         -static int
  7676         -ExprIntFunc(
  7677         -    ClientData clientData,	/* Ignored. */
  7678         -    Tcl_Interp *interp,		/* The interpreter in which to execute the
  7679         -				 * function. */
  7680         -    int objc,			/* Actual parameter count. */
  7681         -    Tcl_Obj *const *objv)	/* Actual parameter vector. */
  7682         -{
  7683         -    long iResult;
  7684         -    Tcl_Obj *objPtr;
  7685         -    if (ExprEntierFunc(NULL, interp, objc, objv) != TCL_OK) {
  7686         -	return TCL_ERROR;
  7687         -    }
  7688         -    objPtr = Tcl_GetObjResult(interp);
  7689         -    if (TclGetLongFromObj(NULL, objPtr, &iResult) != TCL_OK) {
  7690         -	/*
  7691         -	 * Truncate the bignum; keep only bits in long range.
  7692         -	 */
  7693         -
  7694         -	mp_int big;
  7695         -
  7696         -	Tcl_GetBignumFromObj(NULL, objPtr, &big);
  7697         -	mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
  7698         -	objPtr = Tcl_NewBignumObj(&big);
  7699         -	Tcl_IncrRefCount(objPtr);
  7700         -	TclGetLongFromObj(NULL, objPtr, &iResult);
  7701         -	Tcl_DecrRefCount(objPtr);
  7702         -    }
  7703         -    Tcl_SetObjResult(interp, Tcl_NewLongObj(iResult));
  7704         -    return TCL_OK;
  7705         -}
  7706         -
  7707   7927   static int
  7708   7928   ExprWideFunc(
  7709   7929       ClientData clientData,	/* Ignored. */
  7710   7930       Tcl_Interp *interp,		/* The interpreter in which to execute the
  7711   7931   				 * function. */
  7712   7932       int objc,			/* Actual parameter count. */
  7713   7933       Tcl_Obj *const *objv)	/* Actual parameter vector. */
  7714   7934   {
  7715   7935       Tcl_WideInt wResult;
  7716         -    Tcl_Obj *objPtr;
  7717   7936   
  7718         -    if (ExprEntierFunc(NULL, interp, objc, objv) != TCL_OK) {
         7937  +    if (ExprIntFunc(NULL, interp, objc, objv) != TCL_OK) {
  7719   7938   	return TCL_ERROR;
  7720   7939       }
  7721         -    objPtr = Tcl_GetObjResult(interp);
  7722         -    if (TclGetWideIntFromObj(NULL, objPtr, &wResult) != TCL_OK) {
  7723         -	/*
  7724         -	 * Truncate the bignum; keep only bits in wide int range.
  7725         -	 */
  7726         -
  7727         -	mp_int big;
  7728         -
  7729         -	Tcl_GetBignumFromObj(NULL, objPtr, &big);
  7730         -	mp_mod_2d(&big, (int) CHAR_BIT * sizeof(Tcl_WideInt), &big);
  7731         -	objPtr = Tcl_NewBignumObj(&big);
  7732         -	Tcl_IncrRefCount(objPtr);
  7733         -	TclGetWideIntFromObj(NULL, objPtr, &wResult);
  7734         -	Tcl_DecrRefCount(objPtr);
  7735         -    }
         7940  +    TclGetWideBitsFromObj(NULL, Tcl_GetObjResult(interp), &wResult);
  7736   7941       Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wResult));
  7737   7942       return TCL_OK;
  7738   7943   }
  7739   7944   
  7740   7945   /*
  7741   7946    * Common implmentation of max() and min().
  7742   7947    */
................................................................................
  7831   8036   
  7832   8037   	iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12);
  7833   8038   
  7834   8039   	/*
  7835   8040   	 * Make sure 1 <= randSeed <= (2^31) - 2. See below.
  7836   8041   	 */
  7837   8042   
  7838         -	iPtr->randSeed &= (unsigned long) 0x7fffffff;
         8043  +	iPtr->randSeed &= 0x7fffffff;
  7839   8044   	if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
  7840   8045   	    iPtr->randSeed ^= 123459876;
  7841   8046   	}
  7842   8047       }
  7843   8048   
  7844   8049       /*
  7845   8050        * Generate the random number using the linear congruential generator
................................................................................
  7975   8180       ClientData clientData,	/* Ignored. */
  7976   8181       Tcl_Interp *interp,		/* The interpreter in which to execute the
  7977   8182   				 * function. */
  7978   8183       int objc,			/* Actual parameter count. */
  7979   8184       Tcl_Obj *const *objv)	/* Parameter vector. */
  7980   8185   {
  7981   8186       Interp *iPtr = (Interp *) interp;
  7982         -    long i = 0;			/* Initialized to avoid compiler warning. */
         8187  +    Tcl_WideInt w = 0;			/* Initialized to avoid compiler warning. */
  7983   8188   
  7984   8189       /*
  7985   8190        * Convert argument and use it to reset the seed.
  7986   8191        */
  7987   8192   
  7988   8193       if (objc != 2) {
  7989   8194   	MathFuncWrongNumArgs(interp, 2, objc, objv);
  7990   8195   	return TCL_ERROR;
  7991   8196       }
  7992   8197   
  7993         -    if (TclGetLongFromObj(NULL, objv[1], &i) != TCL_OK) {
  7994         -	Tcl_Obj *objPtr;
  7995         -	mp_int big;
  7996         -
  7997         -	if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
  7998         -	    /* TODO: more ::errorInfo here? or in caller? */
  7999         -	    return TCL_ERROR;
  8000         -	}
  8001         -
  8002         -	mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
  8003         -	objPtr = Tcl_NewBignumObj(&big);
  8004         -	Tcl_IncrRefCount(objPtr);
  8005         -	TclGetLongFromObj(NULL, objPtr, &i);
  8006         -	Tcl_DecrRefCount(objPtr);
         8198  +    if (TclGetWideBitsFromObj(NULL, objv[1], &w) != TCL_OK) {
         8199  +	return TCL_ERROR;
  8007   8200       }
  8008   8201   
  8009   8202       /*
  8010   8203        * Reset the seed. Make sure 1 <= randSeed <= 2^31 - 2. See comments in
  8011   8204        * ExprRandFunc for more details.
  8012   8205        */
  8013   8206   
  8014   8207       iPtr->flags |= RAND_SEED_INITIALIZED;
  8015         -    iPtr->randSeed = i;
  8016         -    iPtr->randSeed &= (unsigned long) 0x7fffffff;
         8208  +    iPtr->randSeed = (long) w & 0x7fffffff;
  8017   8209       if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
  8018   8210   	iPtr->randSeed ^= 123459876;
  8019   8211       }
  8020   8212   
  8021   8213       /*
  8022   8214        * To avoid duplicating the random number generation code we simply clean
  8023   8215        * up our state and call the real random number function. That function
................................................................................
  8496   8688        * command, then set it in the varFrame so that PopCallFrame can use it
  8497   8689        * at the proper time.
  8498   8690        */
  8499   8691   
  8500   8692       if (objc > 1) {
  8501   8693           Tcl_Obj *listPtr, *nsObjPtr;
  8502   8694           Tcl_Namespace *nsPtr = (Tcl_Namespace *) iPtr->varFramePtr->nsPtr;
  8503         -        Tcl_Namespace *ns1Ptr;
  8504   8695   
  8505   8696           /* The tailcall data is in a Tcl list: the first element is the
  8506   8697            * namespace, the rest the command to be tailcalled. */
  8507   8698   
  8508         -        listPtr = Tcl_NewListObj(objc, objv);
  8509         -
  8510   8699           nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
  8511         -        if ((TCL_OK != TclGetNamespaceFromObj(interp, nsObjPtr, &ns1Ptr))
  8512         -                || (nsPtr != ns1Ptr)) {
  8513         -            Tcl_Panic("Tailcall failed to find the proper namespace");
  8514         -        }
         8700  +        listPtr = Tcl_NewListObj(objc, objv);
  8515   8701    	TclListObjSetElement(interp, listPtr, 0, nsObjPtr);
  8516   8702   
  8517   8703           iPtr->varFramePtr->tailcallPtr = listPtr;
  8518   8704       }
  8519   8705       return TCL_RETURN;
  8520   8706   }
  8521   8707   

Changes to generic/tclBinary.c.

  1959   1959   FormatNumber(
  1960   1960       Tcl_Interp *interp,		/* Current interpreter, used to report
  1961   1961   				 * errors. */
  1962   1962       int type,			/* Type of number to format. */
  1963   1963       Tcl_Obj *src,		/* Number to format. */
  1964   1964       unsigned char **cursorPtr)	/* Pointer to index into destination buffer. */
  1965   1965   {
  1966         -    long value;
  1967   1966       double dvalue;
  1968   1967       Tcl_WideInt wvalue;
  1969   1968       float fvalue;
  1970   1969   
  1971   1970       switch (type) {
  1972   1971       case 'd':
  1973   1972       case 'q':
................................................................................
  2021   2020   
  2022   2021   	/*
  2023   2022   	 * 64-bit integer values.
  2024   2023   	 */
  2025   2024       case 'w':
  2026   2025       case 'W':
  2027   2026       case 'm':
  2028         -	if (Tcl_GetWideIntFromObj(interp, src, &wvalue) != TCL_OK) {
         2027  +	if (TclGetWideBitsFromObj(interp, src, &wvalue) != TCL_OK) {
  2029   2028   	    return TCL_ERROR;
  2030   2029   	}
  2031   2030   	if (NeedReversing(type)) {
  2032   2031   	    *(*cursorPtr)++ = UCHAR(wvalue);
  2033   2032   	    *(*cursorPtr)++ = UCHAR(wvalue >> 8);
  2034   2033   	    *(*cursorPtr)++ = UCHAR(wvalue >> 16);
  2035   2034   	    *(*cursorPtr)++ = UCHAR(wvalue >> 24);
................................................................................
  2051   2050   
  2052   2051   	/*
  2053   2052   	 * 32-bit integer values.
  2054   2053   	 */
  2055   2054       case 'i':
  2056   2055       case 'I':
  2057   2056       case 'n':
  2058         -	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
         2057  +	if (TclGetWideBitsFromObj(interp, src, &wvalue) != TCL_OK) {
  2059   2058   	    return TCL_ERROR;
  2060   2059   	}
  2061   2060   	if (NeedReversing(type)) {
  2062         -	    *(*cursorPtr)++ = UCHAR(value);
  2063         -	    *(*cursorPtr)++ = UCHAR(value >> 8);
  2064         -	    *(*cursorPtr)++ = UCHAR(value >> 16);
  2065         -	    *(*cursorPtr)++ = UCHAR(value >> 24);
         2061  +	    *(*cursorPtr)++ = UCHAR(wvalue);
         2062  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 8);
         2063  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 16);
         2064  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 24);
  2066   2065   	} else {
  2067         -	    *(*cursorPtr)++ = UCHAR(value >> 24);
  2068         -	    *(*cursorPtr)++ = UCHAR(value >> 16);
  2069         -	    *(*cursorPtr)++ = UCHAR(value >> 8);
  2070         -	    *(*cursorPtr)++ = UCHAR(value);
         2066  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 24);
         2067  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 16);
         2068  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 8);
         2069  +	    *(*cursorPtr)++ = UCHAR(wvalue);
  2071   2070   	}
  2072   2071   	return TCL_OK;
  2073   2072   
  2074   2073   	/*
  2075   2074   	 * 16-bit integer values.
  2076   2075   	 */
  2077   2076       case 's':
  2078   2077       case 'S':
  2079   2078       case 't':
  2080         -	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
         2079  +	if (TclGetWideBitsFromObj(interp, src, &wvalue) != TCL_OK) {
  2081   2080   	    return TCL_ERROR;
  2082   2081   	}
  2083   2082   	if (NeedReversing(type)) {
  2084         -	    *(*cursorPtr)++ = UCHAR(value);
  2085         -	    *(*cursorPtr)++ = UCHAR(value >> 8);
         2083  +	    *(*cursorPtr)++ = UCHAR(wvalue);
         2084  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 8);
  2086   2085   	} else {
  2087         -	    *(*cursorPtr)++ = UCHAR(value >> 8);
  2088         -	    *(*cursorPtr)++ = UCHAR(value);
         2086  +	    *(*cursorPtr)++ = UCHAR(wvalue >> 8);
         2087  +	    *(*cursorPtr)++ = UCHAR(wvalue);
  2089   2088   	}
  2090   2089   	return TCL_OK;
  2091   2090   
  2092   2091   	/*
  2093   2092   	 * 8-bit integer values.
  2094   2093   	 */
  2095   2094       case 'c':
  2096         -	if (TclGetLongFromObj(interp, src, &value) != TCL_OK) {
         2095  +	if (TclGetWideBitsFromObj(interp, src, &wvalue) != TCL_OK) {
  2097   2096   	    return TCL_ERROR;
  2098   2097   	}
  2099         -	*(*cursorPtr)++ = UCHAR(value);
         2098  +	*(*cursorPtr)++ = UCHAR(wvalue);
  2100   2099   	return TCL_OK;
  2101   2100   
  2102   2101       default:
  2103   2102   	Tcl_Panic("unexpected fallthrough");
  2104   2103   	return TCL_ERROR;
  2105   2104       }
  2106   2105   }
................................................................................
  2480   2479   	for (i=0 ; i<2 ; i++) {
  2481   2480   	    if (data >= dataend) {
  2482   2481   		value <<= 4;
  2483   2482   		break;
  2484   2483   	    }
  2485   2484   
  2486   2485   	    c = *data++;
  2487         -	    if (!isxdigit((int) c)) {
  2488         -		if (strict || !isspace(c)) {
         2486  +	    if (!isxdigit(UCHAR(c))) {
         2487  +		if (strict || !TclIsSpaceProc(c)) {
  2489   2488   		    goto badChar;
  2490   2489   		}
  2491   2490   		i--;
  2492   2491   		continue;
  2493   2492   	    }
  2494   2493   
  2495   2494   	    value <<= 4;
................................................................................
  2828   2827   
  2829   2828       while (data < dataend) {
  2830   2829   	char d[4] = {0, 0, 0, 0};
  2831   2830   
  2832   2831   	if (lineLen < 0) {
  2833   2832   	    c = *data++;
  2834   2833   	    if (c < 32 || c > 96) {
  2835         -		if (strict || !isspace(c)) {
         2834  +		if (strict || !TclIsSpaceProc(c)) {
  2836   2835   		    goto badUu;
  2837   2836   		}
  2838   2837   		i--;
  2839   2838   		continue;
  2840   2839   	    }
  2841   2840   	    lineLen = (c - 32) & 0x3f;
  2842   2841   	}
................................................................................
  2846   2845   	 */
  2847   2846   
  2848   2847   	for (i=0 ; i<4 ; i++) {
  2849   2848   	    if (data < dataend) {
  2850   2849   		d[i] = c = *data++;
  2851   2850   		if (c < 32 || c > 96) {
  2852   2851   		    if (strict) {
  2853         -			if (!isspace(c)) {
         2852  +			if (!TclIsSpaceProc(c)) {
  2854   2853   			    goto badUu;
  2855   2854   			} else if (c == '\n') {
  2856   2855   			    goto shortUu;
  2857   2856   			}
  2858   2857   		    }
  2859   2858   		    i--;
  2860   2859   		    continue;
................................................................................
  2890   2889   	    do {
  2891   2890   		c = *data++;
  2892   2891   		if (c == '\n') {
  2893   2892   		    break;
  2894   2893   		} else if (c >= 32 && c <= 96) {
  2895   2894   		    data--;
  2896   2895   		    break;
  2897         -		} else if (strict || !isspace(c)) {
         2896  +		} else if (strict || !TclIsSpaceProc(c)) {
  2898   2897   		    goto badUu;
  2899   2898   		}
  2900   2899   	    } while (data < dataend);
  2901   2900   	}
  2902   2901       }
  2903   2902   
  2904   2903       /*
................................................................................
  3015   3014   	     * input whitespace characters.
  3016   3015   	     */
  3017   3016   
  3018   3017   	    if (cut) {
  3019   3018   		if (c == '=' && i > 1) {
  3020   3019   		     value <<= 6;
  3021   3020   		     cut++;
  3022         -		} else if (!strict && isspace(c)) {
         3021  +		} else if (!strict && TclIsSpaceProc(c)) {
  3023   3022   		     i--;
  3024   3023   		} else {
  3025   3024   		    goto bad64;
  3026   3025   		}
  3027   3026   	    } else if (c >= 'A' && c <= 'Z') {
  3028   3027   		value = (value << 6) | ((c - 'A') & 0x3f);
  3029   3028   	    } else if (c >= 'a' && c <= 'z') {
................................................................................
  3033   3032   	    } else if (c == '+') {
  3034   3033   		value = (value << 6) | 0x3e;
  3035   3034   	    } else if (c == '/') {
  3036   3035   		value = (value << 6) | 0x3f;
  3037   3036   	    } else if (c == '=') {
  3038   3037   		value <<= 6;
  3039   3038   		cut++;
  3040         -	    } else if (strict || !isspace(c)) {
         3039  +	    } else if (strict || !TclIsSpaceProc(c)) {
  3041   3040   		goto bad64;
  3042   3041   	    } else {
  3043   3042   		i--;
  3044   3043   	    }
  3045   3044   	}
  3046   3045   	*cursor++ = UCHAR((value >> 16) & 0xff);
  3047   3046   	*cursor++ = UCHAR((value >> 8) & 0xff);
................................................................................
  3054   3053   	 */
  3055   3054   
  3056   3055   	if (cut && data < dataend) {
  3057   3056   	    if (strict) {
  3058   3057   		goto bad64;
  3059   3058   	    }
  3060   3059   	    for (; data < dataend; data++) {
  3061         -		if (!isspace(*data)) {
         3060  +		if (!TclIsSpaceProc(*data)) {
  3062   3061   		    goto bad64;
  3063   3062   		}
  3064   3063   	    }
  3065   3064   	}
  3066   3065       }
  3067   3066       Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
  3068   3067       Tcl_SetObjResult(interp, resultObj);

Changes to generic/tclCmdAH.c.

    42     42   
    43     43   /*
    44     44    * Prototypes for local procedures defined in this file:
    45     45    */
    46     46   
    47     47   static int		CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr,
    48     48   			    int mode);
    49         -static int		BadEncodingSubcommand(ClientData dummy,
    50         -			    Tcl_Interp *interp, int objc,
    51         -			    Tcl_Obj *const objv[]);
    52     49   static int		EncodingConvertfromObjCmd(ClientData dummy,
    53     50   			    Tcl_Interp *interp, int objc,
    54     51   			    Tcl_Obj *const objv[]);
    55     52   static int		EncodingConverttoObjCmd(ClientData dummy,
    56     53   			    Tcl_Interp *interp, int objc,
    57     54   			    Tcl_Obj *const objv[]);
    58     55   static int		EncodingDirsObjCmd(ClientData dummy,
................................................................................
    80     77   static Tcl_NRPostProc	ForSetupCallback;
    81     78   static Tcl_NRPostProc	ForCondCallback;
    82     79   static Tcl_NRPostProc	ForNextCallback;
    83     80   static Tcl_NRPostProc	ForPostNextCallback;
    84     81   static Tcl_NRPostProc	ForeachLoopStep;
    85     82   static Tcl_NRPostProc	EvalCmdErrMsg;
    86     83   
    87         -static Tcl_ObjCmdProc	BadFileSubcommand;
    88     84   static Tcl_ObjCmdProc FileAttrAccessTimeCmd;
    89     85   static Tcl_ObjCmdProc FileAttrIsDirectoryCmd;
    90     86   static Tcl_ObjCmdProc FileAttrIsExecutableCmd;
    91     87   static Tcl_ObjCmdProc FileAttrIsExistingCmd;
    92     88   static Tcl_ObjCmdProc FileAttrIsFileCmd;
    93     89   static Tcl_ObjCmdProc FileAttrIsOwnedCmd;
    94     90   static Tcl_ObjCmdProc FileAttrIsReadableCmd;
................................................................................
   508    504   {
   509    505       if (objc != 1) {
   510    506   	Tcl_WrongNumArgs(interp, 1, objv, NULL);
   511    507   	return TCL_ERROR;
   512    508       }
   513    509       return TCL_CONTINUE;
   514    510   }
   515         -
   516         -/*
   517         - *----------------------------------------------------------------------
   518         - *
   519         - * Tcl_EncodingObjCmd --
   520         - *
   521         - *	This command manipulates encodings.
   522         - *
   523         - * Results:
   524         - *	A standard Tcl result.
   525         - *
   526         - * Side effects:
   527         - *	See the user documentation.
   528         - *
   529         - *----------------------------------------------------------------------
   530         - */
   531         -
   532         -int
   533         -Tcl_EncodingObjCmd(
   534         -    ClientData dummy,		/* Not used. */
   535         -    Tcl_Interp *interp,		/* Current interpreter. */
   536         -    int objc,			/* Number of arguments. */
   537         -    Tcl_Obj *const objv[])	/* Argument objects. */
   538         -{
   539         -    int index;
   540         -
   541         -    static const char *const optionStrings[] = {
   542         -	"convertfrom", "convertto", "dirs", "names", "system",
   543         -	NULL
   544         -    };
   545         -    enum options {
   546         -	ENC_CONVERTFROM, ENC_CONVERTTO, ENC_DIRS, ENC_NAMES, ENC_SYSTEM
   547         -    };
   548         -
   549         -    if (objc < 2) {
   550         -	Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
   551         -	return TCL_ERROR;
   552         -    }
   553         -    if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
   554         -	    &index) != TCL_OK) {
   555         -	return TCL_ERROR;
   556         -    }
   557         -
   558         -    switch ((enum options) index) {
   559         -    case ENC_CONVERTTO:
   560         -	return EncodingConverttoObjCmd(dummy, interp, objc, objv);
   561         -    case ENC_CONVERTFROM:
   562         -	return EncodingConvertfromObjCmd(dummy, interp, objc, objv);
   563         -    case ENC_DIRS:
   564         -	return EncodingDirsObjCmd(dummy, interp, objc, objv);
   565         -    case ENC_NAMES:
   566         -	return EncodingNamesObjCmd(dummy, interp, objc, objv);
   567         -    case ENC_SYSTEM:
   568         -	return EncodingSystemObjCmd(dummy, interp, objc, objv);
   569         -    }
   570         -    return TCL_OK;
   571         -}
   572    511   
   573    512   /*
   574    513    *-----------------------------------------------------------------------------
   575    514    *
   576    515    * TclInitEncodingCmd --
   577    516    *
   578    517    *	This function creates the 'encoding' ensemble.
................................................................................
   589    528   Tcl_Command
   590    529   TclInitEncodingCmd(
   591    530       Tcl_Interp* interp)		/* Tcl interpreter */
   592    531   {
   593    532       static const EnsembleImplMap encodingImplMap[] = {
   594    533   	{"convertfrom", EncodingConvertfromObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
   595    534   	{"convertto",   EncodingConverttoObjCmd,   TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
   596         -	{"dirs",        EncodingDirsObjCmd,        TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
          535  +	{"dirs",        EncodingDirsObjCmd,        TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
   597    536   	{"names",       EncodingNamesObjCmd,       TclCompileBasic0ArgCmd,    NULL, NULL, 0},
   598         -	{"system",      EncodingSystemObjCmd,      TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
          537  +	{"system",      EncodingSystemObjCmd,      TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
   599    538   	{NULL,          NULL,                      NULL,                      NULL, NULL, 0}
   600    539       };
   601    540   
   602    541       return TclMakeEnsemble(interp, "encoding", encodingImplMap);
   603    542   }
   604         -
   605         -/*
   606         - *-----------------------------------------------------------------------------
   607         - *
   608         - * TclMakeEncodingCommandSafe --
   609         - *
   610         - *	This function hides the unsafe 'dirs' and 'system' subcommands of
   611         - *	the "encoding" Tcl command ensemble. It must be called only from
   612         - *	TclHideUnsafeCommands.
   613         - *
   614         - * Results:
   615         - *	A standard Tcl result
   616         - *
   617         - * Side effects:
   618         - *	Adds commands to the table of hidden commands.
   619         - *
   620         - *-----------------------------------------------------------------------------
   621         - */
   622         -
   623         -int
   624         -TclMakeEncodingCommandSafe(
   625         -    Tcl_Interp* interp)		/* Tcl interpreter */
   626         -{
   627         -    static const struct {
   628         -	const char *cmdName;
   629         -	int unsafe;
   630         -    } unsafeInfo[] = {
   631         -	{"convertfrom", 0},
   632         -	{"convertto",   0},
   633         -	{"dirs",        1},
   634         -	{"names",       0},
   635         -	{"system",      0},
   636         -	{NULL,          0}
   637         -    };
   638         -
   639         -    int i;
   640         -    Tcl_DString oldBuf, newBuf;
   641         -
   642         -    Tcl_DStringInit(&oldBuf);
   643         -    TclDStringAppendLiteral(&oldBuf, "::tcl::encoding::");
   644         -    Tcl_DStringInit(&newBuf);
   645         -    TclDStringAppendLiteral(&newBuf, "tcl:encoding:");
   646         -    for (i=0 ; unsafeInfo[i].cmdName != NULL ; i++) {
   647         -	if (unsafeInfo[i].unsafe) {
   648         -	    const char *oldName, *newName;
   649         -
   650         -	    Tcl_DStringSetLength(&oldBuf, 17);
   651         -	    oldName = Tcl_DStringAppend(&oldBuf, unsafeInfo[i].cmdName, -1);
   652         -	    Tcl_DStringSetLength(&newBuf, 13);
   653         -	    newName = Tcl_DStringAppend(&newBuf, unsafeInfo[i].cmdName, -1);
   654         -	    if (TclRenameCommand(interp, oldName, "___tmp") != TCL_OK
   655         -		    || Tcl_HideCommand(interp, "___tmp", newName) != TCL_OK) {
   656         -		Tcl_Panic("problem making 'encoding %s' safe: %s",
   657         -			unsafeInfo[i].cmdName,
   658         -			Tcl_GetString(Tcl_GetObjResult(interp)));
   659         -	    }
   660         -	    Tcl_CreateObjCommand(interp, oldName, BadEncodingSubcommand,
   661         -		    (ClientData) unsafeInfo[i].cmdName, NULL);
   662         -	}
   663         -    }
   664         -    Tcl_DStringFree(&oldBuf);
   665         -    Tcl_DStringFree(&newBuf);
   666         -
   667         -    /*
   668         -     * Ugh. The [encoding] command is now actually safe, but it is assumed by
   669         -     * scripts that it is not, which messes up security policies.
   670         -     */
   671         -
   672         -    if (Tcl_HideCommand(interp, "encoding", "encoding") != TCL_OK) {
   673         -	Tcl_Panic("problem making 'encoding' safe: %s",
   674         -		Tcl_GetString(Tcl_GetObjResult(interp)));
   675         -    }
   676         -    return TCL_OK;
   677         -}
   678         -
   679         -/*
   680         - *----------------------------------------------------------------------
   681         - *
   682         - * BadEncodingSubcommand --
   683         - *
   684         - *	Command used to act as a backstop implementation when subcommands of
   685         - *	"encoding" are unsafe (the real implementations of the subcommands are
   686         - *	hidden). The clientData is always the full official subcommand name.
   687         - *
   688         - * Results:
   689         - *	A standard Tcl result (always a TCL_ERROR).
   690         - *
   691         - * Side effects:
   692         - *	None.
   693         - *
   694         - *----------------------------------------------------------------------
   695         - */
   696         -
   697         -static int
   698         -BadEncodingSubcommand(
   699         -    ClientData clientData,
   700         -    Tcl_Interp *interp,
   701         -    int objc,
   702         -    Tcl_Obj *const objv[])
   703         -{
   704         -    const char *subcommandName = (const char *) clientData;
   705         -
   706         -    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
   707         -	    "not allowed to invoke subcommand %s of encoding", subcommandName));
   708         -    Tcl_SetErrorCode(interp, "TCL", "SAFE", "SUBCOMMAND", NULL);
   709         -    return TCL_ERROR;
   710         -}
   711    543   
   712    544   /*
   713    545    *----------------------------------------------------------------------
   714    546    *
   715    547    * EncodingConvertfromObjCmd --
   716    548    *
   717    549    *	This command converts a byte array in an external encoding into a
................................................................................
  1227   1059       /*
  1228   1060        * Note that most subcommands are unsafe because either they manipulate
  1229   1061        * the native filesystem or because they reveal information about the
  1230   1062        * native filesystem.
  1231   1063        */
  1232   1064   
  1233   1065       static const EnsembleImplMap initMap[] = {
  1234         -	{"atime",	FileAttrAccessTimeCmd,	TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
  1235         -	{"attributes",	TclFileAttrsCmd,	NULL, NULL, NULL, 0},
         1066  +	{"atime",	FileAttrAccessTimeCmd,	TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
         1067  +	{"attributes",	TclFileAttrsCmd,	NULL, NULL, NULL, 1},
  1236   1068   	{"channels",	TclChannelNamesCmd,	TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
  1237         -	{"copy",	TclFileCopyCmd,		NULL, NULL, NULL, 0},
  1238         -	{"delete",	TclFileDeleteCmd,	TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
  1239         -	{"dirname",	PathDirNameCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1240         -	{"executable",	FileAttrIsExecutableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1241         -	{"exists",	FileAttrIsExistingCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1242         -	{"extension",	PathExtensionCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1243         -	{"isdirectory",	FileAttrIsDirectoryCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1244         -	{"isfile",	FileAttrIsFileCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
         1069  +	{"copy",	TclFileCopyCmd,		NULL, NULL, NULL, 1},
         1070  +	{"delete",	TclFileDeleteCmd,	TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
         1071  +	{"dirname",	PathDirNameCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1072  +	{"executable",	FileAttrIsExecutableCmd, TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1073  +	{"exists",	FileAttrIsExistingCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1074  +	{"extension",	PathExtensionCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1075  +	{"isdirectory",	FileAttrIsDirectoryCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1076  +	{"isfile",	FileAttrIsFileCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
  1245   1077   	{"join",	PathJoinCmd,		TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
  1246         -	{"link",	TclFileLinkCmd,		TclCompileBasic1To3ArgCmd, NULL, NULL, 0},
  1247         -	{"lstat",	FileAttrLinkStatCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
  1248         -	{"mtime",	FileAttrModifyTimeCmd,	TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
  1249         -	{"mkdir",	TclFileMakeDirsCmd,	TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
  1250         -	{"nativename",	PathNativeNameCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1251         -	{"normalize",	PathNormalizeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1252         -	{"owned",	FileAttrIsOwnedCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
         1078  +	{"link",	TclFileLinkCmd,		TclCompileBasic1To3ArgCmd, NULL, NULL, 1},
         1079  +	{"lstat",	FileAttrLinkStatCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 1},
         1080  +	{"mtime",	FileAttrModifyTimeCmd,	TclCompileBasic1Or2ArgCmd, NULL, NULL, 1},
         1081  +	{"mkdir",	TclFileMakeDirsCmd,	TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
         1082  +	{"nativename",	PathNativeNameCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1083  +	{"normalize",	PathNormalizeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1084  +	{"owned",	FileAttrIsOwnedCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
  1253   1085   	{"pathtype",	PathTypeCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1254         -	{"readable",	FileAttrIsReadableCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1255         -	{"readlink",	TclFileReadLinkCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1256         -	{"rename",	TclFileRenameCmd,	NULL, NULL, NULL, 0},
  1257         -	{"rootname",	PathRootNameCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
         1086  +	{"readable",	FileAttrIsReadableCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1087  +	{"readlink",	TclFileReadLinkCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1088  +	{"rename",	TclFileRenameCmd,	NULL, NULL, NULL, 1},
         1089  +	{"rootname",	PathRootNameCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
  1258   1090   	{"separator",	FilesystemSeparatorCmd,	TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
  1259         -	{"size",	FileAttrSizeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
         1091  +	{"size",	FileAttrSizeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
  1260   1092   	{"split",	PathSplitCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1261         -	{"stat",	FileAttrStatCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
         1093  +	{"stat",	FileAttrStatCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 1},
  1262   1094   	{"system",	PathFilesystemCmd,	TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
  1263         -	{"tail",	PathTailCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1264         -	{"tempfile",	TclFileTemporaryCmd,	TclCompileBasic0To2ArgCmd, NULL, NULL, 0},
  1265         -	{"type",	FileAttrTypeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
  1266         -	{"volumes",	FilesystemVolumesCmd,	TclCompileBasic0ArgCmd, NULL, NULL, 0},
  1267         -	{"writable",	FileAttrIsWritableCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 0},
         1095  +	{"tail",	PathTailCmd,		TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1096  +	{"tempfile",	TclFileTemporaryCmd,	TclCompileBasic0To2ArgCmd, NULL, NULL, 1},
         1097  +	{"type",	FileAttrTypeCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
         1098  +	{"volumes",	FilesystemVolumesCmd,	TclCompileBasic0ArgCmd, NULL, NULL, 1},
         1099  +	{"writable",	FileAttrIsWritableCmd,	TclCompileBasic1ArgCmd, NULL, NULL, 1},
  1268   1100   	{NULL, NULL, NULL, NULL, NULL, 0}
  1269   1101       };
  1270   1102       return TclMakeEnsemble(interp, "file", initMap);
  1271   1103   }
  1272         -
  1273         -/*
  1274         - *----------------------------------------------------------------------
  1275         - *
  1276         - * TclMakeFileCommandSafe --
  1277         - *
  1278         - *	This function hides the unsafe subcommands of the "file" Tcl command
  1279         - *	ensemble. It must only be called from TclHideUnsafeCommands.
  1280         - *
  1281         - * Results:
  1282         - *	A standard Tcl result.
  1283         - *
  1284         - * Side effects:
  1285         - *	Adds commands to the table of hidden commands.
  1286         - *
  1287         - *----------------------------------------------------------------------
  1288         - */
  1289         -
  1290         -int
  1291         -TclMakeFileCommandSafe(
  1292         -    Tcl_Interp *interp)
  1293         -{
  1294         -    static const struct {
  1295         -	const char *cmdName;
  1296         -	int unsafe;
  1297         -    } unsafeInfo[] = {
  1298         -	{"atime",	 1},
  1299         -	{"attributes",	 1},
  1300         -	{"channels",	 0},
  1301         -	{"copy",	 1},
  1302         -	{"delete",	 1},
  1303         -	{"dirname",	 1},
  1304         -	{"executable",	 1},
  1305         -	{"exists",	 1},
  1306         -	{"extension",	 1},
  1307         -	{"isdirectory",	 1},
  1308         -	{"isfile",	 1},
  1309         -	{"join",	 0},
  1310         -	{"link",	 1},
  1311         -	{"lstat",	 1},
  1312         -	{"mtime",	 1},
  1313         -	{"mkdir",	 1},
  1314         -	{"nativename",	 1},
  1315         -	{"normalize",	 1},
  1316         -	{"owned",	 1},
  1317         -	{"pathtype",	 0},
  1318         -	{"readable",	 1},
  1319         -	{"readlink",	 1},
  1320         -	{"rename",	 1},
  1321         -	{"rootname",	 1},
  1322         -	{"separator",	 0},
  1323         -	{"size",	 1},
  1324         -	{"split",	 0},
  1325         -	{"stat",	 1},
  1326         -	{"system",	 0},
  1327         -	{"tail",	 1},
  1328         -	{"tempfile",	 1},
  1329         -	{"type",	 1},
  1330         -	{"volumes",	 1},
  1331         -	{"writable",	 1},
  1332         -	{NULL, 0}
  1333         -    };
  1334         -    int i;
  1335         -    Tcl_DString oldBuf, newBuf;
  1336         -
  1337         -    Tcl_DStringInit(&oldBuf);
  1338         -    TclDStringAppendLiteral(&oldBuf, "::tcl::file::");
  1339         -    Tcl_DStringInit(&newBuf);
  1340         -    TclDStringAppendLiteral(&newBuf, "tcl:file:");
  1341         -    for (i=0 ; unsafeInfo[i].cmdName != NULL ; i++) {
  1342         -	if (unsafeInfo[i].unsafe) {
  1343         -	    const char *oldName, *newName;
  1344         -
  1345         -	    Tcl_DStringSetLength(&oldBuf, 13);
  1346         -	    oldName = Tcl_DStringAppend(&oldBuf, unsafeInfo[i].cmdName, -1);
  1347         -	    Tcl_DStringSetLength(&newBuf, 9);
  1348         -	    newName = Tcl_DStringAppend(&newBuf, unsafeInfo[i].cmdName, -1);
  1349         -	    if (TclRenameCommand(interp, oldName, "___tmp") != TCL_OK
  1350         -		    || Tcl_HideCommand(interp, "___tmp", newName) != TCL_OK) {
  1351         -		Tcl_Panic("problem making 'file %s' safe: %s",
  1352         -			unsafeInfo[i].cmdName,
  1353         -			Tcl_GetString(Tcl_GetObjResult(interp)));
  1354         -	    }
  1355         -	    Tcl_CreateObjCommand(interp, oldName, BadFileSubcommand,
  1356         -		    (ClientData) unsafeInfo[i].cmdName, NULL);
  1357         -	}
  1358         -    }
  1359         -    Tcl_DStringFree(&oldBuf);
  1360         -    Tcl_DStringFree(&newBuf);
  1361         -
  1362         -    /*
  1363         -     * Ugh. The [file] command is now actually safe, but it is assumed by
  1364         -     * scripts that it is not, which messes up security policies. [Bug
  1365         -     * 3211758]
  1366         -     */
  1367         -
  1368         -    if (Tcl_HideCommand(interp, "file", "file") != TCL_OK) {
  1369         -	Tcl_Panic("problem making 'file' safe: %s",
  1370         -		Tcl_GetString(Tcl_GetObjResult(interp)));
  1371         -    }
  1372         -    return TCL_OK;
  1373         -}
  1374         -
  1375         -/*
  1376         - *----------------------------------------------------------------------
  1377         - *
  1378         - * BadFileSubcommand --
  1379         - *
  1380         - *	Command used to act as a backstop implementation when subcommands of
  1381         - *	"file" are unsafe (the real implementations of the subcommands are
  1382         - *	hidden). The clientData is always the full official subcommand name.
  1383         - *
  1384         - * Results:
  1385         - *	A standard Tcl result (always a TCL_ERROR).
  1386         - *
  1387         - * Side effects:
  1388         - *	None.
  1389         - *
  1390         - *----------------------------------------------------------------------
  1391         - */
  1392         -
  1393         -static int
  1394         -BadFileSubcommand(
  1395         -    ClientData clientData,
  1396         -    Tcl_Interp *interp,
  1397         -    int objc,
  1398         -    Tcl_Obj *const objv[])
  1399         -{
  1400         -    const char *subcommandName = (const char *) clientData;
  1401         -
  1402         -    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  1403         -	    "not allowed to invoke subcommand %s of file", subcommandName));
  1404         -    Tcl_SetErrorCode(interp, "TCL", "SAFE", "SUBCOMMAND", NULL);
  1405         -    return TCL_ERROR;
  1406         -}
  1407   1104   
  1408   1105   /*
  1409   1106    *----------------------------------------------------------------------
  1410   1107    *
  1411   1108    * FileAttrAccessTimeCmd --
  1412   1109    *
  1413   1110    *	This function is invoked to process the "file atime" Tcl command. See
................................................................................
  1451   1148   
  1452   1149       if (objc == 3) {
  1453   1150   	/*
  1454   1151   	 * Need separate variable for reading longs from an object on 64-bit
  1455   1152   	 * platforms. [Bug 698146]
  1456   1153   	 */
  1457   1154   
  1458         -	long newTime;
         1155  +	Tcl_WideInt newTime;
  1459   1156   
  1460         -	if (TclGetLongFromObj(interp, objv[2], &newTime) != TCL_OK) {
         1157  +	if (TclGetWideIntFromObj(interp, objv[2], &newTime) != TCL_OK) {
  1461   1158   	    return TCL_ERROR;
  1462   1159   	}
  1463   1160   
  1464   1161   	tval.actime = newTime;
  1465   1162   	tval.modtime = buf.st_mtime;
  1466   1163   
  1467   1164   	if (Tcl_FSUtime(objv[1], &tval) != 0) {
................................................................................
  1532   1229   #endif
  1533   1230       if (objc == 3) {
  1534   1231   	/*
  1535   1232   	 * Need separate variable for reading longs from an object on 64-bit
  1536   1233   	 * platforms. [Bug 698146]
  1537   1234   	 */
  1538   1235   
  1539         -	long newTime;
         1236  +	Tcl_WideInt newTime;
  1540   1237   
  1541         -	if (TclGetLongFromObj(interp, objv[2], &newTime) != TCL_OK) {
         1238  +	if (TclGetWideIntFromObj(interp, objv[2], &newTime) != TCL_OK) {
  1542   1239   	    return TCL_ERROR;
  1543   1240   	}
  1544   1241   
  1545   1242   	tval.actime = buf.st_atime;
  1546   1243   	tval.modtime = newTime;
  1547   1244   
  1548   1245   	if (Tcl_FSUtime(objv[1], &tval) != 0) {

Changes to generic/tclCmdIL.c.

   133    133   static int		InfoPatchLevelCmd(ClientData dummy, Tcl_Interp *interp,
   134    134   			    int objc, Tcl_Obj *const objv[]);
   135    135   static int		InfoProcsCmd(ClientData dummy, Tcl_Interp *interp,
   136    136   			    int objc, Tcl_Obj *const objv[]);
   137    137   static int		InfoScriptCmd(ClientData dummy, Tcl_Interp *interp,
   138    138   			    int objc, Tcl_Obj *const objv[]);
   139    139   static int		InfoSharedlibCmd(ClientData dummy, Tcl_Interp *interp,
          140  +			    int objc, Tcl_Obj *const objv[]);
          141  +static int		InfoCmdTypeCmd(ClientData dummy, Tcl_Interp *interp,
   140    142   			    int objc, Tcl_Obj *const objv[]);
   141    143   static int		InfoTclVersionCmd(ClientData dummy, Tcl_Interp *interp,
   142    144   			    int objc, Tcl_Obj *const objv[]);
   143    145   static SortElement *	MergeLists(SortElement *leftPtr, SortElement *rightPtr,
   144    146   			    SortInfo *infoPtr);
   145    147   static int		SortCompare(SortElement *firstPtr, SortElement *second,
   146    148   			    SortInfo *infoPtr);
................................................................................
   152    154    * "info" command.
   153    155    */
   154    156   
   155    157   static const EnsembleImplMap defaultInfoMap[] = {
   156    158       {"args",		   InfoArgsCmd,		    TclCompileBasic1ArgCmd, NULL, NULL, 0},
   157    159       {"body",		   InfoBodyCmd,		    TclCompileBasic1ArgCmd, NULL, NULL, 0},
   158    160       {"cmdcount",	   InfoCmdCountCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
          161  +    {"cmdtype",		   InfoCmdTypeCmd,	    TclCompileBasic1ArgCmd, NULL, NULL, 1},
   159    162       {"commands",	   InfoCommandsCmd,	    TclCompileInfoCommandsCmd, NULL, NULL, 0},
   160    163       {"complete",	   InfoCompleteCmd,	    TclCompileBasic1ArgCmd, NULL, NULL, 0},
   161    164       {"coroutine",	   TclInfoCoroutineCmd,     TclCompileInfoCoroutineCmd, NULL, NULL, 0},
   162    165       {"default",		   InfoDefaultCmd,	    TclCompileBasic3ArgCmd, NULL, NULL, 0},
   163    166       {"errorstack",	   InfoErrorStackCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   164    167       {"exists",		   TclInfoExistsCmd,	    TclCompileInfoExistsCmd, NULL, NULL, 0},
   165    168       {"frame",		   InfoFrameCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
................................................................................
   166    169       {"functions",	   InfoFunctionsCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   167    170       {"globals",		   TclInfoGlobalsCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   168    171       {"hostname",	   InfoHostnameCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
   169    172       {"level",		   InfoLevelCmd,	    TclCompileInfoLevelCmd, NULL, NULL, 0},
   170    173       {"library",		   InfoLibraryCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
   171    174       {"loaded",		   InfoLoadedCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   172    175       {"locals",		   TclInfoLocalsCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   173         -    {"nameofexecutable",   InfoNameOfExecutableCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
          176  +    {"nameofexecutable",   InfoNameOfExecutableCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1},
   174    177       {"patchlevel",	   InfoPatchLevelCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
   175    178       {"procs",		   InfoProcsCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   176    179       {"script",		   InfoScriptCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   177    180       {"sharedlibextension", InfoSharedlibCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
   178    181       {"tclversion",	   InfoTclVersionCmd,	    TclCompileBasic0ArgCmd, NULL, NULL, 0},
   179    182       {"vars",		   TclInfoVarsCmd,	    TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
   180    183       {NULL, NULL, NULL, NULL, NULL, 0}
................................................................................
  2128   2131       }
  2129   2132       return TCL_ERROR;
  2130   2133   }
  2131   2134   
  2132   2135   /*
  2133   2136    *----------------------------------------------------------------------
  2134   2137    *
         2138  + * InfoCmdTypeCmd --
         2139  + *
         2140  + *	Called to implement the "info cmdtype" command that returns the type
         2141  + *	of a given command. Handles the following syntax:
         2142  + *
         2143  + *	    info cmdtype cmdName
         2144  + *
         2145  + * Results:
         2146  + *	Returns TCL_OK if successful and TCL_ERROR if there is an error.
         2147  + *
         2148  + * Side effects:
         2149  + *	Returns a type name. If there is an error, the result is an error
         2150  + *	message.
         2151  + *
         2152  + *----------------------------------------------------------------------
         2153  + */
         2154  +
         2155  +static int
         2156  +InfoCmdTypeCmd(
         2157  +    ClientData dummy,		/* Not used. */
         2158  +    Tcl_Interp *interp,		/* Current interpreter. */
         2159  +    int objc,			/* Number of arguments. */
         2160  +    Tcl_Obj *const objv[])	/* Argument objects. */
         2161  +{
         2162  +    Tcl_Command command;
         2163  +
         2164  +    if (objc != 2) {
         2165  +	Tcl_WrongNumArgs(interp, 1, objv, "commandName");
         2166  +	return TCL_ERROR;
         2167  +    }
         2168  +    command = Tcl_FindCommand(interp, Tcl_GetString(objv[1]), NULL,
         2169  +	    TCL_LEAVE_ERR_MSG);
         2170  +    if (command == NULL) {
         2171  +	return TCL_ERROR;
         2172  +    }
         2173  +
         2174  +    /*
         2175  +     * There's one special case: safe slave interpreters can't see aliases as
         2176  +     * aliases as they're part of the security mechanisms.
         2177  +     */
         2178  +
         2179  +    if (Tcl_IsSafe(interp)
         2180  +	    && (((Command *) command)->objProc == TclAliasObjCmd)) {
         2181  +	Tcl_AppendResult(interp, "native", NULL);
         2182  +    } else {
         2183  +	Tcl_SetObjResult(interp,
         2184  +		Tcl_NewStringObj(TclGetCommandTypeName(command), -1));
         2185  +    }
         2186  +    return TCL_OK;
         2187  +}
         2188  +
         2189  +/*
         2190  + *----------------------------------------------------------------------
         2191  + *
  2135   2192    * Tcl_JoinObjCmd --
  2136   2193    *
  2137   2194    *	This procedure is invoked to process the "join" Tcl command. See the
  2138   2195    *	user documentation for details on what it does.
  2139   2196    *
  2140   2197    * Results:
  2141   2198    *	A standard Tcl object result.
................................................................................
  2726   2783       if (result != TCL_OK) {
  2727   2784   	return result;
  2728   2785       }
  2729   2786   
  2730   2787       if (first < 0) {
  2731   2788   	first = 0;
  2732   2789       }
         2790  +    if (first > listLen) {
         2791  +	first = listLen;
         2792  +    }
  2733   2793   
  2734         -    /*
  2735         -     * Complain if the user asked for a start element that is greater than the
  2736         -     * list length. This won't ever trigger for the "end-*" case as that will
  2737         -     * be properly constrained by TclGetIntForIndex because we use listLen-1
  2738         -     * (to allow for replacing the last elem).
  2739         -     */
  2740         -
  2741         -    if ((first >= listLen) && (listLen > 0)) {
  2742         -	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2743         -		"list doesn't contain element %s", TclGetString(objv[2])));
  2744         -	Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LREPLACE", "BADIDX",
  2745         -		NULL);
  2746         -	return TCL_ERROR;
  2747         -    }
  2748   2794       if (last >= listLen) {
  2749   2795   	last = listLen - 1;
  2750   2796       }
  2751   2797       if (first <= last) {
  2752   2798   	numToDelete = last - first + 1;
  2753   2799       } else {
  2754   2800   	numToDelete = 0;
................................................................................
  3329   3375   	/*
  3330   3376   	 * If the data is sorted, we can do a more intelligent search. Note
  3331   3377   	 * that there is no point in being smart when -all was specified; in
  3332   3378   	 * that case, we have to look at all items anyway, and there is no
  3333   3379   	 * sense in doing this when the match sense is inverted.
  3334   3380   	 */
  3335   3381   
  3336         -	/* 
         3382  +	/*
  3337   3383   	 * With -stride, lower, upper and i are kept as multiples of groupSize.
  3338   3384   	 */
  3339   3385   
  3340   3386   	lower = start - groupSize;
  3341   3387   	upper = listc;
  3342   3388   	while (lower + groupSize != upper && sortInfo.resultCode == TCL_OK) {
  3343   3389   	    i = (lower + upper)/2;
................................................................................
  4011   4057   		sortInfo.indexv = NULL;
  4012   4058   	    } else {
  4013   4059   		sortInfo.indexc--;
  4014   4060   
  4015   4061   		/*
  4016   4062   		 * Do not shrink the actual memory block used; that doesn't
  4017   4063   		 * work with TclStackAlloc-allocated memory. [Bug 2918962]
  4018         -		 * 
         4064  +		 *
  4019   4065   		 * TODO: Consider a pointer increment to replace this
  4020   4066   		 * array shift.
  4021   4067   		 */
  4022   4068   
  4023   4069   		for (i = 0; i < sortInfo.indexc; i++) {
  4024   4070   		    sortInfo.indexv[i] = sortInfo.indexv[i+1];
  4025   4071   		}

Changes to generic/tclCmdMZ.c.

   254    254        * regexp to avoid shimmering problems.
   255    255        */
   256    256   
   257    257       objPtr = objv[1];
   258    258       stringLength = Tcl_GetCharLength(objPtr);
   259    259   
   260    260       if (startIndex) {
   261         -	TclGetIntForIndexM(NULL, startIndex, stringLength, &offset);
          261  +	TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
   262    262   	Tcl_DecrRefCount(startIndex);
   263    263   	if (offset < 0) {
   264    264   	    offset = 0;
   265    265   	}
   266    266       }
   267    267   
   268    268       regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags);
................................................................................
   578    578   
   579    579       objc -= idx;
   580    580       objv += idx;
   581    581   
   582    582       if (startIndex) {
   583    583   	int stringLength = Tcl_GetCharLength(objv[1]);
   584    584   
   585         -	TclGetIntForIndexM(NULL, startIndex, stringLength, &offset);
          585  +	TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
   586    586   	Tcl_DecrRefCount(startIndex);
   587    587   	if (offset < 0) {
   588    588   	    offset = 0;
   589    589   	}
   590    590       }
   591    591   
   592    592       if (all && (offset == 0) && (command == 0)
................................................................................
  1443   1443   	    unsigned char uch = (unsigned char) ch;
  1444   1444   
  1445   1445   	    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(&uch, 1));
  1446   1446   	} else {
  1447   1447   	    char buf[4];
  1448   1448   
  1449   1449   	    length = Tcl_UniCharToUtf(ch, buf);
         1450  +	    if (!length) {
         1451  +		length = Tcl_UniCharToUtf(-1, buf);
         1452  +	    }
  1450   1453   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, length));
  1451   1454   	}
  1452   1455       }
  1453   1456       return TCL_OK;
  1454   1457   }
  1455   1458   
  1456   1459   /*
................................................................................
  1616   1619   	}
  1617   1620   	break;
  1618   1621       }
  1619   1622       case STR_IS_GRAPH:
  1620   1623   	chcomp = Tcl_UniCharIsGraph;
  1621   1624   	break;
  1622   1625       case STR_IS_INT:
  1623         -	if (TCL_OK == TclGetIntFromObj(NULL, objPtr, &i)) {
  1624         -	    break;
  1625         -	}
  1626         -	goto failedIntParse;
  1627   1626       case STR_IS_ENTIER:
  1628   1627   	if ((objPtr->typePtr == &tclIntType) ||
  1629   1628   		(objPtr->typePtr == &tclBignumType)) {
  1630   1629   	    break;
  1631   1630   	}
  1632   1631   	string1 = TclGetStringFromObj(objPtr, &length1);
  1633   1632   	if (length1 == 0) {
................................................................................
  1667   1666   	}
  1668   1667   	break;
  1669   1668       case STR_IS_WIDE:
  1670   1669   	if (TCL_OK == TclGetWideIntFromObj(NULL, objPtr, &w)) {
  1671   1670   	    break;
  1672   1671   	}
  1673   1672   
  1674         -    failedIntParse:
  1675   1673   	string1 = TclGetStringFromObj(objPtr, &length1);
  1676   1674   	if (length1 == 0) {
  1677   1675   	    if (strict) {
  1678   1676   		result = 0;
  1679   1677   	    }
  1680   1678   	    goto str_is_done;
  1681   1679   	}
................................................................................
  1842   1840       return (character >= 0) && (character < 0x80);
  1843   1841   }
  1844   1842   
  1845   1843   static int
  1846   1844   UniCharIsHexDigit(
  1847   1845       int character)
  1848   1846   {
  1849         -    return (character >= 0) && (character < 0x80) && isxdigit(character);
         1847  +    return (character >= 0) && (character < 0x80) && isxdigit(UCHAR(character));
  1850   1848   }
  1851   1849   
  1852   1850   /*
  1853   1851    *----------------------------------------------------------------------
  1854   1852    *
  1855   1853    * StringMapCmd --
  1856   1854    *

Changes to generic/tclCompCmdsGR.c.

    30     30   
    31     31   /*
    32     32    *----------------------------------------------------------------------
    33     33    *
    34     34    * TclGetIndexFromToken --
    35     35    *
    36     36    *	Parse a token to determine if an index value is known at
    37         - *	compile time. 
           37  + *	compile time.
    38     38    *
    39     39    * Returns:
    40     40    *	TCL_OK if parsing succeeded, and TCL_ERROR if it failed.
    41     41    *
    42     42    * Side effects:
    43     43    *	When TCL_OK is returned, the encoded index value is written
    44     44    *	to *index.
................................................................................
  1470   1470   				 * command. */
  1471   1471       Command *cmdPtr,		/* Points to defintion of command being
  1472   1472   				 * compiled. */
  1473   1473       CompileEnv *envPtr)		/* Holds the resulting instructions. */
  1474   1474   {
  1475   1475       Tcl_Token *tokenPtr, *listTokenPtr;
  1476   1476       DefineLineInformation;	/* TIP #280 */
  1477         -    int idx1, idx2, i, offset, offset2;
         1477  +    int idx1, idx2, i;
  1478   1478       int emptyPrefix=1, suffixStart = 0;
  1479   1479   
  1480   1480       if (parsePtr->numWords < 4) {
  1481   1481   	return TCL_ERROR;
  1482   1482       }
  1483   1483       listTokenPtr = TokenAfter(parsePtr->tokenPtr);
  1484   1484   
................................................................................
  1490   1490   
  1491   1491       tokenPtr = TokenAfter(tokenPtr);
  1492   1492       if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_END,
  1493   1493   	    &idx2) != TCL_OK) {
  1494   1494   	return TCL_ERROR;
  1495   1495       }
  1496   1496   
  1497         -    /*
  1498         -     * idx1, idx2 are the conventional encoded forms of the tokens parsed
  1499         -     * as all forms of index values.  Values of idx1 that come before the
  1500         -     * list are treated the same as if they were the start of the list.
  1501         -     * Values of idx2 that come after the list are treated the same as if
  1502         -     * they were the end of the list.
  1503         -     */
  1504         -
  1505         -    if (idx1 == TCL_INDEX_AFTER) {
  1506         -	/*
  1507         -	 * [lreplace] treats idx1 value end+1 differently from end+2, etc.
  1508         -	 * The operand encoding cannot distinguish them, so we must bail
  1509         -	 * out to direct evaluation.
  1510         -	 */
  1511         -	return TCL_ERROR;
  1512         -    }
  1513         -
  1514   1497       /*
  1515   1498        * General structure of the [lreplace] result is
  1516   1499        *		prefix replacement suffix
  1517   1500        * In a few cases we can predict various parts will be empty and
  1518   1501        * take advantage.
  1519   1502        *
  1520   1503        * The proper suffix begins with the greater of indices idx1 or
  1521   1504        * idx2 + 1. If we cannot tell at compile time which is greater,
  1522   1505        * we must defer to direct evaluation.
  1523   1506        */
  1524   1507   
  1525         -    if (idx2 == TCL_INDEX_BEFORE) {
         1508  +    if (idx1 == TCL_INDEX_AFTER) {
         1509  +	suffixStart = idx1;
         1510  +    } else if (idx2 == TCL_INDEX_BEFORE) {
  1526   1511   	suffixStart = idx1;
  1527   1512       } else if (idx2 == TCL_INDEX_END) {
  1528   1513   	suffixStart = TCL_INDEX_AFTER;
  1529   1514       } else if (((idx2 < TCL_INDEX_END) && (idx1 <= TCL_INDEX_END))
  1530   1515   	    || ((idx2 >= TCL_INDEX_START) && (idx1 >= TCL_INDEX_START))) {
  1531   1516   	suffixStart = (idx1 > idx2 + 1) ? idx1 : idx2 + 1;
  1532   1517       } else {
................................................................................
  1549   1534   	}
  1550   1535   
  1551   1536   	/* Make a list of them... */
  1552   1537   	TclEmitInstInt4(	INST_LIST, i - 4,		envPtr);
  1553   1538   
  1554   1539   	emptyPrefix = 0;
  1555   1540       }
  1556         -     
  1557         -    /*
  1558         -     * [lreplace] raises an error when idx1 points after the list, but
  1559         -     * only when the list is not empty. This is maximum stupidity.
  1560         -     *
  1561         -     * TODO: TIP this nonsense away!
  1562         -     */
  1563         -    if (idx1 >= TCL_INDEX_START) {
  1564         -	if (emptyPrefix) {
  1565         -	    TclEmitOpcode(	INST_DUP,			envPtr);
  1566         -	} else {
  1567         -	    TclEmitInstInt4(	INST_OVER, 1,			envPtr);
  1568         -	}
  1569         -	TclEmitOpcode(		INST_LIST_LENGTH,		envPtr);
  1570         -	TclEmitOpcode(		INST_DUP,			envPtr);
  1571         -	offset = CurrentOffset(envPtr);
  1572         -	TclEmitInstInt1(	INST_JUMP_FALSE1, 0,		envPtr);
  1573         -
  1574         -	/* List is not empty */
  1575         -	TclEmitPush(TclAddLiteralObj(envPtr, Tcl_NewIntObj(idx1),
  1576         -							NULL),	envPtr);
  1577         -	TclEmitOpcode(		INST_GT,			envPtr);
  1578         -	offset2 = CurrentOffset(envPtr);
  1579         -	TclEmitInstInt1(	INST_JUMP_TRUE1, 0,		envPtr);
  1580         -
  1581         -	/* Idx1 >= list length ===> raise an error */
  1582         -	TclEmitPush(TclAddLiteralObj(envPtr, Tcl_ObjPrintf(
  1583         -		"list doesn't contain element %d", idx1), NULL), envPtr);
  1584         -	CompileReturnInternal(envPtr, INST_RETURN_IMM, TCL_ERROR, 0,
  1585         -		Tcl_ObjPrintf("-errorcode {TCL OPERATION LREPLACE BADIDX}"));
  1586         -	TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset,
  1587         -		envPtr->codeStart + offset + 1);
  1588         -	TclEmitOpcode(		INST_POP,			envPtr);
  1589         -	TclStoreInt1AtPtr(CurrentOffset(envPtr) - offset2,
  1590         -		envPtr->codeStart + offset2 + 1);
  1591         -    }
  1592   1541   
  1593   1542       if ((idx1 == suffixStart) && (parsePtr->numWords == 4)) {
  1594   1543   	/*
  1595   1544   	 * This is a "no-op". Example: [lreplace {a b c} 2 0]
  1596   1545   	 * We still do a list operation to get list-verification
  1597   1546   	 * and canonicalization side effects.
  1598   1547   	 */

Changes to generic/tclCompCmdsSZ.c.

   687    687   	} else {
   688    688   	    OP(		NUM_TYPE);
   689    689   	    OP(		DUP);
   690    690   	    JUMP1(	JUMP_FALSE, end);
   691    691   	}
   692    692   
   693    693   	switch (t) {
   694         -	case STR_IS_INT:
   695         -	    PUSH(	"1");
   696         -	    OP(		EQ);
   697         -	    break;
   698    694   	case STR_IS_WIDE:
   699    695   	    PUSH(	"2");
   700    696   	    OP(		LE);
   701    697   	    break;
          698  +	case STR_IS_INT:
   702    699   	case STR_IS_ENTIER:
   703    700   	    PUSH(	"3");
   704    701   	    OP(		LE);
   705    702   	    break;
   706    703   	}
   707    704   	FIXJUMP1(	end);
   708    705   	return TCL_OK;
................................................................................
   998    995       Tcl_Token *tokenPtr, *valueTokenPtr;
   999    996       DefineLineInformation;	/* TIP #280 */
  1000    997       int first, last;
  1001    998   
  1002    999       if (parsePtr->numWords < 4 || parsePtr->numWords > 5) {
  1003   1000   	return TCL_ERROR;
  1004   1001       }
  1005         - 
         1002  +
  1006   1003       /* Bytecode to compute/push string argument being replaced */
  1007   1004       valueTokenPtr = TokenAfter(parsePtr->tokenPtr);
  1008   1005       CompileWord(envPtr, valueTokenPtr, interp, 1);
  1009   1006   
  1010   1007       /*
  1011         -     * Check for first index known and useful at compile time. 
         1008  +     * Check for first index known and useful at compile time.
  1012   1009        */
  1013   1010       tokenPtr = TokenAfter(valueTokenPtr);
  1014   1011       if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER,
  1015   1012   	    &first) != TCL_OK) {
  1016   1013   	goto genericReplace;
  1017   1014       }
  1018   1015   
  1019   1016       /*
  1020         -     * Check for last index known and useful at compile time. 
         1017  +     * Check for last index known and useful at compile time.
  1021   1018        */
  1022   1019       tokenPtr = TokenAfter(tokenPtr);
  1023   1020       if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER,
  1024   1021   	    &last) != TCL_OK) {
  1025   1022   	goto genericReplace;
  1026   1023       }
  1027   1024   
  1028         -    /* 
         1025  +    /*
  1029   1026        * [string replace] is an odd bird.  For many arguments it is
  1030   1027        * a conventional substring replacer.  However it also goes out
  1031   1028        * of its way to become a no-op for many cases where it would be
  1032   1029        * replacing an empty substring.  Precisely, it is a no-op when
  1033   1030        *
  1034   1031        *		(last < first)		OR
  1035   1032        *		(last < 0)		OR
................................................................................
  1104   1101        * The encoded indices (last >= TCL_INDEX_START) and
  1105   1102        * (last == TCL_INDEX_AFTER) always meet this condition but any
  1106   1103        * other encoded last index has some list for which it fails.
  1107   1104        *
  1108   1105        * Finally we need, third:
  1109   1106        *
  1110   1107        *		(first <= last)
  1111         -     * 
         1108  +     *
  1112   1109        * Considered in combination with the constraints we already have,
  1113   1110        * we see that we can proceed when (first == TCL_INDEX_BEFORE)
  1114   1111        * or (last == TCL_INDEX_AFTER). These also permit simplification
  1115   1112        * of the prefix|replace|suffix construction. The other constraints,
  1116         -     * though, interfere with getting a guarantee that first <= last. 
         1113  +     * though, interfere with getting a guarantee that first <= last.
  1117   1114        */
  1118   1115   
  1119   1116       if ((first == TCL_INDEX_BEFORE) && (last >= TCL_INDEX_START)) {
  1120   1117   	/* empty prefix */
  1121   1118   	tokenPtr = TokenAfter(tokenPtr);
  1122   1119   	CompileWord(envPtr, tokenPtr, interp, 4);
  1123   1120   	OP4(		REVERSE, 2);
................................................................................
  1137   1134   	OP1(		STR_CONCAT1, 2);
  1138   1135   	return TCL_OK;
  1139   1136       }
  1140   1137   
  1141   1138   	/* FLOW THROUGH TO genericReplace */
  1142   1139   
  1143   1140       } else {
  1144         -	/* 
         1141  +	/*
  1145   1142   	 * When we have no replacement string to worry about, we may
  1146   1143   	 * have more luck, because the forbidden empty string replacements
  1147   1144   	 * are harmless when they are replaced by another empty string.
  1148   1145   	 */
  1149   1146   
  1150   1147   	if ((first == TCL_INDEX_BEFORE) || (first == TCL_INDEX_START)) {
  1151   1148   	    /* empty prefix - build suffix only */
................................................................................
  1349   1346       return (character >= 0) && (character < 0x80);
  1350   1347   }
  1351   1348   
  1352   1349   static int
  1353   1350   UniCharIsHexDigit(
  1354   1351       int character)
  1355   1352   {
  1356         -    return (character >= 0) && (character < 0x80) && isxdigit(character);
         1353  +    return (character >= 0) && (character < 0x80) && isxdigit(UCHAR(character));
  1357   1354   }
  1358   1355   
  1359   1356   StringClassDesc const tclStringClassTable[] = {
  1360   1357       {"alnum",	Tcl_UniCharIsAlnum},
  1361   1358       {"alpha",	Tcl_UniCharIsAlpha},
  1362   1359       {"ascii",	UniCharIsAscii},
  1363   1360       {"control", Tcl_UniCharIsControl},

Changes to generic/tclCompExpr.c.

  1755   1755   		 */
  1756   1756   
  1757   1757   		subExprTokenPtr = parsePtr->tokenPtr + subExprTokenIdx;
  1758   1758   		subExprTokenPtr->size = start - subExprTokenPtr->start;
  1759   1759   
  1760   1760   		/*
  1761   1761   		 * All the Tcl_Tokens allocated and filled belong to
  1762         -		 * this subexpresion. The first token is the leading
         1762  +		 * this subexpression. The first token is the leading
  1763   1763   		 * TCL_TOKEN_SUB_EXPR token, and all the rest (one fewer)
  1764   1764   		 * are its components.
  1765   1765   		 */
  1766   1766   
  1767   1767   		subExprTokenPtr->numComponents =
  1768   1768   			(parsePtr->numTokens - subExprTokenIdx) - 1;
  1769   1769   

Changes to generic/tclCompile.h.

  1469   1469   #   define TclGetInt1AtPtr(p) ((int) *((signed char *) p))
  1470   1470   #else
  1471   1471   #   define TclGetInt1AtPtr(p) \
  1472   1472       (((int) *((char *) p)) | ((*(p) & 0200) ? (-256) : 0))
  1473   1473   #endif
  1474   1474   
  1475   1475   #define TclGetInt4AtPtr(p) \
  1476         -    (((int) TclGetInt1AtPtr(p) << 24) |				\
         1476  +    (((int) (TclGetUInt1AtPtr(p) << 24)) |				\
  1477   1477   		     (*((p)+1) << 16) |				\
  1478   1478   		     (*((p)+2) <<  8) |				\
  1479   1479   		     (*((p)+3)))
  1480   1480   
  1481   1481   #define TclGetUInt1AtPtr(p) \
  1482   1482       ((unsigned int) *(p))
  1483   1483   #define TclGetUInt4AtPtr(p) \

Changes to generic/tclDate.c.

     1         -/* A Bison parser, made by GNU Bison 2.3.  */
            1  +/* A Bison parser, made by GNU Bison 3.1.  */
     2      2   
     3         -/* Skeleton implementation for Bison's Yacc-like parsers in C
            3  +/* Bison implementation for Yacc-like parsers in C
     4      4   
     5         -   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     6         -   Free Software Foundation, Inc.
            5  +   Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
     7      6   
     8         -   This program is free software; you can redistribute it and/or modify
            7  +   This program is free software: you can redistribute it and/or modify
     9      8      it under the terms of the GNU General Public License as published by
    10         -   the Free Software Foundation; either version 2, or (at your option)
    11         -   any later version.
            9  +   the Free Software Foundation, either version 3 of the License, or
           10  +   (at your option) any later version.
    12     11   
    13     12      This program is distributed in the hope that it will be useful,
    14     13      but WITHOUT ANY WARRANTY; without even the implied warranty of
    15     14      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16     15      GNU General Public License for more details.
    17     16   
    18     17      You should have received a copy of the GNU General Public License
    19         -   along with this program; if not, write to the Free Software
    20         -   Foundation, Inc., 51 Franklin Street, Fifth Floor,
    21         -   Boston, MA 02110-1301, USA.  */
           18  +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    22     19   
    23     20   /* As a special exception, you may create a larger work that contains
    24     21      part or all of the Bison parser skeleton and distribute that work
    25     22      under terms of your choice, so long as that work isn't itself a
    26     23      parser generator using the skeleton or a modified version thereof
    27     24      as a parser skeleton.  Alternatively, if you modify or redistribute
    28     25      the parser skeleton itself, you may (at your option) remove this
................................................................................
    43     40      define necessary library symbols; they are noted "INFRINGES ON
    44     41      USER NAME SPACE" below.  */
    45     42   
    46     43   /* Identify Bison output.  */
    47     44   #define YYBISON 1
    48     45   
    49     46   /* Bison version.  */
    50         -#define YYBISON_VERSION "2.3"
           47  +#define YYBISON_VERSION "3.1"
    51     48   
    52     49   /* Skeleton name.  */
    53     50   #define YYSKELETON_NAME "yacc.c"
    54     51   
    55     52   /* Pure parsers.  */
    56     53   #define YYPURE 1
    57     54   
    58         -/* Using locations.  */
    59         -#define YYLSP_NEEDED 1
           55  +/* Push parsers.  */
           56  +#define YYPUSH 0
           57  +
           58  +/* Pull parsers.  */
           59  +#define YYPULL 1
           60  +
    60     61   
    61     62   /* Substitute the variable and function names.  */
    62         -#define yyparse TclDateparse
    63         -#define yylex   TclDatelex
    64         -#define yyerror TclDateerror
    65         -#define yylval  TclDatelval
    66         -#define yychar  TclDatechar
    67         -#define yydebug TclDatedebug
    68         -#define yynerrs TclDatenerrs
    69         -#define yylloc TclDatelloc
    70         -
    71         -/* Tokens.  */
    72         -#ifndef YYTOKENTYPE
    73         -# define YYTOKENTYPE
    74         -   /* Put the tokens into the symbol table, so that GDB and other debuggers
    75         -      know about them.  */
    76         -   enum yytokentype {
    77         -     tAGO = 258,
    78         -     tDAY = 259,
    79         -     tDAYZONE = 260,
    80         -     tID = 261,
    81         -     tMERIDIAN = 262,
    82         -     tMONTH = 263,
    83         -     tMONTH_UNIT = 264,
    84         -     tSTARDATE = 265,
    85         -     tSEC_UNIT = 266,
    86         -     tSNUMBER = 267,
    87         -     tUNUMBER = 268,
    88         -     tZONE = 269,
    89         -     tEPOCH = 270,
    90         -     tDST = 271,
    91         -     tISOBASE = 272,
    92         -     tDAY_UNIT = 273,
    93         -     tNEXT = 274
    94         -   };
    95         -#endif
    96         -/* Tokens.  */
    97         -#define tAGO 258
    98         -#define tDAY 259
    99         -#define tDAYZONE 260
   100         -#define tID 261
   101         -#define tMERIDIAN 262
   102         -#define tMONTH 263
   103         -#define tMONTH_UNIT 264
   104         -#define tSTARDATE 265
   105         -#define tSEC_UNIT 266
   106         -#define tSNUMBER 267
   107         -#define tUNUMBER 268
   108         -#define tZONE 269
   109         -#define tEPOCH 270
   110         -#define tDST 271
   111         -#define tISOBASE 272
   112         -#define tDAY_UNIT 273
   113         -#define tNEXT 274
   114         -
   115         -
           63  +#define yyparse         TclDateparse
           64  +#define yylex           TclDatelex
           65  +#define yyerror         TclDateerror
           66  +#define yydebug         TclDatedebug
           67  +#define yynerrs         TclDatenerrs
   116     68   
   117     69   
   118     70   /* Copy the first part of user declarations.  */
   119     71   
   120     72   
   121     73   /*
   122     74    * tclDate.c --
................................................................................
   125     77    *	tclGetDate.y. It should not be edited directly.
   126     78    *
   127     79    * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
   128     80    * Copyright (c) 1995-1997 Sun Microsystems, Inc.
   129     81    *
   130     82    * See the file "license.terms" for information on usage and redistribution of
   131     83    * this file, and for a DISCLAIMER OF ALL WARRANTIES.
           84  + *
   132     85    */
   133     86   #include "tclInt.h"
   134     87   
   135     88   /*
   136     89    * Bison generates several labels that happen to be unused. MS Visual C++
   137     90    * doesn't like that, and complains. Tell it to shut up.
   138     91    */
................................................................................
   252    205   
   253    206   typedef enum _MERIDIAN {
   254    207       MERam, MERpm, MER24
   255    208   } MERIDIAN;
   256    209   
   257    210   
   258    211   
   259         -/* Enabling traces.  */
   260         -#ifndef YYDEBUG
   261         -# define YYDEBUG 0
   262         -#endif
          212  +
          213  +# ifndef YY_NULLPTR
          214  +#  if defined __cplusplus && 201103L <= __cplusplus
          215  +#   define YY_NULLPTR nullptr
          216  +#  else
          217  +#   define YY_NULLPTR 0
          218  +#  endif
          219  +# endif
   263    220   
   264    221   /* Enabling verbose error messages.  */
   265    222   #ifdef YYERROR_VERBOSE
   266    223   # undef YYERROR_VERBOSE
   267    224   # define YYERROR_VERBOSE 1
   268    225   #else
   269    226   # define YYERROR_VERBOSE 0
   270    227   #endif
   271    228   
   272         -/* Enabling the token table.  */
   273         -#ifndef YYTOKEN_TABLE
   274         -# define YYTOKEN_TABLE 0
          229  +
          230  +/* Debug traces.  */
          231  +#ifndef YYDEBUG
          232  +# define YYDEBUG 0
          233  +#endif
          234  +#if YYDEBUG
          235  +extern int TclDatedebug;
   275    236   #endif
   276    237   
          238  +/* Token type.  */
          239  +#ifndef YYTOKENTYPE
          240  +# define YYTOKENTYPE
          241  +  enum yytokentype
          242  +  {
          243  +    tAGO = 258,
          244  +    tDAY = 259,
          245  +    tDAYZONE = 260,
          246  +    tID = 261,
          247  +    tMERIDIAN = 262,
          248  +    tMONTH = 263,
          249  +    tMONTH_UNIT = 264,
          250  +    tSTARDATE = 265,
          251  +    tSEC_UNIT = 266,
          252  +    tSNUMBER = 267,
          253  +    tUNUMBER = 268,
          254  +    tZONE = 269,
          255  +    tEPOCH = 270,
          256  +    tDST = 271,
          257  +    tISOBASE = 272,
          258  +    tDAY_UNIT = 273,
          259  +    tNEXT = 274
          260  +  };
          261  +#endif
          262  +
          263  +/* Value type.  */
   277    264   #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
   278         -typedef union YYSTYPE
   279    265   
          266  +union YYSTYPE
   280    267   {
          268  +
          269  +
   281    270       time_t Number;
   282    271       enum _MERIDIAN Meridian;
   283         -}
   284         -/* Line 187 of yacc.c.  */
   285    272   
   286         -	YYSTYPE;
   287         -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
          273  +
          274  +};
          275  +
          276  +typedef union YYSTYPE YYSTYPE;
          277  +# define YYSTYPE_IS_TRIVIAL 1
   288    278   # define YYSTYPE_IS_DECLARED 1
   289         -# define YYSTYPE_IS_TRIVIAL 1
   290    279   #endif
   291    280   
          281  +/* Location type.  */
   292    282   #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
   293         -typedef struct YYLTYPE
          283  +typedef struct YYLTYPE YYLTYPE;
          284  +struct YYLTYPE
   294    285   {
   295    286     int first_line;
   296    287     int first_column;
   297    288     int last_line;
   298    289     int last_column;
   299         -} YYLTYPE;
   300         -# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
          290  +};
   301    291   # define YYLTYPE_IS_DECLARED 1
   302    292   # define YYLTYPE_IS_TRIVIAL 1
   303    293   #endif
          294  +
          295  +
          296  +
          297  +int TclDateparse (DateInfo* info);
          298  +
   304    299   
   305    300   
   306    301   /* Copy the second part of user declarations.  */
   307    302   
   308    303   
   309    304   
   310    305   /*
................................................................................
   318    313   				   DateInfo* info);
   319    314   static time_t		ToSeconds(time_t Hours, time_t Minutes,
   320    315   			    time_t Seconds, MERIDIAN Meridian);
   321    316   MODULE_SCOPE int	yyparse(DateInfo*);
   322    317   
   323    318   
   324    319   
   325         -/* Line 216 of yacc.c.  */
   326         -
   327    320   
   328    321   #ifdef short
   329    322   # undef short
   330    323   #endif
   331    324   
   332    325   #ifdef YYTYPE_UINT8
   333    326   typedef YYTYPE_UINT8 yytype_uint8;
   334    327   #else
   335    328   typedef unsigned char yytype_uint8;
   336    329   #endif
   337    330   
   338    331   #ifdef YYTYPE_INT8
   339    332   typedef YYTYPE_INT8 yytype_int8;
   340         -#elif (defined __STDC__ || defined __C99__FUNC__ \
   341         -     || defined __cplusplus || defined _MSC_VER)
   342         -typedef signed char yytype_int8;
   343    333   #else
   344         -typedef short int yytype_int8;
          334  +typedef signed char yytype_int8;
   345    335   #endif
   346    336   
   347    337   #ifdef YYTYPE_UINT16
   348    338   typedef YYTYPE_UINT16 yytype_uint16;
   349    339   #else
   350         -typedef unsigned short int yytype_uint16;
          340  +typedef unsigned short yytype_uint16;
   351    341   #endif
   352    342   
   353    343   #ifdef YYTYPE_INT16
   354    344   typedef YYTYPE_INT16 yytype_int16;
   355    345   #else
   356         -typedef short int yytype_int16;
          346  +typedef short yytype_int16;
   357    347   #endif
   358    348   
   359    349   #ifndef YYSIZE_T
   360    350   # ifdef __SIZE_TYPE__
   361    351   #  define YYSIZE_T __SIZE_TYPE__
   362         -# else
          352  +# elif defined size_t
          353  +#  define YYSIZE_T size_t
          354  +# elif ! defined YYSIZE_T
          355  +#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
   363    356   #  define YYSIZE_T size_t
          357  +# else
          358  +#  define YYSIZE_T unsigned
   364    359   # endif
   365    360   #endif
   366    361   
   367    362   #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
   368    363   
   369    364   #ifndef YY_
   370         -# if YYENABLE_NLS
          365  +# if defined YYENABLE_NLS && YYENABLE_NLS
   371    366   #  if ENABLE_NLS
   372    367   #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
   373         -#   define YY_(msgid) dgettext ("bison-runtime", msgid)
          368  +#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
   374    369   #  endif
   375    370   # endif
   376    371   # ifndef YY_
   377         -#  define YY_(msgid) msgid
          372  +#  define YY_(Msgid) Msgid
          373  +# endif
          374  +#endif
          375  +
          376  +#ifndef YY_ATTRIBUTE
          377  +# if (defined __GNUC__                                               \
          378  +      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
          379  +     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
          380  +#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
          381  +# else
          382  +#  define YY_ATTRIBUTE(Spec) /* empty */
          383  +# endif
          384  +#endif
          385  +
          386  +#ifndef YY_ATTRIBUTE_PURE
          387  +# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
          388  +#endif
          389  +
          390  +#ifndef YY_ATTRIBUTE_UNUSED
          391  +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
          392  +#endif
          393  +
          394  +#if !defined _Noreturn \
          395  +     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
          396  +# if defined _MSC_VER && 1200 <= _MSC_VER
          397  +#  define _Noreturn __declspec (noreturn)
          398  +# else
          399  +#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
   378    400   # endif
   379    401   #endif
   380    402   
   381    403   /* Suppress unused-variable warnings by "using" E.  */
   382    404   #if ! defined lint || defined __GNUC__
   383         -# define YYUSE(e) ((void) (e))
          405  +# define YYUSE(E) ((void) (E))
   384    406   #else
   385         -# define YYUSE(e) /* empty */
          407  +# define YYUSE(E) /* empty */
   386    408   #endif
   387    409   
   388         -/* Identity function, used to suppress warnings about constant conditions.  */
   389         -#ifndef lint
   390         -# define YYID(n) (n)
   391         -#else
   392         -#if (defined __STDC__ || defined __C99__FUNC__ \
   393         -     || defined __cplusplus || defined _MSC_VER)
   394         -static int
   395         -YYID (int i)
          410  +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
          411  +/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
          412  +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
          413  +    _Pragma ("GCC diagnostic push") \
          414  +    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
          415  +    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
          416  +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
          417  +    _Pragma ("GCC diagnostic pop")
   396    418   #else
   397         -static int
   398         -YYID (i)
   399         -    int i;
          419  +# define YY_INITIAL_VALUE(Value) Value
   400    420   #endif
   401         -{
   402         -  return i;
   403         -}
          421  +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
          422  +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
          423  +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
   404    424   #endif
          425  +#ifndef YY_INITIAL_VALUE
          426  +# define YY_INITIAL_VALUE(Value) /* Nothing. */
          427  +#endif
          428  +
   405    429   
   406    430   #if ! defined yyoverflow || YYERROR_VERBOSE
   407    431   
   408    432   /* The parser invokes alloca or malloc; define the necessary symbols.  */
   409    433   
   410    434   # ifdef YYSTACK_USE_ALLOCA
   411    435   #  if YYSTACK_USE_ALLOCA
................................................................................
   416    440   #   elif defined _AIX
   417    441   #    define YYSTACK_ALLOC __alloca
   418    442   #   elif defined _MSC_VER
   419    443   #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
   420    444   #    define alloca _alloca
   421    445   #   else
   422    446   #    define YYSTACK_ALLOC alloca
   423         -#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
   424         -     || defined __cplusplus || defined _MSC_VER)
          447  +#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
   425    448   #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
   426         -#     ifndef _STDLIB_H
   427         -#      define _STDLIB_H 1
          449  +      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
          450  +#     ifndef EXIT_SUCCESS
          451  +#      define EXIT_SUCCESS 0
   428    452   #     endif
   429    453   #    endif
   430    454   #   endif
   431    455   #  endif
   432    456   # endif
   433    457   
   434    458   # ifdef YYSTACK_ALLOC
   435         -   /* Pacify GCC's `empty if-body' warning.  */
   436         -#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
          459  +   /* Pacify GCC's 'empty if-body' warning.  */
          460  +#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
   437    461   #  ifndef YYSTACK_ALLOC_MAXIMUM
   438    462       /* The OS might guarantee only one guard page at the bottom of the stack,
   439    463          and a page size can be as small as 4096 bytes.  So we cannot safely
   440    464          invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
   441    465          to allow for a few compiler-allocated temporary stack slots.  */
   442    466   #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
   443    467   #  endif
   444    468   # else
   445    469   #  define YYSTACK_ALLOC YYMALLOC
   446    470   #  define YYSTACK_FREE YYFREE
   447    471   #  ifndef YYSTACK_ALLOC_MAXIMUM
   448    472   #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
   449    473   #  endif
   450         -#  if (defined __cplusplus && ! defined _STDLIB_H \
          474  +#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
   451    475          && ! ((defined YYMALLOC || defined malloc) \
   452         -	     && (defined YYFREE || defined free)))
          476  +             && (defined YYFREE || defined free)))
   453    477   #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
   454         -#   ifndef _STDLIB_H
   455         -#    define _STDLIB_H 1
          478  +#   ifndef EXIT_SUCCESS
          479  +#    define EXIT_SUCCESS 0
   456    480   #   endif
   457    481   #  endif
   458    482   #  ifndef YYMALLOC
   459    483   #   define YYMALLOC malloc
   460         -#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
   461         -     || defined __cplusplus || defined _MSC_VER)
          484  +#   if ! defined malloc && ! defined EXIT_SUCCESS
   462    485   void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
   463    486   #   endif
   464    487   #  endif
   465    488   #  ifndef YYFREE
   466    489   #   define YYFREE free
   467         -#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
   468         -     || defined __cplusplus || defined _MSC_VER)
          490  +#   if ! defined free && ! defined EXIT_SUCCESS
   469    491   void free (void *); /* INFRINGES ON USER NAME SPACE */
   470    492   #   endif
   471    493   #  endif
   472    494   # endif
   473    495   #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
   474    496   
   475    497   
   476    498   #if (! defined yyoverflow \
   477    499        && (! defined __cplusplus \
   478         -	 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
   479         -	     && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
          500  +         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
          501  +             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
   480    502   
   481    503   /* A type that is properly aligned for any stack member.  */
   482    504   union yyalloc
   483    505   {
   484         -  yytype_int16 yyss;
   485         -  YYSTYPE yyvs;
   486         -    YYLTYPE yyls;
          506  +  yytype_int16 yyss_alloc;
          507  +  YYSTYPE yyvs_alloc;
          508  +  YYLTYPE yyls_alloc;
   487    509   };
   488    510   
   489    511   /* The size of the maximum gap between one aligned stack and the next.  */
   490    512   # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
   491    513   
   492    514   /* The size of an array large to enough to hold all stacks, each with
   493    515      N elements.  */
   494    516   # define YYSTACK_BYTES(N) \
   495    517        ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
   496    518         + 2 * YYSTACK_GAP_MAXIMUM)
   497    519   
   498         -/* Copy COUNT objects from FROM to TO.  The source and destination do
   499         -   not overlap.  */
   500         -# ifndef YYCOPY
   501         -#  if defined __GNUC__ && 1 < __GNUC__
   502         -#   define YYCOPY(To, From, Count) \
   503         -      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
   504         -#  else
   505         -#   define YYCOPY(To, From, Count)		\
   506         -      do					\
   507         -	{					\
   508         -	  YYSIZE_T yyi;				\
   509         -	  for (yyi = 0; yyi < (Count); yyi++)	\
   510         -	    (To)[yyi] = (From)[yyi];		\
   511         -	}					\
   512         -      while (YYID (0))
   513         -#  endif
   514         -# endif
          520  +# define YYCOPY_NEEDED 1
   515    521   
   516    522   /* Relocate STACK from its old location to the new one.  The
   517    523      local variables YYSIZE and YYSTACKSIZE give the old and new number of
   518    524      elements in the stack, and YYPTR gives the new location of the
   519    525      stack.  Advance YYPTR to a properly aligned location for the next
   520    526      stack.  */
   521         -# define YYSTACK_RELOCATE(Stack)					\
   522         -    do									\
   523         -      {									\
   524         -	YYSIZE_T yynewbytes;						\
   525         -	YYCOPY (&yyptr->Stack, Stack, yysize);				\
   526         -	Stack = &yyptr->Stack;						\
   527         -	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
   528         -	yyptr += yynewbytes / sizeof (*yyptr);				\
   529         -      }									\
   530         -    while (YYID (0))
          527  +# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
          528  +    do                                                                  \
          529  +      {                                                                 \
          530  +        YYSIZE_T yynewbytes;                                            \
          531  +        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
          532  +        Stack = &yyptr->Stack_alloc;                                    \
          533  +        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
          534  +        yyptr += yynewbytes / sizeof (*yyptr);                          \
          535  +      }                                                                 \
          536  +    while (0)
   531    537   
   532    538   #endif
          539  +
          540  +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
          541  +/* Copy COUNT objects from SRC to DST.  The source and destination do
          542  +   not overlap.  */
          543  +# ifndef YYCOPY
          544  +#  if defined __GNUC__ && 1 < __GNUC__
          545  +#   define YYCOPY(Dst, Src, Count) \
          546  +      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
          547  +#  else
          548  +#   define YYCOPY(Dst, Src, Count)              \
          549  +      do                                        \
          550  +        {                                       \
          551  +          YYSIZE_T yyi;                         \
          552  +          for (yyi = 0; yyi < (Count); yyi++)   \
          553  +            (Dst)[yyi] = (Src)[yyi];            \
          554  +        }                                       \
          555  +      while (0)
          556  +#  endif
          557  +# endif
          558  +#endif /* !YYCOPY_NEEDED */
   533    559   
   534    560   /* YYFINAL -- State number of the termination state.  */
   535    561   #define YYFINAL  2
   536    562   /* YYLAST -- Last index in YYTABLE.  */
   537    563   #define YYLAST   79
   538    564   
   539    565   /* YYNTOKENS -- Number of terminals.  */
   540    566   #define YYNTOKENS  26
   541    567   /* YYNNTS -- Number of nonterminals.  */
   542    568   #define YYNNTS  16
   543    569   /* YYNRULES -- Number of rules.  */
   544    570   #define YYNRULES  56
   545         -/* YYNRULES -- Number of states.  */
          571  +/* YYNSTATES -- Number of states.  */
   546    572   #define YYNSTATES  83
   547    573   
   548         -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
          574  +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
          575  +   by yylex, with out-of-bounds checking.  */
   549    576   #define YYUNDEFTOK  2
   550    577   #define YYMAXUTOK   274
   551    578   
   552         -#define YYTRANSLATE(YYX)						\
   553         -  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
          579  +#define YYTRANSLATE(YYX)                                                \
          580  +  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
   554    581   
   555         -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
          582  +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
          583  +   as returned by yylex, without out-of-bounds checking.  */
   556    584   static const yytype_uint8 yytranslate[] =
   557    585   {
   558    586          0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   559    587          2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   560    588          2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   561    589          2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   562    590          2,     2,     2,    25,    22,    21,    24,    23,     2,     2,
................................................................................
   582    610          2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   583    611          2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
   584    612          5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
   585    613         15,    16,    17,    18,    19
   586    614   };
   587    615   
   588    616   #if YYDEBUG
   589         -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   590         -   YYRHS.  */
   591         -static const yytype_uint8 yyprhs[] =
   592         -{
   593         -       0,     0,     3,     4,     7,     9,    11,    13,    15,    17,
   594         -      19,    21,    23,    25,    28,    33,    39,    46,    54,    57,
   595         -      59,    61,    63,    66,    69,    73,    76,    80,    86,    88,
   596         -      94,   100,   103,   108,   111,   113,   117,   120,   124,   128,
   597         -     136,   139,   144,   147,   149,   153,   156,   159,   163,   165,
   598         -     167,   169,   171,   173,   175,   177,   178
   599         -};
   600         -
   601         -/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
   602         -static const yytype_int8 yyrhs[] =
   603         -{
   604         -      27,     0,    -1,    -1,    27,    28,    -1,    29,    -1,    30,
   605         -      -1,    32,    -1,    33,    -1,    31,    -1,    36,    -1,    34,
   606         -      -1,    35,    -1,    40,    -1,    13,     7,    -1,    13,    20,
   607         -      13,    41,    -1,    13,    20,    13,    21,    13,    -1,    13,
   608         -      20,    13,    20,    13,    41,    -1,    13,    20,    13,    20,
   609         -      13,    21,    13,    -1,    14,    16,    -1,    14,    -1,     5,
   610         -      -1,     4,    -1,     4,    22,    -1,    13,     4,    -1,    38,
   611         -      13,     4,    -1,    19,     4,    -1,    13,    23,    13,    -1,
   612         -      13,    23,    13,    23,    13,    -1,    17,    -1,    13,    21,
   613         -       8,    21,    13,    -1,    13,    21,    13,    21,    13,    -1,
   614         -       8,    13,    -1,     8,    13,    22,    13,    -1,    13,     8,
   615         -      -1,    15,    -1,    13,     8,    13,    -1,    19,     8,    -1,
   616         -      19,    13,     8,    -1,    17,    14,    17,    -1,    17,    14,
   617         -      13,    20,    13,    20,    13,    -1,    17,    17,    -1,    10,
   618         -      13,    24,    13,    -1,    37,     3,    -1,    37,    -1,    38,
   619         -      13,    39,    -1,    13,    39,    -1,    19,    39,    -1,    19,
   620         -      13,    39,    -1,    39,    -1,    21,    -1,    25,    -1,    11,
   621         -      -1,    18,    -1,     9,    -1,    13,    -1,    -1,     7,    -1
   622         -};
   623         -
   624         -/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
          617  +  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
   625    618   static const yytype_uint16 yyrline[] =
   626    619   {
   627         -       0,   225,   225,   226,   229,   232,   235,   238,   241,   244,
   628         -     247,   251,   256,   259,   265,   271,   279,   285,   296,   300,
   629         -     304,   310,   314,   318,   322,   326,   332,   336,   341,   346,
   630         -     351,   356,   360,   365,   369,   374,   381,   385,   391,   400,
   631         -     409,   419,   433,   438,   441,   444,   447,   450,   453,   458,
   632         -     461,   466,   470,   474,   480,   498,   501
          620  +       0,   223,   223,   224,   227,   230,   233,   236,   239,   242,
          621  +     245,   249,   254,   257,   263,   269,   277,   283,   294,   298,
          622  +     302,   308,   312,   316,   320,   324,   330,   334,   339,   344,
          623  +     349,   354,   358,   363,   367,   372,   379,   383,   389,   398,
          624  +     407,   417,   431,   436,   439,   442,   445,   448,   451,   456,
          625  +     459,   464,   468,   472,   478,   496,   499
   633    626   };
   634    627   #endif
   635    628   
   636         -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
          629  +#if YYDEBUG || YYERROR_VERBOSE || 0
   637    630   /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   638    631      First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
   639    632   static const char *const yytname[] =
   640    633   {
   641    634     "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
   642    635     "tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT",
   643    636     "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE",
   644    637     "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", "'+'",
   645    638     "$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth",
   646    639     "iso", "trek", "relspec", "relunits", "sign", "unit", "number",
   647         -  "o_merid", 0
          640  +  "o_merid", YY_NULLPTR
   648    641   };
   649    642   #endif
   650    643   
   651    644   # ifdef YYPRINT
   652         -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   653         -   token YYLEX-NUM.  */
          645  +/* YYTOKNUM[NUM] -- (External) token number corresponding to the
          646  +   (internal) symbol number NUM (which must be that of a token).  */
   654    647   static const yytype_uint16 yytoknum[] =
   655    648   {
   656    649          0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
   657    650        265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
   658    651         58,    45,    44,    47,    46,    43
   659    652   };
   660    653   # endif
   661    654   
   662         -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
   663         -static const yytype_uint8 yyr1[] =
   664         -{
   665         -       0,    26,    27,    27,    28,    28,    28,    28,    28,    28,
   666         -      28,    28,    28,    29,    29,    29,    29,    29,    30,    30,
   667         -      30,    31,    31,    31,    31,    31,    32,    32,    32,    32,
   668         -      32,    32,    32,    32,    32,    32,    33,    33,    34,    34,
   669         -      34,    35,    36,    36,    37,    37,    37,    37,    37,    38,
   670         -      38,    39,    39,    39,    40,    41,    41
   671         -};
   672         -
   673         -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
   674         -static const yytype_uint8 yyr2[] =
   675         -{
   676         -       0,     2,     0,     2,     1,     1,     1,     1,     1,     1,
   677         -       1,     1,     1,     2,     4,     5,     6,     7,     2,     1,
   678         -       1,     1,     2,     2,     3,     2,     3,     5,     1,     5,
   679         -       5,     2,     4,     2,     1,     3,     2,     3,     3,     7,
   680         -       2,     4,     2,     1,     3,     2,     2,     3,     1,     1,
   681         -       1,     1,     1,     1,     1,     0,     1
   682         -};
   683         -
   684         -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   685         -   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   686         -   means the default is an error.  */
          655  +#define YYPACT_NINF -22
          656  +
          657  +#define yypact_value_is_default(Yystate) \
          658  +  (!!((Yystate) == (-22)))
          659  +
          660  +#define YYTABLE_NINF -1
          661  +
          662  +#define yytable_value_is_error(Yytable_value) \
          663  +  0
          664  +
          665  +  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
          666  +     STATE-NUM.  */
          667  +static const yytype_int8 yypact[] =
          668  +{
          669  +     -22,     2,   -22,   -21,   -22,    -4,   -22,     1,   -22,    22,
          670  +      18,   -22,     8,   -22,    40,   -22,   -22,   -22,   -22,   -22,
          671  +     -22,   -22,   -22,   -22,   -22,   -22,    32,    28,   -22,   -22,
          672  +     -22,    24,    26,   -22,   -22,    42,    47,    -5,    49,   -22,
          673  +     -22,    15,   -22,   -22,   -22,    48,   -22,   -22,    43,    50,
          674  +      51,   -22,    17,    44,    46,    45,    52,   -22,   -22,   -22,
          675  +     -22,   -22,   -22,   -22,   -22,    56,    57,   -22,    58,    60,
          676  +      61,    62,    -3,   -22,   -22,   -22,   -22,    59,    63,   -22,
          677  +      64,   -22,   -22
          678  +};
          679  +
          680  +  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
          681  +     Performed when YYTABLE does not specify something else to do.  Zero
          682  +     means the default is an error.  */
   687    683   static const yytype_uint8 yydefact[] =
   688    684   {
   689    685          2,     0,     1,    21,    20,     0,    53,     0,    51,    54,
   690    686         19,    34,    28,    52,     0,    49,    50,     3,     4,     5,
   691    687          8,     6,     7,    10,    11,     9,    43,     0,    48,    12,
   692    688         22,    31,     0,    23,    13,    33,     0,     0,     0,    45,
   693    689         18,     0,    40,    25,    36,     0,    46,    42,     0,     0,
   694    690          0,    35,    55,     0,     0,    26,     0,    38,    37,    47,
   695    691         24,    44,    32,    41,    56,     0,     0,    14,     0,     0,
   696    692          0,     0,    55,    15,    29,    30,    27,     0,     0,    16,
   697    693          0,    17,    39
   698    694   };
   699    695   
   700         -/* YYDEFGOTO[NTERM-NUM].  */
          696  +  /* YYPGOTO[NTERM-NUM].  */
          697  +static const yytype_int8 yypgoto[] =
          698  +{
          699  +     -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,
          700  +     -22,   -22,   -22,    -9,   -22,     6
          701  +};
          702  +
          703  +  /* YYDEFGOTO[NTERM-NUM].  */
   701    704   static const yytype_int8 yydefgoto[] =
   702    705   {
   703    706         -1,     1,    17,    18,    19,    20,    21,    22,    23,    24,
   704    707         25,    26,    27,    28,    29,    67
   705    708   };
   706    709   
   707         -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   708         -   STATE-NUM.  */
   709         -#define YYPACT_NINF -22
   710         -static const yytype_int8 yypact[] =
   711         -{
   712         -     -22,     2,   -22,   -21,   -22,    -4,   -22,     1,   -22,    22,
   713         -      18,   -22,     8,   -22,    40,   -22,   -22,   -22,   -22,   -22,
   714         -     -22,   -22,   -22,   -22,   -22,   -22,    32,    28,   -22,   -22,
   715         -     -22,    24,    26,   -22,   -22,    42,    47,    -5,    49,   -22,
   716         -     -22,    15,   -22,   -22,   -22,    48,   -22,   -22,    43,    50,
   717         -      51,   -22,    17,    44,    46,    45,    52,   -22,   -22,   -22,
   718         -     -22,   -22,   -22,   -22,   -22,    56,    57,   -22,    58,    60,
   719         -      61,    62,    -3,   -22,   -22,   -22,   -22,    59,    63,   -22,
   720         -      64,   -22,   -22
   721         -};
   722         -
   723         -/* YYPGOTO[NTERM-NUM].  */
   724         -static const yytype_int8 yypgoto[] =
   725         -{
   726         -     -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,   -22,
   727         -     -22,   -22,   -22,    -9,   -22,     6
   728         -};
   729         -
   730         -/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   731         -   positive, shift that token.  If negative, reduce the rule which
   732         -   number is the opposite.  If zero, do what YYDEFACT says.
   733         -   If YYTABLE_NINF, syntax error.  */
   734         -#define YYTABLE_NINF -1
          710  +  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
          711  +     positive, shift that token.  If negative, reduce the rule whose
          712  +     number is the opposite.  If YYTABLE_NINF, syntax error.  */
   735    713   static const yytype_uint8 yytable[] =
   736    714   {
   737    715         39,    30,     2,    53,    64,    46,     3,     4,    54,    31,
   738    716          5,     6,     7,     8,    32,     9,    10,    11,    78,    12,
   739    717         13,    14,    41,    15,    64,    42,    33,    16,    56,    34,
   740    718         35,     6,    57,     8,    40,    47,    59,    65,    66,    61,
   741    719         13,    48,    36,    37,    43,    38,    49,    60,    44,     6,
................................................................................
   752    730          8,     9,    17,    11,    16,     3,    45,    20,    21,    48,
   753    731         18,    13,    20,    21,     4,    23,    22,     4,     8,     9,
   754    732         24,    11,     9,    13,    11,    13,     8,     9,    18,    11,
   755    733         13,    18,    13,    13,    13,    21,    18,    21,    23,    13,
   756    734         13,    13,    20,    13,    13,    13,    13,    13,    72,    20
   757    735   };
   758    736   
   759         -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   760         -   symbol of state STATE-NUM.  */
          737  +  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
          738  +     symbol of state STATE-NUM.  */
   761    739   static const yytype_uint8 yystos[] =
   762    740   {
   763    741          0,    27,     0,     4,     5,     8,     9,    10,    11,    13,
   764    742         14,    15,    17,    18,    19,    21,    25,    28,    29,    30,
   765    743         31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
   766    744         22,    13,    13,     4,     7,     8,    20,    21,    23,    39,
   767    745         16,    14,    17,     4,     8,    13,    39,     3,    13,    22,
   768    746         24,    13,    13,     8,    13,    13,    13,    17,     8,    39,
   769    747          4,    39,    13,    13,     7,    20,    21,    41,    21,    21,
   770    748         23,    20,    13,    13,    13,    13,    13,    13,    21,    41,
   771    749         20,    13,    13
   772    750   };
   773    751   
   774         -#define yyerrok		(yyerrstatus = 0)
   775         -#define yyclearin	(yychar = YYEMPTY)
   776         -#define YYEMPTY		(-2)
   777         -#define YYEOF		0
   778         -
   779         -#define YYACCEPT	goto yyacceptlab
   780         -#define YYABORT		goto yyabortlab
   781         -#define YYERROR		goto yyerrorlab
   782         -
   783         -
   784         -/* Like YYERROR except do call yyerror.  This remains here temporarily
   785         -   to ease the transition to the new meaning of YYERROR, for GCC.
   786         -   Once GCC version 2 has supplanted version 1, this can go.  */
   787         -
   788         -#define YYFAIL		goto yyerrlab
          752  +  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
          753  +static const yytype_uint8 yyr1[] =
          754  +{
          755  +       0,    26,    27,    27,    28,    28,    28,    28,    28,    28,
          756  +      28,    28,    28,    29,    29,    29,    29,    29,    30,    30,
          757  +      30,    31,    31,    31,    31,    31,    32,    32,    32,    32,
          758  +      32,    32,    32,    32,    32,    32,    33,    33,    34,    34,
          759  +      34,    35,    36,    36,    37,    37,    37,    37,    37,    38,
          760  +      38,    39,    39,    39,    40,    41,    41
          761  +};
          762  +
          763  +  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
          764  +static const yytype_uint8 yyr2[] =
          765  +{
          766  +       0,     2,     0,     2,     1,     1,     1,     1,     1,     1,
          767  +       1,     1,     1,     2,     4,     5,     6,     7,     2,     1,
          768  +       1,     1,     2,     2,     3,     2,     3,     5,     1,     5,
          769  +       5,     2,     4,     2,     1,     3,     2,     3,     3,     7,
          770  +       2,     4,     2,     1,     3,     2,     2,     3,     1,     1,
          771  +       1,     1,     1,     1,     1,     0,     1
          772  +};
          773  +
          774  +
          775  +#define yyerrok         (yyerrstatus = 0)
          776  +#define yyclearin       (yychar = YYEMPTY)
          777  +#define YYEMPTY         (-2)
          778  +#define YYEOF           0
          779  +
          780  +#define YYACCEPT        goto yyacceptlab
          781  +#define YYABORT         goto yyabortlab
          782  +#define YYERROR         goto yyerrorlab
          783  +
   789    784   
   790    785   #define YYRECOVERING()  (!!yyerrstatus)
   791    786   
   792         -#define YYBACKUP(Token, Value)					\
   793         -do								\
   794         -  if (yychar == YYEMPTY && yylen == 1)				\
   795         -    {								\
   796         -      yychar = (Token);						\
   797         -      yylval = (Value);						\
   798         -      yytoken = YYTRANSLATE (yychar);				\
   799         -      YYPOPSTACK (1);						\
   800         -      goto yybackup;						\
   801         -    }								\
   802         -  else								\
   803         -    {								\
          787  +#define YYBACKUP(Token, Value)                                  \
          788  +do                                                              \
          789  +  if (yychar == YYEMPTY)                                        \
          790  +    {                                                           \
          791  +      yychar = (Token);                                         \
          792  +      yylval = (Value);                                         \
          793  +      YYPOPSTACK (yylen);                                       \
          794  +      yystate = *yyssp;                                         \
          795  +      goto yybackup;                                            \
          796  +    }                                                           \
          797  +  else                                                          \
          798  +    {                                                           \
   804    799         yyerror (&yylloc, info, YY_("syntax error: cannot back up")); \
   805         -      YYERROR;							\
   806         -    }								\
   807         -while (YYID (0))
          800  +      YYERROR;                                                  \
          801  +    }                                                           \
          802  +while (0)
   808    803   
   809         -
   810         -#define YYTERROR	1
   811         -#define YYERRCODE	256
          804  +/* Error token number */
          805  +#define YYTERROR        1
          806  +#define YYERRCODE       256
   812    807   
   813    808   
   814    809   /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   815    810      If N is 0, then set CURRENT to the empty location which ends
   816    811      the previous symbol: RHS[0] (always defined).  */
   817    812   
   818         -#define YYRHSLOC(Rhs, K) ((Rhs)[K])
   819    813   #ifndef YYLLOC_DEFAULT
   820         -# define YYLLOC_DEFAULT(Current, Rhs, N)				\
   821         -    do									\
   822         -      if (YYID (N))                                                    \
   823         -	{								\
   824         -	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
   825         -	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
   826         -	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
   827         -	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
   828         -	}								\
   829         -      else								\
   830         -	{								\
   831         -	  (Current).first_line   = (Current).last_line   =		\
   832         -	    YYRHSLOC (Rhs, 0).last_line;				\
   833         -	  (Current).first_column = (Current).last_column =		\
   834         -	    YYRHSLOC (Rhs, 0).last_column;				\
   835         -	}								\
   836         -    while (YYID (0))
          814  +# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
          815  +    do                                                                  \
          816  +      if (N)                                                            \
          817  +        {                                                               \
          818  +          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
          819  +          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
          820  +          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
          821  +          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
          822  +        }                                                               \
          823  +      else                                                              \
          824  +        {                                                               \
          825  +          (Current).first_line   = (Current).last_line   =              \
          826  +            YYRHSLOC (Rhs, 0).last_line;                                \
          827  +          (Current).first_column = (Current).last_column =              \
          828  +            YYRHSLOC (Rhs, 0).last_column;                              \
          829  +        }                                                               \
          830  +    while (0)
   837    831   #endif
   838    832   
          833  +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
   839    834   
   840         -/* YY_LOCATION_PRINT -- Print the location on the stream.
   841         -   This macro was not mandated originally: define only if we know
   842         -   we won't break user code: when these are the locations we know.  */
   843         -
   844         -#ifndef YY_LOCATION_PRINT
   845         -# if YYLTYPE_IS_TRIVIAL
   846         -#  define YY_LOCATION_PRINT(File, Loc)			\
   847         -     fprintf (File, "%d.%d-%d.%d",			\
   848         -	      (Loc).first_line, (Loc).first_column,	\
   849         -	      (Loc).last_line,  (Loc).last_column)
   850         -# else
   851         -#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
   852         -# endif
   853         -#endif
   854         -
   855         -
   856         -/* YYLEX -- calling `yylex' with the right arguments.  */
   857         -
   858         -#ifdef YYLEX_PARAM
   859         -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
   860         -#else
   861         -# define YYLEX yylex (&yylval, &yylloc, info)
   862         -#endif
   863    835   
   864    836   /* Enable debugging if requested.  */
   865    837   #if YYDEBUG
   866    838   
   867    839   # ifndef YYFPRINTF
   868    840   #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
   869    841   #  define YYFPRINTF fprintf
   870    842   # endif
   871    843   
   872         -# define YYDPRINTF(Args)			\
   873         -do {						\
   874         -  if (yydebug)					\
   875         -    YYFPRINTF Args;				\
   876         -} while (YYID (0))
   877         -
   878         -# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
   879         -do {									  \
   880         -  if (yydebug)								  \
   881         -    {									  \
   882         -      YYFPRINTF (stderr, "%s ", Title);					  \
   883         -      yy_symbol_print (stderr,						  \
   884         -		  Type, Value, Location, info); \
   885         -      YYFPRINTF (stderr, "\n");						  \
   886         -    }									  \
   887         -} while (YYID (0))
   888         -
   889         -
   890         -/*--------------------------------.
   891         -| Print this symbol on YYOUTPUT.  |
   892         -`--------------------------------*/
   893         -
   894         -/*ARGSUSED*/
   895         -#if (defined __STDC__ || defined __C99__FUNC__ \
   896         -     || defined __cplusplus || defined _MSC_VER)
          844  +# define YYDPRINTF(Args)                        \
          845  +do {                                            \
          846  +  if (yydebug)                                  \
          847  +    YYFPRINTF Args;                             \
          848  +} while (0)
          849  +
          850  +
          851  +/* YY_LOCATION_PRINT -- Print the location on the stream.
          852  +   This macro was not mandated originally: define only if we know
          853  +   we won't break user code: when these are the locations we know.  */
          854  +
          855  +#ifndef YY_LOCATION_PRINT
          856  +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
          857  +
          858  +/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
          859  +
          860  +YY_ATTRIBUTE_UNUSED
          861  +static unsigned
          862  +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
          863  +{
          864  +  unsigned res = 0;
          865  +  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
          866  +  if (0 <= yylocp->first_line)
          867  +    {
          868  +      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
          869  +      if (0 <= yylocp->first_column)
          870  +        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
          871  +    }
          872  +  if (0 <= yylocp->last_line)
          873  +    {
          874  +      if (yylocp->first_line < yylocp->last_line)
          875  +        {
          876  +          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
          877  +          if (0 <= end_col)
          878  +            res += YYFPRINTF (yyo, ".%d", end_col);
          879  +        }
          880  +      else if (0 <= end_col && yylocp->first_column < end_col)
          881  +        res += YYFPRINTF (yyo, "-%d", end_col);
          882  +    }
          883  +  return res;
          884  + }
          885  +
          886  +#  define YY_LOCATION_PRINT(File, Loc)          \
          887  +  yy_location_print_ (File, &(Loc))
          888  +
          889  +# else
          890  +#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
          891  +# endif
          892  +#endif
          893  +
          894  +
          895  +# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
          896  +do {                                                                      \
          897  +  if (yydebug)                                                            \
          898  +    {                                                                     \
          899  +      YYFPRINTF (stderr, "%s ", Title);                                   \
          900  +      yy_symbol_print (stderr,                                            \
          901  +                  Type, Value, Location, info); \
          902  +      YYFPRINTF (stderr, "\n");                                           \
          903  +    }                                                                     \
          904  +} while (0)
          905  +
          906  +
          907  +/*----------------------------------------.
          908  +| Print this symbol's value on YYOUTPUT.  |
          909  +`----------------------------------------*/
          910  +
   897    911   static void
   898    912   yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info)
   899         -#else
   900         -static void
   901         -yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, info)
   902         -    FILE *yyoutput;
   903         -    int yytype;
   904         -    YYSTYPE const * const yyvaluep;
   905         -    YYLTYPE const * const yylocationp;
   906         -    DateInfo* info;
   907         -#endif
   908    913   {
          914  +  FILE *yyo = yyoutput;
          915  +  YYUSE (yyo);
          916  +  YYUSE (yylocationp);
          917  +  YYUSE (info);
   909    918     if (!yyvaluep)
   910    919       return;
   911         -  YYUSE (yylocationp);
   912         -  YYUSE (info);
   913    920   # ifdef YYPRINT
   914    921     if (yytype < YYNTOKENS)
   915    922       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
   916         -# else
   917         -  YYUSE (yyoutput);
   918    923   # endif
   919         -  switch (yytype)
   920         -    {
   921         -      default:
   922         -	break;
   923         -    }
          924  +  YYUSE (yytype);
   924    925   }
   925    926   
   926    927   
   927    928   /*--------------------------------.
   928    929   | Print this symbol on YYOUTPUT.  |
   929    930   `--------------------------------*/
   930    931   
   931         -#if (defined __STDC__ || defined __C99__FUNC__ \
   932         -     || defined __cplusplus || defined _MSC_VER)
   933    932   static void
   934    933   yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info)
   935         -#else
   936         -static void
   937         -yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, info)
   938         -    FILE *yyoutput;
   939         -    int yytype;
   940         -    YYSTYPE const * const yyvaluep;
   941         -    YYLTYPE const * const yylocationp;
   942         -    DateInfo* info;
   943         -#endif
   944    934   {
   945         -  if (yytype < YYNTOKENS)
   946         -    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
   947         -  else
   948         -    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
          935  +  YYFPRINTF (yyoutput, "%s %s (",
          936  +             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
   949    937   
   950    938     YY_LOCATION_PRINT (yyoutput, *yylocationp);
   951    939     YYFPRINTF (yyoutput, ": ");
   952    940     yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, info);
   953    941     YYFPRINTF (yyoutput, ")");
   954    942   }
   955    943   
   956    944   /*------------------------------------------------------------------.
   957    945   | yy_stack_print -- Print the state stack from its BOTTOM up to its |
   958    946   | TOP (included).                                                   |
   959    947   `------------------------------------------------------------------*/
   960    948   
   961         -#if (defined __STDC__ || defined __C99__FUNC__ \
   962         -     || defined __cplusplus || defined _MSC_VER)
   963    949   static void
   964         -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
   965         -#else
   966         -static void
   967         -yy_stack_print (bottom, top)
   968         -    yytype_int16 *bottom;
   969         -    yytype_int16 *top;
   970         -#endif
          950  +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
   971    951   {
   972    952     YYFPRINTF (stderr, "Stack now");
   973         -  for (; bottom <= top; ++bottom)
   974         -    YYFPRINTF (stderr, " %d", *bottom);
          953  +  for (; yybottom <= yytop; yybottom++)
          954  +    {
          955  +      int yybot = *yybottom;
          956  +      YYFPRINTF (stderr, " %d", yybot);
          957  +    }
   975    958     YYFPRINTF (stderr, "\n");
   976    959   }
   977    960   
   978         -# define YY_STACK_PRINT(Bottom, Top)				\
   979         -do {								\
   980         -  if (yydebug)							\
   981         -    yy_stack_print ((Bottom), (Top));				\
   982         -} while (YYID (0))
          961  +# define YY_STACK_PRINT(Bottom, Top)                            \
          962  +do {                                                            \
          963  +  if (yydebug)                                                  \
          964  +    yy_stack_print ((Bottom), (Top));                           \
          965  +} while (0)
   983    966   
   984    967   
   985    968   /*------------------------------------------------.
   986    969   | Report that the YYRULE is going to be reduced.  |
   987    970   `------------------------------------------------*/
   988    971   
   989         -#if (defined __STDC__ || defined __C99__FUNC__ \
   990         -     || defined __cplusplus || defined _MSC_VER)
   991    972   static void
   992         -yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, DateInfo* info)
   993         -#else
   994         -static void
   995         -yy_reduce_print (yyvsp, yylsp, yyrule, info)
   996         -    YYSTYPE *yyvsp;
   997         -    YYLTYPE *yylsp;
   998         -    int yyrule;
   999         -    DateInfo* info;
  1000         -#endif
          973  +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, DateInfo* info)
  1001    974   {
          975  +  unsigned long yylno = yyrline[yyrule];
  1002    976     int yynrhs = yyr2[yyrule];
  1003    977     int yyi;
  1004         -  unsigned long int yylno = yyrline[yyrule];
  1005    978     YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1006         -	     yyrule - 1, yylno);
          979  +             yyrule - 1, yylno);
  1007    980     /* The symbols being reduced.  */
  1008    981     for (yyi = 0; yyi < yynrhs; yyi++)
  1009    982       {
  1010         -      fprintf (stderr, "   $%d = ", yyi + 1);
  1011         -      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  1012         -		       &(yyvsp[(yyi + 1) - (yynrhs)])
  1013         -		       , &(yylsp[(yyi + 1) - (yynrhs)])		       , info);
  1014         -      fprintf (stderr, "\n");
          983  +      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
          984  +      yy_symbol_print (stderr,
          985  +                       yystos[yyssp[yyi + 1 - yynrhs]],
          986  +                       &(yyvsp[(yyi + 1) - (yynrhs)])
          987  +                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , info);
          988  +      YYFPRINTF (stderr, "\n");
  1015    989       }
  1016    990   }
  1017    991   
  1018         -# define YY_REDUCE_PRINT(Rule)		\
  1019         -do {					\
  1020         -  if (yydebug)				\
  1021         -    yy_reduce_print (yyvsp, yylsp, Rule, info); \
  1022         -} while (YYID (0))
          992  +# define YY_REDUCE_PRINT(Rule)          \
          993  +do {                                    \
          994  +  if (yydebug)                          \
          995  +    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, info); \
          996  +} while (0)
  1023    997   
  1024    998   /* Nonzero means print parse trace.  It is left uninitialized so that
  1025    999      multiple parsers can coexist.  */
  1026   1000   int yydebug;
  1027   1001   #else /* !YYDEBUG */
  1028   1002   # define YYDPRINTF(Args)
  1029   1003   # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1030   1004   # define YY_STACK_PRINT(Bottom, Top)
  1031   1005   # define YY_REDUCE_PRINT(Rule)
  1032   1006   #endif /* !YYDEBUG */
  1033   1007   
  1034   1008   
  1035   1009   /* YYINITDEPTH -- initial size of the parser's stacks.  */
  1036         -#ifndef	YYINITDEPTH
         1010  +#ifndef YYINITDEPTH
  1037   1011   # define YYINITDEPTH 200
  1038   1012   #endif
  1039   1013   
  1040   1014   /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1041   1015      if the built-in stack extension method is used).
  1042   1016   
  1043   1017      Do not make this value too large; the results are undefined if
................................................................................
  1044   1018      YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1045   1019      evaluated with infinite-precision integer arithmetic.  */
  1046   1020   
  1047   1021   #ifndef YYMAXDEPTH
  1048   1022   # define YYMAXDEPTH 10000
  1049   1023   #endif
  1050   1024   
  1051         -
  1052   1025   
  1053   1026   #if YYERROR_VERBOSE
  1054   1027   
  1055   1028   # ifndef yystrlen
  1056   1029   #  if defined __GLIBC__ && defined _STRING_H
  1057   1030   #   define yystrlen strlen
  1058   1031   #  else
  1059   1032   /* Return the length of YYSTR.  */
  1060         -#if (defined __STDC__ || defined __C99__FUNC__ \
  1061         -     || defined __cplusplus || defined _MSC_VER)
  1062   1033   static YYSIZE_T
  1063   1034   yystrlen (const char *yystr)
  1064         -#else
  1065         -static YYSIZE_T
  1066         -yystrlen (yystr)
  1067         -    const char *yystr;
  1068         -#endif
  1069   1035   {
  1070   1036     YYSIZE_T yylen;
  1071   1037     for (yylen = 0; yystr[yylen]; yylen++)
  1072   1038       continue;
  1073   1039     return yylen;
  1074   1040   }
  1075   1041   #  endif
................................................................................
  1077   1043   
  1078   1044   # ifndef yystpcpy
  1079   1045   #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1080   1046   #   define yystpcpy stpcpy
  1081   1047   #  else
  1082   1048   /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1083   1049      YYDEST.  */
  1084         -#if (defined __STDC__ || defined __C99__FUNC__ \
  1085         -     || defined __cplusplus || defined _MSC_VER)
  1086   1050   static char *
  1087   1051   yystpcpy (char *yydest, const char *yysrc)
  1088         -#else
  1089         -static char *
  1090         -yystpcpy (yydest, yysrc)
  1091         -    char *yydest;
  1092         -    const char *yysrc;
  1093         -#endif
  1094   1052   {
  1095   1053     char *yyd = yydest;
  1096   1054     const char *yys = yysrc;
  1097   1055   
  1098   1056     while ((*yyd++ = *yys++) != '\0')
  1099   1057       continue;
  1100   1058   
................................................................................
  1116   1074   {
  1117   1075     if (*yystr == '"')
  1118   1076       {
  1119   1077         YYSIZE_T yyn = 0;
  1120   1078         char const *yyp = yystr;
  1121   1079   
  1122   1080         for (;;)
  1123         -	switch (*++yyp)
  1124         -	  {
  1125         -	  case '\'':
  1126         -	  case ',':
  1127         -	    goto do_not_strip_quotes;
  1128         -
  1129         -	  case '\\':
  1130         -	    if (*++yyp != '\\')
  1131         -	      goto do_not_strip_quotes;
  1132         -	    /* Fall through.  */
  1133         -	  default:
  1134         -	    if (yyres)
  1135         -	      yyres[yyn] = *yyp;
  1136         -	    yyn++;
  1137         -	    break;
  1138         -
  1139         -	  case '"':
  1140         -	    if (yyres)
  1141         -	      yyres[yyn] = '\0';
  1142         -	    return yyn;
  1143         -	  }
         1081  +        switch (*++yyp)
         1082  +          {
         1083  +          case '\'':
         1084  +          case ',':
         1085  +            goto do_not_strip_quotes;
         1086  +
         1087  +          case '\\':
         1088  +            if (*++yyp != '\\')
         1089  +              goto do_not_strip_quotes;
         1090  +            /* Fall through.  */
         1091  +          default:
         1092  +            if (yyres)
         1093  +              yyres[yyn] = *yyp;
         1094  +            yyn++;
         1095  +            break;
         1096  +
         1097  +          case '"':
         1098  +            if (yyres)
         1099  +              yyres[yyn] = '\0';
         1100  +            return yyn;
         1101  +          }
  1144   1102       do_not_strip_quotes: ;
  1145   1103       }
  1146   1104   
  1147   1105     if (! yyres)
  1148   1106       return yystrlen (yystr);
  1149   1107   
  1150   1108     return yystpcpy (yyres, yystr) - yyres;
  1151   1109   }
  1152   1110   # endif
  1153   1111   
  1154         -/* Copy into YYRESULT an error message about the unexpected token
  1155         -   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
  1156         -   including the terminating null byte.  If YYRESULT is null, do not
  1157         -   copy anything; just return the number of bytes that would be
  1158         -   copied.  As a special case, return 0 if an ordinary "syntax error"
  1159         -   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
  1160         -   size calculation.  */
  1161         -static YYSIZE_T
  1162         -yysyntax_error (char *yyresult, int yystate, int yychar)
         1112  +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
         1113  +   about the unexpected token YYTOKEN for the state stack whose top is
         1114  +   YYSSP.
         1115  +
         1116  +   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
         1117  +   not large enough to hold the message.  In that case, also set
         1118  +   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
         1119  +   required number of bytes is too large to store.  */
         1120  +static int
         1121  +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
         1122  +                yytype_int16 *yyssp, int yytoken)
  1163   1123   {
  1164         -  int yyn = yypact[yystate];
  1165         -
  1166         -  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
  1167         -    return 0;
  1168         -  else
  1169         -    {
  1170         -      int yytype = YYTRANSLATE (yychar);
  1171         -      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
  1172         -      YYSIZE_T yysize = yysize0;
  1173         -      YYSIZE_T yysize1;
  1174         -      int yysize_overflow = 0;
  1175         -      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1176         -      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1177         -      int yyx;
  1178         -
  1179         -# if 0
  1180         -      /* This is so xgettext sees the translatable formats that are
  1181         -	 constructed on the fly.  */
  1182         -      YY_("syntax error, unexpected %s");
  1183         -      YY_("syntax error, unexpected %s, expecting %s");
  1184         -      YY_("syntax error, unexpected %s, expecting %s or %s");
  1185         -      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
  1186         -      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
  1187         -# endif
  1188         -      char *yyfmt;
  1189         -      char const *yyf;
  1190         -      static char const yyunexpected[] = "syntax error, unexpected %s";
  1191         -      static char const yyexpecting[] = ", expecting %s";
  1192         -      static char const yyor[] = " or %s";
  1193         -      char yyformat[sizeof yyunexpected
  1194         -		    + sizeof yyexpecting - 1
  1195         -		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
  1196         -		       * (sizeof yyor - 1))];
  1197         -      char const *yyprefix = yyexpecting;
  1198         -
  1199         -      /* Start YYX at -YYN if negative to avoid negative indexes in
  1200         -	 YYCHECK.  */
  1201         -      int yyxbegin = yyn < 0 ? -yyn : 0;
  1202         -
  1203         -      /* Stay within bounds of both yycheck and yytname.  */
  1204         -      int yychecklim = YYLAST - yyn + 1;
  1205         -      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1206         -      int yycount = 1;
  1207         -
  1208         -      yyarg[0] = yytname[yytype];
  1209         -      yyfmt = yystpcpy (yyformat, yyunexpected);
  1210         -
  1211         -      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1212         -	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1213         -	  {
  1214         -	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1215         -	      {
  1216         -		yycount = 1;
  1217         -		yysize = yysize0;
  1218         -		yyformat[sizeof yyunexpected - 1] = '\0';
  1219         -		break;
  1220         -	      }
  1221         -	    yyarg[yycount++] = yytname[yyx];
  1222         -	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
  1223         -	    yysize_overflow |= (yysize1 < yysize);
  1224         -	    yysize = yysize1;
  1225         -	    yyfmt = yystpcpy (yyfmt, yyprefix);
  1226         -	    yyprefix = yyor;
  1227         -	  }
  1228         -
  1229         -      yyf = YY_(yyformat);
  1230         -      yysize1 = yysize + yystrlen (yyf);
  1231         -      yysize_overflow |= (yysize1 < yysize);
  1232         -      yysize = yysize1;
  1233         -
  1234         -      if (yysize_overflow)
  1235         -	return YYSIZE_MAXIMUM;
  1236         -
  1237         -      if (yyresult)
  1238         -	{
  1239         -	  /* Avoid sprintf, as that infringes on the user's name space.
  1240         -	     Don't have undefined behavior even if the translation
  1241         -	     produced a string with the wrong number of "%s"s.  */
  1242         -	  char *yyp = yyresult;
  1243         -	  int yyi = 0;
  1244         -	  while ((*yyp = *yyf) != '\0')
  1245         -	    {
  1246         -	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
  1247         -		{
  1248         -		  yyp += yytnamerr (yyp, yyarg[yyi++]);
  1249         -		  yyf += 2;
  1250         -		}
  1251         -	      else
  1252         -		{
  1253         -		  yyp++;
  1254         -		  yyf++;
  1255         -		}
  1256         -	    }
  1257         -	}
  1258         -      return yysize;
  1259         -    }
         1124  +  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
         1125  +  YYSIZE_T yysize = yysize0;
         1126  +  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
         1127  +  /* Internationalized format string. */
         1128  +  const char *yyformat = YY_NULLPTR;
         1129  +  /* Arguments of yyformat. */
         1130  +  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
         1131  +  /* Number of reported tokens (one for the "unexpected", one per
         1132  +     "expected"). */
         1133  +  int yycount = 0;
         1134  +
         1135  +  /* There are many possibilities here to consider:
         1136  +     - If this state is a consistent state with a default action, then
         1137  +       the only way this function was invoked is if the default action
         1138  +       is an error action.  In that case, don't check for expected
         1139  +       tokens because there are none.
         1140  +     - The only way there can be no lookahead present (in yychar) is if
         1141  +       this state is a consistent state with a default action.  Thus,
         1142  +       detecting the absence of a lookahead is sufficient to determine
         1143  +       that there is no unexpected or expected token to report.  In that
         1144  +       case, just report a simple "syntax error".
         1145  +     - Don't assume there isn't a lookahead just because this state is a
         1146  +       consistent state with a default action.  There might have been a
         1147  +       previous inconsistent state, consistent state with a non-default
         1148  +       action, or user semantic action that manipulated yychar.
         1149  +     - Of course, the expected token list depends on states to have
         1150  +       correct lookahead information, and it depends on the parser not
         1151  +       to perform extra reductions after fetching a lookahead from the
         1152  +       scanner and before detecting a syntax error.  Thus, state merging
         1153  +       (from LALR or IELR) and default reductions corrupt the expected
         1154  +       token list.  However, the list is correct for canonical LR with
         1155  +       one exception: it will still contain any token that will not be
         1156  +       accepted due to an error action in a later state.
         1157  +  */
         1158  +  if (yytoken != YYEMPTY)
         1159  +    {
         1160  +      int yyn = yypact[*yyssp];
         1161  +      yyarg[yycount++] = yytname[yytoken];
         1162  +      if (!yypact_value_is_default (yyn))
         1163  +        {
         1164  +          /* Start YYX at -YYN if negative to avoid negative indexes in
         1165  +             YYCHECK.  In other words, skip the first -YYN actions for
         1166  +             this state because they are default actions.  */
         1167  +          int yyxbegin = yyn < 0 ? -yyn : 0;
         1168  +          /* Stay within bounds of both yycheck and yytname.  */
         1169  +          int yychecklim = YYLAST - yyn + 1;
         1170  +          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
         1171  +          int yyx;
         1172  +
         1173  +          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
         1174  +            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
         1175  +                && !yytable_value_is_error (yytable[yyx + yyn]))
         1176  +              {
         1177  +                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
         1178  +                  {
         1179  +                    yycount = 1;
         1180  +                    yysize = yysize0;
         1181  +                    break;
         1182  +                  }
         1183  +                yyarg[yycount++] = yytname[yyx];
         1184  +                {
         1185  +                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
         1186  +                  if (! (yysize <= yysize1
         1187  +                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
         1188  +                    return 2;
         1189  +                  yysize = yysize1;
         1190  +                }
         1191  +              }
         1192  +        }
         1193  +    }
         1194  +
         1195  +  switch (yycount)
         1196  +    {
         1197  +# define YYCASE_(N, S)                      \
         1198  +      case N:                               \
         1199  +        yyformat = S;                       \
         1200  +      break
         1201  +    default: /* Avoid compiler warnings. */
         1202  +      YYCASE_(0, YY_("syntax error"));
         1203  +      YYCASE_(1, YY_("syntax error, unexpected %s"));
         1204  +      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
         1205  +      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
         1206  +      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
         1207  +      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
         1208  +# undef YYCASE_
         1209  +    }
         1210  +
         1211  +  {
         1212  +    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
         1213  +    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
         1214  +      return 2;
         1215  +    yysize = yysize1;
         1216  +  }
         1217  +
         1218  +  if (*yymsg_alloc < yysize)
         1219  +    {
         1220  +      *yymsg_alloc = 2 * yysize;
         1221  +      if (! (yysize <= *yymsg_alloc
         1222  +             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
         1223  +        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
         1224  +      return 1;
         1225  +    }
         1226  +
         1227  +  /* Avoid sprintf, as that infringes on the user's name space.
         1228  +     Don't have undefined behavior even if the translation
         1229  +     produced a string with the wrong number of "%s"s.  */
         1230  +  {
         1231  +    char *yyp = *yymsg;
         1232  +    int yyi = 0;
         1233  +    while ((*yyp = *yyformat) != '\0')
         1234  +      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
         1235  +        {
         1236  +          yyp += yytnamerr (yyp, yyarg[yyi++]);
         1237  +          yyformat += 2;
         1238  +        }
         1239  +      else
         1240  +        {
         1241  +          yyp++;
         1242  +          yyformat++;
         1243  +        }
         1244  +  }
         1245  +  return 0;
  1260   1246   }
  1261   1247   #endif /* YYERROR_VERBOSE */
  1262         -
  1263   1248   
  1264   1249   /*-----------------------------------------------.
  1265   1250   | Release the memory associated to this symbol.  |
  1266   1251   `-----------------------------------------------*/
  1267   1252   
  1268         -/*ARGSUSED*/
  1269         -#if (defined __STDC__ || defined __C99__FUNC__ \
  1270         -     || defined __cplusplus || defined _MSC_VER)
  1271   1253   static void
  1272   1254   yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, DateInfo* info)
  1273         -#else
  1274         -static void
  1275         -yydestruct (yymsg, yytype, yyvaluep, yylocationp, info)
  1276         -    const char *yymsg;
  1277         -    int yytype;
  1278         -    YYSTYPE *yyvaluep;
  1279         -    YYLTYPE *yylocationp;
  1280         -    DateInfo* info;
  1281         -#endif
  1282   1255   {
  1283   1256     YYUSE (yyvaluep);
  1284   1257     YYUSE (yylocationp);
  1285   1258     YYUSE (info);
  1286         -
  1287   1259     if (!yymsg)
  1288   1260       yymsg = "Deleting";
  1289   1261     YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1290   1262   
  1291         -  switch (yytype)
  1292         -    {
  1293         -
  1294         -      default:
  1295         -	break;
  1296         -    }
         1263  +  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
         1264  +  YYUSE (yytype);
         1265  +  YY_IGNORE_MAYBE_UNINITIALIZED_END
  1297   1266   }
  1298         -
  1299         -
  1300         -/* Prevent warnings from -Wmissing-prototypes.  */
  1301         -
  1302         -#ifdef YYPARSE_PARAM
  1303         -#if defined __STDC__ || defined __cplusplus
  1304         -int yyparse (void *YYPARSE_PARAM);
  1305         -#else
  1306         -int yyparse ();
  1307         -#endif
  1308         -#else /* ! YYPARSE_PARAM */
  1309         -#if defined __STDC__ || defined __cplusplus
  1310         -int yyparse (DateInfo* info);
  1311         -#else
  1312         -int yyparse ();
  1313         -#endif
  1314         -#endif /* ! YYPARSE_PARAM */
  1315         -
  1316         -
  1317   1267   
  1318   1268   
  1319   1269   
  1320   1270   
  1321   1271   /*----------.
  1322   1272   | yyparse.  |
  1323   1273   `----------*/
  1324   1274   
  1325         -#ifdef YYPARSE_PARAM
  1326         -#if (defined __STDC__ || defined __C99__FUNC__ \
  1327         -     || defined __cplusplus || defined _MSC_VER)
  1328         -int
  1329         -yyparse (void *YYPARSE_PARAM)
  1330         -#else
  1331         -int
  1332         -yyparse (YYPARSE_PARAM)
  1333         -    void *YYPARSE_PARAM;
  1334         -#endif
  1335         -#else /* ! YYPARSE_PARAM */
  1336         -#if (defined __STDC__ || defined __C99__FUNC__ \
  1337         -     || defined __cplusplus || defined _MSC_VER)
  1338   1275   int
  1339   1276   yyparse (DateInfo* info)
  1340         -#else
  1341         -int
  1342         -yyparse (info)
  1343         -    DateInfo* info;
  1344         -#endif
  1345         -#endif
  1346   1277   {
  1347         -  /* The look-ahead symbol.  */
         1278  +/* The lookahead symbol.  */
  1348   1279   int yychar;
  1349   1280   
  1350         -/* The semantic value of the look-ahead symbol.  */
  1351         -YYSTYPE yylval;
  1352         -
  1353         -/* Number of syntax errors so far.  */
  1354         -int yynerrs;
  1355         -/* Location data for the look-ahead symbol.  */
  1356         -YYLTYPE yylloc;
  1357         -
  1358         -  int yystate;
         1281  +
         1282  +/* The semantic value of the lookahead symbol.  */
         1283  +/* Default value used for initialization, for pacifying older GCCs
         1284  +   or non-GCC compilers.  */
         1285  +YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
         1286  +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
         1287  +
         1288  +/* Location data for the lookahead symbol.  */
         1289  +static YYLTYPE yyloc_default
         1290  +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
         1291  +  = { 1, 1, 1, 1 }
         1292  +# endif
         1293  +;
         1294  +YYLTYPE yylloc = yyloc_default;
         1295  +
         1296  +    /* Number of syntax errors so far.  */
         1297  +    int yynerrs;
         1298  +
         1299  +    int yystate;
         1300  +    /* Number of tokens to shift before error messages enabled.  */
         1301  +    int yyerrstatus;
         1302  +
         1303  +    /* The stacks and their tools:
         1304  +       'yyss': related to states.
         1305  +       'yyvs': related to semantic values.
         1306  +       'yyls': related to locations.
         1307  +
         1308  +       Refer to the stacks through separate pointers, to allow yyoverflow
         1309  +       to reallocate them elsewhere.  */
         1310  +
         1311  +    /* The state stack.  */
         1312  +    yytype_int16 yyssa[YYINITDEPTH];
         1313  +    yytype_int16 *yyss;
         1314  +    yytype_int16 *yyssp;
         1315  +
         1316  +    /* The semantic value stack.  */
         1317  +    YYSTYPE yyvsa[YYINITDEPTH];
         1318  +    YYSTYPE *yyvs;
         1319  +    YYSTYPE *yyvsp;
         1320  +
         1321  +    /* The location stack.  */
         1322  +    YYLTYPE yylsa[YYINITDEPTH];
         1323  +    YYLTYPE *yyls;
         1324  +    YYLTYPE *yylsp;
         1325  +
         1326  +    /* The locations where the error started and ended.  */
         1327  +    YYLTYPE yyerror_range[3];
         1328  +
         1329  +    YYSIZE_T yystacksize;
         1330  +
  1359   1331     int yyn;
  1360   1332     int yyresult;
  1361         -  /* Number of tokens to shift before error messages enabled.  */
  1362         -  int yyerrstatus;
  1363         -  /* Look-ahead token as an internal (translated) token number.  */
         1333  +  /* Lookahead token as an internal (translated) token number.  */
  1364   1334     int yytoken = 0;
         1335  +  /* The variables used to return semantic value and location from the
         1336  +     action routines.  */
         1337  +  YYSTYPE yyval;
         1338  +  YYLTYPE yyloc;
         1339  +
  1365   1340   #if YYERROR_VERBOSE
  1366   1341     /* Buffer for error messages, and its allocated size.  */
  1367   1342     char yymsgbuf[128];
  1368   1343     char *yymsg = yymsgbuf;
  1369   1344     YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1370   1345   #endif
  1371   1346   
  1372         -  /* Three stacks and their tools:
  1373         -     `yyss': related to states,
  1374         -     `yyvs': related to semantic values,
  1375         -     `yyls': related to locations.
  1376         -
  1377         -     Refer to the stacks thru separate pointers, to allow yyoverflow
  1378         -     to reallocate them elsewhere.  */
  1379         -
  1380         -  /* The state stack.  */
  1381         -  yytype_int16 yyssa[YYINITDEPTH];
  1382         -  yytype_int16 *yyss = yyssa;
  1383         -  yytype_int16 *yyssp;
  1384         -
  1385         -  /* The semantic value stack.  */
  1386         -  YYSTYPE yyvsa[YYINITDEPTH];
  1387         -  YYSTYPE *yyvs = yyvsa;
  1388         -  YYSTYPE *yyvsp;
  1389         -
  1390         -  /* The location stack.  */
  1391         -  YYLTYPE yylsa[YYINITDEPTH];
  1392         -  YYLTYPE *yyls = yylsa;
  1393         -  YYLTYPE *yylsp;
  1394         -  /* The locations where the error started and ended.  */
  1395         -  YYLTYPE yyerror_range[2];
  1396         -
  1397   1347   #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1398   1348   
  1399         -  YYSIZE_T yystacksize = YYINITDEPTH;
  1400         -
  1401         -  /* The variables used to return semantic value and location from the
  1402         -     action routines.  */
  1403         -  YYSTYPE yyval;
  1404         -  YYLTYPE yyloc;
  1405         -
  1406   1349     /* The number of symbols on the RHS of the reduced rule.
  1407   1350        Keep to zero when no symbol should be popped.  */
  1408   1351     int yylen = 0;
  1409   1352   
         1353  +  yyssp = yyss = yyssa;
         1354  +  yyvsp = yyvs = yyvsa;
         1355  +  yylsp = yyls = yylsa;
         1356  +  yystacksize = YYINITDEPTH;
         1357  +
  1410   1358     YYDPRINTF ((stderr, "Starting parse\n"));
  1411   1359   
  1412   1360     yystate = 0;
  1413   1361     yyerrstatus = 0;
  1414   1362     yynerrs = 0;
  1415         -  yychar = YYEMPTY;		/* Cause a token to be read.  */
  1416         -
  1417         -  /* Initialize stack pointers.
  1418         -     Waste one element of value and location stack
  1419         -     so that they stay on the same level as the state stack.
  1420         -     The wasted elements are never initialized.  */
  1421         -
  1422         -  yyssp = yyss;
  1423         -  yyvsp = yyvs;
  1424         -  yylsp = yyls;
  1425         -#if YYLTYPE_IS_TRIVIAL
  1426         -  /* Initialize the default location before parsing starts.  */
  1427         -  yylloc.first_line   = yylloc.last_line   = 1;
  1428         -  yylloc.first_column = yylloc.last_column = 0;
  1429         -#endif
  1430         -
         1363  +  yychar = YYEMPTY; /* Cause a token to be read.  */
         1364  +  yylsp[0] = yylloc;
  1431   1365     goto yysetstate;
  1432   1366   
  1433   1367   /*------------------------------------------------------------.
  1434   1368   | yynewstate -- Push a new state, which is found in yystate.  |
  1435   1369   `------------------------------------------------------------*/
  1436   1370    yynewstate:
  1437   1371     /* In all cases, when you get here, the value and location stacks
................................................................................
  1444   1378     if (yyss + yystacksize - 1 <= yyssp)
  1445   1379       {
  1446   1380         /* Get the current used size of the three stacks, in elements.  */
  1447   1381         YYSIZE_T yysize = yyssp - yyss + 1;
  1448   1382   
  1449   1383   #ifdef yyoverflow
  1450   1384         {
  1451         -	/* Give user a chance to reallocate the stack.  Use copies of
  1452         -	   these so that the &'s don't force the real ones into
  1453         -	   memory.  */
  1454         -	YYSTYPE *yyvs1 = yyvs;
  1455         -	yytype_int16 *yyss1 = yyss;
  1456         -	YYLTYPE *yyls1 = yyls;
         1385  +        /* Give user a chance to reallocate the stack.  Use copies of
         1386  +           these so that the &'s don't force the real ones into
         1387  +           memory.  */
         1388  +        YYSTYPE *yyvs1 = yyvs;
         1389  +        yytype_int16 *yyss1 = yyss;
         1390  +        YYLTYPE *yyls1 = yyls;
  1457   1391   
  1458         -	/* Each stack pointer address is followed by the size of the
  1459         -	   data in use in that stack, in bytes.  This used to be a
  1460         -	   conditional around just the two extra args, but that might
  1461         -	   be undefined if yyoverflow is a macro.  */
  1462         -	yyoverflow (YY_("memory exhausted"),
  1463         -		    &yyss1, yysize * sizeof (*yyssp),
  1464         -		    &yyvs1, yysize * sizeof (*yyvsp),
  1465         -		    &yyls1, yysize * sizeof (*yylsp),
  1466         -		    &yystacksize);
  1467         -	yyls = yyls1;
  1468         -	yyss = yyss1;
  1469         -	yyvs = yyvs1;
         1392  +        /* Each stack pointer address is followed by the size of the
         1393  +           data in use in that stack, in bytes.  This used to be a
         1394  +           conditional around just the two extra args, but that might
         1395  +           be undefined if yyoverflow is a macro.  */
         1396  +        yyoverflow (YY_("memory exhausted"),
         1397  +                    &yyss1, yysize * sizeof (*yyssp),
         1398  +                    &yyvs1, yysize * sizeof (*yyvsp),
         1399  +                    &yyls1, yysize * sizeof (*yylsp),
         1400  +                    &yystacksize);
         1401  +
         1402  +        yyls = yyls1;
         1403  +        yyss = yyss1;
         1404  +        yyvs = yyvs1;
  1470   1405         }
  1471   1406   #else /* no yyoverflow */
  1472   1407   # ifndef YYSTACK_RELOCATE
  1473   1408         goto yyexhaustedlab;
  1474   1409   # else
  1475   1410         /* Extend the stack our own way.  */
  1476   1411         if (YYMAXDEPTH <= yystacksize)
  1477         -	goto yyexhaustedlab;
         1412  +        goto yyexhaustedlab;
  1478   1413         yystacksize *= 2;
  1479   1414         if (YYMAXDEPTH < yystacksize)
  1480         -	yystacksize = YYMAXDEPTH;
         1415  +        yystacksize = YYMAXDEPTH;
  1481   1416   
  1482   1417         {
  1483         -	yytype_int16 *yyss1 = yyss;
  1484         -	union yyalloc *yyptr =
  1485         -	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1486         -	if (! yyptr)
  1487         -	  goto yyexhaustedlab;
  1488         -	YYSTACK_RELOCATE (yyss);
  1489         -	YYSTACK_RELOCATE (yyvs);
  1490         -	YYSTACK_RELOCATE (yyls);
         1418  +        yytype_int16 *yyss1 = yyss;
         1419  +        union yyalloc *yyptr =
         1420  +          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
         1421  +        if (! yyptr)
         1422  +          goto yyexhaustedlab;
         1423  +        YYSTACK_RELOCATE (yyss_alloc, yyss);
         1424  +        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
         1425  +        YYSTACK_RELOCATE (yyls_alloc, yyls);
  1491   1426   #  undef YYSTACK_RELOCATE
  1492         -	if (yyss1 != yyssa)
  1493         -	  YYSTACK_FREE (yyss1);
         1427  +        if (yyss1 != yyssa)
         1428  +          YYSTACK_FREE (yyss1);
  1494   1429         }
  1495   1430   # endif
  1496   1431   #endif /* no yyoverflow */
  1497   1432   
  1498   1433         yyssp = yyss + yysize - 1;
  1499   1434         yyvsp = yyvs + yysize - 1;
  1500   1435         yylsp = yyls + yysize - 1;
  1501   1436   
  1502   1437         YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1503         -		  (unsigned long int) yystacksize));
         1438  +                  (unsigned long) yystacksize));
  1504   1439   
  1505   1440         if (yyss + yystacksize - 1 <= yyssp)
  1506         -	YYABORT;
         1441  +        YYABORT;
  1507   1442       }
  1508   1443   
  1509   1444     YYDPRINTF ((stderr, "Entering state %d\n", yystate));
         1445  +
         1446  +  if (yystate == YYFINAL)
         1447  +    YYACCEPT;
  1510   1448   
  1511   1449     goto yybackup;
  1512   1450   
  1513   1451   /*-----------.
  1514   1452   | yybackup.  |
  1515   1453   `-----------*/
  1516   1454   yybackup:
  1517   1455   
  1518   1456     /* Do appropriate processing given the current state.  Read a
  1519         -     look-ahead token if we need one and don't already have one.  */
         1457  +     lookahead token if we need one and don't already have one.  */
  1520   1458   
  1521         -  /* First try to decide what to do without reference to look-ahead token.  */
         1459  +  /* First try to decide what to do without reference to lookahead token.  */
  1522   1460     yyn = yypact[yystate];
  1523         -  if (yyn == YYPACT_NINF)
         1461  +  if (yypact_value_is_default (yyn))
  1524   1462       goto yydefault;
  1525   1463   
  1526         -  /* Not known => get a look-ahead token if don't already have one.  */
         1464  +  /* Not known => get a lookahead token if don't already have one.  */
  1527   1465   
  1528         -  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
         1466  +  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  1529   1467     if (yychar == YYEMPTY)
  1530   1468       {
  1531   1469         YYDPRINTF ((stderr, "Reading a token: "));
  1532         -      yychar = YYLEX;
         1470  +      yychar = yylex (&yylval, &yylloc, info);
  1533   1471       }
  1534   1472   
  1535   1473     if (yychar <= YYEOF)
  1536   1474       {
  1537   1475         yychar = yytoken = YYEOF;
  1538   1476         YYDPRINTF ((stderr, "Now at end of input.\n"));
  1539   1477       }
................................................................................
  1547   1485        detect an error, take that action.  */
  1548   1486     yyn += yytoken;
  1549   1487     if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1550   1488       goto yydefault;
  1551   1489     yyn = yytable[yyn];
  1552   1490     if (yyn <= 0)
  1553   1491       {
  1554         -      if (yyn == 0 || yyn == YYTABLE_NINF)
  1555         -	goto yyerrlab;
         1492  +      if (yytable_value_is_error (yyn))
         1493  +        goto yyerrlab;
  1556   1494         yyn = -yyn;
  1557   1495         goto yyreduce;
  1558   1496       }
  1559   1497   
  1560         -  if (yyn == YYFINAL)
  1561         -    YYACCEPT;
  1562         -
  1563   1498     /* Count tokens shifted since error; after three, turn off error
  1564   1499        status.  */
  1565   1500     if (yyerrstatus)
  1566   1501       yyerrstatus--;
  1567   1502   
  1568         -  /* Shift the look-ahead token.  */
         1503  +  /* Shift the lookahead token.  */
  1569   1504     YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1570   1505   
  1571         -  /* Discard the shifted token unless it is eof.  */
  1572         -  if (yychar != YYEOF)
  1573         -    yychar = YYEMPTY;
         1506  +  /* Discard the shifted token.  */
         1507  +  yychar = YYEMPTY;
  1574   1508   
  1575   1509     yystate = yyn;
         1510  +  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1576   1511     *++yyvsp = yylval;
         1512  +  YY_IGNORE_MAYBE_UNINITIALIZED_END
  1577   1513     *++yylsp = yylloc;
  1578   1514     goto yynewstate;
  1579   1515   
  1580   1516   
  1581   1517   /*-----------------------------------------------------------.
  1582   1518   | yydefault -- do the default action for the current state.  |
  1583   1519   `-----------------------------------------------------------*/
................................................................................
  1592   1528   | yyreduce -- Do a reduction.  |
  1593   1529   `-----------------------------*/
  1594   1530   yyreduce:
  1595   1531     /* yyn is the number of a rule to reduce with.  */
  1596   1532     yylen = yyr2[yyn];
  1597   1533   
  1598   1534     /* If YYLEN is nonzero, implement the default value of the action:
  1599         -     `$$ = $1'.
         1535  +     '$$ = $1'.
  1600   1536   
  1601   1537        Otherwise, the following line sets YYVAL to garbage.
  1602   1538        This behavior is undocumented and Bison
  1603   1539        users should not rely upon it.  Assigning to YYVAL
  1604   1540        unconditionally makes the parser a bit smaller, and it avoids a
  1605   1541        GCC warning that YYVAL may be used uninitialized.  */
  1606   1542     yyval = yyvsp[1-yylen];
  1607   1543   
  1608         -  /* Default location.  */
         1544  +  /* Default location. */
  1609   1545     YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
         1546  +  yyerror_range[1] = yyloc;
  1610   1547     YY_REDUCE_PRINT (yyn);
  1611   1548     switch (yyn)
  1612   1549       {
  1613   1550           case 4:
  1614   1551   
  1615   1552       {
  1616   1553   	    yyHaveTime++;
  1617         -	;}
         1554  +	}
         1555  +
  1618   1556       break;
  1619   1557   
  1620   1558     case 5:
  1621   1559   
  1622   1560       {
  1623   1561   	    yyHaveZone++;
  1624         -	;}
         1562  +	}
         1563  +
  1625   1564       break;
  1626   1565   
  1627   1566     case 6:
  1628   1567   
  1629   1568       {
  1630   1569   	    yyHaveDate++;
  1631         -	;}
         1570  +	}
         1571  +
  1632   1572       break;
  1633   1573   
  1634   1574     case 7:
  1635   1575   
  1636   1576       {
  1637   1577   	    yyHaveOrdinalMonth++;
  1638         -	;}
         1578  +	}
         1579  +
  1639   1580       break;
  1640   1581   
  1641   1582     case 8:
  1642   1583   
  1643   1584       {
  1644   1585   	    yyHaveDay++;
  1645         -	;}
         1586  +	}
         1587  +
  1646   1588       break;
  1647   1589   
  1648   1590     case 9:
  1649   1591   
  1650   1592       {
  1651   1593   	    yyHaveRel++;
  1652         -	;}
         1594  +	}
         1595  +
  1653   1596       break;
  1654   1597   
  1655   1598     case 10:
  1656   1599   
  1657   1600       {
  1658   1601   	    yyHaveTime++;
  1659   1602   	    yyHaveDate++;
  1660         -	;}
         1603  +	}
         1604  +
  1661   1605       break;
  1662   1606   
  1663   1607     case 11:
  1664   1608   
  1665   1609       {
  1666   1610   	    yyHaveTime++;
  1667   1611   	    yyHaveDate++;
  1668   1612   	    yyHaveRel++;
  1669         -	;}
         1613  +	}
         1614  +
  1670   1615       break;
  1671   1616   
  1672   1617     case 13:
  1673   1618   
  1674   1619       {
  1675         -	    yyHour = (yyvsp[(1) - (2)].Number);
         1620  +	    yyHour = (yyvsp[-1].Number);
  1676   1621   	    yyMinutes = 0;
  1677   1622   	    yySeconds = 0;
  1678         -	    yyMeridian = (yyvsp[(2) - (2)].Meridian);
  1679         -	;}
         1623  +	    yyMeridian = (yyvsp[0].Meridian);
         1624  +	}
         1625  +
  1680   1626       break;
  1681   1627   
  1682   1628     case 14:
  1683   1629   
  1684   1630       {
  1685         -	    yyHour = (yyvsp[(1) - (4)].Number);
  1686         -	    yyMinutes = (yyvsp[(3) - (4)].Number);
         1631  +	    yyHour = (yyvsp[-3].Number);
         1632  +	    yyMinutes = (yyvsp[-1].Number);
  1687   1633   	    yySeconds = 0;
  1688         -	    yyMeridian = (yyvsp[(4) - (4)].Meridian);
  1689         -	;}
         1634  +	    yyMeridian = (yyvsp[0].Meridian);
         1635  +	}
         1636  +
  1690   1637       break;
  1691   1638   
  1692   1639     case 15:
  1693   1640   
  1694   1641       {
  1695         -	    yyHour = (yyvsp[(1) - (5)].Number);
  1696         -	    yyMinutes = (yyvsp[(3) - (5)].Number);
         1642  +	    yyHour = (yyvsp[-4].Number);
         1643  +	    yyMinutes = (yyvsp[-2].Number);
  1697   1644   	    yyMeridian = MER24;
  1698   1645   	    yyDSTmode = DSToff;
  1699         -	    yyTimezone = ((yyvsp[(5) - (5)].Number) % 100 + ((yyvsp[(5) - (5)].Number) / 100) * 60);
         1646  +	    yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
  1700   1647   	    ++yyHaveZone;
  1701         -	;}
         1648  +	}
         1649  +
  1702   1650       break;
  1703   1651   
  1704   1652     case 16:
  1705   1653   
  1706   1654       {
  1707         -	    yyHour = (yyvsp[(1) - (6)].Number);
  1708         -	    yyMinutes = (yyvsp[(3) - (6)].Number);
  1709         -	    yySeconds = (yyvsp[(5) - (6)].Number);
  1710         -	    yyMeridian = (yyvsp[(6) - (6)].Meridian);
  1711         -	;}
         1655  +	    yyHour = (yyvsp[-5].Number);
         1656  +	    yyMinutes = (yyvsp[-3].Number);
         1657  +	    yySeconds = (yyvsp[-1].Number);
         1658  +	    yyMeridian = (yyvsp[0].Meridian);
         1659  +	}
         1660  +
  1712   1661       break;
  1713   1662   
  1714   1663     case 17:
  1715   1664   
  1716   1665       {
  1717         -	    yyHour = (yyvsp[(1) - (7)].Number);
  1718         -	    yyMinutes = (yyvsp[(3) - (7)].Number);
  1719         -	    yySeconds = (yyvsp[(5) - (7)].Number);
         1666  +	    yyHour = (yyvsp[-6].Number);
         1667  +	    yyMinutes = (yyvsp[-4].Number);
         1668  +	    yySeconds = (yyvsp[-2].Number);
  1720   1669   	    yyMeridian = MER24;
  1721   1670   	    yyDSTmode = DSToff;
  1722         -	    yyTimezone = ((yyvsp[(7) - (7)].Number) % 100 + ((yyvsp[(7) - (7)].Number) / 100) * 60);
         1671  +	    yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
  1723   1672   	    ++yyHaveZone;
  1724         -	;}
         1673  +	}
         1674  +
  1725   1675       break;
  1726   1676   
  1727   1677     case 18:
  1728   1678   
  1729   1679       {
  1730         -	    yyTimezone = (yyvsp[(1) - (2)].Number);
         1680  +	    yyTimezone = (yyvsp[-1].Number);
  1731   1681   	    yyDSTmode = DSTon;
  1732         -	;}
         1682  +	}
         1683  +
  1733   1684       break;
  1734   1685   
  1735   1686     case 19:
  1736   1687   
  1737   1688       {
  1738         -	    yyTimezone = (yyvsp[(1) - (1)].Number);
         1689  +	    yyTimezone = (yyvsp[0].Number);
  1739   1690   	    yyDSTmode = DSToff;
  1740         -	;}
         1691  +	}
         1692  +
  1741   1693       break;
  1742   1694   
  1743   1695     case 20:
  1744   1696   
  1745   1697       {
  1746         -	    yyTimezone = (yyvsp[(1) - (1)].Number);
         1698  +	    yyTimezone = (yyvsp[0].Number);
  1747   1699   	    yyDSTmode = DSTon;
  1748         -	;}
         1700  +	}
         1701  +
  1749   1702       break;
  1750   1703   
  1751   1704     case 21:
  1752   1705   
  1753   1706       {
  1754   1707   	    yyDayOrdinal = 1;
  1755         -	    yyDayNumber = (yyvsp[(1) - (1)].Number);
  1756         -	;}
         1708  +	    yyDayNumber = (yyvsp[0].Number);
         1709  +	}
         1710  +
  1757   1711       break;
  1758   1712   
  1759   1713     case 22:
  1760   1714   
  1761   1715       {
  1762   1716   	    yyDayOrdinal = 1;
  1763         -	    yyDayNumber = (yyvsp[(1) - (2)].Number);
  1764         -	;}
         1717  +	    yyDayNumber = (yyvsp[-1].Number);
         1718  +	}
         1719  +
  1765   1720       break;
  1766   1721   
  1767   1722     case 23:
  1768   1723   
  1769   1724       {
  1770         -	    yyDayOrdinal = (yyvsp[(1) - (2)].Number);
  1771         -	    yyDayNumber = (yyvsp[(2) - (2)].Number);
  1772         -	;}
         1725  +	    yyDayOrdinal = (yyvsp[-1].Number);
         1726  +	    yyDayNumber = (yyvsp[0].Number);
         1727  +	}
         1728  +
  1773   1729       break;
  1774   1730   
  1775   1731     case 24:
  1776   1732   
  1777   1733       {
  1778         -	    yyDayOrdinal = (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number);
  1779         -	    yyDayNumber = (yyvsp[(3) - (3)].Number);
  1780         -	;}
         1734  +	    yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number);
         1735  +	    yyDayNumber = (yyvsp[0].Number);
         1736  +	}
         1737  +
  1781   1738       break;
  1782   1739   
  1783   1740     case 25:
  1784   1741   
  1785   1742       {
  1786   1743   	    yyDayOrdinal = 2;
  1787         -	    yyDayNumber = (yyvsp[(2) - (2)].Number);
  1788         -	;}
         1744  +	    yyDayNumber = (yyvsp[0].Number);
         1745  +	}
         1746  +
  1789   1747       break;
  1790   1748   
  1791   1749     case 26:
  1792   1750   
  1793   1751       {
  1794         -	    yyMonth = (yyvsp[(1) - (3)].Number);
  1795         -	    yyDay = (yyvsp[(3) - (3)].Number);
  1796         -	;}
         1752  +	    yyMonth = (yyvsp[-2].Number);
         1753  +	    yyDay = (yyvsp[0].Number);
         1754  +	}
         1755  +
  1797   1756       break;
  1798   1757   
  1799   1758     case 27:
  1800   1759   
  1801   1760       {
  1802         -	    yyMonth = (yyvsp[(1) - (5)].Number);
  1803         -	    yyDay = (yyvsp[(3) - (5)].Number);
  1804         -	    yyYear = (yyvsp[(5) - (5)].Number);
  1805         -	;}
         1761  +	    yyMonth = (yyvsp[-4].Number);
         1762  +	    yyDay = (yyvsp[-2].Number);
         1763  +	    yyYear = (yyvsp[0].Number);
         1764  +	}
         1765  +
  1806   1766       break;
  1807   1767   
  1808   1768     case 28:
  1809   1769   
  1810   1770       {
  1811         -	    yyYear = (yyvsp[(1) - (1)].Number) / 10000;
  1812         -	    yyMonth = ((yyvsp[(1) - (1)].Number) % 10000)/100;
  1813         -	    yyDay = (yyvsp[(1) - (1)].Number) % 100;
  1814         -	;}
         1771  +	    yyYear = (yyvsp[0].Number) / 10000;
         1772  +	    yyMonth = ((yyvsp[0].Number) % 10000)/100;
         1773  +	    yyDay = (yyvsp[0].Number) % 100;
         1774  +	}
         1775  +
  1815   1776       break;
  1816   1777   
  1817   1778     case 29:
  1818   1779   
  1819   1780       {
  1820         -	    yyDay = (yyvsp[(1) - (5)].Number);
  1821         -	    yyMonth = (yyvsp[(3) - (5)].Number);
  1822         -	    yyYear = (yyvsp[(5) - (5)].Number);
  1823         -	;}
         1781  +	    yyDay = (yyvsp[-4].Number);
         1782  +	    yyMonth = (yyvsp[-2].Number);
         1783  +	    yyYear = (yyvsp[0].Number);
         1784  +	}
         1785  +
  1824   1786       break;
  1825   1787   
  1826   1788     case 30:
  1827   1789   
  1828   1790       {
  1829         -	    yyMonth = (yyvsp[(3) - (5)].Number);
  1830         -	    yyDay = (yyvsp[(5) - (5)].Number);
  1831         -	    yyYear = (yyvsp[(1) - (5)].Number);
  1832         -	;}
         1791  +	    yyMonth = (yyvsp[-2].Number);
         1792  +	    yyDay = (yyvsp[0].Number);
         1793  +	    yyYear = (yyvsp[-4].Number);
         1794  +	}
         1795  +
  1833   1796       break;
  1834   1797   
  1835   1798     case 31:
  1836   1799   
  1837   1800       {
  1838         -	    yyMonth = (yyvsp[(1) - (2)].Number);
  1839         -	    yyDay = (yyvsp[(2) - (2)].Number);
  1840         -	;}
         1801  +	    yyMonth = (yyvsp[-1].Number);
         1802  +	    yyDay = (yyvsp[0].Number);
         1803  +	}
         1804  +
  1841   1805       break;
  1842   1806   
  1843   1807     case 32:
  1844   1808   
  1845   1809       {
  1846         -	    yyMonth = (yyvsp[(1) - (4)].Number);
  1847         -	    yyDay = (yyvsp[(2) - (4)].Number);
  1848         -	    yyYear = (yyvsp[(4) - (4)].Number);
  1849         -	;}
         1810  +	    yyMonth = (yyvsp[-3].Number);
         1811  +	    yyDay = (yyvsp[-2].Number);
         1812  +	    yyYear = (yyvsp[0].Number);
         1813  +	}
         1814  +
  1850   1815       break;
  1851   1816   
  1852   1817     case 33:
  1853   1818   
  1854   1819       {
  1855         -	    yyMonth = (yyvsp[(2) - (2)].Number);
  1856         -	    yyDay = (yyvsp[(1) - (2)].Number);
  1857         -	;}
         1820  +	    yyMonth = (yyvsp[0].Number);
         1821  +	    yyDay = (yyvsp[-1].Number);
         1822  +	}
         1823  +
  1858   1824       break;
  1859   1825   
  1860   1826     case 34:
  1861   1827   
  1862   1828       {
  1863   1829   	    yyMonth = 1;
  1864   1830   	    yyDay = 1;
  1865   1831   	    yyYear = EPOCH;
  1866         -	;}
         1832  +	}
         1833  +
  1867   1834       break;
  1868   1835   
  1869   1836     case 35:
  1870   1837   
  1871   1838       {
  1872         -	    yyMonth = (yyvsp[(2) - (3)].Number);
  1873         -	    yyDay = (yyvsp[(1) - (3)].Number);
  1874         -	    yyYear = (yyvsp[(3) - (3)].Number);
  1875         -	;}
         1839  +	    yyMonth = (yyvsp[-1].Number);
         1840  +	    yyDay = (yyvsp[-2].Number);
         1841  +	    yyYear = (yyvsp[0].Number);
         1842  +	}
         1843  +
  1876   1844       break;
  1877   1845   
  1878   1846     case 36:
  1879   1847   
  1880   1848       {
  1881   1849   	    yyMonthOrdinal = 1;
  1882         -	    yyMonth = (yyvsp[(2) - (2)].Number);
  1883         -	;}
         1850  +	    yyMonth = (yyvsp[0].Number);
         1851  +	}
         1852  +
  1884   1853       break;
  1885   1854   
  1886   1855     case 37:
  1887   1856   
  1888   1857       {
  1889         -	    yyMonthOrdinal = (yyvsp[(2) - (3)].Number);
  1890         -	    yyMonth = (yyvsp[(3) - (3)].Number);
  1891         -	;}
         1858  +	    yyMonthOrdinal = (yyvsp[-1].Number);
         1859  +	    yyMonth = (yyvsp[0].Number);
         1860  +	}
         1861  +
  1892   1862       break;
  1893   1863   
  1894   1864     case 38:
  1895   1865   
  1896   1866       {
  1897         -	    if ((yyvsp[(2) - (3)].Number) != HOUR( 7)) YYABORT;
  1898         -	    yyYear = (yyvsp[(1) - (3)].Number) / 10000;
  1899         -	    yyMonth = ((yyvsp[(1) - (3)].Number) % 10000)/100;
  1900         -	    yyDay = (yyvsp[(1) - (3)].Number) % 100;
  1901         -	    yyHour = (yyvsp[(3) - (3)].Number) / 10000;
  1902         -	    yyMinutes = ((yyvsp[(3) - (3)].Number) % 10000)/100;
  1903         -	    yySeconds = (yyvsp[(3) - (3)].Number) % 100;
  1904         -	;}
         1867  +	    if ((yyvsp[-1].Number) != HOUR( 7)) YYABORT;
         1868  +	    yyYear = (yyvsp[-2].Number) / 10000;
         1869  +	    yyMonth = ((yyvsp[-2].Number) % 10000)/100;
         1870  +	    yyDay = (yyvsp[-2].Number) % 100;
         1871  +	    yyHour = (yyvsp[0].Number) / 10000;
         1872  +	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
         1873  +	    yySeconds = (yyvsp[0].Number) % 100;
         1874  +	}
         1875  +
  1905   1876       break;
  1906   1877   
  1907   1878     case 39:
  1908   1879   
  1909   1880       {
  1910         -	    if ((yyvsp[(2) - (7)].Number) != HOUR( 7)) YYABORT;
  1911         -	    yyYear = (yyvsp[(1) - (7)].Number) / 10000;
  1912         -	    yyMonth = ((yyvsp[(1) - (7)].Number) % 10000)/100;
  1913         -	    yyDay = (yyvsp[(1) - (7)].Number) % 100;
  1914         -	    yyHour = (yyvsp[(3) - (7)].Number);
  1915         -	    yyMinutes = (yyvsp[(5) - (7)].Number);
  1916         -	    yySeconds = (yyvsp[(7) - (7)].Number);
  1917         -	;}
         1881  +	    if ((yyvsp[-5].Number) != HOUR( 7)) YYABORT;
         1882  +	    yyYear = (yyvsp[-6].Number) / 10000;
         1883  +	    yyMonth = ((yyvsp[-6].Number) % 10000)/100;
         1884  +	    yyDay = (yyvsp[-6].Number) % 100;
         1885  +	    yyHour = (yyvsp[-4].Number);
         1886  +	    yyMinutes = (yyvsp[-2].Number);
         1887  +	    yySeconds = (yyvsp[0].Number);
         1888  +	}
         1889  +
  1918   1890       break;
  1919   1891   
  1920   1892     case 40:
  1921   1893   
  1922   1894       {
  1923         -	    yyYear = (yyvsp[(1) - (2)].Number) / 10000;
  1924         -	    yyMonth = ((yyvsp[(1) - (2)].Number) % 10000)/100;
  1925         -	    yyDay = (yyvsp[(1) - (2)].Number) % 100;
  1926         -	    yyHour = (yyvsp[(2) - (2)].Number) / 10000;
  1927         -	    yyMinutes = ((yyvsp[(2) - (2)].Number) % 10000)/100;
  1928         -	    yySeconds = (yyvsp[(2) - (2)].Number) % 100;
  1929         -	;}
         1895  +	    yyYear = (yyvsp[-1].Number) / 10000;
         1896  +	    yyMonth = ((yyvsp[-1].Number) % 10000)/100;
         1897  +	    yyDay = (yyvsp[-1].Number) % 100;
         1898  +	    yyHour = (yyvsp[0].Number) / 10000;
         1899  +	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
         1900  +	    yySeconds = (yyvsp[0].Number) % 100;
         1901  +	}
         1902  +
  1930   1903       break;
  1931   1904   
  1932   1905     case 41:
  1933   1906   
  1934   1907       {
  1935   1908   	    /*
  1936   1909   	     * Offset computed year by -377 so that the returned years will be
  1937   1910   	     * in a range accessible with a 32 bit clock seconds value.
  1938   1911   	     */
  1939   1912   
  1940         -	    yyYear = (yyvsp[(2) - (4)].Number)/1000 + 2323 - 377;
         1913  +	    yyYear = (yyvsp[-2].Number)/1000 + 2323 - 377;
  1941   1914   	    yyDay  = 1;
  1942   1915   	    yyMonth = 1;
  1943         -	    yyRelDay += (((yyvsp[(2) - (4)].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
  1944         -	    yyRelSeconds += (yyvsp[(4) - (4)].Number) * 144 * 60;
  1945         -	;}
         1916  +	    yyRelDay += (((yyvsp[-2].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
         1917  +	    yyRelSeconds += (yyvsp[0].Number) * 144 * 60;
         1918  +	}
         1919  +
  1946   1920       break;
  1947   1921   
  1948   1922     case 42:
  1949   1923   
  1950   1924       {
  1951   1925   	    yyRelSeconds *= -1;
  1952   1926   	    yyRelMonth *= -1;
  1953   1927   	    yyRelDay *= -1;
  1954         -	;}
         1928  +	}
         1929  +
  1955   1930       break;
  1956   1931   
  1957   1932     case 44:
  1958   1933   
  1959   1934       {
  1960         -	    *yyRelPointer += (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
  1961         -	;}
         1935  +	    *yyRelPointer += (yyvsp[-2].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number);
         1936  +	}
         1937  +
  1962   1938       break;
  1963   1939   
  1964   1940     case 45:
  1965   1941   
  1966   1942       {
  1967         -	    *yyRelPointer += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
  1968         -	;}
         1943  +	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
         1944  +	}
         1945  +
  1969   1946       break;
  1970   1947   
  1971   1948     case 46:
  1972   1949   
  1973   1950       {
  1974         -	    *yyRelPointer += (yyvsp[(2) - (2)].Number);
  1975         -	;}
         1951  +	    *yyRelPointer += (yyvsp[0].Number);
         1952  +	}
         1953  +
  1976   1954       break;
  1977   1955   
  1978   1956     case 47:
  1979   1957   
  1980   1958       {
  1981         -	    *yyRelPointer += (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
  1982         -	;}
         1959  +	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
         1960  +	}
         1961  +
  1983   1962       break;
  1984   1963   
  1985   1964     case 48:
  1986   1965   
  1987   1966       {
  1988         -	    *yyRelPointer += (yyvsp[(1) - (1)].Number);
  1989         -	;}
         1967  +	    *yyRelPointer += (yyvsp[0].Number);
         1968  +	}
         1969  +
  1990   1970       break;
  1991   1971   
  1992   1972     case 49:
  1993   1973   
  1994   1974       {
  1995   1975   	    (yyval.Number) = -1;
  1996         -	;}
         1976  +	}
         1977  +
  1997   1978       break;
  1998   1979   
  1999   1980     case 50:
  2000   1981   
  2001   1982       {
  2002   1983   	    (yyval.Number) =  1;
  2003         -	;}
         1984  +	}
         1985  +
  2004   1986       break;
  2005   1987   
  2006   1988     case 51:
  2007   1989   
  2008   1990       {
  2009         -	    (yyval.Number) = (yyvsp[(1) - (1)].Number);
         1991  +	    (yyval.Number) = (yyvsp[0].Number);
  2010   1992   	    yyRelPointer = &yyRelSeconds;
  2011         -	;}
         1993  +	}
         1994  +
  2012   1995       break;
  2013   1996   
  2014   1997     case 52:
  2015   1998   
  2016   1999       {
  2017         -	    (yyval.Number) = (yyvsp[(1) - (1)].Number);
         2000  +	    (yyval.Number) = (yyvsp[0].Number);
  2018   2001   	    yyRelPointer = &yyRelDay;
  2019         -	;}
         2002  +	}
         2003  +
  2020   2004       break;
  2021   2005   
  2022   2006     case 53:
  2023   2007   
  2024   2008       {
  2025         -	    (yyval.Number) = (yyvsp[(1) - (1)].Number);
         2009  +	    (yyval.Number) = (yyvsp[0].Number);
  2026   2010   	    yyRelPointer = &yyRelMonth;
  2027         -	;}
         2011  +	}
         2012  +
  2028   2013       break;
  2029   2014   
  2030   2015     case 54:
  2031   2016   
  2032   2017       {
  2033   2018   	    if (yyHaveTime && yyHaveDate && !yyHaveRel) {
  2034         -		yyYear = (yyvsp[(1) - (1)].Number);
         2019  +		yyYear = (yyvsp[0].Number);
  2035   2020   	    } else {
  2036   2021   		yyHaveTime++;
  2037   2022   		if (yyDigitCount <= 2) {
  2038         -		    yyHour = (yyvsp[(1) - (1)].Number);
         2023  +		    yyHour = (yyvsp[0].Number);
  2039   2024   		    yyMinutes = 0;
  2040   2025   		} else {
  2041         -		    yyHour = (yyvsp[(1) - (1)].Number) / 100;
  2042         -		    yyMinutes = (yyvsp[(1) - (1)].Number) % 100;
         2026  +		    yyHour = (yyvsp[0].Number) / 100;
         2027  +		    yyMinutes = (yyvsp[0].Number) % 100;
  2043   2028   		}
  2044   2029   		yySeconds = 0;
  2045   2030   		yyMeridian = MER24;
  2046   2031   	    }
  2047         -	;}
         2032  +	}
         2033  +
  2048   2034       break;
  2049   2035   
  2050   2036     case 55:
  2051   2037   
  2052   2038       {
  2053   2039   	    (yyval.Meridian) = MER24;
  2054         -	;}
         2040  +	}
         2041  +
  2055   2042       break;
  2056   2043   
  2057   2044     case 56:
  2058   2045   
  2059   2046       {
  2060         -	    (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
  2061         -	;}
         2047  +	    (yyval.Meridian) = (yyvsp[0].Meridian);
         2048  +	}
         2049  +
  2062   2050       break;
  2063   2051   
  2064   2052   
  2065         -/* Line 1267 of yacc.c.  */
  2066   2053   
  2067   2054         default: break;
  2068   2055       }
         2056  +  /* User semantic actions sometimes alter yychar, and that requires
         2057  +     that yytoken be updated with the new translation.  We take the
         2058  +     approach of translating immediately before every use of yytoken.
         2059  +     One alternative is translating here after every semantic action,
         2060  +     but that translation would be missed if the semantic action invokes
         2061  +     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
         2062  +     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
         2063  +     incorrect destructor might then be invoked immediately.  In the
         2064  +     case of YYERROR or YYBACKUP, subsequent parser actions might lead
         2065  +     to an incorrect destructor call or verbose syntax error message
         2066  +     before the lookahead is translated.  */
  2069   2067     YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  2070   2068   
  2071   2069     YYPOPSTACK (yylen);
  2072   2070     yylen = 0;
  2073   2071     YY_STACK_PRINT (yyss, yyssp);
  2074   2072   
  2075   2073     *++yyvsp = yyval;
  2076   2074     *++yylsp = yyloc;
  2077   2075   
  2078         -  /* Now `shift' the result of the reduction.  Determine what state
         2076  +  /* Now 'shift' the result of the reduction.  Determine what state
  2079   2077        that goes to, based on the state we popped back to and the rule
  2080   2078        number reduced by.  */
  2081   2079   
  2082   2080     yyn = yyr1[yyn];
  2083   2081   
  2084   2082     yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  2085   2083     if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
................................................................................
  2086   2084       yystate = yytable[yystate];
  2087   2085     else
  2088   2086       yystate = yydefgoto[yyn - YYNTOKENS];
  2089   2087   
  2090   2088     goto yynewstate;
  2091   2089   
  2092   2090   
  2093         -/*------------------------------------.
  2094         -| yyerrlab -- here on detecting error |
  2095         -`------------------------------------*/
         2091  +/*--------------------------------------.
         2092  +| yyerrlab -- here on detecting error.  |
         2093  +`--------------------------------------*/
  2096   2094   yyerrlab:
         2095  +  /* Make sure we have latest lookahead translation.  See comments at
         2096  +     user semantic actions for why this is necessary.  */
         2097  +  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
         2098  +
  2097   2099     /* If not already recovering from an error, report this error.  */
  2098   2100     if (!yyerrstatus)
  2099   2101       {
  2100   2102         ++yynerrs;
  2101   2103   #if ! YYERROR_VERBOSE
  2102   2104         yyerror (&yylloc, info, YY_("syntax error"));
  2103   2105   #else
         2106  +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
         2107  +                                        yyssp, yytoken)
  2104   2108         {
  2105         -	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  2106         -	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
  2107         -	  {
  2108         -	    YYSIZE_T yyalloc = 2 * yysize;
  2109         -	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
  2110         -	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
  2111         -	    if (yymsg != yymsgbuf)
  2112         -	      YYSTACK_FREE (yymsg);
  2113         -	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
  2114         -	    if (yymsg)
  2115         -	      yymsg_alloc = yyalloc;
  2116         -	    else
  2117         -	      {
  2118         -		yymsg = yymsgbuf;
  2119         -		yymsg_alloc = sizeof yymsgbuf;
  2120         -	      }
  2121         -	  }
  2122         -
  2123         -	if (0 < yysize && yysize <= yymsg_alloc)
  2124         -	  {
  2125         -	    (void) yysyntax_error (yymsg, yystate, yychar);
  2126         -	    yyerror (&yylloc, info, yymsg);
  2127         -	  }
  2128         -	else
  2129         -	  {
  2130         -	    yyerror (&yylloc, info, YY_("syntax error"));
  2131         -	    if (yysize != 0)
  2132         -	      goto yyexhaustedlab;
  2133         -	  }
         2109  +        char const *yymsgp = YY_("syntax error");
         2110  +        int yysyntax_error_status;
         2111  +        yysyntax_error_status = YYSYNTAX_ERROR;
         2112  +        if (yysyntax_error_status == 0)
         2113  +          yymsgp = yymsg;
         2114  +        else if (yysyntax_error_status == 1)
         2115  +          {
         2116  +            if (yymsg != yymsgbuf)
         2117  +              YYSTACK_FREE (yymsg);
         2118  +            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
         2119  +            if (!yymsg)
         2120  +              {
         2121  +                yymsg = yymsgbuf;
         2122  +                yymsg_alloc = sizeof yymsgbuf;
         2123  +                yysyntax_error_status = 2;
         2124  +              }
         2125  +            else
         2126  +              {
         2127  +                yysyntax_error_status = YYSYNTAX_ERROR;
         2128  +                yymsgp = yymsg;
         2129  +              }
         2130  +          }
         2131  +        yyerror (&yylloc, info, yymsgp);
         2132  +        if (yysyntax_error_status == 2)
         2133  +          goto yyexhaustedlab;
  2134   2134         }
         2135  +# undef YYSYNTAX_ERROR
  2135   2136   #endif
  2136   2137       }
  2137   2138   
  2138         -  yyerror_range[0] = yylloc;
         2139  +  yyerror_range[1] = yylloc;
  2139   2140   
  2140   2141     if (yyerrstatus == 3)
  2141   2142       {
  2142         -      /* If just tried and failed to reuse look-ahead token after an
  2143         -	 error, discard it.  */
         2143  +      /* If just tried and failed to reuse lookahead token after an
         2144  +         error, discard it.  */
  2144   2145   
  2145   2146         if (yychar <= YYEOF)
  2146         -	{
  2147         -	  /* Return failure if at end of input.  */
  2148         -	  if (yychar == YYEOF)
  2149         -	    YYABORT;
  2150         -	}
         2147  +        {
         2148  +          /* Return failure if at end of input.  */
         2149  +          if (yychar == YYEOF)
         2150  +            YYABORT;
         2151  +        }
  2151   2152         else
  2152         -	{
  2153         -	  yydestruct ("Error: discarding",
  2154         -		      yytoken, &yylval, &yylloc, info);
  2155         -	  yychar = YYEMPTY;
  2156         -	}
         2153  +        {
         2154  +          yydestruct ("Error: discarding",
         2155  +                      yytoken, &yylval, &yylloc, info);
         2156  +          yychar = YYEMPTY;
         2157  +        }
  2157   2158       }
  2158   2159   
  2159         -  /* Else will try to reuse look-ahead token after shifting the error
         2160  +  /* Else will try to reuse lookahead token after shifting the error
  2160   2161        token.  */
  2161   2162     goto yyerrlab1;
  2162   2163   
  2163   2164   
  2164   2165   /*---------------------------------------------------.
  2165   2166   | yyerrorlab -- error raised explicitly by YYERROR.  |
  2166   2167   `---------------------------------------------------*/
................................................................................
  2168   2169   
  2169   2170     /* Pacify compilers like GCC when the user code never invokes
  2170   2171        YYERROR and the label yyerrorlab therefore never appears in user
  2171   2172        code.  */
  2172   2173     if (/*CONSTCOND*/ 0)
  2173   2174        goto yyerrorlab;
  2174   2175   
  2175         -  yyerror_range[0] = yylsp[1-yylen];
  2176         -  /* Do not reclaim the symbols of the rule which action triggered
         2176  +  /* Do not reclaim the symbols of the rule whose action triggered
  2177   2177        this YYERROR.  */
  2178   2178     YYPOPSTACK (yylen);
  2179   2179     yylen = 0;
  2180   2180     YY_STACK_PRINT (yyss, yyssp);
  2181   2181     yystate = *yyssp;
  2182   2182     goto yyerrlab1;
  2183   2183   
  2184   2184   
  2185   2185   /*-------------------------------------------------------------.
  2186   2186   | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  2187   2187   `-------------------------------------------------------------*/
  2188   2188   yyerrlab1:
  2189         -  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
         2189  +  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
  2190   2190   
  2191   2191     for (;;)
  2192   2192       {
  2193   2193         yyn = yypact[yystate];
  2194         -      if (yyn != YYPACT_NINF)
  2195         -	{
  2196         -	  yyn += YYTERROR;
  2197         -	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  2198         -	    {
  2199         -	      yyn = yytable[yyn];
  2200         -	      if (0 < yyn)
  2201         -		break;
  2202         -	    }
  2203         -	}
         2194  +      if (!yypact_value_is_default (yyn))
         2195  +        {
         2196  +          yyn += YYTERROR;
         2197  +          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
         2198  +            {
         2199  +              yyn = yytable[yyn];
         2200  +              if (0 < yyn)
         2201  +                break;
         2202  +            }
         2203  +        }
  2204   2204   
  2205   2205         /* Pop the current state because it cannot handle the error token.  */
  2206   2206         if (yyssp == yyss)
  2207         -	YYABORT;
         2207  +        YYABORT;
  2208   2208   
  2209         -      yyerror_range[0] = *yylsp;
         2209  +      yyerror_range[1] = *yylsp;
  2210   2210         yydestruct ("Error: popping",
  2211         -		  yystos[yystate], yyvsp, yylsp, info);
         2211  +                  yystos[yystate], yyvsp, yylsp, info);
  2212   2212         YYPOPSTACK (1);
  2213   2213         yystate = *yyssp;
  2214   2214         YY_STACK_PRINT (yyss, yyssp);
  2215   2215       }
  2216   2216   
  2217         -  if (yyn == YYFINAL)
  2218         -    YYACCEPT;
  2219         -
         2217  +  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2220   2218     *++yyvsp = yylval;
         2219  +  YY_IGNORE_MAYBE_UNINITIALIZED_END
  2221   2220   
  2222         -  yyerror_range[1] = yylloc;
         2221  +  yyerror_range[2] = yylloc;
  2223   2222     /* Using YYLLOC is tempting, but would change the location of
  2224         -     the look-ahead.  YYLOC is available though.  */
  2225         -  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
         2223  +     the lookahead.  YYLOC is available though.  */
         2224  +  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  2226   2225     *++yylsp = yyloc;
  2227   2226   
  2228   2227     /* Shift the error token.  */
  2229   2228     YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  2230   2229   
  2231   2230     yystate = yyn;
  2232   2231     goto yynewstate;
................................................................................
  2242   2241   /*-----------------------------------.
  2243   2242   | yyabortlab -- YYABORT comes here.  |
  2244   2243   `-----------------------------------*/
  2245   2244   yyabortlab:
  2246   2245     yyresult = 1;
  2247   2246     goto yyreturn;
  2248   2247   
  2249         -#ifndef yyoverflow
         2248  +#if !defined yyoverflow || YYERROR_VERBOSE
  2250   2249   /*-------------------------------------------------.
  2251   2250   | yyexhaustedlab -- memory exhaustion comes here.  |
  2252   2251   `-------------------------------------------------*/
  2253   2252   yyexhaustedlab:
  2254   2253     yyerror (&yylloc, info, YY_("memory exhausted"));
  2255   2254     yyresult = 2;
  2256   2255     /* Fall through.  */
  2257   2256   #endif
  2258   2257   
  2259   2258   yyreturn:
  2260         -  if (yychar != YYEOF && yychar != YYEMPTY)
  2261         -     yydestruct ("Cleanup: discarding lookahead",
  2262         -		 yytoken, &yylval, &yylloc, info);
  2263         -  /* Do not reclaim the symbols of the rule which action triggered
         2259  +  if (yychar != YYEMPTY)
         2260  +    {
         2261  +      /* Make sure we have latest lookahead translation.  See comments at
         2262  +         user semantic actions for why this is necessary.  */
         2263  +      yytoken = YYTRANSLATE (yychar);
         2264  +      yydestruct ("Cleanup: discarding lookahead",
         2265  +                  yytoken, &yylval, &yylloc, info);
         2266  +    }
         2267  +  /* Do not reclaim the symbols of the rule whose action triggered
  2264   2268        this YYABORT or YYACCEPT.  */
  2265   2269     YYPOPSTACK (yylen);
  2266   2270     YY_STACK_PRINT (yyss, yyssp);
  2267   2271     while (yyssp != yyss)
  2268   2272       {
  2269   2273         yydestruct ("Cleanup: popping",
  2270         -		  yystos[*yyssp], yyvsp, yylsp, info);
         2274  +                  yystos[*yyssp], yyvsp, yylsp, info);
  2271   2275         YYPOPSTACK (1);
  2272   2276       }
  2273   2277   #ifndef yyoverflow
  2274   2278     if (yyss != yyssa)
  2275   2279       YYSTACK_FREE (yyss);
  2276   2280   #endif
  2277   2281   #if YYERROR_VERBOSE
  2278   2282     if (yymsg != yymsgbuf)
  2279   2283       YYSTACK_FREE (yymsg);
  2280   2284   #endif
  2281         -  /* Make sure YYID is used.  */
  2282         -  return YYID (yyresult);
         2285  +  return yyresult;
  2283   2286   }
  2284         -
  2285         -
  2286   2287   
  2287   2288   
  2288   2289   /*
  2289   2290    * Month and day table.
  2290   2291    */
  2291   2292   
  2292   2293   static const TABLE MonthDayTable[] = {
................................................................................
  2676   2677       register char c;
  2677   2678       register char *p;
  2678   2679       char buff[20];
  2679   2680       int Count;
  2680   2681   
  2681   2682       location->first_column = yyInput - info->dateStart;
  2682   2683       for ( ; ; ) {
  2683         -	while (TclIsSpaceProc(*yyInput)) {
         2684  +	while (TclIsSpaceProc(UCHAR(*yyInput))) {
  2684   2685   	    yyInput++;
  2685   2686   	}
  2686   2687   
  2687   2688   	if (isdigit(UCHAR(c = *yyInput))) { /* INTL: digit */
  2688   2689   	    /*
  2689   2690   	     * Convert the string into a number; count the number of digits.
  2690   2691   	     */
................................................................................
  2907   2908   /*
  2908   2909    * Local Variables:
  2909   2910    * mode: c
  2910   2911    * c-basic-offset: 4
  2911   2912    * fill-column: 78
  2912   2913    * End:
  2913   2914    */
  2914         -

Changes to generic/tclDecls.h.

   115    115   /* 20 */
   116    116   EXTERN void		Tcl_DbIncrRefCount(Tcl_Obj *objPtr, const char *file,
   117    117   				int line);
   118    118   /* 21 */
   119    119   EXTERN int		Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file,
   120    120   				int line);
   121    121   /* 22 */
   122         -EXTERN Tcl_Obj *	Tcl_DbNewBooleanObj(int boolValue, const char *file,
          122  +TCL_DEPRECATED("No longer in use, changed to macro")
          123  +Tcl_Obj *		Tcl_DbNewBooleanObj(int boolValue, const char *file,
   123    124   				int line);
   124    125   /* 23 */
   125    126   EXTERN Tcl_Obj *	Tcl_DbNewByteArrayObj(const unsigned char *bytes,
   126    127   				int length, const char *file, int line);
   127    128   /* 24 */
   128    129   EXTERN Tcl_Obj *	Tcl_DbNewDoubleObj(double doubleValue,
   129    130   				const char *file, int line);
   130    131   /* 25 */
   131    132   EXTERN Tcl_Obj *	Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv,
   132    133   				const char *file, int line);
   133    134   /* 26 */
   134         -EXTERN Tcl_Obj *	Tcl_DbNewLongObj(long longValue, const char *file,
          135  +TCL_DEPRECATED("No longer in use, changed to macro")
          136  +Tcl_Obj *		Tcl_DbNewLongObj(long longValue, const char *file,
   135    137   				int line);
   136    138   /* 27 */
   137    139   EXTERN Tcl_Obj *	Tcl_DbNewObj(const char *file, int line);
   138    140   /* 28 */
   139    141   EXTERN Tcl_Obj *	Tcl_DbNewStringObj(const char *bytes, int length,
   140    142   				const char *file, int line);
   141    143   /* 29 */
................................................................................
   154    156   /* 34 */
   155    157   EXTERN int		Tcl_GetDouble(Tcl_Interp *interp, const char *src,
   156    158   				double *doublePtr);
   157    159   /* 35 */
   158    160   EXTERN int		Tcl_GetDoubleFromObj(Tcl_Interp *interp,
   159    161   				Tcl_Obj *objPtr, double *doublePtr);
   160    162   /* 36 */
   161         -EXTERN int		Tcl_GetIndexFromObj(Tcl_Interp *interp,
          163  +TCL_DEPRECATED("No longer in use, changed to macro")
          164  +int			Tcl_GetIndexFromObj(Tcl_Interp *interp,
   162    165   				Tcl_Obj *objPtr, const char *const *tablePtr,
   163    166   				const char *msg, int flags, int *indexPtr);
   164    167   /* 37 */
   165    168   EXTERN int		Tcl_GetInt(Tcl_Interp *interp, const char *src,
   166    169   				int *intPtr);
   167    170   /* 38 */
   168    171   EXTERN int		Tcl_GetIntFromObj(Tcl_Interp *interp,
................................................................................
   194    197   EXTERN int		Tcl_ListObjLength(Tcl_Interp *interp,
   195    198   				Tcl_Obj *listPtr, int *lengthPtr);
   196    199   /* 48 */
   197    200   EXTERN int		Tcl_ListObjReplace(Tcl_Interp *interp,
   198    201   				Tcl_Obj *listPtr, int first, int count,
   199    202   				int objc, Tcl_Obj *const objv[]);
   200    203   /* 49 */
   201         -EXTERN Tcl_Obj *	Tcl_NewBooleanObj(int boolValue);
          204  +TCL_DEPRECATED("No longer in use, changed to macro")
          205  +Tcl_Obj *		Tcl_NewBooleanObj(int boolValue);
   202    206   /* 50 */
   203    207   EXTERN Tcl_Obj *	Tcl_NewByteArrayObj(const unsigned char *bytes,
   204    208   				int length);
   205    209   /* 51 */
   206    210   EXTERN Tcl_Obj *	Tcl_NewDoubleObj(double doubleValue);
   207    211   /* 52 */
   208         -EXTERN Tcl_Obj *	Tcl_NewIntObj(int intValue);
          212  +TCL_DEPRECATED("No longer in use, changed to macro")
          213  +Tcl_Obj *		Tcl_NewIntObj(int intValue);
   209    214   /* 53 */
   210    215   EXTERN Tcl_Obj *	Tcl_NewListObj(int objc, Tcl_Obj *const objv[]);
   211    216   /* 54 */
   212         -EXTERN Tcl_Obj *	Tcl_NewLongObj(long longValue);
          217  +TCL_DEPRECATED("No longer in use, changed to macro")
          218  +Tcl_Obj *		Tcl_NewLongObj(long longValue);
   213    219   /* 55 */
   214    220   EXTERN Tcl_Obj *	Tcl_NewObj(void);
   215    221   /* 56 */
   216    222   EXTERN Tcl_Obj *	Tcl_NewStringObj(const char *bytes, int length);
   217    223   /* 57 */
   218         -EXTERN void		Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue);
          224  +TCL_DEPRECATED("No longer in use, changed to macro")
          225  +void			Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue);
   219    226   /* 58 */
   220    227   EXTERN unsigned char *	Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length);
   221    228   /* 59 */
   222    229   EXTERN void		Tcl_SetByteArrayObj(Tcl_Obj *objPtr,
   223    230   				const unsigned char *bytes, int length);
   224    231   /* 60 */
   225    232   EXTERN void		Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue);
   226    233   /* 61 */
   227         -EXTERN void		Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue);
          234  +TCL_DEPRECATED("No longer in use, changed to macro")
          235  +void			Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue);
   228    236   /* 62 */
   229    237   EXTERN void		Tcl_SetListObj(Tcl_Obj *objPtr, int objc,
   230    238   				Tcl_Obj *const objv[]);
   231    239   /* 63 */
   232         -EXTERN void		Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue);
          240  +TCL_DEPRECATED("No longer in use, changed to macro")
          241  +void			Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue);
   233    242   /* 64 */
   234    243   EXTERN void		Tcl_SetObjLength(Tcl_Obj *objPtr, int length);
   235    244   /* 65 */
   236    245   EXTERN void		Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes,
   237    246   				int length);
   238    247   /* 66 */
   239         -EXTERN void		Tcl_AddErrorInfo(Tcl_Interp *interp,
          248  +TCL_DEPRECATED("No longer in use, changed to macro")
          249  +void			Tcl_AddErrorInfo(Tcl_Interp *interp,
   240    250   				const char *message);
   241    251   /* 67 */
   242         -EXTERN void		Tcl_AddObjErrorInfo(Tcl_Interp *interp,
          252  +TCL_DEPRECATED("No longer in use, changed to macro")
          253  +void			Tcl_AddObjErrorInfo(Tcl_Interp *interp,
   243    254   				const char *message, int length);
   244    255   /* 68 */
   245    256   EXTERN void		Tcl_AllowExceptions(Tcl_Interp *interp);
   246    257   /* 69 */
   247    258   EXTERN void		Tcl_AppendElement(Tcl_Interp *interp,
   248    259   				const char *element);
   249    260   /* 70 */
................................................................................
   418    429   EXTERN const char *	Tcl_ErrnoMsg(int err);
   419    430   /* 129 */
   420    431   EXTERN int		Tcl_Eval(Tcl_Interp *interp, const char *script);
   421    432   /* 130 */
   422    433   EXTERN int		Tcl_EvalFile(Tcl_Interp *interp,
   423    434   				const char *fileName);
   424    435   /* 131 */
   425         -EXTERN int		Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr);
          436  +TCL_DEPRECATED("No longer in use, changed to macro")
          437  +int			Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr);
   426    438   /* 132 */
   427    439   EXTERN void		Tcl_EventuallyFree(ClientData clientData,
   428    440   				Tcl_FreeProc *freeProc);
   429    441   /* 133 */
   430    442   EXTERN TCL_NORETURN void Tcl_Exit(int status);
   431    443   /* 134 */
   432    444   EXTERN int		Tcl_ExposeCommand(Tcl_Interp *interp,
................................................................................
   545    557   EXTERN Tcl_Interp *	Tcl_GetSlave(Tcl_Interp *interp,
   546    558   				const char *slaveName);
   547    559   /* 173 */
   548    560   EXTERN Tcl_Channel	Tcl_GetStdChannel(int type);
   549    561   /* 174 */
   550    562   EXTERN const char *	Tcl_GetStringResult(Tcl_Interp *interp);
   551    563   /* 175 */
   552         -EXTERN const char *	Tcl_GetVar(Tcl_Interp *interp, const char *varName,
          564  +TCL_DEPRECATED("No longer in use, changed to macro")
          565  +const char *		Tcl_GetVar(Tcl_Interp *interp, const char *varName,
   553    566   				int flags);
   554    567   /* 176 */
   555    568   EXTERN const char *	Tcl_GetVar2(Tcl_Interp *interp, const char *part1,
   556    569   				const char *part2, int flags);
   557    570   /* 177 */
   558    571   EXTERN int		Tcl_GlobalEval(Tcl_Interp *interp,
   559    572   				const char *command);
   560    573   /* 178 */
   561         -EXTERN int		Tcl_GlobalEvalObj(Tcl_Interp *interp,
          574  +TCL_DEPRECATED("No longer in use, changed to macro")
          575  +int			Tcl_GlobalEvalObj(Tcl_Interp *interp,
   562    576   				Tcl_Obj *objPtr);
   563    577   /* 179 */
   564    578   EXTERN int		Tcl_HideCommand(Tcl_Interp *interp,
   565    579   				const char *cmdName,
   566    580   				const char *hiddenCmdToken);
   567    581   /* 180 */
   568    582   EXTERN int		Tcl_Init(Tcl_Interp *interp);
................................................................................
   709    723   				Tcl_Obj *errorObjPtr);
   710    724   /* 235 */
   711    725   EXTERN void		Tcl_SetObjResult(Tcl_Interp *interp,
   712    726   				Tcl_Obj *resultObjPtr);
   713    727   /* 236 */
   714    728   EXTERN void		Tcl_SetStdChannel(Tcl_Channel channel, int type);
   715    729   /* 237 */
   716         -EXTERN const char *	Tcl_SetVar(Tcl_Interp *interp, const char *varName,
          730  +TCL_DEPRECATED("No longer in use, changed to macro")
          731  +const char *		Tcl_SetVar(Tcl_Interp *interp, const char *varName,
   717    732   				const char *newValue, int flags);
   718    733   /* 238 */
   719    734   EXTERN const char *	Tcl_SetVar2(Tcl_Interp *interp, const char *part1,
   720    735   				const char *part2, const char *newValue,
   721    736   				int flags);
   722    737   /* 239 */
   723    738   EXTERN const char *	Tcl_SignalId(int sig);
................................................................................
   739    754   				Tcl_PackageInitProc *safeInitProc);
   740    755   /* 245 */
   741    756   EXTERN int		Tcl_StringMatch(const char *str, const char *pattern);
   742    757   /* 246 */
   743    758   TCL_DEPRECATED("")
   744    759   int			Tcl_TellOld(Tcl_Channel chan);
   745    760   /* 247 */
   746         -EXTERN int		Tcl_TraceVar(Tcl_Interp *interp, const char *varName,
          761  +TCL_DEPRECATED("No longer in use, changed to macro")
          762  +int			Tcl_TraceVar(Tcl_Interp *interp, const char *varName,
   747    763   				int flags, Tcl_VarTraceProc *proc,
   748    764   				ClientData clientData);
   749    765   /* 248 */
   750    766   EXTERN int		Tcl_TraceVar2(Tcl_Interp *interp, const char *part1,
   751    767   				const char *part2, int flags,
   752    768   				Tcl_VarTraceProc *proc,
   753    769   				ClientData clientData);
................................................................................
   760    776   /* 251 */
   761    777   EXTERN void		Tcl_UnlinkVar(Tcl_Interp *interp,
   762    778   				const char *varName);
   763    779   /* 252 */
   764    780   EXTERN int		Tcl_UnregisterChannel(Tcl_Interp *interp,
   765    781   				Tcl_Channel chan);
   766    782   /* 253 */
   767         -EXTERN int		Tcl_UnsetVar(Tcl_Interp *interp, const char *varName,
          783  +TCL_DEPRECATED("No longer in use, changed to macro")
          784  +int			Tcl_UnsetVar(Tcl_Interp *interp, const char *varName,
   768    785   				int flags);
   769    786   /* 254 */
   770    787   EXTERN int		Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1,
   771    788   				const char *part2, int flags);
   772    789   /* 255 */
   773         -EXTERN void		Tcl_UntraceVar(Tcl_Interp *interp,
          790  +TCL_DEPRECATED("No longer in use, changed to macro")
          791  +void			Tcl_UntraceVar(Tcl_Interp *interp,
   774    792   				const char *varName, int flags,
   775    793   				Tcl_VarTraceProc *proc,
   776    794   				ClientData clientData);
   777    795   /* 256 */
   778    796   EXTERN void		Tcl_UntraceVar2(Tcl_Interp *interp,
   779    797   				const char *part1, const char *part2,
   780    798   				int flags, Tcl_VarTraceProc *proc,
   781    799   				ClientData clientData);
   782    800   /* 257 */
   783    801   EXTERN void		Tcl_UpdateLinkedVar(Tcl_Interp *interp,
   784    802   				const char *varName);
   785    803   /* 258 */
   786         -EXTERN int		Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
          804  +TCL_DEPRECATED("No longer in use, changed to macro")
          805  +int			Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
   787    806   				const char *varName, const char *localName,
   788    807   				int flags);
   789    808   /* 259 */
   790    809   EXTERN int		Tcl_UpVar2(Tcl_Interp *interp, const char *frameName,
   791    810   				const char *part1, const char *part2,
   792    811   				const char *localName, int flags);
   793    812   /* 260 */
   794    813   EXTERN int		Tcl_VarEval(Tcl_Interp *interp, ...);
   795    814   /* 261 */
   796         -EXTERN ClientData	Tcl_VarTraceInfo(Tcl_Interp *interp,
          815  +TCL_DEPRECATED("No longer in use, changed to macro")
          816  +ClientData		Tcl_VarTraceInfo(Tcl_Interp *interp,
   797    817   				const char *varName, int flags,
   798    818   				Tcl_VarTraceProc *procPtr,
   799    819   				ClientData prevClientData);
   800    820   /* 262 */
   801    821   EXTERN ClientData	Tcl_VarTraceInfo2(Tcl_Interp *interp,
   802    822   				const char *part1, const char *part2,
   803    823   				int flags, Tcl_VarTraceProc *procPtr,
................................................................................
   821    841   				va_list argList);
   822    842   /* 269 */
   823    843   EXTERN char *		Tcl_HashStats(Tcl_HashTable *tablePtr);
   824    844   /* 270 */
   825    845   EXTERN const char *	Tcl_ParseVar(Tcl_Interp *interp, const char *start,
   826    846   				const char **termPtr);
   827    847   /* 271 */
   828         -EXTERN const char *	Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
          848  +TCL_DEPRECATED("No longer in use, changed to macro")
          849  +const char *		Tcl_PkgPresent(Tcl_Interp *interp, const char *name,
   829    850   				const char *version, int exact);
   830    851   /* 272 */
   831    852   EXTERN const char *	Tcl_PkgPresentEx(Tcl_Interp *interp,
   832    853   				const char *name, const char *version,
   833    854   				int exact, void *clientDataPtr);
   834    855   /* 273 */
   835         -EXTERN int		Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
          856  +TCL_DEPRECATED("No longer in use, changed to macro")
          857  +int			Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
   836    858   				const char *version);
   837    859   /* 274 */
   838         -EXTERN const char *	Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
          860  +TCL_DEPRECATED("No longer in use, changed to macro")
          861  +const char *		Tcl_PkgRequire(Tcl_Interp *interp, const char *name,
   839    862   				const char *version, int exact);
   840    863   /* 275 */
   841    864   TCL_DEPRECATED("see TIP #422")
   842    865   void			Tcl_SetErrorCodeVA(Tcl_Interp *interp,
   843    866   				va_list argList);
   844    867   /* 276 */
   845    868   TCL_DEPRECATED("see TIP #422")
................................................................................
  1121   1144   EXTERN void		Tcl_SetUnicodeObj(Tcl_Obj *objPtr,
  1122   1145   				const Tcl_UniChar *unicode, int numChars);
  1123   1146   /* 380 */
  1124   1147   EXTERN int		Tcl_GetCharLength(Tcl_Obj *objPtr);
  1125   1148   /* 381 */
  1126   1149   EXTERN int		Tcl_GetUniChar(Tcl_Obj *objPtr, int index);
  1127   1150   /* 382 */
  1128         -EXTERN Tcl_UniChar *	Tcl_GetUnicode(Tcl_Obj *objPtr);
         1151  +TCL_DEPRECATED("No longer in use, changed to macro")
         1152  +Tcl_UniChar *		Tcl_GetUnicode(Tcl_Obj *objPtr);
  1129   1153   /* 383 */
  1130   1154   EXTERN Tcl_Obj *	Tcl_GetRange(Tcl_Obj *objPtr, int first, int last);
  1131   1155   /* 384 */
  1132   1156   EXTERN void		Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
  1133   1157   				const Tcl_UniChar *unicode, int length);
  1134   1158   /* 385 */
  1135   1159   EXTERN int		Tcl_RegExpMatchObj(Tcl_Interp *interp,
................................................................................
  1834   1858   				Tcl_Obj *compressionDictionaryObj);
  1835   1859   /* 631 */
  1836   1860   EXTERN Tcl_Channel	Tcl_OpenTcpServerEx(Tcl_Interp *interp,
  1837   1861   				const char *service, const char *host,
  1838   1862   				unsigned int flags,
  1839   1863   				Tcl_TcpAcceptProc *acceptProc,
  1840   1864   				ClientData callbackData);
         1865  +/* 632 */
         1866  +EXTERN int		TclZipfs_Mount(Tcl_Interp *interp,
         1867  +				const char *mountPoint, const char *zipname,
         1868  +				const char *passwd);
         1869  +/* 633 */
         1870  +EXTERN int		TclZipfs_Unmount(Tcl_Interp *interp,
         1871  +				const char *mountPoint);
         1872  +/* 634 */
         1873  +EXTERN Tcl_Obj *	TclZipfs_TclLibrary(void);
         1874  +/* 635 */
         1875  +EXTERN int		TclZipfs_MountBuffer(Tcl_Interp *interp,
         1876  +				const char *mountPoint, unsigned char *data,
         1877  +				size_t datalen, int copy);
  1841   1878   
  1842   1879   typedef struct {
  1843   1880       const struct TclPlatStubs *tclPlatStubs;
  1844   1881       const struct TclIntStubs *tclIntStubs;
  1845   1882       const struct TclIntPlatStubs *tclIntPlatStubs;
  1846   1883   } TclStubHooks;
  1847   1884   
................................................................................
  1883   1920       void (*tcl_AppendStringsToObj) (Tcl_Obj *objPtr, ...); /* 15 */
  1884   1921       void (*tcl_AppendToObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 16 */
  1885   1922       Tcl_Obj * (*tcl_ConcatObj) (int objc, Tcl_Obj *const objv[]); /* 17 */
  1886   1923       int (*tcl_ConvertToType) (Tcl_Interp *interp, Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 18 */
  1887   1924       void (*tcl_DbDecrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 19 */
  1888   1925       void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */
  1889   1926       int (*tcl_DbIsShared) (Tcl_Obj *objPtr, const char *file, int line); /* 21 */
  1890         -    Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */
         1927  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */
  1891   1928       Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int length, const char *file, int line); /* 23 */
  1892   1929       Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */
  1893   1930       Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */
  1894         -    Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */
         1931  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */
  1895   1932       Tcl_Obj * (*tcl_DbNewObj) (const char *file, int line); /* 27 */
  1896   1933       Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, int length, const char *file, int line); /* 28 */
  1897   1934       Tcl_Obj * (*tcl_DuplicateObj) (Tcl_Obj *objPtr); /* 29 */
  1898   1935       void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */
  1899   1936       int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */
  1900   1937       int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */
  1901   1938       unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */
  1902   1939       int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */
  1903   1940       int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */
  1904         -    int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */
         1941  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */
  1905   1942       int (*tcl_GetInt) (Tcl_Interp *interp, const char *src, int *intPtr); /* 37 */
  1906   1943       int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */
  1907   1944       int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */
  1908   1945       CONST86 Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */
  1909   1946       char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */
  1910   1947       void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */
  1911   1948       int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */
  1912   1949       int (*tcl_ListObjAppendElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 44 */
  1913   1950       int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 45 */
  1914   1951       int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj **objPtrPtr); /* 46 */
  1915   1952       int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */
  1916   1953       int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */
  1917         -    Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */
         1954  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */
  1918   1955       Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int length); /* 50 */
  1919   1956       Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */
  1920         -    Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */
         1957  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */
  1921   1958       Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */
  1922         -    Tcl_Obj * (*tcl_NewLongObj) (long longValue); /* 54 */
         1959  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewLongObj) (long longValue); /* 54 */
  1923   1960       Tcl_Obj * (*tcl_NewObj) (void); /* 55 */
  1924   1961       Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, int length); /* 56 */
  1925         -    void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */
         1962  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */
  1926   1963       unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int length); /* 58 */
  1927   1964       void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int length); /* 59 */
  1928   1965       void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */
  1929         -    void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */
         1966  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */
  1930   1967       void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */
  1931         -    void (*tcl_SetLongObj) (Tcl_Obj *objPtr, long longValue); /* 63 */
         1968  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetLongObj) (Tcl_Obj *objPtr, long longValue); /* 63 */
  1932   1969       void (*tcl_SetObjLength) (Tcl_Obj *objPtr, int length); /* 64 */
  1933   1970       void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 65 */
  1934         -    void (*tcl_AddErrorInfo) (Tcl_Interp *interp, const char *message); /* 66 */
  1935         -    void (*tcl_AddObjErrorInfo) (Tcl_Interp *interp, const char *message, int length); /* 67 */
         1971  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_AddErrorInfo) (Tcl_Interp *interp, const char *message); /* 66 */
         1972  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_AddObjErrorInfo) (Tcl_Interp *interp, const char *message, int length); /* 67 */
  1936   1973       void (*tcl_AllowExceptions) (Tcl_Interp *interp); /* 68 */
  1937   1974       void (*tcl_AppendElement) (Tcl_Interp *interp, const char *element); /* 69 */
  1938   1975       void (*tcl_AppendResult) (Tcl_Interp *interp, ...); /* 70 */
  1939   1976       Tcl_AsyncHandler (*tcl_AsyncCreate) (Tcl_AsyncProc *proc, ClientData clientData); /* 71 */
  1940   1977       void (*tcl_AsyncDelete) (Tcl_AsyncHandler async); /* 72 */
  1941   1978       int (*tcl_AsyncInvoke) (Tcl_Interp *interp, int code); /* 73 */
  1942   1979       void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */
................................................................................
  1992   2029       void (*tcl_DStringSetLength) (Tcl_DString *dsPtr, int length); /* 124 */
  1993   2030       void (*tcl_DStringStartSublist) (Tcl_DString *dsPtr); /* 125 */
  1994   2031       int (*tcl_Eof) (Tcl_Channel chan); /* 126 */
  1995   2032       const char * (*tcl_ErrnoId) (void); /* 127 */
  1996   2033       const char * (*tcl_ErrnoMsg) (int err); /* 128 */
  1997   2034       int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */
  1998   2035       int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */
  1999         -    int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */
         2036  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */
  2000   2037       void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */
  2001   2038       TCL_NORETURN1 void (*tcl_Exit) (int status); /* 133 */
  2002   2039       int (*tcl_ExposeCommand) (Tcl_Interp *interp, const char *hiddenCmdToken, const char *cmdName); /* 134 */
  2003   2040       int (*tcl_ExprBoolean) (Tcl_Interp *interp, const char *expr, int *ptr); /* 135 */
  2004   2041       int (*tcl_ExprBooleanObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *ptr); /* 136 */
  2005   2042       int (*tcl_ExprDouble) (Tcl_Interp *interp, const char *expr, double *ptr); /* 137 */
  2006   2043       int (*tcl_ExprDoubleObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *ptr); /* 138 */
................................................................................
  2044   2081       Tcl_PathType (*tcl_GetPathType) (const char *path); /* 168 */
  2045   2082       int (*tcl_Gets) (Tcl_Channel chan, Tcl_DString *dsPtr); /* 169 */
  2046   2083       int (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 170 */
  2047   2084       int (*tcl_GetServiceMode) (void); /* 171 */
  2048   2085       Tcl_Interp * (*tcl_GetSlave) (Tcl_Interp *interp, const char *slaveName); /* 172 */
  2049   2086       Tcl_Channel (*tcl_GetStdChannel) (int type); /* 173 */
  2050   2087       const char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */
  2051         -    const char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */
         2088  +    TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */
  2052   2089       const char * (*tcl_GetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 176 */
  2053   2090       int (*tcl_GlobalEval) (Tcl_Interp *interp, const char *command); /* 177 */
  2054         -    int (*tcl_GlobalEvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 178 */
         2091  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GlobalEvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 178 */
  2055   2092       int (*tcl_HideCommand) (Tcl_Interp *interp, const char *cmdName, const char *hiddenCmdToken); /* 179 */
  2056   2093       int (*tcl_Init) (Tcl_Interp *interp); /* 180 */
  2057   2094       void (*tcl_InitHashTable) (Tcl_HashTable *tablePtr, int keyType); /* 181 */
  2058   2095       int (*tcl_InputBlocked) (Tcl_Channel chan); /* 182 */
  2059   2096       int (*tcl_InputBuffered) (Tcl_Channel chan); /* 183 */
  2060   2097       int (*tcl_InterpDeleted) (Tcl_Interp *interp); /* 184 */
  2061   2098       int (*tcl_IsSafe) (Tcl_Interp *interp); /* 185 */
................................................................................
  2106   2143       void (*tcl_SetPanicProc) (TCL_NORETURN1 Tcl_PanicProc *panicProc); /* 230 */
  2107   2144       int (*tcl_SetRecursionLimit) (Tcl_Interp *interp, int depth); /* 231 */
  2108   2145       void (*tcl_SetResult) (Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc); /* 232 */
  2109   2146       int (*tcl_SetServiceMode) (int mode); /* 233 */
  2110   2147       void (*tcl_SetObjErrorCode) (Tcl_Interp *interp, Tcl_Obj *errorObjPtr); /* 234 */
  2111   2148       void (*tcl_SetObjResult) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr); /* 235 */
  2112   2149       void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */
  2113         -    const char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */
         2150  +    TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */
  2114   2151       const char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */
  2115   2152       const char * (*tcl_SignalId) (int sig); /* 239 */
  2116   2153       const char * (*tcl_SignalMsg) (int sig); /* 240 */
  2117   2154       void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */
  2118   2155       int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */
  2119   2156       void (*tcl_SplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */
  2120   2157       void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */
  2121   2158       int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */
  2122   2159       TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */
  2123         -    int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */
         2160  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */
  2124   2161       int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */
  2125   2162       char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */
  2126   2163       int (*tcl_Ungets) (Tcl_Channel chan, const char *str, int len, int atHead); /* 250 */
  2127   2164       void (*tcl_UnlinkVar) (Tcl_Interp *interp, const char *varName); /* 251 */
  2128   2165       int (*tcl_UnregisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 252 */
  2129         -    int (*tcl_UnsetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 253 */
         2166  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_UnsetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 253 */
  2130   2167       int (*tcl_UnsetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 254 */
  2131         -    void (*tcl_UntraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 255 */
         2168  +    TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_UntraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 255 */
  2132   2169       void (*tcl_UntraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 256 */
  2133   2170       void (*tcl_UpdateLinkedVar) (Tcl_Interp *interp, const char *varName); /* 257 */
  2134         -    int (*tcl_UpVar) (Tcl_Interp *interp, const char *frameName, const char *varName, const char *localName, int flags); /* 258 */
         2171  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_UpVar) (Tcl_Interp *interp, const char *frameName, const char *varName, const char *localName, int flags); /* 258 */
  2135   2172       int (*tcl_UpVar2) (Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags); /* 259 */
  2136   2173       int (*tcl_VarEval) (Tcl_Interp *interp, ...); /* 260 */
  2137         -    ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */
         2174  +    TCL_DEPRECATED_API("No longer in use, changed to macro") ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */
  2138   2175       ClientData (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 262 */
  2139   2176       int (*tcl_Write) (Tcl_Channel chan, const char *s, int slen); /* 263 */
  2140   2177       void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */
  2141   2178       int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */
  2142   2179       void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */
  2143   2180       TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */
  2144   2181       TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */
  2145   2182       char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */
  2146   2183       const char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, const char **termPtr); /* 270 */
  2147         -    const char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */
         2184  +    TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */
  2148   2185       const char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */
  2149         -    int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */
  2150         -    const char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */
         2186  +    TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */
         2187  +    TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */
  2151   2188       TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
  2152   2189       TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */
  2153   2190       Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */
  2154   2191       TCL_DEPRECATED_API("see TIP #422") TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */
  2155   2192       void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */
  2156   2193       void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */
  2157   2194       Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */
................................................................................
  2251   2288       int (*tcl_UniCharIsPunct) (int ch); /* 375 */
  2252   2289       int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 376 */
  2253   2290       void (*tcl_RegExpGetInfo) (Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 377 */
  2254   2291       Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */
  2255   2292       void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */
  2256   2293       int (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */
  2257   2294       int (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */
  2258         -    Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */
         2295  +    TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */
  2259   2296       Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */
  2260   2297       void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
  2261   2298       int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */
  2262   2299       void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */
  2263   2300       Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */
  2264   2301       int (*tcl_GetChannelNames) (Tcl_Interp *interp); /* 388 */
  2265   2302       int (*tcl_GetChannelNamesEx) (Tcl_Interp *interp, const char *pattern); /* 389 */
................................................................................
  2501   2538       int (*tcl_NRExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *resultPtr); /* 625 */
  2502   2539       int (*tcl_NRSubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 626 */
  2503   2540       int (*tcl_LoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *const symv[], int flags, void *procPtrs, Tcl_LoadHandle *handlePtr); /* 627 */
  2504   2541       void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
  2505   2542       int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
  2506   2543       void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */
  2507   2544       Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */
         2545  +    int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *mountPoint, const char *zipname, const char *passwd); /* 632 */
         2546  +    int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *mountPoint); /* 633 */
         2547  +    Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */
         2548  +    int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const char *mountPoint, unsigned char *data, size_t datalen, int copy); /* 635 */
  2508   2549   } TclStubs;
  2509   2550   
  2510   2551   extern const TclStubs *tclStubsPtr;
  2511   2552   
  2512   2553   #ifdef __cplusplus
  2513   2554   }
  2514   2555   #endif
................................................................................
  3795   3836   	(tclStubsPtr->tcl_FindSymbol) /* 628 */
  3796   3837   #define Tcl_FSUnloadFile \
  3797   3838   	(tclStubsPtr->tcl_FSUnloadFile) /* 629 */
  3798   3839   #define Tcl_ZlibStreamSetCompressionDictionary \
  3799   3840   	(tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */
  3800   3841   #define Tcl_OpenTcpServerEx \
  3801   3842   	(tclStubsPtr->tcl_OpenTcpServerEx) /* 631 */
         3843  +#define TclZipfs_Mount \
         3844  +	(tclStubsPtr->tclZipfs_Mount) /* 632 */
         3845  +#define TclZipfs_Unmount \
         3846  +	(tclStubsPtr->tclZipfs_Unmount) /* 633 */
         3847  +#define TclZipfs_TclLibrary \
         3848  +	(tclStubsPtr->tclZipfs_TclLibrary) /* 634 */
         3849  +#define TclZipfs_MountBuffer \
         3850  +	(tclStubsPtr->tclZipfs_MountBuffer) /* 635 */
  3802   3851   
  3803   3852   #endif /* defined(USE_TCL_STUBS) */
  3804   3853   
  3805   3854   /* !END!: Do not edit above this line. */
  3806   3855   
  3807   3856   #if defined(USE_TCL_STUBS)
  3808   3857   #   undef Tcl_CreateInterp
  3809   3858   #   undef Tcl_FindExecutable
  3810   3859   #   undef Tcl_GetStringResult
  3811   3860   #   undef Tcl_Init
  3812   3861   #   undef Tcl_SetPanicProc
  3813         -#   undef Tcl_SetVar
  3814   3862   #   undef Tcl_ObjSetVar2
  3815   3863   #   undef Tcl_StaticPackage
  3816   3864   #   define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp())
  3817   3865   #   define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp))
  3818   3866   #   define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp))
  3819   3867   #   define Tcl_SetPanicProc(proc) (tclStubsPtr->tcl_SetPanicProc(proc))
  3820         -#   define Tcl_SetVar(interp, varName, newValue, flags) \
  3821         -	    (tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags))
  3822   3868   #   define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \
  3823   3869   	    (tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags))
  3824   3870   #endif
  3825   3871   
  3826   3872   #if defined(_WIN32) && defined(UNICODE)
  3827   3873   #   define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
  3828   3874   #   define Tcl_MainEx Tcl_MainExW
  3829   3875       EXTERN void Tcl_MainExW(int argc, wchar_t **argv,
  3830   3876   	    Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
         3877  +    EXTERN int		TclZipfs_AppHook(int *argc, wchar_t ***argv);
  3831   3878   #endif
  3832   3879   
  3833   3880   #undef TCL_STORAGE_CLASS
  3834   3881   #define TCL_STORAGE_CLASS DLLIMPORT
  3835   3882   
  3836   3883   #undef Tcl_SeekOld
  3837   3884   #undef Tcl_TellOld
................................................................................
  3970   4017   #undef Tcl_NewLongObj
  3971   4018   #define Tcl_NewLongObj(value) Tcl_NewWideIntObj((long)(value))
  3972   4019   #undef Tcl_NewIntObj
  3973   4020   #define Tcl_NewIntObj(value) Tcl_NewWideIntObj((int)(value))
  3974   4021   #undef Tcl_DbNewLongObj
  3975   4022   #define Tcl_DbNewLongObj(value, file, line) Tcl_DbNewWideIntObj((long)(value), file, line)
  3976   4023   #undef Tcl_SetIntObj
  3977         -#define Tcl_SetIntObj(objPtr, value)	Tcl_SetWideIntObj(objPtr, (int)(value))
         4024  +#define Tcl_SetIntObj(objPtr, value)	Tcl_SetWideIntObj((objPtr), (int)(value))
  3978   4025   #undef Tcl_SetLongObj
  3979         -#define Tcl_SetLongObj(objPtr, value)	Tcl_SetWideIntObj(objPtr, (long)(value))
         4026  +#define Tcl_SetLongObj(objPtr, value)	Tcl_SetWideIntObj((objPtr), (long)(value))
         4027  +#undef Tcl_GetUnicode
         4028  +#define Tcl_GetUnicode(objPtr)	Tcl_GetUnicodeFromObj((objPtr), NULL)
  3980   4029   
  3981   4030   /*
  3982   4031    * Deprecated Tcl procedures:
  3983   4032    */
  3984   4033   
  3985   4034   #undef Tcl_EvalObj
  3986   4035   #define Tcl_EvalObj(interp, objPtr) \
  3987   4036       Tcl_EvalObjEx(interp, objPtr, 0)
  3988   4037   #undef Tcl_GlobalEvalObj
  3989   4038   #define Tcl_GlobalEvalObj(interp, objPtr) \
  3990   4039       Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
  3991   4040   
  3992   4041   #endif /* _TCLDECLS */

Changes to generic/tclDictObj.c.

   149    149   } Dict;
   150    150   
   151    151   /*
   152    152    * Accessor macro for converting between a Tcl_Obj* and a Dict. Note that this
   153    153    * must be assignable as well as readable.
   154    154    */
   155    155   
   156         -#define DICT(dictObj)   (*((Dict **)&(dictObj)->internalRep.twoPtrValue.ptr1))
          156  +#define DICT(dictObj)   ((dictObj)->internalRep.twoPtrValue.ptr1)
   157    157   
   158    158   /*
   159    159    * The structure below defines the dictionary object type by means of
   160    160    * functions that can be invoked by generic object code.
   161    161    */
   162    162   
   163    163   const Tcl_ObjType tclDictType = {

Changes to generic/tclDisassemble.c.

   890    890   	    continue;
   891    891   	default:
   892    892   #if TCL_UTF_MAX > 4
   893    893   	    if (ch > 0xffff) {
   894    894   		Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
   895    895   		i += 10;
   896    896   	    } else
   897         -#elif TCL_UTF_MAX > 3
          897  +#else
   898    898   	    /* If len == 0, this means we have a char > 0xffff, resulting in
   899    899   	     * TclUtfToUniChar producing a surrogate pair. We want to output
   900    900   	     * this pair as a single Unicode character.
   901    901   	     */
   902    902   	    if (len == 0) {
   903    903   		int upper = ((ch & 0x3ff) + 1) << 10;
   904    904   		len = TclUtfToUniChar(p, &ch);

Changes to generic/tclEncoding.c.

  2054   2054       dataPtr->initLen = strlen(init);
  2055   2055       memcpy(dataPtr->init, init, (unsigned) dataPtr->initLen + 1);
  2056   2056       dataPtr->finalLen = strlen(final);
  2057   2057       memcpy(dataPtr->final, final, (unsigned) dataPtr->finalLen + 1);
  2058   2058       dataPtr->numSubTables =
  2059   2059   	    Tcl_DStringLength(&escapeData) / sizeof(EscapeSubTable);
  2060   2060       memcpy(dataPtr->subTables, Tcl_DStringValue(&escapeData),
  2061         -	    (size_t) Tcl_DStringLength(&escapeData));
         2061  +	    Tcl_DStringLength(&escapeData));
  2062   2062       Tcl_DStringFree(&escapeData);
  2063   2063   
  2064   2064       memset(dataPtr->prefixBytes, 0, sizeof(dataPtr->prefixBytes));
  2065   2065       for (i = 0; i < dataPtr->numSubTables; i++) {
  2066   2066   	dataPtr->prefixBytes[UCHAR(dataPtr->subTables[i].sequence[0])] = 1;
  2067   2067       }
  2068   2068       if (dataPtr->init[0] != '\0') {

Changes to generic/tclEnsemble.c.

    17     17    * Declarations for functions local to this file:
    18     18    */
    19     19   
    20     20   static inline Tcl_Obj *	NewNsObj(Tcl_Namespace *namespacePtr);
    21     21   static inline int	EnsembleUnknownCallback(Tcl_Interp *interp,
    22     22   			    EnsembleConfig *ensemblePtr, int objc,
    23     23   			    Tcl_Obj *const objv[], Tcl_Obj **prefixObjPtr);
    24         -static int		NsEnsembleImplementationCmd(ClientData clientData,
    25         -			    Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
    26     24   static int		NsEnsembleImplementationCmdNR(ClientData clientData,
    27     25   			    Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
    28     26   static void		BuildEnsembleConfig(EnsembleConfig *ensemblePtr);
    29     27   static int		NsEnsembleStringOrder(const void *strPtr1,
    30     28   			    const void *strPtr2);
    31     29   static void		DeleteEnsembleConfig(ClientData clientData);
    32     30   static void		MakeCachedEnsembleCommand(Tcl_Obj *objPtr,
................................................................................
   660    658   {
   661    659       Namespace *nsPtr = (Namespace *) ensembleNsPtr;
   662    660       EnsembleConfig *ensemblePtr;
   663    661       Tcl_Command token;
   664    662   
   665    663       ensemblePtr = ckalloc(sizeof(EnsembleConfig));
   666    664       token = TclNRCreateCommandInNs(interp, name,
   667         -	    (Tcl_Namespace *) nameNsPtr, NsEnsembleImplementationCmd,
          665  +	    (Tcl_Namespace *) nameNsPtr, TclEnsembleImplementationCmd,
   668    666   	    NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig);
   669    667       if (token == NULL) {
   670    668   	ckfree(ensemblePtr);
   671    669   	return NULL;
   672    670       }
   673    671   
   674    672       ensemblePtr->nsPtr = nsPtr;
................................................................................
   764    762       Tcl_Command token,
   765    763       Tcl_Obj *subcmdList)
   766    764   {
   767    765       Command *cmdPtr = (Command *) token;
   768    766       EnsembleConfig *ensemblePtr;
   769    767       Tcl_Obj *oldList;
   770    768   
   771         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
          769  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
   772    770   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
   773    771   		"command is not an ensemble", -1));
   774    772   	Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
   775    773   	return TCL_ERROR;
   776    774       }
   777    775       if (subcmdList != NULL) {
   778    776   	int length;
................................................................................
   840    838       Tcl_Obj *paramList)
   841    839   {
   842    840       Command *cmdPtr = (Command *) token;
   843    841       EnsembleConfig *ensemblePtr;
   844    842       Tcl_Obj *oldList;
   845    843       int length;
   846    844   
   847         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
          845  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
   848    846   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
   849    847   		"command is not an ensemble", -1));
   850    848   	Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
   851    849   	return TCL_ERROR;
   852    850       }
   853    851       if (paramList == NULL) {
   854    852   	length = 0;
................................................................................
   916    914       Tcl_Command token,
   917    915       Tcl_Obj *mapDict)
   918    916   {
   919    917       Command *cmdPtr = (Command *) token;
   920    918       EnsembleConfig *ensemblePtr;
   921    919       Tcl_Obj *oldDict;
   922    920   
   923         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
          921  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
   924    922   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
   925    923   		"command is not an ensemble", -1));
   926    924   	Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
   927    925   	return TCL_ERROR;
   928    926       }
   929    927       if (mapDict != NULL) {
   930    928   	int size, done;
................................................................................
  1015   1013       Tcl_Command token,
  1016   1014       Tcl_Obj *unknownList)
  1017   1015   {
  1018   1016       Command *cmdPtr = (Command *) token;
  1019   1017       EnsembleConfig *ensemblePtr;
  1020   1018       Tcl_Obj *oldList;
  1021   1019   
  1022         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1020  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
  1023   1021   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1024   1022   		"command is not an ensemble", -1));
  1025   1023   	Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
  1026   1024   	return TCL_ERROR;
  1027   1025       }
  1028   1026       if (unknownList != NULL) {
  1029   1027   	int length;
................................................................................
  1081   1079       Tcl_Command token,
  1082   1080       int flags)
  1083   1081   {
  1084   1082       Command *cmdPtr = (Command *) token;
  1085   1083       EnsembleConfig *ensemblePtr;
  1086   1084       int wasCompiled;
  1087   1085   
  1088         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1086  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
  1089   1087   	Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1090   1088   		"command is not an ensemble", -1));
  1091   1089   	Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
  1092   1090   	return TCL_ERROR;
  1093   1091       }
  1094   1092   
  1095   1093       ensemblePtr = cmdPtr->objClientData;
................................................................................
  1157   1155       Tcl_Interp *interp,
  1158   1156       Tcl_Command token,
  1159   1157       Tcl_Obj **subcmdListPtr)
  1160   1158   {
  1161   1159       Command *cmdPtr = (Command *) token;
  1162   1160       EnsembleConfig *ensemblePtr;
  1163   1161   
  1164         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1162  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
  1165   1163   	if (interp != NULL) {
  1166   1164   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1167   1165   		    "command is not an ensemble", -1));
  1168   1166   	    Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
  1169   1167   	}
  1170   1168   	return TCL_ERROR;
  1171   1169       }
................................................................................
  1199   1197       Tcl_Interp *interp,
  1200   1198       Tcl_Command token,
  1201   1199       Tcl_Obj **paramListPtr)
  1202   1200   {
  1203   1201       Command *cmdPtr = (Command *) token;
  1204   1202       EnsembleConfig *ensemblePtr;
  1205   1203   
  1206         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1204  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
  1207   1205   	if (interp != NULL) {
  1208   1206   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1209   1207   		    "command is not an ensemble", -1));
  1210   1208   	    Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
  1211   1209   	}
  1212   1210   	return TCL_ERROR;
  1213   1211       }
................................................................................
  1241   1239       Tcl_Interp *interp,
  1242   1240       Tcl_Command token,
  1243   1241       Tcl_Obj **mapDictPtr)
  1244   1242   {
  1245   1243       Command *cmdPtr = (Command *) token;
  1246   1244       EnsembleConfig *ensemblePtr;
  1247   1245   
  1248         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1246  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
  1249   1247   	if (interp != NULL) {
  1250   1248   	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
  1251   1249   		    "command is not an ensemble", -1));
  1252   1250   	    Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE", "NOT_ENSEMBLE", NULL);
  1253   1251   	}
  1254   1252   	return TCL_ERROR;
  1255   1253       }
................................................................................
  1282   1280       Tcl_Interp *interp,
  1283   1281       Tcl_Command token,
  1284   1282       Tcl_Obj **unknownListPtr)
  1285   1283   {
  1286   1284       Command *cmdPtr = (Command *) token;
  1287   1285       EnsembleConfig *ensemblePtr;
  1288   1286   
  1289         -    if (cmdPtr->objProc != NsEnsembleImplementationCmd) {
         1287  +    if (cmdPtr->objProc != TclEnsembleImplementationCmd) {