3 # Generate the errcodes.h header from errcodes.txt
4 # Copyright (c) 2000-2019, PostgreSQL Global Development Group
10 print "#ifndef __PGERRCODES_H__\n";
11 print "#define __PGERRCODES_H__\n";
13 open my $errcodes, '<', $ARGV[0] or die;
23 # Emit a comment for each section header
28 print "\n/* $header */\n";
32 die "unable to parse errcodes.txt"
33 unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
35 (my $sqlstate, my $errcode_macro) = ($1, $2);
37 print "#define $errcode_macro \"$sqlstate\"\n";