[geany/geany] 009203: entry: Sync initTagEntry() code

Jiří Techet git-noreply at xxxxx
Mon Dec 17 21:05:44 UTC 2018


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 09 Oct 2016 14:49:13 UTC
Commit:      00920360da8d93fa9145da1e07ce916b258c0096
             https://github.com/geany/geany/commit/00920360da8d93fa9145da1e07ce916b258c0096

Log Message:
-----------
entry: Sync initTagEntry() code

For now use "source" instead of "input" for various functions inside
read.c which we need as we don't initialize "input" yet.


Modified Paths:
--------------
    ctags/main/entry.c
    ctags/main/entry.h
    ctags/main/read.c
    ctags/main/read.h

Modified: ctags/main/entry.c
76 lines changed, 67 insertions(+), 9 deletions(-)
===================================================================
@@ -504,17 +504,75 @@ extern int makeTagEntry (const tagEntryInfo *const tag)
 	return r;
 }
 
-extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind)
+extern void initTagEntry (tagEntryInfo *const e, const char *const name,
+			  const kindOption *kind)
 {
-	Assert (File.source.name != NULL);
+	initTagEntryFull(e, name,
+			 getInputLineNumber (),
+			 getInputLanguageName (),
+			 getInputFilePosition (),
+			 getInputFileTagPath (),
+			 kind,
+			 ROLE_INDEX_DEFINITION,
+			 getSourceFileTagPath(),
+			 getSourceLanguageName(),
+			 getSourceLineNumber() - getInputLineNumber ());
+}
+
+extern void initRefTagEntry (tagEntryInfo *const e, const char *const name,
+			     const kindOption *kind, int roleIndex)
+{
+	initTagEntryFull(e, name,
+			 getInputLineNumber (),
+			 getInputLanguageName (),
+			 getInputFilePosition (),
+			 getInputFileTagPath (),
+			 kind,
+			 roleIndex,
+			 getSourceFileTagPath(),
+			 getSourceLanguageName(),
+			 getSourceLineNumber() - getInputLineNumber ());
+}
+
+extern void initTagEntryFull (tagEntryInfo *const e, const char *const name,
+			      unsigned long lineNumber,
+			      const char* language,
+			      MIOPos      filePosition,
+			      const char *inputFileName,
+			      const kindOption *kind,
+			      int roleIndex,
+			      const char *sourceFileName,
+			      const char* sourceLanguage,
+			      long sourceLineNumberDifference)
+{
+	int i;
+	Assert (getInputFileName() != NULL);
+
 	memset (e, 0, sizeof (tagEntryInfo));
-	e->lineNumberEntry  = (bool) (Option.locate == EX_LINENUM);
-	e->lineNumber       = getSourceLineNumber ();
-	e->language         = getSourceLanguageName ();
-	e->filePosition     = getInputFilePosition ();
-	e->sourceFileName   = getSourceFileTagPath ();
-	e->name             = name;
-	e->kind             = kind;
+	e->lineNumberEntry = (bool) (Option.locate == EX_LINENUM);
+	e->lineNumber      = lineNumber;
+/*	e->boundaryInfo    = getNestedInputBoundaryInfo (lineNumber); */
+	e->language        = language;
+	e->filePosition    = filePosition;
+	e->inputFileName   = inputFileName;
+	e->name            = name;
+	e->extensionFields.scopeIndex     = CORK_NIL;
+	e->kind = kind;
+
+	Assert (roleIndex >= ROLE_INDEX_DEFINITION);
+	Assert (kind == NULL || roleIndex < kind->nRoles);
+	e->extensionFields.roleIndex = roleIndex;
+	if (roleIndex > ROLE_INDEX_DEFINITION)
+		markTagExtraBit (e, XTAG_REFERENCE_TAGS);
+
+	e->sourceLanguage = sourceLanguage;
+	e->sourceFileName = sourceFileName;
+	e->sourceLineNumberDifference = sourceLineNumberDifference;
+
+	e->usedParserFields = 0;
+
+	for ( i = 0; i < PRE_ALLOCATED_PARSER_FIELDS; i++ )
+		e->parserFields[i].ftype = FIELD_UNKNOWN;
 }
 
 extern void setTagWriter (tagWriter *t)


Modified: ctags/main/entry.h
15 lines changed, 14 insertions(+), 1 deletions(-)
===================================================================
@@ -114,7 +114,20 @@ extern const char *tagFileName (void);
 extern void openTagFile (void);
 extern void closeTagFile (const bool resize);
 extern int makeTagEntry (const tagEntryInfo *const tag);
-extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind);
+extern void initTagEntry (tagEntryInfo *const e, const char *const name,
+			  const kindOption *kind);
+extern void initRefTagEntry (tagEntryInfo *const e, const char *const name,
+			     const kindOption *kind, int roleIndex);
+extern void initTagEntryFull (tagEntryInfo *const e, const char *const name,
+			      unsigned long lineNumber,
+			      const char* language,
+			      MIOPos      filePosition,
+			      const char *inputFileName,
+			      const kindOption *kind,
+			      int roleIndex,
+			      const char *sourceFileName,
+			      const char* sourceLanguage,
+			      long sourceLineNumberDifference);
 
 extern unsigned long numTagsAdded(void);
 extern void setNumTagsAdded (unsigned long nadded);


Modified: ctags/main/read.c
15 lines changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -35,6 +35,21 @@ static MIOPos StartOfLine;      /* holds deferred position of start of line */
 *   FUNCTION DEFINITIONS
 */
 
+extern langType getInputLanguage (void)
+{
+	return File.source.language;
+}
+
+extern const char *getInputLanguageName (void)
+{
+	return getLanguageName (getInputLanguage());
+}
+
+extern const char *getInputFileTagPath (void)
+{
+	return vStringValue (File.source.tagPath);
+}
+
 extern kindOption *getInputLanguageFileKind (void)
 {
 	return getLanguageFileKind (File.input.language);


Modified: ctags/main/read.h
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -98,6 +98,9 @@ extern inputFile File;
 */
 
 /* InputFile: reading from fp in inputFile with updating fields in input fields */
+extern langType getInputLanguage (void);
+extern const char *getInputLanguageName (void);
+extern const char *getInputFileTagPath (void);
 extern kindOption *getInputLanguageFileKind (void);
 
 extern void freeSourceFileResources (void);



--------------
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