topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 8:20 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Application that reads header files and reports common usages? Or examples?  (Read 3104 times)

fowmow

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 46
    • View Profile
    • Donate to Member
I wonder if such a beast exists?  If not, I think I'd like to lay claim to the idea right now.

Basically, as a programmer, beginner or otherwise, you may not always know what function exists within what header or may not be able to comprehend the contents of a header file.

Wouldn't a program that reads a header and gives you a common use for it be a grand application for a programmer, beginner or otherwise?

For example, taken from stdio.h:

_CRTIMP int __cdecl printf (const char*, ...);

Um, say what?  Does it really matter that it is a constant pointer to some text to a beginning programmer?  Not really.  And knowing this in the beginning to me is not that big of a deal because pointers is something that should be learned on their own and otherwise, variable and type defining is another thing that should be learned separately.

Instead the program would output something like:

printf("Here is a string: %s", sVar);
%s represents a string and will be replaced with the variable or constant that you provide printf.
sVar represents any valid string reference or constant.

So, the idea is something like API Viewer, only for headers.  However, I would enable the ability to create custom views allowing other types of files as well.  For example, keywords and keyword definitions so someone could define the way another type of "header" is written, thereby enabling this program to read and display that information as well.  Also, it would overcome the shortcomings of API Viewer by being a friendly and intuitive application for beginners as well as advanced programmers.

I have several other ideas and features for the program, but those are mine to share only with those who might contribute to the program's birth, fixes, and upgrades.

So, does something like this exist in some form already?  Again, if not, it's my idea!   :P
I code.  Therefore I am.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
fowmow: I don't know of any such program, which is a good reason you read your language/library documentation instead of digging through header files :)
- carpe noctem

fowmow

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 46
    • View Profile
    • Donate to Member
You must not do much programming if you've never ran across or heard of some obscure library that has poor documentation.
I code.  Therefore I am.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
I do a fair deal of programming, and while fortunately most libraries have at least adequate documentation (if you know where to look), I've run into poorly documented stuff as well. Most poorly documented stuff, fortunately, isn't worth using, though...

Anyway, there's some useful pieces of code that's poorly documented but still worth using (funnily enough, lots of this seem to come with a GPL license ;)).

What exactly is it you want to do, anyway? Scanning header files for just function prototypes, for well-formed source, is easy enough with some regular expression magic, but to do much more than that, you basically need to code a C parser. And it's hard to get more data from a function prototype than it already has - what kind of arguments would you turn "..." into? And what do you expect void* to hold?
- carpe noctem

iphigenie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,170
    • View Profile
    • Donate to Member
That's one of the reasons I like slickedit.
It has enough intelligence about most languages that it can analyse all the files in a project and when you want information about a function in your code it can give you a popup which shows you the definition etc. of your function, what it needs, calls etc.

A lot of IDEs do that for one language, but slickedit has been able to cope with perl, python, c, java and php, and i bet it does others.

It's very handy when using someone else's libraries, or code you wrote (as i dont always remember the order of parameters i chose etc.), or work in a team