1 |
;;; bytecomp.el --- compilation of Lisp code into byte code |
;;; bytecomp.el --- compilation of Lisp code into byte code |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001 |
;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Jamie Zawinski <jwz@lucid.com> |
;; Author: Jamie Zawinski <jwz@lucid.com> |
1249 |
This is if a `.elc' file exists but is older than the `.el' file. |
This is if a `.elc' file exists but is older than the `.el' file. |
1250 |
Files in subdirectories of DIRECTORY are processed also. |
Files in subdirectories of DIRECTORY are processed also. |
1251 |
|
|
1252 |
If the `.elc' file does not exist, normally the `.el' file is *not* compiled. |
If the `.elc' file does not exist, normally this function *does not* |
1253 |
But a prefix argument (optional second arg) means ask user, |
compile the corresponding `.el' file. However, |
1254 |
for each such `.el' file, whether to compile it. Prefix argument 0 means |
if ARG (the prefix argument) is 0, that means do compile all those files. |
1255 |
don't ask and compile the file anyway. |
A nonzero ARG means ask the user, for each such `.el' file, |
1256 |
|
whether to compile it. |
1257 |
|
|
1258 |
A nonzero prefix argument also means ask about each subdirectory. |
A nonzero ARG also means ask about each subdirectory before scanning it. |
1259 |
|
|
1260 |
If the third argument FORCE is non-nil, |
If the third argument FORCE is non-nil, |
1261 |
recompile every `.el' file that already has a `.elc' file." |
recompile every `.el' file that already has a `.elc' file." |
1582 |
(delete-region (point) (progn (re-search-forward "^(") |
(delete-region (point) (progn (re-search-forward "^(") |
1583 |
(beginning-of-line) |
(beginning-of-line) |
1584 |
(point))) |
(point))) |
1585 |
(insert ";;; This file contains multibyte non-ASCII characters\n" |
(insert ";;; This file contains utf-8 non-ASCII characters\n" |
1586 |
";;; and therefore cannot be loaded into Emacs 19.\n") |
";;; and therefore cannot be loaded into Emacs 21 or earlier.\n") |
1587 |
;; Replace "19" or "19.29" with "20", twice. |
;; Replace "19" or "19.29" with "22", twice. |
1588 |
(re-search-forward "19\\(\\.[0-9]+\\)") |
(re-search-forward "19\\(\\.[0-9]+\\)") |
1589 |
(replace-match "20") |
(replace-match "22") |
1590 |
(re-search-forward "19\\(\\.[0-9]+\\)") |
(re-search-forward "19\\(\\.[0-9]+\\)") |
1591 |
(replace-match "20") |
(replace-match "22") |
1592 |
;; Now compensate for the change in size, |
;; Now compensate for the change in size, |
1593 |
;; to make sure all positions in the file remain valid. |
;; to make sure all positions in the file remain valid. |
1594 |
(setq delta (- (point-max) old-header-end)) |
(setq delta (- (point-max) old-header-end)) |
1603 |
(set-buffer outbuffer) |
(set-buffer outbuffer) |
1604 |
(goto-char 1) |
(goto-char 1) |
1605 |
;; The magic number of .elc files is ";ELC", or 0x3B454C43. After |
;; The magic number of .elc files is ";ELC", or 0x3B454C43. After |
1606 |
;; that is the file-format version number (18, 19 or 20) as a |
;; that is the file-format version number (18, 19, 20 or 22) as a |
1607 |
;; byte, followed by some nulls. The primary motivation for doing |
;; byte, followed by some nulls. The primary motivation for doing |
1608 |
;; this is to get some binary characters up in the first line of |
;; this is to get some binary characters up in the first line of |
1609 |
;; the file so that `diff' will simply say "Binary files differ" |
;; the file so that `diff' will simply say "Binary files differ" |
1615 |
|
|
1616 |
(insert |
(insert |
1617 |
";ELC" |
";ELC" |
1618 |
(if (byte-compile-version-cond byte-compile-compatibility) 18 20) |
(if (byte-compile-version-cond byte-compile-compatibility) 18 21) |
1619 |
"\000\000\000\n" |
"\000\000\000\n" |
1620 |
) |
) |
1621 |
(insert ";;; Compiled by " |
(insert ";;; Compiled by " |
1674 |
;; Insert semicolons as ballast, so that byte-compile-fix-header |
;; Insert semicolons as ballast, so that byte-compile-fix-header |
1675 |
;; can delete them so as to keep the buffer positions |
;; can delete them so as to keep the buffer positions |
1676 |
;; constant for the actual compiled code. |
;; constant for the actual compiled code. |
1677 |
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")) |
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")) |
1678 |
;; Here if we want Emacs 18 compatibility. |
;; Here if we want Emacs 18 compatibility. |
1679 |
(when dynamic-docstrings |
(when dynamic-docstrings |
1680 |
(error "Version-18 compatibility doesn't support dynamic doc strings")) |
(error "Version-18 compatibility doesn't support dynamic doc strings")) |
2979 |
(byte-defop-compiler-1 mapconcat byte-compile-funarg) |
(byte-defop-compiler-1 mapconcat byte-compile-funarg) |
2980 |
(byte-defop-compiler-1 mapc byte-compile-funarg) |
(byte-defop-compiler-1 mapc byte-compile-funarg) |
2981 |
(byte-defop-compiler-1 sort byte-compile-funarg-2) |
(byte-defop-compiler-1 sort byte-compile-funarg-2) |
2982 |
|
(byte-defop-compiler-1 map-char-table byte-compile-funarg-2) |
2983 |
|
;; map-charset-chars should be funarg but has optional third arg |
2984 |
(byte-defop-compiler-1 let) |
(byte-defop-compiler-1 let) |
2985 |
(byte-defop-compiler-1 let*) |
(byte-defop-compiler-1 let*) |
2986 |
|
|
3629 |
(or command-line-args-left |
(or command-line-args-left |
3630 |
(setq command-line-args-left '("."))) |
(setq command-line-args-left '("."))) |
3631 |
(while command-line-args-left |
(while command-line-args-left |
3632 |
(byte-recompile-directory (car command-line-args-left) 0) |
(byte-recompile-directory (car command-line-args-left)) |
3633 |
(setq command-line-args-left (cdr command-line-args-left))) |
(setq command-line-args-left (cdr command-line-args-left))) |
3634 |
(kill-emacs 0)) |
(kill-emacs 0)) |
3635 |
|
|