summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library/gc_to_bin.c
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2006-04-18 10:47:19 +0000
committerMichal Krol <mjkrol@gmail.org>2006-04-18 10:47:19 +0000
commit2f8496b5655cbd66711745fcfd87e0e528c50229 (patch)
tree8f094bff1a3bd6070af345d090435f70ad0c9cdc /src/mesa/shader/slang/library/gc_to_bin.c
parentd55de658b559437272a88a5e8743304996044fff (diff)
Remove carriage-return chars *ONLY*.
Diffstat (limited to 'src/mesa/shader/slang/library/gc_to_bin.c')
-rwxr-xr-xsrc/mesa/shader/slang/library/gc_to_bin.c172
1 files changed, 86 insertions, 86 deletions
diff --git a/src/mesa/shader/slang/library/gc_to_bin.c b/src/mesa/shader/slang/library/gc_to_bin.c
index 5f176257a9..749c57a032 100755
--- a/src/mesa/shader/slang/library/gc_to_bin.c
+++ b/src/mesa/shader/slang/library/gc_to_bin.c
@@ -1,86 +1,86 @@
-#include "../../grammar/grammar_crt.h"
-#include "../../grammar/grammar_crt.c"
-#include <stdio.h>
-
-static const char *slang_shader_syn =
-#include "slang_shader_syn.h"
-;
-
-static void gc_to_bin (grammar id, const char *in, const char *out)
-{
- FILE *f;
- byte *source, *prod;
- unsigned int size, i, line = 0;
-
- printf ("Precompiling %s\n", in);
-
- f = fopen (in, "r");
- if (f == NULL)
- return;
- fseek (f, 0, SEEK_END);
- size = ftell (f);
- fseek (f, 0, SEEK_SET);
- source = (byte *) grammar_alloc_malloc (size + 1);
- source[fread (source, 1, size, f)] = '\0';
- fclose (f);
-
- if (!grammar_fast_check (id, source, &prod, &size, 65536))
- {
- grammar_alloc_free (source);
- return;
- }
-
- 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;
- if (prod[i] < 10)
- a = 1;
- else if (prod[i] < 100)
- a = 2;
- else
- a = 3;
- if (i < size - 1)
- a++;
- if (line + a >= 100)
- {
- fprintf (f, "\n");
- line = 0;
- }
- line += a;
- fprintf (f, "%d", prod[i]);
- if (i < size - 1)
- fprintf (f, ",");
- }
- fprintf (f, "\n");
- fclose (f);
- grammar_alloc_free (prod);
-}
-
-int main ()
-{
- grammar id;
-
- id = grammar_load_from_text ((const byte *) slang_shader_syn);
- if (id == 0)
- return 1;
-
- 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.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.h");
-
- grammar_destroy (id);
-
- return 0;
-}
-
+#include "../../grammar/grammar_crt.h"
+#include "../../grammar/grammar_crt.c"
+#include <stdio.h>
+
+static const char *slang_shader_syn =
+#include "slang_shader_syn.h"
+;
+
+static void gc_to_bin (grammar id, const char *in, const char *out)
+{
+ FILE *f;
+ byte *source, *prod;
+ unsigned int size, i, line = 0;
+
+ printf ("Precompiling %s\n", in);
+
+ f = fopen (in, "r");
+ if (f == NULL)
+ return;
+ fseek (f, 0, SEEK_END);
+ size = ftell (f);
+ fseek (f, 0, SEEK_SET);
+ source = (byte *) grammar_alloc_malloc (size + 1);
+ source[fread (source, 1, size, f)] = '\0';
+ fclose (f);
+
+ if (!grammar_fast_check (id, source, &prod, &size, 65536))
+ {
+ grammar_alloc_free (source);
+ return;
+ }
+
+ 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;
+ if (prod[i] < 10)
+ a = 1;
+ else if (prod[i] < 100)
+ a = 2;
+ else
+ a = 3;
+ if (i < size - 1)
+ a++;
+ if (line + a >= 100)
+ {
+ fprintf (f, "\n");
+ line = 0;
+ }
+ line += a;
+ fprintf (f, "%d", prod[i]);
+ if (i < size - 1)
+ fprintf (f, ",");
+ }
+ fprintf (f, "\n");
+ fclose (f);
+ grammar_alloc_free (prod);
+}
+
+int main ()
+{
+ grammar id;
+
+ id = grammar_load_from_text ((const byte *) slang_shader_syn);
+ if (id == 0)
+ return 1;
+
+ 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.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.h");
+
+ grammar_destroy (id);
+
+ return 0;
+}
+