We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The current solitary example shows well how to extract data/tokens, but it's very spartan, too spartan, to be honest.
Is there a chance to add some more extensive examples? Perhaps one showing AST rewriting (assuming that's possible via the C-api)?
The text was updated successfully, but these errors were encountered:
On that note, I'd contribute the following, which, given sourcefile(s), prints out prototypes of functions therein:
# this snippet is public domain class MkProto def initialize @index = FFI::Clang::Index.new @seenkinds = [] end def do_file(file) tu = @index.parse_translation_unit(file) tu.cursor.select{|d| d.kind == :cursor_function }.each do |decl| proto = decl.display_name rtyp = decl.result_type.spelling fullprot = sprintf("%s %s;", rtyp, proto) yield fullprot end end end begin if ARGV.empty? then $stderr.printf("usage: %s <file> [<another-file>...]\n", $0) exit(1) else mkp = MkProto.new ARGV.each do |file| $stdout.printf("/* %s */\n", file) mkp.do_file(file) do |prot| $stdout.printf("%s\n", prot) end end end end
The reason I'm not making this a pull request: I have no idea if this is how it's supposed to be done. Hence, better examples would be great.
Sorry, something went wrong.
No branches or pull requests
The current solitary example shows well how to extract data/tokens, but it's very spartan, too spartan, to be honest.
Is there a chance to add some more extensive examples? Perhaps one showing AST rewriting (assuming that's possible via the C-api)?
The text was updated successfully, but these errors were encountered: