diff options
author | CVS Import User <samba-bugs@samba.org> | 2004-04-04 09:21:52 +0000 |
---|---|---|
committer | CVS Import User <samba-bugs@samba.org> | 2004-04-04 09:21:52 +0000 |
commit | 9f765b7406282904ce56f2535dcd929a9aefc5ca (patch) | |
tree | dbdff78b624ac7c1afcb8851f395df3d99eb1f84 /source/aparser/templates | |
parent | 111b4e05ab96eafc4212f38dc5977538907187c7 (diff) | |
download | samba-9f765b7406282904ce56f2535dcd929a9aefc5ca.tar.gz samba-9f765b7406282904ce56f2535dcd929a9aefc5ca.tar.xz samba-9f765b7406282904ce56f2535dcd929a9aefc5ca.zip |
r2: import HEAD into svn+ssh://svn.samba.org/home/svn/samba/trunk
metze
Diffstat (limited to 'source/aparser/templates')
34 files changed, 157 insertions, 0 deletions
diff --git a/source/aparser/templates/fn_end.tpl b/source/aparser/templates/fn_end.tpl new file mode 100644 index 00000000000..2275ec4e33c --- /dev/null +++ b/source/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/source/aparser/templates/fn_end0.tpl b/source/aparser/templates/fn_end0.tpl new file mode 100644 index 00000000000..6e49a10f538 --- /dev/null +++ b/source/aparser/templates/fn_end0.tpl @@ -0,0 +1,8 @@ + +end: + /* the parse is OK */ + return True; + +} /* @FUNCNAME@ */ + + diff --git a/source/aparser/templates/fn_i_end.tpl b/source/aparser/templates/fn_i_end.tpl new file mode 100644 index 00000000000..9de61decb38 --- /dev/null +++ b/source/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/source/aparser/templates/fn_i_start.tpl b/source/aparser/templates/fn_i_start.tpl new file mode 100644 index 00000000000..3979d78e7db --- /dev/null +++ b/source/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/source/aparser/templates/fn_mid.tpl b/source/aparser/templates/fn_mid.tpl new file mode 100644 index 00000000000..b81de92a5bd --- /dev/null +++ b/source/aparser/templates/fn_mid.tpl @@ -0,0 +1,6 @@ + +buffers: + if (!(flags & PARSE_BUFFERS)) goto end; + + /* now parse the buffers */ + diff --git a/source/aparser/templates/fn_start.tpl b/source/aparser/templates/fn_start.tpl new file mode 100644 index 00000000000..a5d58767a6c --- /dev/null +++ b/source/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/source/aparser/templates/harness.tpl b/source/aparser/templates/harness.tpl new file mode 100644 index 00000000000..27c33c0adc1 --- /dev/null +++ b/source/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/source/aparser/templates/harness_end.tpl b/source/aparser/templates/harness_end.tpl new file mode 100644 index 00000000000..1e15faec167 --- /dev/null +++ b/source/aparser/templates/harness_end.tpl @@ -0,0 +1,7 @@ + { + printf("structure %s not found\n", test); + ret = False; + } + + return ret; +} diff --git a/source/aparser/templates/harness_start.tpl b/source/aparser/templates/harness_start.tpl new file mode 100644 index 00000000000..beba6fc12de --- /dev/null +++ b/source/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/source/aparser/templates/ifptr_end.tpl b/source/aparser/templates/ifptr_end.tpl new file mode 100644 index 00000000000..990635cf453 --- /dev/null +++ b/source/aparser/templates/ifptr_end.tpl @@ -0,0 +1 @@ + } diff --git a/source/aparser/templates/ifptr_start.tpl b/source/aparser/templates/ifptr_start.tpl new file mode 100644 index 00000000000..228b84bac93 --- /dev/null +++ b/source/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/source/aparser/templates/module_end.tpl b/source/aparser/templates/module_end.tpl new file mode 100644 index 00000000000..661f7edb95d --- /dev/null +++ b/source/aparser/templates/module_end.tpl @@ -0,0 +1,3 @@ + + +/* end auto-generated structure parsers for @MODULE@ */ diff --git a/source/aparser/templates/module_start.tpl b/source/aparser/templates/module_start.tpl new file mode 100644 index 00000000000..ac6a3c9d98d --- /dev/null +++ b/source/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/source/aparser/templates/prs_.align.tpl b/source/aparser/templates/prs_.align.tpl new file mode 100644 index 00000000000..25816a23b34 --- /dev/null +++ b/source/aparser/templates/prs_.align.tpl @@ -0,0 +1 @@ + if(!io_align(ps)) goto fail; diff --git a/source/aparser/templates/prs_align2.tpl b/source/aparser/templates/prs_align2.tpl new file mode 100644 index 00000000000..54c569b547b --- /dev/null +++ b/source/aparser/templates/prs_align2.tpl @@ -0,0 +1 @@ + if (!io_align2(ps, @OFFSET@)) goto fail; diff --git a/source/aparser/templates/prs_align4.tpl b/source/aparser/templates/prs_align4.tpl new file mode 100644 index 00000000000..702fab13243 --- /dev/null +++ b/source/aparser/templates/prs_align4.tpl @@ -0,0 +1 @@ + if (!io_align4(ps, @OFFSET@)) goto fail; diff --git a/source/aparser/templates/prs_array.tpl b/source/aparser/templates/prs_array.tpl new file mode 100644 index 00000000000..4bd6a26c99c --- /dev/null +++ b/source/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/source/aparser/templates/prs_array_optional.tpl b/source/aparser/templates/prs_array_optional.tpl new file mode 100644 index 00000000000..38bd32861f7 --- /dev/null +++ b/source/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/source/aparser/templates/prs_array_remainder.tpl b/source/aparser/templates/prs_array_remainder.tpl new file mode 100644 index 00000000000..c8b1e2ab5af --- /dev/null +++ b/source/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/source/aparser/templates/prs_break.tpl b/source/aparser/templates/prs_break.tpl new file mode 100644 index 00000000000..eb540f7be84 --- /dev/null +++ b/source/aparser/templates/prs_break.tpl @@ -0,0 +1 @@ + break; diff --git a/source/aparser/templates/prs_case.tpl b/source/aparser/templates/prs_case.tpl new file mode 100644 index 00000000000..06c1bd3ae6e --- /dev/null +++ b/source/aparser/templates/prs_case.tpl @@ -0,0 +1 @@ + case @CASE@: diff --git a/source/aparser/templates/prs_case_end.tpl b/source/aparser/templates/prs_case_end.tpl new file mode 100644 index 00000000000..eb540f7be84 --- /dev/null +++ b/source/aparser/templates/prs_case_end.tpl @@ -0,0 +1 @@ + break; diff --git a/source/aparser/templates/prs_element.tpl b/source/aparser/templates/prs_element.tpl new file mode 100644 index 00000000000..e8bf5180cec --- /dev/null +++ b/source/aparser/templates/prs_element.tpl @@ -0,0 +1 @@ + if (!io_@TYPE@("@ELEM@", ps, depth+1, @PTR@il->@ELEM@, @FLAGS@)) goto fail; diff --git a/source/aparser/templates/prs_pointer.tpl b/source/aparser/templates/prs_pointer.tpl new file mode 100644 index 00000000000..4ebcf19d834 --- /dev/null +++ b/source/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/source/aparser/templates/prs_struct.tpl b/source/aparser/templates/prs_struct.tpl new file mode 100644 index 00000000000..ab8246db8e7 --- /dev/null +++ b/source/aparser/templates/prs_struct.tpl @@ -0,0 +1 @@ + if (!@MODULE@_io_@TYPE@("@ELEM@", &il->@ELEM@, ps, depth+1)) goto fail; diff --git a/source/aparser/templates/prs_struct_alloc.tpl b/source/aparser/templates/prs_struct_alloc.tpl new file mode 100644 index 00000000000..9eae5c92fca --- /dev/null +++ b/source/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/source/aparser/templates/prs_uint16.tpl b/source/aparser/templates/prs_uint16.tpl new file mode 100644 index 00000000000..b40d6d4216f --- /dev/null +++ b/source/aparser/templates/prs_uint16.tpl @@ -0,0 +1 @@ + if (!io_uint16("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; diff --git a/source/aparser/templates/prs_uint32.tpl b/source/aparser/templates/prs_uint32.tpl new file mode 100644 index 00000000000..eb76715d28b --- /dev/null +++ b/source/aparser/templates/prs_uint32.tpl @@ -0,0 +1 @@ + if (!io_uint32("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; diff --git a/source/aparser/templates/prs_uint8s.tpl b/source/aparser/templates/prs_uint8s.tpl new file mode 100644 index 00000000000..967162213f4 --- /dev/null +++ b/source/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/source/aparser/templates/prs_uint8s_fixed.tpl b/source/aparser/templates/prs_uint8s_fixed.tpl new file mode 100644 index 00000000000..26597f419f3 --- /dev/null +++ b/source/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/source/aparser/templates/prs_wstring.tpl b/source/aparser/templates/prs_wstring.tpl new file mode 100644 index 00000000000..4de46f093c8 --- /dev/null +++ b/source/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/source/aparser/templates/prs_wstring_fixed.tpl b/source/aparser/templates/prs_wstring_fixed.tpl new file mode 100644 index 00000000000..e33f7c3d5d2 --- /dev/null +++ b/source/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/source/aparser/templates/union_end.tpl b/source/aparser/templates/union_end.tpl new file mode 100644 index 00000000000..511adbcf602 --- /dev/null +++ b/source/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/source/aparser/templates/union_start.tpl b/source/aparser/templates/union_start.tpl new file mode 100644 index 00000000000..aa052be6972 --- /dev/null +++ b/source/aparser/templates/union_start.tpl @@ -0,0 +1 @@ + switch (il->@SWITCH@) { |