File: unicode.h

package info (click to toggle)
wine 0.0.20000109-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 22,652 kB
  • ctags: 59,973
  • sloc: ansic: 342,054; perl: 3,697; yacc: 3,059; tcl: 2,647; makefile: 2,466; lex: 1,494; sh: 394
file content (63 lines) | stat: -rw-r--r-- 1,368 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Unicode routines for use inside the server
 *
 * Copyright (C) 1999 Alexandre Julliard
 */

#ifndef __WINE_SERVER_UNICODE_H
#define __WINE_SERVER_UNICODE_H

#ifndef __WINE_SERVER__
#error This file can only be used in the Wine server
#endif

#include "config.h"

#include <ctype.h>
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#endif

#include "windef.h"
#include "object.h"

static inline size_t strlenW( const WCHAR *str )
{
    const WCHAR *s = str;
    while (*s) s++;
    return s - str;
}

static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 ) 
{
    while (*str1 && (*str1 == *str2)) { str1++; str2++; }
    return *str1 - *str2;
}

#ifndef HAVE_WCTYPE_H
/* FIXME */
#define towupper(ch) (HIBYTE(ch) ? ch : (WCHAR)toupper(LOBYTE(ch)))
#endif

static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 ) 
{
    while (*str1 && (towupper(*str1) == towupper(*str2))) { str1++; str2++; }
    return towupper(*str1) - towupper(*str2);
}

static inline WCHAR *strcpyW( WCHAR *src, const WCHAR *dst ) 
{
    const WCHAR *ret = dst;
    while ((*src++ = *dst++));
    return (WCHAR *)ret;
}

static inline WCHAR *strdupW( const WCHAR *str )
{
    size_t len = (strlenW(str) + 1) * sizeof(WCHAR);
    return memdup( str, len );
}

extern int dump_strW( const WCHAR *str, size_t len, FILE *f, char escape[2] );

#endif  /* __WINE_SERVER_UNICODE_H */