388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
/*
** Build the binary search table.
*/
void build_table(void){
int i;
int nWeb = 0;
qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
printf(
"/* Automatically generated code\n"
"** DO NOT EDIT!\n"
"**\n"
|
>
>
|
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
/*
** Build the binary search table.
*/
void build_table(void){
int i;
int nWeb = 0;
int mxLen = 0;
int len;
qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
printf(
"/* Automatically generated code\n"
"** DO NOT EDIT!\n"
"**\n"
|
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
}
/* Generate the aCommand[] table */
printf("static const CmdOrPage aCommand[] = {\n");
for(i=0; i<nFixed; i++){
const char *z = aEntry[i].zPath;
int n = strlen(z);
if( aEntry[i].zIf ){
printf("%s", aEntry[i].zIf);
}else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
nWeb++;
}
printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%03x },\n",
n, z,
25-n, "",
aEntry[i].zFunc,
(int)(29-strlen(aEntry[i].zFunc)), "",
aEntry[i].iHelp,
aEntry[i].eType
);
if( aEntry[i].zIf ) printf("#endif\n");
}
printf("};\n");
printf("#define FOSSIL_FIRST_CMD %d\n", nWeb);
/* Generate the aSetting[] table */
printf("const Setting aSetting[] = {\n");
for(i=0; i<nFixed; i++){
const char *z;
const char *zVar;
const char *zDef;
|
>
>
>
|
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
|
}
/* Generate the aCommand[] table */
printf("static const CmdOrPage aCommand[] = {\n");
for(i=0; i<nFixed; i++){
const char *z = aEntry[i].zPath;
int n = strlen(z);
if( n>mxLen ) mxLen = n;
if( aEntry[i].zIf ){
printf("%s", aEntry[i].zIf);
}else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
nWeb++;
}
printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%03x },\n",
n, z,
25-n, "",
aEntry[i].zFunc,
(int)(29-strlen(aEntry[i].zFunc)), "",
aEntry[i].iHelp,
aEntry[i].eType
);
if( aEntry[i].zIf ) printf("#endif\n");
}
printf("};\n");
printf("#define FOSSIL_FIRST_CMD %d\n", nWeb);
printf("#define FOSSIL_MX_CMDNAME %d /* max length of any command name */\n",
mxLen);
/* Generate the aSetting[] table */
printf("const Setting aSetting[] = {\n");
for(i=0; i<nFixed; i++){
const char *z;
const char *zVar;
const char *zDef;
|