|Version 15 (modified by mikel, 9 years ago) (diff)|
Apple's Currency Converter in Lisp
Creating Apple's Currency Converter example with OpenMCL
This HOWTO guide explains how to use OpenMCL to create a Cocoa application that is functionally identical to Apple's Currency Converter example. The most important difference between Apple's example and this one is that this one is implemented in Common Lisp instead of Objective C. It uses OpenMCL's Objective-C bridge to provide communication between the Lisp code that you write and Apple's Cocoa frameworks. The resulting application looks and acts just like any other Cocoa application.
This HOWTO doesn't discuss all the background information that Apple's tutorial covers. Instead, we assume that you have Apple's document handy for reference, and we just describe the specific steps needed to build the example using Apple's InterfaceBuilder application and OpenMCL.
The current version of the OpenMCL Objective-C bridge includes code that was formerly distributed separately as the "Bosco" application framework. Because that framework has been integrated with OpenCL proper, it no longer exists as a separate project.
Apple's Currency Converter Example
It will be helpful in understanding this example if you can easily refer to Apple's Currency Converter tutorial while working through this HOWTO. You might consider opening a separate window or tab, and keeping the Apple example handy while you work.
In some ways, the Lisp version of the example is simpler than the Objective C example, but the basic concepts are the same. In particular, the Lisp example follows the same Model-View-Controller paradigm that the Apple tutorial uses. If you are new to Cocoa programming, or if you are not familiar with how it uses the Model-View-Controller paradigm, it's probably a good idea to read through the Apple example in full, paying special attention to the Model-View-Controller section. Once you've done that, keep the Apple pages handy in a window for easy reference.
This Common Lisp version of the Currency Converter example uses Apple's InterfaceBuilder application to build a window and main menu, and then uses Common Lisp code to load and operate that user interface. The Common Lisp code relies on OpenMCL's Objective-C bridge to provide communication between the running Lisp code and Apple's Cocoa frameworks. Once the code is complete, we use the BUILD-APPLICATION function to save a working Cocoa application bundle. The resulting bundle looks and acts just like any other Cocoa application.
Requirements Before You Start
In order to build this example you will need:
- Mac OS X Leopard (version 10.5.x) or Mac OS X Tiger (version 10.4.x)
- Apple's XCode development tools
- Apple's InterfaceBuilder application (included with XCode)
- A recent version of OpenMCL
- The Apple Currency Converter example, for reference