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]
24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
42 x
= (Node
*)malloc(sizeof (Node
) + (n
- 1) * sizeof (Node
*));
44 ERROR
"out of space in nodealloc" FATAL
;
69 node2(int a
, Node
*b
, Node
*c
)
81 node3(int a
, Node
*b
, Node
*c
, Node
*d
)
94 node4(int a
, Node
*b
, Node
*c
, Node
*d
, Node
*e
)
107 stat3(int a
, Node
*b
, Node
*c
, Node
*d
)
111 x
= node3(a
, b
, c
, d
);
117 op2(int a
, Node
*b
, Node
*c
)
137 stat1(int a
, Node
*b
)
147 op3(int a
, Node
*b
, Node
*c
, Node
*d
)
151 x
= node3(a
, b
, c
, d
);
157 op4(int a
, Node
*b
, Node
*c
, Node
*d
, Node
*e
)
161 x
= node4(a
, b
, c
, d
, e
);
167 stat2(int a
, Node
*b
, Node
*c
)
177 stat4(int a
, Node
*b
, Node
*c
, Node
*d
, Node
*e
)
181 x
= node4(a
, b
, c
, d
, e
);
187 valtonode(Cell
*a
, int b
)
193 x
= node1(0, (Node
*)a
);
201 /* return valtonode(lookup("$0", symtab), CFLD); */
202 return (valtonode(recloc
, CFLD
));
211 cp
= (Cell
*)(p
->narg
[0]);
213 ERROR
"%s is a function, not an array", cp
->nval SYNTAX
;
214 else if (!isarr(cp
)) {
216 cp
->sval
= (uchar
*)makesymtab(NSYMTAB
);
224 pa2stat(Node
*a
, Node
*b
, Node
*c
)
228 x
= node4(PASTAT2
, a
, b
, c
, (Node
*)paircnt
);
235 linkum(Node
*a
, Node
*b
)
239 if (errorflag
) /* don't link things that are wrong */
245 for (c
= a
; c
->nnext
!= NULL
; c
= c
->nnext
)
252 defn(Cell
*v
, Node
*vl
, Node
*st
) /* turn on FCN bit in definition */
258 ERROR
"`%s' is an array name and a function name",
263 v
->sval
= (uchar
*)st
;
264 n
= 0; /* count arguments */
265 for (p
= vl
; p
; p
= p
->nnext
)
268 dprintf(("defining func %s (%d args)\n", v
->nval
, n
));
272 isarg(uchar
*s
) /* is s in argument list for current function? */
274 extern Node
*arglist
;
278 for (n
= 0; p
!= 0; p
= p
->nnext
, n
++) {
279 if (strcmp((char *)((Cell
*)(p
->narg
[0]))->nval
,