70 |
int match(const char *, const char *); |
int match(const char *, const char *); |
71 |
int main(int, char **); |
int main(int, char **); |
72 |
int incremental(const char *, const char *); |
int incremental(const char *, const char *); |
73 |
void updatetags(const char *, const char *, IDSET *, STRBUF *, int); |
void updatetags(const char *, const char *, IDSET *, STRBUF *, int, int); |
74 |
void createtags(const char *, const char *, int); |
void createtags(const char *, const char *, int); |
75 |
int printconf(const char *); |
int printconf(const char *); |
76 |
void set_base_directory(const char *, const char *); |
void set_base_directory(const char *, const char *); |
662 |
STRBUF *deletelist = strbuf_open(0); |
STRBUF *deletelist = strbuf_open(0); |
663 |
IDSET *deleteset; |
IDSET *deleteset; |
664 |
int updated = 0; |
int updated = 0; |
665 |
|
int addtotal = 0; |
666 |
const char *path; |
const char *path; |
667 |
|
|
668 |
if (vflag) { |
if (vflag) { |
691 |
continue; |
continue; |
692 |
if (stat(path, &statp) < 0) |
if (stat(path, &statp) < 0) |
693 |
die("stat failed '%s'.", path); |
die("stat failed '%s'.", path); |
694 |
if ((fid = gpath_path2fid(path)) == NULL) |
if ((fid = gpath_path2fid(path)) == NULL) { |
695 |
strbuf_puts0(addlist, path); |
strbuf_puts0(addlist, path); |
696 |
else if (gtags_mtime < statp.st_mtime) { |
addtotal++; |
697 |
|
} else if (gtags_mtime < statp.st_mtime) { |
698 |
strbuf_puts0(addlist, path); |
strbuf_puts0(addlist, path); |
699 |
|
addtotal++; |
700 |
idset_add(deleteset, atoi(fid)); |
idset_add(deleteset, atoi(fid)); |
701 |
} |
} |
702 |
} |
} |
737 |
continue; |
continue; |
738 |
if (vflag) |
if (vflag) |
739 |
fprintf(stderr, "[%s] Updating '%s'.\n", now(), dbname(db)); |
fprintf(stderr, "[%s] Updating '%s'.\n", now(), dbname(db)); |
740 |
updatetags(dbpath, root, deleteset, addlist, db); |
updatetags(dbpath, root, deleteset, addlist, addtotal, db); |
741 |
if (exitflag) |
if (exitflag) |
742 |
exit(1); |
exit(1); |
743 |
} |
} |
790 |
* i) root root directory of source tree |
* i) root root directory of source tree |
791 |
* i) deleteset bit array of fid of deleted or modified files |
* i) deleteset bit array of fid of deleted or modified files |
792 |
* i) addlist \0 separated list of added or modified files |
* i) addlist \0 separated list of added or modified files |
793 |
|
* i) addtotal number of files in addlist |
794 |
* i) db GTAGS, GRTAGS, GSYMS |
* i) db GTAGS, GRTAGS, GSYMS |
795 |
*/ |
*/ |
796 |
void |
void |
797 |
updatetags(dbpath, root, deleteset, addlist, db) |
updatetags(dbpath, root, deleteset, addlist, addtotal, db) |
798 |
const char *dbpath; |
const char *dbpath; |
799 |
const char *root; |
const char *root; |
800 |
IDSET *deleteset; |
IDSET *deleteset; |
801 |
STRBUF *addlist; |
STRBUF *addlist; |
802 |
|
int addtotal; |
803 |
int db; |
int db; |
804 |
{ |
{ |
805 |
GTOP *gtop; |
GTOP *gtop; |
843 |
if (vflag) { |
if (vflag) { |
844 |
char fid[32]; |
char fid[32]; |
845 |
const char *path; |
const char *path; |
846 |
|
int seqno = 1; |
847 |
|
int total = idset_count(deleteset); |
848 |
int i; |
int i; |
849 |
|
|
850 |
for (i = 0; i < deleteset->max; i++) { |
for (i = 0; i < deleteset->max; i++) { |
853 |
path = gpath_fid2path(fid); |
path = gpath_fid2path(fid); |
854 |
if (path == NULL) |
if (path == NULL) |
855 |
die("GPATH is corrupted."); |
die("GPATH is corrupted."); |
856 |
fprintf(stderr, " deleting tags of %s\n", path + 2); |
fprintf(stderr, " [%d/%d] deleting tags of %s\n", seqno++, total, path + 2); |
857 |
} |
} |
858 |
} |
} |
859 |
} |
} |
873 |
STRBUF *path_list = strbuf_open(0); |
STRBUF *path_list = strbuf_open(0); |
874 |
const char *path = strbuf_value(addlist); |
const char *path = strbuf_value(addlist); |
875 |
const char *end = path + strbuf_getlen(addlist); |
const char *end = path + strbuf_getlen(addlist); |
876 |
|
int seqno = 1; |
877 |
|
|
878 |
while (path < end) { |
while (path < end) { |
879 |
int pathlen = strlen(path); |
int pathlen = strlen(path); |
880 |
|
|
881 |
if (vflag) |
if (vflag) |
882 |
fprintf(stderr, " adding tags of %s\n", path + 2); |
fprintf(stderr, " [%d/%d] adding tags of %s\n", seqno++, addtotal, path + 2); |
883 |
/* |
/* |
884 |
* Execute parser when path name collects enough. |
* Execute parser when path name collects enough. |
885 |
* Though the path_list is \0 separated list of path, |
* Though the path_list is \0 separated list of path, |