comparison lisp/device.el @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents
children 78f53ef88e17
comparison
equal deleted inserted replaced
208:f427b8ec4379 209:41ff10fd062f
1 ;;; device.el --- miscellaneous device functions not written in C
2
3 ;; Copyright (C) 1994-5, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996 Ben Wing
5
6 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: internal, dumped
8
9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Synched up with: Not in FSF.
27
28 ;;; Commentary:
29
30 ;; This file is dumped with XEmacs.
31
32 ;;; Code:
33
34 (defun device-list ()
35 "Return a list of all devices."
36 (apply 'nconc (mapcar 'console-device-list (console-list))))
37
38 (defun device-type (&optional device)
39 "Return the type of the specified device (e.g. `x' or `tty').
40 This is equivalent to the type of the device's console.
41 Value is `tty' for a tty device (a character-only terminal),
42 `x' for a device that is a screen on an X display,
43 `ns' for a device that is a NeXTstep connection (not yet implemented),
44 `w32' for a device that is a Windows or Windows NT connection,
45 `pc' for a device that is a direct-write MS-DOS screen (not yet implemented),
46 `stream' for a stream device (which acts like a stdio stream), and
47 `dead' for a deleted device."
48 (or device (setq device (selected-device)))
49 (if (not (device-live-p device)) 'dead
50 (console-type (device-console device))))
51
52 (defun make-tty-device (&optional tty terminal-type controlling-process)
53 "Create a new device on TTY.
54 TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under
55 SunOS et al.), as returned by the `tty' command. A value of nil means
56 use the stdin and stdout as passed to XEmacs from the shell.
57 If TERMINAL-TYPE is non-nil, it should be a string specifying the
58 type of the terminal attached to the specified tty. If it is nil,
59 the terminal type will be inferred from the TERM environment variable.
60 If CONTROLLING-PROCESS is non-nil, it should be an integer
61 specifying the process id of the process in control of the specified tty. If
62 it is nil, it is assumes to be the value returned by emacs-pid."
63 (make-device 'tty tty (list 'terminal-type terminal-type
64 'controlling-process controlling-process)))
65
66 (defun make-x-device (&optional display)
67 "Create a new device connected to DISPLAY."
68 (make-device 'x display))
69
70 (defun make-w32-device ()
71 "Create a new win32 device."
72 (make-device 'w32 nil))
73
74 (defun device-on-window-system-p (&optional device)
75 "Return non-nil if DEVICE is on a window system.
76 This generally means that there is support for the mouse, the menubar,
77 the toolbar, glyphs, etc."
78 (or device (setq device (selected-device)))
79 (console-on-window-system-p (device-console device)))
80
81 (defalias 'valid-device-type-p 'valid-console-type-p)
82 (defalias 'device-type-list 'console-type-list)
83 (defalias 'device-pixel-depth 'device-bitplanes)
84
85 ;;; device.el ends here