Home | History | Annotate | Line # | Download | only in csh
char.c revision 1.6
      1 /*	$NetBSD: char.c,v 1.6 1995/03/21 09:02:26 cgd Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1980, 1991, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *	This product includes software developed by the University of
     18  *	California, Berkeley and its contributors.
     19  * 4. Neither the name of the University nor the names of its contributors
     20  *    may be used to endorse or promote products derived from this software
     21  *    without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  */
     35 
     36 #ifndef lint
     37 #if 0
     38 static char sccsid[] = "@(#)char.c	8.1 (Berkeley) 5/31/93";
     39 #else
     40 static char rcsid[] = "$NetBSD: char.c,v 1.6 1995/03/21 09:02:26 cgd Exp $";
     41 #endif
     42 #endif /* not lint */
     43 
     44 #include "char.h"
     45 
     46 unsigned short _cmap[256] = {
     47 /*	nul		soh		stx		etx	*/
     48 	_CTR,		_CTR,		_CTR,		_CTR,
     49 
     50 /*	eot		enq		ack		bel	*/
     51 	_CTR,		_CTR,		_CTR,		_CTR,
     52 
     53 /*	bs		ht		nl		vt	*/
     54 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
     55 
     56 /*	np		cr		so		si	*/
     57 	_CTR,		_CTR,		_CTR,		_CTR,
     58 
     59 /*	dle		dc1		dc2		dc3	*/
     60 	_CTR,		_CTR,		_CTR,		_CTR,
     61 
     62 /*	dc4		nak		syn		etb	*/
     63 	_CTR,		_CTR,		_CTR,		_CTR,
     64 
     65 /*	can		em		sub		esc	*/
     66 	_CTR,		_CTR,		_CTR,		_CTR,
     67 
     68 /*	fs		gs		rs		us	*/
     69 	_CTR,		_CTR,		_CTR,		_CTR,
     70 
     71 /*	sp		!		"		#	*/
     72 	_SP|_META,	0,		_QF,		_META,
     73 
     74 /*	$		%		&		'	*/
     75 	_DOL,		0,		_META|_CMD,	_QF,
     76 
     77 /*	(		)		*		+	*/
     78 	_META|_CMD,	_META,		_GLOB,		0,
     79 
     80 /*	,		-		.		/	*/
     81 	0,		0,		0,		0,
     82 
     83 /*	0		1		2		3	*/
     84 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
     85 
     86 /*	4		5		6		7	*/
     87 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
     88 
     89 /*	8		9		:		;	*/
     90 	_DIG|_XD,	_DIG|_XD,	0,		_META|_CMD,
     91 
     92 /*	<		=		>		?	*/
     93 	_META,		0,		_META,		_GLOB,
     94 
     95 /*	@		A		B		C	*/
     96 	0,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
     97 
     98 /*	D		E		F		G	*/
     99 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
    100 
    101 /*	H		I		J		K	*/
    102 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    103 
    104 /*	L		M		N		O	*/
    105 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    106 
    107 /*	P		Q		R		S	*/
    108 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    109 
    110 /*	T		U		V		W	*/
    111 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    112 
    113 /*	X		Y		Z		[	*/
    114 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB,
    115 
    116 /*	\		]		^		_	*/
    117 	_ESC,		0,		0,		0,
    118 
    119 /*	`		a		b		c	*/
    120   _QB|_GLOB|_META,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
    121 
    122 /*	d		e		f		g	*/
    123 	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW,
    124 
    125 /*	h		i		j		k	*/
    126 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    127 
    128 /*	l		m		n		o	*/
    129 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    130 
    131 /*	p		q		r		s	*/
    132 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    133 
    134 /*	t		u		v		w	*/
    135 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    136 
    137 /*	x		y		z		{	*/
    138 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB,
    139 
    140 /*	|		}		~		del	*/
    141 	_META|_CMD,	0,		0,		_CTR,
    142 
    143 #if defined(SHORT_STRINGS) && !defined(KANJI)
    144 /****************************************************************/
    145 /* 128 - 255 The below is supposedly ISO 8859/1			*/
    146 /****************************************************************/
    147 /*	(undef)		(undef)		(undef)		(undef)		*/
    148 	_CTR,		_CTR,		_CTR,		_CTR,
    149 
    150 /*	(undef)		(undef)		(undef)		(undef)		*/
    151 	_CTR,		_CTR,		_CTR,		_CTR,
    152 
    153 /*	(undef)		(undef)		(undef)		(undef)		*/
    154 	_CTR,		_CTR,		_CTR,		_CTR,
    155 
    156 /*	(undef)		(undef)		(undef)		(undef)		*/
    157 	_CTR,		_CTR,		_CTR,		_CTR,
    158 
    159 /*	(undef)		(undef)		(undef)		(undef)		*/
    160 	_CTR,		_CTR,		_CTR,		_CTR,
    161 
    162 /*	(undef)		(undef)		(undef)		(undef)		*/
    163 	_CTR,		_CTR,		_CTR,		_CTR,
    164 
    165 /*	(undef)		(undef)		(undef)		(undef)		*/
    166 	_CTR,		_CTR,		_CTR,		_CTR,
    167 
    168 /*	(undef)		(undef)		(undef)		(undef)		*/
    169 	_CTR,		_CTR,		_CTR,		_CTR,
    170 
    171 /*	nobreakspace	exclamdown	cent		sterling	*/
    172 	_SP,		0,		0,		0,
    173 
    174 /*	currency	yen		brokenbar	section		*/
    175 	0,		0,		0,		0,
    176 
    177 /*	diaeresis	copyright	ordfeminine	guillemotleft	*/
    178 	0,		0,		0,		0,
    179 
    180 /*	notsign		hyphen		registered	macron		*/
    181 	0,		0,		0,		0,
    182 
    183 /*	degree		plusminus	twosuperior	threesuperior	*/
    184 	0,		0,		0,		0,
    185 
    186 /*	acute		mu		paragraph	periodcentered	*/
    187 	0,		0,		0,		0,
    188 
    189 /*	cedilla		onesuperior	masculine	guillemotright	*/
    190 	0,		0,		0,		0,
    191 
    192 /*	onequarter	onehalf		threequarters	questiondown	*/
    193 	0,		0,		0,		0,
    194 
    195 /*	Agrave		Aacute		Acircumflex	Atilde		*/
    196 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    197 
    198 /*	Adiaeresis	Aring		AE		Ccedilla	*/
    199 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    200 
    201 /*	Egrave		Eacute		Ecircumflex	Ediaeresis	*/
    202 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    203 
    204 /*	Igrave		Iacute		Icircumflex	Idiaeresis	*/
    205 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    206 
    207 /*	ETH		Ntilde		Ograve		Oacute		*/
    208 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    209 
    210 /*	Ocircumflex	Otilde		Odiaeresis	multiply	*/
    211 	_LET|_UP,	_LET|_UP,	_LET|_UP,	0,
    212 
    213 /*	Ooblique	Ugrave		Uacute		Ucircumflex	*/
    214 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
    215 
    216 /*	Udiaeresis	Yacute		THORN		ssharp		*/
    217 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_LOW,
    218 
    219 /*	agrave		aacute		acircumflex	atilde		*/
    220 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    221 
    222 /*	adiaeresis	aring		ae		ccedilla	*/
    223 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    224 
    225 /*	egrave		eacute		ecircumflex	ediaeresis	*/
    226 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    227 
    228 /*	igrave		iacute		icircumflex	idiaeresis	*/
    229 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    230 
    231 /*	eth		ntilde		ograve		oacute		*/
    232 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    233 
    234 /*	ocircumflex	otilde		odiaeresis	division	*/
    235 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	0,
    236 
    237 /*	oslash		ugrave		uacute		ucircumflex	*/
    238 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    239 
    240 /*	udiaeresis	yacute		thorn		ydiaeresis	*/
    241 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
    242 #endif /* SHORT_STRINGS && !KANJI */
    243 };
    244 
    245 #ifndef NLS
    246 /* _cmap_lower, _cmap_upper for ISO 8859/1 */
    247 
    248 unsigned char _cmap_lower[256] = {
    249 	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
    250 	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
    251 	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
    252 	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
    253 	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
    254 	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
    255 	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
    256 	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
    257 	0100,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
    258 	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
    259 	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
    260 	0170,	0171,	0172,	0133,	0134,	0135,	0136,	0137,
    261 	0140,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
    262 	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
    263 	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
    264 	0170,	0171,	0172,	0173,	0174,	0175,	0176,	0177,
    265 	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
    266 	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
    267 	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
    268 	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
    269 	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
    270 	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
    271 	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
    272 	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
    273 	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
    274 	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
    275 	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0327,
    276 	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0337,
    277 	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
    278 	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
    279 	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0367,
    280 	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0377,
    281 };
    282 
    283 unsigned char _cmap_upper[256] = {
    284 	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
    285 	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
    286 	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
    287 	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
    288 	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
    289 	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
    290 	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
    291 	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
    292 	0100,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
    293 	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
    294 	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
    295 	0130,	0131,	0132,	0133,	0134,	0135,	0136,	0137,
    296 	0140,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
    297 	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
    298 	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
    299 	0130,	0131,	0132,	0173,	0174,	0175,	0176,	0177,
    300 	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
    301 	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
    302 	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
    303 	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
    304 	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
    305 	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
    306 	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
    307 	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
    308 	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
    309 	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
    310 	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0327,
    311 	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0337,
    312 	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
    313 	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
    314 	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0367,
    315 	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0377,
    316 };
    317 #endif /* NLS */
    318