Browse Source

cmTagFile.h/c : cmTagFile now recognizes function definition, and structure and union tags.

master
kevin 11 years ago
parent
commit
babb016383
2 changed files with 34 additions and 14 deletions
  1. 22
    7
      cmTagFile.c
  2. 12
    7
      cmTagFile.h

+ 22
- 7
cmTagFile.c View File

33
 {
33
 {
34
   switch(flags)
34
   switch(flags)
35
   {
35
   {
36
-    case kFuncTfFl:    return "p";
37
-    case kEnumTfFl:    return "e";
38
-    case kMacroTfFl:   return "m";
39
-    case kTypedefTfFl: return "t";
40
-    case kFieldTfFl:   return "f";
41
-    case kExternTfFl:  return "x";
36
+    case kFuncProtoTfFl: return "p";
37
+    case kFuncDefnTfFl: return "d";
38
+    case kEnumTfFl:     return "e";
39
+    case kMacroTfFl:    return "m";
40
+    case kTypedefTfFl:  return "t";
41
+    case kFieldTfFl:    return "f";
42
+    case kExternTfFl:   return "x";
43
+    case kStructTagTfFl:return "s";
44
+    case kUnionTagTfFl: return "u";
42
     default:
45
     default:
43
       { assert(0); }
46
       { assert(0); }
44
   }
47
   }
125
       break;
128
       break;
126
 
129
 
127
     case 'p': // function prototype
130
     case 'p': // function prototype
128
-      r.flags |= kFuncTfFl;
131
+      r.flags |= kFuncProtoTfFl;
132
+      break;
133
+
134
+    case 'f': // function defn
135
+      r.flags |= kFuncDefnTfFl;
129
       break;
136
       break;
130
 
137
 
131
     case 't': // typedef
138
     case 't': // typedef
140
       r.flags |= kExternTfFl;
147
       r.flags |= kExternTfFl;
141
       break;
148
       break;
142
 
149
 
150
+    case 's': // struct tag
151
+      r.flags |= kStructTagTfFl;
152
+      break;
153
+
154
+    case 'u': // union tag
155
+      r.flags |= kUnionTagTfFl;
156
+      break;
157
+
143
     default: // unrecognized type
158
     default: // unrecognized type
144
       return rc;
159
       return rc;
145
   }
160
   }

+ 12
- 7
cmTagFile.h View File

9
   //
9
   //
10
   // ctags --c-kinds=+p --fields=+n  file.h
10
   // ctags --c-kinds=+p --fields=+n  file.h
11
   //
11
   //
12
-  // --c-kinds=+p turns on function prototype reporting.
12
+  // --c-kinds=+px 
13
+  //            p - turns on function prototype reporting.
14
+  //            x - turns on external and forward decl
13
   // --field=+n turns on line number reporting
15
   // --field=+n turns on line number reporting
14
   enum
16
   enum
15
   {
17
   {
27
 
29
 
28
   enum
30
   enum
29
   {
31
   {
30
-    kFuncTfFl    = 0x01,
31
-    kEnumTfFl    = 0x02,
32
-    kMacroTfFl   = 0x04,
33
-    kTypedefTfFl = 0x08,
34
-    kFieldTfFl   = 0x10,
35
-    kExternTfFl  = 0x20   // extern var's and forward declarations
32
+    kFuncProtoTfFl = 0x001,
33
+    kFuncDefnTfFl  = 0x002,
34
+    kEnumTfFl      = 0x004,
35
+    kMacroTfFl     = 0x008,
36
+    kTypedefTfFl   = 0x010,
37
+    kFieldTfFl     = 0x020,
38
+    kExternTfFl    = 0x040,   // extern var's and forward declarations
39
+    kStructTagTfFl = 0x080,
40
+    kUnionTagTfFl  = 0x100
36
     // be sure to add new flags to _cmTfFlagsToLabel()
41
     // be sure to add new flags to _cmTfFlagsToLabel()
37
   };
42
   };
38
 
43
 

Loading…
Cancel
Save