2010-05-27 00:15 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* utils/hbmk2/examples/contribf.hbc
  * contrib/Makefile
  + contrib/hbcomm
  + contrib/hbcomm/Makefile
  + contrib/hbcomm/hbcomm.hbc
  + contrib/hbcomm/hbcomm.prg
  + contrib/hbcomm/hbcomm.hbp
  + contrib/hbcomm/tests
  + contrib/hbcomm/tests/hbmk.hbm
  + contrib/hbcomm/tests/test.prg
    + Added HBCOMM compatibility library. It's based on hbct
      COM functions. Not tested with real port. Also see one
      TOFIX and one INCOMPATIBILITY note inside. The latter
      belongs to INCHR() function which in original HBCOMM
      library will do HVM corruption by overwriting string
      content passed as 3rd parameter. In Harbour 3rd
      parameter needs to be passed by reference.
      Also added fully adapted test code from HARBOUR MINIGUI
      project. Interestingly this code was using the return
      value of INCHR() to get the returned buffer, which was
      in sync with included HBCOMM code. Anyway, hopefully
      this can be finalized based on report from real users.
    ; DISCLAIMER:
        EXPERIMENTAL CODE. USE AT YOUR OWN RISK. NO GUARANTEES.

  + contrib/hbfbird/hbfbird.hbp
  + contrib/hbsms/hbsms.hbp
    + Added early bird experimental .hbp files for contrib
      two projects.

  * utils/hbmk2/hbmk2.prg
    + Added support for ${hb_dirname} macro which returns the
      directory in which the script file is where the macro is
      used.
    ! Fixed so that '-build' option doesn't require a configured
      C compiler.
    + Extended hack for bcc autoconfiguration with 5.8 support,
      adding an extra system header directory to the include
      dir list if it exists. bcc 5.8 appears to be well installed,
      so this is probably not needed for most users.
    + Documented dir casing differences between bcc 5.5 and 5.82.
      This may be important for autoconfiguration hack to work with
      bcc under wine using native hbmk2 build. I'm not even sure
      such scenario is possible at all ;)
This commit is contained in:
Viktor Szakats
2010-05-26 22:17:06 +00:00
parent 67251071d1
commit 2e28cc5df7
12 changed files with 382 additions and 1 deletions

View File

@@ -17,6 +17,52 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-05-27 00:15 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/examples/contribf.hbc
* contrib/Makefile
+ contrib/hbcomm
+ contrib/hbcomm/Makefile
+ contrib/hbcomm/hbcomm.hbc
+ contrib/hbcomm/hbcomm.prg
+ contrib/hbcomm/hbcomm.hbp
+ contrib/hbcomm/tests
+ contrib/hbcomm/tests/hbmk.hbm
+ contrib/hbcomm/tests/test.prg
+ Added HBCOMM compatibility library. It's based on hbct
COM functions. Not tested with real port. Also see one
TOFIX and one INCOMPATIBILITY note inside. The latter
belongs to INCHR() function which in original HBCOMM
library will do HVM corruption by overwriting string
content passed as 3rd parameter. In Harbour 3rd
parameter needs to be passed by reference.
Also added fully adapted test code from HARBOUR MINIGUI
project. Interestingly this code was using the return
value of INCHR() to get the returned buffer, which was
in sync with included HBCOMM code. Anyway, hopefully
this can be finalized based on report from real users.
; DISCLAIMER:
EXPERIMENTAL CODE. USE AT YOUR OWN RISK. NO GUARANTEES.
+ contrib/hbfbird/hbfbird.hbp
+ contrib/hbsms/hbsms.hbp
+ Added early bird experimental .hbp files for contrib
two projects.
* utils/hbmk2/hbmk2.prg
+ Added support for ${hb_dirname} macro which returns the
directory in which the script file is where the macro is
used.
! Fixed so that '-build' option doesn't require a configured
C compiler.
+ Extended hack for bcc autoconfiguration with 5.8 support,
adding an extra system header directory to the include
dir list if it exists. bcc 5.8 appears to be well installed,
so this is probably not needed for most users.
+ Documented dir casing differences between bcc 5.5 and 5.82.
This may be important for autoconfiguration hack to work with
bcc under wine using native hbmk2 build. I'm not even sure
such scenario is possible at all ;)
2010-05-26 22:54 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/hbwinole.h
* harbour/contrib/hbwin/olecore.c

View File

@@ -11,6 +11,7 @@ DIRS := \
hbbtree \
hbbz2 \
hbclipsm \
hbcomm \
hbct \
hbfoxpro \
hbfship \

View File

@@ -0,0 +1,14 @@
#
# $Id$
#
ROOT := ../../
include $(TOP)$(ROOT)config/global.mk
LIBNAME := hbcomm
PRG_SOURCES := \
hbcomm.prg \
include $(TOP)$(ROOT)config/lib.mk

View File

@@ -0,0 +1,9 @@
#
# $Id$
#
incpaths=.
libs=hbcomm
libs=../hbct/hbct.hbc

View File

@@ -0,0 +1,10 @@
#
# $Id$
#
-hblib
-inc
-o${hb_name}
hbcomm.prg

View File

@@ -0,0 +1,161 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* HBCOMM compatibility library. EXPERIMENTAL CODE. USE AT YOUR OWN RISK. NO GUARANTEES.
*
* Copyright 2010 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"
STATIC s_hPort := { => }
STATIC s_hbcomm_mutex := hb_mutexCreate()
FUNCTION INIT_PORT( cPort, nBaud, nData, nParity, nStop, nBufferSize )
LOCAL nPort
LOCAL cOldPortName
LOCAL cParity
hb_mutexLock( s_hbcomm_mutex )
/* TOFIX: We should get that number from core to avoid
getting mixed up with com port access outside this
compatibility interface. [vszakats] */
nPort := Len( s_hPort ) + 1
IF ISCHARACTER( cPort )
cOldPortName := com_DevName( nPort, cPort )
ENDIF
IF com_Open( nPort )
IF ! ISNUMBER( nBaud )
nBaud := 9600
ENDIF
cParity := "N"
IF ISNUMBER( nParity )
SWITCH nParity
CASE 0 ; cParity := "N" ; EXIT
CASE 1 ; cParity := "O" ; EXIT
CASE 2 ; cParity := "M" ; EXIT
CASE 3 ; cParity := "E" ; EXIT
ENDSWITCH
ENDIF
IF ! ISNUMBER( nStop )
nStop := 1
ENDIF
HB_SYMBOL_UNUSED( nBufferSize )
IF com_Init( nPort, nBaud, cParity, nData, nStop )
s_hPort[ nPort ] := cOldPortName
hb_mutexUnLock( s_hbcomm_mutex )
RETURN nPort
ELSE
com_Close( nPort )
ENDIF
ENDIF
IF cOldPortName != NIL
com_DevName( nPort, cOldPortName )
ENDIF
hb_mutexUnLock( s_hbcomm_mutex )
RETURN 0
/* Purge output buffer */
FUNCTION OUTBUFCLR( nPort )
RETURN com_sflush( nPort )
/* See if port is opened correctly */
FUNCTION ISWORKING( nPort )
RETURN nPort $ s_hPort
/* NOTE: INCOMPATIBILITY.
In contratry to original HBCOMM, here <cString> must be passed by reference.
HBCOMM could corrupt HVM because of it's buggy way of returning data.
[vszakats] */
/* Fetch <nCount> chars into <cString> */
FUNCTION INCHR( nPort, nCount, /* @ */ cString )
cString := com_read( nPort, nCount )
RETURN Len( cString )
/* Send out characters. Returns .t. if successful. */
FUNCTION OUTCHR( nPort, cString )
RETURN com_send( nPort, cString )
/* Find out how many chars are in input buffer */
FUNCTION INBUFSIZE( nPort )
RETURN com_count( nPort )
/* Find out how many characters are in out buf? */
FUNCTION OUTBUFSIZE( nPort )
RETURN com_scount( nPort )
/* Close port and clear handle */
FUNCTION UNINT_PORT( nPort )
LOCAL lRetVal := .F.
hb_mutexLock( s_hbcomm_mutex )
IF nPort $ s_hPort
IF com_Close( nPort )
/* Restore com port name */
IF s_hPort[ nPort ] != NIL
com_DevName( nPort, s_hPort[ nPort ] )
ENDIF
hb_HDel( s_hPort, nPort )
lRetVal := .T.
ENDIF
ENDIF
hb_mutexUnLock( s_hbcomm_mutex )
RETURN lRetVal

View File

@@ -0,0 +1,7 @@
#
# $Id$
#
../hbcomm.hbc
-w3 -es2

View File

@@ -0,0 +1,94 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* (fixed, adapted to CLI, translated, formatted)
* Copyright 2006 Marcelo Torres <lichitorres@yahoo.com.ar>
* www - http://www.harbour-project.org
*
*/
STATIC s_nHandle
STATIC s_lConnected := .F.
PROCEDURE Main()
LOCAL nOption
DO WHILE .T.
? ""
? "Select test:"
? "O) Open"
? "C) Close"
? "S) Send"
? "R) Receive"
? "Q) Quit"
? "> "
nOption := Inkey( 0 )
?? Chr( nOption )
SWITCH Upper( Chr( nOption ) )
CASE "O" ; FConnect() ; EXIT
CASE "C" ; FDisconnect() ; EXIT
CASE "S" ; FSend() ; EXIT
CASE "R" ; FReceive() ; EXIT
CASE "Q" ; RETURN
ENDSWITCH
ENDDO
RETURN
STATIC PROCEDURE FConnect()
LOCAL cCom := "COM1"
LOCAL nBaudeRate := 19200
LOCAL nDatabits := 8
LOCAL nParity := 0 /* none */
LOCAL nStopbit := 1
LOCAL nBuff := 8000
s_nHandle := INIT_PORT( cCom, nBaudeRate, nDatabits, nParity, nStopbit, nBuff )
IF s_nHandle > 0
? "Connecting..."
s_lConnected := .T.
OUTBUFCLR( s_nHandle )
ELSE
? "Could not open connection"
s_lConnected := .F.
ENDIF
RETURN
STATIC PROCEDURE FDisconnect()
s_lConnected := .F.
UNINT_PORT( s_nHandle )
RETURN
STATIC PROCEDURE FSend()
LOCAL cToSend
ACCEPT "Enter string to send: " TO cToSend
IF s_lConnected .AND. ! Empty( cToSend ) .AND. ISWORKING( s_nHandle )
OUTCHR( s_nHandle, cToSend )
ELSE
? "Cannot send data"
ENDIF
RETURN
STATIC PROCEDURE FReceive()
LOCAL cReceive
LOCAL nSize
nSize := INBUFSIZE( s_nHandle )
IF nSize > 0
INCHR( s_nHandle, nSize, @cReceive )
? ">>", Left( cReceive, nSize )
ENDIF
RETURN

View File

@@ -0,0 +1,20 @@
#
# $Id$
#
-hblib
-inc
-o${hb_dirname}
firebird.c
tfirebrd.prg
-stop{pocc64|poccarm}
-reqheader=ibase.h
-inctrypath=${HB_WITH_FIREBIRD}
-inctrypath=/usr/include
-inctrypath=/opt/firebird/include
-inctrypath=/Library/Frameworks/Firebird.framework/Headers

View File

@@ -0,0 +1,10 @@
#
# $Id$
#
-hblib
-inc
-o${hb_dirname}
hbsms.prg

View File

@@ -6,7 +6,7 @@
# [ This should be kept in sync with local Makefile information. ]
# contribs portable, with no external dependencies:
libs=hbblink hbbtree hbclipsm hbct hbfoxpro hbfship hbgt hbmisc hbmzip minizip hbnf hbsms hbtpathy hbxpp hbziparc rddbmcdx rddsql xhb
libs=hbblink hbbtree hbclipsm hbcomm hbct hbfoxpro hbfship hbgt hbmisc hbmzip minizip hbnf hbsms hbtpathy hbxpp hbziparc rddbmcdx rddsql xhb
# contribs portable, with external dependencies:
libs=hbcurl hbfbird hbgd hbhpdf hbmysql hbpgsql hbqt hbtip sddfb sddmy sddpg

View File

@@ -895,6 +895,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
CASE Left( cParamL, 10 ) == "-platform=" ; ParseCOMPPLAT( hbmk, SubStr( cParam, 11 ), _TARG_PLAT )
CASE Left( cParamL, 6 ) == "-arch=" ; ParseCOMPPLAT( hbmk, SubStr( cParam, 7 ), _TARG_PLAT ) /* Compatibility */
CASE Left( cParamL, 7 ) == "-build=" ; hbmk[ _HBMK_cBUILD ] := SubStr( cParam, 8 )
CASE Left( cParamL, 6 ) == "-build" ; lStopAfterHarbour := .T.
CASE Left( cParamL, 6 ) == "-lang=" ; hbmk[ _HBMK_cUILNG ] := SubStr( cParam, 7 ) ; SetUILang( hbmk )
CASE Left( cParamL, 7 ) == "-width="
@@ -1464,8 +1465,14 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
/* NOTE: Automatically configure bcc installation with missing configuration. [vszakats] */
IF ! hb_FileExists( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Bin" + hb_osPathSeparator() + "bcc32.cfg" ) .OR. ;
! hb_FileExists( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Bin" + hb_osPathSeparator() + "ilink32.cfg" )
/* NOTE: BCC 5.8 has different casing: 'include', 'lib', 'psdk' respectively. */
AAdd( hbmk[ _HBMK_aINCPATH ], PathNormalize( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Include" ) )
AAdd( hbmk[ _HBMK_aLIBPATH ], PathNormalize( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Lib" ) )
/* NOTE: BCC 5.8 (and upper ?) thing */
tmp := PathNormalize( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Include" + hb_osPathSeparator() + "dinkumware" )
IF hb_DirExists( tmp )
AAdd( hbmk[ _HBMK_aINCPATH ], tmp )
ENDIF
ENDIF
AAdd( hbmk[ _HBMK_aLIBPATH ], PathNormalize( FN_DirGet( cPath_CompC ) + ".." + hb_osPathSeparator() + "Lib" + hb_osPathSeparator() + "PSDK" ) )
ENDIF
@@ -7474,6 +7481,8 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, cMacroPrefix )
cMacro := PathSepToSelf( DirAddPathSep( hb_DirBase() ) ) ; EXIT
CASE "HB_DIR"
cMacro := PathSepToSelf( FN_DirGet( cFileName ) ) ; EXIT
CASE "HB_DIRNAME"
cMacro := FN_NameGet( DirDelPathSep( PathSepToSelf( FN_DirGet( cFileName ) ) ) ) ; EXIT
CASE "HB_NAME"
cMacro := PathSepToSelf( FN_NameGet( cFileName ) ) ; EXIT
CASE "HB_CURDIR"