2007-09-25 04:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/xhb/Makefile
   * contrib/xhb/xhbfunc.c
   + contrib/xhb/xhb.ch
   + contrib/xhb/xhbcomp.prg
     + Added xhb_AScan(), xhb_AIns(), xhb_ADel() plus defines 
       to redirect extended AScan(), AIns(), ADel() calls to these 
       functions. They need to be tested as I'm no xhb user.
     + Added compatibility header, which adds a the above translations 
       and include hbcompat.ch.
     + Added INIT PROC xhb_Init() as a future place for xhb specific 
       startup settings.
     ; TODO:
       - Add $ and [] operator overloading.
       - Add operator overloading for hash type.
       - Add a way hash API call to control the default flag 
         hb_hashNew() uses, then add this default setting to 
         the xhb libs INIT PROC.
     ; For better xhb compatibility, developers should add 
       #ifndef __XHARBOUR__
          #include "xhb.ch"
       #endif
       to every .prg file they use.

   + contrib/xhb/make_b32.bat
   + contrib/xhb/make_vc.bat
   + contrib/xhb/makefile.bc
   + contrib/xhb/makefile.vc
     + Added non-GNU makefiles for xhb lib.

   * include/hbcompat.ch
     + Added xhb compatibility translates for ENDSWITCH end friends.

   * source/rtl/scrollbr.prg
     * Minor formatting.
This commit is contained in:
Viktor Szakats
2007-09-25 02:43:22 +00:00
parent b4e5912a0e
commit d71fa590e7
11 changed files with 584 additions and 20 deletions

View File

@@ -8,6 +8,42 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-09-25 04:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/xhb/Makefile
* contrib/xhb/xhbfunc.c
+ contrib/xhb/xhb.ch
+ contrib/xhb/xhbcomp.prg
+ Added xhb_AScan(), xhb_AIns(), xhb_ADel() plus defines
to redirect extended AScan(), AIns(), ADel() calls to these
functions. They need to be tested as I'm no xhb user.
+ Added compatibility header, which adds a the above translations
and include hbcompat.ch.
+ Added INIT PROC xhb_Init() as a future place for xhb specific
startup settings.
; TODO:
- Add $ and [] operator overloading.
- Add operator overloading for hash type.
- Add a way hash API call to control the default flag
hb_hashNew() uses, then add this default setting to
the xhb libs INIT PROC.
; For better xhb compatibility, developers should add
#ifndef __XHARBOUR__
#include "xhb.ch"
#endif
to every .prg file they use.
+ contrib/xhb/make_b32.bat
+ contrib/xhb/make_vc.bat
+ contrib/xhb/makefile.bc
+ contrib/xhb/makefile.vc
+ Added non-GNU makefiles for xhb lib.
* include/hbcompat.ch
+ Added xhb compatibility translates for ENDSWITCH end friends.
* source/rtl/scrollbr.prg
* Minor formatting.
2007-09-25 03:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbextern.ch
+ harbour/contrib/xhb/xhbextrn.ch

View File

@@ -16,6 +16,7 @@ PRG_SOURCES=\
hblog.prg \
hblognet.prg \
cstruct.prg \
xhbcomp.prg \
PRG_HEADERS=\
hblog.ch \

View File

@@ -0,0 +1,29 @@
@echo off
rem
rem $Id$
rem
if "%1" == "clean" goto CLEAN
if "%1" == "CLEAN" goto CLEAN
:BUILD
make -fmakefile.bc %1 %2 %3 > make_b32.log
if errorlevel 1 goto BUILD_ERR
:BUILD_OK
copy ..\..\lib\b32\xhb.lib ..\..\lib\*.* > nul
goto EXIT
:BUILD_ERR
notepad make_b32.log
goto EXIT
:CLEAN
goto EXIT
:EXIT

View File

@@ -0,0 +1,21 @@
@echo off
rem
rem $Id$
rem
:BUILD
nmake /f makefile.vc %1 %2 %3 > make_vc.log
if errorlevel 1 goto BUILD_ERR
:BUILD_OK
copy ..\..\lib\vc\xhb.lib ..\..\lib\*.* >nul
goto EXIT
:BUILD_ERR
notepad make_vc.log
:EXIT

View File

@@ -0,0 +1,174 @@
#
# $Id$
#
#
# 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
# 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)
#
#
# NOTE: "echo." intentionally used instead of "echo", to avoid conflicts
# with external commands named echo.
#
!if $d(B16)
CC = bcc
AS = tasm
# Borland C/C++ (DOS 16 bits)
CFLAGS = -mh $(CFLAGS)
BIN_DIR = bin\b16
OBJ_DIR = obj\b16
LIB_DIR = lib\b16
!else
CC = bcc32
AS = tasm32
BIN_DIR = ..\..\bin\b32
OBJ_DIR = ..\..\obj\b32
LIB_DIR = ..\..\lib\b32
# This is needed, otherwise the libs may overflow when
# debug info is requested with -v -y
ARFLAGS = /P32
!endif
!if !$d(BCC_NOOPTIM)
CFLAGS = -O2 $(CFLAGS)
!endif
#
# 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.
#
CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGSDEBUG = -v $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w2 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
LDFLAGS = $(LDFLAGS)
#
# Macros to access our library names
#
TOOLS_LIB = $(LIB_DIR)\xhb.lib
HARBOUR_EXE = $(BIN_DIR)\harbour.exe
#
# Rules
#
#
# TOOLS.LIB rules
#
TOOLS_LIB_OBJS = \
$(OBJ_DIR)\hbxml.obj \
$(OBJ_DIR)\hbsyslog.obj \
$(OBJ_DIR)\hboutdbg.obj \
$(OBJ_DIR)\cstructc.obj \
$(OBJ_DIR)\xhbfunc.obj \
$(OBJ_DIR)\txml.obj \
$(OBJ_DIR)\hblog.obj \
$(OBJ_DIR)\hblognet.obj \
$(OBJ_DIR)\cstruct.obj \
$(OBJ_DIR)\xhbcomp.obj \
#
# Our default target
#
all: \
$(TOOLS_LIB) \
#
# Library dependencies and build rules
#
$(TOOLS_LIB) : $(TOOLS_LIB_OBJS)
#
# TOOLS.LIB dependencies
#
$(OBJ_DIR)\hbxml.obj : $(TOOLS_DIR)\hbxml.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hbsyslog.obj : $(TOOLS_DIR)\hbsyslog.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hboutdbg.obj : $(TOOLS_DIR)\hboutdbg.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\cstructc.obj : $(TOOLS_DIR)\cstructc.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\xhbfunc.obj : $(TOOLS_DIR)\xhbfunc.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\txml.c : $(TOOLS_DIR)\txml.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\txml.obj : $(OBJ_DIR)\txml.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hblog.c : $(TOOLS_DIR)\hblog.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\hblog.obj : $(OBJ_DIR)\hblog.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hblognet.c : $(TOOLS_DIR)\hblognet.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\hblognet.obj : $(OBJ_DIR)\hblognet.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\cstruct.c : $(TOOLS_DIR)\cstruct.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\cstruct.obj : $(OBJ_DIR)\cstruct.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\xhbcomp.c : $(TOOLS_DIR)\xhbcomp.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\xhbcomp.obj : $(OBJ_DIR)\xhbcomp.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,

View File

@@ -0,0 +1,154 @@
#
# $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
#
# 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 -w2 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
LDFLAGS = $(LDFLAGS)
#
# Macros to access our library names
#
TOOLS_LIB = $(LIB_DIR)\xhb.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)\hbxml.obj \
$(OBJ_DIR)\hbsyslog.obj \
$(OBJ_DIR)\hboutdbg.obj \
$(OBJ_DIR)\cstructc.obj \
$(OBJ_DIR)\xhbfunc.obj \
$(OBJ_DIR)\txml.obj \
$(OBJ_DIR)\hblog.obj \
$(OBJ_DIR)\hblognet.obj \
$(OBJ_DIR)\cstruct.obj \
$(OBJ_DIR)\xhbcomp.obj \
#
# Our default target
#
all: \
$(TOOLS_LIB)
CLEAN:
-@if exist $(OBJ_DIR)\hbxml.* del $(OBJ_DIR)\hbxml.*
-@if exist $(OBJ_DIR)\hbsyslog.* del $(OBJ_DIR)\hbsyslog.*
-@if exist $(OBJ_DIR)\hboutdbg.* del $(OBJ_DIR)\hboutdbg.*
-@if exist $(OBJ_DIR)\cstructc.* del $(OBJ_DIR)\cstructc.*
-@if exist $(OBJ_DIR)\xhbfunc.* del $(OBJ_DIR)\xhbfunc.*
-@if exist $(OBJ_DIR)\txml.* del $(OBJ_DIR)\txml.*
-@if exist $(OBJ_DIR)\hblog.* del $(OBJ_DIR)\hblog.*
-@if exist $(OBJ_DIR)\hblognet.* del $(OBJ_DIR)\hblognet.*
-@if exist $(OBJ_DIR)\cstruct.* del $(OBJ_DIR)\cstruct.*
-@if exist $(OBJ_DIR)\xhbcomp.* del $(OBJ_DIR)\xhbcomp.*
-@if exist $(TOOLS_LIB) del $(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)

View File

@@ -0,0 +1,63 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Header file for cross-compatibility with xhb
*
* Copyright 1999-2007 {list of individual authors and e-mail addresses}
* 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, or (at your option)
* any later version.
*
* 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef __XHARBOUR__
#include "hbcompat.ch"
REQUEST XHB_LIB
#xtranslate AIns(<a>,<n>,<x>) => xhb_AIns(<a>,<n>,<x>)
#xtranslate ADel(<a>,<n>,<l>) => xhb_ADel(<a>,<n>,<l>)
#xtranslate AScan(<a>,<b>,[<c>],[<d>],<e>) => xhb_AScan(<a>,<b>,<c>,<d>,<e>)
#endif

View File

@@ -0,0 +1,79 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* xhb compatibility functions
*
* Copyright 2007 Viktor Szakats <harbour.01 syenar.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, or (at your option)
* any later version.
*
* 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
ANNOUNCE XHB_LIB
INIT PROCEDURE xhb_Init()
/* Add calls to do initial settings to Harbour to be more compatible with xhb. */
RETURN
FUNCTION xhb_AIns( a, n, x )
AIns( a, n )
IF PCount() > 2
a[ n ] := x
ENDIF
RETURN a
FUNCTION xhb_ADel( a, n, l )
ADel( a, n )
IF PCount() > 2 .AND. ISLOGICAL( l ) .AND. l
ASize( a, Len( a ) - 1 )
ENDIF
RETURN a

View File

@@ -53,6 +53,25 @@
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( XHB_ASCAN )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
PHB_ITEM pValue = hb_param( 2, HB_IT_ANY );
if( pArray && pValue )
{
ULONG ulStart = hb_parnl( 3 );
ULONG ulCount = hb_parnl( 4 );
hb_retnint( hb_arrayScan( pArray, pValue,
ISNUM( 3 ) ? &ulStart : NULL,
ISNUM( 4 ) ? &ulCount : NULL,
hb_parl( 5 ) ) );
}
else
hb_retni( 0 );
}
HB_FUNC_EXTERN( HB_DESERIALIZE );
HB_FUNC( HB_DESERIALBEGIN )

View File

@@ -89,15 +89,13 @@
#xtranslate hb_IniRead([<x,...>]) => hb_ReadIni(<x>)
#xtranslate hb_IniWrite([<x,...>]) => hb_WriteIni(<x>)
#xtranslate HBDebugger() => TDebugger()
#xtranslate HBBrwText() => TBrwText()
#xtranslate HBDbMenu() => TDbMenu()
#xtranslate HBDbMenuItem() => TDbMenuItem()
#xtranslate HBDbWindow() => TDbWindow()
#xtranslate HBDbBrowse() => TDBGBrowser()
#xtranslate HBDbArray() => TDBGArray()
#xtranslate HBDbHash() => TDBGHash()
#xtranslate HBDbObject() => TDBGobject()
/* Some statement endings */
#xcommand ENDSEQUENCE => END
#xcommand ENDSWITCH => END
#xcommand END SWITCH => END
#xcommand ENDWITH => END
#xcommand END WITH => END
#xcommand END OBJECT => END
#else
@@ -135,16 +133,6 @@
#xtranslate hb_ReadIni([<x,...>]) => hb_IniRead(<x>)
#xtranslate hb_WriteIni([<x,...>]) => hb_IniWrite(<x>)
#xtranslate TDebugger() => HBDebugger()
#xtranslate TBrwText() => HBBrwText()
#xtranslate TDbMenu() => HBDbMenu()
#xtranslate TDbMenuItem() => HBDbMenuItem()
#xtranslate TDbWindow() => HBDbWindow()
#xtranslate TDBGBrowser() => HBDbBrowse()
#xtranslate TDBGArray() => HBDbArray()
#xtranslate TDBGHash() => HBDbHash()
#xtranslate TDBGobject() => HBDbObject()
#xtranslate Str(<x>,[<y>],[<y>],<z>)=> iif(<z>, LTrim(Str(<x>)), Str(<x>))
#xtranslate hb_CMDARGARGV([<x,...>])=> hb_ARGV(0)

View File

@@ -461,7 +461,7 @@ METHOD New( nStart, nEnd, nOffset, bSBlock, nOrient ) CLASS SCROLLBAR
RETURN Self
FUNCTION Scrollbar( nStart, nEnd, nOffset, bSBlock, nOrient )
FUNCTION ScrollBar( nStart, nEnd, nOffset, bSBlock, nOrient )
RETURN HBScrollBar():New( nStart, nEnd, nOffset, bSBlock, nOrient )
#endif