From d500cbb2064e4beb40a760f62b53a3f75f2a87fb Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 31 May 2000 05:39:54 +0000 Subject: messing about. (This used to be commit 9c6f2d75d848a280f25f2377130953ecd824b7b1) --- source3/aparser/templates/fn_end.tpl | 4 +++- source3/aparser/templates/fn_start.tpl | 10 +++++++--- source3/aparser/templates/harness.tpl | 2 +- source3/aparser/templates/harness_start.tpl | 5 ++--- source3/aparser/templates/module_start.tpl | 3 ++- source3/aparser/templates/prs_.align.tpl | 2 +- source3/aparser/templates/prs_array.tpl | 2 +- source3/aparser/templates/prs_array_remainder.tpl | 10 ++++++++++ source3/aparser/templates/prs_uint16.tpl | 2 +- source3/aparser/templates/prs_uint32.tpl | 2 +- source3/aparser/templates/prs_uint8s.tpl | 2 +- source3/aparser/templates/prs_uint8s_fixed.tpl | 3 +-- source3/aparser/templates/prs_wstring.tpl | 2 +- source3/aparser/templates/prs_wstring_fixed.tpl | 2 +- 14 files changed, 33 insertions(+), 18 deletions(-) (limited to 'source3/aparser/templates') diff --git a/source3/aparser/templates/fn_end.tpl b/source3/aparser/templates/fn_end.tpl index df62f6c0ac..2275ec4e33 100644 --- a/source3/aparser/templates/fn_end.tpl +++ b/source3/aparser/templates/fn_end.tpl @@ -4,7 +4,9 @@ end: return True; fail: - ZERO_STRUCTP(il); + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(il); + } return False; } /* @FUNCNAME@ */ diff --git a/source3/aparser/templates/fn_start.tpl b/source3/aparser/templates/fn_start.tpl index 017f894f78..a5d58767a6 100644 --- a/source3/aparser/templates/fn_start.tpl +++ b/source3/aparser/templates/fn_start.tpl @@ -1,13 +1,17 @@ /******************************************************************* parse a @STRUCTNAME@ structure ********************************************************************/ -BOOL @FUNCNAME@(char *desc, prs_struct *ps, int depth, +BOOL @FUNCNAME@(char *desc, io_struct *ps, int depth, @STRUCTNAME@ *il, unsigned flags) { - prs_debug(ps, depth, desc, "@FUNCNAME@"); + io_debug(ps, depth, desc, "@FUNCNAME@"); depth++; if (!(flags & PARSE_SCALARS)) goto buffers; - ZERO_STRUCTP(il); +#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 index bd2355d2a2..0a10ccf49f 100644 --- a/source3/aparser/templates/harness.tpl +++ b/source3/aparser/templates/harness.tpl @@ -1,5 +1,5 @@ if (strcmp(test,"@TEST@")==0) { @TEST@ il; - ret = io_@TEST@("@TEST@", ps, 0, &il, PARSE_SCALARS|PARSE_BUFFERS); + ret = io_@TEST@("@TEST@", ps, 0, &il, flags); } diff --git a/source3/aparser/templates/harness_start.tpl b/source3/aparser/templates/harness_start.tpl index e6cf18a163..beba6fc12d 100644 --- a/source3/aparser/templates/harness_start.tpl +++ b/source3/aparser/templates/harness_start.tpl @@ -1,8 +1,7 @@ -#include "prs_@MODULE@.h" #include "prs_@MODULE@.c" -static BOOL run_test(char *test, prs_struct *ps) +static BOOL run_test(char *test, io_struct *ps, int flags) { BOOL ret; - \ No newline at end of file + diff --git a/source3/aparser/templates/module_start.tpl b/source3/aparser/templates/module_start.tpl index fef9d296ff..5bcdbf3275 100644 --- a/source3/aparser/templates/module_start.tpl +++ b/source3/aparser/templates/module_start.tpl @@ -1,5 +1,6 @@ /* auto-generated structure parsers for @MODULE@ generated by aparser */ - +#include "includes.h" +#include "prs_@MODULE@.h" diff --git a/source3/aparser/templates/prs_.align.tpl b/source3/aparser/templates/prs_.align.tpl index d5b2ceb082..25816a23b3 100644 --- a/source3/aparser/templates/prs_.align.tpl +++ b/source3/aparser/templates/prs_.align.tpl @@ -1 +1 @@ - if(!prs_align(ps)) goto fail; + if(!io_align(ps)) goto fail; diff --git a/source3/aparser/templates/prs_array.tpl b/source3/aparser/templates/prs_array.tpl index 1bf3fa4b04..4bd6a26c99 100644 --- a/source3/aparser/templates/prs_array.tpl +++ b/source3/aparser/templates/prs_array.tpl @@ -1,5 +1,5 @@ if ((@FLAGS@ & PARSE_SCALARS) && - !io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*il->@ARRAY_LEN@)) goto fail; + !io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*(il->@ARRAY_LEN@))) goto fail; { int i; for (i=0;i@ARRAY_LEN@;i++) { diff --git a/source3/aparser/templates/prs_array_remainder.tpl b/source3/aparser/templates/prs_array_remainder.tpl index 80c5d8b9af..c8b1e2ab5a 100644 --- a/source3/aparser/templates/prs_array_remainder.tpl +++ b/source3/aparser/templates/prs_array_remainder.tpl @@ -1,3 +1,4 @@ + if (UNMARSHALLING(ps)) { int i; for (i=0;ps->data_offset < ps->buffer_size;i++) { @@ -5,3 +6,12 @@ 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_uint16.tpl b/source3/aparser/templates/prs_uint16.tpl index 36b8298fb2..b40d6d4216 100644 --- a/source3/aparser/templates/prs_uint16.tpl +++ b/source3/aparser/templates/prs_uint16.tpl @@ -1 +1 @@ - if (!prs_uint16("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; + 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 index 2e2fd638e4..eb76715d28 100644 --- a/source3/aparser/templates/prs_uint32.tpl +++ b/source3/aparser/templates/prs_uint32.tpl @@ -1 +1 @@ - if (!prs_uint32("@ELEM@", ps, depth+1, &il->@ELEM@)) goto fail; + 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 index e5f82670d0..967162213f 100644 --- a/source3/aparser/templates/prs_uint8s.tpl +++ b/source3/aparser/templates/prs_uint8s.tpl @@ -1,2 +1,2 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*il->@ARRAY_LEN@)) goto fail; + 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 index f752fa6c84..26597f419f 100644 --- a/source3/aparser/templates/prs_uint8s_fixed.tpl +++ b/source3/aparser/templates/prs_uint8s_fixed.tpl @@ -1,2 +1 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*@ARRAY_LEN@)) goto fail; - if (!io_uint8s("@ELEM@", ps, depth+1, &il->@ELEM@, @ARRAY_LEN@, @FLAGS@)) goto fail; + 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 index 022381c2d2..4de46f093c 100644 --- a/source3/aparser/templates/prs_wstring.tpl +++ b/source3/aparser/templates/prs_wstring.tpl @@ -1,2 +1,2 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*il->@ARRAY_LEN@)) goto fail; + 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 index bf2539b216..e33f7c3d5d 100644 --- a/source3/aparser/templates/prs_wstring_fixed.tpl +++ b/source3/aparser/templates/prs_wstring_fixed.tpl @@ -1,2 +1,2 @@ - if (!io_alloc("@ELEM@", ps, (void **)&il->@ELEM@, sizeof(*(il->@ELEM@))*@ARRAY_LEN@)) goto fail; + 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; -- cgit