[geany/geany] 0ed5c1: Rename tagEntryInfo.extensionFields.scope

Jiří Techet git-noreply at xxxxx
Sat Sep 10 07:26:10 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sat, 30 Jul 2016 14:04:06 UTC
Commit:      0ed5c16b4614a12e6881a897bc8b2eb28e708c3e
             https://github.com/geany/geany/commit/0ed5c16b4614a12e6881a897bc8b2eb28e708c3e

Log Message:
-----------
Rename tagEntryInfo.extensionFields.scope

This requires moving kindOption into a separate file because of circular
include dependency. Also eliminate now redundant tagLetter() function
in c.c.


Modified Paths:
--------------
    ctags/Makefile.am
    ctags/main/entry.h
    ctags/main/kind.h
    ctags/main/parse.c
    ctags/main/parse.h
    ctags/parsers/asciidoc.c
    ctags/parsers/c.c
    ctags/parsers/erlang.c
    ctags/parsers/fortran.c
    ctags/parsers/go.c
    ctags/parsers/jscript.c
    ctags/parsers/json.c
    ctags/parsers/objc.c
    ctags/parsers/php.c
    ctags/parsers/powershell.c
    ctags/parsers/python.c
    ctags/parsers/rest.c
    ctags/parsers/ruby.c
    ctags/parsers/rust.c
    ctags/parsers/sql.c
    ctags/parsers/txt2tags.c
    src/tagmanager/tm_source_file.c

Modified: ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -65,6 +65,7 @@ libctags_la_SOURCES = \
 	main/get.h \
 	main/keyword.c \
 	main/keyword.h \
+	main/kind.h \
 	main/lregex.c \
 	main/main.h \
 	main/mio.c \


Modified: ctags/main/entry.h
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -17,6 +17,7 @@
 
 #include "mio.h"
 #include "vstring.h"
+#include "kind.h"
 
 /*
 *   MACROS
@@ -68,7 +69,10 @@ typedef struct sTagEntryInfo {
 		const char* fileScope;
 		const char* implementation;
 		const char* inheritance;
-		const char* scope [2];  /* value and key */
+
+		const kindOption* scopeKind;
+		const char* scopeName;
+
 		const char *signature; /* Argument list for functions and macros with arguments */
 		const char *varType;
 	} extensionFields;          /* list of extension fields*/


Modified: ctags/main/kind.h
20 lines changed, 20 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,20 @@
+/*
+*   Copyright (c) 1998-2003, Darren Hiebert
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*/
+#ifndef CTAGS_MAIN_KIND_H
+#define CTAGS_MAIN_KIND_H
+
+#include "general.h"
+
+typedef struct sKindOption {
+	boolean enabled;          /* are tags for kind enabled? */
+	char  letter;               /* kind letter */
+	const char* name;		  /* kind name */
+	const char* description;	  /* displayed in --help output */
+} kindOption;
+
+#endif	/* CTAGS_MAIN_KIND_H */


Modified: ctags/main/parse.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -65,7 +65,7 @@ extern void makeSimpleTag (const vString* const name,
 
 extern void makeSimpleScopedTag (const vString* const name,
 								 kindOption* const kinds, const int kind,
-								 const char* scope, const char *scope2,
+								 const char* scopeKind, const char *scopeName,
 								 const char *laccess)
 {
 	if (name != NULL  &&  vStringLength (name) > 0)
@@ -75,8 +75,8 @@ extern void makeSimpleScopedTag (const vString* const name,
 
 		e.kindName = kinds [kind].name;
 		e.kind     = kinds [kind].letter;
-		e.extensionFields.scope[0] = scope;
-		e.extensionFields.scope[1] = scope2;
+		e.extensionFields.scopeKind = &(kinds [kind]);
+		e.extensionFields.scopeName = scopeName;
 		e.extensionFields.access = laccess;
 
 		makeTagEntry (&e);


Modified: ctags/main/parse.h
7 lines changed, 0 insertions(+), 7 deletions(-)
===================================================================
@@ -36,13 +36,6 @@ typedef boolean (*rescanParser) (const unsigned int passCount);
 typedef void (*parserInitialize) (langType language);
 typedef int (*tagEntryFunction) (const tagEntryInfo *const tag, void *user_data);
 
-typedef struct sKindOption {
-	boolean enabled;            /* are tags for kind enabled? */
-	const int letter;           /* kind letter */
-	const char* name;           /* kind name */
-	const char* const description;  /* displayed in --help output */
-} kindOption;
-
 typedef struct {
 	const char *name;
 	const int id;


Modified: ctags/parsers/asciidoc.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -81,8 +81,8 @@ static void makeAsciidocTag (const vString* const name, const int kind)
 
 		if (nl && nl->type < kind)
 		{
-			e.extensionFields.scope [0] = AsciidocKinds [nl->type].name;
-			e.extensionFields.scope [1] = vStringValue (nl->name);
+			e.extensionFields.scopeKind = &(AsciidocKinds [nl->type]);
+			e.extensionFields.scopeName = vStringValue (nl->name);
 		}
 		makeTagEntry (&e);
 	}


Modified: ctags/parsers/c.c
42 lines changed, 13 insertions(+), 29 deletions(-)
===================================================================
@@ -1110,35 +1110,19 @@ static javaKind javaTagKind (const tagType type)
 	return result;
 }
 
-static const char *tagName (const tagType type)
+static const kindOption *tagKind (const tagType type)
 {
-	const char* result;
+	const kindOption* result;
 	if (isLanguage (Lang_java))
-		result = JavaKinds [javaTagKind (type)].name;
+		result = &JavaKinds [javaTagKind (type)];
 	else if (isLanguage (Lang_csharp))
-		result = CsharpKinds [csharpTagKind (type)].name;
+		result = &CsharpKinds [csharpTagKind (type)];
 	else if (isLanguage (Lang_d))
-		result = DKinds [dTagKind (type)].name;
+		result = &DKinds [dTagKind (type)];
 	else if (isLanguage (Lang_vala))
-		result = ValaKinds [valaTagKind (type)].name;
+		result = &ValaKinds [valaTagKind (type)];
 	else
-		result = CKinds [cTagKind (type)].name;
-	return result;
-}
-
-static int tagLetter (const tagType type)
-{
-	int result;
-	if (isLanguage (Lang_csharp))
-		result = CsharpKinds [csharpTagKind (type)].letter;
-	else if (isLanguage (Lang_d))
-		result = DKinds [dTagKind (type)].letter;
-	else if (isLanguage (Lang_java))
-		result = JavaKinds [javaTagKind (type)].letter;
-	else if (isLanguage (Lang_vala))
-		result = ValaKinds [valaTagKind (type)].letter;
-	else
-		result = CKinds [cTagKind (type)].letter;
+		result = &CKinds [cTagKind (type)];
 	return result;
 }
 
@@ -1217,11 +1201,11 @@ static void addOtherFields (tagEntryInfo* const tag, const tagType type,
 				(isMember (st) || st->parent->declaration == DECL_NAMESPACE))
 			{
 				if (isType (st->context, TOKEN_NAME))
-					tag->extensionFields.scope [0] = tagName (TAG_CLASS);
+					tag->extensionFields.scopeKind = tagKind (TAG_CLASS);
 				else
-					tag->extensionFields.scope [0] =
-						tagName (declToTagType (parentDecl (st)));
-				tag->extensionFields.scope [1] = vStringValue (scope);
+					tag->extensionFields.scopeKind =
+						tagKind (declToTagType (parentDecl (st)));
+				tag->extensionFields.scopeName = vStringValue (scope);
 			}
 			if ((type == TAG_CLASS  ||  type == TAG_INTERFACE  ||
 				 type == TAG_STRUCT) && vStringLength (st->parentClasses) > 0)
@@ -1475,8 +1459,8 @@ static void makeTag (const tokenInfo *const token,
 		e.lineNumber	= token->lineNumber;
 		e.filePosition	= token->filePosition;
 		e.isFileScope = isFileScope;
-		e.kindName	= tagName (type);
-		e.kind		= tagLetter (type);
+		e.kindName	= tagKind (type)->name;
+		e.kind		= tagKind (type)->letter;
 
 		findScopeHierarchy (scope, st);
 		addOtherFields (&e, type, token, st, scope);


Modified: ctags/parsers/erlang.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -85,8 +85,8 @@ static void makeMemberTag (
 
 		if (module != NULL  &&  vStringLength (module) > 0)
 		{
-			tag.extensionFields.scope [0] = "module";
-			tag.extensionFields.scope [1] = vStringValue (module);
+			tag.extensionFields.scopeKind = &(ErlangKinds [K_MODULE]);
+			tag.extensionFields.scopeName = vStringValue (module);
 		}
 		makeTagEntry (&tag);
 	}


Modified: ctags/parsers/fortran.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -505,8 +505,8 @@ static void makeFortranTag (tokenInfo *const token, tagType tag)
 			const tokenInfo* const scope = ancestorScope ();
 			if (scope != NULL)
 			{
-				e.extensionFields.scope [0] = FortranKinds [scope->tag].name;
-				e.extensionFields.scope [1] = vStringValue (scope->string);
+				e.extensionFields.scopeKind = &(FortranKinds [scope->tag]);
+				e.extensionFields.scopeName = vStringValue (scope->string);
 			}
 		}
 		if (! insideInterface () /*|| includeTag (TAG_INTERFACE)*/)


Modified: ctags/parsers/go.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -539,8 +539,8 @@ static void makeTag (tokenInfo *const token, const goKind kind,
 
 	if (parent_kind != GOTAG_UNDEFINED && parent_token != NULL)
 	{
-		e.extensionFields.scope[0] = GoKinds[parent_kind].name;
-		e.extensionFields.scope[1] = vStringValue (parent_token->string);
+		e.extensionFields.scopeKind = &(GoKinds[parent_kind]);
+		e.extensionFields.scopeName = vStringValue (parent_token->string);
 	}
 	makeTagEntry (&e);
 


Modified: ctags/parsers/jscript.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -240,8 +240,8 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind, vString *const
 			if (kind == JSTAG_FUNCTION)
 				parent_kind = JSTAG_FUNCTION;
 
-			e.extensionFields.scope[0] = JsKinds [parent_kind].name;
-			e.extensionFields.scope[1] = vStringValue (fullscope);
+			e.extensionFields.scopeKind = &(JsKinds [parent_kind]);
+			e.extensionFields.scopeName = vStringValue (fullscope);
 		}
 
 		if (signature && vStringLength(signature))


Modified: ctags/parsers/json.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -128,8 +128,8 @@ static void makeJsonTag (tokenInfo *const token, const jsonKind kind)
 	{
 		Assert (token->scopeKind > TAG_NONE && token->scopeKind < TAG_COUNT);
 
-		e.extensionFields.scope[0] = JsonKinds[token->scopeKind].name;
-		e.extensionFields.scope[1] = vStringValue (token->scope);
+		e.extensionFields.scopeKind = &(JsonKinds[token->scopeKind]);
+		e.extensionFields.scopeName = vStringValue (token->scope);
 	}
 
 	makeTagEntry (&e);


Modified: ctags/parsers/objc.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -444,8 +444,8 @@ static void prepareTag (tagEntryInfo * tag, vString const *name, objcKind kind)
 
 	if (parentName != NULL)
 	{
-		tag->extensionFields.scope[0] = ObjcKinds[parentType].name;
-		tag->extensionFields.scope[1] = vStringValue (parentName);
+		tag->extensionFields.scopeKind = &(ObjcKinds[parentType]);
+		tag->extensionFields.scopeName = vStringValue (parentName);
 	}
 }
 


Modified: ctags/parsers/php.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -302,8 +302,8 @@ static void initPhpEntry (tagEntryInfo *const e, const tokenInfo *const token,
 		Assert (parentKind >= 0);
 
 		vStringTerminate (fullScope);
-		e->extensionFields.scope[0] = PhpKinds[parentKind].name;
-		e->extensionFields.scope[1] = vStringValue (fullScope);
+		e->extensionFields.scopeKind = &(PhpKinds[parentKind]);
+		e->extensionFields.scopeName = vStringValue (fullScope);
 	}
 }
 


Modified: ctags/parsers/powershell.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -113,8 +113,8 @@ static void initPowerShellEntry (tagEntryInfo *const e, const tokenInfo *const t
 		int parentKind = token->parentKind;
 		Assert (parentKind >= 0);
 
-		e->extensionFields.scope[0] = PowerShellKinds[parentKind].name;
-		e->extensionFields.scope[1] = vStringValue (token->scope);
+		e->extensionFields.scopeKind = &(PowerShellKinds[parentKind]);
+		e->extensionFields.scopeName = vStringValue (token->scope);
 	}
 }
 


Modified: ctags/parsers/python.c
20 lines changed, 10 insertions(+), 10 deletions(-)
===================================================================
@@ -125,13 +125,13 @@ static void makeFunctionTag (vString *const function,
 		{
 			tag.kindName = PythonKinds[K_METHOD].name;
 			tag.kind = PythonKinds[K_METHOD].letter;
-			tag.extensionFields.scope [0] = PythonKinds[K_CLASS].name;
-			tag.extensionFields.scope [1] = vStringValue (parent);
+			tag.extensionFields.scopeKind = &(PythonKinds[K_CLASS]);
+			tag.extensionFields.scopeName = vStringValue (parent);
 		}
 		else
 		{
-			tag.extensionFields.scope [0] = PythonKinds[K_FUNCTION].name;
-			tag.extensionFields.scope [1] = vStringValue (parent);
+			tag.extensionFields.scopeKind = &(PythonKinds[K_FUNCTION]);
+			tag.extensionFields.scopeName = vStringValue (parent);
 		}
 	}
 
@@ -155,13 +155,13 @@ static void makeClassTag (vString *const class, vString *const inheritance,
 	{
 		if (is_class_parent)
 		{
-			tag.extensionFields.scope [0] = PythonKinds[K_CLASS].name;
-			tag.extensionFields.scope [1] = vStringValue (parent);
+			tag.extensionFields.scopeKind = &(PythonKinds[K_CLASS]);
+			tag.extensionFields.scopeName = vStringValue (parent);
 		}
 		else
 		{
-			tag.extensionFields.scope [0] = PythonKinds[K_FUNCTION].name;
-			tag.extensionFields.scope [1] = vStringValue (parent);
+			tag.extensionFields.scopeKind = &(PythonKinds[K_FUNCTION]);
+			tag.extensionFields.scopeName = vStringValue (parent);
 		}
 	}
 	tag.extensionFields.inheritance = vStringValue (inheritance);
@@ -179,8 +179,8 @@ static void makeVariableTag (vString *const var, vString *const parent,
 	tag.kind = PythonKinds[K_VARIABLE].letter;
 	if (vStringLength (parent) > 0)
 	{
-		tag.extensionFields.scope [0] = PythonKinds[K_CLASS].name;
-		tag.extensionFields.scope [1] = vStringValue (parent);
+		tag.extensionFields.scopeKind = &(PythonKinds[K_CLASS]);
+		tag.extensionFields.scopeName = vStringValue (parent);
 	}
 	addAccessFields (&tag, var, K_VARIABLE, vStringLength (parent) > 0,
 		is_class_parent);


Modified: ctags/parsers/rest.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -78,8 +78,8 @@ static void makeRestTag (const vString* const name, const int kind)
 
 		if (nl && nl->type < kind)
 		{
-			e.extensionFields.scope [0] = RestKinds [nl->type].name;
-			e.extensionFields.scope [1] = vStringValue (nl->name);
+			e.extensionFields.scopeKind = &(RestKinds [nl->type]);
+			e.extensionFields.scopeName = vStringValue (nl->name);
 		}
 		makeTagEntry (&e);
 	}


Modified: ctags/parsers/ruby.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -218,8 +218,8 @@ static void emitRubyTag (vString* name, rubyKind kind)
 		Assert (0 <= parent_kind &&
 		        (size_t) parent_kind < (sizeof RubyKinds / sizeof RubyKinds[0]));
 
-	    tag.extensionFields.scope [0] = RubyKinds [parent_kind].name;
-	    tag.extensionFields.scope [1] = vStringValue (scope);
+	    tag.extensionFields.scopeKind = &(RubyKinds [parent_kind]);
+	    tag.extensionFields.scopeName = vStringValue (scope);
 	}
 	tag.kindName = RubyKinds [kind].name;
 	tag.kind = RubyKinds [kind].letter;


Modified: ctags/parsers/rust.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -452,8 +452,8 @@ static void addTag (vString* ident, const char* type, const char* arg_list, int
 	tag.extensionFields.varType = type;
 	if (parent_kind != K_NONE)
 	{
-		tag.extensionFields.scope[0] = rustKinds[parent_kind].name;
-		tag.extensionFields.scope[1] = scope->buffer;
+		tag.extensionFields.scopeKind = &(rustKinds[parent_kind]);
+		tag.extensionFields.scopeName = scope->buffer;
 	}
 	makeTagEntry(&tag);
 }


Modified: ctags/parsers/sql.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -449,8 +449,8 @@ static void makeSqlTag (tokenInfo *const token, const sqlKind kind)
 		if (vStringLength (token->scope) > 0)
 		{
 			Assert (token->scopeKind < SQLTAG_COUNT);
-			e.extensionFields.scope[0] = SqlKinds [token->scopeKind].name;
-			e.extensionFields.scope[1] = vStringValue (token->scope);
+			e.extensionFields.scopeKind = &(SqlKinds [token->scopeKind]);
+			e.extensionFields.scopeName = vStringValue (token->scope);
 		}
 
 		makeTagEntry (&e);


Modified: ctags/parsers/txt2tags.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -68,8 +68,8 @@ static void makeTxt2tagsTag (const vString* const name,
 		}
 		parentKind = &Txt2tagsKinds[nls->levels[nls->n - 1].type];
 
-		e.extensionFields.scope[0] = parentKind->name;
-		e.extensionFields.scope[1] = vStringValue(scope);
+		e.extensionFields.scopeKind = parentKind;
+		e.extensionFields.scopeName = vStringValue(scope);
 	}
 
 	makeTagEntry(&e);


Modified: src/tagmanager/tm_source_file.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -190,9 +190,9 @@ static gboolean init_tag(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag
 	tag->line = tag_entry->lineNumber;
 	if (NULL != tag_entry->extensionFields.signature)
 		tag->arglist = g_strdup(tag_entry->extensionFields.signature);
-	if ((NULL != tag_entry->extensionFields.scope[1]) &&
-		(0 != tag_entry->extensionFields.scope[1][0]))
-		tag->scope = g_strdup(tag_entry->extensionFields.scope[1]);
+	if ((NULL != tag_entry->extensionFields.scopeName) &&
+		(0 != tag_entry->extensionFields.scopeName[0]))
+		tag->scope = g_strdup(tag_entry->extensionFields.scopeName);
 	if (tag_entry->extensionFields.inheritance != NULL)
 		tag->inheritance = g_strdup(tag_entry->extensionFields.inheritance);
 	if (tag_entry->extensionFields.varType != NULL)



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list