Skip to content

Commit

Permalink
Rename fileUngetc() to ungetcToInputFile()
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Jul 30, 2016
1 parent acdc440 commit 357e4fe
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 79 deletions.
36 changes: 18 additions & 18 deletions ctags/main/get.c
Expand Up @@ -183,7 +183,7 @@ static boolean readDirective (int c, char *const name, unsigned int maxLength)
c = getcFromInputFile ();
if (c == EOF || ! isalpha (c))
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
}
Expand All @@ -205,7 +205,7 @@ static void readIdentifier (int c, vString *const name)
vStringPut (name, c);
c = getcFromInputFile ();
} while (c != EOF && isident (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (name);
}

Expand Down Expand Up @@ -335,7 +335,7 @@ static void directiveDefine (const int c)
{
readIdentifier (c, Cpp.directive.name);
nc = getcFromInputFile ();
fileUngetc (nc);
ungetcToInputFile (nc);
parameterized = (boolean) (nc == '(');
if (! isIgnore ())
makeDefineTag (vStringValue (Cpp.directive.name), parameterized);
Expand Down Expand Up @@ -445,7 +445,7 @@ static Comment isComment (void)
comment = COMMENT_D;
else
{
fileUngetc (next);
ungetcToInputFile (next);
comment = COMMENT_NONE;
}
return comment;
Expand Down Expand Up @@ -550,7 +550,7 @@ static int skipToEndOfCxxRawLiteralString (void)

if (c != '(' && ! isCxxRawLiteralDelimiterChar (c))
{
fileUngetc (c);
ungetcToInputFile (c);
c = skipToEndOfString (FALSE);
}
else
Expand Down Expand Up @@ -578,7 +578,7 @@ static int skipToEndOfCxxRawLiteralString (void)
if (i == delimLen && c == DOUBLE_QUOTE)
break;
else
fileUngetc (c);
ungetcToInputFile (c);
}
}
while ((c = getcFromInputFile ()) != EOF);
Expand All @@ -605,14 +605,14 @@ static int skipToEndOfChar (void)
break;
else if (c == NEWLINE)
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
else if (count == 1 && strchr ("DHOB", toupper (c)) != NULL)
veraBase = c;
else if (veraBase != '\0' && ! isalnum (c))
{
fileUngetc (c);
ungetcToInputFile (c);
break;
}
}
Expand Down Expand Up @@ -687,7 +687,7 @@ extern int cppGetc (void)
{
c = skipOverCplusComment ();
if (c == NEWLINE)
fileUngetc (c);
ungetcToInputFile (c);
}
else if (comment == COMMENT_D)
c = skipOverDComment ();
Expand All @@ -703,15 +703,15 @@ extern int cppGetc (void)
if (next == NEWLINE)
continue;
else
fileUngetc (next);
ungetcToInputFile (next);
break;
}

case '?':
{
int next = getcFromInputFile ();
if (next != '?')
fileUngetc (next);
ungetcToInputFile (next);
else
{
next = getcFromInputFile ();
Expand All @@ -727,8 +727,8 @@ extern int cppGetc (void)
case '-': c = '~'; break;
case '=': c = '#'; goto process;
default:
fileUngetc ('?');
fileUngetc (next);
ungetcToInputFile ('?');
ungetcToInputFile (next);
break;
}
}
Expand All @@ -745,7 +745,7 @@ extern int cppGetc (void)
{
case ':': c = '['; break;
case '%': c = '{'; break;
default: fileUngetc (next);
default: ungetcToInputFile (next);
}
goto enter;
}
Expand All @@ -755,7 +755,7 @@ extern int cppGetc (void)
if (next == '>')
c = ']';
else
fileUngetc (next);
ungetcToInputFile (next);
goto enter;
}
case '%':
Expand All @@ -765,7 +765,7 @@ extern int cppGetc (void)
{
case '>': c = '}'; break;
case ':': c = '#'; goto process;
default: fileUngetc (next);
default: ungetcToInputFile (next);
}
goto enter;
}
Expand All @@ -781,7 +781,7 @@ extern int cppGetc (void)
break;
}
else
fileUngetc (next);
ungetcToInputFile (next);
}
else if (c == 'R' && Cpp.hasCxxRawLiteralStrings)
{
Expand Down Expand Up @@ -812,7 +812,7 @@ extern int cppGetc (void)
{
int next = getcFromInputFile ();
if (next != DOUBLE_QUOTE)
fileUngetc (next);
ungetcToInputFile (next);
else
{
Cpp.directive.accept = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion ctags/main/read.c
Expand Up @@ -416,7 +416,7 @@ static int iFileGetc (void)
return c;
}

extern void fileUngetc (int c)
extern void ungetcToInputFile (int c)
{
const size_t len = sizeof File.ungetchBuf / sizeof File.ungetchBuf[0];

Expand Down
2 changes: 1 addition & 1 deletion ctags/main/read.h
Expand Up @@ -109,7 +109,7 @@ extern void fileClose (void);
extern int getcFromInputFile (void);
extern int fileGetNthPrevC (unsigned int nth, int def);
extern int fileSkipToCharacter (int c);
extern void fileUngetc (int c);
extern void ungetcToInputFile (int c);
extern const unsigned char *fileReadLine (void);
extern char *readLine (vString *const vLine, MIO *const mio);
extern char *readSourceLine (vString *const vLine, MIOPos location, long *const pSeekValue);
Expand Down
4 changes: 2 additions & 2 deletions ctags/parsers/css.c
Expand Up @@ -62,7 +62,7 @@ static void parseSelector (vString *const string, const int firstChar)
vStringPut (string, (char) c);
c = getcFromInputFile ();
} while (isSelectorChar (c));
fileUngetc (c);
ungetcToInputFile (c);
vStringTerminate (string);
}

Expand Down Expand Up @@ -106,7 +106,7 @@ static void readToken (tokenInfo *const token)
int d = getcFromInputFile ();
if (d != '*')
{
fileUngetc (d);
ungetcToInputFile (d);
vStringPut (token->string, c);
token->type = c;
}
Expand Down
6 changes: 3 additions & 3 deletions ctags/parsers/fortran.c
Expand Up @@ -648,7 +648,7 @@ static int getFixedFormChar (void)
if (c2 == '\n')
longjmp (Exception, (int) ExceptionFixedFormat);
else
fileUngetc (c2);
ungetcToInputFile (c2);
}
}
while (Column == 0)
Expand Down Expand Up @@ -691,7 +691,7 @@ static int getFixedFormChar (void)
Column = 0;
else if (Column > 6)
{
fileUngetc (c);
ungetcToInputFile (c);
c = ' ';
}
break;
Expand Down Expand Up @@ -734,7 +734,7 @@ static int getFreeFormChar (boolean inComment)
advanceLine = TRUE;
else
{
fileUngetc (c);
ungetcToInputFile (c);
c = '&';
}
}
Expand Down
12 changes: 6 additions & 6 deletions ctags/parsers/go.c
Expand Up @@ -203,7 +203,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
c = getcFromInputFile ();
} while (isIdentChar (c));
vStringTerminate (string);
fileUngetc (c); /* always unget, LF might add a semicolon */
ungetcToInputFile (c); /* always unget, LF might add a semicolon */
}

static void readToken (tokenInfo *const token)
Expand Down Expand Up @@ -264,7 +264,7 @@ static void readToken (tokenInfo *const token)
* continue through the next
* newline. A line comment acts
* like a newline. */
fileUngetc ('\n');
ungetcToInputFile ('\n');
goto getNextChar;
case '*':
do
Expand All @@ -282,14 +282,14 @@ static void readToken (tokenInfo *const token)
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
} while (c != EOF && c != '\0');

fileUngetc (hasNewline ? '\n' : ' ');
ungetcToInputFile (hasNewline ? '\n' : ' ');
goto getNextChar;
default:
token->type = TOKEN_OTHER;
fileUngetc (d);
ungetcToInputFile (d);
break;
}
}
Expand All @@ -311,7 +311,7 @@ static void readToken (tokenInfo *const token)
token->type = TOKEN_LEFT_ARROW;
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_OTHER;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ctags/parsers/haskell.c
Expand Up @@ -81,7 +81,7 @@ static int get_next_char(void)
nxt = getcFromInputFile();
if (nxt == EOF)
return c;
fileUngetc(nxt);
ungetcToInputFile(nxt);

if (c == '-' && nxt == '-') {
skip_rest_of_line();
Expand Down Expand Up @@ -127,7 +127,7 @@ static int get_token(char *token, int n)
if (c == EOF)
return 0;
if (i != n) {
fileUngetc(c);
ungetcToInputFile(c);
return 1;
} else {
return 0;
Expand Down
20 changes: 10 additions & 10 deletions ctags/parsers/jscript.c
Expand Up @@ -357,7 +357,7 @@ static void parseString (vString *const string, const int delimiter)
{
c = getcFromInputFile();
if (c != '\n')
fileUngetc (c);
ungetcToInputFile (c);
}
}
else if (c == delimiter)
Expand All @@ -368,7 +368,7 @@ static void parseString (vString *const string, const int delimiter)
end = TRUE;
/* we don't want to eat the newline itself to let the automatic
* semicolon insertion code kick in */
fileUngetc (c);
ungetcToInputFile (c);
}
else
vStringPut (string, c);
Expand All @@ -390,7 +390,7 @@ static void parseRegExp (void)
{
c = getcFromInputFile ();
} while (isalpha (c));
fileUngetc (c);
ungetcToInputFile (c);
break;
}
else if (c == '\\')
Expand All @@ -415,7 +415,7 @@ static void parseIdentifier (vString *const string, const int firstChar)
c = getcFromInputFile ();
} while (isIdentChar (c));
vStringTerminate (string);
fileUngetc (c); /* unget non-identifier character */
ungetcToInputFile (c); /* unget non-identifier character */
}

static keywordId analyzeToken (vString *const name)
Expand Down Expand Up @@ -480,7 +480,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
token->type = TOKEN_POSTFIX_OPERATOR;
else
{
fileUngetc (d);
ungetcToInputFile (d);
token->type = TOKEN_BINARY_OPERATOR;
}
break;
Expand Down Expand Up @@ -547,7 +547,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
case '\\':
c = getcFromInputFile ();
if (c != '\\' && c != '"' && !isspace (c))
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_CHARACTER;
token->lineNumber = getSourceLineNumber ();
token->filePosition = getInputFilePosition ();
Expand All @@ -559,7 +559,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
if ( (d != '*') && /* is this the start of a comment? */
(d != '/') ) /* is a one line comment? */
{
fileUngetc (d);
ungetcToInputFile (d);
switch (LastTokenType)
{
case TOKEN_CHARACTER:
Expand Down Expand Up @@ -592,7 +592,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
if (c == '/')
break;
else
fileUngetc (c);
ungetcToInputFile (c);
} while (c != EOF && c != '\0');
goto getNextChar;
}
Expand All @@ -601,7 +601,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
skipToCharacter ('\n');
/* if we care about newlines, put it back so it is seen */
if (include_newlines)
fileUngetc ('\n');
ungetcToInputFile ('\n');
goto getNextChar;
}
}
Expand All @@ -614,7 +614,7 @@ static void readTokenFull (tokenInfo *const token, boolean include_newlines, vSt
token->type = TOKEN_UNDEFINED;
else if ((c = getcFromInputFile ()) != '!')
{
fileUngetc (c);
ungetcToInputFile (c);
token->type = TOKEN_UNDEFINED;
}
else
Expand Down
2 changes: 1 addition & 1 deletion ctags/parsers/json.c
Expand Up @@ -200,7 +200,7 @@ static void readTokenFull (tokenInfo *const token,
}
while (c != EOF && isIdentChar (c));
vStringTerminate (token->string);
fileUngetc (c);
ungetcToInputFile (c);
switch (lookupKeyword (vStringValue (token->string), Lang_json))
{
case KEYWORD_true: token->type = TOKEN_TRUE; break;
Expand Down

0 comments on commit 357e4fe

Please sign in to comment.