(add_emchar_rune): Use `ASCII_TO_CHARC', `CHAR_TO_CHARC' and
[chise/xemacs-chise.git-] / src / syntax.c
index d4cd963..c84502a 100644 (file)
@@ -117,7 +117,7 @@ static Bufpos
 find_defun_start (struct buffer *buf, Bufpos pos)
 {
   Bufpos tem;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   /* Use previous finding, if it's valid and applies to this inquiry.  */
   if (buf == find_start_buffer
@@ -224,7 +224,7 @@ BUFFER defaults to the current buffer if omitted.
    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[0400] =
 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
   0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
   0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
@@ -246,7 +246,7 @@ CONST unsigned char syntax_spec_code[0400] =
   0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377
 };
 
-CONST unsigned char syntax_code_spec[] =  " .w_()'\"$\\/<>@";
+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.
@@ -268,7 +268,7 @@ syntax table.
 */
        (ch, table))
 {
-  struct Lisp_Char_Table *mirrortab;
+  Lisp_Char_Table *mirrortab;
 
   if (NILP(ch))
     {
@@ -295,14 +295,13 @@ charset_syntax (struct buffer *buf, Lisp_Object charset, int *multi_p_out)
 Lisp_Object
 syntax_match (Lisp_Object table, Emchar ch)
 {
-  Lisp_Object code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (table), ch);
+  Lisp_Object code = XCHAR_TABLE_VALUE_UNSAFE (table, ch);
   Lisp_Object code2 = code;
 
   if (CONSP (code))
     code2 = XCAR (code);
   if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit)
-    code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (Vstandard_syntax_table),
-                                   ch);
+    code = XCHAR_TABLE_VALUE_UNSAFE (Vstandard_syntax_table, ch);
 
   return CONSP (code) ? XCDR (code) : Qnil;
 }
@@ -314,7 +313,7 @@ syntax table.
 */
        (ch, table))
 {
-  struct Lisp_Char_Table *mirrortab;
+  Lisp_Char_Table *mirrortab;
   int code;
 
   CHECK_CHAR_COERCE_INT (ch);
@@ -348,7 +347,7 @@ Bufpos
 scan_words (struct buffer *buf, Bufpos from, int count)
 {
   Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
   Emchar ch0, ch1;
   enum syntaxcode code;
 
@@ -365,13 +364,12 @@ scan_words (struct buffer *buf, Bufpos from, int count)
          ch0 = BUF_FETCH_CHAR (buf, from);
          code = SYNTAX_UNSAFE (mirrortab, ch0);
 
+         from++;
          if (words_include_escapes
              && (code == Sescape || code == Scharquote))
            break;
          if (code == Sword)
            break;
-
-         from++;
        }
 
       QUIT;
@@ -407,13 +405,13 @@ scan_words (struct buffer *buf, Bufpos from, int count)
 
          ch1 = BUF_FETCH_CHAR (buf, from - 1);
          code = SYNTAX_UNSAFE (mirrortab, ch1);
+
+         from--;
          if (words_include_escapes
              && (code == Sescape || code == Scharquote))
            break;
          if (code == Sword)
            break;
-
-         from--;
        }
 
       QUIT;
@@ -476,7 +474,7 @@ find_start_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask)
 {
   Emchar c;
   enum syntaxcode code;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   /* Look back, counting the parity of string-quotes,
      and recording the comment-starters seen.
@@ -610,7 +608,7 @@ static Bufpos
 find_end_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int mask)
 {
   int c;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   while (1)
     {
@@ -663,7 +661,7 @@ Optional argument BUFFER defaults to the current buffer.
   enum syntaxcode code;
   EMACS_INT count;
   struct buffer *buf = decode_buffer (buffer, 0);
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   CHECK_INT (n);
   count = XINT (n);
@@ -817,7 +815,7 @@ scan_lists (struct buffer *buf, Bufpos from, int count, int depth,
   enum syntaxcode code;
   int min_depth = depth;    /* Err out if depth gets less than this. */
   Lisp_Object syntaxtab = buf->syntax_table;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   if (depth > 0) min_depth = 0;
 
@@ -1136,7 +1134,7 @@ char_quoted (struct buffer *buf, Bufpos pos)
   enum syntaxcode code;
   Bufpos beg = BUF_BEGV (buf);
   int quoted = 0;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   while (pos > beg
         && ((code = SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)))
@@ -1218,7 +1216,7 @@ Optional arg BUFFER defaults to the current buffer.
   struct buffer *buf = decode_buffer (buffer, 0);
   Bufpos beg = BUF_BEGV (buf);
   Bufpos pos = BUF_PT (buf);
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   while (pos > beg && !char_quoted (buf, pos - 1)
         && (SYNTAX (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)) == Squote
@@ -1258,7 +1256,7 @@ scan_sexps_forward (struct buffer *buf, struct lisp_parse_state *stateptr,
   Lisp_Object tem;
   int mask;                                 /* comment mask */
   Lisp_Object syntaxtab = buf->syntax_table;
-  struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+  Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 
   if (NILP (oldstate))
     {
@@ -1611,7 +1609,7 @@ cmst_mapfun (struct chartab_range *range, Lisp_Object val, void *arg)
 }
 
 static void
-update_just_this_syntax_table (struct Lisp_Char_Table *ct)
+update_just_this_syntax_table (Lisp_Char_Table *ct)
 {
   struct chartab_range range;
   struct cmst_arg arg;
@@ -1629,7 +1627,7 @@ update_just_this_syntax_table (struct Lisp_Char_Table *ct)
    one. */
 
 void
-update_syntax_table (struct Lisp_Char_Table *ct)
+update_syntax_table (Lisp_Char_Table *ct)
 {
   /* Don't be stymied at startup. */
   if (CHAR_TABLEP (Vstandard_syntax_table)
@@ -1692,7 +1690,7 @@ Non-nil means `forward-word', etc., should treat escape chars part of words.
 }
 
 static void
-define_standard_syntax (CONST char *p, enum syntaxcode syn)
+define_standard_syntax (const char *p, enum syntaxcode syn)
 {
   for (; *p; p++)
     Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table);
@@ -1702,7 +1700,7 @@ void
 complex_vars_of_syntax (void)
 {
   Emchar i;
-  CONST char *p;
+  const char *p;
   /* Set this now, so first buffer creation can refer to it. */
   /* Make it nil before calling copy-syntax-table
      so that copy-syntax-table will know not to try to copy from garbage */