[Openmcl-devel] App Development Tools Contrib
plkrueger at comcast.net
Thu Jan 20 09:58:24 CST 2011
If you are not interested in developing your own stand-alone Macintosh application using CCL, you can ignore the rest of this email.
It took longer than expected, but I finally checked into the CCL trunk the application development tools that I've referred to off and on in emails. They're in ...ccl/contrib/cocoa-ide/krueger/InterfaceProjects/<several places>.
They are documented in "...ccl/contrib/cocoa-ide/krueger/InterfaceProjects/Documentation/CCL Cocoa Developer Tools Tutorial" (either pdf or rtfd). That document will also refer you to a several companion documents that dig into specific topics in more detail.
Basically this provides support for a work-flow that results in the development of a stand-alone Macintosh Lisp application by progressively adding to an application bundle that is created for your application. At each stage, the information that you add is reflected as needed in your application bundle without you having to worry about what exactly is there. My objective was to make this process easy by allowing intermediate stages of testing within the CCL IDE. That work-flow goes something like the following:
1. Define your application using an interactive window that is provided. That Lisp Application Definition Document (LAD) is similar in spirit (though not in implementation) to an Xcode project that Objective-C developers might use. You can save and edit your LAD like any other sort of document within the CCL IDE.
2. Develop a "document" class that incorporates the data you want to manage and add information about it (document type information including the class that supports it) to your LAD. A "lisp-document" class is provided that you can inherit from. That class adds no data, only functionality. That functionality includes:
– Automatic support for saving a document to disk and reloading it
– A lisp-friendly interface to the undo manager
– The ability to specify the name of the nib for the main document window
– Generation of a proxy window if you have not yet defined a window for your document
– The ability to specify a window-controller class or use a default window-controller
– Simple interfaces for printing either text or graphical depictions of your document with defaults that just print document slot values.
At this stage you can test your application inside the CCL IDE without any window or menu definitions. Default menu items and windows are provided for you automatically.
3. Add one or more windows to display your document. Window definition is done by using Interface Builder (IB). The tools provide support for this process by providing ways to export class definitions from Lisp and use them in IB or vice versa. A lisp-controller class with associated IB plugin is provided which facilitates communication between user interface objects and Lisp objects. This makes it possible to directly bind values in interface objects to Lisp values within Lisp objects (even those that do not inherit from Objective-C classes). Data conversion is, for the most part, automatic. Once you add the NIB names for these windows to your LAD, you can test your application inside the CCL IDE and see real window behavior. Default menu items are automatically provided.
4. Add a Main Menu for your application using IB and add its NIB name to your LAD.
At this point you can try out your whole application, seeing your application's menus in the menubar. The tools provide support for toggling back and forth between your application's menus and CCL's (or see both simultaneously if you want).
5. Generate and install an executable within your bundle to make it a valid stand-alone application. This is done by starting a subordinate CCL command-line and interactively telling it how to initialize itself for your application and where to save itself. Any errors encountered will result in an Alert. Once this is done you can double-click on your application in a Finder window to execute it or use a provided menu option to execute it from within the CCL IDE.
6. Optionally, you can create a stand-alone executable that includes both your application and normal CCL IDE functionality. This results in opening a normal listener window when your application is run. The availability of other IDE functionality depends somewhat on what menu options you build into your Main Menu to support them.
The documentation provides a single example for how to do this and carries it through all of the above stages. I expect to add a second example that shows off some additional capabilities (that already exist in the code) in the near future. The implementation of the tools themselves also use much of this same functionality and so provide another example (which is only documented within its source code).
This is obviously quite a bit of new code. Although I have tested it fairly thoroughly on my system and try to provide safeguards to avoid various problems that I ran into, I would not be at all surprised to find end conditions that are not handled well. Please let me know if you run into such problems.
This is all very Macintosh specific. I have almost no idea what would be required to make it work for Cocotron, but would be willing to provide help to anyone who thinks that is possible and would like to give it a try. If the CCL ARM support ever gets to the point of supporting iOS devices, I'd be interested in figuring out how to support that as well.
I will be giving a talk about this at the TCLisper's meeting next week. I imagine that a recording of that talk will show up on the web soon after that. I'll send email about where this is when it gets there.
More information about the Openmcl-devel