Replacement of FoxBASE+/FoxPro sys(15,...) needed 
Author Message
 Replacement of FoxBASE+/FoxPro sys(15,...) needed


>Hi all,

>does anybody have the ASM/C function replacing the SYS(15, ... ) function
>of FoxBase+/FoxPro? It's easy to write it in Clipper, but it runs too
>slow for index expression.


>Jan Bucek
>Czech Republic, Europe

>Snippet of FoxPro Help:

>SYS(15, <expC1>, <expC2>)

>Translates second character string by first character string.
>Return value - Character string

>This function  is primarily intended  for the convenience  of European users
>who  must use  letters with   diacritical marks.  Since there  are different
>versions  of most  vowels (with  different diacritical  marks), indexing  on
>fields  containing  such  characters  doesn't  preserve  normal alphabetical

>This function takes  each character in the character  expression <expC2> and
>uses the character's numeric value as a subscript into the table <expC1> and
>replaces the character in <expC2> with  the character found at that position
>in the table.

>If table <expC1> doesn't have a  character corresponding to a character from
><expC2>, those characters in <expC2> aren't translated.

Try C function below. Since I wrote by heart and  test only for
successfully compilation please test for the accuracy.

Beside that you can add parameter validation etc - however it
sacrifices speed which could be very valuable in indexing process.


#include <extend.api>
#include <fm.api>

// Define to make easier reading
#define cTable          _parc(1)
#define cSource         _parc(2)

CLIPPER SYS15( void )
        unsigned int i , iTableLen , iStringLen ;
        char * cReturn ;

        // Parameter's length
        iTableLen  = _parclen(1);
        iStringLen = _parclen(2);

        // Allocate memory for return value - since we will use
        // _retclen we don't need to reserve 1 byte string
        // termination
        cReturn = _xalloc( iStringLen + 1 );

        // Translate
        for ( i = 0 ; i < iStringLen ; i++)
                if ( ( (unsigned int) cSource[i] ) <= iTableLen )
                        cReturn[i] = cTable[ cSource[i] - 1 ];
                        cReturn[i] = cSource[i] ;

        // Post Clipper return value
        _retclen( cReturn , iStringLen );

        // WARNING : don't forget to free memory
        _xfree( cReturn );



Bambang P
Semarang 50144
Central Java

Author of:
 FBrowse  - General browser class for Force Language
 MakForce - Powerful and Intuitive Make utility for almost any language
 < http://www.*-*-*.com/ ;

E-mail: bpranoto at indosat dot net dot id

Sat, 12 May 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Rewriting old dBase II - III, Foxbase, Foxpro programs to Foxpro 2.6 for Windows and VFP

2. Combine databases COBOL/FOXPRO/FOXBASE/BASIC/CLIPPER/DBASE/SQL/GUPTA etc with Impromptu 3.0

3. a foxbase+ question

4. VB / Visual Foxbase / Clarion

5. FoxBase and Clipper Index compatibility

6. form like foxbase

7. ANNOUNCE: pygtk-1.99.15, pyorbit-1.99.3, gnome-python-1.99.15

8. Reuse News - Week Ending: December 15, 1995 - 95-12-15.txt [1/1]

9. Failed file.test 15-4 through 15-8 on SCO Xenix 2.3.4

10. Needed: TCL/TK programmer for 15 minutes...

11. Reading Foxpro Memo Fields using Foxpro driver

12. VSW: Need good text pane replacement


Powered by phpBB® Forum Software