summaryrefslogtreecommitdiff
path: root/static/inferno/man2/devpointer.2
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
commit97d5c458cfa039d857301e1ca7d5af3beb37131d (patch)
treeb460cd850d0537eb71806ba30358840377b27688 /static/inferno/man2/devpointer.2
parentb89dc2331a50c63f8b33272a5c4c61ab98abdaa3 (diff)
build: Better Build System
Diffstat (limited to 'static/inferno/man2/devpointer.2')
-rw-r--r--static/inferno/man2/devpointer.278
1 files changed, 78 insertions, 0 deletions
diff --git a/static/inferno/man2/devpointer.2 b/static/inferno/man2/devpointer.2
new file mode 100644
index 00000000..19c82f13
--- /dev/null
+++ b/static/inferno/man2/devpointer.2
@@ -0,0 +1,78 @@
+.TH DEVPOINTER 2 mux
+.SH NAME
+devpointer \- I/O interface for the pointer device
+.SH SYNOPSIS
+.EX
+include "draw.m"; # for Draw->Pointer
+include "devpointer.m";
+ptr := load Devpointer Devpointer->PATH;
+
+init: fn();
+reader: fn(file: string, posn: chan of ref Draw->Pointer,
+ pid: chan of (int, string));
+bytes2ptr: fn(buf: array of byte) : ref Draw->Pointer;
+ptr2bytes: fn(ptr: ref Draw->Pointer): array of byte;
+.EE
+.SH DESCRIPTION
+.B Devpointer
+reads messages from pointer devices with the same data format as
+.BR /dev/pointer ,
+converting them to
+.B Pointer
+adts.
+.PP
+.B Init
+must be called before any other operation of the module.
+.PP
+.B Reader
+should be spawned by the caller.
+It opens the pointer device specified by
+.IR file ,
+and sends a value
+.BI ( id,\ err )
+on channel
+.IR pid .
+On success,
+.I id
+is the process ID of the spawned process and
+.I err
+is nil; on an error,
+.I err
+is a diagnostic, and
+.I id
+is undefined.
+If the file was opened successfully,
+.B reader
+continually reads the pointer device and sends
+.B Pointer
+adts over the channel
+.IR posn .
+If
+.I file
+is
+.BR nil ,
+the default device is
+.BR /dev/pointer .
+.PP
+.B Bytes2ptr
+converts the array of bytes
+.I buf
+to a
+.B Pointer
+and returns a reference to it.
+.I Buf
+should consist of exactly
+.B Devpointer->Size
+bytes and be in the format returned by
+.BR /dev/pointer .
+.PP
+.B Ptr2bytes
+provides the inverse transformation of
+.BR bytes2ptr :
+it packs the data into an array of bytes of appropriate format,
+which it returns.
+.SH FILES
+.B /dev/pointer
+.SH "SEE ALSO"
+.IR draw-intro (2),
+.IR draw-pointer (2)