svn commit: samba r19580 - in branches/SAMBA_4_0/source/pidl: . lib/Parse/Pidl

jelmer at samba.org jelmer at samba.org
Mon Nov 6 20:01:23 GMT 2006


Author: jelmer
Date: 2006-11-06 20:01:22 +0000 (Mon, 06 Nov 2006)
New Revision: 19580

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19580

Log:
Add --includedir option.

Modified:
   branches/SAMBA_4_0/source/pidl/idl.yp
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm
   branches/SAMBA_4_0/source/pidl/pidl


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/idl.yp
===================================================================
--- branches/SAMBA_4_0/source/pidl/idl.yp	2006-11-06 19:46:50 UTC (rev 19579)
+++ branches/SAMBA_4_0/source/pidl/idl.yp	2006-11-06 20:01:22 UTC (rev 19580)
@@ -470,9 +470,9 @@
 	return CleanData($idl);
 }
 
-sub parse_file($)
+sub parse_file($$)
 {
-	my ($filename) = @_;
+	my ($filename,$incdirs) = @_;
 
 	my $saved_delim = $/;
 	undef $/;
@@ -480,7 +480,8 @@
 	if (! defined $cpp) {
 		$cpp = "cpp";
 	}
-	my $data = `$cpp -D__PIDL__ -xc $filename`;
+	my $includes = map { " -I$_" } @$incdirs;
+	my $data = `$cpp -D__PIDL__$includes -xc $filename`;
 	$/ = $saved_delim;
 
 	return parse_string($data, $filename);

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm	2006-11-06 19:46:50 UTC (rev 19579)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm	2006-11-06 20:01:22 UTC (rev 19580)
@@ -2987,9 +2987,9 @@
 	return CleanData($idl);
 }
 
-sub parse_file($)
+sub parse_file($$)
 {
-	my ($filename) = @_;
+	my ($filename,$incdirs) = @_;
 
 	my $saved_delim = $/;
 	undef $/;
@@ -2997,7 +2997,8 @@
 	if (! defined $cpp) {
 		$cpp = "cpp";
 	}
-	my $data = `$cpp -D__PIDL__ -xc $filename`;
+	my $includes = map { " -I$_" } @$incdirs;
+	my $data = `$cpp -D__PIDL__$includes -xc $filename`;
 	$/ = $saved_delim;
 
 	return parse_string($data, $filename);

Modified: branches/SAMBA_4_0/source/pidl/pidl
===================================================================
--- branches/SAMBA_4_0/source/pidl/pidl	2006-11-06 19:46:50 UTC (rev 19579)
+++ branches/SAMBA_4_0/source/pidl/pidl	2006-11-06 20:01:22 UTC (rev 19580)
@@ -17,7 +17,7 @@
 
 pidl --help
 
-pidl [--outputdir[=OUTNAME]] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--uint-enums] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--uint-enums] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
 
 =head1 DESCRIPTION
 
@@ -57,6 +57,11 @@
 
 Write output files to the specified directory.  Defaults to the current 
 directory.
+
+=item I<--includedir DIR>
+
+Add DIR to the search path used by the preprocessor. This option can be 
+specified multiple times.
 		
 =item I<--parse-idl-tree>
 
@@ -440,6 +445,7 @@
     close(FILE);
 }
 
+my(@opt_incdirs) = (); 
 my($opt_help) = 0;
 my($opt_parse_idl_tree) = 0;
 my($opt_dump_idl_tree);
@@ -484,6 +490,7 @@
  --warn-compat           warn about incompatibility with other compilers
  --quiet                 be quiet
  --verbose               be verbose
+ --includedir DIR        search DIR for included files
 
 Debugging:
  --dump-idl-tree[=FILE]  dump internal representation to file [BASENAME.pidl]
@@ -542,7 +549,8 @@
 	    'com-header:s' => \$opt_com_header,
 	    'quiet' => \$opt_quiet,
 		'verbose' => \$opt_verbose,
-	    'warn-compat' => \$opt_warn_compat
+	    'warn-compat' => \$opt_warn_compat,
+		'includedir=s@' => \@opt_incdirs
 	    );
 
 if (not $result) {
@@ -571,7 +579,7 @@
 	} else {
 		require Parse::Pidl::IDL;
 
-		$pidl = Parse::Pidl::IDL::parse_file($idl_file);
+		$pidl = Parse::Pidl::IDL::parse_file($idl_file, \@opt_incdirs);
 		defined @$pidl || die "Failed to parse $idl_file";
 		require Parse::Pidl::Typelist;
 		Parse::Pidl::Typelist::LoadIdl($pidl);



More information about the samba-cvs mailing list