Home » Archimedes archive » Acorn User » AU 1996-12 A.adf » Regulars » C/!Acronyms/SourceCode/c/AULib » Compare

Compare C/!Acronyms/SourceCode/c/AULib with WimpC/!NewWimpC/c/AULib

File: Archimedes archive » Acorn User » AU 1996-12 A.adf » Regulars » C/!Acronyms/SourceCode/c/AULib
Compared with: Archimedes archive » Acorn User » AU 1996-08.adf » Regulars » WimpC/!NewWimpC/c/AULib
Similarity: 100% of bytes duplicated

99.7% of the bytes in these files are duplicated between them. Duplicated Different Padding (ignored)

Bytes are marked as duplicated if they lie within a run of at least 16 bytes which also appears somewhere in the other file, in any position. Long runs of padding bytes (zeros, spaces, &FF and &E5) are ignored.

C/!Acronyms/SourceCode/c/AULib
00000000  2f 2a 20 41 63 6f 72 6e  20 55 73 65 72 20 6c 69  |/* Acorn User li|
00000010  62 72 61 72 79 20 66 6f  72 20 57 49 4d 50 20 70  |brary for WIMP p|
00000020  72 6f 67 72 61 6d 6d 69  6e 67 20 69 6e 20 43 20  |rogramming in C |
00000030  2a 2f 0a 2f 2a 20 42 79  20 53 74 65 76 65 20 4d  |*/./* By Steve M|
00000040  75 6d 66 6f 72 64 2c 20  31 36 74 68 20 4a 75 6c  |umford, 16th Jul|
00000050  79 20 31 39 39 36 20 2a  2f 0a 0a 2f 2a 20 23 49  |y 1996 */../* #I|
00000060  6e 63 6c 75 64 65 20 74  68 65 20 61 70 70 72 6f  |nclude the appro|
00000070  70 72 69 61 74 65 20 66  69 6c 65 73 20 2d 20 41  |priate files - A|
00000080  55 4c 69 62 2e 68 20 63  6f 6e 74 61 69 6e 73 20  |ULib.h contains |
00000090  65 76 65 72 79 74 68 69  6e 67 20 77 65 20 6e 65  |everything we ne|
000000a0  65 64 20 2a 2f 20 0a 0a  23 69 6e 63 6c 75 64 65  |ed */ ..#include|
000000b0  20 22 41 55 6c 69 62 2e  68 22 0a 0a 69 6e 74 0a  | "AUlib.h"..int.|
000000c0  61 75 5f 69 6e 69 74 69  61 6c 69 73 65 28 69 6e  |au_initialise(in|
000000d0  74 20 76 5f 6e 75 6d 62  65 72 2c 20 63 68 61 72  |t v_number, char|
000000e0  20 2a 61 70 70 6e 61 6d  65 2c 20 6c 6f 6e 67 20  | *appname, long |
000000f0  69 6e 74 20 6d 73 67 6c  69 73 74 5b 5d 29 0a 7b  |int msglist[]).{|
00000100  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 5f 72 65  |.._kernel_swi_re|
00000110  67 73 09 72 65 67 73 5f  69 6e 2c 20 72 65 67 73  |gs.regs_in, regs|
00000120  5f 6f 75 74 3b 0a 0a 09  72 65 67 73 5f 69 6e 2e  |_out;...regs_in.|
00000130  72 5b 30 5d 20 3d 20 76  5f 6e 75 6d 62 65 72 3b  |r[0] = v_number;|
00000140  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 31 5d 20 3d  |..regs_in.r[1] =|
00000150  20 2a 28 69 6e 74 20 2a  29 22 54 41 53 4b 22 3b  | *(int *)"TASK";|
00000160  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 32 5d 20 3d  |..regs_in.r[2] =|
00000170  20 28 69 6e 74 29 20 61  70 70 6e 61 6d 65 3b 0a  | (int) appname;.|
00000180  09 72 65 67 73 5f 69 6e  2e 72 5b 33 5d 20 3d 20  |.regs_in.r[3] = |
00000190  28 69 6e 74 29 20 6d 73  67 6c 69 73 74 3b 0a 0a  |(int) msglist;..|
000001a0  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  |._kernel_swi(Wim|
000001b0  70 5f 49 6e 69 74 69 61  6c 69 73 65 2c 20 26 72  |p_Initialise, &r|
000001c0  65 67 73 5f 69 6e 2c 20  26 72 65 67 73 5f 6f 75  |egs_in, &regs_ou|
000001d0  74 29 3b 0a 09 72 65 74  75 72 6e 20 72 65 67 73  |t);..return regs|
000001e0  5f 6f 75 74 2e 72 5b 31  5d 3b 20 2f 2a 20 74 68  |_out.r[1]; /* th|
000001f0  69 73 20 69 73 20 74 68  65 20 74 61 73 6b 20 68  |is is the task h|
00000200  61 6e 64 6c 65 2c 20 72  65 74 75 72 6e 65 64 20  |andle, returned |
00000210  66 6f 72 20 6c 61 74 65  72 20 75 73 65 20 2a 2f  |for later use */|
00000220  0a 7d 0a 0a 76 6f 69 64  0a 61 75 5f 63 6c 6f 73  |.}..void.au_clos|
00000230  65 64 6f 77 6e 28 69 6e  74 20 74 61 73 6b 68 61  |edown(int taskha|
00000240  6e 64 6c 65 29 0a 7b 0a  09 5f 6b 65 72 6e 65 6c  |ndle).{.._kernel|
00000250  5f 73 77 69 5f 72 65 67  73 09 72 65 67 73 5f 69  |_swi_regs.regs_i|
00000260  6e 2c 20 72 65 67 73 5f  6f 75 74 3b 0a 0a 09 72  |n, regs_out;...r|
00000270  65 67 73 5f 69 6e 2e 72  5b 30 5d 20 3d 20 74 61  |egs_in.r[0] = ta|
00000280  73 6b 68 61 6e 64 6c 65  3b 0a 09 72 65 67 73 5f  |skhandle;..regs_|
00000290  69 6e 2e 72 5b 31 5d 20  3d 20 2a 28 69 6e 74 20  |in.r[1] = *(int |
000002a0  2a 29 22 54 41 53 4b 22  3b 0a 09 5f 6b 65 72 6e  |*)"TASK";.._kern|
000002b0  65 6c 5f 73 77 69 28 57  69 6d 70 5f 43 6c 6f 73  |el_swi(Wimp_Clos|
000002c0  65 44 6f 77 6e 2c 20 26  72 65 67 73 5f 69 6e 2c  |eDown, &regs_in,|
000002d0  20 26 72 65 67 73 5f 6f  75 74 29 3b 0a 7d 0a 0a  | &regs_out);.}..|
000002e0  69 6e 74 0a 61 75 5f 63  72 65 61 74 65 5f 69 63  |int.au_create_ic|
000002f0  6f 6e 62 61 72 5f 69 63  6f 6e 28 69 6e 74 20 70  |onbar_icon(int p|
00000300  72 69 6f 72 69 74 79 2c  20 75 6e 73 69 67 6e 65  |riority, unsigne|
00000310  64 20 6c 6f 6e 67 20 69  6e 74 20 77 68 69 63 68  |d long int which|
00000320  73 69 64 65 2c 20 75 6e  73 69 67 6e 65 64 20 6c  |side, unsigned l|
00000330  6f 6e 67 20 69 6e 74 20  69 63 6f 6e 66 6c 61 67  |ong int iconflag|
00000340  73 2c 20 63 68 61 72 20  2a 73 70 72 6e 61 6d 65  |s, char *sprname|
00000350  29 0a 7b 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |).{.._kernel_swi|
00000360  5f 72 65 67 73 09 72 65  67 73 5f 69 6e 2c 20 72  |_regs.regs_in, r|
00000370  65 67 73 5f 6f 75 74 3b  0a 09 75 6e 73 69 67 6e  |egs_out;..unsign|
00000380  65 64 20 63 68 61 72 20  69 63 6f 6e 5f 62 6c 6f  |ed char icon_blo|
00000390  63 6b 5b 49 43 4f 4e 5f  42 4c 4f 43 4b 5f 53 49  |ck[ICON_BLOCK_SI|
000003a0  5a 45 5d 3b 0a 09 2f 2a  20 57 65 20 6e 65 65 64  |ZE];../* We need|
000003b0  20 74 6f 20 62 75 69 6c  64 20 75 70 20 61 6e 20  | to build up an |
000003c0  69 63 6f 6e 20 69 6e 66  6f 72 6d 61 74 69 6f 6e  |icon information|
000003d0  20 64 61 74 61 62 6c 6f  63 6b 20 2a 2f 0a 09 61  | datablock */..a|
000003e0  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 77 68 69  |u_wordtobyte(whi|
000003f0  63 68 73 69 64 65 2c 20  69 63 6f 6e 5f 62 6c 6f  |chside, icon_blo|
00000400  63 6b 2c 20 30 29 3b 0a  09 61 75 5f 77 6f 72 64  |ck, 0);..au_word|
00000410  74 6f 62 79 74 65 28 49  42 41 52 5f 42 42 4f 58  |tobyte(IBAR_BBOX|
00000420  5f 4d 49 4e 58 2c 20 69  63 6f 6e 5f 62 6c 6f 63  |_MINX, icon_bloc|
00000430  6b 2c 20 34 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |k, 4);..au_wordt|
00000440  6f 62 79 74 65 28 49 42  41 52 5f 42 42 4f 58 5f  |obyte(IBAR_BBOX_|
00000450  4d 49 4e 59 2c 20 69 63  6f 6e 5f 62 6c 6f 63 6b  |MINY, icon_block|
00000460  2c 20 38 29 3b 0a 09 61  75 5f 77 6f 72 64 74 6f  |, 8);..au_wordto|
00000470  62 79 74 65 28 49 42 41  52 5f 42 42 4f 58 5f 4d  |byte(IBAR_BBOX_M|
00000480  41 58 58 2c 20 69 63 6f  6e 5f 62 6c 6f 63 6b 2c  |AXX, icon_block,|
00000490  20 31 32 29 3b 0a 09 61  75 5f 77 6f 72 64 74 6f  | 12);..au_wordto|
000004a0  62 79 74 65 28 49 42 41  52 5f 42 42 4f 58 5f 4d  |byte(IBAR_BBOX_M|
000004b0  41 58 59 2c 20 69 63 6f  6e 5f 62 6c 6f 63 6b 2c  |AXY, icon_block,|
000004c0  20 31 36 29 3b 0a 09 61  75 5f 77 6f 72 64 74 6f  | 16);..au_wordto|
000004d0  62 79 74 65 28 69 63 6f  6e 66 6c 61 67 73 2c 20  |byte(iconflags, |
000004e0  69 63 6f 6e 5f 62 6c 6f  63 6b 2c 20 32 30 29 3b  |icon_block, 20);|
000004f0  0a 0a 09 2f 2a 20 43 6f  70 79 20 74 68 65 20 69  |.../* Copy the i|
00000500  63 6f 6e 20 6e 61 6d 65  20 69 6e 74 6f 20 74 68  |con name into th|
00000510  65 20 61 70 70 72 6f 70  72 69 61 74 65 20 70 6c  |e appropriate pl|
00000520  61 63 65 20 2a 2f 0a 09  73 74 72 63 70 79 28 20  |ace */..strcpy( |
00000530  28 63 68 61 72 20 2a 29  20 26 69 63 6f 6e 5f 62  |(char *) &icon_b|
00000540  6c 6f 63 6b 5b 32 34 5d  2c 20 73 70 72 6e 61 6d  |lock[24], sprnam|
00000550  65 29 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 30  |e);..regs_in.r[0|
00000560  5d 20 3d 20 70 72 69 6f  72 69 74 79 3b 0a 09 72  |] = priority;..r|
00000570  65 67 73 5f 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |egs_in.r[1] = (i|
00000580  6e 74 29 20 69 63 6f 6e  5f 62 6c 6f 63 6b 3b 0a  |nt) icon_block;.|
00000590  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  |._kernel_swi(Wim|
000005a0  70 5f 43 72 65 61 74 65  49 63 6f 6e 2c 20 26 72  |p_CreateIcon, &r|
000005b0  65 67 73 5f 69 6e 2c 20  26 72 65 67 73 5f 6f 75  |egs_in, &regs_ou|
000005c0  74 29 3b 0a 09 72 65 74  75 72 6e 20 72 65 67 73  |t);..return regs|
000005d0  5f 6f 75 74 2e 72 5b 30  5d 3b 20 2f 2a 20 52 65  |_out.r[0]; /* Re|
000005e0  74 75 72 6e 20 74 68 65  20 69 63 6f 6e 20 68 61  |turn the icon ha|
000005f0  6e 64 6c 65 20 2a 2f 0a  7d 0a 0a 76 6f 69 64 0a  |ndle */.}..void.|
00000600  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 75 6e  |au_wordtobyte(un|
00000610  73 69 67 6e 65 64 20 6c  6f 6e 67 20 69 6e 74 20  |signed long int |
00000620  69 6e 70 75 74 2c 20 75  6e 73 69 67 6e 65 64 20  |input, unsigned |
00000630  63 68 61 72 20 62 6c 6f  63 6b 5b 5d 2c 20 69 6e  |char block[], in|
00000640  74 20 69 6e 64 65 78 29  0a 7b 0a 09 75 6e 73 69  |t index).{..unsi|
00000650  67 6e 65 64 20 6c 6f 6e  67 20 69 6e 74 20 6d 61  |gned long int ma|
00000660  73 6b 20 3d 20 32 35 35  3b 0a 0a 09 2f 2a 20 54  |sk = 255;.../* T|
00000670  68 65 20 6f 70 70 6f 73  69 74 65 20 6f 66 20 62  |he opposite of b|
00000680  74 6f 77 28 29 20 2d 20  74 68 69 73 20 66 75 6e  |tow() - this fun|
00000690  63 74 69 6f 6e 20 74 61  6b 65 73 20 61 20 33 32  |ction takes a 32|
000006a0  2d 62 69 74 20 69 6e 74  65 67 65 72 2c 20 73 70  |-bit integer, sp|
000006b0  6c 69 74 73 0a 09 20 2a  20 69 74 20 75 70 20 69  |lits.. * it up i|
000006c0  6e 74 6f 20 34 20 62 79  74 65 73 2c 20 61 6e 64  |nto 4 bytes, and|
000006d0  20 73 74 6f 72 65 73 20  74 68 6f 73 65 20 69 6e  | stores those in|
000006e0  20 34 20 63 6f 6e 73 65  63 75 74 69 76 65 20 63  | 4 consecutive c|
000006f0  65 6c 6c 73 20 6f 66 20  61 0a 09 20 2a 20 63 68  |ells of a.. * ch|
00000700  61 72 61 63 74 65 72 20  61 72 72 61 79 20 69 6e  |aracter array in|
00000710  64 65 78 65 64 20 62 79  20 69 6e 64 65 78 2e 20  |dexed by index. |
00000720  54 68 69 73 20 69 73 20  64 6f 6e 65 20 62 79 20  |This is done by |
00000730  75 73 69 6e 67 20 61 20  6d 61 73 6b 20 74 6f 0a  |using a mask to.|
00000740  09 20 2a 20 65 78 74 72  61 63 74 20 74 68 65 20  |. * extract the |
00000750  64 61 74 61 20 69 6e 20  73 65 71 75 65 6e 63 65  |data in sequence|
00000760  2c 20 77 69 74 68 20 74  68 65 20 26 20 62 69 74  |, with the & bit|
00000770  77 69 73 65 2d 61 6e 64  20 6f 70 65 72 61 74 6f  |wise-and operato|
00000780  72 20 2a 2f 0a 0a 09 62  6c 6f 63 6b 5b 69 6e 64  |r */...block[ind|
00000790  65 78 2b 2b 5d 20 3d 20  28 63 68 61 72 29 20 28  |ex++] = (char) (|
000007a0  69 6e 70 75 74 20 26 20  6d 61 73 6b 29 3b 20 0a  |input & mask); .|
000007b0  09 2f 2a 20 73 68 69 66  74 20 6d 61 73 6b 20 74  |./* shift mask t|
000007c0  6f 20 67 65 74 20 73 65  63 6f 6e 64 20 62 79 74  |o get second byt|
000007d0  65 2c 20 61 6e 64 20 73  75 70 70 6c 79 20 72 65  |e, and supply re|
000007e0  73 75 6c 74 20 61 73 20  62 79 74 65 20 73 69 7a  |sult as byte siz|
000007f0  65 20 2a 2f 0a 09 6d 61  73 6b 20 3c 3c 3d 20 38  |e */..mask <<= 8|
00000800  3b 0a 09 62 6c 6f 63 6b  5b 69 6e 64 65 78 2b 2b  |;..block[index++|
00000810  5d 20 3d 20 28 63 68 61  72 29 20 28 28 69 6e 70  |] = (char) ((inp|
00000820  75 74 20 26 20 6d 61 73  6b 29 20 3e 3e 20 38 29  |ut & mask) >> 8)|
00000830  3b 0a 09 6d 61 73 6b 20  3c 3c 3d 20 38 3b 0a 09  |;..mask <<= 8;..|
00000840  62 6c 6f 63 6b 5b 69 6e  64 65 78 2b 2b 5d 20 3d  |block[index++] =|
00000850  20 28 63 68 61 72 29 20  28 28 69 6e 70 75 74 20  | (char) ((input |
00000860  26 20 6d 61 73 6b 29 20  3e 3e 20 31 36 29 3b 0a  |& mask) >> 16);.|
00000870  09 6d 61 73 6b 20 3c 3c  3d 20 38 3b 0a 09 62 6c  |.mask <<= 8;..bl|
00000880  6f 63 6b 5b 69 6e 64 65  78 2b 2b 5d 20 3d 20 28  |ock[index++] = (|
00000890  63 68 61 72 29 20 28 28  69 6e 70 75 74 20 26 20  |char) ((input & |
000008a0  6d 61 73 6b 29 20 3e 3e  20 32 34 29 3b 0a 0a 09  |mask) >> 24);...|
000008b0  72 65 74 75 72 6e 3b 0a  7d 0a 0a 75 6e 73 69 67  |return;.}..unsig|
000008c0  6e 65 64 20 6c 6f 6e 67  20 69 6e 74 0a 61 75 5f  |ned long int.au_|
000008d0  62 79 74 65 74 6f 77 6f  72 64 28 75 6e 73 69 67  |bytetoword(unsig|
000008e0  6e 65 64 20 63 68 61 72  20 62 6c 6f 63 6b 5b 5d  |ned char block[]|
000008f0  2c 20 69 6e 74 20 69 6e  64 65 78 29 0a 7b 0a 09  |, int index).{..|
00000900  75 6e 73 69 67 6e 65 64  20 6c 6f 6e 67 20 69 6e  |unsigned long in|
00000910  74 20 72 65 73 75 6c 74  20 3d 20 30 3b 0a 09 69  |t result = 0;..i|
00000920  6e 74 20 6c 6f 6f 70 3b  0a 0a 09 2f 2a 20 54 68  |nt loop;.../* Th|
00000930  69 73 20 72 6f 75 74 69  6e 65 20 74 61 6b 65 73  |is routine takes|
00000940  20 61 20 64 61 74 61 20  62 6c 6f 63 6b 20 61 6e  | a data block an|
00000950  64 20 61 20 73 74 61 72  74 69 6e 67 20 62 79 74  |d a starting byt|
00000960  65 2c 20 61 6e 64 20 63  6f 6e 76 65 72 74 73 20  |e, and converts |
00000970  74 68 65 0a 09 20 2a 20  6e 65 78 74 20 66 6f 75  |the.. * next fou|
00000980  72 20 62 79 74 65 73 20  69 6e 74 6f 20 61 20 77  |r bytes into a w|
00000990  6f 72 64 20 2d 20 77 65  20 68 61 76 65 20 74 6f  |ord - we have to|
000009a0  20 73 74 61 72 74 20 61  74 20 74 68 65 20 6d 6f  | start at the mo|
000009b0  73 74 20 73 69 67 6e 69  66 69 63 61 6e 74 0a 09  |st significant..|
000009c0  20 2a 20 62 79 74 65 20  61 6e 64 20 77 6f 72 6b  | * byte and work|
000009d0  20 62 61 63 6b 77 61 72  64 73 20 2a 2f 0a 0a 09  | backwards */...|
000009e0  69 6e 64 65 78 20 2b 3d  20 33 3b 0a 09 72 65 73  |index += 3;..res|
000009f0  75 6c 74 20 3d 20 62 6c  6f 63 6b 5b 69 6e 64 65  |ult = block[inde|
00000a00  78 2d 2d 5d 3b 0a 09 66  6f 72 28 6c 6f 6f 70 20  |x--];..for(loop |
00000a10  3d 20 30 3b 20 6c 6f 6f  70 20 3c 20 33 3b 20 6c  |= 0; loop < 3; l|
00000a20  6f 6f 70 2b 2b 29 20 7b  0a 09 09 72 65 73 75 6c  |oop++) {...resul|
00000a30  74 20 3d 20 72 65 73 75  6c 74 20 3c 3c 20 38 3b  |t = result << 8;|
00000a40  20 2f 2a 20 74 68 69 73  20 73 68 69 66 74 73 20  | /* this shifts |
00000a50  62 69 74 73 20 69 6e 20  72 65 73 75 6c 74 20 6c  |bits in result l|
00000a60  65 66 74 20 62 79 20 38  20 73 70 61 63 65 73 20  |eft by 8 spaces |
00000a70  2a 2f 0a 09 09 72 65 73  75 6c 74 20 2b 3d 20 62  |*/...result += b|
00000a80  6c 6f 63 6b 5b 69 6e 64  65 78 2d 2d 5d 3b 0a 09  |lock[index--];..|
00000a90  7d 0a 0a 09 72 65 74 75  72 6e 20 72 65 73 75 6c  |}...return resul|
00000aa0  74 3b 0a 7d 0a 0a 76 6f  69 64 0a 61 75 5f 6f 70  |t;.}..void.au_op|
00000ab0  65 6e 74 65 6d 70 6c 61  74 65 28 63 68 61 72 20  |entemplate(char |
00000ac0  2a 66 69 6c 65 6e 61 6d  65 29 0a 7b 0a 09 5f 6b  |*filename).{.._k|
00000ad0  65 72 6e 65 6c 5f 73 77  69 5f 72 65 67 73 09 72  |ernel_swi_regs.r|
00000ae0  65 67 73 5f 69 6e 2c 20  72 65 67 73 5f 6f 75 74  |egs_in, regs_out|
00000af0  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 31 5d 20  |;..regs_in.r[1] |
00000b00  3d 20 28 69 6e 74 29 20  66 69 6c 65 6e 61 6d 65  |= (int) filename|
00000b10  3b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 28 57  |;.._kernel_swi(W|
00000b20  69 6d 70 5f 4f 70 65 6e  54 65 6d 70 6c 61 74 65  |imp_OpenTemplate|
00000b30  2c 20 26 72 65 67 73 5f  69 6e 2c 20 26 72 65 67  |, &regs_in, &reg|
00000b40  73 5f 6f 75 74 29 3b 0a  7d 0a 0a 76 6f 69 64 0a  |s_out);.}..void.|
00000b50  61 75 5f 63 6c 6f 73 65  74 65 6d 70 6c 61 74 65  |au_closetemplate|
00000b60  28 76 6f 69 64 29 0a 7b  0a 09 5f 6b 65 72 6e 65  |(void).{.._kerne|
00000b70  6c 5f 73 77 69 5f 72 65  67 73 09 72 65 67 73 5f  |l_swi_regs.regs_|
00000b80  69 6e 2c 20 72 65 67 73  5f 6f 75 74 3b 0a 09 2f  |in, regs_out;../|
00000b90  2a 20 4e 6f 20 64 61 74  61 20 6e 65 65 64 65 64  |* No data needed|
00000ba0  20 66 6f 72 20 43 6c 6f  73 65 54 65 6d 70 6c 61  | for CloseTempla|
00000bb0  74 65 20 2a 2f 0a 09 5f  6b 65 72 6e 65 6c 5f 73  |te */.._kernel_s|
00000bc0  77 69 28 57 69 6d 70 5f  43 6c 6f 73 65 54 65 6d  |wi(Wimp_CloseTem|
00000bd0  70 6c 61 74 65 2c 20 26  72 65 67 73 5f 69 6e 2c  |plate, &regs_in,|
00000be0  20 26 72 65 67 73 5f 6f  75 74 29 3b 0a 7d 0a 0a  | &regs_out);.}..|
00000bf0  69 6e 74 0a 61 75 5f 6c  6f 61 64 74 65 6d 70 6c  |int.au_loadtempl|
00000c00  61 74 65 28 63 68 61 72  20 2a 74 65 6d 70 6c 61  |ate(char *templa|
00000c10  74 65 5f 6e 61 6d 65 2c  20 77 69 6e 64 6f 77 5f  |te_name, window_|
00000c20  64 61 74 61 20 2a 77 69  6e 5f 64 61 74 61 2c 20  |data *win_data, |
00000c30  69 6e 74 20 63 61 6c 6c  29 0a 7b 0a 09 5f 6b 65  |int call).{.._ke|
00000c40  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 09 72 65  |rnel_swi_regs.re|
00000c50  67 73 5f 69 6e 2c 20 72  65 67 73 5f 6f 75 74 3b  |gs_in, regs_out;|
00000c60  0a 09 69 6e 74 09 77 6f  72 6b 73 70 61 63 65 5f  |..int.workspace_|
00000c70  6c 65 6e 67 74 68 20 3d  20 30 3b 0a 09 69 6e 74  |length = 0;..int|
00000c80  09 6e 65 78 74 5f 65 6e  74 72 79 3b 0a 0a 09 2f  |.next_entry;.../|
00000c90  2a 20 69 6e 74 65 72 72  6f 67 61 74 65 20 66 69  |* interrogate fi|
00000ca0  6c 65 20 74 6f 20 66 69  6e 64 20 6f 75 74 20 68  |le to find out h|
00000cb0  6f 77 20 6d 75 63 68 20  73 70 61 63 65 20 77 65  |ow much space we|
00000cc0  20 6e 65 65 64 20 2a 2f  0a 09 72 65 67 73 5f 69  | need */..regs_i|
00000cd0  6e 2e 72 5b 31 5d 20 3d  20 30 3b 20 2f 2a 20 74  |n.r[1] = 0; /* t|
00000ce0  65 6c 6c 20 53 57 49 20  74 6f 20 66 69 6e 64 20  |ell SWI to find |
00000cf0  73 69 7a 65 73 20 2a 2f  0a 09 72 65 67 73 5f 69  |sizes */..regs_i|
00000d00  6e 2e 72 5b 35 5d 20 3d  20 28 69 6e 74 29 20 74  |n.r[5] = (int) t|
00000d10  65 6d 70 6c 61 74 65 5f  6e 61 6d 65 3b 20 2f 2a  |emplate_name; /*|
00000d20  20 70 61 73 73 20 6e 61  6d 65 20 74 6f 20 53 57  | pass name to SW|
00000d30  49 20 2a 2f 0a 09 72 65  67 73 5f 69 6e 2e 72 5b  |I */..regs_in.r[|
00000d40  36 5d 20 3d 20 63 61 6c  6c 3b 20 2f 2a 20 30 20  |6] = call; /* 0 |
00000d50  66 6f 72 20 66 69 72 73  74 20 63 61 6c 6c 20 2a  |for first call *|
00000d60  2f 0a 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |/..._kernel_swi(|
00000d70  57 69 6d 70 5f 4c 6f 61  64 54 65 6d 70 6c 61 74  |Wimp_LoadTemplat|
00000d80  65 2c 20 26 72 65 67 73  5f 69 6e 2c 20 26 72 65  |e, &regs_in, &re|
00000d90  67 73 5f 6f 75 74 29 3b  0a 09 77 69 6e 5f 64 61  |gs_out);..win_da|
00000da0  74 61 2d 3e 62 75 66 66  65 72 20 3d 20 63 61 6c  |ta->buffer = cal|
00000db0  6c 6f 63 28 72 65 67 73  5f 6f 75 74 2e 72 5b 31  |loc(regs_out.r[1|
00000dc0  5d 2c 20 73 69 7a 65 6f  66 28 75 6e 73 69 67 6e  |], sizeof(unsign|
00000dd0  65 64 20 63 68 61 72 29  29 3b 0a 09 77 6f 72 6b  |ed char));..work|
00000de0  73 70 61 63 65 5f 6c 65  6e 67 74 68 20 3d 20 72  |space_length = r|
00000df0  65 67 73 5f 6f 75 74 2e  72 5b 32 5d 3b 20 2f 2a  |egs_out.r[2]; /*|
00000e00  20 65 72 72 20 6f 6e 20  73 69 64 65 20 6f 66 20  | err on side of |
00000e10  63 61 75 74 69 6f 6e 20  2a 2f 0a 09 77 69 6e 5f  |caution */..win_|
00000e20  64 61 74 61 2d 3e 77 6f  72 6b 73 70 61 63 65 20  |data->workspace |
00000e30  3d 20 63 61 6c 6c 6f 63  28 77 6f 72 6b 73 70 61  |= calloc(workspa|
00000e40  63 65 5f 6c 65 6e 67 74  68 2c 20 73 69 7a 65 6f  |ce_length, sizeo|
00000e50  66 28 75 6e 73 69 67 6e  65 64 20 63 68 61 72 29  |f(unsigned char)|
00000e60  29 3b 0a 09 77 69 6e 5f  64 61 74 61 2d 3e 77 69  |);..win_data->wi|
00000e70  6e 5f 6e 61 6d 65 20 3d  20 63 61 6c 6c 6f 63 28  |n_name = calloc(|
00000e80  73 74 72 6c 65 6e 28 20  28 63 68 61 72 20 2a 29  |strlen( (char *)|
00000e90  20 72 65 67 73 5f 6f 75  74 2e 72 5b 35 5d 29 20  | regs_out.r[5]) |
00000ea0  2b 20 31 2c 20 73 69 7a  65 6f 66 28 63 68 61 72  |+ 1, sizeof(char|
00000eb0  29 29 3b 0a 09 73 74 72  63 70 79 28 77 69 6e 5f  |));..strcpy(win_|
00000ec0  64 61 74 61 2d 3e 77 69  6e 5f 6e 61 6d 65 2c 20  |data->win_name, |
00000ed0  28 63 68 61 72 20 2a 29  20 72 65 67 73 5f 6f 75  |(char *) regs_ou|
00000ee0  74 2e 72 5b 35 5d 29 3b  0a 0a 09 2f 2a 20 4e 6f  |t.r[5]);.../* No|
00000ef0  77 20 72 65 6c 6f 61 64  20 74 65 6d 70 6c 61 74  |w reload templat|
00000f00  65 20 66 72 6f 6d 20 66  69 6c 65 20 69 6e 74 6f  |e from file into|
00000f10  20 6d 65 6d 6f 72 79 20  2a 2f 0a 09 72 65 67 73  | memory */..regs|
00000f20  5f 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  |_in.r[1] = (int)|
00000f30  20 77 69 6e 5f 64 61 74  61 2d 3e 62 75 66 66 65  | win_data->buffe|
00000f40  72 3b 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 32 5d  |r;..regs_in.r[2]|
00000f50  20 3d 20 28 69 6e 74 29  20 77 69 6e 5f 64 61 74  | = (int) win_dat|
00000f60  61 2d 3e 77 6f 72 6b 73  70 61 63 65 3b 0a 09 72  |a->workspace;..r|
00000f70  65 67 73 5f 69 6e 2e 72  5b 33 5d 20 3d 20 28 69  |egs_in.r[3] = (i|
00000f80  6e 74 29 20 77 69 6e 5f  64 61 74 61 2d 3e 77 6f  |nt) win_data->wo|
00000f90  72 6b 73 70 61 63 65 20  2b 20 77 6f 72 6b 73 70  |rkspace + worksp|
00000fa0  61 63 65 5f 6c 65 6e 67  74 68 3b 0a 09 72 65 67  |ace_length;..reg|
00000fb0  73 5f 69 6e 2e 72 5b 34  5d 20 3d 20 2d 31 3b 20  |s_in.r[4] = -1; |
00000fc0  2f 2a 20 4e 4f 20 46 4f  4e 54 53 20 43 41 54 45  |/* NO FONTS CATE|
00000fd0  52 45 44 20 46 4f 52 20  49 4e 20 54 45 4d 50 4c  |RED FOR IN TEMPL|
00000fe0  41 54 45 53 20 59 45 54  20 2a 2f 0a 09 72 65 67  |ATES YET */..reg|
00000ff0  73 5f 69 6e 2e 72 5b 35  5d 20 3d 20 28 69 6e 74  |s_in.r[5] = (int|
00001000  29 20 77 69 6e 5f 64 61  74 61 2d 3e 77 69 6e 5f  |) win_data->win_|
00001010  6e 61 6d 65 3b 0a 09 72  65 67 73 5f 69 6e 2e 72  |name;..regs_in.r|
00001020  5b 36 5d 20 3d 20 63 61  6c 6c 3b 0a 0a 09 5f 6b  |[6] = call;..._k|
00001030  65 72 6e 65 6c 5f 73 77  69 28 57 69 6d 70 5f 4c  |ernel_swi(Wimp_L|
00001040  6f 61 64 54 65 6d 70 6c  61 74 65 2c 20 26 72 65  |oadTemplate, &re|
00001050  67 73 5f 69 6e 2c 20 26  72 65 67 73 5f 6f 75 74  |gs_in, &regs_out|
00001060  29 3b 0a 09 6e 65 78 74  5f 65 6e 74 72 79 20 3d  |);..next_entry =|
00001070  20 72 65 67 73 5f 6f 75  74 2e 72 5b 36 5d 3b 0a  | regs_out.r[6];.|
00001080  0a 09 2f 2a 20 43 72 65  61 74 65 20 74 68 65 20  |../* Create the |
00001090  77 69 6e 64 6f 77 2c 20  73 74 6f 72 65 20 77 69  |window, store wi|
000010a0  6e 64 6f 77 20 68 61 6e  64 6c 65 20 2a 2f 0a 09  |ndow handle */..|
000010b0  72 65 67 73 5f 69 6e 2e  72 5b 31 5d 20 3d 20 28  |regs_in.r[1] = (|
000010c0  69 6e 74 29 20 77 69 6e  5f 64 61 74 61 2d 3e 62  |int) win_data->b|
000010d0  75 66 66 65 72 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  |uffer;.._kernel_|
000010e0  73 77 69 28 57 69 6d 70  5f 43 72 65 61 74 65 57  |swi(Wimp_CreateW|
000010f0  69 6e 64 6f 77 2c 20 26  72 65 67 73 5f 69 6e 2c  |indow, &regs_in,|
00001100  20 26 72 65 67 73 5f 6f  75 74 29 3b 0a 09 77 69  | &regs_out);..wi|
00001110  6e 5f 64 61 74 61 2d 3e  77 69 6e 5f 68 61 6e 64  |n_data->win_hand|
00001120  6c 65 20 3d 20 72 65 67  73 5f 6f 75 74 2e 72 5b  |le = regs_out.r[|
00001130  30 5d 3b 0a 09 72 65 74  75 72 6e 20 6e 65 78 74  |0];..return next|
00001140  5f 65 6e 74 72 79 3b 20  2f 2a 20 69 6e 20 63 61  |_entry; /* in ca|
00001150  73 65 20 6f 66 20 77 69  6c 64 63 61 72 64 65 64  |se of wildcarded|
00001160  20 73 65 61 72 63 68 65  73 20 2a 2f 0a 7d 0a 0a  | searches */.}..|
00001170  69 6e 74 0a 61 75 5f 72  65 70 6f 72 74 5f 65 72  |int.au_report_er|
00001180  72 6f 72 28 69 6e 74 20  65 72 72 6e 6f 2c 20 63  |ror(int errno, c|
00001190  68 61 72 20 2a 65 72 72  6d 65 73 73 2c 20 69 6e  |har *errmess, in|
000011a0  74 20 66 6c 61 67 73 2c  20 63 68 61 72 20 2a 61  |t flags, char *a|
000011b0  70 70 5f 6e 61 6d 65 29  0a 7b 0a 20 20 20 75 6e  |pp_name).{.   un|
000011c0  73 69 67 6e 65 64 20 63  68 61 72 20 65 72 72 6f  |signed char erro|
000011d0  72 62 6c 6f 63 6b 5b 32  36 30 5d 3b 0a 20 20 20  |rblock[260];.   |
000011e0  5f 6b 65 72 6e 65 6c 5f  73 77 69 5f 72 65 67 73  |_kernel_swi_regs|
000011f0  20 69 6e 2c 20 6f 75 74  3b 0a 0a 20 20 20 2f 2a  | in, out;..   /*|
00001200  20 53 65 74 20 75 70 20  74 68 65 20 73 74 61 6e  | Set up the stan|
00001210  64 61 72 64 20 65 72 72  6f 72 20 62 6c 6f 63 6b  |dard error block|
00001220  20 77 69 74 68 20 74 68  65 20 65 72 72 6f 72 20  | with the error |
00001230  6e 75 6d 62 65 72 20 61  6e 64 20 6d 65 73 73 61  |number and messa|
00001240  67 65 0a 20 20 20 20 20  20 28 7a 65 72 6f 20 74  |ge.      (zero t|
00001250  65 72 6d 69 6e 61 74 65  64 29 20 2a 2f 0a 20 20  |erminated) */.  |
00001260  20 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 65  | au_wordtobyte(e|
00001270  72 72 6e 6f 2c 20 65 72  72 6f 72 62 6c 6f 63 6b  |rrno, errorblock|
00001280  2c 20 30 29 3b 0a 20 20  20 73 74 72 63 70 79 28  |, 0);.   strcpy(|
00001290  20 28 63 68 61 72 20 2a  29 20 26 65 72 72 6f 72  | (char *) &error|
000012a0  62 6c 6f 63 6b 5b 34 5d  2c 20 65 72 72 6d 65 73  |block[4], errmes|
000012b0  73 29 3b 0a 0a 20 20 20  2f 2a 20 52 30 20 2d 20  |s);..   /* R0 - |
000012c0  70 6f 69 6e 74 65 72 20  74 6f 20 73 74 61 6e 64  |pointer to stand|
000012d0  61 72 64 20 65 72 72 6f  72 20 62 6c 6f 63 6b 0a  |ard error block.|
000012e0  20 20 20 20 20 20 52 31  20 2d 20 65 72 72 6f 72  |      R1 - error|
000012f0  20 77 69 6e 64 6f 77 20  66 6c 61 67 73 0a 20 20  | window flags.  |
00001300  20 20 20 20 52 32 20 2d  20 70 6f 69 6e 74 65 72  |    R2 - pointer|
00001310  20 74 6f 20 61 70 70 6c  69 63 61 74 69 6f 6e 20  | to application |
00001320  6e 61 6d 65 20 66 6f 72  20 65 72 72 6f 72 20 62  |name for error b|
00001330  6f 78 20 74 69 74 6c 65  20 2a 2f 0a 0a 20 20 20  |ox title */..   |
00001340  69 6e 2e 72 5b 30 5d 20  3d 20 28 69 6e 74 29 20  |in.r[0] = (int) |
00001350  65 72 72 6f 72 62 6c 6f  63 6b 3b 0a 20 20 20 69  |errorblock;.   i|
00001360  6e 2e 72 5b 31 5d 20 3d  20 66 6c 61 67 73 3b 0a  |n.r[1] = flags;.|
00001370  20 20 20 69 6e 2e 72 5b  32 5d 20 3d 20 28 69 6e  |   in.r[2] = (in|
00001380  74 29 20 61 70 70 5f 6e  61 6d 65 3b 0a 0a 20 20  |t) app_name;..  |
00001390  20 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  | _kernel_swi(Wim|
000013a0  70 5f 52 65 70 6f 72 74  45 72 72 6f 72 2c 20 26  |p_ReportError, &|
000013b0  69 6e 2c 20 26 6f 75 74  29 3b 0a 0a 20 20 20 2f  |in, &out);..   /|
000013c0  2a 20 52 65 74 75 72 6e  73 20 31 20 69 66 20 4f  |* Returns 1 if O|
000013d0  4b 20 73 65 6c 65 63 74  65 64 2c 20 32 20 69 66  |K selected, 2 if|
000013e0  20 43 61 6e 63 65 6c 20  73 65 6c 65 63 74 65 64  | Cancel selected|
000013f0  20 2a 2f 0a 20 20 20 72  65 74 75 72 6e 20 6f 75  | */.   return ou|
00001400  74 2e 72 5b 31 5d 3b 0a  7d 0a 0a 76 6f 69 64 0a  |t.r[1];.}..void.|
00001410  61 75 5f 6f 70 65 6e 77  69 6e 5f 66 72 6f 6d 5f  |au_openwin_from_|
00001420  74 65 6d 70 6c 61 74 65  64 61 74 61 28 77 69 6e  |templatedata(win|
00001430  64 6f 77 5f 64 61 74 61  20 2a 77 69 6e 5f 64 61  |dow_data *win_da|
00001440  74 61 2c 20 6c 6f 6e 67  20 69 6e 74 20 70 6f 73  |ta, long int pos|
00001450  69 74 69 6f 6e 29 0a 7b  0a 09 5f 6b 65 72 6e 65  |ition).{.._kerne|
00001460  6c 5f 73 77 69 5f 72 65  67 73 09 72 65 67 73 5f  |l_swi_regs.regs_|
00001470  69 6e 2c 20 72 65 67 73  5f 6f 75 74 3b 0a 09 75  |in, regs_out;..u|
00001480  6e 73 69 67 6e 65 64 20  63 68 61 72 09 6f 70 65  |nsigned char.ope|
00001490  6e 77 69 6e 64 6f 77 5f  62 75 66 66 65 72 5b 33  |nwindow_buffer[3|
000014a0  36 5d 3b 0a 09 69 6e 74  09 69 3b 0a 0a 09 61 75  |6];..int.i;...au|
000014b0  5f 77 6f 72 64 74 6f 62  79 74 65 28 20 28 75 6e  |_wordtobyte( (un|
000014c0  73 69 67 6e 65 64 20 6c  6f 6e 67 20 69 6e 74 29  |signed long int)|
000014d0  20 77 69 6e 5f 64 61 74  61 2d 3e 77 69 6e 5f 68  | win_data->win_h|
000014e0  61 6e 64 6c 65 2c 20 6f  70 65 6e 77 69 6e 64 6f  |andle, openwindo|
000014f0  77 5f 62 75 66 66 65 72  2c 20 30 29 3b 0a 09 66  |w_buffer, 0);..f|
00001500  6f 72 28 69 20 3d 20 30  3b 20 69 20 3c 20 36 3b  |or(i = 0; i < 6;|
00001510  20 69 2b 2b 29 20 7b 0a  09 09 61 75 5f 77 6f 72  | i++) {...au_wor|
00001520  64 74 6f 62 79 74 65 28  61 75 5f 62 79 74 65 74  |dtobyte(au_bytet|
00001530  6f 77 6f 72 64 28 77 69  6e 5f 64 61 74 61 2d 3e  |oword(win_data->|
00001540  62 75 66 66 65 72 2c 20  69 2a 34 29 2c 20 6f 70  |buffer, i*4), op|
00001550  65 6e 77 69 6e 64 6f 77  5f 62 75 66 66 65 72 2c  |enwindow_buffer,|
00001560  20 28 69 2b 31 29 20 2a  20 34 29 3b 0a 09 7d 0a  | (i+1) * 4);..}.|
00001570  09 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 70  |.au_wordtobyte(p|
00001580  6f 73 69 74 69 6f 6e 2c  20 6f 70 65 6e 77 69 6e  |osition, openwin|
00001590  64 6f 77 5f 62 75 66 66  65 72 2c 20 32 38 29 3b  |dow_buffer, 28);|
000015a0  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 31 5d 20 3d  |..regs_in.r[1] =|
000015b0  20 28 69 6e 74 29 20 6f  70 65 6e 77 69 6e 64 6f  | (int) openwindo|
000015c0  77 5f 62 75 66 66 65 72  3b 0a 09 5f 6b 65 72 6e  |w_buffer;.._kern|
000015d0  65 6c 5f 73 77 69 28 57  69 6d 70 5f 4f 70 65 6e  |el_swi(Wimp_Open|
000015e0  57 69 6e 64 6f 77 2c 20  26 72 65 67 73 5f 69 6e  |Window, &regs_in|
000015f0  2c 20 26 72 65 67 73 5f  6f 75 74 29 3b 0a 09 72  |, &regs_out);..r|
00001600  65 74 75 72 6e 3b 0a 7d  0a 0a 69 6e 74 0a 61 75  |eturn;.}..int.au|
00001610  5f 77 69 6d 70 5f 70 6f  6c 6c 28 69 6e 74 20 70  |_wimp_poll(int p|
00001620  6f 6c 6c 6d 61 73 6b 2c  20 75 6e 73 69 67 6e 65  |ollmask, unsigne|
00001630  64 20 63 68 61 72 20 2a  70 6f 6c 6c 62 6c 6f 63  |d char *pollbloc|
00001640  6b 29 0a 7b 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |k).{.._kernel_sw|
00001650  69 5f 72 65 67 73 09 72  65 67 73 5f 69 6e 2c 20  |i_regs.regs_in, |
00001660  72 65 67 73 5f 6f 75 74  3b 0a 0a 09 72 65 67 73  |regs_out;...regs|
00001670  5f 69 6e 2e 72 5b 30 5d  20 3d 20 70 6f 6c 6c 6d  |_in.r[0] = pollm|
00001680  61 73 6b 3b 0a 09 72 65  67 73 5f 69 6e 2e 72 5b  |ask;..regs_in.r[|
00001690  31 5d 20 3d 20 28 69 6e  74 29 20 70 6f 6c 6c 62  |1] = (int) pollb|
000016a0  6c 6f 63 6b 3b 0a 0a 09  5f 6b 65 72 6e 65 6c 5f  |lock;..._kernel_|
000016b0  73 77 69 28 57 69 6d 70  5f 50 6f 6c 6c 2c 20 26  |swi(Wimp_Poll, &|
000016c0  72 65 67 73 5f 69 6e 2c  20 26 72 65 67 73 5f 6f  |regs_in, &regs_o|
000016d0  75 74 29 3b 0a 09 72 65  74 75 72 6e 20 72 65 67  |ut);..return reg|
000016e0  73 5f 6f 75 74 2e 72 5b  30 5d 3b 20 2f 2a 20 52  |s_out.r[0]; /* R|
000016f0  65 74 75 72 6e 20 74 68  65 20 65 76 65 6e 74 20  |eturn the event |
00001700  63 6f 64 65 20 2a 2f 0a  7d 0a 0a 76 6f 69 64 0a  |code */.}..void.|
00001710  61 75 5f 69 63 6f 6e 5f  74 65 78 74 5f 63 68 61  |au_icon_text_cha|
00001720  6e 67 65 28 63 68 61 72  20 2a 74 65 78 74 2c 20  |nge(char *text, |
00001730  75 6e 73 69 67 6e 65 64  20 6c 6f 6e 67 20 69 6e  |unsigned long in|
00001740  74 20 77 69 6e 5f 68 2c  20 75 6e 73 69 67 6e 65  |t win_h, unsigne|
00001750  64 20 6c 6f 6e 67 20 69  6e 74 20 69 63 6f 6e 5f  |d long int icon_|
00001760  68 29 0a 7b 0a 20 20 20  5f 6b 65 72 6e 65 6c 5f  |h).{.   _kernel_|
00001770  73 77 69 5f 72 65 67 73  20 72 65 67 73 5f 69 6e  |swi_regs regs_in|
00001780  2c 20 72 65 67 73 5f 6f  75 74 3b 0a 20 20 20 63  |, regs_out;.   c|
00001790  68 61 72 20 2a 74 65 78  74 5f 70 6f 69 6e 74 65  |har *text_pointe|
000017a0  72 3b 0a 20 20 20 75 6e  73 69 67 6e 65 64 20 63  |r;.   unsigned c|
000017b0  68 61 72 20 74 65 6d 70  5f 62 75 66 66 65 72 5b  |har temp_buffer[|
000017c0  32 35 35 5d 3b 0a 0a 20  20 20 2f 2a 20 46 69 6e  |255];..   /* Fin|
000017d0  64 20 6f 75 74 20 77 68  65 72 65 20 74 68 65 20  |d out where the |
000017e0  69 63 6f 6e 27 73 20 69  6e 64 69 72 65 63 74 65  |icon's indirecte|
000017f0  64 20 74 65 78 74 20 69  73 20 73 74 6f 72 65 64  |d text is stored|
00001800  20 69 6e 20 6d 65 6d 6f  72 79 20 61 6e 64 20 63  | in memory and c|
00001810  6f 70 79 0a 20 20 20 20  20 20 61 20 6e 65 77 20  |opy.      a new |
00001820  73 74 72 69 6e 67 20 74  6f 20 69 74 20 2a 2f 0a  |string to it */.|
00001830  20 20 20 74 65 78 74 5f  70 6f 69 6e 74 65 72 20  |   text_pointer |
00001840  3d 20 61 75 5f 67 65 74  5f 70 74 72 5f 74 6f 5f  |= au_get_ptr_to_|
00001850  69 63 6f 6e 74 65 78 74  28 77 69 6e 5f 68 2c 20  |icontext(win_h, |
00001860  69 63 6f 6e 5f 68 29 3b  0a 20 20 20 73 74 72 63  |icon_h);.   strc|
00001870  70 79 28 74 65 78 74 5f  70 6f 69 6e 74 65 72 2c  |py(text_pointer,|
00001880  20 74 65 78 74 29 3b 0a  0a 20 20 20 2f 2a 20 4e  | text);..   /* N|
00001890  6f 77 20 77 65 20 6e 65  65 64 20 74 6f 20 69 6e  |ow we need to in|
000018a0  66 6f 72 6d 20 74 68 65  20 57 49 4d 50 20 74 68  |form the WIMP th|
000018b0  61 74 20 74 68 65 20 69  63 6f 6e 20 6e 65 65 64  |at the icon need|
000018c0  73 20 72 65 64 72 61 77  69 6e 67 20 62 79 20 73  |s redrawing by s|
000018d0  65 74 74 69 6e 67 0a 20  20 20 20 20 20 74 68 65  |etting.      the|
000018e0  20 69 63 6f 6e 20 66 6c  61 67 73 20 2d 20 77 65  | icon flags - we|
000018f0  20 64 6f 6e 27 74 20 61  63 74 75 61 6c 6c 79 20  | don't actually |
00001900  63 68 61 6e 67 65 20 74  68 65 6d 20 77 69 74 68  |change them with|
00001910  20 74 68 69 73 20 63 61  6c 6c 2c 20 62 75 74 20  | this call, but |
00001920  74 68 69 73 0a 20 20 20  20 20 20 73 70 75 72 73  |this.      spurs|
00001930  20 74 68 65 20 57 49 4d  50 20 69 6e 74 6f 20 61  | the WIMP into a|
00001940  63 74 69 6f 6e 20 2a 2f  0a 0a 20 20 20 61 75 5f  |ction */..   au_|
00001950  77 6f 72 64 74 6f 62 79  74 65 28 77 69 6e 5f 68  |wordtobyte(win_h|
00001960  2c 20 74 65 6d 70 5f 62  75 66 66 65 72 2c 20 30  |, temp_buffer, 0|
00001970  29 3b 0a 20 20 20 61 75  5f 77 6f 72 64 74 6f 62  |);.   au_wordtob|
00001980  79 74 65 28 69 63 6f 6e  5f 68 2c 20 74 65 6d 70  |yte(icon_h, temp|
00001990  5f 62 75 66 66 65 72 2c  20 34 29 3b 0a 20 20 20  |_buffer, 4);.   |
000019a0  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 30 2c  |au_wordtobyte(0,|
000019b0  20 74 65 6d 70 5f 62 75  66 66 65 72 2c 20 38 29  | temp_buffer, 8)|
000019c0  3b 0a 20 20 20 61 75 5f  77 6f 72 64 74 6f 62 79  |;.   au_wordtoby|
000019d0  74 65 28 30 2c 20 74 65  6d 70 5f 62 75 66 66 65  |te(0, temp_buffe|
000019e0  72 2c 20 31 32 29 3b 0a  0a 20 20 20 72 65 67 73  |r, 12);..   regs|
000019f0  5f 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  |_in.r[1] = (int)|
00001a00  20 74 65 6d 70 5f 62 75  66 66 65 72 3b 0a 0a 20  | temp_buffer;.. |
00001a10  20 20 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |  _kernel_swi(Wi|
00001a20  6d 70 5f 53 65 74 49 63  6f 6e 53 74 61 74 65 2c  |mp_SetIconState,|
00001a30  20 26 72 65 67 73 5f 69  6e 2c 20 26 72 65 67 73  | &regs_in, &regs|
00001a40  5f 6f 75 74 29 3b 0a 20  20 20 72 65 74 75 72 6e  |_out);.   return|
00001a50  3b 0a 7d 0a 0a 63 68 61  72 20 2a 0a 61 75 5f 67  |;.}..char *.au_g|
00001a60  65 74 5f 70 74 72 5f 74  6f 5f 69 63 6f 6e 74 65  |et_ptr_to_iconte|
00001a70  78 74 28 75 6e 73 69 67  6e 65 64 20 6c 6f 6e 67  |xt(unsigned long|
00001a80  20 69 6e 74 20 77 69 6e  68 64 6c 2c 20 75 6e 73  | int winhdl, uns|
00001a90  69 67 6e 65 64 20 6c 6f  6e 67 20 69 6e 74 20 69  |igned long int i|
00001aa0  63 6f 6e 68 64 6c 29 0a  7b 0a 20 20 20 2f 2a 20  |conhdl).{.   /* |
00001ab0  54 68 69 73 20 70 72 6f  63 65 64 75 72 65 20 69  |This procedure i|
00001ac0  6e 74 65 72 72 6f 67 61  74 65 73 20 61 6e 20 69  |nterrogates an i|
00001ad0  63 6f 6e 20 74 6f 20 64  65 74 65 72 6d 69 6e 65  |con to determine|
00001ae0  20 74 68 65 20 61 64 64  72 65 73 73 20 77 68 65  | the address whe|
00001af0  72 65 20 69 74 73 0a 20  20 20 20 20 20 69 6e 64  |re its.      ind|
00001b00  69 72 65 63 74 65 64 20  74 65 78 74 20 64 61 74  |irected text dat|
00001b10  61 20 69 73 20 73 74 6f  72 65 64 20 69 6e 20 6d  |a is stored in m|
00001b20  65 6d 6f 72 79 2c 20 61  6e 64 20 72 65 74 75 72  |emory, and retur|
00001b30  6e 73 20 69 74 20 2a 2f  0a 0a 20 20 20 75 6e 73  |ns it */..   uns|
00001b40  69 67 6e 65 64 20 63 68  61 72 20 74 65 6d 70 5f  |igned char temp_|
00001b50  62 75 66 66 65 72 5b 32  35 35 5d 3b 0a 20 20 20  |buffer[255];.   |
00001b60  5f 6b 65 72 6e 65 6c 5f  73 77 69 5f 72 65 67 73  |_kernel_swi_regs|
00001b70  20 72 65 67 73 5f 69 6e  2c 20 72 65 67 73 5f 6f  | regs_in, regs_o|
00001b80  75 74 3b 0a 20 20 20 63  68 61 72 20 2a 72 65 73  |ut;.   char *res|
00001b90  75 6c 74 3b 0a 0a 20 20  20 61 75 5f 77 6f 72 64  |ult;..   au_word|
00001ba0  74 6f 62 79 74 65 28 77  69 6e 68 64 6c 2c 20 74  |tobyte(winhdl, t|
00001bb0  65 6d 70 5f 62 75 66 66  65 72 2c 20 30 29 3b 0a  |emp_buffer, 0);.|
00001bc0  20 20 20 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |   au_wordtobyte|
00001bd0  28 69 63 6f 6e 68 64 6c  2c 20 74 65 6d 70 5f 62  |(iconhdl, temp_b|
00001be0  75 66 66 65 72 2c 20 34  29 3b 0a 0a 20 20 20 72  |uffer, 4);..   r|
00001bf0  65 67 73 5f 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |egs_in.r[1] = (i|
00001c00  6e 74 29 20 74 65 6d 70  5f 62 75 66 66 65 72 3b  |nt) temp_buffer;|
00001c10  0a 20 20 20 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |.   _kernel_swi(|
00001c20  57 69 6d 70 5f 47 65 74  49 63 6f 6e 53 74 61 74  |Wimp_GetIconStat|
00001c30  65 2c 20 26 72 65 67 73  5f 69 6e 2c 20 26 72 65  |e, &regs_in, &re|
00001c40  67 73 5f 6f 75 74 29 3b  0a 0a 20 20 20 72 65 73  |gs_out);..   res|
00001c50  75 6c 74 20 3d 20 28 63  68 61 72 20 2a 29 20 61  |ult = (char *) a|
00001c60  75 5f 62 79 74 65 74 6f  77 6f 72 64 28 74 65 6d  |u_bytetoword(tem|
00001c70  70 5f 62 75 66 66 65 72  2c 20 32 38 29 3b 0a 20  |p_buffer, 28);. |
00001c80  20 20 72 65 74 75 72 6e  20 72 65 73 75 6c 74 3b  |  return result;|
00001c90  0a 7d 0a 0a 76 6f 69 64  0a 61 75 5f 62 75 69 6c  |.}..void.au_buil|
00001ca0  64 6d 65 6e 75 28 63 68  61 72 20 2a 74 69 74 6c  |dmenu(char *titl|
00001cb0  65 2c 20 6d 65 6e 75 5f  64 61 74 61 20 2a 6d 65  |e, menu_data *me|
00001cc0  6e 75 5f 64 61 74 29 0a  7b 0a 09 69 66 28 73 74  |nu_dat).{..if(st|
00001cd0  72 6c 65 6e 28 74 69 74  6c 65 29 20 3e 20 31 31  |rlen(title) > 11|
00001ce0  29 20 72 65 74 75 72 6e  3b 20 2f 2a 20 44 6f 20  |) return; /* Do |
00001cf0  74 68 69 73 20 6d 6f 72  65 20 6e 65 61 74 6c 79  |this more neatly|
00001d00  21 20 2a 2f 0a 09 2f 2a  20 46 69 6c 6c 20 69 6e  |! */../* Fill in|
00001d10  20 74 68 65 20 6d 65 6e  75 20 68 65 61 64 65 72  | the menu header|
00001d20  20 77 69 74 68 20 73 74  61 6e 64 61 72 64 20 69  | with standard i|
00001d30  6e 66 6f 72 6d 61 74 69  6f 6e 20 2a 2f 0a 09 73  |nformation */..s|
00001d40  74 72 63 70 79 28 6d 65  6e 75 5f 64 61 74 2d 3e  |trcpy(menu_dat->|
00001d50  74 69 74 6c 65 2c 20 74  69 74 6c 65 29 3b 0a 09  |title, title);..|
00001d60  6d 65 6e 75 5f 64 61 74  2d 3e 63 6f 6c 6f 75 72  |menu_dat->colour|
00001d70  73 20 3d 20 4d 45 4e 55  5f 54 49 54 4c 45 46 4f  |s = MENU_TITLEFO|
00001d80  52 45 20 7c 20 4d 45 4e  55 5f 54 49 54 4c 45 42  |RE | MENU_TITLEB|
00001d90  41 43 4b 20 7c 20 4d 45  4e 55 5f 57 4f 52 4b 46  |ACK | MENU_WORKF|
00001da0  4f 52 45 20 7c 20 4d 45  4e 55 5f 57 4f 52 4b 42  |ORE | MENU_WORKB|
00001db0  41 43 4b 3b 0a 09 6d 65  6e 75 5f 64 61 74 2d 3e  |ACK;..menu_dat->|
00001dc0  77 69 64 74 68 20 3d 20  4d 45 4e 55 5f 57 49 44  |width = MENU_WID|
00001dd0  54 48 3b 0a 09 6d 65 6e  75 5f 64 61 74 2d 3e 68  |TH;..menu_dat->h|
00001de0  65 69 67 68 74 20 3d 20  4d 45 4e 55 5f 48 45 49  |eight = MENU_HEI|
00001df0  47 48 54 3b 0a 09 6d 65  6e 75 5f 64 61 74 2d 3e  |GHT;..menu_dat->|
00001e00  76 65 72 74 5f 67 61 70  20 3d 20 4d 45 4e 55 5f  |vert_gap = MENU_|
00001e10  56 45 52 54 47 41 50 3b  0a 09 6d 65 6e 75 5f 64  |VERTGAP;..menu_d|
00001e20  61 74 2d 3e 6e 65 78 74  5f 6d 65 6e 75 65 6c 65  |at->next_menuele|
00001e30  6d 20 3d 20 4e 55 4c 4c  3b 0a 09 6d 65 6e 75 5f  |m = NULL;..menu_|
00001e40  64 61 74 2d 3e 73 69 7a  65 20 3d 20 73 69 7a 65  |dat->size = size|
00001e50  6f 66 28 6d 65 6e 75 5f  64 61 74 61 29 3b 0a 09  |of(menu_data);..|
00001e60  72 65 74 75 72 6e 3b 0a  7d 0a 0a 76 6f 69 64 0a  |return;.}..void.|
00001e70  61 75 5f 61 64 64 74 6f  6d 65 6e 75 28 63 68 61  |au_addtomenu(cha|
00001e80  72 20 2a 74 65 78 74 2c  20 6c 6f 6e 67 20 69 6e  |r *text, long in|
00001e90  74 20 6d 65 6e 75 5f 66  6c 61 67 73 2c 20 6c 6f  |t menu_flags, lo|
00001ea0  6e 67 20 69 6e 74 20 73  75 62 6d 65 6e 75 2c 20  |ng int submenu, |
00001eb0  6c 6f 6e 67 20 69 6e 74  20 69 63 6f 6e 5f 66 6c  |long int icon_fl|
00001ec0  61 67 73 2c 20 6d 65 6e  75 5f 64 61 74 61 20 2a  |ags, menu_data *|
00001ed0  6d 65 6e 75 5f 64 61 74  29 0a 7b 0a 09 6d 65 6e  |menu_dat).{..men|
00001ee0  75 5f 65 6c 65 6d 65 6e  74 20 2a 70 6f 69 6e 74  |u_element *point|
00001ef0  65 72 3b 0a 0a 09 69 66  28 73 74 72 6c 65 6e 28  |er;...if(strlen(|
00001f00  74 65 78 74 29 20 3e 20  31 31 29 20 72 65 74 75  |text) > 11) retu|
00001f10  72 6e 3b 0a 09 2f 2a 20  57 6f 72 6b 20 6f 75 72  |rn;../* Work our|
00001f20  20 77 61 79 20 74 6f 20  65 6e 64 20 6f 66 20 6d  | way to end of m|
00001f30  65 6e 75 20 6c 69 73 74  20 2a 2f 0a 09 69 66 28  |enu list */..if(|
00001f40  6d 65 6e 75 5f 64 61 74  2d 3e 6e 65 78 74 5f 6d  |menu_dat->next_m|
00001f50  65 6e 75 65 6c 65 6d 20  3d 3d 20 4e 55 4c 4c 29  |enuelem == NULL)|
00001f60  20 7b 0a 09 09 6d 65 6e  75 5f 64 61 74 2d 3e 6e  | {...menu_dat->n|
00001f70  65 78 74 5f 6d 65 6e 75  65 6c 65 6d 20 3d 20 63  |ext_menuelem = c|
00001f80  61 6c 6c 6f 63 28 31 2c  20 73 69 7a 65 6f 66 28  |alloc(1, sizeof(|
00001f90  6d 65 6e 75 5f 65 6c 65  6d 65 6e 74 29 29 3b 0a  |menu_element));.|
00001fa0  09 09 6d 65 6e 75 5f 64  61 74 2d 3e 73 69 7a 65  |..menu_dat->size|
00001fb0  20 2b 3d 20 73 69 7a 65  6f 66 28 6d 65 6e 75 5f  | += sizeof(menu_|
00001fc0  65 6c 65 6d 65 6e 74 29  3b 0a 09 09 70 6f 69 6e  |element);...poin|
00001fd0  74 65 72 20 3d 20 6d 65  6e 75 5f 64 61 74 2d 3e  |ter = menu_dat->|
00001fe0  6e 65 78 74 5f 6d 65 6e  75 65 6c 65 6d 3b 0a 09  |next_menuelem;..|
00001ff0  7d 20 65 6c 73 65 20 7b  0a 09 09 70 6f 69 6e 74  |} else {...point|
00002000  65 72 20 3d 20 6d 65 6e  75 5f 64 61 74 2d 3e 6e  |er = menu_dat->n|
00002010  65 78 74 5f 6d 65 6e 75  65 6c 65 6d 3b 0a 09 09  |ext_menuelem;...|
00002020  77 68 69 6c 65 20 28 70  6f 69 6e 74 65 72 2d 3e  |while (pointer->|
00002030  6e 65 78 74 5f 6d 65 6e  75 65 6c 65 6d 20 21 3d  |next_menuelem !=|
00002040  20 30 29 20 7b 0a 09 09  09 70 6f 69 6e 74 65 72  | 0) {....pointer|
00002050  20 3d 20 70 6f 69 6e 74  65 72 2d 3e 6e 65 78 74  | = pointer->next|
00002060  5f 6d 65 6e 75 65 6c 65  6d 3b 0a 09 09 7d 0a 09  |_menuelem;...}..|
00002070  09 70 6f 69 6e 74 65 72  2d 3e 6e 65 78 74 5f 6d  |.pointer->next_m|
00002080  65 6e 75 65 6c 65 6d 20  3d 20 63 61 6c 6c 6f 63  |enuelem = calloc|
00002090  28 31 2c 20 73 69 7a 65  6f 66 28 6d 65 6e 75 5f  |(1, sizeof(menu_|
000020a0  65 6c 65 6d 65 6e 74 29  29 3b 0a 09 09 6d 65 6e  |element));...men|
000020b0  75 5f 64 61 74 2d 3e 73  69 7a 65 20 2b 3d 20 73  |u_dat->size += s|
000020c0  69 7a 65 6f 66 28 6d 65  6e 75 5f 65 6c 65 6d 65  |izeof(menu_eleme|
000020d0  6e 74 29 3b 0a 09 09 70  6f 69 6e 74 65 72 20 3d  |nt);...pointer =|
000020e0  20 70 6f 69 6e 74 65 72  2d 3e 6e 65 78 74 5f 6d  | pointer->next_m|
000020f0  65 6e 75 65 6c 65 6d 3b  0a 09 7d 0a 09 2f 2a 20  |enuelem;..}../* |
00002100  73 65 74 20 75 70 20 64  61 74 61 20 2a 2f 0a 09  |set up data */..|
00002110  73 74 72 63 70 79 28 70  6f 69 6e 74 65 72 2d 3e  |strcpy(pointer->|
00002120  6d 65 6e 75 5f 74 65 78  74 2c 20 74 65 78 74 29  |menu_text, text)|
00002130  3b 0a 09 70 6f 69 6e 74  65 72 2d 3e 66 6c 61 67  |;..pointer->flag|
00002140  73 20 3d 20 6d 65 6e 75  5f 66 6c 61 67 73 3b 0a  |s = menu_flags;.|
00002150  09 70 6f 69 6e 74 65 72  2d 3e 73 75 62 6d 65 6e  |.pointer->submen|
00002160  75 20 3d 20 73 75 62 6d  65 6e 75 3b 0a 0a 09 2f  |u = submenu;.../|
00002170  2a 20 41 70 70 6c 79 20  73 74 61 6e 64 61 72 64  |* Apply standard|
00002180  20 69 63 6f 6e 20 66 6c  61 67 73 20 2a 2f 0a 09  | icon flags */..|
00002190  69 63 6f 6e 5f 66 6c 61  67 73 20 3d 20 69 63 6f  |icon_flags = ico|
000021a0  6e 5f 66 6c 61 67 73 20  7c 20 4d 45 4e 55 49 54  |n_flags | MENUIT|
000021b0  45 4d 5f 46 4f 52 45 20  7c 20 4d 45 4e 55 49 54  |EM_FORE | MENUIT|
000021c0  45 4d 5f 42 41 43 4b 20  7c 20 49 43 4f 4e 5f 49  |EM_BACK | ICON_I|
000021d0  53 54 45 58 54 20 7c 20  49 43 4f 4e 5f 49 53 46  |STEXT | ICON_ISF|
000021e0  49 4c 4c 45 44 3b 0a 09  70 6f 69 6e 74 65 72 2d  |ILLED;..pointer-|
000021f0  3e 6d 65 6e 75 5f 69 63  6f 6e 66 6c 61 67 73 20  |>menu_iconflags |
00002200  3d 20 69 63 6f 6e 5f 66  6c 61 67 73 3b 0a 09 72  |= icon_flags;..r|
00002210  65 74 75 72 6e 3b 0a 7d  0a 0a 76 6f 69 64 0a 61  |eturn;.}..void.a|
00002220  75 5f 63 72 65 61 74 65  6d 65 6e 75 28 6d 65 6e  |u_createmenu(men|
00002230  75 5f 64 61 74 61 20 2a  6d 65 6e 75 5f 64 61 74  |u_data *menu_dat|
00002240  29 0a 7b 0a 09 6d 65 6e  75 5f 65 6c 65 6d 65 6e  |).{..menu_elemen|
00002250  74 09 2a 70 6f 69 6e 74  65 72 3b 0a 09 69 6e 74  |t.*pointer;..int|
00002260  09 69 3b 0a 0a 09 2f 2a  20 41 73 73 69 67 6e 20  |.i;.../* Assign |
00002270  6d 65 6d 6f 72 79 20 2a  2f 0a 09 6d 65 6e 75 5f  |memory */..menu_|
00002280  64 61 74 2d 3e 64 61 74  61 62 6c 6f 63 6b 20 3d  |dat->datablock =|
00002290  20 63 61 6c 6c 6f 63 28  31 2c 20 6d 65 6e 75 5f  | calloc(1, menu_|
000022a0  64 61 74 2d 3e 73 69 7a  65 29 3b 0a 09 2f 2a 20  |dat->size);../* |
000022b0  42 65 67 69 6e 20 63 6f  70 79 69 6e 67 20 64 61  |Begin copying da|
000022c0  74 61 20 2a 2f 0a 09 73  74 72 63 70 79 28 28 63  |ta */..strcpy((c|
000022d0  68 61 72 20 2a 29 6d 65  6e 75 5f 64 61 74 2d 3e  |har *)menu_dat->|
000022e0  64 61 74 61 62 6c 6f 63  6b 2c 20 6d 65 6e 75 5f  |datablock, menu_|
000022f0  64 61 74 2d 3e 74 69 74  6c 65 29 3b 0a 09 61 75  |dat->title);..au|
00002300  5f 77 6f 72 64 74 6f 62  79 74 65 28 6d 65 6e 75  |_wordtobyte(menu|
00002310  5f 64 61 74 2d 3e 63 6f  6c 6f 75 72 73 2c 20 6d  |_dat->colours, m|
00002320  65 6e 75 5f 64 61 74 2d  3e 64 61 74 61 62 6c 6f  |enu_dat->datablo|
00002330  63 6b 2c 20 31 32 29 3b  0a 09 61 75 5f 77 6f 72  |ck, 12);..au_wor|
00002340  64 74 6f 62 79 74 65 28  6d 65 6e 75 5f 64 61 74  |dtobyte(menu_dat|
00002350  2d 3e 77 69 64 74 68 2c  20 6d 65 6e 75 5f 64 61  |->width, menu_da|
00002360  74 2d 3e 64 61 74 61 62  6c 6f 63 6b 2c 20 31 36  |t->datablock, 16|
00002370  29 3b 0a 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |);..au_wordtobyt|
00002380  65 28 6d 65 6e 75 5f 64  61 74 2d 3e 68 65 69 67  |e(menu_dat->heig|
00002390  68 74 2c 20 6d 65 6e 75  5f 64 61 74 2d 3e 64 61  |ht, menu_dat->da|
000023a0  74 61 62 6c 6f 63 6b 2c  20 32 30 29 3b 0a 09 61  |tablock, 20);..a|
000023b0  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 6d 65 6e  |u_wordtobyte(men|
000023c0  75 5f 64 61 74 2d 3e 76  65 72 74 5f 67 61 70 2c  |u_dat->vert_gap,|
000023d0  20 6d 65 6e 75 5f 64 61  74 2d 3e 64 61 74 61 62  | menu_dat->datab|
000023e0  6c 6f 63 6b 2c 20 32 34  29 3b 0a 09 2f 2a 20 65  |lock, 24);../* e|
000023f0  6e 64 20 6f 66 20 68 65  61 64 65 72 20 69 6e 66  |nd of header inf|
00002400  6f 20 2a 2f 0a 09 69 20  3d 20 32 38 3b 0a 0a 09  |o */..i = 28;...|
00002410  70 6f 69 6e 74 65 72 20  3d 20 6d 65 6e 75 5f 64  |pointer = menu_d|
00002420  61 74 2d 3e 6e 65 78 74  5f 6d 65 6e 75 65 6c 65  |at->next_menuele|
00002430  6d 3b 0a 0a 09 77 68 69  6c 65 28 70 6f 69 6e 74  |m;...while(point|
00002440  65 72 20 21 3d 20 4e 55  4c 4c 29 20 7b 0a 0a 09  |er != NULL) {...|
00002450  09 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 70  |.au_wordtobyte(p|
00002460  6f 69 6e 74 65 72 2d 3e  66 6c 61 67 73 2c 20 6d  |ointer->flags, m|
00002470  65 6e 75 5f 64 61 74 2d  3e 64 61 74 61 62 6c 6f  |enu_dat->datablo|
00002480  63 6b 2c 20 69 29 3b 0a  09 09 69 20 2b 3d 20 34  |ck, i);...i += 4|
00002490  3b 0a 09 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |;...au_wordtobyt|
000024a0  65 28 70 6f 69 6e 74 65  72 2d 3e 73 75 62 6d 65  |e(pointer->subme|
000024b0  6e 75 2c 20 6d 65 6e 75  5f 64 61 74 2d 3e 64 61  |nu, menu_dat->da|
000024c0  74 61 62 6c 6f 63 6b 2c  20 69 29 3b 0a 09 09 69  |tablock, i);...i|
000024d0  20 2b 3d 20 34 3b 0a 09  09 61 75 5f 77 6f 72 64  | += 4;...au_word|
000024e0  74 6f 62 79 74 65 28 70  6f 69 6e 74 65 72 2d 3e  |tobyte(pointer->|
000024f0  6d 65 6e 75 5f 69 63 6f  6e 66 6c 61 67 73 2c 20  |menu_iconflags, |
00002500  6d 65 6e 75 5f 64 61 74  2d 3e 64 61 74 61 62 6c  |menu_dat->databl|
00002510  6f 63 6b 2c 20 69 29 3b  0a 09 09 69 20 2b 3d 20  |ock, i);...i += |
00002520  34 3b 0a 09 09 73 74 72  63 70 79 28 28 63 68 61  |4;...strcpy((cha|
00002530  72 20 2a 29 20 26 6d 65  6e 75 5f 64 61 74 2d 3e  |r *) &menu_dat->|
00002540  64 61 74 61 62 6c 6f 63  6b 5b 69 5d 2c 20 70 6f  |datablock[i], po|
00002550  69 6e 74 65 72 2d 3e 6d  65 6e 75 5f 74 65 78 74  |inter->menu_text|
00002560  29 3b 0a 09 09 69 20 2b  3d 20 31 32 3b 0a 09 09  |);...i += 12;...|
00002570  70 6f 69 6e 74 65 72 20  3d 20 70 6f 69 6e 74 65  |pointer = pointe|
00002580  72 2d 3e 6e 65 78 74 5f  6d 65 6e 75 65 6c 65 6d  |r->next_menuelem|
00002590  3b 0a 09 7d 0a 09 72 65  74 75 72 6e 3b 0a 7d 0a  |;..}..return;.}.|
000025a0  0a 76 6f 69 64 0a 61 75  5f 6f 70 65 6e 6d 65 6e  |.void.au_openmen|
000025b0  75 28 6d 65 6e 75 5f 64  61 74 61 20 2a 6d 65 6e  |u(menu_data *men|
000025c0  75 5f 64 61 74 2c 20 69  6e 74 20 6d 6f 75 73 65  |u_dat, int mouse|
000025d0  5f 78 2c 20 69 6e 74 20  6d 6f 75 73 65 5f 79 29  |_x, int mouse_y)|
000025e0  0a 7b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 5f  |.{.._kernel_swi_|
000025f0  72 65 67 73 09 72 65 67  73 5f 69 6e 2c 20 72 65  |regs.regs_in, re|
00002600  67 73 5f 6f 75 74 3b 0a  0a 09 72 65 67 73 5f 69  |gs_out;...regs_i|
00002610  6e 2e 72 5b 31 5d 20 3d  20 28 69 6e 74 29 20 6d  |n.r[1] = (int) m|
00002620  65 6e 75 5f 64 61 74 2d  3e 64 61 74 61 62 6c 6f  |enu_dat->datablo|
00002630  63 6b 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 32  |ck;..regs_in.r[2|
00002640  5d 20 3d 20 6d 6f 75 73  65 5f 78 3b 0a 09 72 65  |] = mouse_x;..re|
00002650  67 73 5f 69 6e 2e 72 5b  33 5d 20 3d 20 6d 6f 75  |gs_in.r[3] = mou|
00002660  73 65 5f 79 3b 0a 09 5f  6b 65 72 6e 65 6c 5f 73  |se_y;.._kernel_s|
00002670  77 69 28 57 69 6d 70 5f  43 72 65 61 74 65 4d 65  |wi(Wimp_CreateMe|
00002680  6e 75 2c 20 26 72 65 67  73 5f 69 6e 2c 20 26 72  |nu, &regs_in, &r|
00002690  65 67 73 5f 6f 75 74 29  3b 0a 09 72 65 74 75 72  |egs_out);..retur|
000026a0  6e 3b 0a 7d 0a                                    |n;.}.|
000026a5
WimpC/!NewWimpC/c/AULib
00000000  2f 2a 20 41 63 6f 72 6e  20 55 73 65 72 20 6c 69  |/* Acorn User li|
00000010  62 72 61 72 79 20 66 6f  72 20 57 49 4d 50 20 70  |brary for WIMP p|
00000020  72 6f 67 72 61 6d 6d 69  6e 67 20 69 6e 20 43 20  |rogramming in C |
00000030  2a 2f 0a 2f 2a 20 42 79  20 53 74 65 76 65 20 4d  |*/./* By Steve M|
00000040  75 6d 66 6f 72 64 2c 20  31 34 74 68 20 41 70 72  |umford, 14th Apr|
00000050  69 6c 20 31 39 39 36 20  2a 2f 0a 0a 2f 2a 20 23  |il 1996 */../* #|
00000060  49 6e 63 6c 75 64 65 20  74 68 65 20 61 70 70 72  |Include the appr|
00000070  6f 70 72 69 61 74 65 20  66 69 6c 65 73 20 2d 20  |opriate files - |
00000080  41 55 4c 69 62 2e 68 20  63 6f 6e 74 61 69 6e 73  |AULib.h contains|
00000090  20 65 76 65 72 79 74 68  69 6e 67 20 77 65 20 6e  | everything we n|
000000a0  65 65 64 20 2a 2f 20 0a  0a 23 69 6e 63 6c 75 64  |eed */ ..#includ|
000000b0  65 20 22 41 55 6c 69 62  2e 68 22 0a 0a 69 6e 74  |e "AUlib.h"..int|
000000c0  0a 61 75 5f 69 6e 69 74  69 61 6c 69 73 65 28 69  |.au_initialise(i|
000000d0  6e 74 20 76 5f 6e 75 6d  62 65 72 2c 20 63 68 61  |nt v_number, cha|
000000e0  72 20 2a 61 70 70 6e 61  6d 65 2c 20 6c 6f 6e 67  |r *appname, long|
000000f0  20 69 6e 74 20 6d 73 67  6c 69 73 74 5b 5d 29 0a  | int msglist[]).|
00000100  7b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 5f 72  |{.._kernel_swi_r|
00000110  65 67 73 09 72 65 67 73  5f 69 6e 2c 20 72 65 67  |egs.regs_in, reg|
00000120  73 5f 6f 75 74 3b 0a 0a  09 72 65 67 73 5f 69 6e  |s_out;...regs_in|
00000130  2e 72 5b 30 5d 20 3d 20  76 5f 6e 75 6d 62 65 72  |.r[0] = v_number|
00000140  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 31 5d 20  |;..regs_in.r[1] |
00000150  3d 20 2a 28 69 6e 74 20  2a 29 22 54 41 53 4b 22  |= *(int *)"TASK"|
00000160  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 32 5d 20  |;..regs_in.r[2] |
00000170  3d 20 28 69 6e 74 29 20  61 70 70 6e 61 6d 65 3b  |= (int) appname;|
00000180  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 33 5d 20 3d  |..regs_in.r[3] =|
00000190  20 28 69 6e 74 29 20 6d  73 67 6c 69 73 74 3b 0a  | (int) msglist;.|
000001a0  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |.._kernel_swi(Wi|
000001b0  6d 70 5f 49 6e 69 74 69  61 6c 69 73 65 2c 20 26  |mp_Initialise, &|
000001c0  72 65 67 73 5f 69 6e 2c  20 26 72 65 67 73 5f 6f  |regs_in, &regs_o|
000001d0  75 74 29 3b 0a 09 72 65  74 75 72 6e 20 72 65 67  |ut);..return reg|
000001e0  73 5f 6f 75 74 2e 72 5b  31 5d 3b 20 2f 2a 20 74  |s_out.r[1]; /* t|
000001f0  68 69 73 20 69 73 20 74  68 65 20 74 61 73 6b 20  |his is the task |
00000200  68 61 6e 64 6c 65 2c 20  72 65 74 75 72 6e 65 64  |handle, returned|
00000210  20 66 6f 72 20 6c 61 74  65 72 20 75 73 65 20 2a  | for later use *|
00000220  2f 0a 7d 0a 0a 76 6f 69  64 0a 61 75 5f 63 6c 6f  |/.}..void.au_clo|
00000230  73 65 64 6f 77 6e 28 69  6e 74 20 74 61 73 6b 68  |sedown(int taskh|
00000240  61 6e 64 6c 65 29 0a 7b  0a 09 5f 6b 65 72 6e 65  |andle).{.._kerne|
00000250  6c 5f 73 77 69 5f 72 65  67 73 09 72 65 67 73 5f  |l_swi_regs.regs_|
00000260  69 6e 2c 20 72 65 67 73  5f 6f 75 74 3b 0a 0a 09  |in, regs_out;...|
00000270  72 65 67 73 5f 69 6e 2e  72 5b 30 5d 20 3d 20 74  |regs_in.r[0] = t|
00000280  61 73 6b 68 61 6e 64 6c  65 3b 0a 09 72 65 67 73  |askhandle;..regs|
00000290  5f 69 6e 2e 72 5b 31 5d  20 3d 20 2a 28 69 6e 74  |_in.r[1] = *(int|
000002a0  20 2a 29 22 54 41 53 4b  22 3b 0a 09 5f 6b 65 72  | *)"TASK";.._ker|
000002b0  6e 65 6c 5f 73 77 69 28  57 69 6d 70 5f 43 6c 6f  |nel_swi(Wimp_Clo|
000002c0  73 65 44 6f 77 6e 2c 20  26 72 65 67 73 5f 69 6e  |seDown, &regs_in|
000002d0  2c 20 26 72 65 67 73 5f  6f 75 74 29 3b 0a 7d 0a  |, &regs_out);.}.|
000002e0  0a 69 6e 74 0a 61 75 5f  63 72 65 61 74 65 5f 69  |.int.au_create_i|
000002f0  63 6f 6e 62 61 72 5f 69  63 6f 6e 28 69 6e 74 20  |conbar_icon(int |
00000300  70 72 69 6f 72 69 74 79  2c 20 75 6e 73 69 67 6e  |priority, unsign|
00000310  65 64 20 6c 6f 6e 67 20  69 6e 74 20 77 68 69 63  |ed long int whic|
00000320  68 73 69 64 65 2c 20 75  6e 73 69 67 6e 65 64 20  |hside, unsigned |
00000330  6c 6f 6e 67 20 69 6e 74  20 69 63 6f 6e 66 6c 61  |long int iconfla|
00000340  67 73 2c 20 63 68 61 72  20 2a 73 70 72 6e 61 6d  |gs, char *sprnam|
00000350  65 29 0a 7b 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |e).{.._kernel_sw|
00000360  69 5f 72 65 67 73 09 72  65 67 73 5f 69 6e 2c 20  |i_regs.regs_in, |
00000370  72 65 67 73 5f 6f 75 74  3b 0a 09 75 6e 73 69 67  |regs_out;..unsig|
00000380  6e 65 64 20 63 68 61 72  20 69 63 6f 6e 5f 62 6c  |ned char icon_bl|
00000390  6f 63 6b 5b 49 43 4f 4e  5f 42 4c 4f 43 4b 5f 53  |ock[ICON_BLOCK_S|
000003a0  49 5a 45 5d 3b 0a 09 2f  2a 20 57 65 20 6e 65 65  |IZE];../* We nee|
000003b0  64 20 74 6f 20 62 75 69  6c 64 20 75 70 20 61 6e  |d to build up an|
000003c0  20 69 63 6f 6e 20 69 6e  66 6f 72 6d 61 74 69 6f  | icon informatio|
000003d0  6e 20 64 61 74 61 62 6c  6f 63 6b 20 2a 2f 0a 09  |n datablock */..|
000003e0  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 77 68  |au_wordtobyte(wh|
000003f0  69 63 68 73 69 64 65 2c  20 69 63 6f 6e 5f 62 6c  |ichside, icon_bl|
00000400  6f 63 6b 2c 20 30 29 3b  0a 09 61 75 5f 77 6f 72  |ock, 0);..au_wor|
00000410  64 74 6f 62 79 74 65 28  49 42 41 52 5f 42 42 4f  |dtobyte(IBAR_BBO|
00000420  58 5f 4d 49 4e 58 2c 20  69 63 6f 6e 5f 62 6c 6f  |X_MINX, icon_blo|
00000430  63 6b 2c 20 34 29 3b 0a  09 61 75 5f 77 6f 72 64  |ck, 4);..au_word|
00000440  74 6f 62 79 74 65 28 49  42 41 52 5f 42 42 4f 58  |tobyte(IBAR_BBOX|
00000450  5f 4d 49 4e 59 2c 20 69  63 6f 6e 5f 62 6c 6f 63  |_MINY, icon_bloc|
00000460  6b 2c 20 38 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |k, 8);..au_wordt|
00000470  6f 62 79 74 65 28 49 42  41 52 5f 42 42 4f 58 5f  |obyte(IBAR_BBOX_|
00000480  4d 41 58 58 2c 20 69 63  6f 6e 5f 62 6c 6f 63 6b  |MAXX, icon_block|
00000490  2c 20 31 32 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |, 12);..au_wordt|
000004a0  6f 62 79 74 65 28 49 42  41 52 5f 42 42 4f 58 5f  |obyte(IBAR_BBOX_|
000004b0  4d 41 58 59 2c 20 69 63  6f 6e 5f 62 6c 6f 63 6b  |MAXY, icon_block|
000004c0  2c 20 31 36 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |, 16);..au_wordt|
000004d0  6f 62 79 74 65 28 69 63  6f 6e 66 6c 61 67 73 2c  |obyte(iconflags,|
000004e0  20 69 63 6f 6e 5f 62 6c  6f 63 6b 2c 20 32 30 29  | icon_block, 20)|
000004f0  3b 0a 0a 09 2f 2a 20 43  6f 70 79 20 74 68 65 20  |;.../* Copy the |
00000500  69 63 6f 6e 20 6e 61 6d  65 20 69 6e 74 6f 20 74  |icon name into t|
00000510  68 65 20 61 70 70 72 6f  70 72 69 61 74 65 20 70  |he appropriate p|
00000520  6c 61 63 65 20 2a 2f 0a  09 73 74 72 63 70 79 28  |lace */..strcpy(|
00000530  20 28 63 68 61 72 20 2a  29 20 26 69 63 6f 6e 5f  | (char *) &icon_|
00000540  62 6c 6f 63 6b 5b 32 34  5d 2c 20 73 70 72 6e 61  |block[24], sprna|
00000550  6d 65 29 3b 0a 09 72 65  67 73 5f 69 6e 2e 72 5b  |me);..regs_in.r[|
00000560  30 5d 20 3d 20 70 72 69  6f 72 69 74 79 3b 0a 09  |0] = priority;..|
00000570  72 65 67 73 5f 69 6e 2e  72 5b 31 5d 20 3d 20 28  |regs_in.r[1] = (|
00000580  69 6e 74 29 20 69 63 6f  6e 5f 62 6c 6f 63 6b 3b  |int) icon_block;|
00000590  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |.._kernel_swi(Wi|
000005a0  6d 70 5f 43 72 65 61 74  65 49 63 6f 6e 2c 20 26  |mp_CreateIcon, &|
000005b0  72 65 67 73 5f 69 6e 2c  20 26 72 65 67 73 5f 6f  |regs_in, &regs_o|
000005c0  75 74 29 3b 0a 09 72 65  74 75 72 6e 20 72 65 67  |ut);..return reg|
000005d0  73 5f 6f 75 74 2e 72 5b  30 5d 3b 20 2f 2a 20 52  |s_out.r[0]; /* R|
000005e0  65 74 75 72 6e 20 74 68  65 20 69 63 6f 6e 20 68  |eturn the icon h|
000005f0  61 6e 64 6c 65 20 2a 2f  0a 7d 0a 0a 76 6f 69 64  |andle */.}..void|
00000600  0a 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 75  |.au_wordtobyte(u|
00000610  6e 73 69 67 6e 65 64 20  6c 6f 6e 67 20 69 6e 74  |nsigned long int|
00000620  20 69 6e 70 75 74 2c 20  75 6e 73 69 67 6e 65 64  | input, unsigned|
00000630  20 63 68 61 72 20 62 6c  6f 63 6b 5b 5d 2c 20 69  | char block[], i|
00000640  6e 74 20 69 6e 64 65 78  29 0a 7b 0a 09 75 6e 73  |nt index).{..uns|
00000650  69 67 6e 65 64 20 6c 6f  6e 67 20 69 6e 74 20 6d  |igned long int m|
00000660  61 73 6b 20 3d 20 32 35  35 3b 0a 0a 09 2f 2a 20  |ask = 255;.../* |
00000670  54 68 65 20 6f 70 70 6f  73 69 74 65 20 6f 66 20  |The opposite of |
00000680  62 74 6f 77 28 29 20 2d  20 74 68 69 73 20 66 75  |btow() - this fu|
00000690  6e 63 74 69 6f 6e 20 74  61 6b 65 73 20 61 20 33  |nction takes a 3|
000006a0  32 2d 62 69 74 20 69 6e  74 65 67 65 72 2c 20 73  |2-bit integer, s|
000006b0  70 6c 69 74 73 0a 09 20  2a 20 69 74 20 75 70 20  |plits.. * it up |
000006c0  69 6e 74 6f 20 34 20 62  79 74 65 73 2c 20 61 6e  |into 4 bytes, an|
000006d0  64 20 73 74 6f 72 65 73  20 74 68 6f 73 65 20 69  |d stores those i|
000006e0  6e 20 34 20 63 6f 6e 73  65 63 75 74 69 76 65 20  |n 4 consecutive |
000006f0  63 65 6c 6c 73 20 6f 66  20 61 0a 09 20 2a 20 63  |cells of a.. * c|
00000700  68 61 72 61 63 74 65 72  20 61 72 72 61 79 20 69  |haracter array i|
00000710  6e 64 65 78 65 64 20 62  79 20 69 6e 64 65 78 2e  |ndexed by index.|
00000720  20 54 68 69 73 20 69 73  20 64 6f 6e 65 20 62 79  | This is done by|
00000730  20 75 73 69 6e 67 20 61  20 6d 61 73 6b 20 74 6f  | using a mask to|
00000740  0a 09 20 2a 20 65 78 74  72 61 63 74 20 74 68 65  |.. * extract the|
00000750  20 64 61 74 61 20 69 6e  20 73 65 71 75 65 6e 63  | data in sequenc|
00000760  65 2c 20 77 69 74 68 20  74 68 65 20 26 20 62 69  |e, with the & bi|
00000770  74 77 69 73 65 2d 61 6e  64 20 6f 70 65 72 61 74  |twise-and operat|
00000780  6f 72 20 2a 2f 0a 0a 09  62 6c 6f 63 6b 5b 69 6e  |or */...block[in|
00000790  64 65 78 2b 2b 5d 20 3d  20 28 63 68 61 72 29 20  |dex++] = (char) |
000007a0  28 69 6e 70 75 74 20 26  20 6d 61 73 6b 29 3b 20  |(input & mask); |
000007b0  0a 09 2f 2a 20 73 68 69  66 74 20 6d 61 73 6b 20  |../* shift mask |
000007c0  74 6f 20 67 65 74 20 73  65 63 6f 6e 64 20 62 79  |to get second by|
000007d0  74 65 2c 20 61 6e 64 20  73 75 70 70 6c 79 20 72  |te, and supply r|
000007e0  65 73 75 6c 74 20 61 73  20 62 79 74 65 20 73 69  |esult as byte si|
000007f0  7a 65 20 2a 2f 0a 09 6d  61 73 6b 20 3c 3c 3d 20  |ze */..mask <<= |
00000800  38 3b 0a 09 62 6c 6f 63  6b 5b 69 6e 64 65 78 2b  |8;..block[index+|
00000810  2b 5d 20 3d 20 28 63 68  61 72 29 20 28 28 69 6e  |+] = (char) ((in|
00000820  70 75 74 20 26 20 6d 61  73 6b 29 20 3e 3e 20 38  |put & mask) >> 8|
00000830  29 3b 0a 09 6d 61 73 6b  20 3c 3c 3d 20 38 3b 0a  |);..mask <<= 8;.|
00000840  09 62 6c 6f 63 6b 5b 69  6e 64 65 78 2b 2b 5d 20  |.block[index++] |
00000850  3d 20 28 63 68 61 72 29  20 28 28 69 6e 70 75 74  |= (char) ((input|
00000860  20 26 20 6d 61 73 6b 29  20 3e 3e 20 31 36 29 3b  | & mask) >> 16);|
00000870  0a 09 6d 61 73 6b 20 3c  3c 3d 20 38 3b 0a 09 62  |..mask <<= 8;..b|
00000880  6c 6f 63 6b 5b 69 6e 64  65 78 2b 2b 5d 20 3d 20  |lock[index++] = |
00000890  28 63 68 61 72 29 20 28  28 69 6e 70 75 74 20 26  |(char) ((input &|
000008a0  20 6d 61 73 6b 29 20 3e  3e 20 32 34 29 3b 0a 0a  | mask) >> 24);..|
000008b0  09 72 65 74 75 72 6e 3b  0a 7d 0a 0a 75 6e 73 69  |.return;.}..unsi|
000008c0  67 6e 65 64 20 6c 6f 6e  67 20 69 6e 74 0a 61 75  |gned long int.au|
000008d0  5f 62 79 74 65 74 6f 77  6f 72 64 28 75 6e 73 69  |_bytetoword(unsi|
000008e0  67 6e 65 64 20 63 68 61  72 20 62 6c 6f 63 6b 5b  |gned char block[|
000008f0  5d 2c 20 69 6e 74 20 69  6e 64 65 78 29 0a 7b 0a  |], int index).{.|
00000900  09 75 6e 73 69 67 6e 65  64 20 6c 6f 6e 67 20 69  |.unsigned long i|
00000910  6e 74 20 72 65 73 75 6c  74 20 3d 20 30 3b 0a 09  |nt result = 0;..|
00000920  69 6e 74 20 6c 6f 6f 70  3b 0a 0a 09 2f 2a 20 54  |int loop;.../* T|
00000930  68 69 73 20 72 6f 75 74  69 6e 65 20 74 61 6b 65  |his routine take|
00000940  73 20 61 20 64 61 74 61  20 62 6c 6f 63 6b 20 61  |s a data block a|
00000950  6e 64 20 61 20 73 74 61  72 74 69 6e 67 20 62 79  |nd a starting by|
00000960  74 65 2c 20 61 6e 64 20  63 6f 6e 76 65 72 74 73  |te, and converts|
00000970  20 74 68 65 0a 09 20 2a  20 6e 65 78 74 20 66 6f  | the.. * next fo|
00000980  75 72 20 62 79 74 65 73  20 69 6e 74 6f 20 61 20  |ur bytes into a |
00000990  77 6f 72 64 20 2d 20 77  65 20 68 61 76 65 20 74  |word - we have t|
000009a0  6f 20 73 74 61 72 74 20  61 74 20 74 68 65 20 6d  |o start at the m|
000009b0  6f 73 74 20 73 69 67 6e  69 66 69 63 61 6e 74 0a  |ost significant.|
000009c0  09 20 2a 20 62 79 74 65  20 61 6e 64 20 77 6f 72  |. * byte and wor|
000009d0  6b 20 62 61 63 6b 77 61  72 64 73 20 2a 2f 0a 0a  |k backwards */..|
000009e0  09 69 6e 64 65 78 20 2b  3d 20 33 3b 0a 09 72 65  |.index += 3;..re|
000009f0  73 75 6c 74 20 3d 20 62  6c 6f 63 6b 5b 69 6e 64  |sult = block[ind|
00000a00  65 78 2d 2d 5d 3b 0a 09  66 6f 72 28 6c 6f 6f 70  |ex--];..for(loop|
00000a10  20 3d 20 30 3b 20 6c 6f  6f 70 20 3c 20 33 3b 20  | = 0; loop < 3; |
00000a20  6c 6f 6f 70 2b 2b 29 20  7b 0a 09 09 72 65 73 75  |loop++) {...resu|
00000a30  6c 74 20 3d 20 72 65 73  75 6c 74 20 3c 3c 20 38  |lt = result << 8|
00000a40  3b 20 2f 2a 20 74 68 69  73 20 73 68 69 66 74 73  |; /* this shifts|
00000a50  20 62 69 74 73 20 69 6e  20 72 65 73 75 6c 74 20  | bits in result |
00000a60  6c 65 66 74 20 62 79 20  38 20 73 70 61 63 65 73  |left by 8 spaces|
00000a70  20 2a 2f 0a 09 09 72 65  73 75 6c 74 20 2b 3d 20  | */...result += |
00000a80  62 6c 6f 63 6b 5b 69 6e  64 65 78 2d 2d 5d 3b 0a  |block[index--];.|
00000a90  09 7d 0a 0a 09 72 65 74  75 72 6e 20 72 65 73 75  |.}...return resu|
00000aa0  6c 74 3b 0a 7d 0a 0a 76  6f 69 64 0a 61 75 5f 6f  |lt;.}..void.au_o|
00000ab0  70 65 6e 74 65 6d 70 6c  61 74 65 28 63 68 61 72  |pentemplate(char|
00000ac0  20 2a 66 69 6c 65 6e 61  6d 65 29 0a 7b 0a 09 5f  | *filename).{.._|
00000ad0  6b 65 72 6e 65 6c 5f 73  77 69 5f 72 65 67 73 09  |kernel_swi_regs.|
00000ae0  72 65 67 73 5f 69 6e 2c  20 72 65 67 73 5f 6f 75  |regs_in, regs_ou|
00000af0  74 3b 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 31 5d  |t;..regs_in.r[1]|
00000b00  20 3d 20 28 69 6e 74 29  20 66 69 6c 65 6e 61 6d  | = (int) filenam|
00000b10  65 3b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |e;.._kernel_swi(|
00000b20  57 69 6d 70 5f 4f 70 65  6e 54 65 6d 70 6c 61 74  |Wimp_OpenTemplat|
00000b30  65 2c 20 26 72 65 67 73  5f 69 6e 2c 20 26 72 65  |e, &regs_in, &re|
00000b40  67 73 5f 6f 75 74 29 3b  0a 7d 0a 0a 76 6f 69 64  |gs_out);.}..void|
00000b50  0a 61 75 5f 63 6c 6f 73  65 74 65 6d 70 6c 61 74  |.au_closetemplat|
00000b60  65 28 76 6f 69 64 29 0a  7b 0a 09 5f 6b 65 72 6e  |e(void).{.._kern|
00000b70  65 6c 5f 73 77 69 5f 72  65 67 73 09 72 65 67 73  |el_swi_regs.regs|
00000b80  5f 69 6e 2c 20 72 65 67  73 5f 6f 75 74 3b 0a 09  |_in, regs_out;..|
00000b90  2f 2a 20 4e 6f 20 64 61  74 61 20 6e 65 65 64 65  |/* No data neede|
00000ba0  64 20 66 6f 72 20 43 6c  6f 73 65 54 65 6d 70 6c  |d for CloseTempl|
00000bb0  61 74 65 20 2a 2f 0a 09  5f 6b 65 72 6e 65 6c 5f  |ate */.._kernel_|
00000bc0  73 77 69 28 57 69 6d 70  5f 43 6c 6f 73 65 54 65  |swi(Wimp_CloseTe|
00000bd0  6d 70 6c 61 74 65 2c 20  26 72 65 67 73 5f 69 6e  |mplate, &regs_in|
00000be0  2c 20 26 72 65 67 73 5f  6f 75 74 29 3b 0a 7d 0a  |, &regs_out);.}.|
00000bf0  0a 69 6e 74 0a 61 75 5f  6c 6f 61 64 74 65 6d 70  |.int.au_loadtemp|
00000c00  6c 61 74 65 28 63 68 61  72 20 2a 74 65 6d 70 6c  |late(char *templ|
00000c10  61 74 65 5f 6e 61 6d 65  2c 20 77 69 6e 64 6f 77  |ate_name, window|
00000c20  5f 64 61 74 61 20 2a 77  69 6e 5f 64 61 74 61 2c  |_data *win_data,|
00000c30  20 69 6e 74 20 63 61 6c  6c 29 0a 7b 0a 09 5f 6b  | int call).{.._k|
00000c40  65 72 6e 65 6c 5f 73 77  69 5f 72 65 67 73 09 72  |ernel_swi_regs.r|
00000c50  65 67 73 5f 69 6e 2c 20  72 65 67 73 5f 6f 75 74  |egs_in, regs_out|
00000c60  3b 0a 09 69 6e 74 09 77  6f 72 6b 73 70 61 63 65  |;..int.workspace|
00000c70  5f 6c 65 6e 67 74 68 20  3d 20 30 3b 0a 09 69 6e  |_length = 0;..in|
00000c80  74 09 6e 65 78 74 5f 65  6e 74 72 79 3b 0a 0a 09  |t.next_entry;...|
00000c90  2f 2a 20 69 6e 74 65 72  72 6f 67 61 74 65 20 66  |/* interrogate f|
00000ca0  69 6c 65 20 74 6f 20 66  69 6e 64 20 6f 75 74 20  |ile to find out |
00000cb0  68 6f 77 20 6d 75 63 68  20 73 70 61 63 65 20 77  |how much space w|
00000cc0  65 20 6e 65 65 64 20 2a  2f 0a 09 72 65 67 73 5f  |e need */..regs_|
00000cd0  69 6e 2e 72 5b 31 5d 20  3d 20 30 3b 20 2f 2a 20  |in.r[1] = 0; /* |
00000ce0  74 65 6c 6c 20 53 57 49  20 74 6f 20 66 69 6e 64  |tell SWI to find|
00000cf0  20 73 69 7a 65 73 20 2a  2f 0a 09 72 65 67 73 5f  | sizes */..regs_|
00000d00  69 6e 2e 72 5b 35 5d 20  3d 20 28 69 6e 74 29 20  |in.r[5] = (int) |
00000d10  74 65 6d 70 6c 61 74 65  5f 6e 61 6d 65 3b 20 2f  |template_name; /|
00000d20  2a 20 70 61 73 73 20 6e  61 6d 65 20 74 6f 20 53  |* pass name to S|
00000d30  57 49 20 2a 2f 0a 09 72  65 67 73 5f 69 6e 2e 72  |WI */..regs_in.r|
00000d40  5b 36 5d 20 3d 20 63 61  6c 6c 3b 20 2f 2a 20 30  |[6] = call; /* 0|
00000d50  20 66 6f 72 20 66 69 72  73 74 20 63 61 6c 6c 20  | for first call |
00000d60  2a 2f 0a 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |*/..._kernel_swi|
00000d70  28 57 69 6d 70 5f 4c 6f  61 64 54 65 6d 70 6c 61  |(Wimp_LoadTempla|
00000d80  74 65 2c 20 26 72 65 67  73 5f 69 6e 2c 20 26 72  |te, &regs_in, &r|
00000d90  65 67 73 5f 6f 75 74 29  3b 0a 09 77 69 6e 5f 64  |egs_out);..win_d|
00000da0  61 74 61 2d 3e 62 75 66  66 65 72 20 3d 20 63 61  |ata->buffer = ca|
00000db0  6c 6c 6f 63 28 72 65 67  73 5f 6f 75 74 2e 72 5b  |lloc(regs_out.r[|
00000dc0  31 5d 2c 20 73 69 7a 65  6f 66 28 75 6e 73 69 67  |1], sizeof(unsig|
00000dd0  6e 65 64 20 63 68 61 72  29 29 3b 0a 09 77 6f 72  |ned char));..wor|
00000de0  6b 73 70 61 63 65 5f 6c  65 6e 67 74 68 20 3d 20  |kspace_length = |
00000df0  72 65 67 73 5f 6f 75 74  2e 72 5b 32 5d 3b 20 2f  |regs_out.r[2]; /|
00000e00  2a 20 65 72 72 20 6f 6e  20 73 69 64 65 20 6f 66  |* err on side of|
00000e10  20 63 61 75 74 69 6f 6e  20 2a 2f 0a 09 77 69 6e  | caution */..win|
00000e20  5f 64 61 74 61 2d 3e 77  6f 72 6b 73 70 61 63 65  |_data->workspace|
00000e30  20 3d 20 63 61 6c 6c 6f  63 28 77 6f 72 6b 73 70  | = calloc(worksp|
00000e40  61 63 65 5f 6c 65 6e 67  74 68 2c 20 73 69 7a 65  |ace_length, size|
00000e50  6f 66 28 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |of(unsigned char|
00000e60  29 29 3b 0a 09 77 69 6e  5f 64 61 74 61 2d 3e 77  |));..win_data->w|
00000e70  69 6e 5f 6e 61 6d 65 20  3d 20 63 61 6c 6c 6f 63  |in_name = calloc|
00000e80  28 73 74 72 6c 65 6e 28  20 28 63 68 61 72 20 2a  |(strlen( (char *|
00000e90  29 20 72 65 67 73 5f 6f  75 74 2e 72 5b 35 5d 29  |) regs_out.r[5])|
00000ea0  2c 20 73 69 7a 65 6f 66  28 63 68 61 72 29 29 3b  |, sizeof(char));|
00000eb0  0a 09 73 74 72 63 70 79  28 77 69 6e 5f 64 61 74  |..strcpy(win_dat|
00000ec0  61 2d 3e 77 69 6e 5f 6e  61 6d 65 2c 20 28 63 68  |a->win_name, (ch|
00000ed0  61 72 20 2a 29 20 72 65  67 73 5f 6f 75 74 2e 72  |ar *) regs_out.r|
00000ee0  5b 35 5d 29 3b 0a 0a 09  2f 2a 20 4e 6f 77 20 72  |[5]);.../* Now r|
00000ef0  65 6c 6f 61 64 20 74 65  6d 70 6c 61 74 65 20 66  |eload template f|
00000f00  72 6f 6d 20 66 69 6c 65  20 69 6e 74 6f 20 6d 65  |rom file into me|
00000f10  6d 6f 72 79 20 2a 2f 0a  09 72 65 67 73 5f 69 6e  |mory */..regs_in|
00000f20  2e 72 5b 31 5d 20 3d 20  28 69 6e 74 29 20 77 69  |.r[1] = (int) wi|
00000f30  6e 5f 64 61 74 61 2d 3e  62 75 66 66 65 72 3b 0a  |n_data->buffer;.|
00000f40  09 72 65 67 73 5f 69 6e  2e 72 5b 32 5d 20 3d 20  |.regs_in.r[2] = |
00000f50  28 69 6e 74 29 20 77 69  6e 5f 64 61 74 61 2d 3e  |(int) win_data->|
00000f60  77 6f 72 6b 73 70 61 63  65 3b 0a 09 72 65 67 73  |workspace;..regs|
00000f70  5f 69 6e 2e 72 5b 33 5d  20 3d 20 28 69 6e 74 29  |_in.r[3] = (int)|
00000f80  20 77 69 6e 5f 64 61 74  61 2d 3e 77 6f 72 6b 73  | win_data->works|
00000f90  70 61 63 65 20 2b 20 77  6f 72 6b 73 70 61 63 65  |pace + workspace|
00000fa0  5f 6c 65 6e 67 74 68 3b  0a 09 72 65 67 73 5f 69  |_length;..regs_i|
00000fb0  6e 2e 72 5b 34 5d 20 3d  20 2d 31 3b 20 2f 2a 20  |n.r[4] = -1; /* |
00000fc0  4e 4f 20 46 4f 4e 54 53  20 43 41 54 45 52 45 44  |NO FONTS CATERED|
00000fd0  20 46 4f 52 20 49 4e 20  54 45 4d 50 4c 41 54 45  | FOR IN TEMPLATE|
00000fe0  53 20 59 45 54 20 2a 2f  0a 09 72 65 67 73 5f 69  |S YET */..regs_i|
00000ff0  6e 2e 72 5b 35 5d 20 3d  20 28 69 6e 74 29 20 77  |n.r[5] = (int) w|
00001000  69 6e 5f 64 61 74 61 2d  3e 77 69 6e 5f 6e 61 6d  |in_data->win_nam|
00001010  65 3b 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 36 5d  |e;..regs_in.r[6]|
00001020  20 3d 20 63 61 6c 6c 3b  0a 0a 09 5f 6b 65 72 6e  | = call;..._kern|
00001030  65 6c 5f 73 77 69 28 57  69 6d 70 5f 4c 6f 61 64  |el_swi(Wimp_Load|
00001040  54 65 6d 70 6c 61 74 65  2c 20 26 72 65 67 73 5f  |Template, &regs_|
00001050  69 6e 2c 20 26 72 65 67  73 5f 6f 75 74 29 3b 0a  |in, &regs_out);.|
00001060  09 6e 65 78 74 5f 65 6e  74 72 79 20 3d 20 72 65  |.next_entry = re|
00001070  67 73 5f 6f 75 74 2e 72  5b 36 5d 3b 0a 0a 09 2f  |gs_out.r[6];.../|
00001080  2a 20 43 72 65 61 74 65  20 74 68 65 20 77 69 6e  |* Create the win|
00001090  64 6f 77 2c 20 73 74 6f  72 65 20 77 69 6e 64 6f  |dow, store windo|
000010a0  77 20 68 61 6e 64 6c 65  20 2a 2f 0a 09 72 65 67  |w handle */..reg|
000010b0  73 5f 69 6e 2e 72 5b 31  5d 20 3d 20 28 69 6e 74  |s_in.r[1] = (int|
000010c0  29 20 77 69 6e 5f 64 61  74 61 2d 3e 62 75 66 66  |) win_data->buff|
000010d0  65 72 3b 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |er;.._kernel_swi|
000010e0  28 57 69 6d 70 5f 43 72  65 61 74 65 57 69 6e 64  |(Wimp_CreateWind|
000010f0  6f 77 2c 20 26 72 65 67  73 5f 69 6e 2c 20 26 72  |ow, &regs_in, &r|
00001100  65 67 73 5f 6f 75 74 29  3b 0a 09 77 69 6e 5f 64  |egs_out);..win_d|
00001110  61 74 61 2d 3e 77 69 6e  5f 68 61 6e 64 6c 65 20  |ata->win_handle |
00001120  3d 20 72 65 67 73 5f 6f  75 74 2e 72 5b 30 5d 3b  |= regs_out.r[0];|
00001130  0a 09 72 65 74 75 72 6e  20 6e 65 78 74 5f 65 6e  |..return next_en|
00001140  74 72 79 3b 20 2f 2a 20  69 6e 20 63 61 73 65 20  |try; /* in case |
00001150  6f 66 20 77 69 6c 64 63  61 72 64 65 64 20 73 65  |of wildcarded se|
00001160  61 72 63 68 65 73 20 2a  2f 0a 7d 0a 0a 69 6e 74  |arches */.}..int|
00001170  0a 61 75 5f 72 65 70 6f  72 74 5f 65 72 72 6f 72  |.au_report_error|
00001180  28 69 6e 74 20 65 72 72  6e 6f 2c 20 63 68 61 72  |(int errno, char|
00001190  20 2a 65 72 72 6d 65 73  73 2c 20 69 6e 74 20 66  | *errmess, int f|
000011a0  6c 61 67 73 2c 20 63 68  61 72 20 2a 61 70 70 5f  |lags, char *app_|
000011b0  6e 61 6d 65 29 0a 7b 0a  20 20 20 75 6e 73 69 67  |name).{.   unsig|
000011c0  6e 65 64 20 63 68 61 72  20 65 72 72 6f 72 62 6c  |ned char errorbl|
000011d0  6f 63 6b 5b 32 36 30 5d  3b 0a 20 20 20 5f 6b 65  |ock[260];.   _ke|
000011e0  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 20 69 6e  |rnel_swi_regs in|
000011f0  2c 20 6f 75 74 3b 0a 0a  20 20 20 2f 2a 20 53 65  |, out;..   /* Se|
00001200  74 20 75 70 20 74 68 65  20 73 74 61 6e 64 61 72  |t up the standar|
00001210  64 20 65 72 72 6f 72 20  62 6c 6f 63 6b 20 77 69  |d error block wi|
00001220  74 68 20 74 68 65 20 65  72 72 6f 72 20 6e 75 6d  |th the error num|
00001230  62 65 72 20 61 6e 64 20  6d 65 73 73 61 67 65 0a  |ber and message.|
00001240  20 20 20 20 20 20 28 7a  65 72 6f 20 74 65 72 6d  |      (zero term|
00001250  69 6e 61 74 65 64 29 20  2a 2f 0a 20 20 20 61 75  |inated) */.   au|
00001260  5f 77 6f 72 64 74 6f 62  79 74 65 28 65 72 72 6e  |_wordtobyte(errn|
00001270  6f 2c 20 65 72 72 6f 72  62 6c 6f 63 6b 2c 20 30  |o, errorblock, 0|
00001280  29 3b 0a 20 20 20 73 74  72 63 70 79 28 20 28 63  |);.   strcpy( (c|
00001290  68 61 72 20 2a 29 20 26  65 72 72 6f 72 62 6c 6f  |har *) &errorblo|
000012a0  63 6b 5b 34 5d 2c 20 65  72 72 6d 65 73 73 29 3b  |ck[4], errmess);|
000012b0  0a 0a 20 20 20 2f 2a 20  52 30 20 2d 20 70 6f 69  |..   /* R0 - poi|
000012c0  6e 74 65 72 20 74 6f 20  73 74 61 6e 64 61 72 64  |nter to standard|
000012d0  20 65 72 72 6f 72 20 62  6c 6f 63 6b 0a 20 20 20  | error block.   |
000012e0  20 20 20 52 31 20 2d 20  65 72 72 6f 72 20 77 69  |   R1 - error wi|
000012f0  6e 64 6f 77 20 66 6c 61  67 73 0a 20 20 20 20 20  |ndow flags.     |
00001300  20 52 32 20 2d 20 70 6f  69 6e 74 65 72 20 74 6f  | R2 - pointer to|
00001310  20 61 70 70 6c 69 63 61  74 69 6f 6e 20 6e 61 6d  | application nam|
00001320  65 20 66 6f 72 20 65 72  72 6f 72 20 62 6f 78 20  |e for error box |
00001330  74 69 74 6c 65 20 2a 2f  0a 0a 20 20 20 69 6e 2e  |title */..   in.|
00001340  72 5b 30 5d 20 3d 20 28  69 6e 74 29 20 65 72 72  |r[0] = (int) err|
00001350  6f 72 62 6c 6f 63 6b 3b  0a 20 20 20 69 6e 2e 72  |orblock;.   in.r|
00001360  5b 31 5d 20 3d 20 66 6c  61 67 73 3b 0a 20 20 20  |[1] = flags;.   |
00001370  69 6e 2e 72 5b 32 5d 20  3d 20 28 69 6e 74 29 20  |in.r[2] = (int) |
00001380  61 70 70 5f 6e 61 6d 65  3b 0a 0a 20 20 20 5f 6b  |app_name;..   _k|
00001390  65 72 6e 65 6c 5f 73 77  69 28 57 69 6d 70 5f 52  |ernel_swi(Wimp_R|
000013a0  65 70 6f 72 74 45 72 72  6f 72 2c 20 26 69 6e 2c  |eportError, &in,|
000013b0  20 26 6f 75 74 29 3b 0a  0a 20 20 20 2f 2a 20 52  | &out);..   /* R|
000013c0  65 74 75 72 6e 73 20 31  20 69 66 20 4f 4b 20 73  |eturns 1 if OK s|
000013d0  65 6c 65 63 74 65 64 2c  20 32 20 69 66 20 43 61  |elected, 2 if Ca|
000013e0  6e 63 65 6c 20 73 65 6c  65 63 74 65 64 20 2a 2f  |ncel selected */|
000013f0  0a 20 20 20 72 65 74 75  72 6e 20 6f 75 74 2e 72  |.   return out.r|
00001400  5b 31 5d 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |[1];.}..void.au_|
00001410  6f 70 65 6e 77 69 6e 5f  66 72 6f 6d 5f 74 65 6d  |openwin_from_tem|
00001420  70 6c 61 74 65 64 61 74  61 28 77 69 6e 64 6f 77  |platedata(window|
00001430  5f 64 61 74 61 20 2a 77  69 6e 5f 64 61 74 61 2c  |_data *win_data,|
00001440  20 6c 6f 6e 67 20 69 6e  74 20 70 6f 73 69 74 69  | long int positi|
00001450  6f 6e 29 0a 7b 0a 09 5f  6b 65 72 6e 65 6c 5f 73  |on).{.._kernel_s|
00001460  77 69 5f 72 65 67 73 09  72 65 67 73 5f 69 6e 2c  |wi_regs.regs_in,|
00001470  20 72 65 67 73 5f 6f 75  74 3b 0a 09 75 6e 73 69  | regs_out;..unsi|
00001480  67 6e 65 64 20 63 68 61  72 09 6f 70 65 6e 77 69  |gned char.openwi|
00001490  6e 64 6f 77 5f 62 75 66  66 65 72 5b 33 36 5d 3b  |ndow_buffer[36];|
000014a0  0a 09 69 6e 74 09 69 3b  0a 0a 09 61 75 5f 77 6f  |..int.i;...au_wo|
000014b0  72 64 74 6f 62 79 74 65  28 20 28 75 6e 73 69 67  |rdtobyte( (unsig|
000014c0  6e 65 64 20 6c 6f 6e 67  20 69 6e 74 29 20 77 69  |ned long int) wi|
000014d0  6e 5f 64 61 74 61 2d 3e  77 69 6e 5f 68 61 6e 64  |n_data->win_hand|
000014e0  6c 65 2c 20 6f 70 65 6e  77 69 6e 64 6f 77 5f 62  |le, openwindow_b|
000014f0  75 66 66 65 72 2c 20 30  29 3b 0a 09 66 6f 72 28  |uffer, 0);..for(|
00001500  69 20 3d 20 30 3b 20 69  20 3c 20 36 3b 20 69 2b  |i = 0; i < 6; i+|
00001510  2b 29 20 7b 0a 09 09 61  75 5f 77 6f 72 64 74 6f  |+) {...au_wordto|
00001520  62 79 74 65 28 61 75 5f  62 79 74 65 74 6f 77 6f  |byte(au_bytetowo|
00001530  72 64 28 77 69 6e 5f 64  61 74 61 2d 3e 62 75 66  |rd(win_data->buf|
00001540  66 65 72 2c 20 69 2a 34  29 2c 20 6f 70 65 6e 77  |fer, i*4), openw|
00001550  69 6e 64 6f 77 5f 62 75  66 66 65 72 2c 20 28 69  |indow_buffer, (i|
00001560  2b 31 29 20 2a 20 34 29  3b 0a 09 7d 0a 09 61 75  |+1) * 4);..}..au|
00001570  5f 77 6f 72 64 74 6f 62  79 74 65 28 70 6f 73 69  |_wordtobyte(posi|
00001580  74 69 6f 6e 2c 20 6f 70  65 6e 77 69 6e 64 6f 77  |tion, openwindow|
00001590  5f 62 75 66 66 65 72 2c  20 32 38 29 3b 0a 09 72  |_buffer, 28);..r|
000015a0  65 67 73 5f 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |egs_in.r[1] = (i|
000015b0  6e 74 29 20 6f 70 65 6e  77 69 6e 64 6f 77 5f 62  |nt) openwindow_b|
000015c0  75 66 66 65 72 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  |uffer;.._kernel_|
000015d0  73 77 69 28 57 69 6d 70  5f 4f 70 65 6e 57 69 6e  |swi(Wimp_OpenWin|
000015e0  64 6f 77 2c 20 26 72 65  67 73 5f 69 6e 2c 20 26  |dow, &regs_in, &|
000015f0  72 65 67 73 5f 6f 75 74  29 3b 0a 09 72 65 74 75  |regs_out);..retu|
00001600  72 6e 3b 0a 7d 0a 0a 69  6e 74 0a 61 75 5f 77 69  |rn;.}..int.au_wi|
00001610  6d 70 5f 70 6f 6c 6c 28  69 6e 74 20 70 6f 6c 6c  |mp_poll(int poll|
00001620  6d 61 73 6b 2c 20 75 6e  73 69 67 6e 65 64 20 63  |mask, unsigned c|
00001630  68 61 72 20 2a 70 6f 6c  6c 62 6c 6f 63 6b 29 0a  |har *pollblock).|
00001640  7b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 5f 72  |{.._kernel_swi_r|
00001650  65 67 73 09 72 65 67 73  5f 69 6e 2c 20 72 65 67  |egs.regs_in, reg|
00001660  73 5f 6f 75 74 3b 0a 0a  09 72 65 67 73 5f 69 6e  |s_out;...regs_in|
00001670  2e 72 5b 30 5d 20 3d 20  70 6f 6c 6c 6d 61 73 6b  |.r[0] = pollmask|
00001680  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 31 5d 20  |;..regs_in.r[1] |
00001690  3d 20 28 69 6e 74 29 20  70 6f 6c 6c 62 6c 6f 63  |= (int) pollbloc|
000016a0  6b 3b 0a 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |k;..._kernel_swi|
000016b0  28 57 69 6d 70 5f 50 6f  6c 6c 2c 20 26 72 65 67  |(Wimp_Poll, &reg|
000016c0  73 5f 69 6e 2c 20 26 72  65 67 73 5f 6f 75 74 29  |s_in, &regs_out)|
000016d0  3b 0a 09 72 65 74 75 72  6e 20 72 65 67 73 5f 6f  |;..return regs_o|
000016e0  75 74 2e 72 5b 30 5d 3b  20 2f 2a 20 52 65 74 75  |ut.r[0]; /* Retu|
000016f0  72 6e 20 74 68 65 20 65  76 65 6e 74 20 63 6f 64  |rn the event cod|
00001700  65 20 2a 2f 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |e */.}..void.au_|
00001710  69 63 6f 6e 5f 74 65 78  74 5f 63 68 61 6e 67 65  |icon_text_change|
00001720  28 63 68 61 72 20 2a 74  65 78 74 2c 20 75 6e 73  |(char *text, uns|
00001730  69 67 6e 65 64 20 6c 6f  6e 67 20 69 6e 74 20 77  |igned long int w|
00001740  69 6e 5f 68 2c 20 75 6e  73 69 67 6e 65 64 20 6c  |in_h, unsigned l|
00001750  6f 6e 67 20 69 6e 74 20  69 63 6f 6e 5f 68 29 0a  |ong int icon_h).|
00001760  7b 0a 20 20 20 5f 6b 65  72 6e 65 6c 5f 73 77 69  |{.   _kernel_swi|
00001770  5f 72 65 67 73 20 72 65  67 73 5f 69 6e 2c 20 72  |_regs regs_in, r|
00001780  65 67 73 5f 6f 75 74 3b  0a 20 20 20 63 68 61 72  |egs_out;.   char|
00001790  20 2a 74 65 78 74 5f 70  6f 69 6e 74 65 72 3b 0a  | *text_pointer;.|
000017a0  20 20 20 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |   unsigned char|
000017b0  20 74 65 6d 70 5f 62 75  66 66 65 72 5b 32 35 35  | temp_buffer[255|
000017c0  5d 3b 0a 0a 20 20 20 2f  2a 20 46 69 6e 64 20 6f  |];..   /* Find o|
000017d0  75 74 20 77 68 65 72 65  20 74 68 65 20 69 63 6f  |ut where the ico|
000017e0  6e 27 73 20 69 6e 64 69  72 65 63 74 65 64 20 74  |n's indirected t|
000017f0  65 78 74 20 69 73 20 73  74 6f 72 65 64 20 69 6e  |ext is stored in|
00001800  20 6d 65 6d 6f 72 79 20  61 6e 64 20 63 6f 70 79  | memory and copy|
00001810  0a 20 20 20 20 20 20 61  20 6e 65 77 20 73 74 72  |.      a new str|
00001820  69 6e 67 20 74 6f 20 69  74 20 2a 2f 0a 20 20 20  |ing to it */.   |
00001830  74 65 78 74 5f 70 6f 69  6e 74 65 72 20 3d 20 61  |text_pointer = a|
00001840  75 5f 67 65 74 5f 70 74  72 5f 74 6f 5f 69 63 6f  |u_get_ptr_to_ico|
00001850  6e 74 65 78 74 28 77 69  6e 5f 68 2c 20 69 63 6f  |ntext(win_h, ico|
00001860  6e 5f 68 29 3b 0a 20 20  20 73 74 72 63 70 79 28  |n_h);.   strcpy(|
00001870  74 65 78 74 5f 70 6f 69  6e 74 65 72 2c 20 74 65  |text_pointer, te|
00001880  78 74 29 3b 0a 0a 20 20  20 2f 2a 20 4e 6f 77 20  |xt);..   /* Now |
00001890  77 65 20 6e 65 65 64 20  74 6f 20 69 6e 66 6f 72  |we need to infor|
000018a0  6d 20 74 68 65 20 57 49  4d 50 20 74 68 61 74 20  |m the WIMP that |
000018b0  74 68 65 20 69 63 6f 6e  20 6e 65 65 64 73 20 72  |the icon needs r|
000018c0  65 64 72 61 77 69 6e 67  20 62 79 20 73 65 74 74  |edrawing by sett|
000018d0  69 6e 67 0a 20 20 20 20  20 20 74 68 65 20 69 63  |ing.      the ic|
000018e0  6f 6e 20 66 6c 61 67 73  20 2d 20 77 65 20 64 6f  |on flags - we do|
000018f0  6e 27 74 20 61 63 74 75  61 6c 6c 79 20 63 68 61  |n't actually cha|
00001900  6e 67 65 20 74 68 65 6d  20 77 69 74 68 20 74 68  |nge them with th|
00001910  69 73 20 63 61 6c 6c 2c  20 62 75 74 20 74 68 69  |is call, but thi|
00001920  73 0a 20 20 20 20 20 20  73 70 75 72 73 20 74 68  |s.      spurs th|
00001930  65 20 57 49 4d 50 20 69  6e 74 6f 20 61 63 74 69  |e WIMP into acti|
00001940  6f 6e 20 2a 2f 0a 0a 20  20 20 61 75 5f 77 6f 72  |on */..   au_wor|
00001950  64 74 6f 62 79 74 65 28  77 69 6e 5f 68 2c 20 74  |dtobyte(win_h, t|
00001960  65 6d 70 5f 62 75 66 66  65 72 2c 20 30 29 3b 0a  |emp_buffer, 0);.|
00001970  20 20 20 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |   au_wordtobyte|
00001980  28 69 63 6f 6e 5f 68 2c  20 74 65 6d 70 5f 62 75  |(icon_h, temp_bu|
00001990  66 66 65 72 2c 20 34 29  3b 0a 20 20 20 61 75 5f  |ffer, 4);.   au_|
000019a0  77 6f 72 64 74 6f 62 79  74 65 28 30 2c 20 74 65  |wordtobyte(0, te|
000019b0  6d 70 5f 62 75 66 66 65  72 2c 20 38 29 3b 0a 20  |mp_buffer, 8);. |
000019c0  20 20 61 75 5f 77 6f 72  64 74 6f 62 79 74 65 28  |  au_wordtobyte(|
000019d0  30 2c 20 74 65 6d 70 5f  62 75 66 66 65 72 2c 20  |0, temp_buffer, |
000019e0  31 32 29 3b 0a 0a 20 20  20 72 65 67 73 5f 69 6e  |12);..   regs_in|
000019f0  2e 72 5b 31 5d 20 3d 20  28 69 6e 74 29 20 74 65  |.r[1] = (int) te|
00001a00  6d 70 5f 62 75 66 66 65  72 3b 0a 0a 20 20 20 5f  |mp_buffer;..   _|
00001a10  6b 65 72 6e 65 6c 5f 73  77 69 28 57 69 6d 70 5f  |kernel_swi(Wimp_|
00001a20  53 65 74 49 63 6f 6e 53  74 61 74 65 2c 20 26 72  |SetIconState, &r|
00001a30  65 67 73 5f 69 6e 2c 20  26 72 65 67 73 5f 6f 75  |egs_in, &regs_ou|
00001a40  74 29 3b 0a 20 20 20 72  65 74 75 72 6e 3b 0a 7d  |t);.   return;.}|
00001a50  0a 0a 63 68 61 72 20 2a  0a 61 75 5f 67 65 74 5f  |..char *.au_get_|
00001a60  70 74 72 5f 74 6f 5f 69  63 6f 6e 74 65 78 74 28  |ptr_to_icontext(|
00001a70  75 6e 73 69 67 6e 65 64  20 6c 6f 6e 67 20 69 6e  |unsigned long in|
00001a80  74 20 77 69 6e 68 64 6c  2c 20 75 6e 73 69 67 6e  |t winhdl, unsign|
00001a90  65 64 20 6c 6f 6e 67 20  69 6e 74 20 69 63 6f 6e  |ed long int icon|
00001aa0  68 64 6c 29 0a 7b 0a 20  20 20 2f 2a 20 54 68 69  |hdl).{.   /* Thi|
00001ab0  73 20 70 72 6f 63 65 64  75 72 65 20 69 6e 74 65  |s procedure inte|
00001ac0  72 72 6f 67 61 74 65 73  20 61 6e 20 69 63 6f 6e  |rrogates an icon|
00001ad0  20 74 6f 20 64 65 74 65  72 6d 69 6e 65 20 74 68  | to determine th|
00001ae0  65 20 61 64 64 72 65 73  73 20 77 68 65 72 65 20  |e address where |
00001af0  69 74 73 0a 20 20 20 20  20 20 69 6e 64 69 72 65  |its.      indire|
00001b00  63 74 65 64 20 74 65 78  74 20 64 61 74 61 20 69  |cted text data i|
00001b10  73 20 73 74 6f 72 65 64  20 69 6e 20 6d 65 6d 6f  |s stored in memo|
00001b20  72 79 2c 20 61 6e 64 20  72 65 74 75 72 6e 73 20  |ry, and returns |
00001b30  69 74 20 2a 2f 0a 0a 20  20 20 75 6e 73 69 67 6e  |it */..   unsign|
00001b40  65 64 20 63 68 61 72 20  74 65 6d 70 5f 62 75 66  |ed char temp_buf|
00001b50  66 65 72 5b 32 35 35 5d  3b 0a 20 20 20 5f 6b 65  |fer[255];.   _ke|
00001b60  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 20 72 65  |rnel_swi_regs re|
00001b70  67 73 5f 69 6e 2c 20 72  65 67 73 5f 6f 75 74 3b  |gs_in, regs_out;|
00001b80  0a 20 20 20 63 68 61 72  20 2a 72 65 73 75 6c 74  |.   char *result|
00001b90  3b 0a 0a 20 20 20 61 75  5f 77 6f 72 64 74 6f 62  |;..   au_wordtob|
00001ba0  79 74 65 28 77 69 6e 68  64 6c 2c 20 74 65 6d 70  |yte(winhdl, temp|
00001bb0  5f 62 75 66 66 65 72 2c  20 30 29 3b 0a 20 20 20  |_buffer, 0);.   |
00001bc0  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 69 63  |au_wordtobyte(ic|
00001bd0  6f 6e 68 64 6c 2c 20 74  65 6d 70 5f 62 75 66 66  |onhdl, temp_buff|
00001be0  65 72 2c 20 34 29 3b 0a  0a 20 20 20 72 65 67 73  |er, 4);..   regs|
00001bf0  5f 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  |_in.r[1] = (int)|
00001c00  20 74 65 6d 70 5f 62 75  66 66 65 72 3b 0a 20 20  | temp_buffer;.  |
00001c10  20 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  | _kernel_swi(Wim|
00001c20  70 5f 47 65 74 49 63 6f  6e 53 74 61 74 65 2c 20  |p_GetIconState, |
00001c30  26 72 65 67 73 5f 69 6e  2c 20 26 72 65 67 73 5f  |&regs_in, &regs_|
00001c40  6f 75 74 29 3b 0a 0a 20  20 20 72 65 73 75 6c 74  |out);..   result|
00001c50  20 3d 20 28 63 68 61 72  20 2a 29 20 61 75 5f 62  | = (char *) au_b|
00001c60  79 74 65 74 6f 77 6f 72  64 28 74 65 6d 70 5f 62  |ytetoword(temp_b|
00001c70  75 66 66 65 72 2c 20 32  38 29 3b 0a 20 20 20 72  |uffer, 28);.   r|
00001c80  65 74 75 72 6e 20 72 65  73 75 6c 74 3b 0a 7d 0a  |eturn result;.}.|
00001c90  0a 76 6f 69 64 0a 61 75  5f 62 75 69 6c 64 6d 65  |.void.au_buildme|
00001ca0  6e 75 28 63 68 61 72 20  2a 74 69 74 6c 65 2c 20  |nu(char *title, |
00001cb0  6d 65 6e 75 5f 64 61 74  61 20 2a 6d 65 6e 75 5f  |menu_data *menu_|
00001cc0  64 61 74 29 0a 7b 0a 09  69 66 28 73 74 72 6c 65  |dat).{..if(strle|
00001cd0  6e 28 74 69 74 6c 65 29  20 3e 20 31 31 29 20 72  |n(title) > 11) r|
00001ce0  65 74 75 72 6e 3b 20 2f  2a 20 44 6f 20 74 68 69  |eturn; /* Do thi|
00001cf0  73 20 6d 6f 72 65 20 6e  65 61 74 6c 79 21 20 2a  |s more neatly! *|
00001d00  2f 0a 09 2f 2a 20 46 69  6c 6c 20 69 6e 20 74 68  |/../* Fill in th|
00001d10  65 20 6d 65 6e 75 20 68  65 61 64 65 72 20 77 69  |e menu header wi|
00001d20  74 68 20 73 74 61 6e 64  61 72 64 20 69 6e 66 6f  |th standard info|
00001d30  72 6d 61 74 69 6f 6e 20  2a 2f 0a 09 73 74 72 63  |rmation */..strc|
00001d40  70 79 28 6d 65 6e 75 5f  64 61 74 2d 3e 74 69 74  |py(menu_dat->tit|
00001d50  6c 65 2c 20 74 69 74 6c  65 29 3b 0a 09 6d 65 6e  |le, title);..men|
00001d60  75 5f 64 61 74 2d 3e 63  6f 6c 6f 75 72 73 20 3d  |u_dat->colours =|
00001d70  20 4d 45 4e 55 5f 54 49  54 4c 45 46 4f 52 45 20  | MENU_TITLEFORE |
00001d80  7c 20 4d 45 4e 55 5f 54  49 54 4c 45 42 41 43 4b  || MENU_TITLEBACK|
00001d90  20 7c 20 4d 45 4e 55 5f  57 4f 52 4b 46 4f 52 45  | | MENU_WORKFORE|
00001da0  20 7c 20 4d 45 4e 55 5f  57 4f 52 4b 42 41 43 4b  | | MENU_WORKBACK|
00001db0  3b 0a 09 6d 65 6e 75 5f  64 61 74 2d 3e 77 69 64  |;..menu_dat->wid|
00001dc0  74 68 20 3d 20 4d 45 4e  55 5f 57 49 44 54 48 3b  |th = MENU_WIDTH;|
00001dd0  0a 09 6d 65 6e 75 5f 64  61 74 2d 3e 68 65 69 67  |..menu_dat->heig|
00001de0  68 74 20 3d 20 4d 45 4e  55 5f 48 45 49 47 48 54  |ht = MENU_HEIGHT|
00001df0  3b 0a 09 6d 65 6e 75 5f  64 61 74 2d 3e 76 65 72  |;..menu_dat->ver|
00001e00  74 5f 67 61 70 20 3d 20  4d 45 4e 55 5f 56 45 52  |t_gap = MENU_VER|
00001e10  54 47 41 50 3b 0a 09 6d  65 6e 75 5f 64 61 74 2d  |TGAP;..menu_dat-|
00001e20  3e 6e 65 78 74 5f 6d 65  6e 75 65 6c 65 6d 20 3d  |>next_menuelem =|
00001e30  20 4e 55 4c 4c 3b 0a 09  6d 65 6e 75 5f 64 61 74  | NULL;..menu_dat|
00001e40  2d 3e 73 69 7a 65 20 3d  20 73 69 7a 65 6f 66 28  |->size = sizeof(|
00001e50  6d 65 6e 75 5f 64 61 74  61 29 3b 0a 09 72 65 74  |menu_data);..ret|
00001e60  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |urn;.}..void.au_|
00001e70  61 64 64 74 6f 6d 65 6e  75 28 63 68 61 72 20 2a  |addtomenu(char *|
00001e80  74 65 78 74 2c 20 6c 6f  6e 67 20 69 6e 74 20 6d  |text, long int m|
00001e90  65 6e 75 5f 66 6c 61 67  73 2c 20 6c 6f 6e 67 20  |enu_flags, long |
00001ea0  69 6e 74 20 73 75 62 6d  65 6e 75 2c 20 6c 6f 6e  |int submenu, lon|
00001eb0  67 20 69 6e 74 20 69 63  6f 6e 5f 66 6c 61 67 73  |g int icon_flags|
00001ec0  2c 20 6d 65 6e 75 5f 64  61 74 61 20 2a 6d 65 6e  |, menu_data *men|
00001ed0  75 5f 64 61 74 29 0a 7b  0a 09 6d 65 6e 75 5f 65  |u_dat).{..menu_e|
00001ee0  6c 65 6d 65 6e 74 20 2a  70 6f 69 6e 74 65 72 3b  |lement *pointer;|
00001ef0  0a 0a 09 69 66 28 73 74  72 6c 65 6e 28 74 65 78  |...if(strlen(tex|
00001f00  74 29 20 3e 20 31 31 29  20 72 65 74 75 72 6e 3b  |t) > 11) return;|
00001f10  0a 09 2f 2a 20 57 6f 72  6b 20 6f 75 72 20 77 61  |../* Work our wa|
00001f20  79 20 74 6f 20 65 6e 64  20 6f 66 20 6d 65 6e 75  |y to end of menu|
00001f30  20 6c 69 73 74 20 2a 2f  0a 09 69 66 28 6d 65 6e  | list */..if(men|
00001f40  75 5f 64 61 74 2d 3e 6e  65 78 74 5f 6d 65 6e 75  |u_dat->next_menu|
00001f50  65 6c 65 6d 20 3d 3d 20  4e 55 4c 4c 29 20 7b 0a  |elem == NULL) {.|
00001f60  09 09 6d 65 6e 75 5f 64  61 74 2d 3e 6e 65 78 74  |..menu_dat->next|
00001f70  5f 6d 65 6e 75 65 6c 65  6d 20 3d 20 63 61 6c 6c  |_menuelem = call|
00001f80  6f 63 28 31 2c 20 73 69  7a 65 6f 66 28 6d 65 6e  |oc(1, sizeof(men|
00001f90  75 5f 65 6c 65 6d 65 6e  74 29 29 3b 0a 09 09 6d  |u_element));...m|
00001fa0  65 6e 75 5f 64 61 74 2d  3e 73 69 7a 65 20 2b 3d  |enu_dat->size +=|
00001fb0  20 73 69 7a 65 6f 66 28  6d 65 6e 75 5f 65 6c 65  | sizeof(menu_ele|
00001fc0  6d 65 6e 74 29 3b 0a 09  09 70 6f 69 6e 74 65 72  |ment);...pointer|
00001fd0  20 3d 20 6d 65 6e 75 5f  64 61 74 2d 3e 6e 65 78  | = menu_dat->nex|
00001fe0  74 5f 6d 65 6e 75 65 6c  65 6d 3b 0a 09 7d 20 65  |t_menuelem;..} e|
00001ff0  6c 73 65 20 7b 0a 09 09  70 6f 69 6e 74 65 72 20  |lse {...pointer |
00002000  3d 20 6d 65 6e 75 5f 64  61 74 2d 3e 6e 65 78 74  |= menu_dat->next|
00002010  5f 6d 65 6e 75 65 6c 65  6d 3b 0a 09 09 77 68 69  |_menuelem;...whi|
00002020  6c 65 20 28 70 6f 69 6e  74 65 72 2d 3e 6e 65 78  |le (pointer->nex|
00002030  74 5f 6d 65 6e 75 65 6c  65 6d 20 21 3d 20 30 29  |t_menuelem != 0)|
00002040  20 7b 0a 09 09 09 70 6f  69 6e 74 65 72 20 3d 20  | {....pointer = |
00002050  70 6f 69 6e 74 65 72 2d  3e 6e 65 78 74 5f 6d 65  |pointer->next_me|
00002060  6e 75 65 6c 65 6d 3b 0a  09 09 7d 0a 09 09 70 6f  |nuelem;...}...po|
00002070  69 6e 74 65 72 2d 3e 6e  65 78 74 5f 6d 65 6e 75  |inter->next_menu|
00002080  65 6c 65 6d 20 3d 20 63  61 6c 6c 6f 63 28 31 2c  |elem = calloc(1,|
00002090  20 73 69 7a 65 6f 66 28  6d 65 6e 75 5f 65 6c 65  | sizeof(menu_ele|
000020a0  6d 65 6e 74 29 29 3b 0a  09 09 6d 65 6e 75 5f 64  |ment));...menu_d|
000020b0  61 74 2d 3e 73 69 7a 65  20 2b 3d 20 73 69 7a 65  |at->size += size|
000020c0  6f 66 28 6d 65 6e 75 5f  65 6c 65 6d 65 6e 74 29  |of(menu_element)|
000020d0  3b 0a 09 09 70 6f 69 6e  74 65 72 20 3d 20 70 6f  |;...pointer = po|
000020e0  69 6e 74 65 72 2d 3e 6e  65 78 74 5f 6d 65 6e 75  |inter->next_menu|
000020f0  65 6c 65 6d 3b 0a 09 7d  0a 09 2f 2a 20 73 65 74  |elem;..}../* set|
00002100  20 75 70 20 64 61 74 61  20 2a 2f 0a 09 73 74 72  | up data */..str|
00002110  63 70 79 28 70 6f 69 6e  74 65 72 2d 3e 6d 65 6e  |cpy(pointer->men|
00002120  75 5f 74 65 78 74 2c 20  74 65 78 74 29 3b 0a 09  |u_text, text);..|
00002130  70 6f 69 6e 74 65 72 2d  3e 66 6c 61 67 73 20 3d  |pointer->flags =|
00002140  20 6d 65 6e 75 5f 66 6c  61 67 73 3b 0a 09 70 6f  | menu_flags;..po|
00002150  69 6e 74 65 72 2d 3e 73  75 62 6d 65 6e 75 20 3d  |inter->submenu =|
00002160  20 73 75 62 6d 65 6e 75  3b 0a 0a 09 2f 2a 20 41  | submenu;.../* A|
00002170  70 70 6c 79 20 73 74 61  6e 64 61 72 64 20 69 63  |pply standard ic|
00002180  6f 6e 20 66 6c 61 67 73  20 2a 2f 0a 09 69 63 6f  |on flags */..ico|
00002190  6e 5f 66 6c 61 67 73 20  3d 20 69 63 6f 6e 5f 66  |n_flags = icon_f|
000021a0  6c 61 67 73 20 7c 20 4d  45 4e 55 49 54 45 4d 5f  |lags | MENUITEM_|
000021b0  46 4f 52 45 20 7c 20 4d  45 4e 55 49 54 45 4d 5f  |FORE | MENUITEM_|
000021c0  42 41 43 4b 20 7c 20 49  43 4f 4e 5f 49 53 54 45  |BACK | ICON_ISTE|
000021d0  58 54 20 7c 20 49 43 4f  4e 5f 49 53 46 49 4c 4c  |XT | ICON_ISFILL|
000021e0  45 44 3b 0a 09 70 6f 69  6e 74 65 72 2d 3e 6d 65  |ED;..pointer->me|
000021f0  6e 75 5f 69 63 6f 6e 66  6c 61 67 73 20 3d 20 69  |nu_iconflags = i|
00002200  63 6f 6e 5f 66 6c 61 67  73 3b 0a 09 72 65 74 75  |con_flags;..retu|
00002210  72 6e 3b 0a 7d 0a 0a 76  6f 69 64 0a 61 75 5f 63  |rn;.}..void.au_c|
00002220  72 65 61 74 65 6d 65 6e  75 28 6d 65 6e 75 5f 64  |reatemenu(menu_d|
00002230  61 74 61 20 2a 6d 65 6e  75 5f 64 61 74 29 0a 7b  |ata *menu_dat).{|
00002240  0a 09 6d 65 6e 75 5f 65  6c 65 6d 65 6e 74 09 2a  |..menu_element.*|
00002250  70 6f 69 6e 74 65 72 3b  0a 09 69 6e 74 09 69 3b  |pointer;..int.i;|
00002260  0a 0a 09 2f 2a 20 41 73  73 69 67 6e 20 6d 65 6d  |.../* Assign mem|
00002270  6f 72 79 20 2a 2f 0a 09  6d 65 6e 75 5f 64 61 74  |ory */..menu_dat|
00002280  2d 3e 64 61 74 61 62 6c  6f 63 6b 20 3d 20 63 61  |->datablock = ca|
00002290  6c 6c 6f 63 28 31 2c 20  6d 65 6e 75 5f 64 61 74  |lloc(1, menu_dat|
000022a0  2d 3e 73 69 7a 65 29 3b  0a 09 2f 2a 20 42 65 67  |->size);../* Beg|
000022b0  69 6e 20 63 6f 70 79 69  6e 67 20 64 61 74 61 20  |in copying data |
000022c0  2a 2f 0a 09 73 74 72 63  70 79 28 28 63 68 61 72  |*/..strcpy((char|
000022d0  20 2a 29 6d 65 6e 75 5f  64 61 74 2d 3e 64 61 74  | *)menu_dat->dat|
000022e0  61 62 6c 6f 63 6b 2c 20  6d 65 6e 75 5f 64 61 74  |ablock, menu_dat|
000022f0  2d 3e 74 69 74 6c 65 29  3b 0a 09 2f 2a 61 75 5f  |->title);../*au_|
00002300  72 65 70 6f 72 74 5f 65  72 72 6f 72 28 31 2c 20  |report_error(1, |
00002310  22 62 6c 61 22 2c 20 31  2c 20 22 62 6c 61 22 29  |"bla", 1, "bla")|
00002320  3b 2a 2f 0a 09 61 75 5f  77 6f 72 64 74 6f 62 79  |;*/..au_wordtoby|
00002330  74 65 28 6d 65 6e 75 5f  64 61 74 2d 3e 63 6f 6c  |te(menu_dat->col|
00002340  6f 75 72 73 2c 20 6d 65  6e 75 5f 64 61 74 2d 3e  |ours, menu_dat->|
00002350  64 61 74 61 62 6c 6f 63  6b 2c 20 31 32 29 3b 0a  |datablock, 12);.|
00002360  09 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 6d  |.au_wordtobyte(m|
00002370  65 6e 75 5f 64 61 74 2d  3e 77 69 64 74 68 2c 20  |enu_dat->width, |
00002380  6d 65 6e 75 5f 64 61 74  2d 3e 64 61 74 61 62 6c  |menu_dat->databl|
00002390  6f 63 6b 2c 20 31 36 29  3b 0a 09 61 75 5f 77 6f  |ock, 16);..au_wo|
000023a0  72 64 74 6f 62 79 74 65  28 6d 65 6e 75 5f 64 61  |rdtobyte(menu_da|
000023b0  74 2d 3e 68 65 69 67 68  74 2c 20 6d 65 6e 75 5f  |t->height, menu_|
000023c0  64 61 74 2d 3e 64 61 74  61 62 6c 6f 63 6b 2c 20  |dat->datablock, |
000023d0  32 30 29 3b 0a 09 61 75  5f 77 6f 72 64 74 6f 62  |20);..au_wordtob|
000023e0  79 74 65 28 6d 65 6e 75  5f 64 61 74 2d 3e 76 65  |yte(menu_dat->ve|
000023f0  72 74 5f 67 61 70 2c 20  6d 65 6e 75 5f 64 61 74  |rt_gap, menu_dat|
00002400  2d 3e 64 61 74 61 62 6c  6f 63 6b 2c 20 32 34 29  |->datablock, 24)|
00002410  3b 0a 09 2f 2a 20 65 6e  64 20 6f 66 20 68 65 61  |;../* end of hea|
00002420  64 65 72 20 69 6e 66 6f  20 2a 2f 0a 09 69 20 3d  |der info */..i =|
00002430  20 32 38 3b 0a 0a 09 70  6f 69 6e 74 65 72 20 3d  | 28;...pointer =|
00002440  20 6d 65 6e 75 5f 64 61  74 2d 3e 6e 65 78 74 5f  | menu_dat->next_|
00002450  6d 65 6e 75 65 6c 65 6d  3b 0a 0a 09 77 68 69 6c  |menuelem;...whil|
00002460  65 28 70 6f 69 6e 74 65  72 20 21 3d 20 4e 55 4c  |e(pointer != NUL|
00002470  4c 29 20 7b 0a 0a 09 09  61 75 5f 77 6f 72 64 74  |L) {....au_wordt|
00002480  6f 62 79 74 65 28 70 6f  69 6e 74 65 72 2d 3e 66  |obyte(pointer->f|
00002490  6c 61 67 73 2c 20 6d 65  6e 75 5f 64 61 74 2d 3e  |lags, menu_dat->|
000024a0  64 61 74 61 62 6c 6f 63  6b 2c 20 69 29 3b 0a 09  |datablock, i);..|
000024b0  09 69 20 2b 3d 20 34 3b  0a 09 09 61 75 5f 77 6f  |.i += 4;...au_wo|
000024c0  72 64 74 6f 62 79 74 65  28 70 6f 69 6e 74 65 72  |rdtobyte(pointer|
000024d0  2d 3e 73 75 62 6d 65 6e  75 2c 20 6d 65 6e 75 5f  |->submenu, menu_|
000024e0  64 61 74 2d 3e 64 61 74  61 62 6c 6f 63 6b 2c 20  |dat->datablock, |
000024f0  69 29 3b 0a 09 09 69 20  2b 3d 20 34 3b 0a 09 09  |i);...i += 4;...|
00002500  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 70 6f  |au_wordtobyte(po|
00002510  69 6e 74 65 72 2d 3e 6d  65 6e 75 5f 69 63 6f 6e  |inter->menu_icon|
00002520  66 6c 61 67 73 2c 20 6d  65 6e 75 5f 64 61 74 2d  |flags, menu_dat-|
00002530  3e 64 61 74 61 62 6c 6f  63 6b 2c 20 69 29 3b 0a  |>datablock, i);.|
00002540  09 09 69 20 2b 3d 20 34  3b 0a 09 09 73 74 72 63  |..i += 4;...strc|
00002550  70 79 28 28 63 68 61 72  20 2a 29 20 26 6d 65 6e  |py((char *) &men|
00002560  75 5f 64 61 74 2d 3e 64  61 74 61 62 6c 6f 63 6b  |u_dat->datablock|
00002570  5b 69 5d 2c 20 70 6f 69  6e 74 65 72 2d 3e 6d 65  |[i], pointer->me|
00002580  6e 75 5f 74 65 78 74 29  3b 0a 09 09 69 20 2b 3d  |nu_text);...i +=|
00002590  20 31 32 3b 0a 09 09 70  6f 69 6e 74 65 72 20 3d  | 12;...pointer =|
000025a0  20 70 6f 69 6e 74 65 72  2d 3e 6e 65 78 74 5f 6d  | pointer->next_m|
000025b0  65 6e 75 65 6c 65 6d 3b  0a 09 7d 0a 09 72 65 74  |enuelem;..}..ret|
000025c0  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |urn;.}..void.au_|
000025d0  6f 70 65 6e 6d 65 6e 75  28 6d 65 6e 75 5f 64 61  |openmenu(menu_da|
000025e0  74 61 20 2a 6d 65 6e 75  5f 64 61 74 2c 20 69 6e  |ta *menu_dat, in|
000025f0  74 20 6d 6f 75 73 65 5f  78 2c 20 69 6e 74 20 6d  |t mouse_x, int m|
00002600  6f 75 73 65 5f 79 29 0a  7b 0a 09 5f 6b 65 72 6e  |ouse_y).{.._kern|
00002610  65 6c 5f 73 77 69 5f 72  65 67 73 09 72 65 67 73  |el_swi_regs.regs|
00002620  5f 69 6e 2c 20 72 65 67  73 5f 6f 75 74 3b 0a 0a  |_in, regs_out;..|
00002630  09 72 65 67 73 5f 69 6e  2e 72 5b 31 5d 20 3d 20  |.regs_in.r[1] = |
00002640  28 69 6e 74 29 20 6d 65  6e 75 5f 64 61 74 2d 3e  |(int) menu_dat->|
00002650  64 61 74 61 62 6c 6f 63  6b 3b 0a 09 72 65 67 73  |datablock;..regs|
00002660  5f 69 6e 2e 72 5b 32 5d  20 3d 20 6d 6f 75 73 65  |_in.r[2] = mouse|
00002670  5f 78 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 33  |_x;..regs_in.r[3|
00002680  5d 20 3d 20 6d 6f 75 73  65 5f 79 3b 0a 09 5f 6b  |] = mouse_y;.._k|
00002690  65 72 6e 65 6c 5f 73 77  69 28 57 69 6d 70 5f 43  |ernel_swi(Wimp_C|
000026a0  72 65 61 74 65 4d 65 6e  75 2c 20 26 72 65 67 73  |reateMenu, &regs|
000026b0  5f 69 6e 2c 20 26 72 65  67 73 5f 6f 75 74 29 3b  |_in, &regs_out);|
000026c0  0a 09 72 65 74 75 72 6e  3b 0a 7d 0a              |..return;.}.|
000026cc