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