Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-1.1
Commits
3a761a17
Commit
3a761a17
authored
Apr 06, 2008
by
Cristian Maglie
Committed by
Filippo Carone
Apr 06, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java binding: automatic conversion tool for JNA
Signed-off-by:
Filippo Carone
<
littlejohn@videolan.org
>
parent
e8eb6132
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
bindings/java/extras/convert.py
bindings/java/extras/convert.py
+87
-0
No files found.
bindings/java/extras/convert.py
0 → 100755
View file @
3a761a17
#!/usr/bin/python
"""
vlc to jna almost-automatized interface converter.
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
"""
import
sys
file
=
open
(
'libvlc.h'
,
'r'
)
parameter_parsing
=
False
prototype_parsing
=
False
types_map
=
[
[
"const "
,
""
],
[
"VLC_PUBLIC_API "
,
""
],
[
"char**"
,
"String[] "
],
[
"char **"
,
"String[] "
],
[
"char*"
,
"String "
],
[
"char *"
,
"String "
],
[
"libvlc_instance_t *"
,
"LibVlcInstance "
],
[
"libvlc_exception_t *"
,
"libvlc_exception_t "
],
[
"libvlc_log_t *"
,
"LibVlcLog "
],
[
"libvlc_log_iterator_t *"
,
"LibVlcLogIterator "
],
[
"libvlc_log_message_t *"
,
"libvlc_log_message_t "
],
[
"unsigned"
,
"int"
],
]
def
convert_prototype
(
proto
,
parameters
):
#print proto
#print parameters
tokens
=
proto
.
split
(
","
)
last
=
tokens
.
pop
().
split
(
")"
)
res
=
''
for
i
in
tokens
:
param
=
parameters
.
pop
(
0
)
if
i
.
find
(
param
)
==-
1
:
res
+=
i
+
" "
+
param
+
","
else
:
res
+=
i
+
" ,"
if
len
(
parameters
):
param
=
parameters
.
pop
(
0
)
if
last
[
0
].
find
(
param
)
==-
1
:
res
+=
last
[
0
]
+
" "
+
param
+
")"
+
last
[
1
]
else
:
res
+=
last
[
0
]
+
")"
+
last
[
1
]
for
k
,
v
in
types_map
:
res
=
res
.
replace
(
k
,
v
)
print
res
for
line
in
file
.
readlines
():
if
line
.
find
(
"/**"
)
!=-
1
:
parameters
=
[]
parameter_parsing
=
True
if
line
.
find
(
"VLC_PUBLIC_API"
)
!=-
1
:
if
not
parameters
:
continue
prototype_line
=
''
prototype_parsing
=
True
if
parameter_parsing
:
param_index
=
line
.
find
(
"
\
p
a
ram "
)
if
not
param_index
==-
1
:
parameter
=
line
.
split
()[
2
]
parameters
.
append
(
parameter
)
if
line
.
find
(
"*/"
)
!=-
1
:
parameter_parsing
=
False
if
prototype_parsing
:
prototype_line
+=
line
.
strip
()
if
line
.
find
(
");"
)
!=-
1
:
prototype_parsing
=
False
convert_prototype
(
prototype_line
,
parameters
)
parameters
=
None
continue
#sys.stdout.write(line)
# vi:ts=4
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