1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

*** empty log message ***

This commit is contained in:
Jim Blandy 1992-08-04 04:09:07 +00:00
parent 29929437a3
commit 0b030df78b
4 changed files with 99 additions and 60 deletions

View file

@ -691,25 +691,34 @@ list accessors: first, second, ..., tenth, rest."
(arg (cadr form)) (arg (cadr form))
(valid *cl-valid-named-list-accessors*) (valid *cl-valid-named-list-accessors*)
(offsets *cl-valid-nth-offsets*)) (offsets *cl-valid-nth-offsets*))
(if (or (null (cdr form)) (cddr form)) (cond
(error "%s needs exactly one argument, seen `%s'"
fun (prin1-to-string form))) ;; Check that it's a form we're prepared to handle.
(if (not (memq fun valid)) ((not (memq fun valid))
(error "`%s' not in {first, ..., tenth, rest}" fun)) (error
(cond ((eq fun 'first) "cl.el internal bug: `%s' not in {first, ..., tenth, rest}"
(byte-compile-form arg) fun))
(setq byte-compile-depth (1- byte-compile-depth))
(byte-compile-out byte-car 0)) ;; Check the number of arguments.
((eq fun 'rest) ((not (= (length form) 2))
(byte-compile-form arg) (byte-compile-subr-wrong-args form 1))
(setq byte-compile-depth (1- byte-compile-depth))
(byte-compile-out byte-cdr 0)) ;; If the result will simply be tossed, don't generate any code for
(t ;one of the others ;; it, and indicate that we have already discarded the value.
(byte-compile-constant (cdr (assoc fun offsets))) (for-effect
(byte-compile-form arg) (setq for-effect nil))
(setq byte-compile-depth (1- byte-compile-depth))
(byte-compile-out byte-nth 0) ;; Generate code for the call.
)))) ((eq fun 'first)
(byte-compile-form arg)
(byte-compile-out 'byte-car 0))
((eq fun 'rest)
(byte-compile-form arg)
(byte-compile-out 'byte-cdr 0))
(t ;one of the others
(byte-compile-constant (cdr (assq fun offsets)))
(byte-compile-form arg)
(byte-compile-out 'byte-nth 0)))))
;;; Synonyms for list functions ;;; Synonyms for list functions
(defun first (x) (defun first (x)
@ -851,18 +860,31 @@ To use this functionality for a given function,just give its name a
'byte-car 'byte-cdr))) 'byte-car 'byte-cdr)))
(cdr (nreverse (cdr (append (symbol-name fun) nil))))))) (cdr (nreverse (cdr (append (symbol-name fun) nil)))))))
;; SEQ is a list of byte-car and byte-cdr in the correct order. ;; SEQ is a list of byte-car and byte-cdr in the correct order.
(if (null seq) (cond
(error "internal: `%s' cannot be compiled by byte-compile-ca*d*r"
(prin1-to-string form))) ;; Is this a function we can handle?
(if (or (null (cdr form)) (cddr form)) ((null seq)
(error "%s needs exactly one argument, seen `%s'" (error
fun (prin1-to-string form))) "cl.el internal bug: `%s' cannot be compiled by byte-compile-ca*d*r"
(byte-compile-form arg) (prin1-to-string form)))
(setq byte-compile-depth (1- byte-compile-depth))
;; the rest of this code doesn't change the stack depth! ;; Are we passing this function the correct number of arguments?
(while seq ((or (null (cdr form)) (cddr form))
(byte-compile-out (car seq) 0) (byte-compile-subr-wrong-args form 1))
(setq seq (cdr seq)))))
;; Are we evaluating this expression for effect only?
(for-effect
;; We needn't generate any actual code, as long as we tell the rest
;; of the compiler that we didn't push anything on the stack.
(setq for-effect nil))
;; Generate code for the function.
(t
(byte-compile-form arg)
(while seq
(byte-compile-out (car seq) 0)
(setq seq (cdr seq)))))))
(defun caar (X) (defun caar (X)
"Return the car of the car of X." "Return the car of the car of X."

View file

@ -242,7 +242,8 @@ If it is 'byte, then only byte-level optimizations will be logged.")
of `message.'") of `message.'")
(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved)) (defconst byte-compile-warning-types '(redefine callargs free-vars unresolved))
(defvar byte-compile-warnings (not noninteractive) (defvar byte-compile-warnings (if noninteractive nil
(delq 'free-vars byte-compile-warning-types))
"*List of warnings that the byte-compiler should issue (t for all). "*List of warnings that the byte-compiler should issue (t for all).
Valid elements of this list are: Valid elements of this list are:
`free-vars' (references to variables not in the `free-vars' (references to variables not in the
@ -734,6 +735,14 @@ otherwise pop it")
;;; (message "Warning: %s" format)) ;;; (message "Warning: %s" format))
)) ))
;;; This function should be used to report errors that have halted
;;; compilation of the current file.
(defun byte-compile-report-error (error-info)
(setq format (format (if (cdr error-info) "%s (%s)" "%s")
(get (car error-info) 'error-message)
(prin1-to-string (cdr error-info))))
(byte-compile-log-1 (concat "!! " format)))
;;; Used by make-obsolete. ;;; Used by make-obsolete.
(defun byte-compile-obsolete (form) (defun byte-compile-obsolete (form)
(let ((new (get (car form) 'byte-obsolete-info))) (let ((new (get (car form) 'byte-obsolete-info)))
@ -1004,7 +1013,11 @@ otherwise pop it")
(save-excursion (save-excursion
(set-buffer (get-buffer-create "*Compile-Log*")) (set-buffer (get-buffer-create "*Compile-Log*"))
(point-max))))) (point-max)))))
(list 'unwind-protect (cons 'progn body) (list 'unwind-protect
(list 'condition-case 'error-info
(cons 'progn body)
'(error
(byte-compile-report-error error-info)))
'(save-excursion '(save-excursion
;; If there were compilation warnings, display them. ;; If there were compilation warnings, display them.
(set-buffer "*Compile-Log*") (set-buffer "*Compile-Log*")
@ -1090,28 +1103,31 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling."
(set-auto-mode) (set-auto-mode)
(setq filename buffer-file-name)) (setq filename buffer-file-name))
(kill-buffer (prog1 (current-buffer) (kill-buffer (prog1 (current-buffer)
(set-buffer (byte-compile-from-buffer (current-buffer))))) (set-buffer
(byte-compile-from-buffer (current-buffer)))))
(goto-char (point-max)) (goto-char (point-max))
(insert "\n") ; aaah, unix. (insert "\n") ; aaah, unix.
(let ((vms-stmlf-recfm t)) (let ((vms-stmlf-recfm t))
(setq target-file (byte-compile-dest-file filename)) (setq target-file (byte-compile-dest-file filename))
;; (or byte-compile-overwrite-file ;; (or byte-compile-overwrite-file
;; (condition-case () ;; (condition-case ()
;; (delete-file target-file) ;; (delete-file target-file)
;; (error nil))) ;; (error nil)))
(if (file-writable-p target-file) (if (file-writable-p target-file)
(let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki (let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki
(write-region 1 (point-max) target-file)) (write-region 1 (point-max) target-file))
;; This is just to give a better error message than write-region ;; This is just to give a better error message than
(signal 'file-error (list "Opening output file" ;; write-region
(if (file-exists-p target-file) (signal 'file-error
"cannot overwrite file" (list "Opening output file"
"directory not writable or nonexistent") (if (file-exists-p target-file)
target-file))) "cannot overwrite file"
;; (or byte-compile-overwrite-file "directory not writable or nonexistent")
;; (condition-case () target-file)))
;; (set-file-modes target-file (file-modes filename)) ;; (or byte-compile-overwrite-file
;; (error nil))) ;; (condition-case ()
;; (set-file-modes target-file (file-modes filename))
;; (error nil)))
) )
(kill-buffer (current-buffer))) (kill-buffer (current-buffer)))
(if (and byte-compile-generate-call-tree (if (and byte-compile-generate-call-tree
@ -1180,17 +1196,17 @@ With argument, insert value in current buffer after the form."
(byte-compile-depth 0) (byte-compile-depth 0)
(byte-compile-maxdepth 0) (byte-compile-maxdepth 0)
(byte-compile-output nil) (byte-compile-output nil)
;; #### This is bound in b-c-close-variables. ;; #### This is bound in b-c-close-variables.
;;(byte-compile-warnings (if (eq byte-compile-warnings t) ;; (byte-compile-warnings (if (eq byte-compile-warnings t)
;; byte-compile-warning-types ;; byte-compile-warning-types
;; byte-compile-warnings)) ;; byte-compile-warnings))
) )
(byte-compile-close-variables (byte-compile-close-variables
(save-excursion (save-excursion
(setq outbuffer (setq outbuffer
(set-buffer (get-buffer-create " *Compiler Output*"))) (set-buffer (get-buffer-create " *Compiler Output*")))
(erase-buffer) (erase-buffer)
;; (emacs-lisp-mode) ;; (emacs-lisp-mode)
(setq case-fold-search nil)) (setq case-fold-search nil))
(displaying-byte-compile-warnings (displaying-byte-compile-warnings
(save-excursion (save-excursion
@ -1206,8 +1222,9 @@ With argument, insert value in current buffer after the form."
(byte-compile-flush-pending) (byte-compile-flush-pending)
(and (not eval) (byte-compile-insert-header)) (and (not eval) (byte-compile-insert-header))
(byte-compile-warn-about-unresolved-functions) (byte-compile-warn-about-unresolved-functions)
;; always do this? When calling multiple files, it would be useful ;; always do this? When calling multiple files, it
;; to delay this warning until all have been compiled. ;; would be useful to delay this warning until all have
;; been compiled.
(setq byte-compile-unresolved-functions nil))) (setq byte-compile-unresolved-functions nil)))
(save-excursion (save-excursion
(set-buffer outbuffer) (set-buffer outbuffer)

View file

@ -76,7 +76,7 @@ See definition of `print-region-1' for calling conventions.")
(if page-headers (if page-headers
(if (eq system-type 'usg-unix-v) (if (eq system-type 'usg-unix-v)
(progn (progn
(print-region-new-buffer) (print-region-new-buffer start end)
(call-process-region start end "pr" t t nil)) (call-process-region start end "pr" t t nil))
;; On BSD, use an option to get page headers. ;; On BSD, use an option to get page headers.
(setq switches (cons "-p" switches)))) (setq switches (cons "-p" switches))))
@ -92,7 +92,7 @@ See definition of `print-region-1' for calling conventions.")
;; into a new buffer, makes that buffer current, ;; into a new buffer, makes that buffer current,
;; and sets start and end to the buffer bounds. ;; and sets start and end to the buffer bounds.
;; start and end are used free. ;; start and end are used free.
(defun print-region-new-buffer () (defun print-region-new-buffer (start end)
(or (string= (buffer-name) " *spool temp*") (or (string= (buffer-name) " *spool temp*")
(let ((oldbuf (current-buffer))) (let ((oldbuf (current-buffer)))
(set-buffer (get-buffer-create " *spool temp*")) (set-buffer (get-buffer-create " *spool temp*"))

View file

@ -582,7 +582,7 @@ NOT including one on this line."
(hif-endif-to-ifdef)) (hif-endif-to-ifdef))
((hif-looking-at-ifX) ((hif-looking-at-ifX)
'done) 'done)
(t ; never gets here))) (t))) ; never gets here
(defun forward-ifdef (&optional arg) (defun forward-ifdef (&optional arg)