summaryrefslogtreecommitdiff
path: root/source3/aparser
diff options
context:
space:
mode:
Diffstat (limited to 'source3/aparser')
-rw-r--r--source3/aparser/parsetree.awk16
-rw-r--r--source3/aparser/token.awk17
2 files changed, 14 insertions, 19 deletions
diff --git a/source3/aparser/parsetree.awk b/source3/aparser/parsetree.awk
index fe0958e7bf..6fee6e2a4a 100644
--- a/source3/aparser/parsetree.awk
+++ b/source3/aparser/parsetree.awk
@@ -9,17 +9,10 @@ function start_module(name)
num_tests=0;
}
-function parse_typedef(type1, type2,
- LOCAL, type, i)
+function parse_define(def1, def2,
+ LOCAL, type, i)
{
- type=type2;
- if (substr(type,1,1)=="*") type=substr(type,2);
-
- i=match(type,"[[]");
- if (i != 0) type = substr(type, 1, i-1);
- start_struct(type);
- add_struct_elem(type1, type2);
- end_struct("");
+ defines[def1]=def2;
}
function start_struct(name)
@@ -44,6 +37,9 @@ function end_struct(name)
function add_element(type, elem, case,
LOCAL, elem_num, i, v)
{
+ while (defines[type]!="") {
+ type=defines[type];
+ }
elem_num=num_elements;
if (substr(elem, 1, 1) == "*") {
diff --git a/source3/aparser/token.awk b/source3/aparser/token.awk
index a64700f536..d0703439e9 100644
--- a/source3/aparser/token.awk
+++ b/source3/aparser/token.awk
@@ -10,6 +10,12 @@ function parse_error(msg) {
next;
}
+/^\#define.*;/ {
+ split($0,a,"[ \t;]*");
+ parse_define(a[2], a[3]);
+ next;
+}
+
# ignore comments
/^[ \t]*\#/ {
next;
@@ -34,13 +40,6 @@ function parse_error(msg) {
next;
}
-/^[ \t]*typedef.*;/ {
- {if (current_struct!="") parse_error("typedefs must be global");}
- split($0,a,"[ \t;]*");
- parse_typedef(a[2], a[3]);
- next;
-}
-
/^[ \t]*struct.*\{/ {
{if (current_struct!="") parse_error("you cannot have nested structures");}
start_struct($2);
@@ -76,8 +75,8 @@ function parse_error(msg) {
}
/^[ \t]*\} .*;/ {
- split($0,a,"[ \t;]*");
- end_struct(a[2]);
+ split($2,a,"[ \t;]*");
+ end_struct(a[1]);
next;
}