blob: 62942edcb1ee8faaeddf9f2e50dde5fc934c6cfd (
plain)
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
|
/*
* Gregorio is a program that translates gabc files to GregorioTeX
* This header prototypes the UTF-8 support functions.
*
* Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md)
*
* This file is part of Gregorio.
*
* Gregorio 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.
*
* Gregorio 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 Gregorio. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UNICODE_H_FIRST_PART
#define UNICODE_H_FIRST_PART
#define UNICODE_H
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#include <inttypes.h>
#endif
typedef uint32_t grewchar;
void gregorio_print_unichar(FILE *f, grewchar to_print);
void gregorio_print_unistring(FILE *f, grewchar *first_char);
unsigned char gregorio_wcsbufcmp(grewchar *wstr, const char *buf);
grewchar *gregorio_build_grewchar_string_from_buf(const char *buf);
static __inline size_t gregorio_wcstrlen(const grewchar *wstr)
{
size_t length = 0;
while (*(wstr++)) {
++length;
}
return length;
}
/* this macro is for portability under windows, where L'x' is only two-bytes
* long, and thus needs to be cast to a 4-bytes integer. */
#define GL(wc) ((const grewchar) L'wc')
#endif
/* we enter the second part only if struct.h has already been included, because
* we need gregorio_character */
#ifdef STRUCT_H
#ifndef UNICODE_H_SECOND_PART
#define UNICODE_H_SECOND_PART
gregorio_character *gregorio_build_char_list_from_buf(const char *buf);
#endif
#endif
|