Files
harbour-core/harbour/tests/testcom1.prg
Viktor Szakats 953737189d 2013-01-23 17:14 UTC+0100 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg
  * utils/hbmk2/*.po
    + added '-warn=yes' option in sync with warn= .hbc directive
    * cleaned help for -cpp and -cpp= options
    * '-inc' option moved to short help page and clarified a little
    - deprecated several hbmk2 options synonyms. After this
      update, hbmk2 will issue a warning with the recommended
      replacement switch (and exact location where it has
      found it), and these will ultimately disappear with
      HB_LEGACY_LEVEL4 (after next release, or earlier, depending
      on how disrupting it is or how long the new release
      will take):
         -compiler=              -> -comp=
         -platform               -> -plat=
         -mwindows               -> -gui
         -mconsole               -> -std
         -nodebug                -> -debug-
         -nooptim                -> -optim-
         -nomap                  -> -map-
         -noimplib               -> -implib-
         -nobeep                 -> -beep-
         -nominipo               -> -minipo-
         -noinc                  -> -inc-
         -noignore               -> -ignore-
         -nohbcppmm              -> -hbcppmm-
         -nostrip                -> -strip-
         -warn= (value omitted)  -> -warn=yes
         -nowarn                 -> -warn-
         -compr= (value omitted) -> -compr=yes
         -compr=def              -> -compr=yes
         -nocompr                -> -compr-
         -head= (value omitted)  -> -head=full
         -head                   -> -head=full
         -head-                  -> -head=off
         -nohead                 -> -head=off
         -nocpp                  -> -cpp-
         -norun                  -> -run-
         -notrace                -> -trace-
      .hbc directives (no warning for these ones):
         compr=def               -> compr=yes
         <*>=1                   -> <*>=yes
         <*>=0                   -> <*>=no
      Macros (no warning for these ones):
         ${hb_platform}          -> ${hb_plat}
         ${hb_compiler}          -> ${hb_comp}

    ; Update your .hbp/.hbm/.hbc files and hbmk2
      command-line according to above and the new
      warnings. Important to note, that _all_ of the
      required modifications are _backward
      compatible_ with Harbour 3.0.0 and 2.0.0.

  * package/winuni/RELNOTES.txt
    * use -plat= option in examples

  * tests/testcom1.prg
    + made it compatible with unicode/script mode
2013-01-23 16:20:12 +00:00

50 lines
1.5 KiB
Plaintext

/*
* $Id$
*/
#include "hbcom.ch"
PROCEDURE Main( cPortName )
LOCAL cString := "ATE0" + Chr( 13 ) + "ATI3" + Chr( 13 )
LOCAL nTimeOut := 3000 // 3000 miliseconds = 3 sec.
LOCAL nResult
LOCAL nPort := 1
IF ! Empty( cPortName )
hb_comSetDevice( nPort, cPortName )
ENDIF
IF ! hb_comOpen( nPort )
? "Cannot open port:", nPort, hb_comGetDevice( nPort ), ;
"error: " + hb_ntos( hb_comGetError( nPort ) )
ELSE
? "port:", hb_comGetDevice( nPort ), "opened"
IF ! hb_comInit( nPort, 9600, "N", 8, 1 )
? "Cannot initialize port to: 9600:N:8:1", ;
"error: " + hb_ntos( hb_comGetError( nPort ) )
ELSE
nResult := hb_comSend( nPort, cString, hb_BLen( cString ), nTimeOut )
IF nResult != hb_BLen( cString )
? "SEND() failed,", nResult, "bytes sent in", nTimeOut / 1000, ;
"sec., expected:", hb_BLen( cString ), "bytes."
? "error: " + hb_ntos( hb_comGetError( nPort ) )
ELSE
? "SEND() succeeded."
ENDIF
WAIT "Press any key to begin reading..."
cString := Space( 32 )
nTimeOut := 500 // 500 milliseconds = 0.5 sec.
nResult := hb_comRecv( nPort, @cString, hb_BLen( cString ), nTimeOut )
IF nResult == -1
? "RECV() failed,", ;
"error: " + hb_ntos( hb_comGetError( nPort ) )
ELSE
? nResult, "bytes read in", nTimeOut / 1000, "sec."
ENDIF
ENDIF
? "CLOSE:", hb_comClose( nPort )
ENDIF
RETURN