Editing Whim Sources

George Peter Staplin: Whim and megapkg are mostly coded using Procmeup and Fed Builder. I am the author of these editors, and they are included with megapkg. Procmeup is included in the Whim Starkits as pmu22b.tcl within the Whim.vfs.


Can I use another editor to edit whim.img?

Yes, however there are some restrictions you should be aware of. Comments will be eliminated outside of procedures. Normally Procmeup stores plans for a procedure in whim.img.plan. You should also not add globals in whim.img. If you must add globals then use Whim.vfs/main.tcl


How do I use Procmeup to edit whim.img?

First we need to start Procmeup. For example:

A window should be created that looks like this:

The next step is to select a proc to edit, or to Add a new. You may also rename or remove a proc by right-clicking on its name in the listbox. Here I have just selected the create.desktop proc:

Procmeup supports an Attach feature that connects to a running Whim, so that you can press the "Sync" button to update a running Whim's code. Note: the auto-sync feature (in the screenshot) can be troublesome in some situations, so it's not enabled by default.

A new image can be created using the unix touch program. For example:

 touch foo.img

If a proc has unbalanced braces, or is otherwise invalid the large label with white text that displays the proc name will change to a red color. You can not change to another proc until the problem is corrected.

Files are saved automatically by Procmeup.


How do I use Fed Builder to edit some C code?

First you will need to decide which extension has the code you're interested in editing.

For example, let's imagine that we're interested in editing some code in the pwm extension. First we start Fed Builder like so:

Then we have a window that starts and looks something like this:

At this point we need to select a function to edit. This can be done by simply clicking in the listbox. Here I have selected the pwm_event_handler function:

Adding, renaming, and removing functions can be accomplished by a menu accessible by right-clicking in the listbox area.

Files are saved automatically, so you need not worry about that. I recommend that you use a memory file system/ramdisk/tmpfs for the megapkg tree you work in, because this is easier on disks, and much quicker when compiling.

Once you have reached a point where you are ready to test you can use the usual build.tcl framework of megapkg.