1 /*******************************************************************************
2 ********************************************************************************
4 Copyright (c) 2008 Ahmed S. Badran
6 Licensed under the FreeBSD License (see LICENSE)
9 Description: Vimicxx main.
10 Created: 09/01/2008 06:35:01 PM PDT
11 Author: Ahmed S. Badran (Ahmed B.), ahmed.badran@gmail.com
13 ********************************************************************************
14 *******************************************************************************/
20 #include "vimicxx_conf.h"
24 bool vimicxx_init(string
*);
25 void vimicxx_config(configfile
*);
26 bool vimicxx_parse_cmd(int argc
, char** argv
);
28 int main(int argc
, char* argv
[])
30 string DOTVIMICXX_PATH
;
31 if (!vimicxx_init(&DOTVIMICXX_PATH
)) {
34 vimicxx_conf
conf(DOTVIMICXX_PATH
);
36 vector
<string
> extensions
;
37 extensions
.push_back(".c");
38 extensions
.push_back(".cpp");
39 extensions
.push_back(".h");
40 conf
.add_project("test", "/home/ahmed/data", tmp
);
41 conf
.add_project("test3", "/home/ahmed/data/oss/vimicxx", extensions
);
43 /* vimicxx_config(&vimicxx_conf); */
44 if (!vimicxx_parse_cmd(argc
, argv
)) {
48 string name
, prj_path
, prj_cache
, prj_flist
, prj_tags_db
;
49 conf
.get_project_path("test4", &prj_path
);
50 conf
.get_project_cache_dir("test4", &prj_cache
);
51 conf
.get_project_flist("test4", &prj_flist
);
52 conf
.get_project_tags_db("test4", &prj_tags_db
);
53 ctags_db
ctags("test4", prj_path
, prj_cache
, prj_flist
,
54 prj_tags_db
, extensions
);
57 time_t start
= time(0);
60 printf("time : %d\n", end
- start
);
65 * Check for the .vimicxx directory, create it if it
66 * doesn't exist, checks for DOTVIMICXX_PATH
68 bool vimicxx_init(string
* vimicxx_path
)
71 if ((tmp
= getenv("DOTVIMICXX_PATH")) != NULL
) {
74 passwd
* tmp2
= getpwuid(geteuid());
75 *vimicxx_path
= tmp2
->pw_dir
;
76 *vimicxx_path
+= "/.vimicxx";
80 if ((stat(vimicxx_path
->c_str(), &tmp_stat
) == 0) &&
81 (S_ISDIR(tmp_stat
.st_mode
))) {
83 } else if (mkdir(vimicxx_path
->c_str(), S_IRUSR
| S_IWUSR
| S_IXUSR
|
84 S_IRGRP
| S_IXGRP
| S_IROTH
| S_IXOTH
) == 0) {
87 perror("mkdir error");
93 * Parse the command, figure out what are we being asked for
95 bool vimicxx_parse_cmd(int argc
, char** argv
)