Fossil: Check-in [cc074a1442]

Fossil SCM

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

Overview
Comment:Merge trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | repolist-theme
Files: files | file ages | folders
SHA3-256:cc074a1442ba8b6408f9d0f07b47a3f3adc4a080a984c37eb15bd20928f96469
User & Date: milouse 2018-12-05 09:05:45
Context
2019-05-29
07:43
Merge last trunk check-in: ecc09e8683 user: milouse tags: repolist-theme
2018-12-05
09:05
Merge trunk check-in: cc074a1442 user: milouse tags: repolist-theme
2018-12-04
23:08
Fixed a use of fclose() on a handle opened with popen(), noticed by Stephan Beal. check-in: 1f4b4fcb62 user: wyoung tags: trunk
2018-11-15
09:31
Import ideas from @tontyna proposal on fossil forum. Also fix the column sort order check-in: 9280c58260 user: milouse tags: repolist-theme
Changes

Changes to skins/default/css.txt.

   143    143       overflow: auto;
   144    144       border: 1px solid #ccc;
   145    145       border-radius: 5px;
   146    146   }
   147    147   .content blockquote {
   148    148       padding: 0 15px;
   149    149   }
   150         -div.forumHierRoot blockquote, div.forumHier blockquote {
          150  +div.forumHierRoot blockquote, div.forumHier blockquote, div.forumEdit blockquote {
   151    151       background-color: rgba(65, 131, 196, 0.1);
   152    152       border-left: 3px solid #254769;
   153    153       padding: .1em 1em;
   154    154   }
   155    155   
   156    156   table.report {
   157    157       cursor: auto;

Changes to src/alerts.c.

   844    844         emailerError(p, "Failed to insert email message into output queue.\n"
   845    845                         "%s", sqlite3_errmsg(p->db));
   846    846       }
   847    847     }else if( p->zCmd ){
   848    848       FILE *out = popen(p->zCmd, "w");
   849    849       if( out ){
   850    850         fwrite(blob_buffer(&all), 1, blob_size(&all), out);
   851         -      fclose(out);
          851  +      pclose(out);
   852    852       }else{
   853    853         emailerError(p, "Could not open output pipe \"%s\"", p->zCmd);
   854    854       }
   855    855     }else if( p->zDir ){
   856    856       char *zFile = file_time_tempname(p->zDir, ".email");
   857    857       blob_write_to_file(&all, zFile);
   858    858       fossil_free(zFile);
................................................................................
  2033   2033       p->type = db_column_text(&q, 3)[0];
  2034   2034       p->needMod = db_column_int(&q, 4);
  2035   2035       p->zFromName = 0;
  2036   2036       p->pNext = 0;
  2037   2037       switch( p->type ){
  2038   2038         case 'c':  zType = "Check-In";        break;
  2039   2039         case 'f':  zType = "Forum post";      break;
  2040         -      case 't':  zType = "Wiki Edit";       break;
  2041         -      case 'w':  zType = "Ticket Change";   break;
         2040  +      case 't':  zType = "Ticket Change";   break;
         2041  +      case 'w':  zType = "Wiki Edit";       break;
  2042   2042       }
  2043   2043       blob_init(&p->hdr, 0, 0);
  2044   2044       blob_init(&p->txt, 0, 0);
  2045   2045       blob_appendf(&p->txt,"== %s %s ==\n%s\n%s/info/%.20s\n",
  2046   2046         db_column_text(&q,1),
  2047   2047         zType,
  2048   2048         db_column_text(&q,2),

Changes to src/backoffice.c.

   380    380     Lease x;
   381    381     sqlite3_uint64 tmNow;
   382    382   
   383    383     if( backofficeDb ) return;
   384    384     if( g.zRepositoryName==0 ) return;
   385    385     if( g.db==0 ) return;
   386    386     if( !db_table_exists("repository","config") ) return;
          387  +  if( db_get_boolean("backoffice-disable",0) ) return;
   387    388     tmNow = time(0);
   388    389     backofficeReadLease(&x);
   389    390     if( x.tmNext>=tmNow && backofficeProcessExists(x.idNext) ){
   390    391       /* Another backoffice process is already queued up to run.  This
   391    392       ** process does not need to do any backoffice work. */
   392    393       return;
   393    394     }else{

Changes to src/cache.c.

   342    342                    " Should be one of: clear init list status", zCmd);
   343    343     }
   344    344   }
   345    345   
   346    346   /*
   347    347   ** WEBPAGE: cachestat
   348    348   **
   349         -** Show information about the webpage cache.  Requires Admin privilege.
          349  +** Show information about the webpage cache.  Requires Setup privilege.
   350    350   */
   351    351   void cache_page(void){
   352    352     sqlite3 *db;
   353    353     sqlite3_stmt *pStmt;
   354    354     char zBuf[100];
   355    355   
   356    356     login_check_credentials();

Changes to src/comformat.c.

     1      1   /*
     2      2   ** Copyright (c) 2007 D. Richard Hipp
     3      3   **
     4      4   ** This program is free software; you can redistribute it and/or
     5      5   ** modify it under the terms of the Simplified BSD License (also
     6      6   ** known as the "2-Clause License" or "FreeBSD License".)
     7         -
            7  +**
     8      8   ** This program is distributed in the hope that it will be useful,
     9      9   ** but without any warranty; without even the implied warranty of
    10     10   ** merchantability or fitness for a particular purpose.
    11     11   **
    12     12   ** Author contact information:
    13     13   **   drh@hwaci.com
    14     14   **   http://www.hwaci.com/drh/
................................................................................
    93     93     *pMaxChars = COMMENT_LEGACY_LINE_LENGTH - indent;
    94     94     return -1;
    95     95   #endif
    96     96   }
    97     97   
    98     98   /*
    99     99   ** This function checks the current line being printed against the original
   100         -** comment text.  Upon matching, it emits a new line and updates the provided
   101         -** character and line counts, if applicable.
          100  +** comment text.  Upon matching, it updates the provided character and line
          101  +** counts, if applicable.  The caller needs to emit a new line, if desired.
   102    102   */
   103    103   static int comment_check_orig(
   104    104     const char *zOrigText, /* [in] Original comment text ONLY, may be NULL. */
   105    105     const char *zLine,     /* [in] The comment line to print. */
   106    106     int *pCharCnt,         /* [in/out] Pointer to the line character count. */
   107    107     int *pLineCnt          /* [in/out] Pointer to the total line count. */
   108    108   ){
   109    109     if( zOrigText && fossil_strcmp(zLine, zOrigText)==0 ){
   110         -    fossil_print("\n");
   111    110       if( pCharCnt ) *pCharCnt = 0;
   112    111       if( pLineCnt ) (*pLineCnt)++;
   113    112       return 1;
   114    113     }
   115    114     return 0;
   116    115   }
   117    116   
................................................................................
   119    118   ** This function scans the specified comment line starting just after the
   120    119   ** initial index and returns the index of the next spacing character -OR-
   121    120   ** zero if such a character cannot be found.  For the purposes of this
   122    121   ** algorithm, the NUL character is treated the same as a spacing character.
   123    122   */
   124    123   static int comment_next_space(
   125    124     const char *zLine, /* [in] The comment line being printed. */
   126         -  int index          /* [in] The current character index being handled. */
          125  +  int index,         /* [in] The current character index being handled. */
          126  +  int *distUTF8      /* [out] Distance to next space in UTF-8 sequences. */
   127    127   ){
   128    128     int nextIndex = index + 1;
          129  +  int fNonASCII=0;
   129    130     for(;;){
   130    131       char c = zLine[nextIndex];
          132  +    if( (c&0x80)==0x80 ) fNonASCII=1;
   131    133       if( c==0 || fossil_isspace(c) ){
          134  +      if( distUTF8 ){
          135  +        if( fNonASCII!=0 ){
          136  +          *distUTF8 = strlen_utf8(&zLine[index], nextIndex-index);
          137  +        }else{
          138  +          *distUTF8 = nextIndex-index;
          139  +        }
          140  +      }
   132    141         return nextIndex;
   133    142       }
   134    143       nextIndex++;
   135    144     }
   136    145     return 0; /* NOT REACHED */
   137    146   }
   138    147   
   139    148   /*
   140         -** This function is called when printing a logical comment line to perform
   141         -** the necessary indenting.
          149  +** Count the number of UTF-8 sequences in a string. Incomplete, ill-formed and
          150  +** overlong sequences are counted as one sequence. The invalid lead bytes 0xC0
          151  +** to 0xC1 and 0xF5 to 0xF7 are allowed to initiate (ill-formed) 2- and 4-byte
          152  +** sequences, respectively, the other invalid lead bytes 0xF8 to 0xFF are
          153  +** treated as invalid 1-byte sequences (as lone trail bytes).
          154  +** Combining characters and East Asian Wide and Fullwidth characters are counted
          155  +** as one, so this function does not calculate the effective "display width".
          156  +*/
          157  +int strlen_utf8(const char *zString, int lengthBytes){
          158  +  int i;          /* Counted bytes. */
          159  +  int lengthUTF8; /* Counted UTF-8 sequences. */
          160  +#if 0
          161  +  assert( lengthBytes>=0 );
          162  +#endif
          163  +  for(i=0, lengthUTF8=0; i<lengthBytes; i++, lengthUTF8++){
          164  +    char c = zString[i];
          165  +    int cchUTF8=1; /* Code units consumed. */
          166  +    int maxUTF8=1; /* Expected sequence length. */
          167  +    if( (c&0xe0)==0xc0 )maxUTF8=2;          /* UTF-8 lead byte 110vvvvv */
          168  +    else if( (c&0xf0)==0xe0 )maxUTF8=3;     /* UTF-8 lead byte 1110vvvv */
          169  +    else if( (c&0xf8)==0xf0 )maxUTF8=4;     /* UTF-8 lead byte 11110vvv */
          170  +    while( cchUTF8<maxUTF8 &&
          171  +            i<lengthBytes-1 &&
          172  +            (zString[i+1]&0xc0)==0x80 ){    /* UTF-8 trail byte 10vvvvvv */
          173  +      cchUTF8++;
          174  +      i++;
          175  +    }
          176  +  }
          177  +  return lengthUTF8;
          178  +}
          179  +
          180  +/*
          181  +** This function is called when printing a logical comment line to calculate
          182  +** the necessary indenting.  The caller needs to emit the indenting spaces.
   142    183   */
   143         -static void comment_print_indent(
          184  +static void comment_calc_indent(
   144    185     const char *zLine, /* [in] The comment line being printed. */
   145    186     int indent,        /* [in] Number of spaces to indent, zero for none. */
   146    187     int trimCrLf,      /* [in] Non-zero to trim leading/trailing CR/LF. */
   147    188     int trimSpace,     /* [in] Non-zero to trim leading/trailing spaces. */
   148    189     int *piIndex       /* [in/out] Pointer to first non-space character. */
   149    190   ){
   150         -  if( indent>0 ){
   151         -    fossil_print("%*s", indent, "");
   152         -  }
   153    191     if( zLine && piIndex ){
   154    192       int index = *piIndex;
   155    193       if( trimCrLf ){
   156    194         while( zLine[index]=='\r' || zLine[index]=='\n' ){ index++; }
   157    195       }
   158    196       if( trimSpace ){
   159    197         while( fossil_isspace(zLine[index]) ){ index++; }
................................................................................
   177    215     int trimCrLf,          /* [in] Non-zero to trim leading/trailing CR/LF. */
   178    216     int trimSpace,         /* [in] Non-zero to trim leading/trailing spaces. */
   179    217     int wordBreak,         /* [in] Non-zero to try breaking on word boundaries. */
   180    218     int origBreak,         /* [in] Non-zero to break before original comment. */
   181    219     int *pLineCnt,         /* [in/out] Pointer to the total line count. */
   182    220     const char **pzLine    /* [out] Pointer to the end of the logical line. */
   183    221   ){
   184         -  int index = 0, charCnt = 0, lineCnt = 0, maxChars;
          222  +  int index = 0, charCnt = 0, lineCnt = 0, maxChars, i;
          223  +  char zBuf[400]; int iBuf=0; /* Output buffer and counter. */
          224  +  int cchUTF8, maxUTF8;       /* Helper variables to count UTF-8 sequences. */
   185    225     if( !zLine ) return;
   186    226     if( lineChars<=0 ) return;
   187         -  comment_print_indent(zLine, indent, trimCrLf, trimSpace, &index);
          227  +#if 0
          228  +  assert( indent<sizeof(zBuf)-5 );       /* See following comments to explain */
          229  +  assert( origIndent<sizeof(zBuf)-5 );   /* these limits. */
          230  +#endif
          231  +  if( indent>sizeof(zBuf)-6 ){
          232  +    /* Limit initial indent to fit output buffer. */
          233  +    indent = sizeof(zBuf)-6;
          234  +  }
          235  +  comment_calc_indent(zLine, indent, trimCrLf, trimSpace, &index);
          236  +  if( indent>0 ){
          237  +    for(i=0; i<indent; i++){
          238  +      zBuf[iBuf++] = ' ';
          239  +    }
          240  +  }
          241  +  if( origIndent>sizeof(zBuf)-6 ){
          242  +    /* Limit line indent to fit output buffer. */
          243  +    origIndent = sizeof(zBuf)-6;
          244  +  }
   188    245     maxChars = lineChars;
   189    246     for(;;){
   190    247       int useChars = 1;
   191    248       char c = zLine[index];
          249  +    /* Flush the output buffer if there's no space left for at least one more
          250  +    ** (potentially 4-byte) UTF-8 sequence, one level of indentation spaces,
          251  +    ** a new line, and a terminating NULL. */
          252  +    if( iBuf>sizeof(zBuf)-origIndent-6 ){
          253  +      zBuf[iBuf]=0;
          254  +      iBuf=0;
          255  +      fossil_print("%s", zBuf);
          256  +    }
   192    257       if( c==0 ){
   193    258         break;
   194    259       }else{
   195    260         if( origBreak && index>0 ){
   196    261           const char *zCurrent = &zLine[index];
   197    262           if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){
   198         -          comment_print_indent(zCurrent, origIndent, trimCrLf, trimSpace,
   199         -                               &index);
          263  +          zBuf[iBuf++] = '\n';
          264  +          comment_calc_indent(zLine, origIndent, trimCrLf, trimSpace, &index);
          265  +          for( i=0; i<origIndent; i++ ){
          266  +            zBuf[iBuf++] = ' ';
          267  +          }
   200    268             maxChars = lineChars;
   201    269           }
   202    270         }
   203    271         index++;
   204    272       }
   205    273       if( c=='\n' ){
   206    274         lineCnt++;
   207    275         charCnt = 0;
   208    276         useChars = 0;
   209    277       }else if( c=='\t' ){
   210         -      int nextIndex = comment_next_space(zLine, index);
   211         -      if( nextIndex<=0 || (nextIndex-index)>maxChars ){
          278  +      int distUTF8;
          279  +      int nextIndex = comment_next_space(zLine, index, &distUTF8);
          280  +      if( nextIndex<=0 || distUTF8>maxChars ){
   212    281           break;
   213    282         }
   214    283         charCnt++;
   215    284         useChars = COMMENT_TAB_WIDTH;
   216    285         if( maxChars<useChars ){
   217         -        fossil_print(" ");
          286  +        zBuf[iBuf++] = ' ';
   218    287           break;
   219    288         }
   220    289       }else if( wordBreak && fossil_isspace(c) ){
   221         -      int nextIndex = comment_next_space(zLine, index);
   222         -      if( nextIndex<=0 || (nextIndex-index)>maxChars ){
          290  +      int distUTF8;
          291  +      int nextIndex = comment_next_space(zLine, index, &distUTF8);
          292  +      if( nextIndex<=0 || distUTF8>maxChars ){
   223    293           break;
   224    294         }
   225    295         charCnt++;
   226    296       }else{
   227    297         charCnt++;
   228    298       }
   229    299       assert( c!='\n' || charCnt==0 );
   230         -    fossil_print("%c", c);
   231         -    if( (c&0x80)==0 || (zLine[index+1]&0xc0)!=0xc0 ) maxChars -= useChars;
          300  +    zBuf[iBuf++] = c;
          301  +    /* Skip over UTF-8 sequences, see comment on strlen_utf8() for details. */
          302  +    cchUTF8=1; /* Code units consumed. */
          303  +    maxUTF8=1; /* Expected sequence length. */
          304  +    if( (c&0xe0)==0xc0 )maxUTF8=2;          /* UTF-8 lead byte 110vvvvv */
          305  +    else if( (c&0xf0)==0xe0 )maxUTF8=3;     /* UTF-8 lead byte 1110vvvv */
          306  +    else if( (c&0xf8)==0xf0 )maxUTF8=4;     /* UTF-8 lead byte 11110vvv */
          307  +    while( cchUTF8<maxUTF8 &&
          308  +            (zLine[index]&0xc0)==0x80 ){    /* UTF-8 trail byte 10vvvvvv */
          309  +      cchUTF8++;
          310  +      zBuf[iBuf++] = zLine[index++];
          311  +    }
          312  +    maxChars -= useChars;
   232    313       if( maxChars<=0 ) break;
   233    314       if( c=='\n' ) break;
   234    315     }
   235    316     if( charCnt>0 ){
   236         -    fossil_print("\n");
          317  +    zBuf[iBuf++] = '\n';
   237    318       lineCnt++;
          319  +  }
          320  +  /* Flush the remaining output buffer. */
          321  +  if( iBuf>0 ){
          322  +    zBuf[iBuf]=0;
          323  +    iBuf=0;
          324  +    fossil_print("%s", zBuf);
   238    325     }
   239    326     if( pLineCnt ){
   240    327       *pLineCnt += lineCnt;
   241    328     }
   242    329     if( pzLine ){
   243    330       *pzLine = zLine + index;
   244    331     }
................................................................................
   257    344   */
   258    345   static int comment_print_legacy(
   259    346     const char *zText, /* The comment text to be printed. */
   260    347     int indent,        /* Number of spaces to indent each non-initial line. */
   261    348     int width          /* Maximum number of characters per line. */
   262    349   ){
   263    350     int maxChars = width - indent;
   264         -  int si, sk, i, k;
          351  +  int si, sk, i, k, kc;
   265    352     int doIndent = 0;
   266    353     char *zBuf;
   267    354     char zBuffer[400];
   268    355     int lineCnt = 0;
          356  +  int cchUTF8, maxUTF8; /* Helper variables to count UTF-8 sequences. */
   269    357   
   270    358     if( width<0 ){
   271    359       comment_set_maxchars(indent, &maxChars);
   272    360     }
   273    361     if( zText==0 ) zText = "(NULL)";
   274    362     if( maxChars<=0 ){
   275    363       maxChars = strlen(zText);
   276    364     }
   277         -  if( maxChars >= (sizeof(zBuffer)) ){
   278         -    zBuf = fossil_malloc(maxChars+1);
          365  +  /* Ensure the buffer can hold the longest-possible UTF-8 sequences. */
          366  +  if( maxChars >= (sizeof(zBuffer)/4-1) ){
          367  +    zBuf = fossil_malloc(maxChars*4+1);
   279    368     }else{
   280    369       zBuf = zBuffer;
   281    370     }
   282    371     for(;;){
   283    372       while( fossil_isspace(zText[0]) ){ zText++; }
   284    373       if( zText[0]==0 ){
   285    374         if( doIndent==0 ){
   286    375           fossil_print("\n");
   287    376           lineCnt = 1;
   288    377         }
   289    378         if( zBuf!=zBuffer) fossil_free(zBuf);
   290    379         return lineCnt;
   291    380       }
   292         -    for(sk=si=i=k=0; zText[i] && k<maxChars; i++){
          381  +    for(sk=si=i=k=kc=0; zText[i] && kc<maxChars; i++){
   293    382         char c = zText[i];
   294         -      if( fossil_isspace(c) ){
          383  +      kc++; /* Count complete UTF-8 sequences. */
          384  +      /* Skip over UTF-8 sequences, see comment on strlen_utf8() for details. */
          385  +      cchUTF8=1; /* Code units consumed. */
          386  +      maxUTF8=1; /* Expected sequence length. */
          387  +      if( (c&0xe0)==0xc0 )maxUTF8=2;        /* UTF-8 lead byte 110vvvvv */
          388  +      else if( (c&0xf0)==0xe0 )maxUTF8=3;   /* UTF-8 lead byte 1110vvvv */
          389  +      else if( (c&0xf8)==0xf0 )maxUTF8=4;   /* UTF-8 lead byte 11110vvv */
          390  +      if( maxUTF8>1 ){
          391  +        zBuf[k++] = c;
          392  +        while( cchUTF8<maxUTF8 &&
          393  +                (zText[i+1]&0xc0)==0x80 ){  /* UTF-8 trail byte 10vvvvvv */
          394  +          cchUTF8++;
          395  +          zBuf[k++] = zText[++i];
          396  +        }
          397  +      }
          398  +      else if( fossil_isspace(c) ){
   295    399           si = i;
   296    400           sk = k;
   297    401           if( k==0 || zBuf[k-1]!=' ' ){
   298    402             zBuf[k++] = ' ';
   299    403           }
   300    404         }else{
   301    405           zBuf[k] = c;

Changes to src/db.c.

  3028   3028   */
  3029   3029   /*
  3030   3030   ** SETTING: backoffice-nodelay boolean default=off
  3031   3031   ** If backoffice-nodelay is true, then the backoffice processing
  3032   3032   ** will never invoke sleep().  If it has nothing useful to do,
  3033   3033   ** it simply exits.
  3034   3034   */
         3035  +/*
         3036  +** SETTING: backoffice-disable boolean default=off
         3037  +** If backoffice-disable is true, then the automatic backoffice
         3038  +** processing is disabled.  Automatic backoffice processing is the
         3039  +** backoffice work that normally runs after each web page is
         3040  +** rendered.  Backoffice processing that is triggered by the
         3041  +** "fossil backoffice" command is unaffected by this setting.
         3042  +**
         3043  +** Backoffice processing does things such as delivering
         3044  +** email notifications.  So if this setting is true, and if
         3045  +** there is no cron job periodically running "fossil backoffice",
         3046  +** email notifications and other work normally done by the
         3047  +** backoffice will not occur.
         3048  +*/
  3035   3049   /*
  3036   3050   ** SETTING: backoffice-logfile width=40
  3037   3051   ** If backoffice-logfile is not an empty string and is a valid
  3038   3052   ** filename, then a one-line message is appended to that file
  3039   3053   ** every time the backoffice runs.  This can be used for debugging,
  3040   3054   ** to ensure that backoffice is running appropriately.
  3041   3055   */
................................................................................
  3186   3200   /*
  3187   3201   ** SETTING: keep-glob        width=40 versionable block-text
  3188   3202   ** The value is a comma or newline-separated list of GLOB
  3189   3203   ** patterns specifying files that the "clean" command will keep.
  3190   3204   */
  3191   3205   /*
  3192   3206   ** SETTING: localauth        boolean default=off
  3193         -** If enabled, require that HTTP connections from
  3194         -** 127.0.0.1 be authenticated by password.  If
  3195         -** false, all HTTP requests from localhost have
  3196         -** unrestricted access to the repository.
         3207  +** If enabled, require that HTTP connections from the loopback
         3208  +** address (127.0.0.1) be authenticated by password.  If false,
         3209  +** some HTTP requests might be granted full "Setup" user
         3210  +** privileges without having to present login credentials.
         3211  +** This mechanism allows the "fossil ui" command to provide
         3212  +** full access to the repository without requiring the user to
         3213  +** log in first.
         3214  +**
         3215  +** In order for full "Setup" privilege to be granted without a
         3216  +** login, the following conditions must be met:
         3217  +**
         3218  +**   (1)  This setting ("localauth") must be off
         3219  +**   (2)  The HTTP request arrive over the loopback TCP/IP
         3220  +**        address (127.0.01) or else via SSH.
         3221  +**   (3)  The request must be HTTP, not HTTPS. (This
         3222  +**        restriction is designed to help prevent accidentally
         3223  +**        providing "Setup" privileges to requests arriving
         3224  +**        over a reverse proxy.)
         3225  +**   (4)  The command that launched the fossil server must be
         3226  +**        one of the following:
         3227  +**        (a) "fossil ui"
         3228  +**        (b) "fossil server" with the --localauth option
         3229  +**        (c) "fossil http" with the --localauth option
         3230  +**        (d) CGI with the "localauth" setting in the cgi script.
         3231  +**
         3232  +** For maximum security, set "localauth" to 1.  However, because
         3233  +** of the other restrictions (2) through (4), it should be safe
         3234  +** to leave "localauth" set to 0 in most installations, and 
         3235  +** especially on cloned repositories on workstations. Leaving
         3236  +** "localauth" at 0 makes the "fossil ui" command more convenient
         3237  +** to use.
  3197   3238   */
  3198   3239   /*
  3199   3240   ** SETTING: main-branch      width=40 default=trunk
  3200   3241   ** The value is the primary branch for the project.
  3201   3242   */
  3202   3243   /*
  3203   3244   ** SETTING: manifest         width=5 versionable

Changes to src/info.c.

  2127   2127       @ <hr />
  2128   2128       content_get(rid, &content);
  2129   2129       if( renderAsWiki ){
  2130   2130         wiki_render_by_mimetype(&content, zMime);
  2131   2131       }else if( renderAsHtml ){
  2132   2132         @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
  2133   2133         @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
  2134         -      @ sandbox="allow-same-origin"
  2135         -      @ onload="this.height=this.contentDocument.documentElement.scrollHeight;">
         2134  +      @ sandbox="allow-same-origin" id="ifm1">
  2136   2135         @ </iframe>
         2136  +      @ <script nonce="%h(style_nonce())">
         2137  +      @ document.getElementById("ifm1").addEventListener("load",
         2138  +      @   function(){
         2139  +      @     this.height=this.contentDocument.documentElement.scrollHeight + 75;
         2140  +      @   }
         2141  +      @ );
         2142  +      @ </script>
  2137   2143       }else{
  2138   2144         style_submenu_element("Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
  2139   2145         blob_to_utf8_no_bom(&content, 0);
  2140   2146         zMime = mimetype_from_content(&content);
  2141   2147         @ <blockquote>
  2142   2148         if( zMime==0 ){
  2143   2149           const char *z;

Changes to src/main.c.

  2696   2696   **     case=6           Call webpage_assert()
  2697   2697   **     case=7           Call webpage_error()
  2698   2698   */
  2699   2699   void test_warning_page(void){
  2700   2700     int iCase = atoi(PD("case","0"));
  2701   2701     int i;
  2702   2702     login_check_credentials();
  2703         -  if( !g.perm.Setup && !g.perm.Admin ){
         2703  +  if( !g.perm.Admin ){
  2704   2704       login_needed(0);
  2705   2705       return;
  2706   2706     }
  2707   2707     style_header("Warning Test Page");
  2708   2708     style_submenu_element("Error Log","%R/errorlog");
  2709   2709     if( iCase<1 || iCase>4 ){
  2710   2710       @ <p>Generate a message to the <a href="%R/errorlog">error log</a>

Changes to src/makemake.tcl.

   708    708   endif
   709    709   
   710    710   #### The directories where the OpenSSL include and library files are located.
   711    711   #    The recommended usage here is to use the Sysinternals junction tool
   712    712   #    to create a hard link between an "openssl-1.x" sub-directory of the
   713    713   #    Fossil source code directory and the target OpenSSL source directory.
   714    714   #
   715         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2p
          715  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2q
   716    716   OPENSSLINCDIR = $(OPENSSLDIR)/include
   717    717   OPENSSLLIBDIR = $(OPENSSLDIR)
   718    718   
   719    719   #### Either the directory where the Tcl library is installed or the Tcl
   720    720   #    source code directory resides (depending on the value of the macro
   721    721   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   722    722   #    this directory must have "include" and "lib" sub-directories.  If
................................................................................
  1564   1564   
  1565   1565   # Enable support for the SQLite Encryption Extension?
  1566   1566   !ifndef USE_SEE
  1567   1567   USE_SEE = 0
  1568   1568   !endif
  1569   1569   
  1570   1570   !if $(FOSSIL_ENABLE_SSL)!=0
  1571         -SSLDIR    = $(B)\compat\openssl-1.0.2p
         1571  +SSLDIR    = $(B)\compat\openssl-1.0.2q
  1572   1572   SSLINCDIR = $(SSLDIR)\inc32
  1573   1573   !if $(FOSSIL_DYNAMIC_BUILD)!=0
  1574   1574   SSLLIBDIR = $(SSLDIR)\out32dll
  1575   1575   !else
  1576   1576   SSLLIBDIR = $(SSLDIR)\out32
  1577   1577   !endif
  1578   1578   SSLLFLAGS = /nologo /opt:ref /debug

Changes to src/security_audit.c.

    45     45     const char *zAnonCap;      /* Capabilities of user "anonymous" and "nobody" */
    46     46     const char *zPubPages;     /* GLOB pattern for public pages */
    47     47     const char *zSelfCap;      /* Capabilities of self-registered users */
    48     48     char *z;
    49     49     int n;
    50     50   
    51     51     login_check_credentials();
    52         -  if( !g.perm.Setup && !g.perm.Admin ){
           52  +  if( !g.perm.Admin ){
    53     53       login_needed(0);
    54     54       return;
    55     55     }
    56     56     style_header("Security Audit");
    57     57     @ <ol>
    58     58   
    59     59     /* Step 1:  Determine if the repository is public or private.  "Public"
................................................................................
   437    437   /*
   438    438   ** WEBPAGE: takeitprivate
   439    439   **
   440    440   ** Disable anonymous access to this website
   441    441   */
   442    442   void takeitprivate_page(void){
   443    443     login_check_credentials();
   444         -  if( !g.perm.Setup && !g.perm.Admin ){
          444  +  if( !g.perm.Admin ){
   445    445       login_needed(0);
   446    446       return;
   447    447     }
   448    448     if( P("cancel") ){
   449    449       /* User pressed the cancel button.  Go back */
   450    450       cgi_redirect("secaudit0");
   451    451     }
................................................................................
   486    486   ** this page.
   487    487   */
   488    488   void errorlog_page(void){
   489    489     i64 szFile;
   490    490     FILE *in;
   491    491     char z[10000];
   492    492     login_check_credentials();
   493         -  if( !g.perm.Setup && !g.perm.Admin ){
          493  +  if( !g.perm.Admin ){
   494    494       login_needed(0);
   495    495       return;
   496    496     }
   497    497     style_header("Server Error Log");
   498    498     style_submenu_element("Test", "%R/test-warning");
   499    499     style_submenu_element("Refresh", "%R/errorlog");
   500    500     if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){

Changes to src/setup.c.

    57     57   }
    58     58   
    59     59   
    60     60   
    61     61   /*
    62     62   ** WEBPAGE: setup
    63     63   **
    64         -** Main menu for the administrative pages.  Requires Admin privileges.
           64  +** Main menu for the administrative pages.  Requires Admin or Setup
           65  +** privileges.  Links to sub-pages only usable by Setup users are
           66  +** shown only to Setup users.
    65     67   */
    66     68   void setup_page(void){
           69  +  int setup_user = 0;
    67     70     login_check_credentials();
    68         -  if( !g.perm.Setup ){
           71  +  if( !g.perm.Admin ){
    69     72       login_needed(0);
    70     73     }
           74  +  setup_user = g.perm.Setup;
    71     75   
    72     76     style_header("Server Administration");
    73     77   
    74     78     /* Make sure the header contains <base href="...">.   Issue a warning
    75     79     ** if it does not. */
    76     80     if( !cgi_header_contains("<base href=") ){
    77     81       @ <p class="generalError"><b>Configuration Error:</b> Please add
................................................................................
    93     97       @ by SQLite will be poorly seeded.</p>
    94     98     }
    95     99   #endif
    96    100   
    97    101     @ <table border="0" cellspacing="3">
    98    102     setup_menu_entry("Users", "setup_ulist",
    99    103       "Grant privileges to individual users.");
   100         -  setup_menu_entry("Access", "setup_access",
   101         -    "Control access settings.");
   102         -  setup_menu_entry("Configuration", "setup_config",
   103         -    "Configure the WWW components of the repository");
          104  +  if( setup_user ){
          105  +    setup_menu_entry("Access", "setup_access",
          106  +      "Control access settings.");
          107  +    setup_menu_entry("Configuration", "setup_config",
          108  +      "Configure the WWW components of the repository");
          109  +  }
   104    110     setup_menu_entry("Security-Audit", "secaudit0",
   105    111       "Analyze the current configuration for security problems");
   106         -  setup_menu_entry("Settings", "setup_settings",
   107         -    "Web interface to the \"fossil settings\" command");
          112  +  if( setup_user ){
          113  +    setup_menu_entry("Settings", "setup_settings",
          114  +      "Web interface to the \"fossil settings\" command");
          115  +  }
   108    116     setup_menu_entry("Timeline", "setup_timeline",
   109    117       "Timeline display preferences");
   110         -  setup_menu_entry("Login-Group", "setup_login_group",
   111         -    "Manage single sign-on between this repository and others"
   112         -    " on the same server");
   113         -  setup_menu_entry("Tickets", "tktsetup",
   114         -    "Configure the trouble-ticketing system for this repository");
          118  +  if( setup_user ){
          119  +    setup_menu_entry("Login-Group", "setup_login_group",
          120  +      "Manage single sign-on between this repository and others"
          121  +      " on the same server");
          122  +    setup_menu_entry("Tickets", "tktsetup",
          123  +      "Configure the trouble-ticketing system for this repository");
          124  +  }
   115    125     setup_menu_entry("Search","srchsetup",
   116    126       "Configure the built-in search engine");
   117    127     setup_menu_entry("URL Aliases", "waliassetup",
   118    128       "Configure URL aliases");
   119         -  setup_menu_entry("Notification", "setup_notification",
   120         -    "Automatic notifications of changes via outbound email");
   121         -  setup_menu_entry("Email-Server", "setup_smtp",
   122         -    "Activate and configure the built-in email server");
   123         -  setup_menu_entry("Transfers", "xfersetup",
   124         -    "Configure the transfer system for this repository");
          129  +  if( setup_user ){
          130  +    setup_menu_entry("Notification", "setup_notification",
          131  +      "Automatic notifications of changes via outbound email");
          132  +    setup_menu_entry("Email-Server", "setup_smtp",
          133  +      "Activate and configure the built-in email server");
          134  +    setup_menu_entry("Transfers", "xfersetup",
          135  +      "Configure the transfer system for this repository");
          136  +  }
   125    137     setup_menu_entry("Skins", "setup_skin",
   126    138       "Select and/or modify the web interface \"skins\"");
   127    139     setup_menu_entry("Moderation", "setup_modreq",
   128    140       "Enable/Disable requiring moderator approval of Wiki and/or Ticket"
   129    141       " changes and attachments.");
   130    142     setup_menu_entry("Ad-Unit", "setup_adunit",
   131    143       "Edit HTML text for an ad unit inserted after the menu bar");
   132    144     setup_menu_entry("URLs & Checkouts", "urllist",
   133    145       "Show URLs used to access this repo and known check-outs");
   134         -  setup_menu_entry("Web-Cache", "cachestat",
   135         -    "View the status of the expensive-page cache");
          146  +  if( setup_user ){
          147  +    setup_menu_entry("Web-Cache", "cachestat",
          148  +      "View the status of the expensive-page cache");
          149  +  }
   136    150     setup_menu_entry("Logo", "setup_logo",
   137    151       "Change the logo and background images for the server");
   138    152     setup_menu_entry("Shunned", "shun",
   139    153       "Show artifacts that are shunned by this repository");
   140    154     setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
   141    155       "A record of received artifacts and their sources");
   142    156     setup_menu_entry("User Log", "access_log",
................................................................................
   147    161       "View the Fossil server error log");
   148    162     setup_menu_entry("Unversioned Files", "uvlist?byage=1",
   149    163       "Show all unversioned files held");
   150    164     setup_menu_entry("Stats", "stat",
   151    165       "Repository Status Reports");
   152    166     setup_menu_entry("Sitemap", "sitemap",
   153    167       "Links to miscellaneous pages");
   154         -  setup_menu_entry("SQL", "admin_sql",
   155         -    "Enter raw SQL commands");
   156         -  setup_menu_entry("TH1", "admin_th1",
   157         -    "Enter raw TH1 commands");
          168  +  if( setup_user ){
          169  +    setup_menu_entry("SQL", "admin_sql",
          170  +      "Enter raw SQL commands");
          171  +    setup_menu_entry("TH1", "admin_th1",
          172  +      "Enter raw TH1 commands");
          173  +  }
   158    174     @ </table>
   159    175   
   160    176     style_footer();
   161    177   }
   162    178   
   163    179   /*
   164    180   ** Generate a checkbox for an attribute.
................................................................................
   289    305     @ </select> <b>%h(zLabel)</b>
   290    306   }
   291    307   
   292    308   
   293    309   /*
   294    310   ** WEBPAGE: setup_access
   295    311   **
   296         -** The access-control settings page.  Requires Admin privileges.
          312  +** The access-control settings page.  Requires Setup privileges.
   297    313   */
   298    314   void setup_access(void){
   299    315     login_check_credentials();
   300    316     if( !g.perm.Setup ){
   301    317       login_needed(0);
   302    318       return;
   303    319     }
................................................................................
   645    661         "0", "HH:MM",
   646    662         "1", "HH:MM:SS",
   647    663         "2", "YYYY-MM-DD HH:MM",
   648    664         "3", "YYMMDD HH:MM",
   649    665         "4", "(off)"
   650    666     };
   651    667     login_check_credentials();
   652         -  if( !g.perm.Setup ){
          668  +  if( !g.perm.Admin ){
   653    669       login_needed(0);
   654    670       return;
   655    671     }
   656    672   
   657    673     style_header("Timeline Display Preferences");
   658    674     db_begin_transaction();
   659    675     @ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
................................................................................
   724    740     style_footer();
   725    741   }
   726    742   
   727    743   /*
   728    744   ** WEBPAGE: setup_settings
   729    745   **
   730    746   ** Change or view miscellaneous settings.  Part of the
   731         -** Admin pages requiring Admin privileges.
          747  +** /setup pages requiring Setup privileges.
   732    748   */
   733    749   void setup_settings(void){
   734    750     int nSetting;
   735    751     int i;
   736    752     Setting const *pSet;
   737    753     const Setting *aSetting = setting_info(&nSetting);
   738    754   
................................................................................
   811    827     db_end_transaction(0);
   812    828     style_footer();
   813    829   }
   814    830   
   815    831   /*
   816    832   ** WEBPAGE: setup_config
   817    833   **
   818         -** The "Admin/Configuration" page.  Requires Admin privilege.
          834  +** The "Admin/Configuration" page.  Requires Setup privilege.
   819    835   */
   820    836   void setup_config(void){
   821    837     login_check_credentials();
   822    838     if( !g.perm.Setup ){
   823    839       login_needed(0);
   824    840       return;
   825    841     }
................................................................................
   933    949   /*
   934    950   ** WEBPAGE: setup_modreq
   935    951   **
   936    952   ** Admin page for setting up moderation of tickets and wiki.
   937    953   */
   938    954   void setup_modreq(void){
   939    955     login_check_credentials();
   940         -  if( !g.perm.Setup ){
          956  +  if( !g.perm.Admin ){
   941    957       login_needed(0);
   942    958       return;
   943    959     }
   944    960   
   945    961     style_header("Moderator For Wiki And Tickets");
   946    962     db_begin_transaction();
   947    963     @ <form action="%R/setup_modreq" method="post"><div>
................................................................................
   981    997   ** WEBPAGE: setup_adunit
   982    998   **
   983    999   ** Administrative page for configuring and controlling ad units
   984   1000   ** and how they are displayed.
   985   1001   */
   986   1002   void setup_adunit(void){
   987   1003     login_check_credentials();
   988         -  if( !g.perm.Setup ){
         1004  +  if( !g.perm.Admin ){
   989   1005       login_needed(0);
   990   1006       return;
   991   1007     }
   992   1008     db_begin_transaction();
   993   1009     if( P("clear")!=0 && cgi_csrf_safe(1) ){
   994   1010       db_multi_exec("DELETE FROM config WHERE name GLOB 'adunit*'");
   995   1011       cgi_replace_parameter("adunit","");
................................................................................
  1071   1087     if( szLogoImg>0 ){
  1072   1088       zLogoMime = PD("logoim:mimetype","image/gif");
  1073   1089     }
  1074   1090     if( szBgImg>0 ){
  1075   1091       zBgMime = PD("bgim:mimetype","image/gif");
  1076   1092     }
  1077   1093     login_check_credentials();
  1078         -  if( !g.perm.Setup ){
         1094  +  if( !g.perm.Admin ){
  1079   1095       login_needed(0);
  1080   1096       return;
  1081   1097     }
  1082   1098     db_begin_transaction();
  1083   1099     if( !cgi_csrf_safe(1) ){
  1084   1100       /* Allow no state changes if not safe from CSRF */
  1085   1101     }else if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){
................................................................................
  1212   1228   }
  1213   1229   
  1214   1230   
  1215   1231   /*
  1216   1232   ** WEBPAGE: admin_sql
  1217   1233   **
  1218   1234   ** Run raw SQL commands against the database file using the web interface.
  1219         -** Requires Admin privileges.
         1235  +** Requires Setup privileges.
  1220   1236   */
  1221   1237   void sql_page(void){
  1222   1238     const char *zQ;
  1223   1239     int go = P("go")!=0;
  1224   1240     login_check_credentials();
  1225   1241     if( !g.perm.Setup ){
  1226   1242       login_needed(0);
................................................................................
  1403   1419   void page_admin_log(){
  1404   1420     Stmt stLog;
  1405   1421     int limit;                 /* How many entries to show */
  1406   1422     int ofst;                  /* Offset to the first entry */
  1407   1423     int fLogEnabled;
  1408   1424     int counter = 0;
  1409   1425     login_check_credentials();
  1410         -  if( !g.perm.Setup && !g.perm.Admin ){
         1426  +  if( !g.perm.Admin ){
  1411   1427       login_needed(0);
  1412   1428       return;
  1413   1429     }
  1414   1430     style_header("Admin Log");
  1415   1431     create_admin_log_table();
  1416   1432     limit = atoi(PD("n","200"));
  1417   1433     ofst = atoi(PD("x","0"));
................................................................................
  1463   1479   /*
  1464   1480   ** WEBPAGE: srchsetup
  1465   1481   **
  1466   1482   ** Configure the search engine.  Requires Admin privilege.
  1467   1483   */
  1468   1484   void page_srchsetup(){
  1469   1485     login_check_credentials();
  1470         -  if( !g.perm.Setup && !g.perm.Admin ){
         1486  +  if( !g.perm.Admin ){
  1471   1487       login_needed(0);
  1472   1488       return;
  1473   1489     }
  1474   1490     style_header("Search Configuration");
  1475   1491     @ <form action="%s(g.zTop)/srchsetup" method="post"><div>
  1476   1492     login_insert_csrf_secret();
  1477   1493     @ <div style="text-align:center;font-weight:bold;">
................................................................................
  1587   1603   ** Configure the URL aliases
  1588   1604   */
  1589   1605   void page_waliassetup(){
  1590   1606     Stmt q;
  1591   1607     int cnt = 0;
  1592   1608     Blob namelist;
  1593   1609     login_check_credentials();
  1594         -  if( !g.perm.Setup && !g.perm.Admin ){
         1610  +  if( !g.perm.Admin ){
  1595   1611       login_needed(0);
  1596   1612       return;
  1597   1613     }
  1598   1614     style_header("URL Alias Configuration");
  1599   1615     if( P("submit")!=0 ){
  1600   1616       Blob token;
  1601   1617       Blob sql;

Changes to src/shell.c.

  2124   2124   #  define mkdir(path,mode) _mkdir(path)
  2125   2125   #  define lstat(path,buf) stat(path,buf)
  2126   2126   #endif
  2127   2127   #include <time.h>
  2128   2128   #include <errno.h>
  2129   2129   
  2130   2130   
         2131  +/*
         2132  +** Structure of the fsdir() table-valued function
         2133  +*/
         2134  +                 /*    0    1    2     3    4           5             */
  2131   2135   #define FSDIR_SCHEMA "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"
         2136  +#define FSDIR_COLUMN_NAME     0     /* Name of the file */
         2137  +#define FSDIR_COLUMN_MODE     1     /* Access mode */
         2138  +#define FSDIR_COLUMN_MTIME    2     /* Last modification time */
         2139  +#define FSDIR_COLUMN_DATA     3     /* File content */
         2140  +#define FSDIR_COLUMN_PATH     4     /* Path to top of search */
         2141  +#define FSDIR_COLUMN_DIR      5     /* Path is relative to this directory */
         2142  +
  2132   2143   
  2133   2144   /*
  2134   2145   ** Set the result stored by context ctx to a blob containing the 
  2135   2146   ** contents of file zName.
  2136   2147   */
  2137   2148   static void readFileContents(sqlite3_context *ctx, const char *zName){
  2138   2149     FILE *in;
................................................................................
  2713   2724   static int fsdirColumn(
  2714   2725     sqlite3_vtab_cursor *cur,   /* The cursor */
  2715   2726     sqlite3_context *ctx,       /* First argument to sqlite3_result_...() */
  2716   2727     int i                       /* Which column to return */
  2717   2728   ){
  2718   2729     fsdir_cursor *pCur = (fsdir_cursor*)cur;
  2719   2730     switch( i ){
  2720         -    case 0: { /* name */
         2731  +    case FSDIR_COLUMN_NAME: {
  2721   2732         sqlite3_result_text(ctx, &pCur->zPath[pCur->nBase], -1, SQLITE_TRANSIENT);
  2722   2733         break;
  2723   2734       }
  2724   2735   
  2725         -    case 1: /* mode */
         2736  +    case FSDIR_COLUMN_MODE:
  2726   2737         sqlite3_result_int64(ctx, pCur->sStat.st_mode);
  2727   2738         break;
  2728   2739   
  2729         -    case 2: /* mtime */
         2740  +    case FSDIR_COLUMN_MTIME:
  2730   2741         sqlite3_result_int64(ctx, pCur->sStat.st_mtime);
  2731   2742         break;
  2732   2743   
  2733         -    case 3: { /* data */
         2744  +    case FSDIR_COLUMN_DATA: {
  2734   2745         mode_t m = pCur->sStat.st_mode;
  2735   2746         if( S_ISDIR(m) ){
  2736   2747           sqlite3_result_null(ctx);
  2737   2748   #if !defined(_WIN32) && !defined(WIN32)
  2738   2749         }else if( S_ISLNK(m) ){
  2739   2750           char aStatic[64];
  2740   2751           char *aBuf = aStatic;
................................................................................
  2756   2767           sqlite3_result_text(ctx, aBuf, n, SQLITE_TRANSIENT);
  2757   2768           if( aBuf!=aStatic ) sqlite3_free(aBuf);
  2758   2769   #endif
  2759   2770         }else{
  2760   2771           readFileContents(ctx, pCur->zPath);
  2761   2772         }
  2762   2773       }
         2774  +    case FSDIR_COLUMN_PATH:
         2775  +    default: {
         2776  +      /* The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters.
         2777  +      ** always return their values as NULL */
         2778  +      break;
         2779  +    }
  2763   2780     }
  2764   2781     return SQLITE_OK;
  2765   2782   }
  2766   2783   
  2767   2784   /*
  2768   2785   ** Return the rowid for the current row. In this implementation, the
  2769   2786   ** first row returned is assigned rowid value 1, and each subsequent
................................................................................
  2782   2799   static int fsdirEof(sqlite3_vtab_cursor *cur){
  2783   2800     fsdir_cursor *pCur = (fsdir_cursor*)cur;
  2784   2801     return (pCur->zPath==0);
  2785   2802   }
  2786   2803   
  2787   2804   /*
  2788   2805   ** xFilter callback.
         2806  +**
         2807  +** idxNum==1   PATH parameter only
         2808  +** idxNum==2   Both PATH and DIR supplied
  2789   2809   */
  2790   2810   static int fsdirFilter(
  2791   2811     sqlite3_vtab_cursor *cur, 
  2792   2812     int idxNum, const char *idxStr,
  2793   2813     int argc, sqlite3_value **argv
  2794   2814   ){
  2795   2815     const char *zDir = 0;
................................................................................
  2834   2854   ** that uses the generate_series virtual table.  This routine needs to create
  2835   2855   ** a query plan for each invocation and compute an estimated cost for that
  2836   2856   ** plan.
  2837   2857   **
  2838   2858   ** In this implementation idxNum is used to represent the
  2839   2859   ** query plan.  idxStr is unused.
  2840   2860   **
  2841         -** The query plan is represented by bits in idxNum:
         2861  +** The query plan is represented by values of idxNum:
  2842   2862   **
  2843         -**  (1)  start = $value  -- constraint exists
  2844         -**  (2)  stop = $value   -- constraint exists
  2845         -**  (4)  step = $value   -- constraint exists
  2846         -**  (8)  output in descending order
         2863  +**  (1)  The path value is supplied by argv[0]
         2864  +**  (2)  Path is in argv[0] and dir is in argv[1]
  2847   2865   */
  2848   2866   static int fsdirBestIndex(
  2849   2867     sqlite3_vtab *tab,
  2850   2868     sqlite3_index_info *pIdxInfo
  2851   2869   ){
  2852   2870     int i;                 /* Loop over constraints */
  2853         -  int idx4 = -1;
  2854         -  int idx5 = -1;
         2871  +  int idxPath = -1;      /* Index in pIdxInfo->aConstraint of PATH= */
         2872  +  int idxDir = -1;       /* Index in pIdxInfo->aConstraint of DIR= */
         2873  +  int seenPath = 0;      /* True if an unusable PATH= constraint is seen */
         2874  +  int seenDir = 0;       /* True if an unusable DIR= constraint is seen */
  2855   2875     const struct sqlite3_index_constraint *pConstraint;
  2856   2876   
  2857   2877     (void)tab;
  2858   2878     pConstraint = pIdxInfo->aConstraint;
  2859   2879     for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
  2860         -    if( pConstraint->usable==0 ) continue;
  2861   2880       if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
  2862         -    if( pConstraint->iColumn==4 ) idx4 = i;
  2863         -    if( pConstraint->iColumn==5 ) idx5 = i;
         2881  +    switch( pConstraint->iColumn ){
         2882  +      case FSDIR_COLUMN_PATH: {
         2883  +        if( pConstraint->usable ){
         2884  +          idxPath = i;
         2885  +          seenPath = 0;
         2886  +        }else if( idxPath<0 ){
         2887  +          seenPath = 1;
         2888  +        }
         2889  +        break;
         2890  +      }
         2891  +      case FSDIR_COLUMN_DIR: {
         2892  +        if( pConstraint->usable ){
         2893  +          idxDir = i;
         2894  +          seenDir = 0;
         2895  +        }else if( idxDir<0 ){
         2896  +          seenDir = 1;
         2897  +        }
         2898  +        break;
         2899  +      }
         2900  +    } 
         2901  +  }
         2902  +  if( seenPath || seenDir ){
         2903  +    /* If input parameters are unusable, disallow this plan */
         2904  +    return SQLITE_CONSTRAINT;
  2864   2905     }
  2865   2906   
  2866         -  if( idx4<0 ){
         2907  +  if( idxPath<0 ){
  2867   2908       pIdxInfo->idxNum = 0;
  2868         -    pIdxInfo->estimatedCost = (double)(((sqlite3_int64)1) << 50);
         2909  +    /* The pIdxInfo->estimatedCost should have been initialized to a huge
         2910  +    ** number.  Leave it unchanged. */
         2911  +    pIdxInfo->estimatedRows = 0x7fffffff;
  2869   2912     }else{
  2870         -    pIdxInfo->aConstraintUsage[idx4].omit = 1;
  2871         -    pIdxInfo->aConstraintUsage[idx4].argvIndex = 1;
  2872         -    if( idx5>=0 ){
  2873         -      pIdxInfo->aConstraintUsage[idx5].omit = 1;
  2874         -      pIdxInfo->aConstraintUsage[idx5].argvIndex = 2;
         2913  +    pIdxInfo->aConstraintUsage[idxPath].omit = 1;
         2914  +    pIdxInfo->aConstraintUsage[idxPath].argvIndex = 1;
         2915  +    if( idxDir>=0 ){
         2916  +      pIdxInfo->aConstraintUsage[idxDir].omit = 1;
         2917  +      pIdxInfo->aConstraintUsage[idxDir].argvIndex = 2;
  2875   2918         pIdxInfo->idxNum = 2;
  2876   2919         pIdxInfo->estimatedCost = 10.0;
  2877   2920       }else{
  2878   2921         pIdxInfo->idxNum = 1;
  2879   2922         pIdxInfo->estimatedCost = 100.0;
  2880   2923       }
  2881   2924     }
................................................................................
  5313   5356   ** xBestIndex callback.
  5314   5357   */
  5315   5358   static int zipfileBestIndex(
  5316   5359     sqlite3_vtab *tab,
  5317   5360     sqlite3_index_info *pIdxInfo
  5318   5361   ){
  5319   5362     int i;
         5363  +  int idx = -1;
         5364  +  int unusable = 0;
  5320   5365   
  5321   5366     for(i=0; i<pIdxInfo->nConstraint; i++){
  5322   5367       const struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i];
  5323         -    if( pCons->usable==0 ) continue;
  5324         -    if( pCons->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
  5325   5368       if( pCons->iColumn!=ZIPFILE_F_COLUMN_IDX ) continue;
  5326         -    break;
         5369  +    if( pCons->usable==0 ){
         5370  +      unusable = 1;
         5371  +    }else if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ ){
         5372  +      idx = i;
         5373  +    }
  5327   5374     }
  5328         -
  5329         -  if( i<pIdxInfo->nConstraint ){
  5330         -    pIdxInfo->aConstraintUsage[i].argvIndex = 1;
  5331         -    pIdxInfo->aConstraintUsage[i].omit = 1;
         5375  +  if( idx>=0 ){
         5376  +    pIdxInfo->aConstraintUsage[idx].argvIndex = 1;
         5377  +    pIdxInfo->aConstraintUsage[idx].omit = 1;
  5332   5378       pIdxInfo->estimatedCost = 1000.0;
  5333   5379       pIdxInfo->idxNum = 1;
  5334         -  }else{
  5335         -    pIdxInfo->estimatedCost = (double)(((sqlite3_int64)1) << 50);
  5336         -    pIdxInfo->idxNum = 0;
         5380  +  }else if( unusable ){
         5381  +    return SQLITE_CONSTRAINT;
  5337   5382     }
  5338         -
  5339   5383     return SQLITE_OK;
  5340   5384   }
  5341   5385   
  5342   5386   static ZipfileEntry *zipfileNewEntry(const char *zPath){
  5343   5387     ZipfileEntry *pNew;
  5344   5388     pNew = sqlite3_malloc(sizeof(ZipfileEntry));
  5345   5389     if( pNew ){
................................................................................
 15177  15221         { "always",             SQLITE_TESTCTRL_ALWAYS,        "BOOLEAN"            },
 15178  15222         { "assert",             SQLITE_TESTCTRL_ASSERT,        "BOOLEAN"            },
 15179  15223       /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, ""          },*/
 15180  15224       /*{ "bitvec_test",        SQLITE_TESTCTRL_BITVEC_TEST,   ""                },*/
 15181  15225         { "byteorder",          SQLITE_TESTCTRL_BYTEORDER,     ""                   },
 15182  15226       /*{ "fault_install",      SQLITE_TESTCTRL_FAULT_INSTALL, ""                }, */
 15183  15227         { "imposter",           SQLITE_TESTCTRL_IMPOSTER,   "SCHEMA ON/OFF ROOTPAGE"},
        15228  +      { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN"       },
 15184  15229         { "localtime_fault",    SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN"           },
 15185  15230         { "never_corrupt",      SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN"            },
 15186  15231         { "optimizations",      SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK"       },
 15187  15232   #ifdef YYCOVERAGE
 15188  15233         { "parser_coverage",    SQLITE_TESTCTRL_PARSER_COVERAGE, ""                 },
 15189  15234   #endif
 15190  15235         { "pending_byte",       SQLITE_TESTCTRL_PENDING_BYTE,  "OFFSET  "           },
................................................................................
 15271  15316               isOk = 3;
 15272  15317             }
 15273  15318             break;
 15274  15319   
 15275  15320           /* sqlite3_test_control(int, int) */
 15276  15321           case SQLITE_TESTCTRL_ASSERT:
 15277  15322           case SQLITE_TESTCTRL_ALWAYS:
        15323  +        case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS:
 15278  15324             if( nArg==3 ){
 15279  15325               int opt = booleanValue(azArg[2]);
 15280  15326               rc2 = sqlite3_test_control(testctrl, opt);
 15281  15327               isOk = 1;
 15282  15328             }
 15283  15329             break;
 15284  15330   
................................................................................
 15565  15611   /*
 15566  15612   ** We need a default sqlite3_complete() implementation to use in case
 15567  15613   ** the shell is compiled with SQLITE_OMIT_COMPLETE.  The default assumes
 15568  15614   ** any arbitrary text is a complete SQL statement.  This is not very
 15569  15615   ** user-friendly, but it does seem to work.
 15570  15616   */
 15571  15617   #ifdef SQLITE_OMIT_COMPLETE
 15572         -int sqlite3_complete(const char *zSql){ return 1; }
        15618  +#define sqlite3_complete(x) 1
 15573  15619   #endif
 15574  15620   
 15575  15621   /*
 15576  15622   ** Return true if zSql is a complete SQL statement.  Return false if it
 15577  15623   ** ends in the middle of a string literal or C-style comment.
 15578  15624   */
 15579  15625   static int line_is_complete(char *zSql, int nSql){

Changes to src/skins.c.

   457    457     const char *zCurrent = 0;  /* Current skin */
   458    458     int i;                     /* Loop counter */
   459    459     Stmt q;
   460    460     int seenCurrent = 0;
   461    461     int once;
   462    462   
   463    463     login_check_credentials();
   464         -  if( !g.perm.Setup ){
          464  +  if( !g.perm.Admin ){
   465    465       login_needed(0);
   466    466       return;
   467    467     }
   468    468     db_begin_transaction();
   469    469     zCurrent = getSkin(0);
   470    470     for(i=0; i<count(aBuiltinSkin); i++){
   471    471       aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
................................................................................
   691    691   }
   692    692   
   693    693   
   694    694   /*
   695    695   ** WEBPAGE: setup_skinedit
   696    696   **
   697    697   ** Edit aspects of a skin determined by the w= query parameter.
   698         -** Requires Setup privileges.
          698  +** Requires Admin or Setup privileges.
   699    699   **
   700    700   **    w=NUM     -- 0=CSS, 1=footer, 2=header, 3=details, 4=js
   701    701   **    sk=NUM    -- the draft skin number
   702    702   */
   703    703   void setup_skinedit(void){
   704    704     static const struct sSkinAddr {
   705    705       const char *zFile;
................................................................................
   728    728     login_check_credentials();
   729    729   
   730    730     /* Figure out which skin we are editing */
   731    731     iSkin = atoi(PD("sk","1"));
   732    732     if( iSkin<1 || iSkin>9 ) iSkin = 1;
   733    733   
   734    734     /* Check that the user is authorized to edit this skin. */
   735         -  if( !g.perm.Setup ){
          735  +  if( !g.perm.Admin ){
   736    736       char *zAllowedEditors = "";
   737    737       Glob *pAllowedEditors;
   738    738       int isMatch = 0;
   739    739       if( login_is_individual() ){
   740    740         zAllowedEditors = db_get_mprintf("", "draft%d-users", iSkin);
   741    741       }
   742    742       if( zAllowedEditors[0] ){
................................................................................
   901    901     */
   902    902     login_check_credentials();
   903    903     if( !login_is_individual() ){
   904    904       login_needed(0);
   905    905       return;
   906    906     }
   907    907     zAllowedEditors = db_get_mprintf("", "draft%d-users", iSkin);
   908         -  if( g.perm.Setup ){
          908  +  if( g.perm.Admin ){
   909    909       isSetup = isEditor = 1;
   910    910     }else{
   911    911       Glob *pAllowedEditors;
   912    912       isSetup = isEditor = 0;
   913    913       if( zAllowedEditors[0] ){
   914    914         pAllowedEditors = glob_create(zAllowedEditors);
   915    915         isEditor = glob_match(pAllowedEditors, g.zLogin);
................................................................................
  1055   1055     @ <p>Repeat <a href='#step4'>step 4</a> and
  1056   1056     @ <a href='#step5'>step 5</a> as many times as necessary to create
  1057   1057     @ a production-ready skin.
  1058   1058     @
  1059   1059     @ <a name='step7'></a>
  1060   1060     @ <h1>Step 7: Publish</h1>
  1061   1061     @
  1062         -  if( !g.perm.Setup ){
         1062  +  if( !g.perm.Admin ){
  1063   1063       @ <p>Only administrators are allowed to publish draft skins.  Contact
  1064   1064       @ an administrator to get this "draft%d(iSkin)" skin published.</p>
  1065   1065     }else{
  1066   1066       @ <p>When the draft%d(iSkin) skin is ready for production use,
  1067   1067       @ make it the default scan by clicking the acknowledgements and
  1068   1068       @ pressing the button below:</p>
  1069   1069       @
................................................................................
  1080   1080       @ <p>You will probably need to press Reload on your browser after
  1081   1081       @ publishing the new skin.</p>
  1082   1082     }
  1083   1083     @
  1084   1084     @ <a name='step8'></a>
  1085   1085     @ <h1>Step 8: Cleanup and Undo Actions</h1>
  1086   1086     @
  1087         -  if( !g.perm.Setup ){
         1087  +  if( !g.perm.Admin ){
  1088   1088       @ <p>Administrators can optionally save or restore legacy skins, and/or
  1089   1089       @ undo a prior publish.
  1090   1090     }else{
  1091   1091       @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page
  1092   1092       @ for cleanup and recovery actions.
  1093   1093     }
  1094   1094     style_load_one_js_file("skin.js");
  1095   1095     style_footer();
  1096   1096   }

Changes to src/sqlite3.c.

  1160   1160   **
  1161   1161   ** See also: [sqlite3_libversion()],
  1162   1162   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
  1163   1163   ** [sqlite_version()] and [sqlite_source_id()].
  1164   1164   */
  1165   1165   #define SQLITE_VERSION        "3.26.0"
  1166   1166   #define SQLITE_VERSION_NUMBER 3026000
  1167         -#define SQLITE_SOURCE_ID      "2018-11-12 15:20:44 f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a040352513"
         1167  +#define SQLITE_SOURCE_ID      "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
  1168   1168   
  1169   1169   /*
  1170   1170   ** CAPI3REF: Run-Time Library Version Numbers
  1171   1171   ** KEYWORDS: sqlite3_version sqlite3_sourceid
  1172   1172   **
  1173   1173   ** These interfaces provide the same information as the [SQLITE_VERSION],
  1174   1174   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  4668   4668   ** deplete the limited store of lookaside memory. Future versions of
  4669   4669   ** SQLite may act on this hint differently.
  4670   4670   **
  4671   4671   ** [[SQLITE_PREPARE_NORMALIZE]] ^(<dt>SQLITE_PREPARE_NORMALIZE</dt>
  4672   4672   ** <dd>The SQLITE_PREPARE_NORMALIZE flag indicates that a normalized
  4673   4673   ** representation of the SQL statement should be calculated and then
  4674   4674   ** associated with the prepared statement, which can be obtained via
  4675         -** the [sqlite3_normalized_sql()] interface.  The semantics used to
         4675  +** the [sqlite3_normalized_sql()] interface.)^  The semantics used to
  4676   4676   ** normalize a SQL statement are unspecified and subject to change.
  4677   4677   ** At a minimum, literal values will be replaced with suitable
  4678   4678   ** placeholders.
  4679   4679   ** </dl>
  4680   4680   */
  4681   4681   #define SQLITE_PREPARE_PERSISTENT              0x01
  4682   4682   #define SQLITE_PREPARE_NORMALIZE               0x02
................................................................................
  8277   8277   #define SQLITE_TESTCTRL_PENDING_BYTE            11
  8278   8278   #define SQLITE_TESTCTRL_ASSERT                  12
  8279   8279   #define SQLITE_TESTCTRL_ALWAYS                  13
  8280   8280   #define SQLITE_TESTCTRL_RESERVE                 14
  8281   8281   #define SQLITE_TESTCTRL_OPTIMIZATIONS           15
  8282   8282   #define SQLITE_TESTCTRL_ISKEYWORD               16  /* NOT USED */
  8283   8283   #define SQLITE_TESTCTRL_SCRATCHMALLOC           17  /* NOT USED */
         8284  +#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS      17
  8284   8285   #define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
  8285   8286   #define SQLITE_TESTCTRL_EXPLAIN_STMT            19  /* NOT USED */
  8286   8287   #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD    19
  8287   8288   #define SQLITE_TESTCTRL_NEVER_CORRUPT           20
  8288   8289   #define SQLITE_TESTCTRL_VDBE_COVERAGE           21
  8289   8290   #define SQLITE_TESTCTRL_BYTEORDER               22
  8290   8291   #define SQLITE_TESTCTRL_ISINIT                  23
................................................................................
 10459  10460     unsigned int *anQueue;            /* Number of pending entries in the queue */
 10460  10461     int nCoord;                       /* Number of coordinates */
 10461  10462     int iLevel;                       /* Level of current node or entry */
 10462  10463     int mxLevel;                      /* The largest iLevel value in the tree */
 10463  10464     sqlite3_int64 iRowid;             /* Rowid for current entry */
 10464  10465     sqlite3_rtree_dbl rParentScore;   /* Score of parent node */
 10465  10466     int eParentWithin;                /* Visibility of parent node */
 10466         -  int eWithin;                      /* OUT: Visiblity */
        10467  +  int eWithin;                      /* OUT: Visibility */
 10467  10468     sqlite3_rtree_dbl rScore;         /* OUT: Write the score here */
 10468  10469     /* The following fields are only available in 3.8.11 and later */
 10469  10470     sqlite3_value **apSqlParam;       /* Original SQL values of parameters */
 10470  10471   };
 10471  10472   
 10472  10473   /*
 10473  10474   ** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
................................................................................
 15396  15397   
 15397  15398   #ifndef SQLITE_OMIT_WAL
 15398  15399   SQLITE_PRIVATE   int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
 15399  15400   SQLITE_PRIVATE   int sqlite3PagerWalSupported(Pager *pPager);
 15400  15401   SQLITE_PRIVATE   int sqlite3PagerWalCallback(Pager *pPager);
 15401  15402   SQLITE_PRIVATE   int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
 15402  15403   SQLITE_PRIVATE   int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
 15403         -# ifdef SQLITE_DIRECT_OVERFLOW_READ
 15404         -SQLITE_PRIVATE   int sqlite3PagerUseWal(Pager *pPager, Pgno);
 15405         -# endif
 15406  15404   # ifdef SQLITE_ENABLE_SNAPSHOT
 15407  15405   SQLITE_PRIVATE   int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);
 15408  15406   SQLITE_PRIVATE   int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);
 15409  15407   SQLITE_PRIVATE   int sqlite3PagerSnapshotRecover(Pager *pPager);
 15410  15408   SQLITE_PRIVATE   int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
 15411  15409   SQLITE_PRIVATE   void sqlite3PagerSnapshotUnlock(Pager *pPager);
 15412  15410   # endif
 15413         -#else
 15414         -# define sqlite3PagerUseWal(x,y) 0
        15411  +#endif
        15412  +
        15413  +#ifdef SQLITE_DIRECT_OVERFLOW_READ
        15414  +SQLITE_PRIVATE   int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno);
 15415  15415   #endif
 15416  15416   
 15417  15417   #ifdef SQLITE_ENABLE_ZIPVFS
 15418  15418   SQLITE_PRIVATE   int sqlite3PagerWalFramesize(Pager *pPager);
 15419  15419   #endif
 15420  15420   
 15421  15421   /* Functions used to query pager state and configuration. */
................................................................................
 15651  15651   
 15652  15652   /* Return the header size */
 15653  15653   SQLITE_PRIVATE int sqlite3HeaderSizePcache(void);
 15654  15654   SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void);
 15655  15655   
 15656  15656   /* Number of dirty pages as a percentage of the configured cache size */
 15657  15657   SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache*);
        15658  +
        15659  +#ifdef SQLITE_DIRECT_OVERFLOW_READ
        15660  +SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache);
        15661  +#endif
 15658  15662   
 15659  15663   #endif /* _PCACHE_H_ */
 15660  15664   
 15661  15665   /************** End of pcache.h **********************************************/
 15662  15666   /************** Continuing where we left off in sqliteInt.h ******************/
 15663  15667   /************** Include os.h in the middle of sqliteInt.h ********************/
 15664  15668   /************** Begin file os.h **********************************************/
................................................................................
 16535  16539   #define SQLITE_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */
 16536  16540   #define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
 16537  16541   #define SQLITE_FUNC_MINMAX   0x1000 /* True for min() and max() aggregates */
 16538  16542   #define SQLITE_FUNC_SLOCHNG  0x2000 /* "Slow Change". Value constant during a
 16539  16543                                       ** single query - might change over time */
 16540  16544   #define SQLITE_FUNC_AFFINITY 0x4000 /* Built-in affinity() function */
 16541  16545   #define SQLITE_FUNC_OFFSET   0x8000 /* Built-in sqlite_offset() function */
 16542         -#define SQLITE_FUNC_WINDOW  0x10000 /* Built-in window-only function */
 16543         -#define SQLITE_FUNC_WINDOW_SIZE  0x20000  /* Requires partition size as arg. */
        16546  +#define SQLITE_FUNC_WINDOW   0x00010000 /* Built-in window-only function */
        16547  +#define SQLITE_FUNC_WINDOW_SIZE 0x20000 /* Requires partition size as arg. */
        16548  +#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
 16544  16549   
 16545  16550   /*
 16546  16551   ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
 16547  16552   ** used to create the initializers for the FuncDef structures.
 16548  16553   **
 16549  16554   **   FUNCTION(zName, nArg, iArg, bNC, xFunc)
 16550  16555   **     Used to create a scalar function definition of a function zName
................................................................................
 16612  16617      (void *)arg, 0, likeFunc, 0, 0, 0, #zName, {0} }
 16613  16618   #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal, xValue) \
 16614  16619     {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL), \
 16615  16620      SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,xValue,0,#zName, {0}}
 16616  16621   #define AGGREGATE2(zName, nArg, arg, nc, xStep, xFinal, extraFlags) \
 16617  16622     {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|extraFlags, \
 16618  16623      SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,xFinal,0,#zName, {0}}
 16619         -
 16620  16624   #define WAGGREGATE(zName, nArg, arg, nc, xStep, xFinal, xValue, xInverse, f) \
 16621  16625     {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|f, \
 16622  16626      SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,xValue,xInverse,#zName, {0}}
        16627  +#define INTERNAL_FUNCTION(zName, nArg, xFunc) \
        16628  +  {nArg, SQLITE_FUNC_INTERNAL|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \
        16629  +   0, 0, xFunc, 0, 0, 0, #zName, {0} }
        16630  +
 16623  16631   
 16624  16632   /*
 16625  16633   ** All current savepoints are stored in a linked list starting at
 16626  16634   ** sqlite3.pSavepoint. The first element in the list is the most recently
 16627  16635   ** opened savepoint. Savepoints are added to the list by the vdbe
 16628  16636   ** OP_Savepoint instruction.
 16629  16637   */
................................................................................
 18266  18274     void (*xVdbeBranch)(void*,unsigned iSrcLine,u8 eThis,u8 eMx);  /* Callback */
 18267  18275     void *pVdbeBranchArg;                                     /* 1st argument */
 18268  18276   #endif
 18269  18277   #ifndef SQLITE_UNTESTABLE
 18270  18278     int (*xTestCallback)(int);        /* Invoked by sqlite3FaultSim() */
 18271  18279   #endif
 18272  18280     int bLocaltimeFault;              /* True to fail localtime() calls */
        18281  +  int bInternalFunctions;           /* Internal SQL functions are visible */
 18273  18282     int iOnceResetThreshold;          /* When to reset OP_Once counters */
 18274  18283     u32 szSorterRef;                  /* Min size in bytes to use sorter-refs */
 18275  18284   };
 18276  18285   
 18277  18286   /*
 18278  18287   ** This macro is used inside of assert() statements to indicate that
 18279  18288   ** the assert is only valid on a well-formed database.  Instead of:
................................................................................
 19729  19738      0,                         /* xVdbeBranch */
 19730  19739      0,                         /* pVbeBranchArg */
 19731  19740   #endif
 19732  19741   #ifndef SQLITE_UNTESTABLE
 19733  19742      0,                         /* xTestCallback */
 19734  19743   #endif
 19735  19744      0,                         /* bLocaltimeFault */
        19745  +   0,                         /* bInternalFunctions */
 19736  19746      0x7ffffffe,                /* iOnceResetThreshold */
 19737  19747      SQLITE_DEFAULT_SORTERREF_SIZE   /* szSorterRef */
 19738  19748   };
 19739  19749   
 19740  19750   /*
 19741  19751   ** Hash table for global functions - functions common to all
 19742  19752   ** database connections.  After initialization, this table is
................................................................................
 20285  20295   SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
 20286  20296   SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
 20287  20297   
 20288  20298   int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
 20289  20299   SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
 20290  20300   SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
 20291  20301   SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*);
        20302  +#ifndef SQLITE_OMIT_EXPLAIN
 20292  20303   SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*);
        20304  +#endif
 20293  20305   SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*);
 20294  20306   SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int);
 20295  20307   SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*);
 20296  20308   SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*);
 20297  20309   SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
 20298  20310   SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*);
 20299  20311   SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*);
................................................................................
 20324  20336   SQLITE_PRIVATE void sqlite3VdbeMemCast(Mem*,u8,u8);
 20325  20337   SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*);
 20326  20338   SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
 20327  20339   SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
 20328  20340   #ifndef SQLITE_OMIT_WINDOWFUNC
 20329  20341   SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*);
 20330  20342   #endif
        20343  +#ifndef SQLITE_OMIT_EXPLAIN
 20331  20344   SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
        20345  +#endif
 20332  20346   SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
 20333  20347   SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int n);
 20334  20348   SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
 20335  20349   #ifdef SQLITE_DEBUG
 20336  20350   SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame*);
 20337  20351   #endif
 20338  20352   SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void*);      /* Destructor on Mem */
................................................................................
 40673  40687     winceLock local;        /* Locks obtained by this instance of winFile */
 40674  40688     winceLock *shared;      /* Global shared lock memory for the file  */
 40675  40689   #endif
 40676  40690   #if SQLITE_MAX_MMAP_SIZE>0
 40677  40691     int nFetchOut;                /* Number of outstanding xFetch references */
 40678  40692     HANDLE hMap;                  /* Handle for accessing memory mapping */
 40679  40693     void *pMapRegion;             /* Area memory mapped */
 40680         -  sqlite3_int64 mmapSize;       /* Usable size of mapped region */
 40681         -  sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */
        40694  +  sqlite3_int64 mmapSize;       /* Size of mapped region */
 40682  40695     sqlite3_int64 mmapSizeMax;    /* Configured FCNTL_MMAP_SIZE value */
 40683  40696   #endif
 40684  40697   };
 40685  40698   
 40686  40699   /*
 40687  40700   ** The winVfsAppData structure is used for the pAppData member for all of the
 40688  40701   ** Win32 VFS variants.
................................................................................
 43295  43308   */
 43296  43309   static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
 43297  43310     winFile *pFile = (winFile*)id;  /* File handle object */
 43298  43311     int rc = SQLITE_OK;             /* Return code for this function */
 43299  43312     DWORD lastErrno;
 43300  43313   #if SQLITE_MAX_MMAP_SIZE>0
 43301  43314     sqlite3_int64 oldMmapSize;
        43315  +  if( pFile->nFetchOut>0 ){
        43316  +    /* File truncation is a no-op if there are outstanding memory mapped
        43317  +    ** pages.  This is because truncating the file means temporarily unmapping
        43318  +    ** the file, and that might delete memory out from under existing cursors.
        43319  +    **
        43320  +    ** This can result in incremental vacuum not truncating the file,
        43321  +    ** if there is an active read cursor when the incremental vacuum occurs.
        43322  +    ** No real harm comes of this - the database file is not corrupted,
        43323  +    ** though some folks might complain that the file is bigger than it
        43324  +    ** needs to be.
        43325  +    **
        43326  +    ** The only feasible work-around is to defer the truncation until after
        43327  +    ** all references to memory-mapped content are closed.  That is doable,
        43328  +    ** but involves adding a few branches in the common write code path which
        43329  +    ** could slow down normal operations slightly.  Hence, we have decided for
        43330  +    ** now to simply make trancations a no-op if there are pending reads.  We
        43331  +    ** can maybe revisit this decision in the future.
        43332  +    */
        43333  +    return SQLITE_OK;
        43334  +  }
 43302  43335   #endif
 43303  43336   
 43304  43337     assert( pFile );
 43305  43338     SimulateIOError(return SQLITE_IOERR_TRUNCATE);
 43306  43339     OSTRACE(("TRUNCATE pid=%lu, pFile=%p, file=%p, size=%lld, lock=%d\n",
 43307  43340              osGetCurrentProcessId(), pFile, pFile->h, nByte, pFile->locktype));
 43308  43341   
................................................................................
 44723  44756   /*
 44724  44757   ** Cleans up the mapped region of the specified file, if any.
 44725  44758   */
 44726  44759   #if SQLITE_MAX_MMAP_SIZE>0
 44727  44760   static int winUnmapfile(winFile *pFile){
 44728  44761     assert( pFile!=0 );
 44729  44762     OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, pMapRegion=%p, "
 44730         -           "mmapSize=%lld, mmapSizeActual=%lld, mmapSizeMax=%lld\n",
        44763  +           "mmapSize=%lld, mmapSizeMax=%lld\n",
 44731  44764              osGetCurrentProcessId(), pFile, pFile->hMap, pFile->pMapRegion,
 44732         -           pFile->mmapSize, pFile->mmapSizeActual, pFile->mmapSizeMax));
        44765  +           pFile->mmapSize, pFile->mmapSizeMax));
 44733  44766     if( pFile->pMapRegion ){
 44734  44767       if( !osUnmapViewOfFile(pFile->pMapRegion) ){
 44735  44768         pFile->lastErrno = osGetLastError();
 44736  44769         OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, pMapRegion=%p, "
 44737  44770                  "rc=SQLITE_IOERR_MMAP\n", osGetCurrentProcessId(), pFile,
 44738  44771                  pFile->pMapRegion));
 44739  44772         return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
 44740  44773                            "winUnmapfile1", pFile->zPath);
 44741  44774       }
 44742  44775       pFile->pMapRegion = 0;
 44743  44776       pFile->mmapSize = 0;
 44744         -    pFile->mmapSizeActual = 0;
 44745  44777     }
 44746  44778     if( pFile->hMap!=NULL ){
 44747  44779       if( !osCloseHandle(pFile->hMap) ){
 44748  44780         pFile->lastErrno = osGetLastError();
 44749  44781         OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, rc=SQLITE_IOERR_MMAP\n",
 44750  44782                  osGetCurrentProcessId(), pFile, pFile->hMap));
 44751  44783         return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
................................................................................
 44848  44880         /* Log the error, but continue normal operation using xRead/xWrite */
 44849  44881         OSTRACE(("MAP-FILE-MAP pid=%lu, pFile=%p, rc=%s\n",
 44850  44882                  osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
 44851  44883         return SQLITE_OK;
 44852  44884       }
 44853  44885       pFd->pMapRegion = pNew;
 44854  44886       pFd->mmapSize = nMap;
 44855         -    pFd->mmapSizeActual = nMap;
 44856  44887     }
 44857  44888   
 44858  44889     OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n",
 44859  44890              osGetCurrentProcessId(), pFd));
 44860  44891     return SQLITE_OK;
 44861  44892   }
 44862  44893   #endif /* SQLITE_MAX_MMAP_SIZE>0 */
................................................................................
 45650  45681     }
 45651  45682     pFile->lastErrno = NO_ERROR;
 45652  45683     pFile->zPath = zName;
 45653  45684   #if SQLITE_MAX_MMAP_SIZE>0
 45654  45685     pFile->hMap = NULL;
 45655  45686     pFile->pMapRegion = 0;
 45656  45687     pFile->mmapSize = 0;
 45657         -  pFile->mmapSizeActual = 0;
 45658  45688     pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap;
 45659  45689   #endif
 45660  45690   
 45661  45691     OpenCounter(+1);
 45662  45692     return rc;
 45663  45693   }
 45664  45694   
................................................................................
 48370  48400   SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache *pCache){
 48371  48401     PgHdr *pDirty;
 48372  48402     int nDirty = 0;
 48373  48403     int nCache = numberOfCachePages(pCache);
 48374  48404     for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;
 48375  48405     return nCache ? (int)(((i64)nDirty * 100) / nCache) : 0;
 48376  48406   }
        48407  +
        48408  +#ifdef SQLITE_DIRECT_OVERFLOW_READ
        48409  +/* 
        48410  +** Return true if there are one or more dirty pages in the cache. Else false.
        48411  +*/
        48412  +SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache){
        48413  +  return (pCache->pDirty!=0);
        48414  +}
        48415  +#endif
 48377  48416   
 48378  48417   #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
 48379  48418   /*
 48380  48419   ** For all dirty pages currently in the cache, invoke the specified
 48381  48420   ** callback. This is only used if the SQLITE_CHECK_PAGES macro is
 48382  48421   ** defined.
 48383  48422   */
................................................................................
 48494  48533     PgHdr1 *pNext;                 /* Next in hash table chain */
 48495  48534     PCache1 *pCache;               /* Cache that currently owns this page */
 48496  48535     PgHdr1 *pLruNext;              /* Next in LRU list of unpinned pages */
 48497  48536     PgHdr1 *pLruPrev;              /* Previous in LRU list of unpinned pages */
 48498  48537   };
 48499  48538   
 48500  48539   /*
 48501         -** A page is pinned if it is no on the LRU list
        48540  +** A page is pinned if it is not on the LRU list.  To be "pinned" means
        48541  +** that the page is in active use and must not be deallocated.
 48502  48542   */
 48503  48543   #define PAGE_IS_PINNED(p)    ((p)->pLruNext==0)
 48504  48544   #define PAGE_IS_UNPINNED(p)  ((p)->pLruNext!=0)
 48505  48545   
 48506  48546   /* Each page cache (or PCache) belongs to a PGroup.  A PGroup is a set 
 48507  48547   ** of one or more PCaches that are able to recycle each other's unpinned
 48508  48548   ** pages when they are under memory pressure.  A PGroup is an instance of
................................................................................
 51134  51174   **
 51135  51175   ** instead of
 51136  51176   **
 51137  51177   **   if( pPager->jfd->pMethods ){ ...
 51138  51178   */
 51139  51179   #define isOpen(pFd) ((pFd)->pMethods!=0)
 51140  51180   
        51181  +#ifdef SQLITE_DIRECT_OVERFLOW_READ
 51141  51182   /*
 51142         -** Return true if this pager uses a write-ahead log to read page pgno.
 51143         -** Return false if the pager reads pgno directly from the database.
        51183  +** Return true if page pgno can be read directly from the database file
        51184  +** by the b-tree layer. This is the case if:
        51185  +**
        51186  +**   * the database file is open,
        51187  +**   * there are no dirty pages in the cache, and
        51188  +**   * the desired page is not currently in the wal file.
 51144  51189   */
 51145         -#if !defined(SQLITE_OMIT_WAL) && defined(SQLITE_DIRECT_OVERFLOW_READ)
 51146         -SQLITE_PRIVATE int sqlite3PagerUseWal(Pager *pPager, Pgno pgno){
 51147         -  u32 iRead = 0;
 51148         -  int rc;
 51149         -  if( pPager->pWal==0 ) return 0;
 51150         -  rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iRead);
 51151         -  return rc || iRead;
        51190  +SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){
        51191  +  if( pPager->fd->pMethods==0 ) return 0;
        51192  +  if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0;
        51193  +#ifndef SQLITE_OMIT_WAL
        51194  +  if( pPager->pWal ){
        51195  +    u32 iRead = 0;
        51196  +    int rc;
        51197  +    rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iRead);
        51198  +    return (rc==SQLITE_OK && iRead==0);
        51199  +  }
        51200  +#endif
        51201  +  return 1;
 51152  51202   }
 51153  51203   #endif
        51204  +
 51154  51205   #ifndef SQLITE_OMIT_WAL
 51155  51206   # define pagerUseWal(x) ((x)->pWal!=0)
 51156  51207   #else
 51157  51208   # define pagerUseWal(x) 0
 51158  51209   # define pagerRollbackWal(x) 0
 51159  51210   # define pagerWalFrames(v,w,x,y) 0
 51160  51211   # define pagerOpenWalIfPresent(z) SQLITE_OK
................................................................................
 57330  57381   SQLITE_PRIVATE void sqlite3PagerSetCodec(
 57331  57382     Pager *pPager,
 57332  57383     void *(*xCodec)(void*,void*,Pgno,int),
 57333  57384     void (*xCodecSizeChng)(void*,int,int),
 57334  57385     void (*xCodecFree)(void*),
 57335  57386     void *pCodec
 57336  57387   ){
 57337         -  pager_reset(pPager);
 57338         -  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);
        57388  +  if( pPager->xCodecFree ){
        57389  +    pPager->xCodecFree(pPager->pCodec);
        57390  +  }else{
        57391  +    pager_reset(pPager);
        57392  +  }
 57339  57393     pPager->xCodec = pPager->memDb ? 0 : xCodec;
 57340  57394     pPager->xCodecSizeChng = xCodecSizeChng;
 57341  57395     pPager->xCodecFree = xCodecFree;
 57342  57396     pPager->pCodec = pCodec;
 57343  57397     setGetterMethod(pPager);
 57344  57398     pagerReportSize(pPager);
 57345  57399   }
................................................................................
 67637  67691             rc = getOverflowPage(pBt, nextPage, 0, &nextPage);
 67638  67692           }
 67639  67693           offset -= ovflSize;
 67640  67694         }else{
 67641  67695           /* Need to read this page properly. It contains some of the
 67642  67696           ** range of data that is being read (eOp==0) or written (eOp!=0).
 67643  67697           */
 67644         -#ifdef SQLITE_DIRECT_OVERFLOW_READ
 67645         -        sqlite3_file *fd;      /* File from which to do direct overflow read */
 67646         -#endif
 67647  67698           int a = amt;
 67648  67699           if( a + offset > ovflSize ){
 67649  67700             a = ovflSize - offset;
 67650  67701           }
 67651  67702   
 67652  67703   #ifdef SQLITE_DIRECT_OVERFLOW_READ
 67653  67704           /* If all the following are true:
 67654  67705           **
 67655  67706           **   1) this is a read operation, and 
 67656  67707           **   2) data is required from the start of this overflow page, and
 67657         -        **   3) there is no open write-transaction, and
        67708  +        **   3) there are no dirty pages in the page-cache
 67658  67709           **   4) the database is file-backed, and
 67659  67710           **   5) the page is not in the WAL file
 67660  67711           **   6) at least 4 bytes have already been read into the output buffer 
 67661  67712           **
 67662  67713           ** then data can be read directly from the database file into the
 67663  67714           ** output buffer, bypassing the page-cache altogether. This speeds
 67664  67715           ** up loading large records that span many overflow pages.
 67665  67716           */
 67666  67717           if( eOp==0                                             /* (1) */
 67667  67718            && offset==0                                          /* (2) */
 67668         -         && pBt->inTransaction==TRANS_READ                     /* (3) */
 67669         -         && (fd = sqlite3PagerFile(pBt->pPager))->pMethods     /* (4) */
 67670         -         && 0==sqlite3PagerUseWal(pBt->pPager, nextPage)       /* (5) */
        67719  +         && sqlite3PagerDirectReadOk(pBt->pPager, nextPage)    /* (3,4,5) */
 67671  67720            && &pBuf[-4]>=pBufStart                               /* (6) */
 67672  67721           ){
        67722  +          sqlite3_file *fd = sqlite3PagerFile(pBt->pPager);
 67673  67723             u8 aSave[4];
 67674  67724             u8 *aWrite = &pBuf[-4];
 67675  67725             assert( aWrite>=pBufStart );                         /* due to (6) */
 67676  67726             memcpy(aSave, aWrite, 4);
 67677  67727             rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));
 67678  67728             nextPage = get4byte(aWrite);
 67679  67729             memcpy(aWrite, aSave, 4);
................................................................................
 95150  95200           if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
 95151  95201             /* Date/time functions that use 'now', and other functions like
 95152  95202             ** sqlite_version() that might change over time cannot be used
 95153  95203             ** in an index. */
 95154  95204             notValid(pParse, pNC, "non-deterministic functions",
 95155  95205                      NC_IdxExpr|NC_PartIdx);
 95156  95206           }
        95207  +        if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0
        95208  +         && pParse->nested==0
        95209  +         && sqlite3Config.bInternalFunctions==0
        95210  +        ){
        95211  +          /* Internal-use-only functions are disallowed unless the
        95212  +          ** SQL is being compiled using sqlite3NestedParse() */
        95213  +          no_such_func = 1;
        95214  +          pDef = 0;
        95215  +        }
 95157  95216         }
 95158  95217   
 95159  95218         if( 0==IN_RENAME_OBJECT ){
 95160  95219   #ifndef SQLITE_OMIT_WINDOWFUNC
 95161  95220           assert( is_agg==0 || (pDef->funcFlags & SQLITE_FUNC_MINMAX)
 95162  95221             || (pDef->xValue==0 && pDef->xInverse==0)
 95163  95222             || (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize)
................................................................................
102074 102133     }
102075 102134   }
102076 102135   #else
102077 102136   # define renameTokenCheckAll(x,y)
102078 102137   #endif
102079 102138   
102080 102139   /*
102081         -** Add a new RenameToken object mapping parse tree element pPtr into
102082         -** token *pToken to the Parse object currently under construction.
       102140  +** Remember that the parser tree element pPtr was created using
       102141  +** the token pToken.
102083 102142   **
102084         -** Return a copy of pPtr.
       102143  +** In other words, construct a new RenameToken object and add it
       102144  +** to the list of RenameToken objects currently being built up
       102145  +** in pParse->pRename.
       102146  +**
       102147  +** The pPtr argument is returned so that this routine can be used
       102148  +** with tail recursion in tokenExpr() routine, for a small performance
       102149  +** improvement.
102085 102150   */
102086 102151   SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){
102087 102152     RenameToken *pNew;
102088 102153     assert( pPtr || pParse->db->mallocFailed );
102089 102154     renameTokenCheckAll(pParse, pPtr);
102090 102155     pNew = sqlite3DbMallocZero(pParse->db, sizeof(RenameToken));
102091 102156     if( pNew ){
................................................................................
102589 102654   **   8. bTemp:    True if zSql comes from temp schema
102590 102655   **
102591 102656   ** Do a column rename operation on the CREATE statement given in zSql.
102592 102657   ** The iCol-th column (left-most is 0) of table zTable is renamed from zCol
102593 102658   ** into zNew.  The name should be quoted if bQuote is true.
102594 102659   **
102595 102660   ** This function is used internally by the ALTER TABLE RENAME COLUMN command.
102596         -** Though accessible to application code, it is not intended for use by
102597         -** applications.  The existance of this function, and the way it works,
102598         -** is subject to change without notice.
102599         -**
102600         -** If any of the parameters are out-of-bounds, then simply return NULL.
102601         -** An out-of-bounds parameter can only occur when the application calls
102602         -** this function directly.  The parameters will always be well-formed when
102603         -** this routine is invoked by the bytecode for a legitimate ALTER TABLE
102604         -** statement.
       102661  +** It is only accessible to SQL created using sqlite3NestedParse().  It is
       102662  +** not reachable from ordinary SQL passed into sqlite3_prepare().
102605 102663   */
102606 102664   static void renameColumnFunc(
102607 102665     sqlite3_context *context,
102608 102666     int NotUsed,
102609 102667     sqlite3_value **argv
102610 102668   ){
102611 102669     sqlite3 *db = sqlite3_context_db_handle(context);
................................................................................
103005 103063   }
103006 103064   
103007 103065   /*
103008 103066   ** Register built-in functions used to help implement ALTER TABLE
103009 103067   */
103010 103068   SQLITE_PRIVATE void sqlite3AlterFunctions(void){
103011 103069     static FuncDef aAlterTableFuncs[] = {
103012         -    FUNCTION(sqlite_rename_column,  9, 0, 0, renameColumnFunc),
103013         -    FUNCTION(sqlite_rename_table,  7, 0, 0, renameTableFunc),
103014         -    FUNCTION(sqlite_rename_test,  5, 0, 0, renameTableTest),
       103070  +    INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
       103071  +    INTERNAL_FUNCTION(sqlite_rename_table,  7, renameTableFunc),
       103072  +    INTERNAL_FUNCTION(sqlite_rename_test,   5, renameTableTest),
103015 103073     };
103016 103074     sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
103017 103075   }
103018 103076   #endif  /* SQLITE_ALTER_TABLE */
103019 103077   
103020 103078   /************** End of alter.c ***********************************************/
103021 103079   /************** Begin file analyze.c *****************************************/
................................................................................
105056 105114       ** reopen it as a MemDB */
105057 105115       pVfs = sqlite3_vfs_find("memdb");
105058 105116       if( pVfs==0 ) return;
105059 105117       pNew = &db->aDb[db->init.iDb];
105060 105118       if( pNew->pBt ) sqlite3BtreeClose(pNew->pBt);
105061 105119       pNew->pBt = 0;
105062 105120       pNew->pSchema = 0;
105063         -    rc = sqlite3BtreeOpen(pVfs, "x", db, &pNew->pBt, 0, SQLITE_OPEN_MAIN_DB);
       105121  +    rc = sqlite3BtreeOpen(pVfs, "x\0", db, &pNew->pBt, 0, SQLITE_OPEN_MAIN_DB);
105064 105122     }else{
105065 105123       /* This is a real ATTACH
105066 105124       **
105067 105125       ** Check for the following errors:
105068 105126       **
105069 105127       **     * Too many attached databases,
105070 105128       **     * Transaction currently open
................................................................................
106405 106463   /*
106406 106464   ** Erase all schema information from all attached databases (including
106407 106465   ** "main" and "temp") for a single database connection.
106408 106466   */
106409 106467   SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){
106410 106468     int i;
106411 106469     sqlite3BtreeEnterAll(db);
106412         -  assert( db->nSchemaLock==0 );
106413 106470     for(i=0; i<db->nDb; i++){
106414 106471       Db *pDb = &db->aDb[i];
106415 106472       if( pDb->pSchema ){
106416         -      sqlite3SchemaClear(pDb->pSchema);
       106473  +      if( db->nSchemaLock==0 ){
       106474  +        sqlite3SchemaClear(pDb->pSchema);
       106475  +      }else{
       106476  +        DbSetProperty(db, i, DB_ResetWanted);
       106477  +      }
106417 106478       }
106418 106479     }
106419 106480     db->mDbFlags &= ~(DBFLAG_SchemaChange|DBFLAG_SchemaKnownOk);
106420 106481     sqlite3VtabUnlockList(db);
106421 106482     sqlite3BtreeLeaveAll(db);
106422         -  sqlite3CollapseDatabaseArray(db);
       106483  +  if( db->nSchemaLock==0 ){
       106484  +    sqlite3CollapseDatabaseArray(db);
       106485  +  }
106423 106486   }
106424 106487   
106425 106488   /*
106426 106489   ** This routine is called when a commit occurs.
106427 106490   */
106428 106491   SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){
106429 106492     db->mDbFlags &= ~DBFLAG_SchemaChange;
................................................................................
107755 107818       assert( pTab->nCol==j );
107756 107819     }else{
107757 107820       pPk->nColumn = pTab->nCol;
107758 107821     }
107759 107822     recomputeColumnsNotIndexed(pPk);
107760 107823   }
107761 107824   
       107825  +#ifndef SQLITE_OMIT_VIRTUALTABLE
107762 107826   /*
107763 107827   ** Return true if zName is a shadow table name in the current database
107764 107828   ** connection.
107765 107829   **
107766 107830   ** zName is temporarily modified while this routine is running, but is
107767 107831   ** restored to its original value prior to this routine returning.
107768 107832   */
................................................................................
107780 107844     if( !IsVirtual(pTab) ) return 0;
107781 107845     pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]);
107782 107846     if( pMod==0 ) return 0;
107783 107847     if( pMod->pModule->iVersion<3 ) return 0;
107784 107848     if( pMod->pModule->xShadowName==0 ) return 0;
107785 107849     return pMod->pModule->xShadowName(zTail+1);
107786 107850   }
       107851  +#else
       107852  +# define isShadowTableName(x,y) 0
       107853  +#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
107787 107854   
107788 107855   /*
107789 107856   ** This routine is called to report the final ")" that terminates
107790 107857   ** a CREATE TABLE statement.
107791 107858   **
107792 107859   ** The table structure that other action routines have been building
107793 107860   ** is added to the internal hash tables, assuming no errors have
................................................................................
111067 111134     }
111068 111135     if( (pTab->tabFlags & (TF_Readonly|TF_Shadow))==0 ) return 0;
111069 111136     db = pParse->db;
111070 111137     if( (pTab->tabFlags & TF_Readonly)!=0 ){
111071 111138       return sqlite3WritableSchema(db)==0 && pParse->nested==0;
111072 111139     }
111073 111140     assert( pTab->tabFlags & TF_Shadow );
111074         -  return (db->flags & SQLITE_Defensive)!=0
111075         -           && db->nVdbeExec==0
111076         -           && db->pVtabCtx==0;
       111141  +  return (db->flags & SQLITE_Defensive)!=0 
       111142  +#ifndef SQLITE_OMIT_VIRTUALTABLE
       111143  +          && db->pVtabCtx==0
       111144  +#endif
       111145  +          && db->nVdbeExec==0;
111077 111146   }
111078 111147   
111079 111148   /*
111080 111149   ** Check to make sure the given table is writable.  If it is not
111081 111150   ** writable, generate an error message and return 1.  If it is
111082 111151   ** writable return 0;
111083 111152   */
................................................................................
118700 118769   
118701 118770   #ifdef SQLITE_OMIT_VIRTUALTABLE
118702 118771   # define sqlite3_create_module 0
118703 118772   # define sqlite3_create_module_v2 0
118704 118773   # define sqlite3_declare_vtab 0
118705 118774   # define sqlite3_vtab_config 0
118706 118775   # define sqlite3_vtab_on_conflict 0
       118776  +# define sqlite3_vtab_collation 0
118707 118777   #endif
118708 118778   
118709 118779   #ifdef SQLITE_OMIT_SHARED_CACHE
118710 118780   # define sqlite3_enable_shared_cache 0
118711 118781   #endif
118712 118782   
118713 118783   #if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED)
................................................................................
121202 121272     ** dflt_value: The default value for the column, if any.
121203 121273     ** pk:         Non-zero for PK fields.
121204 121274     */
121205 121275     case PragTyp_TABLE_INFO: if( zRight ){
121206 121276       Table *pTab;
121207 121277       pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb);
121208 121278       if( pTab ){
       121279  +      int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
121209 121280         int i, k;
121210 121281         int nHidden = 0;
121211 121282         Column *pCol;
121212 121283         Index *pPk = sqlite3PrimaryKeyIndex(pTab);
121213 121284         pParse->nMem = 7;
121214         -      sqlite3CodeVerifySchema(pParse, iDb);
       121285  +      sqlite3CodeVerifySchema(pParse, iTabDb);
121215 121286         sqlite3ViewGetColumnNames(pParse, pTab);
121216 121287         for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
121217 121288           int isHidden = IsHiddenColumn(pCol);
121218 121289           if( isHidden && pPragma->iArg==0 ){
121219 121290             nHidden++;
121220 121291             continue;
121221 121292           }
................................................................................
121268 121339   #endif
121269 121340   
121270 121341     case PragTyp_INDEX_INFO: if( zRight ){
121271 121342       Index *pIdx;
121272 121343       Table *pTab;
121273 121344       pIdx = sqlite3FindIndex(db, zRight, zDb);
121274 121345       if( pIdx ){
       121346  +      int iIdxDb = sqlite3SchemaToIndex(db, pIdx->pSchema);
121275 121347         int i;
121276 121348         int mx;
121277 121349         if( pPragma->iArg ){
121278 121350           /* PRAGMA index_xinfo (newer version with more rows and columns) */
121279 121351           mx = pIdx->nColumn;
121280 121352           pParse->nMem = 6;
121281 121353         }else{
121282 121354           /* PRAGMA index_info (legacy version) */
121283 121355           mx = pIdx->nKeyCol;
121284 121356           pParse->nMem = 3;
121285 121357         }
121286 121358         pTab = pIdx->pTable;
121287         -      sqlite3CodeVerifySchema(pParse, iDb);
       121359  +      sqlite3CodeVerifySchema(pParse, iIdxDb);
121288 121360         assert( pParse->nMem<=pPragma->nPragCName );
121289 121361         for(i=0; i<mx; i++){
121290 121362           i16 cnum = pIdx->aiColumn[i];
121291 121363           sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,
121292 121364                                cnum<0 ? 0 : pTab->aCol[cnum].zName);
121293 121365           if( pPragma->iArg ){
121294 121366             sqlite3VdbeMultiLoad(v, 4, "isiX",
................................................................................
121304 121376   
121305 121377     case PragTyp_INDEX_LIST: if( zRight ){
121306 121378       Index *pIdx;
121307 121379       Table *pTab;
121308 121380       int i;
121309 121381       pTab = sqlite3FindTable(db, zRight, zDb);
121310 121382       if( pTab ){
       121383  +      int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
121311 121384         pParse->nMem = 5;
121312         -      sqlite3CodeVerifySchema(pParse, iDb);
       121385  +      sqlite3CodeVerifySchema(pParse, iTabDb);
121313 121386         for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
121314 121387           const char *azOrigin[] = { "c", "u", "pk" };
121315 121388           sqlite3VdbeMultiLoad(v, 1, "isisi",
121316 121389              i,
121317 121390              pIdx->zName,
121318 121391              IsUniqueIndex(pIdx),
121319 121392              azOrigin[pIdx->idxType],
................................................................................
121352 121425     case PragTyp_FUNCTION_LIST: {
121353 121426       int i;
121354 121427       HashElem *j;
121355 121428       FuncDef *p;
121356 121429       pParse->nMem = 2;
121357 121430       for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
121358 121431         for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
       121432  +        if( p->funcFlags & SQLITE_FUNC_INTERNAL ) continue;
121359 121433           sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);
121360 121434         }
121361 121435       }
121362 121436       for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){
121363 121437         p = (FuncDef*)sqliteHashData(j);
121364 121438         sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0);
121365 121439       }
................................................................................
121393 121467     case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
121394 121468       FKey *pFK;
121395 121469       Table *pTab;
121396 121470       pTab = sqlite3FindTable(db, zRight, zDb);
121397 121471       if( pTab ){
121398 121472         pFK = pTab->pFKey;
121399 121473         if( pFK ){
       121474  +        int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
121400 121475           int i = 0; 
121401 121476           pParse->nMem = 8;
121402         -        sqlite3CodeVerifySchema(pParse, iDb);
       121477  +        sqlite3CodeVerifySchema(pParse, iTabDb);
121403 121478           while(pFK){
121404 121479             int j;
121405 121480             for(j=0; j<pFK->nCol; j++){
121406 121481               sqlite3VdbeMultiLoad(v, 1, "iissssss",
121407 121482                      i,
121408 121483                      j,
121409 121484                      pFK->zTo,
................................................................................
121440 121515       int addrOk;            /* Jump here if the key is OK */
121441 121516       int *aiCols;           /* child to parent column mapping */
121442 121517   
121443 121518       regResult = pParse->nMem+1;
121444 121519       pParse->nMem += 4;
121445 121520       regKey = ++pParse->nMem;
121446 121521       regRow = ++pParse->nMem;
121447         -    sqlite3CodeVerifySchema(pParse, iDb);
121448 121522       k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
121449 121523       while( k ){
       121524  +      int iTabDb;
121450 121525         if( zRight ){
121451 121526           pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);
121452 121527           k = 0;
121453 121528         }else{
121454 121529           pTab = (Table*)sqliteHashData(k);
121455 121530           k = sqliteHashNext(k);
121456 121531         }
121457 121532         if( pTab==0 || pTab->pFKey==0 ) continue;
121458         -      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
       121533  +      iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
       121534  +      sqlite3CodeVerifySchema(pParse, iTabDb);
       121535  +      sqlite3TableLock(pParse, iTabDb, pTab->tnum, 0, pTab->zName);
121459 121536         if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
121460         -      sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
       121537  +      sqlite3OpenTable(pParse, 0, iTabDb, pTab, OP_OpenRead);
121461 121538         sqlite3VdbeLoadString(v, regResult, pTab->zName);
121462 121539         for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
121463 121540           pParent = sqlite3FindTable(db, pFK->zTo, zDb);
121464 121541           if( pParent==0 ) continue;
121465 121542           pIdx = 0;
121466         -        sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName);
       121543  +        sqlite3TableLock(pParse, iTabDb, pParent->tnum, 0, pParent->zName);
121467 121544           x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0);
121468 121545           if( x==0 ){
121469 121546             if( pIdx==0 ){
121470         -            sqlite3OpenTable(pParse, i, iDb, pParent, OP_OpenRead);
       121547  +            sqlite3OpenTable(pParse, i, iTabDb, pParent, OP_OpenRead);
121471 121548             }else{
121472         -            sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iDb);
       121549  +            sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iTabDb);
121473 121550               sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
121474 121551             }
121475 121552           }else{
121476 121553             k = 0;
121477 121554             break;
121478 121555           }
121479 121556         }
................................................................................
140164 140241   
140165 140242   /*
140166 140243   ** The table object reference passed as the second argument to this function
140167 140244   ** must represent a virtual table. This function invokes the xBestIndex()
140168 140245   ** method of the virtual table with the sqlite3_index_info object that
140169 140246   ** comes in as the 3rd argument to this function.
140170 140247   **
140171         -** If an error occurs, pParse is populated with an error message and a
140172         -** non-zero value is returned. Otherwise, 0 is returned and the output
140173         -** part of the sqlite3_index_info structure is left populated.
       140248  +** If an error occurs, pParse is populated with an error message and an
       140249  +** appropriate error code is returned.  A return of SQLITE_CONSTRAINT from
       140250  +** xBestIndex is not considered an error.  SQLITE_CONSTRAINT indicates that
       140251  +** the current configuration of "unusable" flags in sqlite3_index_info can
       140252  +** not result in a valid plan.
140174 140253   **
140175 140254   ** Whether or not an error is returned, it is the responsibility of the
140176 140255   ** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates
140177 140256   ** that this is required.
140178 140257   */
140179 140258   static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
140180 140259     sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
140181 140260     int rc;
140182 140261   
140183 140262     TRACE_IDX_INPUTS(p);
140184 140263     rc = pVtab->pModule->xBestIndex(pVtab, p);
140185 140264     TRACE_IDX_OUTPUTS(p);
140186 140265   
140187         -  if( rc!=SQLITE_OK ){
       140266  +  if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){
140188 140267       if( rc==SQLITE_NOMEM ){
140189 140268         sqlite3OomFault(pParse->db);
140190 140269       }else if( !pVtab->zErrMsg ){
140191 140270         sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
140192 140271       }else{
140193 140272         sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
140194 140273       }
140195 140274     }
140196 140275     sqlite3_free(pVtab->zErrMsg);
140197 140276     pVtab->zErrMsg = 0;
140198         -
140199         -#if 0
140200         -  /* This error is now caught by the caller.
140201         -  ** Search for "xBestIndex malfunction" below */
140202         -  for(i=0; i<p->nConstraint; i++){
140203         -    if( !p->aConstraint[i].usable && p->aConstraintUsage[i].argvIndex>0 ){
140204         -      sqlite3ErrorMsg(pParse, 
140205         -          "table %s: xBestIndex returned an invalid plan", pTab->zName);
140206         -    }
140207         -  }
140208         -#endif
140209         -
140210         -  return pParse->nErr;
       140277  +  return rc;
140211 140278   }
140212 140279   #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
140213 140280   
140214 140281   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
140215 140282   /*
140216 140283   ** Estimate the location of a particular key among all keys in an
140217 140284   ** index.  Store the results in aStat as follows:
................................................................................
142276 142343     pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2;
142277 142344     pIdxInfo->estimatedRows = 25;
142278 142345     pIdxInfo->idxFlags = 0;
142279 142346     pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed;
142280 142347   
142281 142348     /* Invoke the virtual table xBestIndex() method */
142282 142349     rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo);
142283         -  if( rc ) return rc;
       142350  +  if( rc ){
       142351  +    if( rc==SQLITE_CONSTRAINT ){
       142352  +      /* If the xBestIndex method returns SQLITE_CONSTRAINT, that means
       142353  +      ** that the particular combination of parameters provided is unusable.
       142354  +      ** Make no entries in the loop table.
       142355  +      */
       142356  +      WHERETRACE(0xffff, ("  ^^^^--- non-viable plan rejected!\n"));
       142357  +      return SQLITE_OK;
       142358  +    }
       142359  +    return rc;
       142360  +  }
142284 142361   
142285 142362     mxTerm = -1;
142286 142363     assert( pNew->nLSlot>=nConstraint );
142287 142364     for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0;
142288 142365     pNew->u.vtab.omitMask = 0;
142289 142366     pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
142290 142367     for(i=0; i<nConstraint; i++, pIdxCons++){
................................................................................
146748 146825   ** of this template is copied straight through into the generate parser
146749 146826   ** source file.
146750 146827   **
146751 146828   ** The following is the concatenation of all %include directives from the
146752 146829   ** input grammar file:
146753 146830   */
146754 146831   /* #include <stdio.h> */
       146832  +/* #include <assert.h> */
146755 146833   /************ Begin %include sections from the grammar ************************/
146756 146834   
146757 146835   /* #include "sqliteInt.h" */
146758 146836   
146759 146837   /*
146760 146838   ** Disable all error recovery processing in the parser push-down
146761 146839   ** automaton.
................................................................................
147003 147081   #define sqlite3ParserARG_STORE
147004 147082   #define sqlite3ParserCTX_SDECL Parse *pParse;
147005 147083   #define sqlite3ParserCTX_PDECL ,Parse *pParse
147006 147084   #define sqlite3ParserCTX_PARAM ,pParse
147007 147085   #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
147008 147086   #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
147009 147087   #define YYFALLBACK 1
147010         -#define YYNSTATE             525
       147088  +#define YYNSTATE             521
147011 147089   #define YYNRULE              367
147012 147090   #define YYNTOKEN             155
147013         -#define YY_MAX_SHIFT         524
147014         -#define YY_MIN_SHIFTREDUCE   760
147015         -#define YY_MAX_SHIFTREDUCE   1126
147016         -#define YY_ERROR_ACTION      1127
147017         -#define YY_ACCEPT_ACTION     1128
147018         -#define YY_NO_ACTION         1129
147019         -#define YY_MIN_REDUCE        1130
147020         -#define YY_MAX_REDUCE        1496
       147091  +#define YY_MAX_SHIFT         520
       147092  +#define YY_MIN_SHIFTREDUCE   756
       147093  +#define YY_MAX_SHIFTREDUCE   1122
       147094  +#define YY_ERROR_ACTION      1123
       147095  +#define YY_ACCEPT_ACTION     1124
       147096  +#define YY_NO_ACTION         1125
       147097  +#define YY_MIN_REDUCE        1126
       147098  +#define YY_MAX_REDUCE        1492
147021 147099   /************* End control #defines *******************************************/
147022 147100   #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
147023 147101   
147024 147102   /* Define the yytestcase() macro to be a no-op if is not already defined
147025 147103   ** otherwise.
147026 147104   **
147027 147105   ** Applications can choose to define yytestcase() in the %include section
................................................................................
147082 147160   **  yy_reduce_ofst[]   For each state, the offset into yy_action for
147083 147161   **                     shifting non-terminals after a reduce.
147084 147162   **  yy_default[]       Default action for each state.
147085 147163   **
147086 147164   *********** Begin parsing tables **********************************************/
147087 147165   #define YY_ACTTAB_COUNT (2009)
147088 147166   static const YYACTIONTYPE yy_action[] = {
147089         - /*     0 */   372,  105,  102,  197,  105,  102,  197,  519, 1128,    1,
147090         - /*    10 */     1,  524,    2, 1132,  519, 1196, 1175, 1460,  275,  374,
147091         - /*    20 */   127, 1393, 1201, 1201, 1196, 1170,  178, 1209,   64,   64,
147092         - /*    30 */   481,  891,  326,  432,  352,   37,   37,  812,  366,  892,
147093         - /*    40 */   513,  513,  513,  112,  113,  103, 1104, 1104,  957,  960,
147094         - /*    50 */   950,  950,  110,  110,  111,  111,  111,  111,  369,  252,
147095         - /*    60 */   252,  519,  252,  252,  501,  519,  313,  519,  463,  519,
147096         - /*    70 */  1083,  495,  516,  482,    6,  516,  813,  134,  502,  228,
147097         - /*    80 */   194,  432,   37,   37,  519,  208,   64,   64,   64,   64,
       147167  + /*     0 */   368,  105,  102,  197,  105,  102,  197,  515, 1124,    1,
       147168  + /*    10 */     1,  520,    2, 1128,  515, 1192, 1171, 1456,  275,  370,
       147169  + /*    20 */   127, 1389, 1197, 1197, 1192, 1166,  178, 1205,   64,   64,
       147170  + /*    30 */   477,  887,  322,  428,  348,   37,   37,  808,  362,  888,
       147171  + /*    40 */   509,  509,  509,  112,  113,  103, 1100, 1100,  953,  956,
       147172  + /*    50 */   946,  946,  110,  110,  111,  111,  111,  111,  365,  252,
       147173  + /*    60 */   252,  515,  252,  252,  497,  515,  309,  515,  459,  515,
       147174  + /*    70 */  1079,  491,  512,  478,    6,  512,  809,  134,  498,  228,
       147175  + /*    80 */   194,  428,   37,   37,  515,  208,   64,   64,   64,   64,
147098 147176    /*    90 */    13,   13,  109,  109,  109,  109,  108,  108,  107,  107,
147099         - /*   100 */   107,  106,  405,  258,  385,   13,   13,  402,  401,  432,
147100         - /*   110 */   252,  252,  374,  480,  409, 1108, 1083, 1084, 1085,  390,
147101         - /*   120 */  1110,  394,  501,  516,  501, 1427, 1423,  308, 1109,  311,
147102         - /*   130 */  1260,  500,  374,  503,   16,   16,  112,  113,  103, 1104,
147103         - /*   140 */  1104,  957,  960,  950,  950,  110,  110,  111,  111,  111,
147104         - /*   150 */   111,  262, 1111,  499, 1111,  405,  112,  113,  103, 1104,
147105         - /*   160 */  1104,  957,  960,  950,  950,  110,  110,  111,  111,  111,
147106         - /*   170 */   111,  129, 1429,  347, 1424,  343, 1063,  496, 1061,  263,
147107         - /*   180 */    73,  105,  102,  197,  998,  109,  109,  109,  109,  108,
147108         - /*   190 */   108,  107,  107,  107,  106,  405,  374,  111,  111,  111,
147109         - /*   200 */   111,  104,  496,   89, 1436,  109,  109,  109,  109,  108,
147110         - /*   210 */   108,  107,  107,  107,  106,  405,  111,  111,  111,  111,
147111         - /*   220 */   112,  113,  103, 1104, 1104,  957,  960,  950,  950,  110,
       147177  + /*   100 */   107,  106,  401,  258,  381,   13,   13,  398,  397,  428,
       147178  + /*   110 */   252,  252,  370,  476,  405, 1104, 1079, 1080, 1081,  386,
       147179  + /*   120 */  1106,  390,  497,  512,  497, 1423, 1419,  304, 1105,  307,
       147180  + /*   130 */  1256,  496,  370,  499,   16,   16,  112,  113,  103, 1100,
       147181  + /*   140 */  1100,  953,  956,  946,  946,  110,  110,  111,  111,  111,
       147182  + /*   150 */   111,  262, 1107,  495, 1107,  401,  112,  113,  103, 1100,
       147183  + /*   160 */  1100,  953,  956,  946,  946,  110,  110,  111,  111,  111,
       147184  + /*   170 */   111,  129, 1425,  343, 1420,  339, 1059,  492, 1057,  263,
       147185  + /*   180 */    73,  105,  102,  197,  994,  109,  109,  109,  109,  108,
       147186  + /*   190 */   108,  107,  107,  107,  106,  401,  370,  111,  111,  111,
       147187  + /*   200 */   111,  104,  492,   89, 1432,  109,  109,  109,  109,  108,
       147188  + /*   210 */   108,  107,  107,  107,  106,  401,  111,  111,  111,  111,
       147189  + /*   220 */   112,  113,  103, 1100, 1100,  953,  956,  946,  946,  110,
147112 147190    /*   230 */   110,  111,  111,  111,  111,  109,  109,  109,  109,  108,
147113         - /*   240 */   108,  107,  107,  107,  106,  405,  114,  108,  108,  107,
147114         - /*   250 */   107,  107,  106,  405,  109,  109,  109,  109,  108,  108,
147115         - /*   260 */   107,  107,  107,  106,  405,  152,  403,  403,  403,  109,
147116         - /*   270 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  405,
147117         - /*   280 */   178,  497, 1416,  438, 1041, 1490, 1083,  519, 1490,  374,
147118         - /*   290 */   425,  301,  361,  416,   74, 1083,  109,  109,  109,  109,
147119         - /*   300 */   108,  108,  107,  107,  107,  106,  405, 1417,   37,   37,
147120         - /*   310 */  1435,  274,  510,  112,  113,  103, 1104, 1104,  957,  960,
147121         - /*   320 */   950,  950,  110,  110,  111,  111,  111,  111, 1440,  524,
147122         - /*   330 */     2, 1132, 1083, 1084, 1085,  434,  275, 1083,  127,  370,
147123         - /*   340 */   937, 1083, 1084, 1085,  220, 1209,  917,  462,  459,  458,
147124         - /*   350 */   396,  167,  519, 1039,  152,  449,  928,  457,  152,  878,
147125         - /*   360 */   927,  293,  109,  109,  109,  109,  108,  108,  107,  107,
147126         - /*   370 */   107,  106,  405,   13,   13,  261,  857,  252,  252,  227,
147127         - /*   380 */   106,  405,  374, 1083, 1084, 1085,  315,  392, 1083,  300,
147128         - /*   390 */   516,  927,  927,  929,  231,  327, 1259, 1392, 1427,  494,
147129         - /*   400 */   274,  510,   12,  208,  274,  510,  112,  113,  103, 1104,
147130         - /*   410 */  1104,  957,  960,  950,  950,  110,  110,  111,  111,  111,
147131         - /*   420 */   111, 1444,  290, 1132,  292, 1083, 1101,  247,  275, 1102,
147132         - /*   430 */   127,  391,  409,  393, 1083, 1084, 1085, 1209,  159,  238,
147133         - /*   440 */   255,  325,  465,  320,  464,  225,  794,  105,  102,  197,
147134         - /*   450 */   517,  318,  846,  846,  449,  109,  109,  109,  109,  108,
147135         - /*   460 */   108,  107,  107,  107,  106,  405,  519,  518,  519,  252,
147136         - /*   470 */   252, 1083, 1084, 1085,  439,  374, 1102,  937, 1464,  798,
147137         - /*   480 */   274,  510,  516,  105,  102,  197,  340,   63,   63,   64,
147138         - /*   490 */    64,   27,  794,  928,  291,  208, 1358,  927,  519,  112,
147139         - /*   500 */   113,  103, 1104, 1104,  957,  960,  950,  950,  110,  110,
147140         - /*   510 */   111,  111,  111,  111,  107,  107,  107,  106,  405,   49,
147141         - /*   520 */    49,  519,   28, 1083,  409,  501,  425,  301,  927,  927,
147142         - /*   530 */   929,  186,  472, 1083,  471, 1003, 1003,  446,  519, 1083,
147143         - /*   540 */   338,  519,   45,   45, 1087,  346,  173,  168,  109,  109,
147144         - /*   550 */   109,  109,  108,  108,  107,  107,  107,  106,  405,   13,
147145         - /*   560 */    13,  205,   13,   13,  252,  252, 1199, 1199,  374, 1083,
147146         - /*   570 */  1084, 1085,  791,  265,    5,  363,  498,  516,  473, 1083,
147147         - /*   580 */  1084, 1085,  402,  401, 1083, 1083, 1084, 1085,    3,  282,
147148         - /*   590 */  1083, 1087,  112,  113,  103, 1104, 1104,  957,  960,  950,
147149         - /*   600 */   950,  110,  110,  111,  111,  111,  111,  252,  252, 1019,
147150         - /*   610 */   220, 1083,  877,  462,  459,  458,  947,  947,  958,  961,
147151         - /*   620 */   516,  252,  252,  457, 1020, 1083,  449, 1111, 1213, 1111,
147152         - /*   630 */  1083, 1084, 1085,  519,  516,  430, 1083, 1084, 1085, 1021,
147153         - /*   640 */   516,  109,  109,  109,  109,  108,  108,  107,  107,  107,
147154         - /*   650 */   106,  405, 1056,  519,   50,   50,  519, 1083, 1084, 1085,
147155         - /*   660 */   832,  374, 1055,  383,  415, 1068, 1362,  207,  412,  777,
147156         - /*   670 */   833, 1083, 1084, 1085,   64,   64,  326,   64,   64, 1306,
147157         - /*   680 */   951,  415,  414, 1362, 1364,  112,  113,  103, 1104, 1104,
147158         - /*   690 */   957,  960,  950,  950,  110,  110,  111,  111,  111,  111,
147159         - /*   700 */   298,  486,  519, 1041, 1491,  519,  438, 1491,  358, 1124,
147160         - /*   710 */   487, 1000,  917,  489,  470, 1000,  132,  178,   33,  454,
147161         - /*   720 */  1207,  136,  410,   64,   64,  483,   64,   64,  423,  373,
147162         - /*   730 */   283, 1150,  252,  252,  109,  109,  109,  109,  108,  108,
147163         - /*   740 */   107,  107,  107,  106,  405,  516,  224,  444,  415,  266,
147164         - /*   750 */  1362,  266,  252,  252,  374,  300,  420,  286,  938,  400,
147165         - /*   760 */   980,  474,  404,  252,  252,  516,    9,  477,  231,  504,
147166         - /*   770 */   358, 1040, 1039, 1492,  359,  378,  516, 1125,  112,  113,
147167         - /*   780 */   103, 1104, 1104,  957,  960,  950,  950,  110,  110,  111,
147168         - /*   790 */   111,  111,  111,  252,  252, 1019,  519, 1351,  299,  252,
147169         - /*   800 */   252,  252,  252, 1102,  379,  249,  516,  449,  876,  326,
147170         - /*   810 */  1020,  484,  516,  195,  516,  438,  273,   15,   15,  519,
147171         - /*   820 */   318,  519,   95,  519,   93, 1021,  371,  109,  109,  109,
147172         - /*   830 */   109,  108,  108,  107,  107,  107,  106,  405,  519, 1125,
147173         - /*   840 */    39,   39,   51,   51,   52,   52,  507,  374,  519, 1208,
147174         - /*   850 */  1102,  922,  443,  345,  133,  440,  223,  222,  221,   53,
147175         - /*   860 */    53,  326, 1404,  765,  766,  767,  519,  374,   88,   54,
147176         - /*   870 */    54,  112,  113,  103, 1104, 1104,  957,  960,  950,  950,
147177         - /*   880 */   110,  110,  111,  111,  111,  111,  411,   55,   55,  196,
147178         - /*   890 */   519,  112,  113,  103, 1104, 1104,  957,  960,  950,  950,
147179         - /*   900 */   110,  110,  111,  111,  111,  111,  135,  264, 1153,  380,
147180         - /*   910 */   519,   40,   40,  519,  876,  519,  997,  519,  997,  116,
       147191  + /*   240 */   108,  107,  107,  107,  106,  401,  114,  108,  108,  107,
       147192  + /*   250 */   107,  107,  106,  401,  109,  109,  109,  109,  108,  108,
       147193  + /*   260 */   107,  107,  107,  106,  401,  152,  399,  399,  399,  109,
       147194  + /*   270 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  401,
       147195  + /*   280 */   178,  493, 1412,  434, 1037, 1486, 1079,  515, 1486,  370,
       147196  + /*   290 */   421,  297,  357,  412,   74, 1079,  109,  109,  109,  109,
       147197  + /*   300 */   108,  108,  107,  107,  107,  106,  401, 1413,   37,   37,
       147198  + /*   310 */  1431,  274,  506,  112,  113,  103, 1100, 1100,  953,  956,
       147199  + /*   320 */   946,  946,  110,  110,  111,  111,  111,  111, 1436,  520,
       147200  + /*   330 */     2, 1128, 1079, 1080, 1081,  430,  275, 1079,  127,  366,
       147201  + /*   340 */   933, 1079, 1080, 1081,  220, 1205,  913,  458,  455,  454,
       147202  + /*   350 */   392,  167,  515, 1035,  152,  445,  924,  453,  152,  874,
       147203  + /*   360 */   923,  289,  109,  109,  109,  109,  108,  108,  107,  107,
       147204  + /*   370 */   107,  106,  401,   13,   13,  261,  853,  252,  252,  227,
       147205  + /*   380 */   106,  401,  370, 1079, 1080, 1081,  311,  388, 1079,  296,
       147206  + /*   390 */   512,  923,  923,  925,  231,  323, 1255, 1388, 1423,  490,
       147207  + /*   400 */   274,  506,   12,  208,  274,  506,  112,  113,  103, 1100,
       147208  + /*   410 */  1100,  953,  956,  946,  946,  110,  110,  111,  111,  111,
       147209  + /*   420 */   111, 1440,  286, 1128,  288, 1079, 1097,  247,  275, 1098,
       147210  + /*   430 */   127,  387,  405,  389, 1079, 1080, 1081, 1205,  159,  238,
       147211  + /*   440 */   255,  321,  461,  316,  460,  225,  790,  105,  102,  197,
       147212  + /*   450 */   513,  314,  842,  842,  445,  109,  109,  109,  109,  108,
       147213  + /*   460 */   108,  107,  107,  107,  106,  401,  515,  514,  515,  252,
       147214  + /*   470 */   252, 1079, 1080, 1081,  435,  370, 1098,  933, 1460,  794,
       147215  + /*   480 */   274,  506,  512,  105,  102,  197,  336,   63,   63,   64,
       147216  + /*   490 */    64,   27,  790,  924,  287,  208, 1354,  923,  515,  112,
       147217  + /*   500 */   113,  103, 1100, 1100,  953,  956,  946,  946,  110,  110,
       147218  + /*   510 */   111,  111,  111,  111,  107,  107,  107,  106,  401,   49,
       147219  + /*   520 */    49,  515,   28, 1079,  405,  497,  421,  297,  923,  923,
       147220  + /*   530 */   925,  186,  468, 1079,  467,  999,  999,  442,  515, 1079,
       147221  + /*   540 */   334,  515,   45,   45, 1083,  342,  173,  168,  109,  109,
       147222  + /*   550 */   109,  109,  108,  108,  107,  107,  107,  106,  401,   13,
       147223  + /*   560 */    13,  205,   13,   13,  252,  252, 1195, 1195,  370, 1079,
       147224  + /*   570 */  1080, 1081,  787,  265,    5,  359,  494,  512,  469, 1079,
       147225  + /*   580 */  1080, 1081,  398,  397, 1079, 1079, 1080, 1081,    3,  282,
       147226  + /*   590 */  1079, 1083,  112,  113,  103, 1100, 1100,  953,  956,  946,
       147227  + /*   600 */   946,  110,  110,  111,  111,  111,  111,  252,  252, 1015,
       147228  + /*   610 */   220, 1079,  873,  458,  455,  454,  943,  943,  954,  957,
       147229  + /*   620 */   512,  252,  252,  453, 1016, 1079,  445, 1107, 1209, 1107,
       147230  + /*   630 */  1079, 1080, 1081,  515,  512,  426, 1079, 1080, 1081, 1017,
       147231  + /*   640 */   512,  109,  109,  109,  109,  108,  108,  107,  107,  107,
       147232  + /*   650 */   106,  401, 1052,  515,   50,   50,  515, 1079, 1080, 1081,
       147233  + /*   660 */   828,  370, 1051,  379,  411, 1064, 1358,  207,  408,  773,
       147234  + /*   670 */   829, 1079, 1080, 1081,   64,   64,  322,   64,   64, 1302,
       147235  + /*   680 */   947,  411,  410, 1358, 1360,  112,  113,  103, 1100, 1100,
       147236  + /*   690 */   953,  956,  946,  946,  110,  110,  111,  111,  111,  111,
       147237  + /*   700 */   294,  482,  515, 1037, 1487,  515,  434, 1487,  354, 1120,
       147238  + /*   710 */   483,  996,  913,  485,  466,  996,  132,  178,   33,  450,
       147239  + /*   720 */  1203,  136,  406,   64,   64,  479,   64,   64,  419,  369,
       147240  + /*   730 */   283, 1146,  252,  252,  109,  109,  109,  109,  108,  108,
       147241  + /*   740 */   107,  107,  107,  106,  401,  512,  224,  440,  411,  266,
       147242  + /*   750 */  1358,  266,  252,  252,  370,  296,  416,  284,  934,  396,
       147243  + /*   760 */   976,  470,  400,  252,  252,  512,    9,  473,  231,  500,
       147244  + /*   770 */   354, 1036, 1035, 1488,  355,  374,  512, 1121,  112,  113,
       147245  + /*   780 */   103, 1100, 1100,  953,  956,  946,  946,  110,  110,  111,
       147246  + /*   790 */   111,  111,  111,  252,  252, 1015,  515, 1347,  295,  252,
       147247  + /*   800 */   252,  252,  252, 1098,  375,  249,  512,  445,  872,  322,
       147248  + /*   810 */  1016,  480,  512,  195,  512,  434,  273,   15,   15,  515,
       147249  + /*   820 */   314,  515,   95,  515,   93, 1017,  367,  109,  109,  109,
       147250  + /*   830 */   109,  108,  108,  107,  107,  107,  106,  401,  515, 1121,
       147251  + /*   840 */    39,   39,   51,   51,   52,   52,  503,  370,  515, 1204,
       147252  + /*   850 */  1098,  918,  439,  341,  133,  436,  223,  222,  221,   53,
       147253  + /*   860 */    53,  322, 1400,  761,  762,  763,  515,  370,   88,   54,
       147254  + /*   870 */    54,  112,  113,  103, 1100, 1100,  953,  956,  946,  946,
       147255  + /*   880 */   110,  110,  111,  111,  111,  111,  407,   55,   55,  196,
       147256  + /*   890 */   515,  112,  113,  103, 1100, 1100,  953,  956,  946,  946,
       147257  + /*   900 */   110,  110,  111,  111,  111,  111,  135,  264, 1149,  376,
       147258  + /*   910 */   515,   40,   40,  515,  872,  515,  993,  515,  993,  116,
147181 147259    /*   920 */   109,  109,  109,  109,  108,  108,  107,  107,  107,  106,
147182         - /*   930 */   405,   41,   41,  519,   43,   43,   44,   44,   56,   56,
       147260  + /*   930 */   401,   41,   41,  515,   43,   43,   44,   44,   56,   56,
147183 147261    /*   940 */   109,  109,  109,  109,  108,  108,  107,  107,  107,  106,
147184         - /*   950 */   405,  519,  383,  519,   57,   57,  519,  803,  519,  383,
147185         - /*   960 */   519,  449,  200,  519,  327,  519, 1401,  519, 1463,  519,
147186         - /*   970 */  1291,  821,   58,   58,   14,   14,  519,   59,   59,  118,
147187         - /*   980 */   118,   60,   60,  519,   46,   46,   61,   61,   62,   62,
147188         - /*   990 */    47,   47,  519,  190,  189,   91,  519,  140,  140,  519,
147189         - /*  1000 */   398,  519,  277, 1204,  141,  141,  519, 1119,  519,  996,
147190         - /*  1010 */   519,  996,  519,   69,   69,  374,  278,   48,   48,  259,
       147262  + /*   950 */   401,  515,  379,  515,   57,   57,  515,  799,  515,  379,
       147263  + /*   960 */   515,  445,  200,  515,  323,  515, 1397,  515, 1459,  515,
       147264  + /*   970 */  1287,  817,   58,   58,   14,   14,  515,   59,   59,  118,
       147265  + /*   980 */   118,   60,   60,  515,   46,   46,   61,   61,   62,   62,
       147266  + /*   990 */    47,   47,  515,  190,  189,   91,  515,  140,  140,  515,
       147267  + /*  1000 */   394,  515,  277, 1200,  141,  141,  515, 1115,  515,  992,
       147268  + /*  1010 */   515,  992,  515,   69,   69,  370,  278,   48,   48,  259,
147191 147269    /*  1020 */    65,   65,  119,  119,  246,  246,  260,   66,   66,  120,
147192         - /*  1030 */   120,  121,  121,  117,  117,  374,  519,  516,  387,  112,
147193         - /*  1040 */   113,  103, 1104, 1104,  957,  960,  950,  950,  110,  110,
147194         - /*  1050 */   111,  111,  111,  111,  519,  876,  519,  139,  139,  112,
147195         - /*  1060 */   113,  103, 1104, 1104,  957,  960,  950,  950,  110,  110,
147196         - /*  1070 */   111,  111,  111,  111, 1291,  138,  138,  125,  125,  519,
147197         - /*  1080 */    12,  519,  281, 1291,  519,  449,  131, 1291,  109,  109,
147198         - /*  1090 */   109,  109,  108,  108,  107,  107,  107,  106,  405,  519,
147199         - /*  1100 */   124,  124,  122,  122,  519,  123,  123,  519,  109,  109,
147200         - /*  1110 */   109,  109,  108,  108,  107,  107,  107,  106,  405,  519,
147201         - /*  1120 */    68,   68,  467,  787,  519,   70,   70,  306,   67,   67,
147202         - /*  1130 */  1036,  253,  253,  360, 1291,  191,  196, 1437,  469, 1305,
147203         - /*  1140 */    38,   38,  388,   94,  516,   42,   42,  177,  852,  274,
147204         - /*  1150 */   510,  389,  424,  851, 1360,  445,  512,  380,  381,  153,
147205         - /*  1160 */   427,  876,  436,  374,  224,  251,  194,  891,  182,  297,
147206         - /*  1170 */   787,  852,   88,  254,  470,  892,  851,  919,  811,  810,
147207         - /*  1180 */   230, 1245,  914,  374,   17,  417,  801,  112,  113,  103,
147208         - /*  1190 */  1104, 1104,  957,  960,  950,  950,  110,  110,  111,  111,
147209         - /*  1200 */   111,  111,  399,  818,  819, 1179,  987,  112,  101,  103,
147210         - /*  1210 */  1104, 1104,  957,  960,  950,  950,  110,  110,  111,  111,
147211         - /*  1220 */   111,  111,  379,  426,  431,  433,  302,  230,  230,   88,
147212         - /*  1230 */  1244,  455,  316,  801,  226,   88,  109,  109,  109,  109,
147213         - /*  1240 */   108,  108,  107,  107,  107,  106,  405,   86,  437,  983,
147214         - /*  1250 */   931,  885,  226,  987,  230,  419,  109,  109,  109,  109,
147215         - /*  1260 */   108,  108,  107,  107,  107,  106,  405,  324,  849,  785,
147216         - /*  1270 */   850,  100,  130,  100, 1407,  294,  374,  323, 1381, 1380,
147217         - /*  1280 */   441, 1453,  303, 1241,  307,  310,  312,  314, 1192, 1178,
147218         - /*  1290 */  1177, 1176,  319,  328,  329, 1232,  374,  931, 1253,  271,
147219         - /*  1300 */  1290,  113,  103, 1104, 1104,  957,  960,  950,  950,  110,
147220         - /*  1310 */   110,  111,  111,  111,  111, 1228, 1239,  506,  505, 1296,
147221         - /*  1320 */  1225, 1159,  103, 1104, 1104,  957,  960,  950,  950,  110,
147222         - /*  1330 */   110,  111,  111,  111,  111, 1152, 1141, 1140, 1142, 1447,
147223         - /*  1340 */   450,  244,  184,   98,  511,  188,    4,  357,  331,  109,
147224         - /*  1350 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  405,
147225         - /*  1360 */   514,  333,  335,  199,  418,  460,  296,  289,  322,  109,
147226         - /*  1370 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  405,
147227         - /*  1380 */    11,  285, 1283,  406,  365,  192, 1175, 1355,  435,  509,
147228         - /*  1390 */   350, 1354,  337,   98,  511,  508,    4,  187, 1450, 1119,
147229         - /*  1400 */   233, 1400,  155, 1398, 1116,  152,   72,   75,  382,  429,
147230         - /*  1410 */   514,  165,  115,  499,  937, 1280, 1275,   30,  149,  157,
147231         - /*  1420 */    96,   96,    8,  284,   86,  288,  287,   97, 1272,  406,
147232         - /*  1430 */   521,  520,  421,  406,  927,  422,  453,  210,  160,  161,
147233         - /*  1440 */   162,  163,  362,  428, 1286,  508,  442,  214,   80,  364,
147234         - /*  1450 */    31,  274,  510,  169, 1349,  448,  492,  245, 1369,  216,
147235         - /*  1460 */   174,  491,  451,  309,  937,  927,  927,  929,  930,   24,
147236         - /*  1470 */    96,   96,  305,  217,  367,  466, 1143,   97,  218,  406,
147237         - /*  1480 */   521,  520, 1195, 1194,  927, 1193,  395,  803,   98,  511,
147238         - /*  1490 */   368,    4, 1186, 1167, 1185,  269, 1166,  321, 1165, 1462,
147239         - /*  1500 */   397,  270,  485,  476,  479,  514,   85,  232, 1236,   98,
147240         - /*  1510 */   511,  330,    4,  490,  340,  927,  927,  929,  930,   24,
147241         - /*  1520 */  1439, 1072,  408, 1237,  339,  256,  514, 1418,  406,   10,
147242         - /*  1530 */   356,  356,  355,  241,  353,  181,   92,  774, 1235, 1218,
147243         - /*  1540 */   508,  342,   87,  332,  334, 1217, 1234,  336,  344,  406,
147244         - /*  1550 */   201,  492,  280,  183,  488,  348,  493,  349,  239,  937,
147245         - /*  1560 */   279,  508, 1335,   29, 1149,   96,   96,  522, 1078,  272,
147246         - /*  1570 */   243,  240,   97,  242,  406,  521,  520,  523, 1138,  927,
147247         - /*  1580 */   937,  142, 1133, 1385,  143, 1386,   96,   96,  856,  376,
147248         - /*  1590 */   203,  761,  154,   97, 1384,  406,  521,  520,  204,  377,
147249         - /*  1600 */   927,  146,  144, 1383,  407, 1163, 1162,  128,  202,   71,
147250         - /*  1610 */   927,  927,  929,  930,   24,  267, 1160,  185,  276,  198,
147251         - /*  1620 */   257,   98,  511,  126,    4,  911,  995,  156,  993,  145,
147252         - /*  1630 */   206,  927,  927,  929,  930,   24,  158,  835,  514,  209,
147253         - /*  1640 */   295, 1009,  375,  164,  915,  147,  384,  274,  510,  386,
147254         - /*  1650 */   166,   76,   77,   78,  148, 1012,  211,  212, 1008,  137,
147255         - /*  1660 */    18,  406,   79,  213,  304, 1001, 1113,  230,  447,  215,
147256         - /*  1670 */   413,  171,   32,  508,  323,  776,  170,  452,  172,  219,
147257         - /*  1680 */   456,   81,   19,   20,  492,  317,  461,   82,  268,  491,
147258         - /*  1690 */   150,  814,  937,  179,   83,  468,  151,  180,   96,   96,
147259         - /*  1700 */   963,   84, 1044,   34,  475,   97, 1045,  406,  521,  520,
147260         - /*  1710 */  1072,  408,  927,   35,  256,  884,  478,  248,  193,  356,
147261         - /*  1720 */   356,  355,  241,  353,  250,  175,  774,  229,  879,   21,
147262         - /*  1730 */   100,   98,  511,   22,    4, 1058, 1049,  176,  341,  201,
147263         - /*  1740 */     7,  280, 1062,  927,  927,  929,  930,   24,  514,  279,
147264         - /*  1750 */    88, 1060,   23,  978,  964,  962,  966, 1018, 1017,  967,
147265         - /*  1760 */   235,   90,  511,  234,    4,   25,   36,  515,  932,  786,
147266         - /*  1770 */   845,  406,   99,   26,  236,  237,  351, 1455,  514,  203,
147267         - /*  1780 */   354, 1454, 1073,  508, 1129, 1129, 1129,  204, 1129, 1129,
147268         - /*  1790 */   146, 1129, 1129, 1129, 1129, 1129, 1129,  202, 1129, 1129,
147269         - /*  1800 */  1129,  406,  937, 1129, 1129, 1129, 1129, 1129,   96,   96,
147270         - /*  1810 */  1129, 1129, 1129,  508, 1129,   97, 1129,  406,  521,  520,
147271         - /*  1820 */  1129, 1129,  927, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147272         - /*  1830 */  1129,  375,  937, 1129, 1129, 1129,  274,  510,   96,   96,
147273         - /*  1840 */  1129, 1129, 1129, 1129, 1129,   97, 1129,  406,  521,  520,
147274         - /*  1850 */  1129, 1129,  927,  927,  927,  929,  930,   24, 1129,  413,
147275         - /*  1860 */  1129, 1129, 1129,  256, 1129, 1129, 1129, 1129,  356,  356,
147276         - /*  1870 */   355,  241,  353, 1129, 1129,  774, 1129, 1129, 1129, 1129,
147277         - /*  1880 */  1129, 1129, 1129,  927,  927,  929,  930,   24,  201, 1129,
147278         - /*  1890 */   280, 1129, 1129, 1129, 1129, 1129, 1129, 1129,  279, 1129,
147279         - /*  1900 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147280         - /*  1910 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147281         - /*  1920 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,  203, 1129,
147282         - /*  1930 */  1129, 1129, 1129, 1129, 1129, 1129,  204, 1129, 1129,  146,
147283         - /*  1940 */  1129, 1129, 1129, 1129, 1129, 1129,  202, 1129, 1129, 1129,
147284         - /*  1950 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147285         - /*  1960 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147286         - /*  1970 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147287         - /*  1980 */   375, 1129, 1129, 1129, 1129,  274,  510, 1129, 1129, 1129,
147288         - /*  1990 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
147289         - /*  2000 */  1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,  413,
       147270  + /*  1030 */   120,  121,  121,  117,  117,  370,  515,  512,  383,  112,
       147271  + /*  1040 */   113,  103, 1100, 1100,  953,  956,  946,  946,  110,  110,
       147272  + /*  1050 */   111,  111,  111,  111,  515,  872,  515,  139,  139,  112,
       147273  + /*  1060 */   113,  103, 1100, 1100,  953,  956,  946,  946,  110,  110,
       147274  + /*  1070 */   111,  111,  111,  111, 1287,  138,  138,  125,  125,  515,
       147275  + /*  1080 */    12,  515,  281, 1287,  515,  445,  131, 1287,  109,  109,
       147276  + /*  1090 */   109,  109,  108,  108,  107,  107,  107,  106,  401,  515,
       147277  + /*  1100 */   124,  124,  122,  122,  515,  123,  123,  515,  109,  109,
       147278  + /*  1110 */   109,  109,  108,  108,  107,  107,  107,  106,  401,  515,
       147279  + /*  1120 */    68,   68,  463,  783,  515,   70,   70,  302,   67,   67,
       147280  + /*  1130 */  1032,  253,  253,  356, 1287,  191,  196, 1433,  465, 1301,
       147281  + /*  1140 */    38,   38,  384,   94,  512,   42,   42,  177,  848,  274,
       147282  + /*  1150 */   506,  385,  420,  847, 1356,  441,  508,  376,  377,  153,
       147283  + /*  1160 */   423,  872,  432,  370,  224,  251,  194,  887,  182,  293,
       147284  + /*  1170 */   783,  848,   88,  254,  466,  888,  847,  915,  807,  806,
       147285  + /*  1180 */   230, 1241,  910,  370,   17,  413,  797,  112,  113,  103,
       147286  + /*  1190 */  1100, 1100,  953,  956,  946,  946,  110,  110,  111,  111,
       147287  + /*  1200 */   111,  111,  395,  814,  815, 1175,  983,  112,  101,  103,
       147288  + /*  1210 */  1100, 1100,  953,  956,  946,  946,  110,  110,  111,  111,
       147289  + /*  1220 */   111,  111,  375,  422,  427,  429,  298,  230,  230,   88,
       147290  + /*  1230 */  1240,  451,  312,  797,  226,   88,  109,  109,  109,  109,
       147291  + /*  1240 */   108,  108,  107,  107,  107,  106,  401,   86,  433,  979,
       147292  + /*  1250 */   927,  881,  226,  983,  230,  415,  109,  109,  109,  109,
       147293  + /*  1260 */   108,  108,  107,  107,  107,  106,  401,  320,  845,  781,
       147294  + /*  1270 */   846,  100,  130,  100, 1403,  290,  370,  319, 1377, 1376,
       147295  + /*  1280 */   437, 1449,  299, 1237,  303,  306,  308,  310, 1188, 1174,
       147296  + /*  1290 */  1173, 1172,  315,  324,  325, 1228,  370,  927, 1249,  271,
       147297  + /*  1300 */  1286,  113,  103, 1100, 1100,  953,  956,  946,  946,  110,
       147298  + /*  1310 */   110,  111,  111,  111,  111, 1224, 1235,  502,  501, 1292,
       147299  + /*  1320 */  1221, 1155,  103, 1100, 1100,  953,  956,  946,  946,  110,
       147300  + /*  1330 */   110,  111,  111,  111,  111, 1148, 1137, 1136, 1138, 1443,
       147301  + /*  1340 */   446,  244,  184,   98,  507,  188,    4,  353,  327,  109,
       147302  + /*  1350 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  401,
       147303  + /*  1360 */   510,  329,  331,  199,  414,  456,  292,  285,  318,  109,
       147304  + /*  1370 */   109,  109,  109,  108,  108,  107,  107,  107,  106,  401,
       147305  + /*  1380 */    11, 1271, 1279,  402,  361,  192, 1171, 1351,  431,  505,
       147306  + /*  1390 */   346, 1350,  333,   98,  507,  504,    4,  187, 1446, 1115,
       147307  + /*  1400 */   233, 1396,  155, 1394, 1112,  152,   72,   75,  378,  425,
       147308  + /*  1410 */   510,  165,  149,  157,  933, 1276,   86,   30, 1268,  417,
       147309  + /*  1420 */    96,   96,    8,  160,  161,  162,  163,   97,  418,  402,
       147310  + /*  1430 */   517,  516,  449,  402,  923,  210,  358,  424, 1282,  438,
       147311  + /*  1440 */   169,  214,  360, 1345,   80,  504,   31,  444, 1365,  301,
       147312  + /*  1450 */   245,  274,  506,  216,  174,  305,  488,  447,  217,  462,
       147313  + /*  1460 */  1139,  487,  218,  363,  933,  923,  923,  925,  926,   24,
       147314  + /*  1470 */    96,   96, 1191, 1190, 1189,  391, 1182,   97, 1163,  402,
       147315  + /*  1480 */   517,  516,  799,  364,  923, 1162,  317, 1161,   98,  507,
       147316  + /*  1490 */  1181,    4, 1458,  472,  393,  269,  270,  475,  481, 1232,
       147317  + /*  1500 */    85, 1233,  326,  328,  232,  510,  495, 1231,  330,   98,
       147318  + /*  1510 */   507, 1230,    4,  486,  335,  923,  923,  925,  926,   24,
       147319  + /*  1520 */  1435, 1068,  404,  181,  336,  256,  510,  115,  402,  332,
       147320  + /*  1530 */   352,  352,  351,  241,  349, 1214, 1414,  770,  338,   10,
       147321  + /*  1540 */   504,  340,  272,   92, 1331, 1213,   87,  183,  484,  402,
       147322  + /*  1550 */   201,  488,  280,  239,  344,  345,  489, 1145,   29,  933,
       147323  + /*  1560 */   279,  504, 1074,  518,  240,   96,   96,  242,  243,  519,
       147324  + /*  1570 */  1134, 1129,   97,  154,  402,  517,  516,  372,  373,  923,
       147325  + /*  1580 */   933,  142,  143,  128, 1381,  267,   96,   96,  852,  757,
       147326  + /*  1590 */   203,  144,  403,   97, 1382,  402,  517,  516,  204, 1380,
       147327  + /*  1600 */   923,  146, 1379, 1159, 1158,   71, 1156,  276,  202,  185,
       147328  + /*  1610 */   923,  923,  925,  926,   24,  198,  257,  126,  991,  989,
       147329  + /*  1620 */   907,   98,  507,  156,    4,  145,  158,  206,  831,  209,
       147330  + /*  1630 */   291,  923,  923,  925,  926,   24, 1005,  911,  510,  164,
       147331  + /*  1640 */   147,  380,  371,  382,  166,   76,   77,  274,  506,  148,
       147332  + /*  1650 */    78,   79, 1008,  211,  212, 1004,  137,  213,   18,  300,
       147333  + /*  1660 */   230,  402,  997, 1109,  443,  215,   32,  170,  171,  772,
       147334  + /*  1670 */   409,  448,  319,  504,  219,  172,  452,   81,   19,  457,
       147335  + /*  1680 */   313,   20,   82,  268,  488,  150,  810,  179,   83,  487,
       147336  + /*  1690 */   464,  151,  933,  180,  959,   84, 1040,   34,   96,   96,
       147337  + /*  1700 */   471, 1041,   35,  474,  193,   97,  248,  402,  517,  516,
       147338  + /*  1710 */  1068,  404,  923,  250,  256,  880,  229,  175,  875,  352,
       147339  + /*  1720 */   352,  351,  241,  349,  100,   21,  770,   22, 1054, 1056,
       147340  + /*  1730 */     7,   98,  507, 1045,    4,  337, 1058,   23,  974,  201,
       147341  + /*  1740 */   176,  280,   88,  923,  923,  925,  926,   24,  510,  279,
       147342  + /*  1750 */   960,  958,  962, 1014,  963, 1013,  235,  234,   25,   36,
       147343  + /*  1760 */    99,   90,  507,  928,    4,  511,  350,  782,   26,  841,
       147344  + /*  1770 */   236,  402,  347, 1069,  237, 1125, 1125, 1451,  510,  203,
       147345  + /*  1780 */  1450, 1125, 1125,  504, 1125, 1125, 1125,  204, 1125, 1125,
       147346  + /*  1790 */   146, 1125, 1125, 1125, 1125, 1125, 1125,  202, 1125, 1125,
       147347  + /*  1800 */  1125,  402,  933, 1125, 1125, 1125, 1125, 1125,   96,   96,
       147348  + /*  1810 */  1125, 1125, 1125,  504, 1125,   97, 1125,  402,  517,  516,
       147349  + /*  1820 */  1125, 1125,  923, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147350  + /*  1830 */  1125,  371,  933, 1125, 1125, 1125,  274,  506,   96,   96,
       147351  + /*  1840 */  1125, 1125, 1125, 1125, 1125,   97, 1125,  402,  517,  516,
       147352  + /*  1850 */  1125, 1125,  923,  923,  923,  925,  926,   24, 1125,  409,
       147353  + /*  1860 */  1125, 1125, 1125,  256, 1125, 1125, 1125, 1125,  352,  352,
       147354  + /*  1870 */   351,  241,  349, 1125, 1125,  770, 1125, 1125, 1125, 1125,
       147355  + /*  1880 */  1125, 1125, 1125,  923,  923,  925,  926,   24,  201, 1125,
       147356  + /*  1890 */   280, 1125, 1125, 1125, 1125, 1125, 1125, 1125,  279, 1125,
       147357  + /*  1900 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147358  + /*  1910 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147359  + /*  1920 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,  203, 1125,
       147360  + /*  1930 */  1125, 1125, 1125, 1125, 1125, 1125,  204, 1125, 1125,  146,
       147361  + /*  1940 */  1125, 1125, 1125, 1125, 1125, 1125,  202, 1125, 1125, 1125,
       147362  + /*  1950 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147363  + /*  1960 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147364  + /*  1970 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147365  + /*  1980 */   371, 1125, 1125, 1125, 1125,  274,  506, 1125, 1125, 1125,
       147366  + /*  1990 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
       147367  + /*  2000 */  1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,  409,
147290 147368   };
147291 147369   static const YYCODETYPE yy_lookahead[] = {
147292 147370    /*     0 */   184,  238,  239,  240,  238,  239,  240,  163,  155,  156,
147293 147371    /*    10 */   157,  158,  159,  160,  163,  191,  192,  183,  165,   19,
147294 147372    /*    20 */   167,  258,  202,  203,  200,  191,  163,  174,  184,  185,
147295 147373    /*    30 */   174,   31,  163,  163,  171,  184,  185,   35,  175,   39,
147296 147374    /*    40 */   179,  180,  181,   43,   44,   45,   46,   47,   48,   49,
................................................................................
147426 147504    /*  1340 */   251,  250,  209,   19,   20,  182,   22,  161,  222,   92,
147427 147505    /*  1350 */    93,   94,   95,   96,   97,   98,   99,  100,  101,  102,
147428 147506    /*  1360 */    36,  222,  222,  260,  226,  188,  256,  226,  187,   92,
147429 147507    /*  1370 */    93,   94,   95,   96,   97,   98,   99,  100,  101,  102,
147430 147508    /*  1380 */   210,  213,  213,   59,  213,  196,  192,  187,  256,  244,
147431 147509    /*  1390 */   212,  187,  226,   19,   20,   71,   22,  210,  166,   60,
147432 147510    /*  1400 */   130,  170,  260,  170,   38,   81,  257,  257,  170,  104,
147433         - /*  1410 */    36,   22,  137,  134,   90,  236,  217,  235,   43,  201,
147434         - /*  1420 */    96,   97,   48,  216,  138,  213,  216,  103,  217,  105,
147435         - /*  1430 */   106,  107,   18,   59,  110,  170,   18,  169,  204,  204,
147436         - /*  1440 */   204,  204,  213,  213,  201,   71,  170,  169,  146,  236,
147437         - /*  1450 */   235,  127,  128,  201,  213,   62,   82,  170,  253,  169,
147438         - /*  1460 */    22,   87,  189,  170,   90,  141,  142,  143,  144,  145,
147439         - /*  1470 */    96,   97,  252,  169,  189,  104,  170,  103,  169,  105,
147440         - /*  1480 */   106,  107,  186,  186,  110,  186,   64,  115,   19,   20,
147441         - /*  1490 */   189,   22,  194,  186,  194,  246,  188,  186,  186,  186,
147442         - /*  1500 */   102,  246,  133,  189,  189,   36,  104,  170,  228,   19,
147443         - /*  1510 */    20,  227,   22,   84,   22,  141,  142,  143,  144,  145,
147444         - /*  1520 */     0,    1,    2,  228,  271,    5,   36,  269,   59,   22,
147445         - /*  1530 */    10,   11,   12,   13,   14,  216,  146,   17,  228,  217,
147446         - /*  1540 */    71,  216,  136,  227,  227,  217,  228,  227,  170,   59,
147447         - /*  1550 */    30,   82,   32,  215,  135,  214,   87,  213,   25,   90,
147448         - /*  1560 */    40,   71,  241,   26,  173,   96,   97,  172,   13,  243,
147449         - /*  1570 */     6,  164,  103,  164,  105,  106,  107,  162,  162,  110,
147450         - /*  1580 */    90,  176,  162,  182,  176,  182,   96,   97,   98,  266,
147451         - /*  1590 */    70,    4,  263,  103,  182,  105,  106,  107,   78,  266,
147452         - /*  1600 */   110,   81,  176,  182,    3,  182,  182,  190,   88,  182,
147453         - /*  1610 */   141,  142,  143,  144,  145,  190,  182,   22,  151,   15,
147454         - /*  1620 */    89,   19,   20,   16,   22,  128,   23,  139,   23,  119,
147455         - /*  1630 */    24,  141,  142,  143,  144,  145,  131,   20,   36,  133,
147456         - /*  1640 */    16,    1,  122,  131,  140,  119,   61,  127,  128,   37,
147457         - /*  1650 */   139,   53,   53,   53,  119,  105,   34,  130,    1,    5,
147458         - /*  1660 */    22,   59,   53,  104,  149,   68,   75,   26,   41,  130,
147459         - /*  1670 */   150,  104,   24,   71,  120,   20,   68,   19,   22,  114,
147460         - /*  1680 */    67,   22,   22,   22,   82,   23,   67,   22,   67,   87,
147461         - /*  1690 */    37,   28,   90,   23,  138,   22,  153,   23,   96,   97,
147462         - /*  1700 */    23,   26,   23,   22,   24,  103,   23,  105,  106,  107,
147463         - /*  1710 */     1,    2,  110,   22,    5,  105,   24,   23,  130,   10,
147464         - /*  1720 */    11,   12,   13,   14,   23,   22,   17,   34,  132,   34,
147465         - /*  1730 */    26,   19,   20,   34,   22,   85,   23,   26,   24,   30,
147466         - /*  1740 */    44,   32,   75,  141,  142,  143,  144,  145,   36,   40,
147467         - /*  1750 */    26,   83,   34,   23,   23,   23,   23,   23,   23,   11,
147468         - /*  1760 */    22,   19,   20,   26,   22,   22,   22,   26,   23,   23,
147469         - /*  1770 */   124,   59,   22,   22,  130,  130,   23,  130,   36,   70,
147470         - /*  1780 */    15,  130,    1,   71,  277,  277,  277,   78,  277,  277,
       147511  + /*  1410 */    36,   22,   43,  201,   90,  236,  138,  235,  213,   18,
       147512  + /*  1420 */    96,   97,   48,  204,  204,  204,  204,  103,  170,  105,
       147513  + /*  1430 */   106,  107,   18,   59,  110,  169,  213,  213,  201,  170,
       147514  + /*  1440 */   201,  169,  236,  213,  146,   71,  235,   62,  253,  252,
       147515  + /*  1450 */   170,  127,  128,  169,   22,  170,   82,  189,  169,  104,
       147516  + /*  1460 */   170,   87,  169,  189,   90,  141,  142,  143,  144,  145,
       147517  + /*  1470 */    96,   97,  186,  186,  186,   64,  194,  103,  186,  105,
       147518  + /*  1480 */   106,  107,  115,  189,  110,  188,  186,  186,   19,   20,
       147519  + /*  1490 */   194,   22,  186,  189,  102,  246,  246,  189,  133,  228,
       147520  + /*  1500 */   104,  228,  227,  227,  170,   36,  134,  228,  227,   19,
       147521  + /*  1510 */    20,  228,   22,   84,  271,  141,  142,  143,  144,  145,
       147522  + /*  1520 */     0,    1,    2,  216,   22,    5,   36,  137,   59,  227,
       147523  + /*  1530 */    10,   11,   12,   13,   14,  217,  269,   17,  216,   22,
       147524  + /*  1540 */    71,  170,  243,  146,  241,  217,  136,  215,  135,   59,
       147525  + /*  1550 */    30,   82,   32,   25,  214,  213,   87,  173,   26,   90,
       147526  + /*  1560 */    40,   71,   13,  172,  164,   96,   97,  164,    6,  162,
       147527  + /*  1570 */   162,  162,  103,  263,  105,  106,  107,  266,  266,  110,
       147528  + /*  1580 */    90,  176,  176,  190,  182,  190,   96,   97,   98,    4,
       147529  + /*  1590 */    70,  176,    3,  103,  182,  105,  106,  107,   78,  182,
       147530  + /*  1600 */   110,   81,  182,  182,  182,  182,  182,  151,   88,   22,
       147531  + /*  1610 */   141,  142,  143,  144,  145,   15,   89,   16,   23,   23,
       147532  + /*  1620 */   128,   19,   20,  139,   22,  119,  131,   24,   20,  133,
       147533  + /*  1630 */    16,  141,  142,  143,  144,  145,    1,  140,   36,  131,
       147534  + /*  1640 */   119,   61,  122,   37,  139,   53,   53,  127,  128,  119,
       147535  + /*  1650 */    53,   53,  105,   34,  130,    1,    5,  104,   22,  149,
       147536  + /*  1660 */    26,   59,   68,   75,   41,  130,   24,   68,  104,   20,
       147537  + /*  1670 */   150,   19,  120,   71,  114,   22,   67,   22,   22,   67,
       147538  + /*  1680 */    23,   22,   22,   67,   82,   37,   28,   23,  138,   87,
       147539  + /*  1690 */    22,  153,   90,   23,   23,   26,   23,   22,   96,   97,
       147540  + /*  1700 */    24,   23,   22,   24,  130,  103,   23,  105,  106,  107,
       147541  + /*  1710 */     1,    2,  110,   23,    5,  105,   34,   22,  132,   10,
       147542  + /*  1720 */    11,   12,   13,   14,   26,   34,   17,   34,   85,   83,
       147543  + /*  1730 */    44,   19,   20,   23,   22,   24,   75,   34,   23,   30,
       147544  + /*  1740 */    26,   32,   26,  141,  142,  143,  144,  145,   36,   40,
       147545  + /*  1750 */    23,   23,   23,   23,   11,   23,   22,   26,   22,   22,
       147546  + /*  1760 */    22,   19,   20,   23,   22,   26,   15,   23,   22,  124,
       147547  + /*  1770 */   130,   59,   23,    1,  130,  277,  277,  130,   36,   70,
       147548  + /*  1780 */   130,  277,  277,   71,  277,  277,  277,   78,  277,  277,
147471 147549    /*  1790 */    81,  277,  277,  277,  277,  277,  277,   88,  277,  277,
147472 147550    /*  1800 */   277,   59,   90,  277,  277,  277,  277,  277,   96,   97,
147473 147551    /*  1810 */   277,  277,  277,   71,  277,  103,  277,  105,  106,  107,
147474 147552    /*  1820 */   277,  277,  110,  277,  277,  277,  277,  277,  277,  277,
147475 147553    /*  1830 */   277,  122,   90,  277,  277,  277,  127,  128,   96,   97,
147476 147554    /*  1840 */   277,  277,  277,  277,  277,  103,  277,  105,  106,  107,
147477 147555    /*  1850 */   277,  277,  110,  141,  142,  143,  144,  145,  277,  150,
................................................................................
147488 147566    /*  1960 */   277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
147489 147567    /*  1970 */   277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
147490 147568    /*  1980 */   122,  277,  277,  277,  277,  127,  128,  277,  277,  277,
147491 147569    /*  1990 */   277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
147492 147570    /*  2000 */   277,  277,  277,  277,  277,  277,  277,  277,  150,  277,
147493 147571    /*  2010 */   277,  277,  277,  277,  277,  277,  277,  277,  277,
147494 147572   };
147495         -#define YY_SHIFT_COUNT    (524)
       147573  +#define YY_SHIFT_COUNT    (520)
147496 147574   #define YY_SHIFT_MIN      (0)
147497 147575   #define YY_SHIFT_MAX      (1858)
147498 147576   static const unsigned short int yy_shift_ofst[] = {
147499 147577    /*     0 */  1709, 1520, 1858, 1324, 1324,  277, 1374, 1469, 1602, 1712,
147500 147578    /*    10 */  1712, 1712,  273,    0,    0,  113, 1016, 1712, 1712, 1712,
147501 147579    /*    20 */  1712, 1712, 1712, 1712, 1712, 1712, 1712,   11,   11,  236,
147502 147580    /*    30 */   184,  277,  277,  277,  277,  277,  277,   93,  177,  270,
................................................................................
147520 147598    /*   210 */   531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
147521 147599    /*   220 */   531,    2,    2,    2,  531,  531,  531,  531,  782,  531,
147522 147600    /*   230 */   531,  531,  744,  531,  531,  783,  531,  531,  531,  531,
147523 147601    /*   240 */   531,  531,  531,  531,  419,  682,  327,  370,  370,  370,
147524 147602    /*   250 */   370, 1029,  327,  327, 1024,  897,  856,  947, 1109,  706,
147525 147603    /*   260 */   706, 1143, 1109, 1109, 1143,  842,  945, 1118, 1136, 1136,
147526 147604    /*   270 */  1136,  706,  676,  400, 1047,  694, 1339, 1270, 1270, 1366,
147527         - /*   280 */  1366, 1270, 1305, 1389, 1275, 1279, 1375, 1275, 1279, 1286,
147528         - /*   290 */  1414, 1414, 1414, 1414, 1270, 1418, 1286, 1286, 1305, 1389,
147529         - /*   300 */  1375, 1375, 1286, 1270, 1418, 1302, 1393, 1270, 1418, 1438,
147530         - /*   310 */  1270, 1418, 1270, 1418, 1438, 1371, 1371, 1371, 1422, 1438,
147531         - /*   320 */  1371, 1372, 1371, 1422, 1371, 1371, 1438, 1398, 1398, 1438,
147532         - /*   330 */  1369, 1402, 1369, 1402, 1369, 1402, 1369, 1402, 1270, 1279,
147533         - /*   340 */  1429, 1492, 1275, 1279, 1507, 1270, 1390, 1275, 1406, 1419,
147534         - /*   350 */  1286, 1533, 1537, 1555, 1555, 1564, 1564, 1564, 2009, 2009,
       147605  + /*   280 */  1366, 1270, 1305, 1389, 1369, 1278, 1401, 1401, 1401, 1401,
       147606  + /*   290 */  1270, 1414, 1278, 1278, 1305, 1389, 1369, 1369, 1278, 1270,
       147607  + /*   300 */  1414, 1298, 1385, 1270, 1414, 1432, 1270, 1414, 1270, 1414,
       147608  + /*   310 */  1432, 1355, 1355, 1355, 1411, 1432, 1355, 1367, 1355, 1411,
       147609  + /*   320 */  1355, 1355, 1432, 1392, 1392, 1432, 1365, 1396, 1365, 1396,
       147610  + /*   330 */  1365, 1396, 1365, 1396, 1270, 1372, 1429, 1502, 1390, 1372,
       147611  + /*   340 */  1517, 1270, 1397, 1390, 1410, 1413, 1278, 1528, 1532, 1549,
       147612  + /*   350 */  1549, 1562, 1562, 1562, 2009, 2009, 2009, 2009, 2009, 2009,
147535 147613    /*   360 */  2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
147536         - /*   370 */  2009, 2009, 2009, 2009,  570,  345,  686,  748,   50,  740,
147537         - /*   380 */  1064, 1107,  469,  537, 1042, 1146, 1162, 1154, 1201, 1202,
147538         - /*   390 */  1203, 1208, 1209, 1127, 1069, 1196, 1157, 1147, 1226, 1228,
147539         - /*   400 */  1245,  775,  868, 1246, 1247, 1191, 1151, 1587, 1601, 1595,
147540         - /*   410 */  1467, 1604, 1531, 1607, 1603, 1605, 1497, 1488, 1510, 1606,
147541         - /*   420 */  1505, 1617, 1506, 1624, 1640, 1512, 1504, 1526, 1585, 1612,
147542         - /*   430 */  1511, 1598, 1599, 1600, 1609, 1535, 1550, 1622, 1527, 1657,
147543         - /*   440 */  1654, 1638, 1559, 1515, 1597, 1641, 1608, 1591, 1627, 1539,
147544         - /*   450 */  1567, 1648, 1655, 1658, 1554, 1565, 1656, 1613, 1659, 1660,
147545         - /*   460 */  1662, 1661, 1619, 1663, 1665, 1621, 1653, 1670, 1556, 1673,
147546         - /*   470 */  1543, 1674, 1677, 1675, 1679, 1681, 1680, 1683, 1691, 1692,
147547         - /*   480 */  1588, 1694, 1701, 1610, 1693, 1703, 1596, 1704, 1695, 1704,
147548         - /*   490 */  1699, 1650, 1667, 1668, 1696, 1713, 1714, 1711, 1724, 1718,
147549         - /*   500 */  1730, 1704, 1731, 1732, 1733, 1734, 1737, 1735, 1738, 1748,
147550         - /*   510 */  1743, 1744, 1745, 1746, 1750, 1751, 1741, 1646, 1644, 1645,
147551         - /*   520 */  1647, 1651, 1753, 1765, 1781,
       147614  + /*   370 */   570,  345,  686,  748,   50,  740, 1064, 1107,  469,  537,
       147615  + /*   380 */  1042, 1146, 1162, 1154, 1201, 1202, 1203, 1208, 1209, 1127,
       147616  + /*   390 */  1069, 1196, 1157, 1147, 1226, 1228, 1245,  775,  868, 1246,
       147617  + /*   400 */  1247, 1191, 1151, 1585, 1589, 1587, 1456, 1600, 1527, 1601,
       147618  + /*   410 */  1595, 1596, 1492, 1484, 1506, 1603, 1495, 1608, 1496, 1614,
       147619  + /*   420 */  1635, 1508, 1497, 1521, 1580, 1606, 1505, 1592, 1593, 1597,
       147620  + /*   430 */  1598, 1530, 1547, 1619, 1524, 1654, 1651, 1636, 1553, 1510,
       147621  + /*   440 */  1594, 1634, 1599, 1588, 1623, 1535, 1564, 1642, 1649, 1652,
       147622  + /*   450 */  1552, 1560, 1653, 1609, 1655, 1656, 1657, 1659, 1612, 1658,
       147623  + /*   460 */  1660, 1616, 1648, 1664, 1550, 1668, 1538, 1670, 1671, 1669,
       147624  + /*   470 */  1673, 1675, 1676, 1678, 1680, 1679, 1574, 1683, 1690, 1610,
       147625  + /*   480 */  1682, 1695, 1586, 1698, 1691, 1698, 1693, 1643, 1661, 1646,
       147626  + /*   490 */  1686, 1710, 1711, 1714, 1716, 1703, 1715, 1698, 1727, 1728,
       147627  + /*   500 */  1729, 1730, 1731, 1732, 1734, 1743, 1736, 1737, 1740, 1744,
       147628  + /*   510 */  1738, 1746, 1739, 1645, 1640, 1644, 1647, 1650, 1749, 1751,
       147629  + /*   520 */  1772,
147552 147630   };
147553         -#define YY_REDUCE_COUNT (373)
       147631  +#define YY_REDUCE_COUNT (369)
147554 147632   #define YY_REDUCE_MIN   (-237)
147555         -#define YY_REDUCE_MAX   (1434)
       147633  +#define YY_REDUCE_MAX   (1424)
147556 147634   static const short yy_reduce_ofst[] = {
147557 147635    /*     0 */  -147,  171,  263,  -96,  358, -144, -149, -102,  124, -156,
147558 147636    /*    10 */   -98,  305,  401,  -57,  209, -237,  245,  -94,  -79,  189,
147559 147637    /*    20 */   375,  490,  493,  378,  303,  539,  542,  501,  503,  554,
147560 147638    /*    30 */   415,  526,  546,  557,  587,  593,  595, -234, -234, -234,
147561 147639    /*    40 */  -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
147562 147640    /*    50 */  -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
................................................................................
147578 147656    /*   210 */  1112, 1115, 1116, 1117, 1119, 1120, 1121, 1122, 1123, 1124,
147579 147657    /*   220 */  1125, 1012, 1096, 1097, 1128, 1129, 1130, 1131, 1070, 1135,
147580 147658    /*   230 */  1137, 1152, 1077, 1153, 1155, 1114, 1156,  304, 1158, 1172,
147581 147659    /*   240 */  1173, 1174, 1175, 1176, 1089, 1091, 1133, 1098, 1126, 1139,
147582 147660    /*   250 */  1140, 1070, 1133, 1133, 1170, 1163, 1186, 1103, 1168, 1138,
147583 147661    /*   260 */  1141, 1110, 1169, 1171, 1132, 1177, 1189, 1194, 1181, 1200,
147584 147662    /*   270 */  1204, 1166, 1145, 1178, 1187, 1232, 1142, 1231, 1233, 1149,
147585         - /*   280 */  1150, 1238, 1179, 1182, 1199, 1207, 1218, 1211, 1210, 1212,
147586         - /*   290 */  1234, 1235, 1236, 1237, 1265, 1268, 1229, 1230, 1213, 1215,
147587         - /*   300 */  1243, 1252, 1241, 1276, 1278, 1205, 1220, 1287, 1290, 1273,
147588         - /*   310 */  1293, 1304, 1306, 1309, 1285, 1296, 1297, 1299, 1298, 1301,
147589         - /*   320 */  1307, 1308, 1311, 1300, 1312, 1313, 1314, 1249, 1255, 1315,
147590         - /*   330 */  1280, 1284, 1295, 1316, 1310, 1317, 1318, 1320, 1337, 1319,
147591         - /*   340 */  1253, 1258, 1322, 1325, 1321, 1378, 1326, 1328, 1338, 1341,
147592         - /*   350 */  1344, 1391, 1395, 1407, 1409, 1415, 1416, 1420, 1323, 1333,
147593         - /*   360 */  1329, 1405, 1401, 1403, 1412, 1421, 1408, 1417, 1425, 1423,
147594         - /*   370 */  1424, 1427, 1434, 1426,
       147663  + /*   280 */  1150, 1238, 1179, 1182, 1212, 1205, 1219, 1220, 1221, 1222,
       147664  + /*   290 */  1258, 1266, 1223, 1224, 1206, 1211, 1237, 1239, 1230, 1269,
       147665  + /*   300 */  1272, 1195, 1197, 1280, 1284, 1268, 1285, 1289, 1290, 1293,
       147666  + /*   310 */  1274, 1286, 1287, 1288, 1282, 1294, 1292, 1297, 1300, 1296,
       147667  + /*   320 */  1301, 1306, 1304, 1249, 1250, 1308, 1271, 1275, 1273, 1276,
       147668  + /*   330 */  1279, 1281, 1283, 1302, 1334, 1307, 1243, 1267, 1318, 1322,
       147669  + /*   340 */  1303, 1371, 1299, 1328, 1332, 1340, 1342, 1384, 1391, 1400,
       147670  + /*   350 */  1403, 1407, 1408, 1409, 1311, 1312, 1310, 1405, 1402, 1412,
       147671  + /*   360 */  1417, 1420, 1406, 1393, 1395, 1421, 1422, 1423, 1424, 1415,
147595 147672   };
147596 147673   static const YYACTIONTYPE yy_default[] = {
147597         - /*     0 */  1496, 1496, 1496, 1344, 1127, 1233, 1127, 1127, 1127, 1344,
147598         - /*    10 */  1344, 1344, 1127, 1263, 1263, 1395, 1158, 1127, 1127, 1127,
147599         - /*    20 */  1127, 1127, 1127, 1127, 1343, 1127, 1127, 1127, 1127, 1127,
147600         - /*    30 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1269, 1127,
147601         - /*    40 */  1127, 1127, 1127, 1127, 1345, 1346, 1127, 1127, 1127, 1394,
147602         - /*    50 */  1396, 1279, 1278, 1277, 1276, 1377, 1250, 1274, 1267, 1271,
147603         - /*    60 */  1339, 1340, 1338, 1342, 1346, 1345, 1127, 1270, 1310, 1324,
147604         - /*    70 */  1309, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147605         - /*    80 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147606         - /*    90 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147607         - /*   100 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147608         - /*   110 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1318, 1323, 1329,
147609         - /*   120 */  1322, 1319, 1312, 1311, 1313, 1314, 1127, 1148, 1197, 1127,
147610         - /*   130 */  1127, 1127, 1127, 1413, 1412, 1127, 1127, 1158, 1315, 1316,
147611         - /*   140 */  1326, 1325, 1402, 1452, 1451, 1127, 1127, 1127, 1127, 1127,
147612         - /*   150 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147613         - /*   160 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147614         - /*   170 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1158, 1154, 1304,
147615         - /*   180 */  1303, 1422, 1154, 1257, 1127, 1408, 1233, 1224, 1127, 1127,
147616         - /*   190 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147617         - /*   200 */  1127, 1399, 1397, 1127, 1359, 1127, 1127, 1127, 1127, 1127,
147618         - /*   210 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147619         - /*   220 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147620         - /*   230 */  1127, 1127, 1229, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147621         - /*   240 */  1127, 1127, 1127, 1446, 1127, 1372, 1211, 1229, 1229, 1229,
147622         - /*   250 */  1229, 1231, 1212, 1210, 1223, 1158, 1134, 1488, 1273, 1252,
147623         - /*   260 */  1252, 1485, 1273, 1273, 1485, 1172, 1466, 1169, 1263, 1263,
147624         - /*   270 */  1263, 1252, 1341, 1230, 1223, 1127, 1488, 1238, 1238, 1487,
147625         - /*   280 */  1487, 1238, 1282, 1288, 1268, 1257, 1200, 1268, 1257, 1273,
147626         - /*   290 */  1206, 1206, 1206, 1206, 1238, 1145, 1273, 1273, 1282, 1288,
147627         - /*   300 */  1200, 1200, 1273, 1238, 1145, 1376, 1482, 1238, 1145, 1352,
147628         - /*   310 */  1238, 1145, 1238, 1145, 1352, 1198, 1198, 1198, 1187, 1352,
147629         - /*   320 */  1198, 1172, 1198, 1187, 1198, 1198, 1352, 1356, 1356, 1352,
147630         - /*   330 */  1256, 1251, 1256, 1251, 1256, 1251, 1256, 1251, 1238, 1257,
147631         - /*   340 */  1421, 1127, 1268, 1257, 1347, 1238, 1127, 1268, 1266, 1264,
147632         - /*   350 */  1273, 1151, 1190, 1449, 1449, 1445, 1445, 1445, 1493, 1493,
147633         - /*   360 */  1408, 1461, 1158, 1158, 1158, 1158, 1461, 1174, 1174, 1158,
147634         - /*   370 */  1158, 1158, 1158, 1461, 1127, 1127, 1127, 1127, 1127, 1127,
147635         - /*   380 */  1456, 1127, 1361, 1242, 1127, 1127, 1127, 1127, 1127, 1127,
147636         - /*   390 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147637         - /*   400 */  1127, 1127, 1127, 1127, 1127, 1127, 1293, 1127, 1130, 1405,
147638         - /*   410 */  1127, 1127, 1403, 1127, 1127, 1127, 1127, 1127, 1127, 1243,
147639         - /*   420 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147640         - /*   430 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1484, 1127,
147641         - /*   440 */  1127, 1127, 1127, 1127, 1127, 1375, 1374, 1127, 1127, 1240,
147642         - /*   450 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147643         - /*   460 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147644         - /*   470 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147645         - /*   480 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1265, 1127, 1420,
147646         - /*   490 */  1127, 1127, 1127, 1127, 1127, 1127, 1127, 1434, 1258, 1127,
147647         - /*   500 */  1127, 1475, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
147648         - /*   510 */  1127, 1127, 1127, 1127, 1127, 1127, 1470, 1214, 1295, 1127,
147649         - /*   520 */  1294, 1298, 1127, 1139, 1127,
       147674  + /*     0 */  1492, 1492, 1492, 1340, 1123, 1229, 1123, 1123, 1123, 1340,
       147675  + /*    10 */  1340, 1340, 1123, 1259, 1259, 1391, 1154, 1123, 1123, 1123,
       147676  + /*    20 */  1123, 1123, 1123, 1123, 1339, 1123, 1123, 1123, 1123, 1123,
       147677  + /*    30 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1265, 1123,
       147678  + /*    40 */  1123, 1123, 1123, 1123, 1341, 1342, 1123, 1123, 1123, 1390,
       147679  + /*    50 */  1392, 1275, 1274, 1273, 1272, 1373, 1246, 1270, 1263, 1267,
       147680  + /*    60 */  1335, 1336, 1334, 1338, 1342, 1341, 1123, 1266, 1306, 1320,
       147681  + /*    70 */  1305, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147682  + /*    80 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147683  + /*    90 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147684  + /*   100 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147685  + /*   110 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1314, 1319, 1325,
       147686  + /*   120 */  1318, 1315, 1308, 1307, 1309, 1310, 1123, 1144, 1193, 1123,
       147687  + /*   130 */  1123, 1123, 1123, 1409, 1408, 1123, 1123, 1154, 1311, 1312,
       147688  + /*   140 */  1322, 1321, 1398, 1448, 1447, 1123, 1123, 1123, 1123, 1123,
       147689  + /*   150 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147690  + /*   160 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147691  + /*   170 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1154, 1150, 1300,
       147692  + /*   180 */  1299, 1418, 1150, 1253, 1123, 1404, 1229, 1220, 1123, 1123,
       147693  + /*   190 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147694  + /*   200 */  1123, 1395, 1393, 1123, 1355, 1123, 1123, 1123, 1123, 1123,
       147695  + /*   210 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147696  + /*   220 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147697  + /*   230 */  1123, 1123, 1225, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147698  + /*   240 */  1123, 1123, 1123, 1442, 1123, 1368, 1207, 1225, 1225, 1225,
       147699  + /*   250 */  1225, 1227, 1208, 1206, 1219, 1154, 1130, 1484, 1269, 1248,
       147700  + /*   260 */  1248, 1481, 1269, 1269, 1481, 1168, 1462, 1165, 1259, 1259,
       147701  + /*   270 */  1259, 1248, 1337, 1226, 1219, 1123, 1484, 1234, 1234, 1483,
       147702  + /*   280 */  1483, 1234, 1278, 1284, 1196, 1269, 1202, 1202, 1202, 1202,
       147703  + /*   290 */  1234, 1141, 1269, 1269, 1278, 1284, 1196, 1196, 1269, 1234,
       147704  + /*   300 */  1141, 1372, 1478, 1234, 1141, 1348, 1234, 1141, 1234, 1141,
       147705  + /*   310 */  1348, 1194, 1194, 1194, 1183, 1348, 1194, 1168, 1194, 1183,
       147706  + /*   320 */  1194, 1194, 1348, 1352, 1352, 1348, 1252, 1247, 1252, 1247,
       147707  + /*   330 */  1252, 1247, 1252, 1247, 1234, 1253, 1417, 1123, 1264, 1253,
       147708  + /*   340 */  1343, 1234, 1123, 1264, 1262, 1260, 1269, 1147, 1186, 1445,
       147709  + /*   350 */  1445, 1441, 1441, 1441, 1489, 1489, 1404, 1457, 1154, 1154,
       147710  + /*   360 */  1154, 1154, 1457, 1170, 1170, 1154, 1154, 1154, 1154, 1457,
       147711  + /*   370 */  1123, 1123, 1123, 1123, 1123, 1123, 1452, 1123, 1357, 1238,
       147712  + /*   380 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147713  + /*   390 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147714  + /*   400 */  1123, 1123, 1289, 1123, 1126, 1401, 1123, 1123, 1399, 1123,
       147715  + /*   410 */  1123, 1123, 1123, 1123, 1123, 1239, 1123, 1123, 1123, 1123,
       147716  + /*   420 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147717  + /*   430 */  1123, 1123, 1123, 1123, 1480, 1123, 1123, 1123, 1123, 1123,
       147718  + /*   440 */  1123, 1371, 1370, 1123, 1123, 1236, 1123, 1123, 1123, 1123,
       147719  + /*   450 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147720  + /*   460 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147721  + /*   470 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147722  + /*   480 */  1123, 1123, 1123, 1261, 1123, 1416, 1123, 1123, 1123, 1123,
       147723  + /*   490 */  1123, 1123, 1123, 1430, 1254, 1123, 1123, 1471, 1123, 1123,
       147724  + /*   500 */  1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
       147725  + /*   510 */  1123, 1123, 1466, 1210, 1291, 1123, 1290, 1294, 1123, 1135,
       147726  + /*   520 */  1123,
147650 147727   };
147651 147728   /********** End of lemon-generated parsing tables *****************************/
147652 147729   
147653 147730   /* The next table maps tokens (terminal symbols) into fallback tokens.  
147654 147731   ** If a construct like the following:
147655 147732   ** 
147656 147733   **      %fallback ID X Y Z.
................................................................................
148266 148343    /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
148267 148344    /* 136 */ "having_opt ::=",
148268 148345    /* 137 */ "having_opt ::= HAVING expr",
148269 148346    /* 138 */ "limit_opt ::=",
148270 148347    /* 139 */ "limit_opt ::= LIMIT expr",
148271 148348    /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
148272 148349    /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
148273         - /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt orderby_opt limit_opt",
       148350  + /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
148274 148351    /* 143 */ "where_opt ::=",
148275 148352    /* 144 */ "where_opt ::= WHERE expr",
148276         - /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt orderby_opt limit_opt",
       148353  + /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
148277 148354    /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
148278 148355    /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
148279 148356    /* 148 */ "setlist ::= nm EQ expr",
148280 148357    /* 149 */ "setlist ::= LP idlist RP EQ expr",
148281 148358    /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
148282 148359    /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
148283 148360    /* 152 */ "upsert ::=",
................................................................................
149146 149223     {  214,   -3 }, /* (135) groupby_opt ::= GROUP BY nexprlist */
149147 149224     {  215,    0 }, /* (136) having_opt ::= */
149148 149225     {  215,   -2 }, /* (137) having_opt ::= HAVING expr */
149149 149226     {  217,    0 }, /* (138) limit_opt ::= */
149150 149227     {  217,   -2 }, /* (139) limit_opt ::= LIMIT expr */
149151 149228     {  217,   -4 }, /* (140) limit_opt ::= LIMIT expr OFFSET expr */
149152 149229     {  217,   -4 }, /* (141) limit_opt ::= LIMIT expr COMMA expr */
149153         -  {  160,   -8 }, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt orderby_opt limit_opt */
       149230  +  {  160,   -6 }, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
149154 149231     {  213,    0 }, /* (143) where_opt ::= */
149155 149232     {  213,   -2 }, /* (144) where_opt ::= WHERE expr */
149156         -  {  160,  -10 }, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt orderby_opt limit_opt */
       149233  +  {  160,   -8 }, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
149157 149234     {  233,   -5 }, /* (146) setlist ::= setlist COMMA nm EQ expr */
149158 149235     {  233,   -7 }, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
149159 149236     {  233,   -3 }, /* (148) setlist ::= nm EQ expr */
149160 149237     {  233,   -5 }, /* (149) setlist ::= LP idlist RP EQ expr */
149161 149238     {  160,   -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
149162 149239     {  160,   -7 }, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
149163 149240     {  236,    0 }, /* (152) upsert ::= */
................................................................................
150033 150110           break;
150034 150111         case 140: /* limit_opt ::= LIMIT expr OFFSET expr */
150035 150112   {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
150036 150113           break;
150037 150114         case 141: /* limit_opt ::= LIMIT expr COMMA expr */
150038 150115   {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,yymsp[-2].minor.yy18);}
150039 150116           break;
150040         -      case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt orderby_opt limit_opt */
       150117  +      case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
       150118  +{
       150119  +  sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy135, &yymsp[-1].minor.yy0);
       150120  +  sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy135,yymsp[0].minor.yy18,0,0);
       150121  +}
       150122  +        break;
       150123  +      case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
150041 150124   {
150042 150125     sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy135, &yymsp[-3].minor.yy0);
150043         -  sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy135,yymsp[-2].minor.yy18,yymsp[-1].minor.yy420,yymsp[0].minor.yy18);
150044         -}
150045         -        break;
150046         -      case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt orderby_opt limit_opt */
150047         -{
150048         -  sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy135, &yymsp[-5].minor.yy0);
150049         -  sqlite3ExprListCheckLength(pParse,yymsp[-3].minor.yy420,"set list"); 
150050         -  sqlite3Update(pParse,yymsp[-6].minor.yy135,yymsp[-3].minor.yy420,yymsp[-2].minor.yy18,yymsp[-7].minor.yy70,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,0);
       150126  +  sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy420,"set list"); 
       150127  +  sqlite3Update(pParse,yymsp[-4].minor.yy135,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,yymsp[-5].minor.yy70,0,0,0);
150051 150128   }
150052 150129           break;
150053 150130         case 146: /* setlist ::= setlist COMMA nm EQ expr */
150054 150131   {
150055 150132     yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
150056 150133     sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, 1);
150057 150134   }
................................................................................
151045 151122                yyTracePrompt,yyTokenName[yymajor]);
151046 151123           }
151047 151124   #endif
151048 151125           yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
151049 151126           yymajor = YYNOCODE;
151050 151127         }else{
151051 151128           while( yypParser->yytos >= yypParser->yystack
151052         -            && yymx != YYERRORSYMBOL
151053 151129               && (yyact = yy_find_reduce_action(
151054 151130                           yypParser->yytos->stateno,
151055         -                        YYERRORSYMBOL)) >= YY_MIN_REDUCE
       151131  +                        YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
151056 151132           ){
151057 151133             yy_pop_parser_stack(yypParser);
151058 151134           }
151059 151135           if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
151060 151136             yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
151061 151137             yy_parse_failed(yypParser);
151062 151138   #ifndef YYNOERRORRECOVERY
................................................................................
156597 156673         sqlite3 *db = va_arg(ap, sqlite3*);
156598 156674         db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
156599 156675         break;
156600 156676       }
156601 156677   
156602 156678       /*   sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
156603 156679       **
156604         -    ** If parameter onoff is non-zero, configure the wrappers so that all
156605         -    ** subsequent calls to localtime() and variants fail. If onoff is zero,
156606         -    ** undo this setting.
       156680  +    ** If parameter onoff is non-zero, subsequent calls to localtime()
       156681  +    ** and its variants fail. If onoff is zero, undo this setting.
156607 156682       */
156608 156683       case SQLITE_TESTCTRL_LOCALTIME_FAULT: {
156609 156684         sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int);
156610 156685         break;
156611 156686       }
       156687  +
       156688  +    /*   sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCS, int onoff);
       156689  +    **
       156690  +    ** If parameter onoff is non-zero, internal-use-only SQL functions
       156691  +    ** are visible to ordinary SQL.  This is useful for testing but is
       156692  +    ** unsafe because invalid parameters to those internal-use-only functions
       156693  +    ** can result in crashes or segfaults.
       156694  +    */
       156695  +    case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS: {
       156696  +      sqlite3GlobalConfig.bInternalFunctions = va_arg(ap, int);
       156697  +      break;
       156698  +    }
156612 156699   
156613 156700       /*   sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int);
156614 156701       **
156615 156702       ** Set or clear a flag that indicates that the database file is always well-
156616 156703       ** formed and never corrupt.  This flag is clear by default, indicating that
156617 156704       ** database files might have arbitrary corruption.  Setting the flag during
156618 156705       ** testing causes certain assert() statements in the code to be activated
................................................................................
162393 162480       }
162394 162481       assert( pToken->pSegcsr==0 );
162395 162482     }
162396 162483   
162397 162484     return rc;
162398 162485   }
162399 162486   
       162487  +#ifndef SQLITE_DISABLE_FTS4_DEFERRED
162400 162488   /*
162401 162489   ** This function is called on each phrase after the position lists for
162402 162490   ** any deferred tokens have been loaded into memory. It updates the phrases
162403 162491   ** current position list to include only those positions that are really
162404 162492   ** instances of the phrase (after considering deferred tokens). If this
162405 162493   ** means that the phrase does not appear in the current row, doclist.pList
162406 162494   ** and doclist.nList are both zeroed.
................................................................................
162496 162584         }
162497 162585         sqlite3_free(aPoslist);
162498 162586       }
162499 162587     }
162500 162588   
162501 162589     return SQLITE_OK;
162502 162590   }
       162591  +#endif /* SQLITE_DISABLE_FTS4_DEFERRED */
162503 162592   
162504 162593   /*
162505 162594   ** Maximum number of tokens a phrase may have to be considered for the
162506 162595   ** incremental doclists strategy.
162507 162596   */
162508 162597   #define MAX_INCR_PHRASE_TOKENS 4
162509 162598   
................................................................................
178482 178571   #define JEACH_VALUE   1
178483 178572   #define JEACH_TYPE    2
178484 178573   #define JEACH_ATOM    3
178485 178574   #define JEACH_ID      4
178486 178575   #define JEACH_PARENT  5
178487 178576   #define JEACH_FULLKEY 6
178488 178577   #define JEACH_PATH    7
       178578  +/* The xBestIndex method assumes that the JSON and ROOT columns are
       178579  +** the last two columns in the table.  Should this ever changes, be
       178580  +** sure to update the xBestIndex method. */
178489 178581   #define JEACH_JSON    8
178490 178582   #define JEACH_ROOT    9
178491 178583   
178492 178584     UNUSED_PARAM(pzErr);
178493 178585     UNUSED_PARAM(argv);
178494 178586     UNUSED_PARAM(argc);
178495 178587     UNUSED_PARAM(pAux);
................................................................................
178739 178831   ** 1 if the constraint is found, 3 if the constraint and zRoot are found,
178740 178832   ** and 0 otherwise.
178741 178833   */
178742 178834   static int jsonEachBestIndex(
178743 178835     sqlite3_vtab *tab,
178744 178836     sqlite3_index_info *pIdxInfo
178745 178837   ){
178746         -  int i;
178747         -  int jsonIdx = -1;
178748         -  int rootIdx = -1;
       178838  +  int i;                     /* Loop counter or computed array index */
       178839  +  int aIdx[2];               /* Index of constraints for JSON and ROOT */
       178840  +  int unusableMask = 0;      /* Mask of unusable JSON and ROOT constraints */
       178841  +  int idxMask = 0;           /* Mask of usable == constraints JSON and ROOT */
178749 178842     const struct sqlite3_index_constraint *pConstraint;
178750 178843   
       178844  +  /* This implementation assumes that JSON and ROOT are the last two
       178845  +  ** columns in the table */
       178846  +  assert( JEACH_ROOT == JEACH_JSON+1 );
178751 178847     UNUSED_PARAM(tab);
       178848  +  aIdx[0] = aIdx[1] = -1;
178752 178849     pConstraint = pIdxInfo->aConstraint;
178753 178850     for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
178754         -    if( pConstraint->usable==0 ) continue;
178755         -    if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
178756         -    switch( pConstraint->iColumn ){
178757         -      case JEACH_JSON:   jsonIdx = i;    break;
178758         -      case JEACH_ROOT:   rootIdx = i;    break;
178759         -      default:           /* no-op */     break;
       178851  +    int iCol;
       178852  +    int iMask;
       178853  +    if( pConstraint->iColumn < JEACH_JSON ) continue;
       178854  +    iCol = pConstraint->iColumn - JEACH_JSON;
       178855  +    assert( iCol==0 || iCol==1 );
       178856  +    iMask = 1 << iCol;
       178857  +    if( pConstraint->usable==0 ){
       178858  +      unusableMask |= iMask;
       178859  +    }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
       178860  +      aIdx[iCol] = i;
       178861  +      idxMask |= iMask;
178760 178862       }
178761 178863     }
178762         -  if( jsonIdx<0 ){
       178864  +  if( (unusableMask & ~idxMask)!=0 ){
       178865  +    /* If there are any unusable constraints on JSON or ROOT, then reject
       178866  +    ** this entire plan */
       178867  +    return SQLITE_CONSTRAINT;
       178868  +  }
       178869  +  if( aIdx[0]<0 ){
       178870  +    /* No JSON input.  Leave estimatedCost at the huge value that it was
       178871  +    ** initialized to to discourage the query planner from selecting this
       178872  +    ** plan. */
178763 178873       pIdxInfo->idxNum = 0;
178764         -    pIdxInfo->estimatedCost = 1e99;
178765 178874     }else{
178766 178875       pIdxInfo->estimatedCost = 1.0;
178767         -    pIdxInfo->aConstraintUsage[jsonIdx].argvIndex = 1;
178768         -    pIdxInfo->aConstraintUsage[jsonIdx].omit = 1;
178769         -    if( rootIdx<0 ){
178770         -      pIdxInfo->idxNum = 1;
       178876  +    i = aIdx[0];
       178877  +    pIdxInfo->aConstraintUsage[i].argvIndex = 1;
       178878  +    pIdxInfo->aConstraintUsage[i].omit = 1;
       178879  +    if( aIdx[1]<0 ){
       178880  +      pIdxInfo->idxNum = 1;  /* Only JSON supplied.  Plan 1 */
178771 178881       }else{
178772         -      pIdxInfo->aConstraintUsage[rootIdx].argvIndex = 2;
178773         -      pIdxInfo->aConstraintUsage[rootIdx].omit = 1;
178774         -      pIdxInfo->idxNum = 3;
       178882  +      i = aIdx[1];
       178883  +      pIdxInfo->aConstraintUsage[i].argvIndex = 2;
       178884  +      pIdxInfo->aConstraintUsage[i].omit = 1;
       178885  +      pIdxInfo->idxNum = 3;  /* Both JSON and ROOT are supplied.  Plan 3 */
178775 178886       }
178776 178887     }
178777 178888     return SQLITE_OK;
178778 178889   }
178779 178890   
178780 178891   /* Start a search on a new JSON string */
178781 178892   static int jsonEachFilter(
................................................................................
183787 183898     int argc,
183788 183899     sqlite3_value **argv
183789 183900   ){
183790 183901     GeoPoly *p = geopolyFuncParam(context, argv[0], 0);
183791 183902     if( p ){
183792 183903       if( geopolyArea(p)<0.0 ){
183793 183904         int ii, jj;
183794         -      for(ii=2, jj=p->nVertex*2 - 4; ii<jj; ii+=2, jj-=2){
       183905  +      for(ii=2, jj=p->nVertex*2 - 2; ii<jj; ii+=2, jj-=2){
183795 183906           GeoCoord t = p->a[ii];
183796 183907           p->a[ii] = p->a[jj];
183797 183908           p->a[jj] = t;
183798 183909           t = p->a[ii+1];
183799 183910           p->a[ii+1] = p->a[jj+1];
183800 183911           p->a[jj+1] = t;
183801 183912         }
................................................................................
183804 183915          4+8*p->nVertex, SQLITE_TRANSIENT);
183805 183916       sqlite3_free(p);
183806 183917     }            
183807 183918   }
183808 183919   
183809 183920   #define GEOPOLY_PI 3.1415926535897932385
183810 183921   
183811         -/* Fast approximation for cosine(X) for X between -0.5*pi and 2*pi
       183922  +/* Fast approximation for sine(X) for X between -0.5*pi and 2*pi
183812 183923   */
183813         -static double geopolyCosine(double r){
       183924  +static double geopolySine(double r){
183814 183925     assert( r>=-0.5*GEOPOLY_PI && r<=2.0*GEOPOLY_PI );
183815 183926     if( r>=1.5*GEOPOLY_PI ){
183816 183927       r -= 2.0*GEOPOLY_PI;
183817 183928     }
183818 183929     if( r>=0.5*GEOPOLY_PI ){
183819         -    return -geopolyCosine(r-GEOPOLY_PI);
       183930  +    return -geopolySine(r-GEOPOLY_PI);
183820 183931     }else{
183821 183932       double r2 = r*r;
183822 183933       double r3 = r2*r;
183823 183934       double r5 = r3*r2;
183824 183935       return 0.9996949*r - 0.1656700*r3 + 0.0075134*r5;
183825 183936     }
183826 183937   }
................................................................................
183853 183964     i = 1;
183854 183965     p->hdr[0] = *(unsigned char*)&i;
183855 183966     p->hdr[1] = 0;
183856 183967     p->hdr[2] = (n>>8)&0xff;
183857 183968     p->hdr[3] = n&0xff;
183858 183969     for(i=0; i<n; i++){
183859 183970       double rAngle = 2.0*GEOPOLY_PI*i/n;
183860         -    p->a[i*2] = x - r*geopolyCosine(rAngle-0.5*GEOPOLY_PI);
183861         -    p->a[i*2+1] = y + r*geopolyCosine(rAngle);
       183971  +    p->a[i*2] = x - r*geopolySine(rAngle-0.5*GEOPOLY_PI);
       183972  +    p->a[i*2+1] = y + r*geopolySine(rAngle);
183862 183973     }
183863 183974     sqlite3_result_blob(context, p->hdr, 4+8*n, SQLITE_TRANSIENT);
183864 183975     sqlite3_free(p);
183865 183976   }
183866 183977   
183867 183978   /*
183868 183979   ** If pPoly is a polygon, compute its bounding box. Then:
................................................................................
191798 191909   ** operate on a different database schema, so check for it.
191799 191910   **
191800 191911   ** idxNum is normally 0, but will be 1 if a schema=? constraint exists.
191801 191912   */
191802 191913   static int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
191803 191914     int i;
191804 191915   
191805         -  pIdxInfo->estimatedCost = 1.0e6;  /* Initial cost estimate */
191806         -
191807 191916     /* Look for a valid schema=? constraint.  If found, change the idxNum to
191808 191917     ** 1 and request the value of that constraint be sent to xFilter.  And
191809 191918     ** lower the cost estimate to encourage the constrained version to be
191810 191919     ** used.
191811 191920     */
191812 191921     for(i=0; i<pIdxInfo->nConstraint; i++){
191813         -    if( pIdxInfo->aConstraint[i].usable==0 ) continue;
191814         -    if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
191815 191922       if( pIdxInfo->aConstraint[i].iColumn!=10 ) continue;
       191923  +    if( pIdxInfo->aConstraint[i].usable==0 ) return SQLITE_CONSTRAINT;
       191924  +    if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
191816 191925       pIdxInfo->idxNum = 1;
191817 191926       pIdxInfo->estimatedCost = 1.0;
191818 191927       pIdxInfo->aConstraintUsage[i].argvIndex = 1;
191819 191928       pIdxInfo->aConstraintUsage[i].omit = 1;
191820 191929       break;
191821 191930     }
191822 191931   
................................................................................
192001 192110           if( nLocal<0 ) goto statPageIsCorrupt;
192002 192111           pCell->nLocal = nLocal;
192003 192112           assert( nPayload>=(u32)nLocal );
192004 192113           assert( nLocal<=(nUsable-35) );
192005 192114           if( nPayload>(u32)nLocal ){
192006 192115             int j;
192007 192116             int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4);
       192117  +          if( iOff+nLocal>nUsable ) goto statPageIsCorrupt;
192008 192118             pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);
192009 192119             pCell->nOvfl = nOvfl;
192010 192120             pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl);
192011 192121             if( pCell->aOvfl==0 ) return SQLITE_NOMEM_BKPT;
192012 192122             pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]);
192013 192123             for(j=1; j<nOvfl; j++){
192014 192124               int rc;
................................................................................
192455 192565     ** unavailable
192456 192566     */
192457 192567     for(i=0; i<pIdxInfo->nConstraint; i++){
192458 192568       struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i];
192459 192569       if( p->iColumn!=DBPAGE_COLUMN_SCHEMA ) continue;
192460 192570       if( p->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
192461 192571       if( !p->usable ){
192462         -      /* No solution.  Use the default SQLITE_BIG_DBL cost */
192463         -      pIdxInfo->estimatedRows = 0x7fffffff;
192464         -      return SQLITE_OK;
       192572  +      /* No solution. */
       192573  +      return SQLITE_CONSTRAINT;
192465 192574       }
192466 192575       iPlan = 2;
192467 192576       pIdxInfo->aConstraintUsage[i].argvIndex = 1;
192468 192577       pIdxInfo->aConstraintUsage[i].omit = 1;
192469 192578       break;
192470 192579     }
192471 192580   
................................................................................
199654 199763   ** of this template is copied straight through into the generate parser
199655 199764   ** source file.
199656 199765   **
199657 199766   ** The following is the concatenation of all %include directives from the
199658 199767   ** input grammar file:
199659 199768   */
199660 199769   /* #include <stdio.h> */
       199770  +/* #include <assert.h> */
199661 199771   /************ Begin %include sections from the grammar ************************/
199662 199772   
199663 199773   /* #include "fts5Int.h" */
199664 199774   /* #include "fts5parse.h" */
199665 199775   
199666 199776   /*
199667 199777   ** Disable all error recovery processing in the parser push-down
................................................................................
200981 201091                fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]);
200982 201092           }
200983 201093   #endif
200984 201094           fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion);
200985 201095           fts5yymajor = fts5YYNOCODE;
200986 201096         }else{
200987 201097           while( fts5yypParser->fts5yytos >= fts5yypParser->fts5yystack
200988         -            && fts5yymx != fts5YYERRORSYMBOL
200989 201098               && (fts5yyact = fts5yy_find_reduce_action(
200990 201099                           fts5yypParser->fts5yytos->stateno,
200991         -                        fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE
       201100  +                        fts5YYERRORSYMBOL)) > fts5YY_MAX_SHIFTREDUCE
200992 201101           ){
200993 201102             fts5yy_pop_parser_stack(fts5yypParser);
200994 201103           }
200995 201104           if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){
200996 201105             fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);
200997 201106             fts5yy_parse_failed(fts5yypParser);
200998 201107   #ifndef fts5YYNOERRORRECOVERY
................................................................................
215683 215792   static void fts5SourceIdFunc(
215684 215793     sqlite3_context *pCtx,          /* Function call context */
215685 215794     int nArg,                       /* Number of args */
215686 215795     sqlite3_value **apUnused        /* Function arguments */
215687 215796   ){
215688 215797     assert( nArg==0 );
215689 215798     UNUSED_PARAM2(nArg, apUnused);
215690         -  sqlite3_result_text(pCtx, "fts5: 2018-11-12 15:20:44 f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a040352513", -1, SQLITE_TRANSIENT);
       215799  +  sqlite3_result_text(pCtx, "fts5: 2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9", -1, SQLITE_TRANSIENT);
215691 215800   }
215692 215801   
215693 215802   /*
215694 215803   ** Return true if zName is the extension on one of the shadow tables used
215695 215804   ** by this module.
215696 215805   */
215697 215806   static int fts5ShadowName(const char *zName){
................................................................................
220411 220520   #endif
220412 220521     return rc;
220413 220522   }
220414 220523   #endif /* SQLITE_CORE */
220415 220524   #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
220416 220525   
220417 220526   /************** End of stmt.c ************************************************/
220418         -#if __LINE__!=220418
       220527  +#if __LINE__!=220527
220419 220528   #undef SQLITE_SOURCE_ID
220420         -#define SQLITE_SOURCE_ID      "2018-11-12 15:20:44 f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a04035alt2"
       220529  +#define SQLITE_SOURCE_ID      "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238alt2"
220421 220530   #endif
220422 220531   /* Return the source-id for this library */
220423 220532   SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
220424 220533   /************************** End of sqlite3.c ******************************/

Changes to src/sqlite3.h.

   121    121   **
   122    122   ** See also: [sqlite3_libversion()],
   123    123   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   124    124   ** [sqlite_version()] and [sqlite_source_id()].
   125    125   */
   126    126   #define SQLITE_VERSION        "3.26.0"
   127    127   #define SQLITE_VERSION_NUMBER 3026000
   128         -#define SQLITE_SOURCE_ID      "2018-11-12 15:20:44 f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a040352513"
          128  +#define SQLITE_SOURCE_ID      "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
   129    129   
   130    130   /*
   131    131   ** CAPI3REF: Run-Time Library Version Numbers
   132    132   ** KEYWORDS: sqlite3_version sqlite3_sourceid
   133    133   **
   134    134   ** These interfaces provide the same information as the [SQLITE_VERSION],
   135    135   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  3629   3629   ** deplete the limited store of lookaside memory. Future versions of
  3630   3630   ** SQLite may act on this hint differently.
  3631   3631   **
  3632   3632   ** [[SQLITE_PREPARE_NORMALIZE]] ^(<dt>SQLITE_PREPARE_NORMALIZE</dt>
  3633   3633   ** <dd>The SQLITE_PREPARE_NORMALIZE flag indicates that a normalized
  3634   3634   ** representation of the SQL statement should be calculated and then
  3635   3635   ** associated with the prepared statement, which can be obtained via
  3636         -** the [sqlite3_normalized_sql()] interface.  The semantics used to
         3636  +** the [sqlite3_normalized_sql()] interface.)^  The semantics used to
  3637   3637   ** normalize a SQL statement are unspecified and subject to change.
  3638   3638   ** At a minimum, literal values will be replaced with suitable
  3639   3639   ** placeholders.
  3640   3640   ** </dl>
  3641   3641   */
  3642   3642   #define SQLITE_PREPARE_PERSISTENT              0x01
  3643   3643   #define SQLITE_PREPARE_NORMALIZE               0x02
................................................................................
  7238   7238   #define SQLITE_TESTCTRL_PENDING_BYTE            11
  7239   7239   #define SQLITE_TESTCTRL_ASSERT                  12
  7240   7240   #define SQLITE_TESTCTRL_ALWAYS                  13
  7241   7241   #define SQLITE_TESTCTRL_RESERVE                 14
  7242   7242   #define SQLITE_TESTCTRL_OPTIMIZATIONS           15
  7243   7243   #define SQLITE_TESTCTRL_ISKEYWORD               16  /* NOT USED */
  7244   7244   #define SQLITE_TESTCTRL_SCRATCHMALLOC           17  /* NOT USED */
         7245  +#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS      17
  7245   7246   #define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
  7246   7247   #define SQLITE_TESTCTRL_EXPLAIN_STMT            19  /* NOT USED */
  7247   7248   #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD    19
  7248   7249   #define SQLITE_TESTCTRL_NEVER_CORRUPT           20
  7249   7250   #define SQLITE_TESTCTRL_VDBE_COVERAGE           21
  7250   7251   #define SQLITE_TESTCTRL_BYTEORDER               22
  7251   7252   #define SQLITE_TESTCTRL_ISINIT                  23
................................................................................
  9420   9421     unsigned int *anQueue;            /* Number of pending entries in the queue */
  9421   9422     int nCoord;                       /* Number of coordinates */
  9422   9423     int iLevel;                       /* Level of current node or entry */
  9423   9424     int mxLevel;                      /* The largest iLevel value in the tree */
  9424   9425     sqlite3_int64 iRowid;             /* Rowid for current entry */
  9425   9426     sqlite3_rtree_dbl rParentScore;   /* Score of parent node */
  9426   9427     int eParentWithin;                /* Visibility of parent node */
  9427         -  int eWithin;                      /* OUT: Visiblity */
         9428  +  int eWithin;                      /* OUT: Visibility */
  9428   9429     sqlite3_rtree_dbl rScore;         /* OUT: Write the score here */
  9429   9430     /* The following fields are only available in 3.8.11 and later */
  9430   9431     sqlite3_value **apSqlParam;       /* Original SQL values of parameters */
  9431   9432   };
  9432   9433   
  9433   9434   /*
  9434   9435   ** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.

Changes to win/Makefile.mingw.

   172    172   endif
   173    173   
   174    174   #### The directories where the OpenSSL include and library files are located.
   175    175   #    The recommended usage here is to use the Sysinternals junction tool
   176    176   #    to create a hard link between an "openssl-1.x" sub-directory of the
   177    177   #    Fossil source code directory and the target OpenSSL source directory.
   178    178   #
   179         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2p
          179  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2q
   180    180   OPENSSLINCDIR = $(OPENSSLDIR)/include
   181    181   OPENSSLLIBDIR = $(OPENSSLDIR)
   182    182   
   183    183   #### Either the directory where the Tcl library is installed or the Tcl
   184    184   #    source code directory resides (depending on the value of the macro
   185    185   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   186    186   #    this directory must have "include" and "lib" sub-directories.  If

Changes to win/Makefile.mingw.mistachkin.

   172    172   endif
   173    173   
   174    174   #### The directories where the OpenSSL include and library files are located.
   175    175   #    The recommended usage here is to use the Sysinternals junction tool
   176    176   #    to create a hard link between an "openssl-1.x" sub-directory of the
   177    177   #    Fossil source code directory and the target OpenSSL source directory.
   178    178   #
   179         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2p
          179  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2q
   180    180   OPENSSLINCDIR = $(OPENSSLDIR)/include
   181    181   OPENSSLLIBDIR = $(OPENSSLDIR)
   182    182   
   183    183   #### Either the directory where the Tcl library is installed or the Tcl
   184    184   #    source code directory resides (depending on the value of the macro
   185    185   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   186    186   #    this directory must have "include" and "lib" sub-directories.  If
................................................................................
   524    524     $(SRCDIR)/popen.c \
   525    525     $(SRCDIR)/pqueue.c \
   526    526     $(SRCDIR)/printf.c \
   527    527     $(SRCDIR)/publish.c \
   528    528     $(SRCDIR)/purge.c \
   529    529     $(SRCDIR)/rebuild.c \
   530    530     $(SRCDIR)/regexp.c \
          531  +  $(SRCDIR)/repolist.c \
   531    532     $(SRCDIR)/report.c \
   532    533     $(SRCDIR)/rss.c \
   533    534     $(SRCDIR)/schema.c \
   534    535     $(SRCDIR)/search.c \
   535    536     $(SRCDIR)/security_audit.c \
   536    537     $(SRCDIR)/setup.c \
   537    538     $(SRCDIR)/setupuser.c \
................................................................................
   734    735     $(OBJDIR)/popen_.c \
   735    736     $(OBJDIR)/pqueue_.c \
   736    737     $(OBJDIR)/printf_.c \
   737    738     $(OBJDIR)/publish_.c \
   738    739     $(OBJDIR)/purge_.c \
   739    740     $(OBJDIR)/rebuild_.c \
   740    741     $(OBJDIR)/regexp_.c \
          742  +  $(OBJDIR)/repolist_.c \
   741    743     $(OBJDIR)/report_.c \
   742    744     $(OBJDIR)/rss_.c \
   743    745     $(OBJDIR)/schema_.c \
   744    746     $(OBJDIR)/search_.c \
   745    747     $(OBJDIR)/security_audit_.c \
   746    748     $(OBJDIR)/setup_.c \
   747    749     $(OBJDIR)/setupuser_.c \
................................................................................
   871    873    $(OBJDIR)/popen.o \
   872    874    $(OBJDIR)/pqueue.o \
   873    875    $(OBJDIR)/printf.o \
   874    876    $(OBJDIR)/publish.o \
   875    877    $(OBJDIR)/purge.o \
   876    878    $(OBJDIR)/rebuild.o \
   877    879    $(OBJDIR)/regexp.o \
          880  + $(OBJDIR)/repolist.o \
   878    881    $(OBJDIR)/report.o \
   879    882    $(OBJDIR)/rss.o \
   880    883    $(OBJDIR)/schema.o \
   881    884    $(OBJDIR)/search.o \
   882    885    $(OBJDIR)/security_audit.o \
   883    886    $(OBJDIR)/setup.o \
   884    887    $(OBJDIR)/setupuser.o \
................................................................................
  1227   1230   		$(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \
  1228   1231   		$(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \
  1229   1232   		$(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \
  1230   1233   		$(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \
  1231   1234   		$(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \
  1232   1235   		$(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \
  1233   1236   		$(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \
         1237  +		$(OBJDIR)/repolist_.c:$(OBJDIR)/repolist.h \
  1234   1238   		$(OBJDIR)/report_.c:$(OBJDIR)/report.h \
  1235   1239   		$(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \
  1236   1240   		$(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \
  1237   1241   		$(OBJDIR)/search_.c:$(OBJDIR)/search.h \
  1238   1242   		$(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \
  1239   1243   		$(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \
  1240   1244   		$(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \
................................................................................
  2000   2004   $(OBJDIR)/regexp_.c:	$(SRCDIR)/regexp.c $(TRANSLATE)
  2001   2005   	$(TRANSLATE) $(SRCDIR)/regexp.c >$@
  2002   2006   
  2003   2007   $(OBJDIR)/regexp.o:	$(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h
  2004   2008   	$(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c
  2005   2009   
  2006   2010   $(OBJDIR)/regexp.h:	$(OBJDIR)/headers
         2011  +
         2012  +$(OBJDIR)/repolist_.c:	$(SRCDIR)/repolist.c $(TRANSLATE)
         2013  +	$(TRANSLATE) $(SRCDIR)/repolist.c >$@
         2014  +
         2015  +$(OBJDIR)/repolist.o:	$(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h $(SRCDIR)/config.h
         2016  +	$(XTCC) -o $(OBJDIR)/repolist.o -c $(OBJDIR)/repolist_.c
         2017  +
         2018  +$(OBJDIR)/repolist.h:	$(OBJDIR)/headers
  2007   2019   
  2008   2020   $(OBJDIR)/report_.c:	$(SRCDIR)/report.c $(TRANSLATE)
  2009   2021   	$(TRANSLATE) $(SRCDIR)/report.c >$@
  2010   2022   
  2011   2023   $(OBJDIR)/report.o:	$(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h
  2012   2024   	$(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c
  2013   2025   

Changes to win/Makefile.msc.

    96     96   
    97     97   # Enable support for the SQLite Encryption Extension?
    98     98   !ifndef USE_SEE
    99     99   USE_SEE = 0
   100    100   !endif
   101    101   
   102    102   !if $(FOSSIL_ENABLE_SSL)!=0
   103         -SSLDIR    = $(B)\compat\openssl-1.0.2p
          103  +SSLDIR    = $(B)\compat\openssl-1.0.2q
   104    104   SSLINCDIR = $(SSLDIR)\inc32
   105    105   !if $(FOSSIL_DYNAMIC_BUILD)!=0
   106    106   SSLLIBDIR = $(SSLDIR)\out32dll
   107    107   !else
   108    108   SSLLIBDIR = $(SSLDIR)\out32
   109    109   !endif
   110    110   SSLLFLAGS = /nologo /opt:ref /debug

Added www/admin-v-setup.md.

            1  +# The Differences Between the Setup and Admin User Capabilities
            2  +
            3  +Several of the Fossil user capabilities form a clear power hierarchy.
            4  +Mathematically speaking:
            5  +
            6  +> *Setup > Admin > Moderator > User > Subscriber > Anonymous > Nobody*
            7  +    
            8  +This document explains the distinction between the first two. For the
            9  +others, see:
           10  +
           11  +* [How Moderation Works](./forum.wiki#moderation)
           12  +
           13  +* [Users vs Subscribers](./alerts.md#uvs)
           14  +
           15  +* [Defense Against Spiders](./antibot.wiki)
           16  +
           17  +
           18  +## Philosophical Core
           19  +
           20  +The Setup user "owns" the Fossil repository and may delegate a subset of
           21  +that power to one or more Admin users.
           22  +
           23  +The Setup user can grant Admin capability and take it away, but Admin
           24  +users cannot grant themselves Setup capability, either directly via the
           25  +Admin → Users UI page or via any indirect means. (If you discover
           26  +indirect means to elevate Admin privilege to Setup, it's a bug, so
           27  +please [report it][forum]!)
           28  +
           29  +It is common for the Setup user to have administrative control over the
           30  +host system running the Fossil repository, whereas it makes no sense for
           31  +Admin users to have that ability. If an Admin-only user had `root`
           32  +access on a Linux box running the Fossil instance they are an Admin on,
           33  +they could elevate their capability to Setup in several ways. (The
           34  +`fossil admin` command, the `fossil sql` command, editing the repository
           35  +DB file directly, etc.) Therefore, if you wish to grant someone
           36  +Setup-like capability on a Fossil repository but you're unwilling to
           37  +give them full control over the host system, you probably want to grant
           38  +them Admin capability instead.
           39  +
           40  +Admin power is delegated from Setup. When a Setup user grants Admin
           41  +capability, it is an expression of trust in that user's judgement.
           42  +
           43  +Admin-only users must not fight against the policies of the Setup user.
           44  +Such a rift would be just cause for the Setup user to strip the Admin
           45  +user's capabilities, for the ex-Admin to fork the repository, and for
           46  +both to go their separate ways.
           47  +
           48  +A useful rule of thumb here is that Admin users should only change
           49  +things that the Setup user has not changed from the stock configuration.
           50  +In this way, an Admin-only user can avoid overriding the Setup user's
           51  +choices.
           52  +
           53  +This rule is not enforced by the Fossil permission system for a couple
           54  +of reasons:
           55  +
           56  +1.  There are too many exceptions to encode in the remaining
           57  +    [user capability bits][ucap]. As of this writing, we've already
           58  +    assigned meaning to all of the lowercase letters, most of the
           59  +    decimal digits, and a few of the uppercase letters. We'd rather not
           60  +    resort to punctuation and Unicode to express future extensions to
           61  +    the policy choices Fossil offers its power users.
           62  +
           63  +2.  Even if we had enough suitable printable ASCII characters left to
           64  +    assign one to every imaginable purpose and policy, we want to keep
           65  +    the number of exceptions manageable. Consider the Admin → Settings
           66  +    page, which is currently restricted to Setup users only: you might
           67  +    imagine breaking this up into several subsets so that some subsets
           68  +    are available to non-Setup users, each controlled by a user
           69  +    capability bit. Is that a good idea? Maybe, but it should be done
           70  +    only after due consideration. It would definitely be wrong to assign
           71  +    a user capability bit to *each* setting on that page.
           72  +
           73  +Let's consider a concrete application of this rule: Admin → Skins.
           74  +Fossil grants Admin-only users full access to this page so that the
           75  +Admins can maintain and extend the skin as the repository evolves, not
           76  +so Admins can switch the entire skin to another without consulting with
           77  +the Setup user first. If, during a forum discussion one of the mere
           78  +users notices a problem with the skin, an Admin-only user should feel
           79  +free to correct this without bothering the Setup user.
           80  +
           81  +Another common case is that the Setup user upgrades Fossil on the server
           82  +but forgets to merge the upstream skin changes: Admin users are
           83  +entrusted to do that work on behalf of the Setup user.
           84  +
           85  +
           86  +## Capability Groups
           87  +
           88  +We can break up the set of powers the Admin user capability grants into
           89  +several groups, then defend each group as a coherent whole.
           90  +
           91  +
           92  +### Security
           93  +
           94  +While establishing the Fossil repository's security policy is a task for
           95  +the Setup user, *maintaining* that policy is something that Fossil
           96  +allows a Setup user to delegate to trustworthy users via the Admin user
           97  +capability:
           98  +
           99  +*   **Manage users**: The only thing an Admin-only user cannot do on the
          100  +    Admin → Users page is grant Setup capability, either to themselves
          101  +    or to other users. The intent is that Admin users be able to take
          102  +    some of the load of routine user management tasks off the shoulders
          103  +    of the Setup user: delete accounts created by spammers, fix email
          104  +    alert subscriptions, reset passwords, etc.
          105  +
          106  +*   **Security audit**: The Admin → Security-Audit page runs several
          107  +    tests on the Fossil repository's configuration, then reports
          108  +    potential problems it found and offers canned solutions. Those
          109  +    canned solutions do not do anything that an Admin-user could not do
          110  +    via other means, so this page offers the Admin-only user no more
          111  +    power than they otherwise had. For example, this page's "Take it
          112  +    Private" feature can also be done manually via Admin → Users. This
          113  +    page is a convenience, not a grant of new power to the Admin-only
          114  +    user.
          115  +
          116  +*   **Logging**:<a id="log"></a> Admin-only users get to see the various
          117  +    Fossil logs in case they need to use them to understand a problem
          118  +    they're empowered to solve. An obvious example is a spam attack: the
          119  +    Admin might want to find the user's last-used IP, see if they cloned
          120  +    the repository, see if they attempted to brute-force an existing
          121  +    login before self-registering, etc.
          122  +
          123  +Some security-conscious people might be bothered by the fact that
          124  +Admin-only users have these abilities. Think of a large IT organization:
          125  +if the CIO hires a [tiger team][tt] to test the company's internal IT
          126  +defenses, the line grunts fix the reported problems, not the CIO.
          127  +
          128  +
          129  +### Administrivia
          130  +
          131  +It is perfectly fine for a Fossil repository to only have Setup users,
          132  +no Admin users. The smaller the repository, the more likely the
          133  +repository has no Admin-only users. If the Setup user neither needs nor
          134  +wants to grant Admin power to others, there is no requirement in Fossil
          135  +to do so. [Setup capabilty is a pure superset of Admin capability.][sia]
          136  +
          137  +As the number of users on a Fossil repository grows, the value in
          138  +delegating administrivia also grows, because the Setup user typically
          139  +has other time sinks they consider more important.
          140  +
          141  +Admin users can take over the following routine tasks on behalf of the
          142  +Setup user:
          143  +
          144  +*   **Shunning**: After user management, this is one of the greatest
          145  +    powers of an Admin-only user. Fossil grants access to the Admin →
          146  +    Shunned page to Admin users rather than reserve it to Setup users
          147  +    because one of the primary purposes of [the Fossil shunning
          148  +    system](./shunning.wiki) is to clean up after a spammer, and that's
          149  +    exactly the sort of administrivia we wish to delegate to Admin users.
          150  +
          151  +    Coupled with the Rebuild button on the same page, an Admin user has
          152  +    the power to delete the repository's entire
          153  +    [blockchain](./blockchain.md)! This makes this feature a pretty good
          154  +    razor in deciding whether to grant someone Admin capability: do you
          155  +    trust that user to shun Fossil artifacts responsibly?
          156  +
          157  +    Realize that shunning is cooperative in Fossil. As long as there are
          158  +    surviving repository clones, an Admin-only user who deletes the
          159  +    whole blockchain has merely caused a nuisance. An Admin-only user
          160  +    cannot permanently destroy the repository unless the Setup user has
          161  +    been so silly as to have no up-to-date clones.
          162  +
          163  +*   **Moderation**: According to the power hierarchy laid out at the top
          164  +    of this article, Admins are greater than Moderators, so control over
          165  +    what Moderators can do clearly belongs to both Admins and to the
          166  +    Setup user(s).
          167  +
          168  +*   **Status**: Although the Fossil `/stat` page is visible to every
          169  +    user with Read capability, there are several additional things this
          170  +    page gives access to when a user also has the Admin capability:
          171  +
          172  +    *   <p>[Email alerts](./alerts.md) and [backoffice](./backoffice.md)
          173  +        status. Admin-only users cannot modify the email alerts setup,
          174  +        but they can see some details about its configuration and
          175  +        current status.</p>
          176  +
          177  +    *   <p>The `/urllist` page, which is a read-only page showing the
          178  +        ways the repository can be accessed and how it has been accessed
          179  +        in the past. Logically, this is an extension to logging,
          180  +        [covered above](#log).</p>
          181  +
          182  +    *   <p>The Fossil repository SQL schema. This is not particularly
          183  +        sensitive information, since you get more or less the same
          184  +        information when you clone the repository. It's restricted to
          185  +        Admin because it's primarily useful in debugging SQL errors,
          186  +        which happen most often when Fossil itself is in flux and the
          187  +        schema isn't being automatically updated correctly. That puts
          188  +        this squarely into the "administrivia" category.</p>
          189  +
          190  +    *   <p>Web cache status, environment, and logging: more
          191  +        administrivia meant to help the Admin debug problems.</p>
          192  +
          193  +*   **Configure search**
          194  +
          195  +
          196  +### Cosmetics
          197  +
          198  +While the Setup user is responsible for setting up the initial "look" of
          199  +a Fossil repository, the Setup user entrusts Admin users with
          200  +*maintaining* that look. An Admin-only user therefore has the following
          201  +special abilities:
          202  +
          203  +*   Modify the repository skin
          204  +
          205  +*   Create and modify URL aliases
          206  +
          207  +*   Manage the "ad units" feature, if enabled.
          208  +
          209  +*   Adjust the `/timeline` display preferences.
          210  +
          211  +*   Change the "logo" element displayed by some skins.
          212  +
          213  +These capabilities allow an Admin-only user to affect the branding and
          214  +possibly even the back-end finances of a project. This is why we began
          215  +this document with a philosophical discussion: if you cannot entrust a
          216  +user with these powers, you should not grant that user Admin capability.
          217  +
          218  +
          219  +## Clones and Backups
          220  +
          221  +Keep in mind that Fossil is a *distributed* version control system,
          222  +which means that a user known to Fossil might have Setup capability on
          223  +one repository but be a mere "user" on one of its clones. The most
          224  +common case is that when you clone a repository, even anonymously, you
          225  +gain Setup power over the local clone.
          226  +
          227  +The distinctions above therefore are intransitive: they apply only
          228  +within a single repository instance.
          229  +
          230  +The exception to this is when the clone is done as a Setup user, since
          231  +this also copies the `user` table on the initial clone. A user with
          232  +Setup capability can subsequently say [`fossil conf pull all`][fcp] to
          233  +update that table and everything else not normally synchronized between
          234  +Fossil repositories. In this way, a Setup user can create multiple
          235  +interchangeable clones. This is useful not only to guard against rogue
          236  +Admin-only users, it is a useful element of a load balancing and
          237  +failover system.
          238  +
          239  +
          240  +## Setup-Only Features
          241  +
          242  +Some features are now and must always be restricted to Setup users only.
          243  +
          244  +*   **Configuration**: The Admin → Configuration page nominally falls
          245  +    under Cosmetics above, but it's such a core part of the Fossil
          246  +    configuration — something every Setup user is expected to fully
          247  +    specify on initial repository setup — that we have trouble
          248  +    justifying any case where an Admin-only user would have good cause
          249  +    to modify any of it. This page is generally set up once and then
          250  +    never touched again.
          251  +
          252  +*   **Access**: The Admin → Access page falls under the Security
          253  +    category above, but like Configuration, it's generally something set
          254  +    up once and never touched, so only Setup users should change it.
          255  +
          256  +*   **Login-Group**: Login groups allow one Fossil repository to
          257  +    delegate user access to another. Since an Admin-only user on one
          258  +    repo might not have such access to another repo on the same host
          259  +    system, this must be a Setup-only task.
          260  +
          261  +*   **Settings**: The [repository settings][rs] available via Admin →
          262  +    Settings have too wide a range of power to allow modification by
          263  +    Admin-only users:
          264  +
          265  +    *   <p><b>Harmless</b>: Admin-only users on a repository may well
          266  +        have checkin rights on the repository, so the fact that
          267  +        versionable settings like `crlf-glob` can also be set at the
          268  +        repository level seems like a thing we might want to allow
          269  +        Admin-only users the ability to change. Since Fossil currently
          270  +        has no way to allow only some settings to be changed by
          271  +        Admin-only users and some not, we can't just show these harmless
          272  +        settings to Admin-only users.</p>
          273  +
          274  +    *   <p><b>Low-Risk</b>: The <tt>admin-log</tt> setting controls
          275  +        whether the Fossil admin log is generated. Since we've <a
          276  +        href="#log">already decided</a> that Admin-only users can see
          277  +        this log, it seems fine that the Admin users can choose whether
          278  +        this log gets generated in the first place.</p>
          279  +
          280  +        <p>There's a small risk that a rogue Admin user could disable
          281  +        the log before doing something evil that the log would capture,
          282  +        so ideally, we'd want to restrict changing this setting from 1
          283  +        to 0 to Setup only while allowing Admin-only users to change it
          284  +        from 0 to 1. Fossil doesn't currently allow that.</p>
          285  +
          286  +    *   <p><b>Risky</b>: The <tt>https-login</tt> setting falls under
          287  +        the "Security" section above, but it should probably never be
          288  +        adjusted by Admin-only users. Sites that want it on will never
          289  +        want it to be disabled without a very good reason.</p>
          290  +        
          291  +        <p>There is also an inverse risk: if the site has a front-end
          292  +        HTTPS proxy that uses HTTP to communicate over localhost to
          293  +        Fossil, enabling this setting will create an infinite redirect
          294  +        loop! (Ask me how I know.)</p>
          295  +
          296  +    *   <p><b>Dangerous</b>: The <tt>email-send-command</tt> setting
          297  +        could allow a rogue Admin to run arbitrary commands on the host
          298  +        system, unless it's prevented via some kind of host-specific
          299  +        restriction.  (chroot, jails, SELinux, VMs, etc.) Since it makes
          300  +        no sense to trust Admin-only users with <tt>root</tt> level
          301  +        access on the host system, we almost certainly don't want to
          302  +        allow them to change such settings.</p>
          303  +
          304  +*   **SQL**: The Admin → SQL feature allows the Setup user to enter raw
          305  +    SQL queries against the Fossil repository via Fossil UI. This not
          306  +    only allows arbitrary ability to modify the repository blockchain
          307  +    and its backing data tables, it can probably also be used to damage
          308  +    the host such as via `PRAGMA temp_store = FILE`.
          309  +
          310  +*   **TH1**: The [TH1 language][TH1] is quite restricted relative to the
          311  +    Tcl language it descends from, so this author does not believe there
          312  +    is a way to damage the Fossil repository or its host via the Admin →
          313  +    TH1 feature, which allows exeuction of arbitrary TH1 code within the
          314  +    repository's execution context. Nevertheless, interpreters are a
          315  +    well-known source of security problems, so it seems best to restrict
          316  +    this feature to Setup-only users as long as we lack a good reason
          317  +    for Admin-only users to have access to it.
          318  +
          319  +
          320  +[fcp]:   https://fossil-scm.org/fossil/help?cmd=configuration
          321  +[forum]: https://fossil-scm.org/forum/
          322  +[rs]:    https://www.fossil-scm.org/index.html/doc/trunk/www/settings.wiki
          323  +[sia]:   https://fossil-scm.org/fossil/artifact?udc=1&ln=1259-1260&name=0fda31b6683c206a
          324  +[th1]:   https://www.fossil-scm.org/index.html/doc/trunk/www/th1.md
          325  +[tt]:    https://en.wikipedia.org/wiki/Tiger_team#Security
          326  +[ucap]:  https://fossil-scm.org/fossil/setup_ucap_list

Changes to www/alerts.md.

   472    472   
   473    473   
   474    474   <a id="uvs"></a>
   475    475   ## Users vs Subscribers
   476    476   
   477    477   Fossil makes a distinction between "users" and "subscribers".  A user is
   478    478   someone with a username and password: that is, someone who can log into
   479         -the Fossi repository.  A subscriber is someone who receives email
          479  +the Fossil repository.  A subscriber is someone who receives email
   480    480   alerts.  Users can also be subscribers and subscribers can be users, but
   481    481   that does not have to be the case.  It is possible to be a user without
   482    482   being a subscriber and to be a subscriber without being a user.
   483    483   
   484    484   In the repository database file, users are tracked with the `user` table
   485    485   and subscribers are tracked via the `subscriber` table.
   486    486   

Changes to www/backoffice.md.

   164    164   for a repository:
   165    165   
   166    166   >  fossil test-backoffice-lease -R _REPOSITORY_
   167    167   
   168    168   Running that command every few seconds should show what is going on with
   169    169   backoffice processing in a particular repository.
   170    170   
   171         -There are also two settings that control backoffice behavior.  The
          171  +There are also settings that control backoffice behavior.  The
   172    172   "backoffice-nodelay" setting prevents the "next" process from taking a
   173    173   lease and sleeping.  If "backoffice-nodelay" is set, that causes all
   174    174   backoffice processes to exit either immediately or after doing whatever
   175    175   backoffice works needs to be done.  If something is going wrong and
   176    176   backoffice leases are causing delays in webpage processing, then setting
   177    177   "backoffice-nodelay" to true can work around the problem until the bug
   178    178   can be fixed.  The "backoffice-logfile" setting is the name of a log
   179    179   file onto which is appended a short message everything a backoffice
   180    180   process actually starts to do the backoffice work.  This log file can
   181    181   be used to verify that backoffice really is running, if there is any
   182         -doubt.  Most installations should leave "backoffice-nodelay" off and
          182  +doubt.  The "backoffice-disable" setting prevents automatic backoffice
          183  +processing, if true.  Use this to completely disable backoffice processing
          184  +that occurs automatically after each HTTP request.  The "backoffice-disable"
          185  +setting does not affect the operation of the manual 
          186  +"fossil backoffice" command.
          187  +Most installations should leave "backoffice-nodelay" and "backoffice-disable"
          188  +set to their default values of off and
   183    189   leave "backoffice-logfile" unset or set to an empty string.

Changes to www/build.wiki.

   134    134   file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to
   135    135   detect and use the latest installed version of MSVC.<br><br>To enable
   136    136   the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
   137    137   first <a href="https://www.openssl.org/source/">download the official
   138    138   source code for OpenSSL</a> and extract it to an appropriately named
   139    139   "<b>openssl-X.Y.ZA</b>" subdirectory within the local
   140    140   [/tree?ci=trunk&name=compat | compat] directory (e.g.
   141         -"<b>compat/openssl-1.0.2p</b>"), then make sure that some recent
          141  +"<b>compat/openssl-1.0.2q</b>"), then make sure that some recent
   142    142   <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
   143    143   and finally run one of the following commands:
   144    144   <blockquote><pre>
   145    145   nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
   146    146   </pre></blockquote>
   147    147   <blockquote><pre>
   148    148   buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin

Changes to www/mkindex.tcl.

     7      7   #
     8      8   
     9      9   set doclist {
    10     10     aboutcgi.wiki {How CGI Works In Fossil}
    11     11     aboutdownload.wiki {How The Download Page Works}
    12     12     adding_code.wiki {Adding New Features To Fossil}
    13     13     adding_code.wiki {Hacking Fossil}
           14  +  admin-v-setup.md {The Differences Between the Setup and Admin User Capabilities}
    14     15     alerts.md {Email Alerts And Notifications}
    15     16     antibot.wiki {Defense against Spiders and Bots}
    16     17     backoffice.md {The "Backoffice" mechanism of Fossil}
    17     18     blame.wiki {The Annotate/Blame Algorithm Of Fossil}
    18     19     blockchain.md {Fossil As Blockchain}
    19     20     branching.wiki {Branching, Forking, Merging, and Tagging}
    20     21     bugtheory.wiki {Bug Tracking In Fossil}

Changes to www/permutedindex.html.

    20     20   <a name="pindex"></a>
    21     21   <h2>Permuted Index:</h2>
    22     22   <ul>
    23     23   <li><a href="fiveminutes.wiki">5 Minutes as a Single User &mdash; Up and Running in</a></li>
    24     24   <li><a href="fossil-from-msvc.wiki">2010 IDE &mdash; Integrating Fossil in the Microsoft Express</a></li>
    25     25   <li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li>
    26     26   <li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li>
           27  +<li><a href="admin-v-setup.md">Admin User Capabilities &mdash; The Differences Between the Setup and</a></li>
    27     28   <li><a href="copyright-release.html">Agreement &mdash; Contributor License</a></li>
    28     29   <li><a href="alerts.md">Alerts And Notifications &mdash; Email</a></li>
    29     30   <li><a href="delta_encoder_algorithm.wiki">Algorithm &mdash; Fossil Delta Encoding</a></li>
    30     31   <li><a href="blame.wiki">Algorithm Of Fossil &mdash; The Annotate/Blame</a></li>
    31     32   <li><a href="blame.wiki">Annotate/Blame Algorithm Of Fossil &mdash; The</a></li>
    32     33   <li><a href="customskin.md">Appearance of Web Pages &mdash; Theming: Customizing The</a></li>
    33     34   <li><a href="faq.wiki">Asked Questions &mdash; Frequently</a></li>
    34     35   <li><a href="password.wiki">Authentication &mdash; Password Management And</a></li>
    35     36   <li><a href="backoffice.md">Backoffice mechanism of Fossil &mdash; The</a></li>
    36     37   <li><a href="whyusefossil.wiki"><b>Benefits Of Version Control</b></a></li>
    37     38   <li><a href="hashpolicy.wiki">Between SHA1 and SHA3-256 &mdash; Hash Policy: Choosing</a></li>
           39  +<li><a href="admin-v-setup.md">Between the Setup and Admin User Capabilities &mdash; The Differences</a></li>
    38     40   <li><a href="blockchain.md">Blockchain &mdash; Fossil As</a></li>
    39     41   <li><a href="antibot.wiki">Bots &mdash; Defense against Spiders and</a></li>
    40     42   <li><a href="private.wiki">Branches &mdash; Creating, Syncing, and Deleting Private</a></li>
    41     43   <li><a href="branching.wiki"><b>Branching, Forking, Merging, and Tagging</b></a></li>
    42     44   <li><a href="bugtheory.wiki"><b>Bug Tracking In Fossil</b></a></li>
    43     45   <li><a href="makefile.wiki">Build Process &mdash; The Fossil</a></li>
           46  +<li><a href="admin-v-setup.md">Capabilities &mdash; The Differences Between the Setup and Admin User</a></li>
    44     47   <li><a href="aboutcgi.wiki">CGI Works In Fossil &mdash; How</a></li>
    45     48   <li><a href="changes.wiki">Changelog &mdash; Fossil</a></li>
    46     49   <li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li>
    47     50   <li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li>
    48     51   <li><a href="checkin.wiki">Checklist &mdash; Check-in</a></li>
    49     52   <li><a href="../test/release-checklist.wiki">Checklist &mdash; Pre-Release Testing</a></li>
    50     53   <li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li>
................................................................................
    73     76   <li><a href="antibot.wiki"><b>Defense against Spiders and Bots</b></a></li>
    74     77   <li><a href="shunning.wiki">Deleting Content From Fossil &mdash; Shunning:</a></li>
    75     78   <li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
    76     79   <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm &mdash; Fossil</a></li>
    77     80   <li><a href="delta_format.wiki">Delta Format &mdash; Fossil</a></li>
    78     81   <li><a href="tech_overview.wiki">Design And Implementation Of Fossil &mdash; A Technical Overview Of The</a></li>
    79     82   <li><a href="theory1.wiki">Design Of The Fossil DVCS &mdash; Thoughts On The</a></li>
           83  +<li><a href="admin-v-setup.md">Differences Between the Setup and Admin User Capabilities &mdash; The</a></li>
    80     84   <li><a href="embeddeddoc.wiki">Documentation &mdash; Embedded Project</a></li>
    81     85   <li><a href="contribute.wiki">Documentation To The Fossil Project &mdash; Contributing Code or</a></li>
    82     86   <li><a href="aboutdownload.wiki">Download Page Works &mdash; How The</a></li>
    83     87   <li><a href="theory1.wiki">DVCS &mdash; Thoughts On The Design Of The Fossil</a></li>
    84     88   <li><a href="quotes.wiki">DVCSes in General &mdash; Quotes: What People Are Saying About Fossil, Git, and</a></li>
    85     89   <li><a href="alerts.md"><b>Email Alerts And Notifications</b></a></li>
    86     90   <li><a href="embeddeddoc.wiki"><b>Embedded Project Documentation</b></a></li>
................................................................................
   198    202   <li><a href="fiveminutes.wiki">Running in 5 Minutes as a Single User &mdash; Up and</a></li>
   199    203   <li><a href="quotes.wiki">Saying About Fossil, Git, and DVCSes in General &mdash; Quotes: What People Are</a></li>
   200    204   <li><a href="th1.md">Scripting Language &mdash; The TH1</a></li>
   201    205   <li><a href="selfcheck.wiki">Self Checks &mdash; Fossil Repository Integrity</a></li>
   202    206   <li><a href="selfhost.wiki">Self Hosting Repositories &mdash; Fossil</a></li>
   203    207   <li><a href="server.wiki">Server &mdash; How To Configure A Fossil</a></li>
   204    208   <li><a href="settings.wiki">Settings &mdash; Fossil</a></li>
          209  +<li><a href="admin-v-setup.md">Setup and Admin User Capabilities &mdash; The Differences Between the</a></li>
   205    210   <li><a href="hashpolicy.wiki">SHA1 and SHA3-256 &mdash; Hash Policy: Choosing Between</a></li>
   206    211   <li><a href="hashpolicy.wiki">SHA3-256 &mdash; Hash Policy: Choosing Between SHA1 and</a></li>
   207    212   <li><a href="shunning.wiki"><b>Shunning: Deleting Content From Fossil</b></a></li>
   208    213   <li><a href="fiveminutes.wiki">Single User &mdash; Up and Running in 5 Minutes as a</a></li>
   209    214   <li><a href="../../../sitemap"><b>Site Map</b></a></li>
   210    215   <li><a href="customskin.md">Skins &mdash; Custom</a></li>
   211    216   <li><a href="style.wiki"><b>Source Code Style Guidelines</b></a></li>
................................................................................
   222    227   <li><a href="tickets.wiki">System &mdash; The Fossil Ticket</a></li>
   223    228   <li><a href="branching.wiki">Tagging &mdash; Branching, Forking, Merging, and</a></li>
   224    229   <li><a href="tech_overview.wiki">Technical Overview Of The Design And Implementation Of Fossil &mdash; A</a></li>
   225    230   <li><a href="../test/release-checklist.wiki">Testing Checklist &mdash; Pre-Release</a></li>
   226    231   <li><a href="th1.md">TH1 Scripting Language &mdash; The</a></li>
   227    232   <li><a href="backoffice.md"><b>The "Backoffice" mechanism of Fossil</b></a></li>
   228    233   <li><a href="blame.wiki"><b>The Annotate/Blame Algorithm Of Fossil</b></a></li>
          234  +<li><a href="admin-v-setup.md"><b>The Differences Between the Setup and Admin User Capabilities</b></a></li>
   229    235   <li><a href="makefile.wiki"><b>The Fossil Build Process</b></a></li>
   230    236   <li><a href="sync.wiki"><b>The Fossil Sync Protocol</b></a></li>
   231    237   <li><a href="tickets.wiki"><b>The Fossil Ticket System</b></a></li>
   232    238   <li><a href="webui.wiki"><b>The Fossil Web Interface</b></a></li>
   233    239   <li><a href="th1.md"><b>The TH1 Scripting Language</b></a></li>
   234    240   <li><a href="customskin.md"><b>Theming: Customizing The Appearance of Web Pages</b></a></li>
   235    241   <li><a href="customgraph.md"><b>Theming: Customizing the Timeline Graph</b></a></li>
................................................................................
   239    245   <li><a href="customgraph.md">Timeline Graph &mdash; Theming: Customizing the</a></li>
   240    246   <li><a href="hints.wiki">Tips And Usage Hints &mdash; Fossil</a></li>
   241    247   <li><a href="bugtheory.wiki">Tracking In Fossil &mdash; Bug</a></li>
   242    248   <li><a href="unvers.wiki"><b>Unversioned Files</b></a></li>
   243    249   <li><a href="fiveminutes.wiki"><b>Up and Running in 5 Minutes as a Single User</b></a></li>
   244    250   <li><a href="hints.wiki">Usage Hints &mdash; Fossil Tips And</a></li>
   245    251   <li><a href="fiveminutes.wiki">User &mdash; Up and Running in 5 Minutes as a Single</a></li>
          252  +<li><a href="admin-v-setup.md">User Capabilities &mdash; The Differences Between the Setup and Admin</a></li>
   246    253   <li><a href="ssl.wiki"><b>Using SSL with Fossil</b></a></li>
   247    254   <li><a href="env-opts.md">Variables and Global Options &mdash; Environment</a></li>
   248    255   <li><a href="whyusefossil.wiki">Version Control &mdash; Benefits Of</a></li>
   249    256   <li><a href="checkin_names.wiki">Version Names &mdash; Check-in And</a></li>
   250    257   <li><a href="fossil-v-git.wiki">Versus Git &mdash; Fossil</a></li>
   251    258   <li><a href="grep.md">vs POSIX grep &mdash; Fossil grep</a></li>
   252    259   <li><a href="webui.wiki">Web Interface &mdash; The Fossil</a></li>