I need to create a function pointer file. I am using perl for the same.
My input is a list of function declarations. Below are some examples:
1.
char * cc_Hightor_ind(Closed* p_Closed);
to
char * (*cc_Hightor_ind)(Closed* p_Closed);
2.
char cc_Hightor_ind(Closed* p_Closed);
to
char (*cc_Hightor_ind)(Closed* p_Closed);
These are 2 usual cases where the function returns a pointer and value.
I am unable to resolve on how to convert the function name to be preceded by (*.
My logic is on finding ‘_ind’, I back-track to the start of the word and add (* .
I am finding it hard to translate this to code.
Please suggest the same. Currently I am using the regex to each datatype and adding adding (* to it which is a very lengthy process.
Thanks in advance
Update according to updated question:
output: