xref: /freebsd/contrib/com_err/compile_et.1 (revision 97549c34ecaf74580941fdc9c5bd1050e4b1f6ce)
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.Dt COMPILE_ET 1
8.Os
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.
58Both C
59files have names derived from that of the original source file, with
60the ``.et'' suffix replaced by ``.c'' and ``.h''.
61.Pp
62A ``#'' in the source file is treated as a comment character, and all
63remaining text to the end of the source line will be ignored.
64.Sh SEE ALSO
65.Xr yacc 1 ,
66.Xr com_err 3
67.Rs
68.%A Ken Raeburn
69.%T "A Common Error Description Library for UNIX"
70.Re
71.Sh BUGS
72Since
73.Nm compile_et
74uses a very simple parser based on
75.Xr yacc 1 ,
76its error recovery leaves much to be desired.
77