Standard library tags
Asked Answered
R

5

18

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.

Rarefaction answered 12/10, 2010 at 13:20 Comment(9)
Cool. I had no idea you could do those things in vim.Gauvin
Speaking of tags, shouldn't that be c++1x? ;)Westcott
@JUST MY correct OPINION: c++0xb. Or maybe 0xc ...Andaman
Essentially the question boils down to "give me a link to the tags files or create them for me for 500 points". That eliminates all those recipe answers here.Cartilage
@wilhelmtell: What? Is it wrong for me to put a bounty on the question? Though I didn't say it explicitly (and probably should have, given how much people have had a problem with "freely available" and ready), I also want a download I can point others to so they can get started quickly rather than digging through long and error-prone steps.Rarefaction
@Roger Wow there! I didn't say there's anything wrong here. This is exactly how the market works. We give pieces of processed {wood,metal,bits} an arbitrary value and exchange them for work. I was just interpreting the question because I felt the answers are all wrong (read: correct but for a different question).Cartilage
@wilhelm: Perhaps I read too much into "or create them for me for 500 points". I just don't care about rep, and have never offered a bounty on SO before; thought this would be a good time to try it. (And I'd rather a link to something than someone creating them just for this question, but I guess I wouldn't turn it down.)Rarefaction
Don't know if that helps you, but if you have Notepad++ installed, you'll find its tag list in \plugins\APIs\cpp.xml. Have a look.Dominate
@John: That's a start, but it only lists identifiers for the majority. (For anyone else: download an archive of the latest release, it's at /unicode/plugins/APIs/cpp.xml.) Thanks in any case.Rarefaction
I
2

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

Illconsidered answered 16/10, 2010 at 8:25 Comment(1)
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. ;)Rarefaction
E
5

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.

Excerpt answered 15/10, 2010 at 20:52 Comment(4)
What about macro expansion using the C preprocessor?Metzger
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(...)).Excerpt
You can view all the predefined macros through command-line switches with some compilers. Doxygen does something similar to preprocessing, but has several options to control granularity.Rarefaction
So, it definitely sounds like a there is a reasonable approach out there for doing this w/o parsing the documentation.Excerpt
R
2

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

Recant answered 13/10, 2010 at 11:28 Comment(3)
As I said, "This rules out generating from actual implementations."Rarefaction
@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...Auricular
@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.Rarefaction
I
2

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

Illconsidered answered 16/10, 2010 at 8:25 Comment(1)
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. ;)Rarefaction
S
0

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.

Spears answered 15/10, 2010 at 16:23 Comment(1)
SGI's STL docs differ from the standard library in many ways.Rarefaction
S
0

If getting completion for standard libraries is the main issue, the clang vim plugin does this quite well without using tags at all. There is however, still some parameter "cruft" in the completions, as it uses the symbols used by the header.

You mainly just drop one file in ~/.vim/plugin, install clang, and it works. Much simpler than the omnicomplete route. The only issue I've had so far in my limited use of it is that it is sometimes slow coming up with the completions.

Sooth answered 26/11, 2010 at 0:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.