3 # Generate the plerrcodes.h header from errcodes.txt
4 # Copyright (c) 2000-2011, PostgreSQL Global Development Group
9 print "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
10 print "/* there is deliberately not an #ifndef PLERRCODES_H here */\n";
12 open my $errcodes, $ARGV[0] or die;
21 # Skip section headers
24 die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
29 my $condition_name) = ($1, $2, $3, $4);
32 next unless $type eq 'E';
34 # Skip lines without PL/pgSQL condition names
35 next unless defined($condition_name);
37 print "{\n\t\"$condition_name\", $errcode_macro\n},\n\n";