#include <setjmp.h>
#include "lisp.h"
-#include "buffer.h"
#include "character.h"
+#include "buffer.h"
#include "charset.h"
#include "ccl.h"
#include "composite.h"
static void decode_coding_raw_text (struct coding_system *);
static int encode_coding_raw_text (struct coding_system *);
-static ptrdiff_t coding_set_source (struct coding_system *);
-static ptrdiff_t coding_set_destination (struct coding_system *);
+static void coding_set_source (struct coding_system *);
+static ptrdiff_t coding_change_source (struct coding_system *);
+static void coding_set_destination (struct coding_system *);
+static ptrdiff_t coding_change_destination (struct coding_system *);
static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t);
static void coding_alloc_by_making_gap (struct coding_system *,
ptrdiff_t, ptrdiff_t);
charset_map_loaded = 0; \
c = DECODE_CHAR (charset, code); \
if (charset_map_loaded \
- && (offset = coding_set_source (coding))) \
+ && (offset = coding_change_source (coding))) \
{ \
src += offset; \
src_base += offset; \
charset_map_loaded = 0; \
code = ENCODE_CHAR (charset, c); \
if (charset_map_loaded \
- && (offset = coding_set_destination (coding))) \
+ && (offset = coding_change_destination (coding))) \
{ \
dst += offset; \
dst_end += offset; \
charset_map_loaded = 0; \
charset = char_charset (c, charset_list, code_return); \
if (charset_map_loaded \
- && (offset = coding_set_destination (coding))) \
+ && (offset = coding_change_destination (coding))) \
{ \
dst += offset; \
dst_end += offset; \
charset_map_loaded = 0; \
result = CHAR_CHARSET_P (c, charset); \
if (charset_map_loaded \
- && (offset = coding_set_destination (coding))) \
+ && (offset = coding_change_destination (coding))) \
{ \
dst += offset; \
dst_end += offset; \
| ((p)[-1] & 0x3F))))
-/* Update coding->source from coding->src_object, and return how many
- bytes coding->source was changed. */
+/* Set coding->source from coding->src_object. */
-static ptrdiff_t
+static void
coding_set_source (struct coding_system *coding)
{
- const unsigned char *orig = coding->source;
-
if (BUFFERP (coding->src_object))
{
struct buffer *buf = XBUFFER (coding->src_object);
/* Otherwise, the source is C string and is never relocated
automatically. Thus we don't have to update anything. */
}
- return coding->source - orig;
}
-/* Update coding->destination from coding->dst_object, and return how
- many bytes coding->destination was changed. */
+/* Set coding->source from coding->src_object, and return how many
+ bytes coding->source was changed. */
static ptrdiff_t
-coding_set_destination (struct coding_system *coding)
+coding_change_source (struct coding_system *coding)
{
- const unsigned char *orig = coding->destination;
+ const unsigned char *orig = coding->source;
+ coding_set_source (coding);
+ return coding->source - orig;
+}
+
+/* Set coding->destination from coding->dst_object. */
+
+static void
+coding_set_destination (struct coding_system *coding)
+{
if (BUFFERP (coding->dst_object))
{
if (BUFFERP (coding->src_object) && coding->src_pos < 0)
/* Otherwise, the destination is C string and is never relocated
automatically. Thus we don't have to update anything. */
}
+}
+
+
+/* Set coding->destination from coding->dst_object, and return how
+ many bytes coding->destination was changed. */
+
+static ptrdiff_t
+coding_change_destination (struct coding_system *coding)
+{
+ const unsigned char *orig = coding->destination;
+ coding_set_destination (coding);
return coding->destination - orig;
}
break;
check_extra_latin:
if (! VECTORP (Vlatin_extra_code_table)
- || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))
+ || NILP (AREF (Vlatin_extra_code_table, c)))
{
rejected = CATEGORY_MASK_ISO;
break;
nbytes = encode_designation_at_bol (coding, charbuf, charbuf_end,
desig_buf);
if (charset_map_loaded
- && (offset = coding_set_destination (coding)))
+ && (offset = coding_change_destination (coding)))
{
dst += offset;
dst_end += offset;
if (c < 0xA0
&& check_latin_extra
&& (!VECTORP (Vlatin_extra_code_table)
- || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])))
+ || NILP (AREF (Vlatin_extra_code_table, c))))
break;
found = CATEGORY_MASK_CHARSET;
}
while (buf < buf_end)
{
- int c = *buf, i;
+ int c = *buf;
+ ptrdiff_t i;
if (c >= 0)
{
Vcoding_category_list = Qnil;
for (i = coding_category_max - 1; i >= 0; i--)
Vcoding_category_list
- = Fcons (XVECTOR (Vcoding_category_table)->contents[i],
+ = Fcons (AREF (Vcoding_category_table, i),
Vcoding_category_list);
}