]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tty/tty_update.c
ncurses 5.6 - patch 20080920
[ncurses.git] / ncurses / tty / tty_update.c
index 6926b56198d94eb87d7e21db54feeb2d9335fc45..6a3a0c8e9341ece94e67edc7ec78db47a5845c82 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 
 #include <curses.priv.h>
 
 
 #include <curses.priv.h>
 
+#if defined __HAIKU__ && defined __BEOS__
+#undef __BEOS__
+#endif
+
 #ifdef __BEOS__
 #undef false
 #undef true
 #ifdef __BEOS__
 #undef false
 #undef true
@@ -74,7 +78,7 @@
 #include <ctype.h>
 #include <term.h>
 
 #include <ctype.h>
 #include <term.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.238 2006/11/25 22:33:21 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.246 2008/08/30 20:08:19 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -289,7 +293,7 @@ PutAttrChar(CARG_CH_T ch)
 #endif
     {
        PUTC(CHDEREF(ch), SP->_ofp);    /* macro's fastest... */
 #endif
     {
        PUTC(CHDEREF(ch), SP->_ofp);    /* macro's fastest... */
-       TRACE_OUTCHARS(1);
+       COUNT_OUTCHARS(1);
     }
     SP->_curscol += chlen;
     if (char_padding) {
     }
     SP->_curscol += chlen;
     if (char_padding) {
@@ -624,13 +628,18 @@ doupdate(void)
 
     T((T_CALLED("doupdate()")));
 
 
     T((T_CALLED("doupdate()")));
 
+    if (curscr == 0
+       || newscr == 0)
+       returnCode(ERR);
+
 #ifdef TRACE
 #ifdef TRACE
-    if (_nc_tracing & TRACE_UPDATE) {
+    if (USE_TRACEF(TRACE_UPDATE)) {
        if (curscr->_clear)
            _tracef("curscr is clear");
        else
            _tracedump("curscr", curscr);
        _tracedump("newscr", newscr);
        if (curscr->_clear)
            _tracef("curscr is clear");
        else
            _tracedump("curscr", curscr);
        _tracedump("newscr", newscr);
+       _nc_unlock_global(tracef);
     }
 #endif /* TRACE */
 
     }
 #endif /* TRACE */
 
@@ -640,7 +649,7 @@ doupdate(void)
        SP->_fifohold--;
 
 #if USE_SIZECHANGE
        SP->_fifohold--;
 
 #if USE_SIZECHANGE
-    if (SP->_endwin || SP->_sig_winch) {
+    if (SP->_endwin || _nc_handle_sigwinch(SP)) {
        /*
         * This is a transparent extension:  XSI does not address it,
         * and applications need not know that ncurses can do it.
        /*
         * This is a transparent extension:  XSI does not address it,
         * and applications need not know that ncurses can do it.
@@ -649,7 +658,7 @@ doupdate(void)
         * (this can happen in an xterm, for example), and resize the
         * ncurses data structures accordingly.
         */
         * (this can happen in an xterm, for example), and resize the
         * ncurses data structures accordingly.
         */
-       _nc_update_screensize();
+       _nc_update_screensize(SP);
     }
 #endif
 
     }
 #endif
 
@@ -666,7 +675,7 @@ doupdate(void)
     }
 #if USE_TRACE_TIMES
     /* zero the metering machinery */
     }
 #if USE_TRACE_TIMES
     /* zero the metering machinery */
-    _nc_outchars = 0;
+    RESET_OUTCHARS();
     (void) times(&before);
 #endif /* USE_TRACE_TIMES */
 
     (void) times(&before);
 #endif /* USE_TRACE_TIMES */
 
@@ -826,9 +835,10 @@ doupdate(void)
 
 #ifdef TRACE
        /* show altered highlights after magic-cookie check */
 
 #ifdef TRACE
        /* show altered highlights after magic-cookie check */
-       if (_nc_tracing & TRACE_UPDATE) {
+       if (USE_TRACEF(TRACE_UPDATE)) {
            _tracef("After magic-cookie check...");
            _tracedump("newscr", newscr);
            _tracef("After magic-cookie check...");
            _tracedump("newscr", newscr);
+           _nc_unlock_global(tracef);
        }
 #endif /* TRACE */
     }
        }
 #endif /* TRACE */
     }
@@ -836,7 +846,6 @@ doupdate(void)
 
     nonempty = 0;
     if (curscr->_clear || newscr->_clear) {    /* force refresh ? */
 
     nonempty = 0;
     if (curscr->_clear || newscr->_clear) {    /* force refresh ? */
-       TR(TRACE_UPDATE, ("clearing and updating from scratch"));
        ClrUpdate();
        curscr->_clear = FALSE; /* reset flag */
        newscr->_clear = FALSE; /* reset flag */
        ClrUpdate();
        curscr->_clear = FALSE; /* reset flag */
        newscr->_clear = FALSE; /* reset flag */
@@ -967,7 +976,7 @@ ClrUpdate(void)
     NCURSES_CH_T blank = ClrBlank(stdscr);
     int nonempty = min(screen_lines, newscr->_maxy + 1);
 
     NCURSES_CH_T blank = ClrBlank(stdscr);
     int nonempty = min(screen_lines, newscr->_maxy + 1);
 
-    TR(TRACE_UPDATE, ("ClrUpdate() called"));
+    TR(TRACE_UPDATE, (T_CALLED("ClrUpdate")));
 
     ClearScreen(blank);
 
 
     ClearScreen(blank);
 
@@ -977,6 +986,8 @@ ClrUpdate(void)
 
     for (i = 0; i < nonempty; i++)
        TransformLine(i);
 
     for (i = 0; i < nonempty; i++)
        TransformLine(i);
+
+    TR(TRACE_UPDATE, (T_RETURN("")));
 }
 
 /*
 }
 
 /*