[comp.unix.ultrix] Question on overlay

routley@tle.enet.dec.com (12/15/90)

I am very confused about the behavior of overwrite()/overlay().  The following
program behaves differently on different implementation of curses(), and I am 
confused as to which implementation is "correct".  There also appears to be a 
conflict between the man description and the implementation behavior.

First, the different behaviors.  The initial window resulting from the first
refresh() command appears (approxiamately) as:

On VAX/VMS V5.4: (box in upper left corner, editor seems to have screwed me up)

    -------------------------------------------------------
    |                  |                                                
                                        |
    |                  |                                                
                                        |
    |                  |                                                
                                        |
    |                  |                                                
                                        |
    ----------                                                          
                              |
    |                                                     |
    |                                                     |
    |                                                     |
    |                                                     |
    |                                                     |
    -------------------------------------------------------

On Ultrix V4.0: (box down and to the right)

    |-----------------------------------------------------|
    |                                                     |
    |    |--------|                                       |
    |    |        |                                       |
    |    |        |                                       |
    |    |        |                                       |
    |    |        |                                       |
    |    |--------|                                       |
    |                                                     |
    |                                                     |
    |                                                     |
    |-----------------------------------------------------|

The Ultrix V4.0 implementation of XPG/3: (box down, but flush left)

    |-----------------------------------------------------|
    |                                                     |
    |--------|                                            |
    |        |                                            |
    |        |                                            |
    |        |                                            |
    |        |                                            |
    |--------|                                            |
    |                                                     |
    |                                                     |
    |                                                     |
    |-----------------------------------------------------|


Now you see why I'm confused!  I believe that the behavior from Ultrix V4.0
is "correct", but I'd like confirmation.  Any examples from other systems?

The man page from both Ultrix V4.0 and Ultrix V4.0 XPG/3 reads as follows:

     The overlay routine copies all the text from the source win-
     dow srcwin on top of the destination window dstwin. The two
     windows are not required to be the same size.  The copy
     starts at (0, 0) on both windows.  The copy is non-
     destructive, so blanks are not copied.

     The overwrite routine copies all of srcwin on top of
     destwin. The copy starts at (0, 0) on both windows.  This is
     a desructive copy as blanks are copied.
 
which tends to imply the behavior from VAX/VMS!!!  Can someone justify the
Ultrix V4.0 behavior based on the above description?  The O'Reilly and Assoc.
Nutshell Booklet "Programming with Curses" describes the Ultrix V4.0 behavior
as correct, but doesn't discuss XPG/3.

In case anyone wants to know why, I work on the VAX C RTL project at DEC, and
am trying to fix the VAX/VMS behavior to be correct.  If only someone can tell
me what "correct" is!

Reply by mail and I'll summarize to the net.

Thanks,
Kevin Routley

tle.enet.dec.com!routley	Digital Equipment Corporation
routley@tle.enet.dec.com        VAX C RTL

#include <curses.h>

WINDOW *win1;

main()
{
        char str[80];
        char thing;

        initscr();
        noecho();
        win1 = newwin( 10, 20, 10, 10 );

        box( stdscr, '|', '-' );
        box( win1,   '|', '-' );

        overwrite( win1, stdscr );
        refresh();

        crmode();
        getstr(str);

        endwin();
}