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