From 7933658107276f9d5491f8736a743cf8f8bbd5f2 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 2 Apr 2010 14:47:58 +0000 Subject: Updated to following packages: mesa-7.8 --- mesalib/src/mesa/shader/slang/library/gc_to_bin.c | 85 ----------------------- 1 file changed, 85 deletions(-) delete mode 100644 mesalib/src/mesa/shader/slang/library/gc_to_bin.c (limited to 'mesalib/src/mesa/shader/slang/library/gc_to_bin.c') diff --git a/mesalib/src/mesa/shader/slang/library/gc_to_bin.c b/mesalib/src/mesa/shader/slang/library/gc_to_bin.c deleted file mode 100644 index 8aef7b541..000000000 --- a/mesalib/src/mesa/shader/slang/library/gc_to_bin.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "../../grammar/grammar_crt.h" -#include "../../grammar/grammar_crt.c" -#include -#include - -static const char *slang_shader_syn = -#include "slang_shader_syn.h" -; - -static int 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 1; - 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 1; - } - - f = fopen (out, "w"); - fprintf (f, "\n"); - fprintf (f, "/* DO NOT EDIT - THIS FILE IS 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); - return 0; -} - -int main (int argc, char *argv[]) -{ - grammar id; - - id = grammar_load_from_text ((const byte *) slang_shader_syn); - if (id == 0) { - fprintf(stderr, "Error loading grammar from text\n"); - return 1; - } - grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); - grammar_set_reg8 (id, (const byte *) "shader_type", atoi (argv[1])); - if (gc_to_bin (id, argv[2], argv[3])) { - fprintf(stderr, "Error in gc_to_bin %s %s\n", argv[2], argv[3]); - grammar_destroy (id); - return 1; - } - grammar_destroy (id); - return 0; -} - -- cgit v1.2.3