diff options
author | okellogg <okellogg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-01-20 21:28:38 +0000 |
---|---|---|
committer | okellogg <okellogg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-01-20 21:28:38 +0000 |
commit | 90d23323b7b962baf03c6cd9d655d079f8bad819 (patch) | |
tree | 17a463bf1b80e0ad97aafc884970fa1827e4b282 /bin | |
parent | 8eed60d173bef3c5772c37291049d913194a83cd (diff) | |
download | ATCD-90d23323b7b962baf03c6cd9d655d079f8bad819.tar.gz |
ChangeLogTag:2002-01-20 Oliver Kellogg <oliver.kellogg@sysde.eads.net>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/subst_env.pl | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/bin/subst_env.pl b/bin/subst_env.pl new file mode 100755 index 00000000000..372967da1fb --- /dev/null +++ b/bin/subst_env.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# +# $Id$ +# +# This script eases the transition from the ACE_TRY_ENV declarations +# and method parameters to the TAO_ENV_ARG macros. +# It was used for converting TAO between versions 1.2.1 and 1.2.2. +# The converted output is written to stdout. +# Typical usage would be as follows: +# perl subst_env.pl file_with_acetryenv.cpp >file_with_taoenvarg.cpp +# +$last=""; +$envdecl = "CORBA(::|_)Environment *& *ACE_TRY_ENV"; +$default = " *= *TAO_default_environment"; +while (($l = <>)) { + if ($l =~ /ACE_TRY_ENV/) { + if ($l =~ /$envdecl/) { + if ($l =~ /^\s*$envdecl/) { + my $single = "SINGLE_"; + if ($last =~ /,\s*$/) { + $last =~ s/,\s*$/\n/; + $single = ""; + } + if ($l =~ /$default/) { + $l =~ s/$envdecl${default} *\(\)/TAO_ENV_${single}ARG_DECL_WITH_DEFAULTS/; + } else { + $l =~ s/$envdecl/TAO_ENV_${single}ARG_DECL/; + } + } elsif ($l =~ /,\s*$envdecl/) { + if ($l =~ /$default/) { + $l =~ s/,\s*$envdecl${default} *\(\)/ TAO_ENV_ARG_DECL_WITH_DEFAULTS/; + } else { + $l =~ s/,\s*$envdecl/ TAO_ENV_ARG_DECL/; + } + } else { + if ($l =~ /$default/) { + $l =~ s/$envdecl${default} *\(\)/TAO_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS/; + } else { + $l =~ s/$envdecl/TAO_ENV_SINGLE_ARG_DECL/; + } + } + } elsif ($l =~ /^\s*ACE_TRY_ENV/) { + $last =~ s/,\s*$/\n/; + $l =~ s/ACE_TRY_ENV/TAO_ENV_ARG_PARAMETER/; + } elsif ($l =~ /, *ACE_TRY_ENV/) { + $l =~ s/, *ACE_TRY_ENV/ TAO_ENV_ARG_PARAMETER/; + } else { + $l =~ s/ACE_TRY_ENV/TAO_ENV_SINGLE_ARG_PARAMETER/; + } + print $last; + print $l; + $last = ""; + } elsif ($l =~ /CORBA(::|_)Environment *&/) { + if ($l =~ /^\s*CORBA(::|_)Environment *&/) { + $last =~ s/,\s*$/\n/; + $l =~ s/CORBA(::|_)Environment *&/TAO_ENV_ARG_DECL_NOT_USED/; + } elsif ($l =~ /,\s*CORBA(::|_)Environment *&/) { + $l =~ s/,\s*CORBA(::|_)Environment *&/ TAO_ENV_ARG_DECL_NOT_USED/; + } else { + $l =~ s/CORBA(::|_)Environment *&/TAO_ENV_SINGLE_ARG_DECL_NOT_USED/; + } + print $last; + print $l; + $last = ""; + } else { + print $last; + $last = $l; + } +} +print $last; + |