2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 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 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved. 2N/A * Make_seq_best(s1, s2) 2N/A * Make_seq_best() swaps the values of the pointers if s1->cost > s2->cost. 2N/Astatic bool relative;
/* set if we really know where we are */ 2N/A * Add sequence 2 to sequence 1. 2N/A * add_op() adds the operator op and the appropriate 2N/A * number of parameters to seq. It also increases the 2N/A * cost appropriately. 2N/A * If op takes no parameters then p0 is taken to be a count. 2N/A /* No parameters, total is cost * p1. */ 2N/A /* Cursor motion using parameters have fixed cost. */ 2N/A * row() adds the best sequence for moving the cursor from orow 2N/A /* try out direct row addressing */ 2N/A /* try out parameterized up or down motion */ 2N/A /* try getting there one step at a time... */ 2N/A * Motion indexes used in simp_col(). 2N/A int _one;
/* Single-step index, same direction as tab. */ 2N/A int _opp;
/* Single-step index, opposite direction to tab. */ 2N/A * simp_col(outseq, oldcol, newcol) 2N/A * simp_col() adds the best simple sequence for getting from oldcol 2N/A * to newcol to outseq. simp_col() considers (back_)tab and 2N/A /* Tabstop preceding nc. */ 2N/A /* Set oc to tabstop before nc : oc <= nc. */ 2N/A /* Distance from next tabstop to nc in columns. */ 2N/A /* Tabstop preceding nc. */ 2N/A /* Set oc to tabstop after nc : nc <= oc. */ 2N/A /* Distance from tabstop preceding nc in columns. */ 2N/A /* Tab as close as possible to nc. */ 2N/A /* If tabs alone get us there, then stop. */ 2N/A * We're not exactly positioned yet. Compare the worth of 2N/A * 1. single-step to location; 2N/A * 2. over tab by one tabstop, then single-step back to location. 2N/A /* 1. Single-step to location. */ 2N/A /* 2. Over tab by one tabstop, then single-step back to location. */ 2N/A * vt100 terminals only wrap the cursor when a spacing 2N/A * character is written. Control characters like <tab> 2N/A * will not cause a line wrap. Adjust the number of 2N/A * columns to backup by to reflect the cursor having been 2N/A * placed in the last column. See O'Reilly Termcap & 2N/A * column() adds the best sequence for moving the cursor from oldcol 2N/A * to newcol to outseq. 2N/A * simp_col() and carriage_return + simp_col(). 2N/A /* try out direct column addressing */ 2N/A /* try out parameterized left or right motion */ 2N/A /* try carriage_return then simp_col() */ 2N/A /* try getting there by simpl_col() */ 2N/A * send relevant terminal sequences to the screen 2N/A * Low-level relative cursor motion. __m_mvcur() looks for the optimal 2N/A * way to move the cursor from point A to point B. If either of the 2N/A * coordinates for point A are -1 then only absolute addressing is used. 2N/A * If the coordinates are out-of-bounds then they are MODed into bounds. 2N/A * Since __m_mvcur() must perform output to various terminals, an API 2N/A * similar to tputs() and vidputs() was adopted. 2N/A /* try out direct cursor addressing */ 2N/A /* Force absolute position at bottom right because we */ 2N/A /* don't know where the terminal thinks it is... */ 2N/A * A do nothing output function for tputs(). 2N/A * Initialize an entry in cur_term->_move[] with parameters p1 and p2. 2N/A * Note that some capabilities will ignore their parameters. 2N/A tparm(
cap, (
long)
p1, (
long)
p2, 0, 0, 0, 0, 0, 0, 0),
2N/A * Relative cursor motion that will be costed on a per 2N/A * character basis in __m_mvcur(). 2N/A /* Absolute cursor motion with fixed cost. */ 2N/A /* Parameter cursor motion with worst case cost. */