Author Topic: [Solved] How can i search a function definition through a function prototype?  (Read 6032 times)

Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Code: [Select]
typedef
int
(__cdecl *foofunc) {
  char      *varname,
  foostruct abc,
  int       datasize
);

whenever there is a typedef function pointer, i can't find any reference (function implementation) in my tag file with CTRL+/ or CTRL+F12. Is it any method to satisfy my needs? thank you,.
« Last Edit: August 13, 2010, 02:03:00 am by Gilvin »

Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Re: How can i search a function definition through a function prototype?
« Reply #1 on: August 09, 2010, 02:44:50 am »
bump*

Graeme

  • Senior Community Member
  • Posts: 2432
  • Hero Points: 322
Re: How can i search a function definition through a function prototype?
« Reply #2 on: August 09, 2010, 11:35:43 am »
You have a syntax error.  The { should be a (


Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Re: How can i search a function definition through a function prototype?
« Reply #3 on: August 11, 2010, 06:30:04 am »
oops i have a typo here,  :-[

but in my code the syntax is correct, slickedit wouldn't find me referrence of a function prototype.....

Graeme

  • Senior Community Member
  • Posts: 2432
  • Hero Points: 322
Re: How can i search a function definition through a function prototype?
« Reply #4 on: August 11, 2010, 11:03:00 am »
but in my code the syntax is correct, slickedit wouldn't find me referrence of a function prototype.....

The code you posted shows a typedef of a function pointer  - function pointers are not function prototypes and are not associated with specific functions.  If you still think you have a problem, post full details of the code that you think slick should find references for.

Graeme

Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Re: How can i search a function definition through a function prototype?
« Reply #5 on: August 11, 2010, 11:55:44 pm »
thank you and sorry for my bad english..

Code: [Select]
typedef
int
(__cdecl *foofunc) (
  char      *varname,
  foostruct abc,
  int       datasize
);

Code: [Select]
typedef struct _FUNC_STRUCT {
  foofunc        FUNC1;
  foofunc        FUNC2;
} FUNC_STRUCT;

when i run a full project tag on .c, .h file, slickedit can't find any reference of a typedef function pointer, if i manually drag all the .c, .h file in my project, then slickedit can do exactly what i ask it to do, press SHIFT+F12 and referrence block will show which struct (in this case the FUNC_STRUCT) the function pointer produces, then i could trace deeper.

but usually my project has over 18000 .c, .h files, if i always drag files manually, my slickedit will be very slow and cost more then 200MB of ram...
« Last Edit: August 12, 2010, 12:01:20 am by Gilvin »

Graeme

  • Senior Community Member
  • Posts: 2432
  • Hero Points: 322
Re: How can i search a function definition through a function prototype?
« Reply #6 on: August 12, 2010, 11:34:13 am »
If I add the typedef to a header file and your struct to a .c file or declare foofunc xyz; in some other file, slickedit finds the references ok.  I have "tag files on save" enabled.  If I rebuild the tag file, slick still finds the references ok.

What do you mean by "manually drag all the .c .h files"?  I don't understand what this means.

Do you mean "tag" instead of "drag"?  If so, how do you manually tag a file and why would it cost 200 MB of RAM?

Graeme


Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Re: How can i search a function definition through a function prototype?
« Reply #7 on: August 12, 2010, 01:11:28 pm »
sorry for my bad english again :(

I am a bios engineer, and i have different compiler set on different codebases. usually when i get my codebase, i will do a full tag on .c, .h files (Option-> Quick Start Config Wizard -> Context Tagging -> Tag Compiler Libraries) then bind the tag file to my compiler set.
 
I only need to edit some of the files in the codebase to get my job done, so my daily work is opening a single file and trace foward/backward. I can find most of the proper prototype /reference this way, no need to create a project. But that causes the problem i've mentioned: when a function's prototype is a typedef function pointer, i couldn't trace the source properly (no matter if i traced is a prototype or reference)

If i want to solve this issue, i have to create a project, then manually drag (add tree) all the .c, .h files to my project and let slickedit create another tag file for this project.

In this case, problem solved, but it brings another problem: 200MB+ memory usage and a very slow reation on the editor. And i don't know the difference between "tag compiler libraries" and "project tag", the outcome acts different.

because of my job i have to change codebases once a week, i can't create every codebase a project, or my time will be wasted on tagging files and i have to bear the slow reation of the editor....

hs2

  • Senior Community Member
  • Posts: 2744
  • Hero Points: 288
Re: How can i search a function definition through a function prototype?
« Reply #8 on: August 12, 2010, 06:16:18 pm »
One major difference is that the compiler tag file(s) are build/updated on demand and not automagically as done for workspace tag files. SE only tracks file changes of workspace resp. project files for a good reason.
So in your case I'd create a mini-workspace containing 1 or more mini-project(s) covering the files you're changing in addition to your compiler tag file set.
Since you don't care much about project build support due to your external build toolchain it should be not that hard to setup e.g. using the wizard.
To be clear on that: You need a workspace.
Good luck, HS2

Gilvin

  • Community Member
  • Posts: 86
  • Hero Points: 1
Re: How can i search a function definition through a function prototype?
« Reply #9 on: August 13, 2010, 02:02:41 am »
i got your point, maybe i should cut the codebases into small project in one workspace, thank you all, problem solved! ;D