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
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
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
a57bbc1c
Commit
a57bbc1c
authored
14 years ago
by
rtoy
Browse files
Options
Downloads
Patches
Plain Diff
Improve completion of Hangul syllables and CJK unified ideographs some
more and fix some bugs in previous change.
parent
119f21c7
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
code/unidata.lisp
+35
-52
35 additions, 52 deletions
code/unidata.lisp
with
35 additions
and
52 deletions
code/unidata.lisp
+
35
−
52
View file @
a57bbc1c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;; domain.
;;;
;;;
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unidata.lisp,v 1.
19
2010/09/
19 23:07:46
rtoy Exp $"
)
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unidata.lisp,v 1.
20
2010/09/
20 00:59:22
rtoy Exp $"
)
;;;
;;;
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
(
defconstant
+unidata-path+
#p"ext-formats:unidata.bin"
)
(
defconstant
+unidata-path+
#p"ext-formats:unidata.bin"
)
(
defvar
*unidata-version*
"$Revision: 1.
19
$"
)
(
defvar
*unidata-version*
"$Revision: 1.
20
$"
)
(
defstruct
unidata
(
defstruct
unidata
range
range
...
@@ -1274,62 +1274,45 @@
...
@@ -1274,62 +1274,45 @@
completions starting with Prefix. If there is no match, NIL is
completions starting with Prefix. If there is no match, NIL is
returned."
returned."
(
let
(
names
)
(
let
(
names
)
(
cond
((
search
"Hangul_Syllable_"
prefix
)
(
initialize-reverse-hangul-tables
)
(
unless
*hangul-syllable-dictionary*
(
build-hangul-syllable-dictionary
))
(
multiple-value-bind
(
prefix-match
next
completep
)
(
unicode-complete-name
(
subseq
prefix
16
)
*hangul-syllable-dictionary*
)
(
loop
for
x
in
next
do
(
push
(
concatenate
'string
"Hangul_Syllable_"
prefix-match
x
)
names
))
(
when
completep
(
push
(
concatenate
'string
"Hangul_Syllable_"
prefix-match
)
names
))))
((
search
"Cjk_Unified_Ideograph-"
prefix
)
(
unless
*cjk-unified-ideograph-dictionary*
(
build-cjk-unified-ideograph-dictionary
))
(
multiple-value-bind
(
prefix-match
next
completep
)
(
unicode-complete-name
(
subseq
prefix
22
)
*cjk-unified-ideograph-dictionary*
)
(
loop
for
x
in
next
do
(
push
(
concatenate
'string
"Cjk_Unified_Ideograph-"
prefix-match
x
)
names
))
(
when
completep
(
push
(
concatenate
'string
"Cjk_Unified_Ideograph-"
prefix-match
)
names
)))))
(
multiple-value-bind
(
prefix-match
next
completep
)
(
multiple-value-bind
(
prefix-match
next
completep
)
(
unicode-complete-name
prefix
dict
)
(
unicode-complete-name
prefix
dict
)
(
loop
for
x
in
next
(
loop
for
x
in
next
do
(
push
(
concatenate
'string
prefix-match
x
)
names
))
do
(
push
(
concatenate
'string
prefix-match
x
)
names
))
(
when
completep
(
when
completep
(
push
prefix-match
names
))
(
push
prefix-match
names
))
;; Match prefix against Hangul and/or Hangul_syllable
(
flet
((
han-or-cjk-completion
(
prefix-match
prefix
dictionary
)
(
cond
((
search
"Hangul_S"
prefix-match
(
let*
((
prefix-tail
(
subseq
prefix-match
:end1
(
min
8
(
length
prefix-match
)))
(
min
(
length
prefix
)
;; Add syllable as possible completion, and then try to
(
length
prefix-match
))))
;; complete some more so that we don't end up with slime
(
full-prefix
(
concatenate
'string
prefix
prefix-tail
)))
;; saying "Hangul_Syllable_" is the only completion.
(
multiple-value-bind
(
m
suffixes
)
(
multiple-value-bind
(
m
suffixes
)
(
unicode-complete-name
prefix-tail
dictionary
)
(
unicode-complete-name
(
subseq
prefix-match
(
min
16
(
length
prefix-match
)))
(
declare
(
ignore
m
))
*hangul-syllable-dictionary*
)
(
if
suffixes
(
declare
(
ignore
m
))
(
loop
for
n
in
suffixes
(
if
suffixes
do
(
push
(
concatenate
'string
full-prefix
n
)
names
))
(
loop
for
n
in
suffixes
(
push
full-prefix
names
))))))
do
(
push
(
concatenate
'string
"Hangul_Syllable_"
n
)
names
))
;; Match prefix for Hangul syllables or CJK unified ideographs.
(
push
"Hangul_Syllable_"
names
))))
(
cond
((
char=
(
char
prefix-match
0
)
#\H
)
((
or
;;(string= prefix-match "Cjk_")
;; Add "Hangul_Syllable_" as possible completion for
(
search
"Cjk_Unified_Ideograph-"
prefix-match
;; anything beginning with "H".
:end1
(
min
22
(
length
prefix-match
))))
(
push
"Hangul_Syllable_"
names
)
;; Try to complete the first part so we don't get
(
when
(
<=
(
length
names
)
1
)
;; "Cjk_Unified_Ideograph-" as the only completion.
;; Hangul_Syllable is the only match, so let's extend it.
(
multiple-value-bind
(
m
suffixes
)
(
unless
*hangul-syllable-dictionary*
(
unicode-complete-name
(
subseq
prefix-match
(
min
22
(
length
prefix-match
)))
(
initialize-reverse-hangul-tables
)
*cjk-unified-ideograph-dictionary*
)
(
build-hangul-syllable-dictionary
))
(
declare
(
ignore
m
))
(
han-or-cjk-completion
prefix-match
"Hangul_Syllable_"
(
loop
for
n
in
suffixes
*hangul-syllable-dictionary*
)))
do
(
push
(
concatenate
'string
"Cjk_Unified_Ideograph-"
n
)
names
)))))
((
char=
(
char
prefix-match
0
)
#\C
)
;; Add "Cjk_Unified_Ideograph-" as possible completion
;; for anything beginning with "C".
(
push
"Cjk_Unified_Ideograph-"
names
)
(
when
(
<=
(
length
names
)
1
)
(
unless
*cjk-unified-ideograph-dictionary*
(
build-cjk-unified-ideograph-dictionary
))
(
han-or-cjk-completion
prefix-match
"Cjk_Unified_Ideograph-"
*cjk-unified-ideograph-dictionary*
)))))
(
setf
names
(
mapcar
#'
string-capitalize
names
))
(
setf
names
(
mapcar
#'
string-capitalize
names
))
;;(format t "Final names = ~S~%" names)
;;(format t "Final names = ~S~%" names)
names
)))
names
)))
...
...
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