#!/bin/sh
# Convert MetaPost to C.

sed=sed

$sed -e '
	: again
	/\.$/{
		N
		s/\.\n/\
./
		t again
	}
	s/\.hh/.hhfield/g
	s/\.lh/.lhfield/g
' ../lib/common.defines ../lib/texmf.defines mp.p \
	| ../web2c/web2c -htexmf.h -m \
	| $sed -e '
	    s/else write/else\
write/
	    s/ maxcoef\( *[^( ]\)/ lmaxcoef\1/g
	    s/ b1/ lb1/g
	    s/ b2/ lb2/g
	    s/ b3/ lb3/g
	  ' \
	| ../web2c/fixwrites \
	| ../web2c/splitup mp

cat coerce.h coerce.add >xcoerce.h
mv xcoerce.h coerce.h
