lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
List overview
Commits
September 2016
----- 2024 -----
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
commits@lists.geany.org
1 participants
80 discussions
Start a n
N
ew thread
[geany/geany] d12222: Rename skipOverCComment() to cppSkipOverCComment()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:30 UTC Commit: d1222299020b7fb81e04e6441d900ac3a9b03ba0
https://github.com/geany/geany/commit/d1222299020b7fb81e04e6441d900ac3a9b03…
Log Message: ----------- Rename skipOverCComment() to cppSkipOverCComment() Modified Paths: -------------- ctags/main/lcpp.c ctags/main/lcpp.h ctags/parsers/verilog.c Modified: ctags/main/lcpp.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -458,7 +458,7 @@ static Comment isComment (void) /* Skips over a C style comment. According to ANSI specification a comment * is treated as white space, so we perform this substitution. */ -int skipOverCComment (void) +int cppSkipOverCComment (void) { int c = getcFromInputFile (); @@ -686,7 +686,7 @@ extern int cppGetc (void) const Comment comment = isComment (); if (comment == COMMENT_C) - c = skipOverCComment (); + c = cppSkipOverCComment (); else if (comment == COMMENT_CPLUS) { c = skipOverCplusComment (); Modified: ctags/main/lcpp.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -45,7 +45,7 @@ extern void cppBeginStatement (void); extern void cppEndStatement (void); extern void cppUngetc (const int c); extern int cppGetc (void); -extern int skipOverCComment (void); +extern int cppSkipOverCComment (void); extern char *getArglistFromFilePos(MIOPos startPosition, const char *tokenName); extern char *getArglistFromStr(char *buf, const char *name); Modified: ctags/parsers/verilog.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -140,7 +140,7 @@ static int vGetc (void) } else if (c2 == '*') /* strip block comment */ { - c = skipOverCComment(); + c = cppSkipOverCComment(); } else { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 9745d4: Sync whitespace in parsers
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 00:01:33 UTC Commit: 9745d470c6288d88b455436a918f92e13e271df4
https://github.com/geany/geany/commit/9745d470c6288d88b455436a918f92e13e271…
Log Message: ----------- Sync whitespace in parsers Modified Paths: -------------- ctags/parsers/asm.c ctags/parsers/basic.c ctags/parsers/c.c ctags/parsers/fortran.c ctags/parsers/html.c ctags/parsers/jscript.c ctags/parsers/pascal.c ctags/parsers/php.c ctags/parsers/python.c ctags/parsers/r.c ctags/parsers/ruby.c ctags/parsers/sql.c ctags/parsers/tcl.c Modified: ctags/parsers/asm.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -180,7 +180,7 @@ static AsmKind operatorKind ( static boolean isDefineOperator (const vString *const operator) { const unsigned char *const op = - (unsigned char*) vStringValue (operator); + (unsigned char*) vStringValue (operator); const size_t length = vStringLength (operator); const boolean result = (boolean) (length > 0 && toupper ((int) *op) == 'D' && Modified: ctags/parsers/basic.c 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -194,10 +194,9 @@ static int match_keyword (const char *p, KeyWord const *kw) for (j = 0; j < 1; j++) { p = extract_name (p, name); - } + } makeSimpleTag (name, BasicKinds, kw->kind); vStringDelete (name); - return 1; } Modified: ctags/parsers/c.c 413 lines changed, 203 insertions(+), 210 deletions(-) =================================================================== @@ -11,7 +11,7 @@ /* * INCLUDE FILES */ -#include "general.h" /* must always come first */ +#include "general.h" /* must always come first */ #include <string.h> #include <setjmp.h> @@ -31,17 +31,17 @@ * MACROS */ -#define activeToken(st) ((st)->token [(int) (st)->tokenIndex]) -#define parentDecl(st) ((st)->parent == NULL ? \ - DECL_NONE : (st)->parent->declaration) -#define isType(token,t) (boolean) ((token)->type == (t)) -#define insideEnumBody(st) (boolean) ((st)->parent == NULL ? FALSE : \ +#define activeToken(st) ((st)->token [(int) (st)->tokenIndex]) +#define parentDecl(st) ((st)->parent == NULL ? \ + DECL_NONE : (st)->parent->declaration) +#define isType(token,t) (boolean) ((token)->type == (t)) +#define insideEnumBody(st) (boolean) ((st)->parent == NULL ? FALSE : \ ((st)->parent->declaration == DECL_ENUM)) -#define isExternCDecl(st,c) (boolean) ((c) == STRING_SYMBOL && \ +#define isExternCDecl(st,c) (boolean) ((c) == STRING_SYMBOL && \ ! (st)->haveQualifyingName && \ (st)->scope == SCOPE_EXTERN) -#define isOneOf(c,s) (boolean) (strchr ((s), (c)) != NULL) +#define isOneOf(c,s) (boolean) (strchr ((s), (c)) != NULL) /* * DATA DECLARATIONS @@ -109,50 +109,50 @@ typedef struct sKeywordDesc */ typedef enum eTokenType { - TOKEN_NONE, /* none */ - TOKEN_ARGS, /* a parenthetical pair and its contents */ + TOKEN_NONE, /* none */ + TOKEN_ARGS, /* a parenthetical pair and its contents */ TOKEN_BRACE_CLOSE, TOKEN_BRACE_OPEN, - TOKEN_COMMA, /* the comma character */ - TOKEN_DOUBLE_COLON, /* double colon indicates nested-name-specifier */ + TOKEN_COMMA, /* the comma character */ + TOKEN_DOUBLE_COLON, /* double colon indicates nested-name-specifier */ TOKEN_KEYWORD, - TOKEN_NAME, /* an unknown name */ - TOKEN_PACKAGE, /* a Java package name */ - TOKEN_PAREN_NAME, /* a single name in parentheses */ - TOKEN_SEMICOLON, /* the semicolon character */ - TOKEN_SPEC, /* a storage class specifier, qualifier, type, etc. */ - TOKEN_STAR, /* pointer detection */ - TOKEN_ARRAY, /* array detection */ + TOKEN_NAME, /* an unknown name */ + TOKEN_PACKAGE, /* a Java package name */ + TOKEN_PAREN_NAME, /* a single name in parentheses */ + TOKEN_SEMICOLON, /* the semicolon character */ + TOKEN_SPEC, /* a storage class specifier, qualifier, type, etc. */ + TOKEN_STAR, /* pointer detection */ + TOKEN_ARRAY, /* array detection */ TOKEN_COUNT } tokenType; /* This describes the scoping of the current statement. */ typedef enum eTagScope { - SCOPE_GLOBAL, /* no storage class specified */ - SCOPE_STATIC, /* static storage class */ - SCOPE_EXTERN, /* external storage class */ - SCOPE_FRIEND, /* declares access only */ - SCOPE_TYPEDEF, /* scoping depends upon context */ + SCOPE_GLOBAL, /* no storage class specified */ + SCOPE_STATIC, /* static storage class */ + SCOPE_EXTERN, /* external storage class */ + SCOPE_FRIEND, /* declares access only */ + SCOPE_TYPEDEF, /* scoping depends upon context */ SCOPE_COUNT } tagScope; typedef enum eDeclaration { DECL_NONE, - DECL_BASE, /* base type (default) */ + DECL_BASE, /* base type (default) */ DECL_CLASS, DECL_ENUM, DECL_EVENT, DECL_SIGNAL, DECL_FUNCTION, DECL_FUNCTION_TEMPLATE, - DECL_IGNORE, /* non-taggable "declaration" */ + DECL_IGNORE, /* non-taggable "declaration" */ DECL_INTERFACE, DECL_MODULE, DECL_NAMESPACE, - DECL_NOMANGLE, /* C++ name demangling block */ + DECL_NOMANGLE, /* C++ name demangling block */ DECL_PACKAGE, DECL_STRUCT, DECL_UNION, @@ -165,25 +165,25 @@ typedef enum eVisibilityType ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC, - ACCESS_DEFAULT, /* Java-specific */ + ACCESS_DEFAULT, /* Java-specific */ ACCESS_COUNT } accessType; /* Information about the parent class of a member (if any). */ typedef struct sMemberInfo { - accessType access; /* access of current statement */ - accessType accessDefault; /* access default for current statement */ + accessType access; /* access of current statement */ + accessType accessDefault; /* access default for current statement */ } memberInfo; typedef struct sTokenInfo { - tokenType type; - keywordId keyword; - vString* name; /* the name of the token */ - unsigned long lineNumber; /* line number of tag */ - MIOPos filePosition; /* file position of line containing name */ + tokenType type; + keywordId keyword; + vString* name; /* the name of the token */ + unsigned long lineNumber; /* line number of tag */ + MIOPos filePosition; /* file position of line containing name */ } tokenInfo; typedef enum eImplementation @@ -199,52 +199,52 @@ typedef enum eImplementation */ typedef struct sStatementInfo { - tagScope scope; - declType declaration; /* specifier associated with TOKEN_SPEC */ - boolean gotName; /* was a name parsed yet? */ - boolean haveQualifyingName; /* do we have a name we are considering? */ - boolean gotParenName; /* was a name inside parentheses parsed yet? */ - boolean gotArgs; /* was a list of parameters parsed yet? */ - unsigned int nSemicolons; /* how many semicolons did we see in that statement */ - impType implementation; /* abstract or concrete implementation? */ - unsigned int tokenIndex; /* currently active token */ - tokenInfo* token [((int) NumTokens)]; - tokenInfo* context; /* accumulated scope of current statement */ - tokenInfo* blockName; /* name of current block */ - memberInfo member; /* information regarding parent class/struct */ - vString* parentClasses; /* parent classes */ - struct sStatementInfo *parent; /* statement we are nested within */ - long argEndPosition; /* Position where argument list ended */ - tokenInfo* firstToken; /* First token in the statement */ + tagScope scope; + declType declaration; /* specifier associated with TOKEN_SPEC */ + boolean gotName; /* was a name parsed yet? */ + boolean haveQualifyingName; /* do we have a name we are considering? */ + boolean gotParenName; /* was a name inside parentheses parsed yet? */ + boolean gotArgs; /* was a list of parameters parsed yet? */ + unsigned int nSemicolons; /* how many semicolons did we see in that statement */ + impType implementation; /* abstract or concrete implementation? */ + unsigned int tokenIndex; /* currently active token */ + tokenInfo* token [((int) NumTokens)]; + tokenInfo* context; /* accumulated scope of current statement */ + tokenInfo* blockName; /* name of current block */ + memberInfo member; /* information regarding parent class/struct */ + vString* parentClasses; /* parent classes */ + struct sStatementInfo *parent; /* statement we are nested within */ + long argEndPosition; /* Position where argument list ended */ + tokenInfo* firstToken; /* First token in the statement */ } statementInfo; /* Describes the type of tag being generated. */ typedef enum eTagType { TAG_UNDEFINED, - TAG_CLASS, /* class name */ - TAG_ENUM, /* enumeration name */ - TAG_ENUMERATOR, /* enumerator (enumeration value) */ - TAG_FIELD, /* field (Java) */ - TAG_FUNCTION, /* function definition */ - TAG_INTERFACE, /* interface declaration */ - TAG_MEMBER, /* structure, class or interface member */ - TAG_METHOD, /* method declaration */ - TAG_NAMESPACE, /* namespace name */ - TAG_PACKAGE, /* package name */ - TAG_PROTOTYPE, /* function prototype or declaration */ - TAG_STRUCT, /* structure name */ - TAG_TYPEDEF, /* typedef name */ - TAG_UNION, /* union name */ - TAG_VARIABLE, /* variable definition */ - TAG_EXTERN_VAR, /* external variable declaration */ - TAG_MACRO, /* #define s */ - TAG_EVENT, /* event */ - TAG_SIGNAL, /* signal */ - TAG_LOCAL, /* local variable definition */ - TAG_PROPERTY, /* property name */ - TAG_COUNT /* must be last */ + TAG_CLASS, /* class name */ + TAG_ENUM, /* enumeration name */ + TAG_ENUMERATOR, /* enumerator (enumeration value) */ + TAG_FIELD, /* field (Java) */ + TAG_FUNCTION, /* function definition */ + TAG_INTERFACE, /* interface declaration */ + TAG_MEMBER, /* structure, class or interface member */ + TAG_METHOD, /* method declaration */ + TAG_NAMESPACE, /* namespace name */ + TAG_PACKAGE, /* package name / D module name */ + TAG_PROTOTYPE, /* function prototype or declaration */ + TAG_STRUCT, /* structure name */ + TAG_TYPEDEF, /* typedef name */ + TAG_UNION, /* union name */ + TAG_VARIABLE, /* variable definition */ + TAG_EXTERN_VAR, /* external variable declaration */ + TAG_MACRO, /* #define s */ + TAG_EVENT, /* event */ + TAG_SIGNAL, /* signal */ + TAG_LOCAL, /* local variable definition */ + TAG_PROPERTY, /* property name */ + TAG_COUNT /* must be last */ } tagType; typedef struct sParenInfo @@ -606,9 +606,9 @@ static void initToken (tokenInfo* const token) { token->type = TOKEN_NONE; token->keyword = KEYWORD_NONE; - token->lineNumber = getInputLineNumber(); - token->filePosition = getInputFilePosition(); - vStringClear(token->name); + token->lineNumber = getInputLineNumber (); + token->filePosition = getInputFilePosition (); + vStringClear (token->name); } static void advanceToken (statementInfo* const st) @@ -617,24 +617,23 @@ static void advanceToken (statementInfo* const st) st->tokenIndex = 0; else ++st->tokenIndex; - initToken(st->token[st->tokenIndex]); + initToken (st->token [st->tokenIndex]); } static tokenInfo *prevToken (const statementInfo *const st, unsigned int n) { unsigned int tokenIndex; unsigned int num = (unsigned int) NumTokens; - Assert(n < num); + Assert (n < num); tokenIndex = (st->tokenIndex + num - n) % num; - - return st->token[tokenIndex]; + return st->token [tokenIndex]; } static void setToken (statementInfo *const st, const tokenType type) { tokenInfo *token; token = activeToken (st); - initToken(token); + initToken (token); token->type = type; } @@ -644,23 +643,23 @@ static void retardToken (statementInfo *const st) st->tokenIndex = (unsigned int) NumTokens - 1; else --st->tokenIndex; - setToken(st, TOKEN_NONE); + setToken (st, TOKEN_NONE); } static tokenInfo *newToken (void) { tokenInfo *const token = xMalloc (1, tokenInfo); - token->name = vStringNew(); - initToken(token); + token->name = vStringNew (); + initToken (token); return token; } static void deleteToken (tokenInfo *const token) { if (token != NULL) { - vStringDelete(token->name); - eFree(token); + vStringDelete (token->name); + eFree (token); } } @@ -700,7 +699,7 @@ static const char *tokenString (const tokenType type) }; Assert (sizeof (names) / sizeof (names [0]) == TOKEN_COUNT); Assert ((int) type < TOKEN_COUNT); - return names[(int) type]; + return names [(int) type]; } static const char *scopeString (const tagScope scope) @@ -710,7 +709,7 @@ static const char *scopeString (const tagScope scope) }; Assert (sizeof (names) / sizeof (names [0]) == SCOPE_COUNT); Assert ((int) scope < SCOPE_COUNT); - return names[(int) scope]; + return names [(int) scope]; } static const char *declString (const declType declaration) @@ -722,7 +721,7 @@ static const char *declString (const declType declaration) }; Assert (sizeof (names) / sizeof (names [0]) == DECL_COUNT); Assert ((int) declaration < DECL_COUNT); - return names[(int) declaration]; + return names [(int) declaration]; } static const char *keywordString (const keywordId keyword) @@ -732,8 +731,7 @@ static const char *keywordString (const keywordId keyword) size_t i; for (i = 0 ; i < count ; ++i) { - const keywordDesc *p = &KeywordTable[i]; - + const keywordDesc *p = &KeywordTable [i]; if (p->id == keyword) { name = p->name; @@ -746,16 +744,16 @@ static const char *keywordString (const keywordId keyword) static void UNUSED pt (tokenInfo *const token) { if (isType (token, TOKEN_NAME)) - printf("type: %-12s: %-13s line: %lu\n", - tokenString (token->type), vStringValue (token->name), - token->lineNumber); + printf ("type: %-12s: %-13s line: %lu\n", + tokenString (token->type), vStringValue (token->name), + token->lineNumber); else if (isType (token, TOKEN_KEYWORD)) - printf("type: %-12s: %-13s line: %lu\n", - tokenString (token->type), keywordString (token->keyword), - token->lineNumber); + printf ("type: %-12s: %-13s line: %lu\n", + tokenString (token->type), keywordString (token->keyword), + token->lineNumber); else - printf("type: %-12s line: %lu\n", - tokenString (token->type), token->lineNumber); + printf ("type: %-12s line: %lu\n", + tokenString (token->type), token->lineNumber); } static void UNUSED ps (statementInfo *const st) @@ -1004,17 +1002,17 @@ static cKind cTagKind (const tagType type) cKind result = CK_UNDEFINED; switch (type) { - case TAG_CLASS: result = CK_CLASS; break; - case TAG_ENUM: result = CK_ENUMERATION; break; - case TAG_ENUMERATOR: result = CK_ENUMERATOR; break; - case TAG_FUNCTION: result = CK_FUNCTION; break; - case TAG_MEMBER: result = CK_MEMBER; break; - case TAG_NAMESPACE: result = CK_NAMESPACE; break; - case TAG_PROTOTYPE: result = CK_PROTOTYPE; break; - case TAG_STRUCT: result = CK_STRUCT; break; - case TAG_TYPEDEF: result = CK_TYPEDEF; break; - case TAG_UNION: result = CK_UNION; break; - case TAG_VARIABLE: result = CK_VARIABLE; break; + case TAG_CLASS: result = CK_CLASS; break; + case TAG_ENUM: result = CK_ENUMERATION; break; + case TAG_ENUMERATOR: result = CK_ENUMERATOR; break; + case TAG_FUNCTION: result = CK_FUNCTION; break; + case TAG_MEMBER: result = CK_MEMBER; break; + case TAG_NAMESPACE: result = CK_NAMESPACE; break; + case TAG_PROTOTYPE: result = CK_PROTOTYPE; break; + case TAG_STRUCT: result = CK_STRUCT; break; + case TAG_TYPEDEF: result = CK_TYPEDEF; break; + case TAG_UNION: result = CK_UNION; break; + case TAG_VARIABLE: result = CK_VARIABLE; break; case TAG_EXTERN_VAR: result = CK_EXTERN_VARIABLE; break; default: Assert ("Bad C tag type" == NULL); break; @@ -1145,14 +1143,14 @@ static tagType declToTagType (const declType declaration) switch (declaration) { - case DECL_CLASS: type = TAG_CLASS; break; - case DECL_ENUM: type = TAG_ENUM; break; - case DECL_FUNCTION: type = TAG_FUNCTION; break; + case DECL_CLASS: type = TAG_CLASS; break; + case DECL_ENUM: type = TAG_ENUM; break; + case DECL_FUNCTION: type = TAG_FUNCTION; break; case DECL_FUNCTION_TEMPLATE: type = TAG_FUNCTION; break; - case DECL_INTERFACE:type = TAG_INTERFACE; break; - case DECL_NAMESPACE:type = TAG_NAMESPACE; break; - case DECL_STRUCT: type = TAG_STRUCT; break; - case DECL_UNION: type = TAG_UNION; break; + case DECL_INTERFACE: type = TAG_INTERFACE; break; + case DECL_NAMESPACE: type = TAG_NAMESPACE; break; + case DECL_STRUCT: type = TAG_STRUCT; break; + case DECL_UNION: type = TAG_UNION; break; default: Assert ("Unexpected declaration" == NULL); break; } @@ -1509,8 +1507,8 @@ static void qualifyFunctionTag (const statementInfo *const st, const tagType type = (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) ? TAG_METHOD : TAG_FUNCTION; const boolean isFileScope = - (boolean) (st->member.access == ACCESS_PRIVATE || - (!isMember (st) && st->scope == SCOPE_STATIC)); + (boolean) (st->member.access == ACCESS_PRIVATE || + (!isMember (st) && st->scope == SCOPE_STATIC)); makeTag (nameToken, st, isFileScope, type); } @@ -1696,7 +1694,7 @@ static void skipToMatch (const char *const pair) if (c == EOF) { verbose ("%s: failed to find match for '%c' at line %lu\n", - getInputFileName (), begin, inputLineNumber); + getInputFileName (), begin, inputLineNumber); if (braceMatching) longjmp (Exception, (int) ExceptionBraceFormattingError); else @@ -1790,7 +1788,7 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) c = cppGetc (); } while (isident (c) || (isLanguage (Lang_vala) && '.' == c)); vStringTerminate (name); - cppUngetc (c); /* unget non-identifier character */ + cppUngetc (c); /* unget non-identifier character */ /* Vala supports '?' at end of a type (with or without whitespace before) for nullable types */ if (isLanguage (Lang_vala)) @@ -1818,7 +1816,7 @@ static void readPackageName (tokenInfo *const token, const int firstChar) c = cppGetc (); } vStringTerminate (name); - cppUngetc (c); /* unget non-package character */ + cppUngetc (c); /* unget non-package character */ } static void readPackageOrNamespace (statementInfo *const st, const declType declaration) @@ -1881,7 +1879,7 @@ static void readOperator (statementInfo *const st) else if (c == '(') { /* Verify whether this is a valid function call (i.e. "()") operator. - */ + */ if (cppGetc () == ')') { vStringPut (name, ' '); /* always separate operator from keyword */ @@ -1898,9 +1896,9 @@ static void readOperator (statementInfo *const st) else if (isident1 (c)) { /* Handle "new" and "delete" operators, and conversion functions - * (per 13.3.1.1.2 [2] of the C++ spec). - */ - boolean whiteSpace = TRUE; /* default causes insertion of space */ + * (per 13.3.1.1.2 [2] of the C++ spec). + */ + boolean whiteSpace = TRUE; /* default causes insertion of space */ do { if (isspace (c)) @@ -1920,7 +1918,7 @@ static void readOperator (statementInfo *const st) } else if (isOneOf (c, acceptable)) { - vStringPut (name, ' '); /* always separate operator from keyword */ + vStringPut (name, ' '); /* always separate operator from keyword */ do { vStringPut (name, c); @@ -2034,45 +2032,45 @@ static void processToken (tokenInfo *const token, statementInfo *const st) { default: break; - case KEYWORD_NONE: processName (st); break; - case KEYWORD_ABSTRACT: st->implementation = IMP_ABSTRACT; break; - case KEYWORD_ATTRIBUTE: skipParens (); initToken (token); break; - case KEYWORD_CATCH: skipParens (); skipBraces (); break; - case KEYWORD_CHAR: st->declaration = DECL_BASE; break; - case KEYWORD_CLASS: checkIsClassEnum (st, DECL_CLASS); break; - case KEYWORD_CONST: st->declaration = DECL_BASE; break; - case KEYWORD_DOUBLE: st->declaration = DECL_BASE; break; - case KEYWORD_ENUM: st->declaration = DECL_ENUM; break; - case KEYWORD_EXTENDS: readParents (st, '.'); - setToken (st, TOKEN_NONE); break; - case KEYWORD_FLOAT: st->declaration = DECL_BASE; break; - case KEYWORD_FRIEND: st->scope = SCOPE_FRIEND; break; + case KEYWORD_NONE: processName (st); break; + case KEYWORD_ABSTRACT: st->implementation = IMP_ABSTRACT; break; + case KEYWORD_ATTRIBUTE: skipParens (); initToken (token); break; + case KEYWORD_CATCH: skipParens (); skipBraces (); break; + case KEYWORD_CHAR: st->declaration = DECL_BASE; break; + case KEYWORD_CLASS: checkIsClassEnum (st, DECL_CLASS); break; + case KEYWORD_CONST: st->declaration = DECL_BASE; break; + case KEYWORD_DOUBLE: st->declaration = DECL_BASE; break; + case KEYWORD_ENUM: st->declaration = DECL_ENUM; break; + case KEYWORD_EXTENDS: readParents (st, '.'); + setToken (st, TOKEN_NONE); break; + case KEYWORD_FLOAT: st->declaration = DECL_BASE; break; + case KEYWORD_FRIEND: st->scope = SCOPE_FRIEND; break; case KEYWORD_IMPLEMENTS:readParents (st, '.'); - setToken (st, TOKEN_NONE); break; - case KEYWORD_IMPORT: st->declaration = DECL_IGNORE; break; - case KEYWORD_INT: st->declaration = DECL_BASE; break; - case KEYWORD_BOOLEAN: st->declaration = DECL_BASE; break; - case KEYWORD_WCHAR_T: st->declaration = DECL_BASE; break; - case KEYWORD_SIZE_T: st->declaration = DECL_BASE; break; - case KEYWORD_INTERFACE: st->declaration = DECL_INTERFACE; break; - case KEYWORD_LONG: st->declaration = DECL_BASE; break; - case KEYWORD_OPERATOR: readOperator (st); break; - case KEYWORD_MODULE: readPackage (st); break; - case KEYWORD_PRIVATE: setAccess (st, ACCESS_PRIVATE); break; - case KEYWORD_PROTECTED: setAccess (st, ACCESS_PROTECTED); break; - case KEYWORD_PUBLIC: setAccess (st, ACCESS_PUBLIC); break; - case KEYWORD_SHORT: st->declaration = DECL_BASE; break; - case KEYWORD_SIGNED: st->declaration = DECL_BASE; break; - case KEYWORD_STRUCT: checkIsClassEnum (st, DECL_STRUCT); break; - case KEYWORD_STATIC_ASSERT: skipParens (); break; - case KEYWORD_THROWS: discardTypeList (token); break; - case KEYWORD_TYPEDEF: st->scope = SCOPE_TYPEDEF; break; - case KEYWORD_UNION: st->declaration = DECL_UNION; break; - case KEYWORD_UNSIGNED: st->declaration = DECL_BASE; break; - case KEYWORD_USING: st->declaration = DECL_IGNORE; break; - case KEYWORD_VOID: st->declaration = DECL_BASE; break; - case KEYWORD_VOLATILE: st->declaration = DECL_BASE; break; - case KEYWORD_VIRTUAL: st->implementation = IMP_VIRTUAL; break; + setToken (st, TOKEN_NONE); break; + case KEYWORD_IMPORT: st->declaration = DECL_IGNORE; break; + case KEYWORD_INT: st->declaration = DECL_BASE; break; + case KEYWORD_BOOLEAN: st->declaration = DECL_BASE; break; + case KEYWORD_WCHAR_T: st->declaration = DECL_BASE; break; + case KEYWORD_SIZE_T: st->declaration = DECL_BASE; break; + case KEYWORD_INTERFACE: st->declaration = DECL_INTERFACE; break; + case KEYWORD_LONG: st->declaration = DECL_BASE; break; + case KEYWORD_OPERATOR: readOperator (st); break; + case KEYWORD_MODULE: readPackage (st); break; + case KEYWORD_PRIVATE: setAccess (st, ACCESS_PRIVATE); break; + case KEYWORD_PROTECTED: setAccess (st, ACCESS_PROTECTED); break; + case KEYWORD_PUBLIC: setAccess (st, ACCESS_PUBLIC); break; + case KEYWORD_SHORT: st->declaration = DECL_BASE; break; + case KEYWORD_SIGNED: st->declaration = DECL_BASE; break; + case KEYWORD_STRUCT: checkIsClassEnum (st, DECL_STRUCT); break; + case KEYWORD_STATIC_ASSERT: skipParens (); break; + case KEYWORD_THROWS: discardTypeList (token); break; + case KEYWORD_TYPEDEF: st->scope = SCOPE_TYPEDEF; break; + case KEYWORD_UNION: st->declaration = DECL_UNION; break; + case KEYWORD_UNSIGNED: st->declaration = DECL_BASE; break; + case KEYWORD_USING: st->declaration = DECL_IGNORE; break; + case KEYWORD_VOID: st->declaration = DECL_BASE; break; + case KEYWORD_VOLATILE: st->declaration = DECL_BASE; break; + case KEYWORD_VIRTUAL: st->implementation = IMP_VIRTUAL; break; case KEYWORD_NAMESPACE: readPackageOrNamespace (st, DECL_NAMESPACE); break; case KEYWORD_PACKAGE: readPackageOrNamespace (st, DECL_PACKAGE); break; @@ -2137,7 +2135,7 @@ static void restartStatement (statementInfo *const st) processToken (token, st); } -/* Skips over a the mem-initializer-list of a ctor-initializer, defined as: +/* Skips over a mem-initializer-list of a ctor-initializer, defined as: * * mem-initializer-list: * mem-initializer, mem-initializer-list @@ -2220,8 +2218,8 @@ static boolean isDPostArgumentToken(tokenInfo *const token) * int foo (...) [const|volatile] [throw (...)] try [ctor-initializer] {...} * catch (...) {...} */ -static boolean skipPostArgumentStuff (statementInfo *const st, - parenInfo *const info) +static boolean skipPostArgumentStuff ( + statementInfo *const st, parenInfo *const info) { tokenInfo *const token = activeToken (st); unsigned int parameters = info->parameterCount; @@ -2234,12 +2232,12 @@ static boolean skipPostArgumentStuff (statementInfo *const st, { switch (c) { - case ')': break; - case ':': skipMemIntializerList (token);break; /* ctor-initializer */ - case '[': skipToMatch ("[]"); break; - case '=': cppUngetc (c); end = TRUE; break; - case '{': cppUngetc (c); end = TRUE; break; - case '}': cppUngetc (c); end = TRUE; break; + case ')': break; + case ':': skipMemIntializerList (token);break; /* ctor-initializer */ + case '[': skipToMatch ("[]"); break; + case '=': cppUngetc (c); end = TRUE; break; + case '{': cppUngetc (c); end = TRUE; break; + case '}': cppUngetc (c); end = TRUE; break; case '(': { @@ -2333,6 +2331,7 @@ static boolean skipPostArgumentStuff (statementInfo *const st, restartStatement (st); else setToken (st, TOKEN_NONE); + return (boolean) (c != EOF); } @@ -2508,7 +2507,7 @@ static int parseParens (statementInfo *const st, parenInfo *const info) else if (isType (token, TOKEN_PAREN_NAME)) { c = skipToNonWhite (); - if (c == '*') /* check for function pointer */ + if (c == '*') /* check for function pointer */ { skipToMatch ("()"); c = skipToNonWhite (); @@ -2577,12 +2576,12 @@ static int parseParens (statementInfo *const st, parenInfo *const info) static void initParenInfo (parenInfo *const info) { - info->isParamList = TRUE; - info->isKnrParamList = TRUE; - info->isNameCandidate = TRUE; - info->invalidContents = FALSE; - info->nestedArgs = FALSE; - info->parameterCount = 0; + info->isParamList = TRUE; + info->isKnrParamList = TRUE; + info->isNameCandidate = TRUE; + info->invalidContents = FALSE; + info->nestedArgs = FALSE; + info->parameterCount = 0; } static void analyzeParens (statementInfo *const st) @@ -2597,9 +2596,7 @@ static void analyzeParens (statementInfo *const st) initParenInfo (&info); parseParens (st, &info); - c = skipToNonWhite (); - cppUngetc (c); if (info.invalidContents) { @@ -2629,9 +2626,7 @@ static void analyzeParens (statementInfo *const st) analyzePostParens (st, &info); } else - { setToken (st, TOKEN_NONE); - } } } @@ -2746,7 +2741,7 @@ static int skipInitializer (statementInfo *const st) else if (! isBraceFormat ()) { verbose ("%s: unexpected closing brace at line %lu\n", - getInputFileName (), getInputLineNumber ()); + getInputFileName (), getInputLineNumber ()); longjmp (Exception, (int) ExceptionBraceFormattingError); } break; @@ -2816,24 +2811,24 @@ static void nextToken (statementInfo *const st) c = skipToNonWhite(); switch (c) { - case EOF: longjmp (Exception, (int) ExceptionEOF); break; - case '(': analyzeParens (st); token = activeToken (st); break; - case '*': setToken (st, TOKEN_STAR); break; - case ',': setToken (st, TOKEN_COMMA); break; - case ':': processColon (st); break; - case ';': setToken (st, TOKEN_SEMICOLON); break; - case '<': skipToMatch ("<>"); break; - case '=': processInitializer (st); break; + case EOF: longjmp (Exception, (int) ExceptionEOF); break; + case '(': analyzeParens (st); token = activeToken (st); break; + case '*': setToken (st, TOKEN_STAR); break; + case ',': setToken (st, TOKEN_COMMA); break; + case ':': processColon (st); break; + case ';': setToken (st, TOKEN_SEMICOLON); break; + case '<': skipToMatch ("<>"); break; + case '=': processInitializer (st); break; case '[': /* Hack for Vala: [..] can be a function attribute. * Seems not to have bad side effects, but have to test it more. */ if (!isLanguage (Lang_vala)) setToken (st, TOKEN_ARRAY); skipToMatch ("[]"); break; - case '{': setToken (st, TOKEN_BRACE_OPEN); break; - case '}': setToken (st, TOKEN_BRACE_CLOSE); break; - default: parseGeneralToken (st, c); break; + case '{': setToken (st, TOKEN_BRACE_OPEN); break; + case '}': setToken (st, TOKEN_BRACE_CLOSE); break; + default: parseGeneralToken (st, c); break; } } while (isType (token, TOKEN_NONE)); @@ -2862,10 +2857,10 @@ static statementInfo *newStatement (statementInfo *const parent) for (i = 0 ; i < (unsigned int) NumTokens ; ++i) st->token [i] = newToken (); - st->context = newToken (); - st->blockName = newToken (); - st->parentClasses = vStringNew (); - st->firstToken = newToken(); + st->context = newToken (); + st->blockName = newToken (); + st->parentClasses = vStringNew (); + st->firstToken = newToken(); initStatement (st, parent); CurrentStatement = st; @@ -2881,11 +2876,11 @@ static void deleteStatement (void) for (i = 0 ; i < (unsigned int) NumTokens ; ++i) { - deleteToken(st->token[i]); st->token[i] = NULL; + deleteToken (st->token [i]); st->token [i] = NULL; } - deleteToken(st->blockName); st->blockName = NULL; - deleteToken(st->context); st->context = NULL; - vStringDelete(st->parentClasses); st->parentClasses = NULL; + deleteToken (st->blockName); st->blockName = NULL; + deleteToken (st->context); st->context = NULL; + vStringDelete (st->parentClasses); st->parentClasses = NULL; deleteToken(st->firstToken); eFree (st); CurrentStatement = parent; @@ -3115,17 +3110,15 @@ static void createTags (const unsigned int nestLevel, tokenInfo *token; nextToken (st); - token = activeToken (st); - if (isType (token, TOKEN_BRACE_CLOSE)) { if (nestLevel > 0) break; else { verbose ("%s: unexpected closing brace at line %lu\n", - getInputFileName (), getInputLineNumber ()); + getInputFileName (), getInputLineNumber ()); longjmp (Exception, (int) ExceptionBraceFormattingError); } } @@ -3170,7 +3163,7 @@ static boolean findCTags (const unsigned int passCount) { retry = TRUE; verbose ("%s: retrying file with fallback brace matching algorithm\n", - getInputFileName ()); + getInputFileName ()); } } cppTerminate (); Modified: ctags/parsers/fortran.c 84 lines changed, 42 insertions(+), 42 deletions(-) =================================================================== @@ -209,22 +209,22 @@ static unsigned int contextual_fake_count = 0; /* indexed by tagType */ static kindOption FortranKinds [TAG_COUNT] = { - { TRUE, 'b', "blockData", "block data"}, - { TRUE, 'c', "common", "common blocks"}, - { TRUE, 'e', "entry", "entry points"}, - { TRUE, 'f', "function", "functions"}, - { TRUE, 'i', "interface", "interface contents, generic names, and operators"}, - { TRUE, 'k', "component", "type and structure components"}, - { TRUE, 'l', "label", "labels"}, - { FALSE, 'L', "local", "local, common block, and namelist variables"}, - { TRUE, 'm', "module", "modules"}, - { TRUE, 'n', "namelist", "namelists"}, - { TRUE, 'p', "program", "programs"}, - { TRUE, 's', "subroutine", "subroutines"}, - { TRUE, 't', "type", "derived types and structures"}, - { TRUE, 'v', "variable", "program (global) and module variables"}, - { TRUE, 'E', "enum", "enumerations"}, - { TRUE, 'N', "enumerator", "enumeration values"}, + { TRUE, 'b', "blockData", "block data"}, + { TRUE, 'c', "common", "common blocks"}, + { TRUE, 'e', "entry", "entry points"}, + { TRUE, 'f', "function", "functions"}, + { TRUE, 'i', "interface", "interface contents, generic names, and operators"}, + { TRUE, 'k', "component", "type and structure components"}, + { TRUE, 'l', "label", "labels"}, + { FALSE, 'L', "local", "local, common block, and namelist variables"}, + { TRUE, 'm', "module", "modules"}, + { TRUE, 'n', "namelist", "namelists"}, + { TRUE, 'p', "program", "programs"}, + { TRUE, 's', "subroutine", "subroutines"}, + { TRUE, 't', "type", "derived types and structures"}, + { TRUE, 'v', "variable", "program (global) and module variables"}, + { TRUE, 'E', "enum", "enumerations"}, + { TRUE, 'N', "enumerator", "enumeration values"}, }; /* For efinitions of Fortran 77 with extensions: @@ -551,7 +551,7 @@ static lineType getLineType (void) * an asterisk in column 1 may contain any character capable of * representation in the processor in columns 2 through 72. */ - /* EXCEPTION! Some compilers permit '!' as a commment character here. + /* EXCEPTION! Some compilers permit '!' as a comment character here. * * Treat # and $ in column 1 as comment to permit preprocessor directives. * Treat D and d in column 1 as comment for HP debug statements. @@ -966,19 +966,19 @@ static void readToken (tokenInfo *const token) c = getChar (); token->lineNumber = getInputLineNumber (); - token->filePosition = getInputFilePosition (); + token->filePosition = getInputFilePosition (); switch (c) { case EOF: longjmp (Exception, (int) ExceptionEOF); break; case ' ': goto getNextChar; case '\t': goto getNextChar; - case ',': token->type = TOKEN_COMMA; break; - case '(': token->type = TOKEN_PAREN_OPEN; break; - case ')': token->type = TOKEN_PAREN_CLOSE; break; - case '[': token->type = TOKEN_SQUARE_OPEN; break; + case ',': token->type = TOKEN_COMMA; break; + case '(': token->type = TOKEN_PAREN_OPEN; break; + case ')': token->type = TOKEN_PAREN_CLOSE; break; + case '[': token->type = TOKEN_SQUARE_OPEN; break; case ']': token->type = TOKEN_SQUARE_CLOSE; break; - case '%': token->type = TOKEN_PERCENT; break; + case '%': token->type = TOKEN_PERCENT; break; case '*': case '/': @@ -1353,12 +1353,12 @@ static tagType variableTagType (void) const tokenInfo* const parent = ancestorTop (); switch (parent->tag) { - case TAG_MODULE: result = TAG_VARIABLE; break; - case TAG_DERIVED_TYPE: result = TAG_COMPONENT; break; - case TAG_FUNCTION: result = TAG_LOCAL; break; - case TAG_SUBROUTINE: result = TAG_LOCAL; break; + case TAG_MODULE: result = TAG_VARIABLE; break; + case TAG_DERIVED_TYPE: result = TAG_COMPONENT; break; + case TAG_FUNCTION: result = TAG_LOCAL; break; + case TAG_SUBROUTINE: result = TAG_LOCAL; break; case TAG_ENUM: result = TAG_ENUMERATOR; break; - default: result = TAG_VARIABLE; break; + default: result = TAG_VARIABLE; break; } } return result; @@ -1419,7 +1419,7 @@ static void parseEntityDeclList (tokenInfo *const token) !isKeyword (token, KEYWORD_function) && !isKeyword (token, KEYWORD_subroutine))) { - /* compilers accept keywoeds as identifiers */ + /* compilers accept keywords as identifiers */ if (isType (token, TOKEN_KEYWORD)) token->type = TOKEN_IDENTIFIER; parseEntityDecl (token); @@ -1520,16 +1520,16 @@ static void parseMap (tokenInfo *const token) /* UNION * MAP - * [field-definition] [field-definition] ... + * [field-definition] [field-definition] ... * END MAP * MAP - * [field-definition] [field-definition] ... + * [field-definition] [field-definition] ... * END MAP * [MAP * [field-definition] - * [field-definition] ... + * [field-definition] ... * END MAP] ... - * END UNION + * END UNION * * * * Typed data declarations (variables or arrays) in structure declarations @@ -1544,7 +1544,7 @@ static void parseMap (tokenInfo *const token) * share a common location within the containing structure. When initializing * the fields within a UNION, the final initialization value assigned * overlays any value previously assigned to a field definition that shares - * that field. + * that field. */ static void parseUnionStmt (tokenInfo *const token) { @@ -1566,11 +1566,11 @@ static void parseUnionStmt (tokenInfo *const token) * structure-name * identifies the structure in a subsequent RECORD statement. * Substructures can be established within a structure by means of either - * a nested STRUCTURE declaration or a RECORD statement. + * a nested STRUCTURE declaration or a RECORD statement. * * field-names * (for substructure declarations only) one or more names having the - * structure of the substructure being defined. + * structure of the substructure being defined. * * field-definition * can be one or more of the following: @@ -1585,7 +1585,7 @@ static void parseUnionStmt (tokenInfo *const token) * statements. The syntax of a UNION declaration is described below. * * PARAMETER statements, which do not affect the form of the - * structure. + * structure. */ static void parseStructureStmt (tokenInfo *const token) { @@ -1637,7 +1637,7 @@ static void parseStructureStmt (tokenInfo *const token) * or equivalence-stmt (is EQUIVALENCE equivalence-set-list) * or external-stmt (is EXTERNAL etc.) * or intent-stmt (is INTENT ( intent-spec ) [::] etc.) - * or instrinsic-stmt (is INTRINSIC etc.) + * or intrinsic-stmt (is INTRINSIC etc.) * or namelist-stmt (is NAMELIST / namelist-group-name / etc.) * or optional-stmt (is OPTIONAL [::] etc.) * or pointer-stmt (is POINTER [::] object-name etc.) @@ -1944,9 +1944,9 @@ static boolean parseDeclarationConstruct (tokenInfo *const token) boolean result = TRUE; switch (token->keyword) { - case KEYWORD_entry: parseEntryStmt (token); break; - case KEYWORD_interface: parseInterfaceBlock (token); break; - case KEYWORD_enum: parseEnumBlock (token); break; + case KEYWORD_entry: parseEntryStmt (token); break; + case KEYWORD_interface: parseInterfaceBlock (token); break; + case KEYWORD_enum: parseEnumBlock (token); break; case KEYWORD_stdcall: readToken (token); break; /* derived type handled by parseTypeDeclarationStmt(); */ @@ -2118,7 +2118,7 @@ static void parseModule (tokenInfo *const token) /* execution-part * executable-construct * - * executable-contstruct is + * executable-construct is * execution-part-construct [execution-part-construct] * * execution-part-construct Modified: ctags/parsers/html.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -17,7 +17,6 @@ static tagRegexTable htmlTagRegexTable [] = { #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*" - {"<a" POSSIBLE_ATTRIBUTES "[ \t]+name=\"?([^>\"]+)\"?" POSSIBLE_ATTRIBUTES "[ \t]*>", "\\2", Modified: ctags/parsers/jscript.c 23 lines changed, 13 insertions(+), 10 deletions(-) =================================================================== @@ -106,7 +106,7 @@ typedef struct sTokenInfo { vString * string; vString * scope; unsigned long lineNumber; - MIOPos filePosition; + MIOPos filePosition; int nestLevel; boolean ignoreTag; } tokenInfo; @@ -232,8 +232,10 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind, vString *const { jsKind parent_kind = JSTAG_CLASS; - /* if we're creating a function (and not a method), - * guess we're inside another function */ + /* + * If we're creating a function (and not a method), + * guess we're inside another function + */ if (kind == JSTAG_FUNCTION) parent_kind = JSTAG_FUNCTION; @@ -347,7 +349,7 @@ static void parseString (vString *const string, const int delimiter) * Also, handle the fact that <LineContinuation> produces an empty * sequence. * See ECMA-262 7.8.4 */ - c = getcFromInputFile(); + c = getcFromInputFile (); if (c != '\r' && c != '\n') vStringPut(string, c); else if (c == '\r') @@ -1131,13 +1133,13 @@ static boolean parseMethods (tokenInfo *const token, tokenInfo *const class) * validProperty : 2, * validMethod : function(a,b) {} * 'validMethod2' : function(a,b) {} - * container.dirtyTab = {'url': false, 'title':false, 'snapshot':false, '*': false} + * container.dirtyTab = {'url': false, 'title':false, 'snapshot':false, '*': false} */ do { readToken (token); - if (isType (token, TOKEN_CLOSE_CURLY)) + if (isType (token, TOKEN_CLOSE_CURLY)) { /* * This was most likely a variable declaration of a hash table. @@ -1193,6 +1195,7 @@ static boolean parseMethods (tokenInfo *const token, tokenInfo *const class) { if (isType (token, TOKEN_OPEN_CURLY)) { + /* Recurse to find child properties/methods */ vStringCopy (saveScope, token->scope); addToScope (token, class->string); has_child_methods = parseMethods (token, name); @@ -1580,11 +1583,11 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent, { /* * Only create variables for global scope - */ + */ if ( token->nestLevel == 0 && is_global ) { /* - * A pointer can be created to the function. + * A pointer can be created to the function. * If we recognize the function/class name ignore the variable. * This format looks identical to a variable definition. * A variable defined outside of a block is considered @@ -1616,10 +1619,10 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent, vStringDelete (fulltag); } } - if (isType (token, TOKEN_CLOSE_CURLY)) + if (isType (token, TOKEN_CLOSE_CURLY)) { /* - * Assume the closing parantheses terminates + * Assume the closing parentheses terminates * this statements. */ is_terminated = TRUE; Modified: ctags/parsers/pascal.c 46 lines changed, 24 insertions(+), 22 deletions(-) =================================================================== @@ -29,7 +29,7 @@ typedef enum { } pascalKind; static kindOption PascalKinds [] = { - { TRUE, 'f', "function", "functions"}, + { TRUE, 'f', "function", "functions"}, { TRUE, 'p', "procedure", "procedures"} }; @@ -156,33 +156,35 @@ static void findPascalTags (void) char *arglist = NULL; char *vartype = NULL; pascalKind kind = K_FUNCTION; - /* each of these flags is TRUE iff: */ + /* each of these flags is TRUE iff: */ boolean incomment = FALSE; /* point is inside a comment */ int comment_char = '\0'; /* type of current comment */ boolean inquote = FALSE; /* point is inside '..' string */ boolean get_tagname = FALSE;/* point is after PROCEDURE/FUNCTION - keyword, so next item = potential tag */ + keyword, so next item = potential tag */ boolean found_tag = FALSE; /* point is after a potential tag */ boolean inparms = FALSE; /* point is within parameter-list */ - boolean verify_tag = FALSE; /* point has passed the parm-list, so the - next token will determine whether this - is a FORWARD/EXTERN to be ignored, or - whether it is a real tag */ + boolean verify_tag = FALSE; + /* point has passed the parm-list, so the next token will determine + * whether this is a FORWARD/EXTERN to be ignored, or whether it is a + * real tag + */ dbp = readLineFromInputFile (); while (dbp != NULL) { int c = *dbp++; - if (c == '\0') /* if end of line */ + if (c == '\0') /* if end of line */ { dbp = readLineFromInputFile (); if (dbp == NULL || *dbp == '\0') continue; if (!((found_tag && verify_tag) || get_tagname)) - c = *dbp++; /* only if don't need *dbp pointing - to the beginning of the name of - the procedure or function */ + c = *dbp++; + /* only if don't need *dbp pointing to the beginning of + * the name of the procedure or function + */ } if (incomment) { @@ -204,14 +206,14 @@ static void findPascalTags (void) else switch (c) { case '\'': - inquote = TRUE; /* found first quote */ + inquote = TRUE; /* found first quote */ continue; - case '{': /* found open { comment */ + case '{': /* found open { comment */ incomment = TRUE; comment_char = c; continue; case '(': - if (*dbp == '*') /* found open (* comment */ + if (*dbp == '*') /* found open (* comment */ { incomment = TRUE; comment_char = c; @@ -220,12 +222,12 @@ static void findPascalTags (void) else if (found_tag) /* found '(' after tag, i.e., parm-list */ inparms = TRUE; continue; - case ')': /* end of parms list */ + case ')': /* end of parms list */ if (inparms) inparms = FALSE; continue; case ';': - if (found_tag && !inparms) /* end of proc or fn stmt */ + if (found_tag && !inparms) /* end of proc or fn stmt */ { verify_tag = TRUE; break; @@ -239,15 +241,15 @@ static void findPascalTags (void) continue; if (tolower ((int) *dbp == 'e')) { - if (tail ("extern")) /* superfluous, really! */ + if (tail ("extern")) /* superfluous, really! */ { found_tag = FALSE; verify_tag = FALSE; } } else if (tolower ((int) *dbp) == 'f') { - if (tail ("forward")) /* check for forward reference */ + if (tail ("forward")) /* check for forward reference */ { found_tag = FALSE; verify_tag = FALSE; @@ -261,15 +263,15 @@ static void findPascalTags (void) verify_tag = FALSE; } } - if (found_tag && verify_tag) /* not external proc, so make tag */ + if (found_tag && verify_tag) /* not external proc, so make tag */ { found_tag = FALSE; verify_tag = FALSE; makePascalTag (&tag); continue; } } - if (get_tagname) /* grab name of proc or fn */ + if (get_tagname) /* grab name of proc or fn */ { const unsigned char *cp; @@ -288,7 +290,7 @@ static void findPascalTags (void) eFree(vartype); parseArglist((const char*) cp, &arglist, (kind == K_FUNCTION) ? &vartype : NULL); createPascalTag (&tag, name, kind, arglist, (kind == K_FUNCTION) ? vartype : NULL); - dbp = cp; /* set dbp to e-o-token */ + dbp = cp; /* set dbp to e-o-token */ get_tagname = FALSE; found_tag = TRUE; /* and proceed to check for "extern" */ @@ -339,7 +341,7 @@ static void findPascalTags (void) eFree(arglist); if (vartype != NULL) eFree(vartype); - vStringDelete(name); + vStringDelete (name); } extern parserDefinition* PascalParser (void) Modified: ctags/parsers/php.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -668,7 +668,7 @@ static int skipWhitespaces (int c) } /* <script[:white:]+language[:white:]*=[:white:]*(php|'php'|"php")[:white:]*> - * + * * This is ugly, but the whole "<script language=php>" tag is and we can't * really do better without adding a lot of code only for this */ static boolean isOpenScriptLanguagePhp (int c) Modified: ctags/parsers/python.c 39 lines changed, 19 insertions(+), 20 deletions(-) =================================================================== @@ -492,7 +492,6 @@ static char const *find_triple_start(char const *string, char const **which) { if (*cp == '#') break; - if (*cp == '"' || *cp == '\'') { if (strncmp(cp, doubletriple, 3) == 0) @@ -602,7 +601,7 @@ static const char *skipTypeDecl (const char *cp, boolean *is_class) } if (!*ptr || *ptr == '=') return NULL; if (*ptr == '(') { - return lastStart; /* if we stopped on a '(' we are done */ + return lastStart; /* if we stopped on a '(' we are done */ } ptr = skipSpace(ptr); lastStart = ptr; @@ -778,24 +777,24 @@ static void findPythonTags (void) is_class = TRUE; } else if (matchKeyword ("cdef", keyword, &cp)) - { - candidate = skipTypeDecl (cp, &is_class); - if (candidate) - { - found = TRUE; - cp = candidate; - } - - } - else if (matchKeyword ("cpdef", keyword, &cp)) - { - candidate = skipTypeDecl (cp, &is_class); - if (candidate) - { - found = TRUE; - cp = candidate; - } - } + { + candidate = skipTypeDecl (cp, &is_class); + if (candidate) + { + found = TRUE; + cp = candidate; + } + + } + else if (matchKeyword ("cpdef", keyword, &cp)) + { + candidate = skipTypeDecl (cp, &is_class); + if (candidate) + { + found = TRUE; + cp = candidate; + } + } if (found) { Modified: ctags/parsers/r.c 37 lines changed, 19 insertions(+), 18 deletions(-) =================================================================== @@ -26,7 +26,7 @@ /*#define R_REGEX*/ #define SKIPSPACE(ch) while (isspace((int)*ch)) \ - ch++ + ch++ #ifndef R_REGEX typedef enum { @@ -37,9 +37,9 @@ typedef enum { } rKind; static kindOption RKinds [KIND_COUNT] = { - { TRUE, 'f', "function", "functions" }, - { TRUE, 'l', "library", "libraries" }, - { TRUE, 's', "source", "sources" }, + {TRUE, 'f', "function", "functions"}, + {TRUE, 'l', "library", "libraries"}, + {TRUE, 's', "source", "sources"}, }; #endif @@ -58,29 +58,30 @@ static void installRRegex (const langType language) "^[ \t]*(library|source|load|data)[\\(]([a-zA-Z0-9_]+)[\\)]", "\\2", "s,other", NULL); } #else -static void makeRTag(const vString* const name, rKind kind) +static void makeRTag (const vString * const name, rKind kind) { tagEntryInfo e; initTagEntry(&e, vStringValue(name), &(RKinds[kind])); - Assert(kind < KIND_COUNT); + Assert (kind < KIND_COUNT); - makeTagEntry(&e); + makeTagEntry (&e); } -static void createRTags(void) +static void createRTags (void) { - vString *vLine = vStringNew(); - vString *name = vStringNew(); + vString *vLine = vStringNew (); + vString *name = vStringNew (); int ikind; const unsigned char *line; - while ((line = readLineFromInputFile()) != NULL) + while ((line = readLineFromInputFile ()) != NULL) { - const unsigned char *cp = (const unsigned char*)line; + const unsigned char *cp = (const unsigned char *) line; - vStringClear(name); - while ((*cp != '\0') && (*cp != '#')) { + vStringClear (name); + while ((*cp != '\0') && (*cp != '#')) + { /* iterate to the end of line or to a comment */ ikind = -1; switch (*cp) { @@ -175,18 +176,18 @@ static void createRTags(void) } } - vStringDelete(name); - vStringDelete(vLine); + vStringDelete (name); + vStringDelete (vLine); } #endif -extern parserDefinition* RParser (void) +extern parserDefinition *RParser (void) { /* *.r: R files * *.s;*.q: S files */ static const char *const extensions [] = { "r", "s", "q", NULL }; - parserDefinition* const def = parserNew ("R"); + parserDefinition *const def = parserNew ("R"); #ifndef R_REGEX def->kinds = RKinds; def->kindCount = ARRAY_SIZE (RKinds); Modified: ctags/parsers/ruby.c 8 lines changed, 3 insertions(+), 5 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.scopeKind = &(RubyKinds [parent_kind]); - tag.extensionFields.scopeName = vStringValue (scope); + tag.extensionFields.scopeKind = &(RubyKinds [parent_kind]); + tag.extensionFields.scopeName = vStringValue (scope); } makeTagEntry (&tag); @@ -475,10 +475,8 @@ static void findRubyTags (void) */ if (nl && nl->type == K_CLASS && vStringLength (nl->name) == 0) kind = K_SINGLETON; - readAndEmitTag (&cp, kind); } - while (*cp != '\0') { /* FIXME: we don't cope with here documents, @@ -524,7 +522,7 @@ static void findRubyTags (void) ++cp; } while (*cp != 0 && *cp != '"'); if (*cp == '"') - cp++; /* skip the last found '"' */ + cp++; /* skip the last found '"' */ } else if (*cp == ';') { Modified: ctags/parsers/sql.c 154 lines changed, 79 insertions(+), 75 deletions(-) =================================================================== @@ -359,11 +359,10 @@ static boolean isCmdTerm (tokenInfo *const token) * enum eTokenType * enum eTokenType */ - return ( isType (token, TOKEN_SEMICOLON) || - isType (token, TOKEN_TILDE) || - isType (token, TOKEN_FORWARD_SLASH) || - isKeyword (token, KEYWORD_go) - ); + return (isType (token, TOKEN_SEMICOLON) || + isType (token, TOKEN_TILDE) || + isType (token, TOKEN_FORWARD_SLASH) || + isKeyword (token, KEYWORD_go)); } static boolean isMatchedEnd(tokenInfo *const token, int nest_lvl) @@ -594,8 +593,8 @@ static void readToken (tokenInfo *const token) case '/': { int d = getcFromInputFile (); - if ( (d != '*') && /* is this the start of a comment? */ - (d != '/') ) /* is a one line comment? */ + if ((d != '*') && /* is this the start of a comment? */ + (d != '/')) /* is a one line comment? */ { token->type = TOKEN_FORWARD_SLASH; ungetcToInputFile (d); @@ -662,7 +661,7 @@ static void readIdentifier (tokenInfo *const token) tokenInfo *const close_square = newToken (); readToken (token); - /* eat close swuare */ + /* eat close square */ readToken (close_square); deleteToken (close_square); } @@ -711,9 +710,9 @@ static void findCmdTerm (tokenInfo *const token, const boolean check_first) { int begin_end_nest_lvl = token->begin_end_nest_lvl; - if ( check_first ) + if (check_first) { - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) return; } do @@ -791,7 +790,7 @@ static void skipArgumentList (tokenInfo *const token) * Other databases can have arguments with fully declared * datatypes: * ( name varchar(30), text binary(10) ) - * So we must check for nested open and closing parantheses + * So we must check for nested open and closing parentheses */ if (isType (token, TOKEN_OPEN_PAREN)) /* arguments? */ @@ -877,7 +876,7 @@ static void parseSubProgram (tokenInfo *const token) * blank and the value just read is the OWNER or CREATOR of the * function and should not be considered part of the scope. */ - if ( vStringLength(saveScope) > 0 ) + if (vStringLength(saveScope) > 0) { addToScope(token, name->string, kind); } @@ -893,14 +892,15 @@ static void parseSubProgram (tokenInfo *const token) if (kind == SQLTAG_FUNCTION) { - if (isKeyword (token, KEYWORD_return) || isKeyword (token, KEYWORD_returns)) + if (isKeyword (token, KEYWORD_return) || + isKeyword (token, KEYWORD_returns)) { /* Read datatype */ readToken (token); /* * Read token after which could be the * command terminator if a prototype - * or an open parantheses + * or an open parenthesis */ readToken (token); if (isType (token, TOKEN_OPEN_PAREN)) @@ -910,7 +910,7 @@ static void parseSubProgram (tokenInfo *const token) } } } - if( isCmdTerm (token) ) + if (isCmdTerm (token)) { makeSqlTag (name, SQLTAG_PROTOTYPE); } @@ -927,7 +927,7 @@ static void parseSubProgram (tokenInfo *const token) ) ) { - if ( isKeyword (token, KEYWORD_result) ) + if (isKeyword (token, KEYWORD_result)) { readToken (token); if (isType (token, TOKEN_OPEN_PAREN)) @@ -940,9 +940,9 @@ static void parseSubProgram (tokenInfo *const token) } } if (isKeyword (token, KEYWORD_at) || - isKeyword (token, KEYWORD_url) || - isKeyword (token, KEYWORD_internal) || - isKeyword (token, KEYWORD_external) ) + isKeyword (token, KEYWORD_url) || + isKeyword (token, KEYWORD_internal) || + isKeyword (token, KEYWORD_external)) { addToScope(token, name->string, kind); if (isType (name, TOKEN_IDENTIFIER) || @@ -954,14 +954,14 @@ static void parseSubProgram (tokenInfo *const token) vStringClear (token->scope); token->scopeKind = SQLTAG_COUNT; } - if ( isType (token, TOKEN_EQUAL) ) + if (isType (token, TOKEN_EQUAL)) readToken (token); - if ( isKeyword (token, KEYWORD_declare) ) + if (isKeyword (token, KEYWORD_declare)) parseDeclare (token, FALSE); if (isKeyword (token, KEYWORD_is) || - isKeyword (token, KEYWORD_begin) ) + isKeyword (token, KEYWORD_begin)) { addToScope(token, name->string, kind); if (isType (name, TOKEN_IDENTIFIER) || @@ -1017,6 +1017,8 @@ static void parseRecord (tokenInfo *const token) isKeyword(token, KEYWORD_constraint) || isKeyword(token, KEYWORD_foreign) ) ) { + /* keyword test above is redundant as only a TOKEN_KEYWORD could + * match any isKeyword() anyway */ if (isType (token, TOKEN_IDENTIFIER) || isType (token, TOKEN_STRING)) makeSqlTag (token, SQLTAG_FIELD); @@ -1173,7 +1175,7 @@ static void parseDeclareANSI (tokenInfo *const token, const boolean local) if (isKeyword (type, KEYWORD_cursor)) makeSqlTag (token, SQLTAG_CURSOR); else if (isKeyword (token, KEYWORD_local) && - isKeyword (type, KEYWORD_temporary)) + isKeyword (type, KEYWORD_temporary)) { /* * DECLARE LOCAL TEMPORARY TABLE table_name ( @@ -1186,14 +1188,14 @@ static void parseDeclareANSI (tokenInfo *const token, const boolean local) { readToken (token); if (isType(token, TOKEN_IDENTIFIER) || - isType(token, TOKEN_STRING) ) + isType(token, TOKEN_STRING)) { makeSqlTag (token, SQLTAG_TABLE); } } } else if (isType (token, TOKEN_IDENTIFIER) || - isType (token, TOKEN_STRING)) + isType (token, TOKEN_STRING)) { if (local) makeSqlTag (token, SQLTAG_LOCAL_VARIABLE); @@ -1234,6 +1236,7 @@ static void parseLabel (tokenInfo *const token) static void parseStatements (tokenInfo *const token, const boolean exit_on_endif ) { + /* boolean isAnsi = TRUE; */ boolean stmtTerm = FALSE; do { @@ -1309,8 +1312,9 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif readToken (token); } - if( isKeyword (token, KEYWORD_begin ) ) + if (isKeyword (token, KEYWORD_begin)) { + /* isAnsi = FALSE; */ parseBlock(token, FALSE); /* @@ -1319,7 +1323,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * token in a command terminator (like GO) * we know we are done with this statement. */ - if ( isCmdTerm (token) ) + if (isCmdTerm (token)) stmtTerm = TRUE; } else @@ -1336,7 +1340,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif parseStatements (token, TRUE); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token); } @@ -1347,13 +1351,13 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * IF...THEN * END IF; */ - if( isKeyword (token, KEYWORD_end ) ) + if (isKeyword (token, KEYWORD_end)) readToken (token); if( isKeyword (token, KEYWORD_if ) || isKeyword (token, KEYWORD_endif ) ) { readToken (token); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) stmtTerm = TRUE; } else @@ -1385,7 +1389,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * DO * END FOR; */ - if( isKeyword (token, KEYWORD_for ) ) + if (isKeyword (token, KEYWORD_for)) { /* loop name */ readToken (token); @@ -1418,12 +1422,12 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif parseStatements (token, FALSE); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token); } - if( isKeyword (token, KEYWORD_end ) ) + if (isKeyword (token, KEYWORD_end )) readToken (token); /* @@ -1437,7 +1441,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif isKeyword (token, KEYWORD_for) ) readToken (token); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) stmtTerm = TRUE; break; @@ -1514,12 +1518,12 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * if we detect them, parse them to completion */ if (isType (token, TOKEN_BLOCK_LABEL_BEGIN) || - isKeyword (token, KEYWORD_exception) || - isKeyword (token, KEYWORD_loop) || - isKeyword (token, KEYWORD_case) || - isKeyword (token, KEYWORD_for) || - isKeyword (token, KEYWORD_begin) ) - parseStatements (token, FALSE); + isKeyword (token, KEYWORD_exception) || + isKeyword (token, KEYWORD_loop) || + isKeyword (token, KEYWORD_case) || + isKeyword (token, KEYWORD_for) || + isKeyword (token, KEYWORD_begin)) + parseStatements (token, FALSE); else if (isKeyword (token, KEYWORD_if)) parseStatements (token, TRUE); @@ -1530,7 +1534,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * See comment above, now, only read if the current token * is not a command terminator. */ - if ( isCmdTerm(token) && ! stmtTerm ) + if (isCmdTerm(token) && ! stmtTerm) stmtTerm = TRUE; } while (! isKeyword (token, KEYWORD_end) && @@ -1568,7 +1572,7 @@ static void parseBlock (tokenInfo *const token, const boolean local) { parseStatements (token, FALSE); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token); } token->begin_end_nest_lvl--; @@ -1582,7 +1586,7 @@ static void parseBlock (tokenInfo *const token, const boolean local) /* * Check if the END block is terminated */ - if ( !isCmdTerm (token) ) + if (! isCmdTerm (token)) { /* * Not sure what to do here at the moment. @@ -1647,7 +1651,7 @@ static void parseTable (tokenInfo *const token) /* * This deals with these formats: * create table t1 (c1 int); - * create global tempoary table t2 (c1 int); + * create global temporary table t2 (c1 int); * create table "t3" (c1 int); * create table bob.t4 (c1 int); * create table bob."t5" (c1 int); @@ -1693,7 +1697,7 @@ static void parseTable (tokenInfo *const token) if (isType (token, TOKEN_OPEN_PAREN)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_TABLE); vStringCopy(token->scope, name->string); @@ -1735,8 +1739,9 @@ static void parseIndex (tokenInfo *const token) readIdentifier (name); readToken (token); } - if ( isKeyword (token, KEYWORD_on) && - (isType (name, TOKEN_IDENTIFIER) || isType (name, TOKEN_STRING) ) ) + if (isKeyword (token, KEYWORD_on) && + (isType (name, TOKEN_IDENTIFIER) || + isType (name, TOKEN_STRING))) { readIdentifier (owner); readToken (token); @@ -1777,16 +1782,16 @@ static void parseEvent (tokenInfo *const token) readToken (token); } - if ( isKeyword (token, KEYWORD_handler) || - isType (token, TOKEN_SEMICOLON) ) + if (isKeyword (token, KEYWORD_handler) || + isType (token, TOKEN_SEMICOLON)) { makeSqlTag (name, SQLTAG_EVENT); } if (isKeyword (token, KEYWORD_handler)) { readToken (token); - if ( isKeyword (token, KEYWORD_begin) ) + if (isKeyword (token, KEYWORD_begin)) { parseBlock (token, TRUE); } @@ -1826,7 +1831,7 @@ static void parseTrigger (tokenInfo *const token) } /*if (! isType (token, TOKEN_SEMICOLON) ) */ - if (! isCmdTerm (token) ) + if (! isCmdTerm (token)) { readToken (table); readToken (token); @@ -1840,7 +1845,7 @@ static void parseTrigger (tokenInfo *const token) (isKeyword (token, KEYWORD_call)) || ( isCmdTerm (token))) ) { - if ( isKeyword (token, KEYWORD_declare) ) + if (isKeyword (token, KEYWORD_declare)) { addToScope(token, name->string, SQLTAG_TRIGGER); parseDeclare(token, TRUE); @@ -1851,13 +1856,13 @@ static void parseTrigger (tokenInfo *const token) readToken (token); } - if ( isKeyword (token, KEYWORD_begin) || - isKeyword (token, KEYWORD_call) ) + if (isKeyword (token, KEYWORD_begin) || + isKeyword (token, KEYWORD_call)) { addToScope(name, table->string, SQLTAG_TABLE); makeSqlTag (name, SQLTAG_TRIGGER); addToScope(token, table->string, SQLTAG_TABLE); - if ( isKeyword (token, KEYWORD_begin) ) + if (isKeyword (token, KEYWORD_begin)) { parseBlock (token, TRUE); } @@ -1893,7 +1898,7 @@ static void parsePublication (tokenInfo *const token) if (isType (token, TOKEN_OPEN_PAREN)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_PUBLICATION); } @@ -1922,7 +1927,7 @@ static void parseService (tokenInfo *const token) if (isKeyword (token, KEYWORD_type)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_SERVICE); } @@ -1947,7 +1952,7 @@ static void parseDomain (tokenInfo *const token) } readToken (token); if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_DOMAIN); } @@ -2037,10 +2042,9 @@ static void parseView (tokenInfo *const token) readIdentifier (name); readToken (token); } - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { skipArgumentList(token); - } while (!(isKeyword (token, KEYWORD_is) || @@ -2075,7 +2079,7 @@ static void parseMLTable (tokenInfo *const token) */ readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (version); readToken (token); @@ -2101,16 +2105,16 @@ static void parseMLTable (tokenInfo *const token) { readToken (event); - if (isType (version, TOKEN_STRING) && - isType (table, TOKEN_STRING) && - isType (event, TOKEN_STRING) ) + if (isType (version, TOKEN_STRING) && + isType (table, TOKEN_STRING) && + isType (event, TOKEN_STRING)) { addToScope(version, table->string, SQLTAG_TABLE); addToScope(version, event->string, SQLTAG_EVENT); makeSqlTag (version, SQLTAG_MLTABLE); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN); } } @@ -2135,7 +2139,7 @@ static void parseMLConn (tokenInfo *const token) */ readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (version); readToken (token); @@ -2150,14 +2154,14 @@ static void parseMLConn (tokenInfo *const token) { readToken (event); - if (isType (version, TOKEN_STRING) && - isType (event, TOKEN_STRING) ) + if (isType (version, TOKEN_STRING) && + isType (event, TOKEN_STRING)) { addToScope(version, event->string, SQLTAG_EVENT); makeSqlTag (version, SQLTAG_MLCONN); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN); } @@ -2185,7 +2189,7 @@ static void parseMLProp (tokenInfo *const token) */ readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (component); readToken (token); @@ -2211,16 +2215,16 @@ static void parseMLProp (tokenInfo *const token) { readToken (prop_name); - if (isType (component, TOKEN_STRING) && - isType (prop_set_name, TOKEN_STRING) && - isType (prop_name, TOKEN_STRING) ) + if (isType (component, TOKEN_STRING) && + isType (prop_set_name, TOKEN_STRING) && + isType (prop_name, TOKEN_STRING)) { addToScope(component, prop_set_name->string, SQLTAG_MLPROP /* FIXME */); addToScope(component, prop_name->string, SQLTAG_MLPROP /* FIXME */); makeSqlTag (component, SQLTAG_MLPROP); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN); } } @@ -2255,7 +2259,7 @@ static void parseComment (tokenInfo *const token) readToken (token); } readToken (token); - if ( isType(token, TOKEN_OPEN_CURLY) ) + if (isType(token, TOKEN_OPEN_CURLY)) { findToken (token, TOKEN_CLOSE_CURLY); } Modified: ctags/parsers/tcl.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -76,9 +76,9 @@ static void findTclTags (void) { const unsigned char *cp; - while (isspace (line [0])) + while (isspace (line [0])) ++line; - + if (line [0] == '\0' || line [0] == '#') continue; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 2671d7: Use skipToCharacterInInputFile() in all parsers
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:30 UTC Commit: 2671d73b6759a9ba2c7cab1ae54a84e52cb40874
https://github.com/geany/geany/commit/2671d73b6759a9ba2c7cab1ae54a84e52cb40…
Log Message: ----------- Use skipToCharacterInInputFile() in all parsers Modified Paths: -------------- ctags/parsers/jscript.c ctags/parsers/php.c ctags/parsers/powershell.c Modified: ctags/parsers/jscript.c 16 lines changed, 3 insertions(+), 13 deletions(-) =================================================================== @@ -323,16 +323,6 @@ static void makeFunctionTag (tokenInfo *const token, vString *const signature) * Parsing functions */ -static int skipToCharacter (const int c) -{ - int d; - do - { - d = getcFromInputFile (); - } while (d != EOF && d != c); - return d; -} - static void parseString (vString *const string, const int delimiter) { boolean end = FALSE; @@ -586,7 +576,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt { do { - skipToCharacter ('*'); + skipToCharacterInInputFile ('*'); c = getcFromInputFile (); if (c == '/') break; @@ -597,7 +587,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt } else if (d == '/') /* is this the start of a comment? */ { - skipToCharacter ('\n'); + skipToCharacterInInputFile ('\n'); /* if we care about newlines, put it back so it is seen */ if (include_newlines) ungetcToInputFile ('\n'); @@ -618,7 +608,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt } else { - skipToCharacter ('\n'); + skipToCharacterInInputFile ('\n'); goto getNextChar; } break; Modified: ctags/parsers/php.c 12 lines changed, 1 insertions(+), 11 deletions(-) =================================================================== @@ -483,16 +483,6 @@ static boolean isIdentChar (const int c) return (isalnum (c) || c == '_' || c >= 0x80); } -static int skipToCharacter (const int c) -{ - int d; - do - { - d = getcFromInputFile (); - } while (d != EOF && d != c); - return d; -} - static void parseString (vString *const string, const int delimiter) { while (TRUE) @@ -897,7 +887,7 @@ static void readToken (tokenInfo *const token) { do { - c = skipToCharacter ('*'); + c = skipToCharacterInInputFile ('*'); if (c != EOF) { c = getcFromInputFile (); Modified: ctags/parsers/powershell.c 12 lines changed, 1 insertions(+), 11 deletions(-) =================================================================== @@ -188,16 +188,6 @@ static boolean isIdentChar (const int c) return (isalnum (c) || c == ':' || c == '_' || c == '-' || c >= 0x80); } -static int skipToCharacter (const int c) -{ - int d; - do - { - d = getcFromInputFile (); - } while (d != EOF && d != c); - return d; -} - static void parseString (vString *const string, const int delimiter) { while (TRUE) @@ -309,7 +299,7 @@ static void readToken (tokenInfo *const token) /* <# ... #> multiline comment */ do { - c = skipToCharacter ('#'); + c = skipToCharacterInInputFile ('#'); if (c != EOF) { c = getcFromInputFile (); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 95f946: Rename isident() to cppIsident()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:30 UTC Commit: 95f94629f0fd5d4d40d7d3343014f79b2cc75988
https://github.com/geany/geany/commit/95f94629f0fd5d4d40d7d3343014f79b2cc75…
Log Message: ----------- Rename isident() to cppIsident() Modified Paths: -------------- ctags/main/lcpp.c ctags/main/lcpp.h ctags/parsers/c.c Modified: ctags/main/lcpp.c 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -210,7 +210,7 @@ static void readIdentifier (int c, vString *const name) { vStringPut (name, c); c = getcFromInputFile (); - } while (c != EOF && isident (c)); + } while (c != EOF && cppIsident (c)); ungetcToInputFile (c); vStringTerminate (name); } @@ -810,9 +810,9 @@ extern int cppGetc (void) int prev2 = getNthPrevCFromInputFile (2, '\0'); int prev3 = getNthPrevCFromInputFile (3, '\0'); - if (! isident (prev) || - (! isident (prev2) && (prev == 'L' || prev == 'u' || prev == 'U')) || - (! isident (prev3) && (prev2 == 'u' && prev == '8'))) + if (! cppIsident (prev) || + (! cppIsident (prev2) && (prev == 'L' || prev == 'u' || prev == 'U')) || + (! cppIsident (prev3) && (prev2 == 'u' && prev == '8'))) { int next = getcFromInputFile (); if (next != DOUBLE_QUOTE) Modified: ctags/main/lcpp.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -22,7 +22,7 @@ /* Is the character valid as a character of a C identifier? * VMS allows '$' in identifiers. */ -#define isident(c) (isalnum(c) || (c) == '_' || (c) == '$') +#define cppIsident(c) (isalnum(c) || (c) == '_' || (c) == '$') /* Is the character valid as the first character of a C identifier? * C++ allows '~' in destructors. Modified: ctags/parsers/c.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1786,7 +1786,7 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) { vStringPut (name, c); c = cppGetc (); - } while (isident (c) || (isInputLanguage (Lang_vala) && '.' == c)); + } while (cppIsident (c) || (isInputLanguage (Lang_vala) && '.' == c)); vStringTerminate (name); cppUngetc (c); /* unget non-identifier character */ @@ -1810,7 +1810,7 @@ static void readPackageName (tokenInfo *const token, const int firstChar) initToken (token); - while (isident (c) || c == '.') + while (cppIsident (c) || c == '.') { vStringPut (name, c); c = cppGetc (); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 88a872: Rename isident1() to cppIsident1()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:30 UTC Commit: 88a8724d1ce42c1c2c1437c6c1ac137c3f5e2f84
https://github.com/geany/geany/commit/88a8724d1ce42c1c2c1437c6c1ac137c3f5e2…
Log Message: ----------- Rename isident1() to cppIsident1() Modified Paths: -------------- ctags/main/lcpp.c ctags/main/lcpp.h ctags/parsers/c.c Modified: ctags/main/lcpp.c 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -335,7 +335,7 @@ static void directiveDefine (const int c) boolean parameterized; int nc; - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (c, Cpp.directive.name); nc = getcFromInputFile (); @@ -349,7 +349,7 @@ static void directiveDefine (const int c) static void directivePragma (int c) { - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (c, Cpp.directive.name); if (stringMatch (vStringValue (Cpp.directive.name), "weak")) @@ -359,7 +359,7 @@ static void directivePragma (int c) { c = getcFromInputFile (); } while (c == SPACE); - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (c, Cpp.directive.name); makeDefineTag (vStringValue (Cpp.directive.name), FALSE); Modified: ctags/main/lcpp.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -29,7 +29,7 @@ * VMS allows '$' in identifiers. * Vala allows '@' in identifiers. */ -#define isident1(c) (isalpha(c) || (c) == '_' || (c) == '~' || (c) == '$' || (c) == '@') +#define cppIsident1(c) (isalpha(c) || (c) == '_' || (c) == '~' || (c) == '$' || (c) == '@') /* * FUNCTION PROTOTYPES Modified: ctags/parsers/c.c 22 lines changed, 11 insertions(+), 11 deletions(-) =================================================================== @@ -1893,7 +1893,7 @@ static void readOperator (statementInfo *const st) c = cppGetc (); } } - else if (isident1 (c)) + else if (cppIsident1 (c)) { /* Handle "new" and "delete" operators, and conversion functions * (per 13.3.1.1.2 [2] of the C++ spec). @@ -1965,7 +1965,7 @@ static void setAccess (statementInfo *const st, const accessType laccess) static void discardTypeList (tokenInfo *const token) { int c = skipToNonWhite (); - while (isident1 (c)) + while (cppIsident1 (c)) { readIdentifier (token, c); c = skipToNonWhite (); @@ -1994,7 +1994,7 @@ static void readParents (statementInfo *const st, const int qualifier) do { c = skipToNonWhite (); - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (token, c); if (isType (token, TOKEN_NAME)) @@ -2151,7 +2151,7 @@ static void skipMemIntializerList (tokenInfo *const token) do { c = skipToNonWhite (); - while (isident1 (c) || c == ':') + while (cppIsident1 (c) || c == ':') { if (c != ':') readIdentifier (token, c); @@ -2261,7 +2261,7 @@ static boolean skipPostArgumentStuff ( default: { - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (token, c); if (isInputLanguage(Lang_d) && isDPostArgumentToken(token)) @@ -2340,15 +2340,15 @@ static void skipJavaThrows (statementInfo *const st) tokenInfo *const token = activeToken (st); int c = skipToNonWhite (); - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (token, c); if (token->keyword == KEYWORD_THROWS) { do { c = skipToNonWhite (); - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (token, c); c = skipToNonWhite (); @@ -2365,7 +2365,7 @@ static void skipValaPostParens (statementInfo *const st) tokenInfo *const token = activeToken (st); int c = skipToNonWhite (); - while (isident1 (c)) + while (cppIsident1 (c)) { readIdentifier (token, c); if (token->keyword == KEYWORD_ATTRIBUTE) @@ -2379,7 +2379,7 @@ static void skipValaPostParens (statementInfo *const st) do { c = skipToNonWhite (); - if (isident1 (c)) + if (cppIsident1 (c)) { readIdentifier (token, c); c = skipToNonWhite (); @@ -2528,7 +2528,7 @@ static int parseParens (statementInfo *const st, parenInfo *const info) default: { - if (isident1 (c)) + if (cppIsident1 (c)) { if (++identifierCount > 1) info->isKnrParamList = FALSE; @@ -2783,7 +2783,7 @@ static void parseGeneralToken (statementInfo *const st, const int c) { const tokenInfo *const prev = prevToken (st, 1); - if (isident1(c)) + if (cppIsident1(c)) { parseIdentifier (st, c); if (isType (st->context, TOKEN_NAME) && -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 76818f: Change getSourceFileName() to getInputFileName()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:25 UTC Commit: 76818f94394c5715ba08e31e9e39639279fc32ad
https://github.com/geany/geany/commit/76818f94394c5715ba08e31e9e39639279fc3…
Log Message: ----------- Change getSourceFileName() to getInputFileName() Modified Paths: -------------- ctags/main/read.c ctags/main/read.h ctags/parsers/rust.c Modified: ctags/main/read.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -77,7 +77,10 @@ static void setSourceFileParameters (vString *const fileName, const langType lan { if (File.source.name != NULL) vStringDelete (File.source.name); + if (File.input.name != NULL) + vStringDelete (File.input.name); File.source.name = fileName; + File.input.name = vStringNewCopy(fileName); if (File.source.tagPath != NULL) eFree (File.source.tagPath); Modified: ctags/main/read.h 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -26,9 +26,8 @@ * MACROS */ #define getInputLineNumber() File.input.lineNumber -#define getInputFileName() vStringValue (File.source.name) +#define getInputFileName() vStringValue (File.input.name) #define getInputFilePosition() File.filePosition -#define getSourceFileName() vStringValue (File.source.name) #define getSourceFileTagPath() vStringValue (File.source.tagPath) #define getSourceLanguage() File.source.language #define getSourceLanguageName() getLanguageName (File.source.language) Modified: ctags/parsers/rust.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -443,7 +443,7 @@ static void addTag (vString* ident, const char* type, const char* arg_list, int tag.lineNumber = line; tag.filePosition = pos; - tag.sourceFileName = getSourceFileName(); + tag.sourceFileName = getInputFileName(); tag.extensionFields.signature = arg_list; tag.extensionFields.varType = type; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 1d4859: Remove R regex parser
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:31:30 UTC Commit: 1d48599d3cf6f0c8c92b2e1fb8d61b9b8af96769
https://github.com/geany/geany/commit/1d48599d3cf6f0c8c92b2e1fb8d61b9b8af96…
Log Message: ----------- Remove R regex parser Unused by us, not present in uctags. Modified Paths: -------------- ctags/parsers/r.c Modified: ctags/parsers/r.c 26 lines changed, 0 insertions(+), 26 deletions(-) =================================================================== @@ -23,12 +23,10 @@ #include "vstring.h" #include "routines.h" -/*#define R_REGEX*/ #define SKIPSPACE(ch) while (isspace((int)*ch)) \ ch++ -#ifndef R_REGEX typedef enum { K_FUNCTION, K_LIBRARY, @@ -41,23 +39,7 @@ static kindOption RKinds [KIND_COUNT] = { {TRUE, 'l', "library", "libraries"}, {TRUE, 's', "source", "sources"}, }; -#endif -#ifdef R_REGEX -static void installRRegex (const langType language) -{ - /* This is a function, looks as follows: - * itent <- function(arg1, arg2) { - * do_something; - * } - */ - addTagRegex (language, - "^[ \t]*([.a-zA-Z0-9_]+)([ \t]*)<-([ \t]*)function", "\\1", "f,function", NULL); - /* This loads someting, e.g. a library, simply: library(libname) */ - addTagRegex (language, - "^[ \t]*(library|source|load|data)[\\(]([a-zA-Z0-9_]+)[\\)]", "\\2", "s,other", NULL); -} -#else static void makeRTag (const vString * const name, rKind kind) { tagEntryInfo e; @@ -179,7 +161,6 @@ static void createRTags (void) vStringDelete (name); vStringDelete (vLine); } -#endif extern parserDefinition *RParser (void) { @@ -188,17 +169,10 @@ extern parserDefinition *RParser (void) */ static const char *const extensions [] = { "r", "s", "q", NULL }; parserDefinition *const def = parserNew ("R"); -#ifndef R_REGEX def->kinds = RKinds; def->kindCount = ARRAY_SIZE (RKinds); -#endif def->extensions = extensions; -#ifndef R_REGEX def->parser = createRTags; -#else - def->initialize = installRRegex; - def->regex = TRUE; -#endif return def; } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 2161b7: Change isHeaderFile() to isInputHeaderFile()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 16:22:49 UTC Commit: 2161b73864973cc63a85526158cea35f59e849a8
https://github.com/geany/geany/commit/2161b73864973cc63a85526158cea35f59e84…
Log Message: ----------- Change isHeaderFile() to isInputHeaderFile() Modified Paths: -------------- ctags/main/lcpp.c ctags/main/read.c ctags/main/read.h ctags/parsers/c.c Modified: ctags/main/lcpp.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -307,7 +307,7 @@ static boolean popConditional (void) static void makeDefineTag (const char *const name, boolean parameterized) { - const boolean isFileScope = (boolean) (! isHeaderFile ()); + const boolean isFileScope = (boolean) (! isInputHeaderFile ()); if (includingDefineTags () && (! isFileScope || Option.include.fileScope)) Modified: ctags/main/read.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -92,6 +92,7 @@ static void setSourceFileParameters (vString *const fileName, const langType lan TagFile.max.file = vStringLength (fileName); File.source.isHeader = isIncludeFile (vStringValue (fileName)); + File.input.isHeader = File.source.isHeader; if (language != -1) File.source.language = language; else Modified: ctags/main/read.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -34,7 +34,7 @@ #define getSourceLanguageName() getLanguageName (File.source.language) #define getSourceLineNumber() File.source.lineNumber #define isInputLanguage(lang) (boolean)((lang) == File.input.language) -#define isHeaderFile() File.source.isHeader +#define isInputHeaderFile() File.input.isHeader /* * DATA DECLARATIONS Modified: ctags/parsers/c.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1436,7 +1436,7 @@ static void makeTag (const tokenInfo *const token, #endif /* Nothing is really of file scope when it appears in a header file. */ - isFileScope = (boolean) (isFileScope && ! isHeaderFile ()); + isFileScope = (boolean) (isFileScope && ! isInputHeaderFile ()); if (isType (token, TOKEN_NAME) && vStringLength (token->name) > 0 /* && includeTag (type, isFileScope) */) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 7bd81a: Change isLanguage() to isInputLanguage()
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Sun, 07 Aug 2016 00:15:12 UTC Commit: 7bd81abc1d95b0033257967f6849351d6def262b
https://github.com/geany/geany/commit/7bd81abc1d95b0033257967f6849351d6def2…
Log Message: ----------- Change isLanguage() to isInputLanguage() Modified Paths: -------------- ctags/main/read.c ctags/main/read.h ctags/parsers/c.c Modified: ctags/main/read.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -96,6 +96,7 @@ static void setSourceFileParameters (vString *const fileName, const langType lan File.source.language = language; else File.source.language = getFileLanguage (vStringValue (fileName)); + File.input.language = File.source.language; } static boolean setSourceFileName (vString *const fileName) Modified: ctags/main/read.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -33,7 +33,7 @@ #define getSourceLanguage() File.source.language #define getSourceLanguageName() getLanguageName (File.source.language) #define getSourceLineNumber() File.source.lineNumber -#define isLanguage(lang) (boolean)((lang) == File.source.language) +#define isInputLanguage(lang) (boolean)((lang) == File.input.language) #define isHeaderFile() File.source.isHeader /* Modified: ctags/parsers/c.c 136 lines changed, 68 insertions(+), 68 deletions(-) =================================================================== @@ -587,12 +587,12 @@ void printStatement(const statementInfo *const statement) extern boolean includingDefineTags (void) { - if (isLanguage(Lang_c) || - isLanguage(Lang_cpp) || - isLanguage(Lang_csharp) || - isLanguage(Lang_ferite) || - isLanguage(Lang_glsl) || - isLanguage(Lang_vala)) + if (isInputLanguage(Lang_c) || + isInputLanguage(Lang_cpp) || + isInputLanguage(Lang_csharp) || + isInputLanguage(Lang_ferite) || + isInputLanguage(Lang_glsl) || + isInputLanguage(Lang_vala)) return CKinds [CK_DEFINE].enabled; return FALSE; @@ -853,7 +853,7 @@ static boolean isContextualStatement (const statementInfo *const st) if (st != NULL) { - if (isLanguage (Lang_vala)) + if (isInputLanguage (Lang_vala)) { /* All can be a contextual statement as properties can be of any type */ result = TRUE; @@ -908,7 +908,7 @@ static void initMemberInfo (statementInfo *const st) } case DECL_CLASS: { - if (isLanguage (Lang_java)) + if (isInputLanguage (Lang_java)) accessDefault = ACCESS_DEFAULT; else accessDefault = ACCESS_PRIVATE; @@ -1110,13 +1110,13 @@ static javaKind javaTagKind (const tagType type) static const kindOption *tagKind (const tagType type) { const kindOption* result; - if (isLanguage (Lang_java)) + if (isInputLanguage (Lang_java)) result = &JavaKinds [javaTagKind (type)]; - else if (isLanguage (Lang_csharp)) + else if (isInputLanguage (Lang_csharp)) result = &CsharpKinds [csharpTagKind (type)]; - else if (isLanguage (Lang_d)) + else if (isInputLanguage (Lang_d)) result = &DKinds [dTagKind (type)]; - else if (isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_vala)) result = &ValaKinds [valaTagKind (type)]; else result = &CKinds [cTagKind (type)]; @@ -1129,7 +1129,7 @@ static boolean includeTag (const tagType type, const boolean isFileScope) boolean result; if (isFileScope && ! Option.include.fileScope) result = FALSE; - else if (isLanguage (Lang_java)) + else if (isInputLanguage (Lang_java)) result = JavaKinds [javaTagKind (type)].enabled; else result = CKinds [cTagKind (type)].enabled; @@ -1161,7 +1161,7 @@ static const char* accessField (const statementInfo *const st) { const char* result = NULL; - if ((isLanguage (Lang_cpp) || isLanguage (Lang_d) || isLanguage (Lang_ferite)) && + if ((isInputLanguage (Lang_cpp) || isInputLanguage (Lang_d) || isInputLanguage (Lang_ferite)) && st->scope == SCOPE_FRIEND) result = "friend"; else if (st->member.access != ACCESS_UNDEFINED) @@ -1211,8 +1211,8 @@ static void addOtherFields (tagEntryInfo* const tag, const tagType type, vStringValue (st->parentClasses); } if (st->implementation != IMP_DEFAULT && - (isLanguage (Lang_cpp) || isLanguage (Lang_csharp) || isLanguage (Lang_vala) || - isLanguage (Lang_java) || isLanguage (Lang_d) || isLanguage (Lang_ferite))) + (isInputLanguage (Lang_cpp) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala) || + isInputLanguage (Lang_java) || isInputLanguage (Lang_d) || isInputLanguage (Lang_ferite))) { tag->extensionFields.implementation = implementationString (st->implementation); @@ -1336,10 +1336,10 @@ static const char *getVarType (const statementInfo *const st, static void addContextSeparator (vString *const scope) { - if (isLanguage (Lang_c) || isLanguage (Lang_cpp)) + if (isInputLanguage (Lang_c) || isInputLanguage (Lang_cpp)) vStringCatS (scope, "::"); - else if (isLanguage (Lang_java) || isLanguage (Lang_d) || isLanguage (Lang_ferite) || - isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_java) || isInputLanguage (Lang_d) || isInputLanguage (Lang_ferite) || + isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) vStringCatS (scope, "."); } @@ -1445,7 +1445,7 @@ static void makeTag (const tokenInfo *const token, tagEntryInfo e; /* take only functions which are introduced by "function ..." */ - if (type == TAG_FUNCTION && isLanguage (Lang_ferite) && + if (type == TAG_FUNCTION && isInputLanguage (Lang_ferite) && strncmp("function", st->firstToken->name->buffer, 8) != 0) { return; @@ -1504,7 +1504,7 @@ static void qualifyFunctionTag (const statementInfo *const st, { if (isType (nameToken, TOKEN_NAME)) { - const tagType type = (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + const tagType type = (isInputLanguage (Lang_java) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) ? TAG_METHOD : TAG_FUNCTION; const boolean isFileScope = (boolean) (st->member.access == ACCESS_PRIVATE || @@ -1519,12 +1519,12 @@ static void qualifyFunctionDeclTag (const statementInfo *const st, { if (! isType (nameToken, TOKEN_NAME)) ; - else if (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_java) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) qualifyFunctionTag (st, nameToken); else if (st->scope == SCOPE_TYPEDEF) makeTag (nameToken, st, TRUE, TAG_TYPEDEF); else if (isValidTypeSpecifier (st->declaration) && - ! (isLanguage (Lang_csharp) || isLanguage (Lang_vala))) + ! (isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala))) makeTag (nameToken, st, TRUE, TAG_PROTOTYPE); } @@ -1536,9 +1536,9 @@ static void qualifyCompoundTag (const statementInfo *const st, const tagType type = declToTagType (st->declaration); if (type != TAG_UNDEFINED) - makeTag (nameToken, st, (boolean) (! isLanguage (Lang_java) && - ! isLanguage (Lang_csharp) && - ! isLanguage (Lang_vala)), type); + makeTag (nameToken, st, (boolean) (! isInputLanguage (Lang_java) && + ! isInputLanguage (Lang_csharp) && + ! isInputLanguage (Lang_vala)), type); } } @@ -1580,12 +1580,12 @@ static void qualifyVariableTag (const statementInfo *const st, { if (isMember (st)) { - if (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + if (isInputLanguage (Lang_java) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) makeTag (nameToken, st, (boolean) (st->member.access == ACCESS_PRIVATE), TAG_FIELD); else if (st->scope == SCOPE_GLOBAL || st->scope == SCOPE_STATIC) makeTag (nameToken, st, TRUE, TAG_MEMBER); } - else if (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_java) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) ; else { @@ -1658,7 +1658,7 @@ static void skipToMatch (const char *const pair) const unsigned long inputLineNumber = getInputLineNumber (); int matchLevel = 1; int c = '\0'; - if (isLanguage(Lang_d) && pair[0] == '<') + if (isInputLanguage(Lang_d) && pair[0] == '<') return; /* ignore e.g. Foo!(x < 2) */ while (matchLevel > 0 && (c = cppGetc ()) != EOF) { @@ -1684,7 +1684,7 @@ static void skipToMatch (const char *const pair) * match problems with C++ generics containing a static expression like * foo<X<Y> bar; * normally neither ";" nor "{" could appear inside "<>" anyway. */ - else if (isLanguage (Lang_cpp) && begin == '<' && + else if (isInputLanguage (Lang_cpp) && begin == '<' && (c == ';' || c == '{')) { cppUngetc (c); @@ -1727,7 +1727,7 @@ static keywordId analyzeKeyword (const char *const name) const keywordId id = (keywordId) lookupKeyword (name, getSourceLanguage ()); /* ignore D @attributes and Java @annotations(...), but show them in function signatures */ - if ((isLanguage(Lang_d) || isLanguage(Lang_java)) && id == KEYWORD_NONE && name[0] == '@') + if ((isInputLanguage(Lang_d) || isInputLanguage(Lang_java)) && id == KEYWORD_NONE && name[0] == '@') { skipParens(); /* if annotation has parameters, skip them */ return KEYWORD_CONST; @@ -1741,7 +1741,7 @@ static void analyzeIdentifier (tokenInfo *const token) const char *replacement = NULL; boolean parensToo = FALSE; - if (isLanguage (Lang_java) || + if (isInputLanguage (Lang_java) || ! isIgnoreToken (name, &parensToo, &replacement)) { if (replacement != NULL) @@ -1776,7 +1776,7 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) /* Bug #1585745 (CTags): strangely, C++ destructors allow whitespace between * the ~ and the class name. */ - if (isLanguage (Lang_cpp) && firstChar == '~') + if (isInputLanguage (Lang_cpp) && firstChar == '~') { vStringPut (name, c); c = skipToNonWhite (); @@ -1786,12 +1786,12 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) { vStringPut (name, c); c = cppGetc (); - } while (isident (c) || (isLanguage (Lang_vala) && '.' == c)); + } while (isident (c) || (isInputLanguage (Lang_vala) && '.' == c)); vStringTerminate (name); cppUngetc (c); /* unget non-identifier character */ /* Vala supports '?' at end of a type (with or without whitespace before) for nullable types */ - if (isLanguage (Lang_vala)) + if (isInputLanguage (Lang_vala)) { c = skipToNonWhite (); if ('?' == c) @@ -1823,7 +1823,7 @@ static void readPackageOrNamespace (statementInfo *const st, const declType decl { st->declaration = declaration; - if (declaration == DECL_NAMESPACE && !(isLanguage (Lang_csharp) || isLanguage (Lang_vala))) + if (declaration == DECL_NAMESPACE && !(isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala))) { /* In C++ a namespace is specified one level at a time. */ return; @@ -1846,7 +1846,7 @@ static void readPackage (statementInfo *const st) Assert (isType (token, TOKEN_KEYWORD)); readPackageName (token, skipToNonWhite ()); token->type = TOKEN_NAME; - if (isLanguage (Lang_d)) + if (isInputLanguage (Lang_d)) st->declaration = DECL_MODULE; else st->declaration = DECL_PACKAGE; @@ -1947,7 +1947,7 @@ static void setAccess (statementInfo *const st, const accessType laccess) { if (isMember (st)) { - if (isLanguage (Lang_cpp) || isLanguage (Lang_d) || isLanguage (Lang_ferite)) + if (isInputLanguage (Lang_cpp) || isInputLanguage (Lang_d) || isInputLanguage (Lang_ferite)) { int c = skipToNonWhite (); @@ -2022,7 +2022,7 @@ static void readParents (statementInfo *const st, const int qualifier) static void checkIsClassEnum (statementInfo *const st, const declType decl) { - if (! isLanguage (Lang_cpp) || st->declaration != DECL_ENUM) + if (! isInputLanguage (Lang_cpp) || st->declaration != DECL_ENUM) st->declaration = decl; } @@ -2076,19 +2076,19 @@ static void processToken (tokenInfo *const token, statementInfo *const st) case KEYWORD_PACKAGE: readPackageOrNamespace (st, DECL_PACKAGE); break; case KEYWORD_EVENT: { - if (isLanguage (Lang_csharp)) + if (isInputLanguage (Lang_csharp)) st->declaration = DECL_EVENT; break; } case KEYWORD_SIGNAL: { - if (isLanguage (Lang_vala)) + if (isInputLanguage (Lang_vala)) st->declaration = DECL_SIGNAL; break; } case KEYWORD_EXTERN: { - if (! isLanguage (Lang_csharp) || !st->gotName) + if (! isInputLanguage (Lang_csharp) || !st->gotName) { /*reinitStatement (st, FALSE);*/ st->scope = SCOPE_EXTERN; @@ -2098,7 +2098,7 @@ static void processToken (tokenInfo *const token, statementInfo *const st) } case KEYWORD_STATIC: { - if (! isLanguage (Lang_java) && ! isLanguage (Lang_csharp) && ! isLanguage (Lang_vala)) + if (! isInputLanguage (Lang_java) && ! isInputLanguage (Lang_csharp) && ! isInputLanguage (Lang_vala)) { /*reinitStatement (st, FALSE);*/ st->scope = SCOPE_STATIC; @@ -2107,7 +2107,7 @@ static void processToken (tokenInfo *const token, statementInfo *const st) break; } case KEYWORD_IF: - if (isLanguage (Lang_d)) + if (isInputLanguage (Lang_d)) { /* static if (is(typeof(__traits(getMember, a, name)) == function)) */ int c = skipToNonWhite (); if (c == '(') @@ -2264,7 +2264,7 @@ static boolean skipPostArgumentStuff ( if (isident1 (c)) { readIdentifier (token, c); - if (isLanguage(Lang_d) && isDPostArgumentToken(token)) + if (isInputLanguage(Lang_d) && isDPostArgumentToken(token)) token->keyword = KEYWORD_CONST; switch (token->keyword) @@ -2295,7 +2295,7 @@ static boolean skipPostArgumentStuff ( default: /* "override" and "final" are only keywords in the declaration of a virtual * member function, so need to be handled specially, not as keywords */ - if (isLanguage(Lang_cpp) && isType (token, TOKEN_NAME) && + if (isInputLanguage(Lang_cpp) && isType (token, TOKEN_NAME) && (strcmp ("override", vStringValue (token->name)) == 0 || strcmp ("final", vStringValue (token->name)) == 0)) ; @@ -2401,9 +2401,9 @@ static void analyzePostParens (statementInfo *const st, parenInfo *const info) cppUngetc (c); if (isOneOf (c, "{;,=")) ; - else if (isLanguage (Lang_java)) + else if (isInputLanguage (Lang_java)) skipJavaThrows (st); - else if (isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_vala)) skipValaPostParens(st); else { @@ -2541,7 +2541,7 @@ static int parseParens (statementInfo *const st, parenInfo *const info) info->isNameCandidate = FALSE; } } - else if (isLanguage(Lang_d) && c == '!') + else if (isInputLanguage(Lang_d) && c == '!') { /* D template instantiation */ info->isNameCandidate = FALSE; info->isKnrParamList = FALSE; @@ -2612,7 +2612,7 @@ static void analyzeParens (statementInfo *const st) token->type = TOKEN_NAME; processName (st); st->gotParenName = TRUE; - if (isLanguage(Lang_d) && c == '(' && isType (prev, TOKEN_NAME)) + if (isInputLanguage(Lang_d) && c == '(' && isType (prev, TOKEN_NAME)) { st->declaration = DECL_FUNCTION_TEMPLATE; copyToken (st->blockName, prev); @@ -2640,11 +2640,11 @@ static void addContext (statementInfo *const st, const tokenInfo* const token) { if (vStringLength (st->context->name) > 0) { - if (isLanguage (Lang_c) || isLanguage (Lang_cpp)) + if (isInputLanguage (Lang_c) || isInputLanguage (Lang_cpp)) vStringCatS (st->context->name, "::"); - else if (isLanguage (Lang_java) || - isLanguage (Lang_d) || isLanguage (Lang_ferite) || - isLanguage (Lang_csharp) || isLanguage (Lang_vala)) + else if (isInputLanguage (Lang_java) || + isInputLanguage (Lang_d) || isInputLanguage (Lang_ferite) || + isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala)) vStringCatS (st->context->name, "."); } vStringCat (st->context->name, token->name); @@ -2657,8 +2657,8 @@ static boolean inheritingDeclaration (declType decl) /* enum base types */ if (decl == DECL_ENUM) { - return (boolean) (isLanguage (Lang_cpp) || isLanguage (Lang_csharp) || - isLanguage (Lang_d)); + return (boolean) (isInputLanguage (Lang_cpp) || isInputLanguage (Lang_csharp) || + isInputLanguage (Lang_d)); } return (boolean) ( decl == DECL_CLASS || @@ -2679,8 +2679,8 @@ static void processColon (statementInfo *const st) else { cppUngetc (c); - if ((isLanguage (Lang_cpp) || isLanguage (Lang_csharp) || isLanguage (Lang_d) || - isLanguage (Lang_vala)) && + if ((isInputLanguage (Lang_cpp) || isInputLanguage (Lang_csharp) || isInputLanguage (Lang_d) || + isInputLanguage (Lang_vala)) && inheritingDeclaration (st->declaration)) { readParents (st, ':'); @@ -2822,7 +2822,7 @@ static void nextToken (statementInfo *const st) case '[': /* Hack for Vala: [..] can be a function attribute. * Seems not to have bad side effects, but have to test it more. */ - if (!isLanguage (Lang_vala)) + if (!isInputLanguage (Lang_vala)) setToken (st, TOKEN_ARRAY); skipToMatch ("[]"); break; @@ -2903,8 +2903,8 @@ static boolean isStatementEnd (const statementInfo *const st) /* Java, D, C#, Vala do not require semicolons to end a block. Neither do * C++ namespaces. All other blocks require a semicolon to terminate them. */ - isEnd = (boolean) (isLanguage (Lang_java) || isLanguage (Lang_d) || - isLanguage (Lang_csharp) || isLanguage (Lang_vala) || + isEnd = (boolean) (isInputLanguage (Lang_java) || isInputLanguage (Lang_d) || + isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala) || ! isContextualStatement (st)); else isEnd = FALSE; @@ -2964,7 +2964,7 @@ static void tagCheck (statementInfo *const st) { if (insideEnumBody (st) && /* Java enumerations can contain members after a semicolon */ - (! isLanguage(Lang_java) || st->parent->nSemicolons < 1)) + (! isInputLanguage(Lang_java) || st->parent->nSemicolons < 1)) qualifyEnumeratorTag (st, token); break; } @@ -2987,7 +2987,7 @@ static void tagCheck (statementInfo *const st) if (isType (prev2, TOKEN_NAME)) copyToken (st->blockName, prev2); /* D structure templates */ - if (isLanguage (Lang_d) && + if (isInputLanguage (Lang_d) && (st->declaration == DECL_CLASS || st->declaration == DECL_STRUCT || st->declaration == DECL_INTERFACE || st->declaration == DECL_NAMESPACE)) qualifyBlockTag (st, prev2); @@ -3004,7 +3004,7 @@ static void tagCheck (statementInfo *const st) boolean free_name_token = FALSE; /* C++ 11 allows class <name> final { ... } */ - if (isLanguage (Lang_cpp) && isType (prev, TOKEN_NAME) && + if (isInputLanguage (Lang_cpp) && isType (prev, TOKEN_NAME) && strcmp("final", vStringValue(prev->name)) == 0 && isType(prev2, TOKEN_NAME)) { @@ -3013,7 +3013,7 @@ static void tagCheck (statementInfo *const st) } else if (isType (name_token, TOKEN_NAME)) { - if (!isLanguage (Lang_vala)) + if (!isInputLanguage (Lang_vala)) copyToken (st->blockName, name_token); else { @@ -3036,7 +3036,7 @@ static void tagCheck (statementInfo *const st) } } } - else if (isLanguage (Lang_csharp)) + else if (isInputLanguage (Lang_csharp)) makeTag (prev, st, FALSE, TAG_PROPERTY); else { @@ -3076,7 +3076,7 @@ static void tagCheck (statementInfo *const st) { if (insideEnumBody (st) && /* Java enumerations can contain members after a semicolon */ - (! isLanguage (Lang_java) || st->parent->nSemicolons < 2)) + (! isInputLanguage (Lang_java) || st->parent->nSemicolons < 2)) ; else if (isType (prev, TOKEN_NAME)) { @@ -3147,7 +3147,7 @@ static boolean findCTags (const unsigned int passCount) contextual_fake_count = 0; Assert (passCount < 3); - cppInit ((boolean) (passCount > 1), isLanguage (Lang_csharp), isLanguage (Lang_cpp), &(CKinds [CK_DEFINE])); + cppInit ((boolean) (passCount > 1), isInputLanguage (Lang_csharp), isInputLanguage (Lang_cpp), &(CKinds [CK_DEFINE])); exception = (exception_t) setjmp (Exception); retry = FALSE; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] ea72ec: Remove ctags.c and move its content to routines.c, main.c and options.c
by Jiřà Techet
10 Sep '16
10 Sep '16
Branch: refs/heads/master Author: Jiřà Techet <techet(a)gmail.com> Committer: Jiřà Techet <techet(a)gmail.com> Date: Tue, 02 Aug 2016 22:27:22 UTC Commit: ea72ecc00fc22f24eced3ffce7c7db67d5f02271
https://github.com/geany/geany/commit/ea72ecc00fc22f24eced3ffce7c7db67d5f02…
Log Message: ----------- Remove ctags.c and move its content to routines.c, main.c and options.c This is mostly just moving code with just some minor modifications: - removal of code of unsupported platforms (VAX, OS2, etc.) - syncing includes/headers of affected files with uctags - removal of some functions we don't need in Geany and whose movement would require additional changes (those will get added back when doing final sync with uctags) - minor whitespace syncs Modified Paths: -------------- ctags/Makefile.am ctags/main/args.c ctags/main/ctags.c ctags/main/entry.c ctags/main/general.h ctags/main/lregex.c ctags/main/main.c ctags/main/main.h ctags/main/nestlevel.c ctags/main/options.c ctags/main/options.h ctags/main/parse.c ctags/main/routines.c ctags/main/routines.h ctags/main/sort.c ctags/main/strlist.c ctags/main/vstring.c ctags/parsers/asm.c ctags/parsers/c.c ctags/parsers/fortran.c ctags/parsers/jscript.c ctags/parsers/json.c ctags/parsers/matlab.c ctags/parsers/pascal.c ctags/parsers/perl.c ctags/parsers/php.c ctags/parsers/sh.c ctags/parsers/sql.c Modified: ctags/Makefile.am 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -55,7 +55,6 @@ parsers = \ libctags_la_SOURCES = \ main/args.c \ main/args.h \ - main/ctags.c \ main/ctags.h \ main/debug.h \ main/entry.c \ @@ -67,6 +66,7 @@ libctags_la_SOURCES = \ main/lcpp.c \ main/lcpp.h \ main/lregex.c \ + main/main.c \ main/main.h \ main/mio.c \ main/mio.h \ @@ -79,6 +79,7 @@ libctags_la_SOURCES = \ main/parsers.h \ main/read.c \ main/read.h \ + main/routines.c \ main/routines.h \ main/sort.c \ main/sort.h \ Modified: ctags/main/args.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -18,7 +18,7 @@ #include <ctype.h> #include "args.h" -#include "main.h" +#include "routines.h" /* * FUNCTION DEFINITIONS Modified: ctags/main/ctags.c 1397 lines changed, 0 insertions(+), 1397 deletions(-) =================================================================== @@ -1,1397 +0,0 @@ -/* -* -* Copyright (c) 1996-2001, Darren Hiebert -* -* Author: Darren Hiebert <darren(a)hiebert.com>, <darren(a)hiwaay.net> -*
http://darren.hiebert.com
-* -* This source code is released for free distribution under the terms of the -* GNU General Public License. It is provided on an as-is basis and no -* responsibility is accepted for its failure to perform as expected. -* -* This is a reimplementation of the ctags (1) program. It is an attempt to -* provide a fully featured ctags program which is free of the limitations -* which most (all?) others are subject to. -* -* This module contains top level start-up and portability functions. -*/ - -/* -* INCLUDE FILES -*/ -#include "general.h" /* must always come first */ -#include <glib.h> -#include <glib/gstdio.h> - -#ifdef HAVE_STDLIB_H -# include <stdlib.h> /* to declare malloc (), realloc () */ -#endif -#include <string.h> -#include <errno.h> -#include <ctype.h> - -#include <stdio.h> /* to declare SEEK_SET (hopefully) */ -# include <fcntl.h> /* to declar O_RDWR, O_CREAT, O_EXCL */ -# include <unistd.h> /* to declare mkstemp () */ - -#ifdef AMIGA -# include <dos/dosasl.h> /* for struct AnchorPath */ -# include <clib/dos_protos.h> /* function prototypes */ -# define ANCHOR_BUF_SIZE 512 -# define ANCHOR_SIZE (sizeof (struct AnchorPath) + ANCHOR_BUF_SIZE) -# ifdef __SASC - extern struct DosLibrary *DOSBase; -# include <pragmas/dos_pragmas.h> -# endif -#endif - -#include <stdarg.h> - - - -/* To declare "struct stat" and stat (). - */ -#if defined (HAVE_SYS_TYPES_H) -# include <sys/types.h> -#else -# if defined (HAVE_TYPES_H) -# include <types.h> -# endif -#endif -#ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -#else -# ifdef HAVE_STAT_H -# include <stat.h> -# endif -#endif - -/* To provide directory searching for recursion feature. - */ -#ifdef HAVE_DIRENT_H -# ifdef __BORLANDC__ -# define boolean BORLAND_boolean -# endif -# include <dirent.h> -# undef boolean -#endif -#ifdef HAVE_DIRECT_H -# include <direct.h> /* to _getcwd */ -#endif -#ifdef HAVE_DOS_H -# include <dos.h> /* to declare FA_DIREC */ -#endif -#ifdef HAVE_DIR_H -# include <dir.h> /* to declare findfirst () and findnext () */ -#endif -#ifdef HAVE_IO_H -# include <io.h> /* to declare _finddata_t in MSVC++ 4.x */ -#endif - -/* To provide timings features if available. - */ -#ifdef HAVE_CLOCK -# ifdef HAVE_TIME_H -# include <time.h> -# endif -#else -# ifdef HAVE_TIMES -# ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -# endif -# endif -#endif - -#include "entry.h" -#include "keyword.h" -#include "main.h" -#include "options.h" -#include "parse.h" -#include "read.h" -#include "vstring.h" - -#ifdef TRAP_MEMORY_CALLS -# include "safe_malloc.h" -#endif - -/* -* MACROS -*/ - -/* - * Miscellaneous macros - */ -#define selected(var,feature) (((int)(var) & (int)(feature)) == (int)feature) -#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s") - -/* - * Portability macros - */ -#ifndef PATH_SEPARATOR -# if defined (MSDOS_STYLE_PATH) -# define PATH_SEPARATOR '\\' -# elif defined (QDOS) -# define PATH_SEPARATOR '_' -# else -# define PATH_SEPARATOR '/' -# endif -#endif - -#if defined (MSDOS_STYLE_PATH) && defined (UNIX_PATH_SEPARATOR) -# define OUTPUT_PATH_SEPARATOR '/' -#else -# define OUTPUT_PATH_SEPARATOR PATH_SEPARATOR -#endif - -/* File type tests. - */ -#ifndef S_ISREG -# if defined (S_IFREG) && ! defined (AMIGA) -# define S_ISREG(mode) ((mode) & S_IFREG) -# else -# define S_ISREG(mode) TRUE /* assume regular file */ -# endif -#endif - -#ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(mode) FALSE /* assume no soft links */ -# endif -#endif - -#ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(mode) FALSE /* assume no soft links */ -# endif -#endif - -#ifndef S_IXUSR -# define S_IXUSR 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif - -#ifndef S_IRUSR -# define S_IRUSR 0400 -#endif -#ifndef S_IWUSR -# define S_IWUSR 0200 -#endif - -/* Hack for ridiculous practice of Microsoft Visual C++. - */ -#if defined (WIN32) -# if defined (_MSC_VER) -# define stat _stat -# define getcwd _getcwd -# define PATH_MAX _MAX_PATH -# elif defined (__BORLANDC__) -# define PATH_MAX MAXPATH -# endif -#endif - -#ifndef PATH_MAX -# define PATH_MAX 256 -#endif - -/* -* DATA DEFINITIONS -*/ -#if defined (MSDOS_STYLE_PATH) -static const char PathDelimiters [] = ":/\\"; -#elif defined (VMS) -static const char PathDelimiters [] = ":]>"; -#endif - -#ifndef TMPDIR -# define TMPDIR "/tmp" -#endif - -char *CurrentDirectory = NULL; -#ifdef HAVE_MKSTEMP -static const char *ExecutableProgram = NULL; -#endif -static const char *ExecutableName = "geany"; -static stringList* Excluded = NULL; - -static struct { long files, lines, bytes; } Totals = { 0, 0, 0 }; - -#ifdef AMIGA -# include "ctags.h" - static const char *VERsion = "$VER: "PROGRAM_NAME" "PROGRAM_VERSION" " -# ifdef __SASC - __AMIGADATE__ -# else - __DATE__ -# endif - " "AUTHOR_NAME" $"; -#endif - -/* -* FUNCTION PROTOTYPES -*/ -#ifdef NEED_PROTO_STAT -extern int stat (const char *, struct stat *); -#endif -#ifdef NEED_PROTO_LSTAT -extern int lstat (const char *, struct stat *); -#endif - -#if 0 -static boolean createTagsForEntry (const char *const entryName); -#endif - -/* -* FUNCTION DEFINITIONS -*/ - -extern const char *getExecutableName (void) -{ - return ExecutableName; -} - -#if 0 -static void setCurrentDirectory (void) -{ -#ifdef AMIGA - char* const cwd = eStrdup ("."); -#else - char* const cwd = getcwd (NULL, PATH_MAX); -#endif - CurrentDirectory = xMalloc (strlen (cwd) + 2, char); - if (cwd [strlen (cwd) - (size_t) 1] == PATH_SEPARATOR) - strcpy (CurrentDirectory, cwd); - else - sprintf (CurrentDirectory, "%s%c", cwd, OUTPUT_PATH_SEPARATOR); - free (cwd); -} -#endif - -extern void error (const errorSelection selection, - const char *const format, ...) -{ - va_list ap; - - va_start (ap, format); - fprintf (errout, "%s: %s", getExecutableName (), - selected (selection, WARNING) ? "Warning: " : ""); - vfprintf (errout, format, ap); - if (selected (selection, PERROR)) - fprintf (errout, " : %s", g_strerror (errno)); - fputs ("\n", errout); - va_end (ap); - if (selected (selection, FATAL)) - exit (1); -} - -#ifndef HAVE_STRICMP -extern int stricmp (const char *s1, const char *s2) -{ - int result; - do - { - result = toupper ((int) *s1) - toupper ((int) *s2); - } while (result == 0 && *s1++ != '\0' && *s2++ != '\0'); - return result; -} -#endif - -#ifndef HAVE_STRNICMP -extern int strnicmp (const char *s1, const char *s2, size_t n) -{ - int result; - do - { - result = toupper ((int) *s1) - toupper ((int) *s2); - } while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0'); - return result; -} -#endif - -#ifndef HAVE_STRSTR -extern char* strstr (const char *str, const char *substr) -{ - const size_t length = strlen (substr); - const char *match = NULL; - const char *p; - - for (p = str ; *p != '\0' && match == NULL ; ++p) - if (strncmp (p, substr, length) == 0) - match = p; - return (char*) match; -} -#endif - -extern char* eStrdup (const char* str) -{ - char* result = xMalloc (strlen (str) + 1, char); - strcpy (result, str); - return result; -} - -extern void *eMalloc (const size_t size) -{ - void *buffer = g_malloc (size); - - if (buffer == NULL) - error (FATAL, "out of memory"); - - return buffer; -} - -extern void *eCalloc (const size_t count, const size_t size) -{ - void *buffer = calloc (count, size); - - if (buffer == NULL) - error (FATAL, "out of memory"); - - return buffer; -} - -extern void *eRealloc (void *const ptr, const size_t size) -{ - void *buffer; - if (ptr == NULL) - buffer = eMalloc (size); - else - { - buffer = g_realloc (ptr, size); - if (buffer == NULL) - error (FATAL, "out of memory"); - } - return buffer; -} - -extern void eFree (void *const ptr) -{ - if (ptr != NULL) - free (ptr); -} - -extern void toLowerString (char* str) -{ - while (*str != '\0') - { - *str = tolower ((int) *str); - ++str; - } -} - -extern void toUpperString (char* str) -{ - while (*str != '\0') - { - *str = toupper ((int) *str); - ++str; - } -} - -/* Newly allocated string containing lower case conversion of a string. - */ -extern char* newLowerString (const char* str) -{ - char* const result = xMalloc (strlen (str) + 1, char); - int i = 0; - do - result [i] = tolower ((int) str [i]); - while (str [i++] != '\0'); - return result; -} - -/* Newly allocated string containing upper case conversion of a string. - */ -extern char* newUpperString (const char* str) -{ - char* const result = xMalloc (strlen (str) + 1, char); - int i = 0; - do - result [i] = toupper ((int) str [i]); - while (str [i++] != '\0'); - return result; -} - -extern long unsigned int getFileSize (const char *const name) -{ - GStatBuf fileStatus; - unsigned long size = 0; - - if (g_stat (name, &fileStatus) == 0) - size = fileStatus.st_size; - - return size; -} - -#if 0 -static boolean isSymbolicLink (const char *const name) -{ -#if defined (MSDOS) || defined (WIN32) || defined (VMS) || defined (__EMX__) || defined (AMIGA) - return FALSE; -#else - GStatBuf fileStatus; - boolean result = FALSE; - - if (g_lstat (name, &fileStatus) == 0) - result = (boolean) (S_ISLNK (fileStatus.st_mode)); - - return result; -#endif -} - -static boolean isNormalFile (const char *const name) -{ - GStatBuf fileStatus; - boolean result = FALSE; - - if (g_stat (name, &fileStatus) == 0) - result = (boolean) (S_ISREG (fileStatus.st_mode)); - - return result; -} -#endif - -extern boolean isExecutable (const char *const name) -{ - GStatBuf fileStatus; - boolean result = FALSE; - - if (g_stat (name, &fileStatus) == 0) - result = (boolean) ((fileStatus.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) != 0); - - return result; -} - -extern boolean isSameFile (const char *const name1, const char *const name2) -{ - boolean result = FALSE; -#ifdef HAVE_STAT_ST_INO - GStatBuf stat1, stat2; - - if (g_stat (name1, &stat1) == 0 && g_stat (name2, &stat2) == 0) - result = (boolean) (stat1.st_ino == stat2.st_ino); -#endif - return result; -} - -#ifdef HAVE_MKSTEMP - -static boolean isSetUID (const char *const name) -{ -#if defined (VMS) || defined (MSDOS) || defined (WIN32) || defined (__EMX__) || defined (AMIGA) - return FALSE; -#else - GStatBuf fileStatus; - boolean result = FALSE; - - if (g_stat (name, &fileStatus) == 0) - result = (boolean) ((fileStatus.st_mode & S_ISUID) != 0); - - return result; -#endif -} - -#endif - -#if 0 -static boolean isDirectory (const char *const name) -{ - boolean result = FALSE; -#ifdef AMIGA - struct FileInfoBlock *const fib = xMalloc (1, struct FileInfoBlock); - - if (fib != NULL) - { - const BPTR flock = Lock ((UBYTE *) name, (long) ACCESS_READ); - - if (flock != (BPTR) NULL) - { - if (Examine (flock, fib)) - result = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE); - UnLock (flock); - } - eFree (fib); - } -#else - GStatBuf fileStatus; - - if (g_stat (name, &fileStatus) == 0) - result = (boolean) S_ISDIR (fileStatus.st_mode); -#endif - return result; -} -#endif - -extern boolean doesFileExist (const char *const fileName) -{ - GStatBuf fileStatus; - - return (boolean) (g_stat (fileName, &fileStatus) == 0); -} - -/*#ifndef HAVE_FGETPOS*/ -/* -extern int fgetpos ( stream, pos ) - FILE *const stream; - fpos_t *const pos; -{ - int result = 0; - - *pos = ftell (stream); - if (*pos == -1L) - result = -1; - - return result; -} - -extern int fsetpos ( stream, pos ) - FILE *const stream; - fpos_t *const pos; -{ - return fseek (stream, *pos, SEEK_SET); -} -*/ -/*#endif*/ - -extern void addTotals (const unsigned int files, - const long unsigned int lines, - const long unsigned int bytes) -{ - Totals.files += files; - Totals.lines += lines; - Totals.bytes += bytes; -} - -extern boolean isDestinationStdout (void) -{ - boolean toStdout = FALSE; - - if (Option.xref || Option.filter || - (Option.tagFileName != NULL && (strcmp (Option.tagFileName, "-") == 0 -#if defined (VMS) - || strcmp (Option.tagFileName, "sys$output") == 0 -#else - || strcmp (Option.tagFileName, "/dev/stdout") == 0 -#endif - ))) - toStdout = TRUE; - return toStdout; -} - -extern FILE *tempFile (const char *const mode, char **const pName) -{ - char *name; - FILE *fp; - int fd; -#ifdef HAVE_MKSTEMP - const char *const template = "tags.XXXXXX"; - const char *tmpdir = NULL; - if (! isSetUID (ExecutableProgram)) - tmpdir = getenv ("TMPDIR"); - if (tmpdir == NULL) - tmpdir = TMPDIR; - name = xMalloc (strlen (tmpdir) + 1 + strlen (template) + 1, char); - sprintf (name, "%s%c%s", tmpdir, OUTPUT_PATH_SEPARATOR, template); - fd = mkstemp(name); -#else - name = xMalloc (L_tmpnam, char); - if (tmpnam (name) != name) - error (FATAL | PERROR, "cannot assign temporary file name"); - fd = open (name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); -#endif - if (fd == -1) - error (FATAL | PERROR, "cannot open temporary file"); - fp = fdopen (fd, mode); - if (fp == NULL) - error (FATAL | PERROR, "cannot open temporary file"); - DebugStatement ( - debugPrintf (DEBUG_STATUS, "opened temporary file %s\n", name); ) - Assert (*pName == NULL); - *pName = name; - return fp; -} - -/* - * Pathname manipulation (O/S dependent!!!) - */ - -extern const char *baseFilename (const char *const filePath) -{ -#if defined (MSDOS_STYLE_PATH) || defined (VMS) - const char *tail = NULL; - unsigned int i; - - /* Find whichever of the path delimiters is last. - */ - for (i = 0 ; i < strlen (PathDelimiters) ; ++i) - { - const char *sep = strrchr (filePath, PathDelimiters [i]); - - if (sep > tail) - tail = sep; - } -#else - const char *tail = strrchr (filePath, PATH_SEPARATOR); -#endif - if (tail == NULL) - tail = filePath; - else - ++tail; /* step past last delimiter */ -#ifdef VAXC - { - /* remove version number from filename */ - char *p = strrchr ((char *) tail, ';'); - if (p != NULL) - *p = '\0'; - } -#endif - - return tail; -} - -extern boolean isAbsolutePath (const char *const path) -{ - boolean result = FALSE; -#if defined (MSDOS_STYLE_PATH) - if (strchr (PathDelimiters, path [0]) != NULL) - result = TRUE; - else if (isalpha (path [0]) && path [1] == ':') - { - if (strchr (PathDelimiters, path [2]) != NULL) - result = TRUE; - else - /* We don't support non-absolute file names with a drive - * letter, like `d:NAME' (it's too much hassle). - */ - error (FATAL, - "%s: relative file names with drive letters not supported", - path); - } -#elif defined (VMS) - result = (boolean) (strchr (path, ':') != NULL); -#else - result = (boolean) (path [0] == PATH_SEPARATOR); -#endif - return result; -} - -/* Return a newly-allocated string whose contents concatenate those of - * s1, s2, s3. - * Routine adapted from Gnu etags. - */ -static char* concat (const char *s1, const char *s2, const char *s3) -{ - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); - char *result = xMalloc (len1 + len2 + len3 + 1, char); - - strcpy (result, s1); - strcpy (result + len1, s2); - strcpy (result + len1 + len2, s3); - result [len1 + len2 + len3] = '\0'; - - return result; -} - -/* Return a newly allocated string containing the absolute file name of FILE - * given CWD (which should end with a slash). - * Routine adapted from Gnu etags. - */ -static char* absoluteFilename (const char *file) -{ - char *slashp, *cp; - char *res = NULL; - - if (isAbsolutePath (file)) - res = eStrdup (file); - else - res = concat (CurrentDirectory, file, ""); - - /* Delete the "/dirname/.." and "/." substrings. */ - slashp = strchr (res, '/'); - while (slashp != NULL && slashp [0] != '\0') - { - if (slashp[1] == '.') - { - if (slashp [2] == '.' && (slashp [3] == '/' || slashp [3] == '\0')) - { - cp = slashp; - do - cp--; - while (cp >= res && ! isAbsolutePath (cp)); - if (cp < res) - cp = slashp;/* the absolute name begins with "/.." */ -#ifdef MSDOS_STYLE_PATH - /* Under MSDOS and NT we get `d:/NAME' as absolute file name, - * so the luser could say `d:/../NAME'. We silently treat this - * as `d:/NAME'. - */ - else if (cp [0] != '/') - cp = slashp; -#endif - memmove (cp, slashp + 3, strlen (slashp + 3) + 1); - slashp = cp; - continue; - } - else if (slashp [2] == '/' || slashp [2] == '\0') - { - memmove (slashp, slashp + 2, strlen (slashp + 2) + 1); - continue; - } - } - slashp = strchr (slashp + 1, '/'); - } - - if (res [0] == '\0') - return eStrdup ("/"); - else - { -#ifdef MSDOS_STYLE_PATH - /* Canonicalize drive letter case. */ - if (res [1] == ':' && islower (res [0])) - res [0] = toupper (res [0]); -#endif - - return res; - } -} - -/* Return a newly allocated string containing the absolute file name of dir - * where FILE resides given CWD (which should end with a slash). - * Routine adapted from Gnu etags. - */ -extern char* absoluteDirname (char *file) -{ - char *slashp, *res; - char save; -#ifdef MSDOS_STYLE_PATH - char *p; - for (p = file ; *p != '\0' ; p++) - if (*p == '\\') - *p = '/'; -#endif - slashp = strrchr (file, '/'); - if (slashp == NULL) - res = eStrdup (CurrentDirectory); - else - { - save = slashp [1]; - slashp [1] = '\0'; - res = absoluteFilename (file); - slashp [1] = save; - } - return res; -} - -/* Return a newly allocated string containing the file name of FILE relative - * to the absolute directory DIR (which should end with a slash). - * Routine adapted from Gnu etags. - */ -extern char* relativeFilename (const char *file, const char *dir) -{ - const char *fp, *dp; - char *absdir, *res; - int i; - - /* Find the common root of file and dir (with a trailing slash). */ - absdir = absoluteFilename (file); - fp = absdir; - dp = dir; - while (*fp++ == *dp++) - continue; - fp--; - dp--; /* back to the first differing char */ - do - { /* look at the equal chars until '/' */ - if (fp == absdir) - return absdir; /* first char differs, give up */ - fp--; - dp--; - } while (*fp != '/'); - - /* Build a sequence of "../" strings for the resulting relative file name. - */ - i = 0; - while ((dp = strchr (dp + 1, '/')) != NULL) - i += 1; - res = xMalloc (3 * i + strlen (fp + 1) + 1, char); - res [0] = '\0'; - while (i-- > 0) - strcat (res, "../"); - - /* Add the file name relative to the common root of file and dir. */ - strcat (res, fp + 1); - free (absdir); - - return res; -} - -extern vString *combinePathAndFile (const char *const path, - const char *const file) -{ - vString *const filePath = vStringNew (); -#ifdef VMS - const char *const directoryId = strstr (file, ".DIR;1"); - - if (directoryId == NULL) - { - const char *const versionId = strchr (file, ';'); - - vStringCopyS (filePath, path); - if (versionId == NULL) - vStringCatS (filePath, file); - else - vStringNCatS (filePath, file, versionId - file); - vStringCopyToLower (filePath, filePath); - } - else - { - /* File really is a directory; append it to the path. - * Gotcha: doesn't work with logical names. - */ - vStringNCopyS (filePath, path, strlen (path) - 1); - vStringPut (filePath, '.'); - vStringNCatS (filePath, file, directoryId - file); - if (strchr (path, '[') != NULL) - vStringPut (filePath, ']'); - else - vStringPut (filePath, '>'); - vStringTerminate (filePath); - } -#else - const int lastChar = path [strlen (path) - 1]; -# ifdef MSDOS_STYLE_PATH - boolean terminated = (boolean) (strchr (PathDelimiters, lastChar) != NULL); -# else - boolean terminated = (boolean) (lastChar == PATH_SEPARATOR); -# endif - - vStringCopyS (filePath, path); - if (! terminated) - { - vStringPut (filePath, OUTPUT_PATH_SEPARATOR); - vStringTerminate (filePath); - } - vStringCatS (filePath, file); -#endif - - return filePath; -} - -/* - * Create tags - */ - -extern void processExcludeOption (const char *const UNUSED option, - const char *const parameter) -{ - if (parameter [0] == '\0') - freeList (&Excluded); - else if (parameter [0] == '@') - { - stringList* const new = stringListNewFromFile (parameter + 1); - if (Excluded == NULL) - Excluded = new; - else - stringListCombine (Excluded, new); - } - else - { - vString *const item = vStringNewInit (parameter); - if (Excluded == NULL) - Excluded = stringListNew (); - stringListAdd (Excluded, item); - } -} - -#if 0 -static boolean excludedFile (const char* const name) -{ - const char* base = baseFilename (name); - boolean result = FALSE; - if (Excluded != NULL) - { - result = stringListFileMatched (Excluded, base); - if (! result && name != base) - result = stringListFileMatched (Excluded, name); - } -#ifdef AMIGA - /* not a good solution, but the only one which works often */ - if (! result) - result = (boolean) (strcmp (name, TagFile.name) == 0); -#endif - return result; -} - -# if defined (MSDOS) || defined (WIN32) - -static boolean createTagsForMatchingEntries (char *const pattern) -{ - boolean resize = FALSE; - const size_t dirLength = baseFilename (pattern) - (char *) pattern; - vString *const filePath = vStringNew (); -#if defined (HAVE_FINDFIRST) - struct ffblk fileInfo; - int result = findfirst (pattern, &fileInfo, FA_DIREC); - - while (result == 0) - { - const char *const entryName = fileInfo.ff_name; - - /* We must not recurse into the directories "." or "..". - */ - if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0) - { - vStringNCopyS (filePath, pattern, dirLength); - vStringCatS (filePath, entryName); - resize |= createTagsForEntry (vStringValue (filePath)); - } - result = findnext (&fileInfo); - } -#elif defined (HAVE__FINDFIRST) - struct _finddata_t fileInfo; - long hFile = _findfirst (pattern, &fileInfo); - - if (hFile != -1L) - { - do - { - const char *const entryName = fileInfo.name; - - /* We must not recurse into the directories "." or "..". - */ - if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0) - { - vStringNCopyS (filePath, pattern, dirLength); - vStringCatS (filePath, entryName); - resize |= createTagsForEntry (vStringValue (filePath)); - } - } while (_findnext (hFile, &fileInfo) == 0); - _findclose (hFile); - } -#endif - - vStringDelete (filePath); - return resize; -} - -#elif defined (AMIGA) - -static boolean createTagsForMatchingEntries (char *const pattern) -{ - boolean resize = FALSE; - struct AnchorPath *const anchor = - (struct AnchorPath *) eMalloc ((size_t) ANCHOR_SIZE); - - if (anchor != NULL) - { - LONG result; - - memset (anchor, 0, (size_t) ANCHOR_SIZE); - anchor->ap_Strlen = ANCHOR_BUF_SIZE; /* ap_Length no longer supported */ - - /* Allow '.' for current directory. - */ -#ifdef APF_DODOT - anchor->ap_Flags = APF_DODOT | APF_DOWILD; -#else - anchor->ap_Flags = APF_DoDot | APF_DoWild; -#endif - - result = MatchFirst ((UBYTE *) pattern, anchor); - while (result == 0) - { - resize |= createTagsForEntry ((char *) anchor->ap_Buf); - result = MatchNext (anchor); - } - MatchEnd (anchor); - eFree (anchor); - } - return resize; -} - -#endif - -static boolean isRecursiveLink (const char* const dirName) -{ - boolean result = FALSE; - char* const path = absoluteFilename (dirName); - while (path [strlen (path) - 1] == PATH_SEPARATOR) - path [strlen (path) - 1] = '\0'; - while (! result && strlen (path) > (size_t) 1) - { - char *const separator = strrchr (path, PATH_SEPARATOR); - if (separator == NULL) - break; - else if (separator == path) /* backed up to root directory */ - *(separator + 1) = '\0'; - else - *separator = '\0'; - result = isSameFile (path, dirName); - } - eFree (path); - return result; -} - -static boolean recurseIntoDirectory (const char *const dirName) -{ - boolean resize = FALSE; - if (isRecursiveLink (dirName)) - verbose ("ignoring \"%s\" (recursive link)\n", dirName); - else if (! Option.recurse) - verbose ("ignoring \"%s\" (directory)\n", dirName); - else - { -#if defined (HAVE_OPENDIR) - DIR *const dir = opendir (dirName); - if (dir == NULL) - error (WARNING | PERROR, "cannot recurse into directory \"%s\"", - dirName); - else - { - struct dirent *entry; - verbose ("RECURSING into directory \"%s\"\n", dirName); - while ((entry = readdir (dir)) != NULL) - { - if (strcmp (entry->d_name, ".") != 0 && - strcmp (entry->d_name, "..") != 0) - { - vString *filePath; - if (strcmp (dirName, ".") == 0) - filePath = vStringNewInit (entry->d_name); - else - filePath = combinePathAndFile (dirName, entry->d_name); - resize |= createTagsForEntry (vStringValue (filePath)); - vStringDelete (filePath); - } - } - closedir (dir); - } -#elif defined (AMIGA) || defined (MSDOS) || defined (WIN32) - vString *const pattern = vStringNew (); - verbose ("RECURSING into directory \"%s\"\n", dirName); -# ifdef AMIGA - if (*dirName != '\0' && strcmp (dirName, ".") != 0) - { - vStringCopyS (pattern, dirName); - if (dirName [strlen (dirName) - 1] != '/') - vStringPut (pattern, '/'); - } - vStringCatS (pattern, "#?"); -# else - vStringCopyS (pattern, dirName); - vStringPut (pattern, OUTPUT_PATH_SEPARATOR); - vStringCatS (pattern, "*.*"); -# endif - resize = createTagsForMatchingEntries (vStringValue (pattern)); - vStringDelete (pattern); -#endif /* HAVE_OPENDIR */ - } - return resize; -} - -static boolean createTagsForEntry (const char *const entryName) -{ - boolean resize = FALSE; - - Assert (entryName != NULL); - if (excludedFile (entryName)) - verbose ("excluding \"%s\"\n", entryName); - else if (isSymbolicLink (entryName) && ! Option.followLinks) - verbose ("ignoring \"%s\" (symbolic link)\n", entryName); - else if (! doesFileExist (entryName)) - error (WARNING | PERROR, "cannot open source file \"%s\"", entryName); - else if (isDirectory (entryName)) - resize = recurseIntoDirectory (entryName); - else if (! isNormalFile (entryName)) - verbose ("ignoring \"%s\" (special file)\n", entryName); - else - resize = parseFile (entryName); - - return resize; -} - -static boolean createTagsForArgs (cookedArgs* const args) -{ - boolean resize = FALSE; - - /* Generate tags for each argument on the command line. - */ - while (! cArgOff (args)) - { - const char *arg = cArgItem (args); - -#if defined (MSDOS) || defined (WIN32) - vString *const pattern = vStringNewInit (arg); - char *patternS = vStringValue (pattern); - - /* We must transform the "." and ".." forms into something that can - * be expanded by the MSDOS/Windows functions. - */ - if (Option.recurse && - (strcmp (patternS, ".") == 0 || strcmp (patternS, "..") == 0)) - { - vStringPut (pattern, OUTPUT_PATH_SEPARATOR); - vStringCatS (pattern, "*.*"); - } - resize |= createTagsForMatchingEntries (patternS); - vStringDelete (pattern); -#else - resize |= createTagsForEntry (arg); -#endif - cArgForth (args); - parseOptions (args); - } - return resize; -} - -/* Read from an opened file a list of file names for which to generate tags. - */ -static boolean createTagsFromFileInput (FILE* const fp, const boolean filter) -{ - boolean resize = FALSE; - if (fp != NULL) - { - cookedArgs* args = cArgNewFromLineFile (fp); - parseOptions (args); - while (! cArgOff (args)) - { - resize |= createTagsForEntry (cArgItem (args)); - if (filter) - { - if (Option.filterTerminator != NULL) - fputs (Option.filterTerminator, stdout); - fflush (stdout); - } - cArgForth (args); - parseOptions (args); - } - cArgDelete (args); - } - return resize; -} - -/* Read from a named file a list of file names for which to generate tags. - */ -static boolean createTagsFromListFile (const char* const fileName) -{ - boolean resize; - Assert (fileName != NULL); - if (strcmp (fileName, "-") == 0) - resize = createTagsFromFileInput (stdin, FALSE); - else - { - FILE* const fp = g_fopen (fileName, "r"); - if (fp == NULL) - error (FATAL | PERROR, "cannot open list file \"%s\"", fileName); - resize = createTagsFromFileInput (fp, FALSE); - fclose (fp); - } - return resize; -} - -#if defined (HAVE_CLOCK) -# define CLOCK_AVAILABLE -# ifndef CLOCKS_PER_SEC -# define CLOCKS_PER_SEC 1000000 -# endif -#elif defined (HAVE_TIMES) -# define CLOCK_AVAILABLE -# define CLOCKS_PER_SEC 60 -static clock_t clock (void) -{ - struct tms buf; - - times (&buf); - return (buf.tms_utime + buf.tms_stime); -} -#else -# define clock() (clock_t)0 -#endif - -static void printTotals (const clock_t *const timeStamps) -{ - const unsigned long totalTags = TagFile.numTags.added + - TagFile.numTags.prev; - - fprintf (errout, "%ld file%s, %ld line%s (%ld kB) scanned", - Totals.files, plural (Totals.files), - Totals.lines, plural (Totals.lines), - Totals.bytes/1024L); -#ifdef CLOCK_AVAILABLE - { - const double interval = ((double) (timeStamps [1] - timeStamps [0])) / - CLOCKS_PER_SEC; - - fprintf (errout, " in %.01f seconds", interval); - if (interval != (double) 0.0) - fprintf (errout, " (%lu kB/s)", - (unsigned long) (Totals.bytes / interval) / 1024L); - } -#endif - fputc ('\n', errout); - - fprintf (errout, "%lu tag%s added to tag file", - TagFile.numTags.added, plural (TagFile.numTags.added)); - if (Option.append) - fprintf (errout, " (now %lu tags)", totalTags); - fputc ('\n', errout); - - if (totalTags > 0 && Option.sorted) - { - fprintf (errout, "%lu tag%s sorted", totalTags, plural (totalTags)); -#ifdef CLOCK_AVAILABLE - fprintf (errout, " in %.02f seconds", - ((double) (timeStamps [2] - timeStamps [1])) / CLOCKS_PER_SEC); -#endif - fputc ('\n', errout); - } - -#ifdef TM_DEBUG - fprintf (errout, "longest tag line = %lu\n", - (unsigned long) TagFile.max.line); -#endif -} - -static void makeTags (cookedArgs* args) -{ - clock_t timeStamps [3]; - boolean resize = FALSE; - boolean files = (boolean)(! cArgOff (args) || Option.fileList != NULL - || Option.filter); - - if (! files && ! Option.recurse) - error (FATAL, "No files specified. Try \"%s --help\".", - getExecutableName ()); - -#define timeStamp(n) timeStamps[(n)]=(Option.printTotals ? clock():(clock_t)0) - if (! Option.filter) - openTagFile (); - - timeStamp (0); - - if (! cArgOff (args)) - { - verbose ("Reading command line arguments\n"); - resize = createTagsForArgs (args); - } - if (Option.fileList != NULL) - { - verbose ("Reading list file\n"); - resize = (boolean) (createTagsFromListFile (Option.fileList) || resize); - } - if (Option.filter) - { - verbose ("Reading filter input\n"); - resize = (boolean) (createTagsFromFileInput (stdin, TRUE) || resize); - } - if (! files && Option.recurse) - resize = recurseIntoDirectory ("."); - - timeStamp (1); - - if (! Option.filter) - closeTagFile (resize); - - timeStamp (2); - - if (Option.printTotals) - printTotals (timeStamps); -#undef timeStamp -} - -/* - * Start up code - */ - -static void setExecutableName (const char *const path) -{ - ExecutableProgram = path; - ExecutableName = baseFilename (path); -#ifdef VAXC -{ - /* remove filetype from executable name */ - char *p = strrchr (ExecutableName, '.'); - if (p != NULL) - *p = '\0'; -} -#endif -} - -extern int ctags_main (int UNUSED argc, char **argv) -{ - cookedArgs *args; -#ifdef VMS - extern int getredirection (int *ac, char ***av); - - /* do wildcard expansion and I/O redirection */ - getredirection (&argc, &argv); -#endif - -#ifdef AMIGA - /* This program doesn't work when started from the Workbench */ - if (argc == 0) - exit (1); -#endif - -#ifdef __EMX__ - _wildcard (&argc, &argv); /* expand wildcards in argument list */ -#endif - -#if defined (macintosh) && BUILD_MPW_TOOL == 0 - argc = ccommand (&argv); -#endif - - setCurrentDirectory (); - setExecutableName (*argv++); -#ifdef HAVE_REGEX - checkRegex (); -#endif - - /* always excluded by default */ - processExcludeOption (NULL, "EIFGEN"); - processExcludeOption (NULL, "SCCS"); - - args = cArgNewFromArgv (argv); - previewFirstOption (args); - testEtagsInvocation (); - initializeParsing (); - initOptions (); - readOptionConfiguration (); - verbose ("Reading initial options from command line\n"); - parseOptions (args); - checkOptions (); - makeTags (args); - - /* Clean up. - */ - eFree (CurrentDirectory); - freeList (&Excluded); - cArgDelete (args); - freeKeywordTable (); - freeSourceFileResources (); - freeTagFileResources (); - freeOptionResources (); - freeParserResources (); -#ifdef HAVE_REGEX - freeRegexResources (); -#endif - - exit (0); - return 0; -} -#endif - -/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */ -void utils_warn(const char *msg) -{ - g_warning("%s", msg); -} - -/* vi:set tabstop=4 shiftwidth=4: */ Modified: ctags/main/entry.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -44,6 +44,7 @@ #include "read.h" #include "sort.h" #include "strlist.h" +#include "routines.h" /* * MACROS Modified: ctags/main/general.h 111 lines changed, 5 insertions(+), 106 deletions(-) =================================================================== @@ -42,7 +42,7 @@ /* MS-DOS doesn't allow manipulation of standard error, so we send it to * stdout instead. */ -#if defined (MSDOS) || defined (WIN32) +#if defined (WIN32) # define errout stdout #else # define errout stderr @@ -53,7 +53,7 @@ # define MSDOS_STYLE_PATH #endif -#if defined (MSDOS) || defined (WIN32) +#if defined (WIN32) # define CASE_INSENSITIVE_FILENAMES # define MSDOS_STYLE_PATH # define HAVE_DOS_H 1 @@ -71,11 +71,7 @@ # define HAVE_STRSTR 1 # define HAVE_STRERROR 1 # define HAVE_FINDNEXT 1 -# ifdef __BORLANDC__ -# define HAVE_DIR_H 1 -# define HAVE_DIRENT_H 1 -# define HAVE_FINDFIRST 1 -# elif defined (_MSC_VER) +# ifdef _MSC_VER # define HAVE__FINDFIRST 1 # define HAVE_DIRECT_H 1 # elif defined (__MINGW32__) @@ -95,102 +91,10 @@ char *lrealpath(const char *filename); int fnmatch(const char *pattern, const char *string, int flags); #endif -#ifdef DJGPP -# define CASE_INSENSITIVE_FILENAMES -# define MSDOS_STYLE_PATH -# define HAVE_DIR_H 1 -# define HAVE_SYS_STAT_H 1 -# define HAVE_SYS_TYPES_H 1 -# define HAVE_UNISTD_H 1 -# define HAVE_FGETPOS 1 -# define HAVE_FINDFIRST 1 -# define HAVE_TRUNCATE 1 -#endif - -#ifdef OS2 -# define UNIX_PATH_SEPARATOR 1 -# define CASE_INSENSITIVE_FILENAMES -# define HAVE_DIRENT_H 1 -# define HAVE_FCNTL_H 1 -# define HAVE_IO_H 1 -# define HAVE_STDLIB_H 1 -# define HAVE_SYS_STAT_H 1 -# define HAVE_SYS_TYPES_H 1 -# define HAVE_TIME_H 1 -# define HAVE_UNISTD_H 1 -# define HAVE_CLOCK 1 -# define HAVE_CHSIZE 1 -# define HAVE_FGETPOS 1 -# define HAVE_FTRUNCATE 1 -# define HAVE_OPENDIR 1 -# define HAVE_REGCOMP 1 -# define HAVE_REMOVE 1 -# define HAVE_STRERROR 1 -# define HAVE_STRICMP 1 -# define HAVE_STRNICMP 1 -# define HAVE_STRSTR 1 -# define HAVE_TRUNCATE 1 -#endif - -#ifdef AMIGA -# define HAVE_STDLIB_H 1 -# define HAVE_SYS_STAT_H 1 -# define HAVE_SYS_TYPES_H 1 -# define HAVE_TIME_H 1 -# define HAVE_CLOCK 1 -# define HAVE_FGETPOS 1 -# define HAVE_STRERROR 1 -# define HAVE_STRICMP 1 -# define HAVE_STRNICMP 1 -#endif - #if defined (__MWERKS__) && defined (__MACINTOSH__) # define HAVE_STAT_H 1 #endif -#ifdef QDOS -# define HAVE_DIRENT_H 1 -# define HAVE_STDLIB_H 1 -# define HAVE_SYS_STAT_H 1 -# define HAVE_SYS_TIMES_H 1 -# define HAVE_SYS_TYPES_H 1 -# define HAVE_TIME_H 1 -# define HAVE_UNISTD_H 1 -# define STDC_HEADERS 1 -# define HAVE_CLOCK 1 -# define HAVE_FGETPOS 1 -# define HAVE_FTRUNCATE 1 -# define HAVE_OPENDIR 1 -# define HAVE_PUTENV 1 -# define HAVE_REMOVE 1 -# define HAVE_STRERROR 1 -# define HAVE_STRSTR 1 -# define HAVE_TIMES 1 -# define HAVE_TRUNCATE 1 -# define NON_CONST_PUTENV_PROTOTYPE 1 -#endif - -#if defined (__vms) && ! defined (VMS) -# define VMS -#endif -#ifdef VMS -# define CASE_INSENSITIVE_FILENAMES 1 -# define HAVE_STDLIB_H 1 -# define HAVE_TIME_H 1 -# ifdef VAXC -# define HAVE_STAT_H 1 -# define HAVE_TYPES_H 1 -# else -# define HAVE_FCNTL_H 1 -# define HAVE_SYS_STAT_H 1 -# define HAVE_SYS_TYPES_H 1 -# endif -# define HAVE_CLOCK 1 -# define HAVE_FGETPOS 1 -# define HAVE_STRERROR 1 -# define HAVE_STRSTR 1 -# define HAVE_UNISTD_H 1 -#endif #ifdef __FreeBSD__ #include <sys/types.h> @@ -214,17 +118,12 @@ void utils_warn(const char *msg); #undef FALSE #undef TRUE -#ifdef VAXC -typedef enum { FALSE, TRUE } booleanType; -typedef int boolean; -#else -# ifdef __cplusplus +#ifdef __cplusplus typedef bool boolean; #define FALSE false #define TRUE true -# else +#else typedef enum { FALSE, TRUE } boolean; -# endif #endif #if ! defined (HAVE_FGETPOS) && ! defined (fpos_t) Modified: ctags/main/lregex.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -28,11 +28,11 @@ #endif #include "mio.h" -#include "main.h" #include "entry.h" #include "parse.h" #include "read.h" #include "kind.h" +#include "routines.h" #ifdef HAVE_REGEX Modified: ctags/main/main.c 277 lines changed, 277 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,277 @@ +/* +* Copyright (c) 1996-2003, Darren Hiebert +* +* Author: Darren Hiebert <dhiebert(a)users.sourceforge.net> +*
http://ctags.sourceforge.net
+* +* 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. +* It is provided on an as-is basis and no responsibility is accepted for its +* failure to perform as expected. +* +* This is a reimplementation of the ctags (1) program. It is an attempt to +* provide a fully featured ctags program which is free of the limitations +* which most (all?) others are subject to. +* +* This module contains the start-up code and routines to determine the list +* of files to parsed for tags. +*/ + +/* +* INCLUDE FILES +*/ +#include "general.h" /* must always come first */ + +#include <glib.h> + +/* To provide timings features if available. + */ +#ifdef HAVE_CLOCK +# ifdef HAVE_TIME_H +# include <time.h> +# endif +#else +# ifdef HAVE_TIMES +# ifdef HAVE_SYS_TIMES_H +# include <sys/times.h> +# endif +# endif +#endif + +/* To provide directory searching for recursion feature. + */ + +#ifdef HAVE_DIRENT_H +# ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> /* required by dirent.h */ +# endif +# include <dirent.h> /* to declare opendir() */ +# undef boolean +#endif +#ifdef HAVE_DIRECT_H +# include <direct.h> /* to _getcwd() */ +#endif +#ifdef HAVE_DIR_H +# include <dir.h> /* to declare findfirst() and findnext */ +#endif +#ifdef HAVE_IO_H +# include <io.h> /* to declare _findfirst() */ +#endif + +#include <string.h> + +#include "debug.h" +#include "entry.h" +#include "keyword.h" +#include "main.h" +#include "options.h" +#include "read.h" +#include "routines.h" + +/* +* MACROS +*/ +#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s") + +/* +* DATA DEFINITIONS +*/ +static struct { long files, lines, bytes; } Totals = { 0, 0, 0 }; + +/* +* FUNCTION DEFINITIONS +*/ + +extern void addTotals ( + const unsigned int files, const long unsigned int lines, + const long unsigned int bytes) +{ + Totals.files += files; + Totals.lines += lines; + Totals.bytes += bytes; +} + +extern boolean isDestinationStdout (void) +{ + boolean toStdout = FALSE; + + if (Option.xref || Option.filter || + (Option.tagFileName != NULL && (strcmp (Option.tagFileName, "-") == 0 + || strcmp (Option.tagFileName, "/dev/stdout") == 0 + ))) + toStdout = TRUE; + return toStdout; +} + + +# if defined (WIN32) + +static boolean createTagsForMatchingEntries (char *const pattern) +{ + boolean resize = FALSE; + const size_t dirLength = baseFilename (pattern) - (char *) pattern; + vString *const filePath = vStringNew (); +#if defined (HAVE_FINDFIRST) + struct ffblk fileInfo; + int result = findfirst (pattern, &fileInfo, FA_DIREC); + while (result == 0) + { + const char *const entryName = fileInfo.ff_name; + + /* We must not recurse into the directories "." or "..". + */ + if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0) + { + vStringNCopyS (filePath, pattern, dirLength); + vStringCatS (filePath, entryName); + resize |= createTagsForEntry (vStringValue (filePath)); + } + result = findnext (&fileInfo); + } +#elif defined (HAVE__FINDFIRST) + struct _finddata_t fileInfo; + long hFile = _findfirst (pattern, &fileInfo); + + if (hFile != -1L) + { + do + { + const char *const entryName = fileInfo.name; + + /* We must not recurse into the directories "." or "..". + */ + if (strcmp (entryName, ".") != 0 && strcmp (entryName, "..") != 0) + { + vStringNCopyS (filePath, pattern, dirLength); + vStringCatS (filePath, entryName); + resize |= createTagsForEntry (vStringValue (filePath)); + } + } while (_findnext (hFile, &fileInfo) == 0); + _findclose (hFile); + } +#endif + + vStringDelete (filePath); + return resize; +} + +#endif + + +static boolean recurseIntoDirectory (const char *const dirName) +{ + boolean resize = FALSE; + if (isRecursiveLink (dirName)) + verbose ("ignoring \"%s\" (recursive link)\n", dirName); + else if (! Option.recurse) + verbose ("ignoring \"%s\" (directory)\n", dirName); + else + { +#if defined (HAVE_OPENDIR) + DIR *const dir = opendir (dirName); + if (dir == NULL) + error (WARNING | PERROR, "cannot recurse into directory \"%s\"", + dirName); + else + { + struct dirent *entry; + verbose ("RECURSING into directory \"%s\"\n", dirName); + while ((entry = readdir (dir)) != NULL) + { + if (strcmp (entry->d_name, ".") != 0 && + strcmp (entry->d_name, "..") != 0) + { + vString *filePath; + if (strcmp (dirName, ".") == 0) + filePath = vStringNewInit (entry->d_name); + else + filePath = combinePathAndFile (dirName, entry->d_name); + resize |= createTagsForEntry (vStringValue (filePath)); + vStringDelete (filePath); + } + } + closedir (dir); + } +#elif defined (WIN32) + vString *const pattern = vStringNew (); + verbose ("RECURSING into directory \"%s\"\n", dirName); + vStringCopyS (pattern, dirName); + vStringPut (pattern, OUTPUT_PATH_SEPARATOR); + vStringCatS (pattern, "*.*"); + resize = createTagsForMatchingEntries (vStringValue (pattern)); + vStringDelete (pattern); +#endif /* HAVE_OPENDIR */ + } + return resize; +} + +#if defined (HAVE_CLOCK) +# define CLOCK_AVAILABLE +# ifndef CLOCKS_PER_SEC +# define CLOCKS_PER_SEC 1000000 +# endif +#elif defined (HAVE_TIMES) +# define CLOCK_AVAILABLE +# define CLOCKS_PER_SEC 60 +static clock_t clock (void) +{ + struct tms buf; + + times (&buf); + return (buf.tms_utime + buf.tms_stime); +} +#else +# define clock() (clock_t)0 +#endif + +static void printTotals (const clock_t *const timeStamps) +{ + const unsigned long totalTags = TagFile.numTags.added + + TagFile.numTags.prev; + + fprintf (errout, "%ld file%s, %ld line%s (%ld kB) scanned", + Totals.files, plural (Totals.files), + Totals.lines, plural (Totals.lines), + Totals.bytes/1024L); +#ifdef CLOCK_AVAILABLE + { + const double interval = ((double) (timeStamps [1] - timeStamps [0])) / + CLOCKS_PER_SEC; + + fprintf (errout, " in %.01f seconds", interval); + if (interval != (double) 0.0) + fprintf (errout, " (%lu kB/s)", + (unsigned long) (Totals.bytes / interval) / 1024L); + } +#endif + fputc ('\n', errout); + + fprintf (errout, "%lu tag%s added to tag file", + TagFile.numTags.added, plural (TagFile.numTags.added)); + if (Option.append) + fprintf (errout, " (now %lu tags)", totalTags); + fputc ('\n', errout); + + if (totalTags > 0 && Option.sorted) + { + fprintf (errout, "%lu tag%s sorted", totalTags, plural (totalTags)); +#ifdef CLOCK_AVAILABLE + fprintf (errout, " in %.02f seconds", + ((double) (timeStamps [2] - timeStamps [1])) / CLOCKS_PER_SEC); +#endif + fputc ('\n', errout); + } + +#ifdef TM_DEBUG + fprintf (errout, "longest tag line = %lu\n", + (unsigned long) TagFile.max.line); +#endif +} + +/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */ +void utils_warn(const char *msg) +{ + g_warning("%s", msg); +} + +/* vi:set tabstop=4 shiftwidth=4: */ Modified: ctags/main/main.h 66 lines changed, 6 insertions(+), 60 deletions(-) =================================================================== @@ -1,82 +1,28 @@ /* -* -* Copyright (c) 1998-2001, Darren Hiebert +* Copyright (c) 1998-2002, Darren Hiebert * * This source code is released for free distribution under the terms of the -* GNU General Public License. +* GNU General Public License version 2 or (at your option) any later version. * * External interface to main.c */ -#ifndef _MAIN_H -#define _MAIN_H +#ifndef CTAGS_MAIN_MAIN_H +#define CTAGS_MAIN_MAIN_H /* * INCLUDE FILES */ -#include "general.h" /* must always come first */ +#include "general.h" /* must always come first */ #include <stdio.h> -#include "vstring.h" - -/* -* MACROS -*/ -#define xMalloc(n,Type) (Type *)eMalloc((size_t)(n) * sizeof (Type)) -#define xCalloc(n,Type) (Type *)eCalloc((size_t)(n), sizeof (Type)) -#define xRealloc(p,n,Type) (Type *)eRealloc((p), (n) * sizeof (Type)) - -/* -* DATA DECLARATIONS -*/ -typedef int errorSelection; -enum eErrorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; -extern char *CurrentDirectory; - /* * FUNCTION PROTOTYPES */ -#ifdef NEED_PROTO_MALLOC -extern void *malloc (size_t); -extern void *realloc (void *ptr, size_t); -#endif - -extern void error (const errorSelection selection, const char *const format, ...) PRINTF (2, 3); -extern FILE *tempFile (const char *const mode, char **const pName); -extern char* eStrdup (const char* str); -extern void *eMalloc (const size_t size); -extern void *eCalloc (const size_t count, const size_t size); -extern void *eRealloc (void *const ptr, const size_t size); -extern void eFree (void *const ptr); -extern void toLowerString (char* str); -extern void toUpperString (char* str); -extern char* newLowerString (const char* str); -extern char* newUpperString (const char* str); -extern long unsigned int getFileSize (const char *const name); -extern boolean isExecutable (const char *const name); -extern boolean isSameFile (const char *const name1, const char *const name2); -extern boolean doesFileExist (const char *const fileName); -extern char* absoluteDirname (char *file); -extern char* relativeFilename (const char *file, const char *dir); extern void addTotals (const unsigned int files, const long unsigned int lines, const long unsigned int bytes); -extern const char *baseFilename (const char *const filePath); -extern boolean isAbsolutePath (const char *const path); -extern vString *combinePathAndFile (const char *const path, const char *const file); extern boolean isDestinationStdout (void); -extern const char *getExecutableName (void); -extern void processExcludeOption (const char *const option, const char *const parameter); extern int main (int argc, char **argv); -#ifndef HAVE_STRICMP -extern int stricmp (const char *s1, const char *s2); -#endif -#ifndef HAVE_STRNICMP -extern int strnicmp (const char *s1, const char *s2, size_t n); -#endif -#ifndef HAVE_STRSTR -extern char* strstr (const char *str, const char *substr); -#endif - -#endif /* _MAIN_H */ +#endif /* CTAGS_MAIN_MAIN_H */ /* vi:set tabstop=4 shiftwidth=4: */ Modified: ctags/main/nestlevel.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -14,6 +14,8 @@ #include "general.h" /* must always come first */ #include "main.h" +#include "debug.h" +#include "routines.h" #include "nestlevel.h" /* Modified: ctags/main/options.c 59 lines changed, 39 insertions(+), 20 deletions(-) =================================================================== @@ -19,7 +19,7 @@ #include <ctype.h> /* to declare isspace () */ #include "ctags.h" -#include "main.h" +#include "routines.h" #define OPTION_WRITE #include "options.h" #include "parse.h" @@ -42,7 +42,7 @@ # define DEFAULT_FILE_FORMAT 2 #endif -#if defined (MSDOS) || defined (WIN32) || defined (OS2) || defined (AMIGA) || defined (HAVE_OPENDIR) +#if defined (WIN32) || defined (HAVE_OPENDIR) # define RECURSE_SUPPORTED #endif @@ -54,6 +54,8 @@ * DATA DEFINITIONS */ +static stringList* Excluded = NULL; + optionValues Option = { { FALSE, /* --extra=f */ @@ -124,24 +126,6 @@ extern void setDefaultTagFileName (void) Option.tagFileName = eStrdup (CTAGS_FILE); } -/* - * File extension and language mapping - */ -extern const char *fileExtension (const char *const fileName) -{ - const char *extension; - const char *pDelimiter = NULL; - - pDelimiter = strrchr (fileName, '.'); - - if (pDelimiter == NULL) - extension = ""; - else - extension = pDelimiter + 1; /* skip to first char of extension */ - - return extension; -} - /* Determines whether the specified file name is considered to be a header * file for the purposes of determining whether enclosed tags are global or * static. @@ -225,6 +209,41 @@ void addIgnoreListFromFile (const char *const fileName) stringListCombine (Option.ignore, tokens); } +extern void processExcludeOption (const char *const UNUSED option, + const char *const parameter) +{ + if (parameter [0] == '\0') + freeList (&Excluded); + else if (parameter [0] == '@') + { + stringList* const new = stringListNewFromFile (parameter + 1); + if (Excluded == NULL) + Excluded = new; + else + stringListCombine (Excluded, new); + } + else + { + vString *const item = vStringNewInit (parameter); + if (Excluded == NULL) + Excluded = stringListNew (); + stringListAdd (Excluded, item); + } +} + +extern boolean isExcludedFile (const char* const name) +{ + const char* base = baseFilename (name); + boolean result = FALSE; + if (Excluded != NULL) + { + result = stringListFileMatched (Excluded, base); + if (! result && name != base) + result = stringListFileMatched (Excluded, name); + } + return result; +} + /* Modified: ctags/main/options.h 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -9,7 +9,7 @@ #ifndef CTAGS_MAIN_OPTIONS_H #define CTAGS_MAIN_OPTIONS_H -#if defined(OPTION_WRITE) || defined(VAXC) +#if defined(OPTION_WRITE) # define CONST_OPTION #else # define CONST_OPTION const @@ -97,8 +97,8 @@ extern void verbose (const char *const format, ...) PRINTF (1, 2); extern void freeList (stringList** const pString); extern void setDefaultTagFileName (void); -extern const char *fileExtension (const char *const fileName); extern boolean isIncludeFile (const char *const fileName); +extern boolean isExcludedFile (const char* const name); extern boolean isIgnoreToken (const char *const name, boolean *const pIgnoreParens, const char **const replacement); extern void readOptionConfiguration (void); extern void initOptions (void); Modified: ctags/main/parse.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -26,6 +26,7 @@ #include "parsers.h" #include "read.h" #include "vstring.h" +#include "routines.h" /* * DATA DEFINITIONS Modified: ctags/main/routines.c 788 lines changed, 788 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,788 @@ +/* +* Copyright (c) 2002-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. +* +* This module contains a lose assortment of shared functions. +*/ + +/* +* INCLUDE FILES +*/ +#include "general.h" /* must always come first */ + +#include <glib.h> +#include <glib/gstdio.h> + +#include <errno.h> + +#ifdef HAVE_STDLIB_H +# include <stdlib.h> /* to declare malloc (), realloc () */ +#endif +#include <ctype.h> +#include <string.h> +#include <stdio.h> /* to declare tempnam(), and SEEK_SET (hopefully) */ + +#ifdef HAVE_FCNTL_H +# include <fcntl.h> /* to declare O_RDWR, O_CREAT, O_EXCL */ +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> /* to declare mkstemp () */ +#endif + +#ifdef HAVE_LIMITS_H +# include <limits.h> /* to declare MB_LEN_MAX */ +#endif +#ifndef MB_LEN_MAX +# define MB_LEN_MAX 6 +#endif + +/* To declare "struct stat" and stat (). + */ +#if defined (HAVE_SYS_TYPES_H) +# include <sys/types.h> +#else +# if defined (HAVE_TYPES_H) +# include <types.h> +# endif +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#else +# ifdef HAVE_STAT_H +# include <stat.h> +# endif +#endif + +#ifdef HAVE_DIRECT_H +# include <direct.h> /* to _getcwd */ +#endif +#ifdef HAVE_DIR_H +# include <dir.h> /* to declare findfirst() and findnext() */ +#endif +#ifdef HAVE_IO_H +# include <io.h> /* to declare open() */ +#endif +#include "debug.h" +#include "routines.h" +#ifdef HAVE_ICONV +# include "mbcs.h" +#endif +#ifdef HAVE_ERRNO_H +# include <errno.h> +#endif + +#include "options.h" + +/* +* MACROS +*/ +#ifndef TMPDIR +# define TMPDIR "/tmp" +#endif + +/* File type tests. + */ +#ifndef S_ISREG +# if defined (S_IFREG) +# define S_ISREG(mode) ((mode) & S_IFREG) +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(mode) FALSE /* assume no soft links */ +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(mode) FALSE /* assume no soft links */ +# endif +#endif + +#ifndef S_IFMT +# define S_IFMT 0 +#endif + +#ifndef S_IXUSR +# define S_IXUSR 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif + +#ifndef S_IRUSR +# define S_IRUSR 0400 +#endif +#ifndef S_IWUSR +# define S_IWUSR 0200 +#endif + +#ifndef S_ISUID +# define S_ISUID 0 +#endif + +#ifndef S_ISGID +# define S_ISGID 0 +#endif + +/* Hack for ridiculous practice of Microsoft Visual C++. + */ +#if defined (WIN32) +# if defined (_MSC_VER) +# define stat _stat +# define getcwd _getcwd +# define PATH_MAX _MAX_PATH +# endif +#endif + +#ifndef PATH_MAX +# define PATH_MAX 256 +#endif + +#define selected(var,feature) (((int)(var) & (int)(feature)) == (int)feature) + +/* + * Miscellaneous macros + */ + + +/* +* DATA DEFINITIONS +*/ +#if defined (MSDOS_STYLE_PATH) +static const char PathDelimiters [] = ":/\\"; +#endif + +char *CurrentDirectory; + +#ifdef HAVE_MKSTEMP +static const char *ExecutableProgram = NULL; +#endif + +static const char *ExecutableName = "geany"; + +/* +* FUNCTION PROTOTYPES +*/ +#ifdef NEED_PROTO_STAT +extern int stat (const char *, struct stat *); +#endif +#ifdef NEED_PROTO_LSTAT +extern int lstat (const char *, struct stat *); +#endif + +#if 0 +static boolean createTagsForEntry (const char *const entryName); +#endif + + +/* +* FUNCTION DEFINITIONS +*/ + + +extern void setExecutableName (const char *const path) +{ + ExecutableProgram = path; + ExecutableName = baseFilename (path); +} + +extern const char *getExecutableName (void) +{ + return ExecutableName; +} + + +extern void *eMalloc (const size_t size) +{ + void *buffer = g_malloc (size); + + if (buffer == NULL) + error (FATAL, "out of memory"); + + return buffer; +} + +extern void *eCalloc (const size_t count, const size_t size) +{ + void *buffer = calloc (count, size); + + if (buffer == NULL) + error (FATAL, "out of memory"); + + return buffer; +} + +extern void *eRealloc (void *const ptr, const size_t size) +{ + void *buffer; + if (ptr == NULL) + buffer = eMalloc (size); + else + { + buffer = g_realloc (ptr, size); + if (buffer == NULL) + error (FATAL, "out of memory"); + } + return buffer; +} + +extern void eFree (void *const ptr) +{ + if (ptr != NULL) + free (ptr); +} + +#ifndef HAVE_STRSTR +extern char* strstr (const char *str, const char *substr) +{ + const size_t length = strlen (substr); + const char *match = NULL; + const char *p; + + for (p = str ; *p != '\0' && match == NULL ; ++p) + if (strncmp (p, substr, length) == 0) + match = p; + return (char*) match; +} +#endif + +extern char* eStrdup (const char* str) +{ + char* result = xMalloc (strlen (str) + 1, char); + strcpy (result, str); + return result; +} + +extern void toLowerString (char* str) +{ + while (*str != '\0') + { + *str = tolower ((int) *str); + ++str; + } +} + +extern void toUpperString (char* str) +{ + while (*str != '\0') + { + *str = toupper ((int) *str); + ++str; + } +} + +/* Newly allocated string containing lower case conversion of a string. + */ +extern char* newLowerString (const char* str) +{ + char* const result = xMalloc (strlen (str) + 1, char); + int i = 0; + do + result [i] = tolower ((int) str [i]); + while (str [i++] != '\0'); + return result; +} + +/* Newly allocated string containing upper case conversion of a string. + */ +extern char* newUpperString (const char* str) +{ + char* const result = xMalloc (strlen (str) + 1, char); + int i = 0; + do + result [i] = toupper ((int) str [i]); + while (str [i++] != '\0'); + return result; +} + + +#if 0 +static void setCurrentDirectory (void) +{ + char* const cwd = getcwd (NULL, PATH_MAX); + CurrentDirectory = xMalloc (strlen (cwd) + 2, char); + if (cwd [strlen (cwd) - (size_t) 1] == PATH_SEPARATOR) + strcpy (CurrentDirectory, cwd); + else + sprintf (CurrentDirectory, "%s%c", cwd, OUTPUT_PATH_SEPARATOR); + free (cwd); +} +#endif + + +extern boolean doesFileExist (const char *const fileName) +{ + GStatBuf fileStatus; + + return (boolean) (g_stat (fileName, &fileStatus) == 0); +} + +extern boolean isRecursiveLink (const char* const dirName) +{ + boolean result = FALSE; + char* const path = absoluteFilename (dirName); + while (path [strlen (path) - 1] == PATH_SEPARATOR) + path [strlen (path) - 1] = '\0'; + while (! result && strlen (path) > (size_t) 1) + { + char *const separator = strrchr (path, PATH_SEPARATOR); + if (separator == NULL) + break; + else if (separator == path) /* backed up to root directory */ + *(separator + 1) = '\0'; + else + *separator = '\0'; + result = isSameFile (path, dirName); + } + eFree (path); + return result; +} + +extern boolean isSameFile (const char *const name1, const char *const name2) +{ + boolean result = FALSE; +#ifdef HAVE_STAT_ST_INO + GStatBuf stat1, stat2; + + if (g_stat (name1, &stat1) == 0 && g_stat (name2, &stat2) == 0) + result = (boolean) (stat1.st_ino == stat2.st_ino); +#endif + return result; +} + +/* + * Pathname manipulation (O/S dependent!!!) + */ + +extern const char *baseFilename (const char *const filePath) +{ +#if defined (MSDOS_STYLE_PATH) + const char *tail = NULL; + unsigned int i; + + /* Find whichever of the path delimiters is last. + */ + for (i = 0 ; i < strlen (PathDelimiters) ; ++i) + { + const char *sep = strrchr (filePath, PathDelimiters [i]); + + if (sep > tail) + tail = sep; + } +#else + const char *tail = strrchr (filePath, PATH_SEPARATOR); +#endif + if (tail == NULL) + tail = filePath; + else + ++tail; /* step past last delimiter */ + + return tail; +} + +/* + * File extension and language mapping + */ +extern const char *fileExtension (const char *const fileName) +{ + const char *extension; + const char *pDelimiter = NULL; + + pDelimiter = strrchr (fileName, '.'); + + if (pDelimiter == NULL) + extension = ""; + else + extension = pDelimiter + 1; /* skip to first char of extension */ + + return extension; +} + +extern boolean isAbsolutePath (const char *const path) +{ + boolean result = FALSE; +#if defined (MSDOS_STYLE_PATH) + if (strchr (PathDelimiters, path [0]) != NULL) + result = TRUE; + else if (isalpha (path [0]) && path [1] == ':') + { + if (strchr (PathDelimiters, path [2]) != NULL) + result = TRUE; + else + /* We don't support non-absolute file names with a drive + * letter, like `d:NAME' (it's too much hassle). + */ + error (FATAL, + "%s: relative file names with drive letters not supported", + path); + } +#else + result = (boolean) (path [0] == PATH_SEPARATOR); +#endif + return result; +} + +extern vString *combinePathAndFile (const char *const path, + const char *const file) +{ + vString *const filePath = vStringNew (); + const int lastChar = path [strlen (path) - 1]; +# ifdef MSDOS_STYLE_PATH + boolean terminated = (boolean) (strchr (PathDelimiters, lastChar) != NULL); +# else + boolean terminated = (boolean) (lastChar == PATH_SEPARATOR); +# endif + + vStringCopyS (filePath, path); + if (! terminated) + { + vStringPut (filePath, OUTPUT_PATH_SEPARATOR); + vStringTerminate (filePath); + } + vStringCatS (filePath, file); + + return filePath; +} + +/* Return a newly-allocated string whose contents concatenate those of + * s1, s2, s3. + * Routine adapted from Gnu etags. + */ +static char* concat (const char *s1, const char *s2, const char *s3) +{ + int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); + char *result = xMalloc (len1 + len2 + len3 + 1, char); + + strcpy (result, s1); + strcpy (result + len1, s2); + strcpy (result + len1 + len2, s3); + result [len1 + len2 + len3] = '\0'; + + return result; +} + +/* Return a newly allocated string containing the absolute file name of FILE + * given CWD (which should end with a slash). + * Routine adapted from Gnu etags. + */ +extern char* absoluteFilename (const char *file) +{ + char *slashp, *cp; + char *res = NULL; + + if (isAbsolutePath (file)) + res = eStrdup (file); + else + res = concat (CurrentDirectory, file, ""); + + /* Delete the "/dirname/.." and "/." substrings. */ + slashp = strchr (res, '/'); + while (slashp != NULL && slashp [0] != '\0') + { + if (slashp[1] == '.') + { + if (slashp [2] == '.' && (slashp [3] == '/' || slashp [3] == '\0')) + { + cp = slashp; + do + cp--; + while (cp >= res && ! isAbsolutePath (cp)); + if (cp < res) + cp = slashp;/* the absolute name begins with "/.." */ +#ifdef MSDOS_STYLE_PATH + /* Under MSDOS and NT we get `d:/NAME' as absolute file name, + * so the luser could say `d:/../NAME'. We silently treat this + * as `d:/NAME'. + */ + else if (cp [0] != '/') + cp = slashp; +#endif + memmove (cp, slashp + 3, strlen (slashp + 3) + 1); + slashp = cp; + continue; + } + else if (slashp [2] == '/' || slashp [2] == '\0') + { + memmove (slashp, slashp + 2, strlen (slashp + 2) + 1); + continue; + } + } + slashp = strchr (slashp + 1, '/'); + } + + if (res [0] == '\0') + return eStrdup ("/"); + else + { +#ifdef MSDOS_STYLE_PATH + /* Canonicalize drive letter case. */ + if (res [1] == ':' && islower (res [0])) + res [0] = toupper (res [0]); +#endif + + return res; + } +} + +/* Return a newly allocated string containing the absolute file name of dir + * where FILE resides given CWD (which should end with a slash). + * Routine adapted from Gnu etags. + */ +extern char* absoluteDirname (char *file) +{ + char *slashp, *res; + char save; +#ifdef MSDOS_STYLE_PATH + char *p; + for (p = file ; *p != '\0' ; p++) + if (*p == '\\') + *p = '/'; +#endif + slashp = strrchr (file, '/'); + if (slashp == NULL) + res = eStrdup (CurrentDirectory); + else + { + save = slashp [1]; + slashp [1] = '\0'; + res = absoluteFilename (file); + slashp [1] = save; + } + return res; +} + +/* Return a newly allocated string containing the file name of FILE relative + * to the absolute directory DIR (which should end with a slash). + * Routine adapted from Gnu etags. + */ +extern char* relativeFilename (const char *file, const char *dir) +{ + const char *fp, *dp; + char *absdir, *res; + int i; + + /* Find the common root of file and dir (with a trailing slash). */ + absdir = absoluteFilename (file); + fp = absdir; + dp = dir; + while (*fp++ == *dp++) + continue; + fp--; + dp--; /* back to the first differing char */ + do + { /* look at the equal chars until '/' */ + if (fp == absdir) + return absdir; /* first char differs, give up */ + fp--; + dp--; + } while (*fp != '/'); + + /* Build a sequence of "../" strings for the resulting relative file name. + */ + i = 0; + while ((dp = strchr (dp + 1, '/')) != NULL) + i += 1; + res = xMalloc (3 * i + strlen (fp + 1) + 1, char); + res [0] = '\0'; + while (i-- > 0) + strcat (res, "../"); + + /* Add the file name relative to the common root of file and dir. */ + strcat (res, fp + 1); + free (absdir); + + return res; +} + +extern long unsigned int getFileSize (const char *const name) +{ + GStatBuf fileStatus; + unsigned long size = 0; + + if (g_stat (name, &fileStatus) == 0) + size = fileStatus.st_size; + + return size; +} + +#if 0 +static boolean isSymbolicLink (const char *const name) +{ +#if defined (WIN32) + return FALSE; +#else + GStatBuf fileStatus; + boolean result = FALSE; + + if (g_lstat (name, &fileStatus) == 0) + result = (boolean) (S_ISLNK (fileStatus.st_mode)); + + return result; +#endif +} + +static boolean isNormalFile (const char *const name) +{ + GStatBuf fileStatus; + boolean result = FALSE; + + if (g_stat (name, &fileStatus) == 0) + result = (boolean) (S_ISREG (fileStatus.st_mode)); + + return result; +} +#endif + +extern boolean isExecutable (const char *const name) +{ + GStatBuf fileStatus; + boolean result = FALSE; + + if (g_stat (name, &fileStatus) == 0) + result = (boolean) ((fileStatus.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) != 0); + + return result; +} + +#ifdef HAVE_MKSTEMP + +static boolean isSetUID (const char *const name) +{ +#if defined (WIN32) + return FALSE; +#else + GStatBuf fileStatus; + boolean result = FALSE; + + if (g_stat (name, &fileStatus) == 0) + result = (boolean) ((fileStatus.st_mode & S_ISUID) != 0); + + return result; +#endif +} + +#endif + +#if 0 +static boolean isDirectory (const char *const name) +{ + boolean result = FALSE; + GStatBuf fileStatus; + + if (g_stat (name, &fileStatus) == 0) + result = (boolean) S_ISDIR (fileStatus.st_mode); + return result; +} +#endif + +/*#ifndef HAVE_FGETPOS*/ +/* +extern int fgetpos ( stream, pos ) + FILE *const stream; + fpos_t *const pos; +{ + int result = 0; + + *pos = ftell (stream); + if (*pos == -1L) + result = -1; + + return result; +} + +extern int fsetpos ( stream, pos ) + FILE *const stream; + fpos_t *const pos; +{ + return fseek (stream, *pos, SEEK_SET); +} +*/ +/*#endif*/ + +extern FILE *tempFile (const char *const mode, char **const pName) +{ + char *name; + FILE *fp; + int fd; +#ifdef HAVE_MKSTEMP + const char *const template = "tags.XXXXXX"; + const char *tmpdir = NULL; + if (! isSetUID (ExecutableProgram)) + tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL) + tmpdir = TMPDIR; + name = xMalloc (strlen (tmpdir) + 1 + strlen (template) + 1, char); + sprintf (name, "%s%c%s", tmpdir, OUTPUT_PATH_SEPARATOR, template); + fd = mkstemp(name); +#else + name = xMalloc (L_tmpnam, char); + if (tmpnam (name) != name) + error (FATAL | PERROR, "cannot assign temporary file name"); + fd = open (name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); +#endif + if (fd == -1) + error (FATAL | PERROR, "cannot open temporary file"); + fp = fdopen (fd, mode); + if (fp == NULL) + error (FATAL | PERROR, "cannot open temporary file"); + DebugStatement ( + debugPrintf (DEBUG_STATUS, "opened temporary file %s\n", name); ) + Assert (*pName == NULL); + *pName = name; + return fp; +} + +extern void error (const errorSelection selection, + const char *const format, ...) +{ + va_list ap; + + va_start (ap, format); + fprintf (errout, "%s: %s", getExecutableName (), + selected (selection, WARNING) ? "Warning: " : ""); + vfprintf (errout, format, ap); + if (selected (selection, PERROR)) + fprintf (errout, " : %s", g_strerror (errno)); + fputs ("\n", errout); + va_end (ap); + if (selected (selection, FATAL)) + exit (1); +} + +#ifndef HAVE_STRICMP +extern int stricmp (const char *s1, const char *s2) +{ + int result; + do + { + result = toupper ((int) *s1) - toupper ((int) *s2); + } while (result == 0 && *s1++ != '\0' && *s2++ != '\0'); + return result; +} +#endif + +#ifndef HAVE_STRNICMP +extern int strnicmp (const char *s1, const char *s2, size_t n) +{ + int result; + do + { + result = toupper ((int) *s1) - toupper ((int) *s2); + } while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0'); + return result; +} +#endif + + +/* vi:set tabstop=4 shiftwidth=4: */ Modified: ctags/main/routines.h 82 lines changed, 81 insertions(+), 1 deletions(-) =================================================================== @@ -16,16 +16,96 @@ #include <stdio.h> -#include "mio.h" +#include "vstring.h" /* * MACROS */ +#define xMalloc(n,Type) (Type *)eMalloc((size_t)(n) * sizeof (Type)) +#define xCalloc(n,Type) (Type *)eCalloc((size_t)(n), sizeof (Type)) +#define xRealloc(p,n,Type) (Type *)eRealloc((p), (n) * sizeof (Type)) + #define ARRAY_SIZE(X) (sizeof (X) / sizeof (X[0])) #define STRINGIFY(X) STRINGIFY_(X) #define STRINGIFY_(X) #X +/* + * Portability macros + */ +#ifndef PATH_SEPARATOR +# if defined (MSDOS_STYLE_PATH) +# define PATH_SEPARATOR '\\' +# else +# define PATH_SEPARATOR '/' +# endif +#endif + +#if defined (MSDOS_STYLE_PATH) && defined (UNIX_PATH_SEPARATOR) +# define OUTPUT_PATH_SEPARATOR '/' +#else +# define OUTPUT_PATH_SEPARATOR PATH_SEPARATOR +#endif + +/* +* DATA DECLARATIONS +*/ +#if defined (MSDOS_STYLE_PATH) +extern const char *const PathDelimiters; +#endif +extern char *CurrentDirectory; +typedef int errorSelection; +enum eErrorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; + + +/* +* FUNCTION PROTOTYPES +*/ +extern void setExecutableName (const char *const path); +extern const char *getExecutableName (void); +extern void error (const errorSelection selection, const char *const format, ...) PRINTF (2, 3); + +/* Memory allocation functions */ +#ifdef NEED_PROTO_MALLOC +extern void *malloc (size_t); +extern void *realloc (void *ptr, size_t); +#endif +extern void *eMalloc (const size_t size); +extern void *eCalloc (const size_t count, const size_t size); +extern void *eRealloc (void *const ptr, const size_t size); +extern void eFree (void *const ptr); +extern void toLowerString (char* str); +extern void toUpperString (char* str); +extern char* newLowerString (const char* str); +extern char* newUpperString (const char* str); + +/* File system functions */ +extern boolean doesFileExist (const char *const fileName); +extern boolean isRecursiveLink (const char* const dirName); +extern boolean isSameFile (const char *const name1, const char *const name2); +extern const char *baseFilename (const char *const filePath); +extern boolean isAbsolutePath (const char *const path); +extern vString *combinePathAndFile (const char *const path, const char *const file); +extern char* absoluteFilename (const char *file); +extern char* absoluteDirname (char *file); +extern char* relativeFilename (const char *file, const char *dir); +extern FILE *tempFile (const char *const mode, char **const pName); +extern void processExcludeOption (const char *const option, const char *const parameter); +extern const char *fileExtension (const char *const fileName); +extern char* eStrdup (const char* str); +extern long unsigned int getFileSize (const char *const name); +extern boolean isExecutable (const char *const name); + +#ifndef HAVE_STRICMP +extern int stricmp (const char *s1, const char *s2); +#endif +#ifndef HAVE_STRNICMP +extern int strnicmp (const char *s1, const char *s2, size_t n); +#endif +#ifndef HAVE_STRSTR +extern char* strstr (const char *str, const char *substr); +#endif + #endif /* CTAGS_MAIN_ROUTINES_H */ /* vi:set tabstop=4 shiftwidth=4: */ Modified: ctags/main/sort.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -22,7 +22,7 @@ #include <glib/gstdio.h> #include "entry.h" -#include "main.h" +#include "routines.h" #include "options.h" #include "read.h" #include "sort.h" Modified: ctags/main/strlist.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -18,7 +18,7 @@ #endif #include <glib/gstdio.h> -#include "main.h" +#include "routines.h" #include "read.h" #include "strlist.h" Modified: ctags/main/vstring.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -17,7 +17,7 @@ #include <string.h> #include <ctype.h> -#include "main.h" +#include "routines.h" #include "vstring.h" /* Modified: ctags/parsers/asm.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -20,7 +20,6 @@ #include "parse.h" #include "read.h" #include "routines.h" -#include "main.h" #include "vstring.h" /* Modified: ctags/parsers/c.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,6 @@ #include "entry.h" #include "lcpp.h" #include "keyword.h" -#include "main.h" #include "options.h" #include "parse.h" #include "read.h" Modified: ctags/parsers/fortran.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -22,7 +22,6 @@ #include "mio.h" #include "entry.h" #include "keyword.h" -#include "main.h" #include "options.h" #include "parse.h" #include "read.h" Modified: ctags/parsers/jscript.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -30,7 +30,6 @@ #include "keyword.h" #include "parse.h" #include "read.h" -#include "main.h" #include "routines.h" #include "vstring.h" Modified: ctags/parsers/json.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -18,7 +18,6 @@ #include <string.h> #include "debug.h" -#include "main.h" #include "entry.h" #include "keyword.h" #include "parse.h" Modified: ctags/parsers/matlab.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -18,9 +18,9 @@ #include <string.h> #include "parse.h" +#include "routines.h" #include "read.h" #include "vstring.h" -#include "routines.h" /* * DATA DEFINITIONS Modified: ctags/parsers/pascal.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -18,7 +18,6 @@ #include "entry.h" #include "parse.h" #include "read.h" -#include "main.h" #include "routines.h" #include "vstring.h" Modified: ctags/parsers/perl.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -19,7 +19,6 @@ #include "entry.h" #include "options.h" #include "read.h" -#include "main.h" #include "routines.h" #include "vstring.h" #include "xtag.h" Modified: ctags/parsers/php.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -12,7 +12,6 @@ * INCLUDE FILES */ #include "general.h" /* must always come first */ -#include "main.h" #include "parse.h" #include "read.h" #include "vstring.h" Modified: ctags/parsers/sh.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -17,7 +17,6 @@ #include "parse.h" #include "read.h" -#include "main.h" #include "routines.h" #include "vstring.h" #include "xtag.h" Modified: ctags/parsers/sql.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -23,7 +23,6 @@ #include "entry.h" #include "keyword.h" #include "parse.h" -#include "main.h" #include "read.h" #include "routines.h" #include "vstring.h" -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
Older →
Jump to page:
1
2
3
4
5
6
7
8
Results per page:
10
25
50
100
200