#!/bin/sh

# Transform HeaderDoc keywords in Doxygen synonyms
awk 'BEGIN { inspec = 0; indef = 0; }
/\/\*!/ { inspec = 1; }
/\*\// { inspec = 0; }
/@abstract/  { if (inspec) gsub(/@abstract/,"@brief"); }
/@discussion/ { if (inspec) { gsub(/@discussion/,""); printf( "\n" );} }
/@header/  { if (inspec) gsub(/@header/,"@file"); }
/@function/  { if (inspec) next; }
/@method/  { if (inspec) next; }
/@result/  { if (inspec) gsub(/@result/,"@return"); }

# Overcome a bug in Doxygen parse of ObjectiveC headers
#/@interface/ { indef = 1; }
#/}/ { if (indef) { printf( "%s\n- (id) init ;\n", $0 ); indef = 0; next; } }

{ print $0 }
' $@
