#! /bin/csh -f
# $Copyright:	$
# Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
# Sequent Computer Systems, Inc.   All rights reserved.
#  
# This software is furnished under a license and may be used
# only in accordance with the terms of that license and with the
# inclusion of the above copyright notice.   This software may not
# be provided or otherwise made available to, or used by, any
# other person.  No title to or ownership of the software is
# hereby transferred.

# $Header: makeoptions 2.1 86/04/15 $
#
# remake options -- this isn't necessary unless you add/delete options
#
onintr ifintr
cat < ex_data.c > /tmp/$$.c
ex - /tmp/$$.c <<'%'
	g/^#include/d
	w
	q
'%'
cc -E $* /tmp/$$.c >/tmp/foo.c
ex - /tmp/foo.c <<'X'
	" delete all preprocessor output (# line, etc)
	g/^# /d
	set sh=/bin/csh
	" delete junk (all but data lines)
	g/^[ 	]*$/d
	1,/option options/d
	/}/-1,$d
	" get rid of all of line but option name
	1,$s/[ 	]*"//
	1,$s/".*//
	" begin kludge since options start at 0 but cat -n starts at 1
	"              move first to end and later move it back and renumber
	1m$
	%!cat -n
	$t0
	1s/[0-9][0-9]*/0/
	" end kludge
	1s/......../     0  /	" unkludge
	" make #define lines
	1,$s/[ 	]*\([0-9][0-9]*\)[ 	]*\(.*\)/#define	\U\2\L	\1/
	" filter through expand to make it line up nice
	%!expand -8\,24
	" blank line and number of options.
	$i

.
	$s/e[ 	].*[ 	]/e	NOPTS	/
	0a
	/*  sccs id   @(#)  ex_vars.h  @(#)makeoptions	6.4 5/31/85  */
.
	w! ex_vars.h
	q
'X'
ifintr:
rm /tmp/foo.c
