xref: /freebsd/contrib/com_err/compile_et.1 (revision f9ce010afdd3136fc73e2b500f2ed916bf9cfa59)
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
26.Em error_table name
27
28followed by up to 256 entries of the form:
29
30.Em error_code name ,
31"
32.Em string
33"
34
35and a final
36
37.Em end
38
39to indicate the end of the table.
40.Pp
41The name of the table is used to construct the name of a subroutine
42.Em initialize_XXXX_error_table
43which must be called in order for the
44.Xr com_err 3
45library to recognize the error table.
46.Pp
47The various error codes defined are assigned sequentially increasing
48numbers (starting with a large number computed as a hash function of
49the name of the table); thus for compatibility it is suggested that
50new codes be added only to the end of an existing table, and that no
51codes be removed from tables.
52.Pp
53The names defined in the table are placed into a C header file with
54preprocessor directives defining them as integer constants of up to
5532 bits in magnitude.
56.Pp
57A C source file is also generated which should be compiled and linked
58with the object files which reference these error codes; it contains
59the text of the messages and the initialization subroutine.  Both C
60files have names derived from that of the original source file, with
61the ``.et'' suffix replaced by ``.c'' and ``.h''.
62.Pp
63A ``#'' in the source file is treated as a comment character, and all
64remaining text to the end of the source line will be ignored.
65.Sh BUGS
66Since
67.Nm compile_et
68uses a very simple parser based on
69.Xr yacc 1 ,
70its error recovery leaves much to be desired.
71.Sh "SEE ALSO"
72.Xr yacc 1 ,
73.Xr com_err 3
74.Pp
75.Rs
76.%A Ken Raeburn
77.%T "A Common Error Description Library for UNIX"
78.Re
79