cgma
|
#include <cstdio>
#include <cstdlib>
#include <signal.h>
#include <unistd.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <time.h>
#include "AppUtil.hpp"
#include "CubitMessage.hpp"
#include "CubitString.hpp"
#include "CubitObserver.hpp"
#include "SettingHandler.hpp"
#include "StubProgressTool.hpp"
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include "CubitUtil.hpp"
Go to the source code of this file.
Defines | |
#define | PATH_MAX _MAX_PATH |
Functions | |
void | cubit_update_terminal_size (int) |
void | sigint_handler (int) |
Variables | |
static volatile CubitBoolean | cubit_intr = CUBIT_FALSE |
#define PATH_MAX _MAX_PATH |
Definition at line 67 of file AppUtil.cpp.
void cubit_update_terminal_size | ( | int | ) |
Definition at line 114 of file AppUtil.cpp.
{ #if defined(_WIN32) // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getconsolescreenbufferinfo.asp // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/scrolling_a_screen_buffer_s_window.asp HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO scr_info; if (GetConsoleScreenBufferInfo(h_stdout, &scr_info)) { AppUtil::instance()->set_terminal_size( // dwSize.Y is will return the height of the scroll-back buffer. // srWindow contains the position of the visible rect of the // window in the buffer. That is the height of the window. scr_info.srWindow.Bottom - scr_info.srWindow.Top, // use width of scroll buffer rather than size of window // for number of columns. The window size is useless as // caller would need to know the offset in the X direction // to make use of it and we aren't returning that. Besides, // the user presumably set the scroll buffer to this width // because that's the line length (s)he wants. scr_info.dwSize.X ); } #elif defined(TIOCGWINSZ) // On UNIX platforms, register this function as a handler for // SIGWINCH. The system will then call this function any time // the user changes the size of the terminal window. #ifdef SIGWINCH signal( SIGWINCH, &cubit_update_terminal_size ); #endif const int file = fileno(stdout); struct winsize size; if( ioctl( file, TIOCGWINSZ, (char*)&size ) == 0 ) { AppUtil::instance()->set_terminal_size( size.ws_row, size.ws_col ); } #endif }
void sigint_handler | ( | int | ) |
Definition at line 306 of file AppUtil.cpp.
{ #ifndef CUBIT_NO_SIGNAL if( signal( SIGINT, sigint_handler ) == SIG_ERR ) PRINT_ERROR("Cannot continue to catch SIGINT!\n"); cubit_intr = CUBIT_TRUE; #endif }
volatile CubitBoolean cubit_intr = CUBIT_FALSE [static] |
Definition at line 112 of file AppUtil.cpp.