Shop OBEX P1 Docs P2 Docs Learn Events
pretty printing SX code — Parallax Forums

pretty printing SX code

Keith MKeith M Posts: 102
edited 2008-03-01 21:05 in General Discussion
While I realize I'm pretty spoiled with the color coding of NetBeans and Microsoft's VS .NET stuff, I can't help but want the same support within the SX IDE.

I often print my code, but the built-in support for printing in SX-KEY is too basic.

Notepad++ is a open source, free, source code editor. It natively supports about 30 different languages, and color codes the various structures, keywords, etc to make the source code more readable. While it doesn't support the SX directly, there are user defined languages that let you add your own language and color coding.

notepad-plus.sourceforge.net/uk/site.htm

Today, I threw together the attached XML file that you can drop into the installed directory of Notepad++, that color codes SX keywords. It's not a complete exhaustive list, I used the SX/B help file, the instruction list from the manual, directives, commands, and so on. Each type of keyword has its own color. This makes both reading on-screen and when printing much easier for me.

There's no magic here, and don't expect the editor to be smarter than the average bear. It simply color codes keywords, and changes the colors of comment lines.

The colors I picked are completely random, and very little thought went into this ---- expect some things to have been left out, things color coded incorrectly, and so on. On my relatively small project (~700 lines of SX/B code), it works very well. Making modifications is dead easy with the intuitive interface, so if other colors are better, by all means, fix it yourself!!

Note that this should function with SX/B, or just straight SX assembly as well. (or assembly mixed in with SX/B)

I found this tool useful, and thought you might too.

Keith

P.S. You need to remove the .txt extension from the file and the final filename should be userDefineLang.xml. Overwrite the existing default userDefineLang.xml, unless you've already made changes to it, in which case you'll need to cut-and-paste merge the appropriate section from the attachment.

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-03-01 16:40
    Added color is a great feature. Learning is all about learning to notice patterns and relationships. So color helps a lot. Over time, there might be some obvious relationships that have obvious association with certain colors, but this is a start.

    Exactly how many color choices are available? Also, I realize some of those choices are trivial if one stays to a single color background. So how many colors did you use.

    Thanks, I wasn't aware that merely swapping out a file with another modified one might provide this added feature.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Keith MKeith M Posts: 102
    edited 2008-03-01 18:28
    I really like color coding. You know, I grew up sort as a vi editing, notepad is my IDE type of programmer. These new features, including color coding, are awesome. I really like NetBean's in-line automatic syntax checking, reference to javadoc, type-checking, automatic grouping for ([noparse]/noparse's, {}'s, etc), etc etc. It makes a WORLD of difference in terms of finding before-compile-time mistakes. Or when you are typing an object name, and the available methods pop-up with descriptions of what the methods do. It's really really good stuff.

    Anyways, I just downloaded Notepad++ yesterday, and I'm not by any stretch an expert. You choose from a wide range of colors(maybe 60 patches?), and it looks like you can define up to 4 different color groups within the editor. HOWEVER, by editing the XML directly (easy text based changes), you can probably have as many groups as you want. I don't know this for a fact, but it's easy enough to test.

    The single color background in my case was WHITE as in a sheet of paper. [noparse]:)[/noparse]

    I only used 4 different groups: definition keywords (var,con,func), directives(like device, irc_cal,etc), SX/B commands, and assembly instructions. These color choices are easily changed inside the program.

    Note that I think you can do much much more than I've done. I've just scratched the surface. I sort of wanted to introduce notepad++ to those who hadn't seen it rather than provide a complete off-the-shelf finished solution.

    Yeah, as far as swapping out the file, notepad++ just uses XML to store it's configuration settings, and since it's text, it's easy enough to just distribute the XML as way of exchanging groups of settings --- especially those that might take a little time to type.

    Thanks

    Keith
  • John CoutureJohn Couture Posts: 370
    edited 2008-03-01 21:05
    Thank you Keith. This looks like a good idea!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
Sign In or Register to comment.