SQLite

Check-in [eed76e66]
Login

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

Overview
Comment:Enhance lemon.c so that when it shows the compile-time options in the header comment of the generated output file, it shows all options, even those not used, and it shows them in sorted order.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: eed76e6698eabe47c6bf9696599ce1c2f7aa428cf60f39d0566fbd0d1f6c4c62
User & Date: drh 2024-06-19 16:38:17
Context
2024-06-19
18:46
In lemon, show all the -D options in the generated header, even if none of them are used. (check-in: 2aa009c3 user: drh tags: trunk)
16:38
Enhance lemon.c so that when it shows the compile-time options in the header comment of the generated output file, it shows all options, even those not used, and it shows them in sorted order. (check-in: eed76e66 user: drh tags: trunk)
11:08
Remove some extraneous flags from the fiddle-debug build. Internal doc tweaks in the main wasm makefile. (check-in: afae2c9e user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

1704
1705
1706
1707
1708
1709
1710









1711
1712
1713
1714
1715
1716
1717
*/
static void stats_line(const char *zLabel, int iValue){
  int nLabel = lemonStrlen(zLabel);
  printf("  %s%.*s %5d\n", zLabel,
         35-nLabel, "................................",
         iValue);
}










/* The main program.  Parse the command line and do it... */
int main(int argc, char **argv){
  static int version = 0;
  static int rpflag = 0;
  static int basisflag = 0;
  static int compress = 0;







>
>
>
>
>
>
>
>
>







1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
*/
static void stats_line(const char *zLabel, int iValue){
  int nLabel = lemonStrlen(zLabel);
  printf("  %s%.*s %5d\n", zLabel,
         35-nLabel, "................................",
         iValue);
}

/*
** Comparison function used by qsort() to sort the azDefine[] array.
*/
static int defineCmp(const void *pA, const void *pB){
  const char *zA = *(const char**)pA;
  const char *zB = *(const char**)pB;
  return strcmp(zA,zB);
}

/* The main program.  Parse the command line and do it... */
int main(int argc, char **argv){
  static int version = 0;
  static int rpflag = 0;
  static int basisflag = 0;
  static int compress = 0;
1760
1761
1762
1763
1764
1765
1766

1767
1768
1769
1770
1771
1772
1773
  }
  if( OptNArgs()!=1 ){
    fprintf(stderr,"Exactly one filename argument is required.\n");
    exit(1);
  }
  memset(&lem, 0, sizeof(lem));
  lem.errorcnt = 0;


  /* Initialize the machine */
  Strsafe_init();
  Symbol_init();
  State_init();
  lem.argv = argv;
  lem.argc = argc;







>







1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
  }
  if( OptNArgs()!=1 ){
    fprintf(stderr,"Exactly one filename argument is required.\n");
    exit(1);
  }
  memset(&lem, 0, sizeof(lem));
  lem.errorcnt = 0;
  qsort(azDefine, nDefine, sizeof(azDefine[0]), defineCmp);

  /* Initialize the machine */
  Strsafe_init();
  Symbol_init();
  State_init();
  lem.argv = argv;
  lem.argc = argc;
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
     "/* This file is automatically generated by Lemon from input grammar\n"
     "** source file \"%s\"", lemp->filename);  lineno++;
  if( nDefineUsed==0 ){
    fprintf(out, ".\n*/\n"); lineno += 2;
  }else{
    fprintf(out, " with these options:\n**\n"); lineno += 2;
    for(i=0; i<nDefine; i++){
      if( !bDefineUsed[i] ) continue;
      fprintf(out, "**   -D%s\n", azDefine[i]); lineno++;
    }
    fprintf(out, "*/\n"); lineno++;
  }
  
  /* The first %include directive begins with a C-language comment,
  ** then skip over the header comment of the template file







|







4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
     "/* This file is automatically generated by Lemon from input grammar\n"
     "** source file \"%s\"", lemp->filename);  lineno++;
  if( nDefineUsed==0 ){
    fprintf(out, ".\n*/\n"); lineno += 2;
  }else{
    fprintf(out, " with these options:\n**\n"); lineno += 2;
    for(i=0; i<nDefine; i++){
      /* if( !bDefineUsed[i] ) continue; */
      fprintf(out, "**   -D%s\n", azDefine[i]); lineno++;
    }
    fprintf(out, "*/\n"); lineno++;
  }
  
  /* The first %include directive begins with a C-language comment,
  ** then skip over the header comment of the template file