vcreate.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1986 AT&T
* All Rights Reserved
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12 */
#include <curses.h>
#include <term.h>
#include <values.h>
#include "wish.h"
#include "vt.h"
#include "vtdefs.h"
#include "var_arrays.h"
#include "moremacros.h"
#include "color_pair.h"
#define area(sr1, sc1, r1, c1, sr2, sc2, r2, c2) (_vt_overlap(sr1, r1, sr2, r2) * _vt_overlap(sc1, c1, sc2, c2))
extern int VT_firstline;
extern int VT_lastline;
static int Nextrow;
static int Nextcol;
extern int Color_terminal;
/*
* only way to create a VT
*/
char *title;
int flags;
int srow;
int scol;
unsigned rows;
unsigned cols;
{
register int num;
register int wnum;
register struct vt *v;
extern int VT_firstline;
if (!(flags & VT_NOBORDER)) {
srow--;
scol--;
rows += 2;
cols += 2;
}
#ifdef _DEBUG3
#endif
return FAIL;
}
#ifdef _DEBUG3
#endif
return FAIL;
}
srow += VT_firstline;
/* pick a window number (if appropriate) */
wnum = 0;
if (!(flags & VT_NONUMBER)) {
break;
if (num <= 0)
break;
}
}
/* find a free vt structure */
break;
if (num <= 0) {
}
/* set up v */
#ifdef _DEBUG3
#endif
return FAIL;
}
/*
* set up a subwindow for bordered windows only ....
*/
if (!(flags & VT_NOBORDER)) {
#ifdef _DEBUG3
#endif
return FAIL;
}
}
else
/* syncok (sunwin, TRUE); */
if (v->subwin) { /* set attribute for sub window */
}
}
if (flags & VT_NOBORDER)
else
v->flags |= VT_ANYDIRTY;
return v - VT_array;
}
/*
* find row with least overlap for any column (determined by bestcol)
*/
static int
register int *sr;
register int *sc;
unsigned r;
unsigned c;
{
register int best;
if (*sr >= 0)
else {
register int sofar;
int row;
int col;
register int savedcol;
break;
}
}
if (best) {
}
}
}
#ifdef _DEBUG3
#endif
}
/*
* find column with lowest cost, given row
* do nothing if all columns have a cost higher than sofar
*/
static int
int sofar;
register int *sr;
register int *sc;
unsigned r;
unsigned c;
{
register int best;
int col;
if (*sc >= 0)
else {
Nextcol = 0;
#ifdef _DEBUG3
#endif
break;
}
}
if (best) {
#ifdef _DEBUG3
#endif
}
}
}
return best;
}
/*
* compute sum of overlapping areas of given window with all other windows
*/
static int
unsigned sr;
unsigned sc;
unsigned r;
unsigned c;
{
register int n;
register int sofar;
register int vtarea;
register struct vt *v;
sofar = 0;
v = &VT_array[n];
vsr -= VT_firstline;
/* if there is an overlap with this VT */
}
}
return sofar;
}
/*
* center the window
*/
static int
int *sr;
int *sc;
unsigned r;
unsigned c;
{
if (*sr < 0)
if (*sc < 0)
return SUCCESS;
}
/*
* make window as far as possible away from current window
*/
static int
register int *sr;
register int *sc;
unsigned r;
unsigned c;
{
register struct vt *v;
crow -= VT_firstline;
}
if ((sofar = area(VT_lastline - VT_firstline - r, columns - c - 1, r, c, crow, ccol, crows, ccols)) < best) {
}
*sc = 0;
}
return SUCCESS;
}
/*
* try to put window in the same place as current window
*/
static int
register int *sr;
register int *sc;
unsigned r;
unsigned c;
{
register struct vt *v;
int y, x;
y -= VT_firstline;
return SUCCESS;
return FAIL;
}
/*
* find best place to put window
*/
static int
int flags;
register int *startrow;
register int *startcol;
register unsigned rows;
register unsigned cols;
{
int (*cfunc)(); /* cost function to use */
unsigned cost;
static int (*cost_table[NUMCOSTS])() = {
};
/* we have already bumped the numbers to take care of the border.. */
return FAIL;
/* row and column are set */
return SUCCESS;
/* get cost function */
}
/*
* compute linear overlap between line starting at s1 and going for n1 units
* and line starting at s2 and going for n2 units
*/
register int s1;
register int n1;
register int s2;
register int n2;
{
return 0;
return n2;
}