Debian Codegraph @

examples/non-ascii-example.c

raw
1 /* -*- coding: utf-8 -*- */
2 /*
3 Copyright 2013 David Malcolm <[email protected]>
4 Copyright 2013 Red Hat, Inc.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
20 */
21 /*
22 Example of a UTF-8-encoded source file containing non-ASCII characters
23
24 U+2620 SKULL AND CROSSBONES: ☠
25
26 Test of a Japanese unicode string: 文字化け
27 (I believe this reads "mojibake", using 3 characters from the CJK
28 Unified Ideographs area, followed by U+3051 HIRAGANA LETTER KE)
29
30 Test of a character outside the BMP: 𝄡
31 (this is U+1D121 MUSICAL SYMBOL C CLEF, which is encoded as:
32 UTF-8: 0xF0 0x9D 0x84 0xA1 )
33
34 Test of Unicode "Box Drawing" characters:
35 ─ : U+2500 BOX DRAWINGS LIGHT HORIZONTAL
36 │ : U+2502 BOX DRAWINGS LIGHT VERTICAL
37 ┐ : U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT
38 └ : U+2514 BOX DRAWINGS LIGHT UP AND RIGHT
39 ┘ : U+2518 BOX DRAWINGS LIGHT UP AND LEFT
40
41 first ─> n0 ─> n1 ─> ... ─> nN ┐
42 A │
43 └────────────────────────────┘
44
45 (the arrows are the greater than/less than and the letters A and V)
46 */
47
48 int foo(int i, unsigned int j)
49 {
50 if (i < j) {
51 return 1;
52 } else {
53 return 0;
54 }
55 }