20000322-16:33 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-03-22 15:35:35 +00:00
parent ec7f2f19ba
commit d4111b2b0a
17 changed files with 459 additions and 75 deletions

View File

@@ -1,3 +1,52 @@
20000322-16:33 GMT+1 Victor Szakats <info@szelvesz.hu>
- include/hbclip.ch
+ contrib/hbclip/hbclip.ch
+ contrib/hbclip/hbclip.lib
+ contrib/hbclip/hbclip.prg
+ contrib/hbclip/hbcolind.c
+ contrib/hbclip/hbkeyput.prg
+ contrib/hbclip/hbshadow.prg
+ contrib/hbclip/hbstod.c
+ contrib/hbclip/hbvaltoc.prg
+ contrib/hbclip/make_clp.bat
+ contrib/hbclip/readme.txt
+ Harbour Compatibility Library for CA-Clipper 5.x/'87 contribution
started.
+ STOD(), HB_VALTOSTR(), HB_KEYPUT(), HB_COLORINDEX() functions added.
+ Some functions from hbclip.ch also added to the library so that the
the library (HBCLIP.LIB) can be used with Clipper Summer '87.
+ Header file from Harbour include dir moved here.
* makefile.bc
makefile.vc
+ Some user notes added about configuration.
- source/tools/io.c
* include/hbapifs.h
source/rtl/diskspac.c
source/tools/Makefile
tests/tstdspac.prg
makefile.bc
makefile.vc
- Removed the internal function hb_fsDiskSpace() (the reason is that
this internal function may actually throw a Harbour runtime error.)
- Removed CD(), MD(), RD(), DISK*() from TOOLS.
You can use these macros to access the removed functions:
(This will require HB_COMPAT_C53 and #include "fileio.ch")
#define CD( d ) DIRCHANGE( d )
#define MD( d ) MAKEDIR( d )
#define RD( d ) DIRREMOVE( d )
#define DISKUSED( d ) DISKSPACE( d, HB_DISK_USED )
#define DISKFREE( d ) DISKSPACE( d, HB_DISK_FREE )
#define DISKFULL( d ) DISKSPACE( d, HB_DISK_TOTAL )
* source/rtl/dir.c
* Some minor cleanup (CVSd in the previous session)
20000322-13:30 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/rtl/diskspac.c
! Workaround for GCC/Win32 (Cygwin and Mingw32).

View File

@@ -3,7 +3,7 @@
*/
/*
* Harbour Project source code:
* Harbour Compatibility Library for CA-Cl*pper source code:
* Header file to help compile Harbour source files with Clipper
*
* Copyright 1999 Paul Tucker <ptucker@sympatico.ca>
@@ -48,23 +48,15 @@
#ifndef HB_CLIP_CH_
#define HB_CLIP_CH_
/* TODO: Rewrite as much of these in C or Clipper */
#xtranslate HB_ARGCHECK( <s> ) => ( .F. )
#xtranslate HB_ARGSTRING( <s> ) => ""
#xtranslate HB_ARGC() => 0
#xtranslate HB_ARGV( <n> ) => ""
#xtranslate HB_PVALUE( <n> ) => NIL
#xtranslate HB_OSNEWLINE() => ( Chr( 13 ) + Chr( 10 ) )
#xtranslate HB_SHADOW => dbgShadow
#xtranslate HB_COLORINDEX( <s>[, <n>] ) => ""
#xtranslate HB_STOD( <s> ) => CToD( "" )
#xtranslate HB_FNAMESPLIT( <s> ) => NIL
#xtranslate HB_FNAMEMERGE( <s1>[, <s2>[, <s3>[, <s4>]]] ) => ""
#xtranslate HB_KEYPUT( <n> ) => NIL
#xtranslate HB_ANSITOOEM( <s> ) => ( s )
#xtranslate HB_OEMTOANSI( <s> ) => ( s )
#xtranslate HB_VALTOSTR( <x> ) => ""
#xtranslate HB_TRACESTATE( [<n>] ) => 0
#xtranslate HB_TRACELEVEL( [<n>] ) => 0
#xtranslate HB_PVALUE( <n> ) => NIL
#xtranslate HB_SETKEYGET( [<n>][, <b>] ) => NIL
#xtranslate HB_SETKEYSAVE( [<a>] ) => ( {} )
#xtranslate HB_SETKEYCHECK( <n>[, <x1>[, <x2>[, <x3>]]] ) => ( .F. )

View File

@@ -0,0 +1,52 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* Some simple and dummy functions (to use instead of hbclip.ch)
*
* Copyright 2000 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/).
*
*/
/* Dummy or simple functions */
FUNCTION HB_OSNEWLINE()
RETURN Chr( 13 ) + Chr( 10 )
FUNCTION HB_ANSITOOEM( cString )
RETURN cString
FUNCTION HB_OEMTOANSI( cString )
RETURN cString
FUNCTION HB_TRACESTATE( nValue )
RETURN 0
FUNCTION HB_TRACELEVEL( nValue )
RETURN 0

View File

@@ -0,0 +1,85 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* HB_COLORINDEX() 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/).
*
*/
#include "extend.h"
CLIPPER HB_COLORIN( void )
{
if( ISCHAR( 1 ) && ISNUM( 2 ) )
{
char * pszColor = _parc( 1 );
USHORT uiColorPos;
USHORT uiColorLen;
USHORT uiColorIndex = ( USHORT ) _parni( 2 );
/* Skip the given number of commas */
for( uiColorPos = 0 ; pszColor[ uiColorPos ] != '\0' && uiColorIndex > 0 ; uiColorPos++ )
{
if( pszColor[ uiColorPos ] == ',' )
uiColorIndex--;
}
/* if found, continue */
if( uiColorIndex == 0 )
{
/* Skip the spaces after the comma */
while( pszColor[ uiColorPos ] == ' ' ) uiColorPos++;
/* Search for next comma or end of string */
uiColorLen = 0;
while( pszColor[ uiColorPos + uiColorLen ] != '\0' &&
pszColor[ uiColorPos + uiColorLen ] != ',' ) uiColorLen++;
/* Skip the trailing spaces */
while( uiColorLen > 0 &&
pszColor[ uiColorPos + uiColorLen - 1 ] == ' ' ) uiColorLen--;
/* Return the string */
_retclen( pszColor + uiColorPos, uiColorLen );
}
else
_retc( "" );
}
else
_retc( "" );
}

View File

@@ -0,0 +1,43 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* HB_KEYPUT() function
*
* Copyright 2000 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/).
*
*/
/* NOTE: This one will reset the keyboard buffer, while Harbour not. */
/* NOTE: This one will not allow certain keycodes which are fine in Harbour. */
PROCEDURE HB_KEYPUT( nKey )
KEYBOARD Chr( nKey )
RETURN

View File

@@ -0,0 +1,40 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* HB_SHADOW() function
*
* Copyright 2000 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/).
*
*/
/* NOTE: You can also use the header file */
FUNCTION HB_SHADOW( t, l, b, r, a )
RETURN dbgShadow( t, l, b, r, a )

View File

@@ -0,0 +1,43 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* STOD() function
*
* Copyright 2000 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/).
*
*/
#include "extend.h"
CLIPPER STOD( void )
{
/* The length check is a fix to avoid buggy behaviour of _retds() */
_retds( ( ISCHAR( 1 ) && _parclen( 1 ) == 8 ) ? _parc( 1 ) : " " );
}

View File

@@ -0,0 +1,48 @@
/*
* $Id$
*/
/*
* Harbour Compatibility Library for CA-Cl*pper source code:
* HB_VALTOSTR() function
*
* Copyright 2000 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/).
*
*/
FUNCTION HB_VALTOSTR( xValue )
LOCAL cType := ValType( xValue )
DO CASE
CASE cType $ "CM" ; RETURN xValue
CASE cType == "D" ; RETURN CToD( xValue )
CASE cType == "N" ; RETURN Str( xValue )
CASE cType == "L" ; RETURN iif( xValue, ".T.", ".F." )
CASE cType == "U" ; RETURN "NIL"
ENDCASE
RETURN ""

View File

@@ -0,0 +1,24 @@
@echo off
rem
rem $Id$
rem
clipper hbclip.prg /n
clipper hbkeyput.prg /n
clipper hbshadow.prg /n
clipper hbvaltoc.prg /n
c:\devl\msc\bin\cl /c /AL /Zl /Oalt /Gs /W3 hbcolind.c
c:\devl\msc\bin\cl /c /AL /Zl /Oalt /Gs /W3 hbstod.c
del hbclip.lib
lib hbclip -+ hbclip.obj ,,
lib hbclip -+ hbkeyput.obj ,,
lib hbclip -+ hbshadow.obj ,,
lib hbclip -+ hbvaltoc.obj ,,
lib hbclip -+ hbcolind.obj ,,
lib hbclip -+ hbstod.obj ,,
del hbclip.bak
del *.obj

View File

@@ -0,0 +1,22 @@
/*
* $Id$
*/
Harbour Compatibility Library (HCL) for CA-Clipper 5.x/'87
==========================================================
The goal of this library and header file is to provide some level
of compatibility for Harbour code when compiled with CA-Clipper.
You will require Microsoft C 5.1 or 8.x and CA-Clipper to compile
and build this library.
Use MAKE_CLP.BAT to build the library.
Later on add HBCLIP.LIB to your link script.
Optionally on CA-Clipper 5.x you may want to #include "hbclip.ch" to
your source files.
Victor Szakats <info@szelvesz.hu>

View File

@@ -90,7 +90,6 @@ extern BYTE * hb_fsCurDir ( USHORT uiDrive );
extern USHORT hb_fsCurDirBuff ( USHORT uiDrive, BYTE * pbyBuffer, ULONG ulLen );
extern BYTE hb_fsCurDrv ( void );
extern int hb_fsDelete ( BYTE * pszFileName );
extern double hb_fsDiskSpace ( USHORT uiDrive, USHORT uiType );
extern USHORT hb_fsError ( void );
extern BOOL hb_fsFile ( BYTE * pszFileName );
extern ULONG hb_fsFSize ( BYTE * pszFileName, BOOL bUseDirEntry );

View File

@@ -2,10 +2,26 @@
# $Id$
#
# makefile for Borland C/C++ compilers
#
# Makefile for Harbour Project for Borland C/C++ 3.x, 4.x, 5.x compilers
#
#
# 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
# CLIBFLAGS - Extra C compiler options for the libraries
# HARBOURFLAGS - Extra Harbour compiler options
# HB_GT_LIB - To override the default GT driver
# (search for HB_GT_LIBS for a list)
#
#
# NOTE: "echo." intentionally used instead of "echo", to avoid conflicts
# with external commands named echo.
#
!if $d(B16)
@@ -283,7 +299,6 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\dates2.obj \
$(OBJ_DIR)\dbftools.obj \
$(OBJ_DIR)\hb_f.obj \
$(OBJ_DIR)\io.obj \
$(OBJ_DIR)\mathx.obj \
$(OBJ_DIR)\strasint.obj \
$(OBJ_DIR)\strcount.obj \
@@ -1556,10 +1571,6 @@ $(OBJ_DIR)\html.obj : $(OBJ_DIR)\html.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) -+$@,,
$(OBJ_DIR)\io.obj : $(TOOLS_DIR)\io.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) -+$@,,
$(OBJ_DIR)\mathx.obj : $(TOOLS_DIR)\mathx.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) -+$@,,

View File

@@ -3,7 +3,23 @@
#
#
# Makefile for Harbour project for Microsoft Visual C (32 bits)
# 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
# CLIBFLAGS - Extra C compiler options for the libraries
# HARBOURFLAGS - Extra Harbour compiler options
# HB_GT_LIB - To override the default GT driver
# (search for HB_GT_LIBS for a list)
# DO_HBRUNJAV - Defines this if you want HBRUNJAV.DLL to be built.
# (you must have a JDK installed for this)
#
#
# Notes about this makefile:
#
@@ -330,7 +346,6 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\dates2.obj \
$(OBJ_DIR)\dbftools.obj \
$(OBJ_DIR)\hb_f.obj \
$(OBJ_DIR)\io.obj \
$(OBJ_DIR)\mathx.obj \
$(OBJ_DIR)\strasint.obj \
$(OBJ_DIR)\strcount.obj \
@@ -647,8 +662,9 @@ $(HBRUN_EXE) : \
!ifdef DO_HBRUNJAV
#
# To compile this you must have a JDK installed
# HBRUNJAV.DLL rules (to compile this you must have a JDK installed)
#
$(HBRUNJAV_DLL) : $(HBRUN_DIR)\runjava.c
$(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(HBRUN_DIR)\runjava.c -o $(HBRUNJAV_DLL) /link-dll $(LIBS)
-del $(BIN_DIR)\runjava.exp

View File

@@ -58,8 +58,13 @@
#include <dos.h>
#endif
double hb_fsDiskSpace( USHORT uiDrive, USHORT uiType )
/* NOTE: The second parameter is a Harbour extension, check fileio.ch for
the possible values. */
HB_FUNC( DISKSPACE )
{
USHORT uiDrive = ISNUM( 1 ) ? hb_parni( 1 ) : 0;
USHORT uiType = ISNUM( 2 ) ? hb_parni( 2 ) : HB_DISK_AVAIL;
double dSpace = 0.0;
#if defined(HB_OS_DOS) || defined(__WATCOMC__)
@@ -239,15 +244,6 @@ double hb_fsDiskSpace( USHORT uiDrive, USHORT uiType )
#endif
return dSpace;
}
/* NOTE: The second parameter is a Harbour extension, check fileio.ch for
the possible values. */
HB_FUNC( DISKSPACE )
{
hb_retnlen( hb_fsDiskSpace( ISNUM( 1 ) ? hb_parni( 1 ) : 0,
ISNUM( 2 ) ? hb_parni( 2 ) : HB_DISK_AVAIL ), -1, 0 );
hb_retnlen( dSpace, -1, 0 );
}

View File

@@ -20,7 +20,6 @@ C_SOURCES=\
dates2.c \
dbftools.c \
hb_f.c \
io.c \
mathx.c \
strasint.c \
strcount.c \

View File

@@ -1,37 +0,0 @@
/*
* $Id$
*/
#include "hbapi.h"
#include "hbapifs.h"
HB_FUNC( CD )
{
hb_retni( ISCHAR( 1 ) ? hb_fsChDir( ( BYTE * ) hb_parc( 1 ) ) : 0 );
}
HB_FUNC( MD )
{
hb_retni( ISCHAR( 1 ) ? hb_fsMkDir( ( BYTE * ) hb_parc( 1 ) ) : 0 );
}
HB_FUNC( RD )
{
hb_retni( ISCHAR( 1 ) ? hb_fsRmDir( ( BYTE * ) hb_parc( 1 ) ) : 0 );
}
HB_FUNC( DISKUSED )
{
hb_retnlen( hb_fsDiskSpace( ISNUM( 1 ) ? hb_parni( 1 ) : 0, HB_DISK_USED ), -1, 0 );
}
HB_FUNC( DISKFREE )
{
hb_retnlen( hb_fsDiskSpace( ISNUM( 1 ) ? hb_parni( 1 ) : 0, HB_DISK_FREE ), -1, 0 );
}
HB_FUNC( DISKFULL )
{
hb_retnlen( hb_fsDiskSpace( ISNUM( 1 ) ? hb_parni( 1 ) : 0, HB_DISK_TOTAL ), -1, 0 );
}

View File

@@ -21,6 +21,7 @@
This test program placed in the public domain
*/
#include "fileio.ch"
proc main( cDisk )
if empty( cDisk )
@@ -28,8 +29,9 @@ proc main( cDisk )
Endif
cDisk := Val( cDisk )
? "Bytes available on disk: " + Transform( diskspace(cDisk),"999,999,999,999")
? "Bytes available for use: " + Transform( diskfree(cDisk),"999,999,999,999")
? " Bytes used: " + Transform( diskused(cDisk),"999,999,999,999")
? " Total bytes on disk "+PadL(cDisk,2)+": " + Transform( diskFull(cDisk),"999,999,999,999")
? "Bytes available on disk: " + Transform( diskspace(cDisk, HB_DISK_FREE ),"999,999,999,999")
? "Bytes available for use: " + Transform( diskspace(cDisk, HB_DISK_AVAIL ),"999,999,999,999")
? " Bytes used: " + Transform( diskspace(cDisk, HB_DISK_USED ),"999,999,999,999")
? " Total bytes on disk "+PadL(cDisk,2)+": " + Transform( diskspace(cDisk, HB_DISK_TOTAL ),"999,999,999,999")
return