github.com/ccccaoqing/test@v0.0.0-20220510085219-3985d23445c0/src/cmd/gc/mkopnames (about)

     1  #!/bin/sh
     2  # Copyright 2009 The Go Authors. All rights reserved.
     3  # Use of this source code is governed by a BSD-style
     4  # license that can be found in the LICENSE file.
     5  
     6  # Disable colored grep if user has it set to --color=always.
     7  # (Arguably user error.)
     8  export GREP_OPTIONS=""
     9  
    10  echo '// auto generated by mkopnames'
    11  echo 'static char*'
    12  echo 'opnames[] = '
    13  echo '{'
    14  sed -n '/OXXX/,/OEND/p' go.h |
    15  	cpp |
    16  	sed 's!//.*!!; /^#/d'  |
    17  	tr ' ' '\012' |
    18  	tr -d ' \011,' |
    19  	grep . |
    20  	sort |
    21  	grep -v '^OEND$' |
    22  	sed 's/O//; s/.*/	[O&] =	"&",/'
    23  echo '};'
    24