matthew290683
Newbie level 3
- Joined
- Mar 16, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,323
Need some suggestion or thoughts how to automate a process. Assume that there are 10 .c and .h files in a small project and there are ~40 functions. If I make a search with the variable name or the macro name in all the files, then can I print the corresponding functions where it is used?
The requirement is similar to the cross-reference which is supported by tools. I would prefer to use VB, so can someone help me what will be logic for implementing this....
#include <stdio.h>
int getint(void); /*It prompts user to enter an integer, which it returns*/
int getmax(int a, int b, int c); /*It returns value of largest of a, b, c*/
#define TEMP 20
int k1, k2;
int main (void) {
int x, y, z;
x = getint();
y = getint();
z = getint();
k1 = TEMP + z;
printf("The largest of %d, %d, and %d is %d\n", x, y, z, getmax(x,y,z));
}
int getint(void) {
int a;
printf("Please enter an integer > ");
scanf("%d", &a);
return(a);
}
int getmax(int a, int b, int c){
int m = a;
if (m<b)
m = b;
if (m<c)
m = c;
return(m);
}
Assume that the macro TEMP is used in other files also. The program should parse through all of the .c and .h files and find the usage of the macro and provide me a report like
TEMP Declared as: (20)
*Define [atod_accuracy_fault.h, 85] atod_accuracy_fault.h
*Use [atod_accuracy_fault.c, 136] atod_accuracy_fault_rootState_dispatchEvent
Note that the data that is mentioned in the cross reference is a sample. Not specific to the pgm mentioned as example.
The requirement is similar to the cross-reference which is supported by tools. I would prefer to use VB, so can someone help me what will be logic for implementing this....
#include <stdio.h>
int getint(void); /*It prompts user to enter an integer, which it returns*/
int getmax(int a, int b, int c); /*It returns value of largest of a, b, c*/
#define TEMP 20
int k1, k2;
int main (void) {
int x, y, z;
x = getint();
y = getint();
z = getint();
k1 = TEMP + z;
printf("The largest of %d, %d, and %d is %d\n", x, y, z, getmax(x,y,z));
}
int getint(void) {
int a;
printf("Please enter an integer > ");
scanf("%d", &a);
return(a);
}
int getmax(int a, int b, int c){
int m = a;
if (m<b)
m = b;
if (m<c)
m = c;
return(m);
}
Assume that the macro TEMP is used in other files also. The program should parse through all of the .c and .h files and find the usage of the macro and provide me a report like
TEMP Declared as: (20)
*Define [atod_accuracy_fault.h, 85] atod_accuracy_fault.h
*Use [atod_accuracy_fault.c, 136] atod_accuracy_fault_rootState_dispatchEvent
Note that the data that is mentioned in the cross reference is a sample. Not specific to the pgm mentioned as example.