#!/bin/bash # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # * This source file is part of libspmt. * # * * # * See the file "LICENSE" for the copyright information and for * # * the terms and conditions for copying, distribution and * # * modification of this source file. * # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # $Date$ source util.sh function struct { pattern=$1.struct max_name_length=`max_field_length 1 < $1` awk '{ printf " {\"% '"${max_name_length}"'s\", %s},\n", toupper ($1), toupper ($2) }' $1 | sed -e '$ s/},/}/' > $pattern insert_file_after_marker "${start} ${pattern}" $pattern < options.c > options.c.tmp mv options.c.tmp options.c rm $pattern } function enum { target=`echo $1 | sed 's/\./_/'` echo $target > $target.enum awk '{ print $1 }' $1 >> $target.enum } function process { sort $1 > $1.tmp mv $1.tmp $1 struct $1 enum $1 } strip_between_markers "${start} options" "${end} options" < options.c > options.c.tmp mv options.c.tmp options.c process options.boolean process options.integer