Diff
Not logged in

Differences From Artifact [384a26efe9]:

To Artifact [308dcb7710]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tclUtf.c --
 *
 *	Routines for manipulating UTF-8 strings.
 *
 * Copyright (c) 1997-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUtf.c,v 1.25 2002/05/29 10:35:46 dkf Exp $
 */

#include "tclInt.h"

/*
 * Include the static character classification tables and macros.
 */










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tclUtf.c --
 *
 *	Routines for manipulating UTF-8 strings.
 *
 * Copyright (c) 1997-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUtf.c,v 1.26 2002/05/30 03:27:09 hobbs Exp $
 */

#include "tclInt.h"

/*
 * Include the static character classification tables and macros.
 */
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377

int
Tcl_UniCharNcmp(cs, ct, n)
    CONST Tcl_UniChar *cs;		/* Unicode string to compare to ct. */
    CONST Tcl_UniChar *ct;		/* Unicode string cs is compared to. */
    unsigned long n;			/* Number of unichars to compare. */
{
#ifdef TCL_OPTIMIZE_UNICODE_COMPARE
    /*
     * We are definitely on a big-endian machine; memcmp() is safe
     */
    return memcmp(cs, ct, n*sizeof(Tcl_UniChar));

#else /* !TCL_OPTIMIZE_UNICODE_COMPARE */
    /*
     * We can't simply call memcmp() because that is not lexically correct.
     */
    for ( ; n != 0; cs++, ct++, n--) {
	if (*cs != *ct) {
	    return (*cs - *ct);
	}
    }
    return 0;
#endif /* TCL_OPTIMIZE_UNICODE_COMPARE */
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_UniCharNcasecmp --
 *







|





|









|







1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377

int
Tcl_UniCharNcmp(cs, ct, n)
    CONST Tcl_UniChar *cs;		/* Unicode string to compare to ct. */
    CONST Tcl_UniChar *ct;		/* Unicode string cs is compared to. */
    unsigned long n;			/* Number of unichars to compare. */
{
#ifdef WORDS_BIGENDIAN
    /*
     * We are definitely on a big-endian machine; memcmp() is safe
     */
    return memcmp(cs, ct, n*sizeof(Tcl_UniChar));

#else /* !WORDS_BIGENDIAN */
    /*
     * We can't simply call memcmp() because that is not lexically correct.
     */
    for ( ; n != 0; cs++, ct++, n--) {
	if (*cs != *ct) {
	    return (*cs - *ct);
	}
    }
    return 0;
#endif /* WORDS_BIGENDIAN */
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_UniCharNcasecmp --
 *