Back to index

php5  5.3.10
mbfl_convert.h
Go to the documentation of this file.
00001 /*
00002  * "streamable kanji code filter and converter"
00003  * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
00004  *
00005  * LICENSE NOTICES
00006  *
00007  * This file is part of "streamable kanji code filter and converter",
00008  * which is distributed under the terms of GNU Lesser General Public 
00009  * License (version 2) as published by the Free Software Foundation.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with "streamable kanji code filter and converter";
00018  * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
00019  * Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * The author of this file:
00022  *
00023  */
00024 /*
00025  * The source code included in this files was separated from mbfilter.h
00026  * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
00027  * mbfilter.h is included in this package .
00028  *
00029  */
00030 
00031 #ifndef MBFL_CONVERT_H
00032 #define MBFL_CONVERT_H
00033 
00034 #include "mbfl_defs.h"
00035 #include "mbfl_encoding.h"
00036 #include "mbfl_memory_device.h"
00037 
00038 typedef struct _mbfl_convert_filter mbfl_convert_filter;
00039 
00040 struct _mbfl_convert_filter {
00041        void (*filter_ctor)(mbfl_convert_filter *filter);
00042        void (*filter_dtor)(mbfl_convert_filter *filter);
00043        void (*filter_copy)(mbfl_convert_filter *src, mbfl_convert_filter *dest);
00044        int (*filter_function)(int c, mbfl_convert_filter *filter);
00045        int (*filter_flush)(mbfl_convert_filter *filter);
00046        int (*output_function)(int c, void *data);
00047        int (*flush_function)(void *data);
00048        void *data;
00049        int status;
00050        int cache;
00051        const mbfl_encoding *from;
00052        const mbfl_encoding *to;
00053        int illegal_mode;
00054        int illegal_substchar;
00055        int num_illegalchar;
00056        void *opaque;
00057 };
00058 
00059 struct mbfl_convert_vtbl {
00060        enum mbfl_no_encoding from;
00061        enum mbfl_no_encoding to;
00062        void (*filter_ctor)(mbfl_convert_filter *filter);
00063        void (*filter_dtor)(mbfl_convert_filter *filter);
00064        int (*filter_function)(int c, mbfl_convert_filter *filter);
00065        int (*filter_flush)(mbfl_convert_filter *filter);
00066        void (*filter_copy)(mbfl_convert_filter *src, mbfl_convert_filter *dest);
00067 };
00068 
00069 MBFLAPI extern const struct mbfl_convert_vtbl *mbfl_convert_filter_list[];
00070 
00071 MBFLAPI extern mbfl_convert_filter *mbfl_convert_filter_new(
00072     enum mbfl_no_encoding from,
00073     enum mbfl_no_encoding to,
00074     int (*output_function)(int, void *),
00075     int (*flush_function)(void *),
00076     void *data );
00077 MBFLAPI extern mbfl_convert_filter *mbfl_convert_filter_new2(
00078        const struct mbfl_convert_vtbl *vtbl,
00079     int (*output_function)(int, void *),
00080     int (*flush_function)(void *),
00081     void *data );
00082 MBFLAPI extern void mbfl_convert_filter_delete(mbfl_convert_filter *filter);
00083 MBFLAPI extern int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter);
00084 MBFLAPI extern int mbfl_convert_filter_flush(mbfl_convert_filter *filter);
00085 MBFLAPI extern void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to);
00086 MBFLAPI extern void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist);
00087 MBFLAPI extern int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter);
00088 MBFLAPI extern const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to);
00089 
00090 MBFLAPI extern void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter);
00091 MBFLAPI extern int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter);
00092 MBFLAPI extern void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter);
00093 
00094 MBFLAPI extern int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src);
00095 MBFLAPI extern int mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p);
00096 
00097 #endif /* MBFL_CONVERT_H */