Fossil SCM
Fix up some comments on the command and webpage name lookup logic. No changes to code.
Commit
49703de740a8d74270610d907e5e5e542b936f16
Parent
e6aab1a437f2c95…
2 files changed
+10
-14
+9
+10
-14
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -29,11 +29,11 @@ | ||
| 29 | 29 | /* |
| 30 | 30 | ** An instance of this object defines everything we need to know about an |
| 31 | 31 | ** individual command or webpage. |
| 32 | 32 | */ |
| 33 | 33 | struct CmdOrPage { |
| 34 | - const char *zName; /* Name. Webpages start with "/". Commands do not */ | |
| 34 | + const char *zName; /* Name. Webpages start with "/". Commands do not */ | |
| 35 | 35 | void (*xFunc)(void); /* Function that implements the command or webpage */ |
| 36 | 36 | const char *zHelp; /* Raw help text */ |
| 37 | 37 | unsigned eCmdFlags; /* Flags */ |
| 38 | 38 | }; |
| 39 | 39 | |
| @@ -53,18 +53,18 @@ | ||
| 53 | 53 | ** of CmdOrPage objects that defines all available commands and webpages |
| 54 | 54 | ** known to Fossil. |
| 55 | 55 | ** |
| 56 | 56 | ** The entries in aCommand[] are in sorted order by name. Since webpage names |
| 57 | 57 | ** always begin with "/", all webpage names occur first. The page_index.h file |
| 58 | -** also sets the FOSSIL_FIRST_CMD macro to be the approximate index | |
| 59 | -** in aCommand[] of the first command entry. FOSSIL_FIRST_CMD might be slightly | |
| 60 | -** too low, and so the range FOSSIL_FIRST_CMD...end might contain a few webpage | |
| 61 | -** entries at the beginning. | |
| 58 | +** also sets the FOSSIL_FIRST_CMD macro to be the *approximate* index | |
| 59 | +** in aCommand[] of the first command entry. FOSSIL_FIRST_CMD might be | |
| 60 | +** slightly too low, and so the range FOSSIL_FIRST_CMD...MX_COMMAND might | |
| 61 | +** contain a few webpage entries at the beginning. | |
| 62 | 62 | ** |
| 63 | 63 | ** The page_index.h file is generated by the mkindex program which scans all |
| 64 | -** source code files looking for header comments on the functions that implement | |
| 65 | -** command and webpages. | |
| 64 | +** source code files looking for header comments on the functions that | |
| 65 | +** implement command and webpages. | |
| 66 | 66 | */ |
| 67 | 67 | #include "page_index.h" |
| 68 | 68 | #define MX_COMMAND (sizeof(aCommand)/sizeof(aCommand[0])) |
| 69 | 69 | |
| 70 | 70 | /* |
| @@ -79,22 +79,18 @@ | ||
| 79 | 79 | ** 0: Success. *ppCmd is set to the appropriate CmdOrPage |
| 80 | 80 | ** 1: Not found. |
| 81 | 81 | ** 2: Ambiguous. Two or more entries match. |
| 82 | 82 | */ |
| 83 | 83 | int dispatch_name_search( |
| 84 | - const char *zName, | |
| 85 | - unsigned eType, | |
| 86 | - const CmdOrPage **ppCmd | |
| 84 | + const char *zName, /* Look for this name */ | |
| 85 | + unsigned eType, /* CMDFLAGS_* bits */ | |
| 86 | + const CmdOrPage **ppCmd /* Write the matching CmdOrPage object here */ | |
| 87 | 87 | ){ |
| 88 | 88 | int upr, lwr, mid; |
| 89 | 89 | int nName = strlen(zName); |
| 90 | 90 | lwr = 0; |
| 91 | 91 | upr = MX_COMMAND - 1; |
| 92 | -#if 0 | |
| 93 | - if( (eType&CMDFLAG_WEBPAGE)==0 ) lwr = FOSSIL_FIRST_CMD; | |
| 94 | - if( (eType&CMDFLAG_COMMAND)==0 ) upr = FOSSIL_FIRST_CMD-1; | |
| 95 | -#endif | |
| 96 | 92 | while( lwr<=upr ){ |
| 97 | 93 | int c; |
| 98 | 94 | mid = (upr+lwr)/2; |
| 99 | 95 | c = strcmp(zName, aCommand[mid].zName); |
| 100 | 96 | if( c==0 ){ |
| 101 | 97 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -29,11 +29,11 @@ | |
| 29 | /* |
| 30 | ** An instance of this object defines everything we need to know about an |
| 31 | ** individual command or webpage. |
| 32 | */ |
| 33 | struct CmdOrPage { |
| 34 | const char *zName; /* Name. Webpages start with "/". Commands do not */ |
| 35 | void (*xFunc)(void); /* Function that implements the command or webpage */ |
| 36 | const char *zHelp; /* Raw help text */ |
| 37 | unsigned eCmdFlags; /* Flags */ |
| 38 | }; |
| 39 | |
| @@ -53,18 +53,18 @@ | |
| 53 | ** of CmdOrPage objects that defines all available commands and webpages |
| 54 | ** known to Fossil. |
| 55 | ** |
| 56 | ** The entries in aCommand[] are in sorted order by name. Since webpage names |
| 57 | ** always begin with "/", all webpage names occur first. The page_index.h file |
| 58 | ** also sets the FOSSIL_FIRST_CMD macro to be the approximate index |
| 59 | ** in aCommand[] of the first command entry. FOSSIL_FIRST_CMD might be slightly |
| 60 | ** too low, and so the range FOSSIL_FIRST_CMD...end might contain a few webpage |
| 61 | ** entries at the beginning. |
| 62 | ** |
| 63 | ** The page_index.h file is generated by the mkindex program which scans all |
| 64 | ** source code files looking for header comments on the functions that implement |
| 65 | ** command and webpages. |
| 66 | */ |
| 67 | #include "page_index.h" |
| 68 | #define MX_COMMAND (sizeof(aCommand)/sizeof(aCommand[0])) |
| 69 | |
| 70 | /* |
| @@ -79,22 +79,18 @@ | |
| 79 | ** 0: Success. *ppCmd is set to the appropriate CmdOrPage |
| 80 | ** 1: Not found. |
| 81 | ** 2: Ambiguous. Two or more entries match. |
| 82 | */ |
| 83 | int dispatch_name_search( |
| 84 | const char *zName, |
| 85 | unsigned eType, |
| 86 | const CmdOrPage **ppCmd |
| 87 | ){ |
| 88 | int upr, lwr, mid; |
| 89 | int nName = strlen(zName); |
| 90 | lwr = 0; |
| 91 | upr = MX_COMMAND - 1; |
| 92 | #if 0 |
| 93 | if( (eType&CMDFLAG_WEBPAGE)==0 ) lwr = FOSSIL_FIRST_CMD; |
| 94 | if( (eType&CMDFLAG_COMMAND)==0 ) upr = FOSSIL_FIRST_CMD-1; |
| 95 | #endif |
| 96 | while( lwr<=upr ){ |
| 97 | int c; |
| 98 | mid = (upr+lwr)/2; |
| 99 | c = strcmp(zName, aCommand[mid].zName); |
| 100 | if( c==0 ){ |
| 101 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -29,11 +29,11 @@ | |
| 29 | /* |
| 30 | ** An instance of this object defines everything we need to know about an |
| 31 | ** individual command or webpage. |
| 32 | */ |
| 33 | struct CmdOrPage { |
| 34 | const char *zName; /* Name. Webpages start with "/". Commands do not */ |
| 35 | void (*xFunc)(void); /* Function that implements the command or webpage */ |
| 36 | const char *zHelp; /* Raw help text */ |
| 37 | unsigned eCmdFlags; /* Flags */ |
| 38 | }; |
| 39 | |
| @@ -53,18 +53,18 @@ | |
| 53 | ** of CmdOrPage objects that defines all available commands and webpages |
| 54 | ** known to Fossil. |
| 55 | ** |
| 56 | ** The entries in aCommand[] are in sorted order by name. Since webpage names |
| 57 | ** always begin with "/", all webpage names occur first. The page_index.h file |
| 58 | ** also sets the FOSSIL_FIRST_CMD macro to be the *approximate* index |
| 59 | ** in aCommand[] of the first command entry. FOSSIL_FIRST_CMD might be |
| 60 | ** slightly too low, and so the range FOSSIL_FIRST_CMD...MX_COMMAND might |
| 61 | ** contain a few webpage entries at the beginning. |
| 62 | ** |
| 63 | ** The page_index.h file is generated by the mkindex program which scans all |
| 64 | ** source code files looking for header comments on the functions that |
| 65 | ** implement command and webpages. |
| 66 | */ |
| 67 | #include "page_index.h" |
| 68 | #define MX_COMMAND (sizeof(aCommand)/sizeof(aCommand[0])) |
| 69 | |
| 70 | /* |
| @@ -79,22 +79,18 @@ | |
| 79 | ** 0: Success. *ppCmd is set to the appropriate CmdOrPage |
| 80 | ** 1: Not found. |
| 81 | ** 2: Ambiguous. Two or more entries match. |
| 82 | */ |
| 83 | int dispatch_name_search( |
| 84 | const char *zName, /* Look for this name */ |
| 85 | unsigned eType, /* CMDFLAGS_* bits */ |
| 86 | const CmdOrPage **ppCmd /* Write the matching CmdOrPage object here */ |
| 87 | ){ |
| 88 | int upr, lwr, mid; |
| 89 | int nName = strlen(zName); |
| 90 | lwr = 0; |
| 91 | upr = MX_COMMAND - 1; |
| 92 | while( lwr<=upr ){ |
| 93 | int c; |
| 94 | mid = (upr+lwr)/2; |
| 95 | c = strcmp(zName, aCommand[mid].zName); |
| 96 | if( c==0 ){ |
| 97 |
+9
| --- src/mkindex.c | ||
| +++ src/mkindex.c | ||
| @@ -249,10 +249,19 @@ | ||
| 249 | 249 | void build_table(void){ |
| 250 | 250 | int i; |
| 251 | 251 | int nWeb = 0; |
| 252 | 252 | |
| 253 | 253 | qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare); |
| 254 | + | |
| 255 | + printf( | |
| 256 | + "/* Automatically generated code\n" | |
| 257 | + "** DO NOT EDIT!\n" | |
| 258 | + "**\n" | |
| 259 | + "** This file was generated by the mkindex.exe program based on\n" | |
| 260 | + "** comments in other Fossil source files.\n" | |
| 261 | + "*/\n" | |
| 262 | + ); | |
| 254 | 263 | |
| 255 | 264 | /* Output declarations for all the action functions */ |
| 256 | 265 | for(i=0; i<nFixed; i++){ |
| 257 | 266 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 258 | 267 | printf("extern void %s(void);\n", aEntry[i].zFunc); |
| 259 | 268 |
| --- src/mkindex.c | |
| +++ src/mkindex.c | |
| @@ -249,10 +249,19 @@ | |
| 249 | void build_table(void){ |
| 250 | int i; |
| 251 | int nWeb = 0; |
| 252 | |
| 253 | qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare); |
| 254 | |
| 255 | /* Output declarations for all the action functions */ |
| 256 | for(i=0; i<nFixed; i++){ |
| 257 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 258 | printf("extern void %s(void);\n", aEntry[i].zFunc); |
| 259 |
| --- src/mkindex.c | |
| +++ src/mkindex.c | |
| @@ -249,10 +249,19 @@ | |
| 249 | void build_table(void){ |
| 250 | int i; |
| 251 | int nWeb = 0; |
| 252 | |
| 253 | qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare); |
| 254 | |
| 255 | printf( |
| 256 | "/* Automatically generated code\n" |
| 257 | "** DO NOT EDIT!\n" |
| 258 | "**\n" |
| 259 | "** This file was generated by the mkindex.exe program based on\n" |
| 260 | "** comments in other Fossil source files.\n" |
| 261 | "*/\n" |
| 262 | ); |
| 263 | |
| 264 | /* Output declarations for all the action functions */ |
| 265 | for(i=0; i<nFixed; i++){ |
| 266 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 267 | printf("extern void %s(void);\n", aEntry[i].zFunc); |
| 268 |