// Copyright 2012 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. #include "a.h" /* * Helpers for building cmd/gc. */ // gcopnames creates opnames.h from go.h. // It finds the OXXX enum, pulls out all the constants // from OXXX to OEND, and writes a table mapping // op to string. void gcopnames(char *dir, char *file) { char *p, *q; int i, j, end; Buf in, b, out; Vec lines, fields; binit(&in); binit(&b); binit(&out); vinit(&lines); vinit(&fields); bwritestr(&out, bprintf(&b, "// auto generated by go tool dist\n")); bwritestr(&out, bprintf(&b, "static char *opnames[] = {\n")); readfile(&in, bprintf(&b, "%s/go.h", dir)); splitlines(&lines, bstr(&in)); i = 0; while(i