changeset 89880:51677cb10ced

Sync to HEAD.
author Kenichi Handa <handa@m17n.org>
date Thu, 08 Apr 2004 11:39:14 +0000
parents 1fc9a2dd29dd
children a8e1efb65ccf
files src/category.c src/category.h src/regex.c src/regex.h src/syntax.c src/syntax.h
diffstat 6 files changed, 65 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/category.c	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/category.c	Thu Apr 08 11:39:14 2004 +0000
@@ -91,11 +91,11 @@
 Lisp_Object check_category_table ();
 
 DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0,
-       doc: /* Define CHAR as a category which is described by DOCSTRING.
-CHAR should be an ASCII printing character in the range ` ' to `~'.
-DOCSTRING is a documentation string of the category.
+       doc: /* Define CATEGORY as a category which is described by DOCSTRING.
+CATEGORY should be an ASCII printing character in the range ` ' to `~'.
+DOCSTRING is the documentation string of the category.
 The category is defined only in category table TABLE, which defaults to
- the current buffer's category table.  */)
+the current buffer's category table.  */)
      (category, docstring, table)
      Lisp_Object category, docstring, table;
 {
@@ -111,7 +111,9 @@
 }
 
 DEFUN ("category-docstring", Fcategory_docstring, Scategory_docstring, 1, 2, 0,
-       doc: /* Return the documentation string of CATEGORY, as defined in CATEGORY-TABLE.  */)
+       doc: /* Return the documentation string of CATEGORY, as defined in TABLE.
+TABLE should be a category table and defaults to the current buffer's
+category table.  */)
      (category, table)
      Lisp_Object category, table;
 {
@@ -123,10 +125,9 @@
 
 DEFUN ("get-unused-category", Fget_unused_category, Sget_unused_category,
        0, 1, 0,
-       doc: /* Return a category which is not yet defined in CATEGORY-TABLE.
+       doc: /* Return a category which is not yet defined in TABLE.
 If no category remains available, return nil.
-The optional argument CATEGORY-TABLE
-specifies which category table to modify;
+The optional argument TABLE specifies which category table to modify;
 it defaults to the current buffer's category table.  */)
      (table)
      Lisp_Object table;
@@ -256,7 +257,8 @@
 }
 
 DEFUN ("set-category-table", Fset_category_table, Sset_category_table, 1, 1, 0,
-       doc: /* Specify TABLE as the category table for the current buffer.  */)
+       doc: /* Specify TABLE as the category table for the current buffer.
+Return TABLE.  */)
      (table)
      Lisp_Object table;
 {
@@ -290,7 +292,7 @@
        Scategory_set_mnemonics, 1, 1, 0,
        doc: /* Return a string containing mnemonics of the categories in CATEGORY-SET.
 CATEGORY-SET is a bool-vector, and the categories \"in\" it are those
-that are indexes where t occurs the bool-vector.
+that are indexes where t occurs in the bool-vector.
 The return value is a string containing those same categories.  */)
      (category_set)
      Lisp_Object category_set;
@@ -519,3 +521,6 @@
 
   category_table_version = 0;
 }
+
+/* arch-tag: 74ebf524-121b-4d9c-bd68-07f8d708b211
+   (do not change this comment) */
--- a/src/category.h	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/category.h	Thu Apr 08 11:39:14 2004 +0000
@@ -118,3 +118,6 @@
    && word_boundary_p (c1, c2))
 
 extern int word_boundary_p P_ ((int, int));
+
+/* arch-tag: 309dfe83-c3e2-4d22-8e81-faae5aece0ff
+   (do not change this comment) */
--- a/src/regex.c	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/regex.c	Thu Apr 08 11:39:14 2004 +0000
@@ -1000,9 +1000,10 @@
 	    int has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1);
 
 	    fprintf (stderr, "/charset [%s",
-		    (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-
-	    assert (p + *p < pend);
+		     (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
+
+	    if (p + *p >= pend)
+	      fprintf (stderr, " !extends past end of pattern! ");
 
 	    for (c = 0; c < 256; c++)
 	      if (c / 8 < length
@@ -1761,8 +1762,11 @@
 
 
 /* This is not an arbitrary limit: the arguments which represent offsets
-   into the pattern are two bytes long.  So if 2^16 bytes turns out to
+   into the pattern are two bytes long.  So if 2^15 bytes turns out to
    be too small, many things would have to change.  */
+# define MAX_BUF_SIZE (1L << 15)
+
+#if 0  /* This is when we thought it could be 2^16 bytes.  */
 /* Any other compiler which, like MSC, has allocation limit below 2^16
    bytes will have to use approach similar to what was done below for
    MSC and drop MAX_BUF_SIZE a bit.  Otherwise you may end up
@@ -1774,6 +1778,7 @@
 #else
 # define MAX_BUF_SIZE (1L << 16)
 #endif
+#endif /* 0 */
 
 /* Extend the buffer by twice its current size via realloc and
    reset the pointers that pointed into the old block to point to the
@@ -3588,8 +3593,6 @@
   if (syntax & RE_NO_POSIX_BACKTRACKING)
     BUF_PUSH (succeed);
 
-  free (compile_stack.stack);
-
   /* We have succeeded; set the length of the buffer.  */
   bufp->used = b - bufp->buffer;
 
@@ -3634,7 +3637,7 @@
   }
 #endif /* not MATCH_MAY_ALLOCATE */
 
-  return REG_NOERROR;
+  FREE_STACK_RETURN (REG_NOERROR);
 } /* regex_compile */
 
 /* Subroutines for `regex_compile'.  */
@@ -4571,9 +4574,9 @@
 
 
 /* Jump over non-matching operations.  */
-static unsigned char *
+static re_char *
 skip_noops (p, pend)
-     unsigned char *p, *pend;
+     re_char *p, *pend;
 {
   int mcnt;
   while (p < pend)
@@ -4602,7 +4605,7 @@
 static int
 mutually_exclusive_p (bufp, p1, p2)
      struct re_pattern_buffer *bufp;
-     unsigned char *p1, *p2;
+     re_char *p1, *p2;
 {
   re_opcode_t op2;
   const boolean multibyte = RE_MULTIBYTE_P (bufp);
@@ -6474,3 +6477,6 @@
 WEAK_ALIAS (__regfree, regfree)
 
 #endif /* not emacs  */
+
+/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
+   (do not change this comment) */
--- a/src/regex.h	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/regex.h	Thu Apr 08 11:39:14 2004 +0000
@@ -577,3 +577,6 @@
 trim-versions-without-asking: nil
 End:
 */
+
+/* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083
+   (do not change this comment) */
--- a/src/syntax.c	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/syntax.c	Thu Apr 08 11:39:14 2004 +0000
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
-   Copyright (C) 1985, 87, 93, 94, 95, 97, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1985, 87, 93, 94, 95, 97, 1998, 1999, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1302,21 +1302,25 @@
   return from;
 }
 
-DEFUN ("forward-word", Fforward_word, Sforward_word, 1, 1, "p",
+DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "p",
        doc: /* Move point forward ARG words (backward if ARG is negative).
 Normally returns t.
 If an edge of the buffer or a field boundary is reached, point is left there
 and the function returns nil.  Field boundaries are not noticed if
 `inhibit-field-text-motion' is non-nil.  */)
-     (count)
-     Lisp_Object count;
+     (arg)
+     Lisp_Object arg;
 {
   int orig_val, val;
-  CHECK_NUMBER (count);
-
-  val = orig_val = scan_words (PT, XINT (count));
+
+  if (NILP (arg))
+    XSETFASTINT (arg, 1);
+  else
+    CHECK_NUMBER (arg);
+
+  val = orig_val = scan_words (PT, XINT (arg));
   if (! orig_val)
-    val = XINT (count) > 0 ? ZV : BEGV;
+    val = XINT (arg) > 0 ? ZV : BEGV;
 
   /* Avoid jumping out of an input field.  */
   val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT),
@@ -1451,7 +1455,9 @@
 
 	      c = str[i_byte++];
 	    }
-	  if (i_byte < size_byte
+	  /* Treat `-' as range character only if another character
+	     follows.  */
+	  if (i_byte + 1 < size_byte
 	      && str[i_byte] == '-')
 	    {
 	      unsigned int c2;
@@ -1459,9 +1465,6 @@
 	      /* Skip over the dash.  */
 	      i_byte++;
 
-	      if (i_byte == size_byte)
-		break;
-
 	      /* Get the end of the range.  */
 	      c2 = str[i_byte++];
 	      if (c2 == '\\'
@@ -1537,10 +1540,13 @@
 		break;
 
 	      leading_code = str[i_byte];
-	      c = STRING_CHAR_AND_LENGTH (str+i_byte, size_byte-i_byte, len);
+	      c = STRING_CHAR_AND_LENGTH (str + i_byte,
+					  size_byte - i_byte, len);
 	      i_byte += len;
 	    }
-	  if (i_byte < size_byte
+	  /* Treat `-' as range character only if another character
+	     follows.  */
+	  if (i_byte + 1 < size_byte
 	      && str[i_byte] == '-')
 	    {
 	      unsigned int c2;
@@ -1549,12 +1555,10 @@
 	      /* Skip over the dash.  */
 	      i_byte++;
 
-	      if (i_byte == size_byte)
-		break;
-
 	      /* Get the end of the range.  */
 	      leading_code2 = str[i_byte];
-	      c2 =STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
+	      c2 = STRING_CHAR_AND_LENGTH (str + i_byte,
+					   size_byte - i_byte, len);
 	      i_byte += len;
 
 	      if (c2 == '\\'
@@ -3312,3 +3316,6 @@
   defsubr (&Sbackward_prefix_chars);
   defsubr (&Sparse_partial_sexp);
 }
+
+/* arch-tag: 3e297b9f-088e-4b64-8f4c-fb0b3443e412
+   (do not change this comment) */
--- a/src/syntax.h	Wed Apr 07 07:24:06 2004 +0000
+++ b/src/syntax.h	Thu Apr 08 11:39:14 2004 +0000
@@ -344,3 +344,6 @@
 extern INTERVAL interval_of P_ ((int, Lisp_Object));
 
 extern int scan_words P_ ((int, int));
+
+/* arch-tag: 28833cca-cd73-4741-8c85-a3111166a0e0
+   (do not change this comment) */