]> code.delx.au - gnu-emacs/blobdiff - src/syntax.h
(mail-extr-all-top-level-domains): More domains.
[gnu-emacs] / src / syntax.h
index c8c29cba7cc0894d4e58fb6d8c0cf7a7843c89af..72699386b6ef1ae1dbc1c4b30559f2d7d9ac0bfc 100644 (file)
@@ -20,8 +20,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 extern Lisp_Object Qsyntax_table_p;
-extern Lisp_Object Fsyntax_table_p (), Fsyntax_table (), Fset_syntax_table ();
-extern void update_syntax_table ();
+extern void update_syntax_table P_ ((int, int, int, Lisp_Object));
 
 /* The standard syntax table is stored where it will automatically
    be used in all new buffers.  */
@@ -81,7 +80,7 @@ enum syntaxcode
      temp; })
 #else
 extern Lisp_Object syntax_temp;
-extern Lisp_Object syntax_parent_lookup ();
+extern Lisp_Object syntax_parent_lookup P_ ((Lisp_Object, int));
 
 #define SYNTAX_ENTRY_FOLLOW_PARENT(table, c)           \
   (syntax_temp = XCHAR_TABLE (table)->contents[(c)],   \
@@ -197,23 +196,25 @@ extern char syntax_code_spec[16];
 
 /* Make syntax table state (gl_state) good for POS, assuming it is
    currently good for a position before POS.  */
-#define UPDATE_SYNTAX_TABLE_FORWARD(pos)                               \
-               ((pos) >= gl_state.e_property ?                         \
-                ( update_syntax_table ((pos), 1, 0), 1 ) : 0)
 
+#define UPDATE_SYNTAX_TABLE_FORWARD(pos)               \
+  ((pos) >= gl_state.e_property - gl_state.offset      \
+   ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0)
 
 /* Make syntax table state (gl_state) good for POS, assuming it is
    currently good for a position after POS.  */
-#define UPDATE_SYNTAX_TABLE_BACKWARD(pos)                              \
-               ((pos) <= gl_state.b_property ?                         \
-                ( update_syntax_table ((pos), -1, 0), 1 ) : 0)
 
-/* Make syntax table good for POS. */
+#define UPDATE_SYNTAX_TABLE_BACKWARD(pos)              \
+  ((pos) <= gl_state.b_property - gl_state.offset      \
+   ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1) : 0)
+
+/* Make syntax table good for POS.  */
+
 #define UPDATE_SYNTAX_TABLE(pos)                                       \
-               ((pos) <= gl_state.b_property ?                         \
-                ( update_syntax_table ((pos), -1, 0), 1 ) :            \
-                ( (pos) >= gl_state.e_property ?                       \
-                  ( update_syntax_table ((pos), 1, 0), 1 ) : 0))
+  ((pos) <= gl_state.b_property - gl_state.offset                      \
+   ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, Qnil), 1)   \
+   : ((pos) >= gl_state.e_property - gl_state.offset                   \
+      ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, Qnil), 1) : 0))
 
 /* This macro should be called with FROM at the start of forward
    search, or after the last position of the backward search.  It
@@ -227,28 +228,37 @@ extern char syntax_code_spec[16];
   gl_state.b_property = BEGV - 1;                                      \
   gl_state.e_property = ZV + 1;                                                \
   gl_state.use_global = 0;                                             \
+  gl_state.offset = 0;                                                 \
   gl_state.current_syntax_table = current_buffer->syntax_table;                \
   if (parse_sexp_lookup_properties)                                    \
-      update_syntax_table ((count) > 0 ? (from) : (from) - 1, (count), 1, Qnil);
+    update_syntax_table ((count) > 0 ? (from) : (from) - 1, (count),   \
+                        1, Qnil);
 
 /* Same as above, but in OBJECT.  If OBJECT is nil, use current buffer.
-   If it is t, ignore properties altogether. */
+   If it is t, ignore properties altogether.
+
+   This is meant for regex.c to use.  For buffers, regex.c passes arguments
+   to the UPDATE_SYNTAX_TABLE macros which are relative to BEGV.
+   So if it is a buffer,a we set the offset field to BEGV.  */
 
 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(object, from, count)             \
   if (BUFFERP (object) || NILP (object))                               \
     {                                                                  \
       gl_state.b_property = BEGV - 1;                                  \
       gl_state.e_property = ZV;                                                \
+      gl_state.offset = BEGV - 1;                                      \
     }                                                                  \
   else if (EQ (object, Qt))                                            \
     {                                                                  \
       gl_state.b_property = - 1;                                       \
       gl_state.e_property = 1500000000;                                        \
+      gl_state.offset = 0;                                             \
     }                                                                  \
   else                                                                 \
     {                                                                  \
       gl_state.b_property = -1;                                                \
       gl_state.e_property = 1 + XSTRING (object)->size;                        \
+      gl_state.offset = 0;                                             \
     }                                                                  \
   gl_state.use_global = 0;                                             \
   gl_state.current_syntax_table = current_buffer->syntax_table;                \
@@ -275,10 +285,14 @@ struct gl_state_s
                                           and possibly at the
                                           intervals too, depending
                                           on: */
+  /* Offset for positions specified to UPDATE_SYNTAX_TABLE.  */
+  int offset;
   char left_ok;
   char right_ok;
 };
 
 extern struct gl_state_s gl_state;
 extern int parse_sexp_lookup_properties;
-extern INTERVAL interval_of();
+extern INTERVAL interval_of P_ ((int, Lisp_Object));
+
+extern int scan_words P_ ((int, int));