'\" te .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH CSET 3C "June 18, 2021" .SH NAME cset, csetlen, csetcol, csetno, wcsetno \- get information on EUC codesets .SH SYNOPSIS .nf #include \fBint\fR \fBcsetlen\fR(\fBint\fR \fIcodeset\fR); .fi .LP .nf \fBint\fR \fBcsetcol\fR(\fBint\fR \fIcodeset\fR); .fi .LP .nf \fBint\fR \fBcsetno\fR(\fBunsigned char\fR \fIc\fR); .fi .LP .nf #include \fBint\fR \fBwcsetno\fR(\fBwchar_t\fR \fIpc\fR); .fi .SH DESCRIPTION Both \fBcsetlen()\fR and \fBcsetcol()\fR take a code set number \fIcodeset\fR, which must be 0, 1, 2, or 3. The \fBcsetlen()\fR function returns the number of bytes needed to represent a character of the given Extended Unix Code (EUC) code set, excluding the single-shift characters SS2 and SS3 for codesets 2 and 3. The \fBcsetcol()\fR function returns the number of columns a character in the given \fBEUC\fR code set would take on the display. .sp .LP The \fBcsetno()\fR function is implemented as a macro that returns a codeset number (0, 1, 2, or 3) for the \fBEUC\fR character whose first byte is \fIc\fR. For example, .sp .in +2 .nf #include \|.\|.\|. x+=csetcol(csetno(c)); .fi .in -2 .sp .LP increments a counter "x" (such as the cursor position) by the width of the character whose first byte is \fIc\fR. .sp .LP The \fBwcsetno()\fR function is implemented as a macro that returns a codeset number (0, 1, 2, or 3) for the given process code character \fIpc\fR. For example, .sp .in +2 .nf #include #include \|.\|.\|. x+=csetcol(wcsetno(pc)); .fi .in -2 .sp .LP increments a counter "x" (such as the cursor position) by the width of the Process Code character \fIpc\fR. .SH USAGE These functions work only for the EUC locales. .sp .LP The \fBcset()\fR, \fBcsetlen()\fR, \fBcsetcol()\fR, \fBcsetno()\fR, and \fBwcsetno()\fR functions can be used safely in multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called to change the locale. .SH ATTRIBUTES See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ MT-Level MT-Safe with exceptions .TE .SH SEE ALSO \fBsetlocale\fR(3C), \fBeuclen\fR(3C), \fBattributes\fR(5)