Commit 6449674e authored by Stefan Monnier's avatar Stefan Monnier

(struct lisp_parse_state, char_quoted, inc_bytepos)

(dec_bytepos, find_defun_start): Use EMACS_INT for buffer positions.
parent dbc812e0
2008-07-24 Stefan Monnier <monnier@iro.umontreal.ca> 2008-07-24 Stefan Monnier <monnier@iro.umontreal.ca>
* syntax.c (struct lisp_parse_state, char_quoted, inc_bytepos)
(dec_bytepos, find_defun_start): Use EMACS_INT for buffer positions.
* puresize.h (PURESIZE_CHECKING_RATIO): New macro. * puresize.h (PURESIZE_CHECKING_RATIO): New macro.
(PURESIZE): Use it. (PURESIZE): Use it.
......
...@@ -65,18 +65,20 @@ int open_paren_in_column_0_is_defun_start; ...@@ -65,18 +65,20 @@ int open_paren_in_column_0_is_defun_start;
struct lisp_parse_state struct lisp_parse_state
{ {
int depth; /* Depth at end of parsing. */ int depth; /* Depth at end of parsing. */
int instring; /* -1 if not within string, else desired terminator. */ int instring; /* -1 if not within string, else desired terminator. */
int incomment; /* -1 if in unnestable comment else comment nesting */ int incomment; /* -1 if in unnestable comment else comment nesting */
int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */
int quoted; /* Nonzero if just after an escape char at end of parsing */ int quoted; /* Nonzero if just after an escape char at end of parsing */
int thislevelstart; /* Char number of most recent start-of-expression at current level */ int mindepth; /* Minimum depth seen while scanning. */
int prevlevelstart; /* Char number of start of containing expression */ /* Char number of most recent start-of-expression at current level */
int location; /* Char number at which parsing stopped. */ EMACS_INT thislevelstart;
int mindepth; /* Minimum depth seen while scanning. */ /* Char number of start of containing expression */
int comstr_start; /* Position just after last comment/string starter. */ EMACS_INT prevlevelstart;
Lisp_Object levelstarts; /* Char numbers of starts-of-expression EMACS_INT location; /* Char number at which parsing stopped. */
of levels (starting from outermost). */ EMACS_INT comstr_start; /* Position of last comment/string starter. */
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. /* These variables are a cache for finding the start of a defun.
...@@ -95,10 +97,6 @@ static EMACS_INT find_start_begv; ...@@ -95,10 +97,6 @@ static EMACS_INT find_start_begv;
static int find_start_modiff; static int find_start_modiff;
static int find_defun_start P_ ((EMACS_INT, EMACS_INT));
static int back_comment P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int, int,
EMACS_INT *, EMACS_INT *));
static int char_quoted P_ ((int, int));
static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int)); 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 skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object));
static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int)); static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int));
...@@ -290,13 +288,12 @@ update_syntax_table (charpos, count, init, object) ...@@ -290,13 +288,12 @@ update_syntax_table (charpos, count, init, object)
or after. On return global syntax data is good for lookup at CHARPOS. */ or after. On return global syntax data is good for lookup at CHARPOS. */
static int static int
char_quoted (charpos, bytepos) char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
register int charpos, bytepos;
{ {
register enum syntaxcode code; register enum syntaxcode code;
register int beg = BEGV; register EMACS_INT beg = BEGV;
register int quoted = 0; register int quoted = 0;
int orig = charpos; EMACS_INT orig = charpos;
while (charpos > beg) while (charpos > beg)
{ {
...@@ -319,9 +316,9 @@ char_quoted (charpos, bytepos) ...@@ -319,9 +316,9 @@ char_quoted (charpos, bytepos)
/* Return the bytepos one character after BYTEPOS. /* Return the bytepos one character after BYTEPOS.
We assume that BYTEPOS is not at the end of the buffer. */ We assume that BYTEPOS is not at the end of the buffer. */
INLINE int INLINE EMACS_INT
inc_bytepos (bytepos) inc_bytepos (bytepos)
int bytepos; EMACS_INT bytepos;
{ {
if (NILP (current_buffer->enable_multibyte_characters)) if (NILP (current_buffer->enable_multibyte_characters))
return bytepos + 1; return bytepos + 1;
...@@ -333,9 +330,9 @@ inc_bytepos (bytepos) ...@@ -333,9 +330,9 @@ inc_bytepos (bytepos)
/* Return the bytepos one character before BYTEPOS. /* Return the bytepos one character before BYTEPOS.
We assume that BYTEPOS is not at the start of the buffer. */ We assume that BYTEPOS is not at the start of the buffer. */
INLINE int INLINE EMACS_INT
dec_bytepos (bytepos) dec_bytepos (bytepos)
int bytepos; EMACS_INT bytepos;
{ {
if (NILP (current_buffer->enable_multibyte_characters)) if (NILP (current_buffer->enable_multibyte_characters))
return bytepos - 1; return bytepos - 1;
...@@ -358,7 +355,7 @@ dec_bytepos (bytepos) ...@@ -358,7 +355,7 @@ dec_bytepos (bytepos)
valid on return from the subroutine, so the caller should explicitly valid on return from the subroutine, so the caller should explicitly
update the global data. */ update the global data. */
static int static EMACS_INT
find_defun_start (pos, pos_byte) find_defun_start (pos, pos_byte)
EMACS_INT pos, pos_byte; EMACS_INT pos, pos_byte;
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment