diff -c emacs-19\lib-src\etags.c:1.1.1.17 emacs-19\lib-src\etags.c:1.24 *** emacs-19\lib-src\etags.c:1.1.1.17 Sun Jun 05 22:59:38 1994 --- emacs-19\lib-src\etags.c Sun Jun 05 22:59:42 1994 *************** *** 17,22 **** --- 17,24 ---- along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* * Authors: * Ctags originally by Ken Arnold. *************** *** 48,53 **** --- 50,59 ---- #include #include + #ifdef EMX + #include + #endif /* EMX */ + #if !defined (S_ISREG) && defined (S_IFREG) # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif *************** *** 413,418 **** --- 419,428 ---- progname = argv[0]; + #ifdef EMX + _wildcard (&argc, &argv); + #endif /* EMX */ + /* * If etags, always find typedefs and structure tags. Why not? * Also default is to find macro constants. *************** *** 3139,3144 **** --- 3149,3168 ---- return strdup (cwd); } #else /* not MSDOS */ + #ifdef EMX + char * + etags_getcwd () + { + char cwd[270]; + int i; + + getcwd (cwd, sizeof (cwd)); + i = strlen (cwd); + if (i > 0 && cwd[i-1] == '/') + cwd[i-1] = 0; + return strdup (cwd); + } + #else /* not EMX */ /* Does the same work as the system V getcwd, but does not need to guess buffer size in advance. Included mostly for compatibility. */ char * *************** *** 3172,3177 **** --- 3196,3202 ---- return buf; } #endif /* not MSDOS */ + #endif /* not EMX */ /* Return a newly allocated string containing the filename of FILE relative to the absolute directory DIR (which diff -c emacs-19\lib-src\hexl.c:1.1.1.4 emacs-19\lib-src\hexl.c:1.12 *** emacs-19\lib-src\hexl.c:1.1.1.4 Sun Jun 05 22:59:52 1994 --- emacs-19\lib-src\hexl.c Sun Jun 05 22:59:54 1994 *************** *** 1,3 **** --- 1,5 ---- + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include #include #ifdef MSDOS *************** *** 31,36 **** --- 33,43 ---- progname = *argv++; --argc; + #ifdef EMX + setvbuf (stdin, NULL, _IOFBF, BUFSIZ); + setvbuf (stdout, NULL, _IOFBF, BUFSIZ); + #endif /* EMX */ + /* ** -hex hex dump ** -oct Octal dump *************** *** 139,144 **** --- 146,154 ---- (stdout)->_flag &= ~_IOTEXT; /* print binary */ _setmode (fileno (stdout), O_BINARY); #endif + #ifdef EMX + _fsetmode (stdout, "b"); + #endif /* EMX */ for (;;) { register int i, c, d; *************** *** 183,188 **** --- 193,201 ---- (fp)->_flag &= ~_IOTEXT; /* read binary */ _setmode (fileno (fp), O_BINARY); #endif + #ifdef EMX + _fsetmode (fp, "b"); + #endif /* EMX */ address = 0; string[0] = ' '; string[17] = '\0'; diff -c emacs-19\lib-src\make-docfile.c:1.1.1.8 emacs-19\lib-src\make-docfile.c:1.17 *** emacs-19\lib-src\make-docfile.c:1.1.1.8 Sun Jun 05 22:59:58 1994 --- emacs-19\lib-src\make-docfile.c Sun Jun 05 23:00:00 1994 *************** *** 17,22 **** --- 17,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* The arguments given to this program are all the C and Lisp source files of GNU Emacs. .elc and .el and .c files are allowed. A .o file can also be specified; the .c file it was made from is used. *************** *** 36,41 **** --- 38,47 ---- #include #endif /* MSDOS */ + #ifdef EMX + #define READ_TEXT "rt" + #define READ_BINARY "rb" + #else /* not EMX */ #ifdef MSDOS #define READ_TEXT "rt" #define READ_BINARY "rb" *************** *** 43,48 **** --- 49,55 ---- #define READ_TEXT "r" #define READ_BINARY "r" #endif /* not MSDOS */ + #endif /* not EMX */ FILE *outfile; *************** *** 58,63 **** --- 65,73 ---- (stdout)->_flag &= ~_IOTEXT; _setmode (fileno (stdout), O_BINARY); #endif /* MSDOS */ + #ifdef EMX + _wildcard (&argc, &argv); + #endif /* EMX */ outfile = stdout; /* If first two args are -o FILE, output to FILE. */ *************** *** 77,82 **** --- 87,96 ---- chdir (argv[i + 1]); i += 2; } + + #ifdef EMX + _fsetmode (outfile, "b"); + #endif /* EMX */ for (; i < argc; i++) err_count += scan_file (argv[i]); /* err_count seems to be {mis,un}used */ diff -c emacs-19\lib-src\profile.c:1.1.1.2 emacs-19\lib-src\profile.c:1.5 *** emacs-19\lib-src\profile.c:1.1.1.2 Sun Jun 05 23:00:06 1994 --- emacs-19\lib-src\profile.c Sun Jun 05 23:00:06 1994 *************** *** 19,24 **** --- 19,26 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /** ** To be run as an emacs process. Input string that starts with: *************** *** 79,84 **** --- 81,89 ---- main () { int c; + #ifdef EMX + setvbuf (stdout, NULL, _IOLBF, BUFSIZ); + #endif while ((c = getchar ()) != EOF) { switch (c) diff -c emacs-19\lib-src\timer.c:1.1.1.7 emacs-19\lib-src\timer.c:1.15 *** emacs-19\lib-src\timer.c:1.1.1.7 Sun Jun 05 23:00:12 1994 --- emacs-19\lib-src\timer.c Sun Jun 05 23:00:14 1994 *************** *** 11,16 **** --- 11,18 ---- This version was documented and rewritten for portability by esr@snark.thyrsus.com, Aug 7 1992. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include #include #include *************** *** 32,37 **** --- 34,43 ---- #undef signal #endif + #ifdef OS2 + #define INCL_WINSWITCHLIST + #include + #endif /* OS2 */ extern int errno; extern char *strerror (), *malloc (); *************** *** 306,311 **** --- 312,320 ---- exit (0); break; } + #ifdef EMX + signal (sig, SIG_ACK); + #endif /* EMX */ } /*ARGSUSED*/ *************** *** 330,335 **** --- 339,347 ---- /* Loop reading commands from standard input and scheduling alarms accordingly. The alarms are handled asynchronously, while we wait for commands. */ + #ifdef OS2 + WinRemoveSwitchEntry (WinQuerySwitchHandle (NULLHANDLE, getpid ())); + #endif /* OS2 */ while (1) getevent (); } diff -c emacs-19\lib-src\wakeup.c:1.1.1.6 emacs-19\lib-src\wakeup.c:1.7 *** emacs-19\lib-src\wakeup.c:1.1.1.6 Sun Jun 05 23:00:18 1994 --- emacs-19\lib-src\wakeup.c Sun Jun 05 23:00:18 1994 *************** *** 1,5 **** --- 1,6 ---- /* Program to produce output at regular intervals. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 16,21 **** --- 17,27 ---- #endif #endif + #ifdef OS2 + #define INCL_WINSWITCHLIST + #include + #endif /* OS2 */ + struct tm *localtime (); main (argc, argv) *************** *** 25,30 **** --- 31,40 ---- int period = 60; time_t when; struct tm *tp; + + #ifdef OS2 + WinRemoveSwitchEntry (WinQuerySwitchHandle (NULLHANDLE, getpid ())); + #endif /* OS2 */ if (argc > 1) period = atoi (argv[1]); diff -c emacs-19\lisp\compile.el:1.1.1.15 emacs-19\lisp\compile.el:1.19 *** emacs-19\lisp\compile.el:1.1.1.15 Sun Jun 05 23:03:12 1994 --- emacs-19\lisp\compile.el Sun Jun 05 23:03:14 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; compile.el --- run compiler as inferior of Emacs, parse error messages. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 86, 87, 93, 94 Free Software Foundation, Inc. ;; Author: Roland McGrath *************** *** 266,272 **** (interactive (list (read-from-minibuffer "Run grep (like this): " grep-command nil nil 'grep-history))) ! (compile-internal (concat command-args " /dev/null") "No more grep hits" "grep" ;; Give it a simpler regexp to match. nil grep-regexp-alist)) --- 268,277 ---- (interactive (list (read-from-minibuffer "Run grep (like this): " grep-command nil nil 'grep-history))) ! (compile-internal (concat command-args " " ! (if (eq system-type 'emx) ! "nul" ! "/dev/null")) "No more grep hits" "grep" ;; Give it a simpler regexp to match. nil grep-regexp-alist)) diff -c emacs-19\lisp\dired.el:1.1.1.17 emacs-19\lisp\dired.el:1.18 *** emacs-19\lisp\dired.el:1.1.1.17 Sun Jun 05 23:03:50 1994 --- emacs-19\lisp\dired.el Sun Jun 05 23:03:54 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; dired.el --- directory-browsing commands + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. ;; Author: Sebastian Kremer *************** *** 187,192 **** --- 189,201 ---- "\\|")) (defvar dired-re-dot "^.* \\.\\.?$") + ;; Restrict perm bits to be non-blank, + ;; otherwise this matches one char to early (looking backward): + ;; "l---------" (some systems make symlinks that way) + ;; "----------" (plain file with zero perms) + (defvar dired-re-perm-bits + "\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)") + (defvar dired-subdir-alist nil "Association list of subdirectories and their buffer positions. Each subdirectory has an element: (DIRNAME . STARTMARKER). *************** *** 1178,1190 **** (if hidden nil (save-excursion;; Find out what kind of file this is: ! ;; Restrict perm bits to be non-blank, ! ;; otherwise this matches one char to early (looking backward): ! ;; "l---------" (some systems make symlinks that way) ! ;; "----------" (plain file with zero perms) ! (if (re-search-backward ! "\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)" ! nil t) (setq file-type (char-after (match-beginning 1)) symlink (eq file-type ?l) ;; Only with -F we need to know whether it's an executable --- 1187,1193 ---- (if hidden nil (save-excursion;; Find out what kind of file this is: ! (if (re-search-backward dired-re-perm-bits nil t) (setq file-type (char-after (match-beginning 1)) symlink (eq file-type ?l) ;; Only with -F we need to know whether it's an executable diff -c emacs-19\lisp\faces.el:1.1.1.14 emacs-19\lisp\faces.el:1.23 *** emacs-19\lisp\faces.el:1.1.1.14 Sun Jun 05 23:04:18 1994 --- emacs-19\lisp\faces.el Sun Jun 05 23:04:20 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; faces.el --- Lisp interface to the c "face" structure + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. *************** *** 228,234 **** (setq frames (cdr frames))) (setq global-face-data (cons (cons name face) global-face-data))) ;; when making a face after frames already exist ! (if (eq window-system 'x) (make-face-x-resource-internal face)) face))) --- 230,236 ---- (setq frames (cdr frames))) (setq global-face-data (cons (cons name face) global-face-data))) ;; when making a face after frames already exist ! (if (memq window-system '(x pm)) (make-face-x-resource-internal face)) face))) *************** *** 238,244 **** (cond ((null frame) (let ((frames (frame-list))) (while frames ! (if (eq (framep (car frames)) 'x) (make-face-x-resource-internal (face-name face) (car frames) set-anyway)) (setq frames (cdr frames))))) --- 240,246 ---- (cond ((null frame) (let ((frames (frame-list))) (while frames ! (if (memq (framep (car frames)) '(x pm)) (make-face-x-resource-internal (face-name face) (car frames) set-anyway)) (setq frames (cdr frames))))) *************** *** 778,784 **** (let ((frames (frame-list))) (while frames ! (if (eq (framep (car frames)) 'x) (let ((frame (car frames)) (rest global-face-data)) (while rest --- 780,786 ---- (let ((frames (frame-list))) (while frames ! (if (memq (framep (car frames)) '(x pm)) (let ((frame (car frames)) (rest global-face-data)) (while rest *************** *** 920,926 **** (setq colors (cdr colors))))))) ;; If we are already using x-window frames, initialize faces for them. ! (if (eq (framep (selected-frame)) 'x) (face-initialize)) (provide 'faces) --- 922,928 ---- (setq colors (cdr colors))))))) ;; If we are already using x-window frames, initialize faces for them. ! (if (memq (framep (selected-frame)) '(x pm)) (face-initialize)) (provide 'faces) diff -c emacs-19\lisp\files.el:1.1.1.17 emacs-19\lisp\files.el:1.21 *** emacs-19\lisp\files.el:1.1.1.17 Sun Jun 05 23:05:00 1994 --- emacs-19\lisp\files.el Sun Jun 05 23:05:04 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; files.el --- file input and output commands for Emacs + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 86, 87, 92, 93, 94 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 557,563 **** ;; If the home dir is just /, don't change it. (not (and (= (match-end 0) 1) (= (aref filename 0) ?/))) ! (not (and (eq system-type 'ms-dos) (save-match-data (string-match "^[a-zA-Z]:/$" filename))))) (setq filename --- 559,565 ---- ;; If the home dir is just /, don't change it. (not (and (= (match-end 0) 1) (= (aref filename 0) ?/))) ! (not (and (memq system-type '(ms-dos emx)) (save-match-data (string-match "^[a-zA-Z]:/$" filename))))) (setq filename diff -c emacs-19\lisp\frame.el:1.1.1.15 emacs-19\lisp\frame.el:1.9 *** emacs-19\lisp\frame.el:1.1.1.15 Sun Jun 05 23:05:12 1994 --- emacs-19\lisp\frame.el Sun Jun 05 23:05:14 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; frame.el --- multi-frame management independent of window systems. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 289,298 **** ;; manually. (while tail (let (newval oldval) ! (setq oldval (cdr (assq (car (car tail)) ! frame-initial-frame-alist))) (setq newval (cdr (assq (car (car tail)) allparms))) ! (or (eq oldval newval) (setq newparms (cons (cons (car (car tail)) newval) newparms)))) (setq tail (cdr tail))) --- 291,300 ---- ;; manually. (while tail (let (newval oldval) ! (setq oldval (assq (car (car tail)) ! frame-initial-frame-alist)) (setq newval (cdr (assq (car (car tail)) allparms))) ! (or (and oldval (eq (cdr oldval) newval)) (setq newparms (cons (cons (car (car tail)) newval) newparms)))) (setq tail (cdr tail))) diff -c emacs-19\lisp\gud.el:1.1.1.16 emacs-19\lisp\gud.el:1.21 *** emacs-19\lisp\gud.el:1.1.1.16 Sun Jun 05 23:05:32 1994 --- emacs-19\lisp\gud.el Sun Jun 05 23:05:34 1994 *************** *** 1,6 **** --- 1,8 ---- ;;; gud.el --- Grand Unified Debugger mode for gdb, sdb, dbx, or xdb ;;; under Emacs + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Author: Eric S. Raymond ;; Maintainer: FSF ;; Version: 1.3 *************** *** 174,180 **** (let ((output "")) ;; Process all the complete markers in this chunk. ! (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" gud-marker-acc) (setq --- 176,185 ---- (let ((output "")) ;; Process all the complete markers in this chunk. ! (while (string-match (cond ! ((eq system-type 'emx) ! "\032\032\\([^;\n]*\\);\\([0-9]*\\);.*\n") ! (t "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n")) gud-marker-acc) (setq diff -c emacs-19\lisp\hexl.el:1.1.1.11 emacs-19\lisp\hexl.el:1.6 *** emacs-19\lisp\hexl.el:1.1.1.11 Sun Jun 05 23:05:40 1994 --- emacs-19\lisp\hexl.el Sun Jun 05 23:05:40 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; hexl.el --- edit a file in a hex dump format using the hexl filter. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1989, 1994 Free Software Foundation, Inc. ;; Author: Keith Gabryelski *************** *** 220,226 **** "Edit file FILENAME in hexl-mode. Switch to a buffer visiting file FILENAME, creating one in none exists." (interactive "fFilename: ") ! (if (eq system-type 'ms-dos) (find-file-binary filename) (find-file filename)) (if (not (eq major-mode 'hexl-mode)) --- 222,228 ---- "Edit file FILENAME in hexl-mode. Switch to a buffer visiting file FILENAME, creating one in none exists." (interactive "fFilename: ") ! (if (memq system-type '(ms-dos emx)) (find-file-binary filename) (find-file filename)) (if (not (eq major-mode 'hexl-mode)) diff -c emacs-19\lisp\info.el:1.1.1.15 emacs-19\lisp\info.el:1.17 *** emacs-19\lisp\info.el:1.1.1.15 Sun Jun 05 23:05:58 1994 --- emacs-19\lisp\info.el Sun Jun 05 23:06:00 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; info.el --- info package for Emacs. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 57,63 **** (let ((list nil) idx) (while (> (length path) 0) ! (setq idx (or (string-match ":" path) (length path)) list (cons (substring path 0 idx) list) path (substring path (min (1+ idx) (length path))))) --- 59,67 ---- (let ((list nil) idx) (while (> (length path) 0) ! (setq idx (or (string-match (cond ((eq system-type 'emx) ";") ! (t ":")) ! path) (length path)) list (cons (substring path 0 idx) list) path (substring path (min (1+ idx) (length path))))) *************** *** 103,108 **** --- 107,117 ---- (".info.gz" . "gunzip") (".info.z" . "gunzip") (".info" . nil) + (".inf.Z" . "uncompress") + (".inf.Y" . "unyabba") + (".inf.gz" . "gunzip") + (".inf.z" . "gunzip") + (".inf" . nil) (".Z" . "uncompress") (".Y" . "unyabba") (".gz" . "gunzip") diff -c emacs-19\lisp\loaddefs.el:1.1.1.20 emacs-19\lisp\loaddefs.el:1.17 *** emacs-19\lisp\loaddefs.el:1.1.1.20 Sun Jun 05 23:08:32 1994 --- emacs-19\lisp\loaddefs.el Sun Jun 05 23:08:38 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; loaddefs.el --- define standard autoloads and keys of other files + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985,86,87,92,93,94 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 641,649 **** (autoload (quote ange-ftp-hook-function) "ange-ftp" nil nil nil) ! (or (assoc "^/[^/:]*[^/:]:" file-name-handler-alist) (setq file-name-handler-alist (cons (quote ("^/[^/:]*[^/:]:" . ange-ftp-hook-function)) file-name-handler-alist))) ! (or (assoc "^/[^/:]*\\'" file-name-handler-alist) (setq file-name-handler-alist (cons (quote ("^/[^/:]*\\'" . ange-ftp-completion-hook-function)) file-name-handler-alist))) ;;;*** --- 643,651 ---- (autoload (quote ange-ftp-hook-function) "ange-ftp" nil nil nil) ! ;; (or (assoc "^/[^/:]*[^/:]:" file-name-handler-alist) (setq file-name-handler-alist (cons (quote ("^/[^/:]*[^/:]:" . ange-ftp-hook-function)) file-name-handler-alist))) ! ;; (or (assoc "^/[^/:]*\\'" file-name-handler-alist) (setq file-name-handler-alist (cons (quote ("^/[^/:]*\\'" . ange-ftp-completion-hook-function)) file-name-handler-alist))) ;;;*** diff -c emacs-19\lisp\loadup.el:1.1.1.6 emacs-19\lisp\loadup.el:1.17 *** emacs-19\lisp\loadup.el:1.1.1.6 Sun Jun 05 23:08:46 1994 --- emacs-19\lisp\loadup.el Sun Jun 05 23:08:48 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; loadup.el --- load up standardly loaded Lisp files for Emacs. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 104,109 **** --- 106,115 ---- (garbage-collect) (load "disp-table") ; needed to setup ibm-pc char set, see internal.el (garbage-collect))) + (if (eq system-type 'emx) + (progn + (garbage-collect) + (load "emx-patch"))) (if (fboundp 'atan) ; preload some constants and (progn ; floating pt. functions if (garbage-collect) ; we have float support. *************** *** 127,132 **** --- 133,141 ---- ;; based on the executables that now exist. (if (and (or (equal (nth 3 command-line-args) "dump") (equal (nth 4 command-line-args) "dump")) + (not (and (eq system-type 'emx) + (setq emacs-version (concat emacs-version "." + emx-emacs-version)))) (not (eq system-type 'ms-dos))) (let* ((base (concat "emacs-" emacs-version)) (files (file-name-all-completions base default-directory)) *************** *** 152,158 **** (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (eq system-type 'ms-dos) (setq name (expand-file-name "../etc/DOC")) (setq name (concat (expand-file-name "../etc/DOC-") name)) (if (file-exists-p name) --- 161,167 ---- (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (memq system-type '(ms-dos emx)) (setq name (expand-file-name "../etc/DOC")) (setq name (concat (expand-file-name "../etc/DOC-") name)) (if (file-exists-p name) *************** *** 183,189 **** (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (eq system-type 'ms-dos) (message "Dumping under the name emacs") (message "Dumping under names emacs and %s" name))) (condition-case () --- 192,198 ---- (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (memq system-type '(ms-dos emx)) (message "Dumping under the name emacs") (message "Dumping under names emacs and %s" name))) (condition-case () *************** *** 195,201 **** ;; other GNU product's build process. (dump-emacs "emacs" "temacs") ;; Recompute NAME now, so that it isn't set when we dump. ! (if (not (eq system-type 'ms-dos)) (let ((name (concat "emacs-" emacs-version))) (while (string-match "[^-+_.a-zA-Z0-9]+" name) (setq name (concat (downcase (substring name 0 (match-beginning 0))) --- 204,210 ---- ;; other GNU product's build process. (dump-emacs "emacs" "temacs") ;; Recompute NAME now, so that it isn't set when we dump. ! (if (not (memq system-type '(ms-dos emx))) (let ((name (concat "emacs-" emacs-version))) (while (string-match "[^-+_.a-zA-Z0-9]+" name) (setq name (concat (downcase (substring name 0 (match-beginning 0))) diff -c emacs-19\lisp\menu-bar.el:1.1.1.19 emacs-19\lisp\menu-bar.el:1.25 *** emacs-19\lisp\menu-bar.el:1.1.1.19 Sun Jun 05 23:09:00 1994 --- emacs-19\lisp\menu-bar.el Sun Jun 05 23:09:02 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; menu-bar.el --- define a default menu bar. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Author: RMS ;; Keywords: internal *************** *** 305,312 **** (setq alist (cons (cons (format ! (format "%%%ds %%s%%s %%s" ! maxbuf) (buffer-name elt) (if (buffer-modified-p elt) "*" " ") --- 307,316 ---- (setq alist (cons (cons (format ! (if (eq system-type 'emx) ! "%s\t%s%s %s" ! (format "%%%ds %%s%%s %%s" ! maxbuf)) (buffer-name elt) (if (buffer-modified-p elt) "*" " ") *************** *** 324,329 **** --- 328,335 ---- (setq maxlen (length (car (car alist)))))) (setq tail (cdr tail))) (setq alist (nreverse alist)) + (if (eq system-type 'emx) + (setq maxlen 0)) (nconc (mapcar '(lambda (pair) ;; This is somewhat risque, to use ;; the buffer name itself as the event type diff -c emacs-19\lisp\server.el:1.1.1.11 emacs-19\lisp\server.el:1.16 *** emacs-19\lisp\server.el:1.1.1.11 Sun Jun 05 23:09:26 1994 --- emacs-19\lisp\server.el Sun Jun 05 23:09:28 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; server.el --- Lisp code for GNU Emacs running as server process. + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1986, 1987, 1992, 1994 Free Software Foundation, Inc. ;; Author: William Sommerfeld *************** *** 76,81 **** --- 78,86 ---- (defvar server-program (expand-file-name "emacsserver" exec-directory) "*The program to use as the edit server.") + (defvar server-request-hook nil + "*List of hooks to call when processing a request for the Emacs server.") + (defvar server-visit-hook nil "*List of hooks to call when visiting a file for the Emacs server.") *************** *** 186,198 **** (cons (list arg lineno) files)) (setq lineno 1)))) ! (server-visit-files files client) ! ;; CLIENT is now a list (CLIENTNUM BUFFERS...) ! (setq server-clients (cons client server-clients)) ! (server-switch-buffer (nth 1 client)) ! (run-hooks 'server-switch-hook) ! (message (substitute-command-keys ! "When done with a buffer, type \\[server-edit]."))))) (defun server-visit-files (files client) "Finds FILES and returns the list CLIENT with the buffers nconc'd. --- 191,206 ---- (cons (list arg lineno) files)) (setq lineno 1)))) ! (run-hooks 'server-request-hook) ! (if (null files) ! nil ! (server-visit-files files client) ! ;; CLIENT is now a list (CLIENTNUM BUFFERS...) ! (setq server-clients (cons client server-clients)) ! (server-switch-buffer (nth 1 client)) ! (run-hooks 'server-switch-hook) ! (message (substitute-command-keys ! "When done with a buffer, type \\[server-edit].")))))) (defun server-visit-files (files client) "Finds FILES and returns the list CLIENT with the buffers nconc'd. diff -c emacs-19\lisp\startup.el:1.1.1.13 emacs-19\lisp\startup.el:1.4 *** emacs-19\lisp\startup.el:1.1.1.13 Sun Jun 05 23:09:34 1994 --- emacs-19\lisp\startup.el Sun Jun 05 23:09:34 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; startup.el --- process Emacs shell arguments + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc. ;; Maintainer: FSF *************** *** 185,191 **** ;; Precompute the keyboard equivalents in the menu bar items. (defun precompute-menubar-bindings () ! (if (eq window-system 'x) (let ((submap (lookup-key global-map [menu-bar]))) (while submap (and (consp (car submap)) --- 187,193 ---- ;; Precompute the keyboard equivalents in the menu bar items. (defun precompute-menubar-bindings () ! (if (memq window-system '(x pm)) (let ((submap (lookup-key global-map [menu-bar]))) (while submap (and (consp (car submap)) diff -c emacs-19\lisp\vc.el:1.1.1.14 emacs-19\lisp\vc.el:1.9 *** emacs-19\lisp\vc.el:1.1.1.14 Sun Jun 05 23:10:00 1994 --- emacs-19\lisp\vc.el Sun Jun 05 23:10:02 1994 *************** *** 1,5 **** --- 1,7 ---- ;;; vc.el --- drive a version-control system from within Emacs + ;; Modified for emx by Eberhard Mattes, Jun 1994 + ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. ;; Author: Eric S. Raymond *************** *** 145,150 **** --- 147,154 ---- (defvar vc-comment-ring-index nil) (defvar vc-last-comment-match nil) + (defvar vc-exec-suffix (if (eq system-type 'emx) ".exe")) + ;; File property caching (defun vc-file-clearprops (file) *************** *** 176,182 **** (function (lambda (s) (if s ! (let ((full (concat s "/" name))) (if (file-executable-p full) (progn (setq vc-binary-assoc --- 180,186 ---- (function (lambda (s) (if s ! (let ((full (concat s "/" name vc-exec-suffix))) (if (file-executable-p full) (progn (setq vc-binary-assoc *************** *** 1523,1528 **** --- 1527,1539 ---- (failed t)) (unwind-protect (progn + (if (eq system-type 'emx) + (vc-do-command + 0 shell-file-name file "-c" + (concat ">" filename " co" + (if writable " -l") + " -p" rev + " " (expand-file-name file))) (vc-do-command 0 "/bin/sh" file "-c" (format "umask %o; exec >\"$1\" || exit; shift; umask %o; exec co \"$@\"" *************** *** 1531,1537 **** "" ; dummy argument for shell's $0 filename (if writable "-l") ! (concat "-p" rev)) (setq failed nil)) (and failed (file-exists-p filename) (delete-file filename)))) (vc-do-command 0 "co" file --- 1542,1548 ---- "" ; dummy argument for shell's $0 filename (if writable "-l") ! (concat "-p" rev))) (setq failed nil)) (and failed (file-exists-p filename) (delete-file filename)))) (vc-do-command 0 "co" file diff -c emacs-19\src\Makefile.in.in:1.1.1.10 emacs-19\src\Makefile.in.in:1.9 *** emacs-19\src\Makefile.in.in:1.1.1.10 Sun Jun 05 23:11:12 1994 --- emacs-19\src\Makefile.in.in Sun Jun 05 23:11:14 1994 *************** *** 531,536 **** --- 531,542 ---- #define VMS_SUPPORT #endif + #ifdef EMX + #define EMX_SUPPORT ${lispdir}emx-patch.elc ${lispdir}emx-funcs.elc ${lispdir}emx-keys.el + #else /* not EMX */ + #define EMX_SUPPORT + #endif /* not EMX */ + #ifdef MSDOS #define MSDOS_SUPPORT ${lispdir}ls-lisp.elc ${lispdir}disp-tab.elc ${lispdir}dos-fns.elc ${lispdir}mouse.elc #else *************** *** 572,577 **** --- 578,584 ---- ${lispdir}text-mode.elc \ ${lispdir}vc-hooks.elc \ VMS_SUPPORT \ + EMX_SUPPORT \ MSDOS_SUPPORT \ ${lispdir}window.elc \ ${lispdir}version.el diff -c emacs-19\src\buffer.c:1.1.1.20 emacs-19\src\buffer.c:1.28 *** emacs-19\src\buffer.c:1.1.1.20 Sun Jun 05 23:12:24 1994 --- emacs-19\src\buffer.c Sun Jun 05 23:12:28 1994 *************** *** 18,23 **** --- 18,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 312,317 **** --- 313,321 ---- b->overlays_after = Qnil; XFASTINT (b->overlay_center) = 1; b->mark_active = Qnil; + #ifdef EMX + b->emx_binary_mode = Qnil; + #endif /* EMX */ /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ INITIALIZE_INTERVAL (b, NULL_INTERVAL); *************** *** 2355,2360 **** --- 2359,2367 ---- XFASTINT (buffer_local_flags.mode_name) = -1; XFASTINT (buffer_local_flags.undo_list) = -1; XFASTINT (buffer_local_flags.mark_active) = -1; + #ifdef EMX + XFASTINT (buffer_local_flags.emx_binary_mode) = -1; + #endif /* EMX */ XFASTINT (buffer_local_flags.mode_line_format) = 1; XFASTINT (buffer_local_flags.abbrev_mode) = 2; *************** *** 2410,2415 **** --- 2417,2423 ---- Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); + #ifndef EMX /* If PWD is accurate, use it instead of calling getwd. This is faster when PWD is right, and may avoid a fatal error. */ if ((pwd = getenv ("PWD")) != 0 && *pwd == '/' *************** *** 2421,2426 **** --- 2429,2439 ---- strcpy (buf, pwd); else if (getwd (buf) == 0) fatal ("`getwd' failed: %s.\n", buf); + #else /* EMX */ + if (_getcwd2 (buf, MAXPATHLEN) == 0) + fatal ("`_getcwd2' failed\n"); + _nls_strlwr (buf); + #endif /* EMX */ #ifndef VMS /* Maybe this should really use some standard subroutine *************** *** 2835,2840 **** --- 2848,2860 ---- DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, "List of functions called with no args to query before killing a buffer."); Vkill_buffer_query_functions = Qnil; + + #ifdef EMX + DEFVAR_PER_BUFFER ("emx-binary-mode", ¤t_buffer->emx_binary_mode, Qnil, + "*Non-nil means read and write files in `binary mode'.\n\ + nil means use `text mode'. This variable is emx-specific.\n\ + Automatically becomes buffer-local when set in any fashion."); + #endif /* EMX */ defsubr (&Sbuffer_list); defsubr (&Sget_buffer); diff -c emacs-19\src\buffer.h:1.1.1.5 emacs-19\src\buffer.h:1.5 *** emacs-19\src\buffer.h:1.1.1.5 Sun Jun 05 23:12:32 1994 --- emacs-19\src\buffer.h Sun Jun 05 23:12:34 1994 *************** *** 251,256 **** --- 251,260 ---- /* nil: text, t: binary. */ Lisp_Object buffer_file_type; #endif + #ifdef EMX + /* nil: text mode, t: binary mode */ + Lisp_Object emx_binary_mode; + #endif /* EMX */ /* String of length 256 mapping each char to its lower-case version. */ Lisp_Object downcase_table; diff -c emacs-19\src\callproc.c:1.1.1.13 emacs-19\src\callproc.c:1.33 *** emacs-19\src\callproc.c:1.1.1.13 Sun Jun 05 23:12:50 1994 --- emacs-19\src\callproc.c Sun Jun 05 23:12:50 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 73,78 **** --- 74,86 ---- #define max(a, b) ((a) > (b) ? (a) : (b)) + #ifdef EMX + extern Lisp_Object find_program_name_handler (); + extern Lisp_Object Qprogram_name_handler_alist; + extern Lisp_Object Vprogram_name_handler_alist; + static Lisp_Object Qcall_process; + #endif /* EMX */ + #ifdef MSDOS /* When we are starting external processes we need to know whether they take binary input (no conversion) or text input (\n is converted to *************** *** 197,202 **** --- 205,224 ---- #endif CHECK_STRING (args[0], 0); + #ifdef EMX + { + Lisp_Object handler; + + handler = find_program_name_handler (args[0]); + if (!NILP (handler)) + return call3 (handler, + Fcons (Qcall_process, Flist (3, args + 1)), + args[0], + nargs >= 5 ? Flist (nargs - 4, args + 4) : Qnil); + } + check_process_priority (); + #endif /* EMX */ + #ifndef subprocesses /* Without asynchronous processes we cannot have BUFFER == 0. */ if (nargs >= 3 && XTYPE (args[2]) == Lisp_Int) *************** *** 319,324 **** --- 341,349 ---- { #ifndef MSDOS pipe (fd); + #ifdef EMX + emx_proc_output_pipe (fd[0]); + #endif /* EMX */ #endif #if 0 /* Replaced by close_process_descs */ *************** *** 359,364 **** --- 384,390 ---- report_file_error ("Cannot re-open temporary file", Qnil); } #else /* not MSDOS */ + #ifndef EMX pid = vfork (); if (pid == 0) *************** *** 372,377 **** --- 398,408 ---- #endif /* USG */ child_setup (filefd, fd1, fd1, new_argv, 0, current_dir); } + #else /* EMX */ + if (fd[0] >= 0) + fcntl (fd[0], F_SETFD, 1); + pid = emx_child_setup (filefd, fd1, fd1, new_argv, 0, current_dir); + #endif /* EMX */ #endif /* not MSDOS */ environ = save_environ; *************** *** 387,393 **** --- 418,428 ---- { if (fd[0] >= 0) close (fd[0]); + #ifndef EMX report_file_error ("Doing vfork", Qnil); + #else /* EMX */ + report_file_error ("Running process", Qnil); + #endif } if (XTYPE (buffer) == Lisp_Int) *************** *** 489,495 **** --- 524,534 ---- #ifdef MSDOS char *tempfile; #else + #ifndef EMX char tempfile[20]; + #else /* EMX */ + char tempfile[260]; + #endif /* EMX */ #endif int count = specpdl_ptr - specpdl; #ifdef MSDOS *************** *** 508,518 **** --- 547,569 ---- strcat (tempfile, "detmp.XXX"); #else /* not MSDOS */ + #ifdef EMX + extern char *tempnam (); + char *t = tempnam ("/tmp", "em"); + if (t) + { + strcpy (tempfile, t); + free (t); + } + else + strcpy (tempfile, "/tmp/emXXXXXX"); + #else /* not EMX */ #ifdef VMS strcpy (tempfile, "tmp:emacsXXXXXX."); #else strcpy (tempfile, "/tmp/emacsXXXXXX"); #endif + #endif /* not EMX */ #endif /* not MSDOS */ mktemp (tempfile); *************** *** 539,544 **** --- 590,596 ---- } #ifndef VMS /* VMS version is in vmsproc.c. */ + #ifndef EMX /* emx version is in emxdep.c */ /* This is the last thing run in a newly forked inferior either synchronous or asynchronous. *************** *** 753,758 **** --- 805,812 ---- } } + #endif /* not EMX */ + static int getenv_internal (var, varlen, value, valuelen) char *var; *************** *** 851,858 **** --- 905,917 ---- { /* Add to the path the lib-src subdir of the installation dir. */ Lisp_Object tem; + #ifdef EMX + tem = Fexpand_file_name (build_string ("bin"), + Vinstallation_directory); + #else /* not EMX */ tem = Fexpand_file_name (build_string ("lib-src"), Vinstallation_directory); + #endif /* not EMX */ if (NILP (Fmember (tem, Vexec_path))) { Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil)); *************** *** 862,870 **** --- 921,937 ---- Do so if ../etc exists and has our DOC-... file in it. */ if (data_dir == 0) { + #ifdef EMX + tem = Fexpand_file_name (build_string ("data"), + Vinstallation_directory); + #else /* not EMX */ tem = Fexpand_file_name (build_string ("etc"), Vinstallation_directory); + #endif /* not EMX */ Vdoc_directory = Ffile_name_as_directory (tem); + #ifdef EMX + Vdata_directory = Vdoc_directory; + #endif /* EMX */ } } } *************** *** 935,940 **** --- 1002,1011 ---- syms_of_callproc () { + #ifdef EMX + Qcall_process = intern ("call-process"); + staticpro (&Qcall_process); + #endif /* EMX */ #ifdef MSDOS Qbuffer_file_type = intern ("buffer-file-type"); staticpro (&Qbuffer_file_type); diff -c emacs-19\src\cmds.c:1.1.1.12 emacs-19\src\cmds.c:1.3 *** emacs-19\src\cmds.c:1.1.1.12 Sun Jun 05 23:12:54 1994 --- emacs-19\src\cmds.c Sun Jun 05 23:12:56 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include "lisp.h" *************** *** 392,397 **** --- 393,402 ---- for (n = 040; n < 0177; n++) initial_define_key (global_map, n, "self-insert-command"); #ifdef MSDOS + for (n = 0200; n < 0240; n++) + initial_define_key (global_map, n, "self-insert-command"); + #endif + #ifdef EMX for (n = 0200; n < 0240; n++) initial_define_key (global_map, n, "self-insert-command"); #endif diff -c emacs-19\src\dired.c:1.1.1.9 emacs-19\src\dired.c:1.13 *** emacs-19\src\dired.c:1.1.1.9 Sun Jun 05 23:13:02 1994 --- emacs-19\src\dired.c Sun Jun 05 23:13:02 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 346,355 **** --- 347,366 ---- XSTRING (file)->size)) continue; + #ifdef EMX + /* Speed hack. Note that dp->d_attr was named dp->d_mode in + emx 0.8h and earlier. */ + #ifdef _DIRECT_D_MODE_RENAMED_D_ATTR + directoryp = (dp->d_attr & 0x10); + #else + directoryp = (dp->d_mode & 0x10); + #endif + #else /* not EMX */ if (file_name_completion_stat (dirname, dp, &st) < 0) continue; directoryp = ((st.st_mode & S_IFMT) == S_IFDIR); + #endif /* not EMX */ tem = Qnil; if (!directoryp) { diff -c emacs-19\src\dispextern.h:1.1.1.7 emacs-19\src\dispextern.h:1.15 *** emacs-19\src\dispextern.h:1.1.1.7 Sun Jun 05 23:13:06 1994 --- emacs-19\src\dispextern.h Sun Jun 05 23:13:06 1994 *************** *** 17,28 **** --- 17,34 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* Nonzero means last display completed and cursor is really at cursX, cursY. Zero means it was preempted. */ extern int display_completed; #ifdef HAVE_X_WINDOWS + #ifndef EMX #include + #else /* EMX */ + #include "pmlib.h" + #endif /* EMX */ struct face { diff -c emacs-19\src\dispnew.c:1.1.1.16 emacs-19\src\dispnew.c:1.25 *** emacs-19\src\dispnew.c:1.1.1.16 Sun Jun 05 23:13:34 1994 --- emacs-19\src\dispnew.c Sun Jun 05 23:13:36 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 42,48 **** --- 43,53 ---- #include "systime.h" #ifdef HAVE_X_WINDOWS + #ifndef EMX #include "xterm.h" + #else /* EMX */ + #include "pmterm.h" + #endif /* EMX */ #endif /* HAVE_X_WINDOWS */ #include *************** *** 91,96 **** --- 96,105 ---- int baud_rate; + /* Minimum length of a run of matching characters to be skipped in output. */ + + int min_skip_run = 1; + /* nil or a symbol naming the window system under which emacs is running ('x is the only current possibility). */ *************** *** 532,537 **** --- 541,555 ---- /* Like bcopy except never gets confused by overlap. */ + #ifdef EMX + void + safe_bcopy (from, to, size) + char *from, *to; + int size; + { + bcopy (from, to, size); + } + #else /* not EMX */ void safe_bcopy (from, to, size) char *from, *to; *************** *** 584,589 **** --- 602,608 ---- } } } + #endif /* not EMX */ /* Rotate a vector of SIZE bytes right, by DISTANCE bytes. DISTANCE may be negative. */ *************** *** 1611,1617 **** /* If there's no i/d char, quickly do the best we can without it. */ if (!char_ins_del_ok) { ! int i,j; #if 0 if (FRAME_X_P (frame)) --- 1630,1636 ---- /* If there's no i/d char, quickly do the best we can without it. */ if (!char_ins_del_ok) { ! int i,j,k,more; #if 0 if (FRAME_X_P (frame)) *************** *** 1637,1645 **** if (i >= olen || nbody[i] != obody[i]) /* A non-matching char. */ { cursor_to (vpos, i); ! for (j = 1; (i + j < nlen && ! (i + j >= olen || nbody[i+j] != obody[i+j])); ! j++); /* Output this run of non-matching chars. */ write_glyphs (nbody + i, j); --- 1656,1680 ---- if (i >= olen || nbody[i] != obody[i]) /* A non-matching char. */ { cursor_to (vpos, i); ! j = 1; ! do ! { ! more = 0; ! while (i + j < nlen ! && (i + j >= olen || nbody[i+j] != obody[i+j])) ! j++; ! /* Include matching chars in the run unless there ! are min_skip_run or more consecutive matching chars ! or no non-matching chars follow. */ ! for (k = j; (i + k < nlen && ! !(i + k >= olen || nbody[i+k] != obody[i+k])); ! k++); ! if (k != j && k - j < min_skip_run ! && (i + k >= olen || nbody[i+k] != obody[i+k])) ! { ! j = k; more = 1; ! } ! } while (more); /* Output this run of non-matching chars. */ write_glyphs (nbody + i, j); *************** *** 2310,2315 **** --- 2345,2357 ---- with an error message if that doesn't work. */ #ifdef HAVE_X_WINDOWS + #ifdef EMX + if (!inhibit_window_system && display_arg) + { + Vwindow_system = intern ("pm"); + return; + } + #else /* not EMX */ if (! display_arg) { #ifdef VMS *************** *** 2318,2323 **** --- 2360,2366 ---- display_arg = (getenv ("DISPLAY") != 0); #endif } + #endif /* not EMX */ if (!inhibit_window_system && display_arg) { *************** *** 2435,2440 **** --- 2478,2487 ---- "Display table to use for buffers that specify none.\n\ See `buffer-display-table' for more information."); Vstandard_display_table = Qnil; + + DEFVAR_INT ("min-skip-run", &min_skip_run, + "Minimum run length required for skipping matching characters in output.\n\ + This is used for tuning output."); /* Initialize `window-system', unless init_display already decided it. */ #ifdef CANNOT_DUMP diff -c emacs-19\src\doc.c:1.1.1.8 emacs-19\src\doc.c:1.12 *** emacs-19\src\doc.c:1.1.1.8 Sun Jun 05 23:13:42 1994 --- emacs-19\src\doc.c Sun Jun 05 23:13:42 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include *************** *** 35,40 **** --- 36,45 ---- #define O_RDONLY 0 #endif + #ifndef O_BINARY + #define O_BINARY 0 + #endif + #include "lisp.h" #include "buffer.h" #include "keyboard.h" *************** *** 79,85 **** #endif /* VMS4_4 */ #endif /* VMS */ ! fd = open (name, O_RDONLY, 0); if (fd < 0) error ("Cannot open doc string file \"%s\"", name); if (0 > lseek (fd, filepos, 0)) --- 84,90 ---- #endif /* VMS4_4 */ #endif /* VMS */ ! fd = open (name, O_RDONLY | O_BINARY, 0); if (fd < 0) error ("Cannot open doc string file \"%s\"", name); if (0 > lseek (fd, filepos, 0)) *************** *** 307,313 **** #endif /* VMS4_4 */ #endif /* VMS */ ! fd = open (name, O_RDONLY, 0); if (fd < 0) report_file_error ("Opening doc string file", Fcons (build_string (name), Qnil)); --- 312,318 ---- #endif /* VMS4_4 */ #endif /* VMS */ ! fd = open (name, O_RDONLY | O_BINARY, 0); if (fd < 0) report_file_error ("Opening doc string file", Fcons (build_string (name), Qnil)); diff -c emacs-19\src\editfns.c:1.1.1.16 emacs-19\src\editfns.c:1.16 *** emacs-19\src\editfns.c:1.1.1.16 Sun Jun 05 23:14:00 1994 --- emacs-19\src\editfns.c Sun Jun 05 23:14:02 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include *************** *** 92,98 **** --- 93,105 ---- if (NILP (tem)) pw = (struct passwd *) getpwnam (XSTRING (Vuser_name)->data); + #ifndef EMX p = (unsigned char *) (pw ? USER_FULL_NAME : "unknown"); + #else /* EMX */ + p = (unsigned char *) getenv("USERFULLNAME"); + if (!p) + p = (unsigned char *) (pw ? USER_FULL_NAME : "unknown"); + #endif /* EMX */ q = (unsigned char *) index (p, ','); Vuser_full_name = make_string (p, q ? q - p : strlen (p)); diff -c emacs-19\src\emacs.c:1.1.1.18 emacs-19\src\emacs.c:1.34 *** emacs-19\src\emacs.c:1.1.1.18 Sun Jun 05 23:14:18 1994 --- emacs-19\src\emacs.c Sun Jun 05 23:14:20 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 151,156 **** --- 152,165 ---- shut_down_emacs (sig, 0, Qnil); } + #ifdef EMX + /* Simply returning will cause a core dump; that's what we want. + kill() does not cause a core dump in emx 0.8h. Even if it did, + the core dump would be not very helpful, because the stack + backtrace would not work (we are in a signal handler!). + Returning is also required for SIGTERM. */ + return; + #else /* not EMX */ #ifdef VMS LIB$STOP (SS$_ABORT); #else *************** *** 163,170 **** --- 172,191 ---- #endif kill (getpid (), fatal_error_code); #endif /* not VMS */ + #endif /* not EMX */ } + #ifdef EMX + SIGTYPE + break_signal (sig) + int sig; + { + signal (sig, SIG_ACK); + Vquit_flag = Qt; + raise (SIGINT); + } + #endif /* EMX */ + #ifdef SIGDANGER /* Handler for SIGDANGER. */ *************** *** 221,226 **** --- 242,254 ---- not including lisp and info. */ tem = Fexpand_file_name (build_string ("lib-src"), dir); lib_src_exists = Ffile_exists_p (tem); + #ifdef EMX + if (NILP (lib_src_exists)) + { + tem = Fexpand_file_name (build_string ("bin"), dir); + lib_src_exists = Ffile_exists_p (tem); + } + #endif /* EMX */ if (!NILP (lib_src_exists)) { tem = Fexpand_file_name (build_string ("etc"), dir); *************** *** 236,241 **** --- 264,276 ---- /* See if dir's parent contains those subdirs. */ tem = Fexpand_file_name (build_string ("../lib-src"), dir); lib_src_exists = Ffile_exists_p (tem); + #ifdef EMX + if (NILP (lib_src_exists)) + { + tem = Fexpand_file_name (build_string ("../bin"), dir); + lib_src_exists = Ffile_exists_p (tem); + } + #endif /* EMX */ if (!NILP (lib_src_exists)) { tem = Fexpand_file_name (build_string ("../etc"), dir); *************** *** 357,362 **** --- 392,403 ---- printf ("malloc jumpstart failed!\n"); #endif /* NeXT */ + #ifdef EMX + emx_setup (); + _nls_init (); /* Call before emx_exec_name! */ + emx_exec_name (&argv[0]); + #endif /* EMX */ + #ifdef HAVE_X_WINDOWS /* Stupid kludge to catch command-line display spec. We can't handle this argument entirely in window system dependent code *************** *** 507,512 **** --- 548,563 ---- noninteractive = 1; } + #ifdef EMX + if (!display_arg || inhibit_window_system) + { + char pid[40]; + + sprintf (pid, "EMACS_PID=%d", getpid ()); + putenv (pid); + } + #endif /* EMX */ + #ifdef POSIX_SIGNALS init_signals (); #endif *************** *** 565,570 **** --- 616,624 ---- signal (SIGSOUND, fatal_error_signal); signal (SIGMSG, fatal_error_signal); #endif /* AIX */ + #ifdef EMX + signal (SIGBREAK, break_signal); + #endif /* EMX */ } noninteractive1 = noninteractive; *************** *** 854,861 **** --- 908,921 ---- #ifdef HAVE_X_WINDOWS /* It's not safe to call intern here. Maybe we are crashing. */ if (!noninteractive && SYMBOLP (Vwindow_system) + #ifndef EMX && XSYMBOL (Vwindow_system)->name->size == 1 && XSYMBOL (Vwindow_system)->name->data[0] == 'x' + #else /* EMX */ + && XSYMBOL (Vwindow_system)->name->size == 2 + && XSYMBOL (Vwindow_system)->name->data[0] == 'p' + && XSYMBOL (Vwindow_system)->name->data[1] == 'm' + #endif /* EMX */ && ! no_x) Fx_close_current_connection (); #endif /* HAVE_X_WINDOWS */ *************** *** 973,978 **** --- 1033,1049 ---- path = (char *) getenv (evarname); else path = 0; + #ifdef EMX + if (path) + { + char *p = path; + path = alloca (strlen (p) + 1); + strcpy (path, p); + for (p = path; *p != 0; ++p) + if (*p == '\\') + *p = '/'; + } + #endif /* EMX */ if (!path) path = defalt; lpath = Qnil; diff -c emacs-19\src\fileio.c:1.1.1.18 emacs-19\src\fileio.c:1.34 *** emacs-19\src\fileio.c:1.1.1.18 Sun Jun 05 23:15:32 1994 --- emacs-19\src\fileio.c Sun Jun 05 23:15:36 1994 *************** *** 17,22 **** --- 17,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include #include *************** *** 97,102 **** --- 99,117 ---- #endif #endif + #ifdef EMX + #include + extern Lisp_Object Femx_binary_mode_p (); + extern Lisp_Object emx_expand_file_name (); + extern int fb_start (int fd, off_t *size); + extern int fb_close (); + extern long fb_lseek (); + extern int fb_read (); + #define close(a) fb_close (a) + #define lseek(a,b,c) fb_lseek (a, b, c) + #define read(a,b,c) fb_read (a, b, c) + #endif /* EMX */ + #ifndef O_WRONLY #define O_WRONLY 1 #endif *************** *** 292,297 **** --- 307,315 ---- #ifdef MSDOS && p[-1] != ':' #endif + #ifdef EMX + && p[-1] != ':' && p[-1] != '\\' + #endif /* EMX */ ) p--; if (p == beg) *************** *** 347,352 **** --- 365,373 ---- #ifdef MSDOS && p[-1] != ':' #endif + #ifdef EMX + && p[-1] != ':' && p[-1] != '\\' + #endif /* EMX */ ) p--; return make_string (p, end - p); *************** *** 622,633 **** --- 643,658 ---- /* Process as Unix format: just remove any final slash. But leave "/" unchanged; do not change it to "". */ strcpy (dst, src); + #ifdef EMX + if (slen > 1 && PATH_DELIM_P (dst[slen - 1]) && dst[slen - 2] != ':') + #else /* not EMX */ if (slen > 1 && dst[slen - 1] == '/' #ifdef MSDOS && dst[slen - 2] != ':' #endif ) + #endif /* not EMX */ dst[slen - 1] = 0; return 1; } *************** *** 678,683 **** --- 703,742 ---- Lisp_Object prefix; { Lisp_Object val; + #ifdef EMX + char drv_name[3], fsname[64], *p, *q; + int i, drive; + + /* Check if PREFIX is on an HPFS drive. */ + + CHECK_STRING (prefix, 0); + p = XSTRING (prefix)->data; + drive = _fngetdrive (p); + if (drive == 0) + drive = _getdrive (); + drv_name[0] = (char)drive; + drv_name[1] = ':'; + drv_name[2] = 0; + if (_filesys (drv_name, fsname, sizeof (fsname)) != 0 + || strcmp (fsname, "HPFS") != 0) + { + /* It's not on an HPFS drive. Keep only the first two + characters of the last component of PREFIX to restrict the + length of the last component to 8 characters. */ + + q = p; + while (*p != 0) + { + if (PATH_DELIM_P (*p) || *p == ':') + q = p + 1; + ++p; + } + p = XSTRING (prefix)->data; + i = q - p; + if (XSTRING (prefix)->size - i > 2) + prefix = make_string (XSTRING (prefix)->data, i + 2); + } + #endif /* EMX */ val = concat2 (prefix, build_string ("XXXXXX")); mktemp (XSTRING (val)->data); return val; *************** *** 763,768 **** --- 822,831 ---- nm = XSTRING (name)->data; + #ifdef EMX + return emx_expand_file_name (nm, (!NILP (defalt) ? defalt + : current_buffer->directory)); + #else /* not EMX */ #ifdef MSDOS /* firstly, strip drive name. */ { *************** *** 1138,1143 **** --- 1201,1207 ---- #endif return make_string (target, o - target); + #endif /* not EMX */ } #if 0 /* Changed this DEFUN to a DEAFUN, so as not to confuse `make-docfile'. *************** *** 1493,1498 **** --- 1557,1568 ---- for (p = nm; p != endp; p++) { + #ifdef EMX + if (p != nm && PATH_DELIM_P (p[-1]) + && (p[0] == '~' + || _fngetdrive (p) + || (PATH_DELIM_P (p[0]) && p - 1 != nm))) + #else /* not EMX */ if ((p[0] == '~' || #ifdef APOLLO /* // at start of file name is meaningful in Apollo system */ *************** *** 1509,1514 **** --- 1579,1585 ---- #ifdef VMS ) #endif /* VMS */ + #endif /* not EMX */ { nm = p; substituted = 1; *************** *** 1680,1686 **** /* Remove final slash, if any (unless path is root). stat behaves differently depending! */ if (XSTRING (abspath)->size > 1 ! && XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/') /* We cannot take shortcuts; they might be wrong for magic file names. */ abspath = Fdirectory_file_name (abspath); #endif --- 1751,1761 ---- /* Remove final slash, if any (unless path is root). stat behaves differently depending! */ if (XSTRING (abspath)->size > 1 ! && XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/' ! #ifdef EMX ! && XSTRING (abspath)->data[XSTRING (abspath)->size - 2] != ':' ! #endif /* EMX */ ! ) /* We cannot take shortcuts; they might be wrong for magic file names. */ abspath = Fdirectory_file_name (abspath); #endif *************** *** 1759,1764 **** --- 1834,1842 ---- ifd = open (XSTRING (filename)->data, 0); if (ifd < 0) report_file_error ("Opening input file", Fcons (filename, Qnil)); + #ifdef EMX + setmode (ifd, O_BINARY); + #endif /* EMX */ record_unwind_protect (close_file_unwind, make_number (ifd)); *************** *** 1793,1798 **** --- 1871,1879 ---- #endif /* VMS */ if (ofd < 0) report_file_error ("Opening output file", Fcons (newname, Qnil)); + #ifdef EMX + setmode (ofd, O_BINARY); + #endif /* EMX */ record_unwind_protect (close_file_unwind, make_number (ofd)); *************** *** 1932,1937 **** --- 2013,2021 ---- || XTYPE (ok_if_already_exists) == Lisp_Int) barf_or_query_if_file_exists (newname, "rename to it", XTYPE (ok_if_already_exists) == Lisp_Int); + #ifdef EMX + remove (XSTRING (newname)->data); + #endif /* EMX */ #ifndef BSD4_1 if (0 > rename (XSTRING (filename)->data, XSTRING (newname)->data)) #else *************** *** 2141,2146 **** --- 2225,2234 ---- #ifdef MSDOS || (*ptr != 0 && ptr[1] == ':' && ptr[2] == '/') #endif + #ifdef EMX + || *ptr == '\\' + || (_fngetdrive (ptr) && PATH_DELIM_P (ptr[2])) + #endif /* EMX */ ) return Qt; else *************** *** 2314,2319 **** --- 2402,2411 ---- if (!NILP (dir)) dir = Fdirectory_file_name (dir); #endif /* MSDOS */ + #ifdef EMX + if (!NILP (dir)) + dir = Fdirectory_file_name (dir); + #endif /* EMX */ return ((access (!NILP (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0 && ! ro_fsys ((char *) XSTRING (dir)->data)) ? Qt : Qnil); *************** *** 2608,2613 **** --- 2700,2712 ---- goto notfound; } + #ifdef EMX + if (NILP (current_buffer->emx_binary_mode)) + current_buffer->emx_binary_mode = Femx_binary_mode_p (filename); + if (!NILP (current_buffer->emx_binary_mode)) + setmode (fd, O_BINARY); + #endif /* EMX */ + /* Replacement should preserve point as it preserves markers. */ if (!NILP (replace)) record_unwind_protect (restore_point_unwind, Fpoint_marker ()); *************** *** 2661,2666 **** --- 2760,2771 ---- del_range_1 (BEGV, ZV, 0); } #else /* MSDOS */ + #ifdef EMX + if (!NILP (replace) && NILP (current_buffer->emx_binary_mode) + && fb_start (fd, &st.st_size) != 0) + error ("IO error reading %s: %s", + XSTRING (filename)->data, strerror (errno)); + #endif /* EMX */ if (!NILP (replace)) { unsigned char buffer[1 << 14]; *************** *** 3083,3088 **** --- 3188,3198 ---- #endif /* CLASH_DETECTION */ report_file_error ("Opening output file", Fcons (filename, Qnil)); } + #ifdef EMX + if (!NILP (current_buffer->emx_binary_mode) + || !NILP (Femx_binary_mode_p (filename))) + setmode (desc, O_BINARY); + #endif /* EMX */ record_unwind_protect (close_file_unwind, make_number (desc)); diff -c emacs-19\src\frame.c:1.1.1.16 emacs-19\src\frame.c:1.19 *** emacs-19\src\frame.c:1.1.1.16 Sun Jun 05 23:15:58 1994 --- emacs-19\src\frame.c Sun Jun 05 23:16:00 1994 *************** *** 17,22 **** --- 17,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include #include *************** *** 167,172 **** --- 169,177 ---- f->scroll_bars = Qnil; f->condemned_scroll_bars = Qnil; f->face_alist = Qnil; + #ifdef EMX + f->pm_menu_bar_items = 0; + #endif /* EMX */ f->menu_bar_items = Qnil; f->menu_bar_vector = Qnil; f->menu_bar_items_used = 0; diff -c emacs-19\src\frame.h:1.1.1.8 emacs-19\src\frame.h:1.13 *** emacs-19\src\frame.h:1.1.1.8 Sun Jun 05 23:16:06 1994 --- emacs-19\src\frame.h Sun Jun 05 23:16:08 1994 *************** *** 17,22 **** --- 17,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* Miscellanea. */ *************** *** 136,141 **** --- 138,152 ---- The elements have the form (KEY STRING . nil) to start; when they are displayed, the hpos of the left edge goes in the cddr. */ Lisp_Object menu_bar_items; + + #ifdef EMX + /* An internal representation of the value of menu_bar_items above + as currently used by the PM menu bar. This is used to avoid + rebuilding the PM menu bar if nothing has changed. We cannot use + a Lisp_Object as the garbage collector must not be called at + redisplay time. */ + struct pm_menu_bar_item *pm_menu_bar_items; + #endif /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */ Lisp_Object face_alist; diff -c emacs-19\src\keyboard.c:1.1.1.21 emacs-19\src\keyboard.c:1.46 *** emacs-19\src\keyboard.c:1.1.1.21 Sun Jun 05 23:18:40 1994 --- emacs-19\src\keyboard.c Sun Jun 05 23:18:46 1994 *************** *** 17,22 **** --- 17,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* Allow config.h to undefine symbols found here. */ #include *************** *** 55,61 **** --- 57,67 ---- /* This is to get the definitions of the XK_ symbols. */ #ifdef HAVE_X_WINDOWS + #ifdef EMX + #include "pmterm.h" + #else /* not EMX */ #include "xterm.h" + #endif /* not EMX */ #endif extern int errno; *************** *** 456,462 **** --- 462,472 ---- /* If we support X Windows, turn on the code to poll periodically to detect C-g. It isn't actually used when doing interrupt input. */ #ifdef HAVE_X_WINDOWS + /* pmemacs sends SIGINT to Emacs when C-g is hit. We don't have to + poll. */ + #ifndef EMX #define POLL_FOR_INPUT + #endif /* not EMX */ #endif /* Global variable declarations. */ *************** *** 1162,1167 **** --- 1172,1186 ---- Lisp_Object obj; obj = DISP_CHAR_VECTOR (dp, lose); + #if 1 /* em's temporary fix for a bug of GNU Emacs 19.25 */ + if (NILP (obj)) + { + if (lose >= 0x20 && lose <= 0x7e) + no_redisplay + = direct_output_for_insert (lose); + } + else + #endif if (NILP (obj) || (XTYPE (obj) == Lisp_Vector && XVECTOR (obj)->size == 1 *************** *** 1762,1767 **** --- 1781,1794 ---- } } + #ifdef EMX + /* We got a menu-bar event, but no maps are provided. Tell + pmemacs.exe that x-popup-menu won't be called for updating the + menu. */ + if (nmaps == 0 && pm_menu_bar_cookie != 0) + pm_default_menu (); + #endif /* EMX */ + return c; } *************** *** 1800,1805 **** --- 1827,1835 ---- if (! XFASTINT (old_value)) { do_mouse_tracking = 0; + #ifdef EMX + pm_mouse_tracking (0); + #endif /* EMX */ /* Redisplay may have been preempted because there was input available, and it assumes it will be called again after the *************** *** 1831,1838 **** --- 1861,1875 ---- if (!input_pending && !detect_input_pending ()) prepare_menu_bars (); + #ifdef EMX + if (!do_mouse_tracking) + mouse_moved = 0; + #endif /* EMX */ do_mouse_tracking = 1; + #ifdef EMX + pm_mouse_tracking (1); + #endif /* EMX */ val = Fprogn (args); return unbind_to (count, val); *************** *** 2416,2422 **** --- 2453,2463 ---- static char *lispy_mouse_names[] = { + #ifdef EMX + "mouse-1", "mouse-2", "mouse-3", "mouse-4", "drop" + #else /* not EMX */ "mouse-1", "mouse-2", "mouse-3", "mouse-4", "mouse-5" + #endif /* not EMX */ }; /* Scroll bar parts. */ *************** *** 2664,2669 **** --- 2705,2727 ---- start_pos_ptr = &XVECTOR (button_down_location)->contents[button]; + #ifdef EMX + if (event->modifiers == 0) + { + Lisp_Object head; + + head = modify_event_symbol (button, + event->modifiers, + Qmouse_click, Qnil, + lispy_mouse_names, &mouse_syms, + (sizeof (lispy_mouse_names) + / sizeof (lispy_mouse_names[0]))); + return Fcons (head, + Fcons (position, + Qnil)); + } + #endif + start_pos = *start_pos_ptr; *start_pos_ptr = Qnil; *************** *** 5044,5049 **** --- 5102,5112 ---- unread_switch_frame = delayed_switch_frame; unbind_to (count, Qnil); + #ifdef EMX + if (NILP (read_key_sequence_cmd) && pm_menu_bar_cookie != 0) + pm_default_menu (); + #endif /* EMX */ + /* Occasionally we fabricate events, perhaps by expanding something according to function-key-map, or by adding a prefix symbol to a mouse click in the scroll bar or modeline. In this cases, return *************** *** 5121,5126 **** --- 5184,5193 ---- this_command_key_count = 0; i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), prompt); + #ifdef EMX + if (pm_menu_bar_cookie != 0) + pm_default_menu (); + #endif /* EMX */ if (i == -1) { *************** *** 5520,5531 **** --- 5587,5603 ---- /* Must preserve main program's value of errno. */ int old_errno = errno; + #ifdef EMX + /* Under emx, a signal is blocked until acknowledged. */ + signal (SIGINT, SIG_ACK); + #else /* not EMX */ #ifdef USG /* USG systems forget handlers when they are used; must reestablish each time */ signal (SIGINT, interrupt_signal); signal (SIGQUIT, interrupt_signal); #endif /* USG */ + #endif /* not EMX */ cancel_echoing (); *************** *** 5558,5563 **** --- 5630,5639 ---- printf ("you can continue or abort.\n"); #endif /* not VMS */ #endif /* not SIGTSTP */ + #ifdef EMX + /* Still required??? */ + Vquit_flag = Qnil; + #endif */ EMX */ #ifdef MSDOS /* We must remain inside the screen area when the internal terminal is used. Note that [Enter] is not echoed by dos. */ diff -c emacs-19\src\lread.c:1.1.1.16 emacs-19\src\lread.c:1.24 *** emacs-19\src\lread.c:1.1.1.16 Sun Jun 05 23:19:44 1994 --- emacs-19\src\lread.c Sun Jun 05 23:19:44 1994 *************** *** 18,23 **** --- 18,24 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 77,82 **** --- 78,88 ---- /* This is useud to build the load history. */ Lisp_Object Vcurrent_load_list; + #ifdef EMX + /* Try replacing `-' with `_' in `load' if this is non-zero. */ + int emx_cdrom_load; + #endif /* EMX */ + /* List of descriptors now open for Fload. */ static Lisp_Object load_descriptor_list; *************** *** 358,363 **** --- 364,390 ---- GCPRO1 (str); fd = openp (Vload_path, str, !NILP (nosuffix) ? "" : ".elc:.el:", &found, 0); + #ifdef EMX + /* If the file was not found and emx-cdrom-load is non-nil, try + again, replacing `-' with `_'. */ + if (fd < 0 && emx_cdrom_load) + { + int len = XSTRING (str)->size; + char *new_str = alloca (len + 1); + int i, ok = 0; + + memcpy (new_str, XSTRING (str)->data, len); + new_str[len] = 0; + for (i = 0; i < len; ++i) + if (new_str[i] == '-') + { + new_str[i] = '_'; ok = 1; + } + if (ok) + fd = openp (Vload_path, build_string (new_str), + !NILP (nosuffix) ? "" : ".elc:.el:", &found, 0); + } + #endif /* EMX */ UNGCPRO; } *************** *** 478,483 **** --- 505,514 ---- #ifdef MSDOS /* MW, May 1993 */ || (s[0] != '\0' && s[1] == ':' && s[2] == '/') #endif + #ifdef EMX + || *s == '\\' + || (_fngetdrive (s) && PATH_DELIM_P (s[2])) + #endif /* EMX */ ); } *************** *** 1985,1990 **** --- 2016,2027 ---- DEFVAR_LISP ("current-load-list", &Vcurrent_load_list, "Used for internal purposes by `load'."); Vcurrent_load_list = Qnil; + + #ifdef EMX + DEFVAR_BOOL ("emx-cdrom-load", &emx_cdrom_load, + "*Non-nil if `load' should try again if the file is not found,\n\ + replacing `-' with `_' in the file name."); + #endif /* EMX */ load_descriptor_list = Qnil; staticpro (&load_descriptor_list); diff -c emacs-19\src\process.c:1.1.1.20 emacs-19\src\process.c:1.39 *** emacs-19\src\process.c:1.1.1.20 Sun Jun 05 23:20:50 1994 --- emacs-19\src\process.c Sun Jun 05 23:20:52 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include *************** *** 94,99 **** --- 95,107 ---- #include "commands.h" #include "frame.h" + #ifdef EMX + extern Lisp_Object find_program_name_handler (); + extern Lisp_Object Qprogram_name_handler_alist; + extern Lisp_Object Vprogram_name_handler_alist; + static Lisp_Object Qstart_process; + #endif /* EMX */ + Lisp_Object Qprocessp; Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed; /* Qexit is declared and initialized in eval.c. */ *************** *** 214,220 **** --- 222,230 ---- /* If we support X Windows, turn on the code to poll periodically to detect C-g. It isn't actually used when doing interrupt input. */ #ifdef HAVE_X_WINDOWS + #ifndef EMX #define POLL_FOR_INPUT + #endif /* not EMX */ #endif /* Mask of bits indicating the descriptors that we wait for input on */ *************** *** 988,993 **** --- 998,1017 ---- register int i; int count = specpdl_ptr - specpdl; + #ifdef EMX + { + Lisp_Object handler; + + handler = find_program_name_handler (args[2]); + if (!NILP (handler)) + return call3 (handler, + Fcons (Qstart_process, Flist (2, args + 0)), + args[2], + Flist (nargs - 3, args + 3)); + } + check_process_priority (); + #endif /* EMX */ + buffer = args[1]; if (!NILP (buffer)) buffer = Fget_buffer_create (buffer); *************** *** 1008,1013 **** --- 1032,1041 ---- GCPRO2 (buffer, current_dir); + #ifdef EMX + current_dir = Fexpand_file_name (current_dir, Qnil); + #endif /* EMX */ + current_dir = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir), Qnil); *************** *** 1050,1056 **** --- 1078,1088 ---- new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); /* If program file name is not absolute, search our path for it */ + #ifdef EMX + if (!_fnisabs (XSTRING (program)->data)) + #else /* not EMX */ if (XSTRING (program)->data[0] != '/') + #endif /* not EMX */ { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; *************** *** 1198,1203 **** --- 1230,1239 ---- pipe (sv); outchannel = sv[1]; forkin = sv[0]; + #ifdef EMX + emx_proc_output_pipe (inchannel); + emx_proc_input_pipe (outchannel); + #endif /* EMX */ } #endif /* not SKTPAIR */ *************** *** 1394,1403 **** --- 1430,1444 ---- #endif /* not BSD4_1 */ #endif /* SIGCHLD */ + #ifdef EMX + pid = emx_child_setup (xforkin, xforkout, xforkout, + new_argv, 1, current_dir); + #else /* not EMX */ if (pty_flag) child_setup_tty (xforkout); child_setup (xforkin, xforkout, xforkout, new_argv, 1, current_dir); + #endif /* not EMX */ } environ = save_environ; } *************** *** 1408,1414 **** --- 1449,1459 ---- close (forkin); if (forkin != forkout && forkout >= 0) close (forkout); + #ifndef EMX report_file_error ("Doing vfork", Qnil); + #else /* EMX */ + report_file_error ("Starting process", Qnil); + #endif /* EMX */ } XFASTINT (XPROCESS (process)->pid) = pid; *************** *** 1684,1689 **** --- 1729,1735 ---- close_process_descs () { int i; + #ifndef EMX for (i = 0; i < MAXDESC; i++) { Lisp_Object process; *************** *** 1698,1703 **** --- 1744,1753 ---- close (out); } } + #else /* EMX */ + for (i = 3; i < MAXDESC; i++) + fcntl (i, F_SETFD, 1); + #endif /* EMX */ } DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, *************** *** 2195,2200 **** --- 2245,2254 ---- } #else /* not VMS */ + #ifdef EMX + fcntl (channel, F_SETFL, O_NDELAY); + #endif /* EMX */ + if (proc_buffered_char[channel] < 0) nchars = read (channel, chars, sizeof chars); else *************** *** 3001,3009 **** --- 3055,3067 ---- Otherwise (on systems that have WNOHANG), loop around to use up all the processes that have something to tell us. */ #if defined (USG) && ! (defined (HPUX) && defined (WNOHANG)) + #ifdef EMX + signal (signo, SIG_ACK); + #else /* not EMX */ #ifdef USG signal (signo, sigchld_handler); #endif + #endif /* not EMX */ errno = old_errno; return; #endif /* USG, but not HPUX with WNOHANG */ *************** *** 3196,3201 **** --- 3254,3263 ---- syms_of_process () { + #ifdef EMX + Qstart_process = intern ("start-process"); + staticpro (&Qstart_process); + #endif /* EMX */ #ifdef HAVE_SOCKETS stream_process = intern ("stream"); #endif diff -c emacs-19\src\sysdep.c:1.1.1.17 emacs-19\src\sysdep.c:1.26 *** emacs-19\src\sysdep.c:1.1.1.17 Sun Jun 05 23:21:40 1994 --- emacs-19\src\sysdep.c Sun Jun 05 23:21:44 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 484,489 **** --- 485,493 ---- s.main.c_cc[VTIME] = 0; /* wait forever for at least 1 character */ #endif + #ifdef EMX + s.main.c_lflag |= IDEFAULT; /* Disable termio */ + #endif /* EMX */ s.main.c_lflag |= ICANON; /* Enable erase/kill and eof processing */ s.main.c_cc[VEOF] = 04; /* insure that EOF is Control-D */ s.main.c_cc[VERASE] = 0377; /* disable erase processing */ *************** *** 624,634 **** --- 628,642 ---- #else /* No SIGTSTP or USG_JOBCTRL */ + #ifdef EMX + system (""); + #else /* not EMX */ /* On a system where suspending is not implemented, instead fork a subshell and let it talk directly to the terminal while we wait. */ sys_subshell (); + #endif /* not EMX */ #endif /* no USG_JOBCTRL */ #endif /* no SIGTSTP */ #endif /* not VMS */ *************** *** 1143,1148 **** --- 1151,1160 ---- tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ #endif tty.main.c_lflag &= ~ECHO; /* Disable echo */ + #ifdef EMX + tty.main.c_iflag |= IDELETE; /* Backspace key should send DEL */ + tty.main.c_lflag &= ~IDEFAULT; /* Enable termio */ + #endif /* EMX */ tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */ #ifdef IEXTEN tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ *************** *** 1344,1349 **** --- 1356,1364 ---- #else setbuf (stdout, _sobuf); #endif + #ifdef EMX + _fsetmode (stdout, "b"); + #endif /* EMX */ set_terminal_modes (); if (term_initted && no_redraw_on_reenter) { *************** *** 1422,1430 **** --- 1437,1452 ---- #ifdef MSDOS *widthp = ScreenCols (); *heightp = ScreenRows (); + + #else + #ifdef EMX + int sz[2]; + _scrsize (sz); + *widthp = sz[0]; *heightp = sz[1]; #else /* system doesn't know size */ *widthp = 0; *heightp = 0; + #endif /* not EMX */ #endif #endif /* not VMS */ diff -c emacs-19\src\term.c:1.1.1.10 emacs-19\src\term.c:1.12 *** emacs-19\src\term.c:1.1.1.10 Sun Jun 05 23:21:58 1994 --- emacs-19\src\term.c Sun Jun 05 23:22:00 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 322,327 **** --- 323,331 ---- OUTPUT_IF (TS_end_keypad_mode); OUTPUT_IF (TS_end_visual_mode); OUTPUT_IF (TS_end_termcap_modes); + #ifdef EMX + _fsetmode (stdout, "t"); + #endif /* EMX */ /* Output raw CR so kernel can track the cursor hpos. */ /* But on magic-cookie terminals this can erase an end-standout marker and cause the rest of the frame to be in standout, so move down first. */ diff -c emacs-19\src\termcap.c:1.1.1.6 emacs-19\src\termcap.c:1.14 *** emacs-19\src\termcap.c:1.1.1.6 Sun Jun 05 23:22:06 1994 --- emacs-19\src\termcap.c Sun Jun 05 23:22:06 1994 *************** *** 15,20 **** --- 15,22 ---- along with this program; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + /* Emacs config.h may rename various library functions such as malloc. */ #ifdef HAVE_CONFIG_H #include *************** *** 338,343 **** --- 340,350 ---- static int compare_contin (); static int name_match (); + #ifdef EMX + + #define valid_filename_p(fn) (PATH_DELIM_P (*(fn)) || _fngetdrive (fn)) + + #else /* not EMX */ #ifdef VMS #include *************** *** 377,382 **** --- 384,390 ---- #endif #endif /* !VMS */ + #endif /* not EMX */ /* Find the termcap entry data for terminal type NAME and store it in the block that BP points to. diff -c emacs-19\src\xdisp.c:1.1.1.16 emacs-19\src\xdisp.c:1.22 *** emacs-19\src\xdisp.c:1.1.1.16 Sun Jun 05 23:22:58 1994 --- emacs-19\src\xdisp.c Sun Jun 05 23:23:00 1994 *************** *** 17,22 **** --- 17,23 ---- along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ #include #include *************** *** 2954,2964 **** --- 2955,2969 ---- break; case 't': /* indicate TEXT or BINARY */ + #ifdef EMX + return NILP (current_buffer->emx_binary_mode) ? "T" : "B"; + #else /* not EMX */ #ifdef MSDOS return NILP (current_buffer->buffer_file_type) ? "T" : "B"; #else /* not MSDOS */ return "T"; #endif /* not MSDOS */ + #endif /* not EMX */ case 'p': { diff -c emacs-19\src\xfaces.c:1.1.1.15 emacs-19\src\xfaces.c:1.34 *** emacs-19\src\xfaces.c:1.1.1.15 Sun Jun 05 23:23:20 1994 --- emacs-19\src\xfaces.c Sun Jun 05 23:23:22 1994 *************** *** 19,24 **** --- 19,26 ---- /* This is derived from work by Lucid (some parts very loosely so). */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include #include *************** *** 27,33 **** --- 29,40 ---- #ifdef HAVE_X_WINDOWS + #ifndef EMX #include "xterm.h" + #else /* EMX */ + #include "pmterm.h" + #include "pmemacs.h" + #endif /* EMX */ #include "buffer.h" #include "dispextern.h" #include "frame.h" *************** *** 48,54 **** --- 55,63 ---- #else + #ifndef EMX #include + #endif /* not EMX */ #endif *************** *** 338,343 **** --- 347,355 ---- /* Make a graphics context for face FACE, which is on frame F, if that can be done. */ + + #ifndef EMX + static void build_face (f, face) struct frame *f; *************** *** 380,385 **** --- 392,432 ---- UNBLOCK_INPUT; } + #else /* EMX */ + + static void + build_face (f, face) + struct frame *f; + struct face *face; + { + pm_request pmr; + char *name; + + if (face->foreground != FACE_DEFAULT) + pmr.face.foreground = face->foreground; + else + pmr.face.foreground = f->display.x->foreground_color; + if (face->background != FACE_DEFAULT) + pmr.face.background = face->background; + else + pmr.face.background = f->display.x->background_color; + if (face->font && (int)face->font != FACE_DEFAULT) + name = face->font->name; + else + name = ""; + pmr.face.name_length = strlen (name); + pmr.face.underline = face->underline; + pmr.face.serial = pm_serial++; + pmr.face.header.type = PMR_FACE; + pmr.face.header.frame = (unsigned long)f; + pm_send (&pmr, sizeof (pmr)); + pm_send (name, pmr.face.name_length); + if (!pm_receive (pmr.face.serial, &face->gc, 0, 0)) + face->gc = 0; + } + + #endif /* EMX */ + /* Allocating, freeing, and duplicating fonts, colors, and pixmaps. */ static XFontStruct * *************** *** 645,654 **** --- 692,705 ---- same_size_fonts (font1, font2) XFontStruct *font1, *font2; { + #ifndef EMX XCharStruct *bounds1 = &font1->min_bounds; XCharStruct *bounds2 = &font2->min_bounds; return (bounds1->width == bounds2->width); + #else /* EMX */ + return 1; + #endif /* EMX */ } /* Update the line_height of frame F according to the biggest font in *************** *** 710,718 **** --- 761,775 ---- struct x_display *d = f->display.x; face->gc = 0; + #ifndef EMX face->foreground = d->foreground_pixel; face->background = d->background_pixel; face->font = d->font; + #else + face->foreground = d->foreground_color; + face->background = d->background_color; + face->font = 0; + #endif face->stipple = 0; face->underline = 0; *************** *** 983,990 **** --- 1040,1049 ---- if (EQ (attr_name, intern ("font"))) { XFontStruct *font = load_font (f, attr_value); + #ifndef EMX if (face->font != f->display.x->font) unload_font (f, face->font); + #endif /* not EMX */ face->font = font; if (frame_update_line_height (f)) x_set_window_size (f, 0, f->width, f->height); diff -c emacs-19\src\xmenu.c:1.1.1.15 emacs-19\src\xmenu.c:1.50 *** emacs-19\src\xmenu.c:1.1.1.15 Sun Jun 05 23:24:06 1994 --- emacs-19\src\xmenu.c Sun Jun 05 23:24:10 1994 *************** *** 29,34 **** --- 29,36 ---- /* Rewritten for clarity and GC protection by rms in Feb 94. */ + /* Modified for emx by Eberhard Mattes, Jun 1994 */ + #include /* On 4.3 this loses if it comes after xterm.h. */ *************** *** 41,49 **** --- 43,56 ---- #include "keyboard.h" #include "blockinput.h" + #ifdef EMX + #include "pmterm.h" + #include "pmemacs.h" + #else /* not EMX */ /* This may include sys/types.h, and that somehow loses if this is not done before the other system files. */ #include "xterm.h" + #endif /* not EMX */ /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ *************** *** 53,58 **** --- 60,66 ---- #include "dispextern.h" + #ifndef EMX #ifdef HAVE_X11 #include "../oldXMenu/XMenu.h" #else *************** *** 68,73 **** --- 76,82 ---- #include "../lwlib/lwlib.h" #include "../lwlib/xlwmenuP.h" #endif /* USE_X_TOOLKIT */ + #endif /* not EMX */ #define min(x,y) (((x) < (y)) ? (x) : (y)) #define max(x,y) (((x) > (y)) ? (x) : (y)) *************** *** 89,97 **** --- 98,114 ---- extern Lisp_Object Qmenu_enable; extern Lisp_Object Qmenu_bar; + #ifdef EMX + static int pm_menu_button; + static int pm_align_menu_key_descriptions; + static int pm_popup_menu_align_top; + #endif /* EMX */ + #ifdef USE_X_TOOLKIT + #ifndef EMX extern void process_expose_from_menu (); extern XtAppContext Xt_app_con; + #endif /* not EMX */ static Lisp_Object xdialog_show (); #endif *************** *** 344,351 **** --- 361,378 ---- if (!NILP (savedkey)) { descrip = Fkey_description (savedkey); + #ifndef EMX descrip = concat2 (make_string (" (", 3), descrip); descrip = concat2 (descrip, make_string (")", 1)); + #else /* EMX */ + if (pm_align_menu_key_descriptions) + descrip = concat2 (make_string ("\t", 1), descrip); + else + { + descrip = concat2 (make_string (" (", 3), descrip); + descrip = concat2 (descrip, make_string (")", 1)); + } + #endif /* EMX */ } } *************** *** 686,691 **** --- 713,721 ---- int menubarp = 0; struct gcpro gcpro1; + #ifdef EMX + pm_menu_button = 0; + #endif /* EMX */ if (! NILP (position)) { check_x (); *************** *** 731,736 **** --- 761,771 ---- tem = Fcar (Fcdr (Fcar (Fcdr (position)))); if (CONSP (tem) && EQ (Fcar (tem), Qmenu_bar)) menubarp = 1; + #ifdef EMX + if (menubarp && pm_menu_bar_cookie == 0) + menubarp = 0; + pm_menu_button = menubarp ? -1 : pm_event_button (position); + #endif /* EMX */ } } *************** *** 969,974 **** --- 1004,1010 ---- } #ifdef USE_X_TOOLKIT + #ifndef EMX static void dispatch_dummy_expose (w, x, y) *************** *** 1329,1334 **** --- 1365,1371 ---- return 0; } + #endif /* not EMX */ #endif /* USE_X_TOOLKIT */ /* xmenu_show actually displays a menu using the panes and items in menu_items *************** *** 1347,1352 **** --- 1384,1390 ---- ERROR is a place to store an error message string in case of failure. (We return nil on failure, but the value doesn't actually matter.) */ + #ifndef EMX #ifdef USE_X_TOOLKIT extern unsigned int x_mouse_grabbed; *************** *** 2264,2274 **** --- 2302,2710 ---- return entry; } #endif /* not USE_X_TOOLKIT */ + + #else /* EMX */ + + static int pmmenu_count; + static int pmmenu_alloc; + static pm_menu *pmmenu_menu; + static int pmmenu_str_size; + static int pmmenu_str_alloc; + static char *pmmenu_str; + + static void pmmenu_add (const pm_menu *pmm) + { + if (pmmenu_count >= pmmenu_alloc) + { + pmmenu_alloc += 512; + pmmenu_menu = (pm_menu *)xrealloc (pmmenu_menu, + pmmenu_alloc * sizeof (pm_menu)); + } + pmmenu_menu[pmmenu_count++] = *pmm; + } + + + /* Copy S to D, replacing ~ characters with ~~. */ + + static void tilde_expand (char *d, const char *s) + { + while (*s != 0) + { + if (*s == '~') + *d++ = *s; + *d++ = *s++; + } + *d = 0; + } + + + /* Compute the length of string S. If TILDE is true, count ~ + characters twice. Store the length to *LEN. Return true if TILDE + is true and there are any ~ characters. */ + + static int tilde_len (int *len, const char *s, int tilde) + { + int nc = 0, nt = 0; + + if (tilde) + while (*s != 0) + { + if (*s == '~') + ++nt; + ++nc; ++s; + } + else + nc = strlen (s); + *len = nc + nt; + return nt != 0; + } + + + /* Add the concatenation of S1 and S2 to the string pool for sending + it to pmemacs.exe. Replace ~ with ~~ if TILDE is true. Return the + offset of the string. */ + + static int pmmenu_add_str (const char *s1, const char *s2, int tilde) + { + int len1, len2; + int result = pmmenu_str_size; + + if (tilde_len (&len1, s1, tilde)) + { + char *tem = alloca (len1 + 1); + tilde_expand (tem, s1); + s1 = tem; + } + if (tilde_len (&len2, s2, tilde)) + { + char *tem = alloca (len2 + 1); + tilde_expand (tem, s2); + s2 = tem; + } + ++len2; /* Include the terminating null character */ + while (pmmenu_str_size + len1 + len2 > pmmenu_str_alloc) + { + pmmenu_str_alloc += 4096; + pmmenu_str = (char *)xrealloc (pmmenu_str, pmmenu_str_alloc); + } + bcopy (s1, pmmenu_str + pmmenu_str_size, len1); + bcopy (s2, pmmenu_str + pmmenu_str_size + len1, len2); + pmmenu_str_size += len1 + len2; + return result; + } + + + static Lisp_Object + xmenu_show (f, x, y, menubarp, keymaps, title, error) + FRAME_PTR f; + int x, y; + int keymaps; + int menubarp; + Lisp_Object title; + char **error; + { + int i, sel, serial; + Lisp_Object *subprefix_stack + = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); + int submenu_depth = 0; + pm_request pmr; + pm_menu pmm; + + *error = 0; + if (menu_items_n_panes == 0) + return Qnil; + + if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) + { + *error = "Empty menu"; + return Qnil; + } + + pmmenu_count = 0; pmmenu_str_size = 0; + /* Loop over all panes and items, filling in the tree. */ + i = 0; sel = 0; + while (i < menu_items_used) + { + if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) + { + pmm.type = PMMENU_PUSH; + pmmenu_add (&pmm); + submenu_depth++; + i++; + } + else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) + { + pmm.type = PMMENU_POP; + pmmenu_add (&pmm); + --submenu_depth; + i++; + } + else if (EQ (XVECTOR (menu_items)->contents[i], Qt) + && submenu_depth != 0) + i += MENU_ITEMS_PANE_LENGTH; + /* Ignore a nil in the item list. + It's meaningful only for dialog boxes. */ + else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) + i += 1; + else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) + { + /* Create a new pane. */ + Lisp_Object pane_name, prefix; + char *pane_string; + pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; + prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; + pane_string = (NILP (pane_name) + ? "" : (char *) XSTRING (pane_name)->data); + /* If there is just one top-level pane, put all its items directly + under the top-level menu. */ + if (menu_items_n_panes == 1) + pane_string = ""; + + /* If the pane has a meaningful name, + make the pane a top-level menu item + with its items as a submenu beneath it. */ + if (!keymaps && strcmp (pane_string, "")) + { + if (keymaps && !NILP (prefix)) + pane_string++; + pmm.type = PMMENU_SUB; + pmm.item = 0; + pmm.str_offset = pmmenu_add_str (pane_string, "", 1); + pmm.enable = 1; + pmmenu_add (&pmm); + } + i += MENU_ITEMS_PANE_LENGTH; + } + else + { + /* Create a new item within current pane. */ + Lisp_Object item_name, enable, descrip, value; + item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; + value = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; + enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; + descrip + = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; + + pmm.type = PMMENU_ITEM; + pmm.item = ++sel; + pmm.str_offset = pmmenu_add_str (XSTRING (item_name)->data, + (NILP (descrip) ? "" + : (char*)XSTRING (descrip)->data), + 1); + pmm.enable = !NILP (enable); + pmmenu_add (&pmm); + i += MENU_ITEMS_ITEM_LENGTH; + } + } + + pmm.type = PMMENU_END; + pmmenu_add (&pmm); + + if (pm_menu_button == -1) + { + pmr.menu.header.type = PMR_MENU; + pmr.menu.header.frame = (unsigned long)f; + pmr.menu.serial = serial = pm_serial++; + pmr.menu.count = pmmenu_count; + pmr.menu.size = pmmenu_count * sizeof (pm_menu) + pmmenu_str_size; + pmr.menu.cookie = pm_menu_bar_cookie; + pm_menu_bar_cookie = 0; + } + else + { + pmr.popupmenu.header.type = PMR_POPUPMENU; + pmr.popupmenu.header.frame = (unsigned long)f; + pmr.popupmenu.serial = serial = pm_serial++; + pmr.popupmenu.x = x; + pmr.popupmenu.y = y; + pmr.popupmenu.align_top = pm_popup_menu_align_top; + pmr.popupmenu.button = pm_menu_button; + pmr.popupmenu.count = pmmenu_count; + pmr.popupmenu.size = pmmenu_count * sizeof (pm_menu) + pmmenu_str_size; + } + pm_send (&pmr, sizeof (pmr)); + pm_send (pmmenu_menu, pmmenu_count * sizeof (pm_menu)); + pm_send (pmmenu_str, pmmenu_str_size); + if (pm_receive (serial, &sel, NULL, 0) == NULL) + sel = 0; + + /* Find the selected item, and its pane, to return the proper value. */ + + if (sel != 0) + { + Lisp_Object prefix; + + prefix = Qnil; + i = 0; + while (i < menu_items_used) + { + Lisp_Object entry; + + if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) + { + subprefix_stack[submenu_depth++] = prefix; + prefix = entry; + i++; + } + else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) + { + prefix = subprefix_stack[--submenu_depth]; + i++; + } + else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) + { + prefix + = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; + i += MENU_ITEMS_PANE_LENGTH; + } + else + { + entry + = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; + if (--sel == 0) + { + if (keymaps != 0) + { + int j; + + entry = Fcons (entry, Qnil); + if (!NILP (prefix)) + entry = Fcons (prefix, entry); + for (j = submenu_depth - 1; j >= 0; j--) + if (!NILP (subprefix_stack[j])) + entry = Fcons (subprefix_stack[j], entry); + } + return entry; + } + i += MENU_ITEMS_ITEM_LENGTH; + } + } + } + return Qnil; + } + + static Lisp_Object + xdialog_show (f, menubarp, keymaps, title, error) + FRAME_PTR f; + int menubarp; + int keymaps; + Lisp_Object title; + char **error; + { + int nb_buttons = 0; + int i, sel; + pm_request pmr; + pm_menu pmm; + + *error = NULL; + + if (menu_items_n_panes > 1) + { + *error = "Multiple panes in dialog box"; + return Qnil; + } + + pmmenu_count = 0; pmmenu_str_size = 0; + + if (XSTRING (title)->size != 0) + { + pmm.type = PMMENU_TITLE; + pmm.item = 0; + pmm.str_offset = pmmenu_add_str (XSTRING (title)->data, "", 0); + pmm.enable = 0; + pmmenu_add (&pmm); + } + + /* Loop over all panes and items, filling in the tree. */ + i = MENU_ITEMS_PANE_LENGTH; + while (i < menu_items_used) + { + + /* Create a new item within current pane. */ + Lisp_Object item_name, enable; + item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; + enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; + + if (NILP (item_name)) + { + *error = "Submenu in dialog items"; + return Qnil; + } + if (EQ (item_name, Qquote)) + { + /* This is the boundary between left-side elts + and right-side elts. */ + i++; + continue; + } + if (nb_buttons >= 10) + { + *error = "Too many dialog items"; + return Qnil; + } + + pmm.type = PMMENU_ITEM; + pmm.item = i + 1; + pmm.str_offset = pmmenu_add_str (XSTRING (item_name)->data, "", 0); + pmm.enable = !NILP (enable); + pmmenu_add (&pmm); + + nb_buttons++; + i += MENU_ITEMS_ITEM_LENGTH; + } + + pmm.type = PMMENU_END; + pmmenu_add (&pmm); + + pmr.dialog.header.type = PMR_DIALOG; + pmr.dialog.header.frame = (unsigned long)f; + pmr.dialog.serial = pm_serial++; + pmr.dialog.buttons = nb_buttons; + pmr.dialog.count = pmmenu_count; + pmr.dialog.size = pmmenu_count * sizeof (pm_menu) + pmmenu_str_size; + pm_send (&pmr, sizeof (pmr)); + pm_send (pmmenu_menu, pmmenu_count * sizeof (pm_menu)); + pm_send (pmmenu_str, pmmenu_str_size); + if (pm_receive (pmr.dialog.serial, &sel, NULL, 1) == NULL) + sel = 0; + if (sel == 0) + return Qnil; + return XVECTOR (menu_items)->contents[sel - 1 + MENU_ITEMS_ITEM_VALUE]; + } + + + void + set_frame_menubar (f, first_time) + FRAME_PTR f; + int first_time; + { + if (NILP (FRAME_MENU_BAR_ITEMS (f))) + FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); + if (!first_time) + update_frame_menubar (f); + } + #endif /* EMX */ syms_of_xmenu () { staticpro (&menu_items); menu_items = Qnil; + + #ifdef EMX + DEFVAR_BOOL ("pm-align-menu-key-descriptions", + &pm_align_menu_key_descriptions, + "*Non-nil means align key descriptions in menus.\n\ + nil means put key descriptions directly after the title of a\n\ + menu item, in parentheses. You should set this variable\n\ + in your startup file because it is ignored after computing\n\ + the keyboard equivalents for menus."); + pm_align_menu_key_descriptions = 1; + + DEFVAR_BOOL ("pm-popup-menu-align-top", &pm_popup_menu_align_top, + "*Non-nil means put the top item of a popup menu at the mouse position.\n\ + nil means put the bottom item of a popup menu at the mouse position."); + pm_popup_menu_align_top = 1; + #endif /* EMX */ popup_id_tick = (1<<16); defsubr (&Sx_popup_menu);