mojoshader_preprocessor.c
changeset 640 813a139a4a5a
parent 639 1b549be9ab59
child 641 2002d0399ef2
--- a/mojoshader_preprocessor.c	Mon Feb 16 22:23:51 2009 -0500
+++ b/mojoshader_preprocessor.c	Tue Feb 17 00:38:15 2009 -0500
@@ -543,7 +543,7 @@
 
 
 static int push_source(Context *ctx, const char *fname, const char *source,
-                       unsigned int srclen, int included)
+                       unsigned int srclen, unsigned int linenum, int included)
 {
     IncludeState *state = (IncludeState *) Malloc(ctx, sizeof (IncludeState));
     if (state == NULL)
@@ -565,7 +565,7 @@
     state->source = source;
     state->token = source;
     state->bytes_left = srclen;
-    state->line = 1;
+    state->line = linenum;
     state->next = ctx->include_stack;
 
     ctx->include_stack = state;
@@ -632,7 +632,7 @@
         } // if
     } // for
 
-    if ((okay) && (!push_source(ctx, fname, source, sourcelen, 0)))
+    if ((okay) && (!push_source(ctx, fname, source, sourcelen, 1, 0)))
         okay = 0;
 
     if (!okay)
@@ -747,7 +747,7 @@
         return;
     } // if
 
-    if (!push_source(ctx, filename, newdata, newbytes, 1))
+    if (!push_source(ctx, filename, newdata, newbytes, 1, 1))
     {
         assert(ctx->out_of_memory);
         ctx->close_callback(newdata, ctx->malloc, ctx->free, ctx->malloc_data);