In this part of your example, you'll use the same To-Do List program and create two ICs. The first will contain only IcTestModel and will be an "interior" or reusable IC. That is, it will not contain any system startup code and so will not be able to be started like a "leaf" IC. Call this IC reusable.ic. It will need to be loaded by another leaf IC when the leaf IC starts. This happens automatically as a result of an application in the leaf IC including an application in the reusable IC as a prerequisite. You've already specified this prerequisite relationship. You did so when you included IcTestModel as a prerequisite of IcTestView.
The second IC you will create is the leaf IC that will contain IcTestView. It will depend on reusable.ic, which contains IcTestModel.
First, create a reusable IC which contains IcTestModel. You must do this first because later, when you create the leaf IC which will depend on the reusable IC, the leaf IC needs to know about the existence of the reusable IC.
Note: | In this and the following sections, some of the detail that was included as explanations in the previous section will be omitted for brevity. |
System removeComponent: 'ictest.ic'
Reload the IcTestView and IcTestModel applications from the VisualAge Smalltalk library.
We're illustrating this here because it's easier to correlate what you see in the Browse Image Contents window with what you specified to be included. This is because in a reusable IC what is included in the image is the entire contents of only the applications you specified. This is as opposed to browsing the contents of a leaf IC which includes startup code and for which reduction has been performed.
Select Examine & Fix Problems then select Image
Contents from the Browse menu. You'll see lists
of Applications, classes, pool dictionaries, and global variables along with
notations indicating that they were excluded, included because of a reference,
or included as part of the prerequisite chain. You can expand the lists
and sublists to see more information.
Above is the list of applications expanded with application IcTestModel expanded to show its classes and class Thing expanded to show its methods and instance variables. Application IcTestModel and its classes are shown annotated with included - referenced, which indicates they are included as part of the IC per your packaging instructions.
This kind of check is always useful regardless of whether you're packaging a reusable or a leaf IC or a reduced runtime image. It is especially so in the cases where reduction is performed or where prerequisite applications are added by the packager. You should verify what the packager decided to include in, or to remove from, the image being created is what you expect.
An alternative way to enable the packager to know about the reusable IC you are creating is to unload IcTestModel, explicitly load its IC, reusable.ic, and then begin packaging of the leaf IC. This may be a more desirable approach in a couple of situations. First, if you do not have access to the instructions used to create the reusable IC. Or second, if you are building a leaf IC on a memory constrained machine and have a large number of prerequisite ICs that are already loaded in your development image. In the second case, loading the packaging instruction classes for the prerequisite ICs will use up considerable additional memory.
Since you already have the packaging instructions for the reusable IC in memory, you will use them instead of loading reusable.ic.
Now, on to creating a leaf IC for IcTestView that will depend on the reusable IC you've just created which contains IcTestModel.
You should now have ICs assigned to all of the prerequisite applications appearing in the center pane. You can verify this by scrolling the list and ensuring there are IC entries for all applications except IcTestView.
ToDoListView new openWidget
Also enter depleaf.ic for the Output File.
In the first example, you created a single IC for your example To-do List program. In the second example, you saw how to package a program as two ICs, one dependent on the other. In both of these examples, the runtime scenario is straightforward. The end user simply starts the leaf IC. The VisualAge Smalltalk runtime system takes care of the rest. In the following example, you're going to see how to programmatically manage the loading and unloading of ICs.