Sunday, August 12, 2007

Documenting a Curl Surge Lab Interface class

Surge Lab had been marketed as the name for the Curl IDE. The IDE has a feature that you may recognize if you use eclipse or Aptana: you can flip from one perspective to another. But the IDE gives only a glimpse of Curl interaction for the developer because, like Smalltalk Seaside 'halos' on a web page, Curl offers a Ctrl-Right-Click which opens text and graphic inspectors on objects embedded in a 'live' web page.

The ctrl-right-click pop-up menu includes viewing and editing the Curl source, inspecting objects and both 'Start Profiling' and 'Start HTTP Monitoring'. (Curl also offers test-coverage tools for HP's Mercury QTP.)

The inspectors are toolbar driven and almost feel like a Smalltalk object inspector becuase one toolbar item is 'Evaluate' which is just like the JavaScript popup in FireFox developer tools. Unfortunately, the inspectors lack some features of a typical Smalltalk inspector. The first that I would add to be Curl-ish would be a 'select-text-F1' event-handler to get the fine Curl doc viewer to popup.

What I will do this morning is include a Curl snippet of what you might browse in such a popup; it demonstatrates how the doc viewer is driven.

The following snippet is copied from

I:\Curl RTE\Surge\6\ide\editor-interface
EditorInterface.scurl
Snippet:
{doc-next
{purpose
This class defines the interface that an editor must support
to be integrated with Surge Lab.
}
{details
An external editor needs to implement this class, and define
a top-level variable named {monospace surge-lab-editor} which
is an instance of its implementation of this class.
}
}
{define-class public open abstract EditorInterface

{doc-next
{purpose
Initialize the editor.  An interface back to Surge
Lab is provided for the editor.
}
}
{method public open abstract {initialize
surge-lab-interface:SurgeLabInterface
}:void
}

The behavior of the default Curl editor is not my favorite side of Curl at the moment: high-lighting a '{' offers a context popup to view the '{' in a class browser instead of the handy behavior when you add a '}' which is to blink the matching '{' in red.
Adding a '}' and then placing a CR in front has the disconcerting behavior of aligning the '}' with the matching '{'. This is annoying if it is your habit to end a line using a 'do' with an opening brace ( as required by many script interpreters such as Tcl and which is {script-style} for many programmers.)

But the little annoyances in the default editor come to nothing because there is an interface for external editors.

Over at eclectic-pencil I will add a page with a working HTML example of an embedded Curl {example} macro using a TreeControl object. Install the plugin and Ctrl-Right-Click. Cool.

No comments: