xref: /freebsd/contrib/com_err/compile_et.1 (revision d429ea332342fcb98d27a350d0c4944bf9aec3f9)
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.
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 BUGS
65Since
66.Nm compile_et
67uses a very simple parser based on
68.Xr yacc 1 ,
69its error recovery leaves much to be desired.
70.Sh SEE ALSO
71.Xr yacc 1 ,
72.Xr com_err 3
73.Rs
74.%A Ken Raeburn
75.%T "A Common Error Description Library for UNIX"
76.Re
77