From f4092abdf94af6a99aff944d6264bc1284e8bdd4 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:43:39 +0200 Subject: Imported nx-X11-3.1.0-1.tar.gz Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository --- .../Mesa/src/mesa/shader/grammar/grammar_crt.c | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt.c (limited to 'nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt.c') diff --git a/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt.c b/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt.c new file mode 100755 index 000000000..8db87358c --- /dev/null +++ b/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt.c @@ -0,0 +1,64 @@ +#include "grammar_crt.h" + +#define GRAMMAR_PORT_BUILD 1 +#include "grammar.c" +#undef GRAMMAR_PORT_BUILD + + +void grammar_alloc_free (void *ptr) +{ + free (ptr); +} + +void *grammar_alloc_malloc (unsigned int size) +{ + return malloc (size); +} + +void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) +{ + return realloc (ptr, size); +} + +void *grammar_memory_copy (void *dst, const void * src, unsigned int size) +{ + return memcpy (dst, src, size); +} + +int grammar_string_compare (const byte *str1, const byte *str2) +{ + return strcmp ((const char *) str1, (const char *) str2); +} + +int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n) +{ + return strncmp ((const char *) str1, (const char *) str2, n); +} + +byte *grammar_string_copy (byte *dst, const byte *src) +{ + return (byte *) strcpy ((char *) dst, (const char *) src); +} + +byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n) +{ + return (byte *) strncpy ((char *) dst, (const char *) src, n); +} + +unsigned int grammar_string_length (const byte *str) +{ + return strlen ((const char *) str); +} + +byte *grammar_string_duplicate (const byte *src) +{ + const unsigned int size = grammar_string_length (src); + byte *str = grammar_alloc_malloc (size + 1); + if (str != NULL) + { + grammar_memory_copy (str, src, size); + str[size] = '\0'; + } + return str; +} + -- cgit v1.2.3