Skip to content

Commit

Permalink
Sync to HEAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenichi Handa committed Apr 8, 2004
1 parent 88b904e commit bbe535d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 36 deletions.
25 changes: 15 additions & 10 deletions src/category.c
Expand Up @@ -91,11 +91,11 @@ those categories. */)
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;
{
Expand All @@ -111,7 +111,9 @@ The category is defined only in category table TABLE, which defaults to
}

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;
{
Expand All @@ -123,10 +125,9 @@ DEFUN ("category-docstring", Fcategory_docstring, Scategory_docstring, 1, 2, 0,

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;
Expand Down Expand Up @@ -256,7 +257,8 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
}

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;
{
Expand Down Expand Up @@ -290,7 +292,7 @@ DEFUN ("category-set-mnemonics", Fcategory_set_mnemonics,
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;
Expand Down Expand Up @@ -519,3 +521,6 @@ See the documentation of the variable `word-combining-categories'. */);

category_table_version = 0;
}

/* arch-tag: 74ebf524-121b-4d9c-bd68-07f8d708b211
(do not change this comment) */
3 changes: 3 additions & 0 deletions src/category.h
Expand Up @@ -118,3 +118,6 @@ extern Lisp_Object _temp_category_set;
&& 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) */
24 changes: 15 additions & 9 deletions src/regex.c
Expand Up @@ -1000,9 +1000,10 @@ print_partial_compiled_pattern (start, end)
int has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1);

fprintf (stderr, "/charset [%s",
(re_opcode_t) *(p - 1) == charset_not ? "^" : "");
(re_opcode_t) *(p - 1) == charset_not ? "^" : "");

assert (p + *p < pend);
if (p + *p >= pend)
fprintf (stderr, " !extends past end of pattern! ");

for (c = 0; c < 256; c++)
if (c / 8 < length
Expand Down Expand Up @@ -1761,8 +1762,11 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend,


/* 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
Expand All @@ -1774,6 +1778,7 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend,
#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
Expand Down Expand Up @@ -3588,8 +3593,6 @@ regex_compile (pattern, size, syntax, bufp)
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;

Expand Down Expand Up @@ -3634,7 +3637,7 @@ regex_compile (pattern, size, syntax, bufp)
}
#endif /* not MATCH_MAY_ALLOCATE */

return REG_NOERROR;
FREE_STACK_RETURN (REG_NOERROR);
} /* regex_compile */

/* Subroutines for `regex_compile'. */
Expand Down Expand Up @@ -4571,9 +4574,9 @@ skip_one_char (p)


/* 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)
Expand Down Expand Up @@ -4602,7 +4605,7 @@ skip_noops (p, pend)
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);
Expand Down Expand Up @@ -6474,3 +6477,6 @@ regfree (preg)
WEAK_ALIAS (__regfree, regfree)

#endif /* not emacs */

/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
(do not change this comment) */
3 changes: 3 additions & 0 deletions src/regex.h
Expand Up @@ -577,3 +577,6 @@ version-control: t
trim-versions-without-asking: nil
End:
*/

/* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083
(do not change this comment) */
41 changes: 24 additions & 17 deletions src/syntax.c
@@ -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.
Expand Down Expand Up @@ -1302,21 +1302,25 @@ scan_words (from, count)
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),
Expand Down Expand Up @@ -1451,17 +1455,16 @@ skip_chars (forwardp, string, lim)

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;

/* Skip over the dash. */
i_byte++;

if (i_byte == size_byte)
break;

/* Get the end of the range. */
c2 = str[i_byte++];
if (c2 == '\\'
Expand Down Expand Up @@ -1537,10 +1540,13 @@ skip_chars (forwardp, string, lim)
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;
Expand All @@ -1549,12 +1555,10 @@ skip_chars (forwardp, string, lim)
/* 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 == '\\'
Expand Down Expand Up @@ -3312,3 +3316,6 @@ In both cases, LIMIT bounds the search. */);
defsubr (&Sbackward_prefix_chars);
defsubr (&Sparse_partial_sexp);
}

/* arch-tag: 3e297b9f-088e-4b64-8f4c-fb0b3443e412
(do not change this comment) */
3 changes: 3 additions & 0 deletions src/syntax.h
Expand Up @@ -344,3 +344,6 @@ extern int parse_sexp_lookup_properties;
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) */

0 comments on commit bbe535d

Please sign in to comment.