Blame mach/errsystems.awk

Packit 6c4009
BEGIN {
Packit 6c4009
  print "#include <errno.h>";
Packit 6c4009
  print "#include <mach/error.h>";
Packit 6c4009
  print "#include <errorlib.h>";
Packit 6c4009
  print "#define static static const";
Packit 6c4009
  nsubs = split(subsys, subs);
Packit 6c4009
  while (nsubs > 0) printf "#include \"%s\"\n", subs[nsubs--];
Packit 6c4009
  print "\n\n\
Packit 6c4009
const struct error_system __mach_error_systems[err_max_system + 1] =";
Packit 6c4009
  print "  {";
Packit 6c4009
}
Packit 6c4009
/^static.*err_[a-z0-9A-Z_]+_sub *\[/ {
Packit 6c4009
  s = $0; sub(/^.*err_/, "", s); sub(/_sub.*$/, "", s);
Packit 6c4009
  printf "    [err_get_system (err_%s)] = { errlib_count (err_%s_sub),",
Packit 6c4009
	s, s;
Packit 6c4009
  printf "\"(system %s) error with unknown subsystem\", err_%s_sub },\n",
Packit 6c4009
	s, s;
Packit 6c4009
}
Packit 6c4009
END {
Packit 6c4009
  print "  };";
Packit 6c4009
  print "\n\
Packit 6c4009
const int __mach_error_system_count = errlib_count (__mach_error_systems);";
Packit 6c4009
}