diff --git a/harbour/contrib/libct/trig.c b/harbour/contrib/libct/trig.c index e9ce04a5af..a58e9e20e2 100644 --- a/harbour/contrib/libct/trig.c +++ b/harbour/contrib/libct/trig.c @@ -516,7 +516,7 @@ HB_FUNC( ASIN ) double dInput = hb_parnd(1); double dResult; - if (abs(dInput) > 1.0) + if (fabs(dInput) > 1.0) { PHB_ITEM pSubst = NULL; int iArgErrorMode = ct_getargerrormode(); @@ -617,7 +617,7 @@ HB_FUNC( ACOS ) double dInput = hb_parnd(1); double dResult; - if (abs(dInput) > 1.0) + if (fabs(dInput) > 1.0) { PHB_ITEM pSubst = NULL; int iArgErrorMode = ct_getargerrormode(); @@ -1191,4 +1191,4 @@ HB_FUNC( DTOR ) } - + diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index 172a2f8104..c252de7d4a 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -2090,7 +2090,7 @@ static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo ) if ( sInfo->scopeValue->type == HB_IT_STRING ) { bTypeError = FALSE; - pucScope = hb_itemGetCPtr( sInfo->scopeValue ); + pucScope = (UNSIGNED8*) hb_itemGetCPtr( sInfo->scopeValue ); AdsSetScope( pArea->hOrdCurrent, (sInfo->nScope + 1), /*ADS top/bottom are 1,2 instead of 0,1*/ (UNSIGNED8*) pucScope, (UNSIGNED16) strlen( (const char *) pucScope ), usDataType ); diff --git a/harbour/contrib/samples/gauge.c b/harbour/contrib/samples/gauge.c index 897327da78..1464363fb9 100644 --- a/harbour/contrib/samples/gauge.c +++ b/harbour/contrib/samples/gauge.c @@ -143,20 +143,25 @@ HB_FUNC( GAUGEDISPLAY ) hb_gtGetColorStr( szOldColor ); hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BACKCOLOR ) ); - hb_gtBox( hb_arrayGetNL( pArray, B_TOP ), hb_arrayGetNL( pArray, B_LEFT ), - hb_arrayGetNL( pArray, B_BOTTOM ), hb_arrayGetNL( pArray, B_RIGHT ), - ( BYTE * ) szStr ); + hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ), + (SHORT) hb_arrayGetNL( pArray, B_LEFT ), + (SHORT) hb_arrayGetNL( pArray, B_BOTTOM ), + (SHORT) hb_arrayGetNL( pArray, B_RIGHT ), + (BYTE *) szStr ); - hb_gtBox( hb_arrayGetNL( pArray, B_TOP ), hb_arrayGetNL( pArray, B_LEFT ), - hb_arrayGetNL( pArray, B_BOTTOM ), hb_arrayGetNL( pArray, B_RIGHT ), - B_BOXLINES ); + hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ), + (SHORT) hb_arrayGetNL( pArray, B_LEFT ), + (SHORT) hb_arrayGetNL( pArray, B_BOTTOM ), + (SHORT) hb_arrayGetNL( pArray, B_RIGHT ), + (BYTE *) B_BOXLINES ); if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) - hb_gtWriteAt( hb_arrayGetNL( pArray, B_TOP ), iCenter, ( BYTE * ) "[ ]", 8 ); + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), + iCenter, ( BYTE * ) "[ ]", 8 ); hb_gtSetColorStr( szOldColor ); - hb_gaugeUpdate( pArray, hb_arrayGetNL( pArray, B_PERCENT ) ); + hb_gaugeUpdate( pArray, (float) hb_arrayGetNL( pArray, B_PERCENT ) ); hb_itemReturn( pArray ); } @@ -170,7 +175,7 @@ HB_FUNC( GAUGEUPDATE ) if( pArray ) { - hb_gaugeUpdate( pArray, ISNUM( 2 ) ? hb_parnd( 2 ) : 0 ); + hb_gaugeUpdate( pArray, ISNUM( 2 ) ? (float) hb_parnd( 2 ) : 0 ); hb_itemReturn( pArray ); } @@ -191,12 +196,13 @@ static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ) hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) ); fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) ); - iCols = fPercent * iRatio; + iCols = (int) (fPercent * iRatio); if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) { sprintf( szPct, "%3.0f\%", fPercent * 100 ); - hb_gtWriteAt( hb_arrayGetNL( pArray, B_TOP ), iCenter + 2, szPct, 4 ); + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), + (USHORT) iCenter + 2, (BYTE *) szPct, 4 ); } hb_gtBox( hb_arrayGetNL( pArray, B_TOP ) + 1, hb_arrayGetNL( pArray, B_LEFT ) + 1, @@ -206,8 +212,8 @@ static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ) iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1; for( iRow = 1; iRow <= iMax; iRow++ ) { - hb_gtRepChar( iRow + hb_arrayGetNL( pArray, B_TOP ), - hb_arrayGetNL( pArray, B_LEFT ) + 1, + hb_gtRepChar( (USHORT) (iRow + hb_arrayGetNL( pArray, B_TOP )), + (USHORT) (hb_arrayGetNL( pArray, B_LEFT ) + 1), ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), iCols ); } diff --git a/harbour/contrib/samples/makefile.vc b/harbour/contrib/samples/makefile.vc new file mode 100644 index 0000000000..ae40de2a84 --- /dev/null +++ b/harbour/contrib/samples/makefile.vc @@ -0,0 +1,138 @@ +# +# $Id$ +# + +# +# Makefile for Harbour Project for Microsoft Visual C (32 bits) +# + +# +# NOTE: You can use these envvars to configure the make process: +# (note that these are all optional) +# +# CFLAGS - Extra C compiler options for libraries and for +# executables +# C_USR - Extra C compiler options for libraries and for +# executables (GNU make compatible envvar) +# CLIBFLAGS - Extra C compiler options for the libraries +# HARBOURFLAGS - Extra Harbour compiler options +# PRG_USR - Extra Harbour compiler options +# (GNU make compatible envvar) +# + +# +# Notes about this makefile: +# +# 1. To add new files to a dependancy list, add an obj name to one of the +# OBJ lists for the appropriate library. +# NOTE: put .prg related obj's last in the lib list. +# +# 2. This is a recursive script. If you change the name of this file, +# be sure to change MK_FILE (a few lines down) to the new name as well. +# +# 3. Recurrsion rules are quite simple: +# If you specifiy /a on the command line, files in the obj\vc dir +# will be deleted, and when nmake recurses, it's without the /a flag +# +# If a .prg.obj rule is fired, nmake will execute this script with +# a specific target as a parameter immediatley after compiling a given +# set of prg files. +# ie: Harbour $< +# nmake /fmakefile.vc obj\vc\rtl.lib2 +# which will simply get make to re-evaluate the dependancy list for the +# lib, and as a result, it will execute the C compiler using the .c.obj +# rule below to create the obj's for the prg's that were created just +# prior to the recurrsive call. Once the obj's are created, the +# recurrsion is complete. +# See additional notes under RTL.LIB below. +# + +MK_FILE = makefile.vc +MK_FLAGS = $(MAKEFLAGS: =) + +OBJ_DIR = ..\..\obj\vc +LIB_DIR = ..\..\lib\vc +BIN_DIR = ..\..\bin\vc + +# +# Directory macros. These should never have to change. +# + +INCLUDE_DIR = ..\..\include +TOOLS_DIR = . + +# +# C compiler definition and C flags. These should never have to change. +# + +AS = masm +CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS) +CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) +CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS) +HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) +LDFLAGS = $(LDFLAGS) + +# +# Macros to access our library names +# + +TOOLS_LIB = $(LIB_DIR)\samples.lib + +HARBOUR_EXE = $(BIN_DIR)\harbour.exe + +# +# Rules +# + +.SUFFIXES: .prg .lib .c .obj .asm + +# override builtin + +.c.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +# +# +# + +LIBLIST = \ + $(TOOLS_LIB) + +# +# TOOLS.LIB rules +# + +{$(TOOLS_DIR)}.c{$(OBJ_DIR)}.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +{$(TOOLS_DIR)}.prg{$(OBJ_DIR)}.obj:: + $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< + $(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(TOOLS_LIB)2 + +TOOLS_LIB_OBJS = \ + $(OBJ_DIR)\environ.obj \ + $(OBJ_DIR)\date.obj \ + $(OBJ_DIR)\dbf.obj \ + $(OBJ_DIR)\gauge.obj \ + $(OBJ_DIR)\num.obj \ + $(OBJ_DIR)\stack.obj \ + $(OBJ_DIR)\status.obj \ + $(OBJ_DIR)\time.obj + +# +# Our default target +# + +all: \ + $(TOOLS_LIB) + +# +# Library dependencies and build rules +# + +$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) + lib /out:$@ $** + +# dummy targets used for prg to c creation + +$(TOOLS_LIB)2 : $(TOOLS_LIB_OBJS) diff --git a/harbour/contrib/samples/makevc.bat b/harbour/contrib/samples/makevc.bat new file mode 100644 index 0000000000..d304b77460 --- /dev/null +++ b/harbour/contrib/samples/makevc.bat @@ -0,0 +1,14 @@ +@echo off +SET _LIB=%LIB% +SET _PATH=%PATH% +SET _INCLUDE=%INCLUDE% +SET LIB=C:\COMPILER\VC\LIB;%PATH% +SET PATH=C:\COMPILER\VC\BIN;%PATH% +SET INCLUDE=INCLUDE;C:\COMPILER\VC\INCLUDE;%_INCLUDE% +nmake /f makefile.vc %1 %2 %3 +SET LIB=%_LIB% +SET PATH=%_PATH% +SET INCLUDE=%_INCLUDE% +SET _LIB= +SET _PATH= +SET _INCLUDE= diff --git a/harbour/contrib/samples/num.c b/harbour/contrib/samples/num.c index fd9f9e3412..51cb8887a8 100644 --- a/harbour/contrib/samples/num.c +++ b/harbour/contrib/samples/num.c @@ -62,7 +62,7 @@ */ HB_FUNC( CEILING ) { - hb_retnl( ceil( hb_parnd( 1 ) ) ); + hb_retnl( (long) ceil( hb_parnd( 1 ) ) ); } /* DtoR( ) --> nRadians @@ -78,7 +78,7 @@ HB_FUNC( DTOR ) */ HB_FUNC( FLOOR ) { - hb_retnl( floor( hb_parnd( 1 ) ) ); + hb_retnl( (long) floor( hb_parnd( 1 ) ) ); } /* NumAsLog10( ) --> nLog10 diff --git a/harbour/contrib/samples/status.c b/harbour/contrib/samples/status.c index e74747f483..2d986e9fc2 100644 --- a/harbour/contrib/samples/status.c +++ b/harbour/contrib/samples/status.c @@ -106,13 +106,13 @@ HB_FUNC( STATUSUPDATE ) lCurrent = ( ++lCurrent > 4 ? 1 : lCurrent ); hb_itemArrayPut( pArray, ST_CURRENT, hb_itemPutNL( pCurrent, lCurrent ) ); - hb_gtGetColorStr( szOldColor ); + hb_gtGetColorStr( (char*) szOldColor ); hb_gtSetColorStr( hb_arrayGetCPtr( pArray, ST_COLOR ) ); - - hb_gtWriteAt( hb_arrayGetNL( pArray, ST_ROW ), hb_arrayGetNL( pArray, ST_COL ), + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, ST_ROW ), + (USHORT) hb_arrayGetNL( pArray, ST_COL ), ( BYTE * ) szDisplay + lCurrent - 1, 1 ); - hb_gtSetColorStr( szOldColor ); + hb_gtSetColorStr( (char*) szOldColor ); hb_itemRelease( pCurrent ); } }