NetBSD/lib/libcurses/curses_cchar.3

155 lines
3.8 KiB
Groff

.\" $NetBSD: curses_cchar.3,v 1.3 2021/10/04 14:35:20 andvar Exp $
.\"
.\" Copyright (c) 2018 Valery Ushakov
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 19, 2018
.Dt CURSES_CCHAR 3
.Os
.Sh NAME
.Nm curses_cchar ,
.Nm getcchar ,
.Nm setcchar
.Nd curses representation of wide characters
.Sh LIBRARY
.Lb libcurses
.Sh SYNOPSIS
.\"
.In curses.h
.\"
.Ft int
.Fo getcchar
.Fa "const cchar_t *wcval"
.Fa "wchar_t *wch"
.Fa "attr_t *attrs"
.Fa "short *color_pair"
.Fa "void *opts"
.Fc
.\"
.Ft int
.Fo setcchar
.Fa "cchar_t *wcval"
.Fa "const wchar_t *wch"
.Fa "const attr_t attrs"
.Fa "short color_pair"
.Fa "const void *opts"
.Fc
.Sh DESCRIPTION
Curses uses the opaque type
.Vt cchar_t
to represent a string of wide characters up to an
implementation-dependent length along with a color pair and zero or
more attributes.
A null
.Vt cchar_t
object is an object that references an empty wide-character string.
Arrays of
.Vt cchar_t
objects are terminated by a null
.Vt cchar_t
object.
.Pp
Objects of type
.Vt cchar_t
can be manipulated using the
.Nm getcchar
and
.Nm setcchar
functions.
Both these functions take as their last parameter the
.Fa opts
argument which is reserved for future extensions.
Currently, the application must provide a null pointer as
.Fa opts .
.\"
.Pp
When the
.Nm getcchar
function is called with non-null
.Fa wch
it extracts the information from the
.Fa wcval
object.
The string of wide characters in
.Fa wcval
is copied to the
.Fa wch
array.
The attributes are stored in
.Fa attrs
and the color pair is stored in
.Fa color_pair .
In this case it returns
.Er OK
upon successful completion, and
.Er ERR
otherwise.
.Pp
When
.Nm getcchar
is called with null
.Fa wch
it doesn't store any information but returns the number of wide
characters referenced by
.Fa wcval ,
including the null terminator.
.\"
.Pp
.Nm setcchar
initializes
.Fa wcval
with the wide-character string
.Fa wch ,
attributes
.Fa attrs ,
and color pair
.Fa color_pair .
.Sh RETURN VALUES
.Nm getchar
called with null
.Fa wch
returns the number of wide characters referenced by
.Fa wcval ,
including the null terminator.
.Pp
Otherwise these functions return one of the following values:
.Bl -tag -width "Er ERR" -compact
.It Er OK
The function completed successfully.
.It Er ERR
An error occurred in the function.
.El
.\" .Sh SEE ALSO
.\" XXX no other man pages yet for HAVE_WCHAR functions
.Sh STANDARDS
The
.Nx
Curses library complies with the X/Open Curses specification, part of
the Single Unix Specification.
.Sh HISTORY
The Curses package appeared in
.Bx 4.0 .
.Pp
Wide characters support appeared in
.Nx 5.0 .