Re: BUG - perl binding and IDL include path



Alex Hornby <alex anvil co uk> writes:

> If I initialise the perl binding with:
> 
> use CORBA::ORBit idl_path => "$ENV{ATEBUILD}/include/source:$ENV{ATE}/include:$ENV{TAO_ROOT}/orbsvcs/orbsvcs",
>                  idl => [ 
> 			 qw( CosNaming.idl
> 			     ate/types/ATE.idl
> 			     ate/server/Pingable.idl
> 			     ate/server/ATEAuth.idl
> 			     ate/server/SessionFactory.idl
> 			   )
> 			];
> 
> The idl_path is used to open the IDL files correctly, but is _not_
> passed on to the preprocessor, which will then silently fail to open
> IDL referenced by a #include inside the toplevel IDLs.
> 
> This is with CORBA-ORBit-0.4.3. Is there anyway I can get it to pass
> on the idl_path to the preprocessing stage?

Could you test the following patch? I think it should do what
you want.

Regards,
                                        Owen
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/orbit-perl/ChangeLog,v
retrieving revision 1.18
diff -u -r1.18 ChangeLog
--- ChangeLog	2000/11/18 08:05:12	1.18
+++ ChangeLog	2000/12/14 01:18:01
@@ -1,3 +1,10 @@
+Wed Dec 13 20:16:58 2000  Owen Taylor  <otaylor redhat com>
+
+	* ORBit.xs idl.[ch]: Allow passing in flags for IDL compiler.
+
+	* ORBit.pm: Pass directories from idl_path as -I flags
+	to the IDL compiler.
+
 Sat Nov 18 03:03:24 2000  Owen Taylor  <otaylor redhat com>
 
 	* ORBit.xs: Add implementation of 
Index: ORBit.pm
===================================================================
RCS file: /cvs/gnome/orbit-perl/ORBit.pm,v
retrieving revision 1.6
diff -u -r1.6 ORBit.pm
--- ORBit.pm	2000/11/18 08:05:12	1.6
+++ ORBit.pm	2000/12/14 01:18:01
@@ -30,6 +30,29 @@
 
 my $IDL_PATH;
 
+sub load_idl {
+    my ($orb, $file) = @_;
+    
+    my $path = defined $IDL_PATH ? $IDL_PATH : "";
+    my $includes = join (" ", map { "-I ".$_ } split /:/,$path);
+    
+    if ($file =~ m ^/@) {
+	if (-e $file) {
+	    $orb->load_idl_file("$file", $includes);
+	    return 1;
+	}
+    } else {
+	foreach ((split /:/, $path), ".") {
+	    if (-e "$_/$file") {
+		$orb->load_idl_file("$_/$file", $includes);
+		return 1;
+	    }
+	}
+    }
+
+    0;
+};
+
 sub import {
     my $pkg = shift;
 
@@ -59,21 +82,7 @@
 
     file:
 	foreach my $file (@idls) {
-	    if ($file =~ m ^/@) {
-		if (-e $file) {
-		    $orb->load_idl_file("$file");
-		    next file;
-		}
-	    } else {
-		my $path = defined $IDL_PATH ? $IDL_PATH : "";
-		foreach ((split /:/, $path), ".") {
-		    if (-e "$_/$file") {
-			$orb->load_idl_file("$_/$file");
-			next file;
-		    }
-		}
-	    }
-	    Carp::croak("Cannot locate IDL file: '$file'");
+	    load_idl($orb, $file) or Carp::croak("Cannot load IDL file: '$file'");
 	}
     }
 }
Index: ORBit.xs
===================================================================
RCS file: /cvs/gnome/orbit-perl/ORBit.xs,v
retrieving revision 1.6
diff -u -r1.6 ORBit.xs
--- ORBit.xs	2000/11/18 08:05:12	1.6
+++ ORBit.xs	2000/12/14 01:18:01
@@ -295,11 +295,12 @@
     RETVAL
 
 void
-load_idl_file (self, filename)
+load_idl_file (self, filename, includes="")
     CORBA::ORB self
     char *     filename
+    char *     includes
     CODE:
-    porbit_parse_idl_file (filename);
+    porbit_parse_idl_file (filename, includes);
 
 void
 preload (self, id)
Index: idl.c
===================================================================
RCS file: /cvs/gnome/orbit-perl/idl.c,v
retrieving revision 1.4
diff -u -r1.4 idl.c
--- idl.c	2000/07/08 19:05:02	1.4
+++ idl.c	2000/12/14 01:18:01
@@ -1073,7 +1073,8 @@
 }
 
 CORBA_boolean
-porbit_parse_idl_file (const char *file)
+porbit_parse_idl_file (const char *file,
+		       const char *includes)
 {
   IDL_tree tree;
   IDL_ns ns;
@@ -1085,7 +1086,7 @@
    * is #pragma push inhibit, which breaks us badly, since
    * we can't rely on the definitions in some C library!
    */
-  ret = IDL_parse_filename (file, "", NULL, &tree, &ns,
+  ret = IDL_parse_filename (file, includes, NULL, &tree, &ns,
 			    IDLF_TYPECODES | IDLF_CODEFRAGS,
 			    IDL_WARNING1);
 
Index: idl.h
===================================================================
RCS file: /cvs/gnome/orbit-perl/idl.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 idl.h
--- idl.h	2000/01/02 21:16:20	1.1.1.1
+++ idl.h	2000/12/14 01:18:01
@@ -3,6 +3,7 @@
 
 #include <orb/orbit.h>
 
-CORBA_boolean porbit_parse_idl_file (const char *file);
+CORBA_boolean porbit_parse_idl_file (const char *file, 
+				     const char *includes);
 
 #endif /* __PORBIT_IDL_H__ */




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]