summaryrefslogtreecommitdiffstats
path: root/clientcomm/rpcif_clnt.c.awk_dec
blob: 46a4bdf0a45946c9ba00a03c888e9bbe352a2d91 (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
BEGIN                 { nodebug = 0;
			print"#include <stdio.h>";
			print"#ifdef AIX";
			print"#include <strings.h>";
			print"#endif";
			print"#include \"raslib/error.hh\"";
			print"#include \"raslib/rminit.hh\"";
			}
/^rpc[^(]*([^)]*)/	{
			sig = substr($0, 1, index($0,"(") - 1);
			getline;
			par1 = substr($0, 1, length - 1);
			getline;
			par2 = substr($0, 1, length - 1);
			print sig "(" par1 "," par2 ")";
			if ( sig == "rpcshutdown" )
				nodebug = 1;
			next;
			}

#/rpcshutdown/         { nodebug = 1; print $0; next; }
/^}/                  { nodebug = 0; print $0; next; }
nodebug==1            { print $0; next; }
/static.*res;/    { print $0; print "\tenum clnt_stat stat;\n"; next; }
/if.*clnt_call/       { x=$0;
                        sub(/if *\( *clnt_call/, "if ( (stat = clnt_call", x);
                        sub(/\) *!= *RPC_SUCCESS *\)/, ") ) != RPC_SUCCESS )", x); 
                        print x;
                        next;
                      }
/\) *!= *RPC_SUCCESS/ { x=$0; 
                        sub(/\) *!= *RPC_SUCCESS *\)/, ") ) != RPC_SUCCESS )", x);
                        print x;
                        next;
                      }
/return *\(NULL\)/	{
			print "\t\tclnt_perrno( stat );";
			print $0;
			print "\t\t}";
			
			print "\tif (*((u_short*)&res) == 42)";
			print "\t\t{";
			print "\t\tGetExtendedErrorInfo* result = NULL;";
			print "\t\tint dummy;";
			print "\t\tint counter = 0;";
			print "\t\twhile (!(result = rpcgeterrorinfo_1(&dummy, clnt)) && (counter < RMInit::rpcMaxRetry))";
			print "\t\t\t{";
			print "\t\t\tcounter++;";
			print "\t\t\t}";
			print "\t\tr_Error* t = NULL, e;";
			print "\t\tif (counter == RMInit::rpcMaxRetry)";
			print "\t\t\tt = new r_Error(RPCCOMMUNICATIONFAILURE);";
			print "\t\telse";
			print "\t\t\tt = r_Error::getAnyError(result->errorText);";
			print "\t\te=*t;";
			print "\t\tdelete t;";
			print "\t\tthrow e;";
			next;
			}


                      { print $0; }