1 /* ----------------------------------------------------------------------- *
3 * Copyright 1996-2016 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
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 * ----------------------------------------------------------------------- */
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:
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
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
66 void (*output
)(const struct out_data
*data
);
69 * Called to send a text line to the listing generator. The
70 * `int' parameter is LIST_READ or LIST_MACRO depending on
71 * whether the line came directly from an input file or is the
72 * result of a multi-line macro expansion.
74 void (*line
)(int type
, char *line
);
77 * Called to change one of the various levelled mechanisms in
78 * the listing generator. LIST_INCLUDE and LIST_MACRO can be
79 * used to increase the nesting level of include files and
80 * macro expansions; LIST_TIMES and LIST_INCBIN switch on the
81 * two binary-output-suppression mechanisms for large-scale
82 * pseudo-instructions.
84 * LIST_MACRO_NOLIST is synonymous with LIST_MACRO except that
85 * it indicates the beginning of the expansion of a `nolist'
86 * macro, so anything under that level won't be expanded unless
87 * it includes another file.
89 void (*uplevel
)(int type
);
92 * Reverse the effects of uplevel.
94 void (*downlevel
)(int type
);
97 * Called on a warning or error, with the error message.
99 void (*error
)(int severity
, const char *pfx
, const char *msg
);
102 * Update the current offset. Used to give the listing generator
103 * an offset to work with when doing things like
104 * uplevel(LIST_TIMES) or uplevel(LIST_INCBIN); see
107 void (*set_offset
)(uint64_t offset
);
110 extern const struct lfmt
*lfmt
;
111 extern bool user_nolist
;