summaryrefslogtreecommitdiffhomepage
path: root/libs/web/src/template_utils.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-11-25 19:17:55 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-11-25 19:17:55 +0000
commit0e50aa690af6cd9f37fa97b4a521fe523cce3c39 (patch)
treec0ab4edc0dd221dfa3e6fb4eeba049ecc05326fe /libs/web/src/template_utils.h
parentc647ff9f0e1af211a762dc9a773c1b5c4aacd168 (diff)
libs/web: rewrite template engine, merge lmo library
- template parser: merge lmo library - template parser: rewrite to operate on memory mapped files - template parser: implement proper line number reporting on syntax errors - template parser: process translate tags directly and bypass Lua - template lmo: introduce load_catalog(), change_catalog() and close_catalog() - template lmo: rewrite index processing to operate directly on the memory mapped file - template lmo: implement binary search keys, reducing the lookup complexity to O(log n) - po2lmo: write sorted indixes when generating *.lmo archives - i18n: use the template parser for translations - i18n: stub load(), loadc() and clear() - i18n: map setlanguage() to load_catalog()
Diffstat (limited to 'libs/web/src/template_utils.h')
-rw-r--r--libs/web/src/template_utils.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/libs/web/src/template_utils.h b/libs/web/src/template_utils.h
index 1f7d438c6..371b6a37c 100644
--- a/libs/web/src/template_utils.h
+++ b/libs/web/src/template_utils.h
@@ -1,7 +1,7 @@
/*
* LuCI Template - Utility header
*
- * Copyright (C) 2010 Jo-Philipp Wich <xm@subsignal.org>
+ * Copyright (C) 2010-2012 Jo-Philipp Wich <xm@subsignal.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,28 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <dlfcn.h>
/* buffer object */
struct template_buffer {
- unsigned char *data;
- unsigned char *dptr;
+ char *data;
+ char *dptr;
unsigned int size;
unsigned int fill;
};
+struct template_buffer * buf_init(int size);
+int buf_grow(struct template_buffer *buf, int size);
+int buf_putchar(struct template_buffer *buf, char c);
+int buf_append(struct template_buffer *buf, const char *s, int len);
+int buf_length(struct template_buffer *buf);
+char * buf_destroy(struct template_buffer *buf);
+
char * sanitize_utf8(const char *s, unsigned int l);
char * sanitize_pcdata(const char *s, unsigned int l);
+void escape_luastr(struct template_buffer *out, const char *s, unsigned int l, int escape_xml);
+void translate_luastr(struct template_buffer *out, const char *s, unsigned int l, int escape_xml);
+
#endif