Mercurial > emacs
annotate lisp/dos-fns.el @ 12324:41bd44279127
(sigchld_handler): Change XSETFASTINT to XSETINT.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 19 Jun 1995 23:18:54 +0000 |
parents | 5ff133dbb12f |
children | c51fb9c4c780 |
rev | line source |
---|---|
5443 | 1 ;;; dos-fns.el --- MS-Dos specific functions. |
2 | |
5469 | 3 ;; Copyright (C) 1991, 1993 Free Software Foundation, Inc. |
5443 | 4 |
5 ;; Maintainer: Morten Welinder (terra@diku.dk) | |
6 ;; Keywords: internal | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it 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 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;; Part of this code is taken from (or derived from) demacs. | |
27 | |
28 ;;; Code: | |
29 | |
30 (setq-default mode-line-format | |
31 (list (purecopy "") | |
32 'mode-line-modified | |
33 'mode-line-buffer-identification | |
34 (purecopy " ") | |
35 'global-mode-string | |
36 (purecopy " %[(") | |
37 (purecopy "%t:") | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
38 'mode-name 'mode-line-process 'minor-mode-alist |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
39 (purecopy "%n") |
5443 | 40 (purecopy ")%]--") |
41 (purecopy '(line-number-mode "L%l--")) | |
42 (purecopy '(-3 . "%p")) | |
43 (purecopy "-%-"))) | |
44 | |
12253
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
45 ;; 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
|
46 (setq path-separator ";") |
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
47 |
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
48 ;; 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
|
49 (setq grep-null-device "NUL") |
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
50 |
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
51 ;; 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
|
52 (setq grep-regexp-alist |
5ff133dbb12f
(path-separator, grep-null-device, grep-regexp-alist):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
53 '(("^\\(\\([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
|
54 |
5443 | 55 (defvar file-name-buffer-file-type-alist |
56 '( | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
57 ("[:/].*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
|
58 ("\\.elc$" . t) ; emacs stuff |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
59 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t) |
5443 | 60 ; MS-Dos stuff |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
61 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) |
5443 | 62 ; Packers |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
63 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t) |
5443 | 64 ; Unix stuff |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
65 ("\\.tp[ulpw]$" . t) |
5443 | 66 ; Borland Pascal stuff |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
67 ("[:/]tags$" . t) |
5443 | 68 ; Emacs TAGS file |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
69 ) |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
70 "*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
|
71 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
|
72 against the file name, and TYPE is nil for text, t for binary.") |
5443 | 73 |
74 (defun find-buffer-file-type (filename) | |
75 (let ((alist file-name-buffer-file-type-alist) | |
76 (found nil) | |
77 (code nil)) | |
78 (let ((case-fold-search t)) | |
79 (setq filename (file-name-sans-versions filename)) | |
80 (while (and (not found) alist) | |
81 (if (string-match (car (car alist)) filename) | |
82 (setq code (cdr (car alist)) | |
83 found t)) | |
84 (setq alist (cdr alist)))) | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
85 (if found |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
86 (cond((memq code '(nil t)) code) |
5443 | 87 ((and (symbolp code) (fboundp code)) |
88 (funcall code filename))) | |
89 default-buffer-file-type))) | |
90 | |
91 (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
|
92 "Visit file FILENAME and treat it as binary." |
5443 | 93 (interactive "FFind file binary: ") |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
94 (let ((file-name-buffer-file-type-alist '(("" . t)))) |
5443 | 95 (find-file filename))) |
96 | |
97 (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
|
98 "Visit file FILENAME and treat it as a text file." |
5443 | 99 (interactive "FFind file text: ") |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
100 (let ((file-name-buffer-file-type-alist '(("" . nil)))) |
5443 | 101 (find-file filename))) |
102 | |
103 (defun find-file-not-found-set-buffer-file-type () | |
104 (save-excursion | |
105 (set-buffer (current-buffer)) | |
106 (setq buffer-file-type (find-buffer-file-type (buffer-file-name)))) | |
107 nil) | |
108 | |
109 ;;; To set the default file type on new files. | |
110 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type) | |
111 | |
112 (defvar msdos-shells '("command.com" "4dos.com" "ndos.com") | |
113 "*List of shells that use `/c' instead of `-c' and a backslashed command.") | |
114 | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
115 (defconst register-name-alist |
5443 | 116 '((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
|
117 (cflag . 6) (flags . 7) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
118 (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
|
119 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1)))) |
5443 | 120 |
121 (defun make-register () | |
122 (make-vector 8 0)) | |
123 | |
124 (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
|
125 (let ((where (cdr (assoc name register-name-alist)))) |
5443 | 126 (cond ((consp where) |
127 (let ((tem (aref regs (car where)))) | |
128 (if (zerop (cdr where)) | |
129 (% tem 256) | |
130 (/ tem 256)))) | |
131 ((numberp where) | |
132 (aref regs where)) | |
133 (t nil)))) | |
134 | |
135 (defun set-register-value (regs name value) | |
136 (and (numberp value) | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
137 (>= value 0) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
138 (let ((where (cdr (assoc name register-name-alist)))) |
5443 | 139 (cond ((consp where) |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
140 (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
|
141 (value (logand value 255))) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
142 (aset regs |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
143 (car where) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
144 (if (zerop (cdr where)) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
145 (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
|
146 (logior (logand tem 255) (lsh value 8)))))) |
5443 | 147 ((numberp where) |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
148 (aset regs where (logand value 65535)))))) |
5443 | 149 regs) |
150 | |
151 (defsubst intdos (regs) | |
152 (int86 33 regs)) | |
153 | |
9572 | 154 ;; Extra stub to functions in src/frame.c |
155 ;; Emacs aborts during dump if the following don't have a doc string. | |
156 (defun window-frame (window) | |
157 "Return the frame that WINDOW resides on." | |
158 (selected-frame)) | |
159 (defun raise-frame (frame) | |
160 "Raise FRAME to the top of the desktop." | |
161 nil) | |
162 (defun select-frame (frame &optional no-enter) | |
163 "Select FRAME for input events." | |
164 (selected-frame)) |