tags:

views:

555

answers:

4

I use tag files for code completion and for a quick, inline view of parameters, overloads, files (where declared), etc. Where can I find freely available tags for the C99, C++03, and C++0x standard libraries? (C89 would be better than nothing, but I'd rather have C99.)

I prefer tags without cruft; e.g. implementations use reserved names for parameters, so instead of "std::min(_M_a, _M_b)", I'd rather see "std::min(a, b)". This and other issues rule out generating from actual implementations. Though I suppose some postprocessing might clean those up (especially the identifier issue), it almost seems like it would be easier to write from scratch.

+1  A: 

generate yourself a tag library using ctags on headers dir, like written in the post blog you link in your question

Valentino Dell'Aica
As I said, "This rules out generating from actual implementations."
Roger Pate
@Roger Pate: This doesn't. Actually your only way is to generate from the implementation. And I don't see a problem, usually the conversions used are consistent so it's easy to scan for implementation reserved identifiers and convert them to something prettier. MVS headers look like they *were* mangled with an automatic tool: alloc -> _Alloc etc...
ybungalobill
@ybungalobill: It seems obvious, to me, this answer was written without more reading than skimming the question. If I've made a mistake in my reasons *why* generating from implementations doesn't work for me, please, point those out, but this definitely doesn't answer my question.
Roger Pate
A: 

This is not a complete answer. Someone published a perl script to extract tags from SGI's STL documentation. It does not include function parameter names. Since it works on the documentation there is no cruft. Hope this helps a bit.

Helmut
SGI's STL docs differ from the standard library in many ways.
Roger Pate
+5  A: 

Generally it is difficult to extract tags from libc because function declarations are likely to be implemented in the headers as complex macros. One can use nm to find a list of symbols exported by the a library, but that doesn't address the parameter list.

I think the best solution here is to parse the documentation:

Here is a list of all functions and macros exported by libc in an easily parsed format:

http://www.gnu.org/s/libc/manual/html_node/Function-Index.html#Function-Index

Each function links to a page that lists the parameters for that function, also in a predictable format:

http://www.gnu.org/s/libc/manual/html_node/Block-Input_002fOutput.html#index-fread-1010

Parsing the pages are pretty easy using BeautifulSoup Python module.

Noah Watkins
What about macro expansion using the C preprocessor?
sellibitze
That would be a neat facility to create. It would be made problematic because it might be very difficult to predict the values used in `#if/#ifdef` that are defined at run-time by the compiler.It would also not allow the extraction of the parameters used in macros that have variadic parameters (i.e. #define func(...)).
Noah Watkins
@Noah: [You can view all the predefined macros through command-line switches with some compilers.](http://stackoverflow.com/questions/75538/hidden-features-of-c/2339965#2339965) Doxygen does something similar to preprocessing, but has several options to control granularity.
Roger Pate
So, it definitely sounds like a there is a reasonable approach out there for doing this w/o parsing the documentation.
Noah Watkins
+2  A: 

For those exact requirements you will probably have to create those yourself :(

ttvd
I think I'll have to bite the bullet and do this, but hopefully the work can be used by others. I'm about halfway through the C++03 stdlib now, and will update the question (for you or anyone else that's interested) in about a week with a link. (Hey, it's in my spare time. ;)
Roger Pate