summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2022-03-04 03:51:38 -0500
committerrealtradam <[email protected]>2022-03-04 03:51:38 -0500
commit081d4ff261b1ef684e95cc74bba70b603dfa0929 (patch)
treed8e204704e420c0b4ba9d3d0ad3ef9f3c6d333cf
parent4cdfd5bcbadb5fe49da7c5e108e42a34b7878ad1 (diff)
downloadFelBind-081d4ff261b1ef684e95cc74bba70b603dfa0929.tar.gz
FelBind-081d4ff261b1ef684e95cc74bba70b603dfa0929.zip
partially sorted json export
-rw-r--r--.gitignore2
-rw-r--r--scan.rb47
2 files changed, 48 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c475cc9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+json.json
+raylib.h
diff --git a/scan.rb b/scan.rb
index 2966f43..7e97639 100644
--- a/scan.rb
+++ b/scan.rb
@@ -1 +1,46 @@
-`ctags --output-format=json --c-kinds=pmz --language-force=c raylib.h` # convert to json
+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)"