X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=test%2Fgeekos_test_vm%2Fscripts%2Fgenerrs;fp=test%2Fgeekos_test_vm%2Fscripts%2Fgenerrs;h=1b76e819282af33f849f56f7c58745680a0f5776;hp=0000000000000000000000000000000000000000;hb=a70930549d1b741704dd7af4e6bb0e89f6f8a519;hpb=afb634a80f946634454a5d067a92aa600227bd93 diff --git a/test/geekos_test_vm/scripts/generrs b/test/geekos_test_vm/scripts/generrs new file mode 100755 index 0000000..1b76e81 --- /dev/null +++ b/test/geekos_test_vm/scripts/generrs @@ -0,0 +1,28 @@ +#! /usr/bin/perl + +# Script to process include/geekos/errno.h to produce a table +# of error description strings that can be compiled and +# linked into libc. + +use strict qw(refs vars); + +my @errs = (); +my @syms = (); + +$errs[0] = 'No error'; + +while (<>) { + if (m,^#define\s*(\S+)\s*(-\d+)\s*/\*\s*(.*\S)\s*\*/\s*$,) { + $errs[- $2] = $3; + $syms[- $2] = $1; + } +} + +print "const char *__strerrTable[] = {\n"; +for (my $i = 0; $i < scalar(@errs); $i++) { + print " \"", $errs[$i], "\", /* ", $syms[$i], " */\n"; +} +print "};\n"; +print "const int __strerrTableSize = sizeof(__strerrTable) / sizeof(const char *);\n"; + +# vim:ts=4