Ver código fonte

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

master
kevin 11 anos atrás
pai
commit
babb016383
2 arquivos alterados com 34 adições e 14 exclusões
  1. 22
    7
      cmTagFile.c
  2. 12
    7
      cmTagFile.h

+ 22
- 7
cmTagFile.c Ver arquivo

@@ -33,12 +33,15 @@ const cmChar_t* _cmTfFlagsToLabel( unsigned flags )
33 33
 {
34 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 45
     default:
43 46
       { assert(0); }
44 47
   }
@@ -125,7 +128,11 @@ cmTfRC_t _cmTfParseLine( cmTf_t* p, const cmChar_t* fn, unsigned line, cmChar_t*
125 128
       break;
126 129
 
127 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 136
       break;
130 137
 
131 138
     case 't': // typedef
@@ -140,6 +147,14 @@ cmTfRC_t _cmTfParseLine( cmTf_t* p, const cmChar_t* fn, unsigned line, cmChar_t*
140 147
       r.flags |= kExternTfFl;
141 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 158
     default: // unrecognized type
144 159
       return rc;
145 160
   }

+ 12
- 7
cmTagFile.h Ver arquivo

@@ -9,7 +9,9 @@ extern "C" {
9 9
   //
10 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 15
   // --field=+n turns on line number reporting
14 16
   enum
15 17
   {
@@ -27,12 +29,15 @@ extern "C" {
27 29
 
28 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 41
     // be sure to add new flags to _cmTfFlagsToLabel()
37 42
   };
38 43
 

Carregando…
Cancelar
Salvar