Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199609.adf » Features » WimpC/!RAPS/c/!RunImage

WimpC/!RAPS/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_199609.adf » Features
Filename: WimpC/!RAPS/c/!RunImage
Read OK:
File size: 1887 bytes
Load address: 0000
Exec address: 0000
File contents
/* RAPS - a parachute jump database program
 * To demonstrate the Acorn User Wimp C library
 * by Steve Mumford for Acorn User, September 1996 */

/* #includes */

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

/* #defines */

#define POLL_MASK 1
#define MAX_WINDOWS 2
#define MAX_MENUS 1
#define MAX_JUMPS 15
#define VERSION_NUMBER 310 /* Risc OS version no. * 100 */

/* These #defines relate to the icon numbers in the template file */

#define CURRENT_RECORD_ICON 2
#define LAST_RECORD_ICON 4
#define PREV_RECORD_ICON 5
#define NEXT_RECORD_ICON 6
#define DATE_ICON 7
#define AIRCRAFT_ICON 9
#define DROPZONE_ICON 11
#define ALTITUDE_ICON 13
#define DELAY_ICON 15
#define AIRWORK_ICON 17
#define REMARKS1_ICON 19
#define REMARKS2_ICON 20

/* These next #defines set up the menu selection choices */

/* iconbar menu */
#define INFO_OPTION 0
#define QUIT_OPTION 1

typedef struct jump_data {
	int jump_no;
	char date[11];
	char aircraft[31];
	char dropzone[51];
	int altitude;
	int delay;
	char airwork[13];
	char remarks1[51];
	char remarks2[61];
} jump_data;

/* Global variables */

int	QUIT_FLAG = 0;
int	CURRENT_MENU = 0;
int	CURRENT_RECORD_NUMBER = 1;
int	LAST_RECORD_NUMBER = 10;

window_data	win_data[MAX_WINDOWS];
menu_data	men_data[MAX_MENUS];
jump_data	jump_records[MAX_JUMPS];
char appname[] = "RAPS Jump Logger";
char sprname[] = "!raps";
long int msglist[] = {0};

/* Function prototyping */

int	main(void);
void	openwindow(unsigned char[]);
void	closewindow(unsigned char[]);
void	loadtemplates(void);
void	mouse_click(unsigned char[]);
void	wimp_msg(int, unsigned char[]);
void	open_main_window(void);
void	prev_record(void);
void	next_record(void);
void	update_window_info(void);
void	menu_selection(unsigned char[]);

/* Main program */

int
main()
{
	int	task_handle, icon_handle;

	unsigned char	poll_block[256];
	int	poll_result;
	int	i = 0;

	task_handle = au_initialise(VERSION_NUMBER, appname, msglist);
	icon_handle = au_create_iconbar_icon(IBAR_PRIOR_APP,
			IBAR_ONRIGHT,
			ICON_ISSPRITE | ICON_HCENTRE | ICON_VCENTRE | ICON_CLICKNOTIFIESONCE,
			sprname);
	loadtemplates();
	/*au_openwin_from_templatedata(&win_data[0], -1); */
	while (QUIT_FLAG == 0) {
	/* do some polling */
		poll_result = au_wimp_poll(POLL_MASK, poll_block);
		switch (poll_result) {
			case  2 : openwindow(poll_block);
						break;
			case  3 : closewindow(poll_block);
						break;
			case  6 : mouse_click(poll_block);
						break;
			case  9 : menu_selection(poll_block);
						break;
			case 17 :
			case 18 :
			case 19 : wimp_msg(poll_result, poll_block);
						break;
		}
	}
	au_closedown(task_handle);

	for(i = 0; i < MAX_WINDOWS; i++) {
		free(win_data[i].win_name);
		free(win_data[i].buffer);
		free(win_data[i].workspace);
	}

	/* #Remember to free menu space! (recursion?) */
}

void mouse_click(unsigned char poll_block[])
{
	int	clk;
	long int	icon_num;

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

	if((au_bytetoword(poll_block, 12) == -2) && (clk == 4)) {
	open_main_window();
	}

	if((au_bytetoword(poll_block, 12) == -2) && (clk == 2)) {
		/* Time to produce a menu */
		au_buildmenu("RAPS", &men_data[0]);
		au_addtomenu("Info", 0, win_data[1].win_handle, 0, &men_data[0]);
		au_addtomenu("Quit", MENU_LASTITEM, -1, 0, &men_data[0]);
		au_createmenu(&men_data[0]);
		CURRENT_MENU = 1; /* keep track of the last menu we opened */
		au_openmenu(&men_data[0], (int) au_bytetoword(poll_block, 0) - 64, (44*2)+96);
		return;
	}

	/* Check to see if it was in the main window */
	if((au_bytetoword(poll_block, 12) == win_data[0].win_handle) && (clk == 4)) {
		icon_num = au_bytetoword(poll_block, 16);
		switch (icon_num) {
			case PREV_RECORD_ICON : prev_record();
				break;
			case NEXT_RECORD_ICON : next_record();
				break;
		}
	}

	return;
}

void menu_selection(unsigned char poll_block[])
{
	long int	first_hit;
	/* Which menu was hit? */
	if (CURRENT_MENU == 1) {
		/* The icon bar menu got it - decipher first menu subselection */
		first_hit = au_bytetoword(poll_block, 0);
		if (first_hit == QUIT_OPTION) {
			QUIT_FLAG = 1;
		}
	}
	return;
}

void prev_record(void)
{
	if (CURRENT_RECORD_NUMBER > 1) {
		CURRENT_RECORD_NUMBER--;
		/* would update window info here */
		update_window_info();
	}
}

void next_record(void)
{
	if (CURRENT_RECORD_NUMBER < LAST_RECORD_NUMBER) {
		CURRENT_RECORD_NUMBER++;
		/* would update window info here */
		update_window_info();
	}
}

void update_window_info(void)
{
	char	temp_string[255];

	sprintf(temp_string, "%d", CURRENT_RECORD_NUMBER);
	au_icon_text_change(temp_string, win_data[0].win_handle, CURRENT_RECORD_ICON);
	sprintf(temp_string, "%d", LAST_RECORD_NUMBER);
	au_icon_text_change(temp_string, win_data[0].win_handle, LAST_RECORD_ICON);

	return;
}

void open_main_window(void)
{
	_kernel_swi_regs	in, out;
	unsigned char	temp_buffer[1024];

/* We need to update the current and last record numbers in the window
 * before opening */

	update_window_info();

/* Now open the window */

	au_wordtobyte(win_data[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;
}

void wimp_msg(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;
	}
	return;
}


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;
}

void loadtemplates(void)
{
	au_opentemplate("<RAPS$Dir>.Templates");
	if(au_loadtemplate("MainWindow", &win_data[0], 0) == 0) {
		au_report_error(1, "Template not found!", 1, appname);
		QUIT_FLAG = 1;
	}
	if(au_loadtemplate("ProgInfo", &win_data[1], 0) == 0) {
		au_report_error(1, "Template not found!", 1, appname);
		QUIT_FLAG = 1;
	}
	au_closetemplate();
}
00000000  2f 2a 20 52 41 50 53 20  2d 20 61 20 70 61 72 61  |/* RAPS - a para|
00000010  63 68 75 74 65 20 6a 75  6d 70 20 64 61 74 61 62  |chute jump datab|
00000020  61 73 65 20 70 72 6f 67  72 61 6d 0a 20 2a 20 54  |ase program. * T|
00000030  6f 20 64 65 6d 6f 6e 73  74 72 61 74 65 20 74 68  |o demonstrate th|
00000040  65 20 41 63 6f 72 6e 20  55 73 65 72 20 57 69 6d  |e Acorn User Wim|
00000050  70 20 43 20 6c 69 62 72  61 72 79 0a 20 2a 20 62  |p C library. * b|
00000060  79 20 53 74 65 76 65 20  4d 75 6d 66 6f 72 64 20  |y Steve Mumford |
00000070  66 6f 72 20 41 63 6f 72  6e 20 55 73 65 72 2c 20  |for Acorn User, |
00000080  53 65 70 74 65 6d 62 65  72 20 31 39 39 36 20 2a  |September 1996 *|
00000090  2f 0a 0a 2f 2a 20 23 69  6e 63 6c 75 64 65 73 20  |/../* #includes |
000000a0  2a 2f 0a 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |*/..#include <st|
000000b0  64 69 6f 2e 68 3e 0a 23  69 6e 63 6c 75 64 65 20  |dio.h>.#include |
000000c0  3c 73 74 72 69 6e 67 2e  68 3e 0a 23 69 6e 63 6c  |<string.h>.#incl|
000000d0  75 64 65 20 22 41 55 4c  69 62 2e 68 22 0a 0a 2f  |ude "AULib.h"../|
000000e0  2a 20 23 64 65 66 69 6e  65 73 20 2a 2f 0a 0a 23  |* #defines */..#|
000000f0  64 65 66 69 6e 65 20 50  4f 4c 4c 5f 4d 41 53 4b  |define POLL_MASK|
00000100  20 31 0a 23 64 65 66 69  6e 65 20 4d 41 58 5f 57  | 1.#define MAX_W|
00000110  49 4e 44 4f 57 53 20 32  0a 23 64 65 66 69 6e 65  |INDOWS 2.#define|
00000120  20 4d 41 58 5f 4d 45 4e  55 53 20 31 0a 23 64 65  | MAX_MENUS 1.#de|
00000130  66 69 6e 65 20 4d 41 58  5f 4a 55 4d 50 53 20 31  |fine MAX_JUMPS 1|
00000140  35 0a 23 64 65 66 69 6e  65 20 56 45 52 53 49 4f  |5.#define VERSIO|
00000150  4e 5f 4e 55 4d 42 45 52  20 33 31 30 20 2f 2a 20  |N_NUMBER 310 /* |
00000160  52 69 73 63 20 4f 53 20  76 65 72 73 69 6f 6e 20  |Risc OS version |
00000170  6e 6f 2e 20 2a 20 31 30  30 20 2a 2f 0a 0a 2f 2a  |no. * 100 */../*|
00000180  20 54 68 65 73 65 20 23  64 65 66 69 6e 65 73 20  | These #defines |
00000190  72 65 6c 61 74 65 20 74  6f 20 74 68 65 20 69 63  |relate to the ic|
000001a0  6f 6e 20 6e 75 6d 62 65  72 73 20 69 6e 20 74 68  |on numbers in th|
000001b0  65 20 74 65 6d 70 6c 61  74 65 20 66 69 6c 65 20  |e template file |
000001c0  2a 2f 0a 0a 23 64 65 66  69 6e 65 20 43 55 52 52  |*/..#define CURR|
000001d0  45 4e 54 5f 52 45 43 4f  52 44 5f 49 43 4f 4e 20  |ENT_RECORD_ICON |
000001e0  32 0a 23 64 65 66 69 6e  65 20 4c 41 53 54 5f 52  |2.#define LAST_R|
000001f0  45 43 4f 52 44 5f 49 43  4f 4e 20 34 0a 23 64 65  |ECORD_ICON 4.#de|
00000200  66 69 6e 65 20 50 52 45  56 5f 52 45 43 4f 52 44  |fine PREV_RECORD|
00000210  5f 49 43 4f 4e 20 35 0a  23 64 65 66 69 6e 65 20  |_ICON 5.#define |
00000220  4e 45 58 54 5f 52 45 43  4f 52 44 5f 49 43 4f 4e  |NEXT_RECORD_ICON|
00000230  20 36 0a 23 64 65 66 69  6e 65 20 44 41 54 45 5f  | 6.#define DATE_|
00000240  49 43 4f 4e 20 37 0a 23  64 65 66 69 6e 65 20 41  |ICON 7.#define A|
00000250  49 52 43 52 41 46 54 5f  49 43 4f 4e 20 39 0a 23  |IRCRAFT_ICON 9.#|
00000260  64 65 66 69 6e 65 20 44  52 4f 50 5a 4f 4e 45 5f  |define DROPZONE_|
00000270  49 43 4f 4e 20 31 31 0a  23 64 65 66 69 6e 65 20  |ICON 11.#define |
00000280  41 4c 54 49 54 55 44 45  5f 49 43 4f 4e 20 31 33  |ALTITUDE_ICON 13|
00000290  0a 23 64 65 66 69 6e 65  20 44 45 4c 41 59 5f 49  |.#define DELAY_I|
000002a0  43 4f 4e 20 31 35 0a 23  64 65 66 69 6e 65 20 41  |CON 15.#define A|
000002b0  49 52 57 4f 52 4b 5f 49  43 4f 4e 20 31 37 0a 23  |IRWORK_ICON 17.#|
000002c0  64 65 66 69 6e 65 20 52  45 4d 41 52 4b 53 31 5f  |define REMARKS1_|
000002d0  49 43 4f 4e 20 31 39 0a  23 64 65 66 69 6e 65 20  |ICON 19.#define |
000002e0  52 45 4d 41 52 4b 53 32  5f 49 43 4f 4e 20 32 30  |REMARKS2_ICON 20|
000002f0  0a 0a 2f 2a 20 54 68 65  73 65 20 6e 65 78 74 20  |../* These next |
00000300  23 64 65 66 69 6e 65 73  20 73 65 74 20 75 70 20  |#defines set up |
00000310  74 68 65 20 6d 65 6e 75  20 73 65 6c 65 63 74 69  |the menu selecti|
00000320  6f 6e 20 63 68 6f 69 63  65 73 20 2a 2f 0a 0a 2f  |on choices */../|
00000330  2a 20 69 63 6f 6e 62 61  72 20 6d 65 6e 75 20 2a  |* iconbar menu *|
00000340  2f 0a 23 64 65 66 69 6e  65 20 49 4e 46 4f 5f 4f  |/.#define INFO_O|
00000350  50 54 49 4f 4e 20 30 0a  23 64 65 66 69 6e 65 20  |PTION 0.#define |
00000360  51 55 49 54 5f 4f 50 54  49 4f 4e 20 31 0a 0a 74  |QUIT_OPTION 1..t|
00000370  79 70 65 64 65 66 20 73  74 72 75 63 74 20 6a 75  |ypedef struct ju|
00000380  6d 70 5f 64 61 74 61 20  7b 0a 09 69 6e 74 20 6a  |mp_data {..int j|
00000390  75 6d 70 5f 6e 6f 3b 0a  09 63 68 61 72 20 64 61  |ump_no;..char da|
000003a0  74 65 5b 31 31 5d 3b 0a  09 63 68 61 72 20 61 69  |te[11];..char ai|
000003b0  72 63 72 61 66 74 5b 33  31 5d 3b 0a 09 63 68 61  |rcraft[31];..cha|
000003c0  72 20 64 72 6f 70 7a 6f  6e 65 5b 35 31 5d 3b 0a  |r dropzone[51];.|
000003d0  09 69 6e 74 20 61 6c 74  69 74 75 64 65 3b 0a 09  |.int altitude;..|
000003e0  69 6e 74 20 64 65 6c 61  79 3b 0a 09 63 68 61 72  |int delay;..char|
000003f0  20 61 69 72 77 6f 72 6b  5b 31 33 5d 3b 0a 09 63  | airwork[13];..c|
00000400  68 61 72 20 72 65 6d 61  72 6b 73 31 5b 35 31 5d  |har remarks1[51]|
00000410  3b 0a 09 63 68 61 72 20  72 65 6d 61 72 6b 73 32  |;..char remarks2|
00000420  5b 36 31 5d 3b 0a 7d 20  6a 75 6d 70 5f 64 61 74  |[61];.} jump_dat|
00000430  61 3b 0a 0a 2f 2a 20 47  6c 6f 62 61 6c 20 76 61  |a;../* Global va|
00000440  72 69 61 62 6c 65 73 20  2a 2f 0a 0a 69 6e 74 09  |riables */..int.|
00000450  51 55 49 54 5f 46 4c 41  47 20 3d 20 30 3b 0a 69  |QUIT_FLAG = 0;.i|
00000460  6e 74 09 43 55 52 52 45  4e 54 5f 4d 45 4e 55 20  |nt.CURRENT_MENU |
00000470  3d 20 30 3b 0a 69 6e 74  09 43 55 52 52 45 4e 54  |= 0;.int.CURRENT|
00000480  5f 52 45 43 4f 52 44 5f  4e 55 4d 42 45 52 20 3d  |_RECORD_NUMBER =|
00000490  20 31 3b 0a 69 6e 74 09  4c 41 53 54 5f 52 45 43  | 1;.int.LAST_REC|
000004a0  4f 52 44 5f 4e 55 4d 42  45 52 20 3d 20 31 30 3b  |ORD_NUMBER = 10;|
000004b0  0a 0a 77 69 6e 64 6f 77  5f 64 61 74 61 09 77 69  |..window_data.wi|
000004c0  6e 5f 64 61 74 61 5b 4d  41 58 5f 57 49 4e 44 4f  |n_data[MAX_WINDO|
000004d0  57 53 5d 3b 0a 6d 65 6e  75 5f 64 61 74 61 09 6d  |WS];.menu_data.m|
000004e0  65 6e 5f 64 61 74 61 5b  4d 41 58 5f 4d 45 4e 55  |en_data[MAX_MENU|
000004f0  53 5d 3b 0a 6a 75 6d 70  5f 64 61 74 61 09 6a 75  |S];.jump_data.ju|
00000500  6d 70 5f 72 65 63 6f 72  64 73 5b 4d 41 58 5f 4a  |mp_records[MAX_J|
00000510  55 4d 50 53 5d 3b 0a 63  68 61 72 20 61 70 70 6e  |UMPS];.char appn|
00000520  61 6d 65 5b 5d 20 3d 20  22 52 41 50 53 20 4a 75  |ame[] = "RAPS Ju|
00000530  6d 70 20 4c 6f 67 67 65  72 22 3b 0a 63 68 61 72  |mp Logger";.char|
00000540  20 73 70 72 6e 61 6d 65  5b 5d 20 3d 20 22 21 72  | sprname[] = "!r|
00000550  61 70 73 22 3b 0a 6c 6f  6e 67 20 69 6e 74 20 6d  |aps";.long int m|
00000560  73 67 6c 69 73 74 5b 5d  20 3d 20 7b 30 7d 3b 0a  |sglist[] = {0};.|
00000570  0a 2f 2a 20 46 75 6e 63  74 69 6f 6e 20 70 72 6f  |./* Function pro|
00000580  74 6f 74 79 70 69 6e 67  20 2a 2f 0a 0a 69 6e 74  |totyping */..int|
00000590  09 6d 61 69 6e 28 76 6f  69 64 29 3b 0a 76 6f 69  |.main(void);.voi|
000005a0  64 09 6f 70 65 6e 77 69  6e 64 6f 77 28 75 6e 73  |d.openwindow(uns|
000005b0  69 67 6e 65 64 20 63 68  61 72 5b 5d 29 3b 0a 76  |igned char[]);.v|
000005c0  6f 69 64 09 63 6c 6f 73  65 77 69 6e 64 6f 77 28  |oid.closewindow(|
000005d0  75 6e 73 69 67 6e 65 64  20 63 68 61 72 5b 5d 29  |unsigned char[])|
000005e0  3b 0a 76 6f 69 64 09 6c  6f 61 64 74 65 6d 70 6c  |;.void.loadtempl|
000005f0  61 74 65 73 28 76 6f 69  64 29 3b 0a 76 6f 69 64  |ates(void);.void|
00000600  09 6d 6f 75 73 65 5f 63  6c 69 63 6b 28 75 6e 73  |.mouse_click(uns|
00000610  69 67 6e 65 64 20 63 68  61 72 5b 5d 29 3b 0a 76  |igned char[]);.v|
00000620  6f 69 64 09 77 69 6d 70  5f 6d 73 67 28 69 6e 74  |oid.wimp_msg(int|
00000630  2c 20 75 6e 73 69 67 6e  65 64 20 63 68 61 72 5b  |, unsigned char[|
00000640  5d 29 3b 0a 76 6f 69 64  09 6f 70 65 6e 5f 6d 61  |]);.void.open_ma|
00000650  69 6e 5f 77 69 6e 64 6f  77 28 76 6f 69 64 29 3b  |in_window(void);|
00000660  0a 76 6f 69 64 09 70 72  65 76 5f 72 65 63 6f 72  |.void.prev_recor|
00000670  64 28 76 6f 69 64 29 3b  0a 76 6f 69 64 09 6e 65  |d(void);.void.ne|
00000680  78 74 5f 72 65 63 6f 72  64 28 76 6f 69 64 29 3b  |xt_record(void);|
00000690  0a 76 6f 69 64 09 75 70  64 61 74 65 5f 77 69 6e  |.void.update_win|
000006a0  64 6f 77 5f 69 6e 66 6f  28 76 6f 69 64 29 3b 0a  |dow_info(void);.|
000006b0  76 6f 69 64 09 6d 65 6e  75 5f 73 65 6c 65 63 74  |void.menu_select|
000006c0  69 6f 6e 28 75 6e 73 69  67 6e 65 64 20 63 68 61  |ion(unsigned cha|
000006d0  72 5b 5d 29 3b 0a 0a 2f  2a 20 4d 61 69 6e 20 70  |r[]);../* Main p|
000006e0  72 6f 67 72 61 6d 20 2a  2f 0a 0a 69 6e 74 0a 6d  |rogram */..int.m|
000006f0  61 69 6e 28 29 0a 7b 0a  09 69 6e 74 09 74 61 73  |ain().{..int.tas|
00000700  6b 5f 68 61 6e 64 6c 65  2c 20 69 63 6f 6e 5f 68  |k_handle, icon_h|
00000710  61 6e 64 6c 65 3b 0a 0a  09 75 6e 73 69 67 6e 65  |andle;...unsigne|
00000720  64 20 63 68 61 72 09 70  6f 6c 6c 5f 62 6c 6f 63  |d char.poll_bloc|
00000730  6b 5b 32 35 36 5d 3b 0a  09 69 6e 74 09 70 6f 6c  |k[256];..int.pol|
00000740  6c 5f 72 65 73 75 6c 74  3b 0a 09 69 6e 74 09 69  |l_result;..int.i|
00000750  20 3d 20 30 3b 0a 0a 09  74 61 73 6b 5f 68 61 6e  | = 0;...task_han|
00000760  64 6c 65 20 3d 20 61 75  5f 69 6e 69 74 69 61 6c  |dle = au_initial|
00000770  69 73 65 28 56 45 52 53  49 4f 4e 5f 4e 55 4d 42  |ise(VERSION_NUMB|
00000780  45 52 2c 20 61 70 70 6e  61 6d 65 2c 20 6d 73 67  |ER, appname, msg|
00000790  6c 69 73 74 29 3b 0a 09  69 63 6f 6e 5f 68 61 6e  |list);..icon_han|
000007a0  64 6c 65 20 3d 20 61 75  5f 63 72 65 61 74 65 5f  |dle = au_create_|
000007b0  69 63 6f 6e 62 61 72 5f  69 63 6f 6e 28 49 42 41  |iconbar_icon(IBA|
000007c0  52 5f 50 52 49 4f 52 5f  41 50 50 2c 0a 09 09 09  |R_PRIOR_APP,....|
000007d0  49 42 41 52 5f 4f 4e 52  49 47 48 54 2c 0a 09 09  |IBAR_ONRIGHT,...|
000007e0  09 49 43 4f 4e 5f 49 53  53 50 52 49 54 45 20 7c  |.ICON_ISSPRITE ||
000007f0  20 49 43 4f 4e 5f 48 43  45 4e 54 52 45 20 7c 20  | ICON_HCENTRE | |
00000800  49 43 4f 4e 5f 56 43 45  4e 54 52 45 20 7c 20 49  |ICON_VCENTRE | I|
00000810  43 4f 4e 5f 43 4c 49 43  4b 4e 4f 54 49 46 49 45  |CON_CLICKNOTIFIE|
00000820  53 4f 4e 43 45 2c 0a 09  09 09 73 70 72 6e 61 6d  |SONCE,....sprnam|
00000830  65 29 3b 0a 09 6c 6f 61  64 74 65 6d 70 6c 61 74  |e);..loadtemplat|
00000840  65 73 28 29 3b 0a 09 2f  2a 61 75 5f 6f 70 65 6e  |es();../*au_open|
00000850  77 69 6e 5f 66 72 6f 6d  5f 74 65 6d 70 6c 61 74  |win_from_templat|
00000860  65 64 61 74 61 28 26 77  69 6e 5f 64 61 74 61 5b  |edata(&win_data[|
00000870  30 5d 2c 20 2d 31 29 3b  20 2a 2f 0a 09 77 68 69  |0], -1); */..whi|
00000880  6c 65 20 28 51 55 49 54  5f 46 4c 41 47 20 3d 3d  |le (QUIT_FLAG ==|
00000890  20 30 29 20 7b 0a 09 2f  2a 20 64 6f 20 73 6f 6d  | 0) {../* do som|
000008a0  65 20 70 6f 6c 6c 69 6e  67 20 2a 2f 0a 09 09 70  |e polling */...p|
000008b0  6f 6c 6c 5f 72 65 73 75  6c 74 20 3d 20 61 75 5f  |oll_result = au_|
000008c0  77 69 6d 70 5f 70 6f 6c  6c 28 50 4f 4c 4c 5f 4d  |wimp_poll(POLL_M|
000008d0  41 53 4b 2c 20 70 6f 6c  6c 5f 62 6c 6f 63 6b 29  |ASK, poll_block)|
000008e0  3b 0a 09 09 73 77 69 74  63 68 20 28 70 6f 6c 6c  |;...switch (poll|
000008f0  5f 72 65 73 75 6c 74 29  20 7b 0a 09 09 09 63 61  |_result) {....ca|
00000900  73 65 20 20 32 20 3a 20  6f 70 65 6e 77 69 6e 64  |se  2 : openwind|
00000910  6f 77 28 70 6f 6c 6c 5f  62 6c 6f 63 6b 29 3b 0a  |ow(poll_block);.|
00000920  09 09 09 09 09 09 62 72  65 61 6b 3b 0a 09 09 09  |......break;....|
00000930  63 61 73 65 20 20 33 20  3a 20 63 6c 6f 73 65 77  |case  3 : closew|
00000940  69 6e 64 6f 77 28 70 6f  6c 6c 5f 62 6c 6f 63 6b  |indow(poll_block|
00000950  29 3b 0a 09 09 09 09 09  09 62 72 65 61 6b 3b 0a  |);.......break;.|
00000960  09 09 09 63 61 73 65 20  20 36 20 3a 20 6d 6f 75  |...case  6 : mou|
00000970  73 65 5f 63 6c 69 63 6b  28 70 6f 6c 6c 5f 62 6c  |se_click(poll_bl|
00000980  6f 63 6b 29 3b 0a 09 09  09 09 09 09 62 72 65 61  |ock);.......brea|
00000990  6b 3b 0a 09 09 09 63 61  73 65 20 20 39 20 3a 20  |k;....case  9 : |
000009a0  6d 65 6e 75 5f 73 65 6c  65 63 74 69 6f 6e 28 70  |menu_selection(p|
000009b0  6f 6c 6c 5f 62 6c 6f 63  6b 29 3b 0a 09 09 09 09  |oll_block);.....|
000009c0  09 09 62 72 65 61 6b 3b  0a 09 09 09 63 61 73 65  |..break;....case|
000009d0  20 31 37 20 3a 0a 09 09  09 63 61 73 65 20 31 38  | 17 :....case 18|
000009e0  20 3a 0a 09 09 09 63 61  73 65 20 31 39 20 3a 20  | :....case 19 : |
000009f0  77 69 6d 70 5f 6d 73 67  28 70 6f 6c 6c 5f 72 65  |wimp_msg(poll_re|
00000a00  73 75 6c 74 2c 20 70 6f  6c 6c 5f 62 6c 6f 63 6b  |sult, poll_block|
00000a10  29 3b 0a 09 09 09 09 09  09 62 72 65 61 6b 3b 0a  |);.......break;.|
00000a20  09 09 7d 0a 09 7d 0a 09  61 75 5f 63 6c 6f 73 65  |..}..}..au_close|
00000a30  64 6f 77 6e 28 74 61 73  6b 5f 68 61 6e 64 6c 65  |down(task_handle|
00000a40  29 3b 0a 0a 09 66 6f 72  28 69 20 3d 20 30 3b 20  |);...for(i = 0; |
00000a50  69 20 3c 20 4d 41 58 5f  57 49 4e 44 4f 57 53 3b  |i < MAX_WINDOWS;|
00000a60  20 69 2b 2b 29 20 7b 0a  09 09 66 72 65 65 28 77  | i++) {...free(w|
00000a70  69 6e 5f 64 61 74 61 5b  69 5d 2e 77 69 6e 5f 6e  |in_data[i].win_n|
00000a80  61 6d 65 29 3b 0a 09 09  66 72 65 65 28 77 69 6e  |ame);...free(win|
00000a90  5f 64 61 74 61 5b 69 5d  2e 62 75 66 66 65 72 29  |_data[i].buffer)|
00000aa0  3b 0a 09 09 66 72 65 65  28 77 69 6e 5f 64 61 74  |;...free(win_dat|
00000ab0  61 5b 69 5d 2e 77 6f 72  6b 73 70 61 63 65 29 3b  |a[i].workspace);|
00000ac0  0a 09 7d 0a 0a 09 2f 2a  20 23 52 65 6d 65 6d 62  |..}.../* #Rememb|
00000ad0  65 72 20 74 6f 20 66 72  65 65 20 6d 65 6e 75 20  |er to free menu |
00000ae0  73 70 61 63 65 21 20 28  72 65 63 75 72 73 69 6f  |space! (recursio|
00000af0  6e 3f 29 20 2a 2f 0a 7d  0a 0a 76 6f 69 64 20 6d  |n?) */.}..void m|
00000b00  6f 75 73 65 5f 63 6c 69  63 6b 28 75 6e 73 69 67  |ouse_click(unsig|
00000b10  6e 65 64 20 63 68 61 72  20 70 6f 6c 6c 5f 62 6c  |ned char poll_bl|
00000b20  6f 63 6b 5b 5d 29 0a 7b  0a 09 69 6e 74 09 63 6c  |ock[]).{..int.cl|
00000b30  6b 3b 0a 09 6c 6f 6e 67  20 69 6e 74 09 69 63 6f  |k;..long int.ico|
00000b40  6e 5f 6e 75 6d 3b 0a 0a  09 2f 2a 20 44 65 74 65  |n_num;.../* Dete|
00000b50  72 6d 69 6e 65 20 77 68  69 63 68 20 62 75 74 74  |rmine which butt|
00000b60  6f 6e 20 77 61 73 20 70  72 65 73 73 65 64 20 2a  |on was pressed *|
00000b70  2f 0a 09 63 6c 6b 20 3d  20 28 69 6e 74 29 20 61  |/..clk = (int) a|
00000b80  75 5f 62 79 74 65 74 6f  77 6f 72 64 28 70 6f 6c  |u_bytetoword(pol|
00000b90  6c 5f 62 6c 6f 63 6b 2c  20 38 29 3b 20 0a 0a 09  |l_block, 8); ...|
00000ba0  69 66 28 28 61 75 5f 62  79 74 65 74 6f 77 6f 72  |if((au_bytetowor|
00000bb0  64 28 70 6f 6c 6c 5f 62  6c 6f 63 6b 2c 20 31 32  |d(poll_block, 12|
00000bc0  29 20 3d 3d 20 2d 32 29  20 26 26 20 28 63 6c 6b  |) == -2) && (clk|
00000bd0  20 3d 3d 20 34 29 29 20  7b 0a 09 6f 70 65 6e 5f  | == 4)) {..open_|
00000be0  6d 61 69 6e 5f 77 69 6e  64 6f 77 28 29 3b 0a 09  |main_window();..|
00000bf0  7d 0a 0a 09 69 66 28 28  61 75 5f 62 79 74 65 74  |}...if((au_bytet|
00000c00  6f 77 6f 72 64 28 70 6f  6c 6c 5f 62 6c 6f 63 6b  |oword(poll_block|
00000c10  2c 20 31 32 29 20 3d 3d  20 2d 32 29 20 26 26 20  |, 12) == -2) && |
00000c20  28 63 6c 6b 20 3d 3d 20  32 29 29 20 7b 0a 09 09  |(clk == 2)) {...|
00000c30  2f 2a 20 54 69 6d 65 20  74 6f 20 70 72 6f 64 75  |/* Time to produ|
00000c40  63 65 20 61 20 6d 65 6e  75 20 2a 2f 0a 09 09 61  |ce a menu */...a|
00000c50  75 5f 62 75 69 6c 64 6d  65 6e 75 28 22 52 41 50  |u_buildmenu("RAP|
00000c60  53 22 2c 20 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  |S", &men_data[0]|
00000c70  29 3b 0a 09 09 61 75 5f  61 64 64 74 6f 6d 65 6e  |);...au_addtomen|
00000c80  75 28 22 49 6e 66 6f 22  2c 20 30 2c 20 77 69 6e  |u("Info", 0, win|
00000c90  5f 64 61 74 61 5b 31 5d  2e 77 69 6e 5f 68 61 6e  |_data[1].win_han|
00000ca0  64 6c 65 2c 20 30 2c 20  26 6d 65 6e 5f 64 61 74  |dle, 0, &men_dat|
00000cb0  61 5b 30 5d 29 3b 0a 09  09 61 75 5f 61 64 64 74  |a[0]);...au_addt|
00000cc0  6f 6d 65 6e 75 28 22 51  75 69 74 22 2c 20 4d 45  |omenu("Quit", ME|
00000cd0  4e 55 5f 4c 41 53 54 49  54 45 4d 2c 20 2d 31 2c  |NU_LASTITEM, -1,|
00000ce0  20 30 2c 20 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  | 0, &men_data[0]|
00000cf0  29 3b 0a 09 09 61 75 5f  63 72 65 61 74 65 6d 65  |);...au_createme|
00000d00  6e 75 28 26 6d 65 6e 5f  64 61 74 61 5b 30 5d 29  |nu(&men_data[0])|
00000d10  3b 0a 09 09 43 55 52 52  45 4e 54 5f 4d 45 4e 55  |;...CURRENT_MENU|
00000d20  20 3d 20 31 3b 20 2f 2a  20 6b 65 65 70 20 74 72  | = 1; /* keep tr|
00000d30  61 63 6b 20 6f 66 20 74  68 65 20 6c 61 73 74 20  |ack of the last |
00000d40  6d 65 6e 75 20 77 65 20  6f 70 65 6e 65 64 20 2a  |menu we opened *|
00000d50  2f 0a 09 09 61 75 5f 6f  70 65 6e 6d 65 6e 75 28  |/...au_openmenu(|
00000d60  26 6d 65 6e 5f 64 61 74  61 5b 30 5d 2c 20 28 69  |&men_data[0], (i|
00000d70  6e 74 29 20 61 75 5f 62  79 74 65 74 6f 77 6f 72  |nt) au_bytetowor|
00000d80  64 28 70 6f 6c 6c 5f 62  6c 6f 63 6b 2c 20 30 29  |d(poll_block, 0)|
00000d90  20 2d 20 36 34 2c 20 28  34 34 2a 32 29 2b 39 36  | - 64, (44*2)+96|
00000da0  29 3b 0a 09 09 72 65 74  75 72 6e 3b 0a 09 7d 0a  |);...return;..}.|
00000db0  0a 09 2f 2a 20 43 68 65  63 6b 20 74 6f 20 73 65  |../* Check to se|
00000dc0  65 20 69 66 20 69 74 20  77 61 73 20 69 6e 20 74  |e if it was in t|
00000dd0  68 65 20 6d 61 69 6e 20  77 69 6e 64 6f 77 20 2a  |he main window *|
00000de0  2f 0a 09 69 66 28 28 61  75 5f 62 79 74 65 74 6f  |/..if((au_byteto|
00000df0  77 6f 72 64 28 70 6f 6c  6c 5f 62 6c 6f 63 6b 2c  |word(poll_block,|
00000e00  20 31 32 29 20 3d 3d 20  77 69 6e 5f 64 61 74 61  | 12) == win_data|
00000e10  5b 30 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 29 20  |[0].win_handle) |
00000e20  26 26 20 28 63 6c 6b 20  3d 3d 20 34 29 29 20 7b  |&& (clk == 4)) {|
00000e30  0a 09 09 69 63 6f 6e 5f  6e 75 6d 20 3d 20 61 75  |...icon_num = au|
00000e40  5f 62 79 74 65 74 6f 77  6f 72 64 28 70 6f 6c 6c  |_bytetoword(poll|
00000e50  5f 62 6c 6f 63 6b 2c 20  31 36 29 3b 0a 09 09 73  |_block, 16);...s|
00000e60  77 69 74 63 68 20 28 69  63 6f 6e 5f 6e 75 6d 29  |witch (icon_num)|
00000e70  20 7b 0a 09 09 09 63 61  73 65 20 50 52 45 56 5f  | {....case PREV_|
00000e80  52 45 43 4f 52 44 5f 49  43 4f 4e 20 3a 20 70 72  |RECORD_ICON : pr|
00000e90  65 76 5f 72 65 63 6f 72  64 28 29 3b 0a 09 09 09  |ev_record();....|
00000ea0  09 62 72 65 61 6b 3b 0a  09 09 09 63 61 73 65 20  |.break;....case |
00000eb0  4e 45 58 54 5f 52 45 43  4f 52 44 5f 49 43 4f 4e  |NEXT_RECORD_ICON|
00000ec0  20 3a 20 6e 65 78 74 5f  72 65 63 6f 72 64 28 29  | : next_record()|
00000ed0  3b 0a 09 09 09 09 62 72  65 61 6b 3b 0a 09 09 7d  |;.....break;...}|
00000ee0  0a 09 7d 0a 0a 09 72 65  74 75 72 6e 3b 0a 7d 0a  |..}...return;.}.|
00000ef0  0a 76 6f 69 64 20 6d 65  6e 75 5f 73 65 6c 65 63  |.void menu_selec|
00000f00  74 69 6f 6e 28 75 6e 73  69 67 6e 65 64 20 63 68  |tion(unsigned ch|
00000f10  61 72 20 70 6f 6c 6c 5f  62 6c 6f 63 6b 5b 5d 29  |ar poll_block[])|
00000f20  0a 7b 0a 09 6c 6f 6e 67  20 69 6e 74 09 66 69 72  |.{..long int.fir|
00000f30  73 74 5f 68 69 74 3b 0a  09 2f 2a 20 57 68 69 63  |st_hit;../* Whic|
00000f40  68 20 6d 65 6e 75 20 77  61 73 20 68 69 74 3f 20  |h menu was hit? |
00000f50  2a 2f 0a 09 69 66 20 28  43 55 52 52 45 4e 54 5f  |*/..if (CURRENT_|
00000f60  4d 45 4e 55 20 3d 3d 20  31 29 20 7b 0a 09 09 2f  |MENU == 1) {.../|
00000f70  2a 20 54 68 65 20 69 63  6f 6e 20 62 61 72 20 6d  |* The icon bar m|
00000f80  65 6e 75 20 67 6f 74 20  69 74 20 2d 20 64 65 63  |enu got it - dec|
00000f90  69 70 68 65 72 20 66 69  72 73 74 20 6d 65 6e 75  |ipher first menu|
00000fa0  20 73 75 62 73 65 6c 65  63 74 69 6f 6e 20 2a 2f  | subselection */|
00000fb0  0a 09 09 66 69 72 73 74  5f 68 69 74 20 3d 20 61  |...first_hit = a|
00000fc0  75 5f 62 79 74 65 74 6f  77 6f 72 64 28 70 6f 6c  |u_bytetoword(pol|
00000fd0  6c 5f 62 6c 6f 63 6b 2c  20 30 29 3b 0a 09 09 69  |l_block, 0);...i|
00000fe0  66 20 28 66 69 72 73 74  5f 68 69 74 20 3d 3d 20  |f (first_hit == |
00000ff0  51 55 49 54 5f 4f 50 54  49 4f 4e 29 20 7b 0a 09  |QUIT_OPTION) {..|
00001000  09 09 51 55 49 54 5f 46  4c 41 47 20 3d 20 31 3b  |..QUIT_FLAG = 1;|
00001010  0a 09 09 7d 0a 09 7d 0a  09 72 65 74 75 72 6e 3b  |...}..}..return;|
00001020  0a 7d 0a 0a 76 6f 69 64  20 70 72 65 76 5f 72 65  |.}..void prev_re|
00001030  63 6f 72 64 28 76 6f 69  64 29 0a 7b 0a 09 69 66  |cord(void).{..if|
00001040  20 28 43 55 52 52 45 4e  54 5f 52 45 43 4f 52 44  | (CURRENT_RECORD|
00001050  5f 4e 55 4d 42 45 52 20  3e 20 31 29 20 7b 0a 09  |_NUMBER > 1) {..|
00001060  09 43 55 52 52 45 4e 54  5f 52 45 43 4f 52 44 5f  |.CURRENT_RECORD_|
00001070  4e 55 4d 42 45 52 2d 2d  3b 0a 09 09 2f 2a 20 77  |NUMBER--;.../* w|
00001080  6f 75 6c 64 20 75 70 64  61 74 65 20 77 69 6e 64  |ould update wind|
00001090  6f 77 20 69 6e 66 6f 20  68 65 72 65 20 2a 2f 0a  |ow info here */.|
000010a0  09 09 75 70 64 61 74 65  5f 77 69 6e 64 6f 77 5f  |..update_window_|
000010b0  69 6e 66 6f 28 29 3b 0a  09 7d 0a 7d 0a 0a 76 6f  |info();..}.}..vo|
000010c0  69 64 20 6e 65 78 74 5f  72 65 63 6f 72 64 28 76  |id next_record(v|
000010d0  6f 69 64 29 0a 7b 0a 09  69 66 20 28 43 55 52 52  |oid).{..if (CURR|
000010e0  45 4e 54 5f 52 45 43 4f  52 44 5f 4e 55 4d 42 45  |ENT_RECORD_NUMBE|
000010f0  52 20 3c 20 4c 41 53 54  5f 52 45 43 4f 52 44 5f  |R < LAST_RECORD_|
00001100  4e 55 4d 42 45 52 29 20  7b 0a 09 09 43 55 52 52  |NUMBER) {...CURR|
00001110  45 4e 54 5f 52 45 43 4f  52 44 5f 4e 55 4d 42 45  |ENT_RECORD_NUMBE|
00001120  52 2b 2b 3b 0a 09 09 2f  2a 20 77 6f 75 6c 64 20  |R++;.../* would |
00001130  75 70 64 61 74 65 20 77  69 6e 64 6f 77 20 69 6e  |update window in|
00001140  66 6f 20 68 65 72 65 20  2a 2f 0a 09 09 75 70 64  |fo here */...upd|
00001150  61 74 65 5f 77 69 6e 64  6f 77 5f 69 6e 66 6f 28  |ate_window_info(|
00001160  29 3b 0a 09 7d 0a 7d 0a  0a 76 6f 69 64 20 75 70  |);..}.}..void up|
00001170  64 61 74 65 5f 77 69 6e  64 6f 77 5f 69 6e 66 6f  |date_window_info|
00001180  28 76 6f 69 64 29 0a 7b  0a 09 63 68 61 72 09 74  |(void).{..char.t|
00001190  65 6d 70 5f 73 74 72 69  6e 67 5b 32 35 35 5d 3b  |emp_string[255];|
000011a0  0a 0a 09 73 70 72 69 6e  74 66 28 74 65 6d 70 5f  |...sprintf(temp_|
000011b0  73 74 72 69 6e 67 2c 20  22 25 64 22 2c 20 43 55  |string, "%d", CU|
000011c0  52 52 45 4e 54 5f 52 45  43 4f 52 44 5f 4e 55 4d  |RRENT_RECORD_NUM|
000011d0  42 45 52 29 3b 0a 09 61  75 5f 69 63 6f 6e 5f 74  |BER);..au_icon_t|
000011e0  65 78 74 5f 63 68 61 6e  67 65 28 74 65 6d 70 5f  |ext_change(temp_|
000011f0  73 74 72 69 6e 67 2c 20  77 69 6e 5f 64 61 74 61  |string, win_data|
00001200  5b 30 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 2c 20  |[0].win_handle, |
00001210  43 55 52 52 45 4e 54 5f  52 45 43 4f 52 44 5f 49  |CURRENT_RECORD_I|
00001220  43 4f 4e 29 3b 0a 09 73  70 72 69 6e 74 66 28 74  |CON);..sprintf(t|
00001230  65 6d 70 5f 73 74 72 69  6e 67 2c 20 22 25 64 22  |emp_string, "%d"|
00001240  2c 20 4c 41 53 54 5f 52  45 43 4f 52 44 5f 4e 55  |, LAST_RECORD_NU|
00001250  4d 42 45 52 29 3b 0a 09  61 75 5f 69 63 6f 6e 5f  |MBER);..au_icon_|
00001260  74 65 78 74 5f 63 68 61  6e 67 65 28 74 65 6d 70  |text_change(temp|
00001270  5f 73 74 72 69 6e 67 2c  20 77 69 6e 5f 64 61 74  |_string, win_dat|
00001280  61 5b 30 5d 2e 77 69 6e  5f 68 61 6e 64 6c 65 2c  |a[0].win_handle,|
00001290  20 4c 41 53 54 5f 52 45  43 4f 52 44 5f 49 43 4f  | LAST_RECORD_ICO|
000012a0  4e 29 3b 0a 0a 09 72 65  74 75 72 6e 3b 0a 7d 0a  |N);...return;.}.|
000012b0  0a 76 6f 69 64 20 6f 70  65 6e 5f 6d 61 69 6e 5f  |.void open_main_|
000012c0  77 69 6e 64 6f 77 28 76  6f 69 64 29 0a 7b 0a 09  |window(void).{..|
000012d0  5f 6b 65 72 6e 65 6c 5f  73 77 69 5f 72 65 67 73  |_kernel_swi_regs|
000012e0  09 69 6e 2c 20 6f 75 74  3b 0a 09 75 6e 73 69 67  |.in, out;..unsig|
000012f0  6e 65 64 20 63 68 61 72  09 74 65 6d 70 5f 62 75  |ned char.temp_bu|
00001300  66 66 65 72 5b 31 30 32  34 5d 3b 0a 0a 2f 2a 20  |ffer[1024];../* |
00001310  57 65 20 6e 65 65 64 20  74 6f 20 75 70 64 61 74  |We need to updat|
00001320  65 20 74 68 65 20 63 75  72 72 65 6e 74 20 61 6e  |e the current an|
00001330  64 20 6c 61 73 74 20 72  65 63 6f 72 64 20 6e 75  |d last record nu|
00001340  6d 62 65 72 73 20 69 6e  20 74 68 65 20 77 69 6e  |mbers in the win|
00001350  64 6f 77 0a 20 2a 20 62  65 66 6f 72 65 20 6f 70  |dow. * before op|
00001360  65 6e 69 6e 67 20 2a 2f  0a 0a 09 75 70 64 61 74  |ening */...updat|
00001370  65 5f 77 69 6e 64 6f 77  5f 69 6e 66 6f 28 29 3b  |e_window_info();|
00001380  0a 0a 2f 2a 20 4e 6f 77  20 6f 70 65 6e 20 74 68  |../* Now open th|
00001390  65 20 77 69 6e 64 6f 77  20 2a 2f 0a 0a 09 61 75  |e window */...au|
000013a0  5f 77 6f 72 64 74 6f 62  79 74 65 28 77 69 6e 5f  |_wordtobyte(win_|
000013b0  64 61 74 61 5b 30 5d 2e  77 69 6e 5f 68 61 6e 64  |data[0].win_hand|
000013c0  6c 65 2c 20 74 65 6d 70  5f 62 75 66 66 65 72 2c  |le, temp_buffer,|
000013d0  20 30 29 3b 0a 09 69 6e  2e 72 5b 31 5d 20 3d 20  | 0);..in.r[1] = |
000013e0  28 69 6e 74 29 20 74 65  6d 70 5f 62 75 66 66 65  |(int) temp_buffe|
000013f0  72 3b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |r;.._kernel_swi(|
00001400  57 69 6d 70 5f 47 65 74  57 69 6e 64 6f 77 49 6e  |Wimp_GetWindowIn|
00001410  66 6f 2c 20 26 69 6e 2c  20 26 6f 75 74 29 3b 0a  |fo, &in, &out);.|
00001420  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  |._kernel_swi(Wim|
00001430  70 5f 4f 70 65 6e 57 69  6e 64 6f 77 2c 20 26 69  |p_OpenWindow, &i|
00001440  6e 2c 20 26 6f 75 74 29  3b 0a 09 72 65 74 75 72  |n, &out);..retur|
00001450  6e 3b 0a 7d 0a 0a 76 6f  69 64 20 77 69 6d 70 5f  |n;.}..void wimp_|
00001460  6d 73 67 28 69 6e 74 20  72 65 73 75 6c 74 2c 20  |msg(int result, |
00001470  75 6e 73 69 67 6e 65 64  20 63 68 61 72 20 70 6f  |unsigned char po|
00001480  6c 6c 62 6c 6f 63 6b 5b  5d 29 0a 7b 0a 09 75 6e  |llblock[]).{..un|
00001490  73 69 67 6e 65 64 20 6c  6f 6e 67 20 69 6e 74 20  |signed long int |
000014a0  20 20 6d 65 73 73 61 67  65 5f 61 63 74 69 6f 6e  |  message_action|
000014b0  3b 0a 09 0a 09 2f 2a 20  54 68 65 20 6e 65 78 74  |;..../* The next|
000014c0  20 6c 69 6e 65 20 74 61  6b 65 73 20 62 79 74 65  | line takes byte|
000014d0  73 20 31 36 20 74 6f 20  31 39 20 6f 66 20 74 68  |s 16 to 19 of th|
000014e0  65 20 70 6f 6c 6c 69 6e  67 20 62 6c 6f 63 6b 20  |e polling block |
000014f0  61 6e 64 20 66 6f 72 6d  73 20 74 68 65 6d 0a 09  |and forms them..|
00001500  20 20 20 69 6e 74 6f 20  61 20 77 6f 72 64 20 68  |   into a word h|
00001510  6f 6c 64 69 6e 67 20 74  68 65 20 6d 65 73 73 61  |olding the messa|
00001520  67 65 20 61 63 74 69 6f  6e 20 6e 75 6d 62 65 72  |ge action number|
00001530  20 2a 2f 0a 09 6d 65 73  73 61 67 65 5f 61 63 74  | */..message_act|
00001540  69 6f 6e 20 3d 20 61 75  5f 62 79 74 65 74 6f 77  |ion = au_bytetow|
00001550  6f 72 64 28 70 6f 6c 6c  62 6c 6f 63 6b 2c 20 31  |ord(pollblock, 1|
00001560  36 29 3b 0a 0a 09 73 77  69 74 63 68 20 28 6d 65  |6);...switch (me|
00001570  73 73 61 67 65 5f 61 63  74 69 6f 6e 29 20 7b 0a  |ssage_action) {.|
00001580  09 09 63 61 73 65 20 30  20 3a 20 51 55 49 54 5f  |..case 0 : QUIT_|
00001590  46 4c 41 47 20 3d 20 31  3b 20 2f 2a 20 4d 65 73  |FLAG = 1; /* Mes|
000015a0  73 61 67 65 5f 51 75 69  74 20 2d 20 74 69 6d 65  |sage_Quit - time|
000015b0  20 74 6f 20 67 6f 20 2a  2f 0a 09 09 09 09 62 72  | to go */.....br|
000015c0  65 61 6b 3b 0a 09 7d 0a  09 72 65 74 75 72 6e 3b  |eak;..}..return;|
000015d0  0a 7d 0a 0a 0a 76 6f 69  64 20 6f 70 65 6e 77 69  |.}...void openwi|
000015e0  6e 64 6f 77 28 75 6e 73  69 67 6e 65 64 20 63 68  |ndow(unsigned ch|
000015f0  61 72 20 70 6f 6c 6c 62  6c 6f 63 6b 5b 5d 29 0a  |ar pollblock[]).|
00001600  7b 0a 20 20 20 5f 6b 65  72 6e 65 6c 5f 73 77 69  |{.   _kernel_swi|
00001610  5f 72 65 67 73 20 69 6e  2c 20 6f 75 74 3b 0a 0a  |_regs in, out;..|
00001620  20 20 20 69 6e 2e 72 5b  31 5d 20 3d 20 28 69 6e  |   in.r[1] = (in|
00001630  74 29 20 70 6f 6c 6c 62  6c 6f 63 6b 3b 0a 20 20  |t) pollblock;.  |
00001640  20 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  | _kernel_swi(Wim|
00001650  70 5f 4f 70 65 6e 57 69  6e 64 6f 77 2c 20 26 69  |p_OpenWindow, &i|
00001660  6e 2c 20 26 6f 75 74 29  3b 0a 20 20 20 72 65 74  |n, &out);.   ret|
00001670  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 20 63 6c 6f  |urn;.}..void clo|
00001680  73 65 77 69 6e 64 6f 77  28 75 6e 73 69 67 6e 65  |sewindow(unsigne|
00001690  64 20 63 68 61 72 20 70  6f 6c 6c 62 6c 6f 63 6b  |d char pollblock|
000016a0  5b 5d 29 0a 7b 0a 20 20  20 5f 6b 65 72 6e 65 6c  |[]).{.   _kernel|
000016b0  5f 73 77 69 5f 72 65 67  73 20 69 6e 2c 20 6f 75  |_swi_regs in, ou|
000016c0  74 3b 0a 0a 20 20 20 69  6e 2e 72 5b 31 5d 20 3d  |t;..   in.r[1] =|
000016d0  20 28 69 6e 74 29 20 70  6f 6c 6c 62 6c 6f 63 6b  | (int) pollblock|
000016e0  3b 0a 20 20 20 5f 6b 65  72 6e 65 6c 5f 73 77 69  |;.   _kernel_swi|
000016f0  28 57 69 6d 70 5f 43 6c  6f 73 65 57 69 6e 64 6f  |(Wimp_CloseWindo|
00001700  77 2c 20 26 69 6e 2c 20  26 6f 75 74 29 3b 0a 20  |w, &in, &out);. |
00001710  20 20 72 65 74 75 72 6e  3b 0a 7d 0a 0a 76 6f 69  |  return;.}..voi|
00001720  64 20 6c 6f 61 64 74 65  6d 70 6c 61 74 65 73 28  |d loadtemplates(|
00001730  76 6f 69 64 29 0a 7b 0a  09 61 75 5f 6f 70 65 6e  |void).{..au_open|
00001740  74 65 6d 70 6c 61 74 65  28 22 3c 52 41 50 53 24  |template("<RAPS$|
00001750  44 69 72 3e 2e 54 65 6d  70 6c 61 74 65 73 22 29  |Dir>.Templates")|
00001760  3b 0a 09 69 66 28 61 75  5f 6c 6f 61 64 74 65 6d  |;..if(au_loadtem|
00001770  70 6c 61 74 65 28 22 4d  61 69 6e 57 69 6e 64 6f  |plate("MainWindo|
00001780  77 22 2c 20 26 77 69 6e  5f 64 61 74 61 5b 30 5d  |w", &win_data[0]|
00001790  2c 20 30 29 20 3d 3d 20  30 29 20 7b 0a 09 09 61  |, 0) == 0) {...a|
000017a0  75 5f 72 65 70 6f 72 74  5f 65 72 72 6f 72 28 31  |u_report_error(1|
000017b0  2c 20 22 54 65 6d 70 6c  61 74 65 20 6e 6f 74 20  |, "Template not |
000017c0  66 6f 75 6e 64 21 22 2c  20 31 2c 20 61 70 70 6e  |found!", 1, appn|
000017d0  61 6d 65 29 3b 0a 09 09  51 55 49 54 5f 46 4c 41  |ame);...QUIT_FLA|
000017e0  47 20 3d 20 31 3b 0a 09  7d 0a 09 69 66 28 61 75  |G = 1;..}..if(au|
000017f0  5f 6c 6f 61 64 74 65 6d  70 6c 61 74 65 28 22 50  |_loadtemplate("P|
00001800  72 6f 67 49 6e 66 6f 22  2c 20 26 77 69 6e 5f 64  |rogInfo", &win_d|
00001810  61 74 61 5b 31 5d 2c 20  30 29 20 3d 3d 20 30 29  |ata[1], 0) == 0)|
00001820  20 7b 0a 09 09 61 75 5f  72 65 70 6f 72 74 5f 65  | {...au_report_e|
00001830  72 72 6f 72 28 31 2c 20  22 54 65 6d 70 6c 61 74  |rror(1, "Templat|
00001840  65 20 6e 6f 74 20 66 6f  75 6e 64 21 22 2c 20 31  |e not found!", 1|
00001850  2c 20 61 70 70 6e 61 6d  65 29 3b 0a 09 09 51 55  |, appname);...QU|
00001860  49 54 5f 46 4c 41 47 20  3d 20 31 3b 0a 09 7d 0a  |IT_FLAG = 1;..}.|
00001870  09 61 75 5f 63 6c 6f 73  65 74 65 6d 70 6c 61 74  |.au_closetemplat|
00001880  65 28 29 3b 0a 7d 0a                              |e();.}.|
00001887