Home » Archimedes archive » Acorn User » AU 1996-06.adf » Regulars » StarInfo/WimpC/!NewWimpC/c/AULib » Compare
Compare StarInfo/WimpC/!NewWimpC/c/AULib with WimpC/!RAPS/c/AULib
| File: | Archimedes archive » Acorn User » AU 1996-06.adf » Regulars » StarInfo/WimpC/!NewWimpC/c/AULib |
| Compared with: | Archimedes archive » Acorn User » AU 1996-10 A.adf » Regulars » WimpC/!RAPS/c/AULib |
| Similarity: | 90% of bytes duplicated |
89.6% 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.
StarInfo/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 20 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 |{. _kerne| 00000110 6c 5f 73 77 69 5f 72 65 67 73 20 20 20 20 20 20 |l_swi_regs | 00000120 20 20 72 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f | regs_in, regs_| 00000130 6f 75 74 3b 0a 0a 20 20 20 20 20 20 20 20 72 65 |out;.. re| 00000140 67 73 5f 69 6e 2e 72 5b 30 5d 20 3d 20 76 5f 6e |gs_in.r[0] = v_n| 00000150 75 6d 62 65 72 3b 0a 20 20 20 20 20 20 20 20 72 |umber;. r| 00000160 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 2a 28 |egs_in.r[1] = *(| 00000170 69 6e 74 20 2a 29 22 54 41 53 4b 22 3b 0a 20 20 |int *)"TASK";. | 00000180 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b | regs_in.r[| 00000190 32 5d 20 3d 20 28 69 6e 74 29 20 61 70 70 6e 61 |2] = (int) appna| 000001a0 6d 65 3b 0a 20 20 20 20 20 20 20 20 72 65 67 73 |me;. regs| 000001b0 5f 69 6e 2e 72 5b 33 5d 20 3d 20 28 69 6e 74 29 |_in.r[3] = (int)| 000001c0 20 6d 73 67 6c 69 73 74 3b 0a 0a 20 20 20 20 20 | msglist;.. | 000001d0 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 | _kernel_swi(W| 000001e0 69 6d 70 5f 49 6e 69 74 69 61 6c 69 73 65 2c 20 |imp_Initialise, | 000001f0 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f |®s_in, ®s_| 00000200 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 20 72 65 |out);. re| 00000210 74 75 72 6e 20 72 65 67 73 5f 6f 75 74 2e 72 5b |turn regs_out.r[| 00000220 31 5d 3b 20 2f 2a 20 74 68 69 73 20 69 73 20 74 |1]; /* this is t| 00000230 68 65 20 74 61 73 6b 20 68 61 6e 64 6c 65 2c 20 |he task handle, | 00000240 72 65 74 75 72 6e 65 64 20 66 6f 72 20 6c 61 74 |returned for lat| 00000250 65 72 20 75 73 65 20 2a 2f 0a 7d 0a 0a 76 6f 69 |er use */.}..voi| 00000260 64 0a 61 75 5f 63 6c 6f 73 65 64 6f 77 6e 28 69 |d.au_closedown(i| 00000270 6e 74 20 74 61 73 6b 68 61 6e 64 6c 65 29 0a 7b |nt taskhandle).{| 00000280 0a 20 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c |. _kernel| 00000290 5f 73 77 69 5f 72 65 67 73 20 20 20 20 20 20 20 |_swi_regs | 000002a0 20 72 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f 6f | regs_in, regs_o| 000002b0 75 74 3b 0a 0a 20 20 20 20 20 20 20 20 72 65 67 |ut;.. reg| 000002c0 73 5f 69 6e 2e 72 5b 30 5d 20 3d 20 74 61 73 6b |s_in.r[0] = task| 000002d0 68 61 6e 64 6c 65 3b 0a 20 20 20 20 20 20 20 20 |handle;. | 000002e0 72 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 2a |regs_in.r[1] = *| 000002f0 28 69 6e 74 20 2a 29 22 54 41 53 4b 22 3b 0a 20 |(int *)"TASK";. | 00000300 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 | _kernel_s| 00000310 77 69 28 57 69 6d 70 5f 43 6c 6f 73 65 44 6f 77 |wi(Wimp_CloseDow| 00000320 6e 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |n, ®s_in, &re| 00000330 67 73 5f 6f 75 74 29 3b 0a 7d 0a 0a 69 6e 74 0a |gs_out);.}..int.| 00000340 61 75 5f 63 72 65 61 74 65 5f 69 63 6f 6e 62 61 |au_create_iconba| 00000350 72 5f 69 63 6f 6e 28 69 6e 74 20 70 72 69 6f 72 |r_icon(int prior| 00000360 69 74 79 2c 20 75 6e 73 69 67 6e 65 64 20 6c 6f |ity, unsigned lo| 00000370 6e 67 20 69 6e 74 20 77 68 69 63 68 73 69 64 65 |ng int whichside| 00000380 2c 20 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 |, unsigned long | 00000390 69 6e 74 20 69 63 6f 6e 66 6c 61 67 73 2c 20 63 |int iconflags, c| 000003a0 68 61 72 20 2a 73 70 72 6e 61 6d 65 29 0a 7b 0a |har *sprname).{.| 000003b0 20 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f | _kernel_| 000003c0 73 77 69 5f 72 65 67 73 20 20 20 20 20 20 20 20 |swi_regs | 000003d0 72 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f 6f 75 |regs_in, regs_ou| 000003e0 74 3b 0a 20 20 20 20 20 20 20 20 75 6e 73 69 67 |t;. unsig| 000003f0 6e 65 64 20 63 68 61 72 20 69 63 6f 6e 5f 62 6c |ned char icon_bl| 00000400 6f 63 6b 5b 49 43 4f 4e 5f 42 4c 4f 43 4b 5f 53 |ock[ICON_BLOCK_S| 00000410 49 5a 45 5d 3b 0a 20 20 20 20 20 20 20 20 2f 2a |IZE];. /*| 00000420 20 57 65 20 6e 65 65 64 20 74 6f 20 62 75 69 6c | We need to buil| 00000430 64 20 75 70 20 61 6e 20 69 63 6f 6e 20 69 6e 66 |d up an icon inf| 00000440 6f 72 6d 61 74 69 6f 6e 20 64 61 74 61 62 6c 6f |ormation datablo| 00000450 63 6b 20 2a 2f 0a 20 20 20 20 20 20 20 20 61 75 |ck */. au| 00000460 5f 77 6f 72 64 74 6f 62 79 74 65 28 77 68 69 63 |_wordtobyte(whic| 00000470 68 73 69 64 65 2c 20 69 63 6f 6e 5f 62 6c 6f 63 |hside, icon_bloc| 00000480 6b 2c 20 30 29 3b 0a 20 20 20 20 20 20 20 20 61 |k, 0);. a| 00000490 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 49 42 41 |u_wordtobyte(IBA| 000004a0 52 5f 42 42 4f 58 5f 4d 49 4e 58 2c 20 69 63 6f |R_BBOX_MINX, ico| 000004b0 6e 5f 62 6c 6f 63 6b 2c 20 34 29 3b 0a 20 20 20 |n_block, 4);. | 000004c0 20 20 20 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 | au_wordtoby| 000004d0 74 65 28 49 42 41 52 5f 42 42 4f 58 5f 4d 49 4e |te(IBAR_BBOX_MIN| 000004e0 59 2c 20 69 63 6f 6e 5f 62 6c 6f 63 6b 2c 20 38 |Y, icon_block, 8| 000004f0 29 3b 0a 20 20 20 20 20 20 20 20 61 75 5f 77 6f |);. au_wo| 00000500 72 64 74 6f 62 79 74 65 28 49 42 41 52 5f 42 42 |rdtobyte(IBAR_BB| 00000510 4f 58 5f 4d 41 58 58 2c 20 69 63 6f 6e 5f 62 6c |OX_MAXX, icon_bl| 00000520 6f 63 6b 2c 20 31 32 29 3b 0a 20 20 20 20 20 20 |ock, 12);. | 00000530 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 | au_wordtobyte(| 00000540 49 42 41 52 5f 42 42 4f 58 5f 4d 41 58 59 2c 20 |IBAR_BBOX_MAXY, | 00000550 69 63 6f 6e 5f 62 6c 6f 63 6b 2c 20 31 36 29 3b |icon_block, 16);| 00000560 0a 20 20 20 20 20 20 20 20 61 75 5f 77 6f 72 64 |. au_word| 00000570 74 6f 62 79 74 65 28 69 63 6f 6e 66 6c 61 67 73 |tobyte(iconflags| 00000580 2c 20 69 63 6f 6e 5f 62 6c 6f 63 6b 2c 20 32 30 |, icon_block, 20| 00000590 29 3b 0a 0a 20 20 20 20 20 20 20 20 2f 2a 20 43 |);.. /* C| 000005a0 6f 70 79 20 74 68 65 20 69 63 6f 6e 20 6e 61 6d |opy the icon nam| 000005b0 65 20 69 6e 74 6f 20 74 68 65 20 61 70 70 72 6f |e into the appro| 000005c0 70 72 69 61 74 65 20 70 6c 61 63 65 20 2a 2f 0a |priate place */.| 000005d0 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 20 | strcpy( | 000005e0 28 63 68 61 72 20 2a 29 20 26 69 63 6f 6e 5f 62 |(char *) &icon_b| 000005f0 6c 6f 63 6b 5b 32 34 5d 2c 20 73 70 72 6e 61 6d |lock[24], sprnam| 00000600 65 29 3b 0a 20 20 20 20 20 20 20 20 72 65 67 73 |e);. regs| 00000610 5f 69 6e 2e 72 5b 30 5d 20 3d 20 70 72 69 6f 72 |_in.r[0] = prior| 00000620 69 74 79 3b 0a 20 20 20 20 20 20 20 20 72 65 67 |ity;. reg| 00000630 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 |s_in.r[1] = (int| 00000640 29 20 69 63 6f 6e 5f 62 6c 6f 63 6b 3b 0a 20 20 |) icon_block;. | 00000650 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 | _kernel_sw| 00000660 69 28 57 69 6d 70 5f 43 72 65 61 74 65 49 63 6f |i(Wimp_CreateIco| 00000670 6e 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |n, ®s_in, &re| 00000680 67 73 5f 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 |gs_out);. | 00000690 20 72 65 74 75 72 6e 20 72 65 67 73 5f 6f 75 74 | return regs_out| 000006a0 2e 72 5b 30 5d 3b 20 2f 2a 20 52 65 74 75 72 6e |.r[0]; /* Return| 000006b0 20 74 68 65 20 69 63 6f 6e 20 68 61 6e 64 6c 65 | the icon handle| 000006c0 20 2a 2f 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 77 | */.}..void.au_w| 000006d0 6f 72 64 74 6f 62 79 74 65 28 75 6e 73 69 67 6e |ordtobyte(unsign| 000006e0 65 64 20 6c 6f 6e 67 20 69 6e 74 20 69 6e 70 75 |ed long int inpu| 000006f0 74 2c 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 |t, unsigned char| 00000700 20 62 6c 6f 63 6b 5b 5d 2c 20 69 6e 74 20 69 6e | block[], int in| 00000710 64 65 78 29 0a 7b 0a 20 20 20 20 20 20 20 20 75 |dex).{. u| 00000720 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 |nsigned long int| 00000730 20 6d 61 73 6b 20 3d 20 32 35 35 3b 0a 0a 20 20 | mask = 255;.. | 00000740 20 20 20 20 20 20 2f 2a 20 54 68 65 20 6f 70 70 | /* The opp| 00000750 6f 73 69 74 65 20 6f 66 20 62 74 6f 77 28 29 20 |osite of btow() | 00000760 2d 20 74 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 |- this function | 00000770 74 61 6b 65 73 20 61 20 33 32 2d 62 69 74 20 69 |takes a 32-bit i| 00000780 6e 74 65 67 65 72 2c 20 73 70 6c 69 74 73 0a 20 |nteger, splits. | 00000790 20 20 20 20 20 20 20 20 2a 20 69 74 20 75 70 20 | * it up | 000007a0 69 6e 74 6f 20 34 20 62 79 74 65 73 2c 20 61 6e |into 4 bytes, an| 000007b0 64 20 73 74 6f 72 65 73 20 74 68 6f 73 65 20 69 |d stores those i| 000007c0 6e 20 34 20 63 6f 6e 73 65 63 75 74 69 76 65 20 |n 4 consecutive | 000007d0 63 65 6c 6c 73 20 6f 66 20 61 0a 20 20 20 20 20 |cells of a. | 000007e0 20 20 20 20 2a 20 63 68 61 72 61 63 74 65 72 20 | * character | 000007f0 61 72 72 61 79 20 69 6e 64 65 78 65 64 20 62 79 |array indexed by| 00000800 20 69 6e 64 65 78 2e 20 54 68 69 73 20 69 73 20 | index. This is | 00000810 64 6f 6e 65 20 62 79 20 75 73 69 6e 67 20 61 20 |done by using a | 00000820 6d 61 73 6b 20 74 6f 0a 20 20 20 20 20 20 20 20 |mask to. | 00000830 20 2a 20 65 78 74 72 61 63 74 20 74 68 65 20 64 | * extract the d| 00000840 61 74 61 20 69 6e 20 73 65 71 75 65 6e 63 65 2c |ata in sequence,| 00000850 20 77 69 74 68 20 74 68 65 20 26 20 62 69 74 77 | with the & bitw| 00000860 69 73 65 2d 61 6e 64 20 6f 70 65 72 61 74 6f 72 |ise-and operator| 00000870 20 2a 2f 0a 0a 20 20 20 20 20 20 20 20 62 6c 6f | */.. blo| 00000880 63 6b 5b 69 6e 64 65 78 2b 2b 5d 20 3d 20 28 63 |ck[index++] = (c| 00000890 68 61 72 29 20 28 69 6e 70 75 74 20 26 20 6d 61 |har) (input & ma| 000008a0 73 6b 29 3b 20 0a 20 20 20 20 20 20 20 20 2f 2a |sk); . /*| 000008b0 20 73 68 69 66 74 20 6d 61 73 6b 20 74 6f 20 67 | shift mask to g| 000008c0 65 74 20 73 65 63 6f 6e 64 20 62 79 74 65 2c 20 |et second byte, | 000008d0 61 6e 64 20 73 75 70 70 6c 79 20 72 65 73 75 6c |and supply resul| 000008e0 74 20 61 73 20 62 79 74 65 20 73 69 7a 65 20 2a |t as byte size *| 000008f0 2f 0a 20 20 20 20 20 20 20 20 6d 61 73 6b 20 3c |/. mask <| 00000900 3c 3d 20 38 3b 0a 20 20 20 20 20 20 20 20 62 6c |<= 8;. bl| 00000910 6f 63 6b 5b 69 6e 64 65 78 2b 2b 5d 20 3d 20 28 |ock[index++] = (| 00000920 63 68 61 72 29 20 28 28 69 6e 70 75 74 20 26 20 |char) ((input & | 00000930 6d 61 73 6b 29 20 3e 3e 20 38 29 3b 0a 20 20 20 |mask) >> 8);. | 00000940 20 20 20 20 20 6d 61 73 6b 20 3c 3c 3d 20 38 3b | mask <<= 8;| 00000950 0a 20 20 20 20 20 20 20 20 62 6c 6f 63 6b 5b 69 |. block[i| 00000960 6e 64 65 78 2b 2b 5d 20 3d 20 28 63 68 61 72 29 |ndex++] = (char)| 00000970 20 28 28 69 6e 70 75 74 20 26 20 6d 61 73 6b 29 | ((input & mask)| 00000980 20 3e 3e 20 31 36 29 3b 0a 20 20 20 20 20 20 20 | >> 16);. | 00000990 20 6d 61 73 6b 20 3c 3c 3d 20 38 3b 0a 20 20 20 | mask <<= 8;. | 000009a0 20 20 20 20 20 62 6c 6f 63 6b 5b 69 6e 64 65 78 | block[index| 000009b0 2b 2b 5d 20 3d 20 28 63 68 61 72 29 20 28 28 69 |++] = (char) ((i| 000009c0 6e 70 75 74 20 26 20 6d 61 73 6b 29 20 3e 3e 20 |nput & mask) >> | 000009d0 32 34 29 3b 0a 0a 20 20 20 20 20 20 20 20 72 65 |24);.. re| 000009e0 74 75 72 6e 3b 0a 7d 0a 0a 75 6e 73 69 67 6e 65 |turn;.}..unsigne| 000009f0 64 20 6c 6f 6e 67 20 69 6e 74 0a 61 75 5f 62 79 |d long int.au_by| 00000a00 74 65 74 6f 77 6f 72 64 28 75 6e 73 69 67 6e 65 |tetoword(unsigne| 00000a10 64 20 63 68 61 72 20 62 6c 6f 63 6b 5b 5d 2c 20 |d char block[], | 00000a20 69 6e 74 20 69 6e 64 65 78 29 0a 7b 0a 20 20 20 |int index).{. | 00000a30 20 20 20 20 20 75 6e 73 69 67 6e 65 64 20 6c 6f | unsigned lo| 00000a40 6e 67 20 69 6e 74 20 72 65 73 75 6c 74 20 3d 20 |ng int result = | 00000a50 30 3b 0a 20 20 20 20 20 20 20 20 69 6e 74 20 6c |0;. int l| 00000a60 6f 6f 70 3b 0a 0a 20 20 20 20 20 20 20 20 2f 2a |oop;.. /*| 00000a70 20 54 68 69 73 20 72 6f 75 74 69 6e 65 20 74 61 | This routine ta| 00000a80 6b 65 73 20 61 20 64 61 74 61 20 62 6c 6f 63 6b |kes a data block| 00000a90 20 61 6e 64 20 61 20 73 74 61 72 74 69 6e 67 20 | and a starting | 00000aa0 62 79 74 65 2c 20 61 6e 64 20 63 6f 6e 76 65 72 |byte, and conver| 00000ab0 74 73 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 |ts the. | 00000ac0 2a 20 6e 65 78 74 20 66 6f 75 72 20 62 79 74 65 |* next four byte| 00000ad0 73 20 69 6e 74 6f 20 61 20 77 6f 72 64 20 2d 20 |s into a word - | 00000ae0 77 65 20 68 61 76 65 20 74 6f 20 73 74 61 72 74 |we have to start| 00000af0 20 61 74 20 74 68 65 20 6d 6f 73 74 20 73 69 67 | at the most sig| 00000b00 6e 69 66 69 63 61 6e 74 0a 20 20 20 20 20 20 20 |nificant. | 00000b10 20 20 2a 20 62 79 74 65 20 61 6e 64 20 77 6f 72 | * byte and wor| 00000b20 6b 20 62 61 63 6b 77 61 72 64 73 20 2a 2f 0a 0a |k backwards */..| 00000b30 20 20 20 20 20 20 20 20 69 6e 64 65 78 20 2b 3d | index +=| 00000b40 20 33 3b 0a 20 20 20 20 20 20 20 20 72 65 73 75 | 3;. resu| 00000b50 6c 74 20 3d 20 62 6c 6f 63 6b 5b 69 6e 64 65 78 |lt = block[index| 00000b60 2d 2d 5d 3b 0a 20 20 20 20 20 20 20 20 66 6f 72 |--];. for| 00000b70 28 6c 6f 6f 70 20 3d 20 30 3b 20 6c 6f 6f 70 20 |(loop = 0; loop | 00000b80 3c 20 33 3b 20 6c 6f 6f 70 2b 2b 29 20 7b 0a 20 |< 3; loop++) {. | 00000b90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 | r| 00000ba0 65 73 75 6c 74 20 3d 20 72 65 73 75 6c 74 20 3c |esult = result <| 00000bb0 3c 20 38 3b 20 2f 2a 20 74 68 69 73 20 73 68 69 |< 8; /* this shi| 00000bc0 66 74 73 20 62 69 74 73 20 69 6e 20 72 65 73 75 |fts bits in resu| 00000bd0 6c 74 20 6c 65 66 74 20 62 79 20 38 20 73 70 61 |lt left by 8 spa| 00000be0 63 65 73 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 |ces */. | 00000bf0 20 20 20 20 20 20 20 72 65 73 75 6c 74 20 2b 3d | result +=| 00000c00 20 62 6c 6f 63 6b 5b 69 6e 64 65 78 2d 2d 5d 3b | block[index--];| 00000c10 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 |. }.. | 00000c20 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c | return resul| 00000c30 74 3b 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 6f 70 |t;.}..void.au_op| 00000c40 65 6e 74 65 6d 70 6c 61 74 65 28 63 68 61 72 20 |entemplate(char | 00000c50 2a 66 69 6c 65 6e 61 6d 65 29 0a 7b 0a 20 20 20 |*filename).{. | 00000c60 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 | _kernel_swi| 00000c70 5f 72 65 67 73 20 20 20 20 20 20 20 20 72 65 67 |_regs reg| 00000c80 73 5f 69 6e 2c 20 72 65 67 73 5f 6f 75 74 3b 0a |s_in, regs_out;.| 00000c90 20 20 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2e | regs_in.| 00000ca0 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 66 69 6c |r[1] = (int) fil| 00000cb0 65 6e 61 6d 65 3b 0a 20 20 20 20 20 20 20 20 5f |ename;. _| 00000cc0 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f |kernel_swi(Wimp_| 00000cd0 4f 70 65 6e 54 65 6d 70 6c 61 74 65 2c 20 26 72 |OpenTemplate, &r| 00000ce0 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f 6f 75 |egs_in, ®s_ou| 00000cf0 74 29 3b 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 63 |t);.}..void.au_c| 00000d00 6c 6f 73 65 74 65 6d 70 6c 61 74 65 28 76 6f 69 |losetemplate(voi| 00000d10 64 29 0a 7b 0a 20 20 20 20 20 20 20 20 5f 6b 65 |d).{. _ke| 00000d20 72 6e 65 6c 5f 73 77 69 5f 72 65 67 73 20 20 20 |rnel_swi_regs | 00000d30 20 20 20 20 20 72 65 67 73 5f 69 6e 2c 20 72 65 | regs_in, re| 00000d40 67 73 5f 6f 75 74 3b 0a 20 20 20 20 20 20 20 20 |gs_out;. | 00000d50 2f 2a 20 4e 6f 20 64 61 74 61 20 6e 65 65 64 65 |/* No data neede| 00000d60 64 20 66 6f 72 20 43 6c 6f 73 65 54 65 6d 70 6c |d for CloseTempl| 00000d70 61 74 65 20 2a 2f 0a 20 20 20 20 20 20 20 20 5f |ate */. _| 00000d80 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f |kernel_swi(Wimp_| 00000d90 43 6c 6f 73 65 54 65 6d 70 6c 61 74 65 2c 20 26 |CloseTemplate, &| 00000da0 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f 6f |regs_in, ®s_o| 00000db0 75 74 29 3b 0a 7d 0a 0a 69 6e 74 0a 61 75 5f 6c |ut);.}..int.au_l| 00000dc0 6f 61 64 74 65 6d 70 6c 61 74 65 28 63 68 61 72 |oadtemplate(char| 00000dd0 20 2a 74 65 6d 70 6c 61 74 65 5f 6e 61 6d 65 2c | *template_name,| 00000de0 20 77 69 6e 64 6f 77 5f 64 61 74 61 20 2a 77 69 | window_data *wi| 00000df0 6e 5f 64 61 74 61 2c 20 69 6e 74 20 63 61 6c 6c |n_data, int call| 00000e00 29 0a 7b 0a 20 20 20 20 20 20 20 20 5f 6b 65 72 |).{. _ker| 00000e10 6e 65 6c 5f 73 77 69 5f 72 65 67 73 20 20 20 20 |nel_swi_regs | 00000e20 20 20 20 20 72 65 67 73 5f 69 6e 2c 20 72 65 67 | regs_in, reg| 00000e30 73 5f 6f 75 74 3b 0a 20 20 20 20 20 20 20 20 69 |s_out;. i| 00000e40 6e 74 20 20 20 20 20 77 6f 72 6b 73 70 61 63 65 |nt workspace| 00000e50 5f 6c 65 6e 67 74 68 20 3d 20 30 3b 0a 20 20 20 |_length = 0;. | 00000e60 20 20 20 20 20 69 6e 74 20 20 20 20 20 6e 65 78 | int nex| 00000e70 74 5f 65 6e 74 72 79 3b 0a 0a 20 20 20 20 20 20 |t_entry;.. | 00000e80 20 20 2f 2a 20 69 6e 74 65 72 72 6f 67 61 74 65 | /* interrogate| 00000e90 20 66 69 6c 65 20 74 6f 20 66 69 6e 64 20 6f 75 | file to find ou| 00000ea0 74 20 68 6f 77 20 6d 75 63 68 20 73 70 61 63 65 |t how much space| 00000eb0 20 77 65 20 6e 65 65 64 20 2a 2f 0a 20 20 20 20 | we need */. | 00000ec0 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b 31 5d | regs_in.r[1]| 00000ed0 20 3d 20 30 3b 20 2f 2a 20 74 65 6c 6c 20 53 57 | = 0; /* tell SW| 00000ee0 49 20 74 6f 20 66 69 6e 64 20 73 69 7a 65 73 20 |I to find sizes | 00000ef0 2a 2f 0a 20 20 20 20 20 20 20 20 72 65 67 73 5f |*/. regs_| 00000f00 69 6e 2e 72 5b 35 5d 20 3d 20 28 69 6e 74 29 20 |in.r[5] = (int) | 00000f10 74 65 6d 70 6c 61 74 65 5f 6e 61 6d 65 3b 20 2f |template_name; /| 00000f20 2a 20 70 61 73 73 20 6e 61 6d 65 20 74 6f 20 53 |* pass name to S| 00000f30 57 49 20 2a 2f 0a 20 20 20 20 20 20 20 20 72 65 |WI */. re| 00000f40 67 73 5f 69 6e 2e 72 5b 36 5d 20 3d 20 63 61 6c |gs_in.r[6] = cal| 00000f50 6c 3b 20 2f 2a 20 30 20 66 6f 72 20 66 69 72 73 |l; /* 0 for firs| 00000f60 74 20 63 61 6c 6c 20 2a 2f 0a 0a 20 20 20 20 20 |t call */.. | 00000f70 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 | _kernel_swi(W| 00000f80 69 6d 70 5f 4c 6f 61 64 54 65 6d 70 6c 61 74 65 |imp_LoadTemplate| 00000f90 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 |, ®s_in, ®| 00000fa0 73 5f 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 20 |s_out);. | 00000fb0 77 69 6e 5f 64 61 74 61 2d 3e 62 75 66 66 65 72 |win_data->buffer| 00000fc0 20 3d 20 63 61 6c 6c 6f 63 28 72 65 67 73 5f 6f | = calloc(regs_o| 00000fd0 75 74 2e 72 5b 31 5d 2c 20 73 69 7a 65 6f 66 28 |ut.r[1], sizeof(| 00000fe0 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29 29 3b |unsigned char));| 00000ff0 0a 20 20 20 20 20 20 20 20 77 6f 72 6b 73 70 61 |. workspa| 00001000 63 65 5f 6c 65 6e 67 74 68 20 3d 20 72 65 67 73 |ce_length = regs| 00001010 5f 6f 75 74 2e 72 5b 32 5d 3b 20 2f 2a 20 65 72 |_out.r[2]; /* er| 00001020 72 20 6f 6e 20 73 69 64 65 20 6f 66 20 63 61 75 |r on side of cau| 00001030 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 20 20 |tion */. | 00001040 77 69 6e 5f 64 61 74 61 2d 3e 77 6f 72 6b 73 70 |win_data->worksp| 00001050 61 63 65 20 3d 20 63 61 6c 6c 6f 63 28 77 6f 72 |ace = calloc(wor| 00001060 6b 73 70 61 63 65 5f 6c 65 6e 67 74 68 2c 20 73 |kspace_length, s| 00001070 69 7a 65 6f 66 28 75 6e 73 69 67 6e 65 64 20 63 |izeof(unsigned c| 00001080 68 61 72 29 29 3b 0a 20 20 20 20 20 20 20 20 77 |har));. w| 00001090 69 6e 5f 64 61 74 61 2d 3e 77 69 6e 5f 6e 61 6d |in_data->win_nam| 000010a0 65 20 3d 20 63 61 6c 6c 6f 63 28 73 74 72 6c 65 |e = calloc(strle| 000010b0 6e 28 20 28 63 68 61 72 20 2a 29 20 72 65 67 73 |n( (char *) regs| 000010c0 5f 6f 75 74 2e 72 5b 35 5d 29 2c 20 73 69 7a 65 |_out.r[5]), size| 000010d0 6f 66 28 63 68 61 72 29 29 3b 0a 20 20 20 20 20 |of(char));. | 000010e0 20 20 20 73 74 72 63 70 79 28 77 69 6e 5f 64 61 | strcpy(win_da| 000010f0 74 61 2d 3e 77 69 6e 5f 6e 61 6d 65 2c 20 28 63 |ta->win_name, (c| 00001100 68 61 72 20 2a 29 20 72 65 67 73 5f 6f 75 74 2e |har *) regs_out.| 00001110 72 5b 35 5d 29 3b 0a 0a 20 20 20 20 20 20 20 20 |r[5]);.. | 00001120 2f 2a 20 4e 6f 77 20 72 65 6c 6f 61 64 20 74 65 |/* Now reload te| 00001130 6d 70 6c 61 74 65 20 66 72 6f 6d 20 66 69 6c 65 |mplate from file| 00001140 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 2a 2f 0a | into memory */.| 00001150 20 20 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2e | regs_in.| 00001160 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 77 69 6e |r[1] = (int) win| 00001170 5f 64 61 74 61 2d 3e 62 75 66 66 65 72 3b 0a 20 |_data->buffer;. | 00001180 20 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 | regs_in.r| 00001190 5b 32 5d 20 3d 20 28 69 6e 74 29 20 77 69 6e 5f |[2] = (int) win_| 000011a0 64 61 74 61 2d 3e 77 6f 72 6b 73 70 61 63 65 3b |data->workspace;| 000011b0 0a 20 20 20 20 20 20 20 20 72 65 67 73 5f 69 6e |. regs_in| 000011c0 2e 72 5b 33 5d 20 3d 20 28 69 6e 74 29 20 77 69 |.r[3] = (int) wi| 000011d0 6e 5f 64 61 74 61 2d 3e 77 6f 72 6b 73 70 61 63 |n_data->workspac| 000011e0 65 20 2b 20 77 6f 72 6b 73 70 61 63 65 5f 6c 65 |e + workspace_le| 000011f0 6e 67 74 68 3b 0a 20 20 20 20 20 20 20 20 72 65 |ngth;. re| 00001200 67 73 5f 69 6e 2e 72 5b 34 5d 20 3d 20 2d 31 3b |gs_in.r[4] = -1;| 00001210 20 2f 2a 20 4e 4f 20 46 4f 4e 54 53 20 43 41 54 | /* NO FONTS CAT| 00001220 45 52 45 44 20 46 4f 52 20 49 4e 20 54 45 4d 50 |ERED FOR IN TEMP| 00001230 4c 41 54 45 53 20 59 45 54 20 2a 2f 0a 20 20 20 |LATES YET */. | 00001240 20 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b 35 | regs_in.r[5| 00001250 5d 20 3d 20 28 69 6e 74 29 20 77 69 6e 5f 64 61 |] = (int) win_da| 00001260 74 61 2d 3e 77 69 6e 5f 6e 61 6d 65 3b 0a 20 20 |ta->win_name;. | 00001270 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b | regs_in.r[| 00001280 36 5d 20 3d 20 63 61 6c 6c 3b 0a 0a 20 20 20 20 |6] = call;.. | 00001290 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 | _kernel_swi(| 000012a0 57 69 6d 70 5f 4c 6f 61 64 54 65 6d 70 6c 61 74 |Wimp_LoadTemplat| 000012b0 65 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |e, ®s_in, &re| 000012c0 67 73 5f 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 |gs_out);. | 000012d0 20 6e 65 78 74 5f 65 6e 74 72 79 20 3d 20 72 65 | next_entry = re| 000012e0 67 73 5f 6f 75 74 2e 72 5b 36 5d 3b 0a 0a 20 20 |gs_out.r[6];.. | 000012f0 20 20 20 20 20 20 2f 2a 20 43 72 65 61 74 65 20 | /* Create | 00001300 74 68 65 20 77 69 6e 64 6f 77 2c 20 73 74 6f 72 |the window, stor| 00001310 65 20 77 69 6e 64 6f 77 20 68 61 6e 64 6c 65 20 |e window handle | 00001320 2a 2f 0a 20 20 20 20 20 20 20 20 72 65 67 73 5f |*/. regs_| 00001330 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 |in.r[1] = (int) | 00001340 77 69 6e 5f 64 61 74 61 2d 3e 62 75 66 66 65 72 |win_data->buffer| 00001350 3b 0a 20 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 |;. _kerne| 00001360 6c 5f 73 77 69 28 57 69 6d 70 5f 43 72 65 61 74 |l_swi(Wimp_Creat| 00001370 65 57 69 6e 64 6f 77 2c 20 26 72 65 67 73 5f 69 |eWindow, ®s_i| 00001380 6e 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a 20 |n, ®s_out);. | 00001390 20 20 20 20 20 20 20 77 69 6e 5f 64 61 74 61 2d | win_data-| 000013a0 3e 77 69 6e 5f 68 61 6e 64 6c 65 20 3d 20 72 65 |>win_handle = re| 000013b0 67 73 5f 6f 75 74 2e 72 5b 30 5d 3b 0a 20 20 20 |gs_out.r[0];. | 000013c0 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 78 74 | return next| 000013d0 5f 65 6e 74 72 79 3b 20 2f 2a 20 69 6e 20 63 61 |_entry; /* in ca| 000013e0 73 65 20 6f 66 20 77 69 6c 64 63 61 72 64 65 64 |se of wildcarded| 000013f0 20 73 65 61 72 63 68 65 73 20 2a 2f 0a 7d 0a 0a | searches */.}..| 00001400 69 6e 74 0a 61 75 5f 72 65 70 6f 72 74 5f 65 72 |int.au_report_er| 00001410 72 6f 72 28 69 6e 74 20 65 72 72 6e 6f 2c 20 63 |ror(int errno, c| 00001420 68 61 72 20 2a 65 72 72 6d 65 73 73 2c 20 69 6e |har *errmess, in| 00001430 74 20 66 6c 61 67 73 2c 20 63 68 61 72 20 2a 61 |t flags, char *a| 00001440 70 70 5f 6e 61 6d 65 29 0a 7b 0a 20 20 20 75 6e |pp_name).{. un| 00001450 73 69 67 6e 65 64 20 63 68 61 72 20 65 72 72 6f |signed char erro| 00001460 72 62 6c 6f 63 6b 5b 32 36 30 5d 3b 0a 20 20 20 |rblock[260];. | 00001470 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 73 |_kernel_swi_regs| 00001480 20 69 6e 2c 20 6f 75 74 3b 0a 0a 20 20 20 2f 2a | in, out;.. /*| 00001490 20 53 65 74 20 75 70 20 74 68 65 20 73 74 61 6e | Set up the stan| 000014a0 64 61 72 64 20 65 72 72 6f 72 20 62 6c 6f 63 6b |dard error block| 000014b0 20 77 69 74 68 20 74 68 65 20 65 72 72 6f 72 20 | with the error | 000014c0 6e 75 6d 62 65 72 20 61 6e 64 20 6d 65 73 73 61 |number and messa| 000014d0 67 65 0a 20 20 20 20 20 20 28 7a 65 72 6f 20 74 |ge. (zero t| 000014e0 65 72 6d 69 6e 61 74 65 64 29 20 2a 2f 0a 20 20 |erminated) */. | 000014f0 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 65 | au_wordtobyte(e| 00001500 72 72 6e 6f 2c 20 65 72 72 6f 72 62 6c 6f 63 6b |rrno, errorblock| 00001510 2c 20 30 29 3b 0a 20 20 20 73 74 72 63 70 79 28 |, 0);. strcpy(| 00001520 20 28 63 68 61 72 20 2a 29 20 26 65 72 72 6f 72 | (char *) &error| 00001530 62 6c 6f 63 6b 5b 34 5d 2c 20 65 72 72 6d 65 73 |block[4], errmes| 00001540 73 29 3b 0a 0a 20 20 20 2f 2a 20 52 30 20 2d 20 |s);.. /* R0 - | 00001550 70 6f 69 6e 74 65 72 20 74 6f 20 73 74 61 6e 64 |pointer to stand| 00001560 61 72 64 20 65 72 72 6f 72 20 62 6c 6f 63 6b 0a |ard error block.| 00001570 20 20 20 20 20 20 52 31 20 2d 20 65 72 72 6f 72 | R1 - error| 00001580 20 77 69 6e 64 6f 77 20 66 6c 61 67 73 0a 20 20 | window flags. | 00001590 20 20 20 20 52 32 20 2d 20 70 6f 69 6e 74 65 72 | R2 - pointer| 000015a0 20 74 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 | to application | 000015b0 6e 61 6d 65 20 66 6f 72 20 65 72 72 6f 72 20 62 |name for error b| 000015c0 6f 78 20 74 69 74 6c 65 20 2a 2f 0a 0a 20 20 20 |ox title */.. | 000015d0 69 6e 2e 72 5b 30 5d 20 3d 20 28 69 6e 74 29 20 |in.r[0] = (int) | 000015e0 65 72 72 6f 72 62 6c 6f 63 6b 3b 0a 20 20 20 69 |errorblock;. i| 000015f0 6e 2e 72 5b 31 5d 20 3d 20 66 6c 61 67 73 3b 0a |n.r[1] = flags;.| 00001600 20 20 20 69 6e 2e 72 5b 32 5d 20 3d 20 28 69 6e | in.r[2] = (in| 00001610 74 29 20 61 70 70 5f 6e 61 6d 65 3b 0a 0a 20 20 |t) app_name;.. | 00001620 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d | _kernel_swi(Wim| 00001630 70 5f 52 65 70 6f 72 74 45 72 72 6f 72 2c 20 26 |p_ReportError, &| 00001640 69 6e 2c 20 26 6f 75 74 29 3b 0a 0a 20 20 20 2f |in, &out);.. /| 00001650 2a 20 52 65 74 75 72 6e 73 20 31 20 69 66 20 4f |* Returns 1 if O| 00001660 4b 20 73 65 6c 65 63 74 65 64 2c 20 32 20 69 66 |K selected, 2 if| 00001670 20 43 61 6e 63 65 6c 20 73 65 6c 65 63 74 65 64 | Cancel selected| 00001680 20 2a 2f 0a 20 20 20 72 65 74 75 72 6e 20 6f 75 | */. return ou| 00001690 74 2e 72 5b 31 5d 3b 0a 7d 0a 0a 76 6f 69 64 0a |t.r[1];.}..void.| 000016a0 61 75 5f 6f 70 65 6e 77 69 6e 5f 66 72 6f 6d 5f |au_openwin_from_| 000016b0 74 65 6d 70 6c 61 74 65 64 61 74 61 28 77 69 6e |templatedata(win| 000016c0 64 6f 77 5f 64 61 74 61 20 2a 77 69 6e 5f 64 61 |dow_data *win_da| 000016d0 74 61 2c 20 6c 6f 6e 67 20 69 6e 74 20 70 6f 73 |ta, long int pos| 000016e0 69 74 69 6f 6e 29 0a 7b 0a 20 20 20 20 20 20 20 |ition).{. | 000016f0 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 | _kernel_swi_reg| 00001700 73 20 20 20 20 20 20 20 20 72 65 67 73 5f 69 6e |s regs_in| 00001710 2c 20 72 65 67 73 5f 6f 75 74 3b 0a 20 20 20 20 |, regs_out;. | 00001720 20 20 20 20 75 6e 73 69 67 6e 65 64 20 63 68 61 | unsigned cha| 00001730 72 20 20 20 6f 70 65 6e 77 69 6e 64 6f 77 5f 62 |r openwindow_b| 00001740 75 66 66 65 72 5b 33 36 5d 3b 0a 20 20 20 20 20 |uffer[36];. | 00001750 20 20 20 69 6e 74 20 20 20 20 20 69 3b 0a 0a 20 | int i;.. | 00001760 20 20 20 20 20 20 20 61 75 5f 77 6f 72 64 74 6f | au_wordto| 00001770 62 79 74 65 28 20 28 75 6e 73 69 67 6e 65 64 20 |byte( (unsigned | 00001780 6c 6f 6e 67 20 69 6e 74 29 20 77 69 6e 5f 64 61 |long int) win_da| 00001790 74 61 2d 3e 77 69 6e 5f 68 61 6e 64 6c 65 2c 20 |ta->win_handle, | 000017a0 6f 70 65 6e 77 69 6e 64 6f 77 5f 62 75 66 66 65 |openwindow_buffe| 000017b0 72 2c 20 30 29 3b 0a 20 20 20 20 20 20 20 20 66 |r, 0);. f| 000017c0 6f 72 28 69 20 3d 20 30 3b 20 69 20 3c 20 36 3b |or(i = 0; i < 6;| 000017d0 20 69 2b 2b 29 20 7b 0a 20 20 20 20 20 20 20 20 | i++) {. | 000017e0 20 20 20 20 20 20 20 20 61 75 5f 77 6f 72 64 74 | au_wordt| 000017f0 6f 62 79 74 65 28 61 75 5f 62 79 74 65 74 6f 77 |obyte(au_bytetow| 00001800 6f 72 64 28 77 69 6e 5f 64 61 74 61 2d 3e 62 75 |ord(win_data->bu| 00001810 66 66 65 72 2c 20 69 2a 34 29 2c 20 6f 70 65 6e |ffer, i*4), open| 00001820 77 69 6e 64 6f 77 5f 62 75 66 66 65 72 2c 20 28 |window_buffer, (| 00001830 69 2b 31 29 20 2a 20 34 29 3b 0a 20 20 20 20 20 |i+1) * 4);. | 00001840 20 20 20 7d 0a 20 20 20 20 20 20 20 20 61 75 5f | }. au_| 00001850 77 6f 72 64 74 6f 62 79 74 65 28 70 6f 73 69 74 |wordtobyte(posit| 00001860 69 6f 6e 2c 20 6f 70 65 6e 77 69 6e 64 6f 77 5f |ion, openwindow_| 00001870 62 75 66 66 65 72 2c 20 32 38 29 3b 0a 20 20 20 |buffer, 28);. | 00001880 20 20 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b 31 | regs_in.r[1| 00001890 5d 20 3d 20 28 69 6e 74 29 20 6f 70 65 6e 77 69 |] = (int) openwi| 000018a0 6e 64 6f 77 5f 62 75 66 66 65 72 3b 0a 20 20 20 |ndow_buffer;. | 000018b0 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 | _kernel_swi| 000018c0 28 57 69 6d 70 5f 4f 70 65 6e 57 69 6e 64 6f 77 |(Wimp_OpenWindow| 000018d0 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 |, ®s_in, ®| 000018e0 73 5f 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 20 |s_out);. | 000018f0 72 65 74 75 72 6e 3b 0a 7d 0a 0a 69 6e 74 0a 61 |return;.}..int.a| 00001900 75 5f 77 69 6d 70 5f 70 6f 6c 6c 28 69 6e 74 20 |u_wimp_poll(int | 00001910 70 6f 6c 6c 6d 61 73 6b 2c 20 75 6e 73 69 67 6e |pollmask, unsign| 00001920 65 64 20 63 68 61 72 20 2a 70 6f 6c 6c 62 6c 6f |ed char *pollblo| 00001930 63 6b 29 0a 7b 0a 20 20 20 20 20 20 20 20 5f 6b |ck).{. _k| 00001940 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 73 20 20 |ernel_swi_regs | 00001950 20 20 20 20 20 20 72 65 67 73 5f 69 6e 2c 20 72 | regs_in, r| 00001960 65 67 73 5f 6f 75 74 3b 0a 0a 20 20 20 20 20 20 |egs_out;.. | 00001970 20 20 72 65 67 73 5f 69 6e 2e 72 5b 30 5d 20 3d | regs_in.r[0] =| 00001980 20 70 6f 6c 6c 6d 61 73 6b 3b 0a 20 20 20 20 20 | pollmask;. | 00001990 20 20 20 72 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 | regs_in.r[1] | 000019a0 3d 20 28 69 6e 74 29 20 70 6f 6c 6c 62 6c 6f 63 |= (int) pollbloc| 000019b0 6b 3b 0a 0a 20 20 20 20 20 20 20 20 5f 6b 65 72 |k;.. _ker| 000019c0 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f 50 6f 6c |nel_swi(Wimp_Pol| 000019d0 6c 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |l, ®s_in, &re| 000019e0 67 73 5f 6f 75 74 29 3b 0a 20 20 20 20 20 20 20 |gs_out);. | 000019f0 20 72 65 74 75 72 6e 20 72 65 67 73 5f 6f 75 74 | return regs_out| 00001a00 2e 72 5b 30 5d 3b 20 2f 2a 20 52 65 74 75 72 6e |.r[0]; /* Return| 00001a10 20 74 68 65 20 65 76 65 6e 74 20 63 6f 64 65 20 | the event code | 00001a20 2a 2f 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 69 63 |*/.}..void.au_ic| 00001a30 6f 6e 5f 74 65 78 74 5f 63 68 61 6e 67 65 28 63 |on_text_change(c| 00001a40 68 61 72 20 2a 74 65 78 74 2c 20 75 6e 73 69 67 |har *text, unsig| 00001a50 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 20 77 69 6e |ned long int win| 00001a60 5f 68 2c 20 75 6e 73 69 67 6e 65 64 20 6c 6f 6e |_h, unsigned lon| 00001a70 67 20 69 6e 74 20 69 63 6f 6e 5f 68 29 0a 7b 0a |g int icon_h).{.| 00001a80 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 | _kernel_swi_r| 00001a90 65 67 73 20 72 65 67 73 5f 69 6e 2c 20 72 65 67 |egs regs_in, reg| 00001aa0 73 5f 6f 75 74 3b 0a 20 20 20 63 68 61 72 20 2a |s_out;. char *| 00001ab0 74 65 78 74 5f 70 6f 69 6e 74 65 72 3b 0a 20 20 |text_pointer;. | 00001ac0 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 74 | unsigned char t| 00001ad0 65 6d 70 5f 62 75 66 66 65 72 5b 32 35 35 5d 3b |emp_buffer[255];| 00001ae0 0a 0a 20 20 20 2f 2a 20 46 69 6e 64 20 6f 75 74 |.. /* Find out| 00001af0 20 77 68 65 72 65 20 74 68 65 20 69 63 6f 6e 27 | where the icon'| 00001b00 73 20 69 6e 64 69 72 65 63 74 65 64 20 74 65 78 |s indirected tex| 00001b10 74 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 6d |t is stored in m| 00001b20 65 6d 6f 72 79 20 61 6e 64 20 63 6f 70 79 0a 20 |emory and copy. | 00001b30 20 20 20 20 20 61 20 6e 65 77 20 73 74 72 69 6e | a new strin| 00001b40 67 20 74 6f 20 69 74 20 2a 2f 0a 20 20 20 74 65 |g to it */. te| 00001b50 78 74 5f 70 6f 69 6e 74 65 72 20 3d 20 61 75 5f |xt_pointer = au_| 00001b60 67 65 74 5f 70 74 72 5f 74 6f 5f 69 63 6f 6e 74 |get_ptr_to_icont| 00001b70 65 78 74 28 77 69 6e 5f 68 2c 20 69 63 6f 6e 5f |ext(win_h, icon_| 00001b80 68 29 3b 0a 20 20 20 73 74 72 63 70 79 28 74 65 |h);. strcpy(te| 00001b90 78 74 5f 70 6f 69 6e 74 65 72 2c 20 74 65 78 74 |xt_pointer, text| 00001ba0 29 3b 0a 0a 20 20 20 2f 2a 20 4e 6f 77 20 77 65 |);.. /* Now we| 00001bb0 20 6e 65 65 64 20 74 6f 20 69 6e 66 6f 72 6d 20 | need to inform | 00001bc0 74 68 65 20 57 49 4d 50 20 74 68 61 74 20 74 68 |the WIMP that th| 00001bd0 65 20 69 63 6f 6e 20 6e 65 65 64 73 20 72 65 64 |e icon needs red| 00001be0 72 61 77 69 6e 67 20 62 79 20 73 65 74 74 69 6e |rawing by settin| 00001bf0 67 0a 20 20 20 20 20 20 74 68 65 20 69 63 6f 6e |g. the icon| 00001c00 20 66 6c 61 67 73 20 2d 20 77 65 20 64 6f 6e 27 | flags - we don'| 00001c10 74 20 61 63 74 75 61 6c 6c 79 20 63 68 61 6e 67 |t actually chang| 00001c20 65 20 74 68 65 6d 20 77 69 74 68 20 74 68 69 73 |e them with this| 00001c30 20 63 61 6c 6c 2c 20 62 75 74 20 74 68 69 73 0a | call, but this.| 00001c40 20 20 20 20 20 20 73 70 75 72 73 20 74 68 65 20 | spurs the | 00001c50 57 49 4d 50 20 69 6e 74 6f 20 61 63 74 69 6f 6e |WIMP into action| 00001c60 20 2a 2f 0a 0a 20 20 20 61 75 5f 77 6f 72 64 74 | */.. au_wordt| 00001c70 6f 62 79 74 65 28 77 69 6e 5f 68 2c 20 74 65 6d |obyte(win_h, tem| 00001c80 70 5f 62 75 66 66 65 72 2c 20 30 29 3b 0a 20 20 |p_buffer, 0);. | 00001c90 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 69 | au_wordtobyte(i| 00001ca0 63 6f 6e 5f 68 2c 20 74 65 6d 70 5f 62 75 66 66 |con_h, temp_buff| 00001cb0 65 72 2c 20 34 29 3b 0a 20 20 20 61 75 5f 77 6f |er, 4);. au_wo| 00001cc0 72 64 74 6f 62 79 74 65 28 30 2c 20 74 65 6d 70 |rdtobyte(0, temp| 00001cd0 5f 62 75 66 66 65 72 2c 20 38 29 3b 0a 20 20 20 |_buffer, 8);. | 00001ce0 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 30 2c |au_wordtobyte(0,| 00001cf0 20 74 65 6d 70 5f 62 75 66 66 65 72 2c 20 31 32 | temp_buffer, 12| 00001d00 29 3b 0a 0a 20 20 20 72 65 67 73 5f 69 6e 2e 72 |);.. regs_in.r| 00001d10 5b 31 5d 20 3d 20 28 69 6e 74 29 20 74 65 6d 70 |[1] = (int) temp| 00001d20 5f 62 75 66 66 65 72 3b 0a 0a 20 20 20 5f 6b 65 |_buffer;.. _ke| 00001d30 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f 53 65 |rnel_swi(Wimp_Se| 00001d40 74 49 63 6f 6e 53 74 61 74 65 2c 20 26 72 65 67 |tIconState, ®| 00001d50 73 5f 69 6e 2c 20 26 72 65 67 73 5f 6f 75 74 29 |s_in, ®s_out)| 00001d60 3b 0a 20 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a |;. return;.}..| 00001d70 63 68 61 72 20 2a 0a 61 75 5f 67 65 74 5f 70 74 |char *.au_get_pt| 00001d80 72 5f 74 6f 5f 69 63 6f 6e 74 65 78 74 28 75 6e |r_to_icontext(un| 00001d90 73 69 67 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 20 |signed long int | 00001da0 77 69 6e 68 64 6c 2c 20 75 6e 73 69 67 6e 65 64 |winhdl, unsigned| 00001db0 20 6c 6f 6e 67 20 69 6e 74 20 69 63 6f 6e 68 64 | long int iconhd| 00001dc0 6c 29 0a 7b 0a 20 20 20 2f 2a 20 54 68 69 73 20 |l).{. /* This | 00001dd0 70 72 6f 63 65 64 75 72 65 20 69 6e 74 65 72 72 |procedure interr| 00001de0 6f 67 61 74 65 73 20 61 6e 20 69 63 6f 6e 20 74 |ogates an icon t| 00001df0 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 |o determine the | 00001e00 61 64 64 72 65 73 73 20 77 68 65 72 65 20 69 74 |address where it| 00001e10 73 0a 20 20 20 20 20 20 69 6e 64 69 72 65 63 74 |s. indirect| 00001e20 65 64 20 74 65 78 74 20 64 61 74 61 20 69 73 20 |ed text data is | 00001e30 73 74 6f 72 65 64 20 69 6e 20 6d 65 6d 6f 72 79 |stored in memory| 00001e40 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 69 74 |, and returns it| 00001e50 20 2a 2f 0a 0a 20 20 20 75 6e 73 69 67 6e 65 64 | */.. unsigned| 00001e60 20 63 68 61 72 20 74 65 6d 70 5f 62 75 66 66 65 | char temp_buffe| 00001e70 72 5b 32 35 35 5d 3b 0a 20 20 20 5f 6b 65 72 6e |r[255];. _kern| 00001e80 65 6c 5f 73 77 69 5f 72 65 67 73 20 72 65 67 73 |el_swi_regs regs| 00001e90 5f 69 6e 2c 20 72 65 67 73 5f 6f 75 74 3b 0a 20 |_in, regs_out;. | 00001ea0 20 20 63 68 61 72 20 2a 72 65 73 75 6c 74 3b 0a | char *result;.| 00001eb0 0a 20 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 |. au_wordtobyt| 00001ec0 65 28 77 69 6e 68 64 6c 2c 20 74 65 6d 70 5f 62 |e(winhdl, temp_b| 00001ed0 75 66 66 65 72 2c 20 30 29 3b 0a 20 20 20 61 75 |uffer, 0);. au| 00001ee0 5f 77 6f 72 64 74 6f 62 79 74 65 28 69 63 6f 6e |_wordtobyte(icon| 00001ef0 68 64 6c 2c 20 74 65 6d 70 5f 62 75 66 66 65 72 |hdl, temp_buffer| 00001f00 2c 20 34 29 3b 0a 0a 20 20 20 72 65 67 73 5f 69 |, 4);.. regs_i| 00001f10 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 74 |n.r[1] = (int) t| 00001f20 65 6d 70 5f 62 75 66 66 65 72 3b 0a 20 20 20 5f |emp_buffer;. _| 00001f30 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f |kernel_swi(Wimp_| 00001f40 47 65 74 49 63 6f 6e 53 74 61 74 65 2c 20 26 72 |GetIconState, &r| 00001f50 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f 6f 75 |egs_in, ®s_ou| 00001f60 74 29 3b 0a 0a 20 20 20 72 65 73 75 6c 74 20 3d |t);.. result =| 00001f70 20 28 63 68 61 72 20 2a 29 20 61 75 5f 62 79 74 | (char *) au_byt| 00001f80 65 74 6f 77 6f 72 64 28 74 65 6d 70 5f 62 75 66 |etoword(temp_buf| 00001f90 66 65 72 2c 20 32 38 29 3b 0a 20 20 20 72 65 74 |fer, 28);. ret| 00001fa0 75 72 6e 20 72 65 73 75 6c 74 3b 0a 7d 0a 0a 76 |urn result;.}..v| 00001fb0 6f 69 64 0a 61 75 5f 62 75 69 6c 64 6d 65 6e 75 |oid.au_buildmenu| 00001fc0 28 63 68 61 72 20 2a 74 69 74 6c 65 2c 20 6d 65 |(char *title, me| 00001fd0 6e 75 5f 64 61 74 61 20 2a 6d 65 6e 75 5f 64 61 |nu_data *menu_da| 00001fe0 74 29 0a 7b 0a 20 20 20 20 20 20 20 20 69 66 28 |t).{. if(| 00001ff0 73 74 72 6c 65 6e 28 74 69 74 6c 65 29 20 3e 20 |strlen(title) > | 00002000 31 31 29 20 72 65 74 75 72 6e 3b 20 2f 2a 20 44 |11) return; /* D| 00002010 6f 20 74 68 69 73 20 6d 6f 72 65 20 6e 65 61 74 |o this more neat| 00002020 6c 79 21 20 2a 2f 0a 20 20 20 20 20 20 20 20 2f |ly! */. /| 00002030 2a 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 6d 65 |* Fill in the me| 00002040 6e 75 20 68 65 61 64 65 72 20 77 69 74 68 20 73 |nu header with s| 00002050 74 61 6e 64 61 72 64 20 69 6e 66 6f 72 6d 61 74 |tandard informat| 00002060 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 20 20 20 73 |ion */. s| 00002070 74 72 63 70 79 28 6d 65 6e 75 5f 64 61 74 2d 3e |trcpy(menu_dat->| 00002080 74 69 74 6c 65 2c 20 74 69 74 6c 65 29 3b 0a 20 |title, title);. | 00002090 20 20 20 20 20 20 20 6d 65 6e 75 5f 64 61 74 2d | menu_dat-| 000020a0 3e 63 6f 6c 6f 75 72 73 20 3d 20 4d 45 4e 55 5f |>colours = MENU_| 000020b0 54 49 54 4c 45 46 4f 52 45 20 7c 20 4d 45 4e 55 |TITLEFORE | MENU| 000020c0 5f 54 49 54 4c 45 42 41 43 4b 20 7c 20 4d 45 4e |_TITLEBACK | MEN| 000020d0 55 5f 57 4f 52 4b 46 4f 52 45 20 7c 20 4d 45 4e |U_WORKFORE | MEN| 000020e0 55 5f 57 4f 52 4b 42 41 43 4b 3b 0a 20 20 20 20 |U_WORKBACK;. | 000020f0 20 20 20 20 6d 65 6e 75 5f 64 61 74 2d 3e 77 69 | menu_dat->wi| 00002100 64 74 68 20 3d 20 4d 45 4e 55 5f 57 49 44 54 48 |dth = MENU_WIDTH| 00002110 3b 0a 20 20 20 20 20 20 20 20 6d 65 6e 75 5f 64 |;. menu_d| 00002120 61 74 2d 3e 68 65 69 67 68 74 20 3d 20 4d 45 4e |at->height = MEN| 00002130 55 5f 48 45 49 47 48 54 3b 0a 20 20 20 20 20 20 |U_HEIGHT;. | 00002140 20 20 6d 65 6e 75 5f 64 61 74 2d 3e 76 65 72 74 | menu_dat->vert| 00002150 5f 67 61 70 20 3d 20 4d 45 4e 55 5f 56 45 52 54 |_gap = MENU_VERT| 00002160 47 41 50 3b 0a 20 20 20 20 20 20 20 20 6d 65 6e |GAP;. men| 00002170 75 5f 64 61 74 2d 3e 6e 65 78 74 5f 6d 65 6e 75 |u_dat->next_menu| 00002180 65 6c 65 6d 20 3d 20 4e 55 4c 4c 3b 0a 20 20 20 |elem = NULL;. | 00002190 20 20 20 20 20 6d 65 6e 75 5f 64 61 74 2d 3e 73 | menu_dat->s| 000021a0 69 7a 65 20 3d 20 73 69 7a 65 6f 66 28 6d 65 6e |ize = sizeof(men| 000021b0 75 5f 64 61 74 61 29 3b 0a 20 20 20 20 20 20 20 |u_data);. | 000021c0 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f 69 64 | return;.}..void| 000021d0 0a 61 75 5f 61 64 64 74 6f 6d 65 6e 75 28 63 68 |.au_addtomenu(ch| 000021e0 61 72 20 2a 74 65 78 74 2c 20 6c 6f 6e 67 20 69 |ar *text, long i| 000021f0 6e 74 20 6d 65 6e 75 5f 66 6c 61 67 73 2c 20 6c |nt menu_flags, l| 00002200 6f 6e 67 20 69 6e 74 20 73 75 62 6d 65 6e 75 2c |ong int submenu,| 00002210 20 6c 6f 6e 67 20 69 6e 74 20 69 63 6f 6e 5f 66 | long int icon_f| 00002220 6c 61 67 73 2c 20 6d 65 6e 75 5f 64 61 74 61 20 |lags, menu_data | 00002230 2a 6d 65 6e 75 5f 64 61 74 29 0a 7b 0a 20 20 20 |*menu_dat).{. | 00002240 20 20 20 20 20 6d 65 6e 75 5f 65 6c 65 6d 65 6e | menu_elemen| 00002250 74 20 2a 70 6f 69 6e 74 65 72 3b 0a 0a 20 20 20 |t *pointer;.. | 00002260 20 20 20 20 20 69 66 28 73 74 72 6c 65 6e 28 74 | if(strlen(t| 00002270 65 78 74 29 20 3e 20 31 31 29 20 72 65 74 75 72 |ext) > 11) retur| 00002280 6e 3b 0a 20 20 20 20 20 20 20 20 2f 2a 20 57 6f |n;. /* Wo| 00002290 72 6b 20 6f 75 72 20 77 61 79 20 74 6f 20 65 6e |rk our way to en| 000022a0 64 20 6f 66 20 6d 65 6e 75 20 6c 69 73 74 20 2a |d of menu list *| 000022b0 2f 0a 20 20 20 20 20 20 20 20 69 66 28 6d 65 6e |/. if(men| 000022c0 75 5f 64 61 74 2d 3e 6e 65 78 74 5f 6d 65 6e 75 |u_dat->next_menu| 000022d0 65 6c 65 6d 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a |elem == NULL) {.| 000022e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000022f0 6d 65 6e 75 5f 64 61 74 2d 3e 6e 65 78 74 5f 6d |menu_dat->next_m| 00002300 65 6e 75 65 6c 65 6d 20 3d 20 63 61 6c 6c 6f 63 |enuelem = calloc| 00002310 28 31 2c 20 73 69 7a 65 6f 66 28 6d 65 6e 75 5f |(1, sizeof(menu_| 00002320 65 6c 65 6d 65 6e 74 29 29 3b 0a 20 20 20 20 20 |element));. | 00002330 20 20 20 20 20 20 20 20 20 20 20 6d 65 6e 75 5f | menu_| 00002340 64 61 74 2d 3e 73 69 7a 65 20 2b 3d 20 73 69 7a |dat->size += siz| 00002350 65 6f 66 28 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 |eof(menu_element| 00002360 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |);. | 00002370 20 20 20 70 6f 69 6e 74 65 72 20 3d 20 6d 65 6e | pointer = men| 00002380 75 5f 64 61 74 2d 3e 6e 65 78 74 5f 6d 65 6e 75 |u_dat->next_menu| 00002390 65 6c 65 6d 3b 0a 20 20 20 20 20 20 20 20 7d 20 |elem;. } | 000023a0 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 |else {. | 000023b0 20 20 20 20 20 20 20 70 6f 69 6e 74 65 72 20 3d | pointer =| 000023c0 20 6d 65 6e 75 5f 64 61 74 2d 3e 6e 65 78 74 5f | menu_dat->next_| 000023d0 6d 65 6e 75 65 6c 65 6d 3b 0a 20 20 20 20 20 20 |menuelem;. | 000023e0 20 20 20 20 20 20 20 20 20 20 77 68 69 6c 65 20 | while | 000023f0 28 70 6f 69 6e 74 65 72 2d 3e 6e 65 78 74 5f 6d |(pointer->next_m| 00002400 65 6e 75 65 6c 65 6d 20 21 3d 20 30 29 20 7b 0a |enuelem != 0) {.| 00002410 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002420 20 20 20 20 20 20 20 20 70 6f 69 6e 74 65 72 20 | pointer | 00002430 3d 20 70 6f 69 6e 74 65 72 2d 3e 6e 65 78 74 5f |= pointer->next_| 00002440 6d 65 6e 75 65 6c 65 6d 3b 0a 20 20 20 20 20 20 |menuelem;. | 00002450 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 | }. | 00002460 20 20 20 20 20 20 20 20 20 20 20 20 70 6f 69 6e | poin| 00002470 74 65 72 2d 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c |ter->next_menuel| 00002480 65 6d 20 3d 20 63 61 6c 6c 6f 63 28 31 2c 20 73 |em = calloc(1, s| 00002490 69 7a 65 6f 66 28 6d 65 6e 75 5f 65 6c 65 6d 65 |izeof(menu_eleme| 000024a0 6e 74 29 29 3b 0a 20 20 20 20 20 20 20 20 20 20 |nt));. | 000024b0 20 20 20 20 20 20 6d 65 6e 75 5f 64 61 74 2d 3e | menu_dat->| 000024c0 73 69 7a 65 20 2b 3d 20 73 69 7a 65 6f 66 28 6d |size += sizeof(m| 000024d0 65 6e 75 5f 65 6c 65 6d 65 6e 74 29 3b 0a 20 20 |enu_element);. | 000024e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 6f | po| 000024f0 69 6e 74 65 72 20 3d 20 70 6f 69 6e 74 65 72 2d |inter = pointer-| 00002500 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 3b 0a |>next_menuelem;.| 00002510 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 | }. | 00002520 20 20 2f 2a 20 73 65 74 20 75 70 20 64 61 74 61 | /* set up data| 00002530 20 2a 2f 0a 20 20 20 20 20 20 20 20 73 74 72 63 | */. strc| 00002540 70 79 28 70 6f 69 6e 74 65 72 2d 3e 6d 65 6e 75 |py(pointer->menu| 00002550 5f 74 65 78 74 2c 20 74 65 78 74 29 3b 0a 20 20 |_text, text);. | 00002560 20 20 20 20 20 20 70 6f 69 6e 74 65 72 2d 3e 66 | pointer->f| 00002570 6c 61 67 73 20 3d 20 6d 65 6e 75 5f 66 6c 61 67 |lags = menu_flag| 00002580 73 3b 0a 20 20 20 20 20 20 20 20 70 6f 69 6e 74 |s;. point| 00002590 65 72 2d 3e 73 75 62 6d 65 6e 75 20 3d 20 73 75 |er->submenu = su| 000025a0 62 6d 65 6e 75 3b 0a 0a 20 20 20 20 20 20 20 20 |bmenu;.. | 000025b0 2f 2a 20 41 70 70 6c 79 20 73 74 61 6e 64 61 72 |/* Apply standar| 000025c0 64 20 69 63 6f 6e 20 66 6c 61 67 73 20 2a 2f 0a |d icon flags */.| 000025d0 20 20 20 20 20 20 20 20 69 63 6f 6e 5f 66 6c 61 | icon_fla| 000025e0 67 73 20 3d 20 69 63 6f 6e 5f 66 6c 61 67 73 20 |gs = icon_flags | 000025f0 7c 20 4d 45 4e 55 49 54 45 4d 5f 46 4f 52 45 20 || MENUITEM_FORE | 00002600 7c 20 4d 45 4e 55 49 54 45 4d 5f 42 41 43 4b 20 || MENUITEM_BACK | 00002610 7c 20 49 43 4f 4e 5f 49 53 54 45 58 54 20 7c 20 || ICON_ISTEXT | | 00002620 49 43 4f 4e 5f 49 53 46 49 4c 4c 45 44 3b 0a 20 |ICON_ISFILLED;. | 00002630 20 20 20 20 20 20 20 70 6f 69 6e 74 65 72 2d 3e | pointer->| 00002640 6d 65 6e 75 5f 69 63 6f 6e 66 6c 61 67 73 20 3d |menu_iconflags =| 00002650 20 69 63 6f 6e 5f 66 6c 61 67 73 3b 0a 20 20 20 | icon_flags;. | 00002660 20 20 20 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a | return;.}..| 00002670 76 6f 69 64 0a 61 75 5f 63 72 65 61 74 65 6d 65 |void.au_createme| 00002680 6e 75 28 6d 65 6e 75 5f 64 61 74 61 20 2a 6d 65 |nu(menu_data *me| 00002690 6e 75 5f 64 61 74 29 0a 7b 0a 20 20 20 20 20 20 |nu_dat).{. | 000026a0 20 20 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 20 20 | menu_element | 000026b0 20 20 2a 70 6f 69 6e 74 65 72 3b 0a 20 20 20 20 | *pointer;. | 000026c0 20 20 20 20 69 6e 74 20 20 20 20 20 69 3b 0a 0a | int i;..| 000026d0 20 20 20 20 20 20 20 20 2f 2a 20 41 73 73 69 67 | /* Assig| 000026e0 6e 20 6d 65 6d 6f 72 79 20 2a 2f 0a 20 20 20 20 |n memory */. | 000026f0 20 20 20 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 | menu_dat->da| 00002700 74 61 62 6c 6f 63 6b 20 3d 20 63 61 6c 6c 6f 63 |tablock = calloc| 00002710 28 31 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e 73 69 |(1, menu_dat->si| 00002720 7a 65 29 3b 0a 20 20 20 20 20 20 20 20 2f 2a 20 |ze);. /* | 00002730 42 65 67 69 6e 20 63 6f 70 79 69 6e 67 20 64 61 |Begin copying da| 00002740 74 61 20 2a 2f 0a 20 20 20 20 20 20 20 20 73 74 |ta */. st| 00002750 72 63 70 79 28 28 63 68 61 72 20 2a 29 6d 65 6e |rcpy((char *)men| 00002760 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f 63 6b |u_dat->datablock| 00002770 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e 74 69 74 6c |, menu_dat->titl| 00002780 65 29 3b 0a 20 20 20 20 20 20 20 20 2f 2a 61 75 |e);. /*au| 00002790 5f 72 65 70 6f 72 74 5f 65 72 72 6f 72 28 31 2c |_report_error(1,| 000027a0 20 22 62 6c 61 22 2c 20 31 2c 20 22 62 6c 61 22 | "bla", 1, "bla"| 000027b0 29 3b 2a 2f 0a 20 20 20 20 20 20 20 20 61 75 5f |);*/. au_| 000027c0 77 6f 72 64 74 6f 62 79 74 65 28 6d 65 6e 75 5f |wordtobyte(menu_| 000027d0 64 61 74 2d 3e 63 6f 6c 6f 75 72 73 2c 20 6d 65 |dat->colours, me| 000027e0 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f 63 |nu_dat->databloc| 000027f0 6b 2c 20 31 32 29 3b 0a 20 20 20 20 20 20 20 20 |k, 12);. | 00002800 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 6d 65 |au_wordtobyte(me| 00002810 6e 75 5f 64 61 74 2d 3e 77 69 64 74 68 2c 20 6d |nu_dat->width, m| 00002820 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f |enu_dat->datablo| 00002830 63 6b 2c 20 31 36 29 3b 0a 20 20 20 20 20 20 20 |ck, 16);. | 00002840 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 6d | au_wordtobyte(m| 00002850 65 6e 75 5f 64 61 74 2d 3e 68 65 69 67 68 74 2c |enu_dat->height,| 00002860 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 | menu_dat->datab| 00002870 6c 6f 63 6b 2c 20 32 30 29 3b 0a 20 20 20 20 20 |lock, 20);. | 00002880 20 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 | au_wordtobyte| 00002890 28 6d 65 6e 75 5f 64 61 74 2d 3e 76 65 72 74 5f |(menu_dat->vert_| 000028a0 67 61 70 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 |gap, menu_dat->d| 000028b0 61 74 61 62 6c 6f 63 6b 2c 20 32 34 29 3b 0a 20 |atablock, 24);. | 000028c0 20 20 20 20 20 20 20 2f 2a 20 65 6e 64 20 6f 66 | /* end of| 000028d0 20 68 65 61 64 65 72 20 69 6e 66 6f 20 2a 2f 0a | header info */.| 000028e0 20 20 20 20 20 20 20 20 69 20 3d 20 32 38 3b 0a | i = 28;.| 000028f0 0a 20 20 20 20 20 20 20 20 70 6f 69 6e 74 65 72 |. pointer| 00002900 20 3d 20 6d 65 6e 75 5f 64 61 74 2d 3e 6e 65 78 | = menu_dat->nex| 00002910 74 5f 6d 65 6e 75 65 6c 65 6d 3b 0a 0a 20 20 20 |t_menuelem;.. | 00002920 20 20 20 20 20 77 68 69 6c 65 28 70 6f 69 6e 74 | while(point| 00002930 65 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 0a 20 |er != NULL) {.. | 00002940 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 | a| 00002950 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 70 6f 69 |u_wordtobyte(poi| 00002960 6e 74 65 72 2d 3e 66 6c 61 67 73 2c 20 6d 65 6e |nter->flags, men| 00002970 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f 63 6b |u_dat->datablock| 00002980 2c 20 69 29 3b 0a 20 20 20 20 20 20 20 20 20 20 |, i);. | 00002990 20 20 20 20 20 20 69 20 2b 3d 20 34 3b 0a 20 20 | i += 4;. | 000029a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 75 | au| 000029b0 5f 77 6f 72 64 74 6f 62 79 74 65 28 70 6f 69 6e |_wordtobyte(poin| 000029c0 74 65 72 2d 3e 73 75 62 6d 65 6e 75 2c 20 6d 65 |ter->submenu, me| 000029d0 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f 63 |nu_dat->databloc| 000029e0 6b 2c 20 69 29 3b 0a 20 20 20 20 20 20 20 20 20 |k, i);. | 000029f0 20 20 20 20 20 20 20 69 20 2b 3d 20 34 3b 0a 20 | i += 4;. | 00002a00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 | a| 00002a10 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 70 6f 69 |u_wordtobyte(poi| 00002a20 6e 74 65 72 2d 3e 6d 65 6e 75 5f 69 63 6f 6e 66 |nter->menu_iconf| 00002a30 6c 61 67 73 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e |lags, menu_dat->| 00002a40 64 61 74 61 62 6c 6f 63 6b 2c 20 69 29 3b 0a 20 |datablock, i);. | 00002a50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 | i| 00002a60 20 2b 3d 20 34 3b 0a 20 20 20 20 20 20 20 20 20 | += 4;. | 00002a70 20 20 20 20 20 20 20 73 74 72 63 70 79 28 28 63 | strcpy((c| 00002a80 68 61 72 20 2a 29 20 26 6d 65 6e 75 5f 64 61 74 |har *) &menu_dat| 00002a90 2d 3e 64 61 74 61 62 6c 6f 63 6b 5b 69 5d 2c 20 |->datablock[i], | 00002aa0 70 6f 69 6e 74 65 72 2d 3e 6d 65 6e 75 5f 74 65 |pointer->menu_te| 00002ab0 78 74 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 |xt);. | 00002ac0 20 20 20 20 20 69 20 2b 3d 20 31 32 3b 0a 20 20 | i += 12;. | 00002ad0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 6f | po| 00002ae0 69 6e 74 65 72 20 3d 20 70 6f 69 6e 74 65 72 2d |inter = pointer-| 00002af0 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 3b 0a |>next_menuelem;.| 00002b00 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 | }. | 00002b10 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f 69 | return;.}..voi| 00002b20 64 0a 61 75 5f 6f 70 65 6e 6d 65 6e 75 28 6d 65 |d.au_openmenu(me| 00002b30 6e 75 5f 64 61 74 61 20 2a 6d 65 6e 75 5f 64 61 |nu_data *menu_da| 00002b40 74 2c 20 69 6e 74 20 6d 6f 75 73 65 5f 78 2c 20 |t, int mouse_x, | 00002b50 69 6e 74 20 6d 6f 75 73 65 5f 79 29 0a 7b 0a 20 |int mouse_y).{. | 00002b60 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 | _kernel_s| 00002b70 77 69 5f 72 65 67 73 20 20 20 20 20 20 20 20 72 |wi_regs r| 00002b80 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f 6f 75 74 |egs_in, regs_out| 00002b90 3b 0a 0a 20 20 20 20 20 20 20 20 72 65 67 73 5f |;.. regs_| 00002ba0 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 |in.r[1] = (int) | 00002bb0 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c |menu_dat->databl| 00002bc0 6f 63 6b 3b 0a 20 20 20 20 20 20 20 20 72 65 67 |ock;. reg| 00002bd0 73 5f 69 6e 2e 72 5b 32 5d 20 3d 20 6d 6f 75 73 |s_in.r[2] = mous| 00002be0 65 5f 78 3b 0a 20 20 20 20 20 20 20 20 72 65 67 |e_x;. reg| 00002bf0 73 5f 69 6e 2e 72 5b 33 5d 20 3d 20 6d 6f 75 73 |s_in.r[3] = mous| 00002c00 65 5f 79 3b 0a 20 20 20 20 20 20 20 20 5f 6b 65 |e_y;. _ke| 00002c10 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f 43 72 |rnel_swi(Wimp_Cr| 00002c20 65 61 74 65 4d 65 6e 75 2c 20 26 72 65 67 73 5f |eateMenu, ®s_| 00002c30 69 6e 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a |in, ®s_out);.| 00002c40 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 0a | return;.| 00002c50 7d 0a |}.| 00002c52
WimpC/!RAPS/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, ®s_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, ®s_in| 000002d0 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a 7d 0a |, ®s_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, ®s_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, ®s_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, ®s_in| 00000be0 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a 7d 0a |, ®s_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, ®s_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 20 2b 20 31 2c 20 73 69 7a 65 6f 66 28 63 68 61 | + 1, sizeof(cha| 00000eb0 72 29 29 3b 0a 09 73 74 72 63 70 79 28 77 69 6e |r));..strcpy(win| 00000ec0 5f 64 61 74 61 2d 3e 77 69 6e 5f 6e 61 6d 65 2c |_data->win_name,| 00000ed0 20 28 63 68 61 72 20 2a 29 20 72 65 67 73 5f 6f | (char *) regs_o| 00000ee0 75 74 2e 72 5b 35 5d 29 3b 0a 0a 09 2f 2a 20 4e |ut.r[5]);.../* N| 00000ef0 6f 77 20 72 65 6c 6f 61 64 20 74 65 6d 70 6c 61 |ow reload templa| 00000f00 74 65 20 66 72 6f 6d 20 66 69 6c 65 20 69 6e 74 |te from file int| 00000f10 6f 20 6d 65 6d 6f 72 79 20 2a 2f 0a 09 72 65 67 |o memory */..reg| 00000f20 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 |s_in.r[1] = (int| 00000f30 29 20 77 69 6e 5f 64 61 74 61 2d 3e 62 75 66 66 |) win_data->buff| 00000f40 65 72 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 5b 32 |er;..regs_in.r[2| 00000f50 5d 20 3d 20 28 69 6e 74 29 20 77 69 6e 5f 64 61 |] = (int) win_da| 00000f60 74 61 2d 3e 77 6f 72 6b 73 70 61 63 65 3b 0a 09 |ta->workspace;..| 00000f70 72 65 67 73 5f 69 6e 2e 72 5b 33 5d 20 3d 20 28 |regs_in.r[3] = (| 00000f80 69 6e 74 29 20 77 69 6e 5f 64 61 74 61 2d 3e 77 |int) win_data->w| 00000f90 6f 72 6b 73 70 61 63 65 20 2b 20 77 6f 72 6b 73 |orkspace + works| 00000fa0 70 61 63 65 5f 6c 65 6e 67 74 68 3b 0a 09 72 65 |pace_length;..re| 00000fb0 67 73 5f 69 6e 2e 72 5b 34 5d 20 3d 20 2d 31 3b |gs_in.r[4] = -1;| 00000fc0 20 2f 2a 20 4e 4f 20 46 4f 4e 54 53 20 43 41 54 | /* NO FONTS CAT| 00000fd0 45 52 45 44 20 46 4f 52 20 49 4e 20 54 45 4d 50 |ERED FOR IN TEMP| 00000fe0 4c 41 54 45 53 20 59 45 54 20 2a 2f 0a 09 72 65 |LATES YET */..re| 00000ff0 67 73 5f 69 6e 2e 72 5b 35 5d 20 3d 20 28 69 6e |gs_in.r[5] = (in| 00001000 74 29 20 77 69 6e 5f 64 61 74 61 2d 3e 77 69 6e |t) win_data->win| 00001010 5f 6e 61 6d 65 3b 0a 09 72 65 67 73 5f 69 6e 2e |_name;..regs_in.| 00001020 72 5b 36 5d 20 3d 20 63 61 6c 6c 3b 0a 0a 09 5f |r[6] = call;..._| 00001030 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f |kernel_swi(Wimp_| 00001040 4c 6f 61 64 54 65 6d 70 6c 61 74 65 2c 20 26 72 |LoadTemplate, &r| 00001050 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f 6f 75 |egs_in, ®s_ou| 00001060 74 29 3b 0a 09 6e 65 78 74 5f 65 6e 74 72 79 20 |t);..next_entry | 00001070 3d 20 72 65 67 73 5f 6f 75 74 2e 72 5b 36 5d 3b |= regs_out.r[6];| 00001080 0a 0a 09 2f 2a 20 43 72 65 61 74 65 20 74 68 65 |.../* Create the| 00001090 20 77 69 6e 64 6f 77 2c 20 73 74 6f 72 65 20 77 | window, store w| 000010a0 69 6e 64 6f 77 20 68 61 6e 64 6c 65 20 2a 2f 0a |indow handle */.| 000010b0 09 72 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 |.regs_in.r[1] = | 000010c0 28 69 6e 74 29 20 77 69 6e 5f 64 61 74 61 2d 3e |(int) win_data->| 000010d0 62 75 66 66 65 72 3b 0a 09 5f 6b 65 72 6e 65 6c |buffer;.._kernel| 000010e0 5f 73 77 69 28 57 69 6d 70 5f 43 72 65 61 74 65 |_swi(Wimp_Create| 000010f0 57 69 6e 64 6f 77 2c 20 26 72 65 67 73 5f 69 6e |Window, ®s_in| 00001100 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a 09 77 |, ®s_out);..w| 00001110 69 6e 5f 64 61 74 61 2d 3e 77 69 6e 5f 68 61 6e |in_data->win_han| 00001120 64 6c 65 20 3d 20 72 65 67 73 5f 6f 75 74 2e 72 |dle = regs_out.r| 00001130 5b 30 5d 3b 0a 09 72 65 74 75 72 6e 20 6e 65 78 |[0];..return nex| 00001140 74 5f 65 6e 74 72 79 3b 20 2f 2a 20 69 6e 20 63 |t_entry; /* in c| 00001150 61 73 65 20 6f 66 20 77 69 6c 64 63 61 72 64 65 |ase of wildcarde| 00001160 64 20 73 65 61 72 63 68 65 73 20 2a 2f 0a 7d 0a |d searches */.}.| 00001170 0a 69 6e 74 0a 61 75 5f 72 65 70 6f 72 74 5f 65 |.int.au_report_e| 00001180 72 72 6f 72 28 69 6e 74 20 65 72 72 6e 6f 2c 20 |rror(int errno, | 00001190 63 68 61 72 20 2a 65 72 72 6d 65 73 73 2c 20 69 |char *errmess, i| 000011a0 6e 74 20 66 6c 61 67 73 2c 20 63 68 61 72 20 2a |nt flags, char *| 000011b0 61 70 70 5f 6e 61 6d 65 29 0a 7b 0a 20 20 20 75 |app_name).{. u| 000011c0 6e 73 69 67 6e 65 64 20 63 68 61 72 20 65 72 72 |nsigned char err| 000011d0 6f 72 62 6c 6f 63 6b 5b 32 36 30 5d 3b 0a 20 20 |orblock[260];. | 000011e0 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 | _kernel_swi_reg| 000011f0 73 20 69 6e 2c 20 6f 75 74 3b 0a 0a 20 20 20 2f |s in, out;.. /| 00001200 2a 20 53 65 74 20 75 70 20 74 68 65 20 73 74 61 |* Set up the sta| 00001210 6e 64 61 72 64 20 65 72 72 6f 72 20 62 6c 6f 63 |ndard error bloc| 00001220 6b 20 77 69 74 68 20 74 68 65 20 65 72 72 6f 72 |k with the error| 00001230 20 6e 75 6d 62 65 72 20 61 6e 64 20 6d 65 73 73 | number and mess| 00001240 61 67 65 0a 20 20 20 20 20 20 28 7a 65 72 6f 20 |age. (zero | 00001250 74 65 72 6d 69 6e 61 74 65 64 29 20 2a 2f 0a 20 |terminated) */. | 00001260 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 | au_wordtobyte(| 00001270 65 72 72 6e 6f 2c 20 65 72 72 6f 72 62 6c 6f 63 |errno, errorbloc| 00001280 6b 2c 20 30 29 3b 0a 20 20 20 73 74 72 63 70 79 |k, 0);. strcpy| 00001290 28 20 28 63 68 61 72 20 2a 29 20 26 65 72 72 6f |( (char *) &erro| 000012a0 72 62 6c 6f 63 6b 5b 34 5d 2c 20 65 72 72 6d 65 |rblock[4], errme| 000012b0 73 73 29 3b 0a 0a 20 20 20 2f 2a 20 52 30 20 2d |ss);.. /* R0 -| 000012c0 20 70 6f 69 6e 74 65 72 20 74 6f 20 73 74 61 6e | pointer to stan| 000012d0 64 61 72 64 20 65 72 72 6f 72 20 62 6c 6f 63 6b |dard error block| 000012e0 0a 20 20 20 20 20 20 52 31 20 2d 20 65 72 72 6f |. R1 - erro| 000012f0 72 20 77 69 6e 64 6f 77 20 66 6c 61 67 73 0a 20 |r window flags. | 00001300 20 20 20 20 20 52 32 20 2d 20 70 6f 69 6e 74 65 | R2 - pointe| 00001310 72 20 74 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e |r to application| 00001320 20 6e 61 6d 65 20 66 6f 72 20 65 72 72 6f 72 20 | name for error | 00001330 62 6f 78 20 74 69 74 6c 65 20 2a 2f 0a 0a 20 20 |box title */.. | 00001340 20 69 6e 2e 72 5b 30 5d 20 3d 20 28 69 6e 74 29 | in.r[0] = (int)| 00001350 20 65 72 72 6f 72 62 6c 6f 63 6b 3b 0a 20 20 20 | errorblock;. | 00001360 69 6e 2e 72 5b 31 5d 20 3d 20 66 6c 61 67 73 3b |in.r[1] = flags;| 00001370 0a 20 20 20 69 6e 2e 72 5b 32 5d 20 3d 20 28 69 |. in.r[2] = (i| 00001380 6e 74 29 20 61 70 70 5f 6e 61 6d 65 3b 0a 0a 20 |nt) app_name;.. | 00001390 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 | _kernel_swi(Wi| 000013a0 6d 70 5f 52 65 70 6f 72 74 45 72 72 6f 72 2c 20 |mp_ReportError, | 000013b0 26 69 6e 2c 20 26 6f 75 74 29 3b 0a 0a 20 20 20 |&in, &out);.. | 000013c0 2f 2a 20 52 65 74 75 72 6e 73 20 31 20 69 66 20 |/* Returns 1 if | 000013d0 4f 4b 20 73 65 6c 65 63 74 65 64 2c 20 32 20 69 |OK selected, 2 i| 000013e0 66 20 43 61 6e 63 65 6c 20 73 65 6c 65 63 74 65 |f Cancel selecte| 000013f0 64 20 2a 2f 0a 20 20 20 72 65 74 75 72 6e 20 6f |d */. return o| 00001400 75 74 2e 72 5b 31 5d 3b 0a 7d 0a 0a 76 6f 69 64 |ut.r[1];.}..void| 00001410 0a 61 75 5f 6f 70 65 6e 77 69 6e 5f 66 72 6f 6d |.au_openwin_from| 00001420 5f 74 65 6d 70 6c 61 74 65 64 61 74 61 28 77 69 |_templatedata(wi| 00001430 6e 64 6f 77 5f 64 61 74 61 20 2a 77 69 6e 5f 64 |ndow_data *win_d| 00001440 61 74 61 2c 20 6c 6f 6e 67 20 69 6e 74 20 70 6f |ata, long int po| 00001450 73 69 74 69 6f 6e 29 0a 7b 0a 09 5f 6b 65 72 6e |sition).{.._kern| 00001460 65 6c 5f 73 77 69 5f 72 65 67 73 09 72 65 67 73 |el_swi_regs.regs| 00001470 5f 69 6e 2c 20 72 65 67 73 5f 6f 75 74 3b 0a 09 |_in, regs_out;..| 00001480 75 6e 73 69 67 6e 65 64 20 63 68 61 72 09 6f 70 |unsigned char.op| 00001490 65 6e 77 69 6e 64 6f 77 5f 62 75 66 66 65 72 5b |enwindow_buffer[| 000014a0 33 36 5d 3b 0a 09 69 6e 74 09 69 3b 0a 0a 09 61 |36];..int.i;...a| 000014b0 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 20 28 75 |u_wordtobyte( (u| 000014c0 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 |nsigned long int| 000014d0 29 20 77 69 6e 5f 64 61 74 61 2d 3e 77 69 6e 5f |) win_data->win_| 000014e0 68 61 6e 64 6c 65 2c 20 6f 70 65 6e 77 69 6e 64 |handle, openwind| 000014f0 6f 77 5f 62 75 66 66 65 72 2c 20 30 29 3b 0a 09 |ow_buffer, 0);..| 00001500 66 6f 72 28 69 20 3d 20 30 3b 20 69 20 3c 20 36 |for(i = 0; i < 6| 00001510 3b 20 69 2b 2b 29 20 7b 0a 09 09 61 75 5f 77 6f |; i++) {...au_wo| 00001520 72 64 74 6f 62 79 74 65 28 61 75 5f 62 79 74 65 |rdtobyte(au_byte| 00001530 74 6f 77 6f 72 64 28 77 69 6e 5f 64 61 74 61 2d |toword(win_data-| 00001540 3e 62 75 66 66 65 72 2c 20 69 2a 34 29 2c 20 6f |>buffer, i*4), o| 00001550 70 65 6e 77 69 6e 64 6f 77 5f 62 75 66 66 65 72 |penwindow_buffer| 00001560 2c 20 28 69 2b 31 29 20 2a 20 34 29 3b 0a 09 7d |, (i+1) * 4);..}| 00001570 0a 09 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 |..au_wordtobyte(| 00001580 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 65 6e 77 69 |position, openwi| 00001590 6e 64 6f 77 5f 62 75 66 66 65 72 2c 20 32 38 29 |ndow_buffer, 28)| 000015a0 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 |;..regs_in.r[1] | 000015b0 3d 20 28 69 6e 74 29 20 6f 70 65 6e 77 69 6e 64 |= (int) openwind| 000015c0 6f 77 5f 62 75 66 66 65 72 3b 0a 09 5f 6b 65 72 |ow_buffer;.._ker| 000015d0 6e 65 6c 5f 73 77 69 28 57 69 6d 70 5f 4f 70 65 |nel_swi(Wimp_Ope| 000015e0 6e 57 69 6e 64 6f 77 2c 20 26 72 65 67 73 5f 69 |nWindow, ®s_i| 000015f0 6e 2c 20 26 72 65 67 73 5f 6f 75 74 29 3b 0a 09 |n, ®s_out);..| 00001600 72 65 74 75 72 6e 3b 0a 7d 0a 0a 69 6e 74 0a 61 |return;.}..int.a| 00001610 75 5f 77 69 6d 70 5f 70 6f 6c 6c 28 69 6e 74 20 |u_wimp_poll(int | 00001620 70 6f 6c 6c 6d 61 73 6b 2c 20 75 6e 73 69 67 6e |pollmask, unsign| 00001630 65 64 20 63 68 61 72 20 2a 70 6f 6c 6c 62 6c 6f |ed char *pollblo| 00001640 63 6b 29 0a 7b 0a 09 5f 6b 65 72 6e 65 6c 5f 73 |ck).{.._kernel_s| 00001650 77 69 5f 72 65 67 73 09 72 65 67 73 5f 69 6e 2c |wi_regs.regs_in,| 00001660 20 72 65 67 73 5f 6f 75 74 3b 0a 0a 09 72 65 67 | regs_out;...reg| 00001670 73 5f 69 6e 2e 72 5b 30 5d 20 3d 20 70 6f 6c 6c |s_in.r[0] = poll| 00001680 6d 61 73 6b 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 |mask;..regs_in.r| 00001690 5b 31 5d 20 3d 20 28 69 6e 74 29 20 70 6f 6c 6c |[1] = (int) poll| 000016a0 62 6c 6f 63 6b 3b 0a 0a 09 5f 6b 65 72 6e 65 6c |block;..._kernel| 000016b0 5f 73 77 69 28 57 69 6d 70 5f 50 6f 6c 6c 2c 20 |_swi(Wimp_Poll, | 000016c0 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 73 5f |®s_in, ®s_| 000016d0 6f 75 74 29 3b 0a 09 72 65 74 75 72 6e 20 72 65 |out);..return re| 000016e0 67 73 5f 6f 75 74 2e 72 5b 30 5d 3b 20 2f 2a 20 |gs_out.r[0]; /* | 000016f0 52 65 74 75 72 6e 20 74 68 65 20 65 76 65 6e 74 |Return the event| 00001700 20 63 6f 64 65 20 2a 2f 0a 7d 0a 0a 76 6f 69 64 | code */.}..void| 00001710 0a 61 75 5f 69 63 6f 6e 5f 74 65 78 74 5f 63 68 |.au_icon_text_ch| 00001720 61 6e 67 65 28 63 68 61 72 20 2a 74 65 78 74 2c |ange(char *text,| 00001730 20 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 69 | unsigned long i| 00001740 6e 74 20 77 69 6e 5f 68 2c 20 75 6e 73 69 67 6e |nt win_h, unsign| 00001750 65 64 20 6c 6f 6e 67 20 69 6e 74 20 69 63 6f 6e |ed long int icon| 00001760 5f 68 29 0a 7b 0a 20 20 20 5f 6b 65 72 6e 65 6c |_h).{. _kernel| 00001770 5f 73 77 69 5f 72 65 67 73 20 72 65 67 73 5f 69 |_swi_regs regs_i| 00001780 6e 2c 20 72 65 67 73 5f 6f 75 74 3b 0a 20 20 20 |n, regs_out;. | 00001790 63 68 61 72 20 2a 74 65 78 74 5f 70 6f 69 6e 74 |char *text_point| 000017a0 65 72 3b 0a 20 20 20 75 6e 73 69 67 6e 65 64 20 |er;. unsigned | 000017b0 63 68 61 72 20 74 65 6d 70 5f 62 75 66 66 65 72 |char temp_buffer| 000017c0 5b 32 35 35 5d 3b 0a 0a 20 20 20 2f 2a 20 46 69 |[255];.. /* Fi| 000017d0 6e 64 20 6f 75 74 20 77 68 65 72 65 20 74 68 65 |nd out where the| 000017e0 20 69 63 6f 6e 27 73 20 69 6e 64 69 72 65 63 74 | icon's indirect| 000017f0 65 64 20 74 65 78 74 20 69 73 20 73 74 6f 72 65 |ed text is store| 00001800 64 20 69 6e 20 6d 65 6d 6f 72 79 20 61 6e 64 20 |d in memory and | 00001810 63 6f 70 79 0a 20 20 20 20 20 20 61 20 6e 65 77 |copy. a new| 00001820 20 73 74 72 69 6e 67 20 74 6f 20 69 74 20 2a 2f | string to it */| 00001830 0a 20 20 20 74 65 78 74 5f 70 6f 69 6e 74 65 72 |. text_pointer| 00001840 20 3d 20 61 75 5f 67 65 74 5f 70 74 72 5f 74 6f | = au_get_ptr_to| 00001850 5f 69 63 6f 6e 74 65 78 74 28 77 69 6e 5f 68 2c |_icontext(win_h,| 00001860 20 69 63 6f 6e 5f 68 29 3b 0a 20 20 20 73 74 72 | icon_h);. str| 00001870 63 70 79 28 74 65 78 74 5f 70 6f 69 6e 74 65 72 |cpy(text_pointer| 00001880 2c 20 74 65 78 74 29 3b 0a 0a 20 20 20 2f 2a 20 |, text);.. /* | 00001890 4e 6f 77 20 77 65 20 6e 65 65 64 20 74 6f 20 69 |Now we need to i| 000018a0 6e 66 6f 72 6d 20 74 68 65 20 57 49 4d 50 20 74 |nform the WIMP t| 000018b0 68 61 74 20 74 68 65 20 69 63 6f 6e 20 6e 65 65 |hat the icon nee| 000018c0 64 73 20 72 65 64 72 61 77 69 6e 67 20 62 79 20 |ds redrawing by | 000018d0 73 65 74 74 69 6e 67 0a 20 20 20 20 20 20 74 68 |setting. th| 000018e0 65 20 69 63 6f 6e 20 66 6c 61 67 73 20 2d 20 77 |e icon flags - w| 000018f0 65 20 64 6f 6e 27 74 20 61 63 74 75 61 6c 6c 79 |e don't actually| 00001900 20 63 68 61 6e 67 65 20 74 68 65 6d 20 77 69 74 | change them wit| 00001910 68 20 74 68 69 73 20 63 61 6c 6c 2c 20 62 75 74 |h this call, but| 00001920 20 74 68 69 73 0a 20 20 20 20 20 20 73 70 75 72 | this. spur| 00001930 73 20 74 68 65 20 57 49 4d 50 20 69 6e 74 6f 20 |s the WIMP into | 00001940 61 63 74 69 6f 6e 20 2a 2f 0a 0a 20 20 20 61 75 |action */.. au| 00001950 5f 77 6f 72 64 74 6f 62 79 74 65 28 77 69 6e 5f |_wordtobyte(win_| 00001960 68 2c 20 74 65 6d 70 5f 62 75 66 66 65 72 2c 20 |h, temp_buffer, | 00001970 30 29 3b 0a 20 20 20 61 75 5f 77 6f 72 64 74 6f |0);. au_wordto| 00001980 62 79 74 65 28 69 63 6f 6e 5f 68 2c 20 74 65 6d |byte(icon_h, tem| 00001990 70 5f 62 75 66 66 65 72 2c 20 34 29 3b 0a 20 20 |p_buffer, 4);. | 000019a0 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 30 | au_wordtobyte(0| 000019b0 2c 20 74 65 6d 70 5f 62 75 66 66 65 72 2c 20 38 |, temp_buffer, 8| 000019c0 29 3b 0a 20 20 20 61 75 5f 77 6f 72 64 74 6f 62 |);. au_wordtob| 000019d0 79 74 65 28 30 2c 20 74 65 6d 70 5f 62 75 66 66 |yte(0, temp_buff| 000019e0 65 72 2c 20 31 32 29 3b 0a 0a 20 20 20 72 65 67 |er, 12);.. reg| 000019f0 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 |s_in.r[1] = (int| 00001a00 29 20 74 65 6d 70 5f 62 75 66 66 65 72 3b 0a 0a |) temp_buffer;..| 00001a10 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 | _kernel_swi(W| 00001a20 69 6d 70 5f 53 65 74 49 63 6f 6e 53 74 61 74 65 |imp_SetIconState| 00001a30 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 67 |, ®s_in, ®| 00001a40 73 5f 6f 75 74 29 3b 0a 20 20 20 72 65 74 75 72 |s_out);. retur| 00001a50 6e 3b 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 69 63 |n;.}..void.au_ic| 00001a60 6f 6e 5f 67 65 74 5f 74 65 78 74 28 63 68 61 72 |on_get_text(char| 00001a70 20 2a 64 65 73 74 5f 73 74 72 69 6e 67 2c 20 75 | *dest_string, u| 00001a80 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 |nsigned long int| 00001a90 20 77 69 6e 5f 68 64 6c 2c 20 75 6e 73 69 67 6e | win_hdl, unsign| 00001aa0 65 64 20 6c 6f 6e 67 20 69 6e 74 20 69 63 6f 6e |ed long int icon| 00001ab0 5f 68 64 6c 29 0a 7b 0a 09 63 68 61 72 09 2a 74 |_hdl).{..char.*t| 00001ac0 65 78 74 5f 70 6f 69 6e 74 65 72 3b 0a 0a 09 2f |ext_pointer;.../| 00001ad0 2a 20 41 73 73 75 6d 65 73 20 64 65 73 74 5f 73 |* Assumes dest_s| 00001ae0 74 72 69 6e 67 20 68 61 73 20 65 6e 6f 75 67 68 |tring has enough| 00001af0 20 73 70 61 63 65 20 2a 2f 0a 09 74 65 78 74 5f | space */..text_| 00001b00 70 6f 69 6e 74 65 72 20 3d 20 61 75 5f 67 65 74 |pointer = au_get| 00001b10 5f 70 74 72 5f 74 6f 5f 69 63 6f 6e 74 65 78 74 |_ptr_to_icontext| 00001b20 28 77 69 6e 5f 68 64 6c 2c 20 69 63 6f 6e 5f 68 |(win_hdl, icon_h| 00001b30 64 6c 29 3b 0a 09 73 74 72 63 70 79 28 64 65 73 |dl);..strcpy(des| 00001b40 74 5f 73 74 72 69 6e 67 2c 20 74 65 78 74 5f 70 |t_string, text_p| 00001b50 6f 69 6e 74 65 72 29 3b 0a 09 72 65 74 75 72 6e |ointer);..return| 00001b60 3b 0a 7d 0a 0a 63 68 61 72 20 2a 0a 61 75 5f 67 |;.}..char *.au_g| 00001b70 65 74 5f 70 74 72 5f 74 6f 5f 69 63 6f 6e 74 65 |et_ptr_to_iconte| 00001b80 78 74 28 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 |xt(unsigned long| 00001b90 20 69 6e 74 20 77 69 6e 68 64 6c 2c 20 75 6e 73 | int winhdl, uns| 00001ba0 69 67 6e 65 64 20 6c 6f 6e 67 20 69 6e 74 20 69 |igned long int i| 00001bb0 63 6f 6e 68 64 6c 29 0a 7b 0a 20 20 20 2f 2a 20 |conhdl).{. /* | 00001bc0 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 |This procedure i| 00001bd0 6e 74 65 72 72 6f 67 61 74 65 73 20 61 6e 20 69 |nterrogates an i| 00001be0 63 6f 6e 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 |con to determine| 00001bf0 20 74 68 65 20 61 64 64 72 65 73 73 20 77 68 65 | the address whe| 00001c00 72 65 20 69 74 73 0a 20 20 20 20 20 20 69 6e 64 |re its. ind| 00001c10 69 72 65 63 74 65 64 20 74 65 78 74 20 64 61 74 |irected text dat| 00001c20 61 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 6d |a is stored in m| 00001c30 65 6d 6f 72 79 2c 20 61 6e 64 20 72 65 74 75 72 |emory, and retur| 00001c40 6e 73 20 69 74 20 2a 2f 0a 0a 20 20 20 75 6e 73 |ns it */.. uns| 00001c50 69 67 6e 65 64 20 63 68 61 72 20 74 65 6d 70 5f |igned char temp_| 00001c60 62 75 66 66 65 72 5b 32 35 35 5d 3b 0a 20 20 20 |buffer[255];. | 00001c70 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 73 |_kernel_swi_regs| 00001c80 20 72 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f 6f | regs_in, regs_o| 00001c90 75 74 3b 0a 20 20 20 63 68 61 72 20 2a 72 65 73 |ut;. char *res| 00001ca0 75 6c 74 3b 0a 0a 20 20 20 61 75 5f 77 6f 72 64 |ult;.. au_word| 00001cb0 74 6f 62 79 74 65 28 77 69 6e 68 64 6c 2c 20 74 |tobyte(winhdl, t| 00001cc0 65 6d 70 5f 62 75 66 66 65 72 2c 20 30 29 3b 0a |emp_buffer, 0);.| 00001cd0 20 20 20 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 | au_wordtobyte| 00001ce0 28 69 63 6f 6e 68 64 6c 2c 20 74 65 6d 70 5f 62 |(iconhdl, temp_b| 00001cf0 75 66 66 65 72 2c 20 34 29 3b 0a 0a 20 20 20 72 |uffer, 4);.. r| 00001d00 65 67 73 5f 69 6e 2e 72 5b 31 5d 20 3d 20 28 69 |egs_in.r[1] = (i| 00001d10 6e 74 29 20 74 65 6d 70 5f 62 75 66 66 65 72 3b |nt) temp_buffer;| 00001d20 0a 20 20 20 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 |. _kernel_swi(| 00001d30 57 69 6d 70 5f 47 65 74 49 63 6f 6e 53 74 61 74 |Wimp_GetIconStat| 00001d40 65 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |e, ®s_in, &re| 00001d50 67 73 5f 6f 75 74 29 3b 0a 0a 20 20 20 72 65 73 |gs_out);.. res| 00001d60 75 6c 74 20 3d 20 28 63 68 61 72 20 2a 29 20 61 |ult = (char *) a| 00001d70 75 5f 62 79 74 65 74 6f 77 6f 72 64 28 74 65 6d |u_bytetoword(tem| 00001d80 70 5f 62 75 66 66 65 72 2c 20 32 38 29 3b 0a 20 |p_buffer, 28);. | 00001d90 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c 74 3b | return result;| 00001da0 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 62 75 69 6c |.}..void.au_buil| 00001db0 64 6d 65 6e 75 28 63 68 61 72 20 2a 74 69 74 6c |dmenu(char *titl| 00001dc0 65 2c 20 6d 65 6e 75 5f 64 61 74 61 20 2a 6d 65 |e, menu_data *me| 00001dd0 6e 75 5f 64 61 74 29 0a 7b 0a 09 69 66 28 73 74 |nu_dat).{..if(st| 00001de0 72 6c 65 6e 28 74 69 74 6c 65 29 20 3e 20 31 31 |rlen(title) > 11| 00001df0 29 20 72 65 74 75 72 6e 3b 20 2f 2a 20 44 6f 20 |) return; /* Do | 00001e00 74 68 69 73 20 6d 6f 72 65 20 6e 65 61 74 6c 79 |this more neatly| 00001e10 21 20 2a 2f 0a 09 2f 2a 20 46 69 6c 6c 20 69 6e |! */../* Fill in| 00001e20 20 74 68 65 20 6d 65 6e 75 20 68 65 61 64 65 72 | the menu header| 00001e30 20 77 69 74 68 20 73 74 61 6e 64 61 72 64 20 69 | with standard i| 00001e40 6e 66 6f 72 6d 61 74 69 6f 6e 20 2a 2f 0a 09 73 |nformation */..s| 00001e50 74 72 63 70 79 28 6d 65 6e 75 5f 64 61 74 2d 3e |trcpy(menu_dat->| 00001e60 74 69 74 6c 65 2c 20 74 69 74 6c 65 29 3b 0a 09 |title, title);..| 00001e70 6d 65 6e 75 5f 64 61 74 2d 3e 63 6f 6c 6f 75 72 |menu_dat->colour| 00001e80 73 20 3d 20 4d 45 4e 55 5f 54 49 54 4c 45 46 4f |s = MENU_TITLEFO| 00001e90 52 45 20 7c 20 4d 45 4e 55 5f 54 49 54 4c 45 42 |RE | MENU_TITLEB| 00001ea0 41 43 4b 20 7c 20 4d 45 4e 55 5f 57 4f 52 4b 46 |ACK | MENU_WORKF| 00001eb0 4f 52 45 20 7c 20 4d 45 4e 55 5f 57 4f 52 4b 42 |ORE | MENU_WORKB| 00001ec0 41 43 4b 3b 0a 09 6d 65 6e 75 5f 64 61 74 2d 3e |ACK;..menu_dat->| 00001ed0 77 69 64 74 68 20 3d 20 4d 45 4e 55 5f 57 49 44 |width = MENU_WID| 00001ee0 54 48 3b 0a 09 6d 65 6e 75 5f 64 61 74 2d 3e 68 |TH;..menu_dat->h| 00001ef0 65 69 67 68 74 20 3d 20 4d 45 4e 55 5f 48 45 49 |eight = MENU_HEI| 00001f00 47 48 54 3b 0a 09 6d 65 6e 75 5f 64 61 74 2d 3e |GHT;..menu_dat->| 00001f10 76 65 72 74 5f 67 61 70 20 3d 20 4d 45 4e 55 5f |vert_gap = MENU_| 00001f20 56 45 52 54 47 41 50 3b 0a 09 6d 65 6e 75 5f 64 |VERTGAP;..menu_d| 00001f30 61 74 2d 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 |at->next_menuele| 00001f40 6d 20 3d 20 4e 55 4c 4c 3b 0a 09 6d 65 6e 75 5f |m = NULL;..menu_| 00001f50 64 61 74 2d 3e 73 69 7a 65 20 3d 20 73 69 7a 65 |dat->size = size| 00001f60 6f 66 28 6d 65 6e 75 5f 64 61 74 61 29 3b 0a 09 |of(menu_data);..| 00001f70 72 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f 69 64 0a |return;.}..void.| 00001f80 61 75 5f 61 64 64 74 6f 6d 65 6e 75 28 63 68 61 |au_addtomenu(cha| 00001f90 72 20 2a 74 65 78 74 2c 20 6c 6f 6e 67 20 69 6e |r *text, long in| 00001fa0 74 20 6d 65 6e 75 5f 66 6c 61 67 73 2c 20 6c 6f |t menu_flags, lo| 00001fb0 6e 67 20 69 6e 74 20 73 75 62 6d 65 6e 75 2c 20 |ng int submenu, | 00001fc0 6c 6f 6e 67 20 69 6e 74 20 69 63 6f 6e 5f 66 6c |long int icon_fl| 00001fd0 61 67 73 2c 20 6d 65 6e 75 5f 64 61 74 61 20 2a |ags, menu_data *| 00001fe0 6d 65 6e 75 5f 64 61 74 29 0a 7b 0a 09 6d 65 6e |menu_dat).{..men| 00001ff0 75 5f 65 6c 65 6d 65 6e 74 20 2a 70 6f 69 6e 74 |u_element *point| 00002000 65 72 3b 0a 0a 09 69 66 28 73 74 72 6c 65 6e 28 |er;...if(strlen(| 00002010 74 65 78 74 29 20 3e 20 31 31 29 20 72 65 74 75 |text) > 11) retu| 00002020 72 6e 3b 0a 09 2f 2a 20 57 6f 72 6b 20 6f 75 72 |rn;../* Work our| 00002030 20 77 61 79 20 74 6f 20 65 6e 64 20 6f 66 20 6d | way to end of m| 00002040 65 6e 75 20 6c 69 73 74 20 2a 2f 0a 09 69 66 28 |enu list */..if(| 00002050 6d 65 6e 75 5f 64 61 74 2d 3e 6e 65 78 74 5f 6d |menu_dat->next_m| 00002060 65 6e 75 65 6c 65 6d 20 3d 3d 20 4e 55 4c 4c 29 |enuelem == NULL)| 00002070 20 7b 0a 09 09 6d 65 6e 75 5f 64 61 74 2d 3e 6e | {...menu_dat->n| 00002080 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 20 3d 20 63 |ext_menuelem = c| 00002090 61 6c 6c 6f 63 28 31 2c 20 73 69 7a 65 6f 66 28 |alloc(1, sizeof(| 000020a0 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 29 29 3b 0a |menu_element));.| 000020b0 09 09 6d 65 6e 75 5f 64 61 74 2d 3e 73 69 7a 65 |..menu_dat->size| 000020c0 20 2b 3d 20 73 69 7a 65 6f 66 28 6d 65 6e 75 5f | += sizeof(menu_| 000020d0 65 6c 65 6d 65 6e 74 29 3b 0a 09 09 70 6f 69 6e |element);...poin| 000020e0 74 65 72 20 3d 20 6d 65 6e 75 5f 64 61 74 2d 3e |ter = menu_dat->| 000020f0 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 3b 0a 09 |next_menuelem;..| 00002100 7d 20 65 6c 73 65 20 7b 0a 09 09 70 6f 69 6e 74 |} else {...point| 00002110 65 72 20 3d 20 6d 65 6e 75 5f 64 61 74 2d 3e 6e |er = menu_dat->n| 00002120 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 3b 0a 09 09 |ext_menuelem;...| 00002130 77 68 69 6c 65 20 28 70 6f 69 6e 74 65 72 2d 3e |while (pointer->| 00002140 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 6d 20 21 3d |next_menuelem !=| 00002150 20 30 29 20 7b 0a 09 09 09 70 6f 69 6e 74 65 72 | 0) {....pointer| 00002160 20 3d 20 70 6f 69 6e 74 65 72 2d 3e 6e 65 78 74 | = pointer->next| 00002170 5f 6d 65 6e 75 65 6c 65 6d 3b 0a 09 09 7d 0a 09 |_menuelem;...}..| 00002180 09 70 6f 69 6e 74 65 72 2d 3e 6e 65 78 74 5f 6d |.pointer->next_m| 00002190 65 6e 75 65 6c 65 6d 20 3d 20 63 61 6c 6c 6f 63 |enuelem = calloc| 000021a0 28 31 2c 20 73 69 7a 65 6f 66 28 6d 65 6e 75 5f |(1, sizeof(menu_| 000021b0 65 6c 65 6d 65 6e 74 29 29 3b 0a 09 09 6d 65 6e |element));...men| 000021c0 75 5f 64 61 74 2d 3e 73 69 7a 65 20 2b 3d 20 73 |u_dat->size += s| 000021d0 69 7a 65 6f 66 28 6d 65 6e 75 5f 65 6c 65 6d 65 |izeof(menu_eleme| 000021e0 6e 74 29 3b 0a 09 09 70 6f 69 6e 74 65 72 20 3d |nt);...pointer =| 000021f0 20 70 6f 69 6e 74 65 72 2d 3e 6e 65 78 74 5f 6d | pointer->next_m| 00002200 65 6e 75 65 6c 65 6d 3b 0a 09 7d 0a 09 2f 2a 20 |enuelem;..}../* | 00002210 73 65 74 20 75 70 20 64 61 74 61 20 2a 2f 0a 09 |set up data */..| 00002220 73 74 72 63 70 79 28 70 6f 69 6e 74 65 72 2d 3e |strcpy(pointer->| 00002230 6d 65 6e 75 5f 74 65 78 74 2c 20 74 65 78 74 29 |menu_text, text)| 00002240 3b 0a 09 70 6f 69 6e 74 65 72 2d 3e 66 6c 61 67 |;..pointer->flag| 00002250 73 20 3d 20 6d 65 6e 75 5f 66 6c 61 67 73 3b 0a |s = menu_flags;.| 00002260 09 70 6f 69 6e 74 65 72 2d 3e 73 75 62 6d 65 6e |.pointer->submen| 00002270 75 20 3d 20 73 75 62 6d 65 6e 75 3b 0a 0a 09 2f |u = submenu;.../| 00002280 2a 20 41 70 70 6c 79 20 73 74 61 6e 64 61 72 64 |* Apply standard| 00002290 20 69 63 6f 6e 20 66 6c 61 67 73 20 2a 2f 0a 09 | icon flags */..| 000022a0 69 63 6f 6e 5f 66 6c 61 67 73 20 3d 20 69 63 6f |icon_flags = ico| 000022b0 6e 5f 66 6c 61 67 73 20 7c 20 4d 45 4e 55 49 54 |n_flags | MENUIT| 000022c0 45 4d 5f 46 4f 52 45 20 7c 20 4d 45 4e 55 49 54 |EM_FORE | MENUIT| 000022d0 45 4d 5f 42 41 43 4b 20 7c 20 49 43 4f 4e 5f 49 |EM_BACK | ICON_I| 000022e0 53 54 45 58 54 20 7c 20 49 43 4f 4e 5f 49 53 46 |STEXT | ICON_ISF| 000022f0 49 4c 4c 45 44 3b 0a 09 70 6f 69 6e 74 65 72 2d |ILLED;..pointer-| 00002300 3e 6d 65 6e 75 5f 69 63 6f 6e 66 6c 61 67 73 20 |>menu_iconflags | 00002310 3d 20 69 63 6f 6e 5f 66 6c 61 67 73 3b 0a 09 72 |= icon_flags;..r| 00002320 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f 69 64 0a 61 |eturn;.}..void.a| 00002330 75 5f 63 72 65 61 74 65 6d 65 6e 75 28 6d 65 6e |u_createmenu(men| 00002340 75 5f 64 61 74 61 20 2a 6d 65 6e 75 5f 64 61 74 |u_data *menu_dat| 00002350 29 0a 7b 0a 09 6d 65 6e 75 5f 65 6c 65 6d 65 6e |).{..menu_elemen| 00002360 74 09 2a 70 6f 69 6e 74 65 72 3b 0a 09 69 6e 74 |t.*pointer;..int| 00002370 09 69 3b 0a 0a 09 2f 2a 20 41 73 73 69 67 6e 20 |.i;.../* Assign | 00002380 6d 65 6d 6f 72 79 20 2a 2f 0a 09 6d 65 6e 75 5f |memory */..menu_| 00002390 64 61 74 2d 3e 64 61 74 61 62 6c 6f 63 6b 20 3d |dat->datablock =| 000023a0 20 63 61 6c 6c 6f 63 28 31 2c 20 6d 65 6e 75 5f | calloc(1, menu_| 000023b0 64 61 74 2d 3e 73 69 7a 65 29 3b 0a 09 2f 2a 20 |dat->size);../* | 000023c0 42 65 67 69 6e 20 63 6f 70 79 69 6e 67 20 64 61 |Begin copying da| 000023d0 74 61 20 2a 2f 0a 09 73 74 72 63 70 79 28 28 63 |ta */..strcpy((c| 000023e0 68 61 72 20 2a 29 6d 65 6e 75 5f 64 61 74 2d 3e |har *)menu_dat->| 000023f0 64 61 74 61 62 6c 6f 63 6b 2c 20 6d 65 6e 75 5f |datablock, menu_| 00002400 64 61 74 2d 3e 74 69 74 6c 65 29 3b 0a 09 61 75 |dat->title);..au| 00002410 5f 77 6f 72 64 74 6f 62 79 74 65 28 6d 65 6e 75 |_wordtobyte(menu| 00002420 5f 64 61 74 2d 3e 63 6f 6c 6f 75 72 73 2c 20 6d |_dat->colours, m| 00002430 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f |enu_dat->datablo| 00002440 63 6b 2c 20 31 32 29 3b 0a 09 61 75 5f 77 6f 72 |ck, 12);..au_wor| 00002450 64 74 6f 62 79 74 65 28 6d 65 6e 75 5f 64 61 74 |dtobyte(menu_dat| 00002460 2d 3e 77 69 64 74 68 2c 20 6d 65 6e 75 5f 64 61 |->width, menu_da| 00002470 74 2d 3e 64 61 74 61 62 6c 6f 63 6b 2c 20 31 36 |t->datablock, 16| 00002480 29 3b 0a 09 61 75 5f 77 6f 72 64 74 6f 62 79 74 |);..au_wordtobyt| 00002490 65 28 6d 65 6e 75 5f 64 61 74 2d 3e 68 65 69 67 |e(menu_dat->heig| 000024a0 68 74 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 |ht, menu_dat->da| 000024b0 74 61 62 6c 6f 63 6b 2c 20 32 30 29 3b 0a 09 61 |tablock, 20);..a| 000024c0 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 6d 65 6e |u_wordtobyte(men| 000024d0 75 5f 64 61 74 2d 3e 76 65 72 74 5f 67 61 70 2c |u_dat->vert_gap,| 000024e0 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 | menu_dat->datab| 000024f0 6c 6f 63 6b 2c 20 32 34 29 3b 0a 09 2f 2a 20 65 |lock, 24);../* e| 00002500 6e 64 20 6f 66 20 68 65 61 64 65 72 20 69 6e 66 |nd of header inf| 00002510 6f 20 2a 2f 0a 09 69 20 3d 20 32 38 3b 0a 0a 09 |o */..i = 28;...| 00002520 70 6f 69 6e 74 65 72 20 3d 20 6d 65 6e 75 5f 64 |pointer = menu_d| 00002530 61 74 2d 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 |at->next_menuele| 00002540 6d 3b 0a 0a 09 77 68 69 6c 65 28 70 6f 69 6e 74 |m;...while(point| 00002550 65 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 0a 09 |er != NULL) {...| 00002560 09 61 75 5f 77 6f 72 64 74 6f 62 79 74 65 28 70 |.au_wordtobyte(p| 00002570 6f 69 6e 74 65 72 2d 3e 66 6c 61 67 73 2c 20 6d |ointer->flags, m| 00002580 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f |enu_dat->datablo| 00002590 63 6b 2c 20 69 29 3b 0a 09 09 69 20 2b 3d 20 34 |ck, i);...i += 4| 000025a0 3b 0a 09 09 61 75 5f 77 6f 72 64 74 6f 62 79 74 |;...au_wordtobyt| 000025b0 65 28 70 6f 69 6e 74 65 72 2d 3e 73 75 62 6d 65 |e(pointer->subme| 000025c0 6e 75 2c 20 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 |nu, menu_dat->da| 000025d0 74 61 62 6c 6f 63 6b 2c 20 69 29 3b 0a 09 09 69 |tablock, i);...i| 000025e0 20 2b 3d 20 34 3b 0a 09 09 61 75 5f 77 6f 72 64 | += 4;...au_word| 000025f0 74 6f 62 79 74 65 28 70 6f 69 6e 74 65 72 2d 3e |tobyte(pointer->| 00002600 6d 65 6e 75 5f 69 63 6f 6e 66 6c 61 67 73 2c 20 |menu_iconflags, | 00002610 6d 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c |menu_dat->databl| 00002620 6f 63 6b 2c 20 69 29 3b 0a 09 09 69 20 2b 3d 20 |ock, i);...i += | 00002630 34 3b 0a 09 09 73 74 72 63 70 79 28 28 63 68 61 |4;...strcpy((cha| 00002640 72 20 2a 29 20 26 6d 65 6e 75 5f 64 61 74 2d 3e |r *) &menu_dat->| 00002650 64 61 74 61 62 6c 6f 63 6b 5b 69 5d 2c 20 70 6f |datablock[i], po| 00002660 69 6e 74 65 72 2d 3e 6d 65 6e 75 5f 74 65 78 74 |inter->menu_text| 00002670 29 3b 0a 09 09 69 20 2b 3d 20 31 32 3b 0a 09 09 |);...i += 12;...| 00002680 70 6f 69 6e 74 65 72 20 3d 20 70 6f 69 6e 74 65 |pointer = pointe| 00002690 72 2d 3e 6e 65 78 74 5f 6d 65 6e 75 65 6c 65 6d |r->next_menuelem| 000026a0 3b 0a 09 7d 0a 09 72 65 74 75 72 6e 3b 0a 7d 0a |;..}..return;.}.| 000026b0 0a 76 6f 69 64 0a 61 75 5f 6f 70 65 6e 6d 65 6e |.void.au_openmen| 000026c0 75 28 6d 65 6e 75 5f 64 61 74 61 20 2a 6d 65 6e |u(menu_data *men| 000026d0 75 5f 64 61 74 2c 20 69 6e 74 20 6d 6f 75 73 65 |u_dat, int mouse| 000026e0 5f 78 2c 20 69 6e 74 20 6d 6f 75 73 65 5f 79 29 |_x, int mouse_y)| 000026f0 0a 7b 0a 09 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f |.{.._kernel_swi_| 00002700 72 65 67 73 09 72 65 67 73 5f 69 6e 2c 20 72 65 |regs.regs_in, re| 00002710 67 73 5f 6f 75 74 3b 0a 0a 09 72 65 67 73 5f 69 |gs_out;...regs_i| 00002720 6e 2e 72 5b 31 5d 20 3d 20 28 69 6e 74 29 20 6d |n.r[1] = (int) m| 00002730 65 6e 75 5f 64 61 74 2d 3e 64 61 74 61 62 6c 6f |enu_dat->datablo| 00002740 63 6b 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 5b 32 |ck;..regs_in.r[2| 00002750 5d 20 3d 20 6d 6f 75 73 65 5f 78 3b 0a 09 72 65 |] = mouse_x;..re| 00002760 67 73 5f 69 6e 2e 72 5b 33 5d 20 3d 20 6d 6f 75 |gs_in.r[3] = mou| 00002770 73 65 5f 79 3b 0a 09 5f 6b 65 72 6e 65 6c 5f 73 |se_y;.._kernel_s| 00002780 77 69 28 57 69 6d 70 5f 43 72 65 61 74 65 4d 65 |wi(Wimp_CreateMe| 00002790 6e 75 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 |nu, ®s_in, &r| 000027a0 65 67 73 5f 6f 75 74 29 3b 0a 09 72 65 74 75 72 |egs_out);..retur| 000027b0 6e 3b 0a 7d 0a 0a 76 6f 69 64 0a 61 75 5f 6c 6f |n;.}..void.au_lo| 000027c0 73 65 63 61 72 65 74 28 76 6f 69 64 29 0a 7b 0a |secaret(void).{.| 000027d0 09 5f 6b 65 72 6e 65 6c 5f 73 77 69 5f 72 65 67 |._kernel_swi_reg| 000027e0 73 09 72 65 67 73 5f 69 6e 2c 20 72 65 67 73 5f |s.regs_in, regs_| 000027f0 6f 75 74 3b 0a 0a 09 72 65 67 73 5f 69 6e 2e 72 |out;...regs_in.r| 00002800 5b 30 5d 20 3d 20 2d 31 3b 0a 09 72 65 67 73 5f |[0] = -1;..regs_| 00002810 69 6e 2e 72 5b 31 5d 20 3d 20 2d 31 3b 0a 09 72 |in.r[1] = -1;..r| 00002820 65 67 73 5f 69 6e 2e 72 5b 30 5d 20 3d 20 2d 31 |egs_in.r[0] = -1| 00002830 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 5b 30 5d 20 |;..regs_in.r[0] | 00002840 3d 20 2d 31 3b 0a 09 72 65 67 73 5f 69 6e 2e 72 |= -1;..regs_in.r| 00002850 5b 34 5d 20 3d 20 2d 31 3b 0a 09 72 65 67 73 5f |[4] = -1;..regs_| 00002860 69 6e 2e 72 5b 35 5d 20 3d 20 2d 31 3b 0a 0a 09 |in.r[5] = -1;...| 00002870 5f 6b 65 72 6e 65 6c 5f 73 77 69 28 57 69 6d 70 |_kernel_swi(Wimp| 00002880 5f 53 65 74 43 61 72 65 74 50 6f 73 69 74 69 6f |_SetCaretPositio| 00002890 6e 2c 20 26 72 65 67 73 5f 69 6e 2c 20 26 72 65 |n, ®s_in, &re| 000028a0 67 73 5f 6f 75 74 29 3b 0a 7d 0a |gs_out);.}.| 000028ab
.