Debian Codegraph @

doc-src/extract_protos.rb

raw symbols SCIP
1 # match 0 is the whole function proto
2 # match 1 is either "static inline " or nil
3 # match 2 is the return type
4 # match 3 is the function symbol name
5 # match 4 is the arguments
6 PATTERN = /.*?((static inline )?(\w*\*?)\s(cp\w*)\((.*?)\))/
7
8 IO.readlines("|gcc -DNDEBUG -E ../include/chipmunk/chipmunk.h").each do|line|
9 str = line
10
11 while match = PATTERN.match(str)
12 str = match.post_match
13
14 proto, inline, ret, name, args = match.captures.values_at(0, 1, 2, 3, 4)
15 next if ret == "return" || ret == ""
16
17 inline = !!inline
18
19 p({:inline => inline, :return => ret, :name => name, :args => args})
20 # puts "#{name} - #{inline ? "static inline " : ""}#{ret} #{name}(#{args})"
21 end
22 end