summaryrefslogtreecommitdiffstats
path: root/clientcomm/rpcif_svc.c.awk
diff options
context:
space:
mode:
Diffstat (limited to 'clientcomm/rpcif_svc.c.awk')
-rw-r--r--clientcomm/rpcif_svc.c.awk59
1 files changed, 59 insertions, 0 deletions
diff --git a/clientcomm/rpcif_svc.c.awk b/clientcomm/rpcif_svc.c.awk
new file mode 100644
index 0000000..3baef21
--- /dev/null
+++ b/clientcomm/rpcif_svc.c.awk
@@ -0,0 +1,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;
+ }