1#!/bin/sh
2hfile=../../../include/Xatom.h
3cfile=initatoms.c
4rm -f $hfile $cfile
5umask 222
6awk '
7BEGIN {
8	hfile = "'$hfile'";
9	cfile = "'$cfile'";
10	hformat = "#define XA_%s ((Atom) %d)\n";
11	printf("#ifndef XATOM_H\n") > hfile;
12	printf("#define XATOM_H 1\n\n") > hfile;
13	printf("/* THIS IS A GENERATED FILE\n") > hfile;
14	printf(" *\n") > hfile;
15	printf(" * Do not change!  Changing this file implies a protocol change!\n") > hfile;
16	printf(" */\n\n") > hfile;
17
18	printf("/* THIS IS A GENERATED FILE\n") > cfile;
19	printf(" *\n") > cfile;
20	printf(" * Do not change!  Changing this file implies a protocol change!\n") > cfile;
21	printf(" */\n\n") > cfile;
22	printf("#include \"X.h\"\n") > cfile;
23	printf("#include \"Xatom.h\"\n") > cfile;
24	printf("#include \"misc.h\"\n") > cfile;
25	printf("#include \"dix.h\"\n") > cfile;
26	printf("void MakePredeclaredAtoms()\n") > cfile;
27	printf("{\n") > cfile;
28
29	}
30
31NF == 2 && $2 == "@" {
32	printf(hformat, $1, ++atomno) > hfile ;
33	printf("    if (MakeAtom(\"%s\", %d, 1) != XA_%s) AtomError();\n", $1, length($1), $1) > cfile ;
34	}
35
36END {
37	printf("\n") > hfile;
38	printf(hformat, "LAST_PREDEFINED", atomno) > hfile ;
39	printf("#endif /* XATOM_H */\n") > hfile;
40	printf("}\n") > cfile ;
41	}
42' BuiltInAtoms
43exit 0
44