bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Corrections for 20030816


From: Philippe Blain
Subject: Corrections for 20030816
Date: Fri, 22 Aug 2003 07:28:18 +0200

>From Philippe Blain, Bordeaux, France.
My computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0

Subject: Corrections for ncurses-5.3-20030816+

1-----------------------------------------------------------------------
File : ncurses/tty/lib_mvcur.c

In onscreen_mvcur(), something very simple has been forgotten :
    updating the current position (SP->_cursrow, SP->_curscol).

Instead, it has been placed in GoTo() (static) with position_check().
Even executed if onscreen_mvcur() fails.  I see no reason why ?

MUST be in the low-level onscreen_mvcur() routine as mvcur() can be
called by an user program (ncurses API).

I've spent several days looking why my tests progs have a bad display
and core dump. (I was testing a modified mvcur)
I consider that as a major bug as the cursor position is false
memorized after an mvcur() doing hazardous display.
I suppose nobody in the world is using mvcur() alone !...
(even not used in the test directory)

static inline int
onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
{
    ....................
  nonlocal:
    if (usecost != INFINITY) {
        TPUTS_TRACE("mvcur");
        tputs(buffer, 1, _nc_outch);
==>     SP->_cursrow = ynew;
==>     SP->_curscol = xnew;
        return (OK);
    } else return (ERR);
}

2-----------------------------------------------------------------------
File : ncurses/tinfo/lib_tputs.c

Function : delay_output(int ms)

The actual formula (line 68)
    nullcount = (ms * _nc_baudrate(ospeed)) / 10000;
consider that 1 byte = 10 bits whereas the formula in '_nc_mvcur_init()'
for SP->_char_padding, consider 1 byte = 9 bits.

If we take 1 byte = 9 bits (7 bits + 1 parity + 1 stop), that line should be
:
==> nullcount = (ms * _nc_baudrate(ospeed)) / 9000;

    In 1 second, we transmit BAUDRATE bits or BAUDRATE/9 bytes.
    In 1 millisecond, we transmit BAUDRATE/9000 bytes.

To produce a delay of 1 ms, the actual formula (line 68) gives us :
    Bauds   Calculated value    nullcount value
     1200        0.12                 0     no null send, no delay produced
     4800        0.48                 0     no null send, no delay produced
     9600        0.96                 0     no null send, no delay produced
    38400        3.84                 3
    57600        5.76                 5

To produce a delay of 1 ms, the second formula gives us :
    Bauds   Calculated value    nullcount value
     1200        0.13                 0     no null send, no delay produced
     4800        0.53                 0     no null send, no delay produced
     9600        1.06                 1
    38400        4.26                 4
    57600        6.40                 6

------------------------------------------------------------------------
- Philippe






reply via email to

[Prev in Thread] Current Thread [Next in Thread]