summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/NDR.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-10-03 23:27:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:20 -0500
commitf9a416743401121e1bc2961402cd6f87de68ca00 (patch)
treec5b83bc137b130022159934b22a90227da0ae67b /source4/pidl/lib/Parse/Pidl/NDR.pm
parent012893cb421d77efc538c9f4c78b2421aef3f06e (diff)
downloadsamba-f9a416743401121e1bc2961402cd6f87de68ca00.tar.gz
samba-f9a416743401121e1bc2961402cd6f87de68ca00.tar.bz2
samba-f9a416743401121e1bc2961402cd6f87de68ca00.zip
r10694: Add some work I did this afternoon on getting pidl to output Samba3
RPC parsers. Currently the following files can be generated: - include/rpc_BASENAME.h - rpc_server/srv_BASENAME.c - rpc_server/srv_BASENAME_nt.c (template only, user has to fill in functions) - rpc_client/cli_BASENAME.c - rpc_parse/parse_BASENAME.c So far, I have been working on getting DFS working. Currently still to do (all in rpc_parse/parse_BASENAME.c): - Proper handling of declarations - Proper handling of scalar/buffer parts of structs and unions - Subcontexts - Proper handling of arrays - Support for custom (non-scalar) types I hope to have a somewhat more working version later this week. Some files as currently generated are available from: http://samba.org/~jelmer/pidl_samba3/ (This used to be commit 8af8eaeeef6d46f4d25ccb1d25890e1eef063e4f)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/NDR.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm33
1 files changed, 32 insertions, 1 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 42c9fd133b..6bb92a3b50 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -17,6 +17,37 @@ use strict;
use Parse::Pidl::Typelist qw(hasType getType);
use Parse::Pidl::Util qw(has_property property_matches);
+# Alignment of the built-in scalar types
+my $scalar_alignment = {
+ 'void' => 0,
+ 'char' => 1,
+ 'int8' => 1,
+ 'uint8' => 1,
+ 'int16' => 2,
+ 'uint16' => 2,
+ 'int32' => 4,
+ 'uint32' => 4,
+ 'hyper' => 8,
+ 'dlong' => 4,
+ 'udlong' => 4,
+ 'udlongr' => 4,
+ 'DATA_BLOB' => 4,
+ 'string' => 4,
+ 'string_array' => 4, #???
+ 'time_t' => 4,
+ 'NTTIME' => 4,
+ 'NTTIME_1sec' => 4,
+ 'NTTIME_hyper' => 8,
+ 'WERROR' => 4,
+ 'NTSTATUS' => 4,
+ 'COMRESULT' => 4,
+ 'nbt_string' => 4,
+ 'wrepl_nbt_name' => 4,
+ 'ipv4address' => 4
+};
+
+
+
sub nonfatal($$)
{
my ($e,$s) = @_;
@@ -299,7 +330,7 @@ sub align_type
} elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
return find_largest_alignment($dt);
} elsif ($dt->{TYPE} eq "SCALAR") {
- return Parse::Pidl::Typelist::getScalarAlignment($dt->{NAME});
+ return $scalar_alignment->{$dt->{NAME}};
}
die("Unknown data type type $dt->{TYPE}");