1
0
mirror of https://github.com/golang/go synced 2024-11-20 11:24:47 -07:00
go/src/cmd/gc/mkopnames
Anthony Martin 8039683cef gc: use octal escapes in mkopnames
Plan 9's tr(1) doesn't accept the C-style escapes
for tab and newline characters.  I was going to use
the \xFF hexadecimal escapes but GNU tr(1) doesn't
accept those.  It seems octal is the least common
denominator.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5576079
2012-01-31 18:15:42 -08:00

25 lines
545 B
Bash
Executable File

#!/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.
# Disable colored grep if user has it set to --color=always.
# (Arguably user error.)
export GREP_OPTIONS=""
echo '// auto generated by mkopnames'
echo 'static char*'
echo 'opnames[] = '
echo '{'
sed -n '/OXXX/,/OEND/p' go.h |
cpp |
sed 's!//.*!!; /^#/d' |
tr ' ' '\012' |
tr -d ' \011,' |
grep . |
sort |
grep -v '^OEND$' |
sed 's/O//; s/.*/ [O&] = "&",/'
echo '};'