annotate lisp/prim/device.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 0293115a14e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; device.el --- miscellaneous device functions not written in C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;; Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;;; Copyright (C) 1995, 1996 Ben Wing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (defun device-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 "Return a list of all devices."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (apply 'append (mapcar 'console-device-list (console-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (defun device-type (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 "Return the type of the specified device (e.g. `x' or `tty').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 This is equivalent to the type of the device's console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 Value is `tty' for a tty device (a character-only terminal),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 `x' for a device that is a screen on an X display,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 `ns' for a device that is a NeXTstep connection (not yet implemeted),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 `win32' for a device that is a Windows or Windows NT connection (not yet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 implemented),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 `pc' for a device that is a direct-write MS-DOS screen (not yet implemented),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 `stream' for a stream device (which acts like a stdio stream), and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 `dead' for a deleted device."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (or device (setq device (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (if (not (device-live-p device)) 'dead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (console-type (device-console device))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defun make-tty-device (&optional tty terminal-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "Create a new device on TTY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 SunOS et al.), as returned by the `tty' command. A value of nil means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 use the stdin and stdout as passed to XEmacs from the shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 If TERMINAL-TYPE is non-nil, it should be a string specifying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 type of the terminal attached to the specified tty. If it is nil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 the terminal type will be inferred from the TERM environment variable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (make-device 'tty tty (list 'terminal-type terminal-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (defun make-x-device (&optional display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 "Create a new device connected to DISPLAY."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (make-device 'x display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (defun device-on-window-system-p (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 "Return non-nil if DEVICE is on a window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 This generally means that there is support for the mouse, the menubar,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 the toolbar, glyphs, etc."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (or device (setq device (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (console-on-window-system-p (device-console device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defalias 'valid-device-type-p 'valid-console-type-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defalias 'device-type-list 'console-type-list)