summaryrefslogtreecommitdiff
path: root/dix/buildatoms
blob: bedec58861fbae7163c0ad21be7e7c25497c1f97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
hfile=../../X11/Xatom.h
cfile=initatoms.c
rm -f $hfile $cfile
umask 222
awk '
BEGIN {
	hfile = "'$hfile'";
	cfile = "'$cfile'";
	hformat = "#define XA_%s ((Atom) %d)\n";
	printf("#ifndef XATOM_H\n") > hfile;
	printf("#define XATOM_H 1\n\n") > hfile;
	printf("/* THIS IS A GENERATED FILE\n") > hfile;
	printf(" *\n") > hfile;
	printf(" * Do not change!  Changing this file implies a protocol change!\n") > hfile;
	printf(" */\n\n") > hfile;

	printf("/* THIS IS A GENERATED FILE\n") > cfile;
	printf(" *\n") > cfile;
	printf(" * Do not change!  Changing this file implies a protocol change!\n") > cfile;
	printf(" */\n\n") > cfile;
	printf("#include \"X.h\"\n") > cfile;
	printf("#include \"Xatom.h\"\n") > cfile;
	printf("extern Atom MakeAtom();\n") > cfile;
	printf("MakePredeclaredAtoms()\n") > cfile;
	printf("{\n") > cfile;

	}

NF == 2 && $2 == "@" {
	printf(hformat, $1, ++atomno) > hfile ;
	printf("    if (MakeAtom(\"%s\", %d, 1) != XA_%s) AtomError();\n", $1, length($1), $1) > cfile ;
	}

END {
	printf("\n") > hfile;
	printf(hformat, "LAST_PREDEFINED", atomno) > hfile ;
	printf("#endif /* XATOM_H */\n") > hfile;
	printf("}\n") > cfile ;
	}
' BuiltInAtoms
exit 0