Hi,
How to replace only the function calls with a new name and skip the function definition and declarations. consider the following code.
There are 2 functions defined here returnint and returnvoid.
I need to replace returnint with giveint and returnvoid with givevoid only in the function calls.
1 static int returnint(int num1);
2 static void returnvoid(int num1);
3 void main()
4 {
5 int num1;
6 num1=returnint(3);
7 returnvoid(2);
8 returnvoid(5);
9 }
10 static int returnint(int num1)
11 {
12 returnvoid(5);
13 return 12;
14 }
15 static void returnvoid(int num1)
16 {
17 return;
18 }
function calls are present in line numbers 6,7,8 and 12. so in all these lines, the existing function is to be replaced with the new names given.
funcion declarations and definitions present at lines 1,2,10 and 15 are to be skipped and the original function names are to be retained.
sample output:
1 static int returnint(int num1);
2 static void returnvoid(int num1);
3 void main()
4 {
5 int num1;
6 num1=giveint(3);
7 givevoid(2);
8 givevoid(5);
9 }
10 static int returnint(int num1)
11 {
12 givevoid(5);
13 return 12;
14 }
15 static void returnvoid(int num1)
16 {
17 return;
18 }
Thanks,
Srini