/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdlib.h>
#include "curses_inc.h"
/*
* Initialize usage of soft labels
* This routine should be called before each call of newscreen
* or initscr to initialize for the next terminal.
*
* ng: number of groupings. If gp is NULL, it denotes one
* of two default groupings:
* 0: - - - - - - - -
* 1: - - - - - - - -
* gp: groupings.
*/
static void _init_slk_func(void);
static int _slk_setpos(int, short *);
int
{
int i = 0, j = 0;
switch (ng) {
case 2 :
_ngroups = 2;
_groups[0] = 4;
break;
case 3 :
_ngroups = 3;
_groups[0] = 3;
break;
default :
if (label_format) {
int k;
/*CONSTCOND*/
while (TRUE) {
if ((*ch == ',') ||
(*ch == '\0')) {
ch1[i] = '\0';
0)
goto err;
_groups[j++] = k;
i = 0;
if (*ch == '\0') {
break;
}
} else
}
} else
goto no_format;
break;
}
} else {
for (; i < ng; i++) {
err :
return (ERR);
}
}
/* signal newscreen() */
return (OK);
}
static void
_init_slk_func(void)
{
/* clear this out to ready for next time */
/* get space for slk structure */
#ifdef DEBUG
#endif /* DEBUG */
return;
}
/* compute actual number of labels */
num = 0;
for (i = 0; i < _ngroups; i++)
/* max label length */
(num_labels >= num)) {
goto next;
} else {
goto err;
/* remove one line from the screen */
next :
}
}
/* positions to place labels */
err :
} else {
/* LINTED */
/* LINTED */
for (i = 0; i < num; ++i) {
*cp = ' ';
*ep = '\0';
}
}
}
/*
* Compute placements of labels. The general idea is to spread
* the groups out evenly. This routine is designed for the day
* when > 8 labels and other kinds of groupings may be desired.
*
* The main assumption behind the algorithm is that the total
* # of labels in all the groups is <= LABMAX.
*
* len: length of a label
* labx: to return the coords of the labels.
*/
static int
{
/* compute starting coords for each group */
grpx[0] = 0;
if (_ngroups > 1) {
/* spacing between groups */
for (i = 0, n = 0; i < _ngroups; ++i)
return (ERR);
/* coords of groups */
for (i = 1; i < _ngroups; ++i) {
grpx[i]++;
left--;
}
}
}
/* now set coords of each label */
n = 0;
for (i = 0; i < _ngroups; ++i)
for (k = 0; k < _groups[i]; ++k)
return (OK);
}