changeset 5093:33bc58a32dc2

merge
author Ben Wing <ben@xemacs.org>
date Wed, 03 Mar 2010 05:19:49 -0600
parents 0ca81354c4c7 (current diff) 3aa3888729c3 (diff)
children ebee7d1e58bd
files src/ChangeLog src/emacs.c src/lisp.h
diffstat 17 files changed, 187 insertions(+), 115 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Wed Mar 03 05:07:47 2010 -0600
+++ b/lib-src/ChangeLog	Wed Mar 03 05:19:49 2010 -0600
@@ -1,3 +1,13 @@
+2010-03-02  Ben Wing  <ben@xemacs.org>
+
+	* digest-doc.c:
+	* make-path.c:
+	`emacs' isn't defined, but HAVE_CONFIG_H is, so use it to get
+	config.h.
+	
+	* getopt.h:
+	Conditionalize on HAVE_CONFIG_H to get real prototypes.
+
 2010-02-25  Ben Wing  <ben@xemacs.org>
 
 	* make-docfile.c:
--- a/lib-src/digest-doc.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/lib-src/digest-doc.c	Wed Mar 03 05:19:49 2010 -0600
@@ -5,7 +5,7 @@
    See also sorted-doc.c, which produces similar output
    but in texinfo format and sorted by function/variable name.  */
 
-#ifdef emacs
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 #include <stdio.h>
--- a/lib-src/getopt.h	Wed Mar 03 05:07:47 2010 -0600
+++ b/lib-src/getopt.h	Wed Mar 03 05:19:49 2010 -0600
@@ -98,7 +98,7 @@
 #define required_argument	1
 #define optional_argument	2
 
-#if defined (__GNU_LIBRARY__) || defined (__cplusplus) || defined (CYGWIN)
+#if defined (__GNU_LIBRARY__) || defined (__cplusplus) || defined (HAVE_CONFIG_H)
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
--- a/lib-src/make-path.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/lib-src/make-path.c	Wed Mar 03 05:19:49 2010 -0600
@@ -26,7 +26,7 @@
    command on some of the purer BSD systems (like Mt. Xinu) don't have
    that option. */
 
-#ifdef emacs
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
--- a/lisp/ChangeLog	Wed Mar 03 05:07:47 2010 -0600
+++ b/lisp/ChangeLog	Wed Mar 03 05:19:49 2010 -0600
@@ -1,3 +1,13 @@
+2010-02-26  Aidan Kehoe  <kehoea@parhasard.net>
+
+	Back out Ben's revision c673987f5f3d.
+	* coding.el:
+	Add a compiler macro for #'make-coding-system on non-Mule builds
+	too, to fix the problem he addressed with that changeset.
+	* mule/make-coding-system.el (fixed-width-private-use-start):
+	Don't call (decode-char ... 'ucs) here, it can make bootstrapping
+	harder.
+
 2010-02-25  Didier Verna  <didier@xemacs.org>
 
 	The background-placement face property.
@@ -85,29 +95,6 @@
 	
 2010-02-22  Ben Wing  <ben@xemacs.org>
 
-	* mule/make-coding-system.el:
-	* mule/make-coding-system.el (fixed-width-generate-helper):
-	* mule/make-coding-system.el (fixed-width-private-use-start): Removed.
-	* mule/make-coding-system.el (fixed-width-create-decode-encode-tables):
-	* coding.el:
-	* coding.el (decode-char): New.
-	* coding.el (featurep):
-	* coding.el (encode-char): New.
-	* dumped-lisp.el (preloaded-file-list):
-	Dump make-coding-system.  Aidan's hack to avoid dumping this file
-	never really worked right -- with some configurations (not clear
-	exactly which ones) `make-coding-system.el' gets dumped anyway due to
-	calls to `make-coding-system' in unicode.el, with the result that
-	the documentation of functions in make-coding-system.el gets lost.
-
-	Also needed to remove defvar fixed-width-private-use-start and
-	incorporate it inline, due to bootstrapping issues -- the call to
-	decode-char introduced a cross-dependency between unicode.el and
-	make-coding-system.el.
-	
-
-2010-02-22  Ben Wing  <ben@xemacs.org>
-
 	* cl-seq.el:
 	* cl-seq.el (stable-union): New.
 	* cl-seq.el (stable-intersection): New.
--- a/lisp/coding.el	Wed Mar 03 05:07:47 2010 -0600
+++ b/lisp/coding.el	Wed Mar 03 05:19:49 2010 -0600
@@ -5,7 +5,7 @@
 ;; Copyright (C) 1995 Amdahl Corporation.
 ;; Copyright (C) 1995 Sun Microsystems.
 ;; Copyright (C) 1997 MORIOKA Tomohiko
-;; Copyright (C) 2000, 2001, 2002, 2010 Ben Wing.
+;; Copyright (C) 2000, 2001, 2002 Ben Wing.
 
 ;; This file is part of XEmacs.
 
@@ -464,27 +464,42 @@
   (and (query-coding-string char coding-system)
        (encode-coding-string char coding-system)))
 
-(defun decode-char (quote-ucs code &optional restriction) 
-  "FSF compatibility--return Mule character with Unicode codepoint CODE.
-The second argument must be 'ucs, the third argument is ignored.  "
-  ;; We're prepared to accept invalid Unicode in unicode-to-char, but not in
-  ;; this function, which is the API that should actually be used, since
-  ;; it's available in GNU and in Mule-UCS.
-  (check-argument-range code #x0 #x10FFFF)
-  (assert (eq quote-ucs 'ucs) t
-	  "Sorry, decode-char doesn't yet support anything but the UCS.  ")
-  (unicode-to-char code))
+(if (featurep 'mule)
+    (progn
+      ;; Under Mule, we do much of the complicated coding system creation in
+      ;; Lisp and especially at compile time. We need some function
+      ;; definition for this function to be created in this file, but we can
+      ;; leave assigning the docstring to the autoload cookie
+      ;; handling later. Thankfully; that docstring is big.
+      (autoload 'make-coding-system "mule/make-coding-system")
 
-(defun encode-char (char quote-ucs &optional restriction)
-  "FSF compatibility--return the Unicode code point of CHAR.
-The second argument must be 'ucs, the third argument is ignored.  "
-  (assert (eq quote-ucs 'ucs) t
-	  "Sorry, encode-char doesn't yet support anything but the UCS.  ")
-  (char-to-unicode char))
+      ;; (During byte-compile before dumping, make-coding-system may already
+      ;; have been loaded, make sure not to overwrite the correct compiler
+      ;; macro:)
+      (when (eq 'autoload (car (symbol-function 'make-coding-system)))
+        ;; Make sure to pick up the correct compiler macro when compiling
+        ;; files:
+        (define-compiler-macro make-coding-system (&whole form name type
+                                                   &optional description props)
+          (load (second (symbol-function 'make-coding-system)))
+          (funcall (get 'make-coding-system 'cl-compiler-macro)
+                   form name type description props))))
 
-(unless (featurep 'mule)
   ;; Mule's not available; 
   (fset 'make-coding-system (symbol-function 'make-coding-system-internal))
+  (define-compiler-macro make-coding-system (&whole form name type
+                                             &optional description props)
+    (cond
+     ;; We shouldn't normally see these forms under non-Mule; they're all in
+     ;; the mule/ subdirectory.
+     ((equal '(quote fixed-width) type)
+      form)
+     ((byte-compile-constp type)
+      `(funcall (or (and (fboundp 'make-coding-system-internal)
+                         'make-coding-system-internal) 'make-coding-system)
+        ,@(cdr form)))
+     (t form)))
+
   (define-coding-system-alias 'escape-quoted 'binary)
 
   ;; These are so that gnus and friends work when not mule:
--- a/lisp/dumped-lisp.el	Wed Mar 03 05:07:47 2010 -0600
+++ b/lisp/dumped-lisp.el	Wed Mar 03 05:19:49 2010 -0600
@@ -160,7 +160,6 @@
        "code-process"
        ;; Provide basic commands to set coding systems to user
        "code-cmds"
-       (when (featurep 'mule) "mule/make-coding-system")
        "unicode"
 	;;;;;;;;;;;;;;;;;; MULE support
        (when (featurep 'mule)
--- a/lisp/mule/make-coding-system.el	Wed Mar 03 05:07:47 2010 -0600
+++ b/lisp/mule/make-coding-system.el	Wed Mar 03 05:19:49 2010 -0600
@@ -2,7 +2,6 @@
 ;;; much of the implementation of the fixed-width coding system type.
 
 ;; Copyright (C) 2009 Free Software Foundation
-;; Copyright (C) 2010 Ben Wing.
 
 ;; Author: Aidan Kehoe
 
@@ -27,6 +26,13 @@
 
 ;;; Code:
 
+(defvar fixed-width-private-use-start ?\uE000
+  "Start of a 256 code private use area for fixed-width coding systems.
+
+This is used to ensure that distinct octets on disk for a given coding
+system map to distinct XEmacs characters, preventing spurious changes when
+a file is read, not changed, and then written.  ")
+
 (defun fixed-width-generate-helper (decode-table encode-table
 				   encode-failure-octet)
   "Helper func, `fixed-width-generate-encode-program-and-skip-chars-strings',
@@ -317,7 +323,7 @@
   (check-argument-type #'listp unicode-map)
   (let ((decode-table (make-vector 256 nil))
         (encode-table (make-hash-table :size 256 :rehash-threshold 0.999))
-	(private-use-start #xE000)
+	(private-use-start (encode-char fixed-width-private-use-start 'ucs))
         (invalid-sequence-code-point-start
          (eval-when-compile
            (char-to-unicode
--- a/src/ChangeLog	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/ChangeLog	Wed Mar 03 05:19:49 2010 -0600
@@ -61,6 +61,45 @@
 
 	Some cosmetic changes.
 	
+2010-03-02  Ben Wing  <ben@xemacs.org>
+
+	* lisp.h:
+	* text.h:
+	Move inclusion point of text.h earlier in lisp.h -- just before
+	the definition of characters, which needs some of the stuff in
+	text.h.  With text.h later, some basic character properties had to
+	be defined in lisp.h -- put them back into text.h where they belong.
+	Move some text in lisp.h at the point of text.h inclusion into
+	text.h -- it serves as a mini-introduction.
+
+2010-03-02  Ben Wing  <ben@xemacs.org>
+
+	* Makefile.in.in:
+	* Makefile.in.in (objs):
+	glyphs-shared.o, glyphs-eimage.o only needed when HAVE_WINDOW_SYSTEM.
+	glyphs-widget.o should be too, but we need a bit of work ifdeffing
+	out the subwindow stuff from redisplay.c et al.
+	
+	* bytecode.c (init_opcode_table_multi_op):
+	Change var name to avoid shadowing with `basename'.
+	
+	* emacs.c (main_1):
+	Don't call init/etc. routines for glyphs-shared, glyphs-eimage unless
+	HAVE_WINDOW_SYSTEM is defined.
+	
+	* linuxplay.c:
+	* linuxplay.c (sighandler):
+	* vdb-posix.c (vdb_fault_handler):
+	Use const for variables holding string constants to avoid C++
+	warnings.
+
+2010-02-26  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* file-coding.c (Fmake_coding_system_internal):
+	Be somewhat clearer in this docstring, especially for the sake of
+	people running non-Mule builds who will see this docstring when
+	they do F1 f make-coding-system RET.
+
 2010-02-25  Didier Verna  <didier@xemacs.org>
 
 	The background-placement face property.
--- a/src/Makefile.in.in	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/Makefile.in.in	Wed Mar 03 05:19:49 2010 -0600
@@ -183,6 +183,10 @@
 event_unixoid_objs=event-unixoid.o
 #endif
 
+#ifdef HAVE_WINDOW_SYSTEM
+glyphs_objs=glyphs-eimage.o glyphs-shared.o
+#endif
+
 #ifdef HAVE_GPM
 gpm_objs=gpmevent.o
 #endif
@@ -281,8 +285,8 @@
  event-stream.o $(event_unixoid_objs) $(extra_objs) extents.o\
  faces.o file-coding.o fileio.o $(LOCK_OBJ) filemode.o floatfns.o fns.o \
  font-lock.o frame.o\
- gc.o general.o glyphs.o glyphs-eimage.o glyphs-shared.o\
- glyphs-widget.o $(gpm_objs) $(gtk_objs) $(gtk_gui_objs) $(gui_objs) \
+ gc.o general.o glyphs.o $(glyphs_objs) glyphs-widget.o \
+ $(gpm_objs) $(gtk_objs) $(gtk_gui_objs) $(gui_objs) \
  gutter.o\
  hash.o imgproc.o indent.o insdel.o intl.o\
  keymap.o $(RTC_patch_objs) line-number.o $(ldap_objs) lread.o lstream.o\
--- a/src/bytecode.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/bytecode.c	Wed Mar 03 05:19:49 2010 -0600
@@ -2823,14 +2823,14 @@
 static void
 init_opcode_table_multi_op (Opcode op)
 {
-  const Ascbyte *basename = opcode_name_table[op];
+  const Ascbyte *base = opcode_name_table[op];
   Ascbyte temp[300];
   int i;
 
   for (i = 1; i < 7; i++)
     {
       assert (!opcode_name_table[op + i]);
-      sprintf (temp, "%s+%d", basename, i);
+      sprintf (temp, "%s+%d", base, i);
       opcode_name_table[op + i] = xstrdup (temp);
     }
 }
--- a/src/emacs.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/emacs.c	Wed Mar 03 05:19:49 2010 -0600
@@ -1538,8 +1538,10 @@
       syms_of_frame ();
       syms_of_general ();
       syms_of_glyphs ();
+#ifdef HAVE_WINDOW_SYSTEM
       syms_of_glyphs_eimage ();
       syms_of_glyphs_shared ();
+#endif
       syms_of_glyphs_widget ();
       syms_of_gui ();
       syms_of_gutter ();
@@ -1873,7 +1875,9 @@
 	 called before the any calls to the other macros. */
 
       image_instantiator_format_create ();
+#ifdef HAVE_WINDOW_SYSTEM
       image_instantiator_format_create_glyphs_eimage ();
+#endif
       image_instantiator_format_create_glyphs_widget ();
 #ifdef HAVE_TTY
       image_instantiator_format_create_glyphs_tty ();
@@ -2104,7 +2108,9 @@
       vars_of_frame ();
       vars_of_gc ();
       vars_of_glyphs ();
+#ifdef HAVE_WINDOW_SYSTEM
       vars_of_glyphs_eimage ();
+#endif
       vars_of_glyphs_widget ();
       vars_of_gui ();
       vars_of_gutter ();
--- a/src/file-coding.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/file-coding.c	Wed Mar 03 05:19:49 2010 -0600
@@ -1407,13 +1407,15 @@
 }
 
 DEFUN ("make-coding-system-internal", Fmake_coding_system_internal, 2, 4, 0, /*
-See `make-coding-system'.  This does much of the work of that function.
-
+Create a new coding system object, and register NAME as its name.
+
+With Mule support, this does much of the work of `make-coding-system'.
 Without Mule support, it does all the work of that function, and an alias
-exists, mapping `make-coding-system' to
-`make-coding-system-internal'. You'll need a non-Mule XEmacs to read the
-complete docstring. Or you can just read it in make-coding-system.el;
-something like the following should work:
+exists, mapping `make-coding-system' to `make-coding-system-internal'.
+
+You'll need a Mule XEmacs to read the complete docstring. Or you can
+just read it in make-coding-system.el; something like the following
+should work:
 
  \\[find-function-other-window] find-file RET \\[find-file] mule/make-coding-system.el RET
 
--- a/src/linuxplay.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/linuxplay.c	Wed Mar 03 05:19:49 2010 -0600
@@ -72,7 +72,7 @@
 static int           mix_fd;
 static int           audio_vol;
 static int           audio_fd;
-static Ascbyte    *audio_dev = "/dev/dsp";
+static const Ascbyte *audio_dev = "/dev/dsp";
 
 /* Intercept SIGINT and SIGHUP in order to close the audio and mixer
    devices before terminating sound output; this requires reliable
--- a/src/lisp.h	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/lisp.h	Wed Mar 03 05:19:49 2010 -0600
@@ -3466,8 +3466,18 @@
     x = wrong_type_argument (Qnatnump, x);	\
 } while (0)
 
+END_C_DECLS
+
+/* -------------- properties of internally-formatted text ------------- */
+
+#include "text.h"
+
 /*------------------------------- char ---------------------------------*/
 
+BEGIN_C_DECLS
+
+#ifdef ERROR_CHECK_TYPES
+
 /* NOTE: There are basic functions for converting between a character and
    the string representation of a character in text.h, as well as lots of
    other character-related stuff.  There are other functions/macros for
@@ -3475,31 +3485,6 @@
    Ichar, the length of an Ichar when converted to text, etc.
 */
 
-#ifdef MULE
-
-MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
-
-/* Return whether the given Ichar is valid.
- */
-
-DECLARE_INLINE_HEADER (
-int
-valid_ichar_p (Ichar ch)
-)
-{
-  return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch);
-}
-
-#else /* not MULE */
-
-/* This works when CH is negative, and correctly returns non-zero only when CH
-   is in the range [0, 255], inclusive. */
-#define valid_ichar_p(ch) (! (ch & ~0xFF))
-
-#endif /* not MULE */
-
-#ifdef ERROR_CHECK_TYPES
-
 DECLARE_INLINE_HEADER (
 int
 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line)
@@ -3847,37 +3832,6 @@
 END_C_DECLS
 
 /************************************************************************/
-/*      Definitions related to the format of text and of characters     */
-/************************************************************************/
-
-/* Note:
-
-   "internally formatted text" and the term "internal format" in
-   general are likely to refer to the format of text in buffers and
-   strings; "externally formatted text" and the term "external format"
-   refer to any text format used in the O.S. or elsewhere outside of
-   XEmacs.  The format of text and of a character are related and
-   there must be a one-to-one relationship (hopefully through a
-   relatively simple algorithmic means of conversion) between a string
-   of text and an equivalent array of characters, but the conversion
-   between the two is NOT necessarily trivial.
-
-   In a non-Mule XEmacs, allowed characters are numbered 0 through
-   255, where no fixed meaning is assigned to them, but (when
-   representing text, rather than bytes in a binary file) in practice
-   the lower half represents ASCII and the upper half some other 8-bit
-   character set (chosen by setting the font, case tables, syntax
-   tables, etc. appropriately for the character set through ad-hoc
-   means such as the `iso-8859-1' file and the
-   `standard-display-european' function).
-
-   #### Finish this.
-
-	*/
-#include "text.h"
-
-
-/************************************************************************/
 /*	   Definitions of primitive Lisp functions and variables	*/
 /************************************************************************/
 
--- a/src/text.h	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/text.h	Wed Mar 03 05:19:49 2010 -0600
@@ -47,6 +47,33 @@
 
 BEGIN_C_DECLS
 
+/************************************************************************/
+/*        A short intro to the format of text and of characters         */
+/************************************************************************/
+
+/*
+   "internally formatted text" and the term "internal format" in
+   general are likely to refer to the format of text in buffers and
+   strings; "externally formatted text" and the term "external format"
+   refer to any text format used in the O.S. or elsewhere outside of
+   XEmacs.  The format of text and of a character are related and
+   there must be a one-to-one relationship (hopefully through a
+   relatively simple algorithmic means of conversion) between a string
+   of text and an equivalent array of characters, but the conversion
+   between the two is NOT necessarily trivial.
+
+   In a non-Mule XEmacs, allowed characters are numbered 0 through
+   255, where no fixed meaning is assigned to them, but (when
+   representing text, rather than bytes in a binary file) in practice
+   the lower half represents ASCII and the upper half some other 8-bit
+   character set (chosen by setting the font, case tables, syntax
+   tables, etc. appropriately for the character set through ad-hoc
+   means such as the `iso-8859-1' file and the
+   `standard-display-european' function).
+   
+   For more info, see `text.c' and the Internals Manual.
+*/
+
 /* ---------------------------------------------------------------------- */
 /*                     Super-basic character properties                   */
 /* ---------------------------------------------------------------------- */
@@ -166,6 +193,29 @@
 
 #endif /* not MULE */
 
+#ifdef MULE
+
+MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
+
+/* Return whether the given Ichar is valid.
+ */
+
+DECLARE_INLINE_HEADER (
+int
+valid_ichar_p (Ichar ch)
+)
+{
+  return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch);
+}
+
+#else /* not MULE */
+
+/* This works when CH is negative, and correctly returns non-zero only when CH
+   is in the range [0, 255], inclusive. */
+#define valid_ichar_p(ch) (! (ch & ~0xFF))
+
+#endif /* not MULE */
+
 /* For more discussion, see text.c, "handling non-default formats" */
 
 typedef enum internal_format
--- a/src/vdb-posix.c	Wed Mar 03 05:07:47 2010 -0600
+++ b/src/vdb-posix.c	Wed Mar 03 05:19:49 2010 -0600
@@ -73,7 +73,7 @@
     }
   else  /* default sigsegv handler */
     {
-      char *signal_name = "";
+      const Ascbyte *signal_name = "";
       if (signum == SIGSEGV)
 	signal_name = "SIGSEGV";
       else if (signum == SIGBUS)