diff options
Diffstat (limited to 'source3/aparser/templates')
34 files changed, 157 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..2275ec4e33 --- /dev/null +++ b/source3/aparser/templates/fn_end.tpl @@ -0,0 +1,13 @@ + +end: + /* the parse is OK */ + return True; + +fail: + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(il); + } + return False; +} /* @FUNCNAME@ */ + + diff --git a/source3/aparser/templates/fn_end0.tpl b/source3/aparser/templates/fn_end0.tpl new file mode 100644 index 0000000000..6e49a10f53 --- /dev/null +++ b/source3/aparser/templates/fn_end0.tpl @@ -0,0 +1,8 @@ + +end: + /* the parse is OK */ + return True; + +} /* @FUNCNAME@ */ + + diff --git a/source3/aparser/templates/fn_i_end.tpl b/source3/aparser/templates/fn_i_end.tpl new file mode 100644 index 0000000000..9de61decb3 --- /dev/null +++ b/source3/aparser/templates/fn_i_end.tpl @@ -0,0 +1,12 @@ + + /* the parse is OK */ + return True; + +fail: + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(il); + } + return False; +} /* @FUNCNAME@ */ + + diff --git a/source3/aparser/templates/fn_i_start.tpl b/source3/aparser/templates/fn_i_start.tpl new file mode 100644 index 0000000000..3979d78e7d --- /dev/null +++ b/source3/aparser/templates/fn_i_start.tpl @@ -0,0 +1,15 @@ +/******************************************************************* +parse a @STRUCTNAME@ structure +********************************************************************/ +BOOL @FUNCNAME@(char *desc, io_struct *ps, int depth, + @STRUCTNAME@ *il, unsigned flags) +{ + io_debug(ps, depth, desc, "@FUNCNAME@"); + depth++; + +#if 0 + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(il); + } +#endif + /* parse the scalars */ diff --git a/source3/aparser/templates/fn_mid.tpl b/source3/aparser/templates/fn_mid.tpl new file mode 100644 index 0000000000..b81de92a5b --- /dev/null +++ b/source3/aparser/templates/fn_mid.tpl @@ -0,0 +1,6 @@ + +buffers: + if (!(flags & PARSE_BUFFERS)) goto end; + + /* now parse the buffers */ + diff --git a/source3/aparser/templates/fn_start.tpl b/source3/aparser/templates/fn_start.tpl new file mode 100644 index 0000000000..a5d58767a6 --- /dev/null +++ b/source3/aparser/templates/fn_start.tpl @@ -0,0 +1,17 @@ +/******************************************************************* +parse a @STRUCTNAME@ structure +********************************************************************/ +BOOL @FUNCNAME@(char *desc, io_struct *ps, int depth, + @STRUCTNAME@ *il, unsigned flags) +{ + io_debug(ps, depth, desc, "@FUNCNAME@"); + depth++; + + if (!(flags & PARSE_SCALARS)) goto buffers; + +#if 0 + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(il); + } +#endif + /* parse the scalars */ diff --git a/source3/aparser/templates/harness.tpl b/source3/aparser/templates/harness.tpl new file mode 100644 index 0000000000..27c33c0adc --- /dev/null +++ b/source3/aparser/templates/harness.tpl @@ -0,0 +1,5 @@ + + if (strcmp(test,"@TEST@")==0) { + @TEST@ il; + ret = io_@TEST@("@TEST@", ps, 0, &il, flags); + } else diff --git a/source3/aparser/templates/harness_end.tpl b/source3/aparser/templates/harness_end.tpl new file mode 100644 index 0000000000..1e15faec16 --- /dev/null +++ b/source3/aparser/templates/harness_end.tpl @@ -0,0 +1,7 @@ + { + printf("structure %s not found\n", test); + ret = False; + } + + return ret; +} diff --git a/source3/aparser/templates/harness_start.tpl b/source3/aparser/templates/harness_start.tpl new file mode 100644 index 0000000000..beba6fc12d --- /dev/null +++ b/source3/aparser/templates/harness_start.tpl @@ -0,0 +1,7 @@ +#include "prs_@MODULE@.c" + +static BOOL run_test(char *test, io_struct *ps, int flags) +{ + BOOL ret; + + 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..228b84bac9 --- /dev/null +++ b/source3/aparser/templates/ifptr_start.tpl @@ -0,0 +1,2 @@ + if (il->@ELEM@) { + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@)))) goto fail; 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..ac6a3c9d98 --- /dev/null +++ b/source3/aparser/templates/module_start.tpl @@ -0,0 +1,5 @@ +/* auto-generated structure parsers for @MODULE@ + generated by aparser +*/ +#include "prs_@MODULE@.h" + diff --git a/source3/aparser/templates/prs_.align.tpl b/source3/aparser/templates/prs_.align.tpl new file mode 100644 index 0000000000..25816a23b3 --- /dev/null +++ b/source3/aparser/templates/prs_.align.tpl @@ -0,0 +1 @@ + if(!io_align(ps)) goto fail; diff --git a/source3/aparser/templates/prs_align2.tpl b/source3/aparser/templates/prs_align2.tpl new file mode 100644 index 0000000000..54c569b547 --- /dev/null +++ b/source3/aparser/templates/prs_align2.tpl @@ -0,0 +1 @@ + if (!io_align2(ps, @OFFSET@)) goto fail; diff --git a/source3/aparser/templates/prs_align4.tpl b/source3/aparser/templates/prs_align4.tpl new file mode 100644 index 0000000000..702fab1324 --- /dev/null +++ b/source3/aparser/templates/prs_align4.tpl @@ -0,0 +1 @@ + if (!io_align4(ps, @OFFSET@)) goto fail; diff --git a/source3/aparser/templates/prs_array.tpl b/source3/aparser/templates/prs_array.tpl new file mode 100644 index 0000000000..4bd6a26c99 --- /dev/null +++ b/source3/aparser/templates/prs_array.tpl @@ -0,0 +1,8 @@ + if ((@FLAGS@ & PARSE_SCALARS) && + !io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; + { + int i; + for (i=0;i<il->@ARRAY_LEN@;i++) { + if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; + } + } diff --git a/source3/aparser/templates/prs_array_optional.tpl b/source3/aparser/templates/prs_array_optional.tpl new file mode 100644 index 0000000000..38bd32861f --- /dev/null +++ b/source3/aparser/templates/prs_array_optional.tpl @@ -0,0 +1,5 @@ + if ((MARSHALLING(ps) && il->@ELEM@) || + ps->data_offset < ps->buffer_size) { + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@)))) goto fail; + if (!io_@TYPE@("@ELEM@...", ps, depth+1, il->@ELEM@, @FLAGS@)) goto fail; + } diff --git a/source3/aparser/templates/prs_array_remainder.tpl b/source3/aparser/templates/prs_array_remainder.tpl new file mode 100644 index 0000000000..c8b1e2ab5a --- /dev/null +++ b/source3/aparser/templates/prs_array_remainder.tpl @@ -0,0 +1,17 @@ + if (UNMARSHALLING(ps)) + { + int i; + for (i=0;ps->data_offset < ps->buffer_size;i++) { + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(i+1))) goto fail; + if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; + } + } + else + { + int i = -1; + /* HACK ALERT! */ + do { + i++; + if (!io_@TYPE@("@ELEM@...", ps, depth+1, &il->@ELEM@[i], @FLAGS@)) goto fail; + } while (il->@ELEM@[i].tag2 != 0); + } diff --git a/source3/aparser/templates/prs_break.tpl b/source3/aparser/templates/prs_break.tpl new file mode 100644 index 0000000000..eb540f7be8 --- /dev/null +++ b/source3/aparser/templates/prs_break.tpl @@ -0,0 +1 @@ + break; diff --git a/source3/aparser/templates/prs_case.tpl b/source3/aparser/templates/prs_case.tpl new file mode 100644 index 0000000000..06c1bd3ae6 --- /dev/null +++ b/source3/aparser/templates/prs_case.tpl @@ -0,0 +1 @@ + case @CASE@: 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_element.tpl b/source3/aparser/templates/prs_element.tpl new file mode 100644 index 0000000000..e8bf5180ce --- /dev/null +++ b/source3/aparser/templates/prs_element.tpl @@ -0,0 +1 @@ + if (!io_@TYPE@("@ELEM@", ps, depth+1, @PTR@il->@ELEM@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_pointer.tpl b/source3/aparser/templates/prs_pointer.tpl new file mode 100644 index 0000000000..4ebcf19d83 --- /dev/null +++ b/source3/aparser/templates/prs_pointer.tpl @@ -0,0 +1,2 @@ + if (!io_pointer("@ELEM@_ptr", ps, depth+1, + (void **)&il->@ELEM@, @FLAGS@)) 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..b40d6d4216 --- /dev/null +++ b/source3/aparser/templates/prs_uint16.tpl @@ -0,0 +1 @@ + if (!io_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..eb76715d28 --- /dev/null +++ b/source3/aparser/templates/prs_uint32.tpl @@ -0,0 +1 @@ + if (!io_uint32("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; diff --git a/source3/aparser/templates/prs_uint8s.tpl b/source3/aparser/templates/prs_uint8s.tpl new file mode 100644 index 0000000000..967162213f --- /dev/null +++ b/source3/aparser/templates/prs_uint8s.tpl @@ -0,0 +1,2 @@ + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; + if (!io_uint8s("@ELEM@", ps, depth+1, &il->@ELEM@, il->@ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_uint8s_fixed.tpl b/source3/aparser/templates/prs_uint8s_fixed.tpl new file mode 100644 index 0000000000..26597f419f --- /dev/null +++ b/source3/aparser/templates/prs_uint8s_fixed.tpl @@ -0,0 +1 @@ + if (!io_uint8s_fixed("@ELEM@", ps, depth+1, il->@ELEM@, @ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_wstring.tpl b/source3/aparser/templates/prs_wstring.tpl new file mode 100644 index 0000000000..4de46f093c --- /dev/null +++ b/source3/aparser/templates/prs_wstring.tpl @@ -0,0 +1,2 @@ + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; + if (!io_wstring("@ELEM@", ps, depth+1, il->@ELEM@, il->@ARRAY_LEN@, @FLAGS@)) goto fail; diff --git a/source3/aparser/templates/prs_wstring_fixed.tpl b/source3/aparser/templates/prs_wstring_fixed.tpl new file mode 100644 index 0000000000..e33f7c3d5d --- /dev/null +++ b/source3/aparser/templates/prs_wstring_fixed.tpl @@ -0,0 +1,2 @@ + if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(@ARRAY_LEN@))) goto fail; + if (!io_wstring("@ELEM@", ps, depth+1, il->@ELEM@, @ARRAY_LEN@, @FLAGS@)) 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@) { |