ASCII Comment Generator

1,983 views
Skip to first unread message

Bill Spivey

unread,
Aug 12, 2011, 10:28:19 PM8/12/11
to bbe...@googlegroups.com
I've created a webpage that generates what I call ascii graphic comments like the one below.   You're welcome to try it out at http://whs3rd.burlyhouse.net/cmn/commentx.t

The core functionality is about 500 lines of C-like code that I'd be interested in porting to a BBEDIT text handler if there's a reasonable learning curve for doing so.   Can anyone advise me with a sample of what a text-handler or other kind of BBEDIT extension looks like?

// ------------------------------------------------------------------------------------
//                  \   |   /      __         _                                        |
//         ___             /   __(  (  )_    |_)                                    |  |
//       _(   )___    \ | /  _(  (       )   |   ._  _  _|_ _|_       _  _   _|  _  |  |
//     _(         )__      _(        _(    ) |   |  (/_  |_  |_ \/   (_ (_) (_| (/_ o  |
//    (              )    (        (        )                   /                      |
//   (            (    )    __(       (    )                                           |
//  ( ______(         ) (         (       )  Use the form below to design attractive   |
//         (___  _ ___)     \                comments for your source code. Choose a   |
//                /    |     \               graphic image from the library, specify a |
// short banner for display  in large ascii type, and any regular-type commentary, and |
// let the generator do the work! This site borrows from the work of fine ASCII        |
// artists from all over the world and their contribution  is gratefully acknowledged  |
// below. You can see more great ASCII line art at http://www.ascii-art.de/ascii/      |
// ------------------------------------------------------------------------------------

ASCII COMMENT GENERATOR

Language

Graphic

Graphic on Right
Use Mirror Image


Banner (large type)
Extra White Space

Commentary (plain text only)

Enclose comment in a box
Debug


Steve Kalkwarf

unread,
Aug 15, 2011, 9:25:50 AM8/15/11
to bbe...@googlegroups.com
> The core functionality is about 500 lines of C-like code that I'd be interested in porting to a BBEDIT text handler if there's a reasonable learning curve for doing so. Can anyone advise me with a sample of what a text-handler or other kind of BBEDIT extension looks like?

How do you envision people using your tool?

For getting the output text generated, the easy solution, which you may already have, is compiling your C code as a stdio unix tool.

However, I think the bigger problem is getting input to the tool, as there is no built in GUI for building extensions.

Depending on your areas of comfort, I would suggest a small Cocoa application, whose window displays at NSStatusWindowLevel (which would have the appearance of being in BBEdit's display layers). When the app is finished running, there are a few ways to get the result back to the current document, the easiest being an AppleEvent (which can be expressed as an AppleScript).

Which brings me to the next option, which is an AppleScript Studio application (or whatever Apple calls them these days).

I guess it really depends on your goal.

Steve

Bill Spivey

unread,
Aug 15, 2011, 9:18:51 AM8/15/11
to bbe...@googlegroups.com
I had posted to this list an inquiry about ways in which my "ascii comment generator" at
could be adapted for inline operation within BBEDIT.  After studying BBEDIT manual, I
decided that the "Text Filter" capability would serve this need.  I recast my generator
in C and placed the calling unix shell script into BBEDIT's text filter folder.

Now I can type free-form lines like the first three below:

assembleComment
This function combines the content of graphic, bnr, and com into a single ascii comment
and prints it back to BBEDIT.
void assembleComment()
int i;
.
.
.

select those 3 lines, pass them to my "litebulb" text filter and get back(best viewed in mono-spaced font):

//      _...._                                    _                             
//    .'      '.                                 |                              
//   /          \   _.  _  _  _  .___  |_  |  _  |   _  .___  .___   _  ._  _|_ 
//   |   jgs    |  (_| _> _> (/_ | | | |_) | (/_ |_ (_) | | | | | | (/_ | |  |_ 
//    \   ~~   /                                                                
//     \  ||  /    This function combines the content of graphic, bnr, and com 
//      \ || /     into a single ascii comment and prints it back to BBEDIT. 
//      {__==}     
//      {__==}     
//       \__/      

void assembleComment()
int i;
.
.
.

If anyone's interested in the methods I've used here, I can provide full particulars.  (Now to write a 
text filter that can actually generate code.)

Bill Spivey

unread,
Aug 15, 2011, 10:27:57 AM8/15/11
to bbe...@googlegroups.com
Thanks for the thoughtful reply, Steve.

As you may gather from my followup on this subject, I found a convenient way to do what I wanted using BBEdit's "Text Filter" capability.

> --
> You received this message because you are subscribed to the
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbe...@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+un...@googlegroups.com
> For more options, visit this group at
> <http://groups.google.com/group/bbedit?hl=en>
> If you have a feature request or would like to report a problem,
> please email "sup...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply all
Reply to author
Forward
0 new messages