2015-10-21 19:26 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbfoxpro/hbfoxpro.hbx
  * contrib/hbfoxpro/occurs.prg
    + added FoxPro compatible At() function with 3-rd <nOccurrence>
      parameter:
            fox_At( <cSubstr>, <cString>, <nOccurrence> ) -> <nPos>

  * contrib/hbfoxpro/hbfoxpro.ch
    + added PP rule for At() with FoxPro like 3 parameters,
      please remember that such At() extension is not compatible with
      xHarbour one so do not include hbcompat.ch or xhb.ch - they
      redefines At() with 3 or more parameters to xHarbour compatible
      function: hb_At()
This commit is contained in:
Przemysław Czerpak
2015-10-21 19:26:38 +02:00
parent 1eeec758f6
commit b66470b9a5
4 changed files with 29 additions and 1 deletions

View File

@@ -10,6 +10,20 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2015-10-21 19:26 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbfoxpro/hbfoxpro.hbx
* contrib/hbfoxpro/occurs.prg
+ added FoxPro compatible At() function with 3-rd <nOccurrence>
parameter:
fox_At( <cSubstr>, <cString>, <nOccurrence> ) -> <nPos>
* contrib/hbfoxpro/hbfoxpro.ch
+ added PP rule for At() with FoxPro like 3 parameters,
please remember that such At() extension is not compatible with
xHarbour one so do not include hbcompat.ch or xhb.ch - they
redefines At() with 3 or more parameters to xHarbour compatible
function: hb_At()
2015-10-20 15:55 UTC+0200 Aleksander Czajczynski (hb fki.pl)
* src/rtl/hbsocket.c
! enable socket type translation for Linux/MIPS, enum order is different

View File

@@ -106,6 +106,7 @@
#xtranslate USED( <wa> ) => __fox_Used( <wa> )
#xtranslate At( <sub>, <str>, <occur> ) => fox_At( <sub>, <str>, <occur> )
/* other commands */
#command SCAN [FOR <for>] [WHILE <while>] [NEXT <next>] ;

View File

@@ -23,6 +23,7 @@
DYNAMIC AElement
DYNAMIC Filter
DYNAMIC fox_At
DYNAMIC fox___DynCall
DYNAMIC FSize
DYNAMIC InsMode

View File

@@ -1,6 +1,6 @@
/*
* Harbour Project source code:
* FoxPro compatible Occurs() function
* FoxPro compatible Occurs() and At() functions
*
* Copyright 2014 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://harbour-project.org
@@ -56,3 +56,15 @@ FUNCTION Occurs( cSub, cStr )
ENDIF
RETURN nCount
FUNCTION fox_At( cSub, cStr, nOccurrence )
LOCAL nPos := 0
IF HB_ISSTRING( cSub ) .AND. HB_ISSTRING( cStr )
hb_default( @nOccurrence, 1 )
DO WHILE --nOccurrence >= 0 .AND. ( nPos := hb_At( cSub, cStr, nPos + 1 ) ) != 0
ENDDO
ENDIF
RETURN nPos