1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
.\" Copyright (C) 2001 Information-technology Promotion Agency (IPA)
.\" Copyright (C) 2001-2011
.\" National Institute of Advanced Industrial Science and Technology (AIST)
.\" This file is part of the m17n library documentation.
.\" Permission is granted to copy, distribute and/or modify this document
.\" under the terms of the GNU Free Documentation License, Version 1.2 or
.\" any later version published by the Free Software Foundation; with no
.\" Invariant Section, no Front-Cover Texts,
.\" and no Back-Cover Texts. A copy of the license is included in the
.\" appendix entitled "GNU Free Documentation License".
.TH "mtext_from_data" 3m17n "12 Jan 2011" "Version 1.6.2" "The m17n Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
mtext_from_data \- Allocate a new M\-text with specified data.
.SH SYNOPSIS
\fBMText\fP*
\fBmtext_from_data\fP (const void *
\fIdata\fP, int
\fInitems\fP, enum \fBMTextFormat\fP
\fIformat\fP)
.SH DESCRIPTION
Allocate a new M\-text with specified data. The
.ft B
mtext_from_data()
.ft R
function allocates a new M\-text whose character sequence is specified by array
.ft B
data
.ft R
of
.ft B
nitems
.ft R
elements.
.ft B
format
.ft R
specifies the format of
.ft B
data\fP.
.ft R
.PP
When
.ft B
format
.ft R
is either
.ft B
MTEXT_FORMAT_US_ASCII
.ft R
or
.ft B
MTEXT_FORMAT_UTF_8\fP,
.ft R
the contents of
.ft B
data
.ft R
must be of the type
.ft C
unsigned
.ft R
.ft C
char\fP,
.ft R
and
.ft B
nitems
.ft R
counts by byte.
.PP
When
.ft B
format
.ft R
is either
.ft B
MTEXT_FORMAT_UTF_16LE
.ft R
or
.ft B
MTEXT_FORMAT_UTF_16BE\fP,
.ft R
the contents of
.ft B
data
.ft R
must be of the type
.ft C
unsigned
.ft R
.ft C
short\fP,
.ft R
and
.ft B
nitems
.ft R
counts by unsigned short.
.PP
When
.ft B
format
.ft R
is either
.ft B
MTEXT_FORMAT_UTF_32LE
.ft R
or
.ft B
MTEXT_FORMAT_UTF_32BE\fP,
.ft R
the contents of
.ft B
data
.ft R
must be of the type
.ft C
unsigned\fP,
.ft R
and
.ft B
nitems
.ft R
counts by unsigned.
.PP
The character sequence of the M\-text is not modifiable. The contents of
.ft B
data
.ft R
must not be modified while the M\-text is alive.
.PP
The allocated M\-text will not be freed unless the user explicitly does so with the
.ft B
m17n_object_unref()
.ft R
function. Even in that case,
.ft B
data
.ft R
is not freed.
.PP
.SH RETURN VALUE
.PP
.RS 4
If the operation was successful,
.ft B
mtext_from_data()
.ft R
returns a pointer to the allocated M\-text. Otherwise it returns
.ft C
NULL
.ft R
and assigns an error code to the external variable
.ft B
merror_code\fP.
.ft R
.RE
.PP
.SH ERRORS
.PP
.RS 4
\fCMERROR_MTEXT
.ft R
.RE
.PP
.SH COPYRIGHT
Copyright (C) 2001 Information\-technology Promotion Agency (IPA)
.br
Copyright (C) 2001\-2011 National Institute of Advanced Industrial Science and Technology (AIST)
.br
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License
<http://www.gnu.org/licenses/fdl.html>.
|