www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - struct to json/yaml/xml/whatever codegen

Is anyone aware of a tool which does something akin to the 
following:

Given a C-like definition, automatically generate pure C code 
with no dependencies.

Input c-struct:
   struct Person
   {
     int   id;
     char* name;
   }	

Output minimal c-code:
   void dumpPerson(Person* p)
   {
   	printf("<Person><id>%d</id><name>%s</name></Person>", p->id, 
p->name);	
   }

It's easy to write in D... just want to avoid reinventing the 
wheel.
Sep 29 2016