Author Topic: Where is the other procedures/functions in Code Completion?  (Read 4580 times)

Offline joubertdj

  • Multiple posting newcomer
  • *
  • Posts: 120
Where is the other procedures/functions in Code Completion?
« on: September 22, 2006, 11:48:20 am »
Hi C::B

I have been watching the C::B development closely...
The "older" CodeCompletion used to have a type of cache where you would iterate through all of your include files to get all the functions and variables and so on and so forth... worked nicely... but you ended up with only using a small part of it...
The "newer" (In development one) works far better in the sense of effeciency... Am I correct so far?

The query that I have is this... When I use my Allegro header file... I only seem to have the functions that is within the specific #include<allegro.h> file... I am missing some other functions and or procedures that is used by allegro.h... do I need to add everyone with the function that I require... or does the new code completion go through the allegro.h's include files to determine all the functions and procedures in your project?

I am missing some functions you see, which I know out of my head... but it would be nice if it be in the code completion...


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Where is the other procedures/functions in Code Completion?
« Reply #1 on: September 22, 2006, 12:47:17 pm »
The parser "follows" #includes as it sees them. Two factors can affect this:

  • The parser settings in code-completion options: Follow local/global includes.
  • The compiler include dirs (global/project/target). Obviously, for the parser to be able to open an #included file it first has to find it. The compiler include dirs are searched for this file. If it is not found, it is ignored.


Finally, code inside #if-#ifdef-#ifndef-#elif-#else-#endif preprocessor macros is parsed differently now than before. The old behaviour was to parse everything. This would be ok some times but some other times it would produce wrong results (and faulty code-completion).
The new approach is the same as ctags (AFAIK): the #elif-#else-#endif parts are ignored. Except the special case #if 0 where it should ignore this and parse the #else part (but it doesn't: it's on the todo list).
Be patient!
This bug will be fixed soon...

Offline joubertdj

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: Where is the other procedures/functions in Code Completion?
« Reply #2 on: September 22, 2006, 12:55:18 pm »
Thanks for the quick reply... I will go and play with the settings to see if I can't achieve my desired results.

Offline joubertdj

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: Where is the other procedures/functions in Code Completion?
« Reply #3 on: September 22, 2006, 01:34:57 pm »
 :x Okay ... so I enabled everything in local and global in the code completion configuration. I also added the include directories... both (c:\mingw\include and c:\mingw\include\allegro) in the targets,global, and local area... even though the compiler sees everything... stil nothing more than what I had...

Then I noticed something... and it is probably another white rabbit... but in the allegro.h files... all it's include files are declared as #include "something"
so I changed that to #include <something>

that still did not do it... the irony is... I think it is only the allegro files... because my own files and projects has everything sorted and working sweet... Ah well...

Any final ideas before I just accept and continue?

Offline joubertdj

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: Where is the other procedures/functions in Code Completion?
« Reply #4 on: September 22, 2006, 01:52:42 pm »
I determined through all the #ifndef ALLEGRO_H type declerations that all of the files are "seen" and "run" through... and then I saw how they declared the functions... ouch... don't know if your code parser will sort out that type of function decleration:

They use this helper function:

#ifndef AL_FUNC
   #define AL_FUNC(type, name, args)               type name args
#endif

and then they declare the function in another header with:

AL_FUNC(void, get_executable_name, (char *output, int size));

 :shock: Me to basic to go through everything... but me understand now why it not work...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Where is the other procedures/functions in Code Completion?
« Reply #5 on: September 22, 2006, 02:13:24 pm »
No, sorry. Our parser doesn't handle this and never will. It's parsing at least half-sane code. This is insane :)...
Be patient!
This bug will be fixed soon...