B
bim_bom
Hi,
is there any tool to change naming convention in c++ sources?
I mean something, that parses cpp and h files in my project, and it finds,
what variables are there declared. I think, it should have a public
"CALLBACK" function (which would be impemented by me), which would tell the
program, how to rename variables and functions.
It should work like that:
I have sourcecode:
const int GLOBALX=1;
int main()
{
int VAR=2;
};
This program would parse this file, and find, that there are 2 variables:
GLOBALX and VAR. This function to tell, how to change names (created by me)
would look like this:
char * ChangeNameToWhatName(char *OldName,char *Type,bool IsGlobal)
{
char *dup=strdup(OldName); // make a copy
for(int a=0;a<strlen(dup);++a) // make to lower
dup[a]=tolower(dup[a]);
if(IsGlobal) // if global variable, change first letter to uppercase
dup[0]=toupper(dup[0]);
}
and after that, this program should change my sourcecode to:
const int Globalx=1;
int main()
{
int var=2;
};
I know, that sometimes there are variables of the same name dclared in 2 or
more different places, but this program could exclude these variables from
changing, so that exrything would compile after that without problems.
Are there any such parsing programs? I want to change naming convention in
my program, and don't want to do it manually
I don't use many macros, so this program don't have to be "#define - aware".
is there any tool to change naming convention in c++ sources?
I mean something, that parses cpp and h files in my project, and it finds,
what variables are there declared. I think, it should have a public
"CALLBACK" function (which would be impemented by me), which would tell the
program, how to rename variables and functions.
It should work like that:
I have sourcecode:
const int GLOBALX=1;
int main()
{
int VAR=2;
};
This program would parse this file, and find, that there are 2 variables:
GLOBALX and VAR. This function to tell, how to change names (created by me)
would look like this:
char * ChangeNameToWhatName(char *OldName,char *Type,bool IsGlobal)
{
char *dup=strdup(OldName); // make a copy
for(int a=0;a<strlen(dup);++a) // make to lower
dup[a]=tolower(dup[a]);
if(IsGlobal) // if global variable, change first letter to uppercase
dup[0]=toupper(dup[0]);
}
and after that, this program should change my sourcecode to:
const int Globalx=1;
int main()
{
int var=2;
};
I know, that sometimes there are variables of the same name dclared in 2 or
more different places, but this program could exclude these variables from
changing, so that exrything would compile after that without problems.
Are there any such parsing programs? I want to change naming convention in
my program, and don't want to do it manually
I don't use many macros, so this program don't have to be "#define - aware".