#!/usr/bin/perl
use strict;
use CORBA::IDL 2.61;
# visitors
my $parser = CORBA::IDL::ParserFactory::create('3.0');
$parser->getopts('hi:p:st:vx');
if ($parser->YYData->{opt_v}) {
print "CORBA::JAVA $CORBA::JAVA::VERSION\n";
print "CORBA::IDL $CORBA::IDL::VERSION\n";
print "IDL $CORBA::IDL::Parser::IDL_VERSION\n";
print "$0\n";
print "Perl $] on $^O\n";
exit;
}
if ($parser->YYData->{opt_h}) {
pod2usage(-verbose => 1);
}
my $cflags = '-D__idl2java';
if ($CORBA::IDL::Parser::IDL_VERSION lt '3.0') {
$cflags .= ' -D_PRE_3_0_COMPILER_';
}
my $preprocessor;
if ($^O eq 'MSWin32') {
$preprocessor = 'cpp -C ' . $cflags;
# $preprocessor = 'CL /E /C /nologo ' . $cflags; # Microsoft VC
}
else {
$preprocessor = 'cpp -C ' . $cflags;
}
$parser->Configure(
'forward_constructed_forbidden' => 1,
'preprocessor' => $preprocessor,
'verbose_error' => 1, # 0, 1
'verbose_warning' => 1, # 0, 1
'verbose_info' => 1, # 0, 1
'verbose_deprecated' => 0, # 0, 1 (concerns only version '2.4' and upper)
# 'collision_allowed' => 1,
);
$parser->Run(@ARGV);
$parser->DisplayStatus();
my $root = $parser->getRoot();
if (defined $root) {
$root->visit(new CORBA::IDL::RepositoryIdVisitor($parser));
if ($parser->YYData->{opt_x}) {
$parser->Export();
}
$root->visit(new CORBA::IDL::UidVisitor($parser))
if ($parser->YYData->{opt_s});
$root->visit(new CORBA::JAVA::NameVisitor($parser, $parser->YYData->{opt_p}, $parser->YYData->{opt_t}));
$root->visit(new CORBA::JAVA::LiteralVisitor($parser));
$root->visit(new CORBA::JAVA::Name2Visitor($parser));
$root->visit(new CORBA::JAVA::UidVisitor($parser));
$root->visit(new CORBA::JAVA::ClassVisitor($parser));
}
__END__
=head1 NAME
idl2java - IDL compiler to language Java mapping
=head1 SYNOPSIS
idl2java [options] I<spec>.idl
=head1 OPTIONS
All options are forwarded to C preprocessor, except -h -i -v -x.
With the GNU C Compatible Compiler Processor, useful options are :
=over 8
=item B<-D> I<name>
=item B<-D> I<name>=I<definition>
=item B<-I> I<directory>
=item B<-I->
=item B<-nostdinc>
=back
Specific options :
=over 8
=item B<-h>
Display help.
=item B<-i> I<directory>
Specify a path for import (only for IDL version 3.0).
=item B<-p> "I<m1>=I<prefix1>;..."
Specify a list of prefix (gives full qualified Java package names).
=item B<-s>
Generate the same serial uid as with C & Python.
=item B<-t> "I<m1>=I<new.name1>;..."
Specify a list of name translation (gives full qualified Java package names).
=item B<-v>
Display version.
=item B<-x>
Enable export (only for IDL version 3.0).
=back
=head1 DESCRIPTION
B<idl2java> parses the given input file (IDL) and generates files that
following the IDL to Java Language Mapping Specification, v1.2.
B<idl2java> is a Perl OO application what uses the visitor design pattern.
The parser is generated by Parse::Yapp.
B<idl2java> needs a B<cpp> executable.
CORBA Specifications, including IDL (Interface Language Definition) and
JAVA Language Mapping are available on E<lt>http://www.omg.org/E<gt>.
=head1 SEE ALSO
cpp, L<idl2html>, L<idl2c>
=head1 COPYRIGHT
(c) 2002-2007 Francois PERRAD, France. All rights reserved.
This program and all CORBA::JAVA modules are distributed
under the terms of the Artistic Licence.
=head1 AUTHOR
Francois PERRAD, francois.perrad@gadz.org
=cut