summaryrefslogtreecommitdiffstats
path: root/clientcomm/rpcif_svc.c.awk
blob: 3baef21e64e8d27b1dc1e13f8d23480c968bb051 (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
BEGIN			{
			print "//patched by awk 1";
			print "#include \"raslib/error.hh\""
			print "#include \"servercomm/servercomm.hh\""
			print "#include <new>"
			print "char *secureResultBufferForRPC;"
			print "bool bMemFailed = false;"
			print "//end patched by awk 1";
			}
/result\ =\ .*local/	{
			print "//patched by awk 2";
			print "\ttry\t{";
			print "//end patched by awk 2";
			print $0;
			print "//patched by awk 2.1";
			print "\t\t}";
			print "\tcatch (r_Error& e)";
			print "\t\t{";
			print "\t\tretvalTxt = e.serialiseError();";
			print "\t\tu_short temp = 42;";
			print "\t\tresult = secureResultBufferForRPC;";
			print "\t\tmemcpy(result, (char*)&temp, sizeof(u_short));"
			print "\t\t}";
			print "\tcatch (std::bad_alloc)";
			print "\t\t{";
			print "\t\tbMemFailed = true;"
			print "\t\tServerComm* sc = ServerComm::actual_servercomm;"			
			print "\t\tr_Ememory_allocation e;"
			print "\t\tretvalTxt = e.serialiseError();"
			print "\t\tu_short temp = 42;";
			print "\t\tresult = secureResultBufferForRPC;"
			print "\t\tmemcpy(result, (char*)&temp, sizeof(u_short));"
			print "\t\t"
			print "\t\t}";
			print "//end patched by awk 2.1";
			next;
			}
/^void$/		{
			print "//patched by awk 3";
			print "char\*";
			print "//end patched by awk 3";
			next;
			}
/^{$/			{
			print $0;
			print "//patched by awk 4";
			print "char\* retvalTxt = 0;";
			print "//end patched by awk 4";
			next;
			}
/return;/		{
			print "//patched by awk 5";
			print "return retvalTxt;";
			print "//end patched by awk 5";
			next;
			}
			{
			print $0;
			}