get rid of weird lemon symbols
[m6w6/ext-psi] / src / parser_proc.inc
index 81489d5ff6b88c3f0e22d549de4aa0e9883bad54..5e2128c13c68b9aee7406acc153cced50ffa9c35 100644 (file)
@@ -1,15 +1,34 @@
 %include {
 %include {
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#else
-# include "php_config.h"
-#endif
+#include "php_psi_stdinc.h"
 
 
-#include <stddef.h>
 #include <assert.h>
 #include <assert.h>
-#include <stdlib.h>
-#include <string.h>
 #include <stdarg.h>
 
 #include <stdarg.h>
 
+#include "plist.h"
 #include "parser.h"
 #include "parser.h"
+
+/* rename lemon symbols, works better than DEF(%name) */
+#define ParseAlloc psi_parser_proc_init_ex
+#define Parse psi_parser_proc_parse
+#define ParseTrace psi_parser_proc_trace
+#define ParseFree psi_parser_proc_free_ex
+
+/* fwd decls */
+void *ParseAlloc(void *(*mallocProc)(size_t));
+void ParseFree(void *p, void (*freeProc)(void*));
+
+/* wrappers */
+void *psi_parser_proc_init(void)
+{
+       return ParseAlloc(malloc);
+}
+
+void psi_parser_proc_free(void **parser_proc)
+{
+       if (*parser_proc) {
+               ParseFree(*parser_proc, free);
+               *parser_proc = NULL;
+       }
+}
+
 }
 }