diff -cr ../ctags-5.5.4.orig/c.c ./c.c *** ../ctags-5.5.4.orig/c.c Sat Feb 28 16:37:52 2004 --- ./c.c Sun Sep 11 13:02:59 2005 *************** *** 455,460 **** --- 455,463 ---- { "while", KEYWORD_WHILE, { 1, 1, 1, 1, 0 } } }; + /* Added by Bram: number for nameless structs and unions. */ + static int numberForName = 0; + /* * FUNCTION PROTOTYPES */ *************** *** 762,768 **** initToken (st->token [i]); initToken (st->context); ! initToken (st->blockName); vStringClear (st->parentClasses); /* Init member info. --- 765,775 ---- initToken (st->token [i]); initToken (st->context); ! ! /* Keep the block name, so that a variable following after a comma will ! * still have the structure name. (Bram) */ ! if (! partial) ! initToken (st->blockName); vStringClear (st->parentClasses); /* Init member info. *************** *** 943,950 **** return result; } static void addOtherFields (tagEntryInfo* const tag, const tagType type, ! const statementInfo *const st, vString *const scope) { /* For selected tag types, append an extension flag designating the * parent object in which the tag is defined. --- 950,966 ---- return result; } + static void addContextSeparator (vString *const scope) + { + if (isLanguage (Lang_c) || isLanguage (Lang_cpp)) + vStringCatS (scope, "::"); + else if (isLanguage (Lang_java) || isLanguage (Lang_csharp)) + vStringCatS (scope, "."); + } + static void addOtherFields (tagEntryInfo* const tag, const tagType type, ! const statementInfo *const st, ! vString *const scope, vString *const typeName) { /* For selected tag types, append an extension flag designating the * parent object in which the tag is defined. *************** *** 1001,1014 **** } break; } - } ! static void addContextSeparator (vString *const scope) ! { ! if (isLanguage (Lang_c) || isLanguage (Lang_cpp)) ! vStringCatS (scope, "::"); ! else if (isLanguage (Lang_java) || isLanguage (Lang_csharp)) ! vStringCatS (scope, "."); } static void findScopeHierarchy (vString *const string, --- 1017,1054 ---- } break; } ! /* Added by Bram: typename info, type of the tag and name of ! * struct/union/etc. */ ! if ((type == TAG_TYPEDEF || type == TAG_VARIABLE || type == TAG_MEMBER) ! && isContextualStatement(st)) ! { ! char *p; ! ! tag->extensionFields.typeName [0] = ! tagName (declToTagType (st->declaration)); ! p = vStringValue (st->blockName->name); ! ! /* If there was no {} block get the name from the token before the ! * name (current token is ';' or ',', previous token is the name). */ ! if (p == NULL || *p == '\0') ! { ! tokenInfo *const prev2 = prevToken (st, 2); ! ! if (isType (prev2, TOKEN_NAME)) ! p = vStringValue (prev2->name); ! } ! ! /* Prepend the scope name if there is one. */ ! if (vStringLength (scope) > 0) ! { ! vStringCopy(typeName, scope); ! addContextSeparator (typeName); ! vStringCatS(typeName, p); ! p = vStringValue (typeName); ! } ! tag->extensionFields.typeName [1] = p; ! } } static void findScopeHierarchy (vString *const string, *************** *** 1106,1111 **** --- 1146,1154 ---- includeTag (type, isFileScope)) { vString *scope = vStringNew (); + /* Added "typeName" to store the typename from addOtherFields() until + * it's used in makeTagEntry(). (Bram) */ + vString *typeName = vStringNew (); tagEntryInfo e; initTagEntry (&e, vStringValue (token->name)); *************** *** 1117,1127 **** e.kind = tagLetter (type); findScopeHierarchy (scope, st); ! addOtherFields (&e, type, st, scope); makeTagEntry (&e); makeExtraTagEntry (type, &e, scope); vStringDelete (scope); } } --- 1160,1171 ---- e.kind = tagLetter (type); findScopeHierarchy (scope, st); ! addOtherFields (&e, type, st, scope, typeName); makeTagEntry (&e); makeExtraTagEntry (type, &e, scope); vStringDelete (scope); + vStringDelete (typeName); } } *************** *** 2566,2571 **** --- 2610,2627 ---- { if (isType (prev, TOKEN_NAME)) copyToken (st->blockName, prev); + else + { + char buf[30]; + + /* Added by Bram: for a nameless struct or union we use a + * number, so that the members can be found. */ + vStringClear (st->blockName->name); + sprintf(buf, "%d", ++numberForName); + vStringCatS (st->blockName->name, buf); + st->blockName->type = TOKEN_NAME; + st->blockName->keyword = KEYWORD_NONE; + } qualifyBlockTag (st, prev); } else if (isLanguage (Lang_csharp)) diff -cr ../ctags-5.5.4.orig/ctags.1 ./ctags.1 *** ../ctags-5.5.4.orig/ctags.1 Tue Mar 30 06:18:13 2004 --- ./ctags.1 Sun Sep 11 12:53:14 2005 *************** *** 453,458 **** --- 453,461 ---- .TP 4 .I z Include the "kind:" key in kind field + .TP 4 + .I t + Type and name of a variable or typedef as "typename:" field [enabled] .PD 1 .RE diff -cr ../ctags-5.5.4.orig/ctags.html ./ctags.html *** ../ctags-5.5.4.orig/ctags.html Tue Mar 30 06:18:20 2004 --- ./ctags.html Sun Sep 11 12:54:26 2005 *************** *** 516,521 **** --- 516,527 ----