Mercurial > hg > xemacs-beta
changeset 777:e65d9cf16707
[xemacs-hg @ 2002-03-15 11:00:28 by ben]
config.h.in, sysdep.c, sysfile.h, systime.h: add HAVE_SYS_TIMES_H and use it to include sys/times.h, used for
struct tms in new POSIX() function times().
mule\mule-charset.el, obsolete.el, subr.el: Put back
previously-deleted truncate-string-to-width. Move other
non-Mule-specific stuff into subr.el or obsolete.el.
configure.in: check for sys/times.h.
author | ben |
---|---|
date | Fri, 15 Mar 2002 11:00:56 +0000 |
parents | 79940b592197 |
children | 2923009caf47 |
files | ChangeLog configure configure.in lisp/ChangeLog lisp/mule/mule-charset.el lisp/obsolete.el lisp/subr.el src/ChangeLog src/config.h.in src/sysdep.c src/sysfile.h src/systime.h |
diffstat | 12 files changed, 130 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Mar 15 07:43:43 2002 +0000 +++ b/ChangeLog Fri Mar 15 11:00:56 2002 +0000 @@ -1,3 +1,8 @@ +2002-03-15 Ben Wing <ben@xemacs.org> + + * configure.in (XE_COMPUTE_RUNPATH): + check for sys/times.h. + 2002-03-15 Ben Wing <ben@xemacs.org> * Makefile.in.in (batch):
--- a/configure Fri Mar 15 07:43:43 2002 +0000 +++ b/configure Fri Mar 15 11:00:56 2002 +0000 @@ -3454,7 +3454,7 @@ test -n "$YACC" || YACC="yacc" -for ac_hdr in a.out.h elf.h cygwin/version.h fcntl.h inttypes.h libgen.h locale.h mach/mach.h sys/param.h sys/pstat.h sys/time.h sys/timeb.h sys/un.h ulimit.h unistd.h +for ac_hdr in a.out.h elf.h cygwin/version.h fcntl.h inttypes.h libgen.h locale.h mach/mach.h sys/param.h sys/pstat.h sys/time.h sys/timeb.h sys/times.h sys/un.h ulimit.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--- a/configure.in Fri Mar 15 07:43:43 2002 +0000 +++ b/configure.in Fri Mar 15 11:00:56 2002 +0000 @@ -2368,6 +2368,7 @@ sys/pstat.h dnl sys/time.h dnl sys/timeb.h dnl + sys/times.h dnl sys/un.h dnl ulimit.h dnl unistd.h dnl
--- a/lisp/ChangeLog Fri Mar 15 07:43:43 2002 +0000 +++ b/lisp/ChangeLog Fri Mar 15 11:00:56 2002 +0000 @@ -1,3 +1,26 @@ +2002-03-15 Ben Wing <ben@xemacs.org> + + * mule\mule-charset.el: + * mule\mule-charset.el (char-width): Removed. + * mule\mule-charset.el ('sref): Removed. + * mule\mule-charset.el (char-bytes): Removed. + * mule\mule-charset.el (string-to-sequence): Removed. + * mule\mule-charset.el (string-to-list): Removed. + * mule\mule-charset.el (string-to-vector): Removed. + * mule\mule-charset.el (store-substring): Removed. + * obsolete.el: + * obsolete.el ('sref): New. + * obsolete.el (char-bytes): New. + * subr.el: + * subr.el (char-width): New. + * subr.el (string-to-sequence): New. + * subr.el (string-to-list): New. + * subr.el (string-to-vector): New. + * subr.el (store-substring): New. + * subr.el (truncate-string-to-width): New. Put back + previously-deleted truncate-string-to-width. Move other + non-Mule-specific stuff into subr.el or obsolete.el. + 2002-03-15 Ben Wing <ben@xemacs.org> * mule\chinese.el:
--- a/lisp/mule/mule-charset.el Fri Mar 15 07:43:43 2002 +0000 +++ b/lisp/mule/mule-charset.el Fri Mar 15 11:00:56 2002 +0000 @@ -3,6 +3,7 @@ ;; Copyright (C) 1992 Free Software Foundation, Inc. ;; Copyright (C) 1995 Amdahl Corporation. ;; Copyright (C) 1996 Sun Microsystems. +;; Copyright (C) 2002 Ben Wing. ;; Author: Unknown ;; Keywords: i18n, mule, internal @@ -155,58 +156,8 @@ (defalias 'set-charset-plist 'setplist) -(defun char-width (character) - "Return number of columns a CHARACTER occupies when displayed." - (charset-width (char-charset character))) - -;; The following several functions are useful in GNU Emacs 20 because -;; of the multibyte "characters" the internal representation of which -;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary. -;; We provide them for compatibility reasons solely. - -(define-obsolete-function-alias 'sref 'aref) -(defun char-bytes (character) - "Return number of bytes a CHARACTER occupies in a string or buffer. -It always returns 1 in XEmacs, and in recent FSF Emacs versions." - 1) -(make-obsolete 'char-bytes "This function always returns 1") - -(defun string-to-sequence (string type) - "Convert STRING to a sequence of TYPE which contains characters in STRING. -TYPE should be `list' or `vector'. -Multibyte characters are concerned." - (ecase type - (list - (mapcar #'identity string)) - (vector - (mapvector #'identity string)))) - -(defun string-to-list (string) - "Return a list of characters in STRING." - (mapcar #'identity string)) - -(defun string-to-vector (string) - "Return a vector of characters in STRING." - (mapvector #'identity string)) - -(defun store-substring (string idx obj) - "Embed OBJ (string or character) at index IDX of STRING." - (let* ((str (cond ((stringp obj) obj) - ((characterp obj) (char-to-string obj)) - (t (error - "Invalid argument (should be string or character): %s" - obj)))) - (string-len (length string)) - (len (length str)) - (i 0)) - (while (and (< i len) (< idx string-len)) - (aset string idx (aref str i)) - (setq idx (1+ idx) i (1+ i))) - string)) - - ;; Setup auto-fill-chars for charsets that should invoke auto-filling. -;; SPACE and NEWLIE are already set. +;; SPACE and NEWLINE are already set. (let ((l '(katakana-jisx0201 japanese-jisx0208 japanese-jisx0212 chinese-gb2312 chinese-big5-1 chinese-big5-2)))
--- a/lisp/obsolete.el Fri Mar 15 07:43:43 2002 +0000 +++ b/lisp/obsolete.el Fri Mar 15 11:00:56 2002 +0000 @@ -3,6 +3,7 @@ ;; Copyright (C) 1985-1994, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1994, 1995 Amdahl Corporation. ;; Copyright (C) 1995 Sun Microsystems. +;; Copyright (C) 2002 Ben Wing. ;; Maintainer: XEmacs Development Team ;; Keywords: internal, dumped @@ -298,6 +299,16 @@ (mapcar 'redisplay-device (device-list)) (redisplay-device device))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;; strings + +(define-obsolete-function-alias 'sref 'aref) + +(defun char-bytes (character) + "Return number of bytes a CHARACTER occupies in a string or buffer. +It always returns 1 in XEmacs, and in recent FSF Emacs versions." + 1) +(make-obsolete 'char-bytes "This function always returns 1") + ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects ;; the functionality of column.el has been moved into C
--- a/lisp/subr.el Fri Mar 15 07:43:43 2002 +0000 +++ b/lisp/subr.el Fri Mar 15 11:00:56 2002 +0000 @@ -523,6 +523,75 @@ col) (length string))) +(defun char-width (character) + "Return number of columns a CHARACTER occupies when displayed." + (if (featurep 'mule) + (with-fboundp '(charset-width char-charset) + (charset-width (char-charset character))) + 1)) + +;; The following several functions are useful in GNU Emacs 20 because +;; of the multibyte "characters" the internal representation of which +;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary. +;; We provide them for compatibility reasons solely. + +(defun string-to-sequence (string type) + "Convert STRING to a sequence of TYPE which contains characters in STRING. +TYPE should be `list' or `vector'." + (ecase type + (list + (mapcar #'identity string)) + (vector + (mapvector #'identity string)))) + +(defun string-to-list (string) + "Return a list of characters in STRING." + (mapcar #'identity string)) + +(defun string-to-vector (string) + "Return a vector of characters in STRING." + (mapvector #'identity string)) + +(defun store-substring (string idx obj) + "Embed OBJ (string or character) at index IDX of STRING." + (let* ((str (cond ((stringp obj) obj) + ((characterp obj) (char-to-string obj)) + (t (error + "Invalid argument (should be string or character): %s" + obj)))) + (string-len (length string)) + (len (length str)) + (i 0)) + (while (and (< i len) (< idx string-len)) + (aset string idx (aref str i)) + (setq idx (1+ idx) i (1+ i))) + string)) + +;; #### This function is not compatible with FSF in some cases. Hard +;; to fix, because it is hard to trace the logic of the FSF function. +;; In case we need the exact behavior, we can always copy the FSF +;; version, which is very long and does lots of unnecessary stuff. +(defun truncate-string-to-width (str end-column &optional start-column padding) + "Truncate string STR to end at column END-COLUMN. +The optional 2nd arg START-COLUMN, if non-nil, specifies +the starting column; that means to return the characters occupying +columns START-COLUMN ... END-COLUMN of STR. + +The optional 3rd arg PADDING, if non-nil, specifies a padding character +to add at the end of the result if STR doesn't reach column END-COLUMN, +or if END-COLUMN comes in the middle of a character in STR. +PADDING is also added at the beginning of the result +if column START-COLUMN appears in the middle of a character in STR. + +If PADDING is nil, no padding is added in these cases, so +the resulting string may be narrower than END-COLUMN." + (or start-column + (setq start-column 0)) + (let ((len (length str))) + (concat (substring str (min start-column len) (min end-column len)) + (and padding (> end-column len) + (make-string (- end-column len) padding))))) + ;; alist/plist functions (defun plist-to-alist (plist)
--- a/src/ChangeLog Fri Mar 15 07:43:43 2002 +0000 +++ b/src/ChangeLog Fri Mar 15 11:00:56 2002 +0000 @@ -1,3 +1,13 @@ +2002-03-15 Ben Wing <ben@xemacs.org> + + * config.h.in: + * sysdep.c: + * sysdep.c (get_process_times_1): + * sysfile.h: + * systime.h: + add HAVE_SYS_TIMES_H and use it to include sys/times.h, used for + struct tms in new POSIX() function times(). + 2002-03-15 Ben Wing <ben@xemacs.org> * .cvsignore:
--- a/src/config.h.in Fri Mar 15 07:43:43 2002 +0000 +++ b/src/config.h.in Fri Mar 15 11:00:56 2002 +0000 @@ -247,6 +247,7 @@ #undef HAVE_SYS_PSTAT_H #undef HAVE_SYS_TIME_H #undef HAVE_SYS_TIMEB_H +#undef HAVE_SYS_TIMES_H #undef HAVE_SYS_UN_H #undef HAVE_ULIMIT_H #undef HAVE_UNISTD_H
--- a/src/sysdep.c Fri Mar 15 07:43:43 2002 +0000 +++ b/src/sysdep.c Fri Mar 15 11:00:56 2002 +0000 @@ -1,7 +1,7 @@ /* Interfaces to system-dependent kernel and library entries. Copyright (C) 1985-1988, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems. - Copyright (C) 2000, 2001 Ben Wing. + Copyright (C) 2000, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -3486,6 +3486,7 @@ { #if defined (_SC_CLK_TCK) || defined (CLK_TCK) && !defined(WIN32_NATIVE) /* We have the POSIX times() function available. */ + /* #### Perhaps we should just use a configure test for times()? */ struct tms tttt; times (&tttt); *user_ticks = (long) tttt.tms_utime;
--- a/src/sysfile.h Fri Mar 15 07:43:43 2002 +0000 +++ b/src/sysfile.h Fri Mar 15 11:00:56 2002 +0000 @@ -1,6 +1,6 @@ /* Copyright (C) 1995 Free Software Foundation, Inc. - Copyright (C) 2000, 2001 Ben Wing. + Copyright (C) 2000, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -81,7 +81,7 @@ fcntl.h, and Martin says that a "conforming" system should never need this. We will put it back if necessary on systems requiring it. */ /* # include <sys/fcntl.h> */ -#endif +#endif /* WIN32_NATIVE */ #ifndef STDERR_FILENO #define STDIN_FILENO 0
--- a/src/systime.h Fri Mar 15 07:43:43 2002 +0000 +++ b/src/systime.h Fri Mar 15 11:00:56 2002 +0000 @@ -1,6 +1,6 @@ /* systime.h - System-dependent definitions for time manipulations. Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -35,9 +35,8 @@ # endif #endif -#if defined (CYGWIN) || defined (LINUX) -/* #### why don't other systems have problems with this? need this - for struct tms */ +#ifdef HAVE_SYS_TIMES_H +/* Need this for struct tms */ # include <sys/times.h> #endif