[SVN] r3071 (C)

Allan Odgaard throw-away-1 at macromates.com
Fri Apr 21 23:36:56 UTC 2006


This macro/script will scan the current source for function calls (using a regexp) then call man (looking in section 2 and 3) for each function found, harvest #include lines from that man page (in the SYNOPSIS), and then insert these in the top of the source. Key equivalent is ctrl-#.

Potential improvements:
 1) use a look-up table instead of calling man because:
    a) faster
    b) more precise, e.g. the printf man page also lists stdarg.h under vprintf
    c) more stuff can be added (STL, Cocoa, etc.)
 2) inserted includes should insert extra blank line when the source has no includes, and when the source only has system includes, it should insert immediately below, not n blank lines below
 3) make it use XML input, so we can strip comments, strings, and keywords from what gets parsed for function calls
 4) also find use of data structures in the source (vector, map, string, etc.)

I welcome user contributions, as I probably won’t work on this myself.

Changed:
A   trunk/Bundles/C.tmbundle/Macros/Insert Missing Includes.plist
A   trunk/Bundles/C.tmbundle/Support/bin/
A   trunk/Bundles/C.tmbundle/Support/bin/insert_missing_includes.rb
U   trunk/Bundles/C.tmbundle/info.plist



More information about the textmate-dev mailing list