summaryrefslogtreecommitdiffstats
path: root/source/aparser
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-14 14:01:50 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-14 14:01:50 +0000
commit6790d6c589620f4d0f7aa67a3253c52b0b36c0f7 (patch)
treec74427833ce6ef044079b96d38d36895ea6c767b /source/aparser
parent9493e10de3d1c73b246a9841d4b5bb01838c265f (diff)
downloadsamba-6790d6c589620f4d0f7aa67a3253c52b0b36c0f7.tar.gz
samba-6790d6c589620f4d0f7aa67a3253c52b0b36c0f7.tar.xz
samba-6790d6c589620f4d0f7aa67a3253c52b0b36c0f7.zip
removed old files ready for new awk parser
Diffstat (limited to 'source/aparser')
-rw-r--r--source/aparser/basic.awk43
-rw-r--r--source/aparser/func.awk39
-rw-r--r--source/aparser/parser.awk59
-rw-r--r--source/aparser/struct.awk158
-rw-r--r--source/aparser/test.struct46
-rw-r--r--source/aparser/union.awk16
6 files changed, 0 insertions, 361 deletions
diff --git a/source/aparser/basic.awk b/source/aparser/basic.awk
deleted file mode 100644
index 3dab8a47681..00000000000
--- a/source/aparser/basic.awk
+++ /dev/null
@@ -1,43 +0,0 @@
-function uint32_parser(elem) {
- printf("\
- if(!prs_uint32(\"%s\", ps, depth, &il->%s))\n\
- return False;\n\
-", elem, elem);
-}
-
-function unistr2_parser(elem) {
- printf("\
- if(!prs_uint32(\"%s_ptr\", ps, depth, &il->%s_ptr))\n\
- return False;\n\
-", elem, elem);
-}
-
-function buffer5_parser(elem) {
- printf("\
- if(!prs_uint32(\"%s_len\", ps, depth, &il->%s_len))\n\
- return False;\n\
- if(!prs_uint32(\"%s_ptr\", ps, depth, &il->%s_ptr))\n\
- return False;\n\
-", elem, elem, elem, elem);
-}
-
-function nttime_parser(elem) {
- printf("\
- if(!smb_io_time(\"%s\", &il->%s, ps, depth))\n\
- return False;\n\
-", elem, elem);
-}
-
-function uint64_parser(elem) {
- printf("\
- if(!prs_uint64(\"%s\", ps, depth, &il->%s))\n\
- return False;\n\
-", elem, elem);
-}
-
-function generic_parser(type, elem) {
- printf("\
- if(!%s(\"%s\", &il->%s, ps, depth))\n\
- return False;\n\
-", "io_"tolower(type), elem, elem);
-}
diff --git a/source/aparser/func.awk b/source/aparser/func.awk
deleted file mode 100644
index fcf21a0a2ec..00000000000
--- a/source/aparser/func.awk
+++ /dev/null
@@ -1,39 +0,0 @@
-function func_footer() {
- printf("\n\
-\n\
- return True;\n\
-}\n");
-}
-
-function func_header(func_name, struct_name)
-{
- printf("\
-/*******************************************************************\n\
-parse a %s structure\n\
-********************************************************************/ \n\
-BOOL %s(char *desc, %s **q_u, \n\
- prs_struct *ps, int depth)\n\
-{ \n\
- %s *il;\n\
- \n\
- prs_debug(ps, depth, desc, \"%s\");\n\
- depth++;\n\
- \n\
- /* reading */\n\
- if (UNMARSHALLING(ps)) {\n\
- il=(%s *)malloc(sizeof(%s));\n\
- if(il == NULL)\n\
- return False;\n\
- ZERO_STRUCTP(il);\n\
- *q_u=il;\n\
- }\n\
- else {\n\
- il=*q_u;\n\
- }\n\
- \n\
- if(!prs_align(ps))\n\
- return False;\n\
-\n\
-", struct_name, func_name, struct_name, struct_name, func_name, struct_name, struct_name);
-}
-
diff --git a/source/aparser/parser.awk b/source/aparser/parser.awk
deleted file mode 100644
index dde43b91a27..00000000000
--- a/source/aparser/parser.awk
+++ /dev/null
@@ -1,59 +0,0 @@
-@include basic.awk
-@include struct.awk
-@include union.awk
-@include func.awk
-
-function produce_preamble() {
- printf("#define TEST_STRUCT %s\n", struct_name);
- printf("#define TEST_FUNC %s\n", func_name);
- printf("#define TEST_NAME \"%s\"\n", func_name);
- printf("\n\n");
-}
-
-
-/^module/ {
- module=$2;
- next;
-}
-
-/^test/ {
- test=$2;
- next;
-}
-
-/^struct/ {
- start_struct($2);
- next;
-}
-
-/^[ \t]*union/ {
- start_union($2, $3);
- next;
-}
-
-/^[ \t]*case/ {
- split($0,a,"[ \t;]*");
- parse_case(a[3],a[4],a[5]);
- next;
-}
-
-/^\};/ {
- end_struct();
- next;
-}
-
-/^[ \t]*\}/ {
- end_union();
- next;
-}
-
-/^[ \t]*REF/ {
- split($0,a,"[ \t;]*");
- add_elem(a[3],a[4], 1);
- next;
-}
-
-/.*;/ {
- split($0,a,"[ \t;]*");
- add_elem(a[2], a[3], 0);
-}
diff --git a/source/aparser/struct.awk b/source/aparser/struct.awk
deleted file mode 100644
index 0f25536d946..00000000000
--- a/source/aparser/struct.awk
+++ /dev/null
@@ -1,158 +0,0 @@
-function isaptr(elem) {
- if (substr(elem, 1, 1) == "*") {
- return 1;
- }
- return 0;
-}
-
-
-function header_elem1(type, elem, ref) {
- if (type == "BUFFER5") {
- printf("\tuint32 %s_len;\n", elem);
- }
- if (ref == 1) {
- printf("\tuint32 %s_ptr;\n", elem);
- } else {
- printf("\t%s\t%s;\n", type, elem);
- }
-}
-
-function header_elem2(type, elem, ref) {
- if (ref) {
- printf("\t%s\t%s;\n", type, elem);
- }
-}
-
-function produce_header1() {
- printf("\n/* %s structure */\n", struct_name);
- printf("typedef struct {\n");
- for (i=0;i<num_elems;i++) {
- if (unions[i] != unions[i-1]) {
- if (unions[i] != "") {
- printf("\tunion {\n");
- } else {
- printf("\t} %s;\n", unions[i-1]);
- }
- }
- if (isptr[i]) {
- header_elem1(types[i], "*"elems[i], isref[i]);
- } else {
- header_elem1(types[i], elems[i], isref[i]);
- }
- }
- if (unions[i-1] != "") {
- printf("\t} %s;\n", unions[i-1]);
- }
-}
-
-function produce_header2() {
- for (i=0;i<num_elems;i++) {
- if (isptr[i]) {
- header_elem2(types[i], "*"elems[i], isref[i]);
- } else {
- header_elem2(types[i], elems[i], isref[i]);
- }
- }
- printf("} %s;\n\n", struct_name);
-}
-
-function produce_header() {
- produce_header1();
- produce_header2();
-}
-
-function parse_structs() {
- printf("\n\t/* parse the structures in the packet */\n\n");
- for (i=0;i<num_elems;i++) {
- if (types[i] == "UNISTR2") {
- io_unistr2(elems[i]);
- } else if (types[i] == "BUFFER5") {
- io_buffer5(elems[i]);
- }
- }
-}
-
-function io_unistr2(elem) {
- printf("\
- if(!smb_io_unistr2(\"%s\", &il->%s, il->%s_ptr, ps, depth))\n\
- return False;\n\
- if(!prs_align(ps))\n\
- return False;\n\
-", elem, elem, elem);
-}
-
-function io_buffer5(elem) {
- printf("\
- if (il->%s_ptr) {\n\
- if(!smb_io_buffer5(\"%s\", &il->%s, ps, depth))\n\
- return False;\n\
- if(!prs_align(ps))\n\
- return False;\n\
- }\n\
-", elem, elem, elem);
-}
-
-function start_struct(name) {
- num_elems=0;
- union="";
- case="";
- struct_name=toupper(name);
- func_name=tolower("io_"name);
- if (name == test) {
- produce_preamble();
- }
-}
-
-function parse_one(type, elem) {
- if (type == "uint32") {
- uint32_parser(elem);
- } else if (type == "UINT64_S") {
- uint64_parser(elem);
- } else if (type == "UNISTR2") {
- unistr2_parser(elem);
- } else if (type == "BUFFER5") {
- buffer5_parser(elem);
- } else if (type == "NTTIME") {
- nttime_parser(elem);
- } else {
- generic_parser(type, elem);
- }
-}
-
-function parse_elems() {
- printf("\n\t/* parse the main elements of the packet */\n\n");
- for (i=0;i<num_elems;i++) {
- if (cases[i] != "") {
- printf("\tif (il->%s == %s) {\n",
- switches[i], cases[i]);
- parse_one(types[i], unions[i]"."elems[i]);
- printf("\t}\n");
- } else {
- parse_one(types[i], elems[i]);
- }
- }
-}
-
-function end_struct() {
- produce_header();
- func_header(func_name, struct_name);
- parse_elems();
- parse_structs();
- func_footer();
-}
-
-function add_elem(type, elem, ref)
-{
- types[num_elems] = type;
- elems[num_elems] = elem;
- switches[num_elems] = switch;
- cases[num_elems] = case;
- unions[num_elems] = union;
- isref[num_elems] = ref;
- isptr[num_elems] = isaptr(elem);
- if (isptr[num_elems] == 1) {
- elems[num_elems] = substr(elems[num_elems], 2);
- }
- num_elems++;
-}
-
diff --git a/source/aparser/test.struct b/source/aparser/test.struct
deleted file mode 100644
index 7e1d67c6479..00000000000
--- a/source/aparser/test.struct
+++ /dev/null
@@ -1,46 +0,0 @@
-module spool
-test PRINTER_DRIVER_INFO_LEVEL_6
-
-struct PRINTER_DRIVER_INFO_LEVEL_3 {
- uint32 cversion;
- REF UNISTR2 name;
- REF UNISTR2 environment;
- REF UNISTR2 driverpath;
- REF UNISTR2 datafile;
- REF UNISTR2 configfile;
- REF UNISTR2 helpfile;
- REF UNISTR2 monitorname;
- REF UNISTR2 defaultdatatype;
- REF BUFFER5 dependentfiles;
-};
-
-struct PRINTER_DRIVER_INFO_LEVEL_6 {
- uint32 dummy1;
- uint32 version;
- REF UNISTR2 name;
- REF UNISTR2 environment;
- REF UNISTR2 driverpath;
- REF UNISTR2 datafile;
- REF UNISTR2 configfile;
- REF UNISTR2 helpfile;
- REF UNISTR2 monitorname;
- REF UNISTR2 defaultdatatype;
- REF BUFFER5 dependentfiles;
- REF BUFFER5 previousnames;
- NTTIME driverdate;
- UINT64_S driverversion;
- uint32 dummy4;
- REF UNISTR2 mfgname;
- REF UNISTR2 oemurl;
- REF UNISTR2 hardwareid;
- REF UNISTR2 provider;
-};
-
-
-struct PRINTER_DRIVER_INFO {
- uint32 level;
- union level info {
- case 3 PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
- case 6 PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
- }
-};
diff --git a/source/aparser/union.awk b/source/aparser/union.awk
deleted file mode 100644
index 4a26bd9c20c..00000000000
--- a/source/aparser/union.awk
+++ /dev/null
@@ -1,16 +0,0 @@
-function start_union(elem, name) {
- switch=elem;
- union=name;
-}
-
-function parse_case(value,type,elem) {
- case=value;
- add_elem(type, elem, 0);
-}
-
-function end_union() {
- union="";
- case="";
- switch="";
-}
-