Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Jon Boone
cmucl
Commits
0dae4884
Commit
0dae4884
authored
12 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Minor cleanups of utf8 code.
parent
88d77e83
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lisp/interr.c
+14
-7
14 additions, 7 deletions
src/lisp/interr.c
with
14 additions
and
7 deletions
src/lisp/interr.c
+
14
−
7
View file @
0dae4884
...
...
@@ -161,6 +161,10 @@ internal_error(os_context_t * context)
/* Utility routines used by random pieces of code. */
#if defined(UNICODE)
/* The Unicode replacement character code */
#define REPLACEMENT_CODE 0xfffd
/*
* Convert a unicode code point to a set of utf8-encoded octets to
* standard output. This is the algorithm used by the Lisp utf8
...
...
@@ -196,7 +200,7 @@ utf8(int code, int len)
* surrogate. If not a surrogate, type is not modified. If type is
* NULL, then no type is returned.
*/
boolean
static
boolean
surrogatep
(
int
code
,
int
*
type
)
{
boolean
result
;
...
...
@@ -219,7 +223,7 @@ surrogatep(int code, int *type)
* codepoint is returned and the number of code units consumed is
* returned in consumed.
*/
int
static
int
utf16_codepoint
(
unsigned
short
int
*
utf16
,
int
len
,
int
*
consumed
)
{
int
code
=
*
utf16
;
...
...
@@ -229,7 +233,7 @@ utf16_codepoint(unsigned short int* utf16, int len, int* consumed)
/*
* If the current code unit is not a surrogate, we're done.
* Otherwise process the surrogate
* Otherwise process the surrogate
.
*/
if
(
surrogatep
(
code
,
&
code_type
))
{
...
...
@@ -248,19 +252,22 @@ utf16_codepoint(unsigned short int* utf16, int len, int* consumed)
code
=
((
code
-
0xd800
)
<<
10
)
+
next
+
0x2400
;
++
read
;
}
else
if
((
code_type
==
1
)
&&
(
next_type
==
0
))
{
/* Low followed by high surrogate */
/*
* Low followed by high surrogate. Not sure if we
* really need to handle this case.
*/
code
=
((
code
-
0xd800
)
<<
10
)
+
next
+
0x2400
;;
++
read
;
}
else
{
/* Give up */
code
=
0xfffd
;
code
=
REPLACEMENT_CODE
;
}
}
else
{
/* Surrogate followed by non-surrogate. Give up */
code
=
0xfffd
;
code
=
REPLACEMENT_CODE
;
}
}
else
{
code
=
0xfffd
;
code
=
REPLACEMENT_CODE
;
}
}
...
...
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