Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
627c997d
Commit
627c997d
authored
5 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
More unicode code point definitions and Unicode -> CP437 translations.
parent
dd9d7cd0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/unicode.c
+43
-8
43 additions, 8 deletions
src/xpdev/unicode.c
src/xpdev/unicode_defs.h
+33
-0
33 additions, 0 deletions
src/xpdev/unicode_defs.h
with
76 additions
and
8 deletions
src/xpdev/unicode.c
+
43
−
8
View file @
627c997d
...
...
@@ -351,8 +351,6 @@ size_t unicode_width(enum unicode_codepoint u)
char
unicode_to_cp437
(
enum
unicode_codepoint
codepoint
)
{
switch
(
codepoint
)
{
case
0
:
return
'\0'
;
case
UNICODE_ACUTE_ACCENT
:
return
'\''
;
case
UNICODE_BROKEN_BAR
:
return
'|'
;
...
...
@@ -361,6 +359,8 @@ char unicode_to_cp437(enum unicode_codepoint codepoint)
case
UNICODE_POUND_SIGN
:
return
CP437_POUND_SIGN
;
case
UNICODE_YEN_SIGN
:
return
CP437_YEN_SIGN
;
case
UNICODE_SECTION_SIGN
:
return
CP437_SECTION_SIGN
;
case
UNICODE_DEGREE_CELSIUS
:
case
UNICODE_DEGREE_FAHRENHEIT
:
case
UNICODE_DEGREE_SIGN
:
return
CP437_DEGREE_SIGN
;
case
UNICODE_PLUS_MINUS_SIGN
:
return
CP437_PLUS_MINUS_SIGN
;
case
UNICODE_SUPERSCRIPT_TWO
:
return
CP437_SUPERSCRIPT_TWO
;
...
...
@@ -462,15 +462,14 @@ char unicode_to_cp437(enum unicode_codepoint codepoint)
case
UNICODE_EM_DASH
:
return
'\xC4'
;
case
UNICODE_BULLET
:
// BULLET
return
'\xF9'
;
case
UNICODE_BULLET
:
case
UNICODE_BULLET_OPERATOR
:
return
CP437_BULLET_OPERATOR
;
case
UNICODE_NO_BREAK_SPACE
:
case
UNICODE_EN_QUAD
:
case
UNICODE_EM_QUAD
:
case
UNICODE_EN_SPACE
:
case
UNICODE_EM_SPACE
:
return
' '
;
case
UNICODE_EM_SPACE
:
return
' '
;
case
UNICODE_SQUARE_ROOT
:
return
CP437_SQUARE_ROOT
;
case
UNICODE_CHECK_MARK
:
...
...
@@ -481,6 +480,10 @@ char unicode_to_cp437(enum unicode_codepoint codepoint)
case
UNICODE_BALLOT_X
:
case
UNICODE_HEAVY_BALLOT_X
:
return
'x'
;
case
UNICODE_DIVISION_SLASH
:
return
'/'
;
case
UNICODE_SET_MINUS
:
return
'\\'
;
case
UNICODE_ASTERISK_OPERATOR
:
return
'*'
;
case
UNICODE_OVERLINE
:
case
0x2500
:
// Box Drawings Light Horizontal
case
0x2501
:
// Box Drawings Heavy Horizontal
...
...
@@ -652,9 +655,41 @@ char unicode_to_cp437(enum unicode_codepoint codepoint)
case
0x2594
:
// Upper One Eighth Block
return
'\xDF'
;
default:
// Look for a 1:1 match in the CP437 -> Unicode table
case
UNICODE_SMALL_COMMA
:
case
UNICODE_SMALL_IDEOGRAPHIC_COMMA
:
return
','
;
case
UNICODE_SMALL_FULL_STOP
:
return
'.'
;
case
UNICODE_SMALL_SEMICOLON
:
return
';'
;
case
UNICODE_SMALL_COLON
:
return
':'
;
case
UNICODE_SMALL_QUESTION_MARK
:
return
'?'
;
case
UNICODE_SMALL_EXCLAMATION_MARK
:
return
'!'
;
case
UNICODE_SMALL_EM_DASH
:
return
'-'
;
case
UNICODE_SMALL_LEFT_PARENTHESIS
:
return
'('
;
case
UNICODE_SMALL_RIGHT_PARENTHESIS
:
return
')'
;
case
UNICODE_SMALL_LEFT_CURLY_BRACKET
:
return
'{'
;
case
UNICODE_SMALL_RIGHT_CURLY_BRACKET
:
return
'}'
;
case
UNICODE_SMALL_LEFT_TORTOISE_SHELL_BRACKET
:
return
'['
;
case
UNICODE_SMALL_RIGHT_TORTOISE_SHELL_BRACKET
:
return
']'
;
case
UNICODE_SMALL_NUMBER_SIGN
:
return
'#'
;
case
UNICODE_SMALL_AMPERSAND
:
return
'&'
;
case
UNICODE_SMALL_ASTERISK
:
return
'*'
;
case
UNICODE_SMALL_PLUS_SIGN
:
return
'+'
;
case
UNICODE_SMALL_HYPHEN_MINUS
:
return
'-'
;
case
UNICODE_SMALL_LESS_THAN_SIGN
:
return
'<'
;
case
UNICODE_SMALL_GREATER_THAN_SIGN
:
return
'>'
;
case
UNICODE_SMALL_EQUALS_SIGN
:
return
'='
;
case
UNICODE_SMALL_REVERSE_SOLIDUS
:
return
'\\'
;
case
UNICODE_SMALL_DOLLAR_SIGN
:
return
'$'
;
case
UNICODE_SMALL_PERCENT_SIGN
:
return
'%'
;
case
UNICODE_SMALL_COMMERCIAL_AT
:
return
'@'
;
default:
{
int
i
;
if
(
codepoint
>=
UNICODE_FULLWIDTH_EXCLAMATION_MARK
&&
codepoint
<=
UNICODE_FULLWIDTH_TILDE
)
return
'!'
+
(
codepoint
-
UNICODE_FULLWIDTH_EXCLAMATION_MARK
);
// Look for a 1:1 match in the CP437 -> Unicode table
for
(
i
=
1
;
i
<
0x100
;
i
++
)
{
if
(
cp437_unicode_tbl
[
i
]
==
codepoint
)
return
i
;
...
...
@@ -663,5 +698,5 @@ char unicode_to_cp437(enum unicode_codepoint codepoint)
}
}
return
'\0'
;
// Not-mapped
return
UNICODE_UNDEFINED
;
// Not-mapped
}
This diff is collapsed.
Click to expand it.
src/xpdev/unicode_defs.h
+
33
−
0
View file @
627c997d
...
...
@@ -274,6 +274,10 @@ enum unicode_codepoint {
UNICODE_UP_DOWN_ARROW_WITH_BASE
=
0x21A8
,
UNICODE_DIVISION_SLASH
=
0x2215
,
UNICODE_SET_MINUS
=
0x2216
,
UNICODE_ASTERISK_OPERATOR
=
0x2217
,
UNICODE_RING_OPERATOR
=
0x2218
,
UNICODE_BULLET_OPERATOR
=
0x2219
,
UNICODE_SQUARE_ROOT
=
0x221A
,
UNICODE_INFINITY
=
0x221E
,
...
...
@@ -472,7 +476,36 @@ enum unicode_codepoint {
UNICODE_VARIATION_SELECTOR_16
=
0xFE0F
,
UNICODE_ZERO_WIDTH_NO_BREAK_SPACE
=
0xFEFF
,
UNICODE_SMALL_COMMA
=
0xFE50
,
UNICODE_SMALL_IDEOGRAPHIC_COMMA
=
0xFE51
,
UNICODE_SMALL_FULL_STOP
=
0xFE52
,
UNICODE_SMALL_SEMICOLON
=
0xFE54
,
UNICODE_SMALL_COLON
=
0xFE55
,
UNICODE_SMALL_QUESTION_MARK
=
0xFE56
,
UNICODE_SMALL_EXCLAMATION_MARK
=
0xFE57
,
UNICODE_SMALL_EM_DASH
=
0xFE58
,
UNICODE_SMALL_LEFT_PARENTHESIS
=
0xFE59
,
UNICODE_SMALL_RIGHT_PARENTHESIS
=
0xFE5A
,
UNICODE_SMALL_LEFT_CURLY_BRACKET
=
0xFE5B
,
UNICODE_SMALL_RIGHT_CURLY_BRACKET
=
0xFE5C
,
UNICODE_SMALL_LEFT_TORTOISE_SHELL_BRACKET
=
0xFE5D
,
UNICODE_SMALL_RIGHT_TORTOISE_SHELL_BRACKET
=
0xFE5E
,
UNICODE_SMALL_NUMBER_SIGN
=
0xFE5F
,
UNICODE_SMALL_AMPERSAND
=
0xFE60
,
UNICODE_SMALL_ASTERISK
=
0xFE61
,
UNICODE_SMALL_PLUS_SIGN
=
0xFE62
,
UNICODE_SMALL_HYPHEN_MINUS
=
0xFE63
,
UNICODE_SMALL_LESS_THAN_SIGN
=
0xFE64
,
UNICODE_SMALL_GREATER_THAN_SIGN
=
0xFE65
,
UNICODE_SMALL_EQUALS_SIGN
=
0xFE66
,
UNICODE_SMALL_REVERSE_SOLIDUS
=
0xFE68
,
UNICODE_SMALL_DOLLAR_SIGN
=
0xFE69
,
UNICODE_SMALL_PERCENT_SIGN
=
0xFE6A
,
UNICODE_SMALL_COMMERCIAL_AT
=
0xFE6B
,
UNICODE_FULLWIDTH_EXCLAMATION_MARK
=
0xFF01
,
UNICODE_FULLWIDTH_TILDE
=
0xFF5E
,
UNICODE_FULLWIDTH_LEFT_WHITE_PARENTHESIS
=
0xFF5F
,
UNICODE_FULLWIDTH_RIGHT_WHITE_PARENTHESIS
=
0xFF60
,
UNICODE_HALFWIDTH_BLACK_SQUARE
=
0xFFED
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment