summaryrefslogtreecommitdiff
path: root/source4/build/pidl/header.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-22 22:09:10 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-22 22:09:10 +0000
commite79e6bc4726dc96d553e245e34e94e39de7c2da3 (patch)
tree7f30f01f8f4223795f7daa5e35723c11155b2d95 /source4/build/pidl/header.pm
parent277322b9d4b9d009782f1a47baf09ee4033c8328 (diff)
downloadsamba-e79e6bc4726dc96d553e245e34e94e39de7c2da3.tar.gz
samba-e79e6bc4726dc96d553e245e34e94e39de7c2da3.tar.bz2
samba-e79e6bc4726dc96d553e245e34e94e39de7c2da3.zip
added support for 'const' in IDL files. This makes it easy to define
symbolic names for bitfields etc. (This used to be commit 344a6e1682cc1afab24735e73d05cf15f6eb9816)
Diffstat (limited to 'source4/build/pidl/header.pm')
-rw-r--r--source4/build/pidl/header.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index 25f0fecd47..751383a2b3 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -75,7 +75,7 @@ sub HeaderStruct($$)
{
my($struct) = shift;
my($name) = shift;
- $res .= "struct $name {\n";
+ $res .= "\nstruct $name {\n";
$tab_depth++;
if (defined $struct->{ELEMENTS}) {
foreach my $e (@{$struct->{ELEMENTS}}) {
@@ -143,7 +143,15 @@ sub HeaderTypedef($)
{
my($typedef) = shift;
HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME});
- $res .= ";\n\n";
+ $res .= ";\n";
+}
+
+#####################################################################
+# parse a typedef
+sub HeaderConst($)
+{
+ my($const) = shift;
+ $res .= "#define $const->{NAME}\t( $const->{VALUE} )\n";
}
#####################################################################
@@ -165,7 +173,7 @@ sub HeaderFunctionInOut($$)
sub HeaderFunction($)
{
my($fn) = shift;
- $res .= "struct $fn->{NAME} {\n";
+ $res .= "\nstruct $fn->{NAME} {\n";
$tab_depth++;
tabs();
$res .= "struct {\n";
@@ -208,7 +216,7 @@ sub HeaderInterface($)
foreach my $d (@{$data}) {
if ($d->{TYPE} eq "FUNCTION") {
my $u_name = uc $d->{NAME};
- $res .= "#define DCERPC_$u_name $count\n";
+ $res .= "#define DCERPC_$u_name " . sprintf("0x%02x", $count) . "\n";
$count++;
}
}
@@ -216,6 +224,8 @@ sub HeaderInterface($)
$res .= "\n\n";
foreach my $d (@{$data}) {
+ ($d->{TYPE} eq "CONST") &&
+ HeaderConst($d);
($d->{TYPE} eq "TYPEDEF") &&
HeaderTypedef($d);
($d->{TYPE} eq "FUNCTION") &&