summaryrefslogtreecommitdiff
path: root/src/mesa/shader/grammar_mesa.c
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2004-03-03 18:10:40 +0000
committerMichal Krol <mjkrol@gmail.org>2004-03-03 18:10:40 +0000
commit0e7b1d88118621c34f6a7b64abf3ff4b2ff20679 (patch)
treeb5f28d142f46178c30b46f1d1e0e9822306eef55 /src/mesa/shader/grammar_mesa.c
parente05d4fbf0f9382933ee7b817930f4377ad87b742 (diff)
Grammar package supporting 8-bit registers.
TODO: - add checking for duplicate symbols (or is it done already?) - move all the statics (grammar objects list and last error message) to the GL context state; I think simple pointer initialized in a first call to ProgramString() is sufficent. - apply an optimized version of match() - this will be needed for glslang compiler.
Diffstat (limited to 'src/mesa/shader/grammar_mesa.c')
-rw-r--r--src/mesa/shader/grammar_mesa.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/mesa/shader/grammar_mesa.c b/src/mesa/shader/grammar_mesa.c
new file mode 100644
index 0000000000..b9cb17fc38
--- /dev/null
+++ b/src/mesa/shader/grammar_mesa.c
@@ -0,0 +1,57 @@
+#include "grammar_mesa.h"
+
+#define GRAMMAR_PORT_BUILD 1
+#include "grammar.c"
+#undef GRAMMAR_PORT_BUILD
+
+
+void grammar_alloc_free (void *ptr)
+{
+ _mesa_free (ptr);
+}
+
+void *grammar_alloc_malloc (unsigned int size)
+{
+ return _mesa_malloc (size);
+}
+
+void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
+{
+ return _mesa_realloc (ptr, old_size, size);
+}
+
+void *grammar_memory_copy (void *dst, const void * src, unsigned int size)
+{
+ return _mesa_memcpy (dst, src, size);
+}
+
+int grammar_string_compare (const byte *str1, const byte *str2)
+{
+ return _mesa_strcmp ((const char *) str1, (const char *) str2);
+}
+
+int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n)
+{
+ return _mesa_strncmp ((const char *) str1, (const char *) str2, n);
+}
+
+byte *grammar_string_copy (byte *dst, const byte *src)
+{
+ return (byte *) _mesa_strcpy ((char *) dst, (const char *) src);
+}
+
+byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n)
+{
+ return (byte *) _mesa_strncpy ((char *) dst, (const char *) src, n);
+}
+
+byte *grammar_string_duplicate (const byte *src)
+{
+ return (byte *) _mesa_strdup ((const char *) src);
+}
+
+unsigned int grammar_string_length (const byte *str)
+{
+ return _mesa_strlen ((const char *) str);
+}
+