[AC21.5] Warning suppression
13 years, 4 months
Stephen J. Turnbull
APPROVE COMMIT 21.5
The following patches suppress warnings, at least on Mac OS X 10.5
with GCC 4.2. They can't hurt on other systems, so I'm going to
apply. However, three of them are a bit ugly (*), so please let me
know if you don't like them, I will be happy to accept improved names
or even revert if people feel really strongly.
These patches are "mq" patches, although some are somewhat edited to
give -U0 semantics to the ChangeLog patches.
pdump_file_try-warning Workaround GCC bogosity needs prototype
excessive-zlib-magic* zlib tries to support nonconforming LARGE FILE
eimage-shadowed-local Loop index name confused with image instance
non-ansi-shadowed-global* j1 (!!) is a <math.h> function on Mac!?!
search-shadowed-global* ceil & floor are standard <math.h>
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Improve documentation of syntax table internals.
13 years, 4 months
Stephen J. Turnbull
changeset: 5544:c2301b2c88c8
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:20 2011 +0900
files: src/ChangeLog src/syntax.c src/syntax.h
description:
Improve documentation of syntax table internals.
diff -r fbe90e6f7a43 -r c2301b2c88c8 src/ChangeLog
--- a/src/ChangeLog Mon Aug 08 13:57:20 2011 +0900
+++ b/src/ChangeLog Mon Aug 08 13:57:20 2011 +0900
@@ -1,3 +1,28 @@
+2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * syntax.c:
+ Remove some obsolete or unintelligible #### comments.
+ Improve many toplevel comments.
+
+ (Fsyntax_designator_chars):
+ (Fchar_syntax):
+ (Fmatching_paren):
+ (Fforward_word):
+ (Fforward_comment):
+ (Fscan_lists):
+ (Fscan_sexps):
+ (Fbackward_prefix_chars):
+ (parse-sexp-ignore-comments):
+ (lookup-syntax-properties):
+ (words-include-escapes):
+ Improve docstrings.
+
+ * syntax.h:
+ Document functions and restrictions struct syntax_cache members.
+ Improve many toplevel comments.
+ Delete syntax code parsing macros unused for a decade or so.
+ (#if 0'd out since May 2002.)
+
2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
* syntax.c (reset_buffer_syntax_cache_range):
diff -r fbe90e6f7a43 -r c2301b2c88c8 src/syntax.c
--- a/src/syntax.c Mon Aug 08 13:57:20 2011 +0900
+++ b/src/syntax.c Mon Aug 08 13:57:20 2011 +0900
@@ -41,17 +41,14 @@
int parse_sexp_ignore_comments;
-/* The following two variables are provided to tell additional information
- to the regex routines. We do it this way rather than change the
- arguments to re_search_2() in an attempt to maintain some call
- compatibility with other versions of the regex code. */
-
-/* Tell the regex routines not to QUIT. Normally there is a QUIT
- each iteration in re_search_2(). */
+/* Tell the regex routines not to QUIT. Normally there is a QUIT each
+ iteration in re_search_2(). We do it this way rather than change
+ the arguments to re_search_2() in an attempt to maintain some call
+ compatibility with other versions of the regex code.
+ #### Surely this is no longer a consideration. Last sync was 19.28! */
int no_quit_in_re_search;
-/* The standard syntax table is stored where it will automatically
- be used in all new buffers. */
+/* The standard syntax table is automatically used in all new buffers. */
Lisp_Object Vstandard_syntax_table;
Lisp_Object Vsyntax_designator_chars_string;
@@ -84,6 +81,7 @@
Lisp_Object levelstarts;/* Char numbers of starts-of-expression
of levels (starting from outermost). */
};
+
/* These variables are a cache for finding the start of a defun.
find_start_pos is the place for which the defun start was found.
@@ -165,9 +163,8 @@
}
DEFUN ("syntax-table", Fsyntax_table, 0, 1, 0, /*
-Return the current syntax table.
-This is the one specified by the current buffer, or by BUFFER if it
-is non-nil.
+Return the current syntax table of BUFFER.
+BUFFER defaults to the current buffer.
*/
(buffer))
{
@@ -177,9 +174,8 @@
#ifdef DEBUG_XEMACS
DEFUN ("mirror-syntax-table", Fmirror_syntax_table, 0, 1, 0, /*
-Return the current mirror syntax table, for debugging purposes.
-This is the one specified by the current buffer, or by BUFFER if it
-is non-nil.
+Return the current mirror syntax table of BUFFER.
+BUFFER defaults to the current buffer. Only useful in debugging internals.
*/
(buffer))
{
@@ -187,8 +183,12 @@
}
DEFUN ("syntax-cache-info", Fsyntax_cache_info, 0, 1, 0, /*
-Return info about the syntax cache in BUFFER.
-BUFFER defaults to the current buffer if nil.
+Return a list (START END PREV_CHANGE NEXT_CHANGE) for BUFFER's syntax cache.
+BUFFER defaults to the current buffer.
+
+The elements correspond to members of struct syntax_cache of the same names.
+START and END should be markers. PREV_CHANGE and NEXT_CHANGE are integers.
+Only useful in debugging internals.
*/
(buffer))
{
@@ -201,8 +201,7 @@
#endif /* DEBUG_XEMACS */
DEFUN ("standard-syntax-table", Fstandard_syntax_table, 0, 0, 0, /*
-Return the standard syntax table.
-This is the one used for new buffers.
+Return the standard syntax table, used for new buffers.
*/
())
{
@@ -315,6 +314,11 @@
}
}
+/* init_syntax_cache
+ Arguments:
+ cache: pointer to a zero-ed struct syntax_cache
+ object: a Lisp string or buffer
+ buffer: NULL or the struct buffer of buffer */
static void
init_syntax_cache (struct syntax_cache *cache, /* cache must be zero'ed */
Lisp_Object object, /* string or buffer */
@@ -333,11 +337,9 @@
/* external syntax cache API */
-/* #### This function and associated logic still needs work, and especially
- documentation. */
struct syntax_cache * /* return CACHE or the cache of OBJECT */
-setup_syntax_cache (struct syntax_cache *cache, /* syntax cache, may be NULL
- if OBJECT is a buffer */
+setup_syntax_cache (struct syntax_cache *cache, /* may be NULL only if
+ OBJECT is a buffer */
Lisp_Object object, /* the object (if any) cache
is associated with */
struct buffer *buffer, /* the buffer to use as source
@@ -372,21 +374,18 @@
}
/*
- Update syntax_cache to an appropriate setting for position POS
+ Update syntax_cache CACHE to an appropriate setting for position CPOS.
- The sign of COUNT gives the relative position of POS wrt the
+ The sign of COUNT gives the relative position of CPOS wrt the
previously valid interval. (not currently used)
- `syntax_cache.*_change' are the next and previous positions at
- which syntax_code and c_s_t will need to be recalculated.
+ `syntax_cache.*_change' are the next and previous positions at which
+ syntax_code and c_s_t will need to be recalculated.
- #### Currently this code uses `get-char-property', which will
- return the "last smallest" extent at a given position. In cases
- where overlapping extents are defined, this code will simply use
- whatever is returned by get-char-property.
-
- It might be worth it at some point to merge provided syntax tables
- outward to the current buffer (#### rewrite in English please?!). */
+ #### Currently this code uses `get-char-property', which will return
+ the "last smallest" extent at a given position. In cases where
+ overlapping extents are defined, this code will simply use whatever
+ is returned by get-char-property. */
void
update_syntax_cache (struct syntax_cache *cache, Charxpos cpos,
@@ -482,8 +481,7 @@
}
/* buffer-specific APIs used in buffer.c
- #### This is really unclean;
- the syntax cache should just be a LISP object */
+ #### Really unclean; the syntax cache should just be a LISP object. */
void
mark_buffer_syntax_cache (struct buffer *buf)
@@ -541,7 +539,6 @@
if (BUFFERP (buffer))
{
struct syntax_cache *cache = XBUFFER (buffer)->syntax_cache;
- /* #### would this be slower or less accurate in character terms? */
Bytexpos start = extent_endpoint_byte (extent, 0);
Bytexpos end = extent_endpoint_byte (extent, 1);
Bytexpos start2 = byte_marker_position (cache->start);
@@ -569,9 +566,13 @@
-/* Convert a letter which signifies a syntax code
- into the code it signifies.
- This is used by modify-syntax-entry, and other things. */
+/* Convert an ASCII character which represents a syntax class
+ into the corresponding syntax code.
+ This is used by (search.c) skip_chars and (regex.c) regex_compile.
+ regex_compile indexes with `c' of type int, but promises that it
+ is positive.
+ #### skip_chars indexes with an Ichar, a signed type. Presumably
+ this is guaranteed non-negative. */
const unsigned char syntax_spec_code[0200] =
{ 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
@@ -595,12 +596,12 @@
0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377
};
+/* The inverse mapping for syntax_spec_code. */
const unsigned char syntax_code_spec[] = " .w_()'\"$\\/<>@!|";
DEFUN ("syntax-designator-chars", Fsyntax_designator_chars, 0, 0, 0, /*
-Return a string of the recognized syntax designator chars.
-The chars are ordered by their internal syntax codes, which are
-numbered starting at 0.
+Return the string of the recognized syntax designator chars.
+The chars are indexed by their internal syntax codes, starting at 0.
*/
())
{
@@ -608,13 +609,9 @@
}
DEFUN ("char-syntax", Fchar_syntax, 1, 2, 0, /*
-Return the syntax code of CHARACTER, described by a character.
-For example, if CHARACTER is a word constituent,
-the character `?w' is returned.
-The characters that correspond to various syntax codes
-are listed in the documentation of `modify-syntax-entry'.
-Optional second argument SYNTAX-TABLE defaults to the current buffer's
-syntax table.
+Return the syntax code of CHARACTER, designated by a character.
+Optional SYNTAX-TABLE defaults to the current buffer's syntax table.
+See `modify-syntax-entry' for the designators of the defined syntax codes.
*/
(character, syntax_table))
{
@@ -639,12 +636,15 @@
int *multi_p_out)
{
*multi_p_out = 1;
- /* !!#### get this right */
+ /* !!#### get this right
+ Maybe not worth it until we have Unicode inside. */
return Sword;
}
#endif
+/* #### Outside of this file, only used once, in font-lock.c. Make static?
+ If so, remove prototype from syntax.h. */
Lisp_Object
syntax_match (Lisp_Object syntax_table, Ichar ch)
{
@@ -661,8 +661,7 @@
DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /*
Return the matching parenthesis of CHARACTER, or nil if none.
-Optional second argument SYNTAX-TABLE defaults to the current buffer's
-syntax table.
+Optional SYNTAX-TABLE defaults to the current buffer's syntax table.
*/
(character, syntax_table))
{
@@ -797,16 +796,16 @@
}
DEFUN ("forward-word", Fforward_word, 0, 2, "_p", /*
-Move point forward COUNT words (backward if COUNT is negative).
-Normally t is returned, but if an edge of the buffer is reached,
-point is left there and nil is returned.
+Move point forward COUNT words in BUFFER (backward if COUNT is negative).
+COUNT defaults to 1, and BUFFER defaults to the current buffer.
-The characters that are moved over may be added to the current selection
-\(i.e. active region) if the Shift key is held down, a motion key is used
-to invoke this command, and `shifted-motion-keys-select-region' is t; see
+Return t if the motion successfully crosses COUNT words, otherwise nil (if
+the motion would cross the buffer boundary).
+
+The characters that are moved over are added to the region if the region
+is active, the Shift key is held down, a motion key is used to invoke this
+command, and `shifted-motion-keys-select-region' is non-nil; see
the documentation for this variable for more details.
-
-COUNT defaults to 1, and BUFFER defaults to the current buffer.
*/
(count, buffer))
{
@@ -1111,13 +1110,13 @@
at those changes. --ben */
DEFUN ("forward-comment", Fforward_comment, 0, 2, 0, /*
-Move forward across up to COUNT comments, or backwards if COUNT is negative.
+Move forward across COUNT comments in BUFFER (backwards if COUNT is negative).
+COUNT defaults to 1, and BUFFER defaults to the current buffer.
+
Stop scanning if we find something other than a comment or whitespace.
Set point to where scanning stops.
-If COUNT comments are found as expected, with nothing except whitespace
-between them, return t; otherwise return nil.
-Point is set in either case.
-COUNT defaults to 1, and BUFFER defaults to the current buffer.
+Return t if the motion successfully crosses COUNT comments, otherwise nil (if
+the motion would cross the buffer boundary or encounters a noncomment token).
*/
(count, buffer))
{
@@ -1729,8 +1728,11 @@
}
DEFUN ("scan-lists", Fscan_lists, 3, 5, 0, /*
-Scan from character number FROM by COUNT lists.
-Returns the character number of the position thus found.
+Scan from position FROM across COUNT lists starting from nesting DEPTH.
+Returns the position thus found.
+Optional BUFFER defaults to the current buffer.
+If optional NOERROR is non-nil, scan-lists will return nil instead of
+signalling an error when attempting to cross a buffer boundary.
If DEPTH is nonzero, paren depth begins counting from that value,
only places where the depth in parentheses becomes zero
@@ -1743,11 +1745,6 @@
and the depth is wrong, an error is signaled.
If the depth is right but the count is not used up, nil is returned.
-If optional arg BUFFER is non-nil, scanning occurs in that buffer instead
-of in the current buffer.
-
-If optional arg NOERROR is non-nil, scan-lists will return nil instead of
-signalling an error.
*/
(from, count, depth, buffer, noerror))
{
@@ -1763,9 +1760,13 @@
}
DEFUN ("scan-sexps", Fscan_sexps, 2, 4, 0, /*
-Scan from character number FROM by COUNT balanced expressions.
+Scan from position FROM by COUNT balanced expressions.
+Returns the position thus found.
+
If COUNT is negative, scan backwards.
-Returns the character number of the position thus found.
+Optional BUFFER defaults to the current buffer.
+If optional NOERROR is non-nil, scan-sexps will return nil instead of
+signalling an error.
Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
@@ -1773,12 +1774,6 @@
in the middle of a parenthetical grouping, an error is signaled.
If the beginning or end is reached between groupings
but before count is used up, nil is returned.
-
-If optional arg BUFFER is non-nil, scanning occurs in that buffer instead
-of in the current buffer.
-
-If optional arg NOERROR is non-nil, scan-sexps will return nil instead of
-signalling an error.
*/
(from, count, buffer, noerror))
{
@@ -1790,10 +1785,8 @@
}
DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, 0, 1, 0, /*
-Move point backward over any number of chars with prefix syntax.
-This includes chars with "quote" or "prefix" syntax (' or p).
-
-Optional arg BUFFER defaults to the current buffer.
+Move point backward over any number of chars with quote or prefix syntax.
+Optional BUFFER defaults to the current buffer.
*/
(buffer))
{
@@ -2335,8 +2328,7 @@
/* Called from chartab.c when a change is made to a syntax table.
If this is the standard syntax table, we need to recompute
- *all* syntax tables (yuck). Otherwise we just recompute this
- one. */
+ *all* syntax tables. Otherwise we just recompute this one. */
void
update_syntax_table (Lisp_Object table)
@@ -2399,12 +2391,12 @@
vars_of_syntax (void)
{
DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments /*
-Non-nil means `forward-sexp', etc., should treat comments as whitespace.
+If non-nil, `forward-sexp' etc. treat comments as whitespace.
*/ );
parse_sexp_ignore_comments = 0;
DEFVAR_BOOL ("lookup-syntax-properties", &lookup_syntax_properties /*
-Non-nil means `forward-sexp', etc., respect the `syntax-table' property.
+If non-nil, `forward-sexp' etc. respect the `syntax-table' text property.
This property can be placed on buffers or strings and can be used to explicitly
specify the syntax table to be used for looking up the syntax of the chars
having this property, or to directly specify the syntax of the chars.
@@ -2412,12 +2404,12 @@
The value of this property should be either a syntax table, or a cons
of the form (SYNTAXCODE . MATCHCHAR), SYNTAXCODE being the numeric
syntax code, MATCHCHAR being nil or the character to match (which is
-relevant only when the syntax code is open/close-type).
+relevant only when the syntax code is of an open or close type).
*/ );
lookup_syntax_properties = 1;
DEFVAR_BOOL ("words-include-escapes", &words_include_escapes /*
-Non-nil means `forward-word', etc., should treat escape chars part of words.
+If non-nil, `forward-word' etc. treat escape characters as parts of words.
*/ );
words_include_escapes = 0;
diff -r fbe90e6f7a43 -r c2301b2c88c8 src/syntax.h
--- a/src/syntax.h Mon Aug 08 13:57:20 2011 +0900
+++ b/src/syntax.h Mon Aug 08 13:57:20 2011 +0900
@@ -26,22 +26,24 @@
/* A syntax table is a type of char table.
-The low 7 bits of the integer is a code, as follows. The 8th bit is
-used as the prefix bit flag (see below).
-
The values in a syntax table are either integers or conses of
integers and chars. The lowest 7 bits of the integer are the syntax
class. If this is Sinherit, then the actual syntax value needs to
be retrieved from the standard syntax table.
-Since the logic involved in finding the actual integer isn't very
-complex, you'd think the time required to retrieve it is not a
-factor. If you thought that, however, you'd be wrong, due to the
-high number of times (many per character) that the syntax value is
-accessed in functions such as scan_lists(). To speed this up,
-we maintain a mirror syntax table that contains the actual
-integers. We can do this successfully because syntax tables are
-now an abstract type, where we control all access.
+It turns out to be worth optimizing lookups of character syntax in two
+ways. First, although the logic involved in finding the actual integer
+isn't complex, the syntax value is accessed in functions such as
+scan_lists() many times for each character scanned. A "mirror syntax
+table" that contains the actual integers speeds this up.
+
+Second, due to the syntax-table text property, the table for looking up
+syntax may change from character to character. Since looking up properties
+is expensive, a "syntax cache" which contains the current syntax table and
+the region where it is valid can speed up linear scans dramatically.
+
+The low 7 bits of the integer is a code, as follows. The 8th bit is
+used as the prefix bit flag (see below).
*/
enum syntaxcode
@@ -120,21 +122,23 @@
return SYNTAX (table, c) == Sword;
}
-/* OK, here's a graphic diagram of the format of the syntax values:
+/* OK, here's a graphic diagram of the format of the syntax values.
+ Here, the value has already been extracted from the Lisp integer,
+ so there are no tag bits to worry about.
Bit number:
[ 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ]
[ 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ]
- <-----> <-----> <-------------> <-------------> ^ <----------->
- ELisp unused |comment bits | unused | syntax code
- tag | | | | | | | | |
- stuff | | | | | | | | |
- | | | | | | | | |
- | | | | | | | | `--> prefix flag
- | | | | | | | |
- | | | | | | | `--> comment end style B, second char
+ | <-----------> <-------------> <-------------> ^ <----------->
+ | unused |comment bits | unused | syntax code
+ v | | | | | | | | |
+ unusable | | | | | | | | |
+ due to | | | | | | | | |
+ type tag | | | | | | | | `--> prefix flag
+ in Lisp | | | | | | | |
+ integer | | | | | | | `--> comment end style B, second char
| | | | | | `----> comment end style A, second char
| | | | | `------> comment end style B, first char
| | | | `--------> comment end style A, first char
@@ -144,35 +148,35 @@
`----------------> comment start style A, first char
In a 64-bit integer, there would be 32 more unused bits between
- the tag and the comment bits.
+ the unusable bit and the comment bits.
- Clearly, such a scheme will not work for Mule, because the matching
- paren could be any character and as such requires 21 bits, which
- we don't got.
+ In older versions of XEmacs, bits 8-14 contained the matching
+ character for parentheses. Such a scheme will not work for Mule,
+ because the matching parenthesis could be any character and
+ requires 21 bits, which we don't have on a 32-bit platform.
- Remember that under Mule we use char tables instead of vectors.
- So what we do is use another char table for the matching paren
+ What we do is use another char table for the matching parenthesis
and store a pointer to it in the first char table. (This frees
code from having to worry about passing two tables around.)
*/
-/* The prefix flag bit for backward-prefix-chars is now put into bit 7. */
+/* The prefix flag bit for backward-prefix-chars is in bit 7. */
#define SYNTAX_PREFIX(table, c) \
((SYNTAX_CODE (table, c) >> 7) & 1)
/* Bits 23-16 are used to implement up to two comment styles
in a single buffer. They have the following meanings:
-
- 1. first of a one or two character comment-start sequence of style a.
- 2. first of a one or two character comment-start sequence of style b.
- 3. second of a two-character comment-start sequence of style a.
- 4. second of a two-character comment-start sequence of style b.
- 5. first of a one or two character comment-end sequence of style a.
- 6. first of a one or two character comment-end sequence of style b.
- 7. second of a two-character comment-end sequence of style a.
- 8. second of a two-character comment-end sequence of style b.
+ bit
+ 23 first of a one or two character comment-start sequence of style a.
+ 22 first of a one or two character comment-start sequence of style b.
+ 21 second of a two-character comment-start sequence of style a.
+ 20 second of a two-character comment-start sequence of style b.
+ 19 first of a one or two character comment-end sequence of style a.
+ 18 first of a one or two character comment-end sequence of style b.
+ 17 second of a two-character comment-end sequence of style a.
+ 16 second of a two-character comment-end sequence of style b.
*/
#define SYNTAX_COMMENT_BITS(table, c) \
@@ -196,84 +200,20 @@
#define SYNTAX_SECOND_CHAR_END 0x03
#define SYNTAX_SECOND_CHAR 0x33
-#if 0
-
-/* #### Entirely unused. Should they be deleted? */
-
-/* #### These are now more or less equivalent to
- SYNTAX_COMMENT_MATCH_START ...*/
-/* a and b must be first and second start chars for a common type */
-#define SYNTAX_START_P(table, a, b) \
- (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \
- & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
-
-/* ... and SYNTAX_COMMENT_MATCH_END */
-/* a and b must be first and second end chars for a common type */
-#define SYNTAX_END_P(table, a, b) \
- (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \
- & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
-
-#define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \
- ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \
- && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask)))
-
-#define SYNTAX_STYLES_MATCH_END_P(table, a, b, mask) \
- ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END & (mask)) \
- && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END & (mask)))
-
-#define SYNTAX_STYLES_MATCH_1CHAR_P(table, a, mask) \
- ((SYNTAX_COMMENT_BITS (table, a) & (mask)))
-
-#define STYLE_FOUND_P(table, a, b, startp, style) \
- ((SYNTAX_COMMENT_BITS (table, a) & \
- ((startp) ? SYNTAX_FIRST_CHAR_START : \
- SYNTAX_FIRST_CHAR_END) & (style)) \
- && (SYNTAX_COMMENT_BITS (table, b) & \
- ((startp) ? SYNTAX_SECOND_CHAR_START : \
- SYNTAX_SECOND_CHAR_END) & (style)))
-
-#define SYNTAX_COMMENT_MASK_START(table, a, b) \
- ((STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_A) \
- ? SYNTAX_COMMENT_STYLE_A \
-: (STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_B) \
- ? SYNTAX_COMMENT_STYLE_B \
- : 0)))
-
-#define SYNTAX_COMMENT_MASK_END(table, a, b) \
- ((STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_A) \
- ? SYNTAX_COMMENT_STYLE_A \
-: (STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_B) \
- ? SYNTAX_COMMENT_STYLE_B \
-: 0)))
-
-#define STYLE_FOUND_1CHAR_P(table, a, style) \
- ((SYNTAX_COMMENT_BITS (table, a) & (style)))
-
-#define SYNTAX_COMMENT_1CHAR_MASK(table, a) \
- ((STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_A) \
- ? SYNTAX_COMMENT_STYLE_A \
-: (STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_B) \
- ? SYNTAX_COMMENT_STYLE_B \
- : 0)))
-
-#endif /* 0 */
-
-/* This array, indexed by a character, contains the syntax code which
- that character signifies (as a char).
- For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
-
+/* Array of syntax codes, indexed by characters which designate them.
+ Designators must be ASCII characters (ie, in the range 0x00-0x7F).
+ Bounds checking is the responsibility of calling code. */
extern const unsigned char syntax_spec_code[0200];
-/* Indexed by syntax code, give the letter that describes it. */
-
+/* Array of designators indexed by syntax code.
+ Indicies should be of type enum syntaxcode. */
extern const unsigned char syntax_code_spec[];
Lisp_Object scan_lists (struct buffer *buf, Charbpos from, int count,
int depth, int sexpflag, int no_error);
int char_quoted (struct buffer *buf, Charbpos pos);
-/* NOTE: This does not refer to the mirror table, but to the
- syntax table itself. */
+/* TABLE is a syntax table, not the mirror table. */
Lisp_Object syntax_match (Lisp_Object table, Ichar ch);
extern int no_quit_in_re_search;
@@ -283,55 +223,55 @@
extern int lookup_syntax_properties;
-/* Now that the `syntax-table' property exists, and can override the syntax
- table or directly specify the syntax, we cache the last place we
- retrieved the syntax-table property. This is because, when moving
- linearly through text (e.g. in the regex routines or the scanning
- routines in syntax.c), we only need to recalculate at the next place the
- syntax-table property changes (i.e. not every position), and when we do
- need to recalculate, we can update the info from the previous info
- faster than if we did the whole calculation from scratch. */
+/* The `syntax-table' property overrides the syntax table or directly
+ specifies the syntax. Since looking up properties is expensive, we cache
+ the information about the syntax-table property. When moving linearly
+ through text (e.g. in the regex routines or the scanning routines in
+ syntax.c), recalculation is needed only when the syntax-table property
+ changes (i.e. not every position).
+ When we do need to recalculate, we can update the info from the previous
+ info faster than if we did the whole calculation from scratch.
+ #### sjt sez: I'm not sure I believe that last claim. That seems to
+ require that we use directional information, etc, but that is ignored in
+ the current implementation. */
struct syntax_cache
{
#ifdef NEW_GC
NORMAL_LISP_OBJECT_HEADER header;
#endif /* NEW_GC */
- int use_code; /* Whether to use syntax_code or
- syntax_table. This is set
- depending on whether the
- syntax-table property is a
- syntax table or a syntax
- code. */
- int no_syntax_table_prop; /* If non-zero, there was no
- `syntax-table' property on the
- current range, and so we're
- using the buffer's syntax table.
- This is important to note because
- sometimes the buffer's syntax
- table can be changed. */
- Lisp_Object object; /* The buffer or string the current
- syntax cache applies to, or
- Qnil for a string of text not
- coming from a buffer or string. */
- struct buffer *buffer; /* The buffer that supplies the
- syntax tables, or 0 for the
- standard syntax table. If
- OBJECT is a buffer, this will
- always be the same buffer. */
- int syntax_code; /* Syntax code of current char. */
- Lisp_Object syntax_table; /* Syntax table for current pos. */
- Lisp_Object mirror_table; /* Mirror table for this table. */
- Lisp_Object start, end; /* Markers to keep track of the
- known region in a buffer.
- Formerly we used an internal
- extent, but it seems that having
- an extent over the entire buffer
- causes serious slowdowns in
- extent operations! Yuck! */
- Charxpos next_change; /* Position of the next extent
- change. */
- Charxpos prev_change; /* Position of the previous extent
- change. */
+ int use_code; /* Non-zero if a syntax-table property
+ specified a syntax code. When zero, the
+ syntax_code member is invalid. Otherwise
+ the syntax_table member is invalid. */
+ int no_syntax_table_prop; /* If non-zero, there was no `syntax-table'
+ property on the current range, and so we're
+ using the buffer's syntax table.
+ Then we must invalidate the cache if the
+ buffer's syntax table is changed. */
+ Lisp_Object object; /* The buffer or string the current syntax
+ cache applies to, or Qnil for a string of
+ text not coming from a buffer or string. */
+ struct buffer *buffer; /* The buffer that supplies the syntax tables,
+ or NULL for the standard syntax table. If
+ OBJECT is a buffer, this will always be
+ the same buffer. */
+ int syntax_code; /* Syntax code of current char. */
+ Lisp_Object syntax_table; /* Syntax table for current pos. */
+ Lisp_Object mirror_table; /* Mirror table for this table. */
+ Lisp_Object start, end; /* Markers to keep track of the known region
+ in a buffer.
+ Normally these correspond to prev_change
+ and next_change, respectively, except when
+ insertions and deletions occur. Then
+ prev_change and next change will be
+ refreshed from these markers. See
+ signal_syntax_cache_extent_adjust().
+ We'd like to use an extent, but it seems
+ that having an extent over the entire
+ buffer causes serious slowdowns in extent
+ operations! Yuck! */
+ Charxpos next_change; /* Position of the next extent change. */
+ Charxpos prev_change; /* Position of the previous extent change. */
};
#ifdef NEW_GC
@@ -347,13 +287,10 @@
#define CONCHECK_SYNTAX_CACHE(x) CONCHECK_RECORD (x, syntax_cache)
#endif /* NEW_GC */
-
-
extern const struct sized_memory_description syntax_cache_description;
-/* Note that the external interface to the syntax-cache uses charpos's, but
+/* Note that the external interface to the syntax cache uses charpos's, but
internally we use bytepos's, for speed. */
-
void update_syntax_cache (struct syntax_cache *cache, Charxpos pos, int count);
struct syntax_cache *setup_syntax_cache (struct syntax_cache *cache,
Lisp_Object object,
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Initialize start and end properly (to new markers, not Qnil).
13 years, 4 months
Stephen J. Turnbull
changeset: 5543:fbe90e6f7a43
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:20 2011 +0900
files: src/ChangeLog src/syntax.c tests/ChangeLog tests/automated/syntax-tests.el
description:
Initialize start and end properly (to new markers, not Qnil).
* * *
Refactor syntax cache initialization.
* * *
Refactor setup_syntax_cache.
diff -r dab422055bab -r fbe90e6f7a43 src/ChangeLog
--- a/src/ChangeLog Mon Aug 08 13:57:20 2011 +0900
+++ b/src/ChangeLog Mon Aug 08 13:57:20 2011 +0900
@@ -1,3 +1,17 @@
+2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * syntax.c (reset_buffer_syntax_cache_range):
+ Rename to reset_syntax_cache_range.
+
+ (setup_syntax_cache):
+ (init_buffer_syntax_cache):
+ (init_syntax_cache):
+ (reset_syntax_cache_range):
+ Refactor and document.
+
+ (signal_syntax_cache_extent_changed):
+ Remove obsolete comment.
+
2011-08-05 Stephen J. Turnbull <stephen(a)xemacs.org>
There are only (octal) 0200 ASCII characters, and only 128 values
diff -r dab422055bab -r fbe90e6f7a43 src/syntax.c
--- a/src/syntax.c Mon Aug 08 13:57:20 2011 +0900
+++ b/src/syntax.c Mon Aug 08 13:57:20 2011 +0900
@@ -284,56 +284,51 @@
}
static void
-reset_buffer_syntax_cache_range (struct syntax_cache *cache,
- Lisp_Object buffer, int infinite)
+reset_syntax_cache_range (struct syntax_cache *cache, /* initialized cache */
+ Lisp_Object object) /* string or buffer */
{
- Fset_marker (cache->start, make_int (1), buffer);
- Fset_marker (cache->end, make_int (1), buffer);
- Fset_marker_insertion_type (cache->start, Qt);
- Fset_marker_insertion_type (cache->end, Qnil);
- /* #### Should we "cache->no_syntax_table_prop = 1;" here? */
- /* #### Cf comment on INFINITE in init_syntax_cache. -- sjt */
- if (infinite)
+ /* reinitialize cache parameters */
+ if (BUFFERP (object))
+ {
+ /* make known region zero-length and reset insertion behavior */
+ Fset_marker (cache->start, make_int (1), object);
+ Fset_marker (cache->end, make_int (1), object);
+ Fset_marker_insertion_type (cache->start, Qt);
+ Fset_marker_insertion_type (cache->end, Qnil);
+ }
+ else
+ {
+ /* invalidate the known region markers */
+ Fset_marker (cache->start, Qnil, Qnil);
+ Fset_marker (cache->end, Qnil, Qnil);
+ }
+ cache->no_syntax_table_prop = 1;
+ if (lookup_syntax_properties)
+ {
+ cache->prev_change = -1;
+ cache->next_change = -1;
+ }
+ else
{
cache->prev_change = EMACS_INT_MIN;
cache->next_change = EMACS_INT_MAX;
}
- else
- {
- cache->prev_change = -1;
- cache->next_change = -1;
- }
}
static void
-init_syntax_cache (struct syntax_cache *cache, Lisp_Object object,
- struct buffer *buffer, int infinite)
+init_syntax_cache (struct syntax_cache *cache, /* cache must be zero'ed */
+ Lisp_Object object, /* string or buffer */
+ struct buffer *buffer) /* may not be NULL */
{
- xzero (*cache);
+ /* initialize cache resources */
cache->object = object;
cache->buffer = buffer;
- cache->no_syntax_table_prop = 1;
cache->syntax_table =
BUFFER_SYNTAX_TABLE (cache->buffer);
cache->mirror_table =
BUFFER_MIRROR_SYNTAX_TABLE (cache->buffer);
- cache->start = Qnil;
- cache->end = Qnil;
- /* #### I'm not sure what INFINITE is for, but it's apparently needed by
- setup_syntax_cache(). It looks like it's supposed to guarantee that
- the test for POS outside of cache-valid range will never succeed, so
- that update_syntax_cache won't get called, but it's hard to be sure.
- Cf reset_buffer_syntax_cache_range. -- sjt */
- if (infinite)
- {
- cache->prev_change = EMACS_INT_MIN;
- cache->next_change = EMACS_INT_MAX;
- }
- else
- {
- cache->prev_change = -1;
- cache->next_change = -1;
- }
+ cache->start = Fmake_marker();
+ cache->end = Fmake_marker();
}
/* external syntax cache API */
@@ -347,32 +342,23 @@
is associated with */
struct buffer *buffer, /* the buffer to use as source
of the syntax table */
- Charxpos from, /* initial position of cache */
- int count) /* direction? see code */
+ Charxpos UNUSED (from), /* initial position of cache */
+ int UNUSED (count)) /* direction? see code */
{
- /* If OBJECT is a buffer, use its cache. Initialize cache. Make it valid
- for the whole buffer if the syntax-table property is not being respected.
- Else if OBJECT is not a buffer, initialize the cache passed in CACHE.
- If the syntax-table property is being respected, update the cache. */
+ /* If OBJECT is a buffer, use its cache, otherwise use CACHE.
+ Initialize CACHE. Invalidate the cache if the syntax-table property is
+ being respected, otherwise make it valid for the whole object. */
if (BUFFERP (object))
{
cache = XBUFFER (object)->syntax_cache;
- if (!lookup_syntax_properties)
- reset_buffer_syntax_cache_range (cache, object, 1);
}
else
- init_syntax_cache (cache, object, buffer, 0);
- if (lookup_syntax_properties)
{
- if (count <= 0)
- {
- from--;
- from = buffer_or_string_clip_to_accessible_char (cache->object,
- from);
- }
- if (!(from >= cache->prev_change && from < cache->next_change))
- update_syntax_cache (cache, from, count);
+ xzero (*cache);
+ init_syntax_cache (cache, object, buffer);
}
+ reset_syntax_cache_range (cache, object);
+
#ifdef NOT_WORTH_THE_EFFORT
update_mirror_syntax_if_dirty (cache->mirror_table);
#endif /* NOT_WORTH_THE_EFFORT */
@@ -517,21 +503,14 @@
void
init_buffer_syntax_cache (struct buffer *buf)
{
- struct syntax_cache *cache;
#ifdef NEW_GC
buf->syntax_cache = XSYNTAX_CACHE (ALLOC_NORMAL_LISP_OBJECT (syntax_cache));
#else /* not NEW_GC */
buf->syntax_cache = xnew_and_zero (struct syntax_cache);
#endif /* not NEW_GC */
- cache = buf->syntax_cache;
- cache->object = wrap_buffer (buf);
- cache->buffer = buf;
- cache->no_syntax_table_prop = 1;
- cache->syntax_table = BUFFER_SYNTAX_TABLE (cache->buffer);
- cache->mirror_table = BUFFER_MIRROR_SYNTAX_TABLE (cache->buffer);
- cache->start = Fmake_marker ();
- cache->end = Fmake_marker ();
- reset_buffer_syntax_cache_range (cache, cache->object, 0);
+
+ init_syntax_cache (buf->syntax_cache, wrap_buffer(buf), buf);
+ reset_syntax_cache_range (buf->syntax_cache, wrap_buffer(buf));
}
/* finalize the syntax cache for BUF */
@@ -561,12 +540,6 @@
Lisp_Object buffer = Fextent_object (wrap_extent (extent));
if (BUFFERP (buffer))
{
- /* This was getting called with the buffer's start and end null, eg in
- cperl mode, which triggers an assert in byte_marker_position. Cf
- thread rooted at <yxz7j7xzk97.fsf(a)gimli.holgi.priv> on xemacs-beta.
- <yxzfymklb6p.fsf(a)gimli.holgi.priv> has a recipe, but you also need
- to delete or type SPC to get the crash.
- #### Delete this comment when setup_syntax_cache is made sane. */
struct syntax_cache *cache = XBUFFER (buffer)->syntax_cache;
/* #### would this be slower or less accurate in character terms? */
Bytexpos start = extent_endpoint_byte (extent, 0);
@@ -576,7 +549,7 @@
/* If the extent is entirely before or entirely after the cache
range, it doesn't overlap. Otherwise, invalidate the range. */
if (!(end < start2 || start > end2))
- reset_buffer_syntax_cache_range (cache, buffer, 0);
+ reset_syntax_cache_range (cache, buffer);
}
}
diff -r dab422055bab -r fbe90e6f7a43 tests/ChangeLog
--- a/tests/ChangeLog Mon Aug 08 13:57:20 2011 +0900
+++ b/tests/ChangeLog Mon Aug 08 13:57:20 2011 +0900
@@ -1,3 +1,7 @@
+2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * automated/syntax-tests.el: Suggest test from old syntax-cache bug.
+
2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
* automated/os-tests.el:
diff -r dab422055bab -r fbe90e6f7a43 tests/automated/syntax-tests.el
--- a/tests/automated/syntax-tests.el Mon Aug 08 13:57:20 2011 +0900
+++ b/tests/automated/syntax-tests.el Mon Aug 08 13:57:20 2011 +0900
@@ -204,4 +204,8 @@
;; special-case check that point didn't move
(Assert (= (point) 25))))
+;; #### Add the recipe in <yxzfymklb6p.fsf(a)gimli.holgi.priv> on xemacs-beta.
+;; You also need to do a DELETE or type SPC to get the crash in 21.5.24.
+;http://list-archive.xemacs.org/pipermail/xemacs-beta/2006-February/008430.html
+
;;; end of syntax-tests.el
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Correct array bound for syntax_code_spec.
13 years, 4 months
Stephen J. Turnbull
changeset: 5542:dab422055bab
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:20 2011 +0900
files: src/ChangeLog src/search.c src/syntax.c src/syntax.h
description:
Correct array bound for syntax_code_spec.
diff -r ebd367b82ccd -r dab422055bab src/ChangeLog
--- a/src/ChangeLog Mon Aug 08 13:57:19 2011 +0900
+++ b/src/ChangeLog Mon Aug 08 13:57:20 2011 +0900
@@ -1,3 +1,14 @@
+2011-08-05 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ There are only (octal) 0200 ASCII characters, and only 128 values
+ supplied in the definition.
+
+ * syntax.h (syntax_spec_code):
+ * syntax.c (syntax_spec_code):
+ Declare array with correct dimension.
+ * search.c (skip_chars):
+ Correct bounds check on index of syntax_spec_code.
+
2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
* search.c (byte_scan_buffer):
diff -r ebd367b82ccd -r dab422055bab src/search.c
--- a/src/search.c Mon Aug 08 13:57:19 2011 +0900
+++ b/src/search.c Mon Aug 08 13:57:20 2011 +0900
@@ -926,7 +926,7 @@
INC_IBYTEPTR (p);
if (syntaxp)
{
- if (c < 0400 && syntax_spec_code[c] < (unsigned char) Smax)
+ if (c < 0200 && syntax_spec_code[c] < (unsigned char) Smax)
fastmap[c] = 1;
else
invalid_argument ("Invalid syntax designator", make_char (c));
diff -r ebd367b82ccd -r dab422055bab src/syntax.c
--- a/src/syntax.c Mon Aug 08 13:57:19 2011 +0900
+++ b/src/syntax.c Mon Aug 08 13:57:20 2011 +0900
@@ -600,7 +600,7 @@
into the code it signifies.
This is used by modify-syntax-entry, and other things. */
-const unsigned char syntax_spec_code[0400] =
+const unsigned char syntax_spec_code[0200] =
{ 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
diff -r ebd367b82ccd -r dab422055bab src/syntax.h
--- a/src/syntax.h Mon Aug 08 13:57:19 2011 +0900
+++ b/src/syntax.h Mon Aug 08 13:57:20 2011 +0900
@@ -262,7 +262,7 @@
that character signifies (as a char).
For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
-extern const unsigned char syntax_spec_code[0400];
+extern const unsigned char syntax_spec_code[0200];
/* Indexed by syntax code, give the letter that describes it. */
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Improve treatment of expected bugs.
13 years, 4 months
Stephen J. Turnbull
changeset: 5541:ebd367b82ccd
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:19 2011 +0900
files: lisp/ChangeLog lisp/test-harness.el
description:
Improve treatment of expected bugs.
* * *
Simplify Known-Bug-Expect-Error to produce cleaner output.
diff -r eed303fac325 -r ebd367b82ccd lisp/ChangeLog
--- a/lisp/ChangeLog Mon Aug 08 13:57:19 2011 +0900
+++ b/lisp/ChangeLog Mon Aug 08 13:57:19 2011 +0900
@@ -1,9 +1,23 @@
+2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * test-harness.el (test-harness-bug-expected):
+ Update docstring.
+ (Known-Bug-Expect-Failure, Known-Bug-Expect-Error):
+ Ask if bug was fixed in PASS message.
+ (Known-Bug-Expect-Error):
+ Simplify code to produce clearer output.
+ Make pass and failure correspond to Check-Error.
+ (Print-Pass):
+ Always print test result for known bugs.
+
2011-07-29 Mats Lidell <matsl(a)xemacs.org>
+
* process.el (shell-command):
* process.el (shell-command-on-region): API compatible/synced with
FSF 23.3.1.
2011-07-22 Mats Lidell <matsl(a)xemacs.or>
+
* syntax-ppss.el: Synced up with Emacs 23.3 (syntax.el)
2011-07-03 Aidan Kehoe <kehoea(a)parhasard.net>
diff -r eed303fac325 -r ebd367b82ccd lisp/test-harness.el
--- a/lisp/test-harness.el Mon Aug 08 13:57:19 2011 +0900
+++ b/lisp/test-harness.el Mon Aug 08 13:57:19 2011 +0900
@@ -69,7 +69,8 @@
(defvar unexpected-test-file-failures)
(defvar test-harness-bug-expected nil
- "Non-nil means a bug is expected; backtracing/debugging should not happen.")
+ "Non-nil means a bug is expected; backtracing/debugging should not happen.
+However, the individual test summary should be printed.")
(defvar test-harness-test-compiled nil
"Non-nil means the test code was compiled before execution.
@@ -325,34 +326,26 @@
and on success indicating that this is unexpected."
`(let ((test-harness-bug-expected t)
(test-harness-failure-tag "KNOWN BUG")
- (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
+ (test-harness-success-tag "PASS (FAIL EXPECTED: was bug fixed?)"))
,@body))
(defmacro Known-Bug-Expect-Error (expected-error &rest body)
- "Wrap a BODY that consists of tests that are known to trigger an error.
-This causes messages to be printed on failure indicating that this is expected,
-and on success indicating that this is unexpected."
- (let ((quoted-body (if (eql 1 (length body))
- `(quote ,(car body)) `(quote (progn ,@body)))))
- `(let ((test-harness-bug-expected t)
- (test-harness-failure-tag "KNOWN BUG")
- (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
- (condition-case error-info
- (progn
- (setq trick-optimizer (progn ,@body))
- (Print-Pass
- "%S executed successfully, but expected error %S"
- ,quoted-body
- ',expected-error)
- (incf passes))
- (,expected-error
- (Print-Failure "%S ==> error %S, as expected"
- ,quoted-body ',expected-error)
- (incf no-error-failures))
- (error
- (Print-Failure "%S ==> expected error %S, got error %S instead"
- ,quoted-body ',expected-error error-info)
- (incf wrong-error-failures))))))
+ "Wrap a BODY containing a test known to trigger an error it shouldn't.
+This causes messages to be printed on failure indicating that this is expected
+of the bug, and on success indicating that this is unexpected."
+ `(let ((test-harness-bug-expected t)
+ (test-harness-failure-tag "KNOWN BUG")
+ (test-harness-success-tag
+ (format "PASS (EXPECTED ERROR %S due to bug: fixed?)"
+ (quote ,expected-error))))
+ (condition-case err
+ (progn ,@body)
+ (,expected-error)
+ (error
+ (let ((m (format " Expected %S due to bug, got %S: mutated?\n"
+ (quote ,expected-error) err)))
+ (if (noninteractive) (message m))
+ (princ m))))))
(defmacro Implementation-Incomplete-Expect-Failure (&rest body)
"Wrap a BODY containing tests that are known to fail due to incomplete code.
@@ -361,7 +354,8 @@
success indicating that this is unexpected."
`(let ((test-harness-bug-expected t)
(test-harness-failure-tag "IMPLEMENTATION INCOMPLETE")
- (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
+ (test-harness-success-tag
+ "PASS (FAILURE EXPECTED: feature implemented?)"))
,@body))
(defun Print-Failure (fmt &rest args)
@@ -371,7 +365,9 @@
(defun Print-Pass (fmt &rest args)
(setq fmt (format "%s: %s" test-harness-success-tag fmt))
- (and test-harness-verbose
+ (and (or test-harness-verbose test-harness-bug-expected)
+ (if (and noninteractive test-harness-bug-expected)
+ (apply #'message fmt args))
(princ (concat (apply #'format fmt args) "\n"))))
(defun Print-Skip (test reason &optional fmt &rest args)
@@ -432,18 +428,21 @@
"Assertion failed: %S")
,description ,failing-case)
(incf assertion-failures)
- (test-harness-assertion-failure-do-debug error-info))
+ (test-harness-assertion-failure-do-debug error-info)
+ nil)
(Print-Failure
(if ,failing-case
"%S ==> error: %S; failing case = %S"
"%S ==> error: %S")
,description error-info ,failing-case)
(incf other-failures)
- (test-harness-unexpected-error-do-debug error-info)))
+ (test-harness-unexpected-error-do-debug error-info)
+ nil))
#'(lambda ()
(assert ,assertion)
(Print-Pass "%S" ,description)
- (incf passes)))
+ (incf passes)
+ t))
(cl-assertion-failed nil))))
(defmacro Check-Error (expected-error &rest body)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Should tests for substitute-in-file-name be in syntax-tests?
13 years, 4 months
Stephen J. Turnbull
changeset: 5540:eed303fac325
tag: tip
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:19 2011 +0900
files: tests/ChangeLog tests/automated/os-tests.el tests/automated/syntax-tests.el
description:
Should tests for substitute-in-file-name be in syntax-tests?
diff -r 4307b8e5998c -r eed303fac325 tests/ChangeLog
--- a/tests/ChangeLog Mon Aug 08 13:57:19 2011 +0900
+++ b/tests/ChangeLog Mon Aug 08 13:57:19 2011 +0900
@@ -1,3 +1,12 @@
+2011-08-06 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * automated/os-tests.el:
+ * automated/syntax-tests.el:
+ Move tests of `substitute-in-file-name' from syntax to os.
+
+ * automated/syntax-tests.el:
+ Add lisp-maint required file terminator.
+
2011-07-31 Mats Lidell <matsl(a)xemacs.org>
* automated/process-tests.el: shell-command tests.
diff -r 4307b8e5998c -r eed303fac325 tests/automated/os-tests.el
--- a/tests/automated/os-tests.el Mon Aug 08 13:57:19 2011 +0900
+++ b/tests/automated/os-tests.el Mon Aug 08 13:57:19 2011 +0900
@@ -89,4 +89,38 @@
(Assert (looking-at result))))
(do-test (car case) (cdr case)))))))
+(loop
+ with envvar-not-existing = (symbol-name (gensym "whatever"))
+ with envvar-existing = (symbol-name (gensym "whatever"))
+ with envvar-existing-val = (make-string #x10000 ?\xe1)
+ with examples =
+ (list (list (format "%chome%cwhatever%c%chi-there%c$%s"
+ directory-sep-char
+ directory-sep-char
+ directory-sep-char
+ directory-sep-char
+ directory-sep-char
+ envvar-existing)
+ (format "%chi-there%c%s"
+ directory-sep-char
+ directory-sep-char
+ envvar-existing-val))
+ (if (memq system-type '(windows-nt cygwin32))
+ '("//network-path/c$" "//network-path/c$")
+ '("/network-path/c$" "/network-path/c$"))
+ (list (format "/home/whoever/$%s" envvar-not-existing)
+ (format "/home/whoever/$%s" envvar-not-existing))
+ (list (format "/home/whoever/$%s" envvar-existing)
+ (format "/home/whoever/%s" envvar-existing-val))
+ (list (format "/home/whoever/${%s}" envvar-existing)
+ (format "/home/whoever/%s" envvar-existing-val))
+ (list (format "/home/whoever/${%s}" envvar-not-existing)
+ (format "/home/whoever/${%s}" envvar-not-existing)))
+ initially (progn (setenv envvar-not-existing nil t)
+ (setenv envvar-existing envvar-existing-val))
+ for (pre post)
+ in examples
+ do
+ (Assert (string= post (substitute-in-file-name pre))))
+
;;; end of os-tests.el
diff -r 4307b8e5998c -r eed303fac325 tests/automated/syntax-tests.el
--- a/tests/automated/syntax-tests.el Mon Aug 08 13:57:19 2011 +0900
+++ b/tests/automated/syntax-tests.el Mon Aug 08 13:57:19 2011 +0900
@@ -204,37 +204,4 @@
;; special-case check that point didn't move
(Assert (= (point) 25))))
-(loop
- with envvar-not-existing = (symbol-name (gensym "whatever"))
- with envvar-existing = (symbol-name (gensym "whatever"))
- with envvar-existing-val = (make-string #x10000 ?\xe1)
- with examples =
- (list (list (format "%chome%cwhatever%c%chi-there%c$%s"
- directory-sep-char
- directory-sep-char
- directory-sep-char
- directory-sep-char
- directory-sep-char
- envvar-existing)
- (format "%chi-there%c%s"
- directory-sep-char
- directory-sep-char
- envvar-existing-val))
- (if (memq system-type '(windows-nt cygwin32))
- '("//network-path/c$" "//network-path/c$")
- '("/network-path/c$" "/network-path/c$"))
- (list (format "/home/whoever/$%s" envvar-not-existing)
- (format "/home/whoever/$%s" envvar-not-existing))
- (list (format "/home/whoever/$%s" envvar-existing)
- (format "/home/whoever/%s" envvar-existing-val))
- (list (format "/home/whoever/${%s}" envvar-existing)
- (format "/home/whoever/%s" envvar-existing-val))
- (list (format "/home/whoever/${%s}" envvar-not-existing)
- (format "/home/whoever/${%s}" envvar-not-existing)))
- initially (progn (setenv envvar-not-existing nil t)
- (setenv envvar-existing envvar-existing-val))
- for (pre post)
- in examples
- do
- (Assert (string= post (substitute-in-file-name pre))))
-
+;;; end of syntax-tests.el
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Suppress "shadowed global" warnings for floor and ceil from <math.h>.
13 years, 4 months
Stephen J. Turnbull
changeset: 5539:4307b8e5998c
tag: tip
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:19 2011 +0900
files: src/ChangeLog src/search.c
description:
Suppress "shadowed global" warnings for floor and ceil from <math.h>.
diff -r 580ef98f2beb -r 4307b8e5998c src/ChangeLog
--- a/src/ChangeLog Mon Aug 08 13:57:18 2011 +0900
+++ b/src/ChangeLog Mon Aug 08 13:57:19 2011 +0900
@@ -1,3 +1,9 @@
+2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * search.c (byte_scan_buffer):
+ Rename local variables to suppress GCC "shadowed global" warnings.
+ The warnings are due to ANSI functions from <math.h> on Darwin.
+
2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
* mule-coding.c (shift_jis_convert):
diff -r 580ef98f2beb -r 4307b8e5998c src/search.c
--- a/src/search.c Mon Aug 08 13:57:18 2011 +0900
+++ b/src/search.c Mon Aug 08 13:57:19 2011 +0900
@@ -689,20 +689,20 @@
Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf));
while (st < lim && count > 0)
{
- Bytebpos ceil;
+ Bytebpos ceiling;
Ibyte *bufptr;
- ceil = BYTE_BUF_CEILING_OF (buf, st);
- ceil = min (lim, ceil);
+ ceiling = BYTE_BUF_CEILING_OF (buf, st);
+ ceiling = min (lim, ceiling);
bufptr = (Ibyte *) memchr (BYTE_BUF_BYTE_ADDRESS (buf, st),
- raw, ceil - st);
+ raw, ceiling - st);
if (bufptr)
{
count--;
st = BYTE_BUF_PTR_BYTE_POS (buf, bufptr) + 1;
}
else
- st = ceil;
+ st = ceiling;
}
}
@@ -740,15 +740,15 @@
Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf));
while (st > lim && count < 0)
{
- Bytebpos floor;
+ Bytebpos floorpos;
Ibyte *bufptr;
Ibyte *floorptr;
- floor = BYTE_BUF_FLOOR_OF (buf, st);
- floor = max (lim, floor);
+ floorpos = BYTE_BUF_FLOOR_OF (buf, st);
+ floorpos = max (lim, floorpos);
/* No memrchr() ... */
bufptr = BYTE_BUF_BYTE_ADDRESS_BEFORE (buf, st);
- floorptr = BYTE_BUF_BYTE_ADDRESS (buf, floor);
+ floorptr = BYTE_BUF_BYTE_ADDRESS (buf, floorpos);
while (bufptr >= floorptr)
{
st--;
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Suppress a "shadowed global" warning.
13 years, 4 months
Stephen J. Turnbull
changeset: 5538:580ef98f2beb
user: Stephen J. Turnbull <stephen(a)xemacs.org>
date: Mon Aug 08 13:57:18 2011 +0900
files: src/ChangeLog src/mule-coding.c src/redisplay-xlike-inc.c
description:
Suppress a "shadowed global" warning.
The warning is for j1 from <math.h> on Darwin.
diff -r 2df2d9171f20 -r 580ef98f2beb src/ChangeLog
--- a/src/ChangeLog Mon Aug 08 13:57:18 2011 +0900
+++ b/src/ChangeLog Mon Aug 08 13:57:18 2011 +0900
@@ -1,3 +1,10 @@
+2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * mule-coding.c (shift_jis_convert):
+ * redisplay-xlike-inc.c (XLIKE_output_vertical_divider):
+ Rename local variables to suppress GCC "shadowed global" warnings.
+ The warnings are due to non-ANSI functions from <math.h> on Darwin.
+
2011-08-04 Stephen J. Turnbull <stephen(a)xemacs.org>
* glyphs-eimage.c (png_instantiate): Rename a shadowing loop index
diff -r 2df2d9171f20 -r 580ef98f2beb src/mule-coding.c
--- a/src/mule-coding.c Mon Aug 08 13:57:18 2011 +0900
+++ b/src/mule-coding.c Mon Aug 08 13:57:18 2011 +0900
@@ -214,10 +214,10 @@
ch = c;
else
{
- UExtbyte j1, j2;
- ENCODE_SHIFT_JIS (ch, c, j1, j2);
- Dynarr_add (dst, j1);
- Dynarr_add (dst, j2);
+ UExtbyte b1, b2;
+ ENCODE_SHIFT_JIS (ch, c, b1, b2);
+ Dynarr_add (dst, b1);
+ Dynarr_add (dst, b2);
ch = 0;
}
}
diff -r 2df2d9171f20 -r 580ef98f2beb src/redisplay-xlike-inc.c
--- a/src/redisplay-xlike-inc.c Mon Aug 08 13:57:18 2011 +0900
+++ b/src/redisplay-xlike-inc.c Mon Aug 08 13:57:18 2011 +0900
@@ -1782,7 +1782,7 @@
XLIKE_GC background_gc;
enum edge_style style;
unsigned long mask;
- int x, y1, y2, width, shadow_thickness, spacing, line_width;
+ int x, ytop, ybottom, width, shadow_thickness, spacing, line_width;
face_index div_face =
get_builtin_face_cache_index (w, Vvertical_divider_face);
@@ -1791,8 +1791,8 @@
spacing = XINT (w->vertical_divider_spacing);
line_width = XINT (w->vertical_divider_line_width);
x = WINDOW_RIGHT (w) - width;
- y1 = WINDOW_TOP (w);
- y2 = WINDOW_BOTTOM (w);
+ ytop = WINDOW_TOP (w);
+ ybottom = WINDOW_BOTTOM (w);
memset (&gcv, ~0, sizeof (gcv));
@@ -1810,20 +1810,20 @@
window split occurs. */
#ifdef THIS_IS_X
if (clear)
- XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
+ XClearArea (dpy, x_win, x, ytop, width, ybottom - ytop, False);
#else /* THIS_IS_GTK */
USED (dpy);
/* if (clear) */
gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
- x, y1, width, y2 - y1);
+ x, ytop, width, ybottom - ytop);
#endif /* THIS_IS_GTK */
#ifndef THIS_IS_GTK
/* #### FIXME Why not? Formerly '#if 0' in the GDK code */
/* Draw the divider line. */
XLIKE_FILL_RECTANGLE (dpy, x_win, background_gc,
- x + spacing + shadow_thickness, y1,
- line_width, y2 - y1);
+ x + spacing + shadow_thickness, ytop,
+ line_width, ybottom - ytop);
#endif /* not THIS_IS_GTK */
if (shadow_thickness < 0)
@@ -1837,8 +1837,8 @@
}
/* Draw the shadows around the divider line */
- XLIKE_bevel_area (w, div_face, x + spacing, y1,
- width - 2 * spacing, y2 - y1,
+ XLIKE_bevel_area (w, div_face, x + spacing, ytop,
+ width - 2 * spacing, ybottom - ytop,
shadow_thickness, EDGE_ALL, style);
}
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches