xref: /freebsd/contrib/com_err/compile_et.1 (revision ae83180158c4c937f170e31eff311b18c0286a93)
1.\" Copyright (c) 1988 Massachusetts Institute of Technology,
2.\" Student Information Processing Board.  All rights reserved.
3.\"
4.\" $FreeBSD$
5.\"
6.Dd	November 22, 1988
7.Os
8.Dt COMPILE_ET 1
9.Sh NAME
10.Nm compile_et
11.Nd error table compiler
12.Sh SYNOPSIS
13.Nm compile_et
14.Ar file
15.Sh DESCRIPTION
16.Nm Compile_et
17converts a table listing error-code names and associated messages into
18a C source file suitable for use with the
19.Xr com_err 3
20library.
21.Pp
22The source file name must end with a suffix of ``.et''; the file
23consists of a declaration supplying the name (up to four characters
24long) of the error-code table:
25.Pp
26.Em error_table name
27.Pp
28followed by up to 256 entries of the form:
29.Pp
30.Em error_code name ,
31.No \(dq Ns Em string Ns \(dq
32.Pp
33and a final
34.Pp
35.Em end
36.Pp
37to indicate the end of the table.
38.Pp
39The name of the table is used to construct the name of a subroutine
40.Em initialize_XXXX_error_table
41which must be called in order for the
42.Xr com_err 3
43library to recognize the error table.
44.Pp
45The various error codes defined are assigned sequentially increasing
46numbers (starting with a large number computed as a hash function of
47the name of the table); thus for compatibility it is suggested that
48new codes be added only to the end of an existing table, and that no
49codes be removed from tables.
50.Pp
51The names defined in the table are placed into a C header file with
52preprocessor directives defining them as integer constants of up to
5332 bits in magnitude.
54.Pp
55A C source file is also generated which should be compiled and linked
56with the object files which reference these error codes; it contains
57the text of the messages and the initialization subroutine.  Both C
58files have names derived from that of the original source file, with
59the ``.et'' suffix replaced by ``.c'' and ``.h''.
60.Pp
61A ``#'' in the source file is treated as a comment character, and all
62remaining text to the end of the source line will be ignored.
63.Sh BUGS
64Since
65.Nm compile_et
66uses a very simple parser based on
67.Xr yacc 1 ,
68its error recovery leaves much to be desired.
69.Sh SEE ALSO
70.Xr yacc 1 ,
71.Xr com_err 3
72.Rs
73.%A Ken Raeburn
74.%T "A Common Error Description Library for UNIX"
75.Re
76