mvcur.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) 1995, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* mvcur.c
*
* XCurses Library
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifdef M_RCSID
#ifndef lint
static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/mvcur.c 1.4 1995/06/15 18:56:03 ant Exp $";
#endif
#endif
#include <private.h>
#include <string.h>
#include <stdarg.h>
/*
* #define
* Make_seq_best(s1, s2)
*
* Make_seq_best() swaps the values of the pointers if s1->cost > s2->cost.
*/
}
struct Sequence {
int *end; /* end of vector */
int cost; /* cost of vector */
};
static bool relative; /* set if we really know where we are */
/*f
* Add sequence 2 to sequence 1.
*/
STATIC void
{
else {
}
}
/*f
* add_op() adds the operator op and the appropriate
* number of paramaters to seq. It also increases the
* cost appropriately.
*
* If op takes no parameters then p0 is taken to be a count.
*/
STATIC void
{
} else if (op < __MOVE_MAX_RELATIVE) {
/* No parameters, total is cost * p1. */
} else {
/* Cursor motion using parameters have fixed cost. */
}
}
/*f
* row() adds the best sequence for moving the cursor from orow
* to nrow to seq.
*
* row() considers row_address, parm_up/down_cursor and cursor_up/down.
*/
STATIC void
{
return;
} else {
}
/* try out direct row addressing */
/* try out paramaterized up or down motion */
/* try getting there one step at a time... */
}
/*
* Motion indexes used in simp_col().
*/
typedef struct {
int _tab; /* Tab index. */
int _one; /* Single-step index, same direction as tab. */
int _opp; /* Single-step index, opposite direction to tab. */
} t_steps;
/*f
* simp_col(outseq, oldcol, newcol)
*
* simp_col() adds the best simple sequence for getting from oldcol
* to newcol to outseq. simp_col() considers (back_)tab and
* cursor_left/right.
*/
STATIC void
{
return;
if (0 < init_tabs) {
/* Tabstop preceeding nc. */
if (0 < tabs)
/* Set oc to tabstop before nc : oc <= nc. */
/* Distance from next tabstop to nc in columns. */
}
} else {
if (0 < init_tabs) {
/* Tabstop preceeding nc. */
if (0 < tabs)
/* Set oc to tabstop after nc : nc <= oc. */
/* Distance from tabstop preceeding nc in columns. */
}
}
if (0 < tabs) {
/* Tab as close as possible to nc. */
/* If tabs alone get us there, then stop. */
return;
}
/* We're not exactly positioned yet. Compare the worth of
* two sequences :
* 1. single-step to location;
* 2. over tab by one tabstop, then single-step back to location.
*/
/* 1. Single-step to location. */
/* 2. Over tab by one tabstop, then single-step back to location. */
if (0 < tabstop
/* vt100 terminals only wrap the cursor when a spacing
* character is written. Control characters like <tab>
* will not cause a line wrap. Adjust the number of
* columns to backup by to reflect the cursor having been
* placed in the last column. See O'Reilly Termcap &
* Terminfo book.
*/
}
}
/*f
* column() adds the best sequence for moving the cursor from oldcol
* to newcol to outseq.
*
* column() considers column_address, parm_left/right_cursor,
* simp_col() and carriage_return + simp_col().
*/
STATIC void
{
int parm_cursor, dist;
return;
/* try out direct column addressing */
/* try out paramaterized left or right motion */
} else {
}
/* try carriage_return then simp_col() */
}
/* try getting there by simpl_col() */
}
/*f
* send relevant terminal sequences to the screen
*/
STATIC int
{
return ERR;
if (op < __MOVE_MAX_RELATIVE) {
while (0 < p1--)
(void) tputs(
);
} else {
(void) tputs(
0, 0, 0, 0, 0, 0, 0
), 1, putout
);
}
}
return OK;
}
/*f
* Low-level relative cursor motion. __m_mvcur() looks for the optimal
* way to move the cursor from point A to point B. If either of the
* coordinates for point A are -1 then only absolute addressing is used.
* If the coordinates are out-of-bounds then they are MODed into bounds.
*
* Since __m_mvcur() must perform output to various terminals, an API
* similar to tputs() and vidputs() was adopted.
*/
int
{
#ifdef M_CURSES_TRACE
"__m_mvcur(%d, %d, %d, %d, %p)",
);
#endif
/* try out direct cursor addressing */
}
}
}
}
}
}
/*
* A do nothing output function for tputs().
*/
STATIC int
int ch;
{
return ch;
}
/*
* Initialize an entry in cur_term->_move[] with parameters p1 and p2.
* Note that some capabilities will ignore their parameters.
*/
STATIC void
char *cap;
{
} else {
1, nilout
);
}
}
void
{
/* Relative cursor motion that will be costed on a per
* character basis in __m_mvcur().
*/
cost(
dest_tabs_magic_smso ? (char *) 0
: back_tab, __MOVE_BACK_TAB, 0, 0
);
/* Absolute cursor motion with fixed cost. */
/* Parameter cursor motion with worst case cost. */
}
int
{
#ifdef M_CURSES_TRACE
#endif
}