User: stephent
Date: 05/10/04 18:43:39
Modified: xemacs/src alloc.c
Log:
Improve style and documentation of `register-input-method
Revision Changes Path
1.228 +33 -1 XEmacs/xemacs/CHANGES-beta
Index: CHANGES-beta
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/CHANGES-beta,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -p -r1.227 -r1.228
--- CHANGES-beta 2005/10/03 06:34:34 1.227
+++ CHANGES-beta 2005/10/04 16:43:29 1.228
@@ -2,21 +2,53 @@ to 21.5.23 "daikon"
Major features
+-- New: non-XPM color images can be mouse pointers. -- Ben Wing
+
User-Visible Bug Fixes and Minor Improvements
+-- Fix: crash due to duplicate subrs with MC_ALLOC and modules. -- Marcus Crestani
+
Build Infrastructure
+-- Fix: Cygwin, non-X build needs XPM header and library files in XE_CFLAGS. -- Mike Alexander, Rick Rankin
+-- Fix: Stop installexe.sh from adding redundant exe extension. -- Rick Rankin
+-- Fix: variable initialization misordering in xemacs.mak. -- Adrian Aichner
+-- Improve: replace support for autoconf 2.13 with warning to use autoconf 2.59. -- Malcolm Purvis
+-- Improve: update config.inc.samp to recent versions and add gmp, db, postgresql, ldap support; also optimization in non-debug builds. -- Ben Wing
+-- Improve: xemacs.mak now caters to VC++ version, support for building gmp, db, postgresql, ldap; other fixes. -- Ben Wing
+
Documentation
+-- Fix: texinfmt.el can build all Info files again. -- Adrian Aichner
+-- Fix: typos in Texinfo docs. -- Adrian Aichner
+-- Improve: Texinfo docs about specifiers. -- Ben Wing
+-- Improve: comment style, 'foo -> `foo'. -- Ben Wing
+-- Improve: rewrite nt/README
+
Lisp API
+-- Improve: GC now triggers on relative, not absolute, consing. -- Ben Wing
+-- Improve: memory usage reporting. -- Ben Wing
+-- New: `specifier-instantiator' and related primitives. -- Ben Wing
+
Internal API and Implementation
+-- Fix: Non-MULE needs mswindows_current_locale too. -- Mike Alexander
+-- Fix: address of register variable can't be taken. -- Ben Wing
+-- Fix: bitrot in sysdep.c and nt.c. -- Ben Wing
+-- Fix: bug in range tables with non-default closure. -- Ben Wing
+-- Fix: don't use C++ reserved words "new" and "catch", append '_'. -- Ben Wing
+-- Fix: initialization in mc-alloc. -- Marcus Crestani
+-- Fix: setlocale return string is volatile, dup it. -- Olivier Galibert
+-- Improve: include from ../src so <config.h> works in lib-src. -- Ben Wing
+-- Improve: minitar.c now includes config.h. -- Ben Wing
+-- Improve: warning elimination. -- Ben Wing
+
to 21.5.22 "cucumber"
Major features
---New: support for Unnnn-style keysyms on X11. -- Aidan Kehoe
+-- New: support for Unnnn-style keysyms on X11. -- Aidan Kehoe
User-Visible Bug Fixes and Minor Improvements
1.676 +5 -0 XEmacs/xemacs/lisp/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.675
retrieving revision 1.676
diff -u -p -r1.675 -r1.676
--- ChangeLog 2005/09/14 05:29:43 1.675
+++ ChangeLog 2005/10/04 16:43:34 1.676
@@ -1,3 +1,8 @@
+2005-09-21 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * mule/mule-cmds.el (input-method-alist, register-input-method):
+ Improve docstrings and formal parameter names.
+
2005-09-14 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.22 "cucumber" is released.
1.25 +27 -30 XEmacs/xemacs/lisp/mule/mule-cmds.el
Index: mule-cmds.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/mule/mule-cmds.el,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -p -r1.24 -r1.25
--- mule-cmds.el 2004/11/04 23:06:02 1.24
+++ mule-cmds.el 2005/10/04 16:43:36 1.25
@@ -347,44 +347,41 @@ This function is called with no argument
(put 'describe-current-input-method-function 'permanent-local t)
(defvar input-method-alist nil
- "Alist of input method names vs how to use them.
-Each element has the form:
- (INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC TITLE DESCRIPTION ARGS...)
-See the function `register-input-method' for the meanings of the elements.")
+ "Alist mapping input method names to information used by the LEIM API.
+Elements have the form (METHOD LANGUAGE ACTIVATOR TITLE DESCRIPTION ARGS...).
+Use `register-input-method' to add input methods to the database. See its
+documentation for the meanings of the elements.")
-(defun register-input-method (input-method lang-env &rest args)
- "Register INPUT-METHOD as an input method for language environment ENV.
-INPUT-METHOD and LANG-ENV are symbols or strings.
+(defun register-input-method (method language
+ ;; #### shouldn't be optional, but need to
+ ;; audit callers
+ &optional activator title description
+ &rest args)
+ "Register METHOD as an input method for language environment LANGUAGE.
-The remaining arguments are:
- ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARGS...
-ACTIVATE-FUNC is a function to call to activate this method.
+METHOD and LANGUAGE may be symbols or strings.
+ACTIVATOR is the function called to activate this method. METHOD (the
+ invocation name) and ARGS are passed to the function on activation.
TITLE is a string to show in the mode line when this method is active.
DESCRIPTION is a string describing this method and what it is good for.
-The ARGS, if any, are passed as arguments to ACTIVATE-FUNC.
-All told, the arguments to ACTIVATE-FUNC are INPUT-METHOD and the ARGS.
+Optional ARGS, if any, are stored and passed as arguments to ACTIVATOR.
-This function is mainly used in the file \"leim-list.el\" which is
-created at building time of emacs, registering all quail input methods
-contained in the emacs distribution.
+When registering a new Quail input method, the input method title should be
+the one given in the third parameter of `quail-define-package' (if the values
+are different, the string specified in this function takes precedence).
-In case you want to register a new quail input method by yourself, be
-careful to use the same input method title as given in the third
-parameter of `quail-define-package' (if the values are different, the
-string specified in this function takes precedence).
-
-The commands `describe-input-method' and `list-input-methods' need
-this duplicated values to show some information about input methods
-without loading the affected quail packages."
- (if (symbolp lang-env)
- (setq lang-env (symbol-name lang-env)))
- (if (symbolp input-method)
- (setq input-method (symbol-name input-method)))
- (let ((info (cons lang-env args))
- (slot (assoc input-method input-method-alist)))
+The information provided is registered in `input-method-alist'. The commands
+`describe-input-method' and `list-input-methods' use this database to show
+information about input methods without loading them."
+ (if (symbolp language)
+ (setq language (symbol-name language)))
+ (if (symbolp method)
+ (setq method (symbol-name method)))
+ (let ((info (append (list language activator title description) args))
+ (slot (assoc method input-method-alist)))
(if slot
(setcdr slot info)
- (setq slot (cons input-method info))
+ (setq slot (cons method info))
(setq input-method-alist (cons slot input-method-alist)))))
(defun read-input-method-name (prompt &optional default inhibit-null)
1.114 +54 -29 XEmacs/xemacs/src/alloc.c
Index: alloc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/alloc.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -p -r1.113 -r1.114
--- alloc.c 2005/05/15 16:38:11 1.113
+++ alloc.c 2005/10/04 16:43:38 1.114
@@ -1,7 +1,7 @@
/* Storage allocation and gc for XEmacs Lisp interpreter.
Copyright (C) 1985-1998 Free Software Foundation, Inc.
Copyright (C) 1995 Sun Microsystems, Inc.
- Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004 Ben Wing.
+ Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005 Ben Wing.
This file is part of XEmacs.
@@ -94,6 +94,8 @@ static Fixnum debug_allocation_backtrace
/* Number of bytes of consing done since the last gc */
static EMACS_INT consing_since_gc;
EMACS_UINT total_consing;
+EMACS_INT total_gc_usage;
+int total_gc_usage_set;
int need_to_garbage_collect;
int need_to_check_c_alloca;
@@ -5525,13 +5527,13 @@ garbage_collect_1 (void)
}
{
- struct catchtag *catch;
- for (catch = catchlist; catch; catch = catch->next)
+ struct catchtag *c;
+ for (c = catchlist; c; c = c->next)
{
- mark_object (catch->tag);
- mark_object (catch->val);
- mark_object (catch->actual_tag);
- mark_object (catch->backtrace);
+ mark_object (c->tag);
+ mark_object (c->val);
+ mark_object (c->actual_tag);
+ mark_object (c->backtrace);
}
}
@@ -5769,7 +5771,7 @@ Garbage collection happens automatically
/* Debugging aids. */
static Lisp_Object
-gc_plist_hack (const Ascbyte *name, int value, Lisp_Object tail)
+gc_plist_hack (const Ascbyte *name, EMACS_INT value, Lisp_Object tail)
{
/* C doesn't have local functions (or closures, or GC, or readable syntax,
or portable numeric datatypes, or bit-vectors, or characters, or
@@ -5778,9 +5780,10 @@ gc_plist_hack (const Ascbyte *name, int
}
#define HACK_O_MATIC(type, name, pl) do { \
- int s = 0; \
+ EMACS_INT s = 0; \
struct type##_block *x = current_##type##_block; \
while (x) { s += sizeof (*x) + MALLOC_OVERHEAD; x = x->prev; } \
+ object_usage += s; \
(pl) = gc_plist_hack ((name), s, (pl)); \
} while (0)
@@ -5800,8 +5803,11 @@ Garbage collection happens automatically
Lisp_Object pl = Qnil;
int i;
int gc_count_vector_total_size = 0;
+ EMACS_INT object_usage = 0;
+
garbage_collect_1 ();
+
for (i = 0; i < lrecord_type_count; i++)
{
if (lcrecord_stats[i].bytes_in_use != 0
@@ -5818,6 +5824,7 @@ Garbage collection happens automatically
sprintf (buf, "%s-storage", name);
pl = gc_plist_hack (buf, lcrecord_stats[i].bytes_in_use, pl);
+ object_usage += lcrecord_stats[i].bytes_in_use;
/* Okay, simple pluralization check for `symbol-value-varalias' */
if (name[len-1] == 's')
sprintf (buf, "%ses-freed", name);
@@ -5895,6 +5902,10 @@ Garbage collection happens automatically
pl = gc_plist_hack ("conses-free", gc_count_num_cons_freelist, pl);
pl = gc_plist_hack ("conses-used", gc_count_num_cons_in_use, pl);
+ /* Record total usage for purposes of determining next GC */
+ total_gc_usage = object_usage;
+ total_gc_usage_set = 1;
+
/* The things we do for backwards-compatibility */
return
list6 (Fcons (make_int (gc_count_num_cons_in_use),
@@ -5934,15 +5945,29 @@ The value is divided by 1024 to make sur
}
#endif
-DEFUN ("memory-usage", Fmemory_usage, 0, 0, 0, /*
+DEFUN ("total-memory-usage", Ftotal_memory_usage, 0, 0, 0, /*
Return the total number of bytes used by the data segment in XEmacs.
This may be helpful in debugging XEmacs's memory usage.
+NOTE: This may or may not be accurate! It is hard to determine this
+value in a system-independent fashion.
*/
())
{
return make_int (total_data_usage ());
}
+DEFUN ("lisp-object-memory-usage", Flisp_object_memory_usage, 0, 0, 0, /*
+Return the total number of bytes used for object storage in XEmacs.
+This may be helpful in debugging XEmacs's memory usage.
+This value is only recomputed when garbage collection happens; thus, a
+better value of the real number of bytes used is
+ (+ (lisp-object-memory-usage) (consing-since-gc))
+*/
+ ())
+{
+ return make_int (total_gc_usage);
+}
+
void
recompute_funcall_allocation_flag (void)
{
@@ -5961,11 +5986,15 @@ recompute_need_to_garbage_collect (void)
else
need_to_garbage_collect =
(consing_since_gc > gc_cons_threshold
-#if 0 /* #### implement this better */
&&
+#if 0 /* #### implement this better */
(100 * consing_since_gc) / total_data_usage () >=
gc_cons_percentage
-#endif /* 0 */
+#else
+ (!total_gc_usage_set ||
+ (100 * consing_since_gc) / total_gc_usage >=
+ gc_cons_percentage)
+#endif
);
recompute_funcall_allocation_flag ();
}
@@ -6220,9 +6249,8 @@ common_init_alloc_early (void)
#else
gc_cons_threshold = 15000; /* debugging */
#endif
- gc_cons_percentage = 0; /* #### 20; Don't have an accurate measure of
- memory usage on Windows; not verified on other
- systems */
+ gc_cons_percentage = 40; /* #### what is optimal? */
+ total_gc_usage_set = 0;
lrecord_uid_counter = 259;
#ifndef MC_ALLOC
debug_string_purity = 0;
@@ -6354,7 +6382,8 @@ syms_of_alloc (void)
#if 0
DEFSUBR (Fmemory_limit);
#endif
- DEFSUBR (Fmemory_usage);
+ DEFSUBR (Ftotal_memory_usage);
+ DEFSUBR (Flisp_object_memory_usage);
DEFSUBR (Fconsing_since_gc);
}
@@ -6386,26 +6415,22 @@ effective way to check GCPRO problems, b
will be unusable! You almost certainly won't have the patience to wait
long enough to be able to set it back.
-See also `consing-since-gc'.
+See also `consing-since-gc' and `gc-cons-percentage'.
*/ );
DEFVAR_INT ("gc-cons-percentage", &gc_cons_percentage /*
*Percentage of memory allocated between garbage collections.
Garbage collection will happen if this percentage of the total amount of
-memory used for data has been allocated since the last garbage collection.
-However, it will not happen if less than `gc-cons-threshold' bytes have
-been allocated -- this sets an absolute minimum in case very little data
-has been allocated or the percentage is set very low. Set this to 0 to
-have garbage collection always happen after `gc-cons-threshold' bytes have
-been allocated, regardless of current memory usage.
-
-Garbage collection happens automatically when `eval' or `funcall' are
-called. (Note that `funcall' is called implicitly as part of evaluation.)
-By binding this temporarily to a large number, you can effectively
-prevent garbage collection during a part of the program.
+memory used for data (see `lisp-object-memory-usage') has been allocated
+since the last garbage collection. However, it will not happen if less
+than `gc-cons-threshold' bytes have been allocated -- this sets an absolute
+minimum in case very little data has been allocated or the percentage is
+set very low. Set this to 0 to have garbage collection always happen after
+`gc-cons-threshold' bytes have been allocated, regardless of current memory
+usage.
-See also `consing-since-gc'.
+See also `consing-since-gc' and `gc-cons-threshold'.
*/ );
#ifdef DEBUG_XEMACS