svn commit: samba r14488 - in branches/SAMBA_4_0/source: .
build/smb_build lib/charset librpc librpc/ndr librpc/rpc pidl
pidl/lib/Parse/Pidl pidl/lib/Parse/Pidl/Samba4
pidl/lib/Parse/Pidl/Samba4/COM pidl/lib/Parse/Pidl/Samba4/NDR
jelmer at samba.org
jelmer at samba.org
Thu Mar 16 20:02:32 GMT 2006
Author: jelmer
Date: 2006-03-16 20:02:31 +0000 (Thu, 16 Mar 2006)
New Revision: 14488
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14488
Log:
Install more headers.
Generate different #include lines in pidl depending on whether
we're building inside or outside of the Samba tree (useful for
3rd-party projects).
Added:
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
Modified:
branches/SAMBA_4_0/source/build/smb_build/TODO
branches/SAMBA_4_0/source/headermap.txt
branches/SAMBA_4_0/source/lib/charset/charset.h
branches/SAMBA_4_0/source/lib/charset/config.mk
branches/SAMBA_4_0/source/librpc/config.mk
branches/SAMBA_4_0/source/librpc/ndr/libndr.h
branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
branches/SAMBA_4_0/source/pidl/pidl
Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/TODO
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/TODO 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/build/smb_build/TODO 2006-03-16 20:02:31 UTC (rev 14488)
@@ -1,12 +1,10 @@
-- saner names for some of the .pc files
+- saner names for some of the .pc files (reduce the amount of .pc files?)
- plugin loading support in ldb
- proper #include dependencies:
for each subsystem:
- include line in Makefile
- rule in Makefile
-- improve include paths and how they are handled
-- install autogenerated headers (seperate directory)
-- subdir handler for install headers into a specific directory
+- generate headermap.txt
set of test scripts that check the code:
- configure_check_unused.pl
Modified: branches/SAMBA_4_0/source/headermap.txt
===================================================================
--- branches/SAMBA_4_0/source/headermap.txt 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/headermap.txt 2006-03-16 20:02:31 UTC (rev 14488)
@@ -40,6 +40,8 @@
include/core.h: core.h
librpc/gen_ndr/dcerpc.h: gen_ndr/dcerpc.h
librpc/gen_ndr/netlogon.h: gen_ndr/netlogon.h
+librpc/gen_ndr/ndr_misc.h: gen_ndr/ndr_misc.h
+librpc/gen_ndr/ndr_dcerpc.h: gen_ndr/ndr_dcerpc.h
librpc/gen_ndr/misc.h: gen_ndr/misc.h
librpc/gen_ndr/lsa.h: gen_ndr/lsa.h
librpc/gen_ndr/samr.h: gen_ndr/samr.h
@@ -56,3 +58,5 @@
auth/gensec/spnego.h: gensec/spnego.h
auth/gensec/gensec_proto.h: gensec/proto.h
libcli/auth/credentials.h: domain_credentials.h
+lib/charset/charset.h: charset.h
+lib/charset/charset_proto.h: charset/proto.h
Modified: branches/SAMBA_4_0/source/lib/charset/charset.h
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/charset.h 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/lib/charset/charset.h 2006-03-16 20:02:31 UTC (rev 14488)
@@ -19,6 +19,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef __CHARSET_H__
+#define __CHARSET_H__
+
/* this defines the charset types used in samba */
typedef enum {CH_UTF16=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UTF16BE=5} charset_t;
@@ -67,3 +70,5 @@
#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */
#include "lib/charset/charset_proto.h"
+
+#endif /* __CHARSET_H__ */
Modified: branches/SAMBA_4_0/source/lib/charset/config.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/config.mk 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/lib/charset/config.mk 2006-03-16 20:02:31 UTC (rev 14488)
@@ -4,7 +4,8 @@
OBJ_FILES = \
iconv.o \
charcnv.o
-PRIVATE_PROTO_HEADER = charset_proto.h
+PUBLIC_HEADERS = charset.h
+PUBLIC_PROTO_HEADER = charset_proto.h
REQUIRED_SUBSYSTEMS = EXT_LIB_ICONV
# End SUBSYSTEM CHARSET
################################################
Modified: branches/SAMBA_4_0/source/librpc/config.mk
===================================================================
--- branches/SAMBA_4_0/source/librpc/config.mk 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/librpc/config.mk 2006-03-16 20:02:31 UTC (rev 14488)
@@ -102,7 +102,7 @@
SO_VERSION = 0.0.1
DESCRIPTION =
OBJ_FILES = gen_ndr/ndr_misc.o
-PUBLIC_HEADERS = gen_ndr/misc.h
+PUBLIC_HEADERS = gen_ndr/misc.h gen_ndr/ndr_misc.h
REQUIRED_SUBSYSTEMS = LIBNDR
[LIBRARY::NDR_ROT]
@@ -705,7 +705,7 @@
[SUBSYSTEM::NDR_DCERPC]
OBJ_FILES = gen_ndr/ndr_dcerpc.o
REQUIRED_SUBSYSTEMS = LIBNDR NDR_MISC
-PUBLIC_HEADERS = gen_ndr/dcerpc.h
+PUBLIC_HEADERS = gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h
################################################
# Start SUBSYSTEM dcerpc
Modified: branches/SAMBA_4_0/source/librpc/ndr/libndr.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/libndr.h 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/librpc/ndr/libndr.h 2006-03-16 20:02:31 UTC (rev 14488)
@@ -23,6 +23,8 @@
#include "core.h"
#include "lib/talloc/talloc.h"
+#include "lib/util/util.h" /* for discard_const */
+#include "lib/charset/charset.h"
/*
this provides definitions for the libcli/rpc/ MSRPC library
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h 2006-03-16 20:02:31 UTC (rev 14488)
@@ -24,6 +24,7 @@
#ifndef __DCERPC_H__
#define __DCERPC_H__
+#include "core.h"
#include "librpc/gen_ndr/dcerpc.h"
enum dcerpc_transport_t {
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm 2006-03-16 20:02:31 UTC (rev 14488)
@@ -117,19 +117,22 @@
return $res;
}
-sub Parse($)
+sub Parse($$)
{
- my $idl = shift;
+ my ($idl,$ndr_header) = @_;
my $res = "";
- foreach my $x (@{$idl})
+ $res .= "#include \"librpc/gen_ndr/orpc.h\"\n" .
+ "#include \"$ndr_header\"\n\n";
+
+ foreach (@{$idl})
{
- if ($x->{TYPE} eq "INTERFACE" && has_property($x, "object")) {
- $res.=ParseInterface($x);
+ if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {
+ $res.=ParseInterface($_);
}
- if ($x->{TYPE} eq "COCLASS") {
- $res.=ParseCoClass($x);
+ if ($_->{TYPE} eq "COCLASS") {
+ $res.=ParseCoClass($_);
}
}
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm 2006-03-16 20:02:31 UTC (rev 14488)
@@ -196,17 +196,21 @@
return $res;
}
-sub Parse($)
+sub Parse($$)
{
- my $pidl = shift;
+ my ($pidl,$comh_filename) = @_;
my $res = "";
- foreach my $x (@{$pidl}) {
- next if ($x->{TYPE} ne "INTERFACE");
- next if has_property($x, "local");
- next unless has_property($x, "object");
+ $res .= "#include \"includes.h\"\n" .
+ "#include \"lib/com/dcom/dcom.h\"\n" .
+ "#include \"$comh_filename\"\n";
- $res .= ParseInterface($x);
+ foreach (@{$pidl}) {
+ next if ($_->{TYPE} ne "INTERFACE");
+ next if has_property($_, "local");
+ next unless has_property($_, "object");
+
+ $res .= ParseInterface($_);
}
return $res;
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm 2006-03-16 20:02:31 UTC (rev 14488)
@@ -10,6 +10,7 @@
use Parse::Pidl::Typelist qw(mapType);
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel GetPrevLevel);
+use Parse::Pidl::Samba4 qw(is_intree);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -349,6 +350,10 @@
$res = "";
%headerstructs = ();
pidl "/* header auto-generated by pidl */\n\n";
+ if (!is_intree()) {
+ pidl "#include <core.h>";
+ }
+
foreach (@{$idl}) {
($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
}
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2006-03-16 20:02:31 UTC (rev 14488)
@@ -11,6 +11,7 @@
use Parse::Pidl::Typelist qw(hasType getType mapType);
use Parse::Pidl::Util qw(has_property ParseExpr print_uuid);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
+use Parse::Pidl::Samba4 qw(is_intree choose_header);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -2237,16 +2238,16 @@
my $count = 0;
- pidl_hdr "#include \"librpc/ndr/libndr.h\"";
+ pidl_hdr choose_header("librpc/ndr/libndr.h", "ndr.h");
if (has_property($interface, "object")) {
- pidl "#include \"librpc/gen_ndr/ndr_orpc.h\"";
+ pidl choose_header("librpc/gen_ndr/ndr_orpc.h", "ndr/orpc.h");
}
if (defined $interface->{PROPERTIES}->{depends}) {
my @d = split / /, $interface->{PROPERTIES}->{depends};
foreach my $i (@d) {
- pidl "#include \"librpc/gen_ndr/ndr_$i\.h\"";
+ pidl choose_header("librpc/gen_ndr/ndr_$i\.h", "gen_ndr/ndr_$i.h");
}
}
@@ -2311,7 +2312,7 @@
pidl_hdr "";
if ($needed->{"compression"}) {
- pidl "#include \"librpc/ndr/ndr_compression.h\"";
+ pidl choose_header("librpc/ndr/ndr_compression.h", "ndr/compression.h");
}
HeaderInterface($interface);
@@ -2347,9 +2348,9 @@
#####################################################################
# parse a parsed IDL structure back into an IDL file
-sub Parse($$)
+sub Parse($$$)
{
- my($ndr,$basename) = @_;
+ my($ndr,$gen_header,$ndr_header) = @_;
$tabs = "";
$res = "";
@@ -2357,9 +2358,27 @@
$res_hdr = "";
pidl_hdr "/* header auto-generated by pidl */";
pidl_hdr "";
+ pidl_hdr "#include \"$gen_header\"";
+ pidl_hdr "";
pidl "/* parser auto-generated by pidl */";
pidl "";
+ if (is_intree()) {
+ pidl "#include \"includes.h\"";
+ } else {
+ pidl "#define _GNU_SOURCE";
+ pidl "#include <stdint.h>";
+ pidl "#include <stdlib.h>";
+ pidl "#include <stdio.h>";
+ pidl "#include <stdarg.h>";
+ pidl "#include <string.h>";
+ }
+ pidl choose_header("libcli/util/nterr.h", "core/nterr.h");
+ pidl choose_header("librpc/gen_ndr/ndr_misc.h", "gen_ndr/ndr_misc.h");
+ pidl choose_header("librpc/gen_ndr/ndr_dcerpc.h", "gen_ndr/ndr_dcerpc.h");
+ pidl "#include \"$ndr_header\"";
+ pidl choose_header("librpc/rpc/dcerpc.h", "dcerpc.h"); #FIXME: This shouldn't be here!
+ pidl "";
my %needed = ();
Added: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm 2006-03-16 20:02:31 UTC (rev 14488)
@@ -0,0 +1,32 @@
+###################################################
+# Common Samba4 functions
+# Copyright jelmer at samba.org 2006
+# released under the GNU GPL
+
+package Parse::Pidl::Samba4;
+
+require Exporter;
+ at ISA = qw(Exporter);
+ at EXPORT = qw(is_intree choose_header);
+
+use Parse::Pidl::Util qw(has_property);
+use strict;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+sub is_intree()
+{
+ return -f "include/smb.h";
+}
+
+# Return an #include line depending on whether this build is an in-tree
+# build or not.
+sub choose_header($$)
+{
+ my ($in,$out) = @_;
+ return "#include \"$in\"" if (is_intree());
+ return "#include <$out>";
+}
+
+1;
Modified: branches/SAMBA_4_0/source/pidl/pidl
===================================================================
--- branches/SAMBA_4_0/source/pidl/pidl 2006-03-16 18:54:19 UTC (rev 14487)
+++ branches/SAMBA_4_0/source/pidl/pidl 2006-03-16 20:02:31 UTC (rev 14488)
@@ -613,27 +613,22 @@
unlink($tempfile);
}
+
+ my $comh_filename = ($opt_com_header or "$outputdir/com_$basename.h");
if (defined($opt_com_header)) {
require Parse::Pidl::Samba4::COM::Header;
- my $res = Parse::Pidl::Samba4::COM::Header::Parse($pidl);
+ my $res = Parse::Pidl::Samba4::COM::Header::Parse($pidl,"$outputdir/ndr_$basename.h");
if ($res) {
- my $comh_filename = ($opt_com_header or "$outputdir/com_$basename.h");
- FileSave($comh_filename,
- "#include \"librpc/gen_ndr/ndr_orpc.h\"\n" .
- "#include \"$outputdir/ndr_$basename.h\"\n" .
- $res);
+ FileSave($comh_filename, $res);
}
}
if (defined($opt_dcom_proxy)) {
require Parse::Pidl::Samba4::COM::Proxy;
- my $res = Parse::Pidl::Samba4::COM::Proxy::Parse($pidl);
+ my $res = Parse::Pidl::Samba4::COM::Proxy::Parse($pidl,$comh_filename);
if ($res) {
my ($client) = ($opt_dcom_proxy or "$outputdir/$basename\_p.c");
- FileSave($client,
- "#include \"includes.h\"\n" .
- "#include \"$outputdir/com_$basename.h\"\n" .
- "#include \"lib/com/dcom/dcom.h\"\n" .$res);
+ FileSave($client, $res);
}
}
@@ -690,12 +685,12 @@
require Parse::Pidl::Samba4::NDR::Server;
my $dcom = "";
- foreach my $x (@{$pidl}) {
- next if ($x->{TYPE} ne "INTERFACE");
+ foreach (@{$pidl}) {
+ next if ($_->{TYPE} ne "INTERFACE");
- if (Parse::Pidl::Util::has_property($x, "object")) {
+ if (Parse::Pidl::Util::has_property($_, "object")) {
require Parse::Pidl::Samba4::COM::Stub;
- $dcom .= Parse::Pidl::Samba4::COM::Stub::ParseInterface($x);
+ $dcom .= Parse::Pidl::Samba4::COM::Stub::ParseInterface($_);
}
}
@@ -717,25 +712,16 @@
if (defined($opt_ndr_parser)) {
my $parser_fname = ($opt_ndr_parser or "$outputdir/ndr_$basename.c");
require Parse::Pidl::Samba4::NDR::Parser;
- my $header_fname = $parser_fname;
- $header_fname =~ s/\.c$/\.h/;
- my ($header,$parser) = Parse::Pidl::Samba4::NDR::Parser::Parse($ndr, $basename);
+ my ($header,$parser) = Parse::Pidl::Samba4::NDR::Parser::Parse($ndr, $gen_header, $h_filename);
- my $baseheader = $h_filename; $baseheader =~ s/\/ndr_/\//;
- $header = "#include \"$baseheader\"\n$header";
- $parser = "#include \"includes.h\"\n"
- . "#include \"librpc/gen_ndr/ndr_misc.h\"\n"
- . "#include \"librpc/gen_ndr/ndr_dcerpc.h\"\n"
- . "#include \"$header_fname\"\n\n$parser";
-
FileSave($parser_fname, $parser);
- FileSave($header_fname, $header);
+ FileSave($h_filename, $header);
if (defined($opt_swig)) {
require Parse::Pidl::Samba4::SWIG;
my($filename) = ($opt_swig or "$outputdir/$basename.i");
- Parse::Pidl::Samba4::SWIG::RewriteHeader($pidl, $header_fname, $filename);
+ Parse::Pidl::Samba4::SWIG::RewriteHeader($pidl, $h_filename, $filename);
}
}
More information about the samba-cvs
mailing list