Initial revision
[ssr] / StraySrc / Libraries / Core / EmbTemp / README
1 Embedded Templates
2 ~~~~~~~~~~~~~~~~~~
3
4 For small programs, it's irritating to have a separate templates file
5 hanging around. Separate files aren't necessary for sprites or messages,
6 so templates become rather annoying. An `embedded template' is a
7 position-independent in-memory representation of a window template which
8 has had some extra information added to make it particularly easy to
9 construct a real window definition. (The idea of adding relocation
10 offsets is admittedly based on the Toolbox resource format.) This
11 trivial library unpacks embedded templates.
12
13 The format of an embedded template is (I think) as follows:
14
15 Offset Size Value
16
17 0 4 Offset to window definition ($w$)
18 4 4 Offset to indirected data ($i$)
19 8 4 Offset to limit of the template ($l$)
20 12 $w - 12$ Relocation directives
21
22 $w$ $i - w$ Template window definition (as in template files)
23
24 $i$ $l - i$ Initialisation strings for indirected icons and
25 window titles. This will be copied literally
26 into the application's indirected data space.
27
28 Each relocation directive consists of a single word; the top four bits of
29 a relocation directive determine the `type'; the bottom twenty-eight bits
30 give the `offset'.
31
32 Currently defined types are:
33
34 Type Meaning
35
36 0 Add the address of the indirected data area to the word at the
37 given offset into the window definition.
38 1 Store the `window sprite area' in the word at the given offset
39 into the window definition.
40 2 Store the `icon sprite area' in the word at the given offset
41 into the window definition.
42
43 Embedded templates are not meant to be built by hand. Instead, the
44 programs `templAOF' and `resGen' will build AOF files containing embedded
45 template defintions from standard template files. These can be linked
46 into applications and modules.
47
48 --
49 [mdw]