4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License
, Version
1.0 only
6 * (the
"License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr
/src
/OPENSOLARIS.LICENSE
10 * or http
://www.opensolaris.org
/os
/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code
, include this CDDL HEADER in each
15 * file and include the License file at usr
/src
/OPENSOLARIS.LICENSE.
16 * If applicable
, add the following below this CDDL HEADER
, with the
17 * fields enclosed by brackets
"[]" replaced with your own identifying
18 * information
: Portions Copyright
[yyyy
] [name of copyright owner
]
23 * Copyright (c
) 1996, by Sun Microsystems
, Inc.
24 * All rights reserved.
27 #pragma ident
"%Z%%M% %I% %E% SMI"
31 #define
xfree(a
) { if (a
!=NULL
) { yfree(a
); a
=NULL
; } }
34 #define dprintf
if (dbg
) printf
36 # define
dprintf(x1
, x2
, x3
, x4
)
38 #define
WC_VERY_SMALL ((wchar_t
) 0x0001)
39 #define
WC_VERY_LARGE ((wchar_t
) ~
0x0000)
40 typedef double awkfloat
;
46 extern wchar_t
**OFMT
;
49 extern wchar_t
**FILENAME
;
51 extern wchar_t record
[];
52 extern wchar_t L_NULL
[];
54 extern long long lineno
;
56 extern int donefld
; /* 1 if record broken into fields
*/
57 extern int donerec
; /* 1 if record is
valid (no fld has changed
*/
59 /* CELL
: all information about a variable or constant
*/
62 char ctype
; /* CELL
, BOOL
, JUMP
, etc.
*/
63 char csub
; /* subtype of ctype
*/
64 wchar_t
*nval
; /* name
, for variables only
*/
65 wchar_t
*sval
; /* string value
*/
66 awkfloat fval
; /* value as number
*/
67 unsigned tval
; /* type info
*/
68 struct val
*nextval
; /* ptr to next if chained
*/
71 extern CELL
*symtab
[];
72 extern CELL
*setsymtab(), *lookup(), **makesymtab();
74 extern CELL
*recloc
; /* location of input record
*/
75 extern CELL
*nrloc
; /* NR
*/
76 extern CELL
*nfloc
; /* NF
*/
77 extern CELL
*maxmfld
; /* pointer to CELL for maximum field assigned to
*/
79 /* CELL.tval values
: */
80 #define STR
01 /* string value is valid
*/
81 #define NUM
02 /* number value is valid
*/
82 #define FLD
04 /* FLD means don
't free string space */
83 #define CON 010 /* this is a constant */
84 #define ARR 020 /* this is an array */
86 awkfloat setfval(), getfval();
87 wchar_t *setsval(), *getsval();
88 wchar_t *tostring(), *tokname();
90 double log(), sqrt(), exp(), atof();
105 struct nd *narg[BOTCH]; /* C won't take a zero length array
*/
137 extern CELL
*(*proctab[])();
138 extern int pairstack[], paircnt;
140 #define cantexec(n) (n->ntype == NVALUE)
141 #define notlegal(n) (n <= FIRSTTOKEN || n >= LASTTOKEN || \
142 proctab[n-FIRSTTOKEN]== nullproc)
143 #define isexpr(n) (n->ntype == NEXPR)
144 #define isjump(n) (n->ctype == OJUMP)
145 #define isexit(n) (n->ctype == OJUMP && n->csub == JEXIT)
146 #define isbreak(n) (n->ctype == OJUMP && n->csub == JBREAK)
147 #define iscont(n) (n->ctype == OJUMP && n->csub == JCONT)
148 #define isnext(n) (n->ctype == OJUMP && n->csub == JNEXT)
149 #define isstr(n) (n->tval & STR)
150 #define isnum(n) (n->tval & NUM)
151 #define istrue(n) (n->ctype == OBOOL && n->csub == BTRUE)
152 #define istemp(n) (n->ctype == OCELL && n->csub == CTEMP)
153 #define isfld(n) (!donefld && n->csub==CFLD && n->ctype==OCELL && \
155 #define isrec(n) (donefld && n->csub==CFLD && n->ctype==OCELL && \
157 extern CELL *nullproc();
158 extern CELL *relop();
161 #define HAT 0177 /* matches ^ in regular expr */
162 /* watch out for mach dep */
164 * The code set number can be knew from actual character, but "b.c"
165 * will use some pseudo codes. And that psedo code will not confirm
166 * to rule of real code set.
168 typedef struct ccl_chars {
169 unsigned short cc_ns; /* Code set Number */
170 wchar_t cc_cs; /* Actual character */
171 unsigned short cc_ne;
175 ccl_chars_t *cclenter();