Mesa (master): glcpp: Allow standalone glcpp to accept a filename as first argument.
Carl Worth
cworth at kemper.freedesktop.org
Wed Aug 18 06:42:14 UTC 2010
Module: Mesa
Branch: master
Commit: 97638aa77c509cd37dea499202d31357926a0e2a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=97638aa77c509cd37dea499202d31357926a0e2a
Author: Carl Worth <cworth at cworth.org>
Date: Tue Aug 17 23:13:56 2010 -0700
glcpp: Allow standalone glcpp to accept a filename as first argument.
This is useful for debugging the preprocessor.
---
src/glsl/glcpp/glcpp.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index a245cb5..e49a1df 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -69,12 +69,20 @@ load_text_file(void *ctx, const char *file_name)
}
int
-main (void)
+main (int argc, char *argv[])
{
+ char *filename = NULL;
void *ctx = talloc(NULL, void*);
- const char *shader = load_text_file(ctx, NULL);
char *info_log = talloc_strdup(ctx, "");
- int ret = preprocess(ctx, &shader, &info_log, NULL);
+ const char *shader;
+ int ret;
+
+ if (argc) {
+ filename = argv[1];
+ }
+
+ shader = load_text_file(ctx, filename);
+ ret = preprocess(ctx, &shader, &info_log, NULL);
printf("%s", shader);
fprintf(stderr, "%s", info_log);
More information about the mesa-commit
mailing list