⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 raw-preproc.c

📁 支持AMD64的汇编编译器源码
💻 C
字号:
/* * Raw preprocessor (preforms NO preprocessing) * *  Copyright (C) 2001  Peter Johnson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. 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. */#include <util.h>/*@unused@*/ RCSID("$Id: raw-preproc.c 1137 2004-09-04 01:24:57Z peter $");#define YASM_LIB_INTERNAL#include <libyasm.h>typedef struct yasm_preproc_raw {    yasm_preproc_base preproc;   /* base structure */    int is_interactive;    FILE *in;    yasm_linemap *cur_lm;} yasm_preproc_raw;yasm_preproc_module yasm_raw_LTX_preproc;int isatty(int);static yasm_preproc *raw_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm){    yasm_preproc_raw *preproc_raw = yasm_xmalloc(sizeof(yasm_preproc_raw));    preproc_raw->preproc.module = &yasm_raw_LTX_preproc;    preproc_raw->in = f;    preproc_raw->cur_lm = lm;    /*@-unrecog@*/    preproc_raw->is_interactive = f ? (isatty(fileno(f)) > 0) : 0;    /*@=unrecog@*/    return (yasm_preproc *)preproc_raw;}static voidraw_preproc_destroy(yasm_preproc *preproc){    yasm_xfree(preproc);}static size_traw_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size){    yasm_preproc_raw *preproc_raw = (yasm_preproc_raw *)preproc;    int c = '*';    size_t n;    if (preproc_raw->is_interactive) {	for (n = 0; n < max_size && (c = getc(preproc_raw->in)) != EOF &&	     c != '\n'; n++)	    buf[n] = (char)c;	if (c == '\n')	    buf[n++] = (char)c;	if (c == EOF && ferror(preproc_raw->in))	    yasm__error(yasm_linemap_get_current(preproc_raw->cur_lm),			N_("error when reading from file"));    } else if (((n = fread(buf, 1, max_size, preproc_raw->in)) == 0) &&	       ferror(preproc_raw->in))	yasm__error(yasm_linemap_get_current(preproc_raw->cur_lm),		    N_("error when reading from file"));    return n;}static voidraw_preproc_add_include_path(yasm_preproc *preproc, const char *path){    /* no include paths */}static voidraw_preproc_add_include_file(yasm_preproc *preproc, const char *filename){    /* no pre-include files */}static voidraw_preproc_predefine_macro(yasm_preproc *preproc, const char *macronameval){    /* no pre-defining macros */}static voidraw_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname){    /* no undefining macros */}/* Define preproc structure -- see preproc.h for details */yasm_preproc_module yasm_raw_LTX_preproc = {    YASM_PREPROC_VERSION,    "Disable preprocessing",    "raw",    raw_preproc_create,    raw_preproc_destroy,    raw_preproc_input,    raw_preproc_add_include_path,    raw_preproc_add_include_file,    raw_preproc_predefine_macro,    raw_preproc_undefine_macro};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -