From 8defce2cf1afa9933208ee001ddb8990c5d4eee0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 16 Jan 2006 12:27:22 +0000 Subject: remove slang_*_gc.h files; rename slang_*_gc_bin.h files to slang_*_gc.h ones; store built-in library code in a precompiled form only; --- src/mesa/shader/slang/library/gc_to_bin.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/mesa/shader/slang/library/gc_to_bin.c') diff --git a/src/mesa/shader/slang/library/gc_to_bin.c b/src/mesa/shader/slang/library/gc_to_bin.c index 4bd2114427..5f176257a9 100755 --- a/src/mesa/shader/slang/library/gc_to_bin.c +++ b/src/mesa/shader/slang/library/gc_to_bin.c @@ -12,6 +12,8 @@ static void gc_to_bin (grammar id, const char *in, const char *out) byte *source, *prod; unsigned int size, i, line = 0; + printf ("Precompiling %s\n", in); + f = fopen (in, "r"); if (f == NULL) return; @@ -29,6 +31,10 @@ static void gc_to_bin (grammar id, const char *in, const char *out) } f = fopen (out, "w"); + fprintf (f, "\n"); + fprintf (f, "/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */\n"); + fprintf (f, "/* %s */\n", in); + fprintf (f, "\n"); for (i = 0; i < size; i++) { unsigned int a; @@ -40,7 +46,7 @@ static void gc_to_bin (grammar id, const char *in, const char *out) a = 3; if (i < size - 1) a++; - if (line + a > 100) + if (line + a >= 100) { fprintf (f, "\n"); line = 0; @@ -50,6 +56,7 @@ static void gc_to_bin (grammar id, const char *in, const char *out) if (i < size - 1) fprintf (f, ","); } + fprintf (f, "\n"); fclose (f); grammar_alloc_free (prod); } @@ -65,12 +72,12 @@ int main () grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); grammar_set_reg8 (id, (const byte *) "shader_type", 1); - gc_to_bin (id, "slang_core.gc", "slang_core_gc_bin.h"); - gc_to_bin (id, "slang_common_builtin.gc", "slang_common_builtin_gc_bin.h"); - gc_to_bin (id, "slang_fragment_builtin.gc", "slang_fragment_builtin_gc_bin.h"); + gc_to_bin (id, "slang_core.gc", "slang_core_gc.h"); + gc_to_bin (id, "slang_common_builtin.gc", "slang_common_builtin_gc.h"); + gc_to_bin (id, "slang_fragment_builtin.gc", "slang_fragment_builtin_gc.h"); grammar_set_reg8 (id, (const byte *) "shader_type", 2); - gc_to_bin (id, "slang_vertex_builtin.gc", "slang_vertex_builtin_gc_bin.h"); + gc_to_bin (id, "slang_vertex_builtin.gc", "slang_vertex_builtin_gc.h"); grammar_destroy (id); -- cgit v1.2.3