diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-07-09 15:32:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:27 -0500 |
commit | fa1445f4bc962efb3e639d3a4e345b1db14155b7 (patch) | |
tree | 8799d04bc9ec022569fedd636e899bcc29a57935 /source4/build/pidl/Parse/Pidl/Samba/SWIG.pm | |
parent | c222331d6d3785075bb0c961315aae9380101e47 (diff) | |
download | samba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.tar.gz samba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.tar.bz2 samba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.zip |
r8264: - Use standard perl package structure for pidl.
- Only "use" pidl modules in the main executable when necessary
Try 'make install' in build/pidl to install the package (should work stand-alone).
(This used to be commit c620095692122a65ae1c5d85ca20468d4de93c54)
Diffstat (limited to 'source4/build/pidl/Parse/Pidl/Samba/SWIG.pm')
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Samba/SWIG.pm | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Samba/SWIG.pm b/source4/build/pidl/Parse/Pidl/Samba/SWIG.pm new file mode 100644 index 0000000000..409095804f --- /dev/null +++ b/source4/build/pidl/Parse/Pidl/Samba/SWIG.pm @@ -0,0 +1,76 @@ +################################################### +# Samba4 parser generator for swig wrappers +# Copyright tpot@samba.org 2004,2005 +# released under the GNU GPL + +package Parse::Pidl::Samba::SWIG; + +use strict; + +sub pidl($) +{ + print OUT shift; +} + +##################################################################### +# rewrite autogenerated header file +sub RewriteHeader($$$) +{ + my($idl) = shift; + my($input) = shift; + my($output) = shift; + + open(IN, "<$input") || die "can't open $input for reading"; + open(OUT, ">$output") || die "can't open $output for writing"; + + pidl "%{\n"; + pidl "#define data_in in\n"; + pidl "#define data_out out\n"; + pidl "%}\n\n"; + + while(<IN>) { + + # Rename dom_sid2 to dom_sid as we don't care about the difference + # for the swig wrappers. + + s/dom_sid2/dom_sid/g; + + # Copy structure and union definitions + + if (/^(struct|union) .*? {$/ .. /^\};$/) { + s/\} (in|out);/\} data_$1;/; # "in" is a Python keyword + pidl $_; + next; + } + + # Copy dcerpc functions + + pidl $_ if /^NTSTATUS dcerpc_.*?\(struct dcerpc_pipe/; + + # Copy interface definitions + + pidl $_ + if /^\#define DCERPC_.*?_UUID/ or /^\#define DCERPC_.*?_VERSION/; + } + + close(OUT); +} + +##################################################################### +# rewrite autogenerated header file +sub RewriteC($$$) +{ + my($idl) = shift; + my($input) = shift; + my($output) = shift; + + open(IN, "<$input") || die "can't open $input for reading"; + open(OUT, ">>$output") || die "can't open $output for writing"; + + while(<IN>) { + } + + close(OUT); +} + +1; |