File: unicode.h

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (151 lines) | stat: -rw-r--r-- 4,432 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef AGS_LIB_ALLEGRO_UNICODE_H
#define AGS_LIB_ALLEGRO_UNICODE_H

#include "ags/lib/allegro/base.h"

namespace AGS3 {

#define U_ASCII         AL_ID('A','S','C','8')
#define U_ASCII_CP      AL_ID('A','S','C','P')
#define U_UNICODE       AL_ID('U','N','I','C')
#define U_UTF8          AL_ID('U','T','F','8')
#define U_CURRENT       AL_ID('c','u','r','.')


/* UTF-8 support functions
 */
extern int utf8_getc(const char *s);
extern int utf8_getx(char **s);
extern int utf8_setc(char *s, int c);
extern int utf8_width(const char *s);
extern int utf8_cwidth(int c);
extern int utf8_isok(int c);

/**
 * ASCII support functions
 */
extern int ascii_getc(const char *s);
extern int ascii_getx(char **s);
extern int ascii_setc(char *s, int c);
extern int ascii_width(const char *s);
extern int ascii_cwidth(int c);
extern int ascii_isok(int c);

/* ugetc: */
extern int (*ugetc)(const char *s);
/* ugetxc: */
extern int (*ugetx)(char **s);
/* ugetxc: */
extern int (*ugetxc)(const char * const *s);
/* usetc: */
extern int (*usetc)(char *s, int c);
/* uwidth: */
extern int (*uwidth)(const char *s);
/* ucwidth: */
extern int (*ucwidth)(int c);
/* uisok: */
extern int (*uisok)(int c);

/* set_uformat:
 *  Selects a new text encoding format.
 */
extern void set_uformat(int type);

enum { LC_CTYPE };
extern const char *setlocale(int type, const char *language);

/* get_uformat:
 *  Returns the current text encoding format.
 */
extern int get_uformat();
extern size_t ustrsize(const char *s);
/* &nicode string length
 */
extern int ustrlen(const char *s);
/* utolower:
 *  Unicode-aware version of the ANSI tolower() function.
 */
extern int utolower(int c);
/* utoupper:
 *  Unicode-aware version of the ANSI toupper() function.
 */
extern int utoupper(int c);
/* Unicode string compare
 */
extern int ustrcmp(const char *s1, const char *s2);
 /* ustricmp:
  *  Unicode-aware version of the DJGPP stricmp() function.
  */
extern int ustricmp(const char *s1, const char *s2);
/* ustrncmp:
 *  Unicode-aware version of the ANSI strncmp() function.
 */
extern int ustrncmp(const char *s1, const char *s2, int n);
/* ustrnicmp:
 *  Unicode-aware version of the DJGPP strnicmp() function.
 */
extern int ustrnicmp(const char *s1, const char *s2, int n);
/* uoffset:
 *  Returns the offset in bytes from the start of the string to the
 *  character at the specified index. If the index is negative, counts
 *  backward from the end of the string (-1 returns an offset to the
 *  last character).
 */
extern int uoffset(const char *s, int index);

/* ugetat:
 *  Returns the character from the specified index within the string.
 */
extern int ugetat(const char *s, int idx);

/* ustrlwr:
 *  Unicode-aware version of the ANSI strlwr() function.
 */
extern char *ustrlwr(char *s);
/* ustrupr:
 *  Unicode-aware version of the ANSI strupr() function.
 */
extern char *ustrupr(char *s);
/* ustrstr:
 *  Unicode-aware version of the ANSI strstr() function.
 */
extern const char *ustrstr(const char *s1, const char *s2);
/* usetat:
 *  Modifies the character at the specified index within the string,
 *  handling adjustments for variable width data. Returns how far the
 *  rest of the string was moved.
 */
int usetat(char *s, int index, int c);
/* ustrsizez:
 *  Returns the size of the specified string in bytes, including the
 *  trailing zero.
 */
extern int ustrsizez(const char *s);

extern int need_uconvert(const char *s, int type, int newtype);
extern int uvszprintf(char *buf, int size, const char *format, va_list args);

} // namespace AGS3

#endif