mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Merge pull request #294 from yenatch/utf-8
Fix UTF-8 characters with an even number of bytes.
This commit is contained in:
@@ -19,6 +19,9 @@
|
|||||||
# Don't expect SPDX tag in the first line of a file
|
# Don't expect SPDX tag in the first line of a file
|
||||||
--ignore SPDX_LICENSE_TAG
|
--ignore SPDX_LICENSE_TAG
|
||||||
|
|
||||||
|
# Don't expect Signed-off-by lines in commit messages
|
||||||
|
--no-signoff
|
||||||
|
|
||||||
# List of ignored rules
|
# List of ignored rules
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ os:
|
|||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
|
script:
|
||||||
|
- cd test && ./run-tests.sh
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- env: _="checkpatch"
|
||||||
script:
|
script:
|
||||||
- ./.travis-checkpatch.sh
|
- ./.travis-checkpatch.sh
|
||||||
- cd test
|
|
||||||
- ./run-tests.sh
|
|
||||||
|
|||||||
@@ -75,24 +75,22 @@ copyright and the reference to the MIT License.
|
|||||||
new warning (but it may be possible to remove some warning checks if it makes
|
new warning (but it may be possible to remove some warning checks if it makes
|
||||||
the code much easier).
|
the code much easier).
|
||||||
|
|
||||||
5. Sign off your commits: ``git commit -s``
|
5. Follow the Linux kernel coding style, which can be found in the file
|
||||||
|
|
||||||
6. Follow the Linux kernel coding style, which can be found in the file
|
|
||||||
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
|
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
|
||||||
Note that the coding style isn't writen on stone, if there is a good reason
|
Note that the coding style isn't writen on stone, if there is a good reason
|
||||||
to deviate from it, it should be fine.
|
to deviate from it, it should be fine.
|
||||||
|
|
||||||
7. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
||||||
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
|
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
|
||||||
|
|
||||||
8. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
7. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
||||||
the coding style of all patches between the current one and the upstream
|
the coding style of all patches between the current one and the upstream
|
||||||
code. By default, the Makefile expects the script (and associate files) to be
|
code. By default, the Makefile expects the script (and associate files) to be
|
||||||
located in ``../linux/scripts/``, but you can place them anywhere you like as
|
located in ``../linux/scripts/``, but you can place them anywhere you like as
|
||||||
long as you specify it when executing the command:
|
long as you specify it when executing the command:
|
||||||
``CHECKPATCH=../path/to/folder make checkpatch``.
|
``CHECKPATCH=../path/to/folder make checkpatch``.
|
||||||
|
|
||||||
9. Create a pull request against the branch ``develop``.
|
8. Create a pull request against the branch ``develop``.
|
||||||
|
|
||||||
10. Be prepared to get some comments about your code and to modify it. Tip: Use
|
9. Be prepared to get some comments about your code and to modify it. Tip: Use
|
||||||
``git rebase -i origin/develop`` to modify chains of commits.
|
``git rebase -i origin/develop`` to modify chains of commits.
|
||||||
|
|||||||
@@ -32,12 +32,10 @@ int32_t readUTF8Char(char *dest, char *src)
|
|||||||
|
|
||||||
dest[i] = src[i];
|
dest[i] = src[i];
|
||||||
|
|
||||||
i++;
|
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
dest[i] = '\0';
|
dest[++i] = '\0';
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
dest[i] = src[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
src/extern/utf8decoder.c
vendored
9
src/extern/utf8decoder.c
vendored
@@ -25,12 +25,9 @@ static const uint8_t utf8d[] = {
|
|||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* b0..bf */
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* b0..bf */
|
||||||
8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* c0..cf */
|
8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* c0..cf */
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* d0..df */
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* d0..df */
|
||||||
0xa, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, /* e0..e7 */
|
10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, /* e0..ef */
|
||||||
0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, /* e8..ef */
|
11, 6, 6, 6, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* f0..ff */
|
||||||
0xb, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, /* f0..f7 */
|
0, 1, 2, 3, 5, 8, 7, 1, 1, 1, 4, 6, 1, 1, 1, 1, /* s0 */
|
||||||
0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, /* f8..ff */
|
|
||||||
0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, /* s0.. */
|
|
||||||
0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, /* ..s0 */
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* s1 */
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* s1 */
|
||||||
1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, /* s1 */
|
1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, /* s1 */
|
||||||
1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, /* s3 */
|
1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, /* s3 */
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
fname=$(mktemp)
|
o=$(mktemp)
|
||||||
|
gb=$(mktemp)
|
||||||
|
before=$(mktemp)
|
||||||
|
after=$(mktemp)
|
||||||
rc=0
|
rc=0
|
||||||
|
|
||||||
for i in *.asm; do
|
for i in *.asm; do
|
||||||
../../rgbasm $i >$fname 2>&1
|
../../rgbasm -o $o $i > $after 2>&1
|
||||||
diff -u $fname ${i%.asm}.out
|
diff -u ${i%.asm}.out $after
|
||||||
rc=$(($? || $rc))
|
rc=$(($? || $rc))
|
||||||
|
bin=${i%.asm}.out.bin
|
||||||
|
if [ -f $bin ]; then
|
||||||
|
../../rgblink -o $gb $o > $after 2>&1
|
||||||
|
head -c $(wc -c < $bin) $gb > $after 2>&1
|
||||||
|
hexdump -C $after > $before && mv $before $after
|
||||||
|
hexdump -C $bin > $before
|
||||||
|
diff -u $before $after
|
||||||
|
rc=$(($? || $rc))
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|||||||
2
test/asm/utf-8.asm
Normal file
2
test/asm/utf-8.asm
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
SECTION "sec", ROM0
|
||||||
|
db "é"
|
||||||
0
test/asm/utf-8.out
Normal file
0
test/asm/utf-8.out
Normal file
1
test/asm/utf-8.out.bin
Normal file
1
test/asm/utf-8.out.bin
Normal file
@@ -0,0 +1 @@
|
|||||||
|
é
|
||||||
Reference in New Issue
Block a user