blob: 845265a241232be5ae2ffbb1264692411bd391a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/usr/bin/perl
#
# $Id$
#
# This script eases the transition from the CORBA::Environment& ACE_TRY_ENV
# declarations and method parameters to the ACE_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} *\(\)/ACE_ENV_${single}ARG_DECL_WITH_DEFAULTS/;
} else {
$l =~ s/$envdecl/ACE_ENV_${single}ARG_DECL/;
}
} elsif ($l =~ /,\s*$envdecl/) {
if ($l =~ /$default/) {
$l =~ s/,\s*$envdecl${default} *\(\)/ ACE_ENV_ARG_DECL_WITH_DEFAULTS/;
} else {
$l =~ s/,\s*$envdecl/ ACE_ENV_ARG_DECL/;
}
} else {
if ($l =~ /$default/) {
$l =~ s/$envdecl${default} *\(\)/ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS/;
} else {
$l =~ s/$envdecl/ACE_ENV_SINGLE_ARG_DECL/;
}
}
} elsif ($l =~ /^\s*ACE_TRY_ENV/) {
$last =~ s/,\s*$/\n/;
$l =~ s/ACE_TRY_ENV/ACE_ENV_ARG_PARAMETER/;
} elsif ($l =~ /, *ACE_TRY_ENV/) {
$l =~ s/, *ACE_TRY_ENV/ ACE_ENV_ARG_PARAMETER/;
} else {
$l =~ s/ACE_TRY_ENV/ACE_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 *&/ACE_ENV_ARG_DECL_NOT_USED/;
} elsif ($l =~ /,\s*CORBA(::|_)Environment *&/) {
$l =~ s/,\s*CORBA(::|_)Environment *&/ ACE_ENV_ARG_DECL_NOT_USED/;
} else {
$l =~ s/CORBA(::|_)Environment *&/ACE_ENV_SINGLE_ARG_DECL_NOT_USED/;
}
print $last;
print $l;
$last = "";
} else {
print $last;
$last = $l;
}
}
print $last;
|