3 *
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
7 * with the License.
8 *
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.
13 *
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]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
29
30
31 #pragma ident "%Z%%M% %I% %E% SMI"
32
33 /* Copyright (c) 1979 Regents of the University of California */
34
35 /*LINTLIBRARY*/
36
37 #include "curses_inc.h"
38 #include "curshdr.h"
39 #include "term.h"
40 #include <string.h>
41 #include <setjmp.h>
42 #include <stdlib.h>
43 #include <stdio.h>
44
45 #ifndef _CHCTRL
46 #define _CHCTRL(c) ((c) & 037)
47 #endif /* _CHCTRL */
48
49 char *_branchto(char *, char);
50
51 /*
52 * Routine to perform parameter substitution.
243 return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6],
244 p[7], p[8]));
245 }
246
247 /* VARARGS */
248 char *
249 tparm(char *instring, long fp1, long fp2, long p3, long p4,
250 long p5, long p6, long p7, long p8, long p9)
251 {
252 static char result[512];
253 static char added[100];
254 long vars[26];
255 STACK stk;
256 char *cp = instring;
257 char *outp = result;
258 char c;
259 long op;
260 long op2;
261 int sign;
262 int onrow = 0;
263 long p1 = fp1, p2 = fp2; /* copy in case < 2 actual parms */
264 char *xp;
265 char formatbuffer[100];
266 char *format;
267 int looping;
268 short *regs = cur_term->_regs;
269 int val;
270
271
272 if ((val = setjmp(env)) != 0) {
273 #ifdef DEBUG
274 switch (val) {
275 case MEM_ALLOC_FAIL:
276 fprintf(outf, "TPARM: Memory allocation"
277 " failure.");
278 break;
279 case STACK_UNDERFLOW:
280 fprintf(outf, "TPARM: Stack underflow.");
281 break;
282 }
283 #endif /* DEBUG */
|
3 *
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
7 * with the License.
8 *
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.
13 *
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]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2015 Gary Mills
24 * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
25 * All rights reserved.
26 */
27
28 /* Copyright (c) 1988 AT&T */
29 /* All Rights Reserved */
30
31 /* Copyright (c) 1979 Regents of the University of California */
32
33 /*LINTLIBRARY*/
34
35 #include "curses_inc.h"
36 #include "curshdr.h"
37 #include "term.h"
38 #include <string.h>
39 #include <setjmp.h>
40 #include <stdlib.h>
41 #include <stdio.h>
42
43 #ifndef _CHCTRL
44 #define _CHCTRL(c) ((c) & 037)
45 #endif /* _CHCTRL */
46
47 char *_branchto(char *, char);
48
49 /*
50 * Routine to perform parameter substitution.
241 return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6],
242 p[7], p[8]));
243 }
244
245 /* VARARGS */
246 char *
247 tparm(char *instring, long fp1, long fp2, long p3, long p4,
248 long p5, long p6, long p7, long p8, long p9)
249 {
250 static char result[512];
251 static char added[100];
252 long vars[26];
253 STACK stk;
254 char *cp = instring;
255 char *outp = result;
256 char c;
257 long op;
258 long op2;
259 int sign;
260 int onrow = 0;
261 volatile long p1 = fp1, p2 = fp2; /* copy in case < 2 actual parms */
262 char *xp;
263 char formatbuffer[100];
264 char *format;
265 int looping;
266 short *regs = cur_term->_regs;
267 int val;
268
269
270 if ((val = setjmp(env)) != 0) {
271 #ifdef DEBUG
272 switch (val) {
273 case MEM_ALLOC_FAIL:
274 fprintf(outf, "TPARM: Memory allocation"
275 " failure.");
276 break;
277 case STACK_UNDERFLOW:
278 fprintf(outf, "TPARM: Stack underflow.");
279 break;
280 }
281 #endif /* DEBUG */
|