Articles posted June 2008 |
An Ode to CodeWarrior
As a Mac programmer in the 1990's, you quickly learned to swear by Metrowerks CodeWarrior as your development environment. It was awesome for its time: a completely integrated system with ripping fast compilers, a built-in debugger, and a very nice editor.
Eventually, the company decided to branch out of Mac tools (Apple never seemed to be all that thrilled to have a competitor that, frankly, wiped the floor with them), and they moved into other areas: Java tools and embedded compilers. They also ported their environment to Windows, which was nice for those of us Mac programmers who were just starting to get our feet wet in the Windows world.
In the end, however, the market for a real 3rd party compiler withered and died on the Mac front, and never really took hold on the Windows front. Metrowerks was purchased by Motorola, they focused on their Windows-hosted embedded toolset, and eventually disappeared. The last version of CodeWarrior I bought was CodeWarrior 8 for Windows, released back in 1992.
But in my world, CodeWarrior lives on!
Because once you spend a number of years with an editor that you really like and get to know, it is difficult to switch to another. Yes, sure, there are tons of full-featured editors out there, many of which can be custom-tweaked to perform a good chunk of what the CodeWarrior environment's editor did. But every time I have tried, I found myself crawling back to the old standby within a week or two, missing some feature I just couldn't live without.
That's not to say CodeWarrior is perfect; far from it. It has a nasty GDI leak during search & replace that causes it to eventually crash when it hits the Windows maximum per-process limit (fortunately you can increase that number in the registry!) And its interface on Windows is a bit goofy, with a centralized menubar like on the classic MacOS, and toolbars which I immediately turn off. Not to mention it got even a bit goofier on Vista, with the wide window borders.
But there are too many features I constantly rely on to give it up. Here's my top 10 list of favorite features:
- No MDI. Those of us who came from the Mac always thought that one of Windows' most horrible user interface gaffes was the introduction of a single parent window that contained all your document windows. What this does for coders is it makes you immediately maximize your parent window so you get the most real estate. Except you only maximize to a single monitor, so you are inherently limiting where you can put your windows. And you are wasting a ton of space. To appeal to those who were used to this abomination, Metrowerks defaulted to an MDI mode in their Windows port, but thankfully you could turn it off. The resulting interface was a bit odd, with a small parent window containing just a menubar, but at least you could see the files you were editing alongside other useful data in other applications' windows. Amazing!
- Infinitely divisible windows. Sometimes you need to look at two different parts of the same file at the same time. Sometimes you need to look at more than two parts of the same file at the same time. Sure, many editors allow you to split a document into two panels, but they almost all only allow you to split the document once, and then only vertically — what the hell? My nice widescreen monitor allows me plenty of room to see two or three views of the document side-by-side! With CodeWarrior you could split each window into as many views of the same document as you wanted, vertically or horizontally. I've yet to see a good answer to this.
- Ctrl+E enters the selected text into the search field of the search & replace dialog. Shift+Ctrl+E enters the selected text into the replace field. With these two key combinations, I rarely need to ever bring up a dialog to search & replace. I simply select the example I want to change, Ctrl+E, type over it with the new text, select that, Shift+Ctrl+E, and then use the many other additional shortcut keys to perform the replace over the rest of the document.
- Multi-file regular expression search & replace. I use this all the time. You can operate on all opened files, recursively over an entire folder tree, or only over selected files. Recently searched directory trees are available in a popup menu. Making global project-wide changes with this feature is a snap, and you can do it either all at once or one at a time using shortcuts.
- Awesome directory and file compare. Simply select two files or two directories and it will compare them and display them side-by-side with a very nice visualization of the differences and the ability to apply/unapply changes. Nicer diff/merge utilities have come about since this one, but this was one of the first truly excellent compares I ever experienced.
- Function popups. The editor would scan your C/C++ code, find the function names, and create a popup of available functions on the fly. No need to compile the file to generate browse information — it's built right into the editor and updated dynamically.
- Configurable length of recent documents list. Yep, a minor feature, but I set this to 40 and have a nice long list of recent documents I can skip back to very quickly.
- Page navigation without cursor movement. Off with the default Windows key mappings, this feature comes from the Mac, where the page up/down keys did not move the cursor, but instead simply scrolled. This was handy for keyboard navigation. You would use page up/down to scan for something you were looking for and the cursor would stay put. You could also his the Enter key on the keypad to quickly recenter the screen on the cursor.
- Open header file shortcut. This is the simplest feature yet extremely handy. If you are editing a .c or .cpp file, Ctrl+Backquote opens the .h file with the same name in the same directory if it exists. And if you are in the .h file, the same shortcut opens the corresponding .c or .cpp file.
- Quick file access. Select the name of a file in a text file, hit Ctrl+D, and the editor would search the current directory for a file with a name matching the selected text and open that file. Highly useful for #includes. If you have no text selected, you can still hit Ctrl+D and it will bring up a dialog asking you to type the name, which it then searches for in the same directory relative to the file you were editing. I use this all the time for navigating between files without leaving the editor or bringing up the open file dialog.
Suffice to say, I am many times slower without the help of all these features. Maybe someday I'll write my own editor and incorporate everything I want into it, but as long as CodeWarrior keeps on working, I'll probably just stick with what I love.
What the Hell Happened?
Four months of no posts, and then a curious "under construction" message. What's up with that?
Well, you can blame it on porn spammers and WordPress. Turns out there is some sort of juicy exploit in WordPress that allows porn spammers to slip in hidden links on your home page, and this site was ruthlessly attacked. I tried upgrading to a newer version of WordPress a while back, screwing up my site layout in the process, and the problem came back even worse than ever.
So I have now sworn off of blogging software. What you see now is the result of a few hours of my own PHP coding. It is way simpler and doesn't allow comments to be posted, but I'm not quite sure it was worth the risk of exploits to allow people to post back to the blog.
I'm also hoping to use this as an opportunity to relaunch the site with a bit more of a personal bent. I'll surely still discuss MAME issues here, but now that the MAMEDev wiki is up and running, a lot of articles I used to post here will now appear there. In fact, I have been slowly chipping away at documenting my new universal dynamic recompiler architecture on the wiki, so feel free to have a look if you want to know how it all works.
Of course, this universal dynamic recompiler is what has been taking up most of my time, and why I couldn't be bothered with a few measly hours of PHP scripting to resurrect this site until it was mostly up and running. This has long been a dream of mine, and I've slowly worked out how to make it happen over the past 5 years or so. You can also thank my wife's company for sending her on several business trips at the start of the year, which gave me the large blocks of time necessary to get a real leg up on the project that has stalled several times over the course of the past few years.
California Extreme is coming up again shortly (it seems to get earlier and earlier each year), and of course, I'll be there to check out the games and hobnob with many of the folks I've worked with over the years on MAME. If you're in the San Jose area, I highly recommend stopping by for at least a day. (Plus, my real motivation for going is to indulge in at least one In 'n Out run — apologies in advance to the friends whom I mercilessly beg for rides!)
That's all for now. Hopefully I'll follow this up with more posts shortly. :)
P.S. I do have one bit of help to ask for: if you are a CSS/HTML wizard and happen to be able to help out, I need to figure out how to ensure that the white background of the posts extends to the bottom of the right-hand column. See this post for an example of the bad behavior. Drop me a line if you know how to fix that particular problem.