diff options
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 43 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_utility.c | 73 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_utility.h | 46 | ||||
-rw-r--r-- | src/mesa/sources | 3 |
4 files changed, 123 insertions, 42 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 5ecef00c1d0..d49d104323c 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -29,8 +29,9 @@ */ #include "imports.h" -#include "slang_compile.h" #include "grammar_mesa.h" +#include "slang_utility.h" +#include "slang_compile.h" #include "slang_preprocess.h" /* @@ -40,46 +41,6 @@ may be accepted resulting in undefined behaviour. */ -void slang_alloc_free (void *ptr) -{ - _mesa_free (ptr); -} - -void *slang_alloc_malloc (unsigned int size) -{ - return _mesa_malloc (size); -} - -void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) -{ - return _mesa_realloc (ptr, old_size, size); -} - -int slang_string_compare (const char *str1, const char *str2) -{ - return _mesa_strcmp (str1, str2); -} - -char *slang_string_copy (char *dst, const char *src) -{ - return _mesa_strcpy (dst, src); -} - -char *slang_string_concat (char *dst, const char *src) -{ - return _mesa_strcpy (dst + _mesa_strlen (dst), src); -} - -char *slang_string_duplicate (const char *src) -{ - return _mesa_strdup (src); -} - -unsigned int slang_string_length (const char *str) -{ - return _mesa_strlen (str); -} - static void slang_variable_construct (slang_variable *); static int slang_variable_copy (slang_variable *, const slang_variable *); static void slang_struct_construct (slang_struct *); diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c new file mode 100644 index 00000000000..c07e161c8d9 --- /dev/null +++ b/src/mesa/shader/slang/slang_utility.c @@ -0,0 +1,73 @@ +/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_utility.c
+ * slang utilities
+ * \author Michal Krol
+ */
+
+#include "imports.h"
+#include "slang_utility.h"
+
+void slang_alloc_free (void *ptr)
+{
+ _mesa_free (ptr);
+}
+
+void *slang_alloc_malloc (unsigned int size)
+{
+ return _mesa_malloc (size);
+}
+
+void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
+{
+ return _mesa_realloc (ptr, old_size, size);
+}
+
+int slang_string_compare (const char *str1, const char *str2)
+{
+ return _mesa_strcmp (str1, str2);
+}
+
+char *slang_string_copy (char *dst, const char *src)
+{
+ return _mesa_strcpy (dst, src);
+}
+
+char *slang_string_concat (char *dst, const char *src)
+{
+ return _mesa_strcpy (dst + _mesa_strlen (dst), src);
+}
+
+char *slang_string_duplicate (const char *src)
+{
+ return _mesa_strdup (src);
+}
+
+unsigned int slang_string_length (const char *str)
+{
+ return _mesa_strlen (str);
+}
+
diff --git a/src/mesa/shader/slang/slang_utility.h b/src/mesa/shader/slang/slang_utility.h new file mode 100644 index 00000000000..6eb5369acd1 --- /dev/null +++ b/src/mesa/shader/slang/slang_utility.h @@ -0,0 +1,46 @@ +/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_UTILITY_H
+#define SLANG_UTILITY_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+void slang_alloc_free (void *);
+void *slang_alloc_malloc (unsigned int);
+void *slang_alloc_realloc (void *, unsigned int, unsigned int);
+int slang_string_compare (const char *, const char *);
+char *slang_string_copy (char *, const char *);
+char *slang_string_concat (char *, const char *);
+char *slang_string_duplicate (const char *);
+unsigned int slang_string_length (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/mesa/sources b/src/mesa/sources index 7c79fe76dc4..1a6805749b1 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -182,7 +182,8 @@ SLANG_CPP_SOURCES = \ SLANG_SOURCES = \ shader/slang/slang_compile.c \ - shader/slang/slang_preprocess.c + shader/slang/slang_preprocess.c \ + shader/slang/slang_utility.c ASM_C_SOURCES = \ x86/common_x86.c \ |