How to run (example)
$ ls
foobar.h
$ cat foobar.h
// foobar.h
typedef enum _BarType {
BAR_TYPE_A,
BAR_TYPE_B
} BarType;
#define NUM_B 3
typedef union _Bar {
uint a;
uint b[NUM_B];
} Bar;
typedef struct _Foo {
BarType bartype;
Bar bar;
} Foo;
$ doxygen -g
Configuration file 'Doxyfile' created.
Now edit the configuration file and enter
doxygen Doxyfile
to generate the documentation for your project
$ vi Doxyfile
$ grep '^GENERATE_XML' Doxyfile
GENERATE_XML = YES
$ doxygen Doxyfile
(...snip...)
$ ls -F
Doxyfile foobar.h html/ latex/ xml/
$ cd xml
$ ruby path/to/doxy_struct_xml_to_json.rb
Usage: ruby doxy_struct_xml_to_json.rb struct_id
struct_id: struct__Foo union__Bar
$ ruby path/to/doxy_struct_xml_to_json.rb struct__Foo
{"id":"struct__Foo","name":"_Foo","members":[{"name":"bartype","type":"BarType"},{"name":"bar","type":"Bar","type_data":{"id":"union__Bar","name":"_Bar","members":[{"name":"a","type":"uint"},{"name":"b[NUM_B]","type":"uint"}]}}]}