#!/bin/sh # Munch for VxWorks by Henric Jungheim # Originally for cygwin32 and OpenBSD, should work as long as # awk does. awk ' \ BEGIN { \ print "typedef void (*VOIDFUNCPTR)();" ;\ print "" ;\ \ cts = 0; dts = 0; \ } \ \ \ /T __GLOBAL_[$]I[$]/ { ctors[cts] = substr($3, 2); ++cts; } \ /T __GLOBAL_[$]D[$]/ { dtors[dts] = substr($3, 2); ++dts; } \ \ END { \ for(i = 0; i < cts; ++i) print "void " ctors[i] "();" ; \ for(i = 0; i < dts; ++i) print "void " dtors[i] "();" ; \ \ print "" ; \ print "VOIDFUNCPTR _ctors[] = {" ;\ for(i = 0; i < cts; ++i) print "\t" ctors[i] "," ; \ print "\t0\n};" ; \ \ print "" ;\ print "VOIDFUNCPTR _dtors[] = {" ; \ for(i = dts - 1; i >= 0; --i) print "\t" dtors[i] "," ; \ print "\t0\n};" \ \ } \ '