[Top] [Prev] [Next]

devpointer - I/O interface for the pointer device

include "draw.m";   #for Draw->Pointer
include "devpointer.m";
ptr:= load Devpointer Devpointer->PATH;
Devpointer: module
{
  PATH:    con "/dis/lib/devpointer.dis";
   Size:   con 1+3*12;	# 'm' plus 3 12-byte decimal integers
   init:   fn(file: string, posn: 
                chan of ref Draw->Pointer): int;
  bytes2ptr: fn(buf: array of byte)    : ref Draw->Pointer;
  ptr2bytes: fn(ptr: ref Draw->Pointer): array of byte;
};

Description

init (file, posn)

The init function spawns a thread to continually read the pointer device specified by file and sends a Pointer adt (see pointer - state of a pointer device such as a mouse in Chapter 11) over the channel specified by posn. If file is nil, the default device is /dev/pointer.

bytes2ptr (buf)

The bytes2ptr function converts the array of bytes in buf to a Pointer and returns a reference to it. The buf array should consist of exactly Size bytes and be in the format returned by /dev/pointer.

ptr2bytes (ptr)

The ptr2bytes function provides an inverse transformation of the bytes2ptr function.

Files

/dev/pointer

See Also
pointer - state of a pointer device such as a mouse in Chapter 11

draw - graphics device in Chapter 2



[Top] [Prev] [Next]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.