annotate lisp/dos-fns.el @ 13926:9ea670eb276d

Say djgpp v2 doesn't work.
author Richard M. Stallman <rms@gnu.org>
date Wed, 03 Jan 1996 15:04:26 +0000
parents 4e4201bcea5d
children 15ea2a83edae
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
5469
b22ec3038a64 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 5443
diff changeset
3 ;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Maintainer: Morten Welinder (terra@diku.dk)
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
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; Part of this code is taken from (or derived from) demacs.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Code:
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
13472
c51fb9c4c780 (mode-line-format): Modify it, don't override it entirely.
Richard M. Stallman <rms@gnu.org>
parents: 12253
diff changeset
30 ;;; Add %t: into the mode line format just after the open-paren.
13487
5cff4081b8a6 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 13472
diff changeset
31 (let ((tail (member " %[(" mode-line-format)))
13472
c51fb9c4c780 (mode-line-format): Modify it, don't override it entirely.
Richard M. Stallman <rms@gnu.org>
parents: 12253
diff changeset
32 (setcdr tail (cons (purecopy "%t:")
c51fb9c4c780 (mode-line-format): Modify it, don't override it entirely.
Richard M. Stallman <rms@gnu.org>
parents: 12253
diff changeset
33 (cdr tail))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
12253
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
35 ;; Use ";" instead of ":" as a path separator (from files.el).
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
36 (setq path-separator ";")
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
37
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
38 ;; Set the null device (for compile.el).
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
39 (setq grep-null-device "NUL")
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
40
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
41 ;; Set the grep regexp to match entries with drive letters.
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
42 (setq grep-regexp-alist
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
43 '(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
5ff133dbb12f (path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
44
13913
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
45 ;; 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
46 (defun convert-standard-filename (filename)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
47 "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
48 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
49 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
50 with a definition that really does change some file names."
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
51 (let ((dir (file-name-directory filename))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
52 (string (copy-sequence (file-name-nondirectory filename)))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
53 i firstdot)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
54 ;; Change a leading period to a leading underscore.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
55 (if (= (aref string 0) ?.)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
56 (aset string 0 ?_))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
57 ;; Get rid of invalid characters.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
58 (while (setq i (string-match "[^a-zA-Z0-9_.%~]" string))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
59 (aset string i ?_))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
60 ;; If we don't have a period,
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
61 ;; and we have a dash or underscore that isn't the first char,
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
62 ;; change that to a period.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
63 (if (and (not (string-match "\\." string))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
64 (setq i (string-match "[-_]" string 1)))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
65 (aset string i ?\.))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
66 ;; If we don't have a period in the first 8 chars, insert one.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
67 (if (> (or (string-match "\\." string)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
68 (length string))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
69 8)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
70 (setq string
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
71 (concat (substring string 0 8)
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
72 "."
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
73 (substring string 8))))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
74 (setq firstdot (string-match "\\." string))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
75 ;; Truncate to 3 chars after the first period.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
76 (if (> (length string) (+ firstdot 4))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
77 (setq string (substring string 0 (+ firstdot 4))))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
78 ;; Change all periods except the first one into underscores.
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
79 (while (string-match "\\." string (1+ firstdot))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
80 (setq i (string-match "\\." string (1+ firstdot)))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
81 (aset string i ?_))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
82 (concat dir string)))
4e4201bcea5d (convert-standard-filename): New alternate definition.
Richard M. Stallman <rms@gnu.org>
parents: 13487
diff changeset
83
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (defvar file-name-buffer-file-type-alist
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 '(
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
86 ("[:/].*config.sys$" . nil) ; config.sys text
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
87 ("\\.elc$" . t) ; emacs stuff
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
88 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ; MS-Dos stuff
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
90 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ; Packers
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
92 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ; Unix stuff
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
94 ("\\.tp[ulpw]$" . t)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 ; Borland Pascal stuff
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
96 ("[:/]tags$" . t)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ; Emacs TAGS file
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
98 )
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
99 "*Alist for distinguishing text files from binary files.
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
100 Each element has the form (REGEXP . TYPE), where REGEXP is matched
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
101 against the file name, and TYPE is nil for text, t for binary.")
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (defun find-buffer-file-type (filename)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (let ((alist file-name-buffer-file-type-alist)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (found nil)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (code nil))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (let ((case-fold-search t))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (setq filename (file-name-sans-versions filename))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (while (and (not found) alist)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (if (string-match (car (car alist)) filename)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (setq code (cdr (car alist))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 found t))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (setq alist (cdr alist))))
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
114 (if found
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
115 (cond((memq code '(nil t)) code)
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ((and (symbolp code) (fboundp code))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (funcall code filename)))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 default-buffer-file-type)))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (defun find-file-binary (filename)
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
121 "Visit file FILENAME and treat it as binary."
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (interactive "FFind file binary: ")
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
123 (let ((file-name-buffer-file-type-alist '(("" . t))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (find-file filename)))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defun find-file-text (filename)
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
127 "Visit file FILENAME and treat it as a text file."
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (interactive "FFind file text: ")
7087
57553b30baed (mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents: 5469
diff changeset
129 (let ((file-name-buffer-file-type-alist '(("" . nil))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (find-file filename)))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (defun find-file-not-found-set-buffer-file-type ()
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (save-excursion
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (set-buffer (current-buffer))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 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 ;;; To set the default file type on new files.
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (defvar msdos-shells '("command.com" "4dos.com" "ndos.com")
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 "*List of shells that use `/c' instead of `-c' and a backslashed command.")
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
144 (defconst register-name-alist
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 '((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
146 (cflag . 6) (flags . 7)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
147 (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
148 (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
149
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (defun make-register ()
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (make-vector 8 0))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (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
154 (let ((where (cdr (assoc name register-name-alist))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (cond ((consp where)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (let ((tem (aref regs (car where))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (if (zerop (cdr where))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (% tem 256)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (/ tem 256))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ((numberp where)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (aref regs where))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (t nil))))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (defun set-register-value (regs name value)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (and (numberp value)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
166 (>= value 0)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
167 (let ((where (cdr (assoc name register-name-alist))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (cond ((consp where)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
169 (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
170 (value (logand value 255)))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
171 (aset regs
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
172 (car where)
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
173 (if (zerop (cdr where))
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
174 (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
175 (logior (logand tem 255) (lsh value 8))))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 ((numberp where)
7256
0f06f87f3c3b (set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents: 7087
diff changeset
177 (aset regs where (logand value 65535))))))
5443
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 regs)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (defsubst intdos (regs)
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (int86 33 regs))
391bfbbb9c1d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
183 ;; Extra stub to functions in src/frame.c
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
184 ;; Emacs aborts during dump if the following don't have a doc string.
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
185 (defun window-frame (window)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
186 "Return the frame that WINDOW resides on."
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
187 (selected-frame))
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
188 (defun raise-frame (frame)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
189 "Raise FRAME to the top of the desktop."
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
190 nil)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
191 (defun select-frame (frame &optional no-enter)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
192 "Select FRAME for input events."
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7825
diff changeset
193 (selected-frame))