diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b6c3429ab3..117c115810 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,19 @@ +2000-07-04 04:05 UTC+0100 Victor Szakats + + * contrib/odbc/bld_b32.bat + ! Fixed. + + * source/rtl/tget.prg + ! Fix by Chen Kedem applied for __GET()/_GET_()/GetNew() not passed + setget block bug. + + * source/rtl/filesys.c + * source/rtl/memoline.c + * source/rtl/gtsln/kbsln.c + * source/rtl/gtsln/keytrans.c + * source/vm/classes.c + * Formatting. + 2000-07-03 20:00 UTC+0100 Ryszard Glab *source/vm/garbage.c diff --git a/harbour/contrib/odbc/bld_b32.bat b/harbour/contrib/odbc/bld_b32.bat index bf557bc11f..14194fe1dc 100644 --- a/harbour/contrib/odbc/bld_b32.bat +++ b/harbour/contrib/odbc/bld_b32.bat @@ -4,5 +4,6 @@ rem $Id$ rem ..\..\bin\harbour %1 /n /i..\include %2 -bcc32 -e%1.exe -O2 -I..\..\include -L..\..\lib\b32 rtl.lib gtwin.lib vm.lib pp.lib rdd.lib hbodbc.lib odbc32.lib macro.lib common.lib %1.c +bcc32 -e%1.exe -O2 -d -I..\..\include -L..\..\lib\b32 %1.c debug.lib vm.lib rtl.lib gtwin.lib lang.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib hbodbc.lib odbc32.lib + rem del %1.c diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 8d0bb4ff6b..6ccba7dfc2 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1205,7 +1205,7 @@ USHORT hb_fsCurDirBuff( USHORT uiDrive, BYTE * pbyBuffer, ULONG ulLen ) if( pbyStart[ 1 ] == ':' ) pbyStart += 2; - if( pbyStart[ 0 ] == '\\' ) + if( strchr( OS_PATH_DELIMITER_LIST, pbyStart[ 0 ] ) ) pbyStart++; if( pbyBuffer != pbyStart ) diff --git a/harbour/source/rtl/gtsln/kbsln.c b/harbour/source/rtl/gtsln/kbsln.c index 9ce2d742f4..a5fdb89198 100644 --- a/harbour/source/rtl/gtsln/kbsln.c +++ b/harbour/source/rtl/gtsln/kbsln.c @@ -77,25 +77,25 @@ #define ALTR_PRESSED 2 #define CONTROL_PRESSED 4 #define ALTL_PRESSED 8 - #define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED) + #define ALT_PRESSED ( ALTL_PRESSED || ALTR_PRESSED ) #elif defined(M_UNIX) /* SCO */ #define SHIFT_PRESSED 1 #define ALTR_PRESSED 8 #define CONTROL_PRESSED 2 #define ALTL_PRESSED 4 - #define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED) + #define ALT_PRESSED ( ALTL_PRESSED || ALTR_PRESSED ) #else /* we don't know how to do this */ #define SHIFT_PRESSED 0 #define ALTR_PRESSED 0 #define CONTROL_PRESSED 0 #define ALTL_PRESSED 0 - #define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED) + #define ALT_PRESSED ( ALTL_PRESSED || ALTR_PRESSED ) #endif /* extra keysyms definitions */ #define SL_KEY_MAX 1000 #define SL_KEY_ESC SL_KEY_MAX + 1 -#define SL_KEY_ALT_L( ch ) ( SL_KEY_MAX + ( ( unsigned int )ch ) ) +#define SL_KEY_ALT_L( ch ) ( SL_KEY_MAX + ( ( unsigned int ) ch ) ) /* indicates that screen size has changed */ extern BOOL hb_gt_sln_bScreen_Size_Changed; @@ -114,6 +114,7 @@ static void hb_gt_Init_KeyTranslat() int keynum, i; #ifdef IBMPC_SYSTEM + keynum = 11; keyname[ 0 ] = '^'; keyname[ 1 ] = '@'; @@ -123,7 +124,7 @@ static void hb_gt_Init_KeyTranslat() for( ch = 0x54; ch <= 0x71; ch++ ) { keyname[ 2 ] = ch; - SLkp_define_keysym( keyname, SL_KEY_F(keynum) ); + SLkp_define_keysym( keyname, SL_KEY_F( keynum ) ); keynum++; } @@ -132,93 +133,95 @@ static void hb_gt_Init_KeyTranslat() while( i < sizeof( transDosScanCodeTab ) ) { i++; - if( transDosScanCodeTab[i] < 32 ) + if( transDosScanCodeTab[ i ] < 32 ) { keyname[ 2 ] = '^'; - keyname[ 3 ] = transDosScanCodeTab[i]+'A'-1; + keyname[ 3 ] = transDosScanCodeTab[ i ] + 'A' - 1; keyname[ 4 ] = 0; } /* - else if( transDosScanCodeTab[i] >= 127 ) + else if( transDosScanCodeTab[ i ] >= 127 ) { - sprintf( &keyname[ 2 ], "\\x%02X", transDosScanCodeTab[i] ); + sprintf( &keyname[ 2 ], "\\x%02X", transDosScanCodeTab[ i ] ); keyname[ 6 ] = 0; } */ else { - keyname[ 2 ] = transDosScanCodeTab[i]; + keyname[ 2 ] = transDosScanCodeTab[ i ]; keyname[ 3 ] = 0; } - SLkp_define_keysym( keyname, SL_KEY_ALT_L( transDosScanCodeTab[i-1] ) ); + SLkp_define_keysym( keyname, SL_KEY_ALT_L( transDosScanCodeTab[ i - 1 ] ) ); i++; } #else - char *keyseq; - - /* on Unix systems ESC is a special key so let - assume ESC is also a doble pressed ESCkey - */ - SLkp_define_keysym( "^[^[", SL_KEY_ESC ); - - /* try to define Shft-Fn and Ctrl-Fn keys. - Because we assume terminal has only 10 Fkeys - so F11-F30 is generated with Shift & Ctrl. - This is not guaranteed to work in all cases - */ - keynum = 11; - keyname[ 0 ] = 'F'; - keyname[ 2 ] = 0; - - /* Shft & Ctrl FKeys definition takes place in two - phases : from '1' to '9' and from 'A' to 'K' - */ - for( i=1; i<=2; i++ ) { - for( ch = ( i==1 ? '1' : 'A' ); ch <= ( i==1 ? '9' : 'K' ); ch++ ) - { - keyname[ 1 ] = ch; - keyseq = SLtt_tgetstr( keyname ); - if( (keyseq != NULL) && (keyseq[0] != 0) ) - { - if( (keyseq != NULL) && (keyseq[0] != 0) ) - SLkp_define_keysym( keyseq, SL_KEY_F(keynum) ); - } - keynum++; - } - } - - /* if we are on linux console pressing Alt generates ^[ before sequence */ - if( s_linuxConsole || s_underXTerm ) - { - keyname[ 0 ] = 033; - keyname[ 2 ] = 0; - - /* Alt+Letter & Alt+digit definition takes place in - two phases : from '0' to '9' and from 'A' to 'Z' + char * keyseq; + + /* on Unix systems ESC is a special key so let + assume ESC is also a doble pressed ESCkey */ - for( i=1; i<=2; i++ ) + SLkp_define_keysym( "^[^[", SL_KEY_ESC ); + + /* try to define Shft-Fn and Ctrl-Fn keys. + Because we assume terminal has only 10 Fkeys + so F11-F30 is generated with Shift & Ctrl. + This is not guaranteed to work in all cases + */ + keynum = 11; + keyname[ 0 ] = 'F'; + keyname[ 2 ] = 0; + + /* Shft & Ctrl FKeys definition takes place in two + phases : from '1' to '9' and from 'A' to 'K' + */ + for( i = 1; i <= 2; i++ ) { - for( ch = ( i==1 ? '0' : 'A' ); ch <= ( i==1 ? '9' : 'Z' ); ch++ ) + for( ch = ( i == 1 ? '1' : 'A' ); ch <= ( i == 1 ? '9' : 'K' ); ch++ ) { keyname[ 1 ] = ch; - /* QUESTION: why Slang reports error for defining Alt+O ???. - Have I any error in key definitiions ??? - */ - if( ch != 'O' ) - SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch ) ); - - keyname[ 1 ] = (ch+' '); - SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch+' ' ) ); + keyseq = SLtt_tgetstr( keyname ); + if( ( keyseq != NULL ) && ( keyseq[ 0 ] != 0 ) ) + { + if( ( keyseq != NULL ) && ( keyseq[ 0 ] != 0 ) ) + SLkp_define_keysym( keyseq, SL_KEY_F( keynum ) ); + } + keynum++; + } + } + + /* if we are on linux console pressing Alt generates ^[ before sequence */ + if( s_linuxConsole || s_underXTerm ) + { + keyname[ 0 ] = 033; + keyname[ 2 ] = 0; + + /* Alt+Letter & Alt+digit definition takes place in + two phases : from '0' to '9' and from 'A' to 'Z' + */ + for( i = 1; i <= 2; i++ ) + { + for( ch = ( i == 1 ? '0' : 'A' ); ch <= ( i == 1 ? '9' : 'Z' ); ch++ ) + { + keyname[ 1 ] = ch; + /* QUESTION: why Slang reports error for defining Alt+O ???. + Have I any error in key definitiions ??? + */ + if( ch != 'O' ) + SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch ) ); + + keyname[ 1 ] = ( ch + ' ' ); + SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch + ' ' ) ); + } } } } #endif } -int hb_gt_Init_Terminal(int phase) +int hb_gt_Init_Terminal( int phase ) { #ifndef IBMPC_SYSTEM struct termios newTTY; @@ -226,17 +229,17 @@ int hb_gt_Init_Terminal(int phase) int ret = 0; /* Ctrl-C to abort, no flow-control, no output processing */ - if( SLang_init_tty(HB_GT_ABORT_KEY, 0, 0) != (-1) ) + if( SLang_init_tty( HB_GT_ABORT_KEY, 0, 0 ) != -1 ) { #ifndef IBMPC_SYSTEM /* do missing disable of start/stop processing */ if( tcgetattr( SLang_TT_Read_FD, &newTTY ) == 0 ) { - newTTY.c_cc[VSTOP] = 255; /* disable ^S start/stop processing */ - newTTY.c_cc[VSTART] = 255; /* disable ^Q start/stop processing */ - newTTY.c_cc[VSUSP] = 255; /* disable ^Z suspend processing */ + newTTY.c_cc[ VSTOP ] = 255; /* disable ^S start/stop processing */ + newTTY.c_cc[ VSTART ] = 255; /* disable ^Q start/stop processing */ + newTTY.c_cc[ VSUSP ] = 255; /* disable ^Z suspend processing */ - if( tcsetattr( SLang_TT_Read_FD, TCSADRAIN, &newTTY ) == 0 ) + if( tcsetattr( SLang_TT_Read_FD, TCSADRAIN, &newTTY ) == 0 ) /* everything looks ok so far */ #endif ret = 1; @@ -248,12 +251,12 @@ int hb_gt_Init_Terminal(int phase) /* first time init phase - we don't want this after return from system command ( see run.c ) */ - if( ret && (phase == 0) ) + if( ret && ( phase == 0 ) ) { /* an uncertain way to check if we run under linux console */ - s_linuxConsole = ( !strncmp ( getenv("TERM"), "linux", 5 ) ); + s_linuxConsole = ( ! strncmp( getenv( "TERM" ), "linux", 5 ) ); /* an uncertain way to check if we run under xterm */ - s_underXTerm = ( strstr( getenv("TERM"), "xterm" ) != NULL ); + s_underXTerm = ( strstr( getenv( "TERM" ), "xterm" ) != NULL ); /* define keyboard translations */ hb_gt_Init_KeyTranslat(); @@ -288,7 +291,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) SLsmg_reinit_smg(); #endif /* TODO: we need here some kind of screen redrawing */ - /*SLsmg_refresh ();*/ + /*SLsmg_refresh();*/ } if( SLang_input_pending( 0 ) > 0 ) @@ -300,15 +303,15 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) /* NOTE: This will probably not work on slow terminals or on a very busy lines (i.e. modem lines ) */ - ch = SLang_getkey (); + ch = SLang_getkey(); if( ch == 033 ) /* escape */ { - if( 0 == SLang_input_pending (ESC_TIMEOUT) ) + if( 0 == SLang_input_pending( ESC_TIMEOUT ) ) return 033; } - SLang_ungetkey (ch); + SLang_ungetkey( ch ); /* ------------------------------------------------- */ @@ -332,23 +335,23 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) if( ch < 32 ) /* control characters - simply return */ return ch; - else if( ( ch >= 32 ) && ( ch < 256 ) )/* normal characters ? */ + else if( ( ch >= 32 ) && ( ch < 256 ) ) /* normal characters ? */ { if( kbdflags & ALT_PRESSED ) { /* lower to upper case */ - if( (ch >= 'a') && (ch <= 'z') ) + if( ( ch >= 'a' ) && ( ch <= 'z' ) ) ch -= ' '; /* alt + letter */ - if( (ch >= 'A') && (ch <= 'Z') ) + if( ( ch >= 'A' ) && ( ch <= 'Z' ) ) /* returned value is next in a table */ - return transAltKeyLetterTab[ (ch-'A')*2+1 ]; + return transAltKeyLetterTab[ ( ch - 'A' ) * 2 + 1 ]; /* alt + digit */ - if ( (ch >= '0') && (ch <= '9') ) + if( ( ch >= '0' ) && ( ch <= '9' ) ) /* returned value is next in a table */ - return transAltKeyDigitTab[ (ch-'0')*2+1 ]; + return transAltKeyDigitTab[ ( ch - '0' ) * 2 + 1 ]; } return ch; @@ -367,17 +370,17 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) /* Linux/Dos Alt+A-Z keys */ else if( ( ch >= SL_KEY_ALT_L( 'A' ) ) && ( ch <= SL_KEY_ALT_L( 'Z' ) ) ) /* returned value is next in a table */ - return transAltKeyLetterTab[ (ch-SL_KEY_MAX-'A')*2+1 ]; + return transAltKeyLetterTab[ ( ch - SL_KEY_MAX - 'A' ) * 2 + 1 ]; /* Linux Alt+a-z keys - lower to upper conersion */ else if( ( ch >= SL_KEY_ALT_L( 'a' ) ) && ( ch <= SL_KEY_ALT_L( 'z' ) ) ) /* returned value is next in a table */ - return transAltKeyLetterTab[ (ch-SL_KEY_MAX-(' ')-('A'))*2+1 ]; + return transAltKeyLetterTab[ ( ch - SL_KEY_MAX - ' ' - 'A' ) * 2 + 1 ]; /* Linux/Dos Alt+0-9 keys */ else if( ( ch >= SL_KEY_ALT_L( '0' ) ) && ( ch <= SL_KEY_ALT_L( '9' ) ) ) /* returned value is next in a table */ - return transAltKeyDigitTab[ (ch-SL_KEY_MAX-'0')*2+1 ]; + return transAltKeyDigitTab[ ( ch - SL_KEY_MAX - '0' ) * 2 + 1 ]; return ch; } @@ -392,7 +395,7 @@ static int hb_gt_try_get_Kbd_State() unsigned char modifiers = 6; - if( ioctl (0, TIOCLINUX, &modifiers) < 0 ) + if( ioctl( 0, TIOCLINUX, &modifiers ) < 0 ) return 0; return ( int ) modifiers; @@ -402,23 +405,23 @@ static int hb_gt_try_get_Kbd_State() int modifiers = 0; int IOcommand = 0; - if( ioctl(0, TCGETSC, &modifiers) >= 0 ) + if( ioctl( 0, TCGETSC, &modifiers ) >= 0 ) { if( modifiers == KB_XSCANCODE ) { IOcommand = KB_ISSCANCODE; - if( ioctl(0, TCSETSC, &IOcommand) >= 0 ) + if( ioctl( 0, TCSETSC, &IOcommand ) >= 0 ) { - if( ioctl(0, KDGKBSTATE, &modifiers) < 0 ) + if( ioctl( 0, KDGKBSTATE, &modifiers ) < 0 ) modifiers = 0; } else modifiers = 0; IOcommand = KB_XSCANCODE; - if( ioctl(0, TCSETSC, &IOcommand) < 0 ) + if( ioctl( 0, TCSETSC, &IOcommand ) < 0 ) modifiers = 0; } - else if( ioctl(0, KDGKBSTATE, &modifiers) < 0 ) + else if( ioctl( 0, KDGKBSTATE, &modifiers ) < 0 ) modifiers = 0; return modifiers; @@ -430,17 +433,17 @@ static int hb_gt_try_get_Kbd_State() int hb_gt_Shft_Pressed() { - return (hb_gt_try_get_Kbd_State() & SHIFT_PRESSED) != 0; + return ( hb_gt_try_get_Kbd_State() & SHIFT_PRESSED ) != 0; } int hb_gt_Ctrl_Pressed() { - return (hb_gt_try_get_Kbd_State() & CONTROL_PRESSED) != 0; + return ( hb_gt_try_get_Kbd_State() & CONTROL_PRESSED ) != 0; } int hb_gt_Alt_Pressed() { - return (hb_gt_try_get_Kbd_State() & ALT_PRESSED) != 0; + return ( hb_gt_try_get_Kbd_State() & ALT_PRESSED ) != 0; } int hb_gt_Kbd_State() diff --git a/harbour/source/rtl/gtsln/keytrans.c b/harbour/source/rtl/gtsln/keytrans.c index 2af34e18b2..656f0d47b6 100644 --- a/harbour/source/rtl/gtsln/keytrans.c +++ b/harbour/source/rtl/gtsln/keytrans.c @@ -36,96 +36,96 @@ /* a table of function keys translation */ static int transKeyFunTab[] = { - SL_KEY_DOWN, K_DOWN, - SL_KEY_UP, K_UP, - SL_KEY_LEFT, K_LEFT, - SL_KEY_RIGHT, K_RIGHT, - SL_KEY_HOME, K_HOME, - SL_KEY_END, K_END, - SL_KEY_BACKSPACE, K_BS, - SL_KEY_IC, K_INS, - SL_KEY_DELETE, K_DEL, - SL_KEY_NPAGE, K_PGDN, - SL_KEY_PPAGE, K_PGUP, - SL_KEY_ESC, K_ESC, - SL_KEY_F(1), K_F1, - SL_KEY_F(2), K_F2, - SL_KEY_F(3), K_F3, - SL_KEY_F(4), K_F4, - SL_KEY_F(5), K_F5, - SL_KEY_F(6), K_F6, - SL_KEY_F(7), K_F7, - SL_KEY_F(8), K_F8, - SL_KEY_F(9), K_F9, - SL_KEY_F(10), K_F10, - SL_KEY_F(11), K_SH_F1, - SL_KEY_F(12), K_SH_F2, - SL_KEY_F(13), K_SH_F3, - SL_KEY_F(14), K_SH_F4, - SL_KEY_F(15), K_SH_F5, - SL_KEY_F(16), K_SH_F6, - SL_KEY_F(17), K_SH_F7, - SL_KEY_F(18), K_SH_F8, - SL_KEY_F(19), K_SH_F9, - SL_KEY_F(20), K_SH_F10, - SL_KEY_F(21), K_CTRL_F1, - SL_KEY_F(22), K_CTRL_F2, - SL_KEY_F(23), K_CTRL_F3, - SL_KEY_F(24), K_CTRL_F4, - SL_KEY_F(25), K_CTRL_F5, - SL_KEY_F(26), K_CTRL_F6, - SL_KEY_F(27), K_CTRL_F7, - SL_KEY_F(28), K_CTRL_F8, - SL_KEY_F(29), K_CTRL_F9, - SL_KEY_F(30), K_CTRL_F10, - SL_KEY_F(31), K_ALT_F1, - SL_KEY_F(32), K_ALT_F2, - SL_KEY_F(33), K_ALT_F3, - SL_KEY_F(34), K_ALT_F4, - SL_KEY_F(35), K_ALT_F5, - SL_KEY_F(36), K_ALT_F6, - SL_KEY_F(37), K_ALT_F7, - SL_KEY_F(38), K_ALT_F8, - SL_KEY_F(39), K_ALT_F9, - SL_KEY_F(40), K_ALT_F10 + SL_KEY_DOWN, K_DOWN, + SL_KEY_UP, K_UP, + SL_KEY_LEFT, K_LEFT, + SL_KEY_RIGHT, K_RIGHT, + SL_KEY_HOME, K_HOME, + SL_KEY_END, K_END, + SL_KEY_BACKSPACE, K_BS, + SL_KEY_IC, K_INS, + SL_KEY_DELETE, K_DEL, + SL_KEY_NPAGE, K_PGDN, + SL_KEY_PPAGE, K_PGUP, + SL_KEY_ESC, K_ESC, + SL_KEY_F(1), K_F1, + SL_KEY_F(2), K_F2, + SL_KEY_F(3), K_F3, + SL_KEY_F(4), K_F4, + SL_KEY_F(5), K_F5, + SL_KEY_F(6), K_F6, + SL_KEY_F(7), K_F7, + SL_KEY_F(8), K_F8, + SL_KEY_F(9), K_F9, + SL_KEY_F(10), K_F10, + SL_KEY_F(11), K_SH_F1, + SL_KEY_F(12), K_SH_F2, + SL_KEY_F(13), K_SH_F3, + SL_KEY_F(14), K_SH_F4, + SL_KEY_F(15), K_SH_F5, + SL_KEY_F(16), K_SH_F6, + SL_KEY_F(17), K_SH_F7, + SL_KEY_F(18), K_SH_F8, + SL_KEY_F(19), K_SH_F9, + SL_KEY_F(20), K_SH_F10, + SL_KEY_F(21), K_CTRL_F1, + SL_KEY_F(22), K_CTRL_F2, + SL_KEY_F(23), K_CTRL_F3, + SL_KEY_F(24), K_CTRL_F4, + SL_KEY_F(25), K_CTRL_F5, + SL_KEY_F(26), K_CTRL_F6, + SL_KEY_F(27), K_CTRL_F7, + SL_KEY_F(28), K_CTRL_F8, + SL_KEY_F(29), K_CTRL_F9, + SL_KEY_F(30), K_CTRL_F10, + SL_KEY_F(31), K_ALT_F1, + SL_KEY_F(32), K_ALT_F2, + SL_KEY_F(33), K_ALT_F3, + SL_KEY_F(34), K_ALT_F4, + SL_KEY_F(35), K_ALT_F5, + SL_KEY_F(36), K_ALT_F6, + SL_KEY_F(37), K_ALT_F7, + SL_KEY_F(38), K_ALT_F8, + SL_KEY_F(39), K_ALT_F9, + SL_KEY_F(40), K_ALT_F10 }; /* a table of alt+letter translation */ static int transAltKeyLetterTab[] = { - 'A' , K_ALT_A , 'B' , K_ALT_B , 'C' , K_ALT_C , - 'D' , K_ALT_D , 'E' , K_ALT_E , 'F' , K_ALT_F , - 'G' , K_ALT_G , 'H' , K_ALT_H , 'I' , K_ALT_I , - 'J' , K_ALT_J , 'K' , K_ALT_K , 'L' , K_ALT_L , - 'M' , K_ALT_M , 'N' , K_ALT_N , 'O' , K_ALT_O , - 'P' , K_ALT_P , 'Q' , K_ALT_Q , 'R' , K_ALT_R , - 'S' , K_ALT_S , 'T' , K_ALT_T , 'U' , K_ALT_U , - 'V' , K_ALT_V , 'W' , K_ALT_W , 'X' , K_ALT_X , - 'Y' , K_ALT_Y , 'Z' , K_ALT_Z + 'A' , K_ALT_A , 'B' , K_ALT_B , 'C' , K_ALT_C , + 'D' , K_ALT_D , 'E' , K_ALT_E , 'F' , K_ALT_F , + 'G' , K_ALT_G , 'H' , K_ALT_H , 'I' , K_ALT_I , + 'J' , K_ALT_J , 'K' , K_ALT_K , 'L' , K_ALT_L , + 'M' , K_ALT_M , 'N' , K_ALT_N , 'O' , K_ALT_O , + 'P' , K_ALT_P , 'Q' , K_ALT_Q , 'R' , K_ALT_R , + 'S' , K_ALT_S , 'T' , K_ALT_T , 'U' , K_ALT_U , + 'V' , K_ALT_V , 'W' , K_ALT_W , 'X' , K_ALT_X , + 'Y' , K_ALT_Y , 'Z' , K_ALT_Z }; /* a table of alt+digit translation */ static int transAltKeyDigitTab[] = { - '0' , K_ALT_0 , '1' , K_ALT_1 , - '2' , K_ALT_2 , '3' , K_ALT_3 , - '4' , K_ALT_4 , '5' , K_ALT_5 , - '6' , K_ALT_6 , '7' , K_ALT_7 , - '8' , K_ALT_8 , '9' , K_ALT_9 + '0' , K_ALT_0 , '1' , K_ALT_1 , + '2' , K_ALT_2 , '3' , K_ALT_3 , + '4' , K_ALT_4 , '5' , K_ALT_5 , + '6' , K_ALT_6 , '7' , K_ALT_7 , + '8' , K_ALT_8 , '9' , K_ALT_9 }; #ifdef IBMPC_SYSTEM /* a table of Dos ScanCode translation - hard coded in Slang */ static unsigned char transDosScanCodeTab[] = { - 'A' , 0x1e , 'B' , 0x30 , 'C' , 0x2e , 'D' , 0x20 , 'E' , 0x12 , - 'F' , 0x21 , 'G' , 0x22 , 'H' , 0x23 , 'I' , 0x17 , 'J' , 0x24 , - 'K' , 0x25 , 'L' , 0x26 , 'M' , 0x32 , 'N' , 0x31 , 'O' , 0x18 , - 'P' , 0x19 , 'Q' , 0x10 , 'R' , 0x13 , 'S' , 0x1f , 'T' , 0x14 , - 'U' , 0x16 , 'V' , 0x2f , 'W' , 0x11 , 'X' , 0x2d , 'Y' , 0x15 , - 'Z' , 0x2c , '1' , 0x78 , '2' , 0x79 , '3' , 0x7a , '4' , 0x7b , - '5' , 0x7c , '6' , 0x7d , '7' , 0x7e , '8' , 0x7f , '9' , 0x80 , - '0' , 0x81 + 'A' , 0x1E , 'B' , 0x30 , 'C' , 0x2E , 'D' , 0x20 , 'E' , 0x12 , + 'F' , 0x21 , 'G' , 0x22 , 'H' , 0x23 , 'I' , 0x17 , 'J' , 0x24 , + 'K' , 0x25 , 'L' , 0x26 , 'M' , 0x32 , 'N' , 0x31 , 'O' , 0x18 , + 'P' , 0x19 , 'Q' , 0x10 , 'R' , 0x13 , 'S' , 0x1F , 'T' , 0x14 , + 'U' , 0x16 , 'V' , 0x2F , 'W' , 0x11 , 'X' , 0x2D , 'Y' , 0x15 , + 'Z' , 0x2C , '1' , 0x78 , '2' , 0x79 , '3' , 0x7A , '4' , 0x7B , + '5' , 0x7C , '6' , 0x7D , '7' , 0x7E , '8' , 0x7F , '9' , 0x80 , + '0' , 0x81 }; #endif diff --git a/harbour/source/rtl/memoline.c b/harbour/source/rtl/memoline.c index 188194072f..e8ef63bd44 100644 --- a/harbour/source/rtl/memoline.c +++ b/harbour/source/rtl/memoline.c @@ -70,10 +70,7 @@ HB_FUNC( MEMOLINE ) case HB_CHAR_LF: ulCurLength = 0; ulLastSpace = 0; - if ( ulPos >= 2 ) - ulLineEnd = ulPos -2; - else - ulLineEnd = ulLineBegin; + ulLineEnd = ( ulPos >= 2 ) ? ( ulPos - 2 ) : ulLineBegin; ulLines++; if( ulLines < ulLineNumber ) { @@ -131,10 +128,7 @@ HB_FUNC( MEMOLINE ) if( ulLineEnd == 0 ) { ulLines++; - if ( ulPos == 0) - ulLineEnd = 0; - else - ulLineEnd = ulPos - 1; + ulLineEnd = ( ulPos == 0 ) ? 0 : ( ulPos - 1 ); } if( ulLineNumber == ulLines && ulLineEnd >= ulLineBegin ) @@ -157,4 +151,5 @@ HB_FUNC( MEMOLINE ) } else hb_retc( "" ); -} \ No newline at end of file +} + diff --git a/harbour/source/rtl/tget.prg b/harbour/source/rtl/tget.prg index 6da0c7e3af..0d4b07433f 100644 --- a/harbour/source/rtl/tget.prg +++ b/harbour/source/rtl/tget.prg @@ -35,6 +35,7 @@ #include "hbclass.ch" #include "hbsetup.ch" + #include "color.ch" #include "common.ch" #include "setcurs.ch" @@ -147,30 +148,31 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS TGet DEFAULT nRow TO Row() DEFAULT nCol TO Col() DEFAULT cVarName TO "" + DEFAULT bVarBlock TO MemvarBlock( cVarName ) DEFAULT cPicture TO "" DEFAULT cColorSpec TO hb_ColorIndex( SetColor(), CLR_UNSELECTED ) + "," + hb_ColorIndex( SetColor(), CLR_ENHANCED ) - + ::BadDate := .f. ::Block := bVarBlock ::Changed := .f. ::Clear := .f. ::Col := nCol ::ColorSpec := cColorSpec - ::DecPos := Nil + ::DecPos := NIL ::ExitState := 0 ::HasFocus := .f. ::Minus := .f. ::Name := cVarName ::Original := ::VarGet() ::Picture := cPicture - ::Pos := Nil - ::PostBlock := Nil - ::PreBlock := Nil - ::Reader := Nil + ::Pos := NIL + ::PostBlock := NIL + ::PreBlock := NIL + ::Reader := NIL ::Rejected := .f. ::Row := nRow - ::SubScript := Nil - ::Type := Valtype( ::Original ) + ::SubScript := NIL + ::Type := ValType( ::Original ) ::TypeOut := .f. ::nDispPos := 1 ::nOldPos := 0 @@ -188,7 +190,7 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS TGet endif if ( nAt := At( "S", ::cPicFunc ) ) > 0 for nFor := nAt + 1 to Len( ::cPicFunc ) - if !IsDigit( SubStr( ::cPicFunc, nFor, 1 ) ) + if ! IsDigit( SubStr( ::cPicFunc, nFor, 1 ) ) exit else cNum += SubStr( ::cPicFunc, nFor, 1 ) @@ -242,7 +244,7 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS TGet ::lPicComplex := .f. - if !Empty( ::cPicMask ) + if ! Empty( ::cPicMask ) For nFor := 1 to Len( ::cPicMask ) cChar := SubStr( ::cPicMask, nFor, 1 ) if !cChar $ "!ANX9#" @@ -253,9 +255,9 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS TGet endif ::buffer := ::PutMask( ::Original, .f. ) - ::nMaxLen := len(::buffer) + ::nMaxLen := Len( ::buffer ) - if ::nDispLen == Nil + if ::nDispLen == NIL ::nDispLen := ::nMaxLen endif @@ -277,19 +279,19 @@ METHOD Display( lForced ) CLASS TGet DEFAULT lForced TO .t. - if ::HasScroll() .and. ::Pos != Nil + if ::HasScroll() .and. ::Pos != NIL ::nDispPos := Max( 1, Min( ::Pos - Int( ::nDispLen / 2 ), ::nMaxLen - ::nDispLen + 1 ) ) endif - if lForced .or. (::nDispPos != ::nOldPos) + if lForced .or. ( ::nDispPos != ::nOldPos ) DispOutAt( ::Row, ::Col,; - Substr(::buffer, ::nDispPos, ::nDispLen), ; + Substr( ::buffer, ::nDispPos, ::nDispLen ), ; hb_ColorIndex( ::ColorSpec, iif( ::HasFocus, GET_CLR_ENHANCED, GET_CLR_UNSELECTED ) ) ) endif ::nOldPos := ::nDispPos - if ::Pos != Nil + if ::Pos != NIL SetPos( ::Row, ::Col + ::Pos - ::nDispPos ) endif @@ -311,7 +313,7 @@ METHOD End() CLASS TGet ::Pos := ::nMaxLen endif ::Clear := .f. - ::Display(.f.) + ::Display( .f. ) endif return Self @@ -323,7 +325,7 @@ METHOD Home() CLASS TGet if ::HasFocus ::Pos := 1 ::Clear := .f. - ::Display(.f.) + ::Display( .f. ) endif return Self @@ -368,12 +370,12 @@ METHOD SetFocus() CLASS TGet ::decpos := At( iif( ::lDecRev, ",", "." ), ::buffer ) ::minus := ( "-" $ ::buffer .or. "(" $ ::buffer ) else - ::decpos := Nil + ::decpos := NIL ::minus := .f. endif if ::type == "D" - ::BadDate := !( Dtoc( Ctod( ::buffer ) ) == ::buffer ) + ::BadDate := !( DToC( CToD( ::buffer ) ) == ::buffer ) else ::BadDate := .f. endif @@ -391,7 +393,7 @@ METHOD KillFocus() CLASS TGet ::buffer := ::PutMask() ::hasfocus := .f. - ::pos := Nil + ::pos := NIL return Self @@ -446,7 +448,7 @@ METHOD Untransform( cBuffer ) CLASS TGet cBuffer := StrTran( cBuffer, "-", "" ) cBuffer := StrTran( cBuffer, "(", "" ) cBuffer := StrTran( cBuffer, ")", "" ) - cBuffer := Alltrim( cBuffer ) + cBuffer := AllTrim( cBuffer ) xValue := Val( cBuffer ) if ::minus xValue := -xValue @@ -470,7 +472,7 @@ return xValue METHOD overstrike( cChar ) CLASS TGet - if ::type == "N" .and. !::lEdit + if ::type == "N" .and. ! ::lEdit ::pos := 1 endif @@ -480,12 +482,12 @@ METHOD overstrike( cChar ) CLASS TGet ::lEdit := .f. endif - if !::lEdit + if ! ::lEdit ::buffer := ::PutMask( ::VarGet(), .t. ) ::lEdit := .t. endif - do while !::IsEditable( ::pos ) .and. ::pos <= ::nMaxLen + do while ! ::IsEditable( ::pos ) .and. ::pos <= ::nMaxLen ::pos++ enddo @@ -503,10 +505,10 @@ METHOD overstrike( cChar ) CLASS TGet ::buffer := SubStr( ::buffer, 1, ::Pos - 1 ) + cChar + SubStr( ::buffer, ::Pos + 1 ) ::Changed := !( ::unTransform() == ::Original ) ::Assign() - ::Right(.f.) + ::Right( .f. ) if ::type == "D" - ::BadDate := !( Dtoc( Ctod( ::buffer ) ) == ::buffer ) + ::BadDate := !( DToC( CToD( ::buffer ) ) == ::buffer ) else ::BadDate := .f. endif @@ -523,7 +525,7 @@ METHOD Insert( cChar ) CLASS TGet local cTmp local nPos - if ::type == "N" .and. !::lEdit + if ::type == "N" .and. ! ::lEdit ::pos := 1 endif @@ -533,12 +535,12 @@ METHOD Insert( cChar ) CLASS TGet ::lEdit := .f. endif - if !::lEdit + if ! ::lEdit ::buffer := ::PutMask( ::VarGet(), .t. ) ::lEdit := .t. endif - do while !::IsEditable( ::pos ) .and. ::pos <= ::nMaxLen + do while ! ::IsEditable( ::pos ) .and. ::pos <= ::nMaxLen ::pos++ enddo @@ -570,10 +572,10 @@ METHOD Insert( cChar ) CLASS TGet ::Changed := !( ::unTransform() == ::Original ) ::Assign() - ::Right(.f.) + ::Right( .f. ) if ::type == "D" - ::BadDate := !( Dtoc( Ctod( ::buffer ) ) == ::buffer ) + ::BadDate := !( DToC( CToD( ::buffer ) ) == ::buffer ) else ::BadDate := .f. endif @@ -590,7 +592,7 @@ METHOD _Right( lDisplay ) CLASS TGet DEFAULT lDisplay TO .t. - if !::hasfocus + if ! ::hasfocus return Self endif @@ -604,7 +606,7 @@ METHOD _Right( lDisplay ) CLASS TGet nPos := ::Pos + 1 - do while !::IsEditable( nPos ) .and. nPos <= ::nMaxLen + do while ! ::IsEditable( nPos ) .and. nPos <= ::nMaxLen nPos++ Enddo @@ -615,7 +617,7 @@ METHOD _Right( lDisplay ) CLASS TGet endif if lDisplay - ::Display(.f.) + ::Display( .f. ) endif return Self @@ -628,7 +630,7 @@ METHOD _Left( lDisplay ) CLASS TGet DEFAULT lDisplay TO .t. - if !::hasfocus + if ! ::hasfocus return Self endif @@ -642,7 +644,7 @@ METHOD _Left( lDisplay ) CLASS TGet nPos := ::Pos - 1 - do while !::IsEditable( nPos ) .and. nPos > 0 + do while ! ::IsEditable( nPos ) .and. nPos > 0 nPos-- Enddo @@ -653,7 +655,7 @@ METHOD _Left( lDisplay ) CLASS TGet endif if lDisplay - ::Display(.f.) + ::Display( .f. ) endif @@ -665,7 +667,7 @@ METHOD WordLeft() CLASS TGet local nPos - if !::hasfocus + if ! ::hasfocus return Self endif @@ -703,7 +705,7 @@ METHOD WordLeft() CLASS TGet ::Pos := nPos endif - ::Display(.f.) + ::Display( .f. ) return Self @@ -713,7 +715,7 @@ METHOD WordRight() CLASS TGet local nPos - if !::hasfocus + if ! ::hasfocus return Self endif @@ -745,7 +747,7 @@ METHOD WordRight() CLASS TGet ::Pos := nPos endif - ::Display(.f.) + ::Display( .f. ) return Self @@ -753,15 +755,15 @@ return Self METHOD ToDecPos() CLASS TGet - if !::HasFocus .or. ::DecPos == Nil - Return .f. + if ! ::HasFocus .or. ::DecPos == NIL + return .f. endif ::Clear := .f. ::buffer := ::PutMask( ::UnTransform(), .t. ) ::pos := ::DecPos + 1 - ::Display(.f.) + ::Display( .f. ) return .t. @@ -833,30 +835,30 @@ METHOD Input( cChar ) CLASS TGet endcase - if !Empty( ::cPicFunc ) + if ! Empty( ::cPicFunc ) cChar := Transform( cChar, ::cPicFunc ) endif - if !Empty( ::cPicMask ) + if ! Empty( ::cPicMask ) cPic := Substr( ::cPicMask, ::pos, 1 ) cChar := Transform( cChar, cPic ) do case case cPic == "A" - if !IsAlpha( cChar ) + if ! IsAlpha( cChar ) cChar := "" endif case cPic == "N" - if !IsAlpha( cChar ) .and. !IsDigit( cChar ) + if ! IsAlpha( cChar ) .and. ! IsDigit( cChar ) cChar := "" endif case cPic == "9" - if !IsDigit( cChar ) + if ! IsDigit( cChar ) cChar := "" endif case cPic == "#" - if !IsDigit( cChar ) .and. !( cChar == " " ) .and. !( cChar$"+-" ) + if ! IsDigit( cChar ) .and. !( cChar == " " ) .and. !( cChar $ "+-" ) cChar := "" endif end case @@ -878,13 +880,13 @@ METHOD PutMask( xValue, lEdit ) CLASS TGet DEFAULT xValue TO ::VarGet() DEFAULT lEdit TO ::HasFocus - if xValue == Nil + if xValue == NIL return "" endif - cBuffer := Transform( xValue, Alltrim( ::cPicFunc + " " + ::cPicMask ) ) + cBuffer := Transform( xValue, AllTrim( ::cPicFunc + " " + ::cPicMask ) ) - if lEdit .and. ::type == "N" .and. !Empty( ::cPicMask ) + if lEdit .and. ::type == "N" .and. ! Empty( ::cPicMask ) nLen := Len( cBuffer ) for nFor := 1 to nLen cChar := SubStr( ::cPicMask, nFor, 1 ) @@ -892,8 +894,8 @@ METHOD PutMask( xValue, lEdit ) CLASS TGet cBuffer := SubStr( cBuffer, 1, nFor - 1 ) + cChar + SubStr( cBuffer, nFor + 1 ) endif next - if cBuffer == Space( len( cBuffer ) - 1 ) + "0" - cBuffer := Space( len( cBuffer ) ) + if cBuffer == Space( Len( cBuffer ) - 1 ) + "0" + cBuffer := Space( Len( cBuffer ) ) endif if ::lDecRev cBuffer := StrTran( cBuffer, ",", Chr( 1 ) ) @@ -928,8 +930,8 @@ METHOD _Delete( lDisplay ) CLASS TGet do case case ::type == "C" - if !::lPicComplex - ::buffer := Padr( SubStr( ::buffer, 1, ::Pos - 1 ) + ; + if ! ::lPicComplex + ::buffer := PadR( SubStr( ::buffer, 1, ::Pos - 1 ) + ; SubStr( ::buffer, ::Pos + 1 ), ::nMaxLen ) else ::buffer := SubStr( ::buffer, 1, ::Pos - 1 ) + " " + ; @@ -989,14 +991,14 @@ METHOD DelEnd() CLASS TGet local nPos := ::Pos - if !::hasfocus + if ! ::hasfocus return Self endif ::Pos := ::nMaxLen do while ::Pos > nPos - ::BackSpace(.f.) + ::BackSpace( .f. ) enddo ::Display() @@ -1007,8 +1009,8 @@ return Self METHOD DelLeft() CLASS TGet - ::Left(.f.) - ::Delete(.f.) + ::Left( .f. ) + ::Delete( .f. ) ::Right() return Self @@ -1017,8 +1019,8 @@ return Self METHOD DelRight() CLASS TGet - ::Right(.f.) - ::Delete(.f.) + ::Right( .f. ) + ::Delete( .f. ) ::Left() return Self @@ -1027,13 +1029,13 @@ return Self METHOD DelWordLeft() CLASS TGet - if !::hasfocus + if ! ::hasfocus return Self endif if !( SubStr( ::buffer, ::Pos, 1 ) == " " ) if SubStr( ::buffer, ::Pos - 1 , 1 ) == " " - ::BackSpace(.f.) + ::BackSpace( .f. ) else ::WordRight() ::Left() @@ -1041,11 +1043,11 @@ METHOD DelWordLeft() CLASS TGet endif if SubStr( ::buffer, ::Pos, 1 ) == " " - ::Delete(.f.) + ::Delete( .f. ) endif do while ::Pos > 1 .and. !( SubStr( ::buffer, ::Pos - 1, 1 ) == " " ) - ::BackSpace(.f.) + ::BackSpace( .f. ) Enddo ::Display() @@ -1056,7 +1058,7 @@ return Self METHOD DelWordRight() CLASS TGet - if !::hasfocus + if ! ::hasfocus return Self endif @@ -1069,11 +1071,11 @@ METHOD DelWordRight() CLASS TGet endif do while ::Pos <= ::nMaxLen .and. !( SubStr( ::buffer, ::Pos, 1 ) == " " ) - ::Delete(.f.) + ::Delete( .f. ) Enddo if ::Pos <= ::nMaxLen - ::Delete(.f.) + ::Delete( .f. ) endif ::Display() @@ -1088,19 +1090,27 @@ return TGet():New( nRow, nCol, bVarBlock, cVarName, cPicture, cColor ) //---------------------------------------------------------------------------// -/* TOFIX: Clipper will do a compiler hack to internally generate a setget - block for these function calls when not specified. */ +/* NOTE: Same as _GET_() */ -function __GET( uVar, cVarName, cPicture, bValid, bWhen, bSetGet ) - return _GET_( uVar, cVarName, cPicture, bValid, bWhen, bSetGet ) - -function _GET_( uVar, cVarName, cPicture, bValid, bWhen, bSetGet ) - local oGet := TGet():New(,, bSetGet, cVarName, cPicture ) +FUNCTION __GET( uVar, cVarName, cPicture, bValid, bWhen, bSetGet ) + LOCAL oGet := TGet():New(,, bSetGet, cVarName, cPicture ) uVar := uVar // Suppress unused variable warning oGet:PreBlock := bWhen oGet:PostBlock := bValid -return oGet + RETURN oGet + +/* NOTE: Same as __GET() */ + +FUNCTION _GET_( uVar, cVarName, cPicture, bValid, bWhen, bSetGet ) + LOCAL oGet := TGet():New(,, bSetGet, cVarName, cPicture ) + + uVar := uVar // Suppress unused variable warning + + oGet:PreBlock := bWhen + oGet:PostBlock := bValid + + RETURN oGet diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index ecf1c084e8..4693125b06 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -338,10 +338,11 @@ BOOL hb_clsIsClassRef( void *pBlock ) { if( pClass->pInlines ) if( hb_gcItemRef( pClass->pInlines, pBlock ) ) - return TRUE; + return TRUE; + if( pClass->pClassDatas ) if( hb_gcItemRef( pClass->pClassDatas, pBlock ) ) - return TRUE; + return TRUE; uiLimit = ( USHORT ) ( pClass->uiHashKey * BUCKET ); pMeth = pClass->pMethods; @@ -352,6 +353,7 @@ BOOL hb_clsIsClassRef( void *pBlock ) ++pClass; } + return FALSE; /* passed block is not referenced in any class */ } @@ -497,43 +499,43 @@ char * hb_objGetClsName( PHB_ITEM pObject ) szClassName = ( s_pClasses + pObject->item.asArray.value->uiClass - 1 )->szName; } - else /* built in types */ + else /* built in types */ { switch( pObject->type ) { case HB_IT_NIL: - szClassName = "NIL"; - break; + szClassName = "NIL"; + break; case HB_IT_STRING: - szClassName = "CHARACTER"; - break; + szClassName = "CHARACTER"; + break; case HB_IT_BLOCK: - szClassName = "BLOCK"; - break; + szClassName = "BLOCK"; + break; case HB_IT_SYMBOL: - szClassName = "SYMBOL"; - break; + szClassName = "SYMBOL"; + break; case HB_IT_DATE: - szClassName = "DATE"; - break; + szClassName = "DATE"; + break; case HB_IT_INTEGER: case HB_IT_LONG: case HB_IT_DOUBLE: - szClassName = "NUMERIC"; - break; + szClassName = "NUMERIC"; + break; case HB_IT_LOGICAL: - szClassName = "LOGICAL"; - break; + szClassName = "LOGICAL"; + break; default: - szClassName = "UNKNOWN"; - break; + szClassName = "UNKNOWN"; + break; } } @@ -571,7 +573,6 @@ PHB_FUNC hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage ) { if( pClass->pMethods[ uiAt ].pMessage == pMsg ) { - s_pMethod = pClass->pMethods + uiAt; hb_clsScope( pObject, s_pMethod ); return s_pMethod->pFunction; @@ -812,7 +813,6 @@ HB_FUNC( __CLSADDMSG ) * MessageBox(0,cTmp,"AddMsg ClassData Shared",0); * } */ - } break; @@ -984,75 +984,75 @@ HB_FUNC( __CLSNEW ) for( ui = 0; ui < uiLimit; ui++ ) { - USHORT uiBucket; + USHORT uiBucket; - pMsg = ( PHB_DYNS ) pSprCls->pMethods[ ui ].pMessage; + pMsg = ( PHB_DYNS ) pSprCls->pMethods[ ui ].pMessage; - if( pMsg ) - { - uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pNewCls->uiHashKey ) * BUCKET ); + if( pMsg ) + { + uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pNewCls->uiHashKey ) * BUCKET ); - for( uiBucket = 0; uiBucket < BUCKET; uiBucket++ ) - { + for( uiBucket = 0; uiBucket < BUCKET; uiBucket++ ) + { #ifdef HB_CLS_MASKHIDDEN /* no hidden methods allowed by the inheritence. */ - if( ( pSprCls->pMethods[ ui ].uiScope & HB_OO_CLSTP_HIDDEN ) == HB_OO_CLSTP_HIDDEN ) - break; + if( ( pSprCls->pMethods[ ui ].uiScope & HB_OO_CLSTP_HIDDEN ) == HB_OO_CLSTP_HIDDEN ) + break; #endif - if( pNewCls->pMethods[ uiAt+uiBucket ].pMessage == 0 ) /* this message position is empty */ - { - /* Now, we can increment the msg count */ - pNewCls->uiMethods++; + if( pNewCls->pMethods[ uiAt+uiBucket ].pMessage == 0 ) /* this message position is empty */ + { + /* Now, we can increment the msg count */ + pNewCls->uiMethods++; - hb_xmemcpy(pNewCls->pMethods + ( uiAt+uiBucket ), pSprCls->pMethods + ui, sizeof( METHOD ) ); + hb_xmemcpy(pNewCls->pMethods + ( uiAt+uiBucket ), pSprCls->pMethods + ui, sizeof( METHOD ) ); - if( - pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSetClsData - || - pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgGetClsData - ) - pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenClsDatas; + if( + pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSetClsData + || + pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgGetClsData + ) + pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenClsDatas; - if( - pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSetData - || - pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgGetData - || - pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSuper - ) - { - pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenDatas; - } + if( + pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSetData + || + pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgGetData + || + pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgSuper + ) + { + pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenDatas; + } - if( pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgEvalInline ) - pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenInlines; + if( pNewCls->pMethods[ uiAt+uiBucket ].pFunction == hb___msgEvalInline ) + pNewCls->pMethods[ uiAt+uiBucket ].uiData += nLenInlines; - if( ( pSprCls->pMethods[ ui ].uiScope & HB_OO_CLSTP_SUPER ) != HB_OO_CLSTP_SUPER ) - pNewCls->pMethods[ uiAt+uiBucket ].uiScope = ( USHORT ) ( pSprCls->pMethods[ ui ].uiScope + HB_OO_CLSTP_SUPER ); - else - pNewCls->pMethods[ uiAt+uiBucket ].uiScope = pSprCls->pMethods[ ui ].uiScope; + if( ( pSprCls->pMethods[ ui ].uiScope & HB_OO_CLSTP_SUPER ) != HB_OO_CLSTP_SUPER ) + pNewCls->pMethods[ uiAt+uiBucket ].uiScope = ( USHORT ) ( pSprCls->pMethods[ ui ].uiScope + HB_OO_CLSTP_SUPER ); + else + pNewCls->pMethods[ uiAt+uiBucket ].uiScope = pSprCls->pMethods[ ui ].uiScope; - if( pSprCls->pMethods[ ui ].pInitValue ) - { - PHB_ITEM pInitValue; + if( pSprCls->pMethods[ ui ].pInitValue ) + { + PHB_ITEM pInitValue; - if( HB_IS_ARRAY( pSprCls->pMethods[ ui ].pInitValue ) ) - pNewCls->pMethods[ uiAt + uiBucket ].pInitValue = hb_arrayClone( pSprCls->pMethods[ ui ].pInitValue ); - else - { - pInitValue = hb_itemNew( NULL ); + if( HB_IS_ARRAY( pSprCls->pMethods[ ui ].pInitValue ) ) + pNewCls->pMethods[ uiAt + uiBucket ].pInitValue = hb_arrayClone( pSprCls->pMethods[ ui ].pInitValue ); + else + { + pInitValue = hb_itemNew( NULL ); - hb_itemCopy( pInitValue, pSprCls->pMethods[ ui ].pInitValue ); - pNewCls->pMethods[ uiAt + uiBucket ].pInitValue = pInitValue; - } - } - break; - } - else if( pNewCls->pMethods[ uiAt + uiBucket ].pMessage == pMsg ) /*if( strcmp( pNewCls->pMethods[ uiAt+uiBucket ].pMessage->pSymbol->szName, pMsg->pSymbol->szName ) == 0 )*/ - break; - } - } + hb_itemCopy( pInitValue, pSprCls->pMethods[ ui ].pInitValue ); + pNewCls->pMethods[ uiAt + uiBucket ].pInitValue = pInitValue; + } + } + break; + } + else if( pNewCls->pMethods[ uiAt + uiBucket ].pMessage == pMsg ) /*if( strcmp( pNewCls->pMethods[ uiAt+uiBucket ].pMessage->pSymbol->szName, pMsg->pSymbol->szName ) == 0 )*/ + break; + } + } } } } @@ -1200,24 +1200,24 @@ static PHB_ITEM hb_clsInst( USHORT uiClass, BOOL bInit ) pMeth = pClass->pMethods; for( uiAt = 0; uiAt < uiLimit; uiAt++, pMeth++ ) { - if( ( pMeth->uiScope & HB_OO_CLSTP_CLASS ) == HB_OO_CLSTP_CLASS - && - ( pMeth->uiScope & HB_OO_CLSTP_SUPER ) != HB_OO_CLSTP_SUPER - ) - { - pSprObj = hb_clsInst( pMeth->uiSprClass, FALSE ); /*instance super object*/ - hb_arraySet( pSelf, pMeth->uiData, pSprObj ); - hb_itemRelease( pSprObj ); + if( ( pMeth->uiScope & HB_OO_CLSTP_CLASS ) == HB_OO_CLSTP_CLASS + && + ( pMeth->uiScope & HB_OO_CLSTP_SUPER ) != HB_OO_CLSTP_SUPER + ) + { + pSprObj = hb_clsInst( pMeth->uiSprClass, FALSE ); /*instance super object*/ + hb_arraySet( pSelf, pMeth->uiData, pSprObj ); + hb_itemRelease( pSprObj ); - ++s_uiSize; - if( s_ppObjects == NULL ) - s_ppObjects = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) ); - else - s_ppObjects = ( PHB_ITEM * ) hb_xrealloc( s_ppObjects, s_uiSize * sizeof( PHB_ITEM ) ); + ++s_uiSize; + if( s_ppObjects == NULL ) + s_ppObjects = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) ); + else + s_ppObjects = ( PHB_ITEM * ) hb_xrealloc( s_ppObjects, s_uiSize * sizeof( PHB_ITEM ) ); - pTmp = hb_arrayGetItemPtr( pSelf, pMeth->uiData ); - s_ppObjects[ s_uiSize - 1 ] = pTmp; - } + pTmp = hb_arrayGetItemPtr( pSelf, pMeth->uiData ); + s_ppObjects[ s_uiSize - 1 ] = pTmp; + } } /* Phase II Create link between A:C and A:B:C !! */ @@ -1254,18 +1254,17 @@ static PHB_ITEM hb_clsInst( USHORT uiClass, BOOL bInit ) { /* Init Classdata (inherited and not) if needed */ - if( pMeth->pInitValue && pMeth->pFunction == hb___msgGetClsData && !( pMeth->bClsDataInitiated ) ) - { - HB_ITEM init; - hb_arrayGet( pClass->pClassDatas, pMeth->uiData, &init ); - if( init.type == HB_IT_NIL ) - { - hb_arraySet( pClass->pClassDatas, pMeth->uiData, pMeth->pInitValue ); - pMeth->bClsDataInitiated = 1; - } - hb_itemClear( &init ); - } - + if( pMeth->pInitValue && pMeth->pFunction == hb___msgGetClsData && !( pMeth->bClsDataInitiated ) ) + { + HB_ITEM init; + hb_arrayGet( pClass->pClassDatas, pMeth->uiData, &init ); + if( init.type == HB_IT_NIL ) + { + hb_arraySet( pClass->pClassDatas, pMeth->uiData, pMeth->pInitValue ); + pMeth->bClsDataInitiated = 1; + } + hb_itemClear( &init ); + } if( ( pMeth->uiScope & HB_OO_CLSTP_SUPER ) == HB_OO_CLSTP_SUPER ) { @@ -1292,8 +1291,8 @@ static PHB_ITEM hb_clsInst( USHORT uiClass, BOOL bInit ) for( uiBucket = 0; uiBucket < BUCKET; uiBucket++ ) { - if( pMsg == pSprCls->pMethods[ ui+uiBucket ].pMessage /*strcmp( pMsg->pSymbol->szName, pSprCls->pMethods[ ui+uiBucket ].pMessage->pSymbol->szName ) == 0*/ ) - break; + if( pMsg == pSprCls->pMethods[ ui+uiBucket ].pMessage /*strcmp( pMsg->pSymbol->szName, pSprCls->pMethods[ ui+uiBucket ].pMessage->pSymbol->szName ) == 0*/ ) + break; } pDataHrtd = ( PHB_ITEM ) hb_arrayGetItemPtr( pTmp, pSprCls->pMethods[ ui+uiBucket ].uiData ); @@ -1318,8 +1317,7 @@ static PHB_ITEM hb_clsInst( USHORT uiClass, BOOL bInit ) hb_itemRelease( pInitValue ); } else - hb_arraySet( pSelf, pMeth->uiData, - pMeth->pInitValue ); + hb_arraySet( pSelf, pMeth->uiData, pMeth->pInitValue ); } else if( pMeth->pFunction == hb___msgGetShrData && !( pMeth->bClsDataInitiated ) ) { @@ -1333,8 +1331,7 @@ static PHB_ITEM hb_clsInst( USHORT uiClass, BOOL bInit ) pMeth->bClsDataInitiated = 1; } hb_itemClear( &init ); - - } + } } } } @@ -1687,9 +1684,9 @@ HB_FUNC( __CLS_PARAM ) array = hb_itemArrayNew( uiParam ); for( n = 1; n <= uiParam; n++ ) { - PHB_ITEM iTmp = hb_itemParam( n ); - hb_itemArrayPut( array, n, iTmp ); - hb_itemRelease( iTmp ); + PHB_ITEM iTmp = hb_itemParam( n ); + hb_itemArrayPut( array, n, iTmp ); + hb_itemRelease( iTmp ); } } else