ldterm.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_LDTERM_H
#define _SYS_LDTERM_H
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 11.5 */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
/* flow control defines */
#define TTXOLO 132
#define TTXOHI 180
#define HIWAT 1024
#define LOWAT 200
#define LDCHUNK 512
/*
* The following for EUC and also other types of codesets.
*/
#define EUCIN 0 /* copying eucioc_t IN from ioctl */
/*
* One assumption made throughout this module is: EUC characters have
* a display width less than 255. Also, assumed around, is that they
* consist of < 256 bytes, but we don't worry much about that.
*/
/* "ldterm_dispwidth" */
#define EUC_CRWIDTH 252
#define UNKNOWN_WIDTH 251
/* The next version will be the current LDTERM_DATA_VERSION + 1. */
#define LDTERM_DATA_VERSION 1
/*
* Supported codeset types:
* When you are adding a new codeset type, do not add any new codeset type
* value that is smaller than LDTERM_CS_TYPE_MIN. You will also need to
* add the new codeset type sequentially and also increase LDTERM_CS_TYPE_MAX
* so that the LDTERM_CS_TYPE_MAX will be always equal to the last, new
* codeset type value.
*
* Whenever you increase the LDTERM_CS_TYPE_MAX, you will also need to
* increase the LDTERM_DATA_VERSION and also update the ldterm.c so that
* ldterm will have proper version control.
*/
#define LDTERM_CS_TYPE_MIN 1
#define LDTERM_CS_TYPE_EUC 1
#define LDTERM_CS_TYPE_PCCS 2
#define LDTERM_CS_TYPE_UTF8 3
#define LDTERM_CS_TYPE_MAX 3
/*
* The maximum number of bytes in a character of the codeset that
* can be handled by ldterm.
*/
#define LDTERM_CS_MAX_BYTE_LENGTH 8
/*
* The maximum number of sub-codesets in a codeset that can be
* handled by ldterm.
*/
#define LDTERM_CS_MAX_CODESETS 10
/* The maximum and minimum sub-codeset numbers possible in EUC codeset. */
#define LDTERM_CS_TYPE_EUC_MIN_SUBCS 0
#define LDTERM_CS_TYPE_EUC_MAX_SUBCS 3
/* The maximum and minimum sub-codeset numbers possible in PCCS codeset. */
#define LDTERM_CS_TYPE_PCCS_MIN_SUBCS 1
/* Some UTF-8 related values: */
/* The maximum and minimum UTF-8 character subsequent byte values. */
#define LDTERM_CS_TYPE_UTF8_MIN_BYTE 0x80
#define LDTERM_CS_TYPE_UTF8_MAX_BYTE 0xbf
/* Some maximum and minimum character values in UTF-32. */
#define LDTERM_CS_TYPE_UTF8_MAX_P00 0x00ffff
#define LDTERM_CS_TYPE_UTF8_MAX_P01 0x01ffff
#define LDTERM_CS_TYPE_UTF8_MIN_CJKEXTB 0x020000
#define LDTERM_CS_TYPE_UTF8_MAX_CJKEXTB 0x02a6d6
#define LDTERM_CS_TYPE_UTF8_MIN_CJKCOMP 0x02f800
#define LDTERM_CS_TYPE_UTF8_MAX_CJKCOMP 0x02fa1d
#define LDTERM_CS_TYPE_UTF8_MIN_P14 0x0e0000
#define LDTERM_CS_TYPE_UTF8_MAX_P14 0x0e007f
#define LDTERM_CS_TYPE_UTF8_MIN_VARSEL 0x0e0100
#define LDTERM_CS_TYPE_UTF8_MAX_VARSEL 0x0e01ef
#define LDTERM_CS_TYPE_UTF8_MIN_P15 0x0f0000
#define LDTERM_CS_TYPE_UTF8_MAX_P15 0x0ffffd
#define LDTERM_CS_TYPE_UTF8_MIN_P16 0x100000
#define LDTERM_CS_TYPE_UTF8_MAX_P16 0x10fffd
/* Bit shift number and mask values for conversion from UTF-8 to UCS-4. */
#define LDTERM_CS_TYPE_UTF8_SHIFT_BITS 6
#define LDTERM_CS_TYPE_UTF8_BIT_MASK 0x3f
/*
* The following data structure is to provide codeset-specific
* information for EUC and PC originated codesets (ldterm_eucpc_data_t)
*/
struct _ldterm_eucpc_data {
};
typedef struct _ldterm_eucpc_data ldterm_eucpc_data_t;
/* ldterm codeset data information for user side. */
struct _ldterm_cs_data_user {
char locale_name[MAXNAMELEN];
/* width data */
};
typedef struct _ldterm_cs_data_user ldterm_cs_data_user_t;
/* ldterm codeset data information for ldterm. */
struct _ldterm_cs_data {
char *locale_name;
/* width data */
};
typedef struct _ldterm_cs_data ldterm_cs_data_t;
/*
* The following data structure is to handle Unicode codeset.
* To represent a single Unicode plane, it requires to have 16384
* 'ldterm_unicode_data_cell_t' elements.
*/
struct _ldterm_unicode_data_cell {
};
typedef struct _ldterm_unicode_data_cell ldterm_unicode_data_cell_t;
/* The following function pointers point the current codeset methods. */
typedef struct _ldterm_cs_methods {
int (*ldterm_dispwidth)(uchar_t, void *, int);
int (*ldterm_memwidth)(uchar_t, void *);
typedef struct ldterm_mod {
unsigned int t_state; /* internal state of ldterm module */
int t_line; /* output line of tty */
int t_col; /* output column of tty */
int t_rocount; /* number of chars echoed since last output */
int t_rocol; /* column in which first such char appeared */
/* built */
int t_rd_request; /* Number of bytes requested by M_READ */
int t_iocid; /* ID of ioctl reply being awaited */
/*
* The following are for EUC and also other types of codeset
* processing. Please read 'euc' as 'multi-byte codeset' instead.
*/
int t_eucwarn; /* bad EUC counter */
/*
* The t_csdata, t_csmethods, t_scratch, and, t_scratch_len data
* fields are to support various non-EUC codesets.
*/
struct _ldterm_cs_methods t_csmethods;
/*
* Internal state bits.
*/
/* sees is literal */
/* is literal */
/* below us */
/* rescan input queue */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_LDTERM_H */