summaryrefslogtreecommitdiff
path: root/source3/aparser
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-17 07:10:50 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-17 07:10:50 +0000
commit6738591a229c728ab9d64192e197ac93645a8897 (patch)
tree2ee35bd2c61df7a94bb6dd219aec2e148702966a /source3/aparser
parentba2f726efdb97c95c6110b0365a011121e27fce3 (diff)
downloadsamba-6738591a229c728ab9d64192e197ac93645a8897.tar.gz
samba-6738591a229c728ab9d64192e197ac93645a8897.tar.bz2
samba-6738591a229c728ab9d64192e197ac93645a8897.zip
added primitive define macros
started converting matty's srvsvc.idl to a .struct file (This used to be commit cf8d4c42e259d65d4d16c91316acc0bad71ff177)
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;
}