2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/* Copyright (c) 1988 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * University Copyright- Copyright (c) 1982, 1986, 1988
2N/A * The Regents of the University of California
2N/A * All Rights Reserved
2N/A *
2N/A * University Acknowledgment- Portions of this document are derived from
2N/A * software developed by the University of California, Berkeley, and its
2N/A * contributors.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A/*LINTLIBRARY*/
2N/A
2N/A#include <stdlib.h>
2N/A#include <sys/types.h>
2N/A#include "curses_inc.h"
2N/A
2N/A/*
2N/A * When the keyboard can send more than eight bits, offsets array
2N/A * should be changed from chars to shorts.
2N/A * The offsets MUST match what is in curses.h.
2N/A */
2N/A
2N/Astatic unsigned char offsets[][2] = {
2N/A { '`', '*' }, /* ACS_DIAMOND */
2N/A { 'a', ':' }, /* ACS_CKBOARD */
2N/A { 'f', '\'' }, /* ACS_DEGREE */
2N/A { 'g', '#' }, /* ACS_PLMINUS */
2N/A { 'o', '-' }, /* ACS_S1 */
2N/A { 'q', '-' }, /* ACS_HLINE */
2N/A { 's', '_' }, /* ACS_S9 */
2N/A { 'x', '|' }, /* ACS_VLINE */
2N/A { '~', 'o' }, /* ACS_BULLET */
2N/A { ',', '<' }, /* ACS_LARROW */
2N/A { '+', '>' }, /* ACS_RARROW */
2N/A { '.', 'v' }, /* ACS_DARROW */
2N/A { '-', '^' }, /* ACS_UARROW */
2N/A { 'h', '#' }, /* ACS_BOARD */
2N/A { 'i', '#' }, /* ACS_LANTERN */
2N/A { '0', '#' }, /* ACS_BLOCK */
2N/A };
2N/A
2N/Aint
2N/Ainit_acs(void)
2N/A{
2N/A chtype *nacsmap;
2N/A char *cp;
2N/A int i = sizeof (offsets) / 2, to_get, must_output;
2N/A
2N/A#ifdef _VR3_COMPAT_CODE
2N/A if ((nacsmap = cur_term->_acs32map = (chtype *)
2N/A malloc(sizeof (chtype) * 0400)) == NULL)
2N/A#else /* _VR3_COMPAT_CODE */
2N/A if ((nacsmap = cur_term->_acsmap = (chtype *)
2N/A malloc(sizeof (chtype) * 0400)) == NULL)
2N/A#endif /* _VR3_COMPAT_CODE */
2N/A {
2N/A#ifdef _VR3_COMPAT_CODE
2N/Abad:
2N/A#endif /* _VR3_COMPAT_CODE */
2N/A term_errno = TERM_BAD_MALLOC;
2N/A#ifdef DEBUG
2N/A strcpy(term_parm_err, "init_acs");
2N/A#endif /* DEBUG */
2N/A return (ERR);
2N/A }
2N/A
2N/A /* Default acs chars for regular ASCII terminals are plus signs. */
2N/A
2N/A memSset(nacsmap, (chtype) '+', 0400);
2N/A
2N/A /*
2N/A * Now load in defaults for some of the characters which have close
2N/A * approximations in the normal ascii set.
2N/A */
2N/A
2N/A while (i-- > 0)
2N/A nacsmap[offsets[i][0]] = offsets[i][1];
2N/A
2N/A /* Now do mapping for terminals own ACS, if any */
2N/A
2N/A if ((cp = acs_chars) != 0)
2N/A while (*cp) {
2N/A to_get = *cp++; /* to get this ... */
2N/A must_output = *cp++; /* must output this ... */
2N/A#ifdef DEBUG
2N/A if (outf)
2N/A fprintf(outf, "acs %d, was %d, now %d\n",
2N/A to_get, nacsmap[to_get], must_output);
2N/A#endif /* DEBUG */
2N/A nacsmap[to_get] = ( must_output & 0xFF ) | A_ALTCHARSET;
2N/A }
2N/A
2N/A acs_map = nacsmap;
2N/A
2N/A#ifdef _VR3_COMPAT_CODE
2N/A if (_y16update) {
2N/A _ochtype *n16acsmap;
2N/A
2N/A if ((n16acsmap = cur_term->_acsmap = (_ochtype *)
2N/A malloc(sizeof (_ochtype) * 0400)) == NULL) {
2N/A goto bad;
2N/A }
2N/A
2N/A for (i = 0; i < 0400; i++)
2N/A /*LINTED*/
2N/A n16acsmap[i] = _TO_OCHTYPE(nacsmap[i]);
2N/A#undef acs_map
2N/A acs_map = n16acsmap;
2N/A }
2N/A#endif /* _VR3_COMPAT_CODE */
2N/A return (OK);
2N/A}