Version 1.0 Aug 15,1989
CHAPTER 1 - THE WINDOW EDITOR (Continued)
SOURCE CODE FILETYPE $B0
This code is for appending to APW/ORCA source code listings. A simple word processor can be used to edit the file, however the APW/ORCA assembler is needed to assemble the code into your application. Source code listings are easiest to hook-up to special processes, that templates might include, by allowing you to add symbolic references as required. (See Fig. 1.9)
Figure 1.9 Sample Source Code Listing
OBJECT CODE FILETYPE $B1
This type of code is for linking with the APW/ORCA linker. The code type ean be used by any language that uses this linker. Object code ean also be used by the loader call InitialLoad after you have changed the filetype to $B5 (LoadFile). Use the disk utilities in the CALL-BOX shell to change the filetype of this file. (See Fig. 1.10)
Figure 1.10 Sample Object Code Listing
RESOURCE FILETYPE (any)
Resources are stored in a resource fork of an extended ProDOS file. The exact filetype is not important and resources can be stored in any ProDOS file of any type.
Resources are defined with a 2 byte "type" number and a 4 byte "I.D." number. A type would be analogous to a window record, a pascal string, an icon etc ... An I.D. number would identify which pascal string or which icon you are pointing to in a group of pascal strings or icons.
The type for a window template resource is $1002. The I.D.'s can be anywhere between 0 and 7FFFFFFF.
Window template resources are in OMF2 format and are loaded using the system converter.
USING SOURCE CODE
The source code created by this editor is a simple text file. It has a filetype of $B0 and is created in a form readily adaptable to source code listings created for APW or ORCA assemblers. You can use the filetype command in the APW/ORCA shell or the Disk Utilities function of the CALL-BOX shell to change the filetype.
Do not use periods (.) in the filename. This is commonplace in ProDOS, but periods are an illegal character in the assembler and will generate an error when assembled.
Window templates have pointers which are vital to making the window operate under your application. Two of these pointers are already installed (WinTitle and WinColor) but others must be put in before the window is opened. Each pointer contains a null ( 0 ) which tells the Window Manager to use internal default pointers which ignore the process calls. You must type in your own symbolic references where the directive and modifier: dc i4'0' exist in the template.
The pointers are:
The simplest way of hooking-up a CALL-BOX generated source code file to your applications source code is to use the COPY directive.
. . (your code) . . COPY Call-BoxWindow1 ;Your window template source file . . (your code) . .Another way is to use the COPY function of the APW/ORCA editor (OpenApple-C) to put a copy of you window template source code in its SYSTEMP file. It can then be inserted into your source listing with an INSERT function (OpenApple-V).
Adapting this source code for other assemblers is up to you. We will support Apple prefered format APW or ORCA only.
USING OBJECT CODE
The object code created by the editor is a $B1 file. The file is in OMF2 format and is relocatable. The output is provided for Link-time integration or Library file use. To add an object module to a link add the filename to the link command in the APW or ORCA linker.
LINK myprogram mywindowl mywindow2 (etc ... etc).Where mywindowl and mywindow2 are the filenames of the object code files created with the CALL-BOX Window Editor.
This type of file can be used directly by your application similar to the way a library file is used. You must change the filetype of your object file to $B5 (Load File). The window template can then be loaded by the system loader using the InitialLoad call.
PushWord MyID ;Applications ID. number PushLong #Pathname ;Pointer to pathname buffer PushWord #0 ;Spec. memo flag (set to 0) _InitialLoad pla ;Size of Dir.pg/Stack buf.(N/A) pla ;Addr of Dir.pg/Stack buf.(N/A) PullLong WindPtr1 ;Pointer to the window template ;in memory pla ;Applications ID. numberHowever you choose to use the object code template some hook-up is required for your window to properly operate in your application. Several pointers are contained in a window template that point to routines your application provides.
The pointer are:
Add the following equates to your applications source code:
_wRefCon equ 8 _wInfoRefCon equ 44 _wFrameDefProc equ 50 _wInfoDefProc equ 54 _wContDefProc equ 58 _WinColor equ 78 _WinTitle equ 86These equates are the offsets to pointers from the beginning of the window template. Use them to index into the window template or to hook the window up to your window procedures.