1\section{M-text} 2\label{group__m17nMtext}\index{M-text@{M-text}} 3M-text objects and API for them. 4\subsection*{Variables: Default Endian of UTF-16 and UTF-32} 5\begin{CompactItemize} 6\item 7enum {\bf MTextFormat} {\bf MTEXT\_\-FORMAT\_\-UTF\_\-16} 8\begin{CompactList}\small\item\em Variable of value MTEXT\_\-FORMAT\_\-UTF\_\-16LE or MTEXT\_\-FORMAT\_\-UTF\_\-16BE. \item\end{CompactList}\item 9const int {\bf MTEXT\_\-FORMAT\_\-UTF\_\-32} 10\begin{CompactList}\small\item\em Variable of value MTEXT\_\-FORMAT\_\-UTF\_\-32LE or MTEXT\_\-FORMAT\_\-UTF\_\-32BE. \item\end{CompactList}\end{CompactItemize} 11\subsection*{Typedefs} 12\begin{CompactItemize} 13\item 14typedef struct {\bf MText} {\bf MText} 15\begin{CompactList}\small\item\em Type of {\em M-texts\/}. \item\end{CompactList}\end{CompactItemize} 16\subsection*{Enumerations} 17\begin{CompactItemize} 18\item 19enum {\bf MTextFormat} \{ \par 20{\bf MTEXT\_\-FORMAT\_\-US\_\-ASCII}, 21\par 22{\bf MTEXT\_\-FORMAT\_\-UTF\_\-8}, 23\par 24{\bf MTEXT\_\-FORMAT\_\-UTF\_\-16LE}, 25\par 26{\bf MTEXT\_\-FORMAT\_\-UTF\_\-16BE}, 27\par 28{\bf MTEXT\_\-FORMAT\_\-UTF\_\-32LE}, 29\par 30{\bf MTEXT\_\-FORMAT\_\-UTF\_\-32BE}, 31\par 32{\bf MTEXT\_\-FORMAT\_\-MAX} 33 \} 34\begin{CompactList}\small\item\em Enumeration for specifying the format of an M-text. \item\end{CompactList}\item 35enum {\bf MTextLineBreakOption} \{ \par 36{\bf MTEXT\_\-LBO\_\-SP\_\-CM} = 1, 37\par 38{\bf MTEXT\_\-LBO\_\-KOREAN\_\-SP} = 2, 39\par 40{\bf MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID} = 4, 41\par 42{\bf MTEXT\_\-LBO\_\-MAX} 43 \} 44\begin{CompactList}\small\item\em Enumeration for specifying a set of line breaking option. \item\end{CompactList}\end{CompactItemize} 45\subsection*{Functions} 46\begin{CompactItemize} 47\item 48int {\bf mtext\_\-line\_\-break} ({\bf MText} $\ast$mt, int pos, int option, int $\ast$after) 49\begin{CompactList}\small\item\em Find a linebreak postion of an M-text. \item\end{CompactList}\item 50{\bf MText} $\ast$ {\bf mtext} () 51\begin{CompactList}\small\item\em Allocate a new M-text. \item\end{CompactList}\item 52{\bf MText} $\ast$ {\bf mtext\_\-from\_\-data} (const void $\ast$data, int nitems, enum {\bf MTextFormat} format) 53\begin{CompactList}\small\item\em Allocate a new M-text with specified data. \item\end{CompactList}\item 54void $\ast$ {\bf mtext\_\-data} ({\bf MText} $\ast$mt, enum {\bf MTextFormat} $\ast$fmt, int $\ast$nunits, int $\ast$pos\_\-idx, int $\ast$unit\_\-idx) 55\begin{CompactList}\small\item\em Get information about the text data in M-text. \item\end{CompactList}\item 56int {\bf mtext\_\-len} ({\bf MText} $\ast$mt) 57\begin{CompactList}\small\item\em Number of characters in M-text. \item\end{CompactList}\item 58int {\bf mtext\_\-ref\_\-char} ({\bf MText} $\ast$mt, int pos) 59\begin{CompactList}\small\item\em Return the character at the specified position in an M-text. \item\end{CompactList}\item 60int {\bf mtext\_\-set\_\-char} ({\bf MText} $\ast$mt, int pos, int c) 61\begin{CompactList}\small\item\em Store a character into an M-text. \item\end{CompactList}\item 62{\bf MText} $\ast$ {\bf mtext\_\-cat\_\-char} ({\bf MText} $\ast$mt, int c) 63\begin{CompactList}\small\item\em Append a character to an M-text. \item\end{CompactList}\item 64{\bf MText} $\ast$ {\bf mtext\_\-dup} ({\bf MText} $\ast$mt) 65\begin{CompactList}\small\item\em Create a copy of an M-text. \item\end{CompactList}\item 66{\bf MText} $\ast$ {\bf mtext\_\-cat} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2) 67\begin{CompactList}\small\item\em Append an M-text to another. \item\end{CompactList}\item 68{\bf MText} $\ast$ {\bf mtext\_\-ncat} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2, int n) 69\begin{CompactList}\small\item\em Append a part of an M-text to another. \item\end{CompactList}\item 70{\bf MText} $\ast$ {\bf mtext\_\-cpy} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2) 71\begin{CompactList}\small\item\em Copy an M-text to another. \item\end{CompactList}\item 72{\bf MText} $\ast$ {\bf mtext\_\-ncpy} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2, int n) 73\begin{CompactList}\small\item\em Copy the first some characters in an M-text to another. \item\end{CompactList}\item 74{\bf MText} $\ast$ {\bf mtext\_\-duplicate} ({\bf MText} $\ast$mt, int from, int to) 75\begin{CompactList}\small\item\em Create a new M-text from a part of an existing M-text. \item\end{CompactList}\item 76{\bf MText} $\ast$ {\bf mtext\_\-copy} ({\bf MText} $\ast$mt1, int pos, {\bf MText} $\ast$mt2, int from, int to) 77\begin{CompactList}\small\item\em Copy characters in the specified range into an M-text. \item\end{CompactList}\item 78int {\bf mtext\_\-del} ({\bf MText} $\ast$mt, int from, int to) 79\begin{CompactList}\small\item\em Delete characters in the specified range destructively. \item\end{CompactList}\item 80int {\bf mtext\_\-ins} ({\bf MText} $\ast$mt1, int pos, {\bf MText} $\ast$mt2) 81\begin{CompactList}\small\item\em Insert an M-text into another M-text. \item\end{CompactList}\item 82int {\bf mtext\_\-insert} ({\bf MText} $\ast$mt1, int pos, {\bf MText} $\ast$mt2, int from, int to) 83\begin{CompactList}\small\item\em Insert sub-text of an M-text into another M-text. \item\end{CompactList}\item 84int {\bf mtext\_\-ins\_\-char} ({\bf MText} $\ast$mt, int pos, int c, int n) 85\begin{CompactList}\small\item\em Insert a character into an M-text. \item\end{CompactList}\item 86int {\bf mtext\_\-replace} ({\bf MText} $\ast$mt1, int from1, int to1, {\bf MText} $\ast$mt2, int from2, int to2) 87\begin{CompactList}\small\item\em Replace sub-text of M-text with another. \item\end{CompactList}\item 88int {\bf mtext\_\-character} ({\bf MText} $\ast$mt, int from, int to, int c) 89\begin{CompactList}\small\item\em Search a character in an M-text. \item\end{CompactList}\item 90int {\bf mtext\_\-chr} ({\bf MText} $\ast$mt, int c) 91\begin{CompactList}\small\item\em Return the position of the first occurrence of a character in an M-text. \item\end{CompactList}\item 92int {\bf mtext\_\-rchr} ({\bf MText} $\ast$mt, int c) 93\begin{CompactList}\small\item\em Return the position of the last occurrence of a character in an M-text. \item\end{CompactList}\item 94int {\bf mtext\_\-cmp} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2) 95\begin{CompactList}\small\item\em Compare two M-texts character-by-character. \item\end{CompactList}\item 96int {\bf mtext\_\-ncmp} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2, int n) 97\begin{CompactList}\small\item\em Compare initial parts of two M-texts character-by-character. \item\end{CompactList}\item 98int {\bf mtext\_\-compare} ({\bf MText} $\ast$mt1, int from1, int to1, {\bf MText} $\ast$mt2, int from2, int to2) 99\begin{CompactList}\small\item\em Compare specified regions of two M-texts. \item\end{CompactList}\item 100int {\bf mtext\_\-spn} ({\bf MText} $\ast$mt, {\bf MText} $\ast$accept) 101\begin{CompactList}\small\item\em Search an M-text for a set of characters. \item\end{CompactList}\item 102int {\bf mtext\_\-cspn} ({\bf MText} $\ast$mt, {\bf MText} $\ast$reject) 103\begin{CompactList}\small\item\em Search an M-text for the complement of a set of characters. \item\end{CompactList}\item 104int {\bf mtext\_\-pbrk} ({\bf MText} $\ast$mt, {\bf MText} $\ast$accept) 105\begin{CompactList}\small\item\em Search an M-text for any of a set of characters. \item\end{CompactList}\item 106{\bf MText} $\ast$ {\bf mtext\_\-tok} ({\bf MText} $\ast$mt, {\bf MText} $\ast$delim, int $\ast$pos) 107\begin{CompactList}\small\item\em Look for a token in an M-text. \item\end{CompactList}\item 108int {\bf mtext\_\-text} ({\bf MText} $\ast$mt1, int pos, {\bf MText} $\ast$mt2) 109\begin{CompactList}\small\item\em Locate an M-text in another. \item\end{CompactList}\item 110int {\bf mtext\_\-search} ({\bf MText} $\ast$mt1, int from, int to, {\bf MText} $\ast$mt2) 111\begin{CompactList}\small\item\em Locate an M-text in a specific range of another. \item\end{CompactList}\item 112int {\bf mtext\_\-casecmp} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2) 113\begin{CompactList}\small\item\em Compare two M-texts ignoring cases. \item\end{CompactList}\item 114int {\bf mtext\_\-ncasecmp} ({\bf MText} $\ast$mt1, {\bf MText} $\ast$mt2, int n) 115\begin{CompactList}\small\item\em Compare initial parts of two M-texts ignoring cases. \item\end{CompactList}\item 116int {\bf mtext\_\-case\_\-compare} ({\bf MText} $\ast$mt1, int from1, int to1, {\bf MText} $\ast$mt2, int from2, int to2) 117\begin{CompactList}\small\item\em Compare specified regions of two M-texts ignoring cases. \item\end{CompactList}\item 118int {\bf mtext\_\-lowercase} ({\bf MText} $\ast$mt) 119\begin{CompactList}\small\item\em Lowercase an M-text. \item\end{CompactList}\item 120int {\bf mtext\_\-titlecase} ({\bf MText} $\ast$mt) 121\begin{CompactList}\small\item\em Titlecase an M-text. \item\end{CompactList}\item 122int {\bf mtext\_\-uppercase} ({\bf MText} $\ast$mt) 123\begin{CompactList}\small\item\em Uppercase an M-text. \item\end{CompactList}\end{CompactItemize} 124\subsection*{Variables} 125\begin{CompactItemize} 126\item 127{\bf MSymbol} {\bf Mlanguage} 128\end{CompactItemize} 129 130 131\subsection{Detailed Description} 132M-text objects and API for them. 133 134In the m17n library, text is represented as an object called {\em M-text\/} rather than as a C-string ({\tt char $\ast$} or {\tt unsigned char $\ast$}). An M-text is a sequence of characters whose length is equals to or more than 0, and can be coined from various character sources, e.g. C-strings, files, character codes, etc. 135 136M-texts are more useful than C-strings in the following points. 137 138\begin{itemize} 139\item M-texts can handle mixture of characters of various scripts, including all Unicode characters and more. This is an indispensable facility when handling multilingual text.\end{itemize} 140\begin{itemize} 141\item Each character in an M-text can have properties called {\em text\/} {\em properties\/}. Text properties store various kinds of information attached to parts of an M-text to provide application programs with a unified view of those information. As rich information can be stored in M-texts in the form of text properties, functions in application programs can be simple.\end{itemize} 142In addition, the library provides many functions to manipulate an M-text just the same way as a C-string. 143 144\subsection{Typedef Documentation} 145\index{m17nMtext@{m17nMtext}!MText@{MText}} 146\index{MText@{MText}!m17nMtext@{m17nMtext}} 147\subsubsection[MText]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf MText} {\bf MText}}\label{group__m17nMtext_ge8bba45315c15c8f79ec4a73ebc52aec} 148 149 150Type of {\em M-texts\/}. 151 152The type \doxyref{MText}{p.}{group__m17nMtext_ge8bba45315c15c8f79ec4a73ebc52aec} is for an {\em M-text\/} object. Its internal structure is concealed from application programs. 153 154\subsection{Enumeration Type Documentation} 155\index{m17nMtext@{m17nMtext}!MTextFormat@{MTextFormat}} 156\index{MTextFormat@{MTextFormat}!m17nMtext@{m17nMtext}} 157\subsubsection[MTextFormat]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf MTextFormat}}\label{group__m17nMtext_g4148a7a6fd502d4fb4a786d9fdb7da59} 158 159 160Enumeration for specifying the format of an M-text. 161 162The enum \doxyref{MTextFormat}{p.}{group__m17nMtext_g4148a7a6fd502d4fb4a786d9fdb7da59} is used as an argument of the \doxyref{mtext\_\-from\_\-data()}{p.}{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} function to specify the format of data from which an M-text is created. \begin{Desc} 163\item[Enumerator: ]\par 164\begin{description} 165\index{MTEXT\_\-FORMAT\_\-US\_\-ASCII@{MTEXT\_\-FORMAT\_\-US\_\-ASCII}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-US\_\-ASCII@{MTEXT\_\-FORMAT\_\-US\_\-ASCII}}\item[{\em 166MTEXT\_\-FORMAT\_\-US\_\-ASCII\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59d61701eea01de99f3bf3bd57d6b24d38} 167}]US-ASCII encoding \index{MTEXT\_\-FORMAT\_\-UTF\_\-8@{MTEXT\_\-FORMAT\_\-UTF\_\-8}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-8@{MTEXT\_\-FORMAT\_\-UTF\_\-8}}\item[{\em 168MTEXT\_\-FORMAT\_\-UTF\_\-8\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59008391579e58d7110f28d63736178d90} 169}]UTF-8 encoding \index{MTEXT\_\-FORMAT\_\-UTF\_\-16LE@{MTEXT\_\-FORMAT\_\-UTF\_\-16LE}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-16LE@{MTEXT\_\-FORMAT\_\-UTF\_\-16LE}}\item[{\em 170MTEXT\_\-FORMAT\_\-UTF\_\-16LE\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5942252ef5d95a78cc719768d0fa3ce209} 171}]UTF-16LE encoding \index{MTEXT\_\-FORMAT\_\-UTF\_\-16BE@{MTEXT\_\-FORMAT\_\-UTF\_\-16BE}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-16BE@{MTEXT\_\-FORMAT\_\-UTF\_\-16BE}}\item[{\em 172MTEXT\_\-FORMAT\_\-UTF\_\-16BE\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59ab2d4798020fd8edb35089be48170cee} 173}]UTF-16BE encoding \index{MTEXT\_\-FORMAT\_\-UTF\_\-32LE@{MTEXT\_\-FORMAT\_\-UTF\_\-32LE}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-32LE@{MTEXT\_\-FORMAT\_\-UTF\_\-32LE}}\item[{\em 174MTEXT\_\-FORMAT\_\-UTF\_\-32LE\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5979785b67787c6ca1e9c415a2d76df1be} 175}]UTF-32LE encoding \index{MTEXT\_\-FORMAT\_\-UTF\_\-32BE@{MTEXT\_\-FORMAT\_\-UTF\_\-32BE}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-32BE@{MTEXT\_\-FORMAT\_\-UTF\_\-32BE}}\item[{\em 176MTEXT\_\-FORMAT\_\-UTF\_\-32BE\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5907b67ef89723794acb1ba743a30a79ef} 177}]UTF-32BE encoding \index{MTEXT\_\-FORMAT\_\-MAX@{MTEXT\_\-FORMAT\_\-MAX}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-MAX@{MTEXT\_\-FORMAT\_\-MAX}}\item[{\em 178MTEXT\_\-FORMAT\_\-MAX\label{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da593edc8bb21d072d3ff41447f42ac13ad2} 179}]\end{description} 180\end{Desc} 181 182\index{m17nMtext@{m17nMtext}!MTextLineBreakOption@{MTextLineBreakOption}} 183\index{MTextLineBreakOption@{MTextLineBreakOption}!m17nMtext@{m17nMtext}} 184\subsubsection[MTextLineBreakOption]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf MTextLineBreakOption}}\label{group__m17nMtext_g23c3bd3e53aa9ba5aec709a939865022} 185 186 187Enumeration for specifying a set of line breaking option. 188 189The enum \doxyref{MTextLineBreakOption}{p.}{group__m17nMtext_g23c3bd3e53aa9ba5aec709a939865022} is to control the line breaking algorithm of the function \doxyref{mtext\_\-line\_\-break()}{p.}{group__m17nMtext_g0d1fa6a2b4c0630b9524d900cd4aab70} by specifying logical-or of the members in the arg {\em option\/}. \begin{Desc} 190\item[Enumerator: ]\par 191\begin{description} 192\index{MTEXT\_\-LBO\_\-SP\_\-CM@{MTEXT\_\-LBO\_\-SP\_\-CM}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-LBO\_\-SP\_\-CM@{MTEXT\_\-LBO\_\-SP\_\-CM}}\item[{\em 193MTEXT\_\-LBO\_\-SP\_\-CM\label{group__m17nMtext_gg23c3bd3e53aa9ba5aec709a939865022e88167377a944d4c84a1a89729aef111} 194}]Specify the legacy support for space character as base for combining marks. See the section 8.3 of UAX\#14. \index{MTEXT\_\-LBO\_\-KOREAN\_\-SP@{MTEXT\_\-LBO\_\-KOREAN\_\-SP}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-LBO\_\-KOREAN\_\-SP@{MTEXT\_\-LBO\_\-KOREAN\_\-SP}}\item[{\em 195MTEXT\_\-LBO\_\-KOREAN\_\-SP\label{group__m17nMtext_gg23c3bd3e53aa9ba5aec709a9398650227866ca91fdc6b955b14637d911e9b3d5} 196}]Specify to use space characters for line breaking Korean text. \index{MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID@{MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID@{MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID}}\item[{\em 197MTEXT\_\-LBO\_\-AI\_\-AS\_\-ID\label{group__m17nMtext_gg23c3bd3e53aa9ba5aec709a9398650222a5299f48bbbd8b87766cbf889495fb9} 198}]Specify to treat characters of ambiguous line-breaking class as of ideographic line-breaking class. \index{MTEXT\_\-LBO\_\-MAX@{MTEXT\_\-LBO\_\-MAX}!m17nMtext@{m17nMtext}}\index{m17nMtext@{m17nMtext}!MTEXT\_\-LBO\_\-MAX@{MTEXT\_\-LBO\_\-MAX}}\item[{\em 199MTEXT\_\-LBO\_\-MAX\label{group__m17nMtext_gg23c3bd3e53aa9ba5aec709a939865022857141ca578c6e94548264c01a8e3d42} 200}]\end{description} 201\end{Desc} 202 203 204 205\subsection{Function Documentation} 206\index{m17nMtext@{m17nMtext}!mtext\_\-line\_\-break@{mtext\_\-line\_\-break}} 207\index{mtext\_\-line\_\-break@{mtext\_\-line\_\-break}!m17nMtext@{m17nMtext}} 208\subsubsection[mtext\_\-line\_\-break]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-line\_\-break ({\bf MText} $\ast$ {\em mt}, \/ int {\em pos}, \/ int {\em option}, \/ int $\ast$ {\em after})}\label{group__m17nMtext_g0d1fa6a2b4c0630b9524d900cd4aab70} 209 210 211Find a linebreak postion of an M-text. 212 213The \doxyref{mtext\_\-line\_\-break()}{p.}{group__m17nMtext_g0d1fa6a2b4c0630b9524d900cd4aab70} function checks if position {\bf pos} is a proper linebreak position of an M-text {\bf mt} according to the algorithm of The Unicode Standard 4.0 UAX\#14. It so, it returns {\bf pos}. Otherwise, it returns a proper linebreak position before {\bf pos}. 214 215If {\bf option} is nonzero, it controls the algorithm by logical-or of the members of \doxyref{MTextLineBreakOption}{p.}{group__m17nMtext_g23c3bd3e53aa9ba5aec709a939865022}. 216 217If {\bf after} is not NULL, a proper linebreak position after {\bf pos} is stored there. \index{m17nMtext@{m17nMtext}!mtext@{mtext}} 218\index{mtext@{mtext}!m17nMtext@{m17nMtext}} 219\subsubsection[mtext]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext ()}\label{group__m17nMtext_g1a82c0d7283e62698119ac9c46b3fa8a} 220 221 222Allocate a new M-text. 223 224The \doxyref{mtext()}{p.}{group__m17nMtext_g1a82c0d7283e62698119ac9c46b3fa8a} function allocates a new M-text of length 0 and returns a pointer to it. The allocated M-text will not be freed unless the user explicitly does so with the \doxyref{m17n\_\-object\_\-unref()}{p.}{group__m17nObject_g248ba287a615a2cf3cdb99c13275453b} function. 225 226\begin{Desc} 227\item[See Also:]\doxyref{m17n\_\-object\_\-unref()}{p.}{group__m17nObject_g248ba287a615a2cf3cdb99c13275453b} \end{Desc} 228\index{m17nMtext@{m17nMtext}!mtext\_\-from\_\-data@{mtext\_\-from\_\-data}} 229\index{mtext\_\-from\_\-data@{mtext\_\-from\_\-data}!m17nMtext@{m17nMtext}} 230\subsubsection[mtext\_\-from\_\-data]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-from\_\-data (const void $\ast$ {\em data}, \/ int {\em nitems}, \/ enum {\bf MTextFormat} {\em format})}\label{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} 231 232 233Allocate a new M-text with specified data. 234 235The \doxyref{mtext\_\-from\_\-data()}{p.}{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} function allocates a new M-text whose character sequence is specified by array {\bf data} of {\bf nitems} elements. {\bf format} specifies the format of {\bf data}. 236 237When {\bf format} is either \doxyref{MTEXT\_\-FORMAT\_\-US\_\-ASCII}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59d61701eea01de99f3bf3bd57d6b24d38} or \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-8}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59008391579e58d7110f28d63736178d90}, the contents of {\bf data} must be of the type {\tt unsigned} {\tt char}, and {\bf nitems} counts by byte. 238 239When {\bf format} is either \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-16LE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5942252ef5d95a78cc719768d0fa3ce209} or \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-16BE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59ab2d4798020fd8edb35089be48170cee}, the contents of {\bf data} must be of the type {\tt unsigned} {\tt short}, and {\bf nitems} counts by unsigned short. 240 241When {\bf format} is either \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-32LE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5979785b67787c6ca1e9c415a2d76df1be} or \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-32BE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5907b67ef89723794acb1ba743a30a79ef}, the contents of {\bf data} must be of the type {\tt unsigned}, and {\bf nitems} counts by unsigned. 242 243The character sequence of the M-text is not modifiable. The contents of {\bf data} must not be modified while the M-text is alive. 244 245The allocated M-text will not be freed unless the user explicitly does so with the \doxyref{m17n\_\-object\_\-unref()}{p.}{group__m17nObject_g248ba287a615a2cf3cdb99c13275453b} function. Even in that case, {\bf data} is not freed. 246 247\begin{Desc} 248\item[Return value:]If the operation was successful, \doxyref{mtext\_\-from\_\-data()}{p.}{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} returns a pointer to the allocated M-text. Otherwise it returns {\tt NULL} and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 249\begin{Desc} 250\item[Errors:]{\tt MERROR\_\-MTEXT} \end{Desc} 251\index{m17nMtext@{m17nMtext}!mtext\_\-data@{mtext\_\-data}} 252\index{mtext\_\-data@{mtext\_\-data}!m17nMtext@{m17nMtext}} 253\subsubsection[mtext\_\-data]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ mtext\_\-data ({\bf MText} $\ast$ {\em mt}, \/ enum {\bf MTextFormat} $\ast$ {\em fmt}, \/ int $\ast$ {\em nunits}, \/ int $\ast$ {\em pos\_\-idx}, \/ int $\ast$ {\em unit\_\-idx})}\label{group__m17nMtext_g58dfc38b90385749199caa5e6bc10ec4} 254 255 256Get information about the text data in M-text. 257 258The \doxyref{mtext\_\-data()}{p.}{group__m17nMtext_g58dfc38b90385749199caa5e6bc10ec4} function returns a pointer to the text data of M-text {\bf mt}. If {\bf fmt} is not NULL, the format of the text data is stored in it. If {\bf nunits} is not NULL, the number of units of the text data is stored in it. 259 260If {\bf pos\_\-idx} is not NULL and it points to a non-negative number, what it points to is a character position. In this case, the return value is a pointer to the text data of a character at that position. 261 262Otherwise, if {\bf unit\_\-idx} is not NULL, it points to a unit position. In this case, the return value is a pointer to the text data of a character containing that unit. 263 264The character position and unit position of the return value are stored in {\bf pos\_\-idx} and {\bf unit\_\-dix} respectively if they are not NULL. 265 266\begin{itemize} 267\item If the format of the text data is MTEXT\_\-FORMAT\_\-US\_\-ASCII or MTEXT\_\-FORMAT\_\-UTF\_\-8, one unit is unsigned char. 268 269\item If the format is MTEXT\_\-FORMAT\_\-UTF\_\-16LE or MTEXT\_\-FORMAT\_\-UTF\_\-16BE, one unit is unsigned short. 270 271\item If the format is MTEXT\_\-FORMAT\_\-UTF\_\-32LE or MTEXT\_\-FORMAT\_\-UTF\_\-32BE, one unit is unsigned int. 272 273\end{itemize} 274\index{m17nMtext@{m17nMtext}!mtext\_\-len@{mtext\_\-len}} 275\index{mtext\_\-len@{mtext\_\-len}!m17nMtext@{m17nMtext}} 276\subsubsection[mtext\_\-len]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-len ({\bf MText} $\ast$ {\em mt})}\label{group__m17nMtext_g28ea3879a9dae45127bd62499645c7c3} 277 278 279Number of characters in M-text. 280 281The \doxyref{mtext\_\-len()}{p.}{group__m17nMtext_g28ea3879a9dae45127bd62499645c7c3} function returns the number of characters in M-text {\bf mt}. \index{m17nMtext@{m17nMtext}!mtext\_\-ref\_\-char@{mtext\_\-ref\_\-char}} 282\index{mtext\_\-ref\_\-char@{mtext\_\-ref\_\-char}!m17nMtext@{m17nMtext}} 283\subsubsection[mtext\_\-ref\_\-char]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-ref\_\-char ({\bf MText} $\ast$ {\em mt}, \/ int {\em pos})}\label{group__m17nMtext_g29fd21f8bd3b80a09628ea2dc62db3e5} 284 285 286Return the character at the specified position in an M-text. 287 288The \doxyref{mtext\_\-ref\_\-char()}{p.}{group__m17nMtext_g29fd21f8bd3b80a09628ea2dc62db3e5} function returns the character at {\bf pos} in M-text {\bf mt}. If an error is detected, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}. 289 290\begin{Desc} 291\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 292\index{m17nMtext@{m17nMtext}!mtext\_\-set\_\-char@{mtext\_\-set\_\-char}} 293\index{mtext\_\-set\_\-char@{mtext\_\-set\_\-char}!m17nMtext@{m17nMtext}} 294\subsubsection[mtext\_\-set\_\-char]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-set\_\-char ({\bf MText} $\ast$ {\em mt}, \/ int {\em pos}, \/ int {\em c})}\label{group__m17nMtext_g1378506cd336f1d2029672991ecf8973} 295 296 297Store a character into an M-text. 298 299The \doxyref{mtext\_\-set\_\-char()}{p.}{group__m17nMtext_g1378506cd336f1d2029672991ecf8973} function sets character {\bf c}, which has no text properties, at {\bf pos} in M-text {\bf mt}. 300 301\begin{Desc} 302\item[Return value:]If the operation was successful, \doxyref{mtext\_\-set\_\-char()}{p.}{group__m17nMtext_g1378506cd336f1d2029672991ecf8973} returns 0. Otherwise it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 303\begin{Desc} 304\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 305\index{m17nMtext@{m17nMtext}!mtext\_\-cat\_\-char@{mtext\_\-cat\_\-char}} 306\index{mtext\_\-cat\_\-char@{mtext\_\-cat\_\-char}!m17nMtext@{m17nMtext}} 307\subsubsection[mtext\_\-cat\_\-char]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-cat\_\-char ({\bf MText} $\ast$ {\em mt}, \/ int {\em c})}\label{group__m17nMtext_g21036a5bc066530f7cf9196fbb568efd} 308 309 310Append a character to an M-text. 311 312The \doxyref{mtext\_\-cat\_\-char()}{p.}{group__m17nMtext_g21036a5bc066530f7cf9196fbb568efd} function appends character {\bf c}, which has no text properties, to the end of M-text {\bf mt}. 313 314\begin{Desc} 315\item[Return value:]This function returns a pointer to the resulting M-text {\bf mt}. If {\bf c} is an invalid character, it returns {\tt NULL}.\end{Desc} 316\begin{Desc} 317\item[See Also:]\doxyref{mtext\_\-cat()}{p.}{group__m17nMtext_gf0a0af628d6e4d69fbacea149885a72d}, \doxyref{mtext\_\-ncat()}{p.}{group__m17nMtext_gfd2fa9c1080067533e584e92ebe15f5c} \end{Desc} 318\index{m17nMtext@{m17nMtext}!mtext\_\-dup@{mtext\_\-dup}} 319\index{mtext\_\-dup@{mtext\_\-dup}!m17nMtext@{m17nMtext}} 320\subsubsection[mtext\_\-dup]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-dup ({\bf MText} $\ast$ {\em mt})}\label{group__m17nMtext_gcd7bdc22fa2aacc6cfb3630697e6d3f9} 321 322 323Create a copy of an M-text. 324 325The \doxyref{mtext\_\-dup()}{p.}{group__m17nMtext_gcd7bdc22fa2aacc6cfb3630697e6d3f9} function creates a copy of M-text {\bf mt} while inheriting all the text properties of {\bf mt}. 326 327\begin{Desc} 328\item[Return value:]This function returns a pointer to the created copy.\end{Desc} 329\begin{Desc} 330\item[See Also:]\doxyref{mtext\_\-duplicate()}{p.}{group__m17nMtext_g2349c5cda40d1880c0c560be4c69c911} \end{Desc} 331\index{m17nMtext@{m17nMtext}!mtext\_\-cat@{mtext\_\-cat}} 332\index{mtext\_\-cat@{mtext\_\-cat}!m17nMtext@{m17nMtext}} 333\subsubsection[mtext\_\-cat]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-cat ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_gf0a0af628d6e4d69fbacea149885a72d} 334 335 336Append an M-text to another. 337 338The \doxyref{mtext\_\-cat()}{p.}{group__m17nMtext_gf0a0af628d6e4d69fbacea149885a72d} function appends M-text {\bf mt2} to the end of M-text {\bf mt1} while inheriting all the text properties. {\bf mt2} itself is not modified. 339 340\begin{Desc} 341\item[Return value:]This function returns a pointer to the resulting M-text {\bf mt1}.\end{Desc} 342\begin{Desc} 343\item[See Also:]\doxyref{mtext\_\-ncat()}{p.}{group__m17nMtext_gfd2fa9c1080067533e584e92ebe15f5c}, \doxyref{mtext\_\-cat\_\-char()}{p.}{group__m17nMtext_g21036a5bc066530f7cf9196fbb568efd} \end{Desc} 344\index{m17nMtext@{m17nMtext}!mtext\_\-ncat@{mtext\_\-ncat}} 345\index{mtext\_\-ncat@{mtext\_\-ncat}!m17nMtext@{m17nMtext}} 346\subsubsection[mtext\_\-ncat]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-ncat ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em n})}\label{group__m17nMtext_gfd2fa9c1080067533e584e92ebe15f5c} 347 348 349Append a part of an M-text to another. 350 351The \doxyref{mtext\_\-ncat()}{p.}{group__m17nMtext_gfd2fa9c1080067533e584e92ebe15f5c} function appends the first {\bf n} characters of M-text {\bf mt2} to the end of M-text {\bf mt1} while inheriting all the text properties. If the length of {\bf mt2} is less than {\bf n}, all characters are copied. {\bf mt2} is not modified. 352 353\begin{Desc} 354\item[Return value: ]If the operation was successful, \doxyref{mtext\_\-ncat()}{p.}{group__m17nMtext_gfd2fa9c1080067533e584e92ebe15f5c} returns a pointer to the resulting M-text {\bf mt1}. If an error is detected, it returns {\tt NULL} and assigns an error code to the global variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 355\begin{Desc} 356\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 357\begin{Desc} 358\item[See Also:]\doxyref{mtext\_\-cat()}{p.}{group__m17nMtext_gf0a0af628d6e4d69fbacea149885a72d}, \doxyref{mtext\_\-cat\_\-char()}{p.}{group__m17nMtext_g21036a5bc066530f7cf9196fbb568efd} \end{Desc} 359\index{m17nMtext@{m17nMtext}!mtext\_\-cpy@{mtext\_\-cpy}} 360\index{mtext\_\-cpy@{mtext\_\-cpy}!m17nMtext@{m17nMtext}} 361\subsubsection[mtext\_\-cpy]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-cpy ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_ga9f56201d62d4f39e8a64b4460450ba4} 362 363 364Copy an M-text to another. 365 366The \doxyref{mtext\_\-cpy()}{p.}{group__m17nMtext_ga9f56201d62d4f39e8a64b4460450ba4} function copies M-text {\bf mt2} to M-text {\bf mt1} while inheriting all the text properties. The old text in {\bf mt1} is overwritten and the length of {\bf mt1} is extended if necessary. {\bf mt2} is not modified. 367 368\begin{Desc} 369\item[Return value:]This function returns a pointer to the resulting M-text {\bf mt1}.\end{Desc} 370\begin{Desc} 371\item[See Also:]\doxyref{mtext\_\-ncpy()}{p.}{group__m17nMtext_g83df72acd6f78cec009b642e0afdcfee}, \doxyref{mtext\_\-copy()}{p.}{group__m17nMtext_g45dcea52c2d59bcd129af5e8323593cf} \end{Desc} 372\index{m17nMtext@{m17nMtext}!mtext\_\-ncpy@{mtext\_\-ncpy}} 373\index{mtext\_\-ncpy@{mtext\_\-ncpy}!m17nMtext@{m17nMtext}} 374\subsubsection[mtext\_\-ncpy]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-ncpy ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em n})}\label{group__m17nMtext_g83df72acd6f78cec009b642e0afdcfee} 375 376 377Copy the first some characters in an M-text to another. 378 379The \doxyref{mtext\_\-ncpy()}{p.}{group__m17nMtext_g83df72acd6f78cec009b642e0afdcfee} function copies the first {\bf n} characters of M-text {\bf mt2} to M-text {\bf mt1} while inheriting all the text properties. If the length of {\bf mt2} is less than {\bf n}, all characters of {\bf mt2} are copied. The old text in {\bf mt1} is overwritten and the length of {\bf mt1} is extended if necessary. {\bf mt2} is not modified. 380 381\begin{Desc} 382\item[Return value:]If the operation was successful, \doxyref{mtext\_\-ncpy()}{p.}{group__m17nMtext_g83df72acd6f78cec009b642e0afdcfee} returns a pointer to the resulting M-text {\bf mt1}. If an error is detected, it returns {\tt NULL} and assigns an error code to the global variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 383\begin{Desc} 384\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 385\begin{Desc} 386\item[See Also:]\doxyref{mtext\_\-cpy()}{p.}{group__m17nMtext_ga9f56201d62d4f39e8a64b4460450ba4}, \doxyref{mtext\_\-copy()}{p.}{group__m17nMtext_g45dcea52c2d59bcd129af5e8323593cf} \end{Desc} 387\index{m17nMtext@{m17nMtext}!mtext\_\-duplicate@{mtext\_\-duplicate}} 388\index{mtext\_\-duplicate@{mtext\_\-duplicate}!m17nMtext@{m17nMtext}} 389\subsubsection[mtext\_\-duplicate]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-duplicate ({\bf MText} $\ast$ {\em mt}, \/ int {\em from}, \/ int {\em to})}\label{group__m17nMtext_g2349c5cda40d1880c0c560be4c69c911} 390 391 392Create a new M-text from a part of an existing M-text. 393 394The \doxyref{mtext\_\-duplicate()}{p.}{group__m17nMtext_g2349c5cda40d1880c0c560be4c69c911} function creates a copy of sub-text of M-text {\bf mt}, starting at {\bf from} (inclusive) and ending at {\bf to} (exclusive) while inheriting all the text properties of {\bf mt}. {\bf mt} itself is not modified. 395 396\begin{Desc} 397\item[Return value: ]If the operation was successful, \doxyref{mtext\_\-duplicate()}{p.}{group__m17nMtext_g2349c5cda40d1880c0c560be4c69c911} returns a pointer to the created M-text. If an error is detected, it returns NULL and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 398\begin{Desc} 399\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 400\begin{Desc} 401\item[See Also:]\doxyref{mtext\_\-dup()}{p.}{group__m17nMtext_gcd7bdc22fa2aacc6cfb3630697e6d3f9} \end{Desc} 402\index{m17nMtext@{m17nMtext}!mtext\_\-copy@{mtext\_\-copy}} 403\index{mtext\_\-copy@{mtext\_\-copy}!m17nMtext@{m17nMtext}} 404\subsubsection[mtext\_\-copy]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-copy ({\bf MText} $\ast$ {\em mt1}, \/ int {\em pos}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em from}, \/ int {\em to})}\label{group__m17nMtext_g45dcea52c2d59bcd129af5e8323593cf} 405 406 407Copy characters in the specified range into an M-text. 408 409The \doxyref{mtext\_\-copy()}{p.}{group__m17nMtext_g45dcea52c2d59bcd129af5e8323593cf} function copies the text between {\bf from} (inclusive) and {\bf to} (exclusive) in M-text {\bf mt2} to the region starting at {\bf pos} in M-text {\bf mt1} while inheriting the text properties. The old text in {\bf mt1} is overwritten and the length of {\bf mt1} is extended if necessary. {\bf mt2} is not modified. 410 411\begin{Desc} 412\item[Return value:]If the operation was successful, \doxyref{mtext\_\-copy()}{p.}{group__m17nMtext_g45dcea52c2d59bcd129af5e8323593cf} returns a pointer to the modified {\bf mt1}. Otherwise, it returns {\tt NULL} and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 413\begin{Desc} 414\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 415\begin{Desc} 416\item[See Also:]\doxyref{mtext\_\-cpy()}{p.}{group__m17nMtext_ga9f56201d62d4f39e8a64b4460450ba4}, \doxyref{mtext\_\-ncpy()}{p.}{group__m17nMtext_g83df72acd6f78cec009b642e0afdcfee} \end{Desc} 417\index{m17nMtext@{m17nMtext}!mtext\_\-del@{mtext\_\-del}} 418\index{mtext\_\-del@{mtext\_\-del}!m17nMtext@{m17nMtext}} 419\subsubsection[mtext\_\-del]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-del ({\bf MText} $\ast$ {\em mt}, \/ int {\em from}, \/ int {\em to})}\label{group__m17nMtext_g592d9cfe5c76ee384568c053ad7ea8b5} 420 421 422Delete characters in the specified range destructively. 423 424The \doxyref{mtext\_\-del()}{p.}{group__m17nMtext_g592d9cfe5c76ee384568c053ad7ea8b5} function deletes the characters in the range {\bf from} (inclusive) and {\bf to} (exclusive) from M-text {\bf mt} destructively. As a result, the length of {\bf mt} shrinks by ({\bf to} - {\bf from}) characters. 425 426\begin{Desc} 427\item[Return value:]If the operation was successful, \doxyref{mtext\_\-del()}{p.}{group__m17nMtext_g592d9cfe5c76ee384568c053ad7ea8b5} returns 0. Otherwise, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 428\begin{Desc} 429\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 430\begin{Desc} 431\item[See Also:]\doxyref{mtext\_\-ins()}{p.}{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} \end{Desc} 432\index{m17nMtext@{m17nMtext}!mtext\_\-ins@{mtext\_\-ins}} 433\index{mtext\_\-ins@{mtext\_\-ins}!m17nMtext@{m17nMtext}} 434\subsubsection[mtext\_\-ins]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-ins ({\bf MText} $\ast$ {\em mt1}, \/ int {\em pos}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} 435 436 437Insert an M-text into another M-text. 438 439The \doxyref{mtext\_\-ins()}{p.}{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} function inserts M-text {\bf mt2} into M-text {\bf mt1}, at position {\bf pos}. As a result, {\bf mt1} is lengthen by the length of {\bf mt2}. On insertion, all the text properties of {\bf mt2} are inherited. The original {\bf mt2} is not modified. 440 441\begin{Desc} 442\item[Return value:]If the operation was successful, \doxyref{mtext\_\-ins()}{p.}{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} returns 0. Otherwise, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 443\begin{Desc} 444\item[Errors:]{\tt MERROR\_\-RANGE} , {\tt MERROR\_\-MTEXT} \end{Desc} 445\begin{Desc} 446\item[See Also:]\doxyref{mtext\_\-del()}{p.}{group__m17nMtext_g592d9cfe5c76ee384568c053ad7ea8b5} , \doxyref{mtext\_\-insert()}{p.}{group__m17nMtext_g39d820131ec741f5822b206f44dce2df} \end{Desc} 447\index{m17nMtext@{m17nMtext}!mtext\_\-insert@{mtext\_\-insert}} 448\index{mtext\_\-insert@{mtext\_\-insert}!m17nMtext@{m17nMtext}} 449\subsubsection[mtext\_\-insert]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-insert ({\bf MText} $\ast$ {\em mt1}, \/ int {\em pos}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em from}, \/ int {\em to})}\label{group__m17nMtext_g39d820131ec741f5822b206f44dce2df} 450 451 452Insert sub-text of an M-text into another M-text. 453 454The \doxyref{mtext\_\-insert()}{p.}{group__m17nMtext_g39d820131ec741f5822b206f44dce2df} function inserts sub-text of M-text {\bf mt2} between {\bf from} (inclusive) and {\bf to} (exclusive) into M-text {\bf mt1}, at position {\bf pos}. As a result, {\bf mt1} is lengthen by ({\bf to} - {\bf from}). On insertion, all the text properties of the sub-text of {\bf mt2} are inherited. 455 456\begin{Desc} 457\item[Return value: ]If the operation was successful, \doxyref{mtext\_\-insert()}{p.}{group__m17nMtext_g39d820131ec741f5822b206f44dce2df} returns 0. Otherwise, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 458\begin{Desc} 459\item[Errors:]{\tt MERROR\_\-MTEXT} , {\tt MERROR\_\-RANGE} \end{Desc} 460\begin{Desc} 461\item[See Also:]\doxyref{mtext\_\-ins()}{p.}{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} \end{Desc} 462\index{m17nMtext@{m17nMtext}!mtext\_\-ins\_\-char@{mtext\_\-ins\_\-char}} 463\index{mtext\_\-ins\_\-char@{mtext\_\-ins\_\-char}!m17nMtext@{m17nMtext}} 464\subsubsection[mtext\_\-ins\_\-char]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-ins\_\-char ({\bf MText} $\ast$ {\em mt}, \/ int {\em pos}, \/ int {\em c}, \/ int {\em n})}\label{group__m17nMtext_g683d68d84b907bcac211cbdea41c1e70} 465 466 467Insert a character into an M-text. 468 469The \doxyref{mtext\_\-ins\_\-char()}{p.}{group__m17nMtext_g683d68d84b907bcac211cbdea41c1e70} function inserts {\bf n} copies of character {\bf c} into M-text {\bf mt} at position {\bf pos}. As a result, {\bf mt} is lengthen by {\bf n}. 470 471\begin{Desc} 472\item[Return value:]If the operation was successful, \doxyref{mtext\_\-ins()}{p.}{group__m17nMtext_g38ed0e4b19ec03ad6d522ab433acde4e} returns 0. Otherwise, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 473\begin{Desc} 474\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 475\begin{Desc} 476\item[See Also:]mtext\_\-ins, \doxyref{mtext\_\-del()}{p.}{group__m17nMtext_g592d9cfe5c76ee384568c053ad7ea8b5} \end{Desc} 477\index{m17nMtext@{m17nMtext}!mtext\_\-replace@{mtext\_\-replace}} 478\index{mtext\_\-replace@{mtext\_\-replace}!m17nMtext@{m17nMtext}} 479\subsubsection[mtext\_\-replace]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-replace ({\bf MText} $\ast$ {\em mt1}, \/ int {\em from1}, \/ int {\em to1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em from2}, \/ int {\em to2})}\label{group__m17nMtext_g715661081379ea5a29e591e6601547ba} 480 481 482Replace sub-text of M-text with another. 483 484The \doxyref{mtext\_\-replace()}{p.}{group__m17nMtext_g715661081379ea5a29e591e6601547ba} function replaces sub-text of M-text {\bf mt1} between {\bf from1} (inclusive) and {\bf to1} (exclusive) with the sub-text of M-text {\bf mt2} between {\bf from2} (inclusive) and {\bf to2} (exclusive). The new sub-text inherits text properties of the old sub-text. 485 486\begin{Desc} 487\item[Return value: ]If the operation was successful, \doxyref{mtext\_\-replace()}{p.}{group__m17nMtext_g715661081379ea5a29e591e6601547ba} returns 0. Otherwise, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 488\begin{Desc} 489\item[Errors:]{\tt MERROR\_\-MTEXT} , {\tt MERROR\_\-RANGE} \end{Desc} 490\begin{Desc} 491\item[See Also:]\doxyref{mtext\_\-insert()}{p.}{group__m17nMtext_g39d820131ec741f5822b206f44dce2df} \end{Desc} 492\index{m17nMtext@{m17nMtext}!mtext\_\-character@{mtext\_\-character}} 493\index{mtext\_\-character@{mtext\_\-character}!m17nMtext@{m17nMtext}} 494\subsubsection[mtext\_\-character]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-character ({\bf MText} $\ast$ {\em mt}, \/ int {\em from}, \/ int {\em to}, \/ int {\em c})}\label{group__m17nMtext_g8b8d4053c6c7bc47507bad39f3d332f2} 495 496 497Search a character in an M-text. 498 499The \doxyref{mtext\_\-character()}{p.}{group__m17nMtext_g8b8d4053c6c7bc47507bad39f3d332f2} function searches M-text {\bf mt} for character {\bf c}. If {\bf from} is less than {\bf to}, the search begins at position {\bf from} and goes forward but does not exceed ({\bf to} - 1). Otherwise, the search begins at position ({\bf from} - 1) and goes backward but does not exceed {\bf to}. An invalid position specification is regarded as both {\bf from} and {\bf to} being 0. 500 501\begin{Desc} 502\item[Return value:]If {\bf c} is found, \doxyref{mtext\_\-character()}{p.}{group__m17nMtext_g8b8d4053c6c7bc47507bad39f3d332f2} returns the position of its first occurrence. Otherwise it returns -1 without changing the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}. If an error is detected, it returns -1 and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 503\begin{Desc} 504\item[See Also:]\doxyref{mtext\_\-chr()}{p.}{group__m17nMtext_g7d3f44053118699084e94f1e8493c787}, \doxyref{mtext\_\-rchr()}{p.}{group__m17nMtext_gbb69a4f045cb215091e8cb02f491f4fd} \end{Desc} 505\index{m17nMtext@{m17nMtext}!mtext\_\-chr@{mtext\_\-chr}} 506\index{mtext\_\-chr@{mtext\_\-chr}!m17nMtext@{m17nMtext}} 507\subsubsection[mtext\_\-chr]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-chr ({\bf MText} $\ast$ {\em mt}, \/ int {\em c})}\label{group__m17nMtext_g7d3f44053118699084e94f1e8493c787} 508 509 510Return the position of the first occurrence of a character in an M-text. 511 512The \doxyref{mtext\_\-chr()}{p.}{group__m17nMtext_g7d3f44053118699084e94f1e8493c787} function searches M-text {\bf mt} for character {\bf c}. The search starts from the beginning of {\bf mt} and goes toward the end. 513 514\begin{Desc} 515\item[Return value:]If {\bf c} is found, \doxyref{mtext\_\-chr()}{p.}{group__m17nMtext_g7d3f44053118699084e94f1e8493c787} returns its position; otherwise it returns -1.\end{Desc} 516\begin{Desc} 517\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 518\begin{Desc} 519\item[See Also:]\doxyref{mtext\_\-rchr()}{p.}{group__m17nMtext_gbb69a4f045cb215091e8cb02f491f4fd}, \doxyref{mtext\_\-character()}{p.}{group__m17nMtext_g8b8d4053c6c7bc47507bad39f3d332f2} \end{Desc} 520\index{m17nMtext@{m17nMtext}!mtext\_\-rchr@{mtext\_\-rchr}} 521\index{mtext\_\-rchr@{mtext\_\-rchr}!m17nMtext@{m17nMtext}} 522\subsubsection[mtext\_\-rchr]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-rchr ({\bf MText} $\ast$ {\em mt}, \/ int {\em c})}\label{group__m17nMtext_gbb69a4f045cb215091e8cb02f491f4fd} 523 524 525Return the position of the last occurrence of a character in an M-text. 526 527The \doxyref{mtext\_\-rchr()}{p.}{group__m17nMtext_gbb69a4f045cb215091e8cb02f491f4fd} function searches M-text {\bf mt} for character {\bf c}. The search starts from the end of {\bf mt} and goes backwardly toward the beginning. 528 529\begin{Desc} 530\item[Return value:]If {\bf c} is found, \doxyref{mtext\_\-rchr()}{p.}{group__m17nMtext_gbb69a4f045cb215091e8cb02f491f4fd} returns its position; otherwise it returns -1.\end{Desc} 531\begin{Desc} 532\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 533\begin{Desc} 534\item[See Also:]\doxyref{mtext\_\-chr()}{p.}{group__m17nMtext_g7d3f44053118699084e94f1e8493c787}, \doxyref{mtext\_\-character()}{p.}{group__m17nMtext_g8b8d4053c6c7bc47507bad39f3d332f2} \end{Desc} 535\index{m17nMtext@{m17nMtext}!mtext\_\-cmp@{mtext\_\-cmp}} 536\index{mtext\_\-cmp@{mtext\_\-cmp}!m17nMtext@{m17nMtext}} 537\subsubsection[mtext\_\-cmp]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-cmp ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb} 538 539 540Compare two M-texts character-by-character. 541 542The \doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb} function compares M-texts {\bf mt1} and {\bf mt2} character by character. 543 544\begin{Desc} 545\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively. Comparison is based on character codes.\end{Desc} 546\begin{Desc} 547\item[See Also:]\doxyref{mtext\_\-ncmp()}{p.}{group__m17nMtext_g23fa60794f929caca8c73abebac241cf}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9}, \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434}, \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} \end{Desc} 548\index{m17nMtext@{m17nMtext}!mtext\_\-ncmp@{mtext\_\-ncmp}} 549\index{mtext\_\-ncmp@{mtext\_\-ncmp}!m17nMtext@{m17nMtext}} 550\subsubsection[mtext\_\-ncmp]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-ncmp ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em n})}\label{group__m17nMtext_g23fa60794f929caca8c73abebac241cf} 551 552 553Compare initial parts of two M-texts character-by-character. 554 555The \doxyref{mtext\_\-ncmp()}{p.}{group__m17nMtext_g23fa60794f929caca8c73abebac241cf} function is similar to \doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, but compares at most {\bf n} characters from the beginning. 556 557\begin{Desc} 558\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively.\end{Desc} 559\begin{Desc} 560\item[See Also:]\doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9} \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434}, \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} \end{Desc} 561\index{m17nMtext@{m17nMtext}!mtext\_\-compare@{mtext\_\-compare}} 562\index{mtext\_\-compare@{mtext\_\-compare}!m17nMtext@{m17nMtext}} 563\subsubsection[mtext\_\-compare]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-compare ({\bf MText} $\ast$ {\em mt1}, \/ int {\em from1}, \/ int {\em to1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em from2}, \/ int {\em to2})}\label{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434} 564 565 566Compare specified regions of two M-texts. 567 568The \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434} function compares two M-texts {\bf mt1} and {\bf mt2}, character-by-character. The compared regions are between {\bf from1} and {\bf to1} in {\bf mt1} and {\bf from2} to {\bf to2} in MT2. {\bf from1} and {\bf from2} are inclusive, {\bf to1} and {\bf to2} are exclusive. {\bf from1} being equal to {\bf to1} (or {\bf from2} being equal to {\bf to2}) means an M-text of length zero. An invalid region specification is regarded as both {\bf from1} and {\bf to1} (or {\bf from2} and {\bf to2}) being 0. 569 570\begin{Desc} 571\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively. Comparison is based on character codes.\end{Desc} 572\begin{Desc} 573\item[See Also:]\doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, \doxyref{mtext\_\-ncmp()}{p.}{group__m17nMtext_g23fa60794f929caca8c73abebac241cf}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9}, \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} \end{Desc} 574\index{m17nMtext@{m17nMtext}!mtext\_\-spn@{mtext\_\-spn}} 575\index{mtext\_\-spn@{mtext\_\-spn}!m17nMtext@{m17nMtext}} 576\subsubsection[mtext\_\-spn]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-spn ({\bf MText} $\ast$ {\em mt}, \/ {\bf MText} $\ast$ {\em accept})}\label{group__m17nMtext_gaa4ce420a94b2e407ad388fc9141af7a} 577 578 579Search an M-text for a set of characters. 580 581The \doxyref{mtext\_\-spn()}{p.}{group__m17nMtext_gaa4ce420a94b2e407ad388fc9141af7a} function returns the length of the initial segment of M-text {\bf mt1} that consists entirely of characters in M-text {\bf mt2}. 582 583\begin{Desc} 584\item[See Also:]\doxyref{mtext\_\-cspn()}{p.}{group__m17nMtext_gd4ed9687e60b2cb6f363b244bb756ac8} \end{Desc} 585\index{m17nMtext@{m17nMtext}!mtext\_\-cspn@{mtext\_\-cspn}} 586\index{mtext\_\-cspn@{mtext\_\-cspn}!m17nMtext@{m17nMtext}} 587\subsubsection[mtext\_\-cspn]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-cspn ({\bf MText} $\ast$ {\em mt}, \/ {\bf MText} $\ast$ {\em reject})}\label{group__m17nMtext_gd4ed9687e60b2cb6f363b244bb756ac8} 588 589 590Search an M-text for the complement of a set of characters. 591 592The \doxyref{mtext\_\-cspn()}{p.}{group__m17nMtext_gd4ed9687e60b2cb6f363b244bb756ac8} returns the length of the initial segment of M-text {\bf mt1} that consists entirely of characters not in M-text {\bf mt2}. 593 594\begin{Desc} 595\item[See Also:]\doxyref{mtext\_\-spn()}{p.}{group__m17nMtext_gaa4ce420a94b2e407ad388fc9141af7a} \end{Desc} 596\index{m17nMtext@{m17nMtext}!mtext\_\-pbrk@{mtext\_\-pbrk}} 597\index{mtext\_\-pbrk@{mtext\_\-pbrk}!m17nMtext@{m17nMtext}} 598\subsubsection[mtext\_\-pbrk]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-pbrk ({\bf MText} $\ast$ {\em mt}, \/ {\bf MText} $\ast$ {\em accept})}\label{group__m17nMtext_g9f1ba03d5415f9161c02bc02c5341323} 599 600 601Search an M-text for any of a set of characters. 602 603The \doxyref{mtext\_\-pbrk()}{p.}{group__m17nMtext_g9f1ba03d5415f9161c02bc02c5341323} function locates the first occurrence in M-text {\bf mt1} of any of the characters in M-text {\bf mt2}. 604 605\begin{Desc} 606\item[Return value:]This function returns the position in {\bf mt1} of the found character. If no such character is found, it returns -1. \end{Desc} 607\index{m17nMtext@{m17nMtext}!mtext\_\-tok@{mtext\_\-tok}} 608\index{mtext\_\-tok@{mtext\_\-tok}!m17nMtext@{m17nMtext}} 609\subsubsection[mtext\_\-tok]{\setlength{\rightskip}{0pt plus 5cm}{\bf MText}$\ast$ mtext\_\-tok ({\bf MText} $\ast$ {\em mt}, \/ {\bf MText} $\ast$ {\em delim}, \/ int $\ast$ {\em pos})}\label{group__m17nMtext_gb9ba74b25f75a7395d237f98d43fc50f} 610 611 612Look for a token in an M-text. 613 614The \doxyref{mtext\_\-tok()}{p.}{group__m17nMtext_gb9ba74b25f75a7395d237f98d43fc50f} function searches a token that firstly occurs after position {\bf pos} in M-text {\bf mt}. Here, a token means a substring each of which does not appear in M-text {\bf delim}. Note that the type of {\bf pos} is not {\tt int} but pointer to {\tt int}. 615 616\begin{Desc} 617\item[Return value:]If a token is found, \doxyref{mtext\_\-tok()}{p.}{group__m17nMtext_gb9ba74b25f75a7395d237f98d43fc50f} copies the corresponding part of {\bf mt} and returns a pointer to the copy. In this case, {\bf pos} is set to the end of the found token. If no token is found, it returns {\tt NULL} without changing the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}. If an error is detected, it returns {\tt NULL} and assigns an error code to the external variable \doxyref{merror\_\-code}{p.}{group__m17nError_g995a2e373cfd6a8e5eaca8686b5b0a73}.\end{Desc} 618\begin{Desc} 619\item[Errors:]{\tt MERROR\_\-RANGE} \end{Desc} 620\index{m17nMtext@{m17nMtext}!mtext\_\-text@{mtext\_\-text}} 621\index{mtext\_\-text@{mtext\_\-text}!m17nMtext@{m17nMtext}} 622\subsubsection[mtext\_\-text]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-text ({\bf MText} $\ast$ {\em mt1}, \/ int {\em pos}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_ga8d53b235cd63fb544fa868c8dd00319} 623 624 625Locate an M-text in another. 626 627The \doxyref{mtext\_\-text()}{p.}{group__m17nMtext_ga8d53b235cd63fb544fa868c8dd00319} function finds the first occurrence of M-text {\bf mt2} in M-text {\bf mt1} after the position {\bf pos} while ignoring difference of the text properties. 628 629\begin{Desc} 630\item[Return value:]If {\bf mt2} is found in {\bf mt1}, \doxyref{mtext\_\-text()}{p.}{group__m17nMtext_ga8d53b235cd63fb544fa868c8dd00319} returns the position of it first occurrence. Otherwise it returns -1. If {\bf mt2} is empty, it returns 0. \end{Desc} 631\index{m17nMtext@{m17nMtext}!mtext\_\-search@{mtext\_\-search}} 632\index{mtext\_\-search@{mtext\_\-search}!m17nMtext@{m17nMtext}} 633\subsubsection[mtext\_\-search]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-search ({\bf MText} $\ast$ {\em mt1}, \/ int {\em from}, \/ int {\em to}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_ga2328a6f85eb2f1f0cdbb51c1e09d294} 634 635 636Locate an M-text in a specific range of another. 637 638The \doxyref{mtext\_\-search()}{p.}{group__m17nMtext_ga2328a6f85eb2f1f0cdbb51c1e09d294} function searches for the first occurrence of M-text {\bf mt2} in M-text {\bf mt1} in the region {\bf from} and {\bf to} while ignoring difference of the text properties. If {\bf from} is less than {\bf to}, the forward search starts from {\bf from}, otherwise the backward search starts from {\bf to}. 639 640\begin{Desc} 641\item[Return value:]If {\bf mt2} is found in {\bf mt1}, \doxyref{mtext\_\-search()}{p.}{group__m17nMtext_ga2328a6f85eb2f1f0cdbb51c1e09d294} returns the position of the first occurrence. Otherwise it returns -1. If {\bf mt2} is empty, it returns 0. \end{Desc} 642\index{m17nMtext@{m17nMtext}!mtext\_\-casecmp@{mtext\_\-casecmp}} 643\index{mtext\_\-casecmp@{mtext\_\-casecmp}!m17nMtext@{m17nMtext}} 644\subsubsection[mtext\_\-casecmp]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-casecmp ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2})}\label{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908} 645 646 647Compare two M-texts ignoring cases. 648 649The \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908} function is similar to \doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, but ignores cases on comparison. 650 651\begin{Desc} 652\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively.\end{Desc} 653\begin{Desc} 654\item[See Also:]\doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, \doxyref{mtext\_\-ncmp()}{p.}{group__m17nMtext_g23fa60794f929caca8c73abebac241cf}, \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9} \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434}, \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} \end{Desc} 655\index{m17nMtext@{m17nMtext}!mtext\_\-ncasecmp@{mtext\_\-ncasecmp}} 656\index{mtext\_\-ncasecmp@{mtext\_\-ncasecmp}!m17nMtext@{m17nMtext}} 657\subsubsection[mtext\_\-ncasecmp]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-ncasecmp ({\bf MText} $\ast$ {\em mt1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em n})}\label{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9} 658 659 660Compare initial parts of two M-texts ignoring cases. 661 662The \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9} function is similar to \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, but compares at most {\bf n} characters from the beginning. 663 664\begin{Desc} 665\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively.\end{Desc} 666\begin{Desc} 667\item[See Also:]\doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908} \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434}, \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} \end{Desc} 668\index{m17nMtext@{m17nMtext}!mtext\_\-case\_\-compare@{mtext\_\-case\_\-compare}} 669\index{mtext\_\-case\_\-compare@{mtext\_\-case\_\-compare}!m17nMtext@{m17nMtext}} 670\subsubsection[mtext\_\-case\_\-compare]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-case\_\-compare ({\bf MText} $\ast$ {\em mt1}, \/ int {\em from1}, \/ int {\em to1}, \/ {\bf MText} $\ast$ {\em mt2}, \/ int {\em from2}, \/ int {\em to2})}\label{group__m17nMtext_g250784b22861845abac509f0d8324be5} 671 672 673Compare specified regions of two M-texts ignoring cases. 674 675The \doxyref{mtext\_\-case\_\-compare()}{p.}{group__m17nMtext_g250784b22861845abac509f0d8324be5} function compares two M-texts {\bf mt1} and {\bf mt2}, character-by-character, ignoring cases. The compared regions are between {\bf from1} and {\bf to1} in {\bf mt1} and {\bf from2} to {\bf to2} in MT2. {\bf from1} and {\bf from2} are inclusive, {\bf to1} and {\bf to2} are exclusive. {\bf from1} being equal to {\bf to1} (or {\bf from2} being equal to {\bf to2}) means an M-text of length zero. An invalid region specification is regarded as both {\bf from1} and {\bf to1} (or {\bf from2} and {\bf to2}) being 0. 676 677\begin{Desc} 678\item[Return value:]This function returns 1, 0, or -1 if {\bf mt1} is found greater than, equal to, or less than {\bf mt2}, respectively. Comparison is based on character codes.\end{Desc} 679\begin{Desc} 680\item[See Also:]\doxyref{mtext\_\-cmp()}{p.}{group__m17nMtext_gf2d025d985da7b4f98d07c81fdd500cb}, \doxyref{mtext\_\-ncmp()}{p.}{group__m17nMtext_g23fa60794f929caca8c73abebac241cf}, \doxyref{mtext\_\-casecmp()}{p.}{group__m17nMtext_gbc63537384fb25bccd996e35a9bbc908}, \doxyref{mtext\_\-ncasecmp()}{p.}{group__m17nMtext_g9b232386c4307b95dd42685236dc3ce9}, \doxyref{mtext\_\-compare()}{p.}{group__m17nMtext_gf514b386c0d6469ed56e7806901d2434} \end{Desc} 681\index{m17nMtext@{m17nMtext}!mtext\_\-lowercase@{mtext\_\-lowercase}} 682\index{mtext\_\-lowercase@{mtext\_\-lowercase}!m17nMtext@{m17nMtext}} 683\subsubsection[mtext\_\-lowercase]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-lowercase ({\bf MText} $\ast$ {\em mt})}\label{group__m17nMtext_gb2a252c7ef64c168467475f0e4ffe072} 684 685 686Lowercase an M-text. 687 688The \doxyref{mtext\_\-lowercase()}{p.}{group__m17nMtext_gb2a252c7ef64c168467475f0e4ffe072} function destructively converts each character in M-text {\bf mt} to lowercase. Adjacent characters in {\bf mt} may affect the case conversion. If the Mlanguage text property is attached to {\bf mt}, it may also affect the conversion. The length of {\bf mt} may change. Characters that cannot be converted to lowercase is left unchanged. All the text properties are inherited. 689 690\begin{Desc} 691\item[Return value:]This function returns the length of the updated {\bf mt}.\end{Desc} 692\begin{Desc} 693\item[See Also:]\doxyref{mtext\_\-titlecase()}{p.}{group__m17nMtext_gbca0474405604234294cc5a4e341ca18}, \doxyref{mtext\_\-uppercase()}{p.}{group__m17nMtext_gf8dbb06e910d0f87dbb53d4426977d4f} \end{Desc} 694\index{m17nMtext@{m17nMtext}!mtext\_\-titlecase@{mtext\_\-titlecase}} 695\index{mtext\_\-titlecase@{mtext\_\-titlecase}!m17nMtext@{m17nMtext}} 696\subsubsection[mtext\_\-titlecase]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-titlecase ({\bf MText} $\ast$ {\em mt})}\label{group__m17nMtext_gbca0474405604234294cc5a4e341ca18} 697 698 699Titlecase an M-text. 700 701The \doxyref{mtext\_\-titlecase()}{p.}{group__m17nMtext_gbca0474405604234294cc5a4e341ca18} function destructively converts the first character with the cased property in M-text {\bf mt} to titlecase and the others to lowercase. The length of {\bf mt} may change. If the character cannot be converted to titlecase, it is left unchanged. All the text properties are inherited. 702 703\begin{Desc} 704\item[Return value:]This function returns the length of the updated {\bf mt}.\end{Desc} 705\begin{Desc} 706\item[See Also:]\doxyref{mtext\_\-lowercase()}{p.}{group__m17nMtext_gb2a252c7ef64c168467475f0e4ffe072}, \doxyref{mtext\_\-uppercase()}{p.}{group__m17nMtext_gf8dbb06e910d0f87dbb53d4426977d4f} \end{Desc} 707\index{m17nMtext@{m17nMtext}!mtext\_\-uppercase@{mtext\_\-uppercase}} 708\index{mtext\_\-uppercase@{mtext\_\-uppercase}!m17nMtext@{m17nMtext}} 709\subsubsection[mtext\_\-uppercase]{\setlength{\rightskip}{0pt plus 5cm}int mtext\_\-uppercase ({\bf MText} $\ast$ {\em mt})}\label{group__m17nMtext_gf8dbb06e910d0f87dbb53d4426977d4f} 710 711 712Uppercase an M-text. 713 714The \doxyref{mtext\_\-uppercase()}{p.}{group__m17nMtext_gf8dbb06e910d0f87dbb53d4426977d4f} function destructively converts each character in M-text {\bf mt} to uppercase. Adjacent characters in {\bf mt} may affect the case conversion. If the Mlanguage text property is attached to {\bf mt}, it may also affect the conversion. The length of {\bf mt} may change. Characters that cannot be converted to uppercase is left unchanged. All the text properties are inherited. 715 716\begin{Desc} 717\item[Return value:]This function returns the length of the updated {\bf mt}.\end{Desc} 718\begin{Desc} 719\item[See Also:]\doxyref{mtext\_\-lowercase()}{p.}{group__m17nMtext_gb2a252c7ef64c168467475f0e4ffe072}, \doxyref{mtext\_\-titlecase()}{p.}{group__m17nMtext_gbca0474405604234294cc5a4e341ca18} \end{Desc} 720 721 722\subsection{Variable Documentation} 723\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-16@{MTEXT\_\-FORMAT\_\-UTF\_\-16}} 724\index{MTEXT\_\-FORMAT\_\-UTF\_\-16@{MTEXT\_\-FORMAT\_\-UTF\_\-16}!m17nMtext@{m17nMtext}} 725\subsubsection[MTEXT\_\-FORMAT\_\-UTF\_\-16]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf MTextFormat} {\bf MTEXT\_\-FORMAT\_\-UTF\_\-16}}\label{group__m17nMtext_g985ecc7ae135b77919af483d12d4d337} 726 727 728Variable of value MTEXT\_\-FORMAT\_\-UTF\_\-16LE or MTEXT\_\-FORMAT\_\-UTF\_\-16BE. 729 730The global variable \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-16}{p.}{group__m17nMtext_g985ecc7ae135b77919af483d12d4d337} is initialized to \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-16LE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5942252ef5d95a78cc719768d0fa3ce209} on a \char`\"{}Little Endian\char`\"{} system (storing words with the least significant byte first), and to \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-16BE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da59ab2d4798020fd8edb35089be48170cee} on a \char`\"{}Big Endian\char`\"{} system (storing words with the most significant byte first). 731 732\begin{Desc} 733\item[See Also:]\doxyref{mtext\_\-from\_\-data()}{p.}{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} \end{Desc} 734\index{m17nMtext@{m17nMtext}!MTEXT\_\-FORMAT\_\-UTF\_\-32@{MTEXT\_\-FORMAT\_\-UTF\_\-32}} 735\index{MTEXT\_\-FORMAT\_\-UTF\_\-32@{MTEXT\_\-FORMAT\_\-UTF\_\-32}!m17nMtext@{m17nMtext}} 736\subsubsection[MTEXT\_\-FORMAT\_\-UTF\_\-32]{\setlength{\rightskip}{0pt plus 5cm}const int {\bf MTEXT\_\-FORMAT\_\-UTF\_\-32}}\label{group__m17nMtext_g3e3b72f642ea80b03cf0644325fccfbe} 737 738 739Variable of value MTEXT\_\-FORMAT\_\-UTF\_\-32LE or MTEXT\_\-FORMAT\_\-UTF\_\-32BE. 740 741The global variable \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-32}{p.}{group__m17nMtext_g3e3b72f642ea80b03cf0644325fccfbe} is initialized to \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-32LE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5979785b67787c6ca1e9c415a2d76df1be} on a \char`\"{}Little Endian\char`\"{} system (storing words with the least significant byte first), and to \doxyref{MTEXT\_\-FORMAT\_\-UTF\_\-32BE}{p.}{group__m17nMtext_gg4148a7a6fd502d4fb4a786d9fdb7da5907b67ef89723794acb1ba743a30a79ef} on a \char`\"{}Big Endian\char`\"{} system (storing words with the most significant byte first). 742 743\begin{Desc} 744\item[See Also:]\doxyref{mtext\_\-from\_\-data()}{p.}{group__m17nMtext_g2114a8366b5aaee6b5d344f69ea5dd78} \end{Desc} 745\index{m17nMtext@{m17nMtext}!Mlanguage@{Mlanguage}} 746\index{Mlanguage@{Mlanguage}!m17nMtext@{m17nMtext}} 747\subsubsection[Mlanguage]{\setlength{\rightskip}{0pt plus 5cm}{\bf MSymbol} {\bf Mlanguage}}\label{group__m17nMtext_g32374f3750874ea0142af8dac831ab25} 748 749 750The symbol whose name is \char`\"{}language\char`\"{}.