From 5c3588c430557d091683de7b7cc6f9d9534ca397 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 12 May 2000 14:35:13 +0000 Subject: this is a awk based code generator. Very primitive at the moment, but it was sufficient to generate info level 6 of the add printer driver for spoolss It has two capabilities: 1) generate the header and C code for parsing a structure, given a *.struct file that describes the structure. Evetually I hope to make *.struct compatible with MIDL. 2) it provides a harness that can read a binary data file from prs_dump() which contains real data from a client and display the parse of it from the output of the awk parser. This allows you to "play" with the structure definition until it comes out right, it takes just a few mimutes of playing with the .struct file to work out the right layout. all this is very primitive right now. I hope next to completely replace the spoolss parser with a single .struct file that describes all the structures, and auto-generates working code. That will require quite a bit more work. (This used to be commit 7bc87d20ea47ba25851512cc6f9de6076ce1cec8) --- source3/aparser/vluke.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 source3/aparser/vluke.c (limited to 'source3/aparser/vluke.c') diff --git a/source3/aparser/vluke.c b/source3/aparser/vluke.c new file mode 100644 index 00000000000..5e143016be4 --- /dev/null +++ b/source3/aparser/vluke.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include +#include "parser.h" +#include "test.h" + +int main(int argc, char *argv[]) +{ + BOOL ret; + TEST_STRUCT *q_u; + char *desc = TEST_NAME; + char *fname = argv[1]; + int fd; + struct stat st; + prs_struct ps; + + if (argc < 2) { + printf("usage: harness \n"); + exit(1); + } + + fd = open(fname,O_RDONLY); + fstat(fd, &st); + + prs_init(&ps, 0, 4, MARSHALL); + ps.is_dynamic=True; + prs_read(&ps, fd, st.st_size, 0); + dump_data(0, ps.data_p, ps.buffer_size); + ps.data_offset = 0; + ps.io = UNMARSHALL; + ret = TEST_FUNC(desc, &q_u, &ps, 1); + printf("ret=%d\n", ret); + return !ret; +} -- cgit