20000319-17:47 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-03-19 17:05:17 +00:00
parent 4041084ad8
commit 10accb5458
34 changed files with 612 additions and 418 deletions

View File

@@ -1,3 +1,69 @@
20000319-17:47 GMT+1 Victor Szakats <info@szelvesz.hu>
* include/hbsetup.h
! __WINDOWS__ -> _WINDOWS_
* include/hbdefs.h
* The #ifdef structure cleaned up.
* source/rtl/gt/gtwin.c
% hb_gt_Tone() simplified.
* source/pp/ppcore.c
! __HARBOUR__ is now zero padded, because it's better to avoid spaces
in a macro value.
* source/rtl/console.c
source/rtl/gt/gtstd.c
source/rtl/gtapi.c
include/hbsetup.h
- Removed the non-GTAPI branch. Last one.
Now the box drawing in GTSTD is probably flawed. The non-GT code snipped
from console.c has moved to gtstd.c
+ hb_gtBox() modified to draw the box from top to bottom and left to
right to better support GTSTD. Tested all weirt combination to be
CA-Cl*pper compatible.
* source/rtl/fstemp.c
! Type fixed.
* source/vm/fm.c
source/rtl/net.c
source/rtl/oemansi.c
source/rtl/dateshb.c
% Using HB_OS_WIN_32
+ source/rtl/diskspac.c
+ source/rtl/scroll.c
+ source/rtl/rat.c
source/rtl/filesys.c
source/rtl/console.c
source/rtl/at.c
source/rtl/Makefile
makefile.bc
makefile.vc
* DISKSPACE() function moved into separate file.
* DISKSPACE() using HB_OS_WIN_32
* SCROLL() function moved into separate file.
% SCROLL() function variable usage optimized (got rid of six variables).
* RAT() function moved into separate file.
* source/rtl/saverest.c
% SAVESCREEN() optimized.
* source/rtl/str.c
source/rtl/val.c
* hb_strVal() moved to val.c, where it belongs.
* source/compiler/harbour.c
include/hbcomp.h
! extern moved to the header file.
* source/rtl/console.c
source/rtl/filesys.c
source/rtl/gtapi.c
source/rtl/gt/gtpca.c
source/rtl/dir.c
! Fixed the <io.h> file issue for Linux.
* source/rtl/do.c
source/rtl/eval.c
% Minor optimization.
* make_vc.bat
include/hbinit.h
include/hbapigt.h
source/rtl/datec.c
* Minor change.
* makefile.bc
! Fixed for the latest compiler/macro file splits.
20000319-01:35 EST Paul Tucker <ptucker@sympatico.ca>
* makefile.vc
* enable 'batch' mode for rdd.lib

View File

@@ -84,7 +84,7 @@ typedef enum
extern void hb_gtInit( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr );
extern void hb_gtExit( void );
extern int hb_gtReadKey( void );
extern void hb_gtAdjustPos( int iHandle, char * pStr, ULONG ulLen );
extern void hb_gtAdjustPos( int iHandle, char * pStr, ULONG ulLen );
extern USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyBoxString );
extern USHORT hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight );
extern USHORT hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight );

View File

@@ -329,6 +329,8 @@ extern FILES hb_comp_files;
extern int hb_comp_iStaticCnt;
extern int hb_comp_iErrorCount;
extern char * hb_comp_szAnnounce;
extern PHB_FNAME hb_comp_pOutPath;
extern BOOL hb_comp_bCredits;
extern BOOL hb_comp_bLogo;

View File

@@ -46,20 +46,17 @@
/* Include windows.h if applicable and requested */
#ifdef HB_OS_WIN_32_USED
#if defined(_WINDOWS_) || defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#if defined(__GNUC__)
#define HB_DONT_DEFINE_BASIC_TYPES
#endif
#if defined(HB_OS_WIN_32_USED) && defined(HB_OS_WIN_32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#if defined(__GNUC__)
#define HB_DONT_DEFINE_BASIC_TYPES
#endif
#endif
#if defined(__IBMCPP__)
/* With the exception of WORD, the IBM Visual Age C++ compiler has
its own definitions of the Harbour types defined in the #else
section of this #ifdef block, most of which conflict with the
its own definitions of the Harbour types most of which conflict with the
Harbour #undefs, due to typedef being the prevalent method of
defining the types in IBMCPP, whereas Harbour assumes that the
definitions that it is replacing have been defined using
@@ -75,36 +72,35 @@
#include <os2.h>
#undef INT
#undef UINT
#else
#define HB_DONT_DEFINE_BASIC_TYPES
#endif /* __IBMCPP__ */
#if ! defined(HB_DONT_DEFINE_BASIC_TYPES)
#undef BOOL /* boolean */
typedef int BOOL;
#undef BOOL /* boolean */
typedef int BOOL;
#undef BYTE
typedef unsigned char BYTE; /* 1 byte unsigned */
#undef BYTE
typedef unsigned char BYTE; /* 1 byte unsigned */
#undef SHORT /* 2 bytes signed */
typedef short int SHORT;
#undef SHORT /* 2 bytes signed */
typedef short int SHORT;
#undef USHORT /* 2 bytes unsigned */
typedef unsigned short int USHORT;
#undef USHORT /* 2 bytes unsigned */
typedef unsigned short int USHORT;
#undef LONG /* 4 bytes signed */
typedef long LONG;
#undef LONG /* 4 bytes signed */
typedef long LONG;
#undef ULONG /* 4 bytes unsigned */
typedef unsigned long ULONG;
#undef ULONG /* 4 bytes unsigned */
typedef unsigned long ULONG;
#undef FALSE
#undef TRUE
#define FALSE 0
#define TRUE 1
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE 1
#endif /* HB_DONT_DEFINE_BASIC_TYPES */
#endif /* __IBMCPP__ */
/* NOTE: Underscore postfix needed to avoid conflict with the functions
named HB_MIN() and HB_MAX() [vszakats] */

View File

@@ -88,7 +88,7 @@ extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* stati
#define HB_CALL_ON_STARTUP_END( func ) }
#endif
#if (defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MPW__))
#if defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MPW__)
#define HB_INIT_SYMBOLS_BEGIN( func ) \
static HB_SYMB symbols[] = {

View File

@@ -147,7 +147,7 @@
/*#define HARBOUR_USE_CRS_GTAPI*/
/*#define HARBOUR_USE_SLN_GTAPI*/
/* Short version are also good */
/* Short versions are also good */
#ifdef HB_GT_PCA
#define HARBOUR_USE_PCA_GTAPI
@@ -171,17 +171,6 @@
#define HARBOUR_USE_SLN_GTAPI
#endif
/* Indicate that one of the GTAPIs is defined */
#if defined(HARBOUR_USE_STD_GTAPI) || \
defined(HARBOUR_USE_DOS_GTAPI) || \
defined(HARBOUR_USE_OS2_GTAPI) || \
defined(HARBOUR_USE_WIN_GTAPI) || \
defined(HARBOUR_USE_CRS_GTAPI) || \
defined(HARBOUR_USE_SLN_GTAPI) || \
defined(HARBOUR_USE_PCA_GTAPI)
#define HARBOUR_USE_GTAPI
#endif
/* ***********************************************************************
* You can set here the maximum symbol name length handled by Harbour
* compiler and runtime. You can override this setting in the make process.
@@ -263,7 +252,7 @@
#endif
#ifndef HB_OS_WIN_32
#if defined(WINNT) || defined(_Windows) || defined(__NT__) || defined(_WIN32) || defined(__WINDOWS__) || defined(__WINDOWS_386__)
#if defined(WINNT) || defined(_Windows) || defined(__NT__) || defined(_WIN32) || defined(_WINDOWS_) || defined(__WINDOWS_386__)
#define HB_OS_WIN_32
#endif
#endif

View File

@@ -13,7 +13,7 @@ if "%1" == "CLEAN" goto CLEAN
:BUILD_OK
if exist bin\vc\*.dll copy bin\vc\*.dll bin\*.* >nul
if exist bin\vc\*.dll copy bin\vc\*.dll bin\*.* > nul
copy bin\vc\*.exe bin\*.* > nul
copy lib\vc\*.lib lib\*.* > nul
goto EXIT

View File

@@ -111,6 +111,7 @@ RTL_LIB_OBJS = \
$(OBJ_DIR)\defpath.obj \
$(OBJ_DIR)\descend.obj \
$(OBJ_DIR)\dir.obj \
$(OBJ_DIR)\diskspac.obj \
$(OBJ_DIR)\do.obj \
$(OBJ_DIR)\empty.obj \
$(OBJ_DIR)\environ.obj \
@@ -147,12 +148,14 @@ RTL_LIB_OBJS = \
$(OBJ_DIR)\oldbox.obj \
$(OBJ_DIR)\oldclear.obj \
$(OBJ_DIR)\pad.obj \
$(OBJ_DIR)\rat.obj \
$(OBJ_DIR)\replic.obj \
$(OBJ_DIR)\right.obj \
$(OBJ_DIR)\round.obj \
$(OBJ_DIR)\run.obj \
$(OBJ_DIR)\samples.obj \
$(OBJ_DIR)\saverest.obj \
$(OBJ_DIR)\scroll.obj \
$(OBJ_DIR)\seconds.obj \
$(OBJ_DIR)\set.obj \
$(OBJ_DIR)\setcolor.obj \
@@ -270,6 +273,9 @@ TOOLS_LIB_OBJS = \
MACRO_LIB_OBJS = \
$(OBJ_DIR)\macroy.obj \
$(OBJ_DIR)\macrol.obj \
$(OBJ_DIR)\macroa.obj \
$(OBJ_DIR)\macrob.obj \
$(OBJ_DIR)\macroc.obj \
$(OBJ_DIR)\macro.obj
#
@@ -390,7 +396,6 @@ HARBOUR_EXE_OBJS = \
$(OBJ_DIR)\genpas.obj \
$(OBJ_DIR)\genrc.obj \
$(OBJ_DIR)\genhrb.obj \
$(OBJ_DIR)\expropt.obj \
$(OBJ_DIR)\expropta.obj \
$(OBJ_DIR)\exproptb.obj \
$(OBJ_DIR)\exproptc.obj \
@@ -548,12 +553,12 @@ $(OBJ_DIR)\harbour.obj : $(COMPILER_DIR)\harbour.c
$(OBJ_DIR)\harboury.c : $(COMPILER_DIR)\harbour.y
bison -d $** -o$@
$(OBJ_DIR)\harboury.obj : $(OBJ_DIR)\harboury.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\harbourl.c : $(COMPILER_DIR)\harbour.l
flex -i -8 -o$@ $**
$(OBJ_DIR)\harboury.obj : $(OBJ_DIR)\harboury.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(OBJ_DIR)\harbourl.obj : $(OBJ_DIR)\harbourl.c
$(CC) $(CLIBFLAGS) -I$(OBJ_DIR) -o$@ $**
@@ -888,6 +893,10 @@ $(OBJ_DIR)\dir.obj : $(RTL_DIR)\dir.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\diskspac.obj : $(RTL_DIR)\diskspac.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\dircmd.c : $(RTL_DIR)\dircmd.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
@@ -1100,6 +1109,10 @@ $(OBJ_DIR)\pad.obj : $(RTL_DIR)\pad.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\rat.obj : $(RTL_DIR)\rat.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\readkey.c : $(RTL_DIR)\readkey.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
@@ -1131,6 +1144,10 @@ $(OBJ_DIR)\saverest.obj : $(RTL_DIR)\saverest.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\scroll.obj : $(RTL_DIR)\scroll.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
$(OBJ_DIR)\seconds.obj : $(RTL_DIR)\seconds.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RTL_LIB) -+$@,,
@@ -1537,13 +1554,13 @@ $(OBJ_DIR)\troff.obj : $(OBJ_DIR)\troff.c
$(OBJ_DIR)\macroy.c : $(MACRO_DIR)\macro.y
bison -d $** -o$@
$(OBJ_DIR)\macrol.c : $(MACRO_DIR)\macro.l
flex -i -8 -o$@ $**
$(OBJ_DIR)\macroy.obj : $(OBJ_DIR)\macroy.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(MACRO_LIB) -+$@,,
$(OBJ_DIR)\macrol.c : $(MACRO_DIR)\macro.l
flex -i -8 -o$@ $**
$(OBJ_DIR)\macrol.obj : $(OBJ_DIR)\macrol.c
$(CC) $(CLIBFLAGS) -I$(OBJ_DIR) -o$@ $**
tlib $(MACRO_LIB) -+$@,,

View File

@@ -175,6 +175,7 @@ RTL_LIB_OBJS = \
$(OBJ_DIR)\defpath.obj \
$(OBJ_DIR)\descend.obj \
$(OBJ_DIR)\dir.obj \
$(OBJ_DIR)\diskspac.obj \
$(OBJ_DIR)\do.obj \
$(OBJ_DIR)\empty.obj \
$(OBJ_DIR)\environ.obj \
@@ -211,12 +212,14 @@ RTL_LIB_OBJS = \
$(OBJ_DIR)\oldbox.obj \
$(OBJ_DIR)\oldclear.obj \
$(OBJ_DIR)\pad.obj \
$(OBJ_DIR)\rat.obj \
$(OBJ_DIR)\replic.obj \
$(OBJ_DIR)\right.obj \
$(OBJ_DIR)\round.obj \
$(OBJ_DIR)\run.obj \
$(OBJ_DIR)\samples.obj \
$(OBJ_DIR)\saverest.obj \
$(OBJ_DIR)\scroll.obj \
$(OBJ_DIR)\seconds.obj \
$(OBJ_DIR)\set.obj \
$(OBJ_DIR)\setcolor.obj \

View File

@@ -113,7 +113,6 @@ BOOL hb_comp_bLogo = TRUE; /* print logo */
BOOL hb_comp_bSyntaxCheckOnly = FALSE; /* syntax check only */
int hb_comp_iLanguage = LANG_C; /* default Harbour generated output language */
extern char * hb_comp_szAnnounce;
typedef struct __EXTERN
{
char * szName;

View File

@@ -233,7 +233,7 @@ void hb_pp_Init( void )
hb_pp_nCondCompile = 0;
{
char szResult[ 5 ];
char szResult[ 6 ];
USHORT usHarbour = ( 256 * HB_VER_MAJOR ) + HB_VER_MINOR;
/*
@@ -243,7 +243,7 @@ void hb_pp_Init( void )
The check below is to ensure that __HARBOUR__ gets the
value of 1 by default
*/
sprintf( szResult, "%4d", ( usHarbour ? usHarbour : 1 ) );
sprintf( szResult, "%05d", ( usHarbour ? usHarbour : 1 ) );
hb_pp_AddDefine( "__HARBOUR__", szResult );
}

View File

@@ -20,6 +20,7 @@ C_SOURCES=\
defpath.c \
descend.c \
dir.c \
diskspac.c \
do.c \
empty.c \
environ.c \
@@ -59,12 +60,14 @@ C_SOURCES=\
oldbox.c \
oldclear.c \
pad.c \
rat.c \
replic.c \
right.c \
round.c \
run.c \
samples.c \
saverest.c \
scroll.c \
seconds.c \
set.c \
setcolor.c \

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* AT(), RAT() functions
* AT() function
*
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
* www - http://www.harbour-project.org
@@ -62,38 +62,3 @@ HARBOUR HB_AT( void )
}
}
/* locates a substring in a string starting at the end */
/* TEST: QOUT( "rat( 'cde', 'abcdefgfedcba' ) = '" + rat( 'cde', 'abcdefgfedcba' ) + "'" ) */
/* TOFIX: Will not work with a search string > 64 KB on some platforms */
HARBOUR HB_RAT( void )
{
ULONG ulSubLen = hb_parclen( 1 );
if( ulSubLen )
{
long lPos = hb_parclen( 2 ) - ulSubLen;
if( lPos >= 0 )
{
char * szSub = hb_parc( 1 );
char * szText = hb_parc( 2 );
BOOL bFound = FALSE;
while( lPos >= 0 && !bFound )
{
if( *( szText + lPos ) == *szSub )
bFound = ( memcmp( szSub, szText + lPos, ulSubLen ) == 0 );
lPos--;
}
hb_retnl( bFound ? lPos + 2 : 0 );
}
else
hb_retni( 0 );
}
else
/* This function never seems to raise an error */
hb_retni( 0 );
}

View File

@@ -42,12 +42,12 @@
* HB_DEVPOS(), hb_dispout(), HB___EJECT(),
* hb_out(), hb_outerr(), HB_OUTERR(),
* hb_outstd(), HB_OUTSTD(), HB_PCOL(), HB_PROW(),
* HB_SETPRC(), HB_SCROLL(), and hb_consoleInitialize()
* HB_SETPRC(), and hb_consoleInitialize()
*
* Copyright 1999 Victor Szakats <info@szelvesz.hu>
* hb_consoleGetNewLine()
* HB_DISPOUTAT()
* HB_DISPBOX() (GT version)
* HB_DISPBOX()
* HB_DISPBEGIN()
* HB_DISPEND()
* HB_DISPCOUNT()
@@ -67,14 +67,15 @@
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#endif
#if !defined( OS_UNIX_COMPATIBLE )
#include <io.h>
#if !defined(OS_UNIX_COMPATIBLE)
#include <io.h>
#endif
/* length of buffer for CR/LF characters */
#if defined(OS_UNIX_COMPATIBLE)
#define CRLF_BUFFER_LEN 2 /*length of buffer for CR/LF characters */
#define CRLF_BUFFER_LEN 2
#else
#define CRLF_BUFFER_LEN 3 /*length of buffer for CR/LF characters */
#define CRLF_BUFFER_LEN 3
#endif
static BOOL s_bInit = FALSE;
@@ -439,42 +440,10 @@ HARBOUR HB_SETPRC( void ) /* Sets the current printer row and column positions *
}
}
HARBOUR HB_SCROLL( void ) /* Scrolls a screen region */
{
USHORT top, left, bottom, right;
int iMR = hb_gtMaxRow();
int iMC = hb_gtMaxCol();
int i_top = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
int i_left = ISNUM( 2 ) ? hb_parni( 2 ) : 0;
int i_bottom = ISNUM( 3 ) ? hb_parni( 3 ) : iMR;
int i_right = ISNUM( 4 ) ? hb_parni( 4 ) : iMC;
int v_scroll = ISNUM( 5 ) ? hb_parni( 5 ) : 0;
int h_scroll = ISNUM( 6 ) ? hb_parni( 6 ) : 0;
/* Enforce limits of (0,0) to (MAXROW(),MAXCOL()) */
if( i_top < 0 ) top = 0;
else if( i_top > iMR ) top = iMR;
else top = i_top;
if( i_left < 0 ) left = 0;
else if( i_left > iMC ) left = iMC;
else left = i_left;
if( i_bottom < 0 ) bottom = 0;
else if( i_bottom > iMR ) bottom = iMR;
else bottom = i_bottom;
if( i_right < 0 ) right = 0;
else if( i_right > iMC ) right = iMC;
else right = i_right;
hb_gtScroll( top, left, bottom, right, v_scroll, h_scroll );
}
HARBOUR HB_DISPBOX( void )
{
if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) )
{
#ifdef HARBOUR_USE_GTAPI
char szOldColor[ CLR_STRLEN ];
if( ISCHAR( 6 ) )
@@ -492,118 +461,6 @@ HARBOUR HB_DISPBOX( void )
if( ISCHAR( 6 ) )
hb_gtSetColorStr( szOldColor );
#else
char * szBorderStyle = _B_SINGLE;
int i_top = hb_parni( 1 );
int i_left = hb_parni( 2 );
int i_bottom = hb_parni( 3 );
int i_right = hb_parni( 4 );
USHORT top, left, bottom, right, size = strlen( _B_SINGLE );
USHORT row, col, width, height;
char Borders[ 9 ];
/* Set limits on the box coordinates to (0,0) and (max_row(),max_col()) */
if( i_top < 0 ) top = 0; else top = ( USHORT ) i_top;
if( i_left < 0 ) left = 0; else left = ( USHORT ) i_left;
if( i_bottom < 0 ) bottom = 0; else bottom = ( USHORT ) i_bottom;
if( i_right < 0 ) right = 0; else right = ( USHORT ) i_right;
if( top > hb_gtMaxRow() ) top = hb_gtMaxRow();
if( left > hb_gtMaxCol() ) left = hb_gtMaxCol();
if( bottom > hb_gtMaxRow() ) bottom = hb_gtMaxRow();
if( right > hb_gtMaxCol() ) right = hb_gtMaxCol();
/* Force the box to be drawn from top left to bottom right */
if( top > bottom )
{
int temp;
temp = top;
top = bottom;
bottom = temp;
}
if( left > right )
{
int temp;
temp = right;
right = left;
left = temp;
}
width = right - left + 1;
height = bottom - top + 1;
/* Determine the box style */
if( ISCHAR( 5 ) )
{
szBorderStyle = hb_parc( 5 );
size = hb_parclen( 5 );
}
else if( ISNUM( 5 ) )
{
switch( hb_parni( 5 ) )
{
case 2:
szBorderStyle = _B_DOUBLE;
break;
case 3:
szBorderStyle = _B_SINGLE_DOUBLE;
break;
case 4:
szBorderStyle = _B_DOUBLE_SINGLE;
break;
default:
szBorderStyle = _B_SINGLE;
}
size = strlen( szBorderStyle );
}
/* We only need 9 characters from the source string */
if( size > 9 ) size = 9;
/* If we have at least one character... */
if( size )
/* ...copy the source string */
memcpy( Borders, szBorderStyle, size );
else
/* If not, set the first character to a space */
Borders[ size++ ] = ' ';
/* If there were less than 8 characters in the source... */
for( ; size < 8; size++ )
{
/* ...copy the last character into the remaining 8 border positions */
Borders[ size ] = Borders[ size - 1 ];
}
/* If there were less than 9 characters in the source... */
if( size < 9 )
/* ...set the fill character to space */
Borders[ 8 ] = ' ';
/* Draw the box */
hb_gtSetPos( top, left );
if( height > 1 && width > 1 )
fputc( Borders[ 0 ], stdout ); /* Upper left corner */
for( col = ( height > 1 ? left + 1 : left ); col < ( height > 1 ? right : right + 1 ); col++ )
fputc( Borders[ 1 ], stdout ); /* Top line */
if( height > 1 && width > 1 )
fputc( Borders[ 2 ], stdout ); /* Upper right corner */
for( row = ( height > 1 ? top + 1 : top ); row < ( width > 1 ? bottom : bottom + 1 ); row++ )
{
hb_gtSetPos( row, left );
if( height > 1 )
fputc( Borders[ 3 ], stdout ); /* Left side */
if( height > 1 && width > 1 ) for( col = left + 1; col < right; col++ )
fputc( Borders[ 8 ], stdout ); /* Fill */
if( height > 1 && width > 1 )
fputc( Borders[ 7 ], stdout ); /* Right side */
}
if( height > 1 && width > 1 )
{
hb_gtSetPos( bottom, left );
col = left;
fputc( Borders[ 6 ], stdout ); /* Bottom left corner */
for( col = left + 1; col < right; col++ )
fputc( Borders[ 5 ], stdout ); /* Bottom line */
fputc( Borders[ 4 ], stdout ); /* Bottom right corner */
}
fflush( stdout );
hb_gtSetPos( bottom + 1, right + 1 );
#endif
}
}

View File

@@ -34,8 +34,8 @@
*/
#include "hbapi.h"
#include "hbapierr.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbdate.h"
char * hb_cmonth( int iMonth )
@@ -45,6 +45,13 @@ char * hb_cmonth( int iMonth )
return ( iMonth >= 1 && iMonth <= 12 ) ? hb_monthsname[ iMonth - 1 ] : "";
}
char * hb_cdow( int iDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_cdow(%d)", iDay));
return ( iDay >= 1 && iDay <= 7 ) ? hb_daysname[ iDay - 1 ] : "";
}
HARBOUR HB_CMONTH( void )
{
PHB_ITEM pDate = hb_param( 1, IT_DATE );
@@ -68,13 +75,6 @@ HARBOUR HB_CMONTH( void )
}
}
char * hb_cdow( int iDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_cdow(%d)", iDay));
return ( iDay >= 1 && iDay <= 7 ) ? hb_daysname[ iDay - 1 ] : "";
}
HARBOUR HB_CDOW( void )
{
PHB_ITEM pDate = hb_param( 1, IT_DATE );

View File

@@ -306,7 +306,7 @@ HARBOUR HB_TIME( void )
{
char szResult[ 9 ];
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
SYSTEMTIME st;
GetLocalTime( &st );
sprintf( szResult, "%02d:%02d:%02d", st.wHour, st.wMinute, st.wSecond );
@@ -326,7 +326,7 @@ HARBOUR HB_DATE( void )
{
char szResult[ 9 ];
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
SYSTEMTIME st;
GetLocalTime( &st );
sprintf( szResult, "%04d%02d%02d", st.wYear, st.wMonth, st.wDay );

View File

@@ -113,23 +113,22 @@
#include "hbapiitm.h"
#include "directry.ch"
#if defined(__GNUC__) && ! defined(__MINGW32__)
#if defined(__GNUC__) && !defined(__MINGW32__)
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <time.h>
#include <unistd.h>
#if defined(__DJGPP__)
#if !defined(OS_UNIX_COMPATIBLE)
#include <io.h>
#endif
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#endif
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__)

View File

@@ -0,0 +1,117 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* DISKSPACE() function
*
* Copyright 1999 Victor Szakats <info@szelvesz.hu>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) with other files to produce
* an executable, this does not by itself cause the resulting executable
* to be covered by the GNU General Public License. Your use of that
* executable is in no way restricted on account of linking the HRL
* and/or HVM code into it.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
*
* Copyright 1999 Luiz Rafael Culik <culik@sl.conex.net>
* Parts of DOS support
*
* See doc/license.txt for licensing terms.
*
*/
#define HB_OS_WIN_32_USED
#include <ctype.h>
#if defined(DOS) || defined(__WATCOMC__)
#include <dos.h>
#endif
#include "hbapi.h"
#include "hbapierr.h"
HARBOUR HB_DISKSPACE( void )
{
ULONG ulSpaceFree = 0;
USHORT uiDrive = ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ?
( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' + 1 ) : 0;
#if defined(DOS) || defined(__WATCOMC__)
struct diskfree_t disk;
unsigned uiResult;
while( ( uiResult = _dos_getdiskfree( uiDrive, &disk ) ) != 0 )
{
USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT );
if( uiAction == E_DEFAULT || uiAction == E_BREAK )
break;
}
if( uiResult != 0 )
ulSpaceFree = ( ULONG ) disk.avail_clusters *
( ULONG ) disk.sectors_per_cluster *
( ULONG ) disk.bytes_per_sector;
#elif defined(HB_OS_WIN_32)
{
char szPath[ 4 ];
DWORD dwSectorsPerCluster;
DWORD dwBytesPerSector;
DWORD dwNumberOfFreeClusters;
DWORD dwTotalNumberOfClusters;
szPath[ 0 ] = uiDrive + 'A' - 1;
szPath[ 1 ] = ':';
szPath[ 2 ] = '\\';
szPath[ 3 ] = '\0';
if( GetDiskFreeSpace( szPath,
&dwSectorsPerCluster,
&dwBytesPerSector,
&dwNumberOfFreeClusters,
&dwTotalNumberOfClusters ) )
{
ulSpaceFree = dwNumberOfFreeClusters *
dwSectorsPerCluster *
dwBytesPerSector;
}
}
#else
HB_SYMBOL_UNUSED( uiDrive );
#endif
hb_retnl( ( long ) ulSpaceFree );
}

View File

@@ -40,7 +40,6 @@
HARBOUR HB_DO( void )
{
USHORT uiPCount = hb_pcount();
PHB_ITEM pItem = hb_param( 1, IT_ANY );
if( IS_STRING( pItem ) )
@@ -49,6 +48,7 @@ HARBOUR HB_DO( void )
if( pDynSym )
{
USHORT uiPCount = hb_pcount();
USHORT uiParam;
hb_vmPushSymbol( pDynSym->pSymbol );
@@ -62,6 +62,7 @@ HARBOUR HB_DO( void )
}
else if( IS_BLOCK( pItem ) )
{
USHORT uiPCount = hb_pcount();
USHORT uiParam;
hb_vmPushSymbol( &hb_symEval );
@@ -72,6 +73,7 @@ HARBOUR HB_DO( void )
}
else if( IS_SYMBOL( pItem ) )
{
USHORT uiPCount = hb_pcount();
USHORT uiParam;
hb_vmPushSymbol( pItem->item.asSymbol.value );

View File

@@ -40,11 +40,11 @@
HARBOUR HB_EVAL( void )
{
USHORT uiPCount = hb_pcount();
PHB_ITEM pItem = hb_param( 1, IT_BLOCK );
if( pItem )
{
USHORT uiPCount = hb_pcount();
USHORT uiParam;
hb_vmPushSymbol( &hb_symEval );

View File

@@ -51,7 +51,6 @@
* HB_ISDISK()
* HB_DISKCHANGE()
* HB_DISKNAME()
* HB_DISKSPACE() (parts by Luiz Rafael Culik <culik@sl.conex.net>)
*
* Copyright 1999 Jose Lalin <dezac@corevia.com>
* hb_fsChDrv()
@@ -73,9 +72,8 @@
This has been corrected by ptucker
*/
#define HB_OS_WIN_32_USED
#include <ctype.h>
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
@@ -87,10 +85,10 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#if !defined( OS_UNIX_COMPATIBLE )
#include <io.h>
#endif
#if !defined(OS_UNIX_COMPATIBLE)
#include <io.h>
#endif
#if defined(__DJGPP__)
#include <dir.h>
#define _getdrive getdisk
@@ -1532,66 +1530,6 @@ HARBOUR HB_DIRREMOVE( void )
#endif
HARBOUR HB_DISKSPACE( void )
{
ULONG ulSpaceFree = 0;
USHORT uiDrive = ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ?
( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' + 1 ) : 0;
#if defined( DOS ) || defined( __WATCOMC__ )
struct diskfree_t disk;
unsigned uiResult;
while( ( uiResult = _dos_getdiskfree( uiDrive, &disk ) ) != 0 )
{
USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT );
if( uiAction == E_DEFAULT || uiAction == E_BREAK )
break;
}
if( uiResult != 0 )
ulSpaceFree = ( ULONG ) disk.avail_clusters *
( ULONG ) disk.sectors_per_cluster *
( ULONG ) disk.bytes_per_sector;
#elif defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
{
char szPath[ 4 ];
DWORD dwSectorsPerCluster;
DWORD dwBytesPerSector;
DWORD dwNumberOfFreeClusters;
DWORD dwTotalNumberOfClusters;
szPath[ 0 ] = uiDrive + 'A' - 1;
szPath[ 1 ] = ':';
szPath[ 2 ] = '\\';
szPath[ 3 ] = '\0';
if( GetDiskFreeSpace( szPath,
&dwSectorsPerCluster,
&dwBytesPerSector,
&dwNumberOfFreeClusters,
&dwTotalNumberOfClusters ) )
{
ulSpaceFree = dwNumberOfFreeClusters *
dwSectorsPerCluster *
dwBytesPerSector;
}
}
#else
HB_SYMBOL_UNUSED( uiDrive );
#endif
hb_retnl( ( long ) ulSpaceFree );
}
#ifdef HB_COMPAT_C53
/* NOTE: Clipper 5.3 undocumented */

View File

@@ -47,7 +47,7 @@ void hb_fsTempName( BYTE * pszBuffer, const BYTE * pszDir, const BYTE * pszPrefi
HB_SYMBOL_UNUSED( pszDir );
HB_SYMBOL_UNUSED( pszPrefix );
/* NOFIX: The spec says to reserve L_tmpnam number of characters for the
/* TOFIX: The spec says to reserve L_tmpnam number of characters for the
passed buffer. It will be needed to fix _POSIX_PATH_MAX to be
at least this large. */

View File

@@ -40,16 +40,19 @@
/* NOTE: User programs should never call this layer directly! */
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#endif
#include <io.h>
#include <ctype.h>
#include <string.h>
#include "hbapigt.h"
#include "hbset.h"
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#endif
#if !defined(OS_UNIX_COMPATIBLE)
#include <io.h>
#endif
static USHORT s_usRow, s_usCol, s_usMaxRow, s_usMaxCol;
static int s_iFilenoStdin, s_iFilenoStdout, s_iFilenoStderr;
static int s_iAttribute;

View File

@@ -73,7 +73,7 @@ void hb_gt_Done( void )
int hb_gt_ReadKey( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey()"));
HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey()"));
/* TODO: */
@@ -167,7 +167,7 @@ void hb_gt_SetPos( SHORT iRow, SHORT iCol )
iDevCol = 0;
iDevRow++;
}
else if( iRow > iDevRow )
else if( iRow > iDevRow )
iDevCol = 0;
for( iCount = iDevRow; iCount < iRow; iCount++ )
@@ -263,15 +263,15 @@ void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
/* TODO: */
if( uiTop == 0 &&
uiBottom == s_uiMaxRow &&
uiLeft == 0 &&
uiRight == s_uiMaxCol &&
iRows == 0 &&
if( uiTop == 0 &&
uiBottom == s_uiMaxRow &&
uiLeft == 0 &&
uiRight == s_uiMaxCol &&
iRows == 0 &&
iCols == 0 )
{
for( ; uiBottom; uiBottom-- )
fputs( hb_consoleGetNewLine(), stdout );
fputs( hb_consoleGetNewLine(), stdout );
fflush( stdout );
@@ -338,3 +338,115 @@ void hb_gt_Tone( double dFrequency, double dDuration )
HB_SYMBOL_UNUSED( dDuration );
}
/*
BYTE pszBox[ 10 ];
USHORT uiRow;
USHORT uiCol;
USHORT width, height, tmp;
USHORT top, left, bottom, right, size = strlen( _B_SINGLE );
/* TODO: Would be better to support these cases, Clipper implementation */
/* was quite messy for these cases, which can be considered as */
/* a bug there. */
if( uiTop > uiMaxRow || uiBottom > uiMaxRow ||
uiLeft > uiMaxCol || uiRight > uiMaxCol )
{
return 1;
}
/* Force the box to be drawn from top left to bottom right */
if( top > bottom )
{
tmp = top;
top = bottom;
bottom = tmp;
}
if( left > right )
{
tmp = right;
right = left;
left = tmp;
}
width = right - left + 1;
height = bottom - top + 1;
/* Determine the box style */
if( ISCHAR( 5 ) )
{
pbyFrame = hb_parc( 5 );
size = hb_parclen( 5 );
}
else if( ISNUM( 5 ) )
{
switch( hb_parni( 5 ) )
{
case 2:
pbyFrame = _B_DOUBLE;
break;
case 3:
pbyFrame = _B_SINGLE_DOUBLE;
break;
case 4:
pbyFrame = _B_DOUBLE_SINGLE;
break;
default:
pbyFrame = _B_SINGLE;
}
size = strlen( pbyFrame );
}
/* We only need 9 characters from the source string */
if( size > 9 ) size = 9;
/* If we have at least one character... */
if( size )
/* ...copy the source string */
memcpy( pszBox, pbyFrame, size );
else
/* If not, set the first character to a space */
pszBox[ size++ ] = ' ';
/* If there were less than 8 characters in the source... */
for( ; size < 8; size++ )
{
/* ...copy the last character into the remaining 8 border positions */
pszBox[ size ] = pszBox[ size - 1 ];
}
/* If there were less than 9 characters in the source... */
if( size < 9 )
/* ...set the fill character to space */
pszBox[ 8 ] = ' ';
/* Draw the box */
hb_gtSetPos( top, left );
if( height > 1 && width > 1 )
fputc( pszBox[ 0 ], stdout ); /* Upper left corner */
for( uiCol = ( height > 1 ? left + 1 : left ); uiCol < ( height > 1 ? right : right + 1 ); uiCol++ )
fputc( pszBox[ 1 ], stdout ); /* Top line */
if( height > 1 && width > 1 )
fputc( pszBox[ 2 ], stdout ); /* Upper right corner */
for( uiRow = ( height > 1 ? top + 1 : top ); uiRow < ( width > 1 ? bottom : bottom + 1 ); uiRow++ )
{
hb_gtSetPos( uiRow, left );
if( height > 1 )
fputc( pszBox[ 3 ], stdout ); /* Left side */
if( height > 1 && width > 1 ) for( uiCol = left + 1; uiCol < right; uiCol++ )
fputc( pszBox[ 8 ], stdout ); /* Fill */
if( height > 1 && width > 1 )
fputc( pszBox[ 7 ], stdout ); /* Right side */
}
if( height > 1 && width > 1 )
{
hb_gtSetPos( bottom, left );
uiCol = left;
fputc( pszBox[ 6 ], stdout ); /* Bottom left corner */
for( uiCol = left + 1; uiCol < right; uiCol++ )
fputc( pszBox[ 5 ], stdout ); /* Bottom line */
fputc( pszBox[ 4 ], stdout ); /* Bottom right corner */
}
fflush( stdout );
hb_gtSetPos( bottom + 1, right + 1 );
*/

View File

@@ -748,27 +748,11 @@ void hb_gt_Tone( double dFrequency, double dDuration )
/* The conversion from Clipper timer tick units to
milliseconds is * 1000.0 / 18.2. */
dFrequency = HB_MIN_( HB_MAX_( 0.0, dFrequency ), 32767.0 );
dDuration = dDuration * 1000.0 / 18.2; /* milliseconds */
dDuration = HB_MIN_( HB_MAX_( 0, dDuration ), ULONG_MAX );
while( dDuration > 0.0 )
{
ULONG temp = ( ULONG ) HB_MIN_( HB_MAX_( 0, dDuration ), ULONG_MAX );
dDuration -= temp;
if( temp <= 0 )
{
/* Ensure that the loop gets terminated when
only a fraction of the delay time remains. */
dDuration = -1.0;
}
else
{
/* Bad news for non-NT Windows platforms: Beep() ignores
both parameters and either generates the default sound
event or the standard system beep. */
Beep( ( ULONG ) dFrequency, temp );
}
}
if( dDuration > 0.0 )
Beep( ( ULONG ) HB_MIN_( HB_MAX_( 0.0, dFrequency ), 32767.0 ),
( ULONG ) dDuration );
}

View File

@@ -55,19 +55,18 @@
*
*/
#include "hbsetup.h" /* this have to be included to get OS_xxx defined */
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#endif
#if !defined( OS_UNIX_COMPATIBLE )
#include <io.h>
#endif
#include <ctype.h>
#include "hbapigt.h"
#include "hbset.h"
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#endif
#if !defined(OS_UNIX_COMPATIBLE)
#include <io.h>
#endif
static SHORT s_iCurrentRow = 0;
static SHORT s_iCurrentCol = 0;
static USHORT s_uiDispCount = 0;
@@ -160,9 +159,7 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B
if( uiTop > uiMaxRow || uiBottom > uiMaxRow ||
uiLeft > uiMaxCol || uiRight > uiMaxCol )
{
return 1;
}
/* For full compatibility, pad box string with last char if too short */
@@ -187,51 +184,55 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
height = uiBottom - uiTop + 1;
width = uiRight - uiLeft + 1;
hb_gtDispBegin();
if( height > 1 && width > 1 )
hb_gtWriteAt( uiTop, uiLeft, pszBox + 0, sizeof( BYTE ) ); /* Upper left corner */
if( height == 1 )
{
hb_gtWriteAt( uiRow , uiCol , pszBox + 0, sizeof( BYTE ) );
hb_gtWriteAt( uiRow , uiRight, pszBox + 2, sizeof( BYTE ) );
hb_gtWriteAt( uiBottom, uiCol , pszBox + 6, sizeof( BYTE ) );
hb_gtWriteAt( uiBottom, uiRight, pszBox + 4, sizeof( BYTE ) );
if( width > 1 )
hb_gtRepChar( uiTop, uiLeft, pszBox[ 1 ], uiRight - uiLeft + 1 ); /* Top line */
else
hb_gtRepChar( uiTop, uiLeft, pszBox[ 1 ], 1 ); /* Top line */
}
else if( width > 2 )
hb_gtRepChar( uiTop, uiLeft + 1, pszBox[ 1 ], uiRight - uiLeft - 1 ); /* Top line */
if( height > 1 && width > 1 )
hb_gtWriteAt( uiTop, uiRight, pszBox + 2, sizeof( BYTE ) ); /* Upper right corner */
uiCol = ( height > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
{
hb_gtRepChar( uiRow, uiCol, pszBox[ 1 ], uiRight - uiLeft + ( height > 1 ? -1 : 1 ) );
if( height > 1 )
hb_gtRepChar( uiBottom, uiCol, pszBox[ 5 ], uiRight - uiLeft + ( height > 1 ? -1 : 1 ) );
}
if( pszBox[ 8 ] && height > 2 && width > 2 )
if( pszBox[ 8 ] && width > 2 && height > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
{
uiCol = uiLeft;
hb_gtWriteAt( uiRow, uiCol++, pszBox + 7, sizeof( BYTE ) );
hb_gtRepChar( uiRow, uiCol , pszBox[ 8 ], uiRight - uiLeft - 1 );
hb_gtWriteAt( uiRow, uiRight, pszBox + 3, sizeof( BYTE ) );
hb_gtWriteAt( uiRow, uiCol++, pszBox + 7, sizeof( BYTE ) ); /* Left side */
hb_gtRepChar( uiRow, uiCol , pszBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gtWriteAt( uiRow, uiRight, pszBox + 3, sizeof( BYTE ) ); /* Right side */
}
}
else
else if( height > 1 )
{
for( uiRow = ( width > 1 ? uiTop + 1 : uiTop ); uiRow < ( width > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
{
hb_gtWriteAt( uiRow, uiLeft, pszBox + 7, sizeof( BYTE ) );
hb_gtWriteAt( uiRow, uiLeft, pszBox + 7, sizeof( BYTE ) ); /* Left side */
if( width > 1 )
hb_gtWriteAt( uiRow, uiRight, pszBox + 3, sizeof( BYTE ) );
hb_gtWriteAt( uiRow, uiRight, pszBox + 3, sizeof( BYTE ) ); /* Right side */
}
}
if( height > 1 && width > 1 )
{
hb_gtWriteAt( uiBottom, uiLeft, pszBox + 6, sizeof( BYTE ) ); /* Bottom left corner */
hb_gtRepChar( uiBottom, uiLeft + 1, pszBox[ 5 ], uiRight - uiLeft - 1 ); /* Bottom line */
hb_gtWriteAt( uiBottom, uiRight, pszBox + 4, sizeof( BYTE ) ); /* Bottom right corner */
}
hb_gtDispEnd();
hb_gtSetPos( uiTopBak + 1, uiLeftBak + 1 );

View File

@@ -57,7 +57,7 @@
HARBOUR HB_NETNAME( void )
{
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1;
char * pszValue = ( char * ) hb_xgrab( ulLen );

View File

@@ -46,7 +46,7 @@ HARBOUR HB_HB_ANSITOOEM( void )
PHB_ITEM pString = hb_param( 1, IT_STRING );
if( pString )
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
DWORD ulLen = hb_itemGetCLen( pString );
char * pszDst = ( char * ) hb_xgrab( ulLen + 1 );
@@ -68,7 +68,7 @@ HARBOUR HB_HB_OEMTOANSI( void )
PHB_ITEM pString = hb_param( 1, IT_STRING );
if( pString )
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
DWORD ulLen = hb_itemGetCLen( pString );
char * pszDst = ( char * ) hb_xgrab( ulLen + 1 );

68
harbour/source/rtl/rat.c Normal file
View File

@@ -0,0 +1,68 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* RAT() function
*
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) with other files to produce
* an executable, this does not by itself cause the resulting executable
* to be covered by the GNU General Public License. Your use of that
* executable is in no way restricted on account of linking the HRL
* and/or HVM code into it.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "hbapi.h"
HARBOUR HB_RAT( void )
{
ULONG ulSubLen = hb_parclen( 1 );
if( ulSubLen )
{
long lPos = hb_parclen( 2 ) - ulSubLen;
if( lPos >= 0 )
{
char * pszSub = hb_parc( 1 );
char * pszText = hb_parc( 2 );
BOOL bFound = FALSE;
while( lPos >= 0 && !bFound )
{
if( *( pszText + lPos ) == *pszSub )
bFound = ( memcmp( pszSub, pszText + lPos, ulSubLen ) == 0 );
lPos--;
}
hb_retnl( bFound ? lPos + 2 : 0 );
}
else
hb_retni( 0 );
}
else
/* This function never seems to raise an error */
hb_retni( 0 );
}

View File

@@ -38,19 +38,20 @@
HARBOUR HB_SAVESCREEN( void )
{
USHORT uiX;
USHORT uiCoords[ 4 ];
USHORT uiTop = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
USHORT uiLeft = ISNUM( 2 ) ? hb_parni( 2 ) : 0;
USHORT uiBottom = ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow();
USHORT uiRight = ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol();
USHORT uiSize;
void * pBuffer;
uiCoords[ 0 ] = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
uiCoords[ 1 ] = ISNUM( 2 ) ? hb_parni( 2 ) : 0;
uiCoords[ 2 ] = ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow();
uiCoords[ 3 ] = ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol();
hb_gtRectSize( uiTop, uiLeft, uiBottom, uiRight, &uiSize );
pBuffer = hb_xgrab( uiSize );
hb_gtSave( uiTop, uiLeft, uiBottom, uiRight, pBuffer );
hb_retclen( ( char * ) pBuffer, uiSize );
hb_gtRectSize( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], &uiX );
pBuffer = hb_xgrab( uiX );
hb_gtSave( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], pBuffer );
hb_retclen( ( char * ) pBuffer, uiX );
hb_xfree( ( char * ) pBuffer );
}

View File

@@ -0,0 +1,72 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SCROLL() function
*
* Copyright 1999 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) with other files to produce
* an executable, this does not by itself cause the resulting executable
* to be covered by the GNU General Public License. Your use of that
* executable is in no way restricted on account of linking the HRL
* and/or HVM code into it.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "hbapi.h"
#include "hbapigt.h"
/* Scrolls a screen region */
HARBOUR HB_SCROLL( void )
{
int iMaxRow = hb_gtMaxRow();
int iMaxCol = hb_gtMaxCol();
int iTop = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
int iLeft = ISNUM( 2 ) ? hb_parni( 2 ) : 0;
int iBottom = ISNUM( 3 ) ? hb_parni( 3 ) : iMaxRow;
int iRight = ISNUM( 4 ) ? hb_parni( 4 ) : iMaxCol;
/* Enforce limits of (0,0) to (MAXROW(),MAXCOL()) */
if( iTop < 0 ) iTop = 0;
else if( iTop > iMaxRow ) iTop = iMaxRow;
if( iLeft < 0 ) iLeft = 0;
else if( iLeft > iMaxCol ) iLeft = iMaxCol;
if( iBottom < 0 ) iBottom = 0;
else if( iBottom > iMaxRow ) iBottom = iMaxRow;
if( iRight < 0 ) iRight = 0;
else if( iRight > iMaxCol ) iRight = iMaxCol;
hb_gtScroll( ( USHORT ) iTop,
( USHORT ) iLeft,
( USHORT ) iBottom,
( USHORT ) iRight,
ISNUM( 5 ) ? hb_parni( 5 ) : 0,
ISNUM( 6 ) ? hb_parni( 6 ) : 0 );
}

View File

@@ -37,14 +37,6 @@
#include "hbapiitm.h"
#include "hbapierr.h"
/* returns the numeric value of a character string representation of a number */
double hb_strVal( const char * szText )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%s)", szText));
return atof( szText );
}
HARBOUR HB_STR( void )
{
BOOL bValid;

View File

@@ -37,6 +37,14 @@
#include "hbapiitm.h"
#include "hbapierr.h"
/* returns the numeric value of a character string representation of a number */
double hb_strVal( const char * szText )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%s)", szText));
return atof( szText );
}
/* returns the numeric value of a character string representation of a number */
HARBOUR HB_VAL( void )
{

View File

@@ -491,7 +491,7 @@ ULONG hb_xquery( USHORT uiMode )
switch( uiMode )
{
case HB_MEM_CHAR: /* (Free Variable Space [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -503,7 +503,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_BLOCK: /* (Largest String [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -515,7 +515,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_RUN: /* (RUN Memory [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -527,7 +527,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_VM: /* UNDOCUMENTED! (Virtual Memory [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -539,7 +539,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_EMS: /* UNDOCUMENTED! (Free Expanded Memory [KB]) (?) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
ulResult = 0;
#else
ulResult = 9999;
@@ -547,7 +547,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_FM: /* UNDOCUMENTED! (Fixed Memory/Heap [KB]) (?) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -559,7 +559,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_FMSEGS: /* UNDOCUMENTED! (Segments in Fixed Memory/Heap) (?) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
ulResult = 1;
#else
ulResult = 9999;
@@ -567,7 +567,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_SWAP: /* UNDOCUMENTED! (Free Swap Memory [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
{
MEMORYSTATUS memorystatus;
GlobalMemoryStatus( &memorystatus );
@@ -579,7 +579,7 @@ ULONG hb_xquery( USHORT uiMode )
break;
case HB_MEM_CONV: /* UNDOCUMENTED! (Free Conventional [KB]) */
#if defined(_Windows) || defined(__NT__) || defined(WINNT) || defined(_WIN32)
#if defined(HB_OS_WIN_32)
ulResult = 0;
#else
ulResult = 9999;