Janitors Note: This was originally posted as a sourcecode node (i.e. in the Code Catacombs section).
It has been moved to the CUFP section, but that had the side-effect of making the doctext too large to fit.
Therefore, the code has been removed — it can be found on the external site (sourceforge) anyway,
as the OP notes in the description below.
TkCodex is a specialized code VIEWER that will help you give up sliced bread. I built it for me and
my_nihilist while we're learning C, so its been getting tweaked for months now and runs without errors. It works as a single script without configuration, includes a quick reference, and requires no non-standard modules.
The original idea was a read-only GUI app for scanning code when I couldn't remember the exact format of a seldom used command -- the way one might use "grep -r obscurnew()" on a tree of scripts. It also turned out to be great for development and debugging: rather than doing split screens in vim or repeated cat | less scans I now had a specific tool for highlighting all instances of a variable or function call in works-in-progress. I then intended to add a couple of sets of color to distinguish one highlight search from another. TkCodex does that, and it indexes the searches in a side panel, creating a clickable list of instances by line number. It also allows you to quickly add hypertext style notes to a piece of code. These notes and highlights can then be saved in a seperate file, without the possibility of affecting the code itself. You can remove individual or sets of highlight(s) as easily as you create them. There is a "command history" like less and vim, so you don't have to type in a previously done search.
Since TkCodex performs a unique set of functions (as far as I know), it is not based on any existing GUI interface or concept. Also, it uses key macros for speed rather than a lot of 2D mouse menus. I didn't try to include syntax highlighting.
Here's two ways to use it:
- Find examples: Launch TkCodex from the command-line with a directory and a regular expression, and it will start up with the results of a recursive grep style search ranked in a list of files. Then you just hit a button and the "top four" files are loaded into seperate tabs with the regexp highlighted AND INDEXED, allowing you to quickly peruse a number of (eg.) practically applied commands. If you use vim and have "--remote" compiled in, you can even send a line directly from TkCodex into INSERT mode, saving cut/paste or typing time.
- Decyphering a single file: Often a major part of this is tracking global variables, function calls, etc. You can load the file, AUTOMATICALLY index all (perl) subroutines in a side-panel (and now go from one to another with a single click!), then begin highlighting ALL instances of a particular variable, unhighlite them, manually highlite anything, and index all this in the side-panel too. You can even add little hypertext notes as you go and save all this information in a seperate file that then can be applied to the same script again later.
Monitored in top, TkCodex runs with with a stable residential memory size of 14 Mb.
A complete set of instructions is in the __DATA__ section of the script.
TkCodex is maintained at SourceForge: http://tkcodex.sourceforge.net/
There you may see screenshots and read the complete documentation in html.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.