Annotation of src/usr.bin/compile_et/compile_et.1, Revision 1.16
1.1 downsj 1: .\" Copyright (c) 1988 Massachusetts Institute of Technology,
2: .\" Student Information Processing Board. All rights reserved.
3: .\"
1.16 ! deraadt 4: .\" $OpenBSD: compile_et.1,v 1.15 2007/10/07 15:46:17 deraadt Exp $
1.1 downsj 5: .\"
1.16 ! deraadt 6: .Dd $Mdocdate: October 7 2007 $
1.6 aaron 7: .Dt COMPILE_ET 1
1.3 grr 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
1.5 aaron 16: .Nm
1.1 downsj 17: converts a table listing error-code names and associated messages into
18: a C source file suitable for use with the
1.3 grr 19: .Xr com_err 3
1.1 downsj 20: library.
1.3 grr 21: .Pp
1.9 aaron 22: The source file name must end with a suffix of
23: .Dq .et ;
24: the file
1.8 hin 25: consists of headers and declarations supplying the name (up to four characters
26: long) of the error-code table.
1.9 aaron 27: .Pp
1.8 hin 28: The file may have these declarations:
1.9 aaron 29: .Bl -tag -width Ds
30: .It Sy id Ar string
31: Specify
32: .Ar string
33: as a revision control system tag.
34: .It Sy prefix Ar string
35: Prepends
36: .Ar string
37: to all error codes specified in the file.
38: .It Sy error_table Ar name
39: Specifies the name of the error table.
40: .It Sy index Ar number
41: Sets the assigned error number for the next entry.
42: .It Xo Sy error_code
43: .Ar name ,
44: .Qq Ar string
45: .Xc
46: Declares an error code called
47: .Ar name
48: with description
49: .Ar string ;
50: up to 256 error codes are allowed.
51: .It Sy end
52: Indicates the end of the table.
53: .El
1.3 grr 54: .Pp
1.1 downsj 55: The name of the table is used to construct the name of a subroutine
1.3 grr 56: .Em initialize_XXXX_error_table
1.1 downsj 57: which must be called in order for the
1.3 grr 58: .Xr com_err 3
1.1 downsj 59: library to recognize the error table.
1.3 grr 60: .Pp
1.1 downsj 61: The various error codes defined are assigned sequentially increasing
62: numbers (starting with a large number computed as a hash function of
63: the name of the table); thus for compatibility it is suggested that
64: new codes be added only to the end of an existing table, and that no
65: codes be removed from tables.
1.3 grr 66: .Pp
1.1 downsj 67: The names defined in the table are placed into a C header file with
68: preprocessor directives defining them as integer constants of up to
69: 32 bits in magnitude.
1.3 grr 70: .Pp
1.1 downsj 71: A C source file is also generated which should be compiled and linked
72: with the object files which reference these error codes; it contains
1.10 aaron 73: the text of the messages and the initialization subroutine.
74: Both C files have names derived from that of the original source file, with
1.9 aaron 75: the
76: .Dq .et
77: suffix replaced by
78: .Dq \&.c
79: and
80: .Dq \&.h .
81: .Pp
82: A hash mark
83: .Pq Ql #
84: in the source file is treated as a comment character; subsequent
85: characters to the end of the source line will be ignored.
1.7 aaron 86: .Sh SEE ALSO
1.3 grr 87: .Xr yacc 1 ,
88: .Xr com_err 3
89: .Rs
90: .%A Ken Raeburn
91: .%T "A Common Error Description Library for UNIX"
92: .Re
1.11 aaron 93: .Sh BUGS
94: Since
95: .Nm
96: uses a very simple parser based on
97: .Xr yacc 1 ,
98: its error recovery leaves much to be desired.