diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/category.c | 25 | ||||
-rw-r--r-- | src/category.h | 3 | ||||
-rw-r--r-- | src/regex.c | 24 | ||||
-rw-r--r-- | src/regex.h | 3 | ||||
-rw-r--r-- | src/syntax.c | 41 | ||||
-rw-r--r-- | src/syntax.h | 3 |
6 files changed, 63 insertions, 36 deletions
diff --git a/src/category.c b/src/category.c index 89e4d907378..3c49858bc68 100644 --- a/src/category.c +++ b/src/category.c @@ -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; { @@ -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; { @@ -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; @@ -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; { @@ -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; @@ -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) */ diff --git a/src/category.h b/src/category.h index f2335664acf..adad3d713f8 100644 --- a/src/category.h +++ b/src/category.h @@ -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) */ diff --git a/src/regex.c b/src/regex.c index 453ca3d85d5..e1479e64c9f 100644 --- a/src/regex.c +++ b/src/regex.c @@ -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 @@ -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 @@ -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 @@ -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; @@ -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'. */ @@ -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) @@ -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); @@ -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) */ diff --git a/src/regex.h b/src/regex.h index b23c8855eff..be7634bb8de 100644 --- a/src/regex.h +++ b/src/regex.h @@ -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) */ diff --git a/src/syntax.c b/src/syntax.c index 57c7e4d69f2..680a4bcaf87 100644 --- a/src/syntax.c +++ b/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. @@ -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), @@ -1451,7 +1455,9 @@ 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; @@ -1459,9 +1465,6 @@ skip_chars (forwardp, string, lim) /* 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 @@ 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; @@ -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 == '\\' @@ -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) */ diff --git a/src/syntax.h b/src/syntax.h index bdf7ebb31bd..21f24dbd100 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -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) */ |