[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Implement this Harbour module: Header file for contribution module 'hbfoxpro' (FoxPro file format support): contrib/hbfoxpro/hbfoxpro.ch. Defines constants: HBFOXPRO_CH_. Declares 5 preprocessor commands. Declares 5 preprocessor translations. Defines Harbour internal constants and macros

[Assistant]
#ifndef HBFOXPRO_CH_
#define HBFOXPRO_CH_

#xtranslate .<!msg!> => :<msg>
#translate THIS. => Self:

#xtranslate .NULL. => NIL

#xtranslate __FP_DIM( <exp> ) => <exp>
#xtranslate __FP_DIM( <!name!>( <dim,...> ) ) => <name>\[ <dim> \]

#command PUBLIC <var1> [, <varN> ] => ;
         <@> PUBLIC __FP_DIM( <var1> ) [, __FP_DIM( <varN> ) ]
#command PRIVATE <var1> [, <varN> ] => ;
         <@> PRIVATE __FP_DIM( <var1> ) [, __FP_DIM( <varN> ) ]
#command DIMENSIONS <!name1!>( <dim1,...> ) [, <!nameN!>( <dimN,...> ) ] => ;
         PRIVATE <name1>\[ <dim1> \] [, <nameN>\[ <dimN> \] ]

#translate FIELD-><!name!> => _FIELD-><name>

#command DISPLAY [FIELDS <v,...>] [<off:OFF>] ;
                 [<prn:TO PRINTER>] [TO FILE <(f)>] ;
                 [FOR <for>] [WHILE <while>] [NEXT <next>] ;
                 [RECORD <rec>] [<rest:REST>] [<all:ALL>] => ;
         __dbList( <.off.>, { <{v}> }, <.all.>, ;
                   <{for}>, <{while}>, <next>, ;
                   <rec>, <.rest.>, <.prn.>, <(f)> )

#command SEEK <exp> [<soft: SOFTSEEK>] [<last: LAST>] ;
              [TAG <tag>] [IN <wa>] => ;
         __fox_Seek( <exp>, iif( <.soft.>, .T., NIL ), ;
                            iif( <.last.>, .T., NIL ), ;
                     <(wa)>, <(tag)> )
#command SET FILTER TO <exp> IN <wa> [NOOPTIMIZE] => ;
                                 <wa>->( dbSetFilter( <{exp}>, <"exp"> ) )
#command SKIP [<n>] IN <wa>   => <wa>->( dbSkip( <n> ) )
#command UNLOCK IN <wa>       => <wa>->( dbUnlock() )
#command GO TOP IN <wa>       => <wa>->( dbGoTop() )
#command GO BOTTOM IN <wa>    => <wa>->( dbGoBottom() )
#command GOTO <nRec> IN <wa>  => <wa>->( dbGoto( <nRec> ) )

#xtranslate SEEK( <x>, <wa> ) => (<wa>)->( dbSeek( <x> ) )
#xtranslate RECCOUNT( <wa> )  => (<wa>)->( RecCount() )
#xtranslate RECSIZE( <wa> )   => (<wa>)->( RecSize() )
#xtranslate FCOUNT( <wa> )    => (<wa>)->( FCount() )
#xtranslate RECNO( <wa> )     => (<wa>)->( RecNo() )
#xtranslate RLOCK( <wa> )     => (<wa>)->( RLock() )

#xtranslate USED( <wa> )    => __fox_Used( <wa> )

#xtranslate At( <sub>, <str>, <occur> )   => fox_At( <sub>, <str>, <occur> )

#command SCAN [FOR <for>] [WHILE <while>] [NEXT <next>] ;
              [RECORD <rec>] [<rest:REST>] [ALL] [NOOPTIMIZE] => ;
         __dbLocate( <{for}>, <{while}>, <next>, <rec>, <.rest.> ) ;;
         WHILE Found()
#command ENDSCAN => __dbContinue(); ENDDO

#command EJECT PAGE => __Eject()
#command FLUSH      => dbCommitAll()
#command REGIONAL [<defs,...>] => LOCAL <defs>
#command CD <(path)> => hb_cwd( <(path)> )

#endif


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour test program: tests/define.prg. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#ifndef TEST
#warning Warning: This sample must be tested using /dTEST compiler flag
#endif

#define FIRST
#define SECOND
#define THIRD

PROCEDURE Main()

   ? "testing Harbour /d compiler flag"

   #ifdef TEST
      ? "Fine, you have just tested the /d compiler flag"
   #else
      ? "Please use /dTEST compiler flag"
      ? "Or run 'set HB_USER_PRGFLAGS=/dTEST' if you are using the GNU Make System"
   #endif

   #ifdef FIRST
      ? "FIRST is defined"

      #ifdef SECOND
         ? "FIRST and SECOND are defined"

         #ifdef THIRD
            ? "FIRST, SECOND and THIRD are defined"
         #else
            ? "THIRD is not defined"
         #endif

      #else
         ? "SECOND is not defined"
      #endif

   #else
      ? "FIRST is not defined"
   #endif

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour test program: tests/ains.prg. Contains procedures: Main, aDump. This test file tests specific function APIs

[Assistant]
#ifndef __HARBOUR__
#include "clipper.ch"
#endif

PROCEDURE Main()

   LOCAL aFirst
   LOCAL aSecond
   LOCAL aMore

   aFirst := AClone( { 1, 2, 4 } )
   AIns( aFirst, 3 )
   aFirst[ 3 ] := "3"
   ?? "Testing AIns() ... "
   aDump( aFirst )

   aSecond := { 1, 2, 4 }
   ASize( aSecond, 4 )
   ?? "Testing ASize() ... "
   aDump( aSecond )

   aSecond := { 1, 2, 4 }
   ASize( aSecond, 4 )
   AIns( aSecond, 3 )
   aSecond[ 3 ] := "3"
   ?? "Testing ASize() + AIns() ... "
   aDump( aSecond )

   aSecond := { 1, 2, 3, 3, 4, 5 }
   ADel( aSecond, 3 )
   ?? "Testing ADel() ... "
   aDump( aSecond )

   aSecond := { 1, 2, 3, 3, 4, 5 }
   ADel( aSecond, 3 )
   ASize( aSecond, Len( aSecond ) - 1 )
   ?? "Testing ASize() + ADel() ... "
   aDump( aSecond )

   AFill( aSecond, "!" )
   ?? "Testing AFill() ... "
   aDump( aSecond )

   aMore := { 1, 2, 3, 4, 5, 6 }
   AFill( aMore, "X", 3 )
   ?? "Testing AFill() with start ... "
   aDump( aMore )

   aMore := { 1, 2, 3, 4, 5, 6 }
   AFill( aMore, "X", 3, 2 )
   ?? "Testing AFill() with start and count ... "
   aDump( aMore )

   aMore := { { 1, 2 }, { 3, 4 } }
   ADel( aMore, 1 )
   aDump( aMore )

   RETURN

PROCEDURE aDump( aShow )

   LOCAL n

   ?? "Len=", hb_ntos( Len( aShow ) )
   ?? ": "
   FOR n := 1 TO Len( aShow )

      ?? "["
      ?? hb_ntos( n )
      ?? "]= "
      ?? ValType( aShow[ n ] )
      ?? ":"
      IF HB_ISARRAY( aShow[ n ] )
         ?
         ?? "["
         aDump( aShow[ n ] )
         ?? "]"
      ELSE
         ?? iif( HB_ISNUMERIC( aShow[ n ] ), hb_ntos( aShow[ n ] ), aShow[ n ] )
      ENDIF

      IF n != Len( aShow )
         ?? ", "
      ENDIF

   NEXT
   ?

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour contribution module 'hbct' (CA-Tools compatibility library): contrib/hbct/tempfile.prg. Provides functions: TempFile. This file provides legacy compatibility functions

[Assistant]
#include "fileio.ch"

FUNCTION TempFile( cDir, cExt, nAttr )

   LOCAL cName
   LOCAL fhnd

   IF HB_ISSTRING( cDir )
      cDir := hb_DirSepAdd( cDir )
   ENDIF

   IF HB_ISSTRING( cExt ) .AND. !( Left( cExt, 1 ) == "." )
      cExt := "." + cExt
   ENDIF

   hb_default( @nAttr, SetFCreate() )

   fhnd := hb_FTempCreateEx( @cName, cDir,, cExt, nAttr )

   IF fhnd != F_ERROR
      FClose( fhnd )
      RETURN cName
   ENDIF

   RETURN ""


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Define Harbour macros and constants: Harbour test program: tests/gtstd.prg. Provides functions: PosNow. Contains procedures: Main. This test file exercises basic Harbour language features

[Assistant]
#ifndef __HARBOUR__
#define hb_ntos( n ) LTrim( Str( n ) )
#endif

PROCEDURE Main()

   LOCAL n

   PosNow()
   ?? "Output test. First line, no newlines."

   ? "Press a key to continue: "
   ?? Inkey( 0 )

   ? "This is row " + hb_ntos( Row() )

   @ 7, 30 SAY "@ 7, 30"
   @ 7, 10 SAY "@ 7, 10"
   @ 7, 60 SAY "@ 7, 60"
   @ 7, 75 SAY "9876543210"
   @ 6, 10 SAY "@ 6, 10.."
   PosNow()

   ?
   ? "Scroll test: pre = "
   PosNow()

   ?? " post = "
   PosNow()

   ?
   ? "Press key to test CLS"
   Inkey( 0 )
   CLS

   PosNow()

   ?
   ? "Press key to test FOR n := 100 TO 120; Tone( n, 1 ); NEXT"
   Inkey( 0 )
   FOR n := 100 TO 120
      Tone( n, 1 )
   NEXT

   ? "Done.."
   ? "Testing long string via QOUT. 50 characters follow here: 98765432109876543210987654321098765432109876543210"
   ? "Done.. testing end of screen scroll"

   FOR n := 1 TO 25
      ? "This line is on row "
      ?? hb_ntos( Row() )
      Inkey( 0 )
   NEXT

   RETURN

FUNCTION PosNow()

   ?? "[" + hb_ntos( Row() ) + "," + hb_ntos( Col() ) + "]"

   RETURN NIL


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Define Harbour macros and constants: Harbour contribution module 'hbnf' (NanForum Toolkit - legacy Clipper compatibility functions): contrib/hbnf/popadder.prg. Provides functions: ft_Adder, _ftAddScreen. This file provides legacy compatibility functions

[Assistant]
#include "box.ch"
#include "inkey.ch"
#include "setcurs.ch"
#include "achoice.ch"

#define W_BORDER 1
#define W_ACCENT 2
#define W_PROMPT 3
#define W_SCREEN 4
#define W_TITLE  5
#define W_VARIAB 6
#define W_CURR   NIL

#define STD_ACCENT   1
#define STD_ERROR    2
#define STD_PROMPT   3
#define STD_SCREEN   4
#define STD_TITLE    5
#define STD_VARIABLE 6
#define STD_BORDER   7

#define FT_B_DOUBLE  HB_B_DOUBLE_UNI + " "
#define FT_B_SINGLE  HB_B_SINGLE_UNI + " "

#define nTotal     aAdder[ 1 ]
#define nNumTotal  aAdder[ 2 ]
#define nSavTotal  aAdder[ 3 ]
#define cTotPict   aAdder[ 4 ]
#define lClAdder   aAdder[ 5 ]
#define lDecSet    aAdder[ 6 ]
#define nDecDigit  aAdder[ 7 ]
#define nMaxDeci   aAdder[ 8 ]
#define lMultDiv   aAdder[ 9 ]
#define nAddMode   aAdder[ 10 ]
#define lSubRtn    aAdder[ 11 ]
#define lTotalOk   aAdder[ 12 ]
#define lAddError  aAdder[ 13 ]
#define lTape      aAdder[ 14 ]
#define lNewNum    aAdder[ 15 ]
#define nSavSubTot aAdder[ 16 ]
#define lDivError  aAdder[ 17 ]
#define aTrans     aAdder[ 18 ]
#define nTopOS     aAdder[ 19 ]
#define nLeftOS    aAdder[ 20 ]
#define nAddSpace  aAdder[ 21 ]
#define nTapeSpace aAdder[ 22 ]
#define cTapeScr   aAdder[ 23 ]

THREAD STATIC t_lAdderOpen := .F.
THREAD STATIC t_aKeys
THREAD STATIC t_aWindow
THREAD STATIC t_nWinColor
THREAD STATIC t_aWinColor
THREAD STATIC t_aStdColor

FUNCTION ft_Adder()

   LOCAL nOldDecim, cMoveTotSubTot, cTotal, lDone, nKey
   LOCAL oGet        := GetActive()
   LOCAL nOldCurs    := SetCursor( SC_NONE )
   LOCAL nOldRow     := Row()
   LOCAL nOldCol     := Col()
   LOCAL bOldF10     := SetKey( K_F10, NIL )
   LOCAL nOldLastKey := LastKey()
   LOCAL lShowRight  := .T.
   LOCAL aAdder      := Array( 23 )
   LOCAL tmp, tmp1

   LOCAL lAC_exit_ok

   IF t_lAdderOpen
      RETURN NIL
   ELSE
      t_lAdderOpen := .T.
   ENDIF

   aTrans       := { "                  0.00 C " }
   nOldDecim    := Set( _SET_DECIMALS, 9 )
   cTotPict     := "999999999999999.99"
   cTapeScr     := ""
   nTotal       := nNumTotal := nSavTotal := nDecDigit := 0
   lDone        := .F.
   nMaxDeci     := 2
   nSavSubTot   := 0
   lNewNum      := .F.
   nAddMode     := 1
   lMultDiv     := .F.
   lClAdder     := .F.
   lDecSet      := .F.
   lSubRtn      := lTotalOk := lTape := lAddError := lDivError := .F.

   nTopOS       := Int( ( MaxRow() - 24 ) / 2 )
   nLeftOS      := Int( ( MaxCol() - 79 ) / 2 )
   nAddSpace    := iif( lShowRight, 40, 0 ) + nLeftOS
   nTapeSpace   := iif( lShowRight, 0, 40 ) + nLeftOS

   t_aKeys      := {}
   t_aWindow    := {}
   t_nWinColor  := 0

   _ftAddScreen( aAdder )

   _ftChangeDec( aAdder, 2 )
   hb_DispOutAt( 4 + nTopOS, 7 + nAddSpace, Transform( nTotal, cTotPict ) )

   DO WHILE ! lDone
      nKey := _ftInkey( 0, "nKey" )
      DO CASE
      CASE hb_keyChar( nKey ) $ "1234567890."
         _ftProcessNumb( aAdder, nKey )
      CASE nKey == hb_keyCode( "+" )
         _ftAddSub( aAdder, nKey )
      CASE nKey == hb_keyCode( "-" )
         _ftAddSub( aAdder, nKey )
      CASE nKey == hb_keyCode( "*" )
         _ftMultDiv( aAdder, nKey )
      CASE nKey == hb_keyCode( "/" )
         _ftMultDiv( aAdder, nKey )
      CASE nKey == K_ENTER
         _ftAddTotal( aAdder )
      CASE nKey == K_ESC
         Set( _SET_DECIMALS, nOldDecim )
         SetCursor( nOldCurs )
         IF lTape
            RestScreen( 4 + nTopOS, 6 + nTapeSpace, 22 + nTopOS, 35 + nTapeSpace, cTapeScr )
         ENDIF
         _ftPopWin()
         SetPos( nOldRow, nOldCol )
         _ftSetLastKey( nOldLastKey )
         SetKey( K_F10, bOldF10 )
         t_lAdderOpen := .F.
         lDone      := .T.
      CASE nKey == hb_keyCode( "D" ) .OR. nKey == hb_keyCode( "d" )
         _ftChangeDec( aAdder )
      CASE nKey == hb_keyCode( "T" ) .OR. nKey == hb_keyCode( "t" )
         _ftDisplayTape( aAdder, nKey )
      CASE nKey == hb_keyCode( "M" ) .OR. nKey == hb_keyCode( "m" )
         IF lTape
            RestScreen( 4 + nTopOS, 6 + nTapeSpace, 22 + nTopOS, 35 + nTapeSpace, cTapeScr )
         ENDIF
         IF !( __XSaveGetChar( SaveScreen( 6 + nTopOS, 26 + nAddSpace, 6 + nTopOS, 27 + nAddSpace ), 0 ) == " " )
            IF __XSaveGetChar( SaveScreen( 6 + nTopOS, 19 + nAddSpace, 6 + nTopOS, 20 + nAddSpace ), 0 ) == "S"
               cMoveTotSubTot := "S"
            ELSE
               cMoveTotSubTot := "T"
            ENDIF
         ELSE
            cMoveTotSubTot := " "
         ENDIF
         tmp := SaveScreen( 4 + nTopOS, 8 + nAddSpace, 4 + nTopOS, 25 + nAddSpace )
         cTotal := ""
         FOR tmp1 := 0 TO 16
            cTotal += __XSaveGetChar( tmp, tmp1 )
         NEXT
         _ftPopWin()
         lShowRight := ! lShowRight
         nAddSpace  := iif( lShowRight, 40, 0 ) + nLeftOS
         nTapeSpace := iif( lShowRight, 0, 40 ) + nLeftOS
         _ftAddScreen( aAdder )
         _ftDispTotal( aAdder )
         IF lTape
            lTape := .F.
            _ftDisplayTape( aAdder, nKey )
         ENDIF
         hb_DispOutAt( 4 + nTopOS, 8 + nAddSpace, cTotal )
         IF ! Empty( cMoveTotSubTot )
            _ftSetWinColor( W_CURR, W_SCREEN )
            hb_DispOutAt( 6 + nTopOS, 18 + nAddSpace, iif( cMoveTotSubTot == "T", "   <TOTAL>", ;
               "<SUBTOTAL>" ) )
            _ftSetWinColor( W_CURR, W_PROMPT )
         ENDIF
      CASE ( nKey == hb_keyCode( "S" ) .OR. nKey == hb_keyCode( "s" ) ) .AND. lTape
         IF Len( aTrans ) > 16
            SetColor( "GR+/W" )
            hb_DispOutAt( 21 + nTopOS, 8 + nTapeSpace, " " +  Chr( 24 ) + Chr( 25 ) + "-SCROLL  <ESC>-QUIT " )
            SetColor( "N/W,W+/N" )
            lAC_exit_ok := .F.
            AChoice( 5 + nTopOS, 7 + nTapeSpace, 20 + nTopOS, 32 + nTapeSpace, aTrans, .T., ;
               {| nMode, cur_elem, rel_pos | _ftAdderTapeUDF( nMode, cur_elem, rel_pos, @lAC_exit_ok ) }, Len( aTrans ), 20 )
            SetColor( "R+/W" )
            hb_DispBox( 21 + nTopOS, 8 + nTapeSpace, 21 + nTopOS, 30 + nTapeSpace, HB_B_SINGLE_UNI )
            _ftSetWinColor( W_CURR, W_PROMPT )
            CLEAR TYPEAHEAD
         ELSE
            _ftError( "there are " + iif( Len( aTrans ) > 0, "only " + ;
               hb_ntos( Len( aTrans ) ), "no" ) + ;
               " transactions entered so far." + ;
               " No need to scroll!" )
         ENDIF
      CASE nKey == K_DEL
         _ftClearAdder( aAdder )
      CASE nKey == K_F1
         _ftAddHelp()
      CASE nKey == K_F10
         IF lTotalOk
            IF oGet != NIL .AND. oGet:type == "N"
               Set( _SET_DECIMALS, nOldDecim )
               SetCursor( nOldCurs )
               IF lTape
                  RestScreen( 4 + nTopOS, 6 + nTapeSpace, 22 + nTopOS, 35 + nTapeSpace, cTapeScr )
               ENDIF
               _ftPopWin()
               SetPos( nOldRow, nOldCol )
               _ftSetLastKey( nOldLastKey )
               SetKey( K_F10, bOldF10 )
               oGet:VARPUT( nSavTotal )
               t_lAdderOpen := .F.
               lDone        := .T.
            ELSE
               _ftError( "but I can not return the total from the " + ;
                  "adder to this variable. You must quit the adder using" + ;
                  " the <ESC> key and then enter the total manually." )
            ENDIF
         ELSE
            _ftError( "the calculation is not finished yet! You must have" + ;
               " a TOTAL before you can return it to the program." )
         ENDIF
      ENDCASE
   ENDDO

   t_aKeys := t_aWindow := t_aWinColor := t_aStdColor := NIL

   RETURN NIL

STATIC FUNCTION _ftAddScreen( aAdder )

   LOCAL nCol


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour test program: tests/commouse.prg. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#include "hbcom.ch"

PROCEDURE Main( cParam )

   LOCAL nPort, cBuf, cBuffer, nLen, nType, lL, lM, lR, nX, nY

   IF cParam == NIL
      ? "Usage: commouse [ nPort | cDevice ]"
      RETURN
   ENDIF

   nPort := Val( cParam )
   IF nPort == 0
      ? "Using device:", cParam
      nPort := 1
      hb_comSetDevice( nPort, cParam )
   ELSE
      ? "Using port number:", nPort
   ENDIF

   IF ! hb_comOpen( nPort )
      ? "Unable to open port. Error:", hb_comGetError( nPort ), " OS error:", hb_comGetOSError( nPort )
      RETURN
   ENDIF

   IF ! hb_comInit( nPort, 1200, "N", 8, 1 )
      ? "Unable to initialize port. Error:", hb_comGetError( nPort ), " OS error:", hb_comGetOSError( nPort )
      hb_comClose( nPort )
      RETURN
   ENDIF

   hb_comMCR( nPort, , HB_COM_MCR_DTR + HB_COM_MCR_RTS )
   hb_idleSleep( 0.1 )
   hb_comFlush( nPort )
   hb_comMCR( nPort, , , HB_COM_MCR_DTR + HB_COM_MCR_RTS )

   cBuf := Space( 256 )
   IF ( nLen := hb_comRecv( nPort, @cBuf,, 500 ) ) > 0
      IF hb_BCode( cBuf ) == 0xCD
         ? "Bingo: 2 button mouse detected!"
         nType := 2
         cBuffer := hb_BSubStr( cBuf, 2, nLen - 1 )
      ELSE
         cBuffer := hb_BLeft( cBuf, nLen )
      ENDIF
   ELSE
      cBuffer := ""
   ENDIF

   IF nType == NIL
      ? "Mouse not detected, assuming 3 button mouse"
      nType := 3
   ENDIF

   ? "Press any key to exit..."
   DO WHILE ( nLen := Inkey() ) == 0
      IF ( nLen := hb_comRecv( nPort, @cBuf ) ) > 0
         cBuffer += hb_BLeft( cBuf, nLen )
      ENDIF
      IF hb_BLen( cBuffer ) == 0
         hb_idleSleep( 0.05 )
         LOOP
      ENDIF
      IF nType == 2
         IF hb_bitAnd( hb_BCode( cBuffer ), 0xC0 ) != 0xC0
            cBuffer := hb_BSubStr( cBuffer, 2 )
         ELSEIF hb_BLen( cBuffer ) >= 3
            lR := hb_bitAnd( hb_BCode( cBuffer ), 0x10 ) != 0
            lL := hb_bitAnd( hb_BCode( cBuffer ), 0x20 ) != 0
            nX := hb_bitAnd( hb_BCode( cBuffer ), 3 )
            ? "dX,dY:", Str( nX, 4 ), Str( nY, 4 ), "   "
            IF lL
               ?? "LEFT "
            ENDIF
            IF lR
               ?? "RIGHT"
            ENDIF
            cBuffer := hb_BSubStr( cBuffer, 4 )
         ENDIF
      ELSEIF nType == 3
         IF hb_bitAnd( hb_BCode( cBuffer ), 0xC0 ) != 0x80
            cBuffer := hb_BSubStr( cBuffer, 2 )
         ELSEIF hb_BLen( cBuffer ) >= 4
            lR := hb_bitAnd( hb_BCode( cBuffer ), 1 ) == 0
            lM := hb_bitAnd( hb_BCode( cBuffer ), 2 ) == 0
            lL := hb_bitAnd( hb_BCode( cBuffer ), 4 ) == 0
            nI := hb_BCode( hb_BSubStr( cBuffer, 2 ) )
            IF nI > 127
               nI -= 256
            ENDIF
            nX := nI
            nI := hb_BCode( hb_BSubStr( cBuffer, 4 ) )
            IF nI > 127
               nI -= 256
            ENDIF
            nX += nI
            nI := hb_BCode( hb_BSubStr( cBuffer, 3 ) )
            IF nI > 127
               nI -= 256
            ENDIF
            nY := - nI
            nI := hb_BCode( hb_BSubStr( cBuffer, 5 ) )
            IF nI > 127
               nI -= 256
            ENDIF
            nY -= nI
            ? "dX,dY:", Str( nX, 4 ), Str( nY, 4 ), "   "
            IF lL
               ?? "LEFT "
            ENDIF
            IF lM
               ?? "MIDDLE "
            ENDIF
            IF lR
               ?? "RIGHT"
            ENDIF
            cBuffer := hb_BSubStr( cBuffer, 5 )
         ENDIF

      ENDIF
   ENDDO
   hb_comClose( nPort )

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour contribution module 'gtwvg' (): contrib/gtwvg/toolbar.prg. Defines classes: WvgToolBar, WvgToolBarButton. This file provides platform-specific functionality

[Assistant]
#include "hbclass.ch"
#include "inkey.ch"
#include "hbgtinfo.ch"

#include "hbgtwvg.ch"
#include "wvtwin.ch"
#include "wvgparts.ch"

CREATE CLASS WvgToolBar INHERIT WvgWindow

   VAR    appearance
   VAR    style                                 INIT WVGTOOLBAR_STYLE_STANDARD
   VAR    allowCustomize                        INIT .T.
   VAR    enabled                               INIT .T.
   VAR    showToolTips                          INIT .T.
   VAR    borderStyle                           INIT WVGFRAME_NONE
   VAR    wrappable                             INIT .T.
   VAR    buttonWidth                           INIT 0
   VAR    buttonHeight                          INIT 0
   VAR    textAlign                             INIT WVGALIGN_BOTTOM
   VAR    imageWidth                            INIT 0
   VAR    imageHeight                           INIT 0
   VAR    transparentColor                      INIT 0

   VAR    aItems                                INIT {}
   VAR    hImageList
   VAR    lSized                                INIT .F.

   VAR    sl_change
   VAR    sl_buttonMenuClick
   VAR    sl_buttonDropDown

   METHOD numItems()                            INLINE Len( ::aItems )

   METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
   METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
   METHOD handleEvent( nMessage, aNM )
   METHOD destroy()
   METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
   METHOD sendToolbarMessage( nMsg, p1, p2 )
   METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB )
   METHOD delItem()

   METHOD getItem()
   METHOD clear()
   METHOD customize()
   METHOD loadImageSet()
   METHOD saveToolbar()
   METHOD restToolbar()
   METHOD setPosAndSize()
   METHOD setSize()

   METHOD buttonClick( xParam )                 SETGET
   METHOD change( xParam )                      SETGET
   METHOD buttonMenuClick( xParam )             SETGET
   METHOD buttonDropDown( xParam )              SETGET

ENDCLASS

METHOD WvgToolBar:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   ::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   ::exStyle     := TBSTYLE_EX_DOUBLEBUFFER + TBSTYLE_EX_MIXEDBUTTONS
   ::className   := TOOLBARCLASSNAME
   ::objType     := objTypeToolBar

   RETURN Self

METHOD WvgToolBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   ::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   IF ::style == WVGTOOLBAR_STYLE_FLAT
      ::style := TBSTYLE_FLAT
   ELSEIF ::style == WVGTOOLBAR_STYLE_VERTICAL
      ::style := CCS_VERT
   ELSE
      ::style := 0
   ENDIF
   ::style += WS_CHILD

   IF ::wrappable
      ::style += TBSTYLE_WRAPABLE
   ENDIF
   IF ::showToolTips
      ::style += TBSTYLE_TOOLTIPS
   ENDIF
   IF ::borderStyle == WVGFRAME_RECT
      ::style += WS_BORDER
   ENDIF

   ::oParent:AddChild( Self )

   ::createControl()

   IF ! Empty( ::hWnd )
      ::SendToolbarMessage( TB_BUTTONSTRUCTSIZE )
      ::hImageList := wapi_ImageList_Create( ::imageWidth, ::imageHeight, ILC_COLOR32 + ILC_MASK, 0, 1 )
      ::SendToolbarMessage( TB_SETIMAGELIST, ::hImageList )

      ::SendToolbarMessage( TB_BUTTONSTRUCTSIZE )
   ENDIF

   IF ::visible
      ::show()
   ENDIF

   RETURN Self

METHOD WvgToolBar:handleEvent( nMessage, aNM )

   LOCAL nObj, aNMMouse

   SWITCH nMessage

   CASE HB_GTE_RESIZED
      IF ::isParentCrt()
         ::rePosition()
      ENDIF
      ::sendMessage( WM_SIZE, 0, 0 )
      RETURN EVENT_HANDELLED

   CASE HB_GTE_COMMAND
      EXIT

   CASE HB_GTE_NOTIFY
      aNMMouse := wvg_GetNMMouseInfo( aNM[ 2 ] )

      DO CASE

      CASE aNMMouse[ NMH_code ] == NM_CLICK
         IF ( nObj := AScan( ::aItems, {| e_ | e_[ 1 ] == aNMMouse[ NMH_dwItemSpec ] } ) ) > 0
            IF HB_ISBLOCK( ::sl_lbClick )
               IF ::isParentCrt()
                  ::oParent:setFocus()
               ENDIF
               Eval( ::sl_lbClick, ::aItems[ nObj ][ 2 ], , Self )

            ENDIF
         ENDIF
         RETURN EVENT_HANDELLED

      OTHERWISE
         RETURN EVENT_UNHANDELLED

      ENDCASE

      EXIT
   ENDSWITCH

   RETURN EVENT_UNHANDELLED

METHOD PROCEDURE WvgToolBar:destroy()

   LOCAL i, nItems

   IF ( nItems := Len( ::aItems ) ) > 0
      FOR i := 1 TO nItems
         IF ::aItems[ i, 2 ]:image != NIL
            wvg_DeleteObject( ::aItems[ i, 2 ]:image )
         ENDIF
         IF ::aItems[ i, 2 ]:disabledImage != NIL
            wvg_DeleteObject( ::aItems[ i, 2 ]:disabledImage )
         ENDIF
         IF ::aItems[ i, 2 ]:hotImage != NIL
            wvg_DeleteObject( ::aItems[ i, 2 ]:hotImage )
         ENDIF
      NEXT
   ENDIF

   IF ! Empty( ::hImageList )
      wapi_ImageList_Destroy( ::hImageList )
   ENDIF

   ::wvgWindow:destroy()

   RETURN

METHOD WvgToolBar:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )

   RETURN Self

METHOD WvgToolBar:sendToolbarMessage( nMsg, p1, p2 )
   RETURN wvg_SendToolBarMessage( ::pWnd, nMsg, p1, p2 )

METHOD WvgToolBar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB )

   LOCAL oBtn, pBitmap, nBtn

   HB_SYMBOL_UNUSED( xDisabledImage )
   HB_SYMBOL_UNUSED( xHotImage )
   HB_SYMBOL_UNUSED( cDLL )

   IF ! ::lSized
      ::lSized := .T.
   ENDIF

   oBtn := WvgToolBarButton():new( cCaption, nStyle, cKey )

   oBtn:index   := ::numItems + 1
   oBtn:command := 100 + oBtn:index

   SWITCH ValType( xImage )
   CASE "C"
      IF "." $ xImage .OR. ;
         "/" $ xImage .OR. ;
         "\" $ xImage .OR. ;
         ":" $ xImage .OR. ;
         hb_FileExists( xImage )
         pBitmap := wvg_PrepareBitmapFromFile( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd )
      ELSE
         pBitmap := wvg_PrepareBitmapFromResourceName( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd )
      ENDIF
      EXIT

   CASE "N"
      pBitmap := wvg_PrepareBitmapFromResourceId( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd )
      EXIT

   CASE "P"
      pBitmap := xImage
      EXIT

   ENDSWITCH

   IF ! Empty( pBitmap )

      IF HB_ISNUMERIC( nMapRGB )
         nBtn := wapi_ImageList_AddMasked( ::hImageList, pBitmap, nMapRGB )
      ELSE
         nBtn := wapi_ImageList_Add( ::hImageList, pBitmap )
      ENDIF
      IF ! HB_ISPOINTER( xImage )
         wvg_DeleteObject( pBitmap )
      ENDIF

      wvg_AddToolBarButton( ::pWnd, nBtn, oBtn:caption, oBtn:command, 1, ::showToolTips )

      ::SendToolbarMessage( TB_SETBUTTONSIZE, ::buttonWidth, ::buttonHeight )

      ::sendToolbarMessage( TB_AUTOSIZE )
   ELSE
      wvg_AddToolBarButton( ::pWnd, , , oBtn:command, 3, .F. )

   ENDIF

   AAdd( ::aItems, { oBtn:command, oBtn } )

   RETURN oBtn

METHOD WvgToolBar:delItem()
   RETURN Self

METHOD WvgToolBar:getItem()
   RETURN Self

METHOD WvgToolBar:clear()
   RETURN Self

METHOD WvgToolBar:customize()
   RETURN Self

METHOD WvgToolBar:loadImageSet()
   RETURN Self

METHOD WvgToolBar:saveToolbar()
   RETURN Self

METHOD WvgToolBar:restToolbar()
   RETURN Self

METHOD WvgToolBar:setPosAndSize()
   RETURN Self

METHOD WvgToolBar:setSize()

   ::sendMessage( TB_AUTOSIZE, 0, 0 )

   RETURN Self

METHOD WvgToolBar:buttonClick( xParam )

   IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam )
      ::sl_lbClick := xParam
   ENDIF

   RETURN Self

METHOD WvgToolBar:change( xParam )

   IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam )
      ::sl_change := xParam
   ENDIF

   RETURN Self

METHOD WvgToolBar:buttonMenuClick( xParam )

   IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam )
      ::sl_buttonMenuClick := xParam
   ENDIF

   RETURN Self

METHOD WvgToolBar:buttonDropDown( xParam )

   IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam )
      ::sl_buttonDropDown := xParam
   ENDIF

   RETURN Self

CREATE CLASS WvgToolBarButton

   VAR    enabled                               INIT .T.


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour contribution module 'hbct' (CA-Tools compatibility library): contrib/hbct/tests/charone.prg. Contains procedures: Main. This file provides legacy compatibility functions

[Assistant]
#ifdef __HARBOUR__
#require "hbct"
#endif

PROCEDURE Main()

   ctinit()

   ? "Begin test of CharOne()"
   ?

   ? "Simple tests:"
   ? '  CharOne( "112333a123" )      == "123a123"? --> "' + CharOne( "112333a123" )      + '"'
   ? '  CharOne( "122333a123" )      == "123a123"? --> "' + CharOne( "122333a123" )      + '"'
   ? '  CharOne( "A  B  CCCD" )      == "A B CD"? ---> "' + CharOne( "A  B  CCCD" )      + '"'
   ? '  CharOne( " ", "A  B  A  B" ) == "A B A B"? --> "' + CharOne( " ", "A  B  A  B" ) + '"'
   ? '  CharOne( "o", "122oooB12o" ) == "122oB12o"? -> "' + CharOne( "o", "122oooB12o" ) + '"'
   ?

   ? "End test of CharOne()"
   ?

   ctexit()

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour test program: tests/ntx.prg. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#ifndef __HARBOUR__
#include "clipper.ch"
#endif

PROCEDURE Main()

   LOCAL i := 0
   FIELD Last, First

   USE test
   INDEX ON Left( Last, 8 ) + Left( First, 8 ) TO test1
   INDEX ON Left( Last, 8 ) TO test2
   INDEX ON Last TO test3
   SET INDEX TO test1, test2, test3

   SET ORDER TO 1
   ? IndexKey()
   Inkey( 0 )
   GO TOP
   DO WHILE ! Eof()
      ? ++i, Last, First
      SKIP
   ENDDO

   ? "------------"
   Inkey( 0 )
   SKIP -1

   DO WHILE ! Bof()
      ? i-- , Last, First
      SKIP -1
   ENDDO

   i := 0
   SET ORDER TO 2
   ? IndexKey()
   Inkey( 0 )
   GO TOP
   DO WHILE ! Eof()
      ? ++i, Last, First
      SKIP
   ENDDO

   ? "------------"
   Inkey( 0 )
   SKIP -1

   DO WHILE ! Bof()
      ? i-- , Last, First
      SKIP -1
   ENDDO

   i := 0
   SET ORDER TO 3
   ? IndexKey()
   Inkey( 0 )
   GO TOP
   DO WHILE ! Eof()
      ? ++i, Last, First
      SKIP
   ENDDO

   ? "------------"
   Inkey( 0 )
   SKIP -1

   DO WHILE ! Bof()
      ? i-- , Last, First
      SKIP -1
   ENDDO

   USE

   hb_dbDrop( "test1.ntx" )
   hb_dbDrop( "test2.ntx" )
   hb_dbDrop( "test3.ntx" )

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Write Harbour functions: ArrayToText. Harbour Runtime Library file: src/rtl/tpersist.prg. Defines classes: HBPersistent. Provides functions: ArrayToText. This file implements object-oriented classes using Harbour's class system

[Assistant]
#include "hbclass.ch"

REQUEST Array

#define _INDENT  3

CREATE CLASS HBPersistent

   METHOD CreateNew() INLINE Self
   METHOD LoadFromFile( cFileName, lIgnoreErrors ) INLINE ::LoadFromText( hb_MemoRead( cFileName ), lIgnoreErrors )
   METHOD LoadFromText( cObjectText, lIgnoreErrors )
   METHOD SaveToText( cObjectName, nIndent )
   METHOD SaveToFile( cFileName ) INLINE hb_MemoWrit( cFileName, ::SaveToText() )

ENDCLASS

METHOD LoadFromText( cObjectText, lIgnoreErrors ) CLASS HBPersistent

   LOCAL nPos
   LOCAL cLine
   LOCAL cProp
   LOCAL cInd
   LOCAL uValue
   LOCAL aWords
   LOCAL lStart := .T.
   LOCAL aObjects := { Self }
   LOCAL bError

   IF Empty( cObjectText )
      RETURN .F.
   ENDIF

   bError := iif( hb_defaultValue( lIgnoreErrors, .F. ), ;
                  {| e | Break( e ) }, ErrorBlock() )

   FOR EACH cLine IN hb_ATokens( StrTran( cObjectText, Chr( 13 ) ), Chr( 10 ) )

      cLine := AllTrim( cLine )

      BEGIN SEQUENCE WITH bError

         cProp := NIL

         IF Empty( cLine ) .OR. hb_LeftEq( cLine, "

         ELSEIF hb_LeftEq( cLine, "::" )

            IF ( nPos := At( ":=", cLine ) ) > 0
               cProp := RTrim( SubStr( cLine, 3, nPos - 3 ) )
               uValue := &( LTrim( SubStr( cLine, nPos + 2 ) ) )
            ELSEIF ( nPos := At( "=", cLine ) ) > 0
               cProp := RTrim( SubStr( cLine, 3, nPos - 3 ) )
               uValue := &( LTrim( SubStr( cLine, nPos + 1 ) ) )
            ENDIF
         ELSE
            aWords := hb_ATokens( hb_asciiUpper( cLine ) )
            SWITCH aWords[ 1 ]
            CASE "OBJECT"
               IF lStart
                  lStart := .F.
               ELSEIF aWords[ Len( aWords ) - 1 ] == "AS" .AND. hb_LeftEq( aWords[ 2 ], "::" )
                  cProp := SubStr( AllTrim( SubStr( cLine, 7, RAt( " AS ", cLine ) - 7 ) ), 3 )
                  uValue := &( aTail( aWords ) )():CreateNew()
               ENDIF
               EXIT
            CASE "ENDOBJECT"
               ASize( aObjects, Len( aObjects ) - 1 )
               EXIT
            CASE "ARRAY"
               IF hb_LeftEq( aWords[ 2 ], "::" )
                  cProp := SubStr( AllTrim( SubStr( cLine, 6, RAt( " LEN ", cLine ) - 6 ) ), 3 )
                  uValue := Array( Val( ATail( aWords ) ) )
               ENDIF
               EXIT
            ENDSWITCH
         ENDIF

         IF ! Empty( cProp )
            IF ( nPos := At( "[", cProp ) ) > 0
               cInd := hb_StrReplace( SubStr( cProp, nPos + 1, Len( cProp ) - nPos - 1 ), ;
                                      { " " => "", "][" => "," } )
               cProp := Left( cProp, nPos - 1 )
               ATail( aObjects ):&cProp[ &cInd ] := uValue
            ELSE
               ATail( aObjects ):&cProp := uValue
            ENDIF
         ENDIF

      END SEQUENCE

      IF Empty( aObjects )
         EXIT
      ENDIF
   NEXT

   RETURN .T.

METHOD SaveToText( cObjectName, nIndent ) CLASS HBPersistent

   LOCAL oNew := &( ::ClassName() + "()" ):CreateNew()
   LOCAL cProp
   LOCAL uValue
   LOCAL uNewValue
   LOCAL cObject
   LOCAL cType
   LOCAL lSpacer := .T.

   IF ! HB_ISSTRING( cObjectName )
      cObjectName := "o" + ::ClassName()
   ENDIF

   IF HB_ISNUMERIC( nIndent )
      nIndent += _INDENT
   ELSE
      nIndent := 0
   ENDIF

   cObject := iif( nIndent > 0, hb_eol(), "" ) + Space( nIndent ) + ;
              "OBJECT " + iif( nIndent != 0, "::", "" ) + cObjectName + " AS " + ;
              ::ClassName() + hb_eol()

   FOR EACH cProp IN __clsGetProperties( ::ClassH )

      uValue := Self:&cProp
      uNewValue := oNew:&cProp

      IF !( ( cType := ValType( uValue ) ) == ValType( uNewValue ) ) .OR. ;
         !( uValue == uNewValue )

         SWITCH cType
         CASE "A"
            cObject += ArrayToText( uValue, cProp, nIndent + _INDENT )
            lSpacer := .T.
            EXIT

         CASE "O"
            IF __objDerivedFrom( uValue, "HBPersistent" )
               cObject += uValue:SaveToText( cProp, nIndent )
               lSpacer := .T.
            ENDIF
            EXIT

         CASE "B"
         CASE "P"

            EXIT

         OTHERWISE
            IF lSpacer
               lSpacer := .F.
               cObject += hb_eol()
            ENDIF
            cObject += Space( nIndent + _INDENT ) + "::" + ;
                       cProp + " := " + hb_ValToExp( uValue ) + ;
                       hb_eol()
         ENDSWITCH

      ENDIF

   NEXT

   cObject += hb_eol() + Space( nIndent ) + "ENDOBJECT" + hb_eol()

   RETURN cObject

STATIC FUNCTION ArrayToText( aArray, cName, nIndent )

   LOCAL cArray := hb_eol() + Space( nIndent ) + "ARRAY ::" + cName + ;
                   " LEN " + hb_ntos( Len( aArray ) ) + hb_eol()
   LOCAL uValue

   FOR EACH uValue IN aArray

      SWITCH ValType( uValue )
      CASE "A"
         cArray += ArrayToText( uValue, cName + ;
                                "[ " + hb_ntos( uValue:__enumIndex() ) + " ]", ;
                                 nIndent + _INDENT ) + hb_eol()
         EXIT

      CASE "O"
         IF __objDerivedFrom( uValue, "HBPersistent" )
            cArray += uValue:SaveToText( cName + ;
                     "[ " + hb_ntos( uValue:__enumIndex() ) + " ]", nIndent )
         ENDIF
         EXIT

      CASE "B"
      CASE "P"

         EXIT

      OTHERWISE
         IF uValue:__enumIsFirst()
            cArray += hb_eol()
         ENDIF
         cArray += Space( nIndent + _INDENT ) + "::" + cName + ;
                   "[ " + hb_ntos( uValue:__enumIndex() ) + " ] := " + ;
                   hb_ValToExp( uValue ) + hb_eol()
      ENDSWITCH
   NEXT

   cArray += hb_eol() + Space( nIndent ) + "ENDARRAY" + hb_eol()

   RETURN cArray


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Write the following Harbour (xBase/Clipper) code:

Harbour contribution module 'hbct' (CA-Tools compatibility library): contrib/hbct/tests/asciisum.prg. Contains procedures: Main. This file provides legacy compatibility functions

[Assistant]
#ifdef __HARBOUR__
#require "hbct"
#endif

PROCEDURE Main()

   ctinit()

   ? "Begin test of AsciiSum()"
   ?

   ? '  AsciiSum( Replicate( "A", 10000 ) ) == 650000 ? --> ' + Str( AsciiSum( Replicate( "A", 10000 ) ) )
   ? '  AsciiSum( "0123456789" ) == 525               ? --> ' + Str( AsciiSum( "0123456789" ) )
   ? '  AsciiSum( NIL ) == 0                          ? --> ' + Str( AsciiSum( NIL ) )

   ?
   ? "End test of AsciiSum()"
   ?

   ctexit()

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour contribution module 'gtwvg' (): contrib/gtwvg/menubar.prg. Defines classes: WvgMenuBar. This file provides platform-specific functionality

[Assistant]
#include "hbclass.ch"
#include "inkey.ch"
#include "hbgtinfo.ch"

#include "hbgtwvg.ch"
#include "wvtwin.ch"
#include "wvgparts.ch"

CREATE CLASS WvgMenuBar INHERIT wvgWindow

   CLASS VAR nMenuItemID                         INIT 0

   VAR    hMenu
   VAR    pMenu

   VAR    sl_beginMenu
   VAR    sl_endMenu
   VAR    sl_itemMarked
   VAR    sl_itemSelected
   VAR    sl_drawItem
   VAR    sl_measureItem
   VAR    sl_onMenuKey

   VAR    aMenuItems                             INIT {}

   VAR    nPass                                  INIT 0

   VAR    caption                                INIT ""
   VAR    nItemID                                INIT 0
   VAR    aIds                                   INIT {}

   VAR    className                              INIT "MENUBAR"

   METHOD numItems()                             INLINE Len( ::aMenuItems )

   METHOD new( oParent, aPresParams, lVisible )
   METHOD create( oParent, aPresParams, lVisible )
   METHOD configure( oParent, aPresParams, lVisible )
   METHOD destroy()
   METHOD delAllItems()
   METHOD delItem( nItemNum )
   METHOD addItem( aItem, p2, p3, p4 )
   METHOD findMenuItemById( nId )
   METHOD findMenuPosById( nId )
   METHOD checkItem( nItemNum, lCheck )
   METHOD enableItem( nItemNum )
   METHOD disableItem( nItemNum )

   METHOD getItem( nItemNum )
   METHOD insItem( nItemNum, aItem )
   METHOD isItemChecked( nItemNum )
   METHOD isItemEnabled( nItemNum )
   METHOD selectItem( nItemNum )
   METHOD setItem( nItemNum, aItem )

   METHOD beginMenu( xParam )                   SETGET
   METHOD endMenu( xParam )                     SETGET
   METHOD itemMarked( xParam )                  SETGET
   METHOD itemSelected( xParam )                SETGET
   METHOD drawItem( xParam )                    SETGET
   METHOD measureItem( xParam )                 SETGET
   METHOD onMenuKey( xParam )                   SETGET

   PROTECTED:
   METHOD putItem( aItem, nPos, lInsert )

ENDCLASS

METHOD WvgMenuBar:new( oParent, aPresParams, lVisible )

   __defaultNIL( @oParent, ::oParent )
   __defaultNIL( @aPresParams, ::aPresParams )
   __defaultNIL( @lVisible, ::visible )

   ::oParent     := oParent
   ::aPresParams := aPresParams
   ::visible     := lVisible

   ::wvgWindow:new( ::oParent, , , , ::aPresParams, ::visible )

   RETURN Self

METHOD WvgMenuBar:create( oParent, aPresParams, lVisible )

   __defaultNIL( @oParent, ::oParent )
   __defaultNIL( @aPresParams, ::aPresParams )
   __defaultNIL( @lVisible, ::visible )

   ::oParent     := oParent
   ::aPresParams := aPresParams
   ::visible     := lVisible

   ::wvgWindow:create( ::oParent, , , , ::aPresParams, ::visible )

   ::hMenu := wvg_CreateMenu()

   IF ::hMenu != 0

      ::oParent:oMenu := Self

      ::pMenu := win_N2P( ::hMenu )
   ENDIF

   RETURN Self

METHOD WvgMenuBar:configure( oParent, aPresParams, lVisible )

   __defaultNIL( @oParent, ::oParent )
   __defaultNIL( @aPresParams, ::aPresParams )
   __defaultNIL( @lVisible, ::visible )

   ::oParent     := oParent
   ::aPresParams := aPresParams
   ::visible     := lVisible

   RETURN Self

METHOD WvgMenuBar:destroy()

   IF ! Empty( ::hMenu )
      ::DelAllItems()

      IF ! wvg_DestroyMenu( ::hMenu )
      ENDIF

      ::hMenu := 0
   ENDIF

   RETURN .T.

METHOD WvgMenuBar:delAllItems()

   LOCAL lResult := .T., nItems

   nItems := ::numItems()
   DO WHILE nItems > 0 .AND. lResult
      lResult := ::DelItem( nItems )
      nItems--
   ENDDO

   RETURN lResult

METHOD WvgMenuBar:delItem( nItemNum )

   LOCAL lResult := .F.

   IF nItemNum > 0 .AND. nItemNum <= ::numItems()
      IF ::aMenuItems[ nItemNum ][ WVT_MENU_TYPE ] == MF_POPUP
         ::aMenuItems[ nItemNum ][ WVT_MENU_MENUOBJ ]:Destroy()
      ENDIF

      IF ( lResult := wvg_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) )
         hb_ADel( ::aMenuItems, nItemNum, .T. )
      ELSE
      ENDIF
   ENDIF

   RETURN lResult

METHOD WvgMenuBar:addItem( aItem, p2, p3, p4 )

   LOCAL xCaption, bAction, nStyle, nAttrib

   IF PCount() == 1 .AND. HB_ISARRAY( aItem )
      ASize( aItem, 4 )
      xCaption := aItem[ 1 ]
      bAction  := aItem[ 2 ]
      nStyle   := aItem[ 3 ]
      nAttrib  := aItem[ 4 ]
   ELSE
      xCaption := aItem
      bAction  := p2
      nStyle   := p3
      nAttrib  := p4
   ENDIF

   RETURN ::putItem( { xCaption, bAction, nStyle, nAttrib }, -1, .T. )

METHOD WvgMenuBar:putItem( aItem, nPos, lInsert )

   LOCAL nItemIndex, cCaption
   LOCAL xCaption, bAction, nStyle, nAttrib

   __defaultNIL( @lInsert, .T. )

   ASize( aItem, 4 )

   xCaption := aItem[ 1 ]
   bAction  := aItem[ 2 ]
   nStyle   := aItem[ 3 ]
   nAttrib  := aItem[ 4 ]

   SWITCH ValType( xCaption )
   CASE "U"
      aItem := { MF_SEPARATOR, 0, 0, , nStyle, nAttrib }
      EXIT

   CASE "C"
      IF Left( xCaption, 1 ) == "-"
         aItem := { MF_SEPARATOR, 0, 0, , nStyle, nAttrib }
      ELSE
         aItem := { MF_STRING, ++::nMenuItemID, xCaption, bAction, nStyle, nAttrib }
      ENDIF
      EXIT

   CASE "O"
      cCaption := iif( bAction == NIL, xCaption:title, bAction )
      aItem    := { MF_POPUP, xCaption:hMenu, cCaption, xCaption, nStyle, nAttrib }
      EXIT

   CASE "N"
      EXIT

   ENDSWITCH

   IF nPos <= 0
      AAdd( ::aMenuItems, aItem )
      nItemIndex := Len( ::aMenuItems )
      wvg_AppendMenu( ::hMenu, ;
         aItem[ 1 ], ;
         aItem[ 2 ], ;
         iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) )
   ELSE
      nItemIndex := nPos
      IF lInsert
         ::aMenuItems := hb_AIns( ::aMenuItems, nPos, aItem, .T. )
         wvg_InsertMenu( ::hMenu, ;
            nItemIndex - 1, ;
            aItem[ 1 ] + MF_BYPOSITION, ;
            aItem[ 2 ], ;
            iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) )
      ELSE
         IF HB_ISSTRING( xCaption )
            aItem[ 2 ] := ::aMenuItems[ nItemIndex ][ 2 ]
         ENDIF
         ::aMenuItems[ nItemIndex ] := aItem
         wvg_SetMenuItem( ::hMenu, ;
            nItemIndex - 1, ;
            aItem[ 2 ], ;
            iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ), ;
            HB_ISSTRING( xCaption ) )
      ENDIF
   ENDIF

   IF ++::nPass == 1
      IF ::oParent:className() $ "WVGCRT,WVGDIALOG"
         wvg_SetMenu( ::oParent:getHWND(), ::hMenu )
      ENDIF
   ELSE
      IF ::oParent:className() $ "WVGCRT,WVGDIALOG"
         wvg_DrawMenuBar( ::oParent:getHWND() )
      ENDIF
   ENDIF

   RETURN nItemIndex

METHOD WvgMenuBar:findMenuItemById( nId )

   LOCAL x, aResult := {}

   IF ! Empty( nId )
      x := ::numItems()

      DO WHILE x > 0 .AND. Empty( aResult )
         IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP
            aResult := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuItemById( nId )

         ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId
            aResult := { x, ::aMenuItems[ x ][ WVT_MENU_ACTION ], ::sl_itemSelected, Self }

         ENDIF
         x--
      ENDDO
   ENDIF

   RETURN aResult

METHOD WvgMenuBar:findMenuPosById( nId )

   LOCAL x, nPos

   IF ! Empty( nId )
      x := ::numItems()

      DO WHILE x > 0 .AND. Empty( nPos )
         IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP
            nPos := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuPosById( nId )

         ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId
            nPos := x

         ENDIF
         x--
      ENDDO
   ENDIF

   RETURN nPos

METHOD WvgMenuBar:checkItem( nItemNum, lCheck )

   LOCAL nRet := -1

   __defaultNIL( @lCheck, .T. )

   IF ! Empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum )
      nRet := wvg_CheckMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + iif( lCheck, MF_CHECKED, MF_UNCHECKED ) )
   ENDIF

   RETURN iif( nRet == -1, .F., .T. )

METHOD WvgMenuBar:enableItem( nItemNum )

   LOCAL lSuccess := .F.

   IF ! Empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum )


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Define Harbour macros and constants: Harbour contribution module 'hbcurl' (libcurl wrapper for HTTP/FTP/SMTP operations): contrib/hbcurl/tests/multi.prg. Provides functions: CurGet. Contains 4 procedures. This file provides network protocol implementations

[Assistant]
#define REMOTE_1          "https:
#define REMOTE_2          "https:
#define REMOTE_3          "https:

#require "hbcurl"

#include "inkey.ch"

PROCEDURE Main( cRemote4 )
   LOCAL hMulti
   LOCAL hEasy, aResult, nKey := 0
   LOCAL aUrls := { REMOTE_1, REMOTE_2, REMOTE_3 }
   LOCAL aHandles, i, nErr, nRun := 0, nLastRun := 0

   IF ! Empty( cRemote4 )
      AAdd( aUrls, cRemote4 )
   ENDIF

   aHandles := Array( Len( aUrls ) )

   curl_global_init()

   hMulti := curl_multi_init()

   FOR i := 1 TO Len( aUrls )
      hEasy := curl_easy_init()
      IF hEasy != NIL
         curl_easy_setopt( hEasy, HB_CURLOPT_URL, aUrls[ i ] )
         curl_easy_setopt( hEasy, HB_CURLOPT_DOWNLOAD )
         curl_easy_setopt( hEasy, HB_CURLOPT_DL_BUFF_SETUP )

         curl_easy_setopt( hEasy, HB_CURLOPT_SSL_OPTIONS, HB_CURLSSLOPT_NATIVE_CA )
         curl_multi_add_handle( hMulti, hEasy )
         aHandles[ i ] := hEasy
      ENDIF
   NEXT

   CLS

   nErr := curl_multi_perform( hMulti, @nLastRun )

   IF nErr != HB_CURLM_OK
      ? "curl_multi_perform() failed, err=", nErr
      Cleanup( aHandles, hMulti )
      RETURN
   ENDIF

   SetPos( 3, 0 )

   DO WHILE curl_multi_perform( hMulti, @nRun ) == HB_CURLM_OK

      aResult := CurGet()
      @ 1, 1 SAY Time()
      @ 2, 1 SAY "downloading... (" + hb_ntos( nRun ) + " transfers left)"
      CurSet( aResult )

      IF nRun < nLastRun
         FOR i := 1 TO nLastRun - nRun

            aResult := curl_multi_info_read( hMulti, aHandles )

            IF aResult # NIL

               ? "HB_CURLMSG_RESP_LEN          :", aResult[ HB_CURLMSG_RESP_LEN ]
               ? "HB_CURLMSG_RESP_RESPONSE_CODE:", aResult[ HB_CURLMSG_RESP_RESPONSE_CODE ]
               ? "HB_CURLMSG_RESP_MSG          :", aResult[ HB_CURLMSG_RESP_MSG ]
               ? "HB_CURLMSG_RESP_RESULT       :", aResult[ HB_CURLMSG_RESP_RESULT ]
               ? "HB_CURLMSG_RESP_HPOS         :", aResult[ HB_CURLMSG_RESP_HPOS ]
               IF aResult[ HB_CURLMSG_RESP_HPOS ] > 0
                  ? "URL                          :", aUrls[ aResult[ HB_CURLMSG_RESP_HPOS ] ]
                  IF ! Empty( curl_easy_getinfo( aResult[ HB_CURLMSG_RESP_HANDLE ], HB_CURLINFO_REDIRECT_URL ) )
                     ? "HB_CURLINFO_REDIRECT_URL     :", curl_easy_getinfo( aResult[ HB_CURLMSG_RESP_HANDLE ], HB_CURLINFO_REDIRECT_URL )
                  ENDIF
               ENDIF
               ? "--"
            ENDIF
         NEXT
      ENDIF

      IF nRun == 0 .OR. nKey == K_ESC
         EXIT
      ENDIF

      nLastRun := nRun

      nKey := Inkey( 0.1 )

   ENDDO

   PrintAllDownloaded( aHandles )

   Cleanup( aHandles, hMulti )

   RETURN

STATIC PROCEDURE PrintAllDownloaded( aHandles )
   LOCAL h

   FOR EACH h IN aHandles

      IF h == NIL
         LOOP
      ENDIF

      ?  "Transfer #" + hb_ntos( h:__enumIndex ) + " (" + hb_ntos( curl_easy_getinfo( h, HB_CURLINFO_RESPONSE_CODE ) ) + "): "
      IF curl_easy_getinfo( h, HB_CURLINFO_RESPONSE_CODE ) == 0
        ?? "aborted"
      ELSE
        ?? Left( curl_easy_dl_buff_get( h ), 40 ) + IIF( Len( curl_easy_dl_buff_get( h ) ) > 40, "...", "" )
      ENDIF
   NEXT

   RETURN

STATIC PROCEDURE Cleanup( aHandles, hMulti )
   LOCAL h

   FOR EACH h IN aHandles

      IF h == NIL
         LOOP
      ENDIF

      curl_multi_remove_handle( hMulti, h )
      curl_easy_cleanup( h )

   NEXT

   curl_multi_cleanup( hMulti )

   curl_global_cleanup()

   RETURN

STATIC FUNCTION CurGet()
   RETURN { Row(), Col() }

STATIC PROCEDURE CurSet( a )

   SetPos( a[ 1 ], a[ 2 ] )

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour test program: tests/achoice.prg. Provides functions: cUserFunction. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#include "achoice.ch"
#include "inkey.ch"

#ifndef __HARBOUR__
#define hb_ntos( n ) LTrim( Str( n ) )
#endif

PROCEDURE Main()

   LOCAL aPrompts := { ;
      "AGRI-PLANTS"                   , ;
      "ALAN R. SMITH GREENHOUSES"     , ;
      "ALLAN MURRAY NURSERY, INC."    , ;
      "APOPKA FOREST"                 , ;
      "LIGHT HOUSE NURSERIES"         , ;
      "BAUCOM'S"                      , ;
      "BAY HILL NURSERY, INC."        , ;
      "BAYWOOD NURSERIES"             , ;
      "BIG OAK NURSERY"               , ;
      "C & N NURSERY"                 , ;
      "CHARLES QUALITY PLANTS"        , ;
      "CONNELL FARMS"                 , ;
      "DEWAR NURSERIES, INC."         , ;
      "DIAMOND T NURSERY"             , ;
      "DISTINCTIVE PALMS NURSERIES"   , ;
      "DONKAY NURSERY"                , ;
      "DOUG INGRAM & SONS NURSERY"    , ;
      "DRIFTWOOD GARDENS, INC."       , ;
      "ELVA PLANT NURSERY, INC."      , ;
      "ERINON"                        , ;
      "EVANS NURSERY"                 , ;
      "FANCY PLANTS"                  , ;
      "FL.PLANT GROWERSCOOP"          , ;
      "FLORIDA CACTUS INC."           , ;
      "FLOWERING TREE GROWERS, INC."  , ;
      "FLOWERWOOD NURSERY"            , ;
      "FOLIAGE FACTORY TOO"           , ;
      "GATOR GROWERS NURSERY, INC."   , ;
      "GAZEBO LANDSCAPE DESIGN, INC." , ;
      "GEM ORNAMENTALS"               , ;
      "GRANNY'S GARDEN"               , ;
      "GRAY'S ORNAMENTALS"            , ;
      "GREEN MASTERS INC."            , ;
      "GREEN MEADOW NURSERY"          , ;
      "PIXLEY'S PLANT PLACE"          , ;
      "HARRISON'S NURSERY, INC."      , ;
      "G & G FOLIAGE"                 , ;
      "IVEY'S NURSERY, INC."          , ;
      "JB NURSERIES, INC."            , ;
      "JON'S NURSERY"                 , ;
      "JONES & JONES NURSERY, INC."   , ;
      "KAGER'S NURSERY"               , ;
      "KIRKLAND'S NURSERY"            , ;
      "LAND OF BROMELIADS"            , ;
      "LANDSCAPE NURSERY, INC."       , ;
      "LIEWALD'S NURSERY INC."        , ;
      "LLOYD & RINGS NURSERY"         , ;
      "LONG VAN DOUNG"                , ;
      "MAPEL'S LANDSCAPE NURSERY"     , ;
      "MILESTONE AGRICULTURE, INC."   , ;
      "MOJICA NURSERY & FRUITS"       , ;
      "NELSON'S ROSES"                , ;
      "PARK GARDENS"                  , ;
      "PAUL LUKAS INC."               , ;
      "PECKETT'S INC."                , ;
      "PENANG NURSERY, INC."          , ;
      "PINES III NURERIES"            , ;
      "PINEVIEW NURSERY"              , ;
      "POUL JENSEN NURSERY"           , ;
      "R.P. WELKER"                   , ;
      "RICHARD ROGERS NURSERY, INC."  , ;
      "SPRING HILL NURSERY"           , ;
      "T.O. MAHAFFEY, JR."            , ;
      "TUCKER NURSERY"                , ;
      "TURTLE POND NURSERY"           , ;
      "TUTTLE'S NURSERY INC."         , ;
      "VALLEY CACTUS"                 , ;
      "WHISPER WINDS, INC."           , ;
      "WHITE ROSE NURSERIES INC."     , ;
      "WOODWAY"                       , ;
      "FLORI-DESIGN"                  , ;
      "GREEN ACRES FOLIAGE, INC"      , ;
      "FLORAL EXPO"                   , ;
      "TORRES NURSERY"                , ;
      "DARRYL KOON"                   , ;
      "TRISTAR NURSERY"               , ;
      "KAY WEST NURSERY"              , ;
      "JAYMAR NURSERY"                , ;
      "J D F LANDSCAPE NURSERY"       , ;
      "DEROOSE PLANTS, INC."          , ;
      "THE TREEHOUSE"                 , ;
      "COSTELLO'S ARECAS, INC."       , ;
      "FLORICO FOLIAGE"               , ;
      "THE NATIVES"                   , ;
      "GREENS NURSERY"                , ;
      "STEWART NURSERIES"             , ;
      "G & T FOLIAGE, INC."           , ;
      "GOOD TIMES NURSERY"            , ;
      "CONCEPTS IN GREENERY, INC."    , ;
      "DUNN BROTHERS CITRUS, INC."    , ;
      "JOHN PLANK GREENHOUSES"        , ;
      "GREENER PASTURES NURSERY"      , ;
      "MULVEHILL NURSERY"             , ;
      "A NU LEAF"                     , ;
      "IVY DESIGNS, INC."             , ;
      "B & C TROPICALS"               , ;
      "SPANISH RIVER NURSERY, INC."   , ;
      "JACK CHRISTMAS & ASSOCIATES"   , ;
      "SPECIALIST GROWERS"            , ;
      "HOMRICH NURSERY, INC."         , ;
      "COUNTRYSIDE FOLIAGE, INC."     , ;
      "RFJ COMPANY"                   , ;
      "LAKE BRANTLEY PLANT CORP."     , ;
      "MARISTYME"                     , ;
      "MERISTEM NURSERY, INC."        , ;
      "TROPIC DECOR - EARL WILSON"    , ;
      "URQUHART'S NURSERY"            , ;
      "ACE PLANT NURSERY"             , ;
      "HATTAWAYS GREENHOUSE, INC."    , ;
      "Florida Plant Growers"         , ;
      "Junior Nursery"                , ;
      "Fox's Nurseries, Inc."         , ;
      "Vaughan Nursery"               , ;
      "MERRYGRO FARMS"                , ;
      "ALL SEASONS NURSERY"           , ;
      "BENCHMARK FOLIAGE"             , ;
      "SAMMY'S NURSERY"               , ;
      "SUNSHINE GROWERS"              , ;
      "Blooming-Fields Nursery"       }

   LOCAL aPermits := {}
   LOCAL x
   LOCAL nChoice
   LOCAL ncntr

   CLS

   SetColor( "GB+/B,GR+/R,,,W/N" )

   SET CURSOR ON

   ASize( aPermits, Len( aPrompts ) )

   FOR x := 1 TO Len( aPrompts )
      aPermits[ x ] := !( "V" $ aPrompts[ x ] )
   NEXT

#define TEST1
#ifdef TEST1
   FOR ncntr := 1 TO 17
      aPermits[ nCntr ]                       := .F.
      aPermits[ Len( aPrompts ) - nCntr + 1 ] := .F.
   NEXT
   aPermits[ 32 ] := .F.
   aPermits[ 33 ] := .F.
   aPermits[ 34 ] := .F.
#endif

   nChoice := AChoice( 5, 10, 20, 70, aPrompts, aPermits, "cUserFunction" )

   SetPos( 0, 0 )

   ? nChoice

   IF nChoice > 0
      ? aPrompts[ nChoice ]
   ENDIF
   SetPos( MaxRow() - 2, 0 )

   RETURN

FUNCTION cUserFunction( nMode, nCurElement, nRowPos )

   LOCAL nRetVal := AC_CONT
   LOCAL nKey    := LastKey()

   LOCAL nRow := Row()
   LOCAL nCol := Col()

   HB_SYMBOL_UNUSED( nRowPos )

   @ 0, 20 SAY Str( nRow, 3 ) + " " + Str( nCol, 3 )

   DO CASE

   CASE nMode == AC_IDLE
      @  0,  0 SAY PadR( hb_ntos( nCurElement ), 10 )
      nRetVal := AC_CONT
   CASE nMode == AC_HITTOP
      @  0,  0 SAY "Hit Top   "

   CASE nMode == AC_HITBOTTOM
      @  0,  0 SAY "Hit Bottom"

   CASE nMode == AC_EXCEPT
      @  0,  0 SAY "Exception "
      DO CASE
      CASE nKey == K_ENTER
         nRetVal := AC_SELECT
      CASE nKey == K_ESC
         nRetVal := AC_ABORT
      OTHERWISE
         nRetVal := AC_GOTO
      ENDCASE
   ENDCASE

   RETURN nRetVal


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Create Harbour preprocessor definitions: Header file for contribution module 'xhb' (Extended Harbour functions): contrib/xhb/hblogdef.ch. Defines 8 constants including: HB_LOGDEF_CH, HB_LOG_DEFAULT, HB_LOG_CRITICAL, HB_LOG_ERROR, HB_LOG_WARNING. Defines Harbour internal constants and macros

[Assistant]
#ifndef HB_LOGDEF_CH
#define HB_LOGDEF_CH

#define HB_LOG_DEFAULT    -1
#define HB_LOG_CRITICAL    1
#define HB_LOG_ERROR       2
#define HB_LOG_WARNING     3
#define HB_LOG_WARN        3
#define HB_LOG_INFO        4
#define HB_LOG_DEBUG       5

#endif


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Implement this Harbour module: Harbour header file: extras/template/hbtpl.ch. Defines constants: HBTPL_CH, HBTPL_MYCONSTANT. Declares 1 preprocessor commands. Defines communication constants

[Assistant]
#ifndef HBTPL_CH
#define HBTPL_CH

#define HBTPL_MYCONSTANT  100

#command HBTPL_PRINT <x>  => ? <x>

#endif


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Create Harbour preprocessor definitions: Harbour Runtime Library file: src/rtl/tlabel.prg. Defines classes: HBLabelForm. This file defines UI widget classes for graphical interfaces

[Assistant]
#include "hbclass.ch"

#include "error.ch"
#include "fileio.ch"
#include "inkey.ch"

#define _LF_SAMPLES     2
#define _LF_YN          12

#define LBL_REMARK      1
#define LBL_HEIGHT      2
#define LBL_WIDTH       3
#define LBL_LMARGIN     4
#define LBL_LINES       5
#define LBL_SPACES      6
#define LBL_ACROSS      7
#define LBL_FIELDS      8

#define LBL_COUNT       8

#define LF_EXP          1
#define LF_TEXT         2
#define LF_BLANK        3

#define LF_COUNT        3

#define BUFFSIZE        1034
#define FILEOFFSET      74
#define FIELDSIZE       60
#define REMARKOFFSET    2
#define REMARKSIZE      60
#define HEIGHTOFFSET    62
#define HEIGHTSIZE      2
#define WIDTHOFFSET     64
#define WIDTHSIZE       2
#define LMARGINOFFSET   66
#define LMARGINSIZE     2
#define LINESOFFSET     68
#define LINESSIZE       2
#define SPACESOFFSET    70
#define SPACESSIZE      2
#define ACROSSOFFSET    72
#define ACROSSSIZE      2

CREATE CLASS HBLabelForm

   VAR aLabelData   AS ARRAY   INIT {}
   VAR aBandToPrint AS ARRAY
   VAR cBlank       AS STRING  INIT ""
   VAR lOneMoreBand AS LOGICAL INIT .T.
   VAR nCurrentCol  AS NUMERIC

   METHOD Init( cLBLName, lPrinter, cAltFile, lNoConsole, bFor, ;
                bWhile, nNext, nRecord, lRest, lSample )

   METHOD ExecuteLabel()
   METHOD SampleLabels()
   METHOD LoadLabel( cLblFile )

ENDCLASS

METHOD Init( cLBLName, lPrinter, cAltFile, lNoConsole, bFor, ;
             bWhile, nNext, nRecord, lRest, lSample ) CLASS HBLabelForm

   LOCAL lPrintOn := .F.
   LOCAL lConsoleOn
   LOCAL cExtraFile, lExtraState
   LOCAL xBreakVal, lBroke := .F.
   LOCAL err
   LOCAL OldMargin

   ::aBandToPrint := {}
   ::nCurrentCol := 1

   IF cLBLName == NIL
      err := ErrorNew()
      err:severity := ES_ERROR
      err:genCode := EG_ARG
      err:subSystem := "FRMLBL"
      Eval( ErrorBlock(), err )
   ELSE

      IF Set( _SET_DEFEXTENSIONS )
         cLBLName := hb_FNameExtSetDef( cLBLName, ".lbl" )
      ENDIF
   ENDIF

   __defaultNIL( @lPrinter, .F. )
   __defaultNIL( @lSample, .F. )

   IF lPrinter
      lPrintOn := Set( _SET_PRINTER, lPrinter )
   ENDIF

   lConsoleOn := Set( _SET_CONSOLE )
   Set( _SET_CONSOLE, ! lNoConsole .AND. lConsoleOn )

   IF ! Empty( cAltFile )
      lExtraState := Set( _SET_EXTRA, .T. )
      cExtraFile  := Set( _SET_EXTRAFILE, cAltFile )
   ENDIF

   OldMargin := Set( _SET_MARGIN, 0 )

   BEGIN SEQUENCE

      ::aLabelData := ::LoadLabel( cLBLName )

      ::aLabelData[ LBL_LMARGIN ] += OldMargin

      ASize( ::aBandToPrint, Len( ::aLabelData[ LBL_FIELDS ] ) )
      AFill( ::aBandToPrint, Space( ::aLabelData[ LBL_LMARGIN ] ) )

      ::cBlank := Space( ::aLabelData[ LBL_WIDTH ] + ::aLabelData[ LBL_SPACES ] )

      IF lSample
         ::SampleLabels()
      ENDIF

      dbEval( {|| ::ExecuteLabel() }, bFor, bWhile, nNext, nRecord, lRest )

      IF ::lOneMoreBand

         AEval( ::aBandToPrint, {| BandLine | PrintIt( BandLine ) } )
      ENDIF

   RECOVER USING xBreakVal

      lBroke := .T.

   END SEQUENCE

   ::aLabelData   := {}
   ::aBandToPrint := {}
   ::nCurrentCol  := 1
   ::cBlank       := ""
   ::lOneMoreBand := .T.

   Set( _SET_PRINTER, lPrintOn )
   Set( _SET_CONSOLE, lConsoleOn )

   IF ! Empty( cAltFile )
      Set( _SET_EXTRAFILE, cExtraFile )
      Set( _SET_EXTRA, lExtraState )
   ENDIF

   IF lBroke
      BREAK xBreakVal
   ENDIF

   Set( _SET_MARGIN, OldMargin )

   RETURN Self

METHOD ExecuteLabel() CLASS HBLabelForm

   LOCAL nField, aField, nMoreLines, aBuffer := {}, cBuffer
   LOCAL item

   FOR EACH aField IN ::aLabelData[ LBL_FIELDS ]

      IF aField != NIL

         cBuffer := ;
            PadR( Eval( aField[ LF_EXP ] ), ::aLabelData[ LBL_WIDTH ] ) + ;
            Space( ::aLabelData[ LBL_SPACES ] )

         IF aField[ LF_BLANK ]
            IF ! Empty( cBuffer )
               AAdd( aBuffer, cBuffer )
            ENDIF
         ELSE
            AAdd( aBuffer, cBuffer )
         ENDIF
      ELSE
         AAdd( aBuffer, NIL )
      ENDIF
   NEXT

   ASize( aBuffer, Len( ::aLabelData[ LBL_FIELDS ] ) )

   FOR nField := 1 TO Len( ::aLabelData[ LBL_FIELDS ] )
      ::aBandToPrint[ nField ] += ;
         iif( aBuffer[ nField ] == NIL, ::cBlank, aBuffer[ nField ] )
   NEXT

   IF ::nCurrentCol == ::aLabelData[ LBL_ACROSS ]

      FOR EACH item IN ::aBandToPrint
         item := RTrim( item )
      NEXT

      ::lOneMoreBand := .F.
      ::nCurrentCol := 1

      AEval( ::aBandToPrint, {| BandLine | PrintIt( BandLine ) } )

      nMoreLines := ::aLabelData[ LBL_HEIGHT ] - Len( ::aBandToPrint )
      FOR nField := 1 TO nMoreLines
         PrintIt()
      NEXT

      FOR nField := 1 TO ::aLabelData[ LBL_LINES ]
         PrintIt()
      NEXT

      AFill( ::aBandToPrint, Space( ::aLabelData[ LBL_LMARGIN ] ) )
   ELSE
      ::lOneMoreBand := .T.
      ::nCurrentCol++
   ENDIF

   RETURN Self

METHOD SampleLabels() CLASS HBLabelForm

   LOCAL cKey, lMoreSamples := .T., nField
   LOCAL aBand := {}

   ASize( aBand, ::aLabelData[ LBL_HEIGHT ] )
   AFill( aBand, Space( ::aLabelData[ LBL_LMARGIN ] ) + ;
      Replicate( Replicate( "*", ::aLabelData[ LBL_WIDTH ] ) + ;
      Space( ::aLabelData[ LBL_SPACES ] ), ::aLabelData[ LBL_ACROSS ] ) )

   DO WHILE lMoreSamples

      AEval( aBand, {| BandLine | PrintIt( BandLine ) } )

      FOR nField := 1 TO ::aLabelData[ LBL_LINES ]
         PrintIt()
      NEXT

      DispOutAt( Row(), 0, __natMsg( _LF_SAMPLES ) + " (" + __natMsg( _LF_YN ) + ")" )
      cKey := hb_keyChar( Inkey( 0 ) )
      DispOut( cKey )
      IF Row() == MaxRow()
         Scroll( 0, 0, MaxRow(), MaxCol(), 1 )
         SetPos( MaxRow(), 0 )
      ELSE
         SetPos( Row() + 1, 0 )
      ENDIF
      IF __natIsNegative( cKey )
         lMoreSamples := .F.
      ENDIF
   ENDDO

   RETURN Self

METHOD LoadLabel( cLblFile ) CLASS HBLabelForm

   LOCAL i
   LOCAL cBuff      := Space( BUFFSIZE )
   LOCAL nHandle
   LOCAL nOffset    := FILEOFFSET
   LOCAL cFieldText
   LOCAL err

   LOCAL cPath

   LOCAL aLabel[ LBL_COUNT ]

   aLabel[ LBL_REMARK ]  := Space( 60 )
   aLabel[ LBL_HEIGHT ]  := 5
   aLabel[ LBL_WIDTH ]   := 35
   aLabel[ LBL_LMARGIN ] := 0
   aLabel[ LBL_LINES ]   := 1
   aLabel[ LBL_SPACES ]  := 0
   aLabel[ LBL_ACROSS ]  := 1
   aLabel[ LBL_FIELDS ]  := {}

   IF ( nHandle := FOpen( cLblFile ) ) == F_ERROR .AND. ;
      Empty( hb_FNameDir( cLblFile ) )

      FOR EACH cPath IN hb_ATokens( StrTran( Set( _SET_DEFAULT ), ",", ";" ), ";" )
         IF ( nHandle := FOpen( hb_DirSepAdd( cPath ) + cLblFile ) ) != F_ERROR
            EXIT
         ENDIF
      NEXT
   ENDIF

   IF nHandle == F_ERROR
      err := ErrorNew()
      err:severity := ES_ERROR
      err:genCode := EG_OPEN
      err:subSystem := "FRMLBL"
      err:osCode := FError()
      err:filename := cLblFile
      Eval( ErrorBlock(), err )
   ELSE
      IF FRead( nHandle, @cBuff, BUFFSIZE ) > 0 .AND. FError() == 0

         aLabel[ LBL_REMARK  ] := hb_BSubStr( cBuff, REMARKOFFSET, REMARKSIZE )
         aLabel[ LBL_HEIGHT  ] := Bin2W( hb_BSubStr( cBuff, HEIGHTOFFSET, HEIGHTSIZE ) )
         aLabel[ LBL_WIDTH   ] := Bin2W( hb_BSubStr( cBuff, WIDTHOFFSET, WIDTHSIZE ) )
         aLabel[ LBL_LMARGIN ] := Bin2W( hb_BSubStr( cBuff, LMARGINOFFSET, LMARGINSIZE ) )
         aLabel[ LBL_LINES   ] := Bin2W( hb_BSubStr( cBuff, LINESOFFSET, LINESSIZE ) )


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Write the following Harbour (xBase/Clipper) code:

Harbour test program: tests/hrbext.prg. Provides functions: Msg, Msg2. Contains procedures: MsgInit. This test file tests specific function APIs

[Assistant]
FUNCTION Msg()

   ? "Function called from .hrb"

   RETURN .T.

FUNCTION Msg2()
   RETURN Msg()

INIT PROCEDURE MsgInit()

   ? "INIT PROCEDURE in .hrb"

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Write the following Harbour (xBase/Clipper) code:

Harbour contribution module 'hbzebra' (Barcode generation library): contrib/hbzebra/tests/gtgfx.prg. Provides functions: hb_zebra_draw_gfx. Contains procedures: Main, DrawBarcode. This file provides graphics and image processing capabilities

[Assistant]
#require "hbzebra"

#include "hbgtinfo.ch"
#include "hbgfx.ch"

#define _SCALE_ 2

PROCEDURE Main()

   SetMode( 21
   SetColor( "B*/W" )

   CLS

   DrawBarcode(  1, 32, 1, "EAN13",      "477012345678" )
   DrawBarcode(  2, 32, 1, "EAN8",       "1234567" )
   DrawBarcode(  3, 32, 1, "UPCA",       "01234567891" )
   DrawBarcode(  4, 32, 1, "UPCE",       "123456" )
   DrawBarcode(  5, 32, 1, "CODE39",     "ABC123" )
   DrawBarcode(  6, 32, 1, "CODE39",     "ABC123", HB_ZEBRA_FLAG_CHECKSUM + HB_ZEBRA_FLAG_WIDE3 )
   DrawBarcode(  7, 32, 1, "ITF",        "12345678901", HB_ZEBRA_FLAG_CHECKSUM )
   DrawBarcode(  8, 32, 1, "MSI",        "1234567", HB_ZEBRA_FLAG_CHECKSUM )
   DrawBarcode(  9, 32, 1, "CODABAR",    "40156", HB_ZEBRA_FLAG_WIDE3 )
   DrawBarcode( 10, 32, 1, "CODE93",     "ABC-123" )
   DrawBarcode( 11, 32, 1, "CODE11",     "1234567890", HB_ZEBRA_FLAG_CHECKSUM + HB_ZEBRA_FLAG_WIDE3 )
   DrawBarcode( 12, 32, 1, "CODE128",    "Code 128" )
   DrawBarcode( 13, 32, 1, "PDF417",     "Hello, World of Harbour!!! It's 2D barcode PDF417 :)" )
   DrawBarcode( 17, 32, 1, "DATAMATRIX", "Hello, World of Harbour!!! It's 2D barcode DataMatrix :)" )
   DrawBarcode( 19, 32, 1, "QRCODE",     "https:

   WAIT

   RETURN

STATIC PROCEDURE DrawBarcode( nY, nX, nLineWidth, cType, cCode, nFlags )

   LOCAL hZebra, nLineHeight, cTxt, nYPixel
   LOCAL nColor := hb_gfxMakeColor( 0, 0, 0 )

   IF nLineWidth < 1
      nLineWidth := 1
   ENDIF

   SWITCH cType
   CASE "EAN13"      ; hZebra := hb_zebra_create_ean13( cCode, nFlags )   ; EXIT
   CASE "EAN8"       ; hZebra := hb_zebra_create_ean8( cCode, nFlags )    ; EXIT
   CASE "UPCA"       ; hZebra := hb_zebra_create_upca( cCode, nFlags )    ; EXIT
   CASE "UPCE"       ; hZebra := hb_zebra_create_upce( cCode, nFlags )    ; EXIT
   CASE "CODE39"     ; hZebra := hb_zebra_create_code39( cCode, nFlags )  ; EXIT
   CASE "ITF"        ; hZebra := hb_zebra_create_itf( cCode, nFlags )     ; EXIT
   CASE "MSI"        ; hZebra := hb_zebra_create_msi( cCode, nFlags )     ; EXIT
   CASE "CODABAR"    ; hZebra := hb_zebra_create_codabar( cCode, nFlags ) ; EXIT
   CASE "CODE93"     ; hZebra := hb_zebra_create_code93( cCode, nFlags )  ; EXIT
   CASE "CODE11"     ; hZebra := hb_zebra_create_code11( cCode, nFlags )  ; EXIT
   CASE "CODE128"    ; hZebra := hb_zebra_create_code128( cCode, nFlags ) ; EXIT
   CASE "PDF417"     ; hZebra := hb_zebra_create_pdf417( cCode, nFlags ); nLineHeight := nLineWidth
   CASE "DATAMATRIX" ; hZebra := hb_zebra_create_datamatrix( cCode, nFlags ); nLineHeight := nLineWidth ; EXIT
   CASE "QRCODE"     ; hZebra := hb_zebra_create_qrcode( cCode, nFlags ); nLineHeight := nLineWidth ; EXIT
   ENDSWITCH

   nY
            cTxt := Left( cTxt, nX - 12 - 4 ) + "..."
         ENDIF
         hb_dispOutAt( nY, nx - 20, cTxt )
         hb_zebra_draw_gfx( hZebra, nColor, nX
         ? "Type", cType, "Code", cCode, "Error", hb_zebra_geterror( hZebra )
      ENDIF
      hb_zebra_destroy( hZebra )
   ELSE
      ? "Invalid barcode type", cType
   ENDIF

   RETURN

STATIC FUNCTION hb_zebra_draw_gfx( hZebra, nColor, ... )

   IF hb_zebra_geterror( hZebra ) != 0
      RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
   ENDIF

   RETURN hb_zebra_draw( hZebra, {| x, y, w, h | hb_gfxfilledRect( y, x, y + h, x + w, nColor ) }, ... )


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour header file: include/hbstdgen.ch. Defines 10 constants including: HB_VER_H_, HB_SETUP_CH_, HB_STD_CH_, HB_VER_MAJOR, HB_VER_MINOR. Defines Harbour internal constants and macros

[Assistant]
#include "hbver.h"
#include "hbsetup.ch"
#include "std.ch"

#undef HB_VER_H_
#undef HB_SETUP_CH_
#undef HB_STD_CH_

#undef HB_VER_MAJOR
#undef HB_VER_MINOR
#undef HB_VER_RELEASE
#undef HB_VER_STATUS

#undef __DATE__
#undef __TIME__
#undef __HB_MAIN__
#undef __ARCH16BIT__
#undef __ARCH32BIT__
#undef __ARCH64BIT__
#undef __LITTLE_ENDIAN__
#undef __BIG_ENDIAN__
#undef __PDP_ENDIAN__


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Generate Harbour code for: Harbour contribution module 'hbwin' (Windows API wrapper functions): contrib/hbwin/tests/shfileop.prg. Contains procedures: Main. This file provides platform-specific functionality

[Assistant]
#require "hbwin"

#include "simpleio.ch"

PROCEDURE Main()

   LOCAL a
   LOCAL lAbort
   LOCAL tmp

   ? "0x" + hb_NumToHex( win_SHFileOperation( NIL, WIN_FO_COPY, { __FILE__, "olesrv1.prg" }, { "testcopy1" }, ;
      NIL, @lAbort, ;
      NIL, "Harbour SHFile 1" ) )
   ? lAbort

   hb_MemoWrit( "rename.txt", "hello1" )
   hb_MemoWrit( "rename1.txt", "hello2" )

   a := {}
   ? "0x" + hb_NumToHex( win_SHFileOperation( NIL, WIN_FO_RENAME, { "rename.txt" }, { "rename1.txt" }, ;
      WIN_FOF_WANTMAPPINGHANDLE, @lAbort, ;
      a, "Harbour SHFile 2" ) )
   ? lAbort
   FOR EACH tmp IN a
      ? tmp[ 1 ], tmp[ 2 ]
      FErase( tmp[ 1 ] )
      FErase( tmp[ 2 ] )
   NEXT

   FErase( "rename1.txt" )

   ? "0x" + hb_NumToHex( win_SHFileOperation( NIL, WIN_FO_COPY, __FILE__ + Chr( 0 ) + "olesrv1.prg" + Chr( 0 ), "testcopy2", ;
      NIL, @lAbort, ;
      NIL, "Harbour SHFile 3" ) )
   ? lAbort

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Write a Harbour program with procedures: Main. Harbour contribution module 'hbmisc' (Miscellaneous utility functions): contrib/hbmisc/tests/twirler.prg. Contains procedures: Main. This file provides utility functions

[Assistant]
#require "hbmisc"

PROCEDURE Main()

   LOCAL counter := 0, start_time, stop_time
   LOCAL twirl1 := Twirler():new( 2,  5, "One: " )
   LOCAL twirl2 := Twirler():new( 2, 15, "Two: ", , 0.1 )
   LOCAL twirl3 := Twirler():new( 2, 30, "Three: ", , 0.25 )
   LOCAL twirl4 := Twirler():new( 3,  5, "Four: ", "^)v(", 0.2 )
   LOCAL twirl5 := Twirler():new( 3, 15, "Five: ", "^)v(", 0.2 )
   LOCAL twirl6 := Twirler():new( 4,  5, "Six: ", ".oOo", 0.2 )
   LOCAL twirl7 := Twirler():new( 4, 15, "Seven: ", ".oOo", 0.2 )

   CLS
   SET CURSOR OFF
   @ 1, 1 SAY "Twirler test program - press any key to stop"
   twirl1:show()
   twirl2:show()
   twirl3:show()
   twirl4:show()
   twirl5:show()
   twirl6:show()
   twirl7:show()
   start_time := Seconds()
   WHILE Inkey() == 0
      counter++
      twirl1:twirl()
      twirl2:twirl()
      twirl3:twirl()
      twirl4:twirl()
      twirl6:twirl()
      IF counter % 5 == 0
         twirl5:twirl()
         IF counter % 10 == 0
            twirl7:twirl()
         ENDIF
      ENDIF
   ENDDO
   stop_time := Seconds()
   twirl7:hide()
   twirl6:hide()
   twirl5:hide()
   twirl4:hide()
   twirl3:hide()
   twirl2:hide()
   twirl1:hide()
   @ 2, 5 SAY counter
   @ 3, 5 SAY stop_time - start_time
   SET CURSOR ON

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour test program: tests/clsscast.prg. This test file tests specific function APIs

[Assistant]
#xtranslate QQOUT([<x,...>]) => [OUTSTD(<x>)]
#xtranslate QOUT([<x,...>]) => OUTSTD(hb_eol())[;OUTSTD(<x>)]

#include "hbclass.ch"

proc main()
local o:=myclass4():new(), i, cbErr

? DATE(), TIME(), VERSION(), OS()
?

? "myclass1 shared class vars:", str( __CLS_CNTSHRDATA(o:myclass1:classH), 3), "  => should be:   3"
? "myclass2 shared class vars:", str( __CLS_CNTSHRDATA(o:myclass2:classH), 3), "  => should be:   3"
? "myclass3 shared class vars:", str( __CLS_CNTSHRDATA(o:myclass3:classH), 3), "  => should be:   3"
cbErr := errorBlock( {| oErr | break( oErr ) } )
begin sequence
   ? "myclass4 shared class vars:", str( __CLS_CNTSHRDATA(o:myclass4:classH), 3), "  => should be:   3"
recover
   ? "ERROR: no selfclass casting"
end
errorBlock(cbErr)
? "myclass4 shared class vars:", str( __CLS_CNTSHRDATA(o:classH), 3), "  => should be:   3"
?

? "instance variables ["+ltrim(str(len(o)))+"]:"; ?
for i:=1 to len(o); ?? "",o[i]; next
? " => shoule be [0]:"
?
? "[1] MYCLASS1 VARS:", o:myclass1:x1, o:myclass1:y1, o:myclass1:z1, "  => should be: (x1) (y1) (z1)"
? "[2] MYCLASS1 VARS:", o:myclass2:x1, o:myclass2:y1, o:myclass2:z1, "  => should be: (x1) (y1) (z1)"
? "[2] MYCLASS2 VARS:", o:myclass2:x2, o:myclass2:y2, o:myclass2:z2, "  => should be: (x2) (y2) (z2)"
? "[3] MYCLASS1 VARS:", o:myclass3:x1, o:myclass3:y1, o:myclass3:z1, "  => should be: (x1) (y1) (z1)"
? "[3] MYCLASS2 VARS:", o:myclass3:x2, o:myclass3:y2, o:myclass3:z2, "  => should be: (x2) (y2) (z2)"
? "[3] MYCLASS3 VARS:", o:myclass3:x3, o:myclass3:y3, o:myclass3:z3, "  => should be: (x3) (y3) (z3)"
cbErr := errorBlock( {| oErr | break( oErr ) } )
begin sequence
   ? "[4] MYCLASS1 VARS:", o:myclass4:x1, o:myclass4:y1, o:myclass4:z1, "  => should be: (x1) (y1) (z1)"
   ? "[4] MYCLASS2 VARS:", o:myclass4:x2, o:myclass4:y2, o:myclass4:z2, "  => should be: (x2) (y2) (z2)"
   ? "[4] MYCLASS3 VARS:", o:myclass4:x3, o:myclass4:y3, o:myclass4:z3, "  => should be: (x3) (y3) (z3)"
   ? "[4] MYCLASS4 VARS:", o:myclass4:x4, o:myclass4:y4, o:myclass4:z4, "  => should be: (x4) (y4) (z4)"
recover
   ? "ERROR: no selfclass casting"
end
errorBlock(cbErr)
? "    MYCLASS1 VARS:", o:x1, o:y1, o:z1, "  => should be: (x1) (y1) (z1)"
? "    MYCLASS2 VARS:", o:x2, o:y2, o:z2, "  => should be: (x2) (y2) (z2)"
? "    MYCLASS3 VARS:", o:x3, o:y3, o:z3, "  => should be: (x3) (y3) (z3)"
? "    MYCLASS4 VARS:", o:x4, o:y4, o:z4, "  => should be: (x4) (y4) (z4)"
?
? "initialization..."
o:x1:=" X1 "; o:y1:=" Y1 "; o:z1:=" Z1 "
o:x2:=" X2 "; o:y2:=" Y2 "; o:z2:=" Z2 "
o:x3:=" X3 "; o:y3:=" Y3 "; o:z3:=" Z3 "
o:x4:=" X4 "; o:y4:=" Y4 "; o:z4:=" Z4 "

? "[1] MYCLASS1 VARS:", o:myclass1:x1, o:myclass1:y1, o:myclass1:z1, "  => should be:  X1   Y1   Z1"
? "[2] MYCLASS1 VARS:", o:myclass2:x1, o:myclass2:y1, o:myclass2:z1, "  => should be:  X1   Y1   Z1"
? "[2] MYCLASS2 VARS:", o:myclass2:x2, o:myclass2:y2, o:myclass2:z2, "  => should be:  X2   Y2   Z2"
? "[3] MYCLASS1 VARS:", o:myclass3:x1, o:myclass3:y1, o:myclass3:z1, "  => should be:  X1   Y1   Z1"
? "[3] MYCLASS2 VARS:", o:myclass3:x2, o:myclass3:y2, o:myclass3:z2, "  => should be:  X2   Y2   Z2"
? "[3] MYCLASS3 VARS:", o:myclass3:x3, o:myclass3:y3, o:myclass3:z3, "  => should be:  X3   Y3   Z3"
cbErr := errorBlock( {| oErr | break( oErr ) } )
begin sequence
   ? "[4] MYCLASS1 VARS:", o:myclass4:x1, o:myclass4:y1, o:myclass4:z1, "  => should be:  X1   Y1   Z1"
   ? "[4] MYCLASS2 VARS:", o:myclass4:x2, o:myclass4:y2, o:myclass4:z2, "  => should be:  X2   Y2   Z2"
   ? "[4] MYCLASS3 VARS:", o:myclass4:x3, o:myclass4:y3, o:myclass4:z3, "  => should be:  X3   Y3   Z3"
   ? "[4] MYCLASS4 VARS:", o:myclass4:x4, o:myclass4:y4, o:myclass4:z4, "  => should be:  X4   Y4   Z4"
recover
   ? "ERROR: no selfclass casting"
end
errorBlock(cbErr)
? "    MYCLASS1 VARS:", o:x1, o:y1, o:z1, "  => should be:  X1   Y1   Z1"
? "    MYCLASS2 VARS:", o:x2, o:y2, o:z2, "  => should be:  X2   Y2   Z2"
? "    MYCLASS3 VARS:", o:x3, o:y3, o:z3, "  => should be:  X3   Y3   Z3"
? "    MYCLASS4 VARS:", o:x4, o:y4, o:z4, "  => should be:  X4   Y4   Z4"
?

? "instance variables ["+ltrim(str(len(o)))+"]:"; ?
for i:=1 to len(o); ?? "",o[i]; next
? " => shoule be [0]:"
?

? "Setting MYCLASS1 class variables..."
o:myclass1:x1:="[X1]"
o:myclass1:y1:="[Y1]"
o:myclass1:z1:="[Z1]"
? "[1] MYCLASS1 VARS:", o:myclass1:x1, o:myclass1:y1, o:myclass1:z1, "  => should be: [X1] [Y1] [Z1]"
? "[2] MYCLASS1 VARS:", o:myclass2:x1, o:myclass2:y1, o:myclass2:z1, "  => should be: [X1] [Y1] [Z1]"
? "[2] MYCLASS2 VARS:", o:myclass2:x2, o:myclass2:y2, o:myclass2:z2, "  => should be:  X2   Y2   Z2"
? "[3] MYCLASS1 VARS:", o:myclass3:x1, o:myclass3:y1, o:myclass3:z1, "  => should be: [X1] [Y1] [Z1]"
? "[3] MYCLASS2 VARS:", o:myclass3:x2, o:myclass3:y2, o:myclass3:z2, "  => should be:  X2   Y2   Z2"
? "[3] MYCLASS3 VARS:", o:myclass3:x3, o:myclass3:y3, o:myclass3:z3, "  => should be:  X3   Y3   Z3"
cbErr := errorBlock( {| oErr | break( oErr ) } )
begin sequence
   ? "[4] MYCLASS1 VARS:", o:myclass4:x1, o:myclass4:y1, o:myclass4:z1, "  => should be: [X1] [Y1] [Z1]"
   ? "[4] MYCLASS2 VARS:", o:myclass4:x2, o:myclass4:y2, o:myclass4:z2, "  => should be:  X2   Y2   Z2"
   ? "[4] MYCLASS3 VARS:", o:myclass4:x3, o:myclass4:y3, o:myclass4:z3, "  => should be:  X3   Y3   Z3"
   ? "[4] MYCLASS4 VARS:", o:myclass4:x4, o:myclass4:y4, o:myclass4:z4, "  => should be:  X4   Y4   Z4"
recover
   ? "ERROR: no selfclass casting"
end
errorBlock(cbErr)
? "    MYCLASS1 VARS:", o:x1, o:y1, o:z1, "  => should be: [X1] [Y1] [Z1]"
? "    MYCLASS2 VARS:", o:x2, o:y2, o:z2, "  => should be:  X2   Y2   Z2"
? "    MYCLASS3 VARS:", o:x3, o:y3, o:z3, "  => should be:  X3   Y3   Z3"
? "    MYCLASS4 VARS:", o:x4, o:y4, o:z4, "  => should be:  X4   Y4   Z4"
?

? "Setting MYCLASS2 class variables..."
o:myclass2:x1:="{X1}"
o:myclass2:y1:="{Y1}"
o:myclass2:z1:="{Z1}"
o:myclass2:x2:="{X2}"
o:myclass2:y2:="{Y2}"
o:myclass2:z2:="{Z2}"
? "[1] MYCLASS1 VARS:", o:myclass1:x1, o:myclass1:y1, o:myclass1:z1, "  => should be: {X1} {Y1} {Z1}"
? "[2] MYCLASS1 VARS:", o:myclass2:x1, o:myclass2:y1, o:myclass2:z1, "  => should be: {X1} {Y1} {Z1}"
? "[2] MYCLASS2 VARS:", o:myclass2:x2, o:myclass2:y2, o:myclass2:z2, "  => should be: {X2} {Y2} {Z2}"
? "[3] MYCLASS1 VARS:", o:myclass3:x1, o:myclass3:y1, o:myclass3:z1, "  => should be: {X1} {Y1} {Z1}"
? "[3] MYCLASS2 VARS:", o:myclass3:x2, o:myclass3:y2, o:myclass3:z2, "  => should be: {X2} {Y2} {Z2}"
? "[3] MYCLASS3 VARS:", o:myclass3:x3, o:myclass3:y3, o:myclass3:z3, "  => should be:  X3   Y3   Z3"
cbErr := errorBlock( {| oErr | break( oErr ) } )
begin sequence
   ? "[4] MYCLASS1 VARS:", o:myclass4:x1, o:myclass4:y1, o:myclass4:z1, "  => should be: {X1} {Y1} {Z1}"
   ? "[4] MYCLASS2 VARS:", o:myclass4:x2, o:myclass4:y2, o:myclass4:z2, "  => should be: {X2} {Y2} {Z2}"
   ? "[4] MYCLASS3 VARS:", o:myclass4:x3, o:myclass4:y3, o:myclass4:z3, "  => should be:  X3   Y3   Z3"
   ? "[4] MYCLASS4 VARS:", o:myclass4:x4, o:myclass4:y4, o:myclass4:z4, "  => should be:  X4   Y4   Z4"
recover
   ? "ERROR: no selfclass casting"
end
errorBlock(cbErr)
? "    MYCLASS1 VARS:", o:x1, o:y1, o:z1, "  => should be: {X1} {Y1} {Z1}"
? "    MYCLASS2 VARS:", o:x2, o:y2, o:z2, "  => should be: {X2} {Y2} {Z2}"
? "    MYCLASS3 VARS:", o:x3, o:y3, o:z3, "  => should be:  X3   Y3   Z3"
? "    MYCLASS4 VARS:", o:x4, o:y4, o:z4, "  => should be:  X4   Y4   Z4"
?

? "Setting MYCLASS3 class variables..."
o:myclass3:x1:="<X1>"
o:myclass3:y1:="<Y1>"
o:myclass3:z1:="<Z1>"
o:myclass3:x2:="<X2>"
o:myclass3:y2:="<Y2>"
o:myclass3:z2:="<Z2>"
o:myclass3:x3:="<X3>"
o:myclass3:y3:="<Y3>"
o:myclass3:z3:="<Z3>"
? "[1] MYCLASS1 VARS:", o:myclass1:x1, o:myclass1:y1, o:myclass1:z1, "  => should be: <X1> <Y1> <Z1>"
? "[2] MYCLASS1 VARS:", o:myclass2:x1, o:myclass2:y1, o:myclass2:z1, "  => should be: <X1> <Y1> <Z1>"
? "[2] MYCLASS2 VARS:", o:myclass2:x2, o:myclass2:y2, o:myclass2:z2, "  => should be: <X2> <Y2> <Z2>"


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour test program: tests/checkbox.prg. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
PROCEDURE Main()

   LOCAL GetList := {}

   LOCAL cItem := "Windows"
   LOCAL lx := .F.
   LOCAL ly := .F.

   LOCAL aItems[ 3 ]

   aItems[ 1 ] := RadioButto( 3, 3, "&Windows" )
   aItems[ 2 ] := RadioButto( 4, 3, "&Linux" )
   aItems[ 3 ] := RadioButto( 5, 3, "&OS X" )

   CLS
   SetColor( "W/B+,R/B,G+/R,B+/R+,BG/N+,W/BG,RB/BG" )

   @  2,  2, 6, 40 GET cItem RADIOGROUP aItems COLOR "W/B+,R/B,G/B+" MESSAGE "Select your OS"

   @  8,  3 SAY "Married"
   @  8, 12 GET lx CHECKBOX COLOR "W/B+,W/B,W+/R,W/G+" MESSAGE "Are you married?"
   @  9,  3 SAY "Singer"
   @  9, 12 GET ly CHECKBOX COLOR "W/B+,W/B,W+/R,W/G+" MESSAGE "Are you a singer?"

   READ MSG AT MaxRow(), 0, MaxCol() MSG COLOR "W/B+"

   ? "Is the person married:", iif( lx, "Yes", "No" )
   ? "Is the person a singer:", iif( ly, "Yes", "No" )
   ? "Your OS is", cItem

   RETURN


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Write a Harbour program with procedures: Main. Harbour test program: tests/hrb.prg. Provides functions: Msg. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#include "hbhrb.ch"

PROCEDURE Main( n )

   LOCAL pHrb
   LOCAL cExe := "Msg2()"

   n := iif( n == NIL, 0, Val( n ) )

   IF ! hb_FileExists( "hrbext.hrb" )
      hb_run( "harbour hrbext.prg -gh" )
   ENDIF

   ? "calling Msg ... From exe here !"
   Msg()
   ? "========================="

   ? "Loading( " + iif( n == 0, "HB_HRB_BIND_DEFAULT", iif( n == 1, "HB_HRB_BIND_LOCAL", "HB_HRB_BIND_OVERLOAD" ) ) + ", 'hrbext.hrb' )"
   pHrb := hb_hrbLoad( n, "hrbext.hrb" )

   ? "========================="

   ? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, OVERLOAD=From hrb"
   Msg()
   ? "========================="

   ? "calling Msg ... DEFAULT=From exe, LOCAL=From hrb, OVERLOAD=From hrb"
   &cExe
   ? "========================="

   hb_hrbUnload( pHrb )

   ? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, OVERLOAD=From hrb"
   Msg()
   ? "========================="

   ? "END"

   RETURN

FUNCTION Msg()

   ? "Function called from .exe"

   RETURN .T.


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User]
Here is a Harbour (xBase/Clipper) implementation:

Harbour contribution module 'xhb' (Extended Harbour functions): contrib/xhb/htjlist.prg. Defines classes: TJSList. This file provides legacy compatibility functions

[Assistant]
#include "hbclass.ch"
#include "cgi.ch"

CREATE CLASS TJSList

   VAR nH INIT STD_OUT
   VAR aScript INIT {}
   VAR aItems INIT {}
   VAR cScript INIT ""
   VAR nTimes INIT 0
   VAR nItems INIT 0
   VAR cMainNode INIT ""
   VAR cCurrentNode INIT ""
   VAR Style INIT _WHITE_BLACK_STYLE
   VAR FONT INIT "Verdana"
   VAR Size INIT 2
   VAR BGCOLOR INIT "white"
   VAR FontColor INIT "black"

   METHOD New( name, lOpen, width, height, bgColor, ;
      FONT, fntColor, fntSize, cMinusImg, cPlusImg )
   METHOD NewNode( name, lOpen, width, height, bgColor )
   METHOD SetFont( name, font, fntColor, fntSize )
   METHOD AddItem( name, url, bgColor )
   METHOD AddLink( name, url, img, bgColor )
   METHOD EndNode( name, caption )
   METHOD Build( xPos, yPos )
   METHOD Put( cFile )

ENDCLASS

METHOD New( name, lOpen, width, height, bgColor, ;
      FONT, fntColor, fntSize, cMinusImg, cPlusImg ) CLASS TJSList

   LOCAL cStr

   __defaultNIL( @name, "l" )
   __defaultNIL( @lOpen, .F. )
   __defaultNIL( @WIDTH, 200 )
   __defaultNIL( @HEIGHT, 22 )
   __defaultNIL( @BGCOLOR, "white" )
   __defaultNIL( @FONT, "Verdana" )
   __defaultNIL( @fntColor, "black" )
   __defaultNIL( @fntSize, 2 )
   __defaultNIL( @cMinusImg, "minus.gif" )
   __defaultNIL( @cPlusImg, "plus.gif" )

   ::font      := FONT
   ::size      := fntSize
   ::fontColor := fntColor
   ::bgColor   := BGCOLOR

   ::nItems  := 0
   ::aSCript := {}

   cStr := "" + CRLF() + "" + CRLF() + ;
      "" + CRLF() + ;
      '' + CRLF() + ;
      CRLF() + ;
      '' + CRLF() + ;
      CRLF() + ;
      '" + CRLF()
   cStr += '" + CRLF()
   cStr += '" + CRLF()

   AAdd( ::aScript, cStr )
   cStr := ""

   cStr += "<title>Collapsable Lists: Basic Example</title>" + CRLF()
   cStr += "" + CRLF()
   cStr += '' + CRLF()
   cStr += '

' + CRLF()

   FOR i := 0 TO ::nItems
      cStr += '

' + CRLF()
   NEXT
   cStr += "" + CRLF()

   AAdd( ::aScript, cStr )

   RETURN Self

METHOD Put( cFile ) CLASS TJSList

   IF cFile == NIL
      ::nH := STD_OUT
   ELSE
      ::nH := FCreate( cFile )
   ENDIF

   AEval( ::aScript, {| e | FWrite( ::nH, e ) } )

   FClose( ::nH )

   RETURN Self


[System] You are an expert Harbour (xBase/Clipper) programmer. Write clean, efficient code following Harbour conventions. Use proper Hungarian notation for variable names (c=character, n=numeric, l=logical, a=array, o=object, b=codeblock).

[User] Create Harbour OOP classes for the functionality described: Harbour test program: tests/clsnv.prg. Defines classes: myclass1, myclass2, myclass3. Contains procedures: Main. This test file tests specific function APIs

[Assistant]
#xtranslate QQOut([<x,...>]) => [OutStd(<x>)]
#xtranslate QOut([<x,...>]) => OutStd(hb_eol())[;OutStd(<x>)]

#include "hbclass.ch"

PROCEDURE Main()

   LOCAL o := myclass3():new()

   ? Date(), Time(), Version(), OS()
   ?

   o:m1()
   o:m2()
   o:m3()

   RETURN

CREATE CLASS myclass1
   hidden:
   var a init "(a1)"

   class var b init "(b1)"

   METHOD x
   protected:
   var c init "(c1)"
   class var d init "(d1)"
   METHOD y
   exported:
   var e init "(e1)"
   class var f init "(f1)"
   METHOD z
   METHOD m1

ENDCLASS

METHOD m1

   ? "Method: MYCLASS1:M1()"
   ? "   a =>", ::a, ",  should be: (a1)"
   ? "   b =>", ::b, ",  should be: (b1)"
   ? "   c =>", ::c, ",  should be: (c3)"
   ? "   d =>", ::d, ",  should be: (d3)"
   ? "   e =>", ::e, ",  should be: (e3)"
   ? "   f =>", ::f, ",  should be: (f3)"
   ? "   execute ::x(),  should be: MYCLASS1:X()"
   ::x()
   ? "   execute ::y(),  should be: MYCLASS3:Y()"
   ::y()
   ? "   execute ::z(),  should be: MYCLASS3:Z()"
   ::z()

   RETURN Self

METHOD x

   ? "   Method: MYCLASS1:X()"
   ? "      a =>", ::a, ",  should be: (a1)"
   ? "      b =>", ::b, ",  should be: (b1)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD y

   ? "   Method: MYCLASS1:Y()"
   ? "      a =>", ::a, ",  should be: (a1)"
   ? "      b =>", ::b, ",  should be: (b1)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD z

   ? "   Method: MYCLASS1:Z()"
   ? "      a =>", ::a, ",  should be: (a1)"
   ? "      b =>", ::b, ",  should be: (b1)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

   CREATE CLASS myclass2
   hidden:
   var a init "(a2)"

CLASS var b init "(b2)"

   METHOD x
   protected:
   var c init "(c2)"
   CLASS var d init "(d2)"
   METHOD y
   exported:
   var e init "(e2)"
   CLASS var f init "(f2)"
   METHOD z
   METHOD m2

ENDCLASS

METHOD m2

   ? "Method: MYCLASS2:M2()"
   ? "   a =>", ::a, ",  should be: (a2)"
   ? "   b =>", ::b, ",  should be: (b2)"
   ? "   c =>", ::c, ",  should be: (c3)"
   ? "   d =>", ::d, ",  should be: (d3)"
   ? "   e =>", ::e, ",  should be: (e3)"
   ? "   f =>", ::f, ",  should be: (f3)"
   ? "   execute ::x(),  should be: MYCLASS2:X()"
   ::x()
   ? "   execute ::y(),  should be: MYCLASS3:Y()"
   ::y()
   ? "   execute ::z(),  should be: MYCLASS3:Z()"
   ::z()

   RETURN Self

METHOD x

   ? "   Method: MYCLASS2:X()"
   ? "      a =>", ::a, ",  should be: (a2)"
   ? "      b =>", ::b, ",  should be: (b2)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD y

   ? "   Method: MYCLASS2:Y()"
   ? "      a =>", ::a, ",  should be: (a2)"
   ? "      b =>", ::b, ",  should be: (b2)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD z

   ? "   Method: MYCLASS2:Z()"
   ? "      a =>", ::a, ",  should be: (a2)"
   ? "      b =>", ::b, ",  should be: (b2)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

CREATE CLASS myclass3 FROM myclass1, myclass2
   hidden:
   var a init "(a3)"

   class var b init "(b3)"

   METHOD x
   protected:
   var c init "(c3)"
   class var d init "(d3)"
   METHOD y
   exported:
   var e init "(e3)"
   class var f init "(f3)"
   METHOD z
   METHOD m3

ENDCLASS

METHOD m3

   ? "Method: MYCLASS3:M3()"
   ? "   a =>", ::a, ",  should be: (a3)"
   ? "   b =>", ::b, ",  should be: (b3)"
   ? "   c =>", ::c, ",  should be: (c3)"
   ? "   d =>", ::d, ",  should be: (d3)"
   ? "   e =>", ::e, ",  should be: (e3)"
   ? "   f =>", ::f, ",  should be: (f3)"
   ? "   execute ::x(),  should be: MYCLASS3:X()"
   ::x()
   ? "   execute ::y(),  should be: MYCLASS3:Y()"
   ::y()
   ? "   execute ::z(),  should be: MYCLASS3:Z()"
   ::z()

   RETURN Self

METHOD x

   ? "   Method: MYCLASS3:X()"
   ? "      a =>", ::a, ",  should be: (a3)"
   ? "      b =>", ::b, ",  should be: (b3)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD y

   ? "   Method: MYCLASS3:Y()"
   ? "      a =>", ::a, ",  should be: (a3)"
   ? "      b =>", ::b, ",  should be: (b3)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self

METHOD z

   ? "   Method: MYCLASS3:Z()"
   ? "      a =>", ::a, ",  should be: (a3)"
   ? "      b =>", ::b, ",  should be: (b3)"
   ? "      c =>", ::c, ",  should be: (c3)"
   ? "      d =>", ::d, ",  should be: (d3)"
   ? "      e =>", ::e, ",  should be: (e3)"
   ? "      f =>", ::f, ",  should be: (f3)"

   RETURN Self