diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2014-06-28 10:15:18 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2014-06-29 00:52:54 +0400 |
commit | 4d8dbd98b234be8b2c4ada93ad310662eb97d919 (patch) | |
tree | db9953e8b0bbe7da5ce33480bff86cf9abe00cb1 | |
parent | 6ebe3bcd2ed116ae67b672d8281de093f04b30e0 (diff) | |
download | nasm-4d8dbd98b234be8b2c4ada93ad310662eb97d919.tar.gz |
preproc: Convert tabs to spaces
No func cnages
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | preproc.c | 128 |
1 files changed, 64 insertions, 64 deletions
@@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2012 The NASM Authors - All Rights Reserved + * Copyright 1996-2014 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -503,10 +503,10 @@ static Token *reverse_tokens(Token *t) Token *next; while (t) { - next = t->next; - t->next = prev; - prev = t; - t = next; + next = t->next; + t->next = prev; + prev = t; + t = next; } return prev; @@ -960,24 +960,24 @@ static Token *tokenize(char *line) type = TOK_PREPROC_QQ; /* %?? */ p++; } - } else if (*p == '!') { - type = TOK_PREPROC_ID; - p++; - if (isidchar(*p)) { - do { - p++; - } - while (isidchar(*p)); - } else if (*p == '\'' || *p == '\"' || *p == '`') { - p = nasm_skip_string(p); - if (*p) - p++; - else - error(ERR_NONFATAL|ERR_PASS1, "unterminated %! string"); - } else { - /* %! without string or identifier */ - type = TOK_OTHER; /* Legacy behavior... */ - } + } else if (*p == '!') { + type = TOK_PREPROC_ID; + p++; + if (isidchar(*p)) { + do { + p++; + } + while (isidchar(*p)); + } else if (*p == '\'' || *p == '\"' || *p == '`') { + p = nasm_skip_string(p); + if (*p) + p++; + else + error(ERR_NONFATAL|ERR_PASS1, "unterminated %! string"); + } else { + /* %! without string or identifier */ + type = TOK_OTHER; /* Legacy behavior... */ + } } else if (isidchar(*p) || ((*p == '!' || *p == '%' || *p == '$') && isidchar(p[1]))) { @@ -1246,31 +1246,31 @@ static char *detoken(Token * tlist, bool expand_locals) list_for_each(t, tlist) { if (t->type == TOK_PREPROC_ID && t->text[1] == '!') { - char *v; - char *q = t->text; - - v = t->text + 2; - if (*v == '\'' || *v == '\"' || *v == '`') { - size_t len = nasm_unquote(v, NULL); - size_t clen = strlen(v); - - if (len != clen) { - error(ERR_NONFATAL | ERR_PASS1, - "NUL character in %! string"); - v = NULL; - } - } - - if (v) { - char *p = getenv(v); - if (!p) { - error(ERR_NONFATAL | ERR_PASS1, - "nonexistent environment variable `%s'", v); - p = ""; - } - t->text = nasm_strdup(p); - } - nasm_free(q); + char *v; + char *q = t->text; + + v = t->text + 2; + if (*v == '\'' || *v == '\"' || *v == '`') { + size_t len = nasm_unquote(v, NULL); + size_t clen = strlen(v); + + if (len != clen) { + error(ERR_NONFATAL | ERR_PASS1, + "NUL character in %! string"); + v = NULL; + } + } + + if (v) { + char *p = getenv(v); + if (!p) { + error(ERR_NONFATAL | ERR_PASS1, + "nonexistent environment variable `%s'", v); + p = ""; + } + t->text = nasm_strdup(p); + } + nasm_free(q); } /* Expand local macros here and not during preprocessing */ @@ -1723,26 +1723,26 @@ static bool if_condition(Token * tline, enum preproc_token ct) break; case PPC_IFENV: - tline = expand_smacro(tline); + tline = expand_smacro(tline); j = false; /* have we matched yet? */ while (tline) { skip_white_(tline); if (!tline || (tline->type != TOK_ID && - tline->type != TOK_STRING && + tline->type != TOK_STRING && (tline->type != TOK_PREPROC_ID || - tline->text[1] != '!'))) { + tline->text[1] != '!'))) { error(ERR_NONFATAL, "`%s' expects environment variable names", - pp_directives[ct]); + pp_directives[ct]); goto fail; } - p = tline->text; - if (tline->type == TOK_PREPROC_ID) - p += 2; /* Skip leading %! */ - if (*p == '\'' || *p == '\"' || *p == '`') - nasm_unquote_cstr(p, ct); - if (getenv(p)) - j = true; + p = tline->text; + if (tline->type == TOK_PREPROC_ID) + p += 2; /* Skip leading %! */ + if (*p == '\'' || *p == '\"' || *p == '`') + nasm_unquote_cstr(p, ct); + if (getenv(p)) + j = true; tline = tline->next; } break; @@ -3177,11 +3177,11 @@ issue_error: return DIRECTIVE_FOUND; } - /* - * Convert the string to a token stream. Note that smacros - * are stored with the token stream reversed, so we have to - * reverse the output of tokenize(). - */ + /* + * Convert the string to a token stream. Note that smacros + * are stored with the token stream reversed, so we have to + * reverse the output of tokenize(). + */ nasm_unquote_cstr(t->text, i); macro_start = reverse_tokens(tokenize(t->text)); |