Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
keyboard
LatinIME
Commits
4221738c
Commit
4221738c
authored
12 years ago
by
Satoshi Kataoka
Browse files
Options
Downloads
Patches
Plain Diff
add debug
Change-Id: I101810d2cdd7c2702c489d76fe8f90da0a87a103
parent
c5da4365
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
native/jni/src/char_utils.h
+0
-1
0 additions, 1 deletion
native/jni/src/char_utils.h
native/jni/src/defines.h
+29
-39
29 additions, 39 deletions
native/jni/src/defines.h
with
29 additions
and
40 deletions
native/jni/src/char_utils.h
+
0
−
1
View file @
4221738c
...
@@ -72,6 +72,5 @@ inline static bool isSkippableCodePoint(const int codePoint) {
...
@@ -72,6 +72,5 @@ inline static bool isSkippableCodePoint(const int codePoint) {
// TODO: Do not hardcode here
// TODO: Do not hardcode here
return
codePoint
==
KEYCODE_SINGLE_QUOTE
||
codePoint
==
KEYCODE_HYPHEN_MINUS
;
return
codePoint
==
KEYCODE_SINGLE_QUOTE
||
codePoint
==
KEYCODE_HYPHEN_MINUS
;
}
}
}
// namespace latinime
}
// namespace latinime
#endif // LATINIME_CHAR_UTILS_H
#endif // LATINIME_CHAR_UTILS_H
This diff is collapsed.
Click to expand it.
native/jni/src/defines.h
+
29
−
39
View file @
4221738c
...
@@ -23,6 +23,9 @@
...
@@ -23,6 +23,9 @@
#define AK_FORCE_INLINE inline
#define AK_FORCE_INLINE inline
#endif // __GNUC__
#endif // __GNUC__
// This must be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java
#define MAX_WORD_LENGTH_INTERNAL 48
#if defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
#if defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
#include
<android/log.h>
#include
<android/log.h>
#ifndef LOG_TAG
#ifndef LOG_TAG
...
@@ -37,20 +40,33 @@
...
@@ -37,20 +40,33 @@
#define INTS_TO_CHARS(input, length, output) do { \
#define INTS_TO_CHARS(input, length, output) do { \
intArrayToCharArray(input, length, output); } while (0)
intArrayToCharArray(input, length, output); } while (0)
// TODO: Support full UTF-8 conversion
AK_FORCE_INLINE
static
int
intArrayToCharArray
(
const
int
*
source
,
const
int
sourceSize
,
char
*
dest
)
{
int
si
=
0
;
int
di
=
0
;
while
(
si
<
sourceSize
&&
di
<
MAX_WORD_LENGTH_INTERNAL
-
1
&&
0
!=
source
[
si
])
{
const
int
codePoint
=
source
[
si
++
];
if
(
codePoint
<
0x7F
)
{
dest
[
di
++
]
=
codePoint
;
}
else
if
(
codePoint
<
0x7FF
)
{
dest
[
di
++
]
=
0xC0
+
(
codePoint
>>
6
);
dest
[
di
++
]
=
0x80
+
(
codePoint
&
0x3F
);
}
else
if
(
codePoint
<
0xFFFF
)
{
dest
[
di
++
]
=
0xE0
+
(
codePoint
>>
12
);
dest
[
di
++
]
=
0x80
+
((
codePoint
&
0xFC0
)
>>
6
);
dest
[
di
++
]
=
0x80
+
(
codePoint
&
0x3F
);
}
}
dest
[
di
]
=
0
;
return
di
;
}
static
inline
void
dumpWordInfo
(
const
int
*
word
,
const
int
length
,
const
int
rank
,
static
inline
void
dumpWordInfo
(
const
int
*
word
,
const
int
length
,
const
int
rank
,
const
int
frequency
)
{
const
int
frequency
)
{
static
char
charBuf
[
50
];
static
char
charBuf
[
50
];
int
i
=
0
;
const
int
N
=
intArrayToCharArray
(
word
,
length
,
charBuf
);
for
(;
i
<
length
;
++
i
)
{
if
(
N
>
1
)
{
const
int
c
=
word
[
i
];
if
(
c
==
0
)
{
break
;
}
// static_cast only for debugging
charBuf
[
i
]
=
static_cast
<
char
>
(
c
);
}
charBuf
[
i
]
=
0
;
if
(
i
>
1
)
{
AKLOGI
(
"%2d [ %s ] (%d)"
,
rank
,
charBuf
,
frequency
);
AKLOGI
(
"%2d [ %s ] (%d)"
,
rank
,
charBuf
,
frequency
);
}
}
}
}
...
@@ -66,34 +82,12 @@ static inline void dumpResult(const int *outWords, const int *frequencies, const
...
@@ -66,34 +82,12 @@ static inline void dumpResult(const int *outWords, const int *frequencies, const
static
AK_FORCE_INLINE
void
dumpWord
(
const
int
*
word
,
const
int
length
)
{
static
AK_FORCE_INLINE
void
dumpWord
(
const
int
*
word
,
const
int
length
)
{
static
char
charBuf
[
50
];
static
char
charBuf
[
50
];
int
i
=
0
;
const
int
N
=
intArrayToCharArray
(
word
,
length
,
charBuf
);
for
(;
i
<
length
;
++
i
)
{
if
(
N
>
1
)
{
const
int
c
=
word
[
i
];
if
(
c
==
0
)
{
break
;
}
// static_cast only for debugging
charBuf
[
i
]
=
static_cast
<
char
>
(
c
);
}
charBuf
[
i
]
=
0
;
if
(
i
>
1
)
{
AKLOGI
(
"[ %s ]"
,
charBuf
);
AKLOGI
(
"[ %s ]"
,
charBuf
);
}
}
}
}
static
inline
void
intArrayToCharArray
(
const
int
*
input
,
const
int
length
,
char
*
output
)
{
int
i
=
0
;
for
(;
i
<
length
;
++
i
)
{
const
int
c
=
input
[
i
];
if
(
c
==
0
)
{
break
;
}
// static_cast only for debugging
output
[
i
]
=
static_cast
<
char
>
(
c
);
}
output
[
i
]
=
0
;
}
#ifndef __ANDROID__
#ifndef __ANDROID__
#include
<cassert>
#include
<cassert>
#include
<execinfo.h>
#include
<execinfo.h>
...
@@ -320,10 +314,6 @@ static inline void prof_out(void) {
...
@@ -320,10 +314,6 @@ static inline void prof_out(void) {
#define MAX_FREQ 255
#define MAX_FREQ 255
#define MAX_BIGRAM_FREQ 15
#define MAX_BIGRAM_FREQ 15
// This must be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java
// This is only used for the size of array. Not to be used in c functions.
#define MAX_WORD_LENGTH_INTERNAL 48
// This must be the same as ProximityInfo#MAX_PROXIMITY_CHARS_SIZE, currently it's 16.
// This must be the same as ProximityInfo#MAX_PROXIMITY_CHARS_SIZE, currently it's 16.
#define MAX_PROXIMITY_CHARS_SIZE_INTERNAL 16
#define MAX_PROXIMITY_CHARS_SIZE_INTERNAL 16
...
...
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