annotate lisp/prim/device.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 131b0175ea99
children 8619ce7e4c50
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
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (defun device-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 "Return a list of all devices."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (apply 'append (mapcar 'console-device-list (console-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defun device-type (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "Return the type of the specified device (e.g. `x' or `tty').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 This is equivalent to the type of the device's console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 Value is `tty' for a tty device (a character-only terminal),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 `x' for a device that is a screen on an X display,
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
36 `ns' for a device that is a NeXTstep connection (not yet implemented),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 `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
38 implemented),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 `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
40 `stream' for a stream device (which acts like a stdio stream), and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 `dead' for a deleted device."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (or device (setq device (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (if (not (device-live-p device)) 'dead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (console-type (device-console device))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
46 (defun make-tty-device (&optional tty terminal-type controlling-process)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 "Create a new device on TTY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 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
49 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
50 use the stdin and stdout as passed to XEmacs from the shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 If TERMINAL-TYPE is non-nil, it should be a string specifying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 type of the terminal attached to the specified tty. If it is nil,
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
53 the terminal type will be inferred from the TERM environment variable.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
54 If CONTROLLING-PROCESS is non-nil, it should be an integer
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
55 specifying the process id of the process in control of the specified tty. If
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
56 it is nil, it is assumes to be the value returned by emacs-pid."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
57 (make-device 'tty tty (list 'terminal-type terminal-type
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 70
diff changeset
58 'controlling-process controlling-process)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defun make-x-device (&optional display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "Create a new device connected to DISPLAY."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (make-device 'x display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defun device-on-window-system-p (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "Return non-nil if DEVICE is on a window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 This generally means that there is support for the mouse, the menubar,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 the toolbar, glyphs, etc."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (or device (setq device (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (console-on-window-system-p (device-console device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defalias 'valid-device-type-p 'valid-console-type-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defalias 'device-type-list 'console-type-list)