-sub trans_lines();
-
-my @xids=("WINDOW","VISUALTYPE","DRAWABLE","FONT","ATOM","COLORMAP","FONTABLE","GCONTEXT","PIXMAP","SCREEN");
-
-while(<>) {
-
- trans_lines() unless (/#[a-z]/ or /print/ or /\/\// or /\/\*/);
- print;
+BEGIN {
+ %::const = map { $_ => 1 } (
+ "XCBNone",
+ "XCBCopyFromParent",
+ "XCBCurrentTime",
+ "XCBNoSymbol",
+ "XCBError",
+ "XCBReply",
+ );
+ open(CONST, shift) or die "failed to open constants list: $!";
+ while(<CONST>)
+ {
+ chomp;
+ die "invalid constant name: \"$_\"" unless /^XCB[A-Za-z0-9_]*$/;
+ $::const{$_} = 1;
+ }
+ close(CONST);