diff options
author | Michal Krol <michal@vmware.com> | 2009-09-24 08:43:05 +0200 |
---|---|---|
committer | Michal Krol <michal@vmware.com> | 2009-09-24 08:43:05 +0200 |
commit | 9a1447d449209635e481c7f9bd02084864e17419 (patch) | |
tree | 8b7d0383cb0cd96f4c0cf15e53a12cd1577b103b /src/glsl/pp/sl_pp_line.c | |
parent | 8212e4d9fabb0c441575975c12d656364baba6fe (diff) |
glsl/pp: Store both line number and file index in a single token.
Diffstat (limited to 'src/glsl/pp/sl_pp_line.c')
-rw-r--r-- | src/glsl/pp/sl_pp_line.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/glsl/pp/sl_pp_line.c b/src/glsl/pp/sl_pp_line.c index e8f751003a..41ddaf6ba2 100644 --- a/src/glsl/pp/sl_pp_line.c +++ b/src/glsl/pp/sl_pp_line.c @@ -42,6 +42,7 @@ sl_pp_process_line(struct sl_pp_context *context, int line_number = -1; int file_number = -1; unsigned int line; + unsigned int file; memset(&state, 0, sizeof(state)); for (i = first; i < last;) { @@ -94,37 +95,25 @@ sl_pp_process_line(struct sl_pp_context *context, free(state.out); line = atoi(sl_pp_context_cstr(context, line_number)); + if (file_number != -1) { + file = atoi(sl_pp_context_cstr(context, file_number)); + } else { + file = context->file; + } - if (context->line != line) { + if (context->line != line || context->file != file) { struct sl_pp_token_info ti; ti.token = SL_PP_LINE; - ti.data.line = line; + ti.data.line.lineno = line; + ti.data.line.fileno = file; if (sl_pp_process_out(pstate, &ti)) { strcpy(context->error_msg, "out of memory"); return -1; } context->line = line; - } - - if (file_number != -1) { - unsigned int file; - - file = atoi(sl_pp_context_cstr(context, file_number)); - - if (context->file != file) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_FILE; - ti.data.file = file; - if (sl_pp_process_out(pstate, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - context->file = file; - } + context->file = file; } return 0; |