2009-07-31 10:45:39 -06:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2010-02-10 01:44:43 -07:00
|
|
|
# Disable colored grep if user has it set to --color=always.
|
|
|
|
# (Arguably user error.)
|
|
|
|
export GREP_OPTIONS=""
|
|
|
|
|
2009-07-31 10:45:39 -06:00
|
|
|
echo '// auto generated by mkopnames'
|
|
|
|
echo 'static char*'
|
|
|
|
echo 'opnames[] = '
|
|
|
|
echo '{'
|
|
|
|
sed -n '/OXXX/,/OEND/p' go.h |
|
|
|
|
cpp |
|
|
|
|
sed 's!//.*!!; /^#/d' |
|
|
|
|
tr ' ' '\n' |
|
|
|
|
tr -d ' \t,' |
|
|
|
|
grep . |
|
|
|
|
sort |
|
|
|
|
grep -v '^OEND$' |
|
|
|
|
sed 's/O//; s/.*/ [O&] = "&",/'
|
|
|
|
echo '};'
|
|
|
|
|