summaryrefslogtreecommitdiffstats
path: root/charset.h
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-03-30 23:50:33 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-03-30 23:50:33 +0000
commitec8c796bd17158c54f2415b1e71a82d309687126 (patch)
tree472eb9f8f428af3c73f39c6e63ea1cebad36facd /charset.h
parenta784b853587106e064e2c72d2058b88223434a6a (diff)
This patch removes at least some of the horrible utf-8 kluges in
charset.c. The new DECODER framework is currently only used in handler.c, and there in a horribly inefficient manner. We should use greater blocks of data, which would be much more efficient than what we are currently doing. Most of the other charset-related code still uses the old mutt_display_char() &friends interface, which is actually ok as long as you don't try to handle multibyte character sets. The most notable change should be the one to mutt_get_translation(): It will delay the loading and parsing of character set information files until it's really needed, catching a huge amount of standard cases. As a side effect, this will make "iso tagged as ascii" "work" again, as long as both sides use the same iso character set.
Diffstat (limited to 'charset.h')
-rw-r--r--charset.h38
1 files changed, 26 insertions, 12 deletions
diff --git a/charset.h b/charset.h
index 39522428..8f466ef5 100644
--- a/charset.h
+++ b/charset.h
@@ -53,31 +53,45 @@ typedef struct
}
CHARSET;
-/* this one could be made a bit smaller with two levels
- * of nested unions and structs. It's not worth the effort.
- */
+#define DECODER_BUFFSIZE 4096
+
+struct decoder_buff
+{
+ size_t size, used;
+ char buff[DECODER_BUFFSIZE];
+};
typedef struct decoder
{
- STATE *s;
- short is_utf8;
- CHARSET_MAP *map;
+ short src_is_utf8;
+ short just_take_id;
+ short forced;
+
+ /* used for utf-8 decoding */
CHARSET *chs;
- struct utf8_state *sfu;
-}
-DECODER;
+ /* used for 8-bit to 8-bit recoding */
+ CHARSET_MAP *chm;
+
+ /* the buffers */
+ struct decoder_buff in;
+ struct decoder_buff out;
+}
+DECODER;
+
+DECODER *mutt_open_decoder (const char *, const char *);
+void mutt_decoder_push (DECODER *, void *, size_t, size_t *);
+void mutt_decoder_pop (DECODER *, void *, size_t, size_t *);
+void mutt_decoder_pop_to_state (DECODER *, STATE *);
+void mutt_free_decoder (DECODER **);
CHARSET *mutt_get_charset(const char *);
CHARSET_MAP *mutt_get_translation(const char *, const char *);
-DECODER *mutt_open_decoder (STATE *, BODY *, int);
int mutt_display_string(char *, CHARSET_MAP *);
int mutt_is_utf8(const char *);
int mutt_recode_file (const char *, const char *, const char *);
unsigned char mutt_display_char(unsigned char, CHARSET_MAP *);
-void mutt_close_decoder (DECODER **);
void mutt_decode_utf8_string(char *, CHARSET *);
-void mutt_decoder_putc (DECODER *, char);
#endif