outmacho: Fix relative relocations for 32-bit Mach-O (fix typo)
[nasm.git] / listing.h
blob58b5eb8aff81fc23c1fa79e433c5219140869c7b
1 /* ----------------------------------------------------------------------- *
2 *
3 * Copyright 1996-2009 The NASM Authors - All Rights Reserved
4 * See the file AUTHORS included with the NASM distribution for
5 * the specific copyright holders.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following
9 * conditions are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * ----------------------------------------------------------------------- */
34 /*
35 * listing.h header file for listing.c
38 #ifndef NASM_LISTING_H
39 #define NASM_LISTING_H
42 * List-file generators should look like this:
44 struct lfmt {
46 * Called to initialize the listing file generator. Before this
47 * is called, the other routines will silently do nothing when
48 * called. The `char *' parameter is the file name to write the
49 * listing to.
51 void (*init)(const char *fname);
54 * Called to clear stuff up and close the listing file.
56 void (*cleanup)(void);
59 * Called to output binary data. Parameters are: the offset;
60 * the data; the data type. Data types are similar to the
61 * output-format interface, only OUT_ADDRESS will _always_ be
62 * displayed as if it's relocatable, so ensure that any non-
63 * relocatable address has been converted to OUT_RAWDATA by
64 * then. Note that OUT_RAWDATA,0 is a valid data type, and is a
65 * dummy call used to give the listing generator an offset to
66 * work with when doing things like uplevel(LIST_TIMES) or
67 * uplevel(LIST_INCBIN).
69 void (*output)(int32_t offset, const void *data, enum out_type type, uint64_t size);
72 * Called to send a text line to the listing generator. The
73 * `int' parameter is LIST_READ or LIST_MACRO depending on
74 * whether the line came directly from an input file or is the
75 * result of a multi-line macro expansion.
77 void (*line)(int type, char *line);
80 * Called to change one of the various levelled mechanisms in
81 * the listing generator. LIST_INCLUDE and LIST_MACRO can be
82 * used to increase the nesting level of include files and
83 * macro expansions; LIST_TIMES and LIST_INCBIN switch on the
84 * two binary-output-suppression mechanisms for large-scale
85 * pseudo-instructions.
87 * LIST_MACRO_NOLIST is synonymous with LIST_MACRO except that
88 * it indicates the beginning of the expansion of a `nolist'
89 * macro, so anything under that level won't be expanded unless
90 * it includes another file.
92 void (*uplevel)(int type);
95 * Reverse the effects of uplevel.
97 void (*downlevel)(int type);
100 * Called on a warning or error, with the error message.
102 void (*error)(int severity, const char *pfx, const char *msg);
105 extern const struct lfmt *lfmt;
106 extern bool user_nolist;
108 #endif