Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199607.adf » Regulars » Wimp_C/!NewWimpC/c/!RunImage

Wimp_C/!NewWimpC/c/!RunImage

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199607.adf » Regulars
Filename: Wimp_C/!NewWimpC/c/!RunImage
Read OK:
File size: 165F bytes
Load address: 0000
Exec address: 0000
File contents
/* An example program which makes use of the kernel SWI calls -
   this will compile with Acorn's C as well as Beebug's EasyC */
/* by Steve Mumford for Acorn User - June 1996 */

#include <stdio.h>
#include <string.h>
#include "AULib.h"

/* We also define a poll mask here to tell the WIMP about any events we're not
   intererested in */

#define POLL_MASK 1
#define MAX_WINDOWS 3

/* If we set QUIT_FLAG up as a global variable, it means that we can change it
 * anywhere within the program and shut things down next time we end the
 * polling loop */

int QUIT_FLAG = 0;
int DISPLAY_ICON = 1;
char appname[] = "New WIMPC Example";
window_data	win_array[MAX_WINDOWS];
menu_data	globmen, globmen2;

/* Function prototyping */

int      main(void);
void     wimpmsg(int, unsigned char[]);
void     mouseclick(unsigned char[]);
void     menuselection(unsigned char[]);
int      load_templates(void);
void     openwindow(unsigned char[]);
void     closewindow(unsigned char[]);

/* Program functions */

int
main(void) {
	int task_handle;
	unsigned char pollblock[257]; /* A byte array large enough for our polling block */
	int ibar_icon_handle; /* A variable to store our iconbar icon handle */
	int pollresult;
	int i;
	long int msglist[1] = {0}; /* Set up the acceptable message list for initialisation */

	task_handle = au_initialise(310, appname, msglist);
	/* Now, we'll put an icon on the icon bar */
	ibar_icon_handle = au_create_iconbar_icon(IBAR_PRIOR_APP,
		IBAR_ONRIGHT,
		ICON_ISSPRITE | ICON_HCENTRE | ICON_VCENTRE | ICON_CLICKNOTIFIESONCE,
		"!newwimpc");

/* Now open a template file ready for loading */

	load_templates();
	au_openwin_from_templatedata(&win_array[0], -1); /* Open first window at front (-1) */

    while (QUIT_FLAG == 0) {
	pollresult = au_wimp_poll(POLL_MASK, pollblock);
        switch (pollresult) {
            case  2: openwindow(pollblock);
                     break;
            case  3: closewindow(pollblock);
                     break;
            case  6: mouseclick(pollblock);
                     break;
                     /* If our icon is clicked on, we jump to mouseclick() */
            case  9: menuselection(pollblock);
                     break;
            case 17:
            case 18:
            case 19: wimpmsg(pollresult, pollblock);
                break;
            /* The above section listens for event codes 17, 18 and 19 - the
               ones which indicate we're being sent a message */
        }
    }
    /* If QUIT_FLAG changes to anything but 0, we stop going round the polling
     * loop and shut down */

    au_closedown(task_handle);
    /* Need to release malloc memory from window structures */
	for(i = 0; i < MAX_WINDOWS; i++) {
		free(win_array[i].win_name);
		free(win_array[i].buffer);
		free(win_array[i].workspace);
	}
}

void
wimpmsg(int result, unsigned char pollblock[])
{
    unsigned long int   message_action;

    /* The next line takes bytes 16 to 19 of the polling block and forms them
       into a word holding the message action number */
    message_action = au_bytetoword(pollblock, 16);
    
    switch (message_action) {
        case 0: QUIT_FLAG = 1; /* Message_Quit - time to go */
                break;
        case 0x400c2: au_icon_text_change((char *) &pollblock[28], win_array[0].win_handle, DISPLAY_ICON);
                break;        
        /* More message actions can be added here */
    }
}

void
menuselection(unsigned char block[])
{
   /* We would check which menu was active etc. here */
   
   if(au_bytetoword(block, 0) == 1) {
       /* This is the 'quit' entry */
       QUIT_FLAG = 1;
   }
   return;
}

void
mouseclick(unsigned char pollblock[])
{
   char message[255];
   /* A buffer to hold an 'error' message */

   int clk;
   _kernel_swi_regs in, out;
   unsigned char temp_buffer[255];

   /* Determine which button was pressed */
   clk = (int) au_bytetoword(pollblock, 8);

   /* If the 'Select' button was clicked on the icon bar (pollblock + 12 = -2)
      then re-open main window and return */

   if((au_bytetoword(pollblock, 12) == -2) && (clk == 4)) {
      au_wordtobyte(win_array[0].win_handle, temp_buffer, 0);
      in.r[1] = (int) temp_buffer;
      _kernel_swi(Wimp_GetWindowInfo, &in, &out);
      _kernel_swi(Wimp_OpenWindow, &in, &out);
      return;
   }

   if((au_bytetoword(pollblock, 12) == -2) && (clk == 2)) {
      /* 'Menu' has been clicked on the icon bar icon - now we produce
         a menu */
	au_buildmenu("Submenu", &globmen2);
	au_addtomenu("Entry", MENU_LASTITEM, -1, 0, &globmen2);
	au_createmenu(&globmen2);

	au_buildmenu("Test menu", &globmen);
	au_addtomenu("Entry 1", MENU_TICK | MENU_DOTTED, (int) globmen2.datablock, 0, &globmen);
	au_addtomenu("Quit", MENU_LASTITEM, -1, 0, &globmen);
	au_createmenu(&globmen);
	au_openmenu(&globmen, (int) au_bytetoword(pollblock, 0) - 64, (44*2)+96);
	return;
   }

   strcpy(message, "Mouse click detected (type");
   sprintf(message, "%s %d) - do you wish to stop the program?", message, clk);
   if(au_report_error(1, message, 3, appname) == 1) QUIT_FLAG = 1;
}

int
load_templates(void)
{
	au_opentemplate("<WimpC$Dir>.Templates");
	if(au_loadtemplate("MainWindow", &win_array[0], 0) == 0) {
		au_report_error(1, "Template not found!", 1, appname);
		QUIT_FLAG = 1;
	}
	/* Now we've finished reading the templates, close the file */
	au_closetemplate();
	return 0;
}

void openwindow(unsigned char pollblock[])
{
   _kernel_swi_regs in, out;

   in.r[1] = (int) pollblock;
   _kernel_swi(Wimp_OpenWindow, &in, &out);
   return;
}

void closewindow(unsigned char pollblock[])
{
   _kernel_swi_regs in, out;

   in.r[1] = (int) pollblock;
   _kernel_swi(Wimp_CloseWindow, &in, &out);
   return;
}
00000000  2f 2a 20 41 6e 20 65 78  61 6d 70 6c 65 20 70 72  |/* An example pr|
00000010  6f 67 72 61 6d 20 77 68  69 63 68 20 6d 61 6b 65  |ogram which make|
00000020  73 20 75 73 65 20 6f 66  20 74 68 65 20 6b 65 72  |s use of the ker|
00000030  6e 65 6c 20 53 57 49 20  63 61 6c 6c 73 20 2d 0a  |nel SWI calls -.|
00000040  20 20 20 74 68 69 73 20  77 69 6c 6c 20 63 6f 6d  |   this will com|
00000050  70 69 6c 65 20 77 69 74  68 20 41 63 6f 72 6e 27  |pile with Acorn'|
00000060  73 20 43 20 61 73 20 77  65 6c 6c 20 61 73 20 42  |s C as well as B|
00000070  65 65 62 75 67 27 73 20  45 61 73 79 43 20 2a 2f  |eebug's EasyC */|
00000080  0a 2f 2a 20 62 79 20 53  74 65 76 65 20 4d 75 6d  |./* by Steve Mum|
00000090  66 6f 72 64 20 66 6f 72  20 41 63 6f 72 6e 20 55  |ford for Acorn U|
000000a0  73 65 72 20 2d 20 4a 75  6e 65 20 31 39 39 36 20  |ser - June 1996 |
000000b0  2a 2f 0a 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |*/..#include <st|
000000c0  64 69 6f 2e 68 3e 0a 23  69 6e 63 6c 75 64 65 20  |dio.h>.#include |
000000d0  3c 73 74 72 69 6e 67 2e  68 3e 0a 23 69 6e 63 6c  |<string.h>.#incl|
000000e0  75 64 65 20 22 41 55 4c  69 62 2e 68 22 0a 0a 2f  |ude "AULib.h"../|
000000f0  2a 20 57 65 20 61 6c 73  6f 20 64 65 66 69 6e 65  |* We also define|
00000100  20 61 20 70 6f 6c 6c 20  6d 61 73 6b 20 68 65 72  | a poll mask her|
00000110  65 20 74 6f 20 74 65 6c  6c 20 74 68 65 20 57 49  |e to tell the WI|
00000120  4d 50 20 61 62 6f 75 74  20 61 6e 79 20 65 76 65  |MP about any eve|
00000130  6e 74 73 20 77 65 27 72  65 20 6e 6f 74 0a 20 20  |nts we're not.  |
00000140  20 69 6e 74 65 72 65 72  65 73 74 65 64 20 69 6e  | intererested in|
00000150  20 2a 2f 0a 0a 23 64 65  66 69 6e 65 20 50 4f 4c  | */..#define POL|
00000160  4c 5f 4d 41 53 4b 20 31  0a 23 64 65 66 69 6e 65  |L_MASK 1.#define|
00000170  20 4d 41 58 5f 57 49 4e  44 4f 57 53 20 33 0a 0a  | MAX_WINDOWS 3..|
00000180  2f 2a 20 49 66 20 77 65  20 73 65 74 20 51 55 49  |/* If we set QUI|
00000190  54 5f 46 4c 41 47 20 75  70 20 61 73 20 61 20 67  |T_FLAG up as a g|
000001a0  6c 6f 62 61 6c 20 76 61  72 69 61 62 6c 65 2c 20  |lobal variable, |
000001b0  69 74 20 6d 65 61 6e 73  20 74 68 61 74 20 77 65  |it means that we|
000001c0  20 63 61 6e 20 63 68 61  6e 67 65 20 69 74 0a 20  | can change it. |
000001d0  2a 20 61 6e 79 77 68 65  72 65 20 77 69 74 68 69  |* anywhere withi|
000001e0  6e 20 74 68 65 20 70 72  6f 67 72 61 6d 20 61 6e  |n the program an|
000001f0  64 20 73 68 75 74 20 74  68 69 6e 67 73 20 64 6f  |d shut things do|
00000200  77 6e 20 6e 65 78 74 20  74 69 6d 65 20 77 65 20  |wn next time we |
00000210  65 6e 64 20 74 68 65 0a  20 2a 20 70 6f 6c 6c 69  |end the. * polli|
00000220  6e 67 20 6c 6f 6f 70 20  2a 2f 0a 0a 69 6e 74 20  |ng loop */..int |
00000230  51 55 49 54 5f 46 4c 41  47 20 3d 20 30 3b 0a 69  |QUIT_FLAG = 0;.i|
00000240  6e 74 20 44 49 53 50 4c  41 59 5f 49 43 4f 4e 20  |nt DISPLAY_ICON |
00000250  3d 20 31 3b 0a 63 68 61  72 20 61 70 70 6e 61 6d  |= 1;.char appnam|
00000260  65 5b 5d 20 3d 20 22 4e  65 77 20 57 49 4d 50 43  |e[] = "New WIMPC|
00000270  20 45 78 61 6d 70 6c 65  22 3b 0a 77 69 6e 64 6f  | Example";.windo|
00000280  77 5f 64 61 74 61 09 77  69 6e 5f 61 72 72 61 79  |w_data.win_array|
00000290  5b 4d 41 58 5f 57 49 4e  44 4f 57 53 5d 3b 0a 6d  |[MAX_WINDOWS];.m|
000002a0  65 6e 75 5f 64 61 74 61  09 67 6c 6f 62 6d 65 6e  |enu_data.globmen|
000002b0  2c 20 67 6c 6f 62 6d 65  6e 32 3b 0a 0a 2f 2a 20  |, globmen2;../* |
000002c0  46 75 6e 63 74 69 6f 6e  20 70 72 6f 74 6f 74 79  |Function prototy|
000002d0  70 69 6e 67 20 2a 2f 0a  0a 69 6e 74 20 20 20 20  |ping */..int    |
000002e0  20 20 6d 61 69 6e 28 76  6f 69 64 29 3b 0a 76 6f  |  main(void);.vo|
000002f0  69 64 20 20 20 20 20 77  69 6d 70 6d 73 67 28 69  |id     wimpmsg(i|
00000300  6e 74 2c 20 75 6e 73 69  67 6e 65 64 20 63 68 61  |nt, unsigned cha|
00000310  72 5b 5d 29 3b 0a 76 6f  69 64 20 20 20 20 20 6d  |r[]);.void     m|
00000320  6f 75 73 65 63 6c 69 63  6b 28 75 6e 73 69 67 6e  |ouseclick(unsign|
00000330  65 64 20 63 68 61 72 5b  5d 29 3b 0a 76 6f 69 64  |ed char[]);.void|
00000340  20 20 20 20 20 6d 65 6e  75 73 65 6c 65 63 74 69  |     menuselecti|
00000350  6f 6e 28 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |on(unsigned char|
00000360  5b 5d 29 3b 0a 69 6e 74  20 20 20 20 20 20 6c 6f  |[]);.int      lo|
00000370  61 64 5f 74 65 6d 70 6c  61 74 65 73 28 76 6f 69  |ad_templates(voi|
00000380  64 29 3b 0a 76 6f 69 64  20 20 20 20 20 6f 70 65  |d);.void     ope|
00000390  6e 77 69 6e 64 6f 77 28  75 6e 73 69 67 6e 65 64  |nwindow(unsigned|
000003a0  20 63 68 61 72 5b 5d 29  3b 0a 76 6f 69 64 20 20  | char[]);.void  |
000003b0  20 20 20 63 6c 6f 73 65  77 69 6e 64 6f 77 28 75  |   closewindow(u|
000003c0  6e 73 69 67 6e 65 64 20  63 68 61 72 5b 5d 29 3b  |nsigned char[]);|
000003d0  0a 0a 2f 2a 20 50 72 6f  67 72 61 6d 20 66 75 6e  |../* Program fun|
000003e0  63 74 69 6f 6e 73 20 2a  2f 0a 0a 69 6e 74 0a 6d  |ctions */..int.m|
000003f0  61 69 6e 28 76 6f 69 64  29 20 7b 0a 09 69 6e 74  |ain(void) {..int|
00000400  20 74 61 73 6b 5f 68 61  6e 64 6c 65 3b 0a 09 75  | task_handle;..u|
00000410  6e 73 69 67 6e 65 64 20  63 68 61 72 20 70 6f 6c  |nsigned char pol|
00000420  6c 62 6c 6f 63 6b 5b 32  35 37 5d 3b 20 2f 2a 20  |lblock[257]; /* |
00000430  41 20 62 79 74 65 20 61  72 72 61 79 20 6c 61 72  |A byte array lar|
00000440  67 65 20 65 6e 6f 75 67  68 20 66 6f 72 20 6f 75  |ge enough for ou|
00000450  72 20 70 6f 6c 6c 69 6e  67 20 62 6c 6f 63 6b 20  |r polling block |
00000460  2a 2f 0a 09 69 6e 74 20  69 62 61 72 5f 69 63 6f  |*/..int ibar_ico|
00000470  6e 5f 68 61 6e 64 6c 65  3b 20 2f 2a 20 41 20 76  |n_handle; /* A v|
00000480  61 72 69 61 62 6c 65 20  74 6f 20 73 74 6f 72 65  |ariable to store|
00000490  20 6f 75 72 20 69 63 6f  6e 62 61 72 20 69 63 6f  | our iconbar ico|
000004a0  6e 20 68 61 6e 64 6c 65  20 2a 2f 0a 09 69 6e 74  |n handle */..int|
000004b0  20 70 6f 6c 6c 72 65 73  75 6c 74 3b 0a 09 69 6e  | pollresult;..in|
000004c0  74 20 69 3b 0a 09 6c 6f  6e 67 20 69 6e 74 20 6d  |t i;..long int m|
000004d0  73 67 6c 69 73 74 5b 31  5d 20 3d 20 7b 30 7d 3b  |sglist[1] = {0};|
000004e0  20 2f 2a 20 53 65 74 20  75 70 20 74 68 65 20 61  | /* Set up the a|
000004f0  63 63 65 70 74 61 62 6c  65 20 6d 65 73 73 61 67  |cceptable messag|
00000500  65 20 6c 69 73 74 20 66  6f 72 20 69 6e 69 74 69  |e list for initi|
00000510  61 6c 69 73 61 74 69 6f  6e 20 2a 2f 0a 0a 09 74  |alisation */...t|
00000520  61 73 6b 5f 68 61 6e 64  6c 65 20 3d 20 61 75 5f  |ask_handle = au_|
00000530  69 6e 69 74 69 61 6c 69  73 65 28 33 31 30 2c 20  |initialise(310, |
00000540  61 70 70 6e 61 6d 65 2c  20 6d 73 67 6c 69 73 74  |appname, msglist|
00000550  29 3b 0a 09 2f 2a 20 4e  6f 77 2c 20 77 65 27 6c  |);../* Now, we'l|
00000560  6c 20 70 75 74 20 61 6e  20 69 63 6f 6e 20 6f 6e  |l put an icon on|
00000570  20 74 68 65 20 69 63 6f  6e 20 62 61 72 20 2a 2f  | the icon bar */|
00000580  0a 09 69 62 61 72 5f 69  63 6f 6e 5f 68 61 6e 64  |..ibar_icon_hand|
00000590  6c 65 20 3d 20 61 75 5f  63 72 65 61 74 65 5f 69  |le = au_create_i|
000005a0  63 6f 6e 62 61 72 5f 69  63 6f 6e 28 49 42 41 52  |conbar_icon(IBAR|
000005b0  5f 50 52 49 4f 52 5f 41  50 50 2c 0a 09 09 49 42  |_PRIOR_APP,...IB|
000005c0  41 52 5f 4f 4e 52 49 47  48 54 2c 0a 09 09 49 43  |AR_ONRIGHT,...IC|
000005d0  4f 4e 5f 49 53 53 50 52  49 54 45 20 7c 20 49 43  |ON_ISSPRITE | IC|
000005e0  4f 4e 5f 48 43 45 4e 54  52 45 20 7c 20 49 43 4f  |ON_HCENTRE | ICO|
000005f0  4e 5f 56 43 45 4e 54 52  45 20 7c 20 49 43 4f 4e  |N_VCENTRE | ICON|
00000600  5f 43 4c 49 43 4b 4e 4f  54 49 46 49 45 53 4f 4e  |_CLICKNOTIFIESON|
00000610  43 45 2c 0a 09 09 22 21  6e 65 77 77 69 6d 70 63  |CE,..."!newwimpc|
00000620  22 29 3b 0a 0a 2f 2a 20  4e 6f 77 20 6f 70 65 6e  |");../* Now open|
00000630  20 61 20 74 65 6d 70 6c  61 74 65 20 66 69 6c 65  | a template file|
00000640  20 72 65 61 64 79 20 66  6f 72 20 6c 6f 61 64 69  | ready for loadi|
00000650  6e 67 20 2a 2f 0a 0a 09  6c 6f 61 64 5f 74 65 6d  |ng */...load_tem|
00000660  70 6c 61 74 65 73 28 29  3b 0a 09 61 75 5f 6f 70  |plates();..au_op|
00000670  65 6e 77 69 6e 5f 66 72  6f 6d 5f 74 65 6d 70 6c  |enwin_from_templ|
00000680  61 74 65 64 61 74 61 28  26 77 69 6e 5f 61 72 72  |atedata(&win_arr|
00000690  61 79 5b 30 5d 2c 20 2d  31 29 3b 20 2f 2a 20 4f  |ay[0], -1); /* O|
000006a0  70 65 6e 20 66 69 72 73  74 20 77 69 6e 64 6f 77  |pen first window|
000006b0  20 61 74 20 66 72 6f 6e  74 20 28 2d 31 29 20 2a  | at front (-1) *|
000006c0  2f 0a 0a 20 20 20 20 77  68 69 6c 65 20 28 51 55  |/..    while (QU|
000006d0  49 54 5f 46 4c 41 47 20  3d 3d 20 30 29 20 7b 0a  |IT_FLAG == 0) {.|
000006e0  09 70 6f 6c 6c 72 65 73  75 6c 74 20 3d 20 61 75  |.pollresult = au|
000006f0  5f 77 69 6d 70 5f 70 6f  6c 6c 28 50 4f 4c 4c 5f  |_wimp_poll(POLL_|
00000700  4d 41 53 4b 2c 20 70 6f  6c 6c 62 6c 6f 63 6b 29  |MASK, pollblock)|
00000710  3b 0a 20 20 20 20 20 20  20 20 73 77 69 74 63 68  |;.        switch|
00000720  20 28 70 6f 6c 6c 72 65  73 75 6c 74 29 20 7b 0a  | (pollresult) {.|
00000730  20 20 20 20 20 20 20 20  20 20 20 20 63 61 73 65  |            case|
00000740  20 20 32 3a 20 6f 70 65  6e 77 69 6e 64 6f 77 28  |  2: openwindow(|
00000750  70 6f 6c 6c 62 6c 6f 63  6b 29 3b 0a 20 20 20 20  |pollblock);.    |
00000760  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000770  20 62 72 65 61 6b 3b 0a  20 20 20 20 20 20 20 20  | break;.        |
00000780  20 20 20 20 63 61 73 65  20 20 33 3a 20 63 6c 6f  |    case  3: clo|
00000790  73 65 77 69 6e 64 6f 77  28 70 6f 6c 6c 62 6c 6f  |sewindow(pollblo|
000007a0  63 6b 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |ck);.           |
000007b0  20 20 20 20 20 20 20 20  20 20 62 72 65 61 6b 3b  |          break;|
000007c0  0a 20 20 20 20 20 20 20  20 20 20 20 20 63 61 73  |.            cas|
000007d0  65 20 20 36 3a 20 6d 6f  75 73 65 63 6c 69 63 6b  |e  6: mouseclick|
000007e0  28 70 6f 6c 6c 62 6c 6f  63 6b 29 3b 0a 20 20 20  |(pollblock);.   |
000007f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000800  20 20 62 72 65 61 6b 3b  0a 20 20 20 20 20 20 20  |  break;.       |
00000810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2f 2a  |              /*|
00000820  20 49 66 20 6f 75 72 20  69 63 6f 6e 20 69 73 20  | If our icon is |
00000830  63 6c 69 63 6b 65 64 20  6f 6e 2c 20 77 65 20 6a  |clicked on, we j|
00000840  75 6d 70 20 74 6f 20 6d  6f 75 73 65 63 6c 69 63  |ump to mouseclic|
00000850  6b 28 29 20 2a 2f 0a 20  20 20 20 20 20 20 20 20  |k() */.         |
00000860  20 20 20 63 61 73 65 20  20 39 3a 20 6d 65 6e 75  |   case  9: menu|
00000870  73 65 6c 65 63 74 69 6f  6e 28 70 6f 6c 6c 62 6c  |selection(pollbl|
00000880  6f 63 6b 29 3b 0a 20 20  20 20 20 20 20 20 20 20  |ock);.          |
00000890  20 20 20 20 20 20 20 20  20 20 20 62 72 65 61 6b  |           break|
000008a0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 63 61  |;.            ca|
000008b0  73 65 20 31 37 3a 0a 20  20 20 20 20 20 20 20 20  |se 17:.         |
000008c0  20 20 20 63 61 73 65 20  31 38 3a 0a 20 20 20 20  |   case 18:.    |
000008d0  20 20 20 20 20 20 20 20  63 61 73 65 20 31 39 3a  |        case 19:|
000008e0  20 77 69 6d 70 6d 73 67  28 70 6f 6c 6c 72 65 73  | wimpmsg(pollres|
000008f0  75 6c 74 2c 20 70 6f 6c  6c 62 6c 6f 63 6b 29 3b  |ult, pollblock);|
00000900  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000910  20 62 72 65 61 6b 3b 0a  20 20 20 20 20 20 20 20  | break;.        |
00000920  20 20 20 20 2f 2a 20 54  68 65 20 61 62 6f 76 65  |    /* The above|
00000930  20 73 65 63 74 69 6f 6e  20 6c 69 73 74 65 6e 73  | section listens|
00000940  20 66 6f 72 20 65 76 65  6e 74 20 63 6f 64 65 73  | for event codes|
00000950  20 31 37 2c 20 31 38 20  61 6e 64 20 31 39 20 2d  | 17, 18 and 19 -|
00000960  20 74 68 65 0a 20 20 20  20 20 20 20 20 20 20 20  | the.           |
00000970  20 20 20 20 6f 6e 65 73  20 77 68 69 63 68 20 69  |    ones which i|
00000980  6e 64 69 63 61 74 65 20  77 65 27 72 65 20 62 65  |ndicate we're be|
00000990  69 6e 67 20 73 65 6e 74  20 61 20 6d 65 73 73 61  |ing sent a messa|
000009a0  67 65 20 2a 2f 0a 20 20  20 20 20 20 20 20 7d 0a  |ge */.        }.|
000009b0  20 20 20 20 7d 0a 20 20  20 20 2f 2a 20 49 66 20  |    }.    /* If |
000009c0  51 55 49 54 5f 46 4c 41  47 20 63 68 61 6e 67 65  |QUIT_FLAG change|
000009d0  73 20 74 6f 20 61 6e 79  74 68 69 6e 67 20 62 75  |s to anything bu|
000009e0  74 20 30 2c 20 77 65 20  73 74 6f 70 20 67 6f 69  |t 0, we stop goi|
000009f0  6e 67 20 72 6f 75 6e 64  20 74 68 65 20 70 6f 6c  |ng round the pol|
00000a00  6c 69 6e 67 0a 20 20 20  20 20 2a 20 6c 6f 6f 70  |ling.     * loop|
00000a10  20 61 6e 64 20 73 68 75  74 20 64 6f 77 6e 20 2a  | and shut down *|
00000a20  2f 0a 0a 20 20 20 20 61  75 5f 63 6c 6f 73 65 64  |/..    au_closed|
00000a30  6f 77 6e 28 74 61 73 6b  5f 68 61 6e 64 6c 65 29  |own(task_handle)|
00000a40  3b 0a 20 20 20 20 2f 2a  20 4e 65 65 64 20 74 6f  |;.    /* Need to|
00000a50  20 72 65 6c 65 61 73 65  20 6d 61 6c 6c 6f 63 20  | release malloc |
00000a60  6d 65 6d 6f 72 79 20 66  72 6f 6d 20 77 69 6e 64  |memory from wind|
00000a70  6f 77 20 73 74 72 75 63  74 75 72 65 73 20 2a 2f  |ow structures */|
00000a80  0a 09 66 6f 72 28 69 20  3d 20 30 3b 20 69 20 3c  |..for(i = 0; i <|
00000a90  20 4d 41 58 5f 57 49 4e  44 4f 57 53 3b 20 69 2b  | MAX_WINDOWS; i+|
00000aa0  2b 29 20 7b 0a 09 09 66  72 65 65 28 77 69 6e 5f  |+) {...free(win_|
00000ab0  61 72 72 61 79 5b 69 5d  2e 77 69 6e 5f 6e 61 6d  |array[i].win_nam|
00000ac0  65 29 3b 0a 09 09 66 72  65 65 28 77 69 6e 5f 61  |e);...free(win_a|
00000ad0  72 72 61 79 5b 69 5d 2e  62 75 66 66 65 72 29 3b  |rray[i].buffer);|
00000ae0  0a 09 09 66 72 65 65 28  77 69 6e 5f 61 72 72 61  |...free(win_arra|
00000af0  79 5b 69 5d 2e 77 6f 72  6b 73 70 61 63 65 29 3b  |y[i].workspace);|
00000b00  0a 09 7d 0a 7d 0a 0a 76  6f 69 64 0a 77 69 6d 70  |..}.}..void.wimp|
00000b10  6d 73 67 28 69 6e 74 20  72 65 73 75 6c 74 2c 20  |msg(int result, |
00000b20  75 6e 73 69 67 6e 65 64  20 63 68 61 72 20 70 6f  |unsigned char po|
00000b30  6c 6c 62 6c 6f 63 6b 5b  5d 29 0a 7b 0a 20 20 20  |llblock[]).{.   |
00000b40  20 75 6e 73 69 67 6e 65  64 20 6c 6f 6e 67 20 69  | unsigned long i|
00000b50  6e 74 20 20 20 6d 65 73  73 61 67 65 5f 61 63 74  |nt   message_act|
00000b60  69 6f 6e 3b 0a 0a 20 20  20 20 2f 2a 20 54 68 65  |ion;..    /* The|
00000b70  20 6e 65 78 74 20 6c 69  6e 65 20 74 61 6b 65 73  | next line takes|
00000b80  20 62 79 74 65 73 20 31  36 20 74 6f 20 31 39 20  | bytes 16 to 19 |
00000b90  6f 66 20 74 68 65 20 70  6f 6c 6c 69 6e 67 20 62  |of the polling b|
00000ba0  6c 6f 63 6b 20 61 6e 64  20 66 6f 72 6d 73 20 74  |lock and forms t|
00000bb0  68 65 6d 0a 20 20 20 20  20 20 20 69 6e 74 6f 20  |hem.       into |
00000bc0  61 20 77 6f 72 64 20 68  6f 6c 64 69 6e 67 20 74  |a word holding t|
00000bd0  68 65 20 6d 65 73 73 61  67 65 20 61 63 74 69 6f  |he message actio|
00000be0  6e 20 6e 75 6d 62 65 72  20 2a 2f 0a 20 20 20 20  |n number */.    |
00000bf0  6d 65 73 73 61 67 65 5f  61 63 74 69 6f 6e 20 3d  |message_action =|
00000c00  20 61 75 5f 62 79 74 65  74 6f 77 6f 72 64 28 70  | au_bytetoword(p|
00000c10  6f 6c 6c 62 6c 6f 63 6b  2c 20 31 36 29 3b 0a 20  |ollblock, 16);. |
00000c20  20 20 20 0a 20 20 20 20  73 77 69 74 63 68 20 28  |   .    switch (|
00000c30  6d 65 73 73 61 67 65 5f  61 63 74 69 6f 6e 29 20  |message_action) |
00000c40  7b 0a 20 20 20 20 20 20  20 20 63 61 73 65 20 30  |{.        case 0|
00000c50  3a 20 51 55 49 54 5f 46  4c 41 47 20 3d 20 31 3b  |: QUIT_FLAG = 1;|
00000c60  20 2f 2a 20 4d 65 73 73  61 67 65 5f 51 75 69 74  | /* Message_Quit|
00000c70  20 2d 20 74 69 6d 65 20  74 6f 20 67 6f 20 2a 2f  | - time to go */|
00000c80  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000c90  20 62 72 65 61 6b 3b 0a  20 20 20 20 20 20 20 20  | break;.        |
00000ca0  63 61 73 65 20 30 78 34  30 30 63 32 3a 20 61 75  |case 0x400c2: au|
00000cb0  5f 69 63 6f 6e 5f 74 65  78 74 5f 63 68 61 6e 67  |_icon_text_chang|
00000cc0  65 28 28 63 68 61 72 20  2a 29 20 26 70 6f 6c 6c  |e((char *) &poll|
00000cd0  62 6c 6f 63 6b 5b 32 38  5d 2c 20 77 69 6e 5f 61  |block[28], win_a|
00000ce0  72 72 61 79 5b 30 5d 2e  77 69 6e 5f 68 61 6e 64  |rray[0].win_hand|
00000cf0  6c 65 2c 20 44 49 53 50  4c 41 59 5f 49 43 4f 4e  |le, DISPLAY_ICON|
00000d00  29 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |);.             |
00000d10  20 20 20 62 72 65 61 6b  3b 20 20 20 20 20 20 20  |   break;       |
00000d20  20 0a 20 20 20 20 20 20  20 20 2f 2a 20 4d 6f 72  | .        /* Mor|
00000d30  65 20 6d 65 73 73 61 67  65 20 61 63 74 69 6f 6e  |e message action|
00000d40  73 20 63 61 6e 20 62 65  20 61 64 64 65 64 20 68  |s can be added h|
00000d50  65 72 65 20 2a 2f 0a 20  20 20 20 7d 0a 7d 0a 0a  |ere */.    }.}..|
00000d60  76 6f 69 64 0a 6d 65 6e  75 73 65 6c 65 63 74 69  |void.menuselecti|
00000d70  6f 6e 28 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |on(unsigned char|
00000d80  20 62 6c 6f 63 6b 5b 5d  29 0a 7b 0a 20 20 20 2f  | block[]).{.   /|
00000d90  2a 20 57 65 20 77 6f 75  6c 64 20 63 68 65 63 6b  |* We would check|
00000da0  20 77 68 69 63 68 20 6d  65 6e 75 20 77 61 73 20  | which menu was |
00000db0  61 63 74 69 76 65 20 65  74 63 2e 20 68 65 72 65  |active etc. here|
00000dc0  20 2a 2f 0a 20 20 20 0a  20 20 20 69 66 28 61 75  | */.   .   if(au|
00000dd0  5f 62 79 74 65 74 6f 77  6f 72 64 28 62 6c 6f 63  |_bytetoword(bloc|
00000de0  6b 2c 20 30 29 20 3d 3d  20 31 29 20 7b 0a 20 20  |k, 0) == 1) {.  |
00000df0  20 20 20 20 20 2f 2a 20  54 68 69 73 20 69 73 20  |     /* This is |
00000e00  74 68 65 20 27 71 75 69  74 27 20 65 6e 74 72 79  |the 'quit' entry|
00000e10  20 2a 2f 0a 20 20 20 20  20 20 20 51 55 49 54 5f  | */.       QUIT_|
00000e20  46 4c 41 47 20 3d 20 31  3b 0a 20 20 20 7d 0a 20  |FLAG = 1;.   }. |
00000e30  20 20 72 65 74 75 72 6e  3b 0a 7d 0a 0a 76 6f 69  |  return;.}..voi|
00000e40  64 0a 6d 6f 75 73 65 63  6c 69 63 6b 28 75 6e 73  |d.mouseclick(uns|
00000e50  69 67 6e 65 64 20 63 68  61 72 20 70 6f 6c 6c 62  |igned char pollb|
00000e60  6c 6f 63 6b 5b 5d 29 0a  7b 0a 20 20 20 63 68 61  |lock[]).{.   cha|
00000e70  72 20 6d 65 73 73 61 67  65 5b 32 35 35 5d 3b 0a  |r message[255];.|
00000e80  20 20 20 2f 2a 20 41 20  62 75 66 66 65 72 20 74  |   /* A buffer t|
00000e90  6f 20 68 6f 6c 64 20 61  6e 20 27 65 72 72 6f 72  |o hold an 'error|
00000ea0  27 20 6d 65 73 73 61 67  65 20 2a 2f 0a 0a 20 20  |' message */..  |
00000eb0  20 69 6e 74 20 63 6c 6b  3b 0a 20 20 20 5f 6b 65  | int clk;.   _ke|
00000ec0  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 20 69 6e  |rnel_swi_regs in|
00000ed0  2c 20 6f 75 74 3b 0a 20  20 20 75 6e 73 69 67 6e  |, out;.   unsign|
00000ee0  65 64 20 63 68 61 72 20  74 65 6d 70 5f 62 75 66  |ed char temp_buf|
00000ef0  66 65 72 5b 32 35 35 5d  3b 0a 0a 20 20 20 2f 2a  |fer[255];..   /*|
00000f00  20 44 65 74 65 72 6d 69  6e 65 20 77 68 69 63 68  | Determine which|
00000f10  20 62 75 74 74 6f 6e 20  77 61 73 20 70 72 65 73  | button was pres|
00000f20  73 65 64 20 2a 2f 0a 20  20 20 63 6c 6b 20 3d 20  |sed */.   clk = |
00000f30  28 69 6e 74 29 20 61 75  5f 62 79 74 65 74 6f 77  |(int) au_bytetow|
00000f40  6f 72 64 28 70 6f 6c 6c  62 6c 6f 63 6b 2c 20 38  |ord(pollblock, 8|
00000f50  29 3b 0a 0a 20 20 20 2f  2a 20 49 66 20 74 68 65  |);..   /* If the|
00000f60  20 27 53 65 6c 65 63 74  27 20 62 75 74 74 6f 6e  | 'Select' button|
00000f70  20 77 61 73 20 63 6c 69  63 6b 65 64 20 6f 6e 20  | was clicked on |
00000f80  74 68 65 20 69 63 6f 6e  20 62 61 72 20 28 70 6f  |the icon bar (po|
00000f90  6c 6c 62 6c 6f 63 6b 20  2b 20 31 32 20 3d 20 2d  |llblock + 12 = -|
00000fa0  32 29 0a 20 20 20 20 20  20 74 68 65 6e 20 72 65  |2).      then re|
00000fb0  2d 6f 70 65 6e 20 6d 61  69 6e 20 77 69 6e 64 6f  |-open main windo|
00000fc0  77 20 61 6e 64 20 72 65  74 75 72 6e 20 2a 2f 0a  |w and return */.|
00000fd0  0a 20 20 20 69 66 28 28  61 75 5f 62 79 74 65 74  |.   if((au_bytet|
00000fe0  6f 77 6f 72 64 28 70 6f  6c 6c 62 6c 6f 63 6b 2c  |oword(pollblock,|
00000ff0  20 31 32 29 20 3d 3d 20  2d 32 29 20 26 26 20 28  | 12) == -2) && (|
00001000  63 6c 6b 20 3d 3d 20 34  29 29 20 7b 0a 20 20 20  |clk == 4)) {.   |
00001010  20 20 20 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |   au_wordtobyte|
00001020  28 77 69 6e 5f 61 72 72  61 79 5b 30 5d 2e 77 69  |(win_array[0].wi|
00001030  6e 5f 68 61 6e 64 6c 65  2c 20 74 65 6d 70 5f 62  |n_handle, temp_b|
00001040  75 66 66 65 72 2c 20 30  29 3b 0a 20 20 20 20 20  |uffer, 0);.     |
00001050  20 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  | in.r[1] = (int)|
00001060  20 74 65 6d 70 5f 62 75  66 66 65 72 3b 0a 20 20  | temp_buffer;.  |
00001070  20 20 20 20 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |    _kernel_swi(|
00001080  57 69 6d 70 5f 47 65 74  57 69 6e 64 6f 77 49 6e  |Wimp_GetWindowIn|
00001090  66 6f 2c 20 26 69 6e 2c  20 26 6f 75 74 29 3b 0a  |fo, &in, &out);.|
000010a0  20 20 20 20 20 20 5f 6b  65 72 6e 65 6c 5f 73 77  |      _kernel_sw|
000010b0  69 28 57 69 6d 70 5f 4f  70 65 6e 57 69 6e 64 6f  |i(Wimp_OpenWindo|
000010c0  77 2c 20 26 69 6e 2c 20  26 6f 75 74 29 3b 0a 20  |w, &in, &out);. |
000010d0  20 20 20 20 20 72 65 74  75 72 6e 3b 0a 20 20 20  |     return;.   |
000010e0  7d 0a 0a 20 20 20 69 66  28 28 61 75 5f 62 79 74  |}..   if((au_byt|
000010f0  65 74 6f 77 6f 72 64 28  70 6f 6c 6c 62 6c 6f 63  |etoword(pollbloc|
00001100  6b 2c 20 31 32 29 20 3d  3d 20 2d 32 29 20 26 26  |k, 12) == -2) &&|
00001110  20 28 63 6c 6b 20 3d 3d  20 32 29 29 20 7b 0a 20  | (clk == 2)) {. |
00001120  20 20 20 20 20 2f 2a 20  27 4d 65 6e 75 27 20 68  |     /* 'Menu' h|
00001130  61 73 20 62 65 65 6e 20  63 6c 69 63 6b 65 64 20  |as been clicked |
00001140  6f 6e 20 74 68 65 20 69  63 6f 6e 20 62 61 72 20  |on the icon bar |
00001150  69 63 6f 6e 20 2d 20 6e  6f 77 20 77 65 20 70 72  |icon - now we pr|
00001160  6f 64 75 63 65 0a 20 20  20 20 20 20 20 20 20 61  |oduce.         a|
00001170  20 6d 65 6e 75 20 2a 2f  0a 09 61 75 5f 62 75 69  | menu */..au_bui|
00001180  6c 64 6d 65 6e 75 28 22  53 75 62 6d 65 6e 75 22  |ldmenu("Submenu"|
00001190  2c 20 26 67 6c 6f 62 6d  65 6e 32 29 3b 0a 09 61  |, &globmen2);..a|
000011a0  75 5f 61 64 64 74 6f 6d  65 6e 75 28 22 45 6e 74  |u_addtomenu("Ent|
000011b0  72 79 22 2c 20 4d 45 4e  55 5f 4c 41 53 54 49 54  |ry", MENU_LASTIT|
000011c0  45 4d 2c 20 2d 31 2c 20  30 2c 20 26 67 6c 6f 62  |EM, -1, 0, &glob|
000011d0  6d 65 6e 32 29 3b 0a 09  61 75 5f 63 72 65 61 74  |men2);..au_creat|
000011e0  65 6d 65 6e 75 28 26 67  6c 6f 62 6d 65 6e 32 29  |emenu(&globmen2)|
000011f0  3b 0a 0a 09 61 75 5f 62  75 69 6c 64 6d 65 6e 75  |;...au_buildmenu|
00001200  28 22 54 65 73 74 20 6d  65 6e 75 22 2c 20 26 67  |("Test menu", &g|
00001210  6c 6f 62 6d 65 6e 29 3b  0a 09 61 75 5f 61 64 64  |lobmen);..au_add|
00001220  74 6f 6d 65 6e 75 28 22  45 6e 74 72 79 20 31 22  |tomenu("Entry 1"|
00001230  2c 20 4d 45 4e 55 5f 54  49 43 4b 20 7c 20 4d 45  |, MENU_TICK | ME|
00001240  4e 55 5f 44 4f 54 54 45  44 2c 20 28 69 6e 74 29  |NU_DOTTED, (int)|
00001250  20 67 6c 6f 62 6d 65 6e  32 2e 64 61 74 61 62 6c  | globmen2.databl|
00001260  6f 63 6b 2c 20 30 2c 20  26 67 6c 6f 62 6d 65 6e  |ock, 0, &globmen|
00001270  29 3b 0a 09 61 75 5f 61  64 64 74 6f 6d 65 6e 75  |);..au_addtomenu|
00001280  28 22 51 75 69 74 22 2c  20 4d 45 4e 55 5f 4c 41  |("Quit", MENU_LA|
00001290  53 54 49 54 45 4d 2c 20  2d 31 2c 20 30 2c 20 26  |STITEM, -1, 0, &|
000012a0  67 6c 6f 62 6d 65 6e 29  3b 0a 09 61 75 5f 63 72  |globmen);..au_cr|
000012b0  65 61 74 65 6d 65 6e 75  28 26 67 6c 6f 62 6d 65  |eatemenu(&globme|
000012c0  6e 29 3b 0a 09 61 75 5f  6f 70 65 6e 6d 65 6e 75  |n);..au_openmenu|
000012d0  28 26 67 6c 6f 62 6d 65  6e 2c 20 28 69 6e 74 29  |(&globmen, (int)|
000012e0  20 61 75 5f 62 79 74 65  74 6f 77 6f 72 64 28 70  | au_bytetoword(p|
000012f0  6f 6c 6c 62 6c 6f 63 6b  2c 20 30 29 20 2d 20 36  |ollblock, 0) - 6|
00001300  34 2c 20 28 34 34 2a 32  29 2b 39 36 29 3b 0a 09  |4, (44*2)+96);..|
00001310  72 65 74 75 72 6e 3b 0a  20 20 20 7d 0a 0a 20 20  |return;.   }..  |
00001320  20 73 74 72 63 70 79 28  6d 65 73 73 61 67 65 2c  | strcpy(message,|
00001330  20 22 4d 6f 75 73 65 20  63 6c 69 63 6b 20 64 65  | "Mouse click de|
00001340  74 65 63 74 65 64 20 28  74 79 70 65 22 29 3b 0a  |tected (type");.|
00001350  20 20 20 73 70 72 69 6e  74 66 28 6d 65 73 73 61  |   sprintf(messa|
00001360  67 65 2c 20 22 25 73 20  25 64 29 20 2d 20 64 6f  |ge, "%s %d) - do|
00001370  20 79 6f 75 20 77 69 73  68 20 74 6f 20 73 74 6f  | you wish to sto|
00001380  70 20 74 68 65 20 70 72  6f 67 72 61 6d 3f 22 2c  |p the program?",|
00001390  20 6d 65 73 73 61 67 65  2c 20 63 6c 6b 29 3b 0a  | message, clk);.|
000013a0  20 20 20 69 66 28 61 75  5f 72 65 70 6f 72 74 5f  |   if(au_report_|
000013b0  65 72 72 6f 72 28 31 2c  20 6d 65 73 73 61 67 65  |error(1, message|
000013c0  2c 20 33 2c 20 61 70 70  6e 61 6d 65 29 20 3d 3d  |, 3, appname) ==|
000013d0  20 31 29 20 51 55 49 54  5f 46 4c 41 47 20 3d 20  | 1) QUIT_FLAG = |
000013e0  31 3b 0a 7d 0a 0a 69 6e  74 0a 6c 6f 61 64 5f 74  |1;.}..int.load_t|
000013f0  65 6d 70 6c 61 74 65 73  28 76 6f 69 64 29 0a 7b  |emplates(void).{|
00001400  0a 09 61 75 5f 6f 70 65  6e 74 65 6d 70 6c 61 74  |..au_opentemplat|
00001410  65 28 22 3c 57 69 6d 70  43 24 44 69 72 3e 2e 54  |e("<WimpC$Dir>.T|
00001420  65 6d 70 6c 61 74 65 73  22 29 3b 0a 09 69 66 28  |emplates");..if(|
00001430  61 75 5f 6c 6f 61 64 74  65 6d 70 6c 61 74 65 28  |au_loadtemplate(|
00001440  22 4d 61 69 6e 57 69 6e  64 6f 77 22 2c 20 26 77  |"MainWindow", &w|
00001450  69 6e 5f 61 72 72 61 79  5b 30 5d 2c 20 30 29 20  |in_array[0], 0) |
00001460  3d 3d 20 30 29 20 7b 0a  09 09 61 75 5f 72 65 70  |== 0) {...au_rep|
00001470  6f 72 74 5f 65 72 72 6f  72 28 31 2c 20 22 54 65  |ort_error(1, "Te|
00001480  6d 70 6c 61 74 65 20 6e  6f 74 20 66 6f 75 6e 64  |mplate not found|
00001490  21 22 2c 20 31 2c 20 61  70 70 6e 61 6d 65 29 3b  |!", 1, appname);|
000014a0  0a 09 09 51 55 49 54 5f  46 4c 41 47 20 3d 20 31  |...QUIT_FLAG = 1|
000014b0  3b 0a 09 7d 0a 09 2f 2a  20 4e 6f 77 20 77 65 27  |;..}../* Now we'|
000014c0  76 65 20 66 69 6e 69 73  68 65 64 20 72 65 61 64  |ve finished read|
000014d0  69 6e 67 20 74 68 65 20  74 65 6d 70 6c 61 74 65  |ing the template|
000014e0  73 2c 20 63 6c 6f 73 65  20 74 68 65 20 66 69 6c  |s, close the fil|
000014f0  65 20 2a 2f 0a 09 61 75  5f 63 6c 6f 73 65 74 65  |e */..au_closete|
00001500  6d 70 6c 61 74 65 28 29  3b 0a 09 72 65 74 75 72  |mplate();..retur|
00001510  6e 20 30 3b 0a 7d 0a 0a  76 6f 69 64 20 6f 70 65  |n 0;.}..void ope|
00001520  6e 77 69 6e 64 6f 77 28  75 6e 73 69 67 6e 65 64  |nwindow(unsigned|
00001530  20 63 68 61 72 20 70 6f  6c 6c 62 6c 6f 63 6b 5b  | char pollblock[|
00001540  5d 29 0a 7b 0a 20 20 20  5f 6b 65 72 6e 65 6c 5f  |]).{.   _kernel_|
00001550  73 77 69 5f 72 65 67 73  20 69 6e 2c 20 6f 75 74  |swi_regs in, out|
00001560  3b 0a 0a 20 20 20 69 6e  2e 72 5b 31 5d 20 3d 20  |;..   in.r[1] = |
00001570  28 69 6e 74 29 20 70 6f  6c 6c 62 6c 6f 63 6b 3b  |(int) pollblock;|
00001580  0a 20 20 20 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |.   _kernel_swi(|
00001590  57 69 6d 70 5f 4f 70 65  6e 57 69 6e 64 6f 77 2c  |Wimp_OpenWindow,|
000015a0  20 26 69 6e 2c 20 26 6f  75 74 29 3b 0a 20 20 20  | &in, &out);.   |
000015b0  72 65 74 75 72 6e 3b 0a  7d 0a 0a 76 6f 69 64 20  |return;.}..void |
000015c0  63 6c 6f 73 65 77 69 6e  64 6f 77 28 75 6e 73 69  |closewindow(unsi|
000015d0  67 6e 65 64 20 63 68 61  72 20 70 6f 6c 6c 62 6c  |gned char pollbl|
000015e0  6f 63 6b 5b 5d 29 0a 7b  0a 20 20 20 5f 6b 65 72  |ock[]).{.   _ker|
000015f0  6e 65 6c 5f 73 77 69 5f  72 65 67 73 20 69 6e 2c  |nel_swi_regs in,|
00001600  20 6f 75 74 3b 0a 0a 20  20 20 69 6e 2e 72 5b 31  | out;..   in.r[1|
00001610  5d 20 3d 20 28 69 6e 74  29 20 70 6f 6c 6c 62 6c  |] = (int) pollbl|
00001620  6f 63 6b 3b 0a 20 20 20  5f 6b 65 72 6e 65 6c 5f  |ock;.   _kernel_|
00001630  73 77 69 28 57 69 6d 70  5f 43 6c 6f 73 65 57 69  |swi(Wimp_CloseWi|
00001640  6e 64 6f 77 2c 20 26 69  6e 2c 20 26 6f 75 74 29  |ndow, &in, &out)|
00001650  3b 0a 20 20 20 72 65 74  75 72 6e 3b 0a 7d 0a     |;.   return;.}.|
0000165f