blob: 7e9763928c245d47ba83c8cb83f66f843e836f90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
require 'json'
parse = `ctags --output-format=json --c-kinds=pmz --language-force=c raylib.h`
File.write('json.json', parse)
$params = {}
$members = {}
$garbage = []
$struct = []
parse.each_line do |line|
json_line = JSON.parse line
puts json_line['kind']
if json_line['kind'] == 'parameter'
if $params[json_line['scope']].nil?
$params[json_line['scope']] = []
end
$params[json_line['scope']].push json_line
elsif json_line['kind'] == 'prototype'
$members[json_line['name']] = json_line
elsif json_line['kind'] == 'member'
if json_line['scopeKind'] == 'struct'
$struct.push json_line
else
$garbage.push json_line
end
else
if json_line['scopeKind'] == 'struct'
$garbage.push json_line
end
end
end
$members.each do |key, item|
puts "Function: #{item['typeref'].gsub(/typename:[^ ]* /,'')} #{item['name']}"
$params.each do |key, param_arry|
param_arry.each do |param|
if param['scope'] == item['name']
puts "#{param['typeref'].gsub('typename:','')} #{param['name']}"
end
end
end
puts '---'
end
puts
puts "Struct: #{$struct.size}"
puts "Garbage: #{$garbage.size}(should be 0)"
|