Blame src/mtext.h

Packit Service a721b1
/* mtext.h -- header file for the M-text module.
Packit Service a721b1
   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Packit Service a721b1
     National Institute of Advanced Industrial Science and Technology (AIST)
Packit Service a721b1
     Registration Number H15PRO112
Packit Service a721b1
Packit Service a721b1
   This file is part of the m17n library.
Packit Service a721b1
Packit Service a721b1
   The m17n library is free software; you can redistribute it and/or
Packit Service a721b1
   modify it under the terms of the GNU Lesser General Public License
Packit Service a721b1
   as published by the Free Software Foundation; either version 2.1 of
Packit Service a721b1
   the License, or (at your option) any later version.
Packit Service a721b1
Packit Service a721b1
   The m17n library is distributed in the hope that it will be useful,
Packit Service a721b1
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service a721b1
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service a721b1
   Lesser General Public License for more details.
Packit Service a721b1
Packit Service a721b1
   You should have received a copy of the GNU Lesser General Public
Packit Service a721b1
   License along with the m17n library; if not, write to the Free
Packit Service a721b1
   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Packit Service a721b1
   Boston, MA 02110-1301 USA.  */
Packit Service a721b1
Packit Service a721b1
#ifndef _M17N_MTEXT_H_
Packit Service a721b1
#define _M17N_MTEXT_H_
Packit Service a721b1
Packit Service a721b1
/** @file mtext.h
Packit Service a721b1
    @brief Header for M-text handling.
Packit Service a721b1
*/
Packit Service a721b1
Packit Service a721b1
#define POS_CHAR_TO_BYTE(mt, pos)				\
Packit Service a721b1
  (mtext_nchars (mt) == mtext_nbytes (mt) ? (pos)		\
Packit Service a721b1
   : (pos) == (mt)->cache_char_pos ? (mt)->cache_byte_pos	\
Packit Service a721b1
   : mtext__char_to_byte ((mt), (pos)))
Packit Service a721b1
Packit Service a721b1
#define POS_BYTE_TO_CHAR(mt, pos_byte)				\
Packit Service a721b1
  (mtext_nchars (mt) == mtext_nbytes (mt) ? (pos_byte)		\
Packit Service a721b1
   : (pos_byte) == (mt)->cache_byte_pos ? (mt)->cache_char_pos	\
Packit Service a721b1
   : mtext__byte_to_char ((mt), (pos_byte)))
Packit Service a721b1
Packit Service a721b1
Packit Service a721b1
#define MTEXT_DATA(mt) ((mt)->data)
Packit Service a721b1
Packit Service a721b1
extern int mtext__char_to_byte (MText *mt, int pos);
Packit Service a721b1
Packit Service a721b1
extern int mtext__byte_to_char (MText *mt, int pos_byte);
Packit Service a721b1
Packit Service a721b1
extern void mtext__enlarge (MText *mt, int nbytes);
Packit Service a721b1
Packit Service a721b1
extern int mtext__takein (MText *mt, int nchars, int nbytes);
Packit Service a721b1
Packit Service a721b1
extern int mtext__cat_data (MText *mt, unsigned char *p, int nbytes,
Packit Service a721b1
			    enum MTextFormat format);
Packit Service a721b1
Packit Service a721b1
#define MTEXT_CAT_ASCII(mt, str)				\
Packit Service a721b1
  mtext__cat_data ((mt), (unsigned char *) (str), strlen (str),	\
Packit Service a721b1
		   MTEXT_FORMAT_US_ASCII)
Packit Service a721b1
Packit Service a721b1
extern MText *mtext__from_data (const void *data, int nitems,
Packit Service a721b1
				enum MTextFormat format, int need_copy);
Packit Service a721b1
Packit Service a721b1
extern void mtext__adjust_format (MText *mt, enum MTextFormat format);
Packit Service a721b1
Packit Service a721b1
extern int mtext__bol (MText *mt, int pos);
Packit Service a721b1
Packit Service a721b1
extern int mtext__eol (MText *mt, int pos);
Packit Service a721b1
Packit Service a721b1
extern void mtext__wseg_fini ();
Packit Service a721b1
Packit Service a721b1
extern int mtext__word_segment (MText *mt, int pos, int *from, int *to);
Packit Service a721b1
Packit Service a721b1
#endif /* _M17N_MTEXT_H_ */