annotate lisp/dos-fns.el @ 29871:903015affdf0

(eshell-sublist): Use eshell-copy-list instead of copy-list.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 23 Jun 2000 04:53:48 +0000
parents 4a37c3f4cb29
children cf435e74e3ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; dos-fns.el --- MS-Dos specific functions.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
14734
20f4c4a078b2 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 14380
diff changeset
3 ;; Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
17977
727cf56647a4 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 16690
diff changeset
5 ;; Maintainer: Morten Welinder <terra@diku.dk>
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keywords: internal
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; any later version.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14162
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14162
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14162
diff changeset
23 ;; Boston, MA 02111-1307, USA.
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; Part of this code is taken from (or derived from) demacs.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; Code:
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
13913
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
31 ;; This overrides a trivial definition in files.el.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
32 (defun convert-standard-filename (filename)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
33 "Convert a standard file's name to something suitable for the current OS.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
34 This function's standard definition is trivial; it just returns the argument.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
35 However, on some systems, the function is redefined
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
36 with a definition that really does change some file names."
29855
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
37 (if (or (not (stringp filename))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
38 ;; Note: the empty file-name-nondirectory catches the case
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
39 ;; where FILENAME is "x:" or "x:/", thus preventing infinite
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
40 ;; recursion.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
41 (string-match "\\`[a-zA-Z]:[/\\]?\\'" filename))
15187
d46c1e8bdb0d (convert-standard-filename): Test msdos-long-file-names.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
42 filename
29855
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
43 ;; If FILENAME has a trailing slash, remove it and recurse.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
44 (if (memq (aref filename (1- (length filename))) '(?/ ?\\))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
45 (concat (convert-standard-filename
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
46 (substring filename 0 (1- (length filename))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
47 "/")
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
48 (let* ((dir
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
49 ;; If FILENAME is "x:foo", file-name-directory returns
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
50 ;; "x:/bar/baz", substituting the current working
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
51 ;; directory on drive x:. We want to be left with "x:"
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
52 ;; instead.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
53 (if (and (eq (aref filename 1) ?:)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
54 (null (string-match "[/\\]" filename)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
55 (substring filename 0 2)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
56 (file-name-directory filename)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
57 (string (copy-sequence (file-name-nondirectory filename)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
58 (lastchar (aref string (1- (length string))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
59 i firstdot)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
60 (if (msdos-long-file-names)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
61 ;; Replace characters that are invalid even on Windows.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
62 (while (setq i (string-match "[?*:<>|\"\000-\037]" string))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
63 (aset string i ?!))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
64 ;; Change a leading period to a leading underscore.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
65 (if (= (aref string 0) ?.)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
66 (aset string 0 ?_))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
67 ;; Get rid of invalid characters.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
68 (while (setq i (string-match
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
69 "[^-a-zA-Z0-9_.%~^$!#&{}@`'()\200-\376]"
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
70 string))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
71 (aset string i ?_))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
72 ;; If we don't have a period,
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
73 ;; and we have a dash or underscore that isn't the first char,
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
74 ;; change that to a period.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
75 (if (and (not (string-match "\\." string))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
76 (setq i (string-match "[-_]" string 1)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
77 (aset string i ?\.))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
78 ;; If we don't have a period in the first 8 chars, insert one.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
79 (if (> (or (string-match "\\." string)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
80 (length string))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
81 8)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
82 (setq string
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
83 (concat (substring string 0 8)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
84 "."
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
85 (substring string 8))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
86 (setq firstdot (or (string-match "\\." string) (1- (length string))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
87 ;; Truncate to 3 chars after the first period.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
88 (if (> (length string) (+ firstdot 4))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
89 (setq string (substring string 0 (+ firstdot 4))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
90 ;; Change all periods except the first one into underscores.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
91 (while (string-match "\\." string (1+ firstdot))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
92 (setq i (string-match "\\." string (1+ firstdot)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
93 (aset string i ?_))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
94 ;; If the last character of the original filename was `~',
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
95 ;; make sure the munged name ends with it also.
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
96 (if (equal lastchar ?~)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
97 (aset string (1- (length string)) lastchar)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
98 (concat (if (and (stringp dir)
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
99 (memq (aref dir (1- (length dir))) '(?/ ?\\)))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
100 (concat (convert-standard-filename
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
101 (substring dir 0 (1- (length dir))))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
102 "/")
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
103 (convert-standard-filename dir))
4a37c3f4cb29 (convert-standard-filename): Convert leading
Eli Zaretskii <eliz@gnu.org>
parents: 24515
diff changeset
104 string)))))
13913
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
105
22070
d8e53123116c (dos-ps-printer, dos-printer, msdos-shells):
Richard M. Stallman <rms@gnu.org>
parents: 21568
diff changeset
106 ;; See dos-vars.el for defcustom.
d8e53123116c (dos-ps-printer, dos-printer, msdos-shells):
Richard M. Stallman <rms@gnu.org>
parents: 21568
diff changeset
107 (defvar msdos-shells)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
24515
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
109 ;;; Override setting chosen at startup.
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
110 (defun set-default-process-coding-system ()
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
111 (setq default-process-coding-system
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
112 (if default-enable-multibyte-characters
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
113 '(undecided-dos . undecided-dos)
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
114 '(raw-text-dos . raw-text-dos))))
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
115
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
116 (add-hook 'before-init-hook 'set-default-process-coding-system)
ef4a540c34ff (set-default-process-coding-system): Copied from dos-w32.el.
Andrew Innes <andrewi@gnu.org>
parents: 22676
diff changeset
117
16690
97029c2699a7 (register-name-alist): Use defvar.
Richard M. Stallman <rms@gnu.org>
parents: 16027
diff changeset
118 (defvar register-name-alist
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
120 (cflag . 6) (flags . 7)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
121 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
122 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (defun make-register ()
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (make-vector 8 0))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defun register-value (regs name)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
128 (let ((where (cdr (assoc name register-name-alist))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (cond ((consp where)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (let ((tem (aref regs (car where))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (if (zerop (cdr where))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (% tem 256)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (/ tem 256))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 ((numberp where)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (aref regs where))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (t nil))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (defun set-register-value (regs name value)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (and (numberp value)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
140 (>= value 0)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
141 (let ((where (cdr (assoc name register-name-alist))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (cond ((consp where)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
143 (let ((tem (aref regs (car where)))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
144 (value (logand value 255)))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
145 (aset regs
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
146 (car where)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
147 (if (zerop (cdr where))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
148 (logior (logand tem 65280) value)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
149 (logior (logand tem 255) (lsh value 8))))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ((numberp where)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
151 (aset regs where (logand value 65535))))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 regs)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (defsubst intdos (regs)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (int86 33 regs))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
14380
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
157 ;; Backward compatibility for obsolescent functions which
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
158 ;; set screen size.
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
159
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
160 (defun mode25 ()
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
161 "Changes the number of screen rows to 25."
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
162 (interactive)
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
163 (set-frame-size (selected-frame) 80 25))
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
164
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
165 (defun mode4350 ()
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
166 "Changes the number of rows to 43 or 50.
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
167 Emacs always tries to set the screen height to 50 rows first.
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
168 If this fails, it will try to set it to 43 rows, on the assumption
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
169 that your video hardware might not support 50-line mode."
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
170 (interactive)
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
171 (set-frame-size (selected-frame) 80 50)
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
172 (if (eq (frame-height (selected-frame)) 50)
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
173 nil ; the original built-in function returned nil
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
174 (set-frame-size (selected-frame) 80 43)))
874cd82cd2b4 (mode25): Moved from `src/dosfns.c' for backward compatibility.
Richard M. Stallman <rms@gnu.org>
parents: 14189
diff changeset
175
14189
557b3d11a381 (ps-lpr-switches, ps-lpr-command): Just setq them;
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
176 (provide 'dos-fns)
557b3d11a381 (ps-lpr-switches, ps-lpr-command): Just setq them;
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
177
557b3d11a381 (ps-lpr-switches, ps-lpr-command): Just setq them;
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
178 ; dos-fns.el ends here