2 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley Software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
18 * Macros to classify characters.
24 #define isauxspZ (!isascii(Z)&&!(Z"E)&&iswspace(Z))
25 #define isauxsp(c) (Z=((unsigned)(c)), isauxspZ)
26 /* Regocnizes non-ASCII space characters. */
29 /* macros of macros to reduce further #ifdef MBCHAR later. Please be patient!*/
30 #define iswdigit(c) isdigit(c)
31 #define iswalpha(c) isalpha(c)
32 #define isphonogram(c) 0
33 #define isideogram(c) 0
37 extern unsigned short _cmap
[];/* Defined in sh.char.c */
38 unsigned int Z
; /* A place to save macro arg to avoid side-effect!*/
40 #define _Q 0x01 /* '" */
41 #define _Q1 0x02 /* ` */
42 #define _SP 0x04 /* space and tab */
43 #define _NL 0x08 /* \n */
44 #define _META 0x10 /* lex meta characters, sp #'`";&<>()|\t\n */
45 #define _GLOB 0x20 /* glob characters, *?{[` */
46 #define _ESC 0x40 /* \ */
47 #define _DOL 0x80 /* $ */
48 #define _DIG 0x100 /* 0-9 */
49 #define _LET 0x200 /* a-z, A-Z, _ NO LONGER OF REAL USE. */
52 #define quoted(c) ((unsigned)(c) & QUOTE)
54 #define cmapZ(bits) (isascii(Z)?(_cmap[Z] & (bits)):0)
55 #define cmap(c, bits) (Z=((unsigned)(c)), cmapZ(bits))
57 #define isglob(c) cmap(c, _GLOB)
58 #define ismeta(c) cmap(c, _META)
59 #define digit(c) cmap(c, _DIG)
60 #define issp(c) (Z=((unsigned)(c)), cmapZ( _SP)||isauxspZ)
62 #define isspnl(c) (Z=((unsigned)(c)), cmapZ( _SP|_NL)||isauxspZ)
64 (Z=((unsigned)(c)), !quoted(Z)&&(iswalpha(Z)||((Z)=='_')\
65 ||isphonogram(Z)||isideogram(Z)))
67 (Z=((unsigned)(c)), !quoted(Z)&&(iswalpha(Z)||((Z)=='_')\
68 ||iswdigit(Z)||isphonogram(Z)||isideogram(Z)))