Home » Archimedes archive » Acorn User » AU 1997-12.adf » Regulars » C/!Skeleton/c/AULib

C/!Skeleton/c/AULib

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 1997-12.adf » Regulars
Filename: C/!Skeleton/c/AULib
Read OK:
File size: 3C91 bytes
Load address: 0000
Exec address: 0000
File contents
/* Acorn User library for WIMP programming in C */
/* By Steve Mumford, 8th September 1996 */
/* Last modified 6/10/97 */

/* #Include the appropriate files - AULib.h contains everything we need */

#include "AUlib.h"

int
au_initialise(int v_number, char *appname, long int msglist[])
{
	_kernel_swi_regs	regs_in, regs_out;

	regs_in.r[0] = v_number;
	regs_in.r[1] = *(int *)"TASK";
	regs_in.r[2] = (int) appname;
	regs_in.r[3] = (int) msglist;

	_kernel_swi(Wimp_Initialise, &regs_in, &regs_out);
	return regs_out.r[1]; /* this is the task handle, returned for later use */
}

void
au_closedown(int taskhandle)
{
	_kernel_swi_regs	regs_in, regs_out;

	regs_in.r[0] = taskhandle;
	regs_in.r[1] = *(int *)"TASK";
	_kernel_swi(Wimp_CloseDown, &regs_in, &regs_out);
}

int
au_create_iconbar_icon(int priority, unsigned long int whichside, unsigned long int iconflags, char *sprname)
{
	_kernel_swi_regs	regs_in, regs_out;
	unsigned char icon_block[ICON_BLOCK_SIZE];
	/* We need to build up an icon information datablock */
	au_wordtobyte(whichside, icon_block, 0);
	au_wordtobyte(IBAR_BBOX_MINX, icon_block, 4);
	au_wordtobyte(IBAR_BBOX_MINY, icon_block, 8);
	au_wordtobyte(IBAR_BBOX_MAXX, icon_block, 12);
	au_wordtobyte(IBAR_BBOX_MAXY, icon_block, 16);
	au_wordtobyte(iconflags, icon_block, 20);

	/* Copy the icon name into the appropriate place */
	strcpy( (char *) &icon_block[24], sprname);
	regs_in.r[0] = priority;
	regs_in.r[1] = (int) icon_block;
	_kernel_swi(Wimp_CreateIcon, &regs_in, &regs_out);
	return regs_out.r[0]; /* Return the icon handle */
}

void
au_wordtobyte(unsigned long int input, unsigned char block[], int index)
{
	unsigned long int mask = 255;

	/* The opposite of btow() - this function takes a 32-bit integer, splits
	 * it up into 4 bytes, and stores those in 4 consecutive cells of a
	 * character array indexed by index. This is done by using a mask to
	 * extract the data in sequence, with the & bitwise-and operator */

	block[index++] = (char) (input & mask);
	/* shift mask to get second byte, and supply result as byte size */
	mask <<= 8;
	block[index++] = (char) ((input & mask) >> 8);
	mask <<= 8;
	block[index++] = (char) ((input & mask) >> 16);
	mask <<= 8;
	block[index++] = (char) ((input & mask) >> 24);

	return;
}

unsigned long int
au_bytetoword(unsigned char block[], int index)
{
	unsigned long int result = 0;
	int loop;

	/* This routine takes a data block and a starting byte, and converts the
	 * next four bytes into a word - we have to start at the most significant
	 * byte and work backwards */

	index += 3;
	result = block[index--];
	for(loop = 0; loop < 3; loop++) {
		result = result << 8; /* this shifts bits in result left by 8 spaces */
		result += block[index--];
	}

	return result;
}

void
au_opentemplate(char *filename)
{
	_kernel_swi_regs	regs_in, regs_out;
	regs_in.r[1] = (int) filename;
	_kernel_swi(Wimp_OpenTemplate, &regs_in, &regs_out);
}

void
au_closetemplate(void)
{
	_kernel_swi_regs	regs_in, regs_out;
	/* No data needed for CloseTemplate */
	_kernel_swi(Wimp_CloseTemplate, &regs_in, &regs_out);
}

int
au_loadtemplate(char *template_name, window_data *win_data, int call)
{
	_kernel_swi_regs	regs_in, regs_out;
	int	workspace_length = 0;
	int	next_entry;

	/* interrogate file to find out how much space we need */
	regs_in.r[1] = 0; /* tell SWI to find sizes */
	regs_in.r[5] = (int) template_name; /* pass name to SWI */
	regs_in.r[6] = call; /* 0 for first call */

	_kernel_swi(Wimp_LoadTemplate, &regs_in, &regs_out);
	win_data->buffer = calloc(regs_out.r[1], sizeof(unsigned char));
	workspace_length = regs_out.r[2]; /* err on side of caution */
	win_data->workspace = calloc(workspace_length, sizeof(unsigned char));
	win_data->win_name = calloc(strlen( (char *) regs_out.r[5]) + 1, sizeof(char));
	strcpy(win_data->win_name, (char *) regs_out.r[5]);

	/* Now reload template from file into memory */
	regs_in.r[1] = (int) win_data->buffer;
	regs_in.r[2] = (int) win_data->workspace;
	regs_in.r[3] = (int) win_data->workspace + workspace_length;
	regs_in.r[4] = -1; /* NO FONTS CATERED FOR IN TEMPLATES YET */
	regs_in.r[5] = (int) win_data->win_name;
	regs_in.r[6] = call;

	_kernel_swi(Wimp_LoadTemplate, &regs_in, &regs_out);
	next_entry = regs_out.r[6];

	/* Create the window, store window handle */
	regs_in.r[1] = (int) win_data->buffer;
	_kernel_swi(Wimp_CreateWindow, &regs_in, &regs_out);
	win_data->win_handle = regs_out.r[0];
	return next_entry; /* in case of wildcarded searches */
}

int
au_report_error(int errno, char *errmess, int flags, char *app_name)
{
   unsigned char errorblock[260];
   _kernel_swi_regs in, out;

   /* Set up the standard error block with the error number and message
      (zero terminated) */
   au_wordtobyte(errno, errorblock, 0);
   strcpy( (char *) &errorblock[4], errmess);

   /* R0 - pointer to standard error block
      R1 - error window flags
      R2 - pointer to application name for error box title */

   in.r[0] = (int) errorblock;
   in.r[1] = flags;
   in.r[2] = (int) app_name;

   _kernel_swi(Wimp_ReportError, &in, &out);

   /* Returns 1 if OK selected, 2 if Cancel selected */
   return out.r[1];
}

void
au_openwin_from_templatedata(window_data *win_data, long int position)
{
	_kernel_swi_regs	regs_in, regs_out;
	unsigned char	openwindow_buffer[36];
	int	i;

	au_wordtobyte( (unsigned long int) win_data->win_handle, openwindow_buffer, 0);
	for(i = 0; i < 6; i++) {
		au_wordtobyte(au_bytetoword(win_data->buffer, i*4), openwindow_buffer, (i+1) * 4);
	}
	au_wordtobyte(position, openwindow_buffer, 28);
	regs_in.r[1] = (int) openwindow_buffer;
	_kernel_swi(Wimp_OpenWindow, &regs_in, &regs_out);
	return;
}

int
au_wimp_poll(int pollmask, unsigned char *pollblock)
{
	_kernel_swi_regs	regs_in, regs_out;

	regs_in.r[0] = pollmask;
	regs_in.r[1] = (int) pollblock;

	_kernel_swi(Wimp_Poll, &regs_in, &regs_out);
	return regs_out.r[0]; /* Return the event code */
}

void
au_icon_text_change(char *text, unsigned long int win_h, unsigned long int icon_h)
{
   _kernel_swi_regs regs_in, regs_out;
   char *text_pointer;
   unsigned char temp_buffer[255];

   /* Find out where the icon's indirected text is stored in memory and copy
      a new string to it */
   text_pointer = au_get_ptr_to_icontext(win_h, icon_h);
   strcpy(text_pointer, text);

   /* Now we need to inform the WIMP that the icon needs redrawing by setting
      the icon flags - we don't actually change them with this call, but this
      spurs the WIMP into action */

   au_wordtobyte(win_h, temp_buffer, 0);
   au_wordtobyte(icon_h, temp_buffer, 4);
   au_wordtobyte(0, temp_buffer, 8);
   au_wordtobyte(0, temp_buffer, 12);

   regs_in.r[1] = (int) temp_buffer;

   _kernel_swi(Wimp_SetIconState, &regs_in, &regs_out);
   return;
}

void
au_icon_get_text(char *dest_string, unsigned long int win_hdl, unsigned long int icon_hdl)
{
	char	*text_pointer;

	/* Assumes dest_string has enough space */
	text_pointer = au_get_ptr_to_icontext(win_hdl, icon_hdl);
	strcpy(dest_string, text_pointer);
	return;
}

char *
au_get_ptr_to_icontext(unsigned long int winhdl, unsigned long int iconhdl)
{
   /* This procedure interrogates an icon to determine the address where its
      indirected text data is stored in memory, and returns it */

   unsigned char temp_buffer[255];
   _kernel_swi_regs regs_in, regs_out;
   char *result;

   au_wordtobyte(winhdl, temp_buffer, 0);
   au_wordtobyte(iconhdl, temp_buffer, 4);

   regs_in.r[1] = (int) temp_buffer;
   _kernel_swi(Wimp_GetIconState, &regs_in, &regs_out);

   result = (char *) au_bytetoword(temp_buffer, 28);
   return result;
}

void
au_buildmenu(char *title, menu_data *menu_dat)
{
	if(strlen(title) > 11) return; /* Do this more neatly! */
	/* Fill in the menu header with standard information */
	strcpy(menu_dat->title, title);
	menu_dat->colours = MENU_TITLEFORE | MENU_TITLEBACK | MENU_WORKFORE | MENU_WORKBACK;
	menu_dat->width = MENU_WIDTH;
	menu_dat->height = MENU_HEIGHT;
	menu_dat->vert_gap = MENU_VERTGAP;
	menu_dat->next_menuelem = NULL;
	menu_dat->size = sizeof(menu_data);
	return;
}

void
au_addtomenu(char *text, long int menu_flags, long int submenu, long int icon_flags, menu_data *
menu_dat)
{
	menu_element *pointer;

	if(strlen(text) > 11) return;
	/* Work our way to end of menu list */
	if(menu_dat->next_menuelem == NULL) {
		menu_dat->next_menuelem = calloc(1, sizeof(menu_element));
		menu_dat->size += sizeof(menu_element);
		pointer = menu_dat->next_menuelem;
	} else {
		pointer = menu_dat->next_menuelem;
		while (pointer->next_menuelem != 0) {
			pointer = pointer->next_menuelem;
		}
		pointer->next_menuelem = calloc(1, sizeof(menu_element));
		menu_dat->size += sizeof(menu_element);
		pointer = pointer->next_menuelem;
	}
	/* set up data */
	strcpy(pointer->menu_text, text);
	pointer->flags = menu_flags;
	pointer->submenu = submenu;

	/* Apply standard icon flags */
	icon_flags = icon_flags | MENUITEM_FORE | MENUITEM_BACK | ICON_ISTEXT | ICON_ISFILLED;
	pointer->menu_iconflags = icon_flags;
	return;
}

void
au_createmenu(menu_data *menu_dat)
{
	menu_element	*pointer;
	int	i;

	/* Assign memory */
	menu_dat->datablock = calloc(1, menu_dat->size);
	/* Begin copying data */
	strcpy((char *)menu_dat->datablock, menu_dat->title);
	au_wordtobyte(menu_dat->colours, menu_dat->datablock, 12);
	au_wordtobyte(menu_dat->width, menu_dat->datablock, 16);
	au_wordtobyte(menu_dat->height, menu_dat->datablock, 20);
	au_wordtobyte(menu_dat->vert_gap, menu_dat->datablock, 24);
	/* end of header info */
	i = 28;

	pointer = menu_dat->next_menuelem;

	while(pointer != NULL) {

		au_wordtobyte(pointer->flags, menu_dat->datablock, i);
		i += 4;
		au_wordtobyte(pointer->submenu, menu_dat->datablock, i);
		i += 4;
		au_wordtobyte(pointer->menu_iconflags, menu_dat->datablock, i);
		i += 4;
		strcpy((char *) &menu_dat->datablock[i], pointer->menu_text);
		i += 12;
		pointer = pointer->next_menuelem;
	}
	return;
}

void
au_openmenu(menu_data *menu_dat, int mouse_x, int mouse_y)
{
	_kernel_swi_regs	regs_in, regs_out;

	regs_in.r[1] = (int) menu_dat->datablock;
	regs_in.r[2] = mouse_x;
	regs_in.r[3] = mouse_y;
	_kernel_swi(Wimp_CreateMenu, &regs_in, &regs_out);
	return;
}

void
au_losecaret(void)
{
	_kernel_swi_regs	regs_in, regs_out;

	regs_in.r[0] = -1;
	regs_in.r[1] = -1;
	regs_in.r[0] = -1;
	regs_in.r[0] = -1;
	regs_in.r[4] = -1;
	regs_in.r[5] = -1;

	_kernel_swi(Wimp_SetCaretPosition, &regs_in, &regs_out);
}

void
au_dragbox(unsigned long int winhdl, unsigned long int iconhdl)
{
	_kernel_swi_regs	regs_in, regs_out;
	unsigned char	temp_buffer[256];
	unsigned char	temp_buffer2[256];
	long int	min_x, min_y, max_x, max_y = 0;

	/* Get some icon information */
	au_geticoninfo(winhdl, iconhdl, temp_buffer2);

	au_wordtobyte(winhdl, temp_buffer, 0);
	au_wordtobyte(SAVEDRAG_TYPE, temp_buffer, 4);

	/* Copy in max and min coordinates for bounding box */
	min_x = au_bytetoword(temp_buffer2, 8);
	min_y = au_bytetoword(temp_buffer2, 12);
	max_x = au_bytetoword(temp_buffer2, 16);
	max_y = au_bytetoword(temp_buffer2, 20);

	au_wordtobyte(winhdl, temp_buffer2, 0);
	regs_in.r[1] = (int) temp_buffer2;
	_kernel_swi(Wimp_GetWindowState, &regs_in, &regs_out);

	min_x += au_bytetoword(temp_buffer2, 4);
	max_x += au_bytetoword(temp_buffer2, 4);
	min_x -= au_bytetoword(temp_buffer2, 20);
	max_x -= au_bytetoword(temp_buffer2, 20);
	min_y += au_bytetoword(temp_buffer2, 16);
	max_y += au_bytetoword(temp_buffer2, 16);
	min_y -= au_bytetoword(temp_buffer2, 24);
	max_y -= au_bytetoword(temp_buffer2, 24);


	au_wordtobyte(min_x, temp_buffer, 8);
	au_wordtobyte(min_y, temp_buffer, 12);
	au_wordtobyte(max_x, temp_buffer, 16);
	au_wordtobyte(max_y, temp_buffer, 20);
	au_wordtobyte(0, temp_buffer, 24);
	au_wordtobyte(0, temp_buffer, 28);
	au_wordtobyte(0, temp_buffer, 32);
	au_wordtobyte(0, temp_buffer, 36);


/*printf("\f%ld %ld %ld %ld\n", min_x, min_y, max_x, max_y);*/


	regs_in.r[1] = (int) temp_buffer;
	_kernel_swi(Wimp_DragBox, &regs_in, &regs_out);
	/* The end-of-drag should be caught with the appropriate poll message */
	return;
}

void
au_geticoninfo(unsigned long int winhdl, unsigned long int iconhdl, unsigned char *buffer)
{
	_kernel_swi_regs	regs_in, regs_out;

	au_wordtobyte(winhdl, buffer, 0);
	au_wordtobyte(iconhdl, buffer, 4);
	regs_in.r[1] = (int) buffer;
	_kernel_swi(Wimp_GetIconState, &regs_in, &regs_out);
	return;
}

void
au_getpointerinfo(pointer_data *pointer_info)
{
	_kernel_swi_regs	regs_in, regs_out;
	unsigned char	temp_blk[1024];

	regs_in.r[1] = (int) temp_blk;
	_kernel_swi(Wimp_GetPointerInfo, &regs_in, &regs_out);
	pointer_info->mouse_x = au_bytetoword(temp_blk, 0);
	pointer_info->mouse_y = au_bytetoword(temp_blk, 4);
	pointer_info->button_state = au_bytetoword(temp_blk, 8);
	pointer_info->win_handle = au_bytetoword(temp_blk, 12);
	pointer_info->icon_handle = au_bytetoword(temp_blk, 16);
	return;
}

void
au_datasave(pointer_data pointer_info, int size, int filetype, char *leafname)
{
	_kernel_swi_regs	regs_in, regs_out;
	int block_length = 56;
	unsigned char	temp_blk[1024];

	au_wordtobyte(block_length, temp_blk, 0);
	/* The following two aren't used on entry */
	au_wordtobyte(0, temp_blk, 4);
	au_wordtobyte(0, temp_blk, 8);
	/* This next value sets your_ref to 0, meaning it's an original message */
	au_wordtobyte(0, temp_blk, 12);
	au_wordtobyte(MESSAGE_DATASAVE, temp_blk, 16);

	/* Copy the data from pointer_info to the temp block */
	au_wordtobyte(pointer_info.win_handle, temp_blk, 20);
	au_wordtobyte(pointer_info.icon_handle, temp_blk, 24);
	au_wordtobyte(pointer_info.mouse_x, temp_blk, 28);
	au_wordtobyte(pointer_info.mouse_y, temp_blk, 32);

	au_wordtobyte(size, temp_blk, 36);
	au_wordtobyte(filetype, temp_blk, 40);
	/* The following must be zero-terminated, but this should be */
	/* taken care of for us */
	strcpy((char *) &temp_blk[44], leafname);

	regs_in.r[0] = 17;
	regs_in.r[1] = (int) &temp_blk;
	regs_in.r[2] = (int) pointer_info.win_handle;
	_kernel_swi(Wimp_SendMessage, &regs_in, &regs_out);
}

int
au_findfont(char *fontname, int fontsize, int fontres)
{
	_kernel_swi_regs in, out;

	in.r[1] = (int) fontname;
	in.r[2] = in.r[3] = fontsize;
	in.r[4] = in.r[5] = fontres;
	_kernel_swi(Font_FindFont, &in, &out);
	return out.r[0];
}

void
au_selectfont(int fonthandle)
{
	_kernel_swi_regs in, out;
	in.r[0] = fonthandle;
	_kernel_swi(Font_SetFont, &in, &out);
}

void
au_setfontcolours(int background, int foreground)
{
	_kernel_swi_regs in, out;

	in.r[0] = 0;
	in.r[1] = background;
	in.r[2] = foreground;
	in.r[3] = 14;
	_kernel_swi(ColourTrans_SetFontColours, &in, &out);
}

void
au_fontpaint(char *text, int x_coor, int y_coor)
{
	_kernel_swi_regs in, out;
	int fontflags = 1u << 4;

	in.r[1] = (int) text;
	in.r[2] = fontflags;
	in.r[3] = x_coor,
	in.r[4] = y_coor,
	_kernel_swi(Font_Paint, &in, &out);
}

void
au_losefont(int fonthandle)
{
	_kernel_swi_regs in, out;

	in.r[0] = fonthandle;
	_kernel_swi(Font_LoseFont, &in, &out);
}

void
au_convertwindow_to_screen(unsigned char *pollblock, int *x_coor, int *y_coor)
{
	int winx1, winx2, winy1, winy2;
	int scrollx, scrolly;
	int temp_x, temp_y;

	winx1 = (int) au_bytetoword(pollblock, 4);
	winy1 = (int) au_bytetoword(pollblock, 8);
	winx2 = (int) au_bytetoword(pollblock, 12);
	winy2 = (int) au_bytetoword(pollblock, 16);

	scrollx = (int) au_bytetoword(pollblock, 20);
	scrolly = (int) au_bytetoword(pollblock, 24);

	temp_x = *x_coor - scrollx + winx1;
	temp_y = *y_coor - scrolly + winy2;
	*x_coor = temp_x;
	*y_coor = temp_y;
}
00000000  2f 2a 20 41 63 6f 72 6e  20 55 73 65 72 20 6c 69  |/* Acorn User li|
00000010  62 72 61 72 79 20 66 6f  72 20 57 49 4d 50 20 70  |brary for WIMP p|
00000020  72 6f 67 72 61 6d 6d 69  6e 67 20 69 6e 20 43 20  |rogramming in C |
00000030  2a 2f 0a 2f 2a 20 42 79  20 53 74 65 76 65 20 4d  |*/./* By Steve M|
00000040  75 6d 66 6f 72 64 2c 20  38 74 68 20 53 65 70 74  |umford, 8th Sept|
00000050  65 6d 62 65 72 20 31 39  39 36 20 2a 2f 0a 2f 2a  |ember 1996 */./*|
00000060  20 4c 61 73 74 20 6d 6f  64 69 66 69 65 64 20 36  | Last modified 6|
00000070  2f 31 30 2f 39 37 20 2a  2f 0a 0a 2f 2a 20 23 49  |/10/97 */../* #I|
00000080  6e 63 6c 75 64 65 20 74  68 65 20 61 70 70 72 6f  |nclude the appro|
00000090  70 72 69 61 74 65 20 66  69 6c 65 73 20 2d 20 41  |priate files - A|
000000a0  55 4c 69 62 2e 68 20 63  6f 6e 74 61 69 6e 73 20  |ULib.h contains |
000000b0  65 76 65 72 79 74 68 69  6e 67 20 77 65 20 6e 65  |everything we ne|
000000c0  65 64 20 2a 2f 0a 0a 23  69 6e 63 6c 75 64 65 20  |ed */..#include |
000000d0  22 41 55 6c 69 62 2e 68  22 0a 0a 69 6e 74 0a 61  |"AUlib.h"..int.a|
000000e0  75 5f 69 6e 69 74 69 61  6c 69 73 65 28 69 6e 74  |u_initialise(int|
000000f0  20 76 5f 6e 75 6d 62 65  72 2c 20 63 68 61 72 20  | v_number, char |
00000100  2a 61 70 70 6e 61 6d 65  2c 20 6c 6f 6e 67 20 69  |*appname, long i|
00000110  6e 74 20 6d 73 67 6c 69  73 74 5b 5d 29 0a 7b 0a  |nt msglist[]).{.|
00000120  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 5f 72 65 67  |._kernel_swi_reg|
00000130  73 09 72 65 67 73 5f 69  6e 2c 20 72 65 67 73 5f  |s.regs_in, regs_|
00000140  6f 75 74 3b 0a 0a 09 72  65 67 73 5f 69 6e 2e 72  |out;...regs_in.r|
00000150  5b 30 5d 20 3d 20 76 5f  6e 75 6d 62 65 72 3b 0a  |[0] = v_number;.|
00000160  09 72 65 67 73 5f 69 6e  2e 72 5b 31 5d 20 3d 20  |.regs_in.r[1] = |
00000170  2a 28 69 6e 74 20 2a 29  22 54 41 53 4b 22 3b 0a  |*(int *)"TASK";.|
00000180  09 72 65 67 73 5f 69 6e  2e 72 5b 32 5d 20 3d 20  |.regs_in.r[2] = |
00000190  28 69 6e 74 29 20 61 70  70 6e 61 6d 65 3b 0a 09  |(int) appname;..|
000001a0  72 65 67 73 5f 69 6e 2e  72 5b 33 5d 20 3d 20 28  |regs_in.r[3] = (|
000001b0  69 6e 74 29 20 6d 73 67  6c 69 73 74 3b 0a 0a 09  |int) msglist;...|
000001c0  5f 6b 65 72 6e 65 6c 5f  73 77 69 28 57 69 6d 70  |_kernel_swi(Wimp|
000001d0  5f 49 6e 69 74 69 61 6c  69 73 65 2c 20 26 72 65  |_Initialise, &re|
000001e0  67 73 5f 69 6e 2c 20 26  72 65 67 73 5f 6f 75 74  |gs_in, &regs_out|
000001f0  29 3b 0a 09 72 65 74 75  72 6e 20 72 65 67 73 5f  |);..return regs_|
00000200  6f 75 74 2e 72 5b 31 5d  3b 20 2f 2a 20 74 68 69  |out.r[1]; /* thi|
00000210  73 20 69 73 20 74 68 65  20 74 61 73 6b 20 68 61  |s is the task ha|
00000220  6e 64 6c 65 2c 20 72 65  74 75 72 6e 65 64 20 66  |ndle, returned f|
00000230  6f 72 20 6c 61 74 65 72  20 75 73 65 20 2a 2f 0a  |or later use */.|
00000240  7d 0a 0a 76 6f 69 64 0a  61 75 5f 63 6c 6f 73 65  |}..void.au_close|
00000250  64 6f 77 6e 28 69 6e 74  20 74 61 73 6b 68 61 6e  |down(int taskhan|
00000260  64 6c 65 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |dle).{.._kernel_|
00000270  73 77 69 5f 72 65 67 73  09 72 65 67 73 5f 69 6e  |swi_regs.regs_in|
00000280  2c 20 72 65 67 73 5f 6f  75 74 3b 0a 0a 09 72 65  |, regs_out;...re|
00000290  67 73 5f 69 6e 2e 72 5b  30 5d 20 3d 20 74 61 73  |gs_in.r[0] = tas|
000002a0  6b 68 61 6e 64 6c 65 3b  0a 09 72 65 67 73 5f 69  |khandle;..regs_i|
000002b0  6e 2e 72 5b 31 5d 20 3d  20 2a 28 69 6e 74 20 2a  |n.r[1] = *(int *|
000002c0  29 22 54 41 53 4b 22 3b  0a 09 5f 6b 65 72 6e 65  |)"TASK";.._kerne|
000002d0  6c 5f 73 77 69 28 57 69  6d 70 5f 43 6c 6f 73 65  |l_swi(Wimp_Close|
000002e0  44 6f 77 6e 2c 20 26 72  65 67 73 5f 69 6e 2c 20  |Down, &regs_in, |
000002f0  26 72 65 67 73 5f 6f 75  74 29 3b 0a 7d 0a 0a 69  |&regs_out);.}..i|
00000300  6e 74 0a 61 75 5f 63 72  65 61 74 65 5f 69 63 6f  |nt.au_create_ico|
00000310  6e 62 61 72 5f 69 63 6f  6e 28 69 6e 74 20 70 72  |nbar_icon(int pr|
00000320  69 6f 72 69 74 79 2c 20  75 6e 73 69 67 6e 65 64  |iority, unsigned|
00000330  20 6c 6f 6e 67 20 69 6e  74 20 77 68 69 63 68 73  | long int whichs|
00000340  69 64 65 2c 20 75 6e 73  69 67 6e 65 64 20 6c 6f  |ide, unsigned lo|
00000350  6e 67 20 69 6e 74 20 69  63 6f 6e 66 6c 61 67 73  |ng int iconflags|
00000360  2c 20 63 68 61 72 20 2a  73 70 72 6e 61 6d 65 29  |, char *sprname)|
00000370  0a 7b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 5f  |.{.._kernel_swi_|
00000380  72 65 67 73 09 72 65 67  73 5f 69 6e 2c 20 72 65  |regs.regs_in, re|
00000390  67 73 5f 6f 75 74 3b 0a  09 75 6e 73 69 67 6e 65  |gs_out;..unsigne|
000003a0  64 20 63 68 61 72 20 69  63 6f 6e 5f 62 6c 6f 63  |d char icon_bloc|
000003b0  6b 5b 49 43 4f 4e 5f 42  4c 4f 43 4b 5f 53 49 5a  |k[ICON_BLOCK_SIZ|
000003c0  45 5d 3b 0a 09 2f 2a 20  57 65 20 6e 65 65 64 20  |E];../* We need |
000003d0  74 6f 20 62 75 69 6c 64  20 75 70 20 61 6e 20 69  |to build up an i|
000003e0  63 6f 6e 20 69 6e 66 6f  72 6d 61 74 69 6f 6e 20  |con information |
000003f0  64 61 74 61 62 6c 6f 63  6b 20 2a 2f 0a 09 61 75  |datablock */..au|
00000400  5f 77 6f 72 64 74 6f 62  79 74 65 28 77 68 69 63  |_wordtobyte(whic|
00000410  68 73 69 64 65 2c 20 69  63 6f 6e 5f 62 6c 6f 63  |hside, icon_bloc|
00000420  6b 2c 20 30 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |k, 0);..au_wordt|
00000430  6f 62 79 74 65 28 49 42  41 52 5f 42 42 4f 58 5f  |obyte(IBAR_BBOX_|
00000440  4d 49 4e 58 2c 20 69 63  6f 6e 5f 62 6c 6f 63 6b  |MINX, icon_block|
00000450  2c 20 34 29 3b 0a 09 61  75 5f 77 6f 72 64 74 6f  |, 4);..au_wordto|
00000460  62 79 74 65 28 49 42 41  52 5f 42 42 4f 58 5f 4d  |byte(IBAR_BBOX_M|
00000470  49 4e 59 2c 20 69 63 6f  6e 5f 62 6c 6f 63 6b 2c  |INY, icon_block,|
00000480  20 38 29 3b 0a 09 61 75  5f 77 6f 72 64 74 6f 62  | 8);..au_wordtob|
00000490  79 74 65 28 49 42 41 52  5f 42 42 4f 58 5f 4d 41  |yte(IBAR_BBOX_MA|
000004a0  58 58 2c 20 69 63 6f 6e  5f 62 6c 6f 63 6b 2c 20  |XX, icon_block, |
000004b0  31 32 29 3b 0a 09 61 75  5f 77 6f 72 64 74 6f 62  |12);..au_wordtob|
000004c0  79 74 65 28 49 42 41 52  5f 42 42 4f 58 5f 4d 41  |yte(IBAR_BBOX_MA|
000004d0  58 59 2c 20 69 63 6f 6e  5f 62 6c 6f 63 6b 2c 20  |XY, icon_block, |
000004e0  31 36 29 3b 0a 09 61 75  5f 77 6f 72 64 74 6f 62  |16);..au_wordtob|
000004f0  79 74 65 28 69 63 6f 6e  66 6c 61 67 73 2c 20 69  |yte(iconflags, i|
00000500  63 6f 6e 5f 62 6c 6f 63  6b 2c 20 32 30 29 3b 0a  |con_block, 20);.|
00000510  0a 09 2f 2a 20 43 6f 70  79 20 74 68 65 20 69 63  |../* Copy the ic|
00000520  6f 6e 20 6e 61 6d 65 20  69 6e 74 6f 20 74 68 65  |on name into the|
00000530  20 61 70 70 72 6f 70 72  69 61 74 65 20 70 6c 61  | appropriate pla|
00000540  63 65 20 2a 2f 0a 09 73  74 72 63 70 79 28 20 28  |ce */..strcpy( (|
00000550  63 68 61 72 20 2a 29 20  26 69 63 6f 6e 5f 62 6c  |char *) &icon_bl|
00000560  6f 63 6b 5b 32 34 5d 2c  20 73 70 72 6e 61 6d 65  |ock[24], sprname|
00000570  29 3b 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 30 5d  |);..regs_in.r[0]|
00000580  20 3d 20 70 72 69 6f 72  69 74 79 3b 0a 09 72 65  | = priority;..re|
00000590  67 73 5f 69 6e 2e 72 5b  31 5d 20 3d 20 28 69 6e  |gs_in.r[1] = (in|
000005a0  74 29 20 69 63 6f 6e 5f  62 6c 6f 63 6b 3b 0a 09  |t) icon_block;..|
000005b0  5f 6b 65 72 6e 65 6c 5f  73 77 69 28 57 69 6d 70  |_kernel_swi(Wimp|
000005c0  5f 43 72 65 61 74 65 49  63 6f 6e 2c 20 26 72 65  |_CreateIcon, &re|
000005d0  67 73 5f 69 6e 2c 20 26  72 65 67 73 5f 6f 75 74  |gs_in, &regs_out|
000005e0  29 3b 0a 09 72 65 74 75  72 6e 20 72 65 67 73 5f  |);..return regs_|
000005f0  6f 75 74 2e 72 5b 30 5d  3b 20 2f 2a 20 52 65 74  |out.r[0]; /* Ret|
00000600  75 72 6e 20 74 68 65 20  69 63 6f 6e 20 68 61 6e  |urn the icon han|
00000610  64 6c 65 20 2a 2f 0a 7d  0a 0a 76 6f 69 64 0a 61  |dle */.}..void.a|
00000620  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 75 6e 73  |u_wordtobyte(uns|
00000630  69 67 6e 65 64 20 6c 6f  6e 67 20 69 6e 74 20 69  |igned long int i|
00000640  6e 70 75 74 2c 20 75 6e  73 69 67 6e 65 64 20 63  |nput, unsigned c|
00000650  68 61 72 20 62 6c 6f 63  6b 5b 5d 2c 20 69 6e 74  |har block[], int|
00000660  20 69 6e 64 65 78 29 0a  7b 0a 09 75 6e 73 69 67  | index).{..unsig|
00000670  6e 65 64 20 6c 6f 6e 67  20 69 6e 74 20 6d 61 73  |ned long int mas|
00000680  6b 20 3d 20 32 35 35 3b  0a 0a 09 2f 2a 20 54 68  |k = 255;.../* Th|
00000690  65 20 6f 70 70 6f 73 69  74 65 20 6f 66 20 62 74  |e opposite of bt|
000006a0  6f 77 28 29 20 2d 20 74  68 69 73 20 66 75 6e 63  |ow() - this func|
000006b0  74 69 6f 6e 20 74 61 6b  65 73 20 61 20 33 32 2d  |tion takes a 32-|
000006c0  62 69 74 20 69 6e 74 65  67 65 72 2c 20 73 70 6c  |bit integer, spl|
000006d0  69 74 73 0a 09 20 2a 20  69 74 20 75 70 20 69 6e  |its.. * it up in|
000006e0  74 6f 20 34 20 62 79 74  65 73 2c 20 61 6e 64 20  |to 4 bytes, and |
000006f0  73 74 6f 72 65 73 20 74  68 6f 73 65 20 69 6e 20  |stores those in |
00000700  34 20 63 6f 6e 73 65 63  75 74 69 76 65 20 63 65  |4 consecutive ce|
00000710  6c 6c 73 20 6f 66 20 61  0a 09 20 2a 20 63 68 61  |lls of a.. * cha|
00000720  72 61 63 74 65 72 20 61  72 72 61 79 20 69 6e 64  |racter array ind|
00000730  65 78 65 64 20 62 79 20  69 6e 64 65 78 2e 20 54  |exed by index. T|
00000740  68 69 73 20 69 73 20 64  6f 6e 65 20 62 79 20 75  |his is done by u|
00000750  73 69 6e 67 20 61 20 6d  61 73 6b 20 74 6f 0a 09  |sing a mask to..|
00000760  20 2a 20 65 78 74 72 61  63 74 20 74 68 65 20 64  | * extract the d|
00000770  61 74 61 20 69 6e 20 73  65 71 75 65 6e 63 65 2c  |ata in sequence,|
00000780  20 77 69 74 68 20 74 68  65 20 26 20 62 69 74 77  | with the & bitw|
00000790  69 73 65 2d 61 6e 64 20  6f 70 65 72 61 74 6f 72  |ise-and operator|
000007a0  20 2a 2f 0a 0a 09 62 6c  6f 63 6b 5b 69 6e 64 65  | */...block[inde|
000007b0  78 2b 2b 5d 20 3d 20 28  63 68 61 72 29 20 28 69  |x++] = (char) (i|
000007c0  6e 70 75 74 20 26 20 6d  61 73 6b 29 3b 0a 09 2f  |nput & mask);../|
000007d0  2a 20 73 68 69 66 74 20  6d 61 73 6b 20 74 6f 20  |* shift mask to |
000007e0  67 65 74 20 73 65 63 6f  6e 64 20 62 79 74 65 2c  |get second byte,|
000007f0  20 61 6e 64 20 73 75 70  70 6c 79 20 72 65 73 75  | and supply resu|
00000800  6c 74 20 61 73 20 62 79  74 65 20 73 69 7a 65 20  |lt as byte size |
00000810  2a 2f 0a 09 6d 61 73 6b  20 3c 3c 3d 20 38 3b 0a  |*/..mask <<= 8;.|
00000820  09 62 6c 6f 63 6b 5b 69  6e 64 65 78 2b 2b 5d 20  |.block[index++] |
00000830  3d 20 28 63 68 61 72 29  20 28 28 69 6e 70 75 74  |= (char) ((input|
00000840  20 26 20 6d 61 73 6b 29  20 3e 3e 20 38 29 3b 0a  | & mask) >> 8);.|
00000850  09 6d 61 73 6b 20 3c 3c  3d 20 38 3b 0a 09 62 6c  |.mask <<= 8;..bl|
00000860  6f 63 6b 5b 69 6e 64 65  78 2b 2b 5d 20 3d 20 28  |ock[index++] = (|
00000870  63 68 61 72 29 20 28 28  69 6e 70 75 74 20 26 20  |char) ((input & |
00000880  6d 61 73 6b 29 20 3e 3e  20 31 36 29 3b 0a 09 6d  |mask) >> 16);..m|
00000890  61 73 6b 20 3c 3c 3d 20  38 3b 0a 09 62 6c 6f 63  |ask <<= 8;..bloc|
000008a0  6b 5b 69 6e 64 65 78 2b  2b 5d 20 3d 20 28 63 68  |k[index++] = (ch|
000008b0  61 72 29 20 28 28 69 6e  70 75 74 20 26 20 6d 61  |ar) ((input & ma|
000008c0  73 6b 29 20 3e 3e 20 32  34 29 3b 0a 0a 09 72 65  |sk) >> 24);...re|
000008d0  74 75 72 6e 3b 0a 7d 0a  0a 75 6e 73 69 67 6e 65  |turn;.}..unsigne|
000008e0  64 20 6c 6f 6e 67 20 69  6e 74 0a 61 75 5f 62 79  |d long int.au_by|
000008f0  74 65 74 6f 77 6f 72 64  28 75 6e 73 69 67 6e 65  |tetoword(unsigne|
00000900  64 20 63 68 61 72 20 62  6c 6f 63 6b 5b 5d 2c 20  |d char block[], |
00000910  69 6e 74 20 69 6e 64 65  78 29 0a 7b 0a 09 75 6e  |int index).{..un|
00000920  73 69 67 6e 65 64 20 6c  6f 6e 67 20 69 6e 74 20  |signed long int |
00000930  72 65 73 75 6c 74 20 3d  20 30 3b 0a 09 69 6e 74  |result = 0;..int|
00000940  20 6c 6f 6f 70 3b 0a 0a  09 2f 2a 20 54 68 69 73  | loop;.../* This|
00000950  20 72 6f 75 74 69 6e 65  20 74 61 6b 65 73 20 61  | routine takes a|
00000960  20 64 61 74 61 20 62 6c  6f 63 6b 20 61 6e 64 20  | data block and |
00000970  61 20 73 74 61 72 74 69  6e 67 20 62 79 74 65 2c  |a starting byte,|
00000980  20 61 6e 64 20 63 6f 6e  76 65 72 74 73 20 74 68  | and converts th|
00000990  65 0a 09 20 2a 20 6e 65  78 74 20 66 6f 75 72 20  |e.. * next four |
000009a0  62 79 74 65 73 20 69 6e  74 6f 20 61 20 77 6f 72  |bytes into a wor|
000009b0  64 20 2d 20 77 65 20 68  61 76 65 20 74 6f 20 73  |d - we have to s|
000009c0  74 61 72 74 20 61 74 20  74 68 65 20 6d 6f 73 74  |tart at the most|
000009d0  20 73 69 67 6e 69 66 69  63 61 6e 74 0a 09 20 2a  | significant.. *|
000009e0  20 62 79 74 65 20 61 6e  64 20 77 6f 72 6b 20 62  | byte and work b|
000009f0  61 63 6b 77 61 72 64 73  20 2a 2f 0a 0a 09 69 6e  |ackwards */...in|
00000a00  64 65 78 20 2b 3d 20 33  3b 0a 09 72 65 73 75 6c  |dex += 3;..resul|
00000a10  74 20 3d 20 62 6c 6f 63  6b 5b 69 6e 64 65 78 2d  |t = block[index-|
00000a20  2d 5d 3b 0a 09 66 6f 72  28 6c 6f 6f 70 20 3d 20  |-];..for(loop = |
00000a30  30 3b 20 6c 6f 6f 70 20  3c 20 33 3b 20 6c 6f 6f  |0; loop < 3; loo|
00000a40  70 2b 2b 29 20 7b 0a 09  09 72 65 73 75 6c 74 20  |p++) {...result |
00000a50  3d 20 72 65 73 75 6c 74  20 3c 3c 20 38 3b 20 2f  |= result << 8; /|
00000a60  2a 20 74 68 69 73 20 73  68 69 66 74 73 20 62 69  |* this shifts bi|
00000a70  74 73 20 69 6e 20 72 65  73 75 6c 74 20 6c 65 66  |ts in result lef|
00000a80  74 20 62 79 20 38 20 73  70 61 63 65 73 20 2a 2f  |t by 8 spaces */|
00000a90  0a 09 09 72 65 73 75 6c  74 20 2b 3d 20 62 6c 6f  |...result += blo|
00000aa0  63 6b 5b 69 6e 64 65 78  2d 2d 5d 3b 0a 09 7d 0a  |ck[index--];..}.|
00000ab0  0a 09 72 65 74 75 72 6e  20 72 65 73 75 6c 74 3b  |..return result;|
00000ac0  0a 7d 0a 0a 76 6f 69 64  0a 61 75 5f 6f 70 65 6e  |.}..void.au_open|
00000ad0  74 65 6d 70 6c 61 74 65  28 63 68 61 72 20 2a 66  |template(char *f|
00000ae0  69 6c 65 6e 61 6d 65 29  0a 7b 0a 09 5f 6b 65 72  |ilename).{.._ker|
00000af0  6e 65 6c 5f 73 77 69 5f  72 65 67 73 09 72 65 67  |nel_swi_regs.reg|
00000b00  73 5f 69 6e 2c 20 72 65  67 73 5f 6f 75 74 3b 0a  |s_in, regs_out;.|
00000b10  09 72 65 67 73 5f 69 6e  2e 72 5b 31 5d 20 3d 20  |.regs_in.r[1] = |
00000b20  28 69 6e 74 29 20 66 69  6c 65 6e 61 6d 65 3b 0a  |(int) filename;.|
00000b30  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  |._kernel_swi(Wim|
00000b40  70 5f 4f 70 65 6e 54 65  6d 70 6c 61 74 65 2c 20  |p_OpenTemplate, |
00000b50  26 72 65 67 73 5f 69 6e  2c 20 26 72 65 67 73 5f  |&regs_in, &regs_|
00000b60  6f 75 74 29 3b 0a 7d 0a  0a 76 6f 69 64 0a 61 75  |out);.}..void.au|
00000b70  5f 63 6c 6f 73 65 74 65  6d 70 6c 61 74 65 28 76  |_closetemplate(v|
00000b80  6f 69 64 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |oid).{.._kernel_|
00000b90  73 77 69 5f 72 65 67 73  09 72 65 67 73 5f 69 6e  |swi_regs.regs_in|
00000ba0  2c 20 72 65 67 73 5f 6f  75 74 3b 0a 09 2f 2a 20  |, regs_out;../* |
00000bb0  4e 6f 20 64 61 74 61 20  6e 65 65 64 65 64 20 66  |No data needed f|
00000bc0  6f 72 20 43 6c 6f 73 65  54 65 6d 70 6c 61 74 65  |or CloseTemplate|
00000bd0  20 2a 2f 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  | */.._kernel_swi|
00000be0  28 57 69 6d 70 5f 43 6c  6f 73 65 54 65 6d 70 6c  |(Wimp_CloseTempl|
00000bf0  61 74 65 2c 20 26 72 65  67 73 5f 69 6e 2c 20 26  |ate, &regs_in, &|
00000c00  72 65 67 73 5f 6f 75 74  29 3b 0a 7d 0a 0a 69 6e  |regs_out);.}..in|
00000c10  74 0a 61 75 5f 6c 6f 61  64 74 65 6d 70 6c 61 74  |t.au_loadtemplat|
00000c20  65 28 63 68 61 72 20 2a  74 65 6d 70 6c 61 74 65  |e(char *template|
00000c30  5f 6e 61 6d 65 2c 20 77  69 6e 64 6f 77 5f 64 61  |_name, window_da|
00000c40  74 61 20 2a 77 69 6e 5f  64 61 74 61 2c 20 69 6e  |ta *win_data, in|
00000c50  74 20 63 61 6c 6c 29 0a  7b 0a 09 5f 6b 65 72 6e  |t call).{.._kern|
00000c60  65 6c 5f 73 77 69 5f 72  65 67 73 09 72 65 67 73  |el_swi_regs.regs|
00000c70  5f 69 6e 2c 20 72 65 67  73 5f 6f 75 74 3b 0a 09  |_in, regs_out;..|
00000c80  69 6e 74 09 77 6f 72 6b  73 70 61 63 65 5f 6c 65  |int.workspace_le|
00000c90  6e 67 74 68 20 3d 20 30  3b 0a 09 69 6e 74 09 6e  |ngth = 0;..int.n|
00000ca0  65 78 74 5f 65 6e 74 72  79 3b 0a 0a 09 2f 2a 20  |ext_entry;.../* |
00000cb0  69 6e 74 65 72 72 6f 67  61 74 65 20 66 69 6c 65  |interrogate file|
00000cc0  20 74 6f 20 66 69 6e 64  20 6f 75 74 20 68 6f 77  | to find out how|
00000cd0  20 6d 75 63 68 20 73 70  61 63 65 20 77 65 20 6e  | much space we n|
00000ce0  65 65 64 20 2a 2f 0a 09  72 65 67 73 5f 69 6e 2e  |eed */..regs_in.|
00000cf0  72 5b 31 5d 20 3d 20 30  3b 20 2f 2a 20 74 65 6c  |r[1] = 0; /* tel|
00000d00  6c 20 53 57 49 20 74 6f  20 66 69 6e 64 20 73 69  |l SWI to find si|
00000d10  7a 65 73 20 2a 2f 0a 09  72 65 67 73 5f 69 6e 2e  |zes */..regs_in.|
00000d20  72 5b 35 5d 20 3d 20 28  69 6e 74 29 20 74 65 6d  |r[5] = (int) tem|
00000d30  70 6c 61 74 65 5f 6e 61  6d 65 3b 20 2f 2a 20 70  |plate_name; /* p|
00000d40  61 73 73 20 6e 61 6d 65  20 74 6f 20 53 57 49 20  |ass name to SWI |
00000d50  2a 2f 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 36 5d  |*/..regs_in.r[6]|
00000d60  20 3d 20 63 61 6c 6c 3b  20 2f 2a 20 30 20 66 6f  | = call; /* 0 fo|
00000d70  72 20 66 69 72 73 74 20  63 61 6c 6c 20 2a 2f 0a  |r first call */.|
00000d80  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |.._kernel_swi(Wi|
00000d90  6d 70 5f 4c 6f 61 64 54  65 6d 70 6c 61 74 65 2c  |mp_LoadTemplate,|
00000da0  20 26 72 65 67 73 5f 69  6e 2c 20 26 72 65 67 73  | &regs_in, &regs|
00000db0  5f 6f 75 74 29 3b 0a 09  77 69 6e 5f 64 61 74 61  |_out);..win_data|
00000dc0  2d 3e 62 75 66 66 65 72  20 3d 20 63 61 6c 6c 6f  |->buffer = callo|
00000dd0  63 28 72 65 67 73 5f 6f  75 74 2e 72 5b 31 5d 2c  |c(regs_out.r[1],|
00000de0  20 73 69 7a 65 6f 66 28  75 6e 73 69 67 6e 65 64  | sizeof(unsigned|
00000df0  20 63 68 61 72 29 29 3b  0a 09 77 6f 72 6b 73 70  | char));..worksp|
00000e00  61 63 65 5f 6c 65 6e 67  74 68 20 3d 20 72 65 67  |ace_length = reg|
00000e10  73 5f 6f 75 74 2e 72 5b  32 5d 3b 20 2f 2a 20 65  |s_out.r[2]; /* e|
00000e20  72 72 20 6f 6e 20 73 69  64 65 20 6f 66 20 63 61  |rr on side of ca|
00000e30  75 74 69 6f 6e 20 2a 2f  0a 09 77 69 6e 5f 64 61  |ution */..win_da|
00000e40  74 61 2d 3e 77 6f 72 6b  73 70 61 63 65 20 3d 20  |ta->workspace = |
00000e50  63 61 6c 6c 6f 63 28 77  6f 72 6b 73 70 61 63 65  |calloc(workspace|
00000e60  5f 6c 65 6e 67 74 68 2c  20 73 69 7a 65 6f 66 28  |_length, sizeof(|
00000e70  75 6e 73 69 67 6e 65 64  20 63 68 61 72 29 29 3b  |unsigned char));|
00000e80  0a 09 77 69 6e 5f 64 61  74 61 2d 3e 77 69 6e 5f  |..win_data->win_|
00000e90  6e 61 6d 65 20 3d 20 63  61 6c 6c 6f 63 28 73 74  |name = calloc(st|
00000ea0  72 6c 65 6e 28 20 28 63  68 61 72 20 2a 29 20 72  |rlen( (char *) r|
00000eb0  65 67 73 5f 6f 75 74 2e  72 5b 35 5d 29 20 2b 20  |egs_out.r[5]) + |
00000ec0  31 2c 20 73 69 7a 65 6f  66 28 63 68 61 72 29 29  |1, sizeof(char))|
00000ed0  3b 0a 09 73 74 72 63 70  79 28 77 69 6e 5f 64 61  |;..strcpy(win_da|
00000ee0  74 61 2d 3e 77 69 6e 5f  6e 61 6d 65 2c 20 28 63  |ta->win_name, (c|
00000ef0  68 61 72 20 2a 29 20 72  65 67 73 5f 6f 75 74 2e  |har *) regs_out.|
00000f00  72 5b 35 5d 29 3b 0a 0a  09 2f 2a 20 4e 6f 77 20  |r[5]);.../* Now |
00000f10  72 65 6c 6f 61 64 20 74  65 6d 70 6c 61 74 65 20  |reload template |
00000f20  66 72 6f 6d 20 66 69 6c  65 20 69 6e 74 6f 20 6d  |from file into m|
00000f30  65 6d 6f 72 79 20 2a 2f  0a 09 72 65 67 73 5f 69  |emory */..regs_i|
00000f40  6e 2e 72 5b 31 5d 20 3d  20 28 69 6e 74 29 20 77  |n.r[1] = (int) w|
00000f50  69 6e 5f 64 61 74 61 2d  3e 62 75 66 66 65 72 3b  |in_data->buffer;|
00000f60  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 32 5d 20 3d  |..regs_in.r[2] =|
00000f70  20 28 69 6e 74 29 20 77  69 6e 5f 64 61 74 61 2d  | (int) win_data-|
00000f80  3e 77 6f 72 6b 73 70 61  63 65 3b 0a 09 72 65 67  |>workspace;..reg|
00000f90  73 5f 69 6e 2e 72 5b 33  5d 20 3d 20 28 69 6e 74  |s_in.r[3] = (int|
00000fa0  29 20 77 69 6e 5f 64 61  74 61 2d 3e 77 6f 72 6b  |) win_data->work|
00000fb0  73 70 61 63 65 20 2b 20  77 6f 72 6b 73 70 61 63  |space + workspac|
00000fc0  65 5f 6c 65 6e 67 74 68  3b 0a 09 72 65 67 73 5f  |e_length;..regs_|
00000fd0  69 6e 2e 72 5b 34 5d 20  3d 20 2d 31 3b 20 2f 2a  |in.r[4] = -1; /*|
00000fe0  20 4e 4f 20 46 4f 4e 54  53 20 43 41 54 45 52 45  | NO FONTS CATERE|
00000ff0  44 20 46 4f 52 20 49 4e  20 54 45 4d 50 4c 41 54  |D FOR IN TEMPLAT|
00001000  45 53 20 59 45 54 20 2a  2f 0a 09 72 65 67 73 5f  |ES YET */..regs_|
00001010  69 6e 2e 72 5b 35 5d 20  3d 20 28 69 6e 74 29 20  |in.r[5] = (int) |
00001020  77 69 6e 5f 64 61 74 61  2d 3e 77 69 6e 5f 6e 61  |win_data->win_na|
00001030  6d 65 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 36  |me;..regs_in.r[6|
00001040  5d 20 3d 20 63 61 6c 6c  3b 0a 0a 09 5f 6b 65 72  |] = call;..._ker|
00001050  6e 65 6c 5f 73 77 69 28  57 69 6d 70 5f 4c 6f 61  |nel_swi(Wimp_Loa|
00001060  64 54 65 6d 70 6c 61 74  65 2c 20 26 72 65 67 73  |dTemplate, &regs|
00001070  5f 69 6e 2c 20 26 72 65  67 73 5f 6f 75 74 29 3b  |_in, &regs_out);|
00001080  0a 09 6e 65 78 74 5f 65  6e 74 72 79 20 3d 20 72  |..next_entry = r|
00001090  65 67 73 5f 6f 75 74 2e  72 5b 36 5d 3b 0a 0a 09  |egs_out.r[6];...|
000010a0  2f 2a 20 43 72 65 61 74  65 20 74 68 65 20 77 69  |/* Create the wi|
000010b0  6e 64 6f 77 2c 20 73 74  6f 72 65 20 77 69 6e 64  |ndow, store wind|
000010c0  6f 77 20 68 61 6e 64 6c  65 20 2a 2f 0a 09 72 65  |ow handle */..re|
000010d0  67 73 5f 69 6e 2e 72 5b  31 5d 20 3d 20 28 69 6e  |gs_in.r[1] = (in|
000010e0  74 29 20 77 69 6e 5f 64  61 74 61 2d 3e 62 75 66  |t) win_data->buf|
000010f0  66 65 72 3b 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |fer;.._kernel_sw|
00001100  69 28 57 69 6d 70 5f 43  72 65 61 74 65 57 69 6e  |i(Wimp_CreateWin|
00001110  64 6f 77 2c 20 26 72 65  67 73 5f 69 6e 2c 20 26  |dow, &regs_in, &|
00001120  72 65 67 73 5f 6f 75 74  29 3b 0a 09 77 69 6e 5f  |regs_out);..win_|
00001130  64 61 74 61 2d 3e 77 69  6e 5f 68 61 6e 64 6c 65  |data->win_handle|
00001140  20 3d 20 72 65 67 73 5f  6f 75 74 2e 72 5b 30 5d  | = regs_out.r[0]|
00001150  3b 0a 09 72 65 74 75 72  6e 20 6e 65 78 74 5f 65  |;..return next_e|
00001160  6e 74 72 79 3b 20 2f 2a  20 69 6e 20 63 61 73 65  |ntry; /* in case|
00001170  20 6f 66 20 77 69 6c 64  63 61 72 64 65 64 20 73  | of wildcarded s|
00001180  65 61 72 63 68 65 73 20  2a 2f 0a 7d 0a 0a 69 6e  |earches */.}..in|
00001190  74 0a 61 75 5f 72 65 70  6f 72 74 5f 65 72 72 6f  |t.au_report_erro|
000011a0  72 28 69 6e 74 20 65 72  72 6e 6f 2c 20 63 68 61  |r(int errno, cha|
000011b0  72 20 2a 65 72 72 6d 65  73 73 2c 20 69 6e 74 20  |r *errmess, int |
000011c0  66 6c 61 67 73 2c 20 63  68 61 72 20 2a 61 70 70  |flags, char *app|
000011d0  5f 6e 61 6d 65 29 0a 7b  0a 20 20 20 75 6e 73 69  |_name).{.   unsi|
000011e0  67 6e 65 64 20 63 68 61  72 20 65 72 72 6f 72 62  |gned char errorb|
000011f0  6c 6f 63 6b 5b 32 36 30  5d 3b 0a 20 20 20 5f 6b  |lock[260];.   _k|
00001200  65 72 6e 65 6c 5f 73 77  69 5f 72 65 67 73 20 69  |ernel_swi_regs i|
00001210  6e 2c 20 6f 75 74 3b 0a  0a 20 20 20 2f 2a 20 53  |n, out;..   /* S|
00001220  65 74 20 75 70 20 74 68  65 20 73 74 61 6e 64 61  |et up the standa|
00001230  72 64 20 65 72 72 6f 72  20 62 6c 6f 63 6b 20 77  |rd error block w|
00001240  69 74 68 20 74 68 65 20  65 72 72 6f 72 20 6e 75  |ith the error nu|
00001250  6d 62 65 72 20 61 6e 64  20 6d 65 73 73 61 67 65  |mber and message|
00001260  0a 20 20 20 20 20 20 28  7a 65 72 6f 20 74 65 72  |.      (zero ter|
00001270  6d 69 6e 61 74 65 64 29  20 2a 2f 0a 20 20 20 61  |minated) */.   a|
00001280  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 65 72 72  |u_wordtobyte(err|
00001290  6e 6f 2c 20 65 72 72 6f  72 62 6c 6f 63 6b 2c 20  |no, errorblock, |
000012a0  30 29 3b 0a 20 20 20 73  74 72 63 70 79 28 20 28  |0);.   strcpy( (|
000012b0  63 68 61 72 20 2a 29 20  26 65 72 72 6f 72 62 6c  |char *) &errorbl|
000012c0  6f 63 6b 5b 34 5d 2c 20  65 72 72 6d 65 73 73 29  |ock[4], errmess)|
000012d0  3b 0a 0a 20 20 20 2f 2a  20 52 30 20 2d 20 70 6f  |;..   /* R0 - po|
000012e0  69 6e 74 65 72 20 74 6f  20 73 74 61 6e 64 61 72  |inter to standar|
000012f0  64 20 65 72 72 6f 72 20  62 6c 6f 63 6b 0a 20 20  |d error block.  |
00001300  20 20 20 20 52 31 20 2d  20 65 72 72 6f 72 20 77  |    R1 - error w|
00001310  69 6e 64 6f 77 20 66 6c  61 67 73 0a 20 20 20 20  |indow flags.    |
00001320  20 20 52 32 20 2d 20 70  6f 69 6e 74 65 72 20 74  |  R2 - pointer t|
00001330  6f 20 61 70 70 6c 69 63  61 74 69 6f 6e 20 6e 61  |o application na|
00001340  6d 65 20 66 6f 72 20 65  72 72 6f 72 20 62 6f 78  |me for error box|
00001350  20 74 69 74 6c 65 20 2a  2f 0a 0a 20 20 20 69 6e  | title */..   in|
00001360  2e 72 5b 30 5d 20 3d 20  28 69 6e 74 29 20 65 72  |.r[0] = (int) er|
00001370  72 6f 72 62 6c 6f 63 6b  3b 0a 20 20 20 69 6e 2e  |rorblock;.   in.|
00001380  72 5b 31 5d 20 3d 20 66  6c 61 67 73 3b 0a 20 20  |r[1] = flags;.  |
00001390  20 69 6e 2e 72 5b 32 5d  20 3d 20 28 69 6e 74 29  | in.r[2] = (int)|
000013a0  20 61 70 70 5f 6e 61 6d  65 3b 0a 0a 20 20 20 5f  | app_name;..   _|
000013b0  6b 65 72 6e 65 6c 5f 73  77 69 28 57 69 6d 70 5f  |kernel_swi(Wimp_|
000013c0  52 65 70 6f 72 74 45 72  72 6f 72 2c 20 26 69 6e  |ReportError, &in|
000013d0  2c 20 26 6f 75 74 29 3b  0a 0a 20 20 20 2f 2a 20  |, &out);..   /* |
000013e0  52 65 74 75 72 6e 73 20  31 20 69 66 20 4f 4b 20  |Returns 1 if OK |
000013f0  73 65 6c 65 63 74 65 64  2c 20 32 20 69 66 20 43  |selected, 2 if C|
00001400  61 6e 63 65 6c 20 73 65  6c 65 63 74 65 64 20 2a  |ancel selected *|
00001410  2f 0a 20 20 20 72 65 74  75 72 6e 20 6f 75 74 2e  |/.   return out.|
00001420  72 5b 31 5d 3b 0a 7d 0a  0a 76 6f 69 64 0a 61 75  |r[1];.}..void.au|
00001430  5f 6f 70 65 6e 77 69 6e  5f 66 72 6f 6d 5f 74 65  |_openwin_from_te|
00001440  6d 70 6c 61 74 65 64 61  74 61 28 77 69 6e 64 6f  |mplatedata(windo|
00001450  77 5f 64 61 74 61 20 2a  77 69 6e 5f 64 61 74 61  |w_data *win_data|
00001460  2c 20 6c 6f 6e 67 20 69  6e 74 20 70 6f 73 69 74  |, long int posit|
00001470  69 6f 6e 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |ion).{.._kernel_|
00001480  73 77 69 5f 72 65 67 73  09 72 65 67 73 5f 69 6e  |swi_regs.regs_in|
00001490  2c 20 72 65 67 73 5f 6f  75 74 3b 0a 09 75 6e 73  |, regs_out;..uns|
000014a0  69 67 6e 65 64 20 63 68  61 72 09 6f 70 65 6e 77  |igned char.openw|
000014b0  69 6e 64 6f 77 5f 62 75  66 66 65 72 5b 33 36 5d  |indow_buffer[36]|
000014c0  3b 0a 09 69 6e 74 09 69  3b 0a 0a 09 61 75 5f 77  |;..int.i;...au_w|
000014d0  6f 72 64 74 6f 62 79 74  65 28 20 28 75 6e 73 69  |ordtobyte( (unsi|
000014e0  67 6e 65 64 20 6c 6f 6e  67 20 69 6e 74 29 20 77  |gned long int) w|
000014f0  69 6e 5f 64 61 74 61 2d  3e 77 69 6e 5f 68 61 6e  |in_data->win_han|
00001500  64 6c 65 2c 20 6f 70 65  6e 77 69 6e 64 6f 77 5f  |dle, openwindow_|
00001510  62 75 66 66 65 72 2c 20  30 29 3b 0a 09 66 6f 72  |buffer, 0);..for|
00001520  28 69 20 3d 20 30 3b 20  69 20 3c 20 36 3b 20 69  |(i = 0; i < 6; i|
00001530  2b 2b 29 20 7b 0a 09 09  61 75 5f 77 6f 72 64 74  |++) {...au_wordt|
00001540  6f 62 79 74 65 28 61 75  5f 62 79 74 65 74 6f 77  |obyte(au_bytetow|
00001550  6f 72 64 28 77 69 6e 5f  64 61 74 61 2d 3e 62 75  |ord(win_data->bu|
00001560  66 66 65 72 2c 20 69 2a  34 29 2c 20 6f 70 65 6e  |ffer, i*4), open|
00001570  77 69 6e 64 6f 77 5f 62  75 66 66 65 72 2c 20 28  |window_buffer, (|
00001580  69 2b 31 29 20 2a 20 34  29 3b 0a 09 7d 0a 09 61  |i+1) * 4);..}..a|
00001590  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 70 6f 73  |u_wordtobyte(pos|
000015a0  69 74 69 6f 6e 2c 20 6f  70 65 6e 77 69 6e 64 6f  |ition, openwindo|
000015b0  77 5f 62 75 66 66 65 72  2c 20 32 38 29 3b 0a 09  |w_buffer, 28);..|
000015c0  72 65 67 73 5f 69 6e 2e  72 5b 31 5d 20 3d 20 28  |regs_in.r[1] = (|
000015d0  69 6e 74 29 20 6f 70 65  6e 77 69 6e 64 6f 77 5f  |int) openwindow_|
000015e0  62 75 66 66 65 72 3b 0a  09 5f 6b 65 72 6e 65 6c  |buffer;.._kernel|
000015f0  5f 73 77 69 28 57 69 6d  70 5f 4f 70 65 6e 57 69  |_swi(Wimp_OpenWi|
00001600  6e 64 6f 77 2c 20 26 72  65 67 73 5f 69 6e 2c 20  |ndow, &regs_in, |
00001610  26 72 65 67 73 5f 6f 75  74 29 3b 0a 09 72 65 74  |&regs_out);..ret|
00001620  75 72 6e 3b 0a 7d 0a 0a  69 6e 74 0a 61 75 5f 77  |urn;.}..int.au_w|
00001630  69 6d 70 5f 70 6f 6c 6c  28 69 6e 74 20 70 6f 6c  |imp_poll(int pol|
00001640  6c 6d 61 73 6b 2c 20 75  6e 73 69 67 6e 65 64 20  |lmask, unsigned |
00001650  63 68 61 72 20 2a 70 6f  6c 6c 62 6c 6f 63 6b 29  |char *pollblock)|
00001660  0a 7b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 5f  |.{.._kernel_swi_|
00001670  72 65 67 73 09 72 65 67  73 5f 69 6e 2c 20 72 65  |regs.regs_in, re|
00001680  67 73 5f 6f 75 74 3b 0a  0a 09 72 65 67 73 5f 69  |gs_out;...regs_i|
00001690  6e 2e 72 5b 30 5d 20 3d  20 70 6f 6c 6c 6d 61 73  |n.r[0] = pollmas|
000016a0  6b 3b 0a 09 72 65 67 73  5f 69 6e 2e 72 5b 31 5d  |k;..regs_in.r[1]|
000016b0  20 3d 20 28 69 6e 74 29  20 70 6f 6c 6c 62 6c 6f  | = (int) pollblo|
000016c0  63 6b 3b 0a 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |ck;..._kernel_sw|
000016d0  69 28 57 69 6d 70 5f 50  6f 6c 6c 2c 20 26 72 65  |i(Wimp_Poll, &re|
000016e0  67 73 5f 69 6e 2c 20 26  72 65 67 73 5f 6f 75 74  |gs_in, &regs_out|
000016f0  29 3b 0a 09 72 65 74 75  72 6e 20 72 65 67 73 5f  |);..return regs_|
00001700  6f 75 74 2e 72 5b 30 5d  3b 20 2f 2a 20 52 65 74  |out.r[0]; /* Ret|
00001710  75 72 6e 20 74 68 65 20  65 76 65 6e 74 20 63 6f  |urn the event co|
00001720  64 65 20 2a 2f 0a 7d 0a  0a 76 6f 69 64 0a 61 75  |de */.}..void.au|
00001730  5f 69 63 6f 6e 5f 74 65  78 74 5f 63 68 61 6e 67  |_icon_text_chang|
00001740  65 28 63 68 61 72 20 2a  74 65 78 74 2c 20 75 6e  |e(char *text, un|
00001750  73 69 67 6e 65 64 20 6c  6f 6e 67 20 69 6e 74 20  |signed long int |
00001760  77 69 6e 5f 68 2c 20 75  6e 73 69 67 6e 65 64 20  |win_h, unsigned |
00001770  6c 6f 6e 67 20 69 6e 74  20 69 63 6f 6e 5f 68 29  |long int icon_h)|
00001780  0a 7b 0a 20 20 20 5f 6b  65 72 6e 65 6c 5f 73 77  |.{.   _kernel_sw|
00001790  69 5f 72 65 67 73 20 72  65 67 73 5f 69 6e 2c 20  |i_regs regs_in, |
000017a0  72 65 67 73 5f 6f 75 74  3b 0a 20 20 20 63 68 61  |regs_out;.   cha|
000017b0  72 20 2a 74 65 78 74 5f  70 6f 69 6e 74 65 72 3b  |r *text_pointer;|
000017c0  0a 20 20 20 75 6e 73 69  67 6e 65 64 20 63 68 61  |.   unsigned cha|
000017d0  72 20 74 65 6d 70 5f 62  75 66 66 65 72 5b 32 35  |r temp_buffer[25|
000017e0  35 5d 3b 0a 0a 20 20 20  2f 2a 20 46 69 6e 64 20  |5];..   /* Find |
000017f0  6f 75 74 20 77 68 65 72  65 20 74 68 65 20 69 63  |out where the ic|
00001800  6f 6e 27 73 20 69 6e 64  69 72 65 63 74 65 64 20  |on's indirected |
00001810  74 65 78 74 20 69 73 20  73 74 6f 72 65 64 20 69  |text is stored i|
00001820  6e 20 6d 65 6d 6f 72 79  20 61 6e 64 20 63 6f 70  |n memory and cop|
00001830  79 0a 20 20 20 20 20 20  61 20 6e 65 77 20 73 74  |y.      a new st|
00001840  72 69 6e 67 20 74 6f 20  69 74 20 2a 2f 0a 20 20  |ring to it */.  |
00001850  20 74 65 78 74 5f 70 6f  69 6e 74 65 72 20 3d 20  | text_pointer = |
00001860  61 75 5f 67 65 74 5f 70  74 72 5f 74 6f 5f 69 63  |au_get_ptr_to_ic|
00001870  6f 6e 74 65 78 74 28 77  69 6e 5f 68 2c 20 69 63  |ontext(win_h, ic|
00001880  6f 6e 5f 68 29 3b 0a 20  20 20 73 74 72 63 70 79  |on_h);.   strcpy|
00001890  28 74 65 78 74 5f 70 6f  69 6e 74 65 72 2c 20 74  |(text_pointer, t|
000018a0  65 78 74 29 3b 0a 0a 20  20 20 2f 2a 20 4e 6f 77  |ext);..   /* Now|
000018b0  20 77 65 20 6e 65 65 64  20 74 6f 20 69 6e 66 6f  | we need to info|
000018c0  72 6d 20 74 68 65 20 57  49 4d 50 20 74 68 61 74  |rm the WIMP that|
000018d0  20 74 68 65 20 69 63 6f  6e 20 6e 65 65 64 73 20  | the icon needs |
000018e0  72 65 64 72 61 77 69 6e  67 20 62 79 20 73 65 74  |redrawing by set|
000018f0  74 69 6e 67 0a 20 20 20  20 20 20 74 68 65 20 69  |ting.      the i|
00001900  63 6f 6e 20 66 6c 61 67  73 20 2d 20 77 65 20 64  |con flags - we d|
00001910  6f 6e 27 74 20 61 63 74  75 61 6c 6c 79 20 63 68  |on't actually ch|
00001920  61 6e 67 65 20 74 68 65  6d 20 77 69 74 68 20 74  |ange them with t|
00001930  68 69 73 20 63 61 6c 6c  2c 20 62 75 74 20 74 68  |his call, but th|
00001940  69 73 0a 20 20 20 20 20  20 73 70 75 72 73 20 74  |is.      spurs t|
00001950  68 65 20 57 49 4d 50 20  69 6e 74 6f 20 61 63 74  |he WIMP into act|
00001960  69 6f 6e 20 2a 2f 0a 0a  20 20 20 61 75 5f 77 6f  |ion */..   au_wo|
00001970  72 64 74 6f 62 79 74 65  28 77 69 6e 5f 68 2c 20  |rdtobyte(win_h, |
00001980  74 65 6d 70 5f 62 75 66  66 65 72 2c 20 30 29 3b  |temp_buffer, 0);|
00001990  0a 20 20 20 61 75 5f 77  6f 72 64 74 6f 62 79 74  |.   au_wordtobyt|
000019a0  65 28 69 63 6f 6e 5f 68  2c 20 74 65 6d 70 5f 62  |e(icon_h, temp_b|
000019b0  75 66 66 65 72 2c 20 34  29 3b 0a 20 20 20 61 75  |uffer, 4);.   au|
000019c0  5f 77 6f 72 64 74 6f 62  79 74 65 28 30 2c 20 74  |_wordtobyte(0, t|
000019d0  65 6d 70 5f 62 75 66 66  65 72 2c 20 38 29 3b 0a  |emp_buffer, 8);.|
000019e0  20 20 20 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |   au_wordtobyte|
000019f0  28 30 2c 20 74 65 6d 70  5f 62 75 66 66 65 72 2c  |(0, temp_buffer,|
00001a00  20 31 32 29 3b 0a 0a 20  20 20 72 65 67 73 5f 69  | 12);..   regs_i|
00001a10  6e 2e 72 5b 31 5d 20 3d  20 28 69 6e 74 29 20 74  |n.r[1] = (int) t|
00001a20  65 6d 70 5f 62 75 66 66  65 72 3b 0a 0a 20 20 20  |emp_buffer;..   |
00001a30  5f 6b 65 72 6e 65 6c 5f  73 77 69 28 57 69 6d 70  |_kernel_swi(Wimp|
00001a40  5f 53 65 74 49 63 6f 6e  53 74 61 74 65 2c 20 26  |_SetIconState, &|
00001a50  72 65 67 73 5f 69 6e 2c  20 26 72 65 67 73 5f 6f  |regs_in, &regs_o|
00001a60  75 74 29 3b 0a 20 20 20  72 65 74 75 72 6e 3b 0a  |ut);.   return;.|
00001a70  7d 0a 0a 76 6f 69 64 0a  61 75 5f 69 63 6f 6e 5f  |}..void.au_icon_|
00001a80  67 65 74 5f 74 65 78 74  28 63 68 61 72 20 2a 64  |get_text(char *d|
00001a90  65 73 74 5f 73 74 72 69  6e 67 2c 20 75 6e 73 69  |est_string, unsi|
00001aa0  67 6e 65 64 20 6c 6f 6e  67 20 69 6e 74 20 77 69  |gned long int wi|
00001ab0  6e 5f 68 64 6c 2c 20 75  6e 73 69 67 6e 65 64 20  |n_hdl, unsigned |
00001ac0  6c 6f 6e 67 20 69 6e 74  20 69 63 6f 6e 5f 68 64  |long int icon_hd|
00001ad0  6c 29 0a 7b 0a 09 63 68  61 72 09 2a 74 65 78 74  |l).{..char.*text|
00001ae0  5f 70 6f 69 6e 74 65 72  3b 0a 0a 09 2f 2a 20 41  |_pointer;.../* A|
00001af0  73 73 75 6d 65 73 20 64  65 73 74 5f 73 74 72 69  |ssumes dest_stri|
00001b00  6e 67 20 68 61 73 20 65  6e 6f 75 67 68 20 73 70  |ng has enough sp|
00001b10  61 63 65 20 2a 2f 0a 09  74 65 78 74 5f 70 6f 69  |ace */..text_poi|
00001b20  6e 74 65 72 20 3d 20 61  75 5f 67 65 74 5f 70 74  |nter = au_get_pt|
00001b30  72 5f 74 6f 5f 69 63 6f  6e 74 65 78 74 28 77 69  |r_to_icontext(wi|
00001b40  6e 5f 68 64 6c 2c 20 69  63 6f 6e 5f 68 64 6c 29  |n_hdl, icon_hdl)|
00001b50  3b 0a 09 73 74 72 63 70  79 28 64 65 73 74 5f 73  |;..strcpy(dest_s|
00001b60  74 72 69 6e 67 2c 20 74  65 78 74 5f 70 6f 69 6e  |tring, text_poin|
00001b70  74 65 72 29 3b 0a 09 72  65 74 75 72 6e 3b 0a 7d  |ter);..return;.}|
00001b80  0a 0a 63 68 61 72 20 2a  0a 61 75 5f 67 65 74 5f  |..char *.au_get_|
00001b90  70 74 72 5f 74 6f 5f 69  63 6f 6e 74 65 78 74 28  |ptr_to_icontext(|
00001ba0  75 6e 73 69 67 6e 65 64  20 6c 6f 6e 67 20 69 6e  |unsigned long in|
00001bb0  74 20 77 69 6e 68 64 6c  2c 20 75 6e 73 69 67 6e  |t winhdl, unsign|
00001bc0  65 64 20 6c 6f 6e 67 20  69 6e 74 20 69 63 6f 6e  |ed long int icon|
00001bd0  68 64 6c 29 0a 7b 0a 20  20 20 2f 2a 20 54 68 69  |hdl).{.   /* Thi|
00001be0  73 20 70 72 6f 63 65 64  75 72 65 20 69 6e 74 65  |s procedure inte|
00001bf0  72 72 6f 67 61 74 65 73  20 61 6e 20 69 63 6f 6e  |rrogates an icon|
00001c00  20 74 6f 20 64 65 74 65  72 6d 69 6e 65 20 74 68  | to determine th|
00001c10  65 20 61 64 64 72 65 73  73 20 77 68 65 72 65 20  |e address where |
00001c20  69 74 73 0a 20 20 20 20  20 20 69 6e 64 69 72 65  |its.      indire|
00001c30  63 74 65 64 20 74 65 78  74 20 64 61 74 61 20 69  |cted text data i|
00001c40  73 20 73 74 6f 72 65 64  20 69 6e 20 6d 65 6d 6f  |s stored in memo|
00001c50  72 79 2c 20 61 6e 64 20  72 65 74 75 72 6e 73 20  |ry, and returns |
00001c60  69 74 20 2a 2f 0a 0a 20  20 20 75 6e 73 69 67 6e  |it */..   unsign|
00001c70  65 64 20 63 68 61 72 20  74 65 6d 70 5f 62 75 66  |ed char temp_buf|
00001c80  66 65 72 5b 32 35 35 5d  3b 0a 20 20 20 5f 6b 65  |fer[255];.   _ke|
00001c90  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 20 72 65  |rnel_swi_regs re|
00001ca0  67 73 5f 69 6e 2c 20 72  65 67 73 5f 6f 75 74 3b  |gs_in, regs_out;|
00001cb0  0a 20 20 20 63 68 61 72  20 2a 72 65 73 75 6c 74  |.   char *result|
00001cc0  3b 0a 0a 20 20 20 61 75  5f 77 6f 72 64 74 6f 62  |;..   au_wordtob|
00001cd0  79 74 65 28 77 69 6e 68  64 6c 2c 20 74 65 6d 70  |yte(winhdl, temp|
00001ce0  5f 62 75 66 66 65 72 2c  20 30 29 3b 0a 20 20 20  |_buffer, 0);.   |
00001cf0  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 69 63  |au_wordtobyte(ic|
00001d00  6f 6e 68 64 6c 2c 20 74  65 6d 70 5f 62 75 66 66  |onhdl, temp_buff|
00001d10  65 72 2c 20 34 29 3b 0a  0a 20 20 20 72 65 67 73  |er, 4);..   regs|
00001d20  5f 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  |_in.r[1] = (int)|
00001d30  20 74 65 6d 70 5f 62 75  66 66 65 72 3b 0a 20 20  | temp_buffer;.  |
00001d40  20 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  | _kernel_swi(Wim|
00001d50  70 5f 47 65 74 49 63 6f  6e 53 74 61 74 65 2c 20  |p_GetIconState, |
00001d60  26 72 65 67 73 5f 69 6e  2c 20 26 72 65 67 73 5f  |&regs_in, &regs_|
00001d70  6f 75 74 29 3b 0a 0a 20  20 20 72 65 73 75 6c 74  |out);..   result|
00001d80  20 3d 20 28 63 68 61 72  20 2a 29 20 61 75 5f 62  | = (char *) au_b|
00001d90  79 74 65 74 6f 77 6f 72  64 28 74 65 6d 70 5f 62  |ytetoword(temp_b|
00001da0  75 66 66 65 72 2c 20 32  38 29 3b 0a 20 20 20 72  |uffer, 28);.   r|
00001db0  65 74 75 72 6e 20 72 65  73 75 6c 74 3b 0a 7d 0a  |eturn result;.}.|
00001dc0  0a 76 6f 69 64 0a 61 75  5f 62 75 69 6c 64 6d 65  |.void.au_buildme|
00001dd0  6e 75 28 63 68 61 72 20  2a 74 69 74 6c 65 2c 20  |nu(char *title, |
00001de0  6d 65 6e 75 5f 64 61 74  61 20 2a 6d 65 6e 75 5f  |menu_data *menu_|
00001df0  64 61 74 29 0a 7b 0a 09  69 66 28 73 74 72 6c 65  |dat).{..if(strle|
00001e00  6e 28 74 69 74 6c 65 29  20 3e 20 31 31 29 20 72  |n(title) > 11) r|
00001e10  65 74 75 72 6e 3b 20 2f  2a 20 44 6f 20 74 68 69  |eturn; /* Do thi|
00001e20  73 20 6d 6f 72 65 20 6e  65 61 74 6c 79 21 20 2a  |s more neatly! *|
00001e30  2f 0a 09 2f 2a 20 46 69  6c 6c 20 69 6e 20 74 68  |/../* Fill in th|
00001e40  65 20 6d 65 6e 75 20 68  65 61 64 65 72 20 77 69  |e menu header wi|
00001e50  74 68 20 73 74 61 6e 64  61 72 64 20 69 6e 66 6f  |th standard info|
00001e60  72 6d 61 74 69 6f 6e 20  2a 2f 0a 09 73 74 72 63  |rmation */..strc|
00001e70  70 79 28 6d 65 6e 75 5f  64 61 74 2d 3e 74 69 74  |py(menu_dat->tit|
00001e80  6c 65 2c 20 74 69 74 6c  65 29 3b 0a 09 6d 65 6e  |le, title);..men|
00001e90  75 5f 64 61 74 2d 3e 63  6f 6c 6f 75 72 73 20 3d  |u_dat->colours =|
00001ea0  20 4d 45 4e 55 5f 54 49  54 4c 45 46 4f 52 45 20  | MENU_TITLEFORE |
00001eb0  7c 20 4d 45 4e 55 5f 54  49 54 4c 45 42 41 43 4b  || MENU_TITLEBACK|
00001ec0  20 7c 20 4d 45 4e 55 5f  57 4f 52 4b 46 4f 52 45  | | MENU_WORKFORE|
00001ed0  20 7c 20 4d 45 4e 55 5f  57 4f 52 4b 42 41 43 4b  | | MENU_WORKBACK|
00001ee0  3b 0a 09 6d 65 6e 75 5f  64 61 74 2d 3e 77 69 64  |;..menu_dat->wid|
00001ef0  74 68 20 3d 20 4d 45 4e  55 5f 57 49 44 54 48 3b  |th = MENU_WIDTH;|
00001f00  0a 09 6d 65 6e 75 5f 64  61 74 2d 3e 68 65 69 67  |..menu_dat->heig|
00001f10  68 74 20 3d 20 4d 45 4e  55 5f 48 45 49 47 48 54  |ht = MENU_HEIGHT|
00001f20  3b 0a 09 6d 65 6e 75 5f  64 61 74 2d 3e 76 65 72  |;..menu_dat->ver|
00001f30  74 5f 67 61 70 20 3d 20  4d 45 4e 55 5f 56 45 52  |t_gap = MENU_VER|
00001f40  54 47 41 50 3b 0a 09 6d  65 6e 75 5f 64 61 74 2d  |TGAP;..menu_dat-|
00001f50  3e 6e 65 78 74 5f 6d 65  6e 75 65 6c 65 6d 20 3d  |>next_menuelem =|
00001f60  20 4e 55 4c 4c 3b 0a 09  6d 65 6e 75 5f 64 61 74  | NULL;..menu_dat|
00001f70  2d 3e 73 69 7a 65 20 3d  20 73 69 7a 65 6f 66 28  |->size = sizeof(|
00001f80  6d 65 6e 75 5f 64 61 74  61 29 3b 0a 09 72 65 74  |menu_data);..ret|
00001f90  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |urn;.}..void.au_|
00001fa0  61 64 64 74 6f 6d 65 6e  75 28 63 68 61 72 20 2a  |addtomenu(char *|
00001fb0  74 65 78 74 2c 20 6c 6f  6e 67 20 69 6e 74 20 6d  |text, long int m|
00001fc0  65 6e 75 5f 66 6c 61 67  73 2c 20 6c 6f 6e 67 20  |enu_flags, long |
00001fd0  69 6e 74 20 73 75 62 6d  65 6e 75 2c 20 6c 6f 6e  |int submenu, lon|
00001fe0  67 20 69 6e 74 20 69 63  6f 6e 5f 66 6c 61 67 73  |g int icon_flags|
00001ff0  2c 20 6d 65 6e 75 5f 64  61 74 61 20 2a 0a 6d 65  |, menu_data *.me|
00002000  6e 75 5f 64 61 74 29 0a  7b 0a 09 6d 65 6e 75 5f  |nu_dat).{..menu_|
00002010  65 6c 65 6d 65 6e 74 20  2a 70 6f 69 6e 74 65 72  |element *pointer|
00002020  3b 0a 0a 09 69 66 28 73  74 72 6c 65 6e 28 74 65  |;...if(strlen(te|
00002030  78 74 29 20 3e 20 31 31  29 20 72 65 74 75 72 6e  |xt) > 11) return|
00002040  3b 0a 09 2f 2a 20 57 6f  72 6b 20 6f 75 72 20 77  |;../* Work our w|
00002050  61 79 20 74 6f 20 65 6e  64 20 6f 66 20 6d 65 6e  |ay to end of men|
00002060  75 20 6c 69 73 74 20 2a  2f 0a 09 69 66 28 6d 65  |u list */..if(me|
00002070  6e 75 5f 64 61 74 2d 3e  6e 65 78 74 5f 6d 65 6e  |nu_dat->next_men|
00002080  75 65 6c 65 6d 20 3d 3d  20 4e 55 4c 4c 29 20 7b  |uelem == NULL) {|
00002090  0a 09 09 6d 65 6e 75 5f  64 61 74 2d 3e 6e 65 78  |...menu_dat->nex|
000020a0  74 5f 6d 65 6e 75 65 6c  65 6d 20 3d 20 63 61 6c  |t_menuelem = cal|
000020b0  6c 6f 63 28 31 2c 20 73  69 7a 65 6f 66 28 6d 65  |loc(1, sizeof(me|
000020c0  6e 75 5f 65 6c 65 6d 65  6e 74 29 29 3b 0a 09 09  |nu_element));...|
000020d0  6d 65 6e 75 5f 64 61 74  2d 3e 73 69 7a 65 20 2b  |menu_dat->size +|
000020e0  3d 20 73 69 7a 65 6f 66  28 6d 65 6e 75 5f 65 6c  |= sizeof(menu_el|
000020f0  65 6d 65 6e 74 29 3b 0a  09 09 70 6f 69 6e 74 65  |ement);...pointe|
00002100  72 20 3d 20 6d 65 6e 75  5f 64 61 74 2d 3e 6e 65  |r = menu_dat->ne|
00002110  78 74 5f 6d 65 6e 75 65  6c 65 6d 3b 0a 09 7d 20  |xt_menuelem;..} |
00002120  65 6c 73 65 20 7b 0a 09  09 70 6f 69 6e 74 65 72  |else {...pointer|
00002130  20 3d 20 6d 65 6e 75 5f  64 61 74 2d 3e 6e 65 78  | = menu_dat->nex|
00002140  74 5f 6d 65 6e 75 65 6c  65 6d 3b 0a 09 09 77 68  |t_menuelem;...wh|
00002150  69 6c 65 20 28 70 6f 69  6e 74 65 72 2d 3e 6e 65  |ile (pointer->ne|
00002160  78 74 5f 6d 65 6e 75 65  6c 65 6d 20 21 3d 20 30  |xt_menuelem != 0|
00002170  29 20 7b 0a 09 09 09 70  6f 69 6e 74 65 72 20 3d  |) {....pointer =|
00002180  20 70 6f 69 6e 74 65 72  2d 3e 6e 65 78 74 5f 6d  | pointer->next_m|
00002190  65 6e 75 65 6c 65 6d 3b  0a 09 09 7d 0a 09 09 70  |enuelem;...}...p|
000021a0  6f 69 6e 74 65 72 2d 3e  6e 65 78 74 5f 6d 65 6e  |ointer->next_men|
000021b0  75 65 6c 65 6d 20 3d 20  63 61 6c 6c 6f 63 28 31  |uelem = calloc(1|
000021c0  2c 20 73 69 7a 65 6f 66  28 6d 65 6e 75 5f 65 6c  |, sizeof(menu_el|
000021d0  65 6d 65 6e 74 29 29 3b  0a 09 09 6d 65 6e 75 5f  |ement));...menu_|
000021e0  64 61 74 2d 3e 73 69 7a  65 20 2b 3d 20 73 69 7a  |dat->size += siz|
000021f0  65 6f 66 28 6d 65 6e 75  5f 65 6c 65 6d 65 6e 74  |eof(menu_element|
00002200  29 3b 0a 09 09 70 6f 69  6e 74 65 72 20 3d 20 70  |);...pointer = p|
00002210  6f 69 6e 74 65 72 2d 3e  6e 65 78 74 5f 6d 65 6e  |ointer->next_men|
00002220  75 65 6c 65 6d 3b 0a 09  7d 0a 09 2f 2a 20 73 65  |uelem;..}../* se|
00002230  74 20 75 70 20 64 61 74  61 20 2a 2f 0a 09 73 74  |t up data */..st|
00002240  72 63 70 79 28 70 6f 69  6e 74 65 72 2d 3e 6d 65  |rcpy(pointer->me|
00002250  6e 75 5f 74 65 78 74 2c  20 74 65 78 74 29 3b 0a  |nu_text, text);.|
00002260  09 70 6f 69 6e 74 65 72  2d 3e 66 6c 61 67 73 20  |.pointer->flags |
00002270  3d 20 6d 65 6e 75 5f 66  6c 61 67 73 3b 0a 09 70  |= menu_flags;..p|
00002280  6f 69 6e 74 65 72 2d 3e  73 75 62 6d 65 6e 75 20  |ointer->submenu |
00002290  3d 20 73 75 62 6d 65 6e  75 3b 0a 0a 09 2f 2a 20  |= submenu;.../* |
000022a0  41 70 70 6c 79 20 73 74  61 6e 64 61 72 64 20 69  |Apply standard i|
000022b0  63 6f 6e 20 66 6c 61 67  73 20 2a 2f 0a 09 69 63  |con flags */..ic|
000022c0  6f 6e 5f 66 6c 61 67 73  20 3d 20 69 63 6f 6e 5f  |on_flags = icon_|
000022d0  66 6c 61 67 73 20 7c 20  4d 45 4e 55 49 54 45 4d  |flags | MENUITEM|
000022e0  5f 46 4f 52 45 20 7c 20  4d 45 4e 55 49 54 45 4d  |_FORE | MENUITEM|
000022f0  5f 42 41 43 4b 20 7c 20  49 43 4f 4e 5f 49 53 54  |_BACK | ICON_IST|
00002300  45 58 54 20 7c 20 49 43  4f 4e 5f 49 53 46 49 4c  |EXT | ICON_ISFIL|
00002310  4c 45 44 3b 0a 09 70 6f  69 6e 74 65 72 2d 3e 6d  |LED;..pointer->m|
00002320  65 6e 75 5f 69 63 6f 6e  66 6c 61 67 73 20 3d 20  |enu_iconflags = |
00002330  69 63 6f 6e 5f 66 6c 61  67 73 3b 0a 09 72 65 74  |icon_flags;..ret|
00002340  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |urn;.}..void.au_|
00002350  63 72 65 61 74 65 6d 65  6e 75 28 6d 65 6e 75 5f  |createmenu(menu_|
00002360  64 61 74 61 20 2a 6d 65  6e 75 5f 64 61 74 29 0a  |data *menu_dat).|
00002370  7b 0a 09 6d 65 6e 75 5f  65 6c 65 6d 65 6e 74 09  |{..menu_element.|
00002380  2a 70 6f 69 6e 74 65 72  3b 0a 09 69 6e 74 09 69  |*pointer;..int.i|
00002390  3b 0a 0a 09 2f 2a 20 41  73 73 69 67 6e 20 6d 65  |;.../* Assign me|
000023a0  6d 6f 72 79 20 2a 2f 0a  09 6d 65 6e 75 5f 64 61  |mory */..menu_da|
000023b0  74 2d 3e 64 61 74 61 62  6c 6f 63 6b 20 3d 20 63  |t->datablock = c|
000023c0  61 6c 6c 6f 63 28 31 2c  20 6d 65 6e 75 5f 64 61  |alloc(1, menu_da|
000023d0  74 2d 3e 73 69 7a 65 29  3b 0a 09 2f 2a 20 42 65  |t->size);../* Be|
000023e0  67 69 6e 20 63 6f 70 79  69 6e 67 20 64 61 74 61  |gin copying data|
000023f0  20 2a 2f 0a 09 73 74 72  63 70 79 28 28 63 68 61  | */..strcpy((cha|
00002400  72 20 2a 29 6d 65 6e 75  5f 64 61 74 2d 3e 64 61  |r *)menu_dat->da|
00002410  74 61 62 6c 6f 63 6b 2c  20 6d 65 6e 75 5f 64 61  |tablock, menu_da|
00002420  74 2d 3e 74 69 74 6c 65  29 3b 0a 09 61 75 5f 77  |t->title);..au_w|
00002430  6f 72 64 74 6f 62 79 74  65 28 6d 65 6e 75 5f 64  |ordtobyte(menu_d|
00002440  61 74 2d 3e 63 6f 6c 6f  75 72 73 2c 20 6d 65 6e  |at->colours, men|
00002450  75 5f 64 61 74 2d 3e 64  61 74 61 62 6c 6f 63 6b  |u_dat->datablock|
00002460  2c 20 31 32 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |, 12);..au_wordt|
00002470  6f 62 79 74 65 28 6d 65  6e 75 5f 64 61 74 2d 3e  |obyte(menu_dat->|
00002480  77 69 64 74 68 2c 20 6d  65 6e 75 5f 64 61 74 2d  |width, menu_dat-|
00002490  3e 64 61 74 61 62 6c 6f  63 6b 2c 20 31 36 29 3b  |>datablock, 16);|
000024a0  0a 09 61 75 5f 77 6f 72  64 74 6f 62 79 74 65 28  |..au_wordtobyte(|
000024b0  6d 65 6e 75 5f 64 61 74  2d 3e 68 65 69 67 68 74  |menu_dat->height|
000024c0  2c 20 6d 65 6e 75 5f 64  61 74 2d 3e 64 61 74 61  |, menu_dat->data|
000024d0  62 6c 6f 63 6b 2c 20 32  30 29 3b 0a 09 61 75 5f  |block, 20);..au_|
000024e0  77 6f 72 64 74 6f 62 79  74 65 28 6d 65 6e 75 5f  |wordtobyte(menu_|
000024f0  64 61 74 2d 3e 76 65 72  74 5f 67 61 70 2c 20 6d  |dat->vert_gap, m|
00002500  65 6e 75 5f 64 61 74 2d  3e 64 61 74 61 62 6c 6f  |enu_dat->datablo|
00002510  63 6b 2c 20 32 34 29 3b  0a 09 2f 2a 20 65 6e 64  |ck, 24);../* end|
00002520  20 6f 66 20 68 65 61 64  65 72 20 69 6e 66 6f 20  | of header info |
00002530  2a 2f 0a 09 69 20 3d 20  32 38 3b 0a 0a 09 70 6f  |*/..i = 28;...po|
00002540  69 6e 74 65 72 20 3d 20  6d 65 6e 75 5f 64 61 74  |inter = menu_dat|
00002550  2d 3e 6e 65 78 74 5f 6d  65 6e 75 65 6c 65 6d 3b  |->next_menuelem;|
00002560  0a 0a 09 77 68 69 6c 65  28 70 6f 69 6e 74 65 72  |...while(pointer|
00002570  20 21 3d 20 4e 55 4c 4c  29 20 7b 0a 0a 09 09 61  | != NULL) {....a|
00002580  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 70 6f 69  |u_wordtobyte(poi|
00002590  6e 74 65 72 2d 3e 66 6c  61 67 73 2c 20 6d 65 6e  |nter->flags, men|
000025a0  75 5f 64 61 74 2d 3e 64  61 74 61 62 6c 6f 63 6b  |u_dat->datablock|
000025b0  2c 20 69 29 3b 0a 09 09  69 20 2b 3d 20 34 3b 0a  |, i);...i += 4;.|
000025c0  09 09 61 75 5f 77 6f 72  64 74 6f 62 79 74 65 28  |..au_wordtobyte(|
000025d0  70 6f 69 6e 74 65 72 2d  3e 73 75 62 6d 65 6e 75  |pointer->submenu|
000025e0  2c 20 6d 65 6e 75 5f 64  61 74 2d 3e 64 61 74 61  |, menu_dat->data|
000025f0  62 6c 6f 63 6b 2c 20 69  29 3b 0a 09 09 69 20 2b  |block, i);...i +|
00002600  3d 20 34 3b 0a 09 09 61  75 5f 77 6f 72 64 74 6f  |= 4;...au_wordto|
00002610  62 79 74 65 28 70 6f 69  6e 74 65 72 2d 3e 6d 65  |byte(pointer->me|
00002620  6e 75 5f 69 63 6f 6e 66  6c 61 67 73 2c 20 6d 65  |nu_iconflags, me|
00002630  6e 75 5f 64 61 74 2d 3e  64 61 74 61 62 6c 6f 63  |nu_dat->databloc|
00002640  6b 2c 20 69 29 3b 0a 09  09 69 20 2b 3d 20 34 3b  |k, i);...i += 4;|
00002650  0a 09 09 73 74 72 63 70  79 28 28 63 68 61 72 20  |...strcpy((char |
00002660  2a 29 20 26 6d 65 6e 75  5f 64 61 74 2d 3e 64 61  |*) &menu_dat->da|
00002670  74 61 62 6c 6f 63 6b 5b  69 5d 2c 20 70 6f 69 6e  |tablock[i], poin|
00002680  74 65 72 2d 3e 6d 65 6e  75 5f 74 65 78 74 29 3b  |ter->menu_text);|
00002690  0a 09 09 69 20 2b 3d 20  31 32 3b 0a 09 09 70 6f  |...i += 12;...po|
000026a0  69 6e 74 65 72 20 3d 20  70 6f 69 6e 74 65 72 2d  |inter = pointer-|
000026b0  3e 6e 65 78 74 5f 6d 65  6e 75 65 6c 65 6d 3b 0a  |>next_menuelem;.|
000026c0  09 7d 0a 09 72 65 74 75  72 6e 3b 0a 7d 0a 0a 76  |.}..return;.}..v|
000026d0  6f 69 64 0a 61 75 5f 6f  70 65 6e 6d 65 6e 75 28  |oid.au_openmenu(|
000026e0  6d 65 6e 75 5f 64 61 74  61 20 2a 6d 65 6e 75 5f  |menu_data *menu_|
000026f0  64 61 74 2c 20 69 6e 74  20 6d 6f 75 73 65 5f 78  |dat, int mouse_x|
00002700  2c 20 69 6e 74 20 6d 6f  75 73 65 5f 79 29 0a 7b  |, int mouse_y).{|
00002710  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 5f 72 65  |.._kernel_swi_re|
00002720  67 73 09 72 65 67 73 5f  69 6e 2c 20 72 65 67 73  |gs.regs_in, regs|
00002730  5f 6f 75 74 3b 0a 0a 09  72 65 67 73 5f 69 6e 2e  |_out;...regs_in.|
00002740  72 5b 31 5d 20 3d 20 28  69 6e 74 29 20 6d 65 6e  |r[1] = (int) men|
00002750  75 5f 64 61 74 2d 3e 64  61 74 61 62 6c 6f 63 6b  |u_dat->datablock|
00002760  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 32 5d 20  |;..regs_in.r[2] |
00002770  3d 20 6d 6f 75 73 65 5f  78 3b 0a 09 72 65 67 73  |= mouse_x;..regs|
00002780  5f 69 6e 2e 72 5b 33 5d  20 3d 20 6d 6f 75 73 65  |_in.r[3] = mouse|
00002790  5f 79 3b 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |_y;.._kernel_swi|
000027a0  28 57 69 6d 70 5f 43 72  65 61 74 65 4d 65 6e 75  |(Wimp_CreateMenu|
000027b0  2c 20 26 72 65 67 73 5f  69 6e 2c 20 26 72 65 67  |, &regs_in, &reg|
000027c0  73 5f 6f 75 74 29 3b 0a  09 72 65 74 75 72 6e 3b  |s_out);..return;|
000027d0  0a 7d 0a 0a 76 6f 69 64  0a 61 75 5f 6c 6f 73 65  |.}..void.au_lose|
000027e0  63 61 72 65 74 28 76 6f  69 64 29 0a 7b 0a 09 5f  |caret(void).{.._|
000027f0  6b 65 72 6e 65 6c 5f 73  77 69 5f 72 65 67 73 09  |kernel_swi_regs.|
00002800  72 65 67 73 5f 69 6e 2c  20 72 65 67 73 5f 6f 75  |regs_in, regs_ou|
00002810  74 3b 0a 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 30  |t;...regs_in.r[0|
00002820  5d 20 3d 20 2d 31 3b 0a  09 72 65 67 73 5f 69 6e  |] = -1;..regs_in|
00002830  2e 72 5b 31 5d 20 3d 20  2d 31 3b 0a 09 72 65 67  |.r[1] = -1;..reg|
00002840  73 5f 69 6e 2e 72 5b 30  5d 20 3d 20 2d 31 3b 0a  |s_in.r[0] = -1;.|
00002850  09 72 65 67 73 5f 69 6e  2e 72 5b 30 5d 20 3d 20  |.regs_in.r[0] = |
00002860  2d 31 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 34  |-1;..regs_in.r[4|
00002870  5d 20 3d 20 2d 31 3b 0a  09 72 65 67 73 5f 69 6e  |] = -1;..regs_in|
00002880  2e 72 5b 35 5d 20 3d 20  2d 31 3b 0a 0a 09 5f 6b  |.r[5] = -1;..._k|
00002890  65 72 6e 65 6c 5f 73 77  69 28 57 69 6d 70 5f 53  |ernel_swi(Wimp_S|
000028a0  65 74 43 61 72 65 74 50  6f 73 69 74 69 6f 6e 2c  |etCaretPosition,|
000028b0  20 26 72 65 67 73 5f 69  6e 2c 20 26 72 65 67 73  | &regs_in, &regs|
000028c0  5f 6f 75 74 29 3b 0a 7d  0a 0a 76 6f 69 64 0a 61  |_out);.}..void.a|
000028d0  75 5f 64 72 61 67 62 6f  78 28 75 6e 73 69 67 6e  |u_dragbox(unsign|
000028e0  65 64 20 6c 6f 6e 67 20  69 6e 74 20 77 69 6e 68  |ed long int winh|
000028f0  64 6c 2c 20 75 6e 73 69  67 6e 65 64 20 6c 6f 6e  |dl, unsigned lon|
00002900  67 20 69 6e 74 20 69 63  6f 6e 68 64 6c 29 0a 7b  |g int iconhdl).{|
00002910  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 5f 72 65  |.._kernel_swi_re|
00002920  67 73 09 72 65 67 73 5f  69 6e 2c 20 72 65 67 73  |gs.regs_in, regs|
00002930  5f 6f 75 74 3b 0a 09 75  6e 73 69 67 6e 65 64 20  |_out;..unsigned |
00002940  63 68 61 72 09 74 65 6d  70 5f 62 75 66 66 65 72  |char.temp_buffer|
00002950  5b 32 35 36 5d 3b 0a 09  75 6e 73 69 67 6e 65 64  |[256];..unsigned|
00002960  20 63 68 61 72 09 74 65  6d 70 5f 62 75 66 66 65  | char.temp_buffe|
00002970  72 32 5b 32 35 36 5d 3b  0a 09 6c 6f 6e 67 20 69  |r2[256];..long i|
00002980  6e 74 09 6d 69 6e 5f 78  2c 20 6d 69 6e 5f 79 2c  |nt.min_x, min_y,|
00002990  20 6d 61 78 5f 78 2c 20  6d 61 78 5f 79 20 3d 20  | max_x, max_y = |
000029a0  30 3b 0a 0a 09 2f 2a 20  47 65 74 20 73 6f 6d 65  |0;.../* Get some|
000029b0  20 69 63 6f 6e 20 69 6e  66 6f 72 6d 61 74 69 6f  | icon informatio|
000029c0  6e 20 2a 2f 0a 09 61 75  5f 67 65 74 69 63 6f 6e  |n */..au_geticon|
000029d0  69 6e 66 6f 28 77 69 6e  68 64 6c 2c 20 69 63 6f  |info(winhdl, ico|
000029e0  6e 68 64 6c 2c 20 74 65  6d 70 5f 62 75 66 66 65  |nhdl, temp_buffe|
000029f0  72 32 29 3b 0a 0a 09 61  75 5f 77 6f 72 64 74 6f  |r2);...au_wordto|
00002a00  62 79 74 65 28 77 69 6e  68 64 6c 2c 20 74 65 6d  |byte(winhdl, tem|
00002a10  70 5f 62 75 66 66 65 72  2c 20 30 29 3b 0a 09 61  |p_buffer, 0);..a|
00002a20  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 53 41 56  |u_wordtobyte(SAV|
00002a30  45 44 52 41 47 5f 54 59  50 45 2c 20 74 65 6d 70  |EDRAG_TYPE, temp|
00002a40  5f 62 75 66 66 65 72 2c  20 34 29 3b 0a 0a 09 2f  |_buffer, 4);.../|
00002a50  2a 20 43 6f 70 79 20 69  6e 20 6d 61 78 20 61 6e  |* Copy in max an|
00002a60  64 20 6d 69 6e 20 63 6f  6f 72 64 69 6e 61 74 65  |d min coordinate|
00002a70  73 20 66 6f 72 20 62 6f  75 6e 64 69 6e 67 20 62  |s for bounding b|
00002a80  6f 78 20 2a 2f 0a 09 6d  69 6e 5f 78 20 3d 20 61  |ox */..min_x = a|
00002a90  75 5f 62 79 74 65 74 6f  77 6f 72 64 28 74 65 6d  |u_bytetoword(tem|
00002aa0  70 5f 62 75 66 66 65 72  32 2c 20 38 29 3b 0a 09  |p_buffer2, 8);..|
00002ab0  6d 69 6e 5f 79 20 3d 20  61 75 5f 62 79 74 65 74  |min_y = au_bytet|
00002ac0  6f 77 6f 72 64 28 74 65  6d 70 5f 62 75 66 66 65  |oword(temp_buffe|
00002ad0  72 32 2c 20 31 32 29 3b  0a 09 6d 61 78 5f 78 20  |r2, 12);..max_x |
00002ae0  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
00002af0  74 65 6d 70 5f 62 75 66  66 65 72 32 2c 20 31 36  |temp_buffer2, 16|
00002b00  29 3b 0a 09 6d 61 78 5f  79 20 3d 20 61 75 5f 62  |);..max_y = au_b|
00002b10  79 74 65 74 6f 77 6f 72  64 28 74 65 6d 70 5f 62  |ytetoword(temp_b|
00002b20  75 66 66 65 72 32 2c 20  32 30 29 3b 0a 0a 09 61  |uffer2, 20);...a|
00002b30  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 77 69 6e  |u_wordtobyte(win|
00002b40  68 64 6c 2c 20 74 65 6d  70 5f 62 75 66 66 65 72  |hdl, temp_buffer|
00002b50  32 2c 20 30 29 3b 0a 09  72 65 67 73 5f 69 6e 2e  |2, 0);..regs_in.|
00002b60  72 5b 31 5d 20 3d 20 28  69 6e 74 29 20 74 65 6d  |r[1] = (int) tem|
00002b70  70 5f 62 75 66 66 65 72  32 3b 0a 09 5f 6b 65 72  |p_buffer2;.._ker|
00002b80  6e 65 6c 5f 73 77 69 28  57 69 6d 70 5f 47 65 74  |nel_swi(Wimp_Get|
00002b90  57 69 6e 64 6f 77 53 74  61 74 65 2c 20 26 72 65  |WindowState, &re|
00002ba0  67 73 5f 69 6e 2c 20 26  72 65 67 73 5f 6f 75 74  |gs_in, &regs_out|
00002bb0  29 3b 0a 0a 09 6d 69 6e  5f 78 20 2b 3d 20 61 75  |);...min_x += au|
00002bc0  5f 62 79 74 65 74 6f 77  6f 72 64 28 74 65 6d 70  |_bytetoword(temp|
00002bd0  5f 62 75 66 66 65 72 32  2c 20 34 29 3b 0a 09 6d  |_buffer2, 4);..m|
00002be0  61 78 5f 78 20 2b 3d 20  61 75 5f 62 79 74 65 74  |ax_x += au_bytet|
00002bf0  6f 77 6f 72 64 28 74 65  6d 70 5f 62 75 66 66 65  |oword(temp_buffe|
00002c00  72 32 2c 20 34 29 3b 0a  09 6d 69 6e 5f 78 20 2d  |r2, 4);..min_x -|
00002c10  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
00002c20  74 65 6d 70 5f 62 75 66  66 65 72 32 2c 20 32 30  |temp_buffer2, 20|
00002c30  29 3b 0a 09 6d 61 78 5f  78 20 2d 3d 20 61 75 5f  |);..max_x -= au_|
00002c40  62 79 74 65 74 6f 77 6f  72 64 28 74 65 6d 70 5f  |bytetoword(temp_|
00002c50  62 75 66 66 65 72 32 2c  20 32 30 29 3b 0a 09 6d  |buffer2, 20);..m|
00002c60  69 6e 5f 79 20 2b 3d 20  61 75 5f 62 79 74 65 74  |in_y += au_bytet|
00002c70  6f 77 6f 72 64 28 74 65  6d 70 5f 62 75 66 66 65  |oword(temp_buffe|
00002c80  72 32 2c 20 31 36 29 3b  0a 09 6d 61 78 5f 79 20  |r2, 16);..max_y |
00002c90  2b 3d 20 61 75 5f 62 79  74 65 74 6f 77 6f 72 64  |+= au_bytetoword|
00002ca0  28 74 65 6d 70 5f 62 75  66 66 65 72 32 2c 20 31  |(temp_buffer2, 1|
00002cb0  36 29 3b 0a 09 6d 69 6e  5f 79 20 2d 3d 20 61 75  |6);..min_y -= au|
00002cc0  5f 62 79 74 65 74 6f 77  6f 72 64 28 74 65 6d 70  |_bytetoword(temp|
00002cd0  5f 62 75 66 66 65 72 32  2c 20 32 34 29 3b 0a 09  |_buffer2, 24);..|
00002ce0  6d 61 78 5f 79 20 2d 3d  20 61 75 5f 62 79 74 65  |max_y -= au_byte|
00002cf0  74 6f 77 6f 72 64 28 74  65 6d 70 5f 62 75 66 66  |toword(temp_buff|
00002d00  65 72 32 2c 20 32 34 29  3b 0a 0a 0a 09 61 75 5f  |er2, 24);....au_|
00002d10  77 6f 72 64 74 6f 62 79  74 65 28 6d 69 6e 5f 78  |wordtobyte(min_x|
00002d20  2c 20 74 65 6d 70 5f 62  75 66 66 65 72 2c 20 38  |, temp_buffer, 8|
00002d30  29 3b 0a 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |);..au_wordtobyt|
00002d40  65 28 6d 69 6e 5f 79 2c  20 74 65 6d 70 5f 62 75  |e(min_y, temp_bu|
00002d50  66 66 65 72 2c 20 31 32  29 3b 0a 09 61 75 5f 77  |ffer, 12);..au_w|
00002d60  6f 72 64 74 6f 62 79 74  65 28 6d 61 78 5f 78 2c  |ordtobyte(max_x,|
00002d70  20 74 65 6d 70 5f 62 75  66 66 65 72 2c 20 31 36  | temp_buffer, 16|
00002d80  29 3b 0a 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |);..au_wordtobyt|
00002d90  65 28 6d 61 78 5f 79 2c  20 74 65 6d 70 5f 62 75  |e(max_y, temp_bu|
00002da0  66 66 65 72 2c 20 32 30  29 3b 0a 09 61 75 5f 77  |ffer, 20);..au_w|
00002db0  6f 72 64 74 6f 62 79 74  65 28 30 2c 20 74 65 6d  |ordtobyte(0, tem|
00002dc0  70 5f 62 75 66 66 65 72  2c 20 32 34 29 3b 0a 09  |p_buffer, 24);..|
00002dd0  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 30 2c  |au_wordtobyte(0,|
00002de0  20 74 65 6d 70 5f 62 75  66 66 65 72 2c 20 32 38  | temp_buffer, 28|
00002df0  29 3b 0a 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |);..au_wordtobyt|
00002e00  65 28 30 2c 20 74 65 6d  70 5f 62 75 66 66 65 72  |e(0, temp_buffer|
00002e10  2c 20 33 32 29 3b 0a 09  61 75 5f 77 6f 72 64 74  |, 32);..au_wordt|
00002e20  6f 62 79 74 65 28 30 2c  20 74 65 6d 70 5f 62 75  |obyte(0, temp_bu|
00002e30  66 66 65 72 2c 20 33 36  29 3b 0a 0a 0a 2f 2a 70  |ffer, 36);.../*p|
00002e40  72 69 6e 74 66 28 22 5c  66 25 6c 64 20 25 6c 64  |rintf("\f%ld %ld|
00002e50  20 25 6c 64 20 25 6c 64  5c 6e 22 2c 20 6d 69 6e  | %ld %ld\n", min|
00002e60  5f 78 2c 20 6d 69 6e 5f  79 2c 20 6d 61 78 5f 78  |_x, min_y, max_x|
00002e70  2c 20 6d 61 78 5f 79 29  3b 2a 2f 0a 0a 0a 09 72  |, max_y);*/....r|
00002e80  65 67 73 5f 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |egs_in.r[1] = (i|
00002e90  6e 74 29 20 74 65 6d 70  5f 62 75 66 66 65 72 3b  |nt) temp_buffer;|
00002ea0  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |.._kernel_swi(Wi|
00002eb0  6d 70 5f 44 72 61 67 42  6f 78 2c 20 26 72 65 67  |mp_DragBox, &reg|
00002ec0  73 5f 69 6e 2c 20 26 72  65 67 73 5f 6f 75 74 29  |s_in, &regs_out)|
00002ed0  3b 0a 09 2f 2a 20 54 68  65 20 65 6e 64 2d 6f 66  |;../* The end-of|
00002ee0  2d 64 72 61 67 20 73 68  6f 75 6c 64 20 62 65 20  |-drag should be |
00002ef0  63 61 75 67 68 74 20 77  69 74 68 20 74 68 65 20  |caught with the |
00002f00  61 70 70 72 6f 70 72 69  61 74 65 20 70 6f 6c 6c  |appropriate poll|
00002f10  20 6d 65 73 73 61 67 65  20 2a 2f 0a 09 72 65 74  | message */..ret|
00002f20  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |urn;.}..void.au_|
00002f30  67 65 74 69 63 6f 6e 69  6e 66 6f 28 75 6e 73 69  |geticoninfo(unsi|
00002f40  67 6e 65 64 20 6c 6f 6e  67 20 69 6e 74 20 77 69  |gned long int wi|
00002f50  6e 68 64 6c 2c 20 75 6e  73 69 67 6e 65 64 20 6c  |nhdl, unsigned l|
00002f60  6f 6e 67 20 69 6e 74 20  69 63 6f 6e 68 64 6c 2c  |ong int iconhdl,|
00002f70  20 75 6e 73 69 67 6e 65  64 20 63 68 61 72 20 2a  | unsigned char *|
00002f80  62 75 66 66 65 72 29 0a  7b 0a 09 5f 6b 65 72 6e  |buffer).{.._kern|
00002f90  65 6c 5f 73 77 69 5f 72  65 67 73 09 72 65 67 73  |el_swi_regs.regs|
00002fa0  5f 69 6e 2c 20 72 65 67  73 5f 6f 75 74 3b 0a 0a  |_in, regs_out;..|
00002fb0  09 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 77  |.au_wordtobyte(w|
00002fc0  69 6e 68 64 6c 2c 20 62  75 66 66 65 72 2c 20 30  |inhdl, buffer, 0|
00002fd0  29 3b 0a 09 61 75 5f 77  6f 72 64 74 6f 62 79 74  |);..au_wordtobyt|
00002fe0  65 28 69 63 6f 6e 68 64  6c 2c 20 62 75 66 66 65  |e(iconhdl, buffe|
00002ff0  72 2c 20 34 29 3b 0a 09  72 65 67 73 5f 69 6e 2e  |r, 4);..regs_in.|
00003000  72 5b 31 5d 20 3d 20 28  69 6e 74 29 20 62 75 66  |r[1] = (int) buf|
00003010  66 65 72 3b 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |fer;.._kernel_sw|
00003020  69 28 57 69 6d 70 5f 47  65 74 49 63 6f 6e 53 74  |i(Wimp_GetIconSt|
00003030  61 74 65 2c 20 26 72 65  67 73 5f 69 6e 2c 20 26  |ate, &regs_in, &|
00003040  72 65 67 73 5f 6f 75 74  29 3b 0a 09 72 65 74 75  |regs_out);..retu|
00003050  72 6e 3b 0a 7d 0a 0a 76  6f 69 64 0a 61 75 5f 67  |rn;.}..void.au_g|
00003060  65 74 70 6f 69 6e 74 65  72 69 6e 66 6f 28 70 6f  |etpointerinfo(po|
00003070  69 6e 74 65 72 5f 64 61  74 61 20 2a 70 6f 69 6e  |inter_data *poin|
00003080  74 65 72 5f 69 6e 66 6f  29 0a 7b 0a 09 5f 6b 65  |ter_info).{.._ke|
00003090  72 6e 65 6c 5f 73 77 69  5f 72 65 67 73 09 72 65  |rnel_swi_regs.re|
000030a0  67 73 5f 69 6e 2c 20 72  65 67 73 5f 6f 75 74 3b  |gs_in, regs_out;|
000030b0  0a 09 75 6e 73 69 67 6e  65 64 20 63 68 61 72 09  |..unsigned char.|
000030c0  74 65 6d 70 5f 62 6c 6b  5b 31 30 32 34 5d 3b 0a  |temp_blk[1024];.|
000030d0  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 31 5d 20 3d  |..regs_in.r[1] =|
000030e0  20 28 69 6e 74 29 20 74  65 6d 70 5f 62 6c 6b 3b  | (int) temp_blk;|
000030f0  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 57 69  |.._kernel_swi(Wi|
00003100  6d 70 5f 47 65 74 50 6f  69 6e 74 65 72 49 6e 66  |mp_GetPointerInf|
00003110  6f 2c 20 26 72 65 67 73  5f 69 6e 2c 20 26 72 65  |o, &regs_in, &re|
00003120  67 73 5f 6f 75 74 29 3b  0a 09 70 6f 69 6e 74 65  |gs_out);..pointe|
00003130  72 5f 69 6e 66 6f 2d 3e  6d 6f 75 73 65 5f 78 20  |r_info->mouse_x |
00003140  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
00003150  74 65 6d 70 5f 62 6c 6b  2c 20 30 29 3b 0a 09 70  |temp_blk, 0);..p|
00003160  6f 69 6e 74 65 72 5f 69  6e 66 6f 2d 3e 6d 6f 75  |ointer_info->mou|
00003170  73 65 5f 79 20 3d 20 61  75 5f 62 79 74 65 74 6f  |se_y = au_byteto|
00003180  77 6f 72 64 28 74 65 6d  70 5f 62 6c 6b 2c 20 34  |word(temp_blk, 4|
00003190  29 3b 0a 09 70 6f 69 6e  74 65 72 5f 69 6e 66 6f  |);..pointer_info|
000031a0  2d 3e 62 75 74 74 6f 6e  5f 73 74 61 74 65 20 3d  |->button_state =|
000031b0  20 61 75 5f 62 79 74 65  74 6f 77 6f 72 64 28 74  | au_bytetoword(t|
000031c0  65 6d 70 5f 62 6c 6b 2c  20 38 29 3b 0a 09 70 6f  |emp_blk, 8);..po|
000031d0  69 6e 74 65 72 5f 69 6e  66 6f 2d 3e 77 69 6e 5f  |inter_info->win_|
000031e0  68 61 6e 64 6c 65 20 3d  20 61 75 5f 62 79 74 65  |handle = au_byte|
000031f0  74 6f 77 6f 72 64 28 74  65 6d 70 5f 62 6c 6b 2c  |toword(temp_blk,|
00003200  20 31 32 29 3b 0a 09 70  6f 69 6e 74 65 72 5f 69  | 12);..pointer_i|
00003210  6e 66 6f 2d 3e 69 63 6f  6e 5f 68 61 6e 64 6c 65  |nfo->icon_handle|
00003220  20 3d 20 61 75 5f 62 79  74 65 74 6f 77 6f 72 64  | = au_bytetoword|
00003230  28 74 65 6d 70 5f 62 6c  6b 2c 20 31 36 29 3b 0a  |(temp_blk, 16);.|
00003240  09 72 65 74 75 72 6e 3b  0a 7d 0a 0a 76 6f 69 64  |.return;.}..void|
00003250  0a 61 75 5f 64 61 74 61  73 61 76 65 28 70 6f 69  |.au_datasave(poi|
00003260  6e 74 65 72 5f 64 61 74  61 20 70 6f 69 6e 74 65  |nter_data pointe|
00003270  72 5f 69 6e 66 6f 2c 20  69 6e 74 20 73 69 7a 65  |r_info, int size|
00003280  2c 20 69 6e 74 20 66 69  6c 65 74 79 70 65 2c 20  |, int filetype, |
00003290  63 68 61 72 20 2a 6c 65  61 66 6e 61 6d 65 29 0a  |char *leafname).|
000032a0  7b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 5f 72  |{.._kernel_swi_r|
000032b0  65 67 73 09 72 65 67 73  5f 69 6e 2c 20 72 65 67  |egs.regs_in, reg|
000032c0  73 5f 6f 75 74 3b 0a 09  69 6e 74 20 62 6c 6f 63  |s_out;..int bloc|
000032d0  6b 5f 6c 65 6e 67 74 68  20 3d 20 35 36 3b 0a 09  |k_length = 56;..|
000032e0  75 6e 73 69 67 6e 65 64  20 63 68 61 72 09 74 65  |unsigned char.te|
000032f0  6d 70 5f 62 6c 6b 5b 31  30 32 34 5d 3b 0a 0a 09  |mp_blk[1024];...|
00003300  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 62 6c  |au_wordtobyte(bl|
00003310  6f 63 6b 5f 6c 65 6e 67  74 68 2c 20 74 65 6d 70  |ock_length, temp|
00003320  5f 62 6c 6b 2c 20 30 29  3b 0a 09 2f 2a 20 54 68  |_blk, 0);../* Th|
00003330  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 74 77 6f 20  |e following two |
00003340  61 72 65 6e 27 74 20 75  73 65 64 20 6f 6e 20 65  |aren't used on e|
00003350  6e 74 72 79 20 2a 2f 0a  09 61 75 5f 77 6f 72 64  |ntry */..au_word|
00003360  74 6f 62 79 74 65 28 30  2c 20 74 65 6d 70 5f 62  |tobyte(0, temp_b|
00003370  6c 6b 2c 20 34 29 3b 0a  09 61 75 5f 77 6f 72 64  |lk, 4);..au_word|
00003380  74 6f 62 79 74 65 28 30  2c 20 74 65 6d 70 5f 62  |tobyte(0, temp_b|
00003390  6c 6b 2c 20 38 29 3b 0a  09 2f 2a 20 54 68 69 73  |lk, 8);../* This|
000033a0  20 6e 65 78 74 20 76 61  6c 75 65 20 73 65 74 73  | next value sets|
000033b0  20 79 6f 75 72 5f 72 65  66 20 74 6f 20 30 2c 20  | your_ref to 0, |
000033c0  6d 65 61 6e 69 6e 67 20  69 74 27 73 20 61 6e 20  |meaning it's an |
000033d0  6f 72 69 67 69 6e 61 6c  20 6d 65 73 73 61 67 65  |original message|
000033e0  20 2a 2f 0a 09 61 75 5f  77 6f 72 64 74 6f 62 79  | */..au_wordtoby|
000033f0  74 65 28 30 2c 20 74 65  6d 70 5f 62 6c 6b 2c 20  |te(0, temp_blk, |
00003400  31 32 29 3b 0a 09 61 75  5f 77 6f 72 64 74 6f 62  |12);..au_wordtob|
00003410  79 74 65 28 4d 45 53 53  41 47 45 5f 44 41 54 41  |yte(MESSAGE_DATA|
00003420  53 41 56 45 2c 20 74 65  6d 70 5f 62 6c 6b 2c 20  |SAVE, temp_blk, |
00003430  31 36 29 3b 0a 0a 09 2f  2a 20 43 6f 70 79 20 74  |16);.../* Copy t|
00003440  68 65 20 64 61 74 61 20  66 72 6f 6d 20 70 6f 69  |he data from poi|
00003450  6e 74 65 72 5f 69 6e 66  6f 20 74 6f 20 74 68 65  |nter_info to the|
00003460  20 74 65 6d 70 20 62 6c  6f 63 6b 20 2a 2f 0a 09  | temp block */..|
00003470  61 75 5f 77 6f 72 64 74  6f 62 79 74 65 28 70 6f  |au_wordtobyte(po|
00003480  69 6e 74 65 72 5f 69 6e  66 6f 2e 77 69 6e 5f 68  |inter_info.win_h|
00003490  61 6e 64 6c 65 2c 20 74  65 6d 70 5f 62 6c 6b 2c  |andle, temp_blk,|
000034a0  20 32 30 29 3b 0a 09 61  75 5f 77 6f 72 64 74 6f  | 20);..au_wordto|
000034b0  62 79 74 65 28 70 6f 69  6e 74 65 72 5f 69 6e 66  |byte(pointer_inf|
000034c0  6f 2e 69 63 6f 6e 5f 68  61 6e 64 6c 65 2c 20 74  |o.icon_handle, t|
000034d0  65 6d 70 5f 62 6c 6b 2c  20 32 34 29 3b 0a 09 61  |emp_blk, 24);..a|
000034e0  75 5f 77 6f 72 64 74 6f  62 79 74 65 28 70 6f 69  |u_wordtobyte(poi|
000034f0  6e 74 65 72 5f 69 6e 66  6f 2e 6d 6f 75 73 65 5f  |nter_info.mouse_|
00003500  78 2c 20 74 65 6d 70 5f  62 6c 6b 2c 20 32 38 29  |x, temp_blk, 28)|
00003510  3b 0a 09 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |;..au_wordtobyte|
00003520  28 70 6f 69 6e 74 65 72  5f 69 6e 66 6f 2e 6d 6f  |(pointer_info.mo|
00003530  75 73 65 5f 79 2c 20 74  65 6d 70 5f 62 6c 6b 2c  |use_y, temp_blk,|
00003540  20 33 32 29 3b 0a 0a 09  61 75 5f 77 6f 72 64 74  | 32);...au_wordt|
00003550  6f 62 79 74 65 28 73 69  7a 65 2c 20 74 65 6d 70  |obyte(size, temp|
00003560  5f 62 6c 6b 2c 20 33 36  29 3b 0a 09 61 75 5f 77  |_blk, 36);..au_w|
00003570  6f 72 64 74 6f 62 79 74  65 28 66 69 6c 65 74 79  |ordtobyte(filety|
00003580  70 65 2c 20 74 65 6d 70  5f 62 6c 6b 2c 20 34 30  |pe, temp_blk, 40|
00003590  29 3b 0a 09 2f 2a 20 54  68 65 20 66 6f 6c 6c 6f  |);../* The follo|
000035a0  77 69 6e 67 20 6d 75 73  74 20 62 65 20 7a 65 72  |wing must be zer|
000035b0  6f 2d 74 65 72 6d 69 6e  61 74 65 64 2c 20 62 75  |o-terminated, bu|
000035c0  74 20 74 68 69 73 20 73  68 6f 75 6c 64 20 62 65  |t this should be|
000035d0  20 2a 2f 0a 09 2f 2a 20  74 61 6b 65 6e 20 63 61  | */../* taken ca|
000035e0  72 65 20 6f 66 20 66 6f  72 20 75 73 20 2a 2f 0a  |re of for us */.|
000035f0  09 73 74 72 63 70 79 28  28 63 68 61 72 20 2a 29  |.strcpy((char *)|
00003600  20 26 74 65 6d 70 5f 62  6c 6b 5b 34 34 5d 2c 20  | &temp_blk[44], |
00003610  6c 65 61 66 6e 61 6d 65  29 3b 0a 0a 09 72 65 67  |leafname);...reg|
00003620  73 5f 69 6e 2e 72 5b 30  5d 20 3d 20 31 37 3b 0a  |s_in.r[0] = 17;.|
00003630  09 72 65 67 73 5f 69 6e  2e 72 5b 31 5d 20 3d 20  |.regs_in.r[1] = |
00003640  28 69 6e 74 29 20 26 74  65 6d 70 5f 62 6c 6b 3b  |(int) &temp_blk;|
00003650  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 32 5d 20 3d  |..regs_in.r[2] =|
00003660  20 28 69 6e 74 29 20 70  6f 69 6e 74 65 72 5f 69  | (int) pointer_i|
00003670  6e 66 6f 2e 77 69 6e 5f  68 61 6e 64 6c 65 3b 0a  |nfo.win_handle;.|
00003680  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 57 69 6d  |._kernel_swi(Wim|
00003690  70 5f 53 65 6e 64 4d 65  73 73 61 67 65 2c 20 26  |p_SendMessage, &|
000036a0  72 65 67 73 5f 69 6e 2c  20 26 72 65 67 73 5f 6f  |regs_in, &regs_o|
000036b0  75 74 29 3b 0a 7d 0a 0a  69 6e 74 0a 61 75 5f 66  |ut);.}..int.au_f|
000036c0  69 6e 64 66 6f 6e 74 28  63 68 61 72 20 2a 66 6f  |indfont(char *fo|
000036d0  6e 74 6e 61 6d 65 2c 20  69 6e 74 20 66 6f 6e 74  |ntname, int font|
000036e0  73 69 7a 65 2c 20 69 6e  74 20 66 6f 6e 74 72 65  |size, int fontre|
000036f0  73 29 0a 7b 0a 09 5f 6b  65 72 6e 65 6c 5f 73 77  |s).{.._kernel_sw|
00003700  69 5f 72 65 67 73 20 69  6e 2c 20 6f 75 74 3b 0a  |i_regs in, out;.|
00003710  0a 09 69 6e 2e 72 5b 31  5d 20 3d 20 28 69 6e 74  |..in.r[1] = (int|
00003720  29 20 66 6f 6e 74 6e 61  6d 65 3b 0a 09 69 6e 2e  |) fontname;..in.|
00003730  72 5b 32 5d 20 3d 20 69  6e 2e 72 5b 33 5d 20 3d  |r[2] = in.r[3] =|
00003740  20 66 6f 6e 74 73 69 7a  65 3b 0a 09 69 6e 2e 72  | fontsize;..in.r|
00003750  5b 34 5d 20 3d 20 69 6e  2e 72 5b 35 5d 20 3d 20  |[4] = in.r[5] = |
00003760  66 6f 6e 74 72 65 73 3b  0a 09 5f 6b 65 72 6e 65  |fontres;.._kerne|
00003770  6c 5f 73 77 69 28 46 6f  6e 74 5f 46 69 6e 64 46  |l_swi(Font_FindF|
00003780  6f 6e 74 2c 20 26 69 6e  2c 20 26 6f 75 74 29 3b  |ont, &in, &out);|
00003790  0a 09 72 65 74 75 72 6e  20 6f 75 74 2e 72 5b 30  |..return out.r[0|
000037a0  5d 3b 0a 7d 0a 0a 76 6f  69 64 0a 61 75 5f 73 65  |];.}..void.au_se|
000037b0  6c 65 63 74 66 6f 6e 74  28 69 6e 74 20 66 6f 6e  |lectfont(int fon|
000037c0  74 68 61 6e 64 6c 65 29  0a 7b 0a 09 5f 6b 65 72  |thandle).{.._ker|
000037d0  6e 65 6c 5f 73 77 69 5f  72 65 67 73 20 69 6e 2c  |nel_swi_regs in,|
000037e0  20 6f 75 74 3b 0a 09 69  6e 2e 72 5b 30 5d 20 3d  | out;..in.r[0] =|
000037f0  20 66 6f 6e 74 68 61 6e  64 6c 65 3b 0a 09 5f 6b  | fonthandle;.._k|
00003800  65 72 6e 65 6c 5f 73 77  69 28 46 6f 6e 74 5f 53  |ernel_swi(Font_S|
00003810  65 74 46 6f 6e 74 2c 20  26 69 6e 2c 20 26 6f 75  |etFont, &in, &ou|
00003820  74 29 3b 0a 7d 0a 0a 76  6f 69 64 0a 61 75 5f 73  |t);.}..void.au_s|
00003830  65 74 66 6f 6e 74 63 6f  6c 6f 75 72 73 28 69 6e  |etfontcolours(in|
00003840  74 20 62 61 63 6b 67 72  6f 75 6e 64 2c 20 69 6e  |t background, in|
00003850  74 20 66 6f 72 65 67 72  6f 75 6e 64 29 0a 7b 0a  |t foreground).{.|
00003860  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 5f 72 65 67  |._kernel_swi_reg|
00003870  73 20 69 6e 2c 20 6f 75  74 3b 0a 0a 09 69 6e 2e  |s in, out;...in.|
00003880  72 5b 30 5d 20 3d 20 30  3b 0a 09 69 6e 2e 72 5b  |r[0] = 0;..in.r[|
00003890  31 5d 20 3d 20 62 61 63  6b 67 72 6f 75 6e 64 3b  |1] = background;|
000038a0  0a 09 69 6e 2e 72 5b 32  5d 20 3d 20 66 6f 72 65  |..in.r[2] = fore|
000038b0  67 72 6f 75 6e 64 3b 0a  09 69 6e 2e 72 5b 33 5d  |ground;..in.r[3]|
000038c0  20 3d 20 31 34 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  | = 14;.._kernel_|
000038d0  73 77 69 28 43 6f 6c 6f  75 72 54 72 61 6e 73 5f  |swi(ColourTrans_|
000038e0  53 65 74 46 6f 6e 74 43  6f 6c 6f 75 72 73 2c 20  |SetFontColours, |
000038f0  26 69 6e 2c 20 26 6f 75  74 29 3b 0a 7d 0a 0a 76  |&in, &out);.}..v|
00003900  6f 69 64 0a 61 75 5f 66  6f 6e 74 70 61 69 6e 74  |oid.au_fontpaint|
00003910  28 63 68 61 72 20 2a 74  65 78 74 2c 20 69 6e 74  |(char *text, int|
00003920  20 78 5f 63 6f 6f 72 2c  20 69 6e 74 20 79 5f 63  | x_coor, int y_c|
00003930  6f 6f 72 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |oor).{.._kernel_|
00003940  73 77 69 5f 72 65 67 73  20 69 6e 2c 20 6f 75 74  |swi_regs in, out|
00003950  3b 0a 09 69 6e 74 20 66  6f 6e 74 66 6c 61 67 73  |;..int fontflags|
00003960  20 3d 20 31 75 20 3c 3c  20 34 3b 0a 0a 09 69 6e  | = 1u << 4;...in|
00003970  2e 72 5b 31 5d 20 3d 20  28 69 6e 74 29 20 74 65  |.r[1] = (int) te|
00003980  78 74 3b 0a 09 69 6e 2e  72 5b 32 5d 20 3d 20 66  |xt;..in.r[2] = f|
00003990  6f 6e 74 66 6c 61 67 73  3b 0a 09 69 6e 2e 72 5b  |ontflags;..in.r[|
000039a0  33 5d 20 3d 20 78 5f 63  6f 6f 72 2c 0a 09 69 6e  |3] = x_coor,..in|
000039b0  2e 72 5b 34 5d 20 3d 20  79 5f 63 6f 6f 72 2c 0a  |.r[4] = y_coor,.|
000039c0  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 46 6f 6e  |._kernel_swi(Fon|
000039d0  74 5f 50 61 69 6e 74 2c  20 26 69 6e 2c 20 26 6f  |t_Paint, &in, &o|
000039e0  75 74 29 3b 0a 7d 0a 0a  76 6f 69 64 0a 61 75 5f  |ut);.}..void.au_|
000039f0  6c 6f 73 65 66 6f 6e 74  28 69 6e 74 20 66 6f 6e  |losefont(int fon|
00003a00  74 68 61 6e 64 6c 65 29  0a 7b 0a 09 5f 6b 65 72  |thandle).{.._ker|
00003a10  6e 65 6c 5f 73 77 69 5f  72 65 67 73 20 69 6e 2c  |nel_swi_regs in,|
00003a20  20 6f 75 74 3b 0a 0a 09  69 6e 2e 72 5b 30 5d 20  | out;...in.r[0] |
00003a30  3d 20 66 6f 6e 74 68 61  6e 64 6c 65 3b 0a 09 5f  |= fonthandle;.._|
00003a40  6b 65 72 6e 65 6c 5f 73  77 69 28 46 6f 6e 74 5f  |kernel_swi(Font_|
00003a50  4c 6f 73 65 46 6f 6e 74  2c 20 26 69 6e 2c 20 26  |LoseFont, &in, &|
00003a60  6f 75 74 29 3b 0a 7d 0a  0a 76 6f 69 64 0a 61 75  |out);.}..void.au|
00003a70  5f 63 6f 6e 76 65 72 74  77 69 6e 64 6f 77 5f 74  |_convertwindow_t|
00003a80  6f 5f 73 63 72 65 65 6e  28 75 6e 73 69 67 6e 65  |o_screen(unsigne|
00003a90  64 20 63 68 61 72 20 2a  70 6f 6c 6c 62 6c 6f 63  |d char *pollbloc|
00003aa0  6b 2c 20 69 6e 74 20 2a  78 5f 63 6f 6f 72 2c 20  |k, int *x_coor, |
00003ab0  69 6e 74 20 2a 79 5f 63  6f 6f 72 29 0a 7b 0a 09  |int *y_coor).{..|
00003ac0  69 6e 74 20 77 69 6e 78  31 2c 20 77 69 6e 78 32  |int winx1, winx2|
00003ad0  2c 20 77 69 6e 79 31 2c  20 77 69 6e 79 32 3b 0a  |, winy1, winy2;.|
00003ae0  09 69 6e 74 20 73 63 72  6f 6c 6c 78 2c 20 73 63  |.int scrollx, sc|
00003af0  72 6f 6c 6c 79 3b 0a 09  69 6e 74 20 74 65 6d 70  |rolly;..int temp|
00003b00  5f 78 2c 20 74 65 6d 70  5f 79 3b 0a 0a 09 77 69  |_x, temp_y;...wi|
00003b10  6e 78 31 20 3d 20 28 69  6e 74 29 20 61 75 5f 62  |nx1 = (int) au_b|
00003b20  79 74 65 74 6f 77 6f 72  64 28 70 6f 6c 6c 62 6c  |ytetoword(pollbl|
00003b30  6f 63 6b 2c 20 34 29 3b  0a 09 77 69 6e 79 31 20  |ock, 4);..winy1 |
00003b40  3d 20 28 69 6e 74 29 20  61 75 5f 62 79 74 65 74  |= (int) au_bytet|
00003b50  6f 77 6f 72 64 28 70 6f  6c 6c 62 6c 6f 63 6b 2c  |oword(pollblock,|
00003b60  20 38 29 3b 0a 09 77 69  6e 78 32 20 3d 20 28 69  | 8);..winx2 = (i|
00003b70  6e 74 29 20 61 75 5f 62  79 74 65 74 6f 77 6f 72  |nt) au_bytetowor|
00003b80  64 28 70 6f 6c 6c 62 6c  6f 63 6b 2c 20 31 32 29  |d(pollblock, 12)|
00003b90  3b 0a 09 77 69 6e 79 32  20 3d 20 28 69 6e 74 29  |;..winy2 = (int)|
00003ba0  20 61 75 5f 62 79 74 65  74 6f 77 6f 72 64 28 70  | au_bytetoword(p|
00003bb0  6f 6c 6c 62 6c 6f 63 6b  2c 20 31 36 29 3b 0a 0a  |ollblock, 16);..|
00003bc0  09 73 63 72 6f 6c 6c 78  20 3d 20 28 69 6e 74 29  |.scrollx = (int)|
00003bd0  20 61 75 5f 62 79 74 65  74 6f 77 6f 72 64 28 70  | au_bytetoword(p|
00003be0  6f 6c 6c 62 6c 6f 63 6b  2c 20 32 30 29 3b 0a 09  |ollblock, 20);..|
00003bf0  73 63 72 6f 6c 6c 79 20  3d 20 28 69 6e 74 29 20  |scrolly = (int) |
00003c00  61 75 5f 62 79 74 65 74  6f 77 6f 72 64 28 70 6f  |au_bytetoword(po|
00003c10  6c 6c 62 6c 6f 63 6b 2c  20 32 34 29 3b 0a 0a 09  |llblock, 24);...|
00003c20  74 65 6d 70 5f 78 20 3d  20 2a 78 5f 63 6f 6f 72  |temp_x = *x_coor|
00003c30  20 2d 20 73 63 72 6f 6c  6c 78 20 2b 20 77 69 6e  | - scrollx + win|
00003c40  78 31 3b 0a 09 74 65 6d  70 5f 79 20 3d 20 2a 79  |x1;..temp_y = *y|
00003c50  5f 63 6f 6f 72 20 2d 20  73 63 72 6f 6c 6c 79 20  |_coor - scrolly |
00003c60  2b 20 77 69 6e 79 32 3b  0a 09 2a 78 5f 63 6f 6f  |+ winy2;..*x_coo|
00003c70  72 20 3d 20 74 65 6d 70  5f 78 3b 0a 09 2a 79 5f  |r = temp_x;..*y_|
00003c80  63 6f 6f 72 20 3d 20 74  65 6d 70 5f 79 3b 0a 7d  |coor = temp_y;.}|
00003c90  0a                                                |.|
00003c91