/* ----------------------------------------------------------------------- * * * Copyright 1996-2020 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following * conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ----------------------------------------------------------------------- */ /* * listing.c listing file generator for the Netwide Assembler */ #include "compiler.h" #include "nctype.h" #include "nasm.h" #include "nasmlib.h" #include "error.h" #include "strlist.h" #include "listing.h" #define LIST_MAX_LEN … #define LIST_INDENT … #define LIST_HEXBIT … static const char xdigit[] = …; #define HEX(a,b) … uint64_t list_options, active_list_options; static char listline[LIST_MAX_LEN]; static bool listlinep; static struct strlist *list_errors; static char listdata[2 * LIST_INDENT]; /* we need less than that actually */ static int32_t listoffset; static int32_t listlineno; static int suppress; /* for INCBIN & TIMES special cases */ static int listlevel, listlevel_e; static FILE *listfp; static void list_emit(void) { … } static void list_cleanup(void) { … } static void list_init(const char *fname) { … } static void list_out(int64_t offset, char *str) { … } static void list_address(int64_t offset, const char *brackets, int64_t addr, int size) { … } static void list_size(int64_t offset, const char *tag, uint64_t size) { … } static void list_output(const struct out_data *data) { … } static void list_line(int type, int32_t lineno, const char *line) { … } static void list_uplevel(int type, int64_t size) { … } static void list_downlevel(int type) { … } static void list_error(errflags severity, const char *fmt, ...) { … } static void list_set_offset(uint64_t offset) { … } static void list_update_options(const char *str) { … } enum directive_result list_pragma(const struct pragma *pragma) { … } static const struct lfmt nasm_list = …; const struct lfmt *lfmt = …;