Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
poppler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Persch
poppler
Commits
6c427f7e
Commit
6c427f7e
authored
Oct 21, 2018
by
Elliott Sales de Andrade
Committed by
Albert Astals Cid
Nov 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Python 3 in scripts.
parent
a85c2ed8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
24 deletions
+43
-24
gtkdoc.py
gtkdoc.py
+5
-1
poppler/gen-unicode-tables.py
poppler/gen-unicode-tables.py
+38
-23
No files found.
gtkdoc.py
View file @
6c427f7e
...
...
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
from
__future__
import
absolute_import
,
division
,
print_function
import
errno
import
logging
...
...
@@ -22,6 +23,9 @@ import subprocess
import
sys
PY2
=
sys
.
version_info
[
0
]
==
2
if
PY2
:
input
=
raw_input
class
GTKDoc
(
object
):
...
...
@@ -180,7 +184,7 @@ class GTKDoc(object):
question
+=
' [y/N] '
answer
=
None
while
answer
!=
'y'
and
answer
!=
'n'
and
answer
!=
''
:
answer
=
raw_
input
(
question
).
lower
()
answer
=
input
(
question
).
lower
()
return
answer
==
'y'
def
_run_command
(
self
,
args
,
env
=
None
,
cwd
=
None
,
print_output
=
True
,
ignore_warnings
=
False
):
...
...
poppler/gen-unicode-tables.py
View file @
6c427f7e
from
__future__
import
absolute_import
,
division
,
print_function
import
sys
import
unicodedata
if
sys
.
version_info
[
0
]
==
2
:
chr
=
unichr
UNICODE_LAST_CHAR_PART1
=
0x2FAFF
HANGUL_S_BASE
=
0xAC00
HANGUL_S_COUNT
=
19
*
21
*
28
import
unicodedata
print
"""// Generated by gen-unicode-tables.py
print
(
"""// Generated by gen-unicode-tables.py
typedef struct {
Unicode character;
int length;
int offset;
} decomposition;
"""
"""
)
decomp_table
=
[]
max_index
=
0
decomp_expansion_index
=
{}
decomp_expansion
=
[]
for
u
in
xrange
(
0
,
UNICODE_LAST_CHAR_PART1
):
if
(
u
>=
HANGUL_S_BASE
and
u
<
HANGUL_S_BASE
+
HANGUL_S_COUNT
):
continue
norm
=
tuple
(
map
(
ord
,
unicodedata
.
normalize
(
"NFKD"
,
unichr
(
u
))))
if
norm
!=
(
u
,):
try
:
i
=
decomp_expansion_index
[
norm
]
decomp_table
.
append
((
u
,
len
(
norm
),
i
))
except
KeyError
:
decomp_table
.
append
((
u
,
len
(
norm
),
max_index
))
decomp_expansion_index
[
norm
]
=
max_index
decomp_expansion
.
append
((
norm
,
max_index
))
max_index
+=
len
(
norm
)
print
"#define DECOMP_TABLE_LENGTH %d
\n
"
%
len
(
decomp_table
)
print
"static const decomposition decomp_table[] = {
\n
%s
\n
};
\n
"
%
",
\n
"
.
join
(
" { 0x%x, %d, %d }"
%
(
character
,
length
,
offset
)
for
character
,
length
,
offset
in
decomp_table
)
print
"static const Unicode decomp_expansion[] = {
\n
%s
\n
};
\n
"
%
",
\n
"
.
join
(
" %s /* offset %d */ "
%
(
", "
.
join
(
"0x%x"
%
u
for
u
in
norm
),
index
)
for
norm
,
index
in
decomp_expansion
)
for
u
in
range
(
0
,
UNICODE_LAST_CHAR_PART1
):
if
HANGUL_S_BASE
<=
u
<
HANGUL_S_BASE
+
HANGUL_S_COUNT
:
continue
norm
=
tuple
(
map
(
ord
,
unicodedata
.
normalize
(
"NFKD"
,
chr
(
u
))))
if
norm
!=
(
u
,
):
try
:
i
=
decomp_expansion_index
[
norm
]
decomp_table
.
append
((
u
,
len
(
norm
),
i
))
except
KeyError
:
decomp_table
.
append
((
u
,
len
(
norm
),
max_index
))
decomp_expansion_index
[
norm
]
=
max_index
decomp_expansion
.
append
((
norm
,
max_index
))
max_index
+=
len
(
norm
)
print
(
"#define DECOMP_TABLE_LENGTH %d"
%
(
len
(
decomp_table
),
))
print
()
print
(
"static const decomposition decomp_table[] = {"
)
print
(
*
(
" { 0x%x, %d, %d }"
%
(
character
,
length
,
offset
)
for
character
,
length
,
offset
in
decomp_table
),
sep
=
",
\n
"
)
print
(
"};"
)
print
()
print
(
"static const Unicode decomp_expansion[] = {"
)
print
(
*
(
" %s /* offset %d */"
%
(
", "
.
join
(
"0x%x"
%
u
for
u
in
norm
),
index
)
for
norm
,
index
in
decomp_expansion
),
sep
=
" ,
\n
"
)
print
(
"};"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment