/ Check-in [0aa9ed5b]
Login

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

Overview
Comment:Add comments to the top of keywordhash.h. (CVS 3651)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0aa9ed5bbfb756967a6f761c5fc2f274a5466e2d
User & Date: drh 2007-02-21 16:44:33
Context
2007-02-21
16:52
Fix for an UPDATE on a virtual table when the WHERE clause matches zero rows. Ticket #2244. (CVS 3652) check-in: 43bf7978 user: danielk1977 tags: trunk
16:44
Add comments to the top of keywordhash.h. (CVS 3651) check-in: 0aa9ed5b user: drh tags: trunk
2007-02-20
15:21
Enhance the documentation to clarify that SQLite is not reentrant through the authorization callback function. Ticket #2242. (CVS 3650) check-in: b18a758a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/mkkeywordhash.c.

     2      2   ** Compile and run this standalone program in order to generate code that
     3      3   ** implements a function that will translate alphabetic identifiers into
     4      4   ** parser token codes.
     5      5   */
     6      6   #include <stdio.h>
     7      7   #include <string.h>
     8      8   #include <stdlib.h>
            9  +
           10  +/*
           11  +** A header comment placed at the beginning of generated code.
           12  +*/
           13  +static const char zHdr[] = 
           14  +  "/***** This file contains automatically generated code ******\n"
           15  +  "**\n"
           16  +  "** The code in this file has been automatically generated by\n"
           17  +  "**\n"
           18  +  "**     $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.25 2007/02/21 16:44:33 drh Exp $\n"
           19  +  "**\n"
           20  +  "** The code in this file implements a function that determines whether\n"
           21  +  "** or not a given identifier is really an SQL keyword.  The same thing\n"
           22  +  "** might be implemented more directly using a hand-written hash table.\n"
           23  +  "** But by using this automatically generated code, the size of the code\n"
           24  +  "** is substantially reduced.  This is important for embedded applications\n"
           25  +  "** on platforms with limited memory.\n"
           26  +  "*/\n"
           27  +;
     9     28   
    10     29   /*
    11     30   ** All the keywords of the SQL language are stored as in a hash
    12     31   ** table composed of instances of the following structure.
    13     32   */
    14     33   typedef struct Keyword Keyword;
    15     34   struct Keyword {
................................................................................
   406    425     for(i=0; i<NKEYWORD; i++){
   407    426       h = aKeywordTable[i].hash % bestSize;
   408    427       aKeywordTable[i].iNext = aHash[h];
   409    428       aHash[h] = i+1;
   410    429     }
   411    430   
   412    431     /* Begin generating code */
          432  +  printf("%s", zHdr);
   413    433     printf("/* Hash score: %d */\n", bestCount);
   414    434     printf("static int keywordCode(const char *z, int n){\n");
   415    435   
   416    436     printf("  static const char zText[%d] =\n", nChar+1);
   417    437     for(i=j=0; i<NKEYWORD; i++){
   418    438       Keyword *p = &aKeywordTable[i];
   419    439       if( p->substrId ) continue;