From 45a9479a42aa497f778f4187b3f8e4e511cc147a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 8 Nov 2008 12:21:50 +0000 Subject: [PATCH] 2008-11-08 13:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/make_gcc.sh * harbour/make_gnu.bat * harbour/make_gnu.sh * harbour/config/lib.cf * harbour/config/bin.cf + added MK_USR to pass GNU MAKE flags * harbour/source/vm/set.c * minor cleanup and simplifications in hb_setSetItem(). * grouped SETs with the same item type in hb_setSetItem() function together. --- harbour/ChangeLog | 13 ++ harbour/config/bin.cf | 2 +- harbour/config/lib.cf | 2 +- harbour/make_gcc.sh | 2 +- harbour/make_gnu.bat | 2 +- harbour/make_gnu.sh | 4 +- harbour/source/vm/set.c | 277 +++++++++++++++++----------------------- 7 files changed, 137 insertions(+), 165 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 01e9fbfb06..5be5342bb4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,19 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-08 13:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/make_gcc.sh + * harbour/make_gnu.bat + * harbour/make_gnu.sh + * harbour/config/lib.cf + * harbour/config/bin.cf + + added MK_USR to pass GNU MAKE flags + + * harbour/source/vm/set.c + * minor cleanup and simplifications in hb_setSetItem(). + * grouped SETs with the same item type in hb_setSetItem() function + together. + 2008-11-08 12:46 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/gtwvt/gtwvt.c * hb_gt_wvt_ResetWindowSize(): Not very good looking (or diff --git a/harbour/config/bin.cf b/harbour/config/bin.cf index 5337c9d9ca..b4f58dd567 100644 --- a/harbour/config/bin.cf +++ b/harbour/config/bin.cf @@ -31,7 +31,7 @@ ALL_OBJS = $(ALL_C_OBJS) $(ALL_PRG_OBJS) first:: dirbase descend descend : - @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(EXE_NAME) + @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(EXE_NAME) $(MK_USR) $(EXE_NAME) : $(ALL_OBJS) $(LD_RULE) diff --git a/harbour/config/lib.cf b/harbour/config/lib.cf index 9c2833d3a2..a7924ca011 100644 --- a/harbour/config/lib.cf +++ b/harbour/config/lib.cf @@ -23,7 +23,7 @@ ALL_OBJS = $(ALL_C_OBJS) $(ALL_PRG_OBJS) first:: dirbase descend descend : - @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(LIB_NAME) + @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(LIB_NAME) $(MK_USR) vpath $(LIB_NAME) $(LIB_DIR) $(LIB_NAME) : $(ALL_OBJS) diff --git a/harbour/make_gcc.sh b/harbour/make_gcc.sh index bca36a3810..cd240b68bf 100755 --- a/harbour/make_gcc.sh +++ b/harbour/make_gcc.sh @@ -186,5 +186,5 @@ sed -e 's/;/ /g' \ -e 's/^HB_BUILD_TARGETS \=/HB_BUILD_TARGETS \:\=/g' \ common.mak > common.cf -$MAKE -r -f make_gcc.mak $* +$MAKE -r -f make_gcc.mak $MK_USR $* rm -f common.cf diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat index 933f72f0bc..569a8437ea 100644 --- a/harbour/make_gnu.bat +++ b/harbour/make_gnu.bat @@ -106,7 +106,7 @@ if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=%HB_INSTALL_PREFIX%/include rem --------------------------------------------------------------- rem Start the GNU make system - make -r %1 %2 %3 %4 %5 %6 %7 %8 %9 > make_gnu.log + make -r %MK_USR% %1 %2 %3 %4 %5 %6 %7 %8 %9 > make_gnu.log goto END :END diff --git a/harbour/make_gnu.sh b/harbour/make_gnu.sh index ec2d2aa6dc..af85dde299 100755 --- a/harbour/make_gnu.sh +++ b/harbour/make_gnu.sh @@ -179,9 +179,9 @@ else if [ "$HB_ARCHITECTURE" = "bsd" ] || [ "$HB_ARCHITECTURE" = "hpux" ] then - gmake $* + gmake $MK_USR $* else - make $* + make $MK_USR $* fi if [ "$*" = "clean" ]; then diff --git a/harbour/source/vm/set.c b/harbour/source/vm/set.c index 9764ee69b3..f6ef19adc3 100644 --- a/harbour/source/vm/set.c +++ b/harbour/source/vm/set.c @@ -1563,19 +1563,6 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) } } break; - case HB_SET_MFILEEXT: - if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) - { - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_MFILEEXT ) - hb_xfree( pSet->HB_SET_MFILEEXT ); - pSet->HB_SET_MFILEEXT = szValue; - fResult = TRUE; - } - break; - - /* TOREVIEW */ - case HB_SET_AUTORDER: if( HB_IS_NUMERIC( pItem ) ) { @@ -1598,89 +1585,19 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) } } break; - case HB_SET_COLOR: - hb_conSetColor( HB_IS_STRING( pItem ) ? hb_itemGetCPtr( pItem ) : ( char * ) NULL ); - fResult = TRUE; - break; case HB_SET_CURSOR: if( HB_IS_NUMERIC( pItem ) ) + { hb_conSetCursor( TRUE, ( USHORT ) hb_itemGetNI( pItem ) ); - else - hb_conSetCursor( FALSE, 0 ); - fResult = TRUE; - break; - case HB_SET_DATEFORMAT: - if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) - { - BOOL flag = FALSE; - unsigned int i, iLen; - int ch, year = 0; - - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_DATEFORMAT ) - hb_xfree( pSet->HB_SET_DATEFORMAT ); - pSet->HB_SET_DATEFORMAT = szValue; - - iLen = ( unsigned int ) strlen( pSet->HB_SET_DATEFORMAT ); - for( i = 0; i < iLen; i++ ) - { - ch = pSet->HB_SET_DATEFORMAT[ i ]; - if( !flag && ( ch == 'Y' || ch == 'y' ) ) - year++; /* Only count the first set of consecutive "Y"s. */ - else if( year ) - flag = TRUE; /* Indicate non-consecutive. */ - } - - flag = ( year >= 4 ); - - if( flag != pSet->hb_set_century ) - { - /* CENTURY is not controlled directly by SET, so there is no - notification for changing it indirectly via DATE FORMAT. */ - pSet->hb_set_century = flag; - } - - fResult = TRUE; - } - break; - case HB_SET_DEFAULT: - if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) - { - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_DEFAULT ) - hb_xfree( pSet->HB_SET_DEFAULT ); - pSet->HB_SET_DEFAULT = szValue; - fResult = TRUE; - } - break; - case HB_SET_DELIMCHARS: - if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) - { - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_DELIMCHARS ) - hb_xfree( pSet->HB_SET_DELIMCHARS ); - pSet->HB_SET_DELIMCHARS = szValue; - fResult = TRUE; - } - break; - case HB_SET_DEVICE: - if( HB_IS_STRING( pItem ) ) - { - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_DEVICE ) - hb_xfree( pSet->HB_SET_DEVICE ); - pSet->HB_SET_DEVICE = szValue; - - /* If the print file is not already open, open it in overwrite mode. */ - if( hb_stricmp( pSet->HB_SET_DEVICE, "PRINTER" ) == 0 && pSet->hb_set_printhan == FS_ERROR && - pSet->HB_SET_PRINTFILE && pSet->HB_SET_PRINTFILE[ 0 ] != '\0' ) - pSet->hb_set_printhan = open_handle( pSet, pSet->HB_SET_PRINTFILE, FALSE, NULL, HB_SET_PRINTFILE ); fResult = TRUE; } break; case HB_SET_EVENTMASK: - pSet->HB_SET_EVENTMASK = hb_itemGetNI( pItem ); - fResult = TRUE; + if( HB_IS_NUMERIC( pItem ) ) + { + pSet->HB_SET_EVENTMASK = hb_itemGetNI( pItem ); + fResult = TRUE; + } break; case HB_SET_MARGIN: if( HB_IS_NUMERIC( pItem ) ) @@ -1704,35 +1621,22 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) } } break; - case HB_SET_PATH: - if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) + case HB_SET_TYPEAHEAD: + if( HB_IS_NUMERIC( pItem ) ) { - szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); - if( pSet->HB_SET_PATH ) - hb_xfree( pSet->HB_SET_PATH ); - pSet->HB_SET_PATH = szValue; - - hb_fsFreeSearchPath( pSet->hb_set_path ); - pSet->hb_set_path = NULL; - hb_fsAddSearchPath( pSet->HB_SET_PATH, &pSet->hb_set_path ); - + /* Set the value and limit the range */ + pSet->HB_SET_TYPEAHEAD = hb_itemGetNI( pItem ); + if( pSet->HB_SET_TYPEAHEAD == 0 ) + /* Do nothing */ ; + else if( pSet->HB_SET_TYPEAHEAD < 16 ) + pSet->HB_SET_TYPEAHEAD = 16; + else if( pSet->HB_SET_TYPEAHEAD > 4096 ) + pSet->HB_SET_TYPEAHEAD = 4096; + /* reset keyboard buffer */ + hb_inkeyReset(); fResult = TRUE; } break; - case HB_SET_TYPEAHEAD: - /* Set the value and limit the range */ - pSet->HB_SET_TYPEAHEAD = hb_itemGetNI( pItem ); - if( pSet->HB_SET_TYPEAHEAD == 0 ) - /* Do nothing */ ; - else if( pSet->HB_SET_TYPEAHEAD < 16 ) - pSet->HB_SET_TYPEAHEAD = 16; - else if( pSet->HB_SET_TYPEAHEAD > 4096 ) - pSet->HB_SET_TYPEAHEAD = 4096; - /* reset keyboard buffer */ - hb_inkeyReset(); - - fResult = TRUE; - break; case HB_SET_VIDEOMODE: if( HB_IS_NUMERIC( pItem ) ) { @@ -1744,6 +1648,14 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) } } break; + + case HB_SET_COLOR: + if( HB_IS_STRING( pItem ) ) + { + hb_conSetColor( hb_itemGetCPtr( pItem ) ); + fResult = TRUE; + } + break; case HB_SET_LANGUAGE: if( HB_IS_STRING( pItem ) ) { @@ -1759,74 +1671,121 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) } break; case HB_SET_FILECASE: + case HB_SET_DIRCASE: + iValue = -1; if( HB_IS_STRING( pItem ) ) { if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "LOWER" ) ) - { - pSet->HB_SET_FILECASE = HB_SET_CASE_LOWER; - fResult = TRUE; - } + iValue = HB_SET_CASE_LOWER; else if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "UPPER" ) ) - { - pSet->HB_SET_FILECASE = HB_SET_CASE_UPPER; - fResult = TRUE; - } + iValue = HB_SET_CASE_UPPER; else if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "MIXED" ) ) - { - pSet->HB_SET_FILECASE = HB_SET_CASE_MIXED; - fResult = TRUE; - } + iValue = HB_SET_CASE_MIXED; } else if( HB_IS_NUMERIC( pItem ) ) - { iValue = hb_itemGetNI( pItem ); - if( iValue == HB_SET_CASE_LOWER || - iValue == HB_SET_CASE_UPPER || - iValue == HB_SET_CASE_MIXED ) - { + + if( iValue == HB_SET_CASE_LOWER || + iValue == HB_SET_CASE_UPPER || + iValue == HB_SET_CASE_MIXED ) + { + if( set_specifier == HB_SET_FILECASE ) pSet->HB_SET_FILECASE = iValue; - fResult = TRUE; - } + else + pSet->HB_SET_DIRCASE = iValue; + fResult = TRUE; } break; - case HB_SET_DIRCASE: + case HB_SET_DATEFORMAT: if( HB_IS_STRING( pItem ) ) { - if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "LOWER" ) ) + int iYear = 0; + + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_DATEFORMAT ) + hb_xfree( pSet->HB_SET_DATEFORMAT ); + pSet->HB_SET_DATEFORMAT = szValue; + while( *szValue ) { - pSet->HB_SET_DIRCASE = HB_SET_CASE_LOWER; - fResult = TRUE; - } - else if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "UPPER" ) ) - { - pSet->HB_SET_DIRCASE = HB_SET_CASE_UPPER; - fResult = TRUE; - } - else if( ! hb_stricmp( hb_itemGetCPtr( pItem ), "MIXED" ) ) - { - pSet->HB_SET_DIRCASE = HB_SET_CASE_MIXED; - fResult = TRUE; - } - } - else if( HB_IS_NUMERIC( pItem ) ) - { - iValue = hb_itemGetNI( pItem ); - if( iValue == HB_SET_CASE_LOWER || - iValue == HB_SET_CASE_UPPER || - iValue == HB_SET_CASE_MIXED ) - { - pSet->HB_SET_DIRCASE = iValue; - fResult = TRUE; + if( *szValue == 'Y' || *szValue == 'y' ) + ++iYear; + else if( iYear ) /* Only count the first set of consecutive "Y"s. */ + break; + ++szValue; } + if( pSet->hb_set_century ? iYear < 4 : iYear >= 4 ) + /* CENTURY is not controlled directly by SET, so there is no + notification for changing it indirectly via DATE FORMAT. */ + pSet->hb_set_century = iYear >= 4; } break; case HB_SET_DIRSEPARATOR: - if( HB_IS_STRING( pItem ) && hb_itemGetCLen( pItem ) > 0 ) + if( hb_itemGetCLen( pItem ) > 0 ) { pSet->HB_SET_DIRSEPARATOR = hb_itemGetCPtr( pItem )[ 0 ]; fResult = TRUE; } break; + case HB_SET_DEVICE: + if( HB_IS_STRING( pItem ) ) + { + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_DEVICE ) + hb_xfree( pSet->HB_SET_DEVICE ); + pSet->HB_SET_DEVICE = szValue; + + /* If the print file is not already open, open it in overwrite mode. */ + if( hb_stricmp( szValue, "PRINTER" ) == 0 && pSet->hb_set_printhan == FS_ERROR && + pSet->HB_SET_PRINTFILE && pSet->HB_SET_PRINTFILE[ 0 ] != '\0' ) + pSet->hb_set_printhan = open_handle( pSet, pSet->HB_SET_PRINTFILE, FALSE, NULL, HB_SET_PRINTFILE ); + fResult = TRUE; + } + break; + case HB_SET_MFILEEXT: + if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) + { + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_MFILEEXT ) + hb_xfree( pSet->HB_SET_MFILEEXT ); + pSet->HB_SET_MFILEEXT = szValue; + fResult = TRUE; + } + break; + case HB_SET_DEFAULT: + if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) + { + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_DEFAULT ) + hb_xfree( pSet->HB_SET_DEFAULT ); + pSet->HB_SET_DEFAULT = szValue; + fResult = TRUE; + } + break; + case HB_SET_PATH: + if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) + { + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_PATH ) + hb_xfree( pSet->HB_SET_PATH ); + pSet->HB_SET_PATH = szValue; + + hb_fsFreeSearchPath( pSet->hb_set_path ); + pSet->hb_set_path = NULL; + hb_fsAddSearchPath( pSet->HB_SET_PATH, &pSet->hb_set_path ); + + fResult = TRUE; + } + break; + case HB_SET_DELIMCHARS: + if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) + { + szValue = hb_strndup( hb_itemGetCPtr( pItem ), USHRT_MAX ); + if( pSet->HB_SET_DELIMCHARS ) + hb_xfree( pSet->HB_SET_DELIMCHARS ); + pSet->HB_SET_DELIMCHARS = szValue; + fResult = TRUE; + } + break; case HB_SET_EOL: if( HB_IS_STRING( pItem ) || HB_IS_NIL( pItem ) ) {