mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
bytes and offsets, but relocations are not yet indicated. Also, this outputs post-preprocessed source, so no comments, etc, are visible in the list file. * listfmt.h: New header file describing listfmt module interface. * coretype.h: Declare new yasm_listfmt typedef. * libyasm.h: Include listfmt.h. * libyasm/Makefile.inc (modinclude_HEADERS): Add listfmt.h. * yasm-module.h (module_type): Add MODULE_LISTFMT for listfmts. (load_listfmt_module, list_listfmts): New macros for listfmts. * yasm-module.c (module_type_str): Add listfmt string for MODULE_LISTFMT. (list_module_load): Add support for MODULE_LISTFMT. * bytecode.h (yasm_bc_tobytes): Comment clarification on effect of calling yasm_bc_tobytes twice on the same bytecode. * linemgr.h: Replace support for associated data with support for bytecode and source line information. (yasm_linemap_get_data): Remove. (yasm_linemap_get_source): Add. (yasm_linemap_add_data): Remove. (yasm_linemap_add_source): Add. * linemgr.c (yasm_linemap, yasm_linemap_create, yasm_linemap_destroy) (yasm_linemap_add_data, yasm_linemap_add_source, yasm_linemap_get_data) (yasm_linemap_get_source): Likewise. * nasm-token.re (fill): Save previous 2 lines instead of previous 1 line. (destroy_line, print_line, line_assoc_data): Remove. (save_line): Save line in structure instead of calling yasm_linemap_add_data. * nasm-bison.y (input rule): Call yasm_linemap_add_source here. * nasm-parser.h (yasm_parser_nasm): Add second line of storage and save_last variable to toggle between the two lines. * nasm-parser.c (nasm_parser_do_parse): Initialize save_last. * modules/Makefile.inc: Include new modules/listfmts/Makefile.inc. * modules/listfmts/Makefile.inc: New; includes modules/listfmts/nasm/Makefile.inc. * modules/listfmts/nasm/Makefile.inc: New build file for NASM-like listfmt. * nasm-listfmt.c: New NASM-like listfmt. * yasm.c: Enable use of listfmts, and default to NASM listfmt. (list_filename, cur_listfmt, cur_listfmt_module): New listfmt variables. (opt_listfmt_handler, opt_listfile_handler): New listfmt functions. (options): Add --lformat (-L) and --list (-l) options. (main): Load "nasm" listfmt as default if none selected. Enable saving of input lines if list output file enabled. Open and write to the list file. (open_obj): Rename to open_file and make more generic. (cleanup): Destroy listfmt and list filename if created. svn path=/trunk/yasm/; revision=1152
89 lines
2.7 KiB
C
89 lines
2.7 KiB
C
/**
|
|
* \file libyasm.h
|
|
* \brief YASM library primary header file.
|
|
*
|
|
* \rcs
|
|
* $Id$
|
|
* \endrcs
|
|
*
|
|
* \license
|
|
* Copyright (C) 2003 Peter Johnson
|
|
*
|
|
* 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 AUTHOR AND OTHER 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 AUTHOR OR OTHER 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.
|
|
* \endlicense
|
|
*
|
|
* Define YASM_LIB_INTERNAL to include many internal function and variable
|
|
* definitions that violate the yasm_* namespace. This includes
|
|
* compat-queue.h, bitvect.h, and hamt.h.
|
|
*
|
|
* Additional parts may be included via:
|
|
* - YASM_BC_INTERNAL: reveal bytecode internal structures via bc-int.h
|
|
* inclusion
|
|
* - YASM_EXPR_INTERNAL: reveal expr internal structures via expr-int.h
|
|
* inclusion
|
|
*/
|
|
#ifndef YASM_LIB_H
|
|
#define YASM_LIB_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
|
|
#ifdef YASM_LIB_INTERNAL
|
|
# include <libyasm/compat-queue.h>
|
|
#endif
|
|
|
|
#include <libyasm/coretype.h>
|
|
#include <libyasm/valparam.h>
|
|
|
|
#include <libyasm/linemgr.h>
|
|
|
|
#include <libyasm/errwarn.h>
|
|
#include <libyasm/intnum.h>
|
|
#include <libyasm/floatnum.h>
|
|
#include <libyasm/expr.h>
|
|
#include <libyasm/symrec.h>
|
|
|
|
#include <libyasm/bytecode.h>
|
|
#include <libyasm/section.h>
|
|
|
|
#include <libyasm/arch.h>
|
|
#include <libyasm/dbgfmt.h>
|
|
#include <libyasm/objfmt.h>
|
|
#include <libyasm/listfmt.h>
|
|
#include <libyasm/optimizer.h>
|
|
#include <libyasm/parser.h>
|
|
#include <libyasm/preproc.h>
|
|
|
|
#include <libyasm/file.h>
|
|
|
|
#ifdef YASM_LIB_INTERNAL
|
|
#ifdef YASM_BC_INTERNAL
|
|
#include <libyasm/bc-int.h>
|
|
#endif
|
|
#ifdef YASM_EXPR_INTERNAL
|
|
#include <libyasm/expr-int.h>
|
|
#endif
|
|
#include <libyasm/hamt.h>
|
|
#include <libyasm/bitvect.h>
|
|
#endif
|
|
|
|
#endif
|