1 | /* ----------------------------------------------------------------------- * |
2 | * |
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. |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following |
9 | * conditions are met: |
10 | * |
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. |
17 | * |
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. |
31 | * |
32 | * ----------------------------------------------------------------------- */ |
33 | |
34 | /* |
35 | * listing.h header file for listing.c |
36 | */ |
37 | |
38 | #ifndef NASM_LISTING_H |
39 | #define NASM_LISTING_H |
40 | |
41 | /* |
42 | * List-file generators should look like this: |
43 | */ |
44 | struct lfmt { |
45 | /* |
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. |
50 | */ |
51 | void (*init)(const char *fname); |
52 | |
53 | /* |
54 | * Called to clear stuff up and close the listing file. |
55 | */ |
56 | void (*cleanup)(void); |
57 | |
58 | /* |
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. |
65 | */ |
66 | void (*output)(const struct out_data *data); |
67 | |
68 | /* |
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. |
73 | */ |
74 | void (*line)(int type, char *line); |
75 | |
76 | /* |
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. |
83 | * |
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. |
88 | */ |
89 | void (*uplevel)(int type); |
90 | |
91 | /* |
92 | * Reverse the effects of uplevel. |
93 | */ |
94 | void (*downlevel)(int type); |
95 | |
96 | /* |
97 | * Called on a warning or error, with the error message. |
98 | */ |
99 | void printf_func(2, 3) (*error)(int severity, const char *fmt, ...); |
100 | |
101 | /* |
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 |
105 | * list_set_offset(); |
106 | */ |
107 | void (*set_offset)(uint64_t offset); |
108 | }; |
109 | |
110 | extern const struct lfmt *lfmt; |
111 | extern bool user_nolist; |
112 | |
113 | #endif |
114 | |