diff -urN icomplete/cppcomplete.vim icomplete.new/cppcomplete.vim --- icomplete/cppcomplete.vim 2006-04-07 00:57:32.000000000 +0800 +++ icomplete.new/cppcomplete.vim 2006-04-07 00:56:37.000000000 +0800 @@ -41,12 +41,19 @@ " Return list of matches. let res = [] + " check if set g:cppcomplete_tagfile + if exists('g:cppcomplete_tagfile') + let s:tagparam = " --tagfile=" . g:cppcomplete_tagfile + else + let s:tagparam = "" + endif + " call icomplete and store the result in the array " java and c# users must build their tags file manually if &ft == "java" || &ft == "cs" - let cmd = "icomplete --cache=0 -c " . s:cppcomplete_col . " -l " . s:cppcomplete_line . " " . s:cppcomplete_tmpfile + let cmd = "icomplete --cache=0 -c " . s:cppcomplete_col . " -l " . s:cppcomplete_line . s:tagparam . " " . s:cppcomplete_tmpfile else - let cmd = "icomplete --cache=1 -c " . s:cppcomplete_col . " -l " . s:cppcomplete_line . " " . s:cppcomplete_tmpfile + let cmd = "icomplete --cache=1 -c " . s:cppcomplete_col . " -l " . s:cppcomplete_line . s:tagparam . " " . s:cppcomplete_tmpfile endif let icomplete_output = system(cmd) diff -urN icomplete/src/error.c icomplete.new/src/error.c --- icomplete/src/error.c 2005-12-20 10:44:36.000000000 +0800 +++ icomplete.new/src/error.c 2006-04-07 00:56:37.000000000 +0800 @@ -15,7 +15,8 @@ " -a --cache=0|1|2 : 0=never build tags file, 1=when necessary 2=always\n" " -c --column= : The column number where completion should start\n" " -l --line= : The line number where completion should start\n" - " -g --lang=c++|java|cs : Input is considered as this language, c++ is default\n" + " -g --lang=c++|java|cs : Input is considered as this language, c++ is default\n" + " -t --tagfile= : Write and read tags from instead of `tags'\n" " -m --list-members= : List all (also inherited) members of \n" " -o --output= : Write completions to instead of stdout\n" " -v --version : Prints the version\n" diff -urN icomplete/src/main.c icomplete.new/src/main.c --- icomplete/src/main.c 2005-12-20 10:44:36.000000000 +0800 +++ icomplete.new/src/main.c 2006-04-07 00:56:37.000000000 +0800 @@ -121,7 +121,7 @@ fclose (taglist); /* save the cache information in the tags file */ - FILE *tags = fopen("tags", "w"); + FILE *tags = fopen(opt_tagfile, "w"); if (tags) { fprintf(tags, "!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;\" to lines/\n" @@ -134,7 +134,7 @@ fclose(tags); } - char **arguments = (char**)malloc(sizeof(char*) * (8 + (config.cpp_macros->size*2))); + char **arguments = (char**)malloc(sizeof(char*) * (10 + (config.cpp_macros->size*2))); if (arguments == NULL) bailout ("Could not get memory in build_tags_file() for char **arguments"); @@ -145,12 +145,14 @@ arguments[4]="--c++-kinds=cdefgmnpstuvx"; arguments[5]="-L"; arguments[6]=".icomplete_taglist"; + arguments[7]="-f"; + arguments[8]=opt_tagfile; int i = 0; List_item *it=config.cpp_macros->first; while(NULL!=it) { - arguments[i+7]="-I"; - arguments[i+8]=it->item; + arguments[i+9]="-I"; + arguments[i+10]=it->item; it=it->next; i+=2; } @@ -206,7 +208,7 @@ * has changed, and reuse the existing tags file */ if (opt_cache == 1) { - FILE *fCache = fopen("tags", "r"); + FILE *fCache = fopen(opt_tagfile, "r"); bool build_cache = true; if (fCache) { @@ -219,7 +221,7 @@ if (!strcmp(cacheline, cmp_pattern)) { #if DEBUG >= 2 - fprintf(stderr, "valid tags file found, icomplete will reuse it\n"); + fprintf(stderr, "valid tags `%s' file found, icomplete will reuse it\n", opt_tagfile); #endif build_cache = false; } diff -urN icomplete/src/options.c icomplete.new/src/options.c --- icomplete/src/options.c 2005-12-23 06:25:33.000000000 +0800 +++ icomplete.new/src/options.c 2006-04-07 00:56:37.000000000 +0800 @@ -14,6 +14,7 @@ char *opt_listmembers = NULL; char *opt_liststatic = NULL; char *opt_lang = "c++"; +char *opt_tagfile = "tags"; cache_e opt_cache = CACHE_AUTO; const char *opt_progname = PACKAGE_NAME; struct config_s config={NULL,NULL}; @@ -32,6 +33,7 @@ {"list-members" , 1 , 0 , 'm' } , {"output" , 1 , 0 , 'o' } , {"lang" , 1 , 0 , 'g' } , + {"tagfile" , 1 , 0 , 't' } , {"version" , 0 , 0 , 'v' } , {0 , 0 , 0 , 0 } }; @@ -40,7 +42,7 @@ { /* int this_option_optind = optind ? optind : 1; */ int option_index = 0; - c = getopt_long (argc, argv, "a:c:g:hl:m:o:s:v", long_options, &option_index); + c = getopt_long (argc, argv, "a:c:g:t:hl:m:o:s:v", long_options, &option_index); if (c == -1) break; @@ -83,6 +85,10 @@ opt_output = optarg; break; + case 't': + opt_tagfile = optarg; + break; + case 'v': printf(PACKAGE_NAME "\nVersion: " VERSION "\n"); break; diff -urN icomplete/src/options.h icomplete.new/src/options.h --- icomplete/src/options.h 2005-12-20 10:44:36.000000000 +0800 +++ icomplete.new/src/options.h 2006-04-07 00:56:37.000000000 +0800 @@ -25,6 +25,7 @@ extern char* opt_listmembers; ///< List members of this class extern char* opt_liststatic; ///< ??!? extern char* opt_lang; ///< Language (defaults to c++) +extern char* opt_tagfile; ///< Tag file (defaults to tags) extern cache_e opt_cache; ///< Wether we should build cache or not extern const char* opt_progname; ///< argv[0] diff -urN icomplete/src/parse.c icomplete.new/src/parse.c --- icomplete/src/parse.c 2006-01-04 10:10:29.000000000 +0800 +++ icomplete.new/src/parse.c 2006-04-07 00:56:37.000000000 +0800 @@ -136,7 +136,7 @@ tagFileInfo info; tagEntry entry; - tagFile *tfile = tagsOpen ("tags", &info); + tagFile *tfile = tagsOpen (opt_tagfile, &info); if (tfile && info.status.opened) { if (tagsFind (tfile, &entry, ident, TAG_OBSERVECASE | TAG_FULLMATCH) == TagSuccess) diff -urN icomplete/src/readtags.c icomplete.new/src/readtags.c --- icomplete/src/readtags.c 2005-11-20 01:25:37.000000000 +0800 +++ icomplete.new/src/readtags.c 2006-04-07 00:56:37.000000000 +0800 @@ -873,7 +873,7 @@ " -l List all tags.\n" " -p Perform partial matching.\n" " -s[0|1|2] Override sort detection of tag file.\n" - " -t file Use specified tag file (default: \"tags\").\n" + " -t file Use specified tag file (default: `tags').\n" "Note that options are acted upon as encountered, so order is significant.\n"; extern int main (int argc, char **argv) diff -urN icomplete/src/treeold.c icomplete.new/src/treeold.c --- icomplete/src/treeold.c 2005-12-20 10:44:36.000000000 +0800 +++ icomplete.new/src/treeold.c 2006-04-07 00:56:37.000000000 +0800 @@ -37,7 +37,7 @@ tagEntry entry; tagFileInfo info; - tagFile *tfile = tagsOpen ("tags", &info); + tagFile *tfile = tagsOpen (opt_tagfile, &info); //brc: split namespace part and classname char nbuffer[256]; @@ -258,7 +258,7 @@ { tagEntry entry; tagFileInfo info; - tagFile *tfile = tagsOpen ("tags", &info); + tagFile *tfile = tagsOpen (opt_tagfile, &info); char lasttag[256] = ""; /* store last tag to avoid duplicates */ /* write tags to file instead of stdout */ @@ -432,7 +432,9 @@ } else { - bailout("Could not open `tags' file. You should be able to build a valid one by running this command:\n\nicomplete -l 1 -c 1 \n\n should be a source file which contains all #include files you want to have in the tags file"); + char buf[BUFSIZ]; + snprintf(buf, BUFSIZ, "Could not open `%s' file. You should be able to build a valid one by running this command:\n\nicomplete -l 1 -c 1 \n\n should be a source file which contains all #include files you want to have in the tags file", opt_tagfile); + bailout(buf); } free_tree (tree);