comparison lisp/emacs-lisp/bytecomp.el @ 20847:b06dd0c28977

(byte-compile-output-as-comment): Use the size in bytes for the #@ size integer.
author Richard M. Stallman <rms@gnu.org>
date Thu, 05 Feb 1998 03:25:11 +0000
parents 732ffd28a863
children daf7dfe93205
comparison
equal deleted inserted replaced
20846:985a277c9b9a 20847:b06dd0c28977
7 ;; Maintainer: FSF 7 ;; Maintainer: FSF
8 ;; Keywords: lisp 8 ;; Keywords: lisp
9 9
10 ;;; This version incorporates changes up to version 2.10 of the 10 ;;; This version incorporates changes up to version 2.10 of the
11 ;;; Zawinski-Furuseth compiler. 11 ;;; Zawinski-Furuseth compiler.
12 (defconst byte-compile-version "$Revision: 2.36 $") 12 (defconst byte-compile-version "$Revision: 2.37 $")
13 13
14 ;; This file is part of GNU Emacs. 14 ;; This file is part of GNU Emacs.
15 15
16 ;; GNU Emacs is free software; you can redistribute it and/or modify 16 ;; GNU Emacs is free software; you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by 17 ;; it under the terms of the GNU General Public License as published by
1834 1834
1835 ;; Print Lisp object EXP in the output file, inside a comment, 1835 ;; Print Lisp object EXP in the output file, inside a comment,
1836 ;; and return the file position it will have. 1836 ;; and return the file position it will have.
1837 ;; If QUOTED is non-nil, print with quoting; otherwise, print without quoting. 1837 ;; If QUOTED is non-nil, print with quoting; otherwise, print without quoting.
1838 (defun byte-compile-output-as-comment (exp quoted) 1838 (defun byte-compile-output-as-comment (exp quoted)
1839 (let ((position (point))) 1839 (let ((position (point))
1840 total-bytes)
1840 (set-buffer 1841 (set-buffer
1841 (prog1 (current-buffer) 1842 (prog1 (current-buffer)
1842 (set-buffer outbuffer) 1843 (set-buffer outbuffer)
1843 1844
1844 ;; Insert EXP, and make it a comment with #@LENGTH. 1845 ;; Insert EXP, and make it a comment with #@LENGTH.
1858 (while (search-forward "\037" nil t) 1859 (while (search-forward "\037" nil t)
1859 (replace-match "\^A_" t t)) 1860 (replace-match "\^A_" t t))
1860 (goto-char (point-max)) 1861 (goto-char (point-max))
1861 (insert "\037") 1862 (insert "\037")
1862 (goto-char position) 1863 (goto-char position)
1863 (insert "#@" (format "%d" (- (point-max) position))) 1864 (setq total-bytes 0)
1865 (while (not (eobp))
1866 (setq total-bytes (+ total-bytes (char-bytes (char-after (point)))))
1867 (forward-char 1))
1868 (goto-char position)
1869 (insert "#@" (format "%d" total-bytes))
1864 1870
1865 ;; Save the file position of the object. 1871 ;; Save the file position of the object.
1866 ;; Note we should add 1 to skip the space 1872 ;; Note we should add 1 to skip the space
1867 ;; that we inserted before the actual doc string, 1873 ;; that we inserted before the actual doc string,
1868 ;; and subtract 1 to convert from an 1-origin Emacs position 1874 ;; and subtract 1 to convert from an 1-origin Emacs position