static int find_start_modiff;
-static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int));
-static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object));
-static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int));
-static void scan_sexps_forward P_ ((struct lisp_parse_state *,
- EMACS_INT, EMACS_INT, EMACS_INT, int,
- int, Lisp_Object, int));
-static int in_classes P_ ((int, Lisp_Object));
+static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
+static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object);
+static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int);
+static void scan_sexps_forward (struct lisp_parse_state *,
+ EMACS_INT, EMACS_INT, EMACS_INT, int,
+ int, Lisp_Object, int);
+static int in_classes (int, Lisp_Object);
\f
struct gl_state_s gl_state; /* Global state of syntax parser. */
-INTERVAL interval_of ();
+INTERVAL interval_of (int, Lisp_Object);
#define INTERVALS_AT_ONCE 10 /* 1 + max-number of intervals
to scan to property-change. */
start/end of OBJECT. */
void
-update_syntax_table (charpos, count, init, object)
- int charpos, count, init;
- Lisp_Object object;
+update_syntax_table (int charpos, int count, int init, Lisp_Object object)
{
Lisp_Object tmp_table;
int cnt = 0, invalidate = 1;
We assume that BYTEPOS is not at the end of the buffer. */
INLINE EMACS_INT
-inc_bytepos (bytepos)
- EMACS_INT bytepos;
+inc_bytepos (EMACS_INT bytepos)
{
if (NILP (current_buffer->enable_multibyte_characters))
return bytepos + 1;
We assume that BYTEPOS is not at the start of the buffer. */
INLINE EMACS_INT
-dec_bytepos (bytepos)
- EMACS_INT bytepos;
+dec_bytepos (EMACS_INT bytepos)
{
if (NILP (current_buffer->enable_multibyte_characters))
return bytepos - 1;
update the global data. */
static EMACS_INT
-find_defun_start (pos, pos_byte)
- EMACS_INT pos, pos_byte;
+find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
{
EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
/* We optimize syntax-table lookup for rare updates. Thus we accept
only those `^\s(' which are good in global _and_ text-property
syntax-tables. */
- gl_state.current_syntax_table = current_buffer->syntax_table;
- gl_state.use_global = 0;
+ SETUP_BUFFER_SYNTAX_TABLE ();
while (PT > BEGV)
{
int c;
if (SYNTAX (c) == Sopen)
break;
/* Now fallback to the default value. */
- gl_state.current_syntax_table = current_buffer->syntax_table;
- gl_state.use_global = 0;
+ SETUP_BUFFER_SYNTAX_TABLE ();
}
/* Move to beg of previous line. */
scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1);
/* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */
static int
-prev_char_comend_first (pos, pos_byte)
- int pos, pos_byte;
+prev_char_comend_first (int pos, int pos_byte)
{
int c, val;
the returned value (or at FROM, if the search was not successful). */
static int
-back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr)
- EMACS_INT from, from_byte, stop;
- int comnested, comstyle;
- EMACS_INT *charpos_ptr, *bytepos_ptr;
+back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr)
{
/* Look back, counting the parity of string-quotes,
and recording the comment-starters seen.
DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0,
doc: /* Return t if OBJECT is a syntax table.
Currently, any char-table counts as a syntax table. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CHAR_TABLE_P (object)
&& EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table))
}
static void
-check_syntax_table (obj)
- Lisp_Object obj;
+check_syntax_table (Lisp_Object obj)
{
CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table),
Qsyntax_table_p, obj);
DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
doc: /* Return the current syntax table.
This is the one specified by the current buffer. */)
- ()
+ (void)
{
return current_buffer->syntax_table;
}
Sstandard_syntax_table, 0, 0, 0,
doc: /* Return the standard syntax table.
This is the one used for new buffers. */)
- ()
+ (void)
{
return Vstandard_syntax_table;
}
DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0,
doc: /* Construct a new syntax table and return it.
It is a copy of the TABLE, which defaults to the standard syntax table. */)
- (table)
- Lisp_Object table;
+ (Lisp_Object table)
{
Lisp_Object copy;
DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0,
doc: /* Select a new syntax table for the current buffer.
One argument, a syntax table. */)
- (table)
- Lisp_Object table;
+ (Lisp_Object table)
{
int idx;
check_syntax_table (table);
character `w' (119) is returned.
The characters that correspond to various syntax codes
are listed in the documentation of `modify-syntax-entry'. */)
- (character)
- Lisp_Object character;
+ (Lisp_Object character)
{
int char_int;
- gl_state.current_syntax_table = current_buffer->syntax_table;
-
- gl_state.use_global = 0;
- CHECK_NUMBER (character);
+ CHECK_CHARACTER (character);
char_int = XINT (character);
+ SETUP_BUFFER_SYNTAX_TABLE ();
return make_number (syntax_code_spec[(int) SYNTAX (char_int)]);
}
DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */)
- (character)
- Lisp_Object character;
+ (Lisp_Object character)
{
int char_int, code;
- gl_state.current_syntax_table = current_buffer->syntax_table;
- gl_state.use_global = 0;
CHECK_NUMBER (character);
char_int = XINT (character);
+ SETUP_BUFFER_SYNTAX_TABLE ();
code = SYNTAX (char_int);
if (code == Sopen || code == Sclose)
return SYNTAX_MATCH (char_int);
`modify-syntax-entry'. Value is the equivalent cons cell
\(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
text property. */)
- (string)
- Lisp_Object string;
+ (Lisp_Object string)
{
register const unsigned char *p;
register enum syntaxcode code;
such characters are treated as whitespace when they occur
between expressions.
usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
- (c, newentry, syntax_table)
- Lisp_Object c, newentry, syntax_table;
+ (Lisp_Object c, Lisp_Object newentry, Lisp_Object syntax_table)
{
if (CONSP (c))
{
DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
Sinternal_describe_syntax_value, 1, 1, 0,
doc: /* Insert a description of the internal syntax description SYNTAX at point. */)
- (syntax)
- Lisp_Object syntax;
+ (Lisp_Object syntax)
{
register enum syntaxcode code;
char desc, start1, start2, end1, end2, prefix, comstyle, comnested;
COUNT negative means scan backward and stop at word beginning. */
int
-scan_words (from, count)
- register int from, count;
+scan_words (register int from, register int count)
{
register int beg = BEGV;
register int end = ZV;
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. */)
- (arg)
- Lisp_Object arg;
+ (Lisp_Object arg)
{
Lisp_Object tmp;
int orig_val, val;
return val == orig_val ? Qt : Qnil;
}
\f
-Lisp_Object skip_chars ();
+Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM.
Char classes, e.g. `[:alpha:]', are supported.
Returns the distance traveled, either zero or positive. */)
- (string, lim)
- Lisp_Object string, lim;
+ (Lisp_Object string, Lisp_Object lim)
{
return skip_chars (1, string, lim, 1);
}
doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM.
See `skip-chars-forward' for details.
Returns the distance traveled, either zero or negative. */)
- (string, lim)
- Lisp_Object string, lim;
+ (Lisp_Object string, Lisp_Object lim)
{
return skip_chars (0, string, lim, 1);
}
Stop before a char whose syntax is not in SYNTAX, or at position LIM.
If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
This function returns the distance traveled, either zero or positive. */)
- (syntax, lim)
- Lisp_Object syntax, lim;
+ (Lisp_Object syntax, Lisp_Object lim)
{
return skip_syntaxes (1, syntax, lim);
}
Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM.
If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
This function returns the distance traveled, either zero or negative. */)
- (syntax, lim)
- Lisp_Object syntax, lim;
+ (Lisp_Object syntax, Lisp_Object lim)
{
return skip_syntaxes (0, syntax, lim);
}
static Lisp_Object
-skip_chars (forwardp, string, lim, handle_iso_classes)
- int forwardp;
- Lisp_Object string, lim;
- int handle_iso_classes;
+skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_classes)
{
register unsigned int c;
unsigned char fastmap[0400];
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
string_multibyte = SBYTES (string) > SCHARS (string);
- bzero (fastmap, sizeof fastmap);
+ memset (fastmap, 0, sizeof fastmap);
str = SDATA (string);
size_byte = SBYTES (string);
|| *class_end != ':' || class_end[1] != ']')
goto not_a_class_name;
- bcopy (class_beg, class_name, class_end - class_beg);
+ memcpy (class_name, class_beg, class_end - class_beg);
class_name[class_end - class_beg] = 0;
cc = re_wctype (class_name);
unsigned char fastmap2[0400];
int range_start_byte, range_start_char;
- bcopy (fastmap2 + 0200, fastmap + 0200, 0200);
- bzero (fastmap + 0200, 0200);
+ memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
+ memset (fastmap + 0200, 0, 0200);
/* We are sure that this loop stops. */
for (i = 0200; ! fastmap2[i]; i++);
c = BYTE8_TO_CHAR (i);
|| *class_end != ':' || class_end[1] != ']')
goto not_a_class_name_multibyte;
- bcopy (class_beg, class_name, class_end - class_beg);
+ memcpy (class_name, class_beg, class_end - class_beg);
class_name[class_end - class_beg] = 0;
cc = re_wctype (class_name);
if (! multibyte && n_char_ranges > 0)
{
- bzero (fastmap + 0200, 0200);
+ memset (fastmap + 0200, 0, 0200);
for (i = 0; i < n_char_ranges; i += 2)
{
int c1 = char_ranges[i];
let's initialize it manually.
We ignore syntax-table text-properties for now, since that's
what we've done in the past. */
- SETUP_SYNTAX_TABLE (BEGV, 0);
+ SETUP_BUFFER_SYNTAX_TABLE ();
if (forwardp)
{
if (multibyte)
static Lisp_Object
-skip_syntaxes (forwardp, string, lim)
- int forwardp;
- Lisp_Object string, lim;
+skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
{
register unsigned int c;
unsigned char fastmap[0400];
multibyte = (!NILP (current_buffer->enable_multibyte_characters)
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
- bzero (fastmap, sizeof fastmap);
+ memset (fastmap, 0, sizeof fastmap);
if (SBYTES (string) > SCHARS (string))
/* As this is very rare case (syntax spec is ASCII only), don't
integer which is its type according to re_wctype. */
static int
-in_classes (c, iso_classes)
- int c;
- Lisp_Object iso_classes;
+in_classes (int c, Lisp_Object iso_classes)
{
int fits_class = 0;
remains valid for forward search starting at the returned position. */
static int
-forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
- charpos_ptr, bytepos_ptr, incomment_ptr)
- EMACS_INT from, from_byte, stop;
- int nesting, style, prev_syntax;
- EMACS_INT *charpos_ptr, *bytepos_ptr;
- int *incomment_ptr;
+forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop,
+ int nesting, int style, int prev_syntax,
+ EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr,
+ int *incomment_ptr)
{
register int c, c1;
register enum syntaxcode code;
Set point to where scanning stops.
If COUNT comments are found as expected, with nothing except whitespace
between them, return t; otherwise return nil. */)
- (count)
- Lisp_Object count;
+ (Lisp_Object count)
{
register EMACS_INT from;
EMACS_INT from_byte;
? SYNTAX (c) : Ssymbol)
static Lisp_Object
-scan_lists (from, count, depth, sexpflag)
- register EMACS_INT from;
- EMACS_INT count, depth;
- int sexpflag;
+scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag)
{
Lisp_Object val;
register EMACS_INT stop = count > 0 ? ZV : BEGV;
If the beginning or end of (the accessible part of) the buffer is reached
and the depth is wrong, an error is signaled.
If the depth is right but the count is not used up, nil is returned. */)
- (from, count, depth)
- Lisp_Object from, count, depth;
+ (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
{
CHECK_NUMBER (from);
CHECK_NUMBER (count);
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. */)
- (from, count)
- Lisp_Object from, count;
+ (Lisp_Object from, Lisp_Object count)
{
CHECK_NUMBER (from);
CHECK_NUMBER (count);
0, 0, 0,
doc: /* Move point backward over any number of chars with prefix syntax.
This includes chars with "quote" or "prefix" syntax (' or p). */)
- ()
+ (void)
{
int beg = BEGV;
int opoint = PT;
after the beginning of a string, or after the end of a string. */
static void
-scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
- stopbefore, oldstate, commentstop)
- struct lisp_parse_state *stateptr;
- register EMACS_INT from;
- EMACS_INT from_byte, end;
- int targetdepth, stopbefore;
- Lisp_Object oldstate;
- int commentstop;
+scan_sexps_forward (struct lisp_parse_state *stateptr,
+ EMACS_INT from, EMACS_INT from_byte, EMACS_INT end,
+ int targetdepth, int stopbefore,
+ Lisp_Object oldstate, int commentstop)
{
struct lisp_parse_state state;
Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
If it is symbol `syntax-table', stop after the start of a comment or a
string, or after end of a comment or a string. */)
- (from, to, targetdepth, stopbefore, oldstate, commentstop)
- Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop;
+ (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
{
struct lisp_parse_state state;
int target;
}
\f
void
-init_syntax_once ()
+init_syntax_once (void)
{
register int i, c;
Lisp_Object temp;
}
void
-syms_of_syntax ()
+syms_of_syntax (void)
{
Qsyntax_table_p = intern_c_string ("syntax-table-p");
staticpro (&Qsyntax_table_p);