summaryrefslogtreecommitdiff
path: root/source3/aparser/templates
diff options
context:
space:
mode:
Diffstat (limited to 'source3/aparser/templates')
-rw-r--r--source3/aparser/templates/fn_end.tpl33
-rw-r--r--source3/aparser/templates/fn_start.tpl9
-rw-r--r--source3/aparser/templates/harness_start.tpl7
-rw-r--r--source3/aparser/templates/ifptr_end.tpl1
-rw-r--r--source3/aparser/templates/ifptr_start.tpl1
-rw-r--r--source3/aparser/templates/module_end.tpl3
-rw-r--r--source3/aparser/templates/module_start.tpl5
-rw-r--r--source3/aparser/templates/prs_.align.tpl1
-rw-r--r--source3/aparser/templates/prs_array.tpl7
-rw-r--r--source3/aparser/templates/prs_case.tpl1
-rw-r--r--source3/aparser/templates/prs_case_end.tpl1
-rw-r--r--source3/aparser/templates/prs_pointer.tpl1
-rw-r--r--source3/aparser/templates/prs_struct.tpl1
-rw-r--r--source3/aparser/templates/prs_struct_alloc.tpl1
-rw-r--r--source3/aparser/templates/prs_uint16.tpl1
-rw-r--r--source3/aparser/templates/prs_uint32.tpl1
-rw-r--r--source3/aparser/templates/union_end.tpl5
-rw-r--r--source3/aparser/templates/union_start.tpl1
18 files changed, 80 insertions, 0 deletions
diff --git a/source3/aparser/templates/fn_end.tpl b/source3/aparser/templates/fn_end.tpl
new file mode 100644
index 0000000000..b5c36fff35
--- /dev/null
+++ b/source3/aparser/templates/fn_end.tpl
@@ -0,0 +1,33 @@
+
+ return True;
+
+fail:
+ ZERO_STRUCTP(il);
+ return False;
+} /* @FUNCNAME@ */
+
+/*******************************************************************
+parse a @STRUCTNAME@ structure
+********************************************************************/
+BOOL @FUNCNAME@_alloc(char *desc, @STRUCTNAME@ **q_u,
+ prs_struct *ps, int depth)
+{
+ @STRUCTNAME@ *il;
+ BOOL ret;
+
+ if (!UNMARSHALLING(ps)) return False;
+
+ il=(@STRUCTNAME@ *)malloc(sizeof(@STRUCTNAME@));
+ if (il == NULL) return False;
+ ZERO_STRUCTP(il);
+
+ ret = @FUNCNAME@(desc, il, ps, depth);
+ if (!ret) {
+ free(il);
+ return False;
+ }
+ *q_u = il;
+ return True;
+}
+
+
diff --git a/source3/aparser/templates/fn_start.tpl b/source3/aparser/templates/fn_start.tpl
new file mode 100644
index 0000000000..deecc670e3
--- /dev/null
+++ b/source3/aparser/templates/fn_start.tpl
@@ -0,0 +1,9 @@
+/*******************************************************************
+parse a @STRUCTNAME@ structure
+********************************************************************/
+BOOL @FUNCNAME@(char *desc, @STRUCTNAME@ *il,
+ prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "@FUNCNAME@");
+ depth++;
+
diff --git a/source3/aparser/templates/harness_start.tpl b/source3/aparser/templates/harness_start.tpl
new file mode 100644
index 0000000000..375b110536
--- /dev/null
+++ b/source3/aparser/templates/harness_start.tpl
@@ -0,0 +1,7 @@
+#define TEST_STRUCT @STRUCTNAME@
+#define TEST_NAME "@TEST@"
+#define TEST_FUNC @FUNCNAME@_alloc
+
+
+#include "prs_@MODULE@.h"
+#include "prs_@MODULE@.c"
diff --git a/source3/aparser/templates/ifptr_end.tpl b/source3/aparser/templates/ifptr_end.tpl
new file mode 100644
index 0000000000..990635cf45
--- /dev/null
+++ b/source3/aparser/templates/ifptr_end.tpl
@@ -0,0 +1 @@
+ }
diff --git a/source3/aparser/templates/ifptr_start.tpl b/source3/aparser/templates/ifptr_start.tpl
new file mode 100644
index 0000000000..ffffe49e91
--- /dev/null
+++ b/source3/aparser/templates/ifptr_start.tpl
@@ -0,0 +1 @@
+ if (il->@ELEM@) {
diff --git a/source3/aparser/templates/module_end.tpl b/source3/aparser/templates/module_end.tpl
new file mode 100644
index 0000000000..661f7edb95
--- /dev/null
+++ b/source3/aparser/templates/module_end.tpl
@@ -0,0 +1,3 @@
+
+
+/* end auto-generated structure parsers for @MODULE@ */
diff --git a/source3/aparser/templates/module_start.tpl b/source3/aparser/templates/module_start.tpl
new file mode 100644
index 0000000000..fef9d296ff
--- /dev/null
+++ b/source3/aparser/templates/module_start.tpl
@@ -0,0 +1,5 @@
+/* auto-generated structure parsers for @MODULE@
+ generated by aparser
+*/
+
+
diff --git a/source3/aparser/templates/prs_.align.tpl b/source3/aparser/templates/prs_.align.tpl
new file mode 100644
index 0000000000..d5b2ceb082
--- /dev/null
+++ b/source3/aparser/templates/prs_.align.tpl
@@ -0,0 +1 @@
+ if(!prs_align(ps)) goto fail;
diff --git a/source3/aparser/templates/prs_array.tpl b/source3/aparser/templates/prs_array.tpl
new file mode 100644
index 0000000000..ca707148db
--- /dev/null
+++ b/source3/aparser/templates/prs_array.tpl
@@ -0,0 +1,7 @@
+ if (il->@ARRAYLEN@ > 0) {
+ il->@ELEM@ = (@TYPE@ *)malloc(sizeof(@TYPE@)*il->@ARRAYLEN@);
+ if (!il->@ELEM@) goto fail;
+ if (!prs_@TYPE@s(True, "@ELEM@", ps, depth+1, il->@ELEM@, il->@ARRAYLEN@)) goto fail;
+ } else {
+ il->@ELEM@ = NULL;
+ }
diff --git a/source3/aparser/templates/prs_case.tpl b/source3/aparser/templates/prs_case.tpl
new file mode 100644
index 0000000000..2f81c35828
--- /dev/null
+++ b/source3/aparser/templates/prs_case.tpl
@@ -0,0 +1 @@
+ case @VALUE@:
diff --git a/source3/aparser/templates/prs_case_end.tpl b/source3/aparser/templates/prs_case_end.tpl
new file mode 100644
index 0000000000..eb540f7be8
--- /dev/null
+++ b/source3/aparser/templates/prs_case_end.tpl
@@ -0,0 +1 @@
+ break;
diff --git a/source3/aparser/templates/prs_pointer.tpl b/source3/aparser/templates/prs_pointer.tpl
new file mode 100644
index 0000000000..f268c259bc
--- /dev/null
+++ b/source3/aparser/templates/prs_pointer.tpl
@@ -0,0 +1 @@
+ if (!prs_pointer("@ELEM@_ptr", ps, depth+1, (void **)&il->@ELEM@)) goto fail;
diff --git a/source3/aparser/templates/prs_struct.tpl b/source3/aparser/templates/prs_struct.tpl
new file mode 100644
index 0000000000..ab8246db8e
--- /dev/null
+++ b/source3/aparser/templates/prs_struct.tpl
@@ -0,0 +1 @@
+ if (!@MODULE@_io_@TYPE@("@ELEM@", &il->@ELEM@, ps, depth+1)) goto fail;
diff --git a/source3/aparser/templates/prs_struct_alloc.tpl b/source3/aparser/templates/prs_struct_alloc.tpl
new file mode 100644
index 0000000000..9eae5c92fc
--- /dev/null
+++ b/source3/aparser/templates/prs_struct_alloc.tpl
@@ -0,0 +1 @@
+ if (!@MODULE@_io_@TYPE@_alloc("@ELEM@", &il->@ELEM@, ps, depth+1)) goto fail;
diff --git a/source3/aparser/templates/prs_uint16.tpl b/source3/aparser/templates/prs_uint16.tpl
new file mode 100644
index 0000000000..36b8298fb2
--- /dev/null
+++ b/source3/aparser/templates/prs_uint16.tpl
@@ -0,0 +1 @@
+ if (!prs_uint16("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail;
diff --git a/source3/aparser/templates/prs_uint32.tpl b/source3/aparser/templates/prs_uint32.tpl
new file mode 100644
index 0000000000..2e2fd638e4
--- /dev/null
+++ b/source3/aparser/templates/prs_uint32.tpl
@@ -0,0 +1 @@
+ if (!prs_uint32("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail;
diff --git a/source3/aparser/templates/union_end.tpl b/source3/aparser/templates/union_end.tpl
new file mode 100644
index 0000000000..511adbcf60
--- /dev/null
+++ b/source3/aparser/templates/union_end.tpl
@@ -0,0 +1,5 @@
+ default:
+ DEBUG(5,("No handler for case %d in @FUNCNAME@\n",
+ (int)il->@SWITCH@));
+ goto fail;
+ }
diff --git a/source3/aparser/templates/union_start.tpl b/source3/aparser/templates/union_start.tpl
new file mode 100644
index 0000000000..aa052be697
--- /dev/null
+++ b/source3/aparser/templates/union_start.tpl
@@ -0,0 +1 @@
+ switch (il->@SWITCH@) {