Mercurial > emacs
comparison lisp/emacs-lisp/bytecomp.el @ 105847:ca4611bcf0d4
(byte-compile-version-cond): Remove macro.
(byte-compile-compatibility): Remove option.
(byte-compile-close-variables, byte-compile-fix-header)
(byte-compile-insert-header, byte-compile-output-docform)
(byte-compile-file-form-defmumble, byte-compile-byte-code-maker)
(byte-compile-lambda, byte-compile-form, byte-defop-compiler19)
(byte-compile-list, byte-compile-concat, byte-compile-function-form)
(byte-compile-insert, byte-compile-defun):
Remove support for byte-compile-compatibility and Emacs 18. (Bug#4571)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 04 Nov 2009 03:15:14 +0000 |
parents | 56392d7b0ff4 |
children | e7f7399383e9 |
comparison
equal
deleted
inserted
replaced
105846:e2ca82d9bfab | 105847:ca4611bcf0d4 |
---|---|
123 (load "byte-run")) | 123 (load "byte-run")) |
124 | 124 |
125 ;; The feature of compiling in a specific target Emacs version | 125 ;; The feature of compiling in a specific target Emacs version |
126 ;; has been turned off because compile time options are a bad idea. | 126 ;; has been turned off because compile time options are a bad idea. |
127 (defmacro byte-compile-single-version () nil) | 127 (defmacro byte-compile-single-version () nil) |
128 (defmacro byte-compile-version-cond (cond) cond) | |
129 | 128 |
130 ;; The crud you see scattered through this file of the form | 129 ;; The crud you see scattered through this file of the form |
131 ;; (or (and (boundp 'epoch::version) epoch::version) | 130 ;; (or (and (boundp 'epoch::version) epoch::version) |
132 ;; (string-lessp emacs-version "19")) | 131 ;; (string-lessp emacs-version "19")) |
133 ;; is because the Epoch folks couldn't be bothered to follow the | 132 ;; is because the Epoch folks couldn't be bothered to follow the |
217 (autoload 'byte-decompile-bytecode "byte-opt") | 216 (autoload 'byte-decompile-bytecode "byte-opt") |
218 | 217 |
219 (defcustom byte-compile-verbose | 218 (defcustom byte-compile-verbose |
220 (and (not noninteractive) (> baud-rate search-slow-speed)) | 219 (and (not noninteractive) (> baud-rate search-slow-speed)) |
221 "Non-nil means print messages describing progress of byte-compiler." | 220 "Non-nil means print messages describing progress of byte-compiler." |
222 :group 'bytecomp | |
223 :type 'boolean) | |
224 | |
225 (defcustom byte-compile-compatibility nil | |
226 "Non-nil means generate output that can run in Emacs 18. | |
227 This only means that it can run in principle, if it doesn't require | |
228 facilities that have been added more recently." | |
229 :group 'bytecomp | 221 :group 'bytecomp |
230 :type 'boolean) | 222 :type 'boolean) |
231 | 223 |
232 ;; (defvar byte-compile-generate-emacs19-bytecodes | 224 ;; (defvar byte-compile-generate-emacs19-bytecodes |
233 ;; (not (or (and (boundp 'epoch::version) epoch::version) | 225 ;; (not (or (and (boundp 'epoch::version) epoch::version) |
1549 ;; Close over these variables so that `byte-compiler-options' | 1541 ;; Close over these variables so that `byte-compiler-options' |
1550 ;; can change them on a per-file basis. | 1542 ;; can change them on a per-file basis. |
1551 ;; | 1543 ;; |
1552 (byte-compile-verbose byte-compile-verbose) | 1544 (byte-compile-verbose byte-compile-verbose) |
1553 (byte-optimize byte-optimize) | 1545 (byte-optimize byte-optimize) |
1554 (byte-compile-compatibility byte-compile-compatibility) | |
1555 (byte-compile-dynamic byte-compile-dynamic) | 1546 (byte-compile-dynamic byte-compile-dynamic) |
1556 (byte-compile-dynamic-docstrings | 1547 (byte-compile-dynamic-docstrings |
1557 byte-compile-dynamic-docstrings) | 1548 byte-compile-dynamic-docstrings) |
1558 ;; (byte-compile-generate-emacs19-bytecodes | 1549 ;; (byte-compile-generate-emacs19-bytecodes |
1559 ;; byte-compile-generate-emacs19-bytecodes) | 1550 ;; byte-compile-generate-emacs19-bytecodes) |
1973 | 1964 |
1974 (defun byte-compile-fix-header (filename inbuffer outbuffer) | 1965 (defun byte-compile-fix-header (filename inbuffer outbuffer) |
1975 (with-current-buffer outbuffer | 1966 (with-current-buffer outbuffer |
1976 ;; See if the buffer has any multibyte characters. | 1967 ;; See if the buffer has any multibyte characters. |
1977 (when (< (point-max) (position-bytes (point-max))) | 1968 (when (< (point-max) (position-bytes (point-max))) |
1978 (when (byte-compile-version-cond byte-compile-compatibility) | |
1979 (error "Version-18 compatibility not valid with multibyte characters")) | |
1980 (goto-char (point-min)) | 1969 (goto-char (point-min)) |
1981 ;; Find the comment that describes the version test. | 1970 ;; Find the comment that describes the version test. |
1982 (search-forward "\n;;; This file") | 1971 (search-forward "\n;;; This file") |
1983 (beginning-of-line) | 1972 (beginning-of-line) |
1984 (narrow-to-region (point) (point-max)) | 1973 (narrow-to-region (point) (point-max)) |
2022 ;; benefit is that you can add this to /etc/magic: | 2011 ;; benefit is that you can add this to /etc/magic: |
2023 | 2012 |
2024 ;; 0 string ;ELC GNU Emacs Lisp compiled file, | 2013 ;; 0 string ;ELC GNU Emacs Lisp compiled file, |
2025 ;; >4 byte x version %d | 2014 ;; >4 byte x version %d |
2026 | 2015 |
2027 (insert | 2016 (insert ";ELC" 23 "\000\000\000\n") |
2028 ";ELC" | |
2029 (if (byte-compile-version-cond byte-compile-compatibility) 18 23) | |
2030 "\000\000\000\n" | |
2031 ) | |
2032 (insert ";;; Compiled by " | 2017 (insert ";;; Compiled by " |
2033 (or (and (boundp 'user-mail-address) user-mail-address) | 2018 (or (and (boundp 'user-mail-address) user-mail-address) |
2034 (concat (user-login-name) "@" (system-name))) | 2019 (concat (user-login-name) "@" (system-name))) |
2035 " on " | 2020 " on " |
2036 (current-time-string) "\n;;; from file " filename "\n") | 2021 (current-time-string) "\n;;; from file " filename "\n") |
2039 (cond | 2024 (cond |
2040 ((eq byte-optimize 'source) "with source-level optimization only") | 2025 ((eq byte-optimize 'source) "with source-level optimization only") |
2041 ((eq byte-optimize 'byte) "with byte-level optimization only") | 2026 ((eq byte-optimize 'byte) "with byte-level optimization only") |
2042 (byte-optimize "with all optimizations") | 2027 (byte-optimize "with all optimizations") |
2043 (t "without optimization")) | 2028 (t "without optimization")) |
2044 (if (byte-compile-version-cond byte-compile-compatibility) | 2029 ".\n") |
2045 "; compiled with Emacs 18 compatibility.\n" | |
2046 ".\n")) | |
2047 (if dynamic | 2030 (if dynamic |
2048 (insert ";;; Function definitions are lazy-loaded.\n")) | 2031 (insert ";;; Function definitions are lazy-loaded.\n")) |
2049 (if (not (byte-compile-version-cond byte-compile-compatibility)) | 2032 (let (intro-string minimum-version) |
2050 (let (intro-string minimum-version) | 2033 ;; Figure out which Emacs version to require, |
2051 ;; Figure out which Emacs version to require, | 2034 ;; and what comment to use to explain why. |
2052 ;; and what comment to use to explain why. | 2035 ;; Note that this fails to take account of whether |
2053 ;; Note that this fails to take account of whether | 2036 ;; the buffer contains multibyte characters. We may have to |
2054 ;; the buffer contains multibyte characters. We may have to | 2037 ;; compensate at the end in byte-compile-fix-header. |
2055 ;; compensate at the end in byte-compile-fix-header. | 2038 (if dynamic-docstrings |
2056 (if dynamic-docstrings | |
2057 (setq intro-string | |
2058 ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n" | |
2059 minimum-version "19.29") | |
2060 (setq intro-string | 2039 (setq intro-string |
2061 ";;; This file uses opcodes which do not exist in Emacs 18.\n" | 2040 ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n" |
2062 minimum-version "19")) | 2041 minimum-version "19.29") |
2063 ;; Now insert the comment and the error check. | 2042 (setq intro-string |
2064 (insert | 2043 ";;; This file uses opcodes which do not exist in Emacs 18.\n" |
2065 "\n" | 2044 minimum-version "19")) |
2066 intro-string | 2045 ;; Now insert the comment and the error check. |
2067 ;; Have to check if emacs-version is bound so that this works | 2046 (insert |
2068 ;; in files loaded early in loadup.el. | 2047 "\n" |
2069 "(if (and (boundp 'emacs-version)\n" | 2048 intro-string |
2070 ;; If there is a name at the end of emacs-version, | 2049 ;; Have to check if emacs-version is bound so that this works |
2071 ;; don't try to check the version number. | 2050 ;; in files loaded early in loadup.el. |
2072 "\t (< (aref emacs-version (1- (length emacs-version))) ?A)\n" | 2051 "(if (and (boundp 'emacs-version)\n" |
2073 "\t (or (and (boundp 'epoch::version) epoch::version)\n" | 2052 ;; If there is a name at the end of emacs-version, |
2074 (format "\t (string-lessp emacs-version \"%s\")))\n" | 2053 ;; don't try to check the version number. |
2075 minimum-version) | 2054 "\t (< (aref emacs-version (1- (length emacs-version))) ?A)\n" |
2076 " (error \"`" | 2055 "\t (or (and (boundp 'epoch::version) epoch::version)\n" |
2077 ;; prin1-to-string is used to quote backslashes. | 2056 (format "\t (string-lessp emacs-version \"%s\")))\n" |
2078 (substring (prin1-to-string (file-name-nondirectory filename)) | 2057 minimum-version) |
2079 1 -1) | 2058 " (error \"`" |
2080 (format "' was compiled for Emacs %s or later\"))\n\n" | 2059 ;; prin1-to-string is used to quote backslashes. |
2081 minimum-version) | 2060 (substring (prin1-to-string (file-name-nondirectory filename)) |
2082 ;; Insert semicolons as ballast, so that byte-compile-fix-header | 2061 1 -1) |
2083 ;; can delete them so as to keep the buffer positions | 2062 (format "' was compiled for Emacs %s or later\"))\n\n" |
2084 ;; constant for the actual compiled code. | 2063 minimum-version) |
2085 ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")) | 2064 ;; Insert semicolons as ballast, so that byte-compile-fix-header |
2086 ;; Here if we want Emacs 18 compatibility. | 2065 ;; can delete them so as to keep the buffer positions |
2087 (when dynamic-docstrings | 2066 ;; constant for the actual compiled code. |
2088 (error "Version-18 compatibility doesn't support dynamic doc strings")) | 2067 ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))))) |
2089 (when byte-compile-dynamic | |
2090 (error "Version-18 compatibility doesn't support dynamic byte code")) | |
2091 (insert "(or (boundp 'current-load-list) (setq current-load-list nil))\n" | |
2092 "\n"))))) | |
2093 | 2068 |
2094 ;; Dynamically bound in byte-compile-from-buffer. | 2069 ;; Dynamically bound in byte-compile-from-buffer. |
2095 ;; NB also used in cl.el and cl-macs.el. | 2070 ;; NB also used in cl.el and cl-macs.el. |
2096 (defvar bytecomp-outbuffer) | 2071 (defvar bytecomp-outbuffer) |
2097 | 2072 |
2139 (let (position) | 2114 (let (position) |
2140 | 2115 |
2141 ;; Insert the doc string, and make it a comment with #@LENGTH. | 2116 ;; Insert the doc string, and make it a comment with #@LENGTH. |
2142 (and (>= (nth 1 info) 0) | 2117 (and (>= (nth 1 info) 0) |
2143 dynamic-docstrings | 2118 dynamic-docstrings |
2144 (not byte-compile-compatibility) | |
2145 (progn | 2119 (progn |
2146 ;; Make the doc string start at beginning of line | 2120 ;; Make the doc string start at beginning of line |
2147 ;; for make-docfile's sake. | 2121 ;; for make-docfile's sake. |
2148 (insert "\n") | 2122 (insert "\n") |
2149 (setq position | 2123 (setq position |
2506 (byte-compile-flush-pending) | 2480 (byte-compile-flush-pending) |
2507 (if (not (stringp (nth 3 form))) | 2481 (if (not (stringp (nth 3 form))) |
2508 ;; No doc string. Provide -1 as the "doc string index" | 2482 ;; No doc string. Provide -1 as the "doc string index" |
2509 ;; so that no element will be treated as a doc string. | 2483 ;; so that no element will be treated as a doc string. |
2510 (byte-compile-output-docform | 2484 (byte-compile-output-docform |
2511 (if (byte-compile-version-cond byte-compile-compatibility) | 2485 "\n(defalias '" |
2512 "\n(fset '" "\n(defalias '") | |
2513 bytecomp-name | 2486 bytecomp-name |
2514 (cond ((atom code) | 2487 (cond ((atom code) |
2515 (if macrop '(" '(macro . #[" -1 "])") '(" #[" -1 "]"))) | 2488 (if macrop '(" '(macro . #[" -1 "])") '(" #[" -1 "]"))) |
2516 ((eq (car code) 'quote) | 2489 ((eq (car code) 'quote) |
2517 (setq code new-one) | 2490 (setq code new-one) |
2522 1) | 2495 1) |
2523 nil) | 2496 nil) |
2524 ;; Output the form by hand, that's much simpler than having | 2497 ;; Output the form by hand, that's much simpler than having |
2525 ;; b-c-output-file-form analyze the defalias. | 2498 ;; b-c-output-file-form analyze the defalias. |
2526 (byte-compile-output-docform | 2499 (byte-compile-output-docform |
2527 (if (byte-compile-version-cond byte-compile-compatibility) | 2500 "\n(defalias '" |
2528 "\n(fset '" "\n(defalias '") | |
2529 bytecomp-name | 2501 bytecomp-name |
2530 (cond ((atom code) | 2502 (cond ((atom code) |
2531 (if macrop '(" '(macro . #[" 4 "])") '(" #[" 4 "]"))) | 2503 (if macrop '(" '(macro . #[" 4 "])") '(" #[" 4 "]"))) |
2532 ((eq (car code) 'quote) | 2504 ((eq (car code) 'quote) |
2533 (setq code new-one) | 2505 (setq code new-one) |
2607 (byte-compile-top-level sexp)))) | 2579 (byte-compile-top-level sexp)))) |
2608 | 2580 |
2609 ;; Given a function made by byte-compile-lambda, make a form which produces it. | 2581 ;; Given a function made by byte-compile-lambda, make a form which produces it. |
2610 (defun byte-compile-byte-code-maker (fun) | 2582 (defun byte-compile-byte-code-maker (fun) |
2611 (cond | 2583 (cond |
2612 ((byte-compile-version-cond byte-compile-compatibility) | |
2613 ;; Return (quote (lambda ...)). | |
2614 (list 'quote (byte-compile-byte-code-unmake fun))) | |
2615 ;; ## atom is faster than compiled-func-p. | 2584 ;; ## atom is faster than compiled-func-p. |
2616 ((atom fun) ; compiled function. | 2585 ((atom fun) ; compiled function. |
2617 ;; generate-emacs19-bytecodes must be on, otherwise byte-compile-lambda | 2586 ;; generate-emacs19-bytecodes must be on, otherwise byte-compile-lambda |
2618 ;; would have produced a lambda. | 2587 ;; would have produced a lambda. |
2619 fun) | 2588 fun) |
2740 (prin1-to-string bytecomp-int))))) | 2709 (prin1-to-string bytecomp-int))))) |
2741 ;; Process the body. | 2710 ;; Process the body. |
2742 (let ((compiled (byte-compile-top-level | 2711 (let ((compiled (byte-compile-top-level |
2743 (cons 'progn bytecomp-body) nil 'lambda))) | 2712 (cons 'progn bytecomp-body) nil 'lambda))) |
2744 ;; Build the actual byte-coded function. | 2713 ;; Build the actual byte-coded function. |
2745 (if (and (eq 'byte-code (car-safe compiled)) | 2714 (if (eq 'byte-code (car-safe compiled)) |
2746 (not (byte-compile-version-cond | |
2747 byte-compile-compatibility))) | |
2748 (apply 'make-byte-code | 2715 (apply 'make-byte-code |
2749 (append (list bytecomp-arglist) | 2716 (append (list bytecomp-arglist) |
2750 ;; byte-string, constants-vector, stack depth | 2717 ;; byte-string, constants-vector, stack depth |
2751 (cdr compiled) | 2718 (cdr compiled) |
2752 ;; optionally, the doc string. | 2719 ;; optionally, the doc string. |
2972 ;; for CL compiler macros since the symbol may be | 2939 ;; for CL compiler macros since the symbol may be |
2973 ;; `cl-byte-compile-compiler-macro' but if CL isn't | 2940 ;; `cl-byte-compile-compiler-macro' but if CL isn't |
2974 ;; loaded, this function doesn't exist. | 2941 ;; loaded, this function doesn't exist. |
2975 (or (not (memq bytecomp-handler | 2942 (or (not (memq bytecomp-handler |
2976 '(cl-byte-compile-compiler-macro))) | 2943 '(cl-byte-compile-compiler-macro))) |
2977 (functionp bytecomp-handler)) | 2944 (functionp bytecomp-handler))) |
2978 (not (and (byte-compile-version-cond | |
2979 byte-compile-compatibility) | |
2980 (get (get bytecomp-fn 'byte-opcode) | |
2981 'emacs19-opcode)))) | |
2982 (funcall bytecomp-handler form) | 2945 (funcall bytecomp-handler form) |
2983 (byte-compile-normal-call form)) | 2946 (byte-compile-normal-call form)) |
2984 (if (byte-compile-warning-enabled-p 'cl-functions) | 2947 (if (byte-compile-warning-enabled-p 'cl-functions) |
2985 (byte-compile-cl-warn form)))) | 2948 (byte-compile-cl-warn form)))) |
2986 ((and (or (byte-code-function-p (car form)) | 2949 ((and (or (byte-code-function-p (car form)) |
3110 (list 'put (list 'quote opcode) | 3073 (list 'put (list 'quote opcode) |
3111 ''byte-opcode-invert (list 'quote function))) | 3074 ''byte-opcode-invert (list 'quote function))) |
3112 fnform)))) | 3075 fnform)))) |
3113 | 3076 |
3114 (defmacro byte-defop-compiler19 (function &optional compile-handler) | 3077 (defmacro byte-defop-compiler19 (function &optional compile-handler) |
3115 ;; Just like byte-defop-compiler, but defines an opcode that will only | 3078 ;; Just like byte-defop-compiler, but used to define an opcode to only |
3116 ;; be used when byte-compile-compatibility is false. | 3079 ;; be used when byte-compile-compatibility was false. |
3117 (if (and (byte-compile-single-version) | 3080 (list 'progn |
3118 byte-compile-compatibility) | 3081 (list 'put |
3119 ;; #### instead of doing nothing, this should do some remprops, | 3082 (list 'quote |
3120 ;; #### to protect against the case where a single-version compiler | 3083 (or (car (cdr-safe function)) |
3121 ;; #### is loaded into a world that has contained a multi-version one. | 3084 (intern (concat "byte-" |
3122 nil | 3085 (symbol-name (or (car-safe function) |
3123 (list 'progn | 3086 function)))))) |
3124 (list 'put | 3087 ''emacs19-opcode t) |
3125 (list 'quote | 3088 (list 'byte-defop-compiler function compile-handler))) |
3126 (or (car (cdr-safe function)) | |
3127 (intern (concat "byte-" | |
3128 (symbol-name (or (car-safe function) function)))))) | |
3129 ''emacs19-opcode t) | |
3130 (list 'byte-defop-compiler function compile-handler)))) | |
3131 | 3089 |
3132 (defmacro byte-defop-compiler-1 (function &optional compile-handler) | 3090 (defmacro byte-defop-compiler-1 (function &optional compile-handler) |
3133 (list 'byte-defop-compiler (list function nil) compile-handler)) | 3091 (list 'byte-defop-compiler (list function nil) compile-handler)) |
3134 | 3092 |
3135 | 3093 |
3371 (byte-compile-constant nil)) | 3329 (byte-compile-constant nil)) |
3372 ((< count 5) | 3330 ((< count 5) |
3373 (mapc 'byte-compile-form (cdr form)) | 3331 (mapc 'byte-compile-form (cdr form)) |
3374 (byte-compile-out | 3332 (byte-compile-out |
3375 (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- count)) 0)) | 3333 (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- count)) 0)) |
3376 ((and (< count 256) (not (byte-compile-version-cond | 3334 ((< count 256) |
3377 byte-compile-compatibility))) | |
3378 (mapc 'byte-compile-form (cdr form)) | 3335 (mapc 'byte-compile-form (cdr form)) |
3379 (byte-compile-out 'byte-listN count)) | 3336 (byte-compile-out 'byte-listN count)) |
3380 (t (byte-compile-normal-call form))))) | 3337 (t (byte-compile-normal-call form))))) |
3381 | 3338 |
3382 (defun byte-compile-concat (form) | 3339 (defun byte-compile-concat (form) |
3387 (aref [byte-concat2 byte-concat3 byte-concat4] (- count 2)) | 3344 (aref [byte-concat2 byte-concat3 byte-concat4] (- count 2)) |
3388 0)) | 3345 0)) |
3389 ;; Concat of one arg is not a no-op if arg is not a string. | 3346 ;; Concat of one arg is not a no-op if arg is not a string. |
3390 ((= count 0) | 3347 ((= count 0) |
3391 (byte-compile-form "")) | 3348 (byte-compile-form "")) |
3392 ((and (< count 256) (not (byte-compile-version-cond | 3349 ((< count 256) |
3393 byte-compile-compatibility))) | |
3394 (mapc 'byte-compile-form (cdr form)) | 3350 (mapc 'byte-compile-form (cdr form)) |
3395 (byte-compile-out 'byte-concatN count)) | 3351 (byte-compile-out 'byte-concatN count)) |
3396 ((byte-compile-normal-call form))))) | 3352 ((byte-compile-normal-call form))))) |
3397 | 3353 |
3398 (defun byte-compile-minus (form) | 3354 (defun byte-compile-minus (form) |
3484 | 3440 |
3485 (defun byte-compile-function-form (form) | 3441 (defun byte-compile-function-form (form) |
3486 (byte-compile-constant | 3442 (byte-compile-constant |
3487 (cond ((symbolp (nth 1 form)) | 3443 (cond ((symbolp (nth 1 form)) |
3488 (nth 1 form)) | 3444 (nth 1 form)) |
3489 ;; If we're not allowed to use #[] syntax, then output a form like | |
3490 ;; '(lambda (..) (byte-code ..)) instead of a call to make-byte-code. | |
3491 ;; In this situation, calling make-byte-code at run-time will usually | |
3492 ;; be less efficient than processing a call to byte-code. | |
3493 ((byte-compile-version-cond byte-compile-compatibility) | |
3494 (byte-compile-byte-code-unmake (byte-compile-lambda (nth 1 form)))) | |
3495 ((byte-compile-lambda (nth 1 form)))))) | 3445 ((byte-compile-lambda (nth 1 form)))))) |
3496 | 3446 |
3497 (defun byte-compile-indent-to (form) | 3447 (defun byte-compile-indent-to (form) |
3498 (let ((len (length form))) | 3448 (let ((len (length form))) |
3499 (cond ((= len 2) | 3449 (cond ((= len 2) |
3506 (byte-compile-subr-wrong-args form "1-2"))))) | 3456 (byte-compile-subr-wrong-args form "1-2"))))) |
3507 | 3457 |
3508 (defun byte-compile-insert (form) | 3458 (defun byte-compile-insert (form) |
3509 (cond ((null (cdr form)) | 3459 (cond ((null (cdr form)) |
3510 (byte-compile-constant nil)) | 3460 (byte-compile-constant nil)) |
3511 ((and (not (byte-compile-version-cond | 3461 ((<= (length form) 256) |
3512 byte-compile-compatibility)) | |
3513 (<= (length form) 256)) | |
3514 (mapc 'byte-compile-form (cdr form)) | 3462 (mapc 'byte-compile-form (cdr form)) |
3515 (if (cdr (cdr form)) | 3463 (if (cdr (cdr form)) |
3516 (byte-compile-out 'byte-insertN (length (cdr form))) | 3464 (byte-compile-out 'byte-insertN (length (cdr form))) |
3517 (byte-compile-out 'byte-insert 0))) | 3465 (byte-compile-out 'byte-insert 0))) |
3518 ((memq t (mapcar 'consp (cdr (cdr form)))) | 3466 ((memq t (mapcar 'consp (cdr (cdr form)))) |
3963 ;; This is not used for file-level defuns with doc strings. | 3911 ;; This is not used for file-level defuns with doc strings. |
3964 (if (symbolp (car form)) | 3912 (if (symbolp (car form)) |
3965 (byte-compile-set-symbol-position (car form)) | 3913 (byte-compile-set-symbol-position (car form)) |
3966 (byte-compile-set-symbol-position 'defun) | 3914 (byte-compile-set-symbol-position 'defun) |
3967 (error "defun name must be a symbol, not %s" (car form))) | 3915 (error "defun name must be a symbol, not %s" (car form))) |
3968 (if (byte-compile-version-cond byte-compile-compatibility) | 3916 ;; We prefer to generate a defalias form so it will record the function |
3969 (progn | 3917 ;; definition just like interpreting a defun. |
3970 (byte-compile-two-args ; Use this to avoid byte-compile-fset's warning. | 3918 (byte-compile-form |
3971 (list 'fset | 3919 (list 'defalias |
3972 (list 'quote (nth 1 form)) | 3920 (list 'quote (nth 1 form)) |
3973 (byte-compile-byte-code-maker | 3921 (byte-compile-byte-code-maker |
3974 (byte-compile-lambda (cdr (cdr form)) t)))) | 3922 (byte-compile-lambda (cdr (cdr form)) t))) |
3975 (byte-compile-discard)) | 3923 t) |
3976 ;; We prefer to generate a defalias form so it will record the function | |
3977 ;; definition just like interpreting a defun. | |
3978 (byte-compile-form | |
3979 (list 'defalias | |
3980 (list 'quote (nth 1 form)) | |
3981 (byte-compile-byte-code-maker | |
3982 (byte-compile-lambda (cdr (cdr form)) t))) | |
3983 t)) | |
3984 (byte-compile-constant (nth 1 form))) | 3924 (byte-compile-constant (nth 1 form))) |
3985 | 3925 |
3986 (defun byte-compile-defmacro (form) | 3926 (defun byte-compile-defmacro (form) |
3987 ;; This is not used for file-level defmacros with doc strings. | 3927 ;; This is not used for file-level defmacros with doc strings. |
3988 (byte-compile-body-do-effect | 3928 (byte-compile-body-do-effect |