From 59fa2d248c61604eb8049b7ef19450f1814d4fe4 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 28 Nov 2012 19:20:51 +0000 Subject: [PATCH] 2012-11-28 20:19 UTC+0100 Viktor Szakats (harbour syenar.net) + contrib/xhb/xhwinprn.prg - contrib/xhb/xhw32prn.prg * contrib/xhb/xhb.hbp * renamed to avoid using '32' when referring to Windows API * src/rtl/gtcrs/gtcrs.c * src/rtl/gtos2/gtos2.c * deleted excessive {} * commented code converted to #if 0 blocks * formatting --- harbour/ChangeLog.txt | 12 ++ harbour/contrib/xhb/xhb.hbp | 2 +- .../xhb/{xhw32prn.prg => xhwinprn.prg} | 0 harbour/src/rtl/gtcrs/gtcrs.c | 130 +++++++++--------- harbour/src/rtl/gtos2/gtos2.c | 2 - 5 files changed, 78 insertions(+), 68 deletions(-) rename harbour/contrib/xhb/{xhw32prn.prg => xhwinprn.prg} (100%) diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index 8c15f91c09..239501f4d5 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,18 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-11-28 20:19 UTC+0100 Viktor Szakats (harbour syenar.net) + + contrib/xhb/xhwinprn.prg + - contrib/xhb/xhw32prn.prg + * contrib/xhb/xhb.hbp + * renamed to avoid using '32' when referring to Windows API + + * src/rtl/gtcrs/gtcrs.c + * src/rtl/gtos2/gtos2.c + * deleted excessive {} + * commented code converted to #if 0 blocks + * formatting + 2012-11-28 17:59 UTC+0100 Viktor Szakats (harbour syenar.net) * src/rtl/checkbox.prg * src/rtl/listbox.prg diff --git a/harbour/contrib/xhb/xhb.hbp b/harbour/contrib/xhb/xhb.hbp index 2181f6feda..4aa684fd28 100644 --- a/harbour/contrib/xhb/xhb.hbp +++ b/harbour/contrib/xhb/xhb.hbp @@ -107,7 +107,7 @@ xhbmt.prg xhbole.prg xhbtedit.prg xhbver.prg -xhw32prn.prg +xhwinprn.prg hjwindow.prg hterrsys.prg diff --git a/harbour/contrib/xhb/xhw32prn.prg b/harbour/contrib/xhb/xhwinprn.prg similarity index 100% rename from harbour/contrib/xhb/xhw32prn.prg rename to harbour/contrib/xhb/xhwinprn.prg diff --git a/harbour/src/rtl/gtcrs/gtcrs.c b/harbour/src/rtl/gtcrs/gtcrs.c index 37ee6cb8af..0da516a531 100644 --- a/harbour/src/rtl/gtcrs/gtcrs.c +++ b/harbour/src/rtl/gtcrs/gtcrs.c @@ -1155,7 +1155,7 @@ static void set_tmevt( unsigned char * cMBuf, mouseEvent * mEvt ) break; } chk_mevtdblck( mEvt ); - /* printf("\n\rmouse event: %02x, %02x, %02x\n\r", cMBuf[0], cMBuf[1], cMBuf[2]); */ + /* printf( "\n\rmouse event: %02x, %02x, %02x\n\r", cMBuf[ 0 ], cMBuf[ 1 ], cMBuf[ 2 ] ); */ } #if defined( HB_HAS_GPM ) @@ -1374,13 +1374,13 @@ static void gt_refresh( InOutBase * ioBase ) { if( ioBase->disp_count == 0 ) { -/* - if(ioBase->cursor == SC_NONE) - leaveok( ioBase->hb_stdscr, HB_TRUE ); - else - leaveok( ioBase->hb_stdscr, HB_FALSE ); - */ -/* if(ioBase->cursor != SC_NONE) */ +#if 0 + if( ioBase->cursor == SC_NONE ) + leaveok( ioBase->hb_stdscr, HB_TRUE ); + else + leaveok( ioBase->hb_stdscr, HB_FALSE ); +#endif + /* if( ioBase->cursor != SC_NONE ) */ wmove( ioBase->hb_stdscr, ioBase->row, ioBase->col ); wrefresh( ioBase->hb_stdscr ); disp_cursor( ioBase ); @@ -1790,22 +1790,23 @@ static int gt_resize( InOutBase * ioBase ) if( gt_getsize( ioBase, &rows, &cols ) >= 0 ) { -/* +#if 0 #if defined( NCURSES_VERSION ) - wresize( ioBase->hb_stdscr, rows, cols ); + wresize( ioBase->hb_stdscr, rows, cols ); +#endif #endif -*/ endwin(); gt_refresh( ioBase ); ret = 0; -/* +#if 0 #if defined( NCURSES_VERSION ) - if( resize_term( rows, cols ) == OK ) { - ret = 0; - gt_refresh( ioBase ); - } + if( resize_term( rows, cols ) == OK ) + { + ret = 0; + gt_refresh( ioBase ); + } +#endif #endif -*/ getmaxyx( ioBase->hb_stdscr, ioBase->maxrow, ioBase->maxcol ); } return ret; @@ -2027,10 +2028,10 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, /* curses screen initialization */ ioBase->basescr = newterm( crsterm, ioBase->baseout, ioBase->basein ); - /* +#if 0 def_shell_mode(); def_prog_mode(); - */ +#endif curs_wrkaround(); if( ioBase->basescr == NULL ) @@ -2088,18 +2089,19 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, COLOR_WHITE }; start_color(); -/* - for( bg = 0; bg < COLORS; bg++ ) - for( fg = 0; fg < COLORS; fg++ ) - { - i = bg * COLORS + fg; - if( i == 0 ) - i = 7; - else if( i == 7 ) - i = 0; - init_pair( i, color_map[ fg ], color_map[ bg ] ); - } - */ + +#if 0 + for( bg = 0; bg < COLORS; bg++ ) + for( fg = 0; fg < COLORS; fg++ ) + { + i = bg * COLORS + fg; + if( i == 0 ) + i = 7; + else if( i == 7 ) + i = 0; + init_pair( i, color_map[ fg ], color_map[ bg ] ); + } +#endif for( i = 0; i < 256; i++ ) { bg = ( i >> 4 ) & 0x07; /* extract background color bits 4-6 */ @@ -2141,11 +2143,11 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, getmaxyx( ioBase->hb_stdscr, ioBase->maxrow, ioBase->maxcol ); scrollok( ioBase->hb_stdscr, HB_FALSE ); -/* - idlok( ioBase->hb_stdscr, HB_FALSE ); - idcok( ioBase->hb_stdscr, HB_FALSE ); - leaveok( ioBase->hb_stdscr, HB_FALSE ); - */ +#if 0 + idlok( ioBase->hb_stdscr, HB_FALSE ); + idcok( ioBase->hb_stdscr, HB_FALSE ); + leaveok( ioBase->hb_stdscr, HB_FALSE ); +#endif /* * curses keyboard initialization * we have our own keyboard routine so it's unnecessary now @@ -2157,14 +2159,14 @@ static InOutBase * create_ioBase( char * term, int infd, int outfd, int errfd, leaveok( ioBase->hb_stdscr, HB_FALSE ); curs_set( 0 ); -/* - nonl(); - nodelay( ioBase->hb_stdscr, HB_TRUE); - keypad( ioBase->hb_stdscr, HB_FALSE); - timeout( 0 ); - noecho(); - curs_set( 0 ); - */ +#if 0 + nonl(); + nodelay( ioBase->hb_stdscr, HB_TRUE ); + keypad( ioBase->hb_stdscr, HB_FALSE ); + timeout( 0 ); + noecho(); + curs_set( 0 ); +#endif wclear( ioBase->hb_stdscr ); wrefresh( ioBase->hb_stdscr ); @@ -2183,10 +2185,8 @@ static void destroy_ioBase( InOutBase * ioBase ) del_all_efds( ioBase ); if( ioBase->terminal_type == TERM_LINUX ) - { /* restore a standard bell frequency and duration */ write_ttyseq( ioBase, "\033[10]\033[11]" ); - } /* curses SCREEN delete */ if( ioBase->hb_stdscr != NULL ) @@ -2265,20 +2265,20 @@ static InOutBase * create_newXterm( void ) else ptr = ptyname; hb_snprintf( buf, sizeof( buf ), "-S%s/%d", ptr, masterfd ); -/* - close(0); - close(1); - close(2); - */ -/* - dup2(masterfd, 0); - dup2(masterfd, 1); #if 0 - fd = open("/tmp/hb-xterm.log", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); + close( 0 ); + close( 1 ); + close( 2 ); +#endif +#if 0 + dup2( masterfd, 0 ); + dup2( masterfd, 1 ); +#if 0 + fd = open( "/tmp/hb-xterm.log", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR ); +#endif + fd = open( "/dev/null", O_WRONLY ); + dup2( fd, 2 ); #endif - fd = open("/dev/null", O_WRONLY); - dup2(fd, 2); - */ for( fd = 3; fd < MAXFD; ++fd ) if( fd != masterfd ) close( fd ); @@ -2543,6 +2543,7 @@ static HB_BOOL hb_gt_crs_SetMode( PHB_GT pGT, int iRows, int iCols ) HB_GTSELF_RESIZE( pGT, iRows, iCols ); return HB_TRUE; } + return HB_FALSE; } @@ -2571,10 +2572,8 @@ static void hb_gt_crs_Tone( PHB_GT pGT, double dFrequency, double dDuration ) gt_tone( s_ioBase, dFrequency, dDuration ); if( s_ioBase->terminal_type == TERM_LINUX ) - { /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ hb_idleSleep( dDuration / 18.2 ); - } } /* *********************************************************************** */ @@ -2638,6 +2637,7 @@ static HB_BOOL hb_gt_crs_Suspend( PHB_GT pGT ) endwin(); gt_ttyrestore( s_ioBase ); } + return HB_TRUE; } @@ -2657,6 +2657,7 @@ static HB_BOOL hb_gt_crs_Resume( PHB_GT pGT ) /* redrawwin( s_ioBase->hb_stdscr ); */ gt_refresh( s_ioBase ); } + return HB_TRUE; } @@ -2669,9 +2670,8 @@ static HB_BOOL hb_gt_crs_PreExt( PHB_GT pGT ) HB_SYMBOL_UNUSED( pGT ); if( s_ioBase ) - { gt_refresh( s_ioBase ); - } + return HB_TRUE; } @@ -2722,9 +2722,7 @@ static void hb_gt_crs_mouse_Hide( PHB_GT pGT ) #if defined( HB_HAS_GPM ) if( s_ioBase->mouse_type == MOUSE_GPM ) - { gpm_visiblepointer = 0; - } #endif } @@ -2978,7 +2976,9 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) static void curs_wrkaround( void ) { back_color_erase = HB_FALSE; - /* cur_term->type.Booleans[28] = 0; */ +#if 0 + cur_term->type.Booleans[ 28 ] = 0; +#endif } #else static void curs_wrkaround( void ) { ; } diff --git a/harbour/src/rtl/gtos2/gtos2.c b/harbour/src/rtl/gtos2/gtos2.c index f20cb708f1..4fafe0ba57 100644 --- a/harbour/src/rtl/gtos2/gtos2.c +++ b/harbour/src/rtl/gtos2/gtos2.c @@ -573,9 +573,7 @@ static void hb_gt_os2_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil /* If I could not set codepage 437 I reset previous codepage, maybe I do not need to do this */ if( VioSetCp( 0, 437, 0 ) != NO_ERROR ) - { VioSetCp( 0, s_usOldCodePage, 0 ); - } hb_gt_os2_GetCursorPosition( &s_iCurRow, &s_iCurCol ); s_iCursorStyle = hb_gt_os2_GetCursorStyle();