Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
2df53f40
Commit
2df53f40
authored
Aug 15, 2014
by
Thomas Jahns
🤸
Browse files
Correctly parse function declarations with whitespace for mo_cdi.
parent
634b0e9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
interfaces/f2003/bindGen.rb
View file @
2df53f40
...
...
@@ -58,12 +58,12 @@ def getFuncInfo(filename)
typelist
=
%w[char int float double void]
funclist
=
IO
.
popen
(
"cpp
#{
filename
}
| cpp -fpreprocessed"
).
readlines
.
delete_if
{
|
line
|
not
line
.
index
(
'#'
).
nil?
}.
collect
{
|
line
|
line
.
chomp
}
# delete everything, that do not look like a function prototype
typeRegexp
=
/^.*(
#{
typelist
.
join
(
'|'
)
}
) \**\w+\(.*\)/
typeRegexp
=
/^.*(
#{
typelist
.
join
(
'|'
)
}
) \**\w+\
s*\
(.*\)/
funclist
.
delete_if
{
|
line
|
not
typeRegexp
.
match
(
line
.
lstrip
)
}
funclist
.
collect!
{
|
line
|
md
=
/(\w+)+ +(\**)(\w+)\((.*)\)/
.
match
(
line
)
md
=
/(\w+)+ +(\**)(\w+)\
s*\
((.*)\)/
.
match
(
line
)
returnType
,
returnPointer
,
funcName
,
paramList
=
md
[
1
,
4
]
paramList
=
paramList
.
split
(
','
).
collect
{
|
p
|
p
.
split
(
' '
).
each
{
|
_p
|
_p
.
strip
}}
[
funcName
,
returnType
,
returnPointer
,
paramList
]
...
...
Write
Preview
Supports
Markdown
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