Hello,
This is a reduced sample that shows a bug in a Index that uses Descend()

REQUEST DBFCDX
REQUEST DESCEND
REQUEST HB_CODEPAGE_ETWIN

PROCEDURE Main()

    rddsetdefault('DBFCDX')
    hb_setcodepage('ETWIN')

    dbCreate("temp",{{"NUM","C",3,0}})

    USE temp INDEX temp

    INDEX ON num          TAG NUM
    INDEX ON Descend(num) TAG DESC_NUM

    APPEND BLANK ; REPLACE num WITH '0'
    APPEND BLANK ; REPLACE num WITH '1'
    APPEND BLANK ; REPLACE num WITH '10'
    APPEND BLANK ; REPLACE num WITH '100'
    APPEND BLANK ; REPLACE num WITH '150'
    APPEND BLANK ; REPLACE num WITH '200'

    USE

    ? 'Ordered by NUM'
    USE temp INDEX temp
    SET ORDER TO TAG NUM
    GO TOP
    WHILE !Eof()
       ? temp->num
       SKIP
    ENDDO
    USE

    ?
    ? 'Ordered by descend(NUM)'
    USE temp INDEX temp
    SET ORDER TO TAG DESC_NUM
    GO TOP
    WHILE !Eof()
       ? temp->num
       SKIP
    ENDDO
    USE

    ?
    WAIT

RETURN

//------------------------



File : cpetwin.c
//--------------------------
#include <ctype.h>
#include "hbapi.h"
#include "hbapicdp.h"

#define NUMBER_OF_CHARACTERS  32    /* The number of single characters in
the
                                       alphabet, two-as-one aren't
considered
                                       here, accented - are considered. */
#define IS_LATIN               1    /* Should be 1, if the national alphabet
                                       is based on Latin */
#define ACCENTED_EQUAL         0    /* Should be 1, if accented character
                                       has the same weight as appropriate
                                       unaccented. */
#define ACCENTED_INTERLEAVED   0    /* Should be 1, if accented characters
                                       sort after their unaccented
counterparts
                                       only if the unaccented versions of
all
                                       characters being compared are the
same
                                       ( interleaving ) */

/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the
   accented characters with the symbol '~' before each of them, for example:
      a~€
   If there is two-character sequence, which is considered as one, it should
   be marked with '.' before and after it, for example:
      ... h.ch.i ...

   The Upper case string and the Lower case string should be absolutely the
   same excepting the characters case, of course.
 */

static HB_CODEPAGE s_codepage = { "ETWIN",
    CPID_1257,UNITB_1257,NUMBER_OF_CHARACTERS,
    "ABCDEFGHIJKLMNOPQRSÐZÞTUVWÕÄÖÜXY",
    "abcdefghijklmnopqrsðzþtuvwõäöüxy",
    IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL,
NULL, 0, NULL };
//    "ABCDEFGHIJKLMNOPQRSŠZŽTUVWÕÄÖÜXY",
//    "abcdefghijklmnopqrsšzžtuvwõäöüxy",

/* Windows-1250 : Š Ž š ž
   Windows-1257 : Ð Þ ð þ
*/

HB_CODEPAGE_ANNOUNCE( ETWIN );

HB_CALL_ON_STARTUP_BEGIN( hb_codepage_Init_ETWIN )
   hb_cdpRegister( &s_codepage );
HB_CALL_ON_STARTUP_END( hb_codepage_Init_ETWIN )

#if defined(HB_PRAGMA_STARTUP)
   #pragma startup hb_codepage_Init_ETWIN
#elif defined(HB_MSC_STARTUP)
   #if _MSC_VER >= 1010
      #pragma data_seg( ".CRT$XIY" )
      #pragma comment( linker, "/Merge:.CRT=.data" )
   #else
      #pragma data_seg( "XIY" )
   #endif
   static HB_$INITSYM hb_vm_auto_hb_codepage_Init_ETWIN =
hb_codepage_Init_ETWIN;
   #pragma data_seg()
#endif

//----------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to