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
ff569406
Commit
ff569406
authored
12 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Clean up debug_print. Surrogate pairs are always high surrogate
followed by low; anything else is invalid.
parent
0dae4884
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lisp/interr.c
+19
-34
19 additions, 34 deletions
src/lisp/interr.c
with
19 additions
and
34 deletions
src/lisp/interr.c
+
19
−
34
View file @
ff569406
...
...
@@ -226,53 +226,38 @@ surrogatep(int code, int *type)
static
int
utf16_codepoint
(
unsigned
short
int
*
utf16
,
int
len
,
int
*
consumed
)
{
int
code
=
*
utf16
;
int
read
=
1
;
int
codepoint
=
REPLACEMENT_CODE
;
int
code_unit
=
*
utf16
;
int
code_type
;
int
read
=
1
;
/*
* If the current code unit is not a surrogate, we're done.
* Otherwise process the surrogate.
* Otherwise process the surrogate. If this is a high (leading)
* surrogate and the next code unit is a low (trailing) surrogate,
* compute the code point. Otherwise we have a bare surrogate or
* an invalid surrogate sequence, so just return the replacement
* character.
*/
if
(
surrogatep
(
code
,
&
code_type
))
{
/*
* Try to get the following surrogate, if there are still code
* units left. If not, we have a bare surrogate, so just
* return the replacement character.
*/
if
(
len
>
0
)
{
int
next
=
utf16
[
1
];
if
(
surrogatep
(
code_unit
,
&
code_type
))
{
if
(
code_type
==
0
&&
len
>
0
)
{
int
next_unit
=
utf16
[
1
];
int
next_type
;
if
(
surrogatep
(
next
,
&
next_type
))
{
/* Got the following surrogate, so combine them if possible */
if
((
code_type
==
0
)
&&
(
next_type
==
1
))
{
if
(
surrogatep
(
next_unit
,
&
next_type
))
{
if
(
next_type
==
1
)
{
/* High followed by low surrogate */
code
=
((
code
-
0xd800
)
<<
10
)
+
next
+
0x2400
;
++
read
;
}
else
if
((
code_type
==
1
)
&&
(
next_type
==
0
))
{
/*
* Low followed by high surrogate. Not sure if we
* really need to handle this case.
*/
code
=
((
code
-
0xd800
)
<<
10
)
+
next
+
0x2400
;;
codepoint
=
((
code_unit
-
0xd800
)
<<
10
)
+
next_unit
+
0x2400
;
++
read
;
}
else
{
/* Give up */
code
=
REPLACEMENT_CODE
;
}
}
else
{
/* Surrogate followed by non-surrogate. Give up */
code
=
REPLACEMENT_CODE
;
}
}
else
{
code
=
REPLACEMENT_CODE
;
}
}
else
{
codepoint
=
code_unit
;
}
*
consumed
=
read
;
return
code
;
return
code
point
;
}
/*
...
...
@@ -340,8 +325,8 @@ debug_print(lispobj object)
}
}
else
{
/*
* We should actually ever get here because %primitive
print
* is only supposed to take strings. But if we do, it's
* We should
n't
actually ever get here because %primitive
*
print
is only supposed to take strings. But if we do, it's
* useful to print something out anyway.
*/
#if 1
...
...
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