/[global]/global/gtags/gtags.c
ViewVC logotype

Diff of /global/gtags/gtags.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.125 by shigio, Sat Jul 30 03:15:02 2005 UTC revision 1.126 by shigio, Sat Jul 30 06:54:24 2005 UTC
# Line 76  int oflag;                                     /* suppress making GSYMS Line 76  int oflag;                                     /* suppress making GSYMS
76  int qflag;                                      /* quiet mode */  int qflag;                                      /* quiet mode */
77  int wflag;                                      /* warning message */  int wflag;                                      /* warning message */
78  int vflag;                                      /* verbose mode */  int vflag;                                      /* verbose mode */
79    int max_args;
80  int show_version;  int show_version;
81  int show_help;  int show_help;
82  int show_config;  int show_config;
# Line 91  int gtagslabel; Line 92  int gtagslabel;
92  int other_files;  int other_files;
93  int debug;  int debug;
94  int secure_mode;  int secure_mode;
 int noxargs;  
95  const char *extra_options;  const char *extra_options;
96  const char *info_string;  const char *info_string;
97    
# Line 132  static struct option const long_options[ Line 132  static struct option const long_options[
132          {"gtagsconf", required_argument, &gtagsconf, 1},          {"gtagsconf", required_argument, &gtagsconf, 1},
133          {"gtagslabel", required_argument, &gtagslabel, 1},          {"gtagslabel", required_argument, &gtagslabel, 1},
134          {"idutils", no_argument, NULL, 'I'},          {"idutils", no_argument, NULL, 'I'},
135          {"noxargs", no_argument, &noxargs, 1},          {"max-args", required_argument, NULL, 'n'},
136          {"other", no_argument, &other_files, 1},          {"other", no_argument, &other_files, 1},
137          {"relative", no_argument, &do_relative, 1},          {"relative", no_argument, &do_relative, 1},
138          {"secure", no_argument, &secure_mode, 1},          {"secure", no_argument, &secure_mode, 1},
# Line 199  main(argc, argv) Line 199  main(argc, argv)
199          int optchar;          int optchar;
200          int option_index = 0;          int option_index = 0;
201    
202          while ((optchar = getopt_long(argc, argv, "cGiIoPqvw", long_options, &option_index)) != EOF) {          while ((optchar = getopt_long(argc, argv, "cGiIn:oPqvw", long_options, &option_index)) != EOF) {
203                  switch (optchar) {                  switch (optchar) {
204                  case 0:                  case 0:
205                          p = long_options[option_index].name;                          p = long_options[option_index].name;
# Line 231  main(argc, argv) Line 231  main(argc, argv)
231                  case 'I':                  case 'I':
232                          Iflag++;                          Iflag++;
233                          break;                          break;
234                    case 'n':
235                            max_args = atoi(optarg);
236                            if (max_args <= 0)
237                                    die("--max-args option requires number > 0.");
238                            break;
239                  case 'o':                  case 'o':
240                          oflag++;                          oflag++;
241                          break;                          break;
# Line 799  updatetags(dbpath, root, deleteset, addl Line 804  updatetags(dbpath, root, deleteset, addl
804          STRBUF *comline = strbuf_open(0);          STRBUF *comline = strbuf_open(0);
805          int gflags;          int gflags;
806          int path_list_max;          int path_list_max;
807            int arg_count = 0;
808    
809          /*          /*
810           * GTAGS needed to make GRTAGS.           * GTAGS needed to make GRTAGS.
# Line 846  updatetags(dbpath, root, deleteset, addl Line 852  updatetags(dbpath, root, deleteset, addl
852          if (debug)          if (debug)
853                  gflags |= GTAGS_DEBUG;                  gflags |= GTAGS_DEBUG;
854          /*          /*
855           * If the --noxargs option is not specified, we pass the parser           * If the --max-args option is not specified, we pass the parser
856           * the source file as a lot as possible to decrease the invoking           * the source file as a lot as possible to decrease the invoking
857           * frequency of the parser.           * frequency of the parser.
858           */           */
# Line 869  updatetags(dbpath, root, deleteset, addl Line 875  updatetags(dbpath, root, deleteset, addl
875                           * with a blank.                           * with a blank.
876                           */                           */
877                          if (strbuf_getlen(path_list)) {                          if (strbuf_getlen(path_list)) {
878                                  if (path_list_max == 0 || strbuf_getlen(path_list) + pathlen > path_list_max) {                                  if (path_list_max == 0 ||
879                                        (max_args > 0 && arg_count >= max_args) ||
880                                        strbuf_getlen(path_list) + pathlen > path_list_max)
881                                    {
882                                          gtags_add(gtop, strbuf_value(comline), path_list, gflags);                                          gtags_add(gtop, strbuf_value(comline), path_list, gflags);
883                                          strbuf_reset(path_list);                                          strbuf_reset(path_list);
884                                            arg_count = 0;
885                                  }                                  }
886                          }                          }
887                          if (exitflag)                          if (exitflag)
# Line 881  updatetags(dbpath, root, deleteset, addl Line 891  updatetags(dbpath, root, deleteset, addl
891                           */                           */
892                          strbuf_puts0(path_list, path);                          strbuf_puts0(path_list, path);
893                          path += pathlen + 1;                          path += pathlen + 1;
894                            arg_count++;
895                  }                  }
896                  if (strbuf_getlen(path_list))                  if (strbuf_getlen(path_list))
897                          gtags_add(gtop, strbuf_value(comline), path_list, gflags);                          gtags_add(gtop, strbuf_value(comline), path_list, gflags);
# Line 908  createtags(dbpath, root, db) Line 919  createtags(dbpath, root, db)
919          int flags, gflags;          int flags, gflags;
920          STRBUF *comline = strbuf_open(0);          STRBUF *comline = strbuf_open(0);
921          int count = 0;          int count = 0;
922            int arg_count = 0;
923          STRBUF *path_list = strbuf_open(MAXPATHLEN);          STRBUF *path_list = strbuf_open(MAXPATHLEN);
924          int path_list_max;          int path_list_max;
925    
# Line 954  createtags(dbpath, root, db) Line 966  createtags(dbpath, root, db)
966          if (debug)          if (debug)
967                  gflags |= GTAGS_DEBUG;                  gflags |= GTAGS_DEBUG;
968          /*          /*
969           * If the --noxargs option is not specified, we pass the parser           * If the --max-args option is not specified, we pass the parser
970           * the source file as a lot as possible to decrease the invoking           * the source file as a lot as possible to decrease the invoking
971           * frequency of the parser.           * frequency of the parser.
972           */           */
# Line 995  createtags(dbpath, root, db) Line 1007  createtags(dbpath, root, db)
1007                   * with a blank.                   * with a blank.
1008                   */                   */
1009                  if (strbuf_getlen(path_list)) {                  if (strbuf_getlen(path_list)) {
1010                          if (path_list_max == 0 || strbuf_getlen(path_list) + strlen(path) > path_list_max) {                          if (path_list_max == 0 ||
1011                                (max_args > 0 && arg_count >= max_args) ||
1012                                strbuf_getlen(path_list) + strlen(path) > path_list_max)
1013                            {
1014                                  gtags_add(gtop, strbuf_value(comline), path_list, gflags);                                  gtags_add(gtop, strbuf_value(comline), path_list, gflags);
1015                                  strbuf_reset(path_list);                                  strbuf_reset(path_list);
1016                                    arg_count = 0;
1017                          }                          }
1018                  }                  }
1019                  /*                  /*
1020                   * Add a path to path_list.                   * Add a path to path_list.
1021                   */                   */
1022                  strbuf_puts0(path_list, path);                  strbuf_puts0(path_list, path);
1023                    arg_count++;
1024          }          }
1025          if (strbuf_getlen(path_list))          if (strbuf_getlen(path_list))
1026                  gtags_add(gtop, strbuf_value(comline), path_list, gflags);                  gtags_add(gtop, strbuf_value(comline), path_list, gflags);

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26