comparison lisp/subr.el @ 4359:df1f1f49ef70

Automated merge with file:/Sources/xemacs-21.5-checked-out
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 24 Dec 2007 15:04:01 +0100
parents d9eb5ea14f65
children ef9eb714f0e4
comparison
equal deleted inserted replaced
4358:63c25d1cbecf 4359:df1f1f49ef70
910 910
911 ;; These two names are a bit awkward, as they conflict with the normal 911 ;; These two names are a bit awkward, as they conflict with the normal
912 ;; foo-to-bar naming scheme, but CLtL2 has them, so they stay. 912 ;; foo-to-bar naming scheme, but CLtL2 has them, so they stay.
913 (define-function 'char-int 'char-to-int) 913 (define-function 'char-int 'char-to-int)
914 (define-function 'int-char 'int-to-char) 914 (define-function 'int-char 'int-to-char)
915
916 ;; XEmacs addition.
917 (defun integer-to-bit-vector (integer &optional minlength)
918 "Return INTEGER converted to a bit vector.
919 Optional argument MINLENGTH gives a minimum length for the returned vector.
920 If MINLENGTH is not given, zero high-order bits will be ignored."
921 (check-argument-type #'integerp integer)
922 (setq minlength (or minlength 0))
923 (check-nonnegative-number minlength)
924 (read (format (format "#*%%0%db" minlength) integer)))
925
926 ;; XEmacs addition.
927 (defun bit-vector-to-integer (bit-vector)
928 "Return BIT-VECTOR converted to an integer.
929 If bignum support is available, BIT-VECTOR's length is unlimited.
930 Otherwise the limit is the number of value bits in an Lisp integer. "
931 (check-argument-type #'bit-vector-p bit-vector)
932 (setq bit-vector (prin1-to-string bit-vector))
933 (aset bit-vector 1 ?b)
934 (read bit-vector))
915 935
916 (defun string-width (string) 936 (defun string-width (string)
917 "Return number of columns STRING occupies when displayed. 937 "Return number of columns STRING occupies when displayed.
918 With international (Mule) support, uses the charset-columns attribute of 938 With international (Mule) support, uses the charset-columns attribute of
919 the characters in STRING, which may not accurately represent the actual 939 the characters in STRING, which may not accurately represent the actual