xref: /openbsd/share/man/man5/genassym.cf.5 (revision 17df1aa7)
1.\"	$OpenBSD: genassym.cf.5,v 1.8 2007/05/31 19:19:58 jmc Exp $
2.\"	$NetBSD: genassym.cf.5,v 1.8 2001/06/19 12:34:27 wiz Exp $
3.\"
4.\" Copyright (c) 1997 Matthias Pfaller.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	  This product includes software developed by Matthias Pfaller.
18.\" 4. The name of the author may not be used to endorse or promote products
19.\"    derived from this software without specific prior written permission
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31.\"
32.Dd $Mdocdate: May 31 2007 $
33.Dt GENASSYM.CF 5
34.Os
35.Sh NAME
36.Nm genassym.cf
37.Nd assym.h definition file
38.Sh DESCRIPTION
39The
40.Nm
41file is used by
42.Xr genassym.sh 8
43to make constant C expressions known to assembler source files.
44.Pp
45Lines starting with '#' are discarded by
46.Xr genassym.sh 8 .
47Lines starting with
48.Em include ,
49.Em ifdef ,
50.Em if ,
51.Em else
52or
53.Em endif
54are preceded with '#' and passed otherwise unmodified to the C compiler.
55.Pp
56Lines starting with
57.Em quote
58get passed on with the
59.Em quote
60command removed.
61.Pp
62The first word after a
63.Em define
64command is taken as a CPP identifier and the rest of the line has to be
65a constant C expression.
66The output of
67.Xr genassym.sh 8
68will assign the numerical value of this expression to the CPP identifier.
69.Pp
70.Em "export foo"
71.br
72is a shorthand for
73.br
74.Em "define foo foo" .
75.Pp
76.Em "struct foo"
77.br
78remembers foo for the
79.Em member
80command and does a
81.br
82.Em "define FOO_SIZEOF sizeof(foo)" ,
83.br
84with the structure name converted to upper
85case.
86.Pp
87.Em "member foo"
88.br
89does a
90.br
91.Em "define FOO offsetof(<last struct>, foo)" .
92.br
93The two argument form of
94.Em "member" ,
95as
96.br
97.Em "member foo bar"
98.br
99does a
100.br
101.Em "define FOO offsetof(<last struct>, bar)" ,
102.br
103with its first argument converted to upper case.
104In the case where struct was
105invoked with an extra argument, as in
106.br
107.Em "struct foo PREFIX_" ,
108.br
109the first argument of member will be prefixed by the remembered prefix, before
110being converted to upper case.
111.Pp
112.Em "union foo"
113.br
114is similar to the
115.Em struct
116command, but applies to a union instead of a struct.
117.Pp
118.Em "config <ctype> <gcc constraint> <asm print modifier>"
119.br
120can be used to customize the output of
121.Xr genassym.sh 8 .
122.br
123When producing C output, values are cast to <ctype> (default: long)
124before they get handed to printf.
125<gcc constraint> (default: n) is the constraint used in the __asm__ statements.
126<asm print modifier> (default: empty) can be used to force gcc to output
127operands in different ways than normal.
128The "a" modifier e.g. stops gcc from emitting immediate
129prefixes in front of constants for the i386 and m68k port.
130.Sh FILES
131.Pa /sys/arch/${MACHINE}/${MACHINE}/genassym.cf
132.Sh SEE ALSO
133.Xr genassym.sh 8
134.Sh HISTORY
135The first use of
136.Nm
137files occurred in
138.Ox 2.2 .
139Its use was generalized to all ports for
140.Ox 3.0 .
141The
142.Em union
143command appeared in
144.Ox 3.5 .
145