glcpp: Allow standalone glcpp to accept a filename as first argument.
This is useful for debugging the preprocessor.
This commit is contained in:
@@ -69,12 +69,20 @@ load_text_file(void *ctx, const char *file_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
char *filename = NULL;
|
||||||
void *ctx = talloc(NULL, void*);
|
void *ctx = talloc(NULL, void*);
|
||||||
const char *shader = load_text_file(ctx, NULL);
|
|
||||||
char *info_log = talloc_strdup(ctx, "");
|
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);
|
printf("%s", shader);
|
||||||
fprintf(stderr, "%s", info_log);
|
fprintf(stderr, "%s", info_log);
|
||||||
|
Reference in New Issue
Block a user