--- /dev/null
+#include "grammar_crt.h"\r
+\r
+#define GRAMMAR_PORT_BUILD 1\r
+#include "grammar.c"\r
+#undef GRAMMAR_PORT_BUILD\r
+\r
+\r
+void grammar_alloc_free (void *ptr)\r
+{\r
+ free (ptr);\r
+}\r
+\r
+void *grammar_alloc_malloc (unsigned int size)\r
+{\r
+ return malloc (size);\r
+}\r
+\r
+void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)\r
+{\r
+ return realloc (ptr, size);\r
+}\r
+\r
+void *grammar_memory_copy (void *dst, const void * src, unsigned int size)\r
+{\r
+ return memcpy (dst, src, size);\r
+}\r
+\r
+int grammar_string_compare (const byte *str1, const byte *str2)\r
+{\r
+ return strcmp ((const char *) str1, (const char *) str2);\r
+}\r
+\r
+int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n)\r
+{\r
+ return strncmp ((const char *) str1, (const char *) str2, n);\r
+}\r
+\r
+byte *grammar_string_copy (byte *dst, const byte *src)\r
+{\r
+ return (byte *) strcpy ((char *) dst, (const char *) src);\r
+}\r
+\r
+byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n)\r
+{\r
+ return (byte *) strncpy ((char *) dst, (const char *) src, n);\r
+}\r
+\r
+unsigned int grammar_string_length (const byte *str)\r
+{\r
+ return strlen ((const char *) str);\r
+}\r
+\r
+byte *grammar_string_duplicate (const byte *src)\r
+{\r
+ const unsigned int size = grammar_string_length (src);\r
+ byte *str = grammar_alloc_malloc (size + 1);\r
+ if (str != NULL)\r
+ {\r
+ grammar_memory_copy (str, src, size);\r
+ str[size] = '\0';\r
+ }\r
+ return str;\r
+}\r
+\r