//#include"commons.h"
//
//#ifdef NEWIO
//
//typedef void (*f_dispose)(Ctx *ctx, Object *);
//typedef void (*f_setobj)(Ctx *ctx, Object *, Object *);
//
//typedef knh_int_t (*f_r_getc)(Ctx *ctx, Object *);
//typedef size_t (*f_r_read)(Ctx *ctx, Object *, Bytes *buf, size_t size);
//
//typedef struct knh_rfunc_l {
//	f_r_getc   fgetc;
//	f_r_read   fread;
//	f_setobj   fsetcodec;
//	f_dispose  fdispose;
//} knh_rfunc_l;
//
//typedef void  (*f_w_putc)(Ctx *ctx, Object *, knh_int_t);
//typedef void  (*f_w_write)(Ctx *ctx, Object *, knh_bytes_t);
//typedef void  (*f_w_flush)(Ctx *ctx, Object *);
//
//typedef struct knh_wfunc_l {
//	f_w_putc    fputc;
//	f_w_write   fwrite;
//	f_w_flush   fflush;
//	f_setobj    fsetcodec;
//	f_dispose   fdispose;
//} knh_wfunc_l;
//
//
//typedef void  (*f_conv)(Ctx *ctx, struct knh_Codec *, knh_bytes_t sbuf, Writer *tw);
//
//typedef struct Codec {
//	Object    *parent;
//	Bytes     *mbuf;
//	f_conv     fconv;
//	f_dispose  fdispose;
//	knh_iconv_t iconv;
//} Codec;
//
//void knh_Codec_conv(Ctx *ctx, Codec *b, knh_bytes_t sbuf, Writer *tw)
//{
//	if(IS_NOTNULL(b->parent)) {
//		b->fconv(ctx, b, sbuf, b->mbuf);
//		knh_Codec_conv(ctx, b->parent, knh_Bytes_tobytes(b->mbuf), tw);
//	}
//	else {
//		b->fconv(ctx, b, sbuf, b->tw);
//	}		
//}
//
//typedef struct InputStream {
//	f_r_getc  getc;
//	f_r_read  read;	
//}
//typedef struct knh_iofunc_t {
//	f_io_getc  getc;
//	f_io_putc  putc;
//	f_io_write write;	
//	f_io_flush flush;
//} knh_iofunc_t;
//
//typedef struct knh_IOHandler {
//	knh_uint_t  magic;
//	knh_iofunc_t *f;
//	knh_iofunc_t *forig;
//} knh_IOHander;
//
//typedef void  (*f_io_decode)(Ctx *ctx, knh_iconv_t, knh_bytes_t, knh_IOHandler);
//typedef void  (*f_io_encode)(Ctx *ctx, knh_iconv_t, knh_bytes_t, knh_IOHandler);
//
//typedef struct IOCodec {
//	knh_uint_t  magic;
//	knh_iofunc_t *f;
//	knh_iofunc_t *forig;
//	knh_IOHandler  *parent;
//	knh_IOHandler  *iobuf;
//	size_t         iobuf_pos;
//	String *name;
//	f_io_decode   fdecode;
//	knh_iconv_t    deconv;
//	f_io_encode   fencode;
//	knh_iconv_t    enconv;	
//} IOCodec;
//
//
///* ------------------------------------------------------------------------ */
//
//knh_intch_t knh_Nue_getc__nop(Ctx *ctx, IOCodec *b)
//{
//	return EOF;
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_Nue_putc__nop(Ctx *ctx, IOCodec *b, knh_intch_t ch)
//{
//
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_Nue_write__nop(Ctx *ctx, IOCodec *b, knh_bytes_t b)
//{
//
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_Nue_flush__nop(Ctx *ctx, IOCodec *b)
//{
//
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_intch_t knh_IOCodec_getc__parent(Ctx *ctx, IOCodec *b)
//{
//	return b->parent->forig->getc(ctx, b->parent);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_putc__parent(Ctx *ctx, IOCodec *b, knh_intch_t ch)
//{
//	b->parent->forig->putc(ctx, b->parent, ch);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_write__parent(Ctx *ctx, IOCodec *b, knh_bytes_t b)
//{
//	b->parent->forig->write(ctx, b->parent, b);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_flush__parent(Ctx *ctx, IOCodec *b)
//{
//	b->parent->forig->flush(ctx, b->parent);
//}
//
///* ------------------------------------------------------------------------ */
//
///* ------------------------------------------------------------------------ */
//
//knh_intch_t knh_IOCodec_getc__iconv(Ctx *ctx, IOCodec *b)
//{
//	return b->parent->forig->getc(ctx, b->parent);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_putc__iconv(Ctx *ctx, IOCodec *b, knh_intch_t ch)
//{
//	char *buf[2] = {ch, 0};
//	b->fencode(ctx, b->enconv, B(buf), b->parent);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_write__iconv(Ctx *ctx, IOCodec *b, knh_bytes_t b)
//{
//	b->fencode(ctx, b->enconv, b, b->parent);
//}
//
///* ------------------------------------------------------------------------ */
//
//knh_bytes_t knh_IOCodec_flush__iconv(Ctx *ctx, IOCodec *b)
//{
//	b->parent->f->flush(ctx, b->parent);
//}
//
//#endif
//
///* ------------------------------------------------------------------------ */
