Home » Archimedes archive » Acorn User » AU 1996-12 A.adf » Regulars » C/!RAPS/c/!RunImage

C/!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 » Archimedes archive » Acorn User » AU 1996-12 A.adf » Regulars
Filename: C/!RAPS/c/!RunImage
Read OK:
File size: 2E85 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 <stdlib.h>
#include <string.h>
#include "AULib.h"

/* #defines */

#define POLL_MASK 1
#define MAX_WINDOWS 3
#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 21
#define UPDATE_ICON 22
#define SAVE_ICON 0
#define SAVE_FILENAME_ICON 1

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

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

/* These #defines set up some flag mnemomics */

#define SAVE_DRAG 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];
	struct jump_data *prev_record;
	struct jump_data *next_record;
} jump_data;

/* Global variables */

int	QUIT_FLAG = 0;
int	DRAG_FLAG = 0;
int	CURRENT_MENU = 0;
int	CURRENT_RECORD_NUMBER = 1;
int	LAST_RECORD_NUMBER = 1;
jump_data	*CURRENT_RECORD_POINTER = NULL;

window_data	win_data[MAX_WINDOWS];
menu_data	men_data[MAX_MENUS];
jump_data	*jmp_data_root;
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	drag_return(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[]);
void	setup_database(void);
void	update_record(void);
void	add_record(void);
void	data_save(unsigned char[]);

/* Main program */

int
main()
{
	int	task_handle, icon_handle;

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

	setup_database();
	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  7 : drag_return(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[])
{
	/* The dragging code also goes in here... */ 
	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("Save", 0, win_data[2].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;
			case UPDATE_ICON : update_record();
				break;
		}
	}

	/* Check to see whether we need to start a drag operation - drags are passed as
	 * the mouse button number multiplied by 16 */

	if((au_bytetoword(poll_block, 12) == win_data[2].win_handle) && (clk == 4*16)) {
		/* Start the drag operation */
		icon_num = au_bytetoword(poll_block, 16);
		/* Are we over the actual file icon in the save window? */
		if(icon_num == SAVE_ICON) {
			au_dragbox(au_bytetoword(poll_block, 12), icon_num);
			/* This is just so we remember which drag we're doing */
			DRAG_FLAG = SAVE_DRAG;
		}
	}

	return;
}

void drag_return(unsigned char poll_block[])
{
	char	temp_name[256];
	/* Call GetPointerInfo to find out where pointer is */
	pointer_data	pointer_info;
	au_getpointerinfo(&pointer_info);
	/* Now we check to see whether we're in the middle of a drag�*/
	if (DRAG_FLAG == SAVE_DRAG) {
		/* Grab leafname from save icon */
		au_icon_get_text(temp_name, win_data[2].win_handle, SAVE_FILENAME_ICON);
		/* Now we can send a DataSave message */
		au_datasave(pointer_info, 1024, 0xfff, temp_name);
		DRAG_FLAG = 0;
	}
}

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_POINTER->prev_record != NULL) {
		/* Save window information? */
		CURRENT_RECORD_POINTER = CURRENT_RECORD_POINTER->prev_record;
		CURRENT_RECORD_NUMBER = CURRENT_RECORD_POINTER->jump_no;
		/* would update window info here */
		update_window_info();
	}
}

void next_record(void)
{
	if (CURRENT_RECORD_POINTER->next_record != NULL) {
		CURRENT_RECORD_POINTER = CURRENT_RECORD_POINTER->next_record;
		CURRENT_RECORD_NUMBER = CURRENT_RECORD_POINTER->jump_no;
		/* would update window info here */
		update_window_info();
	}
}

void update_record(void)
{
	/* We need a temporary string buffer */
	char temp_buf[255];

	/* Save window information */
	au_icon_get_text(CURRENT_RECORD_POINTER->date, win_data[0].win_handle, DATE_ICON);
	au_icon_get_text(CURRENT_RECORD_POINTER->aircraft, win_data[0].win_handle, AIRCRAFT_ICON);
	au_icon_get_text(CURRENT_RECORD_POINTER->dropzone, win_data[0].win_handle, DROPZONE_ICON);
	au_icon_get_text(CURRENT_RECORD_POINTER->airwork, win_data[0].win_handle, AIRWORK_ICON);
	au_icon_get_text(CURRENT_RECORD_POINTER->remarks1, win_data[0].win_handle, REMARKS1_ICON);
	au_icon_get_text(CURRENT_RECORD_POINTER->remarks2, win_data[0].win_handle, REMARKS2_ICON);
	/* We need to convert text to integer here */
	au_icon_get_text(temp_buf, win_data[0].win_handle, ALTITUDE_ICON);
	CURRENT_RECORD_POINTER->altitude = atoi(temp_buf);

	/* And here */
	au_icon_get_text(temp_buf, win_data[0].win_handle, DELAY_ICON);
	CURRENT_RECORD_POINTER->delay = atoi(temp_buf);
	/* Record is now saved in memory */

	/* Are we on the last record? If so, we add a new one */
	if (CURRENT_RECORD_POINTER->next_record == NULL) {
		add_record();
	}
}

void add_record(void)
{
	jump_data	*new_record;

	/*Information from window already saved */

	new_record = calloc(1, sizeof(jump_data));
	/* Initialise pointers */
	new_record->prev_record = CURRENT_RECORD_POINTER;
	new_record->next_record = NULL;
	LAST_RECORD_NUMBER = new_record->jump_no = CURRENT_RECORD_POINTER->jump_no + 1;
	CURRENT_RECORD_POINTER->next_record = new_record;

	/* Switch view to the new record */
	CURRENT_RECORD_POINTER = new_record;
	CURRENT_RECORD_NUMBER = CURRENT_RECORD_POINTER->jump_no;

	/* Update the window to display the new information */
	update_window_info();
}

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

	au_losecaret();
	if (CURRENT_RECORD_POINTER->next_record == NULL) {
		au_icon_text_change("Add", win_data[0].win_handle, UPDATE_ICON);
	} else {
		au_icon_text_change("Update", win_data[0].win_handle, UPDATE_ICON);
	}
	sprintf(temp_string, "%d", CURRENT_RECORD_POINTER->jump_no);
	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);

	au_icon_text_change(CURRENT_RECORD_POINTER->date , win_data[0].win_handle, DATE_ICON);
	au_icon_text_change(CURRENT_RECORD_POINTER->aircraft , win_data[0].win_handle, AIRCRAFT_ICON);
	au_icon_text_change(CURRENT_RECORD_POINTER->dropzone , win_data[0].win_handle, DROPZONE_ICON);
	au_icon_text_change(CURRENT_RECORD_POINTER->airwork , win_data[0].win_handle, AIRWORK_ICON);
	au_icon_text_change(CURRENT_RECORD_POINTER->remarks1 , win_data[0].win_handle, REMARKS1_ICON);
	au_icon_text_change(CURRENT_RECORD_POINTER->remarks2 , win_data[0].win_handle, REMARKS2_ICON);

	sprintf(temp_string, "%d", CURRENT_RECORD_POINTER->altitude);
	au_icon_text_change(temp_string, win_data[0].win_handle, ALTITUDE_ICON);
	sprintf(temp_string, "%d", CURRENT_RECORD_POINTER->delay);
	au_icon_text_change(temp_string, win_data[0].win_handle, DELAY_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 MESSAGE_QUIT : QUIT_FLAG = 1; /* Message_Quit - time to go */
				break;
		case MESSAGE_DATASAVEACK : data_save(pollblock);
				break;
	}
	return;
}

void data_save(unsigned char pollblock[])
{
	char	*filename;
	int	name_length;
	/* Read the filename from the pollblock */
	name_length = strlen((char *) &pollblock[44]);
	filename = calloc(name_length, sizeof(char));
	strcpy(filename, (char *) &pollblock[44]);
	/* Just display the filename for now */
	au_report_error(1, filename, 1, appname);
}

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;
	}
	if(au_loadtemplate("xfer_send", &win_data[2], 0) == 0) {
		au_report_error(1, "Template not found!", 1, appname);
		QUIT_FLAG = 1;
	}

	au_closetemplate();
}

void setup_database(void)
{

	/* Initially, we need to set aside memory for the 'root' structure */

	jmp_data_root = calloc(1, sizeof(jump_data));
	/* Initialise pointers */
	jmp_data_root->prev_record = jmp_data_root->next_record = NULL;
	jmp_data_root->jump_no = 1;
	CURRENT_RECORD_POINTER = jmp_data_root;
}
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 64 6c 69 62 2e  68 3e 0a 23 69 6e 63 6c  |<stdlib.h>.#incl|
000000d0  75 64 65 20 3c 73 74 72  69 6e 67 2e 68 3e 0a 23  |ude <string.h>.#|
000000e0  69 6e 63 6c 75 64 65 20  22 41 55 4c 69 62 2e 68  |include "AULib.h|
000000f0  22 0a 0a 2f 2a 20 23 64  65 66 69 6e 65 73 20 2a  |"../* #defines *|
00000100  2f 0a 0a 23 64 65 66 69  6e 65 20 50 4f 4c 4c 5f  |/..#define POLL_|
00000110  4d 41 53 4b 20 31 0a 23  64 65 66 69 6e 65 20 4d  |MASK 1.#define M|
00000120  41 58 5f 57 49 4e 44 4f  57 53 20 33 0a 23 64 65  |AX_WINDOWS 3.#de|
00000130  66 69 6e 65 20 4d 41 58  5f 4d 45 4e 55 53 20 31  |fine MAX_MENUS 1|
00000140  0a 23 64 65 66 69 6e 65  20 4d 41 58 5f 4a 55 4d  |.#define MAX_JUM|
00000150  50 53 20 31 35 0a 23 64  65 66 69 6e 65 20 56 45  |PS 15.#define VE|
00000160  52 53 49 4f 4e 5f 4e 55  4d 42 45 52 20 33 31 30  |RSION_NUMBER 310|
00000170  20 2f 2a 20 52 69 73 63  20 4f 53 20 76 65 72 73  | /* Risc OS vers|
00000180  69 6f 6e 20 6e 6f 2e 20  2a 20 31 30 30 20 2a 2f  |ion no. * 100 */|
00000190  0a 0a 2f 2a 20 54 68 65  73 65 20 23 64 65 66 69  |../* These #defi|
000001a0  6e 65 73 20 72 65 6c 61  74 65 20 74 6f 20 74 68  |nes relate to th|
000001b0  65 20 69 63 6f 6e 20 6e  75 6d 62 65 72 73 20 69  |e icon numbers i|
000001c0  6e 20 74 68 65 20 74 65  6d 70 6c 61 74 65 20 66  |n the template f|
000001d0  69 6c 65 20 2a 2f 0a 0a  23 64 65 66 69 6e 65 20  |ile */..#define |
000001e0  43 55 52 52 45 4e 54 5f  52 45 43 4f 52 44 5f 49  |CURRENT_RECORD_I|
000001f0  43 4f 4e 20 32 0a 23 64  65 66 69 6e 65 20 4c 41  |CON 2.#define LA|
00000200  53 54 5f 52 45 43 4f 52  44 5f 49 43 4f 4e 20 34  |ST_RECORD_ICON 4|
00000210  0a 23 64 65 66 69 6e 65  20 50 52 45 56 5f 52 45  |.#define PREV_RE|
00000220  43 4f 52 44 5f 49 43 4f  4e 20 35 0a 23 64 65 66  |CORD_ICON 5.#def|
00000230  69 6e 65 20 4e 45 58 54  5f 52 45 43 4f 52 44 5f  |ine NEXT_RECORD_|
00000240  49 43 4f 4e 20 36 0a 23  64 65 66 69 6e 65 20 44  |ICON 6.#define D|
00000250  41 54 45 5f 49 43 4f 4e  20 37 0a 23 64 65 66 69  |ATE_ICON 7.#defi|
00000260  6e 65 20 41 49 52 43 52  41 46 54 5f 49 43 4f 4e  |ne AIRCRAFT_ICON|
00000270  20 39 0a 23 64 65 66 69  6e 65 20 44 52 4f 50 5a  | 9.#define DROPZ|
00000280  4f 4e 45 5f 49 43 4f 4e  20 31 31 0a 23 64 65 66  |ONE_ICON 11.#def|
00000290  69 6e 65 20 41 4c 54 49  54 55 44 45 5f 49 43 4f  |ine ALTITUDE_ICO|
000002a0  4e 20 31 33 0a 23 64 65  66 69 6e 65 20 44 45 4c  |N 13.#define DEL|
000002b0  41 59 5f 49 43 4f 4e 20  31 35 0a 23 64 65 66 69  |AY_ICON 15.#defi|
000002c0  6e 65 20 41 49 52 57 4f  52 4b 5f 49 43 4f 4e 20  |ne AIRWORK_ICON |
000002d0  31 37 0a 23 64 65 66 69  6e 65 20 52 45 4d 41 52  |17.#define REMAR|
000002e0  4b 53 31 5f 49 43 4f 4e  20 31 39 0a 23 64 65 66  |KS1_ICON 19.#def|
000002f0  69 6e 65 20 52 45 4d 41  52 4b 53 32 5f 49 43 4f  |ine REMARKS2_ICO|
00000300  4e 20 32 31 0a 23 64 65  66 69 6e 65 20 55 50 44  |N 21.#define UPD|
00000310  41 54 45 5f 49 43 4f 4e  20 32 32 0a 23 64 65 66  |ATE_ICON 22.#def|
00000320  69 6e 65 20 53 41 56 45  5f 49 43 4f 4e 20 30 0a  |ine SAVE_ICON 0.|
00000330  23 64 65 66 69 6e 65 20  53 41 56 45 5f 46 49 4c  |#define SAVE_FIL|
00000340  45 4e 41 4d 45 5f 49 43  4f 4e 20 31 0a 0a 2f 2a  |ENAME_ICON 1../*|
00000350  20 54 68 65 73 65 20 6e  65 78 74 20 23 64 65 66  | These next #def|
00000360  69 6e 65 73 20 73 65 74  20 75 70 20 74 68 65 20  |ines set up the |
00000370  6d 65 6e 75 20 73 65 6c  65 63 74 69 6f 6e 20 63  |menu selection c|
00000380  68 6f 69 63 65 73 20 2a  2f 0a 0a 2f 2a 20 69 63  |hoices */../* ic|
00000390  6f 6e 62 61 72 20 6d 65  6e 75 20 2a 2f 0a 23 64  |onbar menu */.#d|
000003a0  65 66 69 6e 65 20 49 4e  46 4f 5f 4f 50 54 49 4f  |efine INFO_OPTIO|
000003b0  4e 20 30 0a 23 64 65 66  69 6e 65 20 53 41 56 45  |N 0.#define SAVE|
000003c0  5f 4f 50 54 49 4f 4e 20  31 0a 23 64 65 66 69 6e  |_OPTION 1.#defin|
000003d0  65 20 51 55 49 54 5f 4f  50 54 49 4f 4e 20 32 0a  |e QUIT_OPTION 2.|
000003e0  0a 2f 2a 20 54 68 65 73  65 20 23 64 65 66 69 6e  |./* These #defin|
000003f0  65 73 20 73 65 74 20 75  70 20 73 6f 6d 65 20 66  |es set up some f|
00000400  6c 61 67 20 6d 6e 65 6d  6f 6d 69 63 73 20 2a 2f  |lag mnemomics */|
00000410  0a 0a 23 64 65 66 69 6e  65 20 53 41 56 45 5f 44  |..#define SAVE_D|
00000420  52 41 47 20 31 0a 0a 74  79 70 65 64 65 66 20 73  |RAG 1..typedef s|
00000430  74 72 75 63 74 20 6a 75  6d 70 5f 64 61 74 61 20  |truct jump_data |
00000440  7b 0a 09 69 6e 74 20 6a  75 6d 70 5f 6e 6f 3b 0a  |{..int jump_no;.|
00000450  09 63 68 61 72 20 64 61  74 65 5b 31 31 5d 3b 0a  |.char date[11];.|
00000460  09 63 68 61 72 20 61 69  72 63 72 61 66 74 5b 33  |.char aircraft[3|
00000470  31 5d 3b 0a 09 63 68 61  72 20 64 72 6f 70 7a 6f  |1];..char dropzo|
00000480  6e 65 5b 35 31 5d 3b 0a  09 69 6e 74 20 61 6c 74  |ne[51];..int alt|
00000490  69 74 75 64 65 3b 0a 09  69 6e 74 20 64 65 6c 61  |itude;..int dela|
000004a0  79 3b 0a 09 63 68 61 72  20 61 69 72 77 6f 72 6b  |y;..char airwork|
000004b0  5b 31 33 5d 3b 0a 09 63  68 61 72 20 72 65 6d 61  |[13];..char rema|
000004c0  72 6b 73 31 5b 35 31 5d  3b 0a 09 63 68 61 72 20  |rks1[51];..char |
000004d0  72 65 6d 61 72 6b 73 32  5b 36 31 5d 3b 0a 09 73  |remarks2[61];..s|
000004e0  74 72 75 63 74 20 6a 75  6d 70 5f 64 61 74 61 20  |truct jump_data |
000004f0  2a 70 72 65 76 5f 72 65  63 6f 72 64 3b 0a 09 73  |*prev_record;..s|
00000500  74 72 75 63 74 20 6a 75  6d 70 5f 64 61 74 61 20  |truct jump_data |
00000510  2a 6e 65 78 74 5f 72 65  63 6f 72 64 3b 0a 7d 20  |*next_record;.} |
00000520  6a 75 6d 70 5f 64 61 74  61 3b 0a 0a 2f 2a 20 47  |jump_data;../* G|
00000530  6c 6f 62 61 6c 20 76 61  72 69 61 62 6c 65 73 20  |lobal variables |
00000540  2a 2f 0a 0a 69 6e 74 09  51 55 49 54 5f 46 4c 41  |*/..int.QUIT_FLA|
00000550  47 20 3d 20 30 3b 0a 69  6e 74 09 44 52 41 47 5f  |G = 0;.int.DRAG_|
00000560  46 4c 41 47 20 3d 20 30  3b 0a 69 6e 74 09 43 55  |FLAG = 0;.int.CU|
00000570  52 52 45 4e 54 5f 4d 45  4e 55 20 3d 20 30 3b 0a  |RRENT_MENU = 0;.|
00000580  69 6e 74 09 43 55 52 52  45 4e 54 5f 52 45 43 4f  |int.CURRENT_RECO|
00000590  52 44 5f 4e 55 4d 42 45  52 20 3d 20 31 3b 0a 69  |RD_NUMBER = 1;.i|
000005a0  6e 74 09 4c 41 53 54 5f  52 45 43 4f 52 44 5f 4e  |nt.LAST_RECORD_N|
000005b0  55 4d 42 45 52 20 3d 20  31 3b 0a 6a 75 6d 70 5f  |UMBER = 1;.jump_|
000005c0  64 61 74 61 09 2a 43 55  52 52 45 4e 54 5f 52 45  |data.*CURRENT_RE|
000005d0  43 4f 52 44 5f 50 4f 49  4e 54 45 52 20 3d 20 4e  |CORD_POINTER = N|
000005e0  55 4c 4c 3b 0a 0a 77 69  6e 64 6f 77 5f 64 61 74  |ULL;..window_dat|
000005f0  61 09 77 69 6e 5f 64 61  74 61 5b 4d 41 58 5f 57  |a.win_data[MAX_W|
00000600  49 4e 44 4f 57 53 5d 3b  0a 6d 65 6e 75 5f 64 61  |INDOWS];.menu_da|
00000610  74 61 09 6d 65 6e 5f 64  61 74 61 5b 4d 41 58 5f  |ta.men_data[MAX_|
00000620  4d 45 4e 55 53 5d 3b 0a  6a 75 6d 70 5f 64 61 74  |MENUS];.jump_dat|
00000630  61 09 2a 6a 6d 70 5f 64  61 74 61 5f 72 6f 6f 74  |a.*jmp_data_root|
00000640  3b 0a 63 68 61 72 20 61  70 70 6e 61 6d 65 5b 5d  |;.char appname[]|
00000650  20 3d 20 22 52 41 50 53  20 4a 75 6d 70 20 4c 6f  | = "RAPS Jump Lo|
00000660  67 67 65 72 22 3b 0a 63  68 61 72 20 73 70 72 6e  |gger";.char sprn|
00000670  61 6d 65 5b 5d 20 3d 20  22 21 72 61 70 73 22 3b  |ame[] = "!raps";|
00000680  0a 6c 6f 6e 67 20 69 6e  74 20 6d 73 67 6c 69 73  |.long int msglis|
00000690  74 5b 5d 20 3d 20 7b 30  7d 3b 0a 0a 2f 2a 20 46  |t[] = {0};../* F|
000006a0  75 6e 63 74 69 6f 6e 20  70 72 6f 74 6f 74 79 70  |unction prototyp|
000006b0  69 6e 67 20 2a 2f 0a 0a  69 6e 74 09 6d 61 69 6e  |ing */..int.main|
000006c0  28 76 6f 69 64 29 3b 0a  76 6f 69 64 09 6f 70 65  |(void);.void.ope|
000006d0  6e 77 69 6e 64 6f 77 28  75 6e 73 69 67 6e 65 64  |nwindow(unsigned|
000006e0  20 63 68 61 72 5b 5d 29  3b 0a 76 6f 69 64 09 63  | char[]);.void.c|
000006f0  6c 6f 73 65 77 69 6e 64  6f 77 28 75 6e 73 69 67  |losewindow(unsig|
00000700  6e 65 64 20 63 68 61 72  5b 5d 29 3b 0a 76 6f 69  |ned char[]);.voi|
00000710  64 09 6c 6f 61 64 74 65  6d 70 6c 61 74 65 73 28  |d.loadtemplates(|
00000720  76 6f 69 64 29 3b 0a 76  6f 69 64 09 6d 6f 75 73  |void);.void.mous|
00000730  65 5f 63 6c 69 63 6b 28  75 6e 73 69 67 6e 65 64  |e_click(unsigned|
00000740  20 63 68 61 72 5b 5d 29  3b 0a 76 6f 69 64 09 64  | char[]);.void.d|
00000750  72 61 67 5f 72 65 74 75  72 6e 28 75 6e 73 69 67  |rag_return(unsig|
00000760  6e 65 64 20 63 68 61 72  5b 5d 29 3b 0a 76 6f 69  |ned char[]);.voi|
00000770  64 09 77 69 6d 70 5f 6d  73 67 28 69 6e 74 2c 20  |d.wimp_msg(int, |
00000780  75 6e 73 69 67 6e 65 64  20 63 68 61 72 5b 5d 29  |unsigned char[])|
00000790  3b 0a 76 6f 69 64 09 6f  70 65 6e 5f 6d 61 69 6e  |;.void.open_main|
000007a0  5f 77 69 6e 64 6f 77 28  76 6f 69 64 29 3b 0a 76  |_window(void);.v|
000007b0  6f 69 64 09 70 72 65 76  5f 72 65 63 6f 72 64 28  |oid.prev_record(|
000007c0  76 6f 69 64 29 3b 0a 76  6f 69 64 09 6e 65 78 74  |void);.void.next|
000007d0  5f 72 65 63 6f 72 64 28  76 6f 69 64 29 3b 0a 76  |_record(void);.v|
000007e0  6f 69 64 09 75 70 64 61  74 65 5f 77 69 6e 64 6f  |oid.update_windo|
000007f0  77 5f 69 6e 66 6f 28 76  6f 69 64 29 3b 0a 76 6f  |w_info(void);.vo|
00000800  69 64 09 6d 65 6e 75 5f  73 65 6c 65 63 74 69 6f  |id.menu_selectio|
00000810  6e 28 75 6e 73 69 67 6e  65 64 20 63 68 61 72 5b  |n(unsigned char[|
00000820  5d 29 3b 0a 76 6f 69 64  09 73 65 74 75 70 5f 64  |]);.void.setup_d|
00000830  61 74 61 62 61 73 65 28  76 6f 69 64 29 3b 0a 76  |atabase(void);.v|
00000840  6f 69 64 09 75 70 64 61  74 65 5f 72 65 63 6f 72  |oid.update_recor|
00000850  64 28 76 6f 69 64 29 3b  0a 76 6f 69 64 09 61 64  |d(void);.void.ad|
00000860  64 5f 72 65 63 6f 72 64  28 76 6f 69 64 29 3b 0a  |d_record(void);.|
00000870  76 6f 69 64 09 64 61 74  61 5f 73 61 76 65 28 75  |void.data_save(u|
00000880  6e 73 69 67 6e 65 64 20  63 68 61 72 5b 5d 29 3b  |nsigned char[]);|
00000890  0a 0a 2f 2a 20 4d 61 69  6e 20 70 72 6f 67 72 61  |../* Main progra|
000008a0  6d 20 2a 2f 0a 0a 69 6e  74 0a 6d 61 69 6e 28 29  |m */..int.main()|
000008b0  0a 7b 0a 09 69 6e 74 09  74 61 73 6b 5f 68 61 6e  |.{..int.task_han|
000008c0  64 6c 65 2c 20 69 63 6f  6e 5f 68 61 6e 64 6c 65  |dle, icon_handle|
000008d0  3b 0a 0a 09 75 6e 73 69  67 6e 65 64 20 63 68 61  |;...unsigned cha|
000008e0  72 09 70 6f 6c 6c 5f 62  6c 6f 63 6b 5b 32 35 36  |r.poll_block[256|
000008f0  5d 3b 0a 09 69 6e 74 09  70 6f 6c 6c 5f 72 65 73  |];..int.poll_res|
00000900  75 6c 74 3b 0a 09 69 6e  74 09 69 20 3d 20 30 3b  |ult;..int.i = 0;|
00000910  0a 0a 09 73 65 74 75 70  5f 64 61 74 61 62 61 73  |...setup_databas|
00000920  65 28 29 3b 0a 09 74 61  73 6b 5f 68 61 6e 64 6c  |e();..task_handl|
00000930  65 20 3d 20 61 75 5f 69  6e 69 74 69 61 6c 69 73  |e = au_initialis|
00000940  65 28 56 45 52 53 49 4f  4e 5f 4e 55 4d 42 45 52  |e(VERSION_NUMBER|
00000950  2c 20 61 70 70 6e 61 6d  65 2c 20 6d 73 67 6c 69  |, appname, msgli|
00000960  73 74 29 3b 0a 09 69 63  6f 6e 5f 68 61 6e 64 6c  |st);..icon_handl|
00000970  65 20 3d 20 61 75 5f 63  72 65 61 74 65 5f 69 63  |e = au_create_ic|
00000980  6f 6e 62 61 72 5f 69 63  6f 6e 28 49 42 41 52 5f  |onbar_icon(IBAR_|
00000990  50 52 49 4f 52 5f 41 50  50 2c 0a 09 09 09 49 42  |PRIOR_APP,....IB|
000009a0  41 52 5f 4f 4e 52 49 47  48 54 2c 0a 09 09 09 49  |AR_ONRIGHT,....I|
000009b0  43 4f 4e 5f 49 53 53 50  52 49 54 45 20 7c 20 49  |CON_ISSPRITE | I|
000009c0  43 4f 4e 5f 48 43 45 4e  54 52 45 20 7c 20 49 43  |CON_HCENTRE | IC|
000009d0  4f 4e 5f 56 43 45 4e 54  52 45 20 7c 20 49 43 4f  |ON_VCENTRE | ICO|
000009e0  4e 5f 43 4c 49 43 4b 4e  4f 54 49 46 49 45 53 4f  |N_CLICKNOTIFIESO|
000009f0  4e 43 45 2c 0a 09 09 09  73 70 72 6e 61 6d 65 29  |NCE,....sprname)|
00000a00  3b 0a 09 6c 6f 61 64 74  65 6d 70 6c 61 74 65 73  |;..loadtemplates|
00000a10  28 29 3b 0a 09 2f 2a 61  75 5f 6f 70 65 6e 77 69  |();../*au_openwi|
00000a20  6e 5f 66 72 6f 6d 5f 74  65 6d 70 6c 61 74 65 64  |n_from_templated|
00000a30  61 74 61 28 26 77 69 6e  5f 64 61 74 61 5b 30 5d  |ata(&win_data[0]|
00000a40  2c 20 2d 31 29 3b 20 2a  2f 0a 09 77 68 69 6c 65  |, -1); */..while|
00000a50  20 28 51 55 49 54 5f 46  4c 41 47 20 3d 3d 20 30  | (QUIT_FLAG == 0|
00000a60  29 20 7b 0a 09 2f 2a 20  64 6f 20 73 6f 6d 65 20  |) {../* do some |
00000a70  70 6f 6c 6c 69 6e 67 20  2a 2f 0a 09 09 70 6f 6c  |polling */...pol|
00000a80  6c 5f 72 65 73 75 6c 74  20 3d 20 61 75 5f 77 69  |l_result = au_wi|
00000a90  6d 70 5f 70 6f 6c 6c 28  50 4f 4c 4c 5f 4d 41 53  |mp_poll(POLL_MAS|
00000aa0  4b 2c 20 70 6f 6c 6c 5f  62 6c 6f 63 6b 29 3b 0a  |K, poll_block);.|
00000ab0  09 09 73 77 69 74 63 68  20 28 70 6f 6c 6c 5f 72  |..switch (poll_r|
00000ac0  65 73 75 6c 74 29 20 7b  0a 09 09 09 63 61 73 65  |esult) {....case|
00000ad0  20 20 32 20 3a 20 6f 70  65 6e 77 69 6e 64 6f 77  |  2 : openwindow|
00000ae0  28 70 6f 6c 6c 5f 62 6c  6f 63 6b 29 3b 0a 09 09  |(poll_block);...|
00000af0  09 09 09 09 62 72 65 61  6b 3b 0a 09 09 09 63 61  |....break;....ca|
00000b00  73 65 20 20 33 20 3a 20  63 6c 6f 73 65 77 69 6e  |se  3 : closewin|
00000b10  64 6f 77 28 70 6f 6c 6c  5f 62 6c 6f 63 6b 29 3b  |dow(poll_block);|
00000b20  0a 09 09 09 09 09 09 62  72 65 61 6b 3b 0a 09 09  |.......break;...|
00000b30  09 63 61 73 65 20 20 36  20 3a 20 6d 6f 75 73 65  |.case  6 : mouse|
00000b40  5f 63 6c 69 63 6b 28 70  6f 6c 6c 5f 62 6c 6f 63  |_click(poll_bloc|
00000b50  6b 29 3b 0a 09 09 09 09  09 09 62 72 65 61 6b 3b  |k);.......break;|
00000b60  0a 09 09 09 63 61 73 65  20 20 37 20 3a 20 64 72  |....case  7 : dr|
00000b70  61 67 5f 72 65 74 75 72  6e 28 70 6f 6c 6c 5f 62  |ag_return(poll_b|
00000b80  6c 6f 63 6b 29 3b 0a 09  09 09 09 09 09 62 72 65  |lock);.......bre|
00000b90  61 6b 3b 0a 09 09 09 63  61 73 65 20 20 39 20 3a  |ak;....case  9 :|
00000ba0  20 6d 65 6e 75 5f 73 65  6c 65 63 74 69 6f 6e 28  | menu_selection(|
00000bb0  70 6f 6c 6c 5f 62 6c 6f  63 6b 29 3b 0a 09 09 09  |poll_block);....|
00000bc0  09 09 09 62 72 65 61 6b  3b 0a 09 09 09 63 61 73  |...break;....cas|
00000bd0  65 20 31 37 20 3a 0a 09  09 09 63 61 73 65 20 31  |e 17 :....case 1|
00000be0  38 20 3a 0a 09 09 09 63  61 73 65 20 31 39 20 3a  |8 :....case 19 :|
00000bf0  20 77 69 6d 70 5f 6d 73  67 28 70 6f 6c 6c 5f 72  | wimp_msg(poll_r|
00000c00  65 73 75 6c 74 2c 20 70  6f 6c 6c 5f 62 6c 6f 63  |esult, poll_bloc|
00000c10  6b 29 3b 0a 09 09 09 09  09 09 62 72 65 61 6b 3b  |k);.......break;|
00000c20  0a 09 09 7d 0a 09 7d 0a  09 61 75 5f 63 6c 6f 73  |...}..}..au_clos|
00000c30  65 64 6f 77 6e 28 74 61  73 6b 5f 68 61 6e 64 6c  |edown(task_handl|
00000c40  65 29 3b 0a 0a 09 66 6f  72 28 69 20 3d 20 30 3b  |e);...for(i = 0;|
00000c50  20 69 20 3c 20 4d 41 58  5f 57 49 4e 44 4f 57 53  | i < MAX_WINDOWS|
00000c60  3b 20 69 2b 2b 29 20 7b  0a 09 09 66 72 65 65 28  |; i++) {...free(|
00000c70  77 69 6e 5f 64 61 74 61  5b 69 5d 2e 77 69 6e 5f  |win_data[i].win_|
00000c80  6e 61 6d 65 29 3b 0a 09  09 66 72 65 65 28 77 69  |name);...free(wi|
00000c90  6e 5f 64 61 74 61 5b 69  5d 2e 62 75 66 66 65 72  |n_data[i].buffer|
00000ca0  29 3b 0a 09 09 66 72 65  65 28 77 69 6e 5f 64 61  |);...free(win_da|
00000cb0  74 61 5b 69 5d 2e 77 6f  72 6b 73 70 61 63 65 29  |ta[i].workspace)|
00000cc0  3b 0a 09 7d 0a 0a 09 2f  2a 20 23 52 65 6d 65 6d  |;..}.../* #Remem|
00000cd0  62 65 72 20 74 6f 20 66  72 65 65 20 6d 65 6e 75  |ber to free menu|
00000ce0  20 73 70 61 63 65 21 20  28 72 65 63 75 72 73 69  | space! (recursi|
00000cf0  6f 6e 3f 29 20 2a 2f 0a  7d 0a 0a 76 6f 69 64 20  |on?) */.}..void |
00000d00  6d 6f 75 73 65 5f 63 6c  69 63 6b 28 75 6e 73 69  |mouse_click(unsi|
00000d10  67 6e 65 64 20 63 68 61  72 20 70 6f 6c 6c 5f 62  |gned char poll_b|
00000d20  6c 6f 63 6b 5b 5d 29 0a  7b 0a 09 2f 2a 20 54 68  |lock[]).{../* Th|
00000d30  65 20 64 72 61 67 67 69  6e 67 20 63 6f 64 65 20  |e dragging code |
00000d40  61 6c 73 6f 20 67 6f 65  73 20 69 6e 20 68 65 72  |also goes in her|
00000d50  65 2e 2e 2e 20 2a 2f 20  0a 09 69 6e 74 09 63 6c  |e... */ ..int.cl|
00000d60  6b 3b 0a 09 6c 6f 6e 67  20 69 6e 74 09 69 63 6f  |k;..long int.ico|
00000d70  6e 5f 6e 75 6d 3b 0a 0a  09 2f 2a 20 44 65 74 65  |n_num;.../* Dete|
00000d80  72 6d 69 6e 65 20 77 68  69 63 68 20 62 75 74 74  |rmine which butt|
00000d90  6f 6e 20 77 61 73 20 70  72 65 73 73 65 64 20 2a  |on was pressed *|
00000da0  2f 0a 09 63 6c 6b 20 3d  20 28 69 6e 74 29 20 61  |/..clk = (int) a|
00000db0  75 5f 62 79 74 65 74 6f  77 6f 72 64 28 70 6f 6c  |u_bytetoword(pol|
00000dc0  6c 5f 62 6c 6f 63 6b 2c  20 38 29 3b 20 0a 0a 09  |l_block, 8); ...|
00000dd0  69 66 28 28 61 75 5f 62  79 74 65 74 6f 77 6f 72  |if((au_bytetowor|
00000de0  64 28 70 6f 6c 6c 5f 62  6c 6f 63 6b 2c 20 31 32  |d(poll_block, 12|
00000df0  29 20 3d 3d 20 2d 32 29  20 26 26 20 28 63 6c 6b  |) == -2) && (clk|
00000e00  20 3d 3d 20 34 29 29 20  7b 0a 09 6f 70 65 6e 5f  | == 4)) {..open_|
00000e10  6d 61 69 6e 5f 77 69 6e  64 6f 77 28 29 3b 0a 09  |main_window();..|
00000e20  7d 0a 0a 09 69 66 28 28  61 75 5f 62 79 74 65 74  |}...if((au_bytet|
00000e30  6f 77 6f 72 64 28 70 6f  6c 6c 5f 62 6c 6f 63 6b  |oword(poll_block|
00000e40  2c 20 31 32 29 20 3d 3d  20 2d 32 29 20 26 26 20  |, 12) == -2) && |
00000e50  28 63 6c 6b 20 3d 3d 20  32 29 29 20 7b 0a 09 09  |(clk == 2)) {...|
00000e60  2f 2a 20 54 69 6d 65 20  74 6f 20 70 72 6f 64 75  |/* Time to produ|
00000e70  63 65 20 61 20 6d 65 6e  75 20 2a 2f 0a 09 09 61  |ce a menu */...a|
00000e80  75 5f 62 75 69 6c 64 6d  65 6e 75 28 22 52 41 50  |u_buildmenu("RAP|
00000e90  53 22 2c 20 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  |S", &men_data[0]|
00000ea0  29 3b 0a 09 09 61 75 5f  61 64 64 74 6f 6d 65 6e  |);...au_addtomen|
00000eb0  75 28 22 49 6e 66 6f 22  2c 20 30 2c 20 77 69 6e  |u("Info", 0, win|
00000ec0  5f 64 61 74 61 5b 31 5d  2e 77 69 6e 5f 68 61 6e  |_data[1].win_han|
00000ed0  64 6c 65 2c 20 30 2c 20  26 6d 65 6e 5f 64 61 74  |dle, 0, &men_dat|
00000ee0  61 5b 30 5d 29 3b 0a 09  09 61 75 5f 61 64 64 74  |a[0]);...au_addt|
00000ef0  6f 6d 65 6e 75 28 22 53  61 76 65 22 2c 20 30 2c  |omenu("Save", 0,|
00000f00  20 77 69 6e 5f 64 61 74  61 5b 32 5d 2e 77 69 6e  | win_data[2].win|
00000f10  5f 68 61 6e 64 6c 65 2c  20 30 2c 20 26 6d 65 6e  |_handle, 0, &men|
00000f20  5f 64 61 74 61 5b 30 5d  29 3b 0a 09 09 61 75 5f  |_data[0]);...au_|
00000f30  61 64 64 74 6f 6d 65 6e  75 28 22 51 75 69 74 22  |addtomenu("Quit"|
00000f40  2c 20 4d 45 4e 55 5f 4c  41 53 54 49 54 45 4d 2c  |, MENU_LASTITEM,|
00000f50  20 2d 31 2c 20 30 2c 20  26 6d 65 6e 5f 64 61 74  | -1, 0, &men_dat|
00000f60  61 5b 30 5d 29 3b 0a 09  09 61 75 5f 63 72 65 61  |a[0]);...au_crea|
00000f70  74 65 6d 65 6e 75 28 26  6d 65 6e 5f 64 61 74 61  |temenu(&men_data|
00000f80  5b 30 5d 29 3b 0a 09 09  43 55 52 52 45 4e 54 5f  |[0]);...CURRENT_|
00000f90  4d 45 4e 55 20 3d 20 31  3b 20 2f 2a 20 6b 65 65  |MENU = 1; /* kee|
00000fa0  70 20 74 72 61 63 6b 20  6f 66 20 74 68 65 20 6c  |p track of the l|
00000fb0  61 73 74 20 6d 65 6e 75  20 77 65 20 6f 70 65 6e  |ast menu we open|
00000fc0  65 64 20 2a 2f 0a 09 09  61 75 5f 6f 70 65 6e 6d  |ed */...au_openm|
00000fd0  65 6e 75 28 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  |enu(&men_data[0]|
00000fe0  2c 20 28 69 6e 74 29 20  61 75 5f 62 79 74 65 74  |, (int) au_bytet|
00000ff0  6f 77 6f 72 64 28 70 6f  6c 6c 5f 62 6c 6f 63 6b  |oword(poll_block|
00001000  2c 20 30 29 20 2d 20 36  34 2c 20 28 34 34 2a 32  |, 0) - 64, (44*2|
00001010  29 2b 39 36 29 3b 0a 09  09 72 65 74 75 72 6e 3b  |)+96);...return;|
00001020  0a 09 7d 0a 0a 09 2f 2a  20 43 68 65 63 6b 20 74  |..}.../* Check t|
00001030  6f 20 73 65 65 20 69 66  20 69 74 20 77 61 73 20  |o see if it was |
00001040  69 6e 20 74 68 65 20 6d  61 69 6e 20 77 69 6e 64  |in the main wind|
00001050  6f 77 20 2a 2f 0a 09 69  66 28 28 61 75 5f 62 79  |ow */..if((au_by|
00001060  74 65 74 6f 77 6f 72 64  28 70 6f 6c 6c 5f 62 6c  |tetoword(poll_bl|
00001070  6f 63 6b 2c 20 31 32 29  20 3d 3d 20 77 69 6e 5f  |ock, 12) == win_|
00001080  64 61 74 61 5b 30 5d 2e  77 69 6e 5f 68 61 6e 64  |data[0].win_hand|
00001090  6c 65 29 20 26 26 20 28  63 6c 6b 20 3d 3d 20 34  |le) && (clk == 4|
000010a0  29 29 20 7b 0a 09 09 69  63 6f 6e 5f 6e 75 6d 20  |)) {...icon_num |
000010b0  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
000010c0  70 6f 6c 6c 5f 62 6c 6f  63 6b 2c 20 31 36 29 3b  |poll_block, 16);|
000010d0  0a 09 09 73 77 69 74 63  68 20 28 69 63 6f 6e 5f  |...switch (icon_|
000010e0  6e 75 6d 29 20 7b 0a 09  09 09 63 61 73 65 20 50  |num) {....case P|
000010f0  52 45 56 5f 52 45 43 4f  52 44 5f 49 43 4f 4e 20  |REV_RECORD_ICON |
00001100  3a 20 70 72 65 76 5f 72  65 63 6f 72 64 28 29 3b  |: prev_record();|
00001110  0a 09 09 09 09 62 72 65  61 6b 3b 0a 09 09 09 63  |.....break;....c|
00001120  61 73 65 20 4e 45 58 54  5f 52 45 43 4f 52 44 5f  |ase NEXT_RECORD_|
00001130  49 43 4f 4e 20 3a 20 6e  65 78 74 5f 72 65 63 6f  |ICON : next_reco|
00001140  72 64 28 29 3b 0a 09 09  09 09 62 72 65 61 6b 3b  |rd();.....break;|
00001150  0a 09 09 09 63 61 73 65  20 55 50 44 41 54 45 5f  |....case UPDATE_|
00001160  49 43 4f 4e 20 3a 20 75  70 64 61 74 65 5f 72 65  |ICON : update_re|
00001170  63 6f 72 64 28 29 3b 0a  09 09 09 09 62 72 65 61  |cord();.....brea|
00001180  6b 3b 0a 09 09 7d 0a 09  7d 0a 0a 09 2f 2a 20 43  |k;...}..}.../* C|
00001190  68 65 63 6b 20 74 6f 20  73 65 65 20 77 68 65 74  |heck to see whet|
000011a0  68 65 72 20 77 65 20 6e  65 65 64 20 74 6f 20 73  |her we need to s|
000011b0  74 61 72 74 20 61 20 64  72 61 67 20 6f 70 65 72  |tart a drag oper|
000011c0  61 74 69 6f 6e 20 2d 20  64 72 61 67 73 20 61 72  |ation - drags ar|
000011d0  65 20 70 61 73 73 65 64  20 61 73 0a 09 20 2a 20  |e passed as.. * |
000011e0  74 68 65 20 6d 6f 75 73  65 20 62 75 74 74 6f 6e  |the mouse button|
000011f0  20 6e 75 6d 62 65 72 20  6d 75 6c 74 69 70 6c 69  | number multipli|
00001200  65 64 20 62 79 20 31 36  20 2a 2f 0a 0a 09 69 66  |ed by 16 */...if|
00001210  28 28 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |((au_bytetoword(|
00001220  70 6f 6c 6c 5f 62 6c 6f  63 6b 2c 20 31 32 29 20  |poll_block, 12) |
00001230  3d 3d 20 77 69 6e 5f 64  61 74 61 5b 32 5d 2e 77  |== win_data[2].w|
00001240  69 6e 5f 68 61 6e 64 6c  65 29 20 26 26 20 28 63  |in_handle) && (c|
00001250  6c 6b 20 3d 3d 20 34 2a  31 36 29 29 20 7b 0a 09  |lk == 4*16)) {..|
00001260  09 2f 2a 20 53 74 61 72  74 20 74 68 65 20 64 72  |./* Start the dr|
00001270  61 67 20 6f 70 65 72 61  74 69 6f 6e 20 2a 2f 0a  |ag operation */.|
00001280  09 09 69 63 6f 6e 5f 6e  75 6d 20 3d 20 61 75 5f  |..icon_num = au_|
00001290  62 79 74 65 74 6f 77 6f  72 64 28 70 6f 6c 6c 5f  |bytetoword(poll_|
000012a0  62 6c 6f 63 6b 2c 20 31  36 29 3b 0a 09 09 2f 2a  |block, 16);.../*|
000012b0  20 41 72 65 20 77 65 20  6f 76 65 72 20 74 68 65  | Are we over the|
000012c0  20 61 63 74 75 61 6c 20  66 69 6c 65 20 69 63 6f  | actual file ico|
000012d0  6e 20 69 6e 20 74 68 65  20 73 61 76 65 20 77 69  |n in the save wi|
000012e0  6e 64 6f 77 3f 20 2a 2f  0a 09 09 69 66 28 69 63  |ndow? */...if(ic|
000012f0  6f 6e 5f 6e 75 6d 20 3d  3d 20 53 41 56 45 5f 49  |on_num == SAVE_I|
00001300  43 4f 4e 29 20 7b 0a 09  09 09 61 75 5f 64 72 61  |CON) {....au_dra|
00001310  67 62 6f 78 28 61 75 5f  62 79 74 65 74 6f 77 6f  |gbox(au_bytetowo|
00001320  72 64 28 70 6f 6c 6c 5f  62 6c 6f 63 6b 2c 20 31  |rd(poll_block, 1|
00001330  32 29 2c 20 69 63 6f 6e  5f 6e 75 6d 29 3b 0a 09  |2), icon_num);..|
00001340  09 09 2f 2a 20 54 68 69  73 20 69 73 20 6a 75 73  |../* This is jus|
00001350  74 20 73 6f 20 77 65 20  72 65 6d 65 6d 62 65 72  |t so we remember|
00001360  20 77 68 69 63 68 20 64  72 61 67 20 77 65 27 72  | which drag we'r|
00001370  65 20 64 6f 69 6e 67 20  2a 2f 0a 09 09 09 44 52  |e doing */....DR|
00001380  41 47 5f 46 4c 41 47 20  3d 20 53 41 56 45 5f 44  |AG_FLAG = SAVE_D|
00001390  52 41 47 3b 0a 09 09 7d  0a 09 7d 0a 0a 09 72 65  |RAG;...}..}...re|
000013a0  74 75 72 6e 3b 0a 7d 0a  0a 76 6f 69 64 20 64 72  |turn;.}..void dr|
000013b0  61 67 5f 72 65 74 75 72  6e 28 75 6e 73 69 67 6e  |ag_return(unsign|
000013c0  65 64 20 63 68 61 72 20  70 6f 6c 6c 5f 62 6c 6f  |ed char poll_blo|
000013d0  63 6b 5b 5d 29 0a 7b 0a  09 63 68 61 72 09 74 65  |ck[]).{..char.te|
000013e0  6d 70 5f 6e 61 6d 65 5b  32 35 36 5d 3b 0a 09 2f  |mp_name[256];../|
000013f0  2a 20 43 61 6c 6c 20 47  65 74 50 6f 69 6e 74 65  |* Call GetPointe|
00001400  72 49 6e 66 6f 20 74 6f  20 66 69 6e 64 20 6f 75  |rInfo to find ou|
00001410  74 20 77 68 65 72 65 20  70 6f 69 6e 74 65 72 20  |t where pointer |
00001420  69 73 20 2a 2f 0a 09 70  6f 69 6e 74 65 72 5f 64  |is */..pointer_d|
00001430  61 74 61 09 70 6f 69 6e  74 65 72 5f 69 6e 66 6f  |ata.pointer_info|
00001440  3b 0a 09 61 75 5f 67 65  74 70 6f 69 6e 74 65 72  |;..au_getpointer|
00001450  69 6e 66 6f 28 26 70 6f  69 6e 74 65 72 5f 69 6e  |info(&pointer_in|
00001460  66 6f 29 3b 0a 09 2f 2a  20 4e 6f 77 20 77 65 20  |fo);../* Now we |
00001470  63 68 65 63 6b 20 74 6f  20 73 65 65 20 77 68 65  |check to see whe|
00001480  74 68 65 72 20 77 65 27  72 65 20 69 6e 20 74 68  |ther we're in th|
00001490  65 20 6d 69 64 64 6c 65  20 6f 66 20 61 20 64 72  |e middle of a dr|
000014a0  61 67 a0 2a 2f 0a 09 69  66 20 28 44 52 41 47 5f  |ag.*/..if (DRAG_|
000014b0  46 4c 41 47 20 3d 3d 20  53 41 56 45 5f 44 52 41  |FLAG == SAVE_DRA|
000014c0  47 29 20 7b 0a 09 09 2f  2a 20 47 72 61 62 20 6c  |G) {.../* Grab l|
000014d0  65 61 66 6e 61 6d 65 20  66 72 6f 6d 20 73 61 76  |eafname from sav|
000014e0  65 20 69 63 6f 6e 20 2a  2f 0a 09 09 61 75 5f 69  |e icon */...au_i|
000014f0  63 6f 6e 5f 67 65 74 5f  74 65 78 74 28 74 65 6d  |con_get_text(tem|
00001500  70 5f 6e 61 6d 65 2c 20  77 69 6e 5f 64 61 74 61  |p_name, win_data|
00001510  5b 32 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 2c 20  |[2].win_handle, |
00001520  53 41 56 45 5f 46 49 4c  45 4e 41 4d 45 5f 49 43  |SAVE_FILENAME_IC|
00001530  4f 4e 29 3b 0a 09 09 2f  2a 20 4e 6f 77 20 77 65  |ON);.../* Now we|
00001540  20 63 61 6e 20 73 65 6e  64 20 61 20 44 61 74 61  | can send a Data|
00001550  53 61 76 65 20 6d 65 73  73 61 67 65 20 2a 2f 0a  |Save message */.|
00001560  09 09 61 75 5f 64 61 74  61 73 61 76 65 28 70 6f  |..au_datasave(po|
00001570  69 6e 74 65 72 5f 69 6e  66 6f 2c 20 31 30 32 34  |inter_info, 1024|
00001580  2c 20 30 78 66 66 66 2c  20 74 65 6d 70 5f 6e 61  |, 0xfff, temp_na|
00001590  6d 65 29 3b 0a 09 09 44  52 41 47 5f 46 4c 41 47  |me);...DRAG_FLAG|
000015a0  20 3d 20 30 3b 0a 09 7d  0a 7d 0a 0a 76 6f 69 64  | = 0;..}.}..void|
000015b0  20 6d 65 6e 75 5f 73 65  6c 65 63 74 69 6f 6e 28  | menu_selection(|
000015c0  75 6e 73 69 67 6e 65 64  20 63 68 61 72 20 70 6f  |unsigned char po|
000015d0  6c 6c 5f 62 6c 6f 63 6b  5b 5d 29 0a 7b 0a 09 6c  |ll_block[]).{..l|
000015e0  6f 6e 67 20 69 6e 74 09  66 69 72 73 74 5f 68 69  |ong int.first_hi|
000015f0  74 3b 0a 09 2f 2a 20 57  68 69 63 68 20 6d 65 6e  |t;../* Which men|
00001600  75 20 77 61 73 20 68 69  74 3f 20 2a 2f 0a 09 69  |u was hit? */..i|
00001610  66 20 28 43 55 52 52 45  4e 54 5f 4d 45 4e 55 20  |f (CURRENT_MENU |
00001620  3d 3d 20 31 29 20 7b 0a  09 09 2f 2a 20 54 68 65  |== 1) {.../* The|
00001630  20 69 63 6f 6e 20 62 61  72 20 6d 65 6e 75 20 67  | icon bar menu g|
00001640  6f 74 20 69 74 20 2d 20  64 65 63 69 70 68 65 72  |ot it - decipher|
00001650  20 66 69 72 73 74 20 6d  65 6e 75 20 73 75 62 73  | first menu subs|
00001660  65 6c 65 63 74 69 6f 6e  20 2a 2f 0a 09 09 66 69  |election */...fi|
00001670  72 73 74 5f 68 69 74 20  3d 20 61 75 5f 62 79 74  |rst_hit = au_byt|
00001680  65 74 6f 77 6f 72 64 28  70 6f 6c 6c 5f 62 6c 6f  |etoword(poll_blo|
00001690  63 6b 2c 20 30 29 3b 0a  09 09 69 66 20 28 66 69  |ck, 0);...if (fi|
000016a0  72 73 74 5f 68 69 74 20  3d 3d 20 51 55 49 54 5f  |rst_hit == QUIT_|
000016b0  4f 50 54 49 4f 4e 29 20  7b 0a 09 09 09 51 55 49  |OPTION) {....QUI|
000016c0  54 5f 46 4c 41 47 20 3d  20 31 3b 0a 09 09 7d 0a  |T_FLAG = 1;...}.|
000016d0  09 7d 0a 09 72 65 74 75  72 6e 3b 0a 7d 0a 0a 76  |.}..return;.}..v|
000016e0  6f 69 64 20 70 72 65 76  5f 72 65 63 6f 72 64 28  |oid prev_record(|
000016f0  76 6f 69 64 29 0a 7b 0a  09 69 66 20 28 43 55 52  |void).{..if (CUR|
00001700  52 45 4e 54 5f 52 45 43  4f 52 44 5f 50 4f 49 4e  |RENT_RECORD_POIN|
00001710  54 45 52 2d 3e 70 72 65  76 5f 72 65 63 6f 72 64  |TER->prev_record|
00001720  20 21 3d 20 4e 55 4c 4c  29 20 7b 0a 09 09 2f 2a  | != NULL) {.../*|
00001730  20 53 61 76 65 20 77 69  6e 64 6f 77 20 69 6e 66  | Save window inf|
00001740  6f 72 6d 61 74 69 6f 6e  3f 20 2a 2f 0a 09 09 43  |ormation? */...C|
00001750  55 52 52 45 4e 54 5f 52  45 43 4f 52 44 5f 50 4f  |URRENT_RECORD_PO|
00001760  49 4e 54 45 52 20 3d 20  43 55 52 52 45 4e 54 5f  |INTER = CURRENT_|
00001770  52 45 43 4f 52 44 5f 50  4f 49 4e 54 45 52 2d 3e  |RECORD_POINTER->|
00001780  70 72 65 76 5f 72 65 63  6f 72 64 3b 0a 09 09 43  |prev_record;...C|
00001790  55 52 52 45 4e 54 5f 52  45 43 4f 52 44 5f 4e 55  |URRENT_RECORD_NU|
000017a0  4d 42 45 52 20 3d 20 43  55 52 52 45 4e 54 5f 52  |MBER = CURRENT_R|
000017b0  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 2d 3e 6a  |ECORD_POINTER->j|
000017c0  75 6d 70 5f 6e 6f 3b 0a  09 09 2f 2a 20 77 6f 75  |ump_no;.../* wou|
000017d0  6c 64 20 75 70 64 61 74  65 20 77 69 6e 64 6f 77  |ld update window|
000017e0  20 69 6e 66 6f 20 68 65  72 65 20 2a 2f 0a 09 09  | info here */...|
000017f0  75 70 64 61 74 65 5f 77  69 6e 64 6f 77 5f 69 6e  |update_window_in|
00001800  66 6f 28 29 3b 0a 09 7d  0a 7d 0a 0a 76 6f 69 64  |fo();..}.}..void|
00001810  20 6e 65 78 74 5f 72 65  63 6f 72 64 28 76 6f 69  | next_record(voi|
00001820  64 29 0a 7b 0a 09 69 66  20 28 43 55 52 52 45 4e  |d).{..if (CURREN|
00001830  54 5f 52 45 43 4f 52 44  5f 50 4f 49 4e 54 45 52  |T_RECORD_POINTER|
00001840  2d 3e 6e 65 78 74 5f 72  65 63 6f 72 64 20 21 3d  |->next_record !=|
00001850  20 4e 55 4c 4c 29 20 7b  0a 09 09 43 55 52 52 45  | NULL) {...CURRE|
00001860  4e 54 5f 52 45 43 4f 52  44 5f 50 4f 49 4e 54 45  |NT_RECORD_POINTE|
00001870  52 20 3d 20 43 55 52 52  45 4e 54 5f 52 45 43 4f  |R = CURRENT_RECO|
00001880  52 44 5f 50 4f 49 4e 54  45 52 2d 3e 6e 65 78 74  |RD_POINTER->next|
00001890  5f 72 65 63 6f 72 64 3b  0a 09 09 43 55 52 52 45  |_record;...CURRE|
000018a0  4e 54 5f 52 45 43 4f 52  44 5f 4e 55 4d 42 45 52  |NT_RECORD_NUMBER|
000018b0  20 3d 20 43 55 52 52 45  4e 54 5f 52 45 43 4f 52  | = CURRENT_RECOR|
000018c0  44 5f 50 4f 49 4e 54 45  52 2d 3e 6a 75 6d 70 5f  |D_POINTER->jump_|
000018d0  6e 6f 3b 0a 09 09 2f 2a  20 77 6f 75 6c 64 20 75  |no;.../* would u|
000018e0  70 64 61 74 65 20 77 69  6e 64 6f 77 20 69 6e 66  |pdate window inf|
000018f0  6f 20 68 65 72 65 20 2a  2f 0a 09 09 75 70 64 61  |o here */...upda|
00001900  74 65 5f 77 69 6e 64 6f  77 5f 69 6e 66 6f 28 29  |te_window_info()|
00001910  3b 0a 09 7d 0a 7d 0a 0a  76 6f 69 64 20 75 70 64  |;..}.}..void upd|
00001920  61 74 65 5f 72 65 63 6f  72 64 28 76 6f 69 64 29  |ate_record(void)|
00001930  0a 7b 0a 09 2f 2a 20 57  65 20 6e 65 65 64 20 61  |.{../* We need a|
00001940  20 74 65 6d 70 6f 72 61  72 79 20 73 74 72 69 6e  | temporary strin|
00001950  67 20 62 75 66 66 65 72  20 2a 2f 0a 09 63 68 61  |g buffer */..cha|
00001960  72 20 74 65 6d 70 5f 62  75 66 5b 32 35 35 5d 3b  |r temp_buf[255];|
00001970  0a 0a 09 2f 2a 20 53 61  76 65 20 77 69 6e 64 6f  |.../* Save windo|
00001980  77 20 69 6e 66 6f 72 6d  61 74 69 6f 6e 20 2a 2f  |w information */|
00001990  0a 09 61 75 5f 69 63 6f  6e 5f 67 65 74 5f 74 65  |..au_icon_get_te|
000019a0  78 74 28 43 55 52 52 45  4e 54 5f 52 45 43 4f 52  |xt(CURRENT_RECOR|
000019b0  44 5f 50 4f 49 4e 54 45  52 2d 3e 64 61 74 65 2c  |D_POINTER->date,|
000019c0  20 77 69 6e 5f 64 61 74  61 5b 30 5d 2e 77 69 6e  | win_data[0].win|
000019d0  5f 68 61 6e 64 6c 65 2c  20 44 41 54 45 5f 49 43  |_handle, DATE_IC|
000019e0  4f 4e 29 3b 0a 09 61 75  5f 69 63 6f 6e 5f 67 65  |ON);..au_icon_ge|
000019f0  74 5f 74 65 78 74 28 43  55 52 52 45 4e 54 5f 52  |t_text(CURRENT_R|
00001a00  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 2d 3e 61  |ECORD_POINTER->a|
00001a10  69 72 63 72 61 66 74 2c  20 77 69 6e 5f 64 61 74  |ircraft, win_dat|
00001a20  61 5b 30 5d 2e 77 69 6e  5f 68 61 6e 64 6c 65 2c  |a[0].win_handle,|
00001a30  20 41 49 52 43 52 41 46  54 5f 49 43 4f 4e 29 3b  | AIRCRAFT_ICON);|
00001a40  0a 09 61 75 5f 69 63 6f  6e 5f 67 65 74 5f 74 65  |..au_icon_get_te|
00001a50  78 74 28 43 55 52 52 45  4e 54 5f 52 45 43 4f 52  |xt(CURRENT_RECOR|
00001a60  44 5f 50 4f 49 4e 54 45  52 2d 3e 64 72 6f 70 7a  |D_POINTER->dropz|
00001a70  6f 6e 65 2c 20 77 69 6e  5f 64 61 74 61 5b 30 5d  |one, win_data[0]|
00001a80  2e 77 69 6e 5f 68 61 6e  64 6c 65 2c 20 44 52 4f  |.win_handle, DRO|
00001a90  50 5a 4f 4e 45 5f 49 43  4f 4e 29 3b 0a 09 61 75  |PZONE_ICON);..au|
00001aa0  5f 69 63 6f 6e 5f 67 65  74 5f 74 65 78 74 28 43  |_icon_get_text(C|
00001ab0  55 52 52 45 4e 54 5f 52  45 43 4f 52 44 5f 50 4f  |URRENT_RECORD_PO|
00001ac0  49 4e 54 45 52 2d 3e 61  69 72 77 6f 72 6b 2c 20  |INTER->airwork, |
00001ad0  77 69 6e 5f 64 61 74 61  5b 30 5d 2e 77 69 6e 5f  |win_data[0].win_|
00001ae0  68 61 6e 64 6c 65 2c 20  41 49 52 57 4f 52 4b 5f  |handle, AIRWORK_|
00001af0  49 43 4f 4e 29 3b 0a 09  61 75 5f 69 63 6f 6e 5f  |ICON);..au_icon_|
00001b00  67 65 74 5f 74 65 78 74  28 43 55 52 52 45 4e 54  |get_text(CURRENT|
00001b10  5f 52 45 43 4f 52 44 5f  50 4f 49 4e 54 45 52 2d  |_RECORD_POINTER-|
00001b20  3e 72 65 6d 61 72 6b 73  31 2c 20 77 69 6e 5f 64  |>remarks1, win_d|
00001b30  61 74 61 5b 30 5d 2e 77  69 6e 5f 68 61 6e 64 6c  |ata[0].win_handl|
00001b40  65 2c 20 52 45 4d 41 52  4b 53 31 5f 49 43 4f 4e  |e, REMARKS1_ICON|
00001b50  29 3b 0a 09 61 75 5f 69  63 6f 6e 5f 67 65 74 5f  |);..au_icon_get_|
00001b60  74 65 78 74 28 43 55 52  52 45 4e 54 5f 52 45 43  |text(CURRENT_REC|
00001b70  4f 52 44 5f 50 4f 49 4e  54 45 52 2d 3e 72 65 6d  |ORD_POINTER->rem|
00001b80  61 72 6b 73 32 2c 20 77  69 6e 5f 64 61 74 61 5b  |arks2, win_data[|
00001b90  30 5d 2e 77 69 6e 5f 68  61 6e 64 6c 65 2c 20 52  |0].win_handle, R|
00001ba0  45 4d 41 52 4b 53 32 5f  49 43 4f 4e 29 3b 0a 09  |EMARKS2_ICON);..|
00001bb0  2f 2a 20 57 65 20 6e 65  65 64 20 74 6f 20 63 6f  |/* We need to co|
00001bc0  6e 76 65 72 74 20 74 65  78 74 20 74 6f 20 69 6e  |nvert text to in|
00001bd0  74 65 67 65 72 20 68 65  72 65 20 2a 2f 0a 09 61  |teger here */..a|
00001be0  75 5f 69 63 6f 6e 5f 67  65 74 5f 74 65 78 74 28  |u_icon_get_text(|
00001bf0  74 65 6d 70 5f 62 75 66  2c 20 77 69 6e 5f 64 61  |temp_buf, win_da|
00001c00  74 61 5b 30 5d 2e 77 69  6e 5f 68 61 6e 64 6c 65  |ta[0].win_handle|
00001c10  2c 20 41 4c 54 49 54 55  44 45 5f 49 43 4f 4e 29  |, ALTITUDE_ICON)|
00001c20  3b 0a 09 43 55 52 52 45  4e 54 5f 52 45 43 4f 52  |;..CURRENT_RECOR|
00001c30  44 5f 50 4f 49 4e 54 45  52 2d 3e 61 6c 74 69 74  |D_POINTER->altit|
00001c40  75 64 65 20 3d 20 61 74  6f 69 28 74 65 6d 70 5f  |ude = atoi(temp_|
00001c50  62 75 66 29 3b 0a 0a 09  2f 2a 20 41 6e 64 20 68  |buf);.../* And h|
00001c60  65 72 65 20 2a 2f 0a 09  61 75 5f 69 63 6f 6e 5f  |ere */..au_icon_|
00001c70  67 65 74 5f 74 65 78 74  28 74 65 6d 70 5f 62 75  |get_text(temp_bu|
00001c80  66 2c 20 77 69 6e 5f 64  61 74 61 5b 30 5d 2e 77  |f, win_data[0].w|
00001c90  69 6e 5f 68 61 6e 64 6c  65 2c 20 44 45 4c 41 59  |in_handle, DELAY|
00001ca0  5f 49 43 4f 4e 29 3b 0a  09 43 55 52 52 45 4e 54  |_ICON);..CURRENT|
00001cb0  5f 52 45 43 4f 52 44 5f  50 4f 49 4e 54 45 52 2d  |_RECORD_POINTER-|
00001cc0  3e 64 65 6c 61 79 20 3d  20 61 74 6f 69 28 74 65  |>delay = atoi(te|
00001cd0  6d 70 5f 62 75 66 29 3b  0a 09 2f 2a 20 52 65 63  |mp_buf);../* Rec|
00001ce0  6f 72 64 20 69 73 20 6e  6f 77 20 73 61 76 65 64  |ord is now saved|
00001cf0  20 69 6e 20 6d 65 6d 6f  72 79 20 2a 2f 0a 0a 09  | in memory */...|
00001d00  2f 2a 20 41 72 65 20 77  65 20 6f 6e 20 74 68 65  |/* Are we on the|
00001d10  20 6c 61 73 74 20 72 65  63 6f 72 64 3f 20 49 66  | last record? If|
00001d20  20 73 6f 2c 20 77 65 20  61 64 64 20 61 20 6e 65  | so, we add a ne|
00001d30  77 20 6f 6e 65 20 2a 2f  0a 09 69 66 20 28 43 55  |w one */..if (CU|
00001d40  52 52 45 4e 54 5f 52 45  43 4f 52 44 5f 50 4f 49  |RRENT_RECORD_POI|
00001d50  4e 54 45 52 2d 3e 6e 65  78 74 5f 72 65 63 6f 72  |NTER->next_recor|
00001d60  64 20 3d 3d 20 4e 55 4c  4c 29 20 7b 0a 09 09 61  |d == NULL) {...a|
00001d70  64 64 5f 72 65 63 6f 72  64 28 29 3b 0a 09 7d 0a  |dd_record();..}.|
00001d80  7d 0a 0a 76 6f 69 64 20  61 64 64 5f 72 65 63 6f  |}..void add_reco|
00001d90  72 64 28 76 6f 69 64 29  0a 7b 0a 09 6a 75 6d 70  |rd(void).{..jump|
00001da0  5f 64 61 74 61 09 2a 6e  65 77 5f 72 65 63 6f 72  |_data.*new_recor|
00001db0  64 3b 0a 0a 09 2f 2a 49  6e 66 6f 72 6d 61 74 69  |d;.../*Informati|
00001dc0  6f 6e 20 66 72 6f 6d 20  77 69 6e 64 6f 77 20 61  |on from window a|
00001dd0  6c 72 65 61 64 79 20 73  61 76 65 64 20 2a 2f 0a  |lready saved */.|
00001de0  0a 09 6e 65 77 5f 72 65  63 6f 72 64 20 3d 20 63  |..new_record = c|
00001df0  61 6c 6c 6f 63 28 31 2c  20 73 69 7a 65 6f 66 28  |alloc(1, sizeof(|
00001e00  6a 75 6d 70 5f 64 61 74  61 29 29 3b 0a 09 2f 2a  |jump_data));../*|
00001e10  20 49 6e 69 74 69 61 6c  69 73 65 20 70 6f 69 6e  | Initialise poin|
00001e20  74 65 72 73 20 2a 2f 0a  09 6e 65 77 5f 72 65 63  |ters */..new_rec|
00001e30  6f 72 64 2d 3e 70 72 65  76 5f 72 65 63 6f 72 64  |ord->prev_record|
00001e40  20 3d 20 43 55 52 52 45  4e 54 5f 52 45 43 4f 52  | = CURRENT_RECOR|
00001e50  44 5f 50 4f 49 4e 54 45  52 3b 0a 09 6e 65 77 5f  |D_POINTER;..new_|
00001e60  72 65 63 6f 72 64 2d 3e  6e 65 78 74 5f 72 65 63  |record->next_rec|
00001e70  6f 72 64 20 3d 20 4e 55  4c 4c 3b 0a 09 4c 41 53  |ord = NULL;..LAS|
00001e80  54 5f 52 45 43 4f 52 44  5f 4e 55 4d 42 45 52 20  |T_RECORD_NUMBER |
00001e90  3d 20 6e 65 77 5f 72 65  63 6f 72 64 2d 3e 6a 75  |= new_record->ju|
00001ea0  6d 70 5f 6e 6f 20 3d 20  43 55 52 52 45 4e 54 5f  |mp_no = CURRENT_|
00001eb0  52 45 43 4f 52 44 5f 50  4f 49 4e 54 45 52 2d 3e  |RECORD_POINTER->|
00001ec0  6a 75 6d 70 5f 6e 6f 20  2b 20 31 3b 0a 09 43 55  |jump_no + 1;..CU|
00001ed0  52 52 45 4e 54 5f 52 45  43 4f 52 44 5f 50 4f 49  |RRENT_RECORD_POI|
00001ee0  4e 54 45 52 2d 3e 6e 65  78 74 5f 72 65 63 6f 72  |NTER->next_recor|
00001ef0  64 20 3d 20 6e 65 77 5f  72 65 63 6f 72 64 3b 0a  |d = new_record;.|
00001f00  0a 09 2f 2a 20 53 77 69  74 63 68 20 76 69 65 77  |../* Switch view|
00001f10  20 74 6f 20 74 68 65 20  6e 65 77 20 72 65 63 6f  | to the new reco|
00001f20  72 64 20 2a 2f 0a 09 43  55 52 52 45 4e 54 5f 52  |rd */..CURRENT_R|
00001f30  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 20 3d 20  |ECORD_POINTER = |
00001f40  6e 65 77 5f 72 65 63 6f  72 64 3b 0a 09 43 55 52  |new_record;..CUR|
00001f50  52 45 4e 54 5f 52 45 43  4f 52 44 5f 4e 55 4d 42  |RENT_RECORD_NUMB|
00001f60  45 52 20 3d 20 43 55 52  52 45 4e 54 5f 52 45 43  |ER = CURRENT_REC|
00001f70  4f 52 44 5f 50 4f 49 4e  54 45 52 2d 3e 6a 75 6d  |ORD_POINTER->jum|
00001f80  70 5f 6e 6f 3b 0a 0a 09  2f 2a 20 55 70 64 61 74  |p_no;.../* Updat|
00001f90  65 20 74 68 65 20 77 69  6e 64 6f 77 20 74 6f 20  |e the window to |
00001fa0  64 69 73 70 6c 61 79 20  74 68 65 20 6e 65 77 20  |display the new |
00001fb0  69 6e 66 6f 72 6d 61 74  69 6f 6e 20 2a 2f 0a 09  |information */..|
00001fc0  75 70 64 61 74 65 5f 77  69 6e 64 6f 77 5f 69 6e  |update_window_in|
00001fd0  66 6f 28 29 3b 0a 7d 0a  0a 76 6f 69 64 20 75 70  |fo();.}..void up|
00001fe0  64 61 74 65 5f 77 69 6e  64 6f 77 5f 69 6e 66 6f  |date_window_info|
00001ff0  28 76 6f 69 64 29 0a 7b  0a 09 63 68 61 72 09 74  |(void).{..char.t|
00002000  65 6d 70 5f 73 74 72 69  6e 67 5b 32 35 35 5d 3b  |emp_string[255];|
00002010  0a 0a 09 61 75 5f 6c 6f  73 65 63 61 72 65 74 28  |...au_losecaret(|
00002020  29 3b 0a 09 69 66 20 28  43 55 52 52 45 4e 54 5f  |);..if (CURRENT_|
00002030  52 45 43 4f 52 44 5f 50  4f 49 4e 54 45 52 2d 3e  |RECORD_POINTER->|
00002040  6e 65 78 74 5f 72 65 63  6f 72 64 20 3d 3d 20 4e  |next_record == N|
00002050  55 4c 4c 29 20 7b 0a 09  09 61 75 5f 69 63 6f 6e  |ULL) {...au_icon|
00002060  5f 74 65 78 74 5f 63 68  61 6e 67 65 28 22 41 64  |_text_change("Ad|
00002070  64 22 2c 20 77 69 6e 5f  64 61 74 61 5b 30 5d 2e  |d", win_data[0].|
00002080  77 69 6e 5f 68 61 6e 64  6c 65 2c 20 55 50 44 41  |win_handle, UPDA|
00002090  54 45 5f 49 43 4f 4e 29  3b 0a 09 7d 20 65 6c 73  |TE_ICON);..} els|
000020a0  65 20 7b 0a 09 09 61 75  5f 69 63 6f 6e 5f 74 65  |e {...au_icon_te|
000020b0  78 74 5f 63 68 61 6e 67  65 28 22 55 70 64 61 74  |xt_change("Updat|
000020c0  65 22 2c 20 77 69 6e 5f  64 61 74 61 5b 30 5d 2e  |e", win_data[0].|
000020d0  77 69 6e 5f 68 61 6e 64  6c 65 2c 20 55 50 44 41  |win_handle, UPDA|
000020e0  54 45 5f 49 43 4f 4e 29  3b 0a 09 7d 0a 09 73 70  |TE_ICON);..}..sp|
000020f0  72 69 6e 74 66 28 74 65  6d 70 5f 73 74 72 69 6e  |rintf(temp_strin|
00002100  67 2c 20 22 25 64 22 2c  20 43 55 52 52 45 4e 54  |g, "%d", CURRENT|
00002110  5f 52 45 43 4f 52 44 5f  50 4f 49 4e 54 45 52 2d  |_RECORD_POINTER-|
00002120  3e 6a 75 6d 70 5f 6e 6f  29 3b 0a 09 61 75 5f 69  |>jump_no);..au_i|
00002130  63 6f 6e 5f 74 65 78 74  5f 63 68 61 6e 67 65 28  |con_text_change(|
00002140  74 65 6d 70 5f 73 74 72  69 6e 67 2c 20 77 69 6e  |temp_string, win|
00002150  5f 64 61 74 61 5b 30 5d  2e 77 69 6e 5f 68 61 6e  |_data[0].win_han|
00002160  64 6c 65 2c 20 43 55 52  52 45 4e 54 5f 52 45 43  |dle, CURRENT_REC|
00002170  4f 52 44 5f 49 43 4f 4e  29 3b 0a 09 73 70 72 69  |ORD_ICON);..spri|
00002180  6e 74 66 28 74 65 6d 70  5f 73 74 72 69 6e 67 2c  |ntf(temp_string,|
00002190  20 22 25 64 22 2c 20 4c  41 53 54 5f 52 45 43 4f  | "%d", LAST_RECO|
000021a0  52 44 5f 4e 55 4d 42 45  52 29 3b 0a 09 61 75 5f  |RD_NUMBER);..au_|
000021b0  69 63 6f 6e 5f 74 65 78  74 5f 63 68 61 6e 67 65  |icon_text_change|
000021c0  28 74 65 6d 70 5f 73 74  72 69 6e 67 2c 20 77 69  |(temp_string, wi|
000021d0  6e 5f 64 61 74 61 5b 30  5d 2e 77 69 6e 5f 68 61  |n_data[0].win_ha|
000021e0  6e 64 6c 65 2c 20 4c 41  53 54 5f 52 45 43 4f 52  |ndle, LAST_RECOR|
000021f0  44 5f 49 43 4f 4e 29 3b  0a 0a 09 61 75 5f 69 63  |D_ICON);...au_ic|
00002200  6f 6e 5f 74 65 78 74 5f  63 68 61 6e 67 65 28 43  |on_text_change(C|
00002210  55 52 52 45 4e 54 5f 52  45 43 4f 52 44 5f 50 4f  |URRENT_RECORD_PO|
00002220  49 4e 54 45 52 2d 3e 64  61 74 65 20 2c 20 77 69  |INTER->date , wi|
00002230  6e 5f 64 61 74 61 5b 30  5d 2e 77 69 6e 5f 68 61  |n_data[0].win_ha|
00002240  6e 64 6c 65 2c 20 44 41  54 45 5f 49 43 4f 4e 29  |ndle, DATE_ICON)|
00002250  3b 0a 09 61 75 5f 69 63  6f 6e 5f 74 65 78 74 5f  |;..au_icon_text_|
00002260  63 68 61 6e 67 65 28 43  55 52 52 45 4e 54 5f 52  |change(CURRENT_R|
00002270  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 2d 3e 61  |ECORD_POINTER->a|
00002280  69 72 63 72 61 66 74 20  2c 20 77 69 6e 5f 64 61  |ircraft , win_da|
00002290  74 61 5b 30 5d 2e 77 69  6e 5f 68 61 6e 64 6c 65  |ta[0].win_handle|
000022a0  2c 20 41 49 52 43 52 41  46 54 5f 49 43 4f 4e 29  |, AIRCRAFT_ICON)|
000022b0  3b 0a 09 61 75 5f 69 63  6f 6e 5f 74 65 78 74 5f  |;..au_icon_text_|
000022c0  63 68 61 6e 67 65 28 43  55 52 52 45 4e 54 5f 52  |change(CURRENT_R|
000022d0  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 2d 3e 64  |ECORD_POINTER->d|
000022e0  72 6f 70 7a 6f 6e 65 20  2c 20 77 69 6e 5f 64 61  |ropzone , win_da|
000022f0  74 61 5b 30 5d 2e 77 69  6e 5f 68 61 6e 64 6c 65  |ta[0].win_handle|
00002300  2c 20 44 52 4f 50 5a 4f  4e 45 5f 49 43 4f 4e 29  |, DROPZONE_ICON)|
00002310  3b 0a 09 61 75 5f 69 63  6f 6e 5f 74 65 78 74 5f  |;..au_icon_text_|
00002320  63 68 61 6e 67 65 28 43  55 52 52 45 4e 54 5f 52  |change(CURRENT_R|
00002330  45 43 4f 52 44 5f 50 4f  49 4e 54 45 52 2d 3e 61  |ECORD_POINTER->a|
00002340  69 72 77 6f 72 6b 20 2c  20 77 69 6e 5f 64 61 74  |irwork , win_dat|
00002350  61 5b 30 5d 2e 77 69 6e  5f 68 61 6e 64 6c 65 2c  |a[0].win_handle,|
00002360  20 41 49 52 57 4f 52 4b  5f 49 43 4f 4e 29 3b 0a  | AIRWORK_ICON);.|
00002370  09 61 75 5f 69 63 6f 6e  5f 74 65 78 74 5f 63 68  |.au_icon_text_ch|
00002380  61 6e 67 65 28 43 55 52  52 45 4e 54 5f 52 45 43  |ange(CURRENT_REC|
00002390  4f 52 44 5f 50 4f 49 4e  54 45 52 2d 3e 72 65 6d  |ORD_POINTER->rem|
000023a0  61 72 6b 73 31 20 2c 20  77 69 6e 5f 64 61 74 61  |arks1 , win_data|
000023b0  5b 30 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 2c 20  |[0].win_handle, |
000023c0  52 45 4d 41 52 4b 53 31  5f 49 43 4f 4e 29 3b 0a  |REMARKS1_ICON);.|
000023d0  09 61 75 5f 69 63 6f 6e  5f 74 65 78 74 5f 63 68  |.au_icon_text_ch|
000023e0  61 6e 67 65 28 43 55 52  52 45 4e 54 5f 52 45 43  |ange(CURRENT_REC|
000023f0  4f 52 44 5f 50 4f 49 4e  54 45 52 2d 3e 72 65 6d  |ORD_POINTER->rem|
00002400  61 72 6b 73 32 20 2c 20  77 69 6e 5f 64 61 74 61  |arks2 , win_data|
00002410  5b 30 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 2c 20  |[0].win_handle, |
00002420  52 45 4d 41 52 4b 53 32  5f 49 43 4f 4e 29 3b 0a  |REMARKS2_ICON);.|
00002430  0a 09 73 70 72 69 6e 74  66 28 74 65 6d 70 5f 73  |..sprintf(temp_s|
00002440  74 72 69 6e 67 2c 20 22  25 64 22 2c 20 43 55 52  |tring, "%d", CUR|
00002450  52 45 4e 54 5f 52 45 43  4f 52 44 5f 50 4f 49 4e  |RENT_RECORD_POIN|
00002460  54 45 52 2d 3e 61 6c 74  69 74 75 64 65 29 3b 0a  |TER->altitude);.|
00002470  09 61 75 5f 69 63 6f 6e  5f 74 65 78 74 5f 63 68  |.au_icon_text_ch|
00002480  61 6e 67 65 28 74 65 6d  70 5f 73 74 72 69 6e 67  |ange(temp_string|
00002490  2c 20 77 69 6e 5f 64 61  74 61 5b 30 5d 2e 77 69  |, win_data[0].wi|
000024a0  6e 5f 68 61 6e 64 6c 65  2c 20 41 4c 54 49 54 55  |n_handle, ALTITU|
000024b0  44 45 5f 49 43 4f 4e 29  3b 0a 09 73 70 72 69 6e  |DE_ICON);..sprin|
000024c0  74 66 28 74 65 6d 70 5f  73 74 72 69 6e 67 2c 20  |tf(temp_string, |
000024d0  22 25 64 22 2c 20 43 55  52 52 45 4e 54 5f 52 45  |"%d", CURRENT_RE|
000024e0  43 4f 52 44 5f 50 4f 49  4e 54 45 52 2d 3e 64 65  |CORD_POINTER->de|
000024f0  6c 61 79 29 3b 0a 09 61  75 5f 69 63 6f 6e 5f 74  |lay);..au_icon_t|
00002500  65 78 74 5f 63 68 61 6e  67 65 28 74 65 6d 70 5f  |ext_change(temp_|
00002510  73 74 72 69 6e 67 2c 20  77 69 6e 5f 64 61 74 61  |string, win_data|
00002520  5b 30 5d 2e 77 69 6e 5f  68 61 6e 64 6c 65 2c 20  |[0].win_handle, |
00002530  44 45 4c 41 59 5f 49 43  4f 4e 29 3b 0a 09 72 65  |DELAY_ICON);..re|
00002540  74 75 72 6e 3b 0a 7d 0a  0a 76 6f 69 64 20 6f 70  |turn;.}..void op|
00002550  65 6e 5f 6d 61 69 6e 5f  77 69 6e 64 6f 77 28 76  |en_main_window(v|
00002560  6f 69 64 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |oid).{.._kernel_|
00002570  73 77 69 5f 72 65 67 73  09 69 6e 2c 20 6f 75 74  |swi_regs.in, out|
00002580  3b 0a 09 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |;..unsigned char|
00002590  09 74 65 6d 70 5f 62 75  66 66 65 72 5b 31 30 32  |.temp_buffer[102|
000025a0  34 5d 3b 0a 0a 2f 2a 20  57 65 20 6e 65 65 64 20  |4];../* We need |
000025b0  74 6f 20 75 70 64 61 74  65 20 74 68 65 20 63 75  |to update the cu|
000025c0  72 72 65 6e 74 20 61 6e  64 20 6c 61 73 74 20 72  |rrent and last r|
000025d0  65 63 6f 72 64 20 6e 75  6d 62 65 72 73 20 69 6e  |ecord numbers in|
000025e0  20 74 68 65 20 77 69 6e  64 6f 77 0a 20 2a 20 62  | the window. * b|
000025f0  65 66 6f 72 65 20 6f 70  65 6e 69 6e 67 20 2a 2f  |efore opening */|
00002600  0a 0a 09 75 70 64 61 74  65 5f 77 69 6e 64 6f 77  |...update_window|
00002610  5f 69 6e 66 6f 28 29 3b  0a 0a 2f 2a 20 4e 6f 77  |_info();../* Now|
00002620  20 6f 70 65 6e 20 74 68  65 20 77 69 6e 64 6f 77  | open the window|
00002630  20 2a 2f 0a 0a 09 61 75  5f 77 6f 72 64 74 6f 62  | */...au_wordtob|
00002640  79 74 65 28 77 69 6e 5f  64 61 74 61 5b 30 5d 2e  |yte(win_data[0].|
00002650  77 69 6e 5f 68 61 6e 64  6c 65 2c 20 74 65 6d 70  |win_handle, temp|
00002660  5f 62 75 66 66 65 72 2c  20 30 29 3b 0a 09 69 6e  |_buffer, 0);..in|
00002670  2e 72 5b 31 5d 20 3d 20  28 69 6e 74 29 20 74 65  |.r[1] = (int) te|
00002680  6d 70 5f 62 75 66 66 65  72 3b 0a 09 5f 6b 65 72  |mp_buffer;.._ker|
00002690  6e 65 6c 5f 73 77 69 28  57 69 6d 70 5f 47 65 74  |nel_swi(Wimp_Get|
000026a0  57 69 6e 64 6f 77 49 6e  66 6f 2c 20 26 69 6e 2c  |WindowInfo, &in,|
000026b0  20 26 6f 75 74 29 3b 0a  09 5f 6b 65 72 6e 65 6c  | &out);.._kernel|
000026c0  5f 73 77 69 28 57 69 6d  70 5f 4f 70 65 6e 57 69  |_swi(Wimp_OpenWi|
000026d0  6e 64 6f 77 2c 20 26 69  6e 2c 20 26 6f 75 74 29  |ndow, &in, &out)|
000026e0  3b 0a 09 72 65 74 75 72  6e 3b 0a 7d 0a 0a 76 6f  |;..return;.}..vo|
000026f0  69 64 20 77 69 6d 70 5f  6d 73 67 28 69 6e 74 20  |id wimp_msg(int |
00002700  72 65 73 75 6c 74 2c 20  75 6e 73 69 67 6e 65 64  |result, unsigned|
00002710  20 63 68 61 72 20 70 6f  6c 6c 62 6c 6f 63 6b 5b  | char pollblock[|
00002720  5d 29 0a 7b 0a 09 75 6e  73 69 67 6e 65 64 20 6c  |]).{..unsigned l|
00002730  6f 6e 67 20 69 6e 74 20  20 20 6d 65 73 73 61 67  |ong int   messag|
00002740  65 5f 61 63 74 69 6f 6e  3b 0a 09 0a 09 2f 2a 20  |e_action;..../* |
00002750  54 68 65 20 6e 65 78 74  20 6c 69 6e 65 20 74 61  |The next line ta|
00002760  6b 65 73 20 62 79 74 65  73 20 31 36 20 74 6f 20  |kes bytes 16 to |
00002770  31 39 20 6f 66 20 74 68  65 20 70 6f 6c 6c 69 6e  |19 of the pollin|
00002780  67 20 62 6c 6f 63 6b 20  61 6e 64 20 66 6f 72 6d  |g block and form|
00002790  73 20 74 68 65 6d 0a 09  20 20 20 69 6e 74 6f 20  |s them..   into |
000027a0  61 20 77 6f 72 64 20 68  6f 6c 64 69 6e 67 20 74  |a word holding t|
000027b0  68 65 20 6d 65 73 73 61  67 65 20 61 63 74 69 6f  |he message actio|
000027c0  6e 20 6e 75 6d 62 65 72  20 2a 2f 0a 09 6d 65 73  |n number */..mes|
000027d0  73 61 67 65 5f 61 63 74  69 6f 6e 20 3d 20 61 75  |sage_action = au|
000027e0  5f 62 79 74 65 74 6f 77  6f 72 64 28 70 6f 6c 6c  |_bytetoword(poll|
000027f0  62 6c 6f 63 6b 2c 20 31  36 29 3b 0a 0a 09 73 77  |block, 16);...sw|
00002800  69 74 63 68 20 28 6d 65  73 73 61 67 65 5f 61 63  |itch (message_ac|
00002810  74 69 6f 6e 29 20 7b 0a  09 09 63 61 73 65 20 4d  |tion) {...case M|
00002820  45 53 53 41 47 45 5f 51  55 49 54 20 3a 20 51 55  |ESSAGE_QUIT : QU|
00002830  49 54 5f 46 4c 41 47 20  3d 20 31 3b 20 2f 2a 20  |IT_FLAG = 1; /* |
00002840  4d 65 73 73 61 67 65 5f  51 75 69 74 20 2d 20 74  |Message_Quit - t|
00002850  69 6d 65 20 74 6f 20 67  6f 20 2a 2f 0a 09 09 09  |ime to go */....|
00002860  09 62 72 65 61 6b 3b 0a  09 09 63 61 73 65 20 4d  |.break;...case M|
00002870  45 53 53 41 47 45 5f 44  41 54 41 53 41 56 45 41  |ESSAGE_DATASAVEA|
00002880  43 4b 20 3a 20 64 61 74  61 5f 73 61 76 65 28 70  |CK : data_save(p|
00002890  6f 6c 6c 62 6c 6f 63 6b  29 3b 0a 09 09 09 09 62  |ollblock);.....b|
000028a0  72 65 61 6b 3b 0a 09 7d  0a 09 72 65 74 75 72 6e  |reak;..}..return|
000028b0  3b 0a 7d 0a 0a 76 6f 69  64 20 64 61 74 61 5f 73  |;.}..void data_s|
000028c0  61 76 65 28 75 6e 73 69  67 6e 65 64 20 63 68 61  |ave(unsigned cha|
000028d0  72 20 70 6f 6c 6c 62 6c  6f 63 6b 5b 5d 29 0a 7b  |r pollblock[]).{|
000028e0  0a 09 63 68 61 72 09 2a  66 69 6c 65 6e 61 6d 65  |..char.*filename|
000028f0  3b 0a 09 69 6e 74 09 6e  61 6d 65 5f 6c 65 6e 67  |;..int.name_leng|
00002900  74 68 3b 0a 09 2f 2a 20  52 65 61 64 20 74 68 65  |th;../* Read the|
00002910  20 66 69 6c 65 6e 61 6d  65 20 66 72 6f 6d 20 74  | filename from t|
00002920  68 65 20 70 6f 6c 6c 62  6c 6f 63 6b 20 2a 2f 0a  |he pollblock */.|
00002930  09 6e 61 6d 65 5f 6c 65  6e 67 74 68 20 3d 20 73  |.name_length = s|
00002940  74 72 6c 65 6e 28 28 63  68 61 72 20 2a 29 20 26  |trlen((char *) &|
00002950  70 6f 6c 6c 62 6c 6f 63  6b 5b 34 34 5d 29 3b 0a  |pollblock[44]);.|
00002960  09 66 69 6c 65 6e 61 6d  65 20 3d 20 63 61 6c 6c  |.filename = call|
00002970  6f 63 28 6e 61 6d 65 5f  6c 65 6e 67 74 68 2c 20  |oc(name_length, |
00002980  73 69 7a 65 6f 66 28 63  68 61 72 29 29 3b 0a 09  |sizeof(char));..|
00002990  73 74 72 63 70 79 28 66  69 6c 65 6e 61 6d 65 2c  |strcpy(filename,|
000029a0  20 28 63 68 61 72 20 2a  29 20 26 70 6f 6c 6c 62  | (char *) &pollb|
000029b0  6c 6f 63 6b 5b 34 34 5d  29 3b 0a 09 2f 2a 20 4a  |lock[44]);../* J|
000029c0  75 73 74 20 64 69 73 70  6c 61 79 20 74 68 65 20  |ust display the |
000029d0  66 69 6c 65 6e 61 6d 65  20 66 6f 72 20 6e 6f 77  |filename for now|
000029e0  20 2a 2f 0a 09 61 75 5f  72 65 70 6f 72 74 5f 65  | */..au_report_e|
000029f0  72 72 6f 72 28 31 2c 20  66 69 6c 65 6e 61 6d 65  |rror(1, filename|
00002a00  2c 20 31 2c 20 61 70 70  6e 61 6d 65 29 3b 0a 7d  |, 1, appname);.}|
00002a10  0a 0a 76 6f 69 64 20 6f  70 65 6e 77 69 6e 64 6f  |..void openwindo|
00002a20  77 28 75 6e 73 69 67 6e  65 64 20 63 68 61 72 20  |w(unsigned char |
00002a30  70 6f 6c 6c 62 6c 6f 63  6b 5b 5d 29 0a 7b 0a 20  |pollblock[]).{. |
00002a40  20 20 5f 6b 65 72 6e 65  6c 5f 73 77 69 5f 72 65  |  _kernel_swi_re|
00002a50  67 73 20 69 6e 2c 20 6f  75 74 3b 0a 0a 20 20 20  |gs in, out;..   |
00002a60  69 6e 2e 72 5b 31 5d 20  3d 20 28 69 6e 74 29 20  |in.r[1] = (int) |
00002a70  70 6f 6c 6c 62 6c 6f 63  6b 3b 0a 20 20 20 5f 6b  |pollblock;.   _k|
00002a80  65 72 6e 65 6c 5f 73 77  69 28 57 69 6d 70 5f 4f  |ernel_swi(Wimp_O|
00002a90  70 65 6e 57 69 6e 64 6f  77 2c 20 26 69 6e 2c 20  |penWindow, &in, |
00002aa0  26 6f 75 74 29 3b 0a 20  20 20 72 65 74 75 72 6e  |&out);.   return|
00002ab0  3b 0a 7d 0a 0a 76 6f 69  64 20 63 6c 6f 73 65 77  |;.}..void closew|
00002ac0  69 6e 64 6f 77 28 75 6e  73 69 67 6e 65 64 20 63  |indow(unsigned c|
00002ad0  68 61 72 20 70 6f 6c 6c  62 6c 6f 63 6b 5b 5d 29  |har pollblock[])|
00002ae0  0a 7b 0a 20 20 20 5f 6b  65 72 6e 65 6c 5f 73 77  |.{.   _kernel_sw|
00002af0  69 5f 72 65 67 73 20 69  6e 2c 20 6f 75 74 3b 0a  |i_regs in, out;.|
00002b00  0a 20 20 20 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |.   in.r[1] = (i|
00002b10  6e 74 29 20 70 6f 6c 6c  62 6c 6f 63 6b 3b 0a 20  |nt) pollblock;. |
00002b20  20 20 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |  _kernel_swi(Wi|
00002b30  6d 70 5f 43 6c 6f 73 65  57 69 6e 64 6f 77 2c 20  |mp_CloseWindow, |
00002b40  26 69 6e 2c 20 26 6f 75  74 29 3b 0a 20 20 20 72  |&in, &out);.   r|
00002b50  65 74 75 72 6e 3b 0a 7d  0a 0a 76 6f 69 64 20 6c  |eturn;.}..void l|
00002b60  6f 61 64 74 65 6d 70 6c  61 74 65 73 28 76 6f 69  |oadtemplates(voi|
00002b70  64 29 0a 7b 0a 09 61 75  5f 6f 70 65 6e 74 65 6d  |d).{..au_opentem|
00002b80  70 6c 61 74 65 28 22 3c  52 41 50 53 24 44 69 72  |plate("<RAPS$Dir|
00002b90  3e 2e 54 65 6d 70 6c 61  74 65 73 22 29 3b 0a 09  |>.Templates");..|
00002ba0  69 66 28 61 75 5f 6c 6f  61 64 74 65 6d 70 6c 61  |if(au_loadtempla|
00002bb0  74 65 28 22 4d 61 69 6e  57 69 6e 64 6f 77 22 2c  |te("MainWindow",|
00002bc0  20 26 77 69 6e 5f 64 61  74 61 5b 30 5d 2c 20 30  | &win_data[0], 0|
00002bd0  29 20 3d 3d 20 30 29 20  7b 0a 09 09 61 75 5f 72  |) == 0) {...au_r|
00002be0  65 70 6f 72 74 5f 65 72  72 6f 72 28 31 2c 20 22  |eport_error(1, "|
00002bf0  54 65 6d 70 6c 61 74 65  20 6e 6f 74 20 66 6f 75  |Template not fou|
00002c00  6e 64 21 22 2c 20 31 2c  20 61 70 70 6e 61 6d 65  |nd!", 1, appname|
00002c10  29 3b 0a 09 09 51 55 49  54 5f 46 4c 41 47 20 3d  |);...QUIT_FLAG =|
00002c20  20 31 3b 0a 09 7d 0a 09  69 66 28 61 75 5f 6c 6f  | 1;..}..if(au_lo|
00002c30  61 64 74 65 6d 70 6c 61  74 65 28 22 50 72 6f 67  |adtemplate("Prog|
00002c40  49 6e 66 6f 22 2c 20 26  77 69 6e 5f 64 61 74 61  |Info", &win_data|
00002c50  5b 31 5d 2c 20 30 29 20  3d 3d 20 30 29 20 7b 0a  |[1], 0) == 0) {.|
00002c60  09 09 61 75 5f 72 65 70  6f 72 74 5f 65 72 72 6f  |..au_report_erro|
00002c70  72 28 31 2c 20 22 54 65  6d 70 6c 61 74 65 20 6e  |r(1, "Template n|
00002c80  6f 74 20 66 6f 75 6e 64  21 22 2c 20 31 2c 20 61  |ot found!", 1, a|
00002c90  70 70 6e 61 6d 65 29 3b  0a 09 09 51 55 49 54 5f  |ppname);...QUIT_|
00002ca0  46 4c 41 47 20 3d 20 31  3b 0a 09 7d 0a 09 69 66  |FLAG = 1;..}..if|
00002cb0  28 61 75 5f 6c 6f 61 64  74 65 6d 70 6c 61 74 65  |(au_loadtemplate|
00002cc0  28 22 78 66 65 72 5f 73  65 6e 64 22 2c 20 26 77  |("xfer_send", &w|
00002cd0  69 6e 5f 64 61 74 61 5b  32 5d 2c 20 30 29 20 3d  |in_data[2], 0) =|
00002ce0  3d 20 30 29 20 7b 0a 09  09 61 75 5f 72 65 70 6f  |= 0) {...au_repo|
00002cf0  72 74 5f 65 72 72 6f 72  28 31 2c 20 22 54 65 6d  |rt_error(1, "Tem|
00002d00  70 6c 61 74 65 20 6e 6f  74 20 66 6f 75 6e 64 21  |plate not found!|
00002d10  22 2c 20 31 2c 20 61 70  70 6e 61 6d 65 29 3b 0a  |", 1, appname);.|
00002d20  09 09 51 55 49 54 5f 46  4c 41 47 20 3d 20 31 3b  |..QUIT_FLAG = 1;|
00002d30  0a 09 7d 0a 0a 09 61 75  5f 63 6c 6f 73 65 74 65  |..}...au_closete|
00002d40  6d 70 6c 61 74 65 28 29  3b 0a 7d 0a 0a 76 6f 69  |mplate();.}..voi|
00002d50  64 20 73 65 74 75 70 5f  64 61 74 61 62 61 73 65  |d setup_database|
00002d60  28 76 6f 69 64 29 0a 7b  0a 0a 09 2f 2a 20 49 6e  |(void).{.../* In|
00002d70  69 74 69 61 6c 6c 79 2c  20 77 65 20 6e 65 65 64  |itially, we need|
00002d80  20 74 6f 20 73 65 74 20  61 73 69 64 65 20 6d 65  | to set aside me|
00002d90  6d 6f 72 79 20 66 6f 72  20 74 68 65 20 27 72 6f  |mory for the 'ro|
00002da0  6f 74 27 20 73 74 72 75  63 74 75 72 65 20 2a 2f  |ot' structure */|
00002db0  0a 0a 09 6a 6d 70 5f 64  61 74 61 5f 72 6f 6f 74  |...jmp_data_root|
00002dc0  20 3d 20 63 61 6c 6c 6f  63 28 31 2c 20 73 69 7a  | = calloc(1, siz|
00002dd0  65 6f 66 28 6a 75 6d 70  5f 64 61 74 61 29 29 3b  |eof(jump_data));|
00002de0  0a 09 2f 2a 20 49 6e 69  74 69 61 6c 69 73 65 20  |../* Initialise |
00002df0  70 6f 69 6e 74 65 72 73  20 2a 2f 0a 09 6a 6d 70  |pointers */..jmp|
00002e00  5f 64 61 74 61 5f 72 6f  6f 74 2d 3e 70 72 65 76  |_data_root->prev|
00002e10  5f 72 65 63 6f 72 64 20  3d 20 6a 6d 70 5f 64 61  |_record = jmp_da|
00002e20  74 61 5f 72 6f 6f 74 2d  3e 6e 65 78 74 5f 72 65  |ta_root->next_re|
00002e30  63 6f 72 64 20 3d 20 4e  55 4c 4c 3b 0a 09 6a 6d  |cord = NULL;..jm|
00002e40  70 5f 64 61 74 61 5f 72  6f 6f 74 2d 3e 6a 75 6d  |p_data_root->jum|
00002e50  70 5f 6e 6f 20 3d 20 31  3b 0a 09 43 55 52 52 45  |p_no = 1;..CURRE|
00002e60  4e 54 5f 52 45 43 4f 52  44 5f 50 4f 49 4e 54 45  |NT_RECORD_POINTE|
00002e70  52 20 3d 20 6a 6d 70 5f  64 61 74 61 5f 72 6f 6f  |R = jmp_data_roo|
00002e80  74 3b 0a 7d 0a                                    |t;.}.|
00002e85