update.
[chise/xemacs-chise.git-] / src / buffer.h
index 7ed84ed..6b36d3a 100644 (file)
@@ -201,7 +201,7 @@ struct buffer
   int modtime;
 
   /* the value of text->modiff at the last auto-save.  */
-  int auto_save_modified;
+  long auto_save_modified;
 
   /* The time at which we detected a failure to auto-save,
      Or -1 if we didn't have a failure.  */
@@ -318,8 +318,8 @@ for (mps_bufcons = Qunbound,                                                        \
 /*----------------------------------------------------------------------*/
 
 /* Convert the address of a byte in the buffer into a position.  */
-INLINE Bytind BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr);
-INLINE Bytind
+INLINE_HEADER Bytind BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr);
+INLINE_HEADER Bytind
 BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr)
 {
   return (ptr - buf->text->beg + 1
@@ -331,8 +331,8 @@ BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr)
   bytind_to_bufpos (buf, BI_BUF_PTR_BYTE_POS (buf, ptr))
 
 /* Address of byte at position POS in buffer. */
-INLINE Bufbyte * BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos);
-INLINE Bufbyte *
+INLINE_HEADER Bufbyte * BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos);
+INLINE_HEADER Bufbyte *
 BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos)
 {
   return (buf->text->beg +
@@ -344,8 +344,8 @@ BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos)
   BI_BUF_BYTE_ADDRESS (buf, bufpos_to_bytind (buf, pos))
 
 /* Address of byte before position POS in buffer. */
-INLINE Bufbyte * BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos);
-INLINE Bufbyte *
+INLINE_HEADER Bufbyte * BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos);
+INLINE_HEADER Bufbyte *
 BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos)
 {
   return (buf->text->beg +
@@ -360,8 +360,8 @@ BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos)
 /*         Converting between byte indices and memory indices          */
 /*----------------------------------------------------------------------*/
 
-INLINE int valid_memind_p (struct buffer *buf, Memind x);
-INLINE int
+INLINE_HEADER int valid_memind_p (struct buffer *buf, Memind x);
+INLINE_HEADER int
 valid_memind_p (struct buffer *buf, Memind x)
 {
   return ((x >= 1 && x <= (Memind) buf->text->gpt) ||
@@ -369,16 +369,16 @@ valid_memind_p (struct buffer *buf, Memind x)
           x <= (Memind) (buf->text->z   + buf->text->gap_size)));
 }
 
-INLINE Memind bytind_to_memind (struct buffer *buf, Bytind x);
-INLINE Memind
+INLINE_HEADER Memind bytind_to_memind (struct buffer *buf, Bytind x);
+INLINE_HEADER Memind
 bytind_to_memind (struct buffer *buf, Bytind x)
 {
   return (Memind) ((x > buf->text->gpt) ? (x + buf->text->gap_size) : x);
 }
 
 
-INLINE Bytind memind_to_bytind (struct buffer *buf, Memind x);
-INLINE Bytind
+INLINE_HEADER Bytind memind_to_bytind (struct buffer *buf, Memind x);
+INLINE_HEADER Bytind
 memind_to_bytind (struct buffer *buf, Memind x)
 {
 #ifdef ERROR_CHECK_BUFPOS
@@ -598,16 +598,16 @@ memind_to_bytind (struct buffer *buf, Memind x)
   VALIDATE_BYTIND_BACKWARD (buf, x);                   \
 } while (0)
 
-INLINE Bytind prev_bytind (struct buffer *buf, Bytind x);
-INLINE Bytind
+INLINE_HEADER Bytind prev_bytind (struct buffer *buf, Bytind x);
+INLINE_HEADER Bytind
 prev_bytind (struct buffer *buf, Bytind x)
 {
   DEC_BYTIND (buf, x);
   return x;
 }
 
-INLINE Bytind next_bytind (struct buffer *buf, Bytind x);
-INLINE Bytind
+INLINE_HEADER Bytind next_bytind (struct buffer *buf, Bytind x);
+INLINE_HEADER Bytind
 next_bytind (struct buffer *buf, Bytind x)
 {
   INC_BYTIND (buf, x);
@@ -671,8 +671,8 @@ Bufpos bytind_to_bufpos_func (struct buffer *buf, Bytind x);
 extern short three_to_one_table[];
 #endif
 
-INLINE int real_bufpos_to_bytind (struct buffer *buf, Bufpos x);
-INLINE int
+INLINE_HEADER int real_bufpos_to_bytind (struct buffer *buf, Bufpos x);
+INLINE_HEADER int
 real_bufpos_to_bytind (struct buffer *buf, Bufpos x)
 {
   if (x >= buf->text->mule_bufmin && x <= buf->text->mule_bufmax)
@@ -688,8 +688,8 @@ real_bufpos_to_bytind (struct buffer *buf, Bufpos x)
     return bufpos_to_bytind_func (buf, x);
 }
 
-INLINE int real_bytind_to_bufpos (struct buffer *buf, Bytind x);
-INLINE int
+INLINE_HEADER int real_bytind_to_bufpos (struct buffer *buf, Bytind x);
+INLINE_HEADER int
 real_bytind_to_bufpos (struct buffer *buf, Bytind x)
 {
   if (x >= buf->text->mule_bytmin && x <= buf->text->mule_bytmax)
@@ -976,16 +976,17 @@ dfc_convert_to_internal_format (dfc_conversion_type source_type,
 } while (0)
 
 /* Assign to the `sink' lvalue(s) using the converted data. */
+typedef union { char c; void *p; } *dfc_aliasing_voidpp;
 #define DFC_ALLOCA_USE_CONVERTED_DATA(sink) do {                       \
   void * dfc_sink_ret = alloca (dfc_sink.data.len + 1);                        \
   memcpy (dfc_sink_ret, dfc_sink.data.ptr, dfc_sink.data.len + 1);     \
-  (DFC_CPP_CAR sink) = (unsigned char *) dfc_sink_ret;                 \
+  ((dfc_aliasing_voidpp) &(DFC_CPP_CAR sink))->p = dfc_sink_ret;       \
   (DFC_CPP_CDR sink) = dfc_sink.data.len;                              \
 } while (0)
 #define DFC_MALLOC_USE_CONVERTED_DATA(sink) do {                       \
   void * dfc_sink_ret = xmalloc (dfc_sink.data.len + 1);               \
   memcpy (dfc_sink_ret, dfc_sink.data.ptr, dfc_sink.data.len + 1);     \
-  (DFC_CPP_CAR sink) = (unsigned char *) dfc_sink_ret;                 \
+  ((dfc_aliasing_voidpp) &(DFC_CPP_CAR sink))->p = dfc_sink_ret;       \
   (DFC_CPP_CDR sink) = dfc_sink.data.len;                              \
 } while (0)
 #define DFC_C_STRING_ALLOCA_USE_CONVERTED_DATA(sink) do {              \
@@ -1015,7 +1016,7 @@ dfc_convert_to_internal_format (dfc_conversion_type source_type,
 #define GET_C_CHARPTR_EXT_DATA_ALLOCA(ptr, fmt, ptr_out) do    \
 {                                                              \
   Extcount gcceda_ignored_len;                                 \
-  CONST Bufbyte *gcceda_ptr_in = (CONST Bufbyte *) (ptr);      \
+  const Bufbyte *gcceda_ptr_in = (const Bufbyte *) (ptr);      \
   Extbyte *gcceda_ptr_out;                                     \
                                                                \
   GET_CHARPTR_EXT_DATA_ALLOCA (gcceda_ptr_in,                  \
@@ -1059,7 +1060,7 @@ dfc_convert_to_internal_format (dfc_conversion_type source_type,
 {                                                                      \
   Extcount gcida_len_in = (Extcount) (len);                            \
   Bytecount gcida_len_out;                                             \
-  CONST Extbyte *gcida_ptr_in = (ptr);                                 \
+  const Extbyte *gcida_ptr_in = (ptr);                                 \
   Bufbyte *gcida_ptr_out =                                             \
     convert_from_external_format (gcida_ptr_in, gcida_len_in,          \
                                  &gcida_len_out, fmt);                 \
@@ -1094,7 +1095,7 @@ dfc_convert_to_internal_format (dfc_conversion_type source_type,
 #define GET_C_CHARPTR_INT_DATA_ALLOCA(ptr, fmt, ptr_out) do    \
 {                                                              \
   Bytecount gccida_ignored_len;                                        \
-  CONST Extbyte *gccida_ptr_in = (CONST Extbyte *) (ptr);      \
+  const Extbyte *gccida_ptr_in = (const Extbyte *) (ptr);      \
   Bufbyte *gccida_ptr_out;                                     \
                                                                \
   GET_CHARPTR_INT_DATA_ALLOCA (gccida_ptr_in,                  \
@@ -1408,17 +1409,17 @@ int beginning_of_line_p (struct buffer *b, Bufpos pt);
 /* from insdel.c */
 void set_buffer_point (struct buffer *buf, Bufpos pos, Bytind bipos);
 void find_charsets_in_bufbyte_string (Charset_ID *charsets,
-                                     CONST Bufbyte *str,
+                                     const Bufbyte *str,
                                      Bytecount len);
 void find_charsets_in_emchar_string (Charset_ID *charsets,
-                                    CONST Emchar *str,
+                                    const Emchar *str,
                                     Charcount len);
-int bufbyte_string_displayed_columns (CONST Bufbyte *str, Bytecount len);
-int emchar_string_displayed_columns (CONST Emchar *str, Charcount len);
-void convert_bufbyte_string_into_emchar_dynarr (CONST Bufbyte *str,
+int bufbyte_string_displayed_columns (const Bufbyte *str, Bytecount len);
+int emchar_string_displayed_columns (const Emchar *str, Charcount len);
+void convert_bufbyte_string_into_emchar_dynarr (const Bufbyte *str,
                                                Bytecount len,
                                                Emchar_dynarr *dyn);
-Charcount convert_bufbyte_string_into_emchar_string (CONST Bufbyte *str,
+Charcount convert_bufbyte_string_into_emchar_string (const Bufbyte *str,
                                                     Bytecount len,
                                                     Emchar *arr);
 void convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels,
@@ -1544,8 +1545,8 @@ int map_over_sharing_buffers (struct buffer *buf,
   TRT_TABLE_AS_STRING (buf->case_eqv_table)
 #endif
 
-INLINE Emchar TRT_TABLE_OF (Lisp_Object trt, Emchar c);
-INLINE Emchar
+INLINE_HEADER Emchar TRT_TABLE_OF (Lisp_Object trt, Emchar c);
+INLINE_HEADER Emchar
 TRT_TABLE_OF (Lisp_Object trt, Emchar c)
 {
   return IN_TRT_TABLE_DOMAIN (c) ? TRT_TABLE_CHAR_1 (trt, c) : c;
@@ -1557,8 +1558,8 @@ TRT_TABLE_OF (Lisp_Object trt, Emchar c)
 
 /* 1 if CH is upper case.  */
 
-INLINE int UPPERCASEP (struct buffer *buf, Emchar ch);
-INLINE int
+INLINE_HEADER int UPPERCASEP (struct buffer *buf, Emchar ch);
+INLINE_HEADER int
 UPPERCASEP (struct buffer *buf, Emchar ch)
 {
   return DOWNCASE_TABLE_OF (buf, ch) != ch;
@@ -1566,8 +1567,8 @@ UPPERCASEP (struct buffer *buf, Emchar ch)
 
 /* 1 if CH is lower case.  */
 
-INLINE int LOWERCASEP (struct buffer *buf, Emchar ch);
-INLINE int
+INLINE_HEADER int LOWERCASEP (struct buffer *buf, Emchar ch);
+INLINE_HEADER int
 LOWERCASEP (struct buffer *buf, Emchar ch)
 {
   return (UPCASE_TABLE_OF   (buf, ch) != ch &&
@@ -1576,8 +1577,8 @@ LOWERCASEP (struct buffer *buf, Emchar ch)
 
 /* 1 if CH is neither upper nor lower case.  */
 
-INLINE int NOCASEP (struct buffer *buf, Emchar ch);
-INLINE int
+INLINE_HEADER int NOCASEP (struct buffer *buf, Emchar ch);
+INLINE_HEADER int
 NOCASEP (struct buffer *buf, Emchar ch)
 {
   return UPCASE_TABLE_OF (buf, ch) == ch;
@@ -1585,8 +1586,8 @@ NOCASEP (struct buffer *buf, Emchar ch)
 
 /* Upcase a character, or make no change if that cannot be done.  */
 
-INLINE Emchar UPCASE (struct buffer *buf, Emchar ch);
-INLINE Emchar
+INLINE_HEADER Emchar UPCASE (struct buffer *buf, Emchar ch);
+INLINE_HEADER Emchar
 UPCASE (struct buffer *buf, Emchar ch)
 {
   return (DOWNCASE_TABLE_OF (buf, ch) == ch) ? UPCASE_TABLE_OF (buf, ch) : ch;