From: Peter Johnson Date: Sat, 16 Sep 2006 04:27:37 +0000 (-0000) Subject: * yapp: Unbitrot. Note to actually build this you need AM_PROG_LEX in X-Git-Tag: v0.6.0~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42c4152c0d0bda3ee9d7757cf084c5bbfc08743e;p=yasm * yapp: Unbitrot. Note to actually build this you need AM_PROG_LEX in configure.ac (and add this subdirectory to preprocs/Makefile.inc). svn path=/trunk/yasm/; revision=1616 --- diff --git a/modules/preprocs/yapp/Makefile.inc b/modules/preprocs/yapp/Makefile.inc index c935c6e7..e1659032 100644 --- a/modules/preprocs/yapp/Makefile.inc +++ b/modules/preprocs/yapp/Makefile.inc @@ -1,15 +1,11 @@ -# $IdPath$ +# $Id$ -pkglib_LTLIBRARIES += preproc_yapp.la +libyasm_a_SOURCES += modules/preprocs/yapp/yapp-preproc.c +libyasm_a_SOURCES += modules/preprocs/yapp/yapp-preproc.h +libyasm_a_SOURCES += modules/preprocs/yapp/yapp-token.h +libyasm_a_SOURCES += modules/preprocs/yapp/yapp-token.l -preproc_yapp_la_SOURCES = modules/preprocs/yapp/yapp-preproc.c -preproc_yapp_la_SOURCES += modules/preprocs/yapp/yapp-preproc.h -preproc_yapp_la_SOURCES += modules/preprocs/yapp/yapp-token.h -preproc_yapp_la_SOURCES += modules/preprocs/yapp/yapp-token.l - -preproc_yapp_la_LDFLAGS = -module -avoid-version -no-undefined -preproc_yapp_la_LIBADD = libyasm.la -YASM_MODULES += -dlopen preproc_yapp.la +YASM_MODULES += preproc_yapp BUILT_SOURCES += yapp-token.c diff --git a/modules/preprocs/yapp/tests/yapp_test.sh b/modules/preprocs/yapp/tests/yapp_test.sh index 28e42ea8..56565d1c 100755 --- a/modules/preprocs/yapp/tests/yapp_test.sh +++ b/modules/preprocs/yapp/tests/yapp_test.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $IdPath$ +# $Id$ case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' @@ -16,45 +16,89 @@ mkdir results >/dev/null 2>&1 # passedct=0 -passedlist='' failedct=0 -failedlist='' -errorct=0 -errorlist='' YT="yapp_test" +echo $ECHO_N "Test $YT: " for asm in ${srcdir}/modules/preprocs/yapp/tests/*.asm do a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'` - y=${a}.yp - p=`echo ${asm} | sed 's,.asm$,.pre,'` - - echo $ECHO_N "$YT: Testing yapp for ${a} ... $ECHO_C" - if sed "s,\./,${srcdir}/," ${asm} | ./yasm -e -r yapp | - sed "s,${srcdir}/,./," > results/${y}; then - if diff -w ${p} results/${y} > /dev/null; then - echo "PASS." - passedct=`expr $passedct + 1` - passedlist="${passedlist}${a} " - else - echo "FAIL." + o=${a}.yp + og=`echo ${asm} | sed 's,.asm$,.pre,'` + e=${a}.ew + eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` + + # Run within a subshell to prevent signal messages from displaying. + sh -c "sed \"s,\./,${srcdir}/,\" ${asm} | ./yasm -e -r yapp | sed \"s,${srcdir}/,./,\" > results/${o} 2>results/${e}" >/dev/null 2>/dev/null + status=$? + if test $status -gt 128; then + # We should never get a coredump! + echo $ECHO_N "C" + eval "failed$failedct='C: ${a} crashed!'" + failedct=`expr $failedct + 1` + elif test $status -gt 0; then + echo ${asm} | grep err >/dev/null + if test $? -gt 0; then + # YASM detected errors but shouldn't have! + echo $ECHO_N "E" + eval "failed$failedct='E: ${a} returned an error code!'" failedct=`expr $failedct + 1` - failedlist="${failedlist}${a} " + else + # We got errors, check to see if they match: + if (test \! -e ${eg} && test -s results/${e}) || + (test -e ${eg} && diff ${eg} results/${e} >/dev/null); then + # Error/warnings don't match. + echo $ECHO_N "W" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + else + # Error/warnings match, it passes! + echo $ECHO_N "." + passedct=`expr $passedct + 1` + fi fi else - errorct=`expr $errorct + 1` - errorlist="${errorlist}${a} " + echo ${asm} | grep -v err >/dev/null + if test $? -gt 0; then + # YASM detected errors but shouldn't have! + echo $ECHO_N "E" + eval "failed$failedct='E: ${a} returned an error code!'" + failedct=`expr $failedct + 1` + else + diff -w ${og} results/${o} > /dev/null + if test $? -eq 0; then + if (test \! -e ${eg} && test -s results/${e}) || + (test -e ${eg} && diff ${eg} results/${e} >/dev/null); then + # Error/warnings don't match. + echo $ECHO_N "W" + eval "failed$failedct='W: ${a} did not match errors and warnings!'" + failedct=`expr $failedct + 1` + else + # Both output file and error/warnings match, it passes! + echo $ECHO_N "." + passedct=`expr $passedct + 1` + fi + else + # Output file doesn't match. + echo $ECHO_N "O" + eval "failed$failedct='O: ${a} did not match output file!'" + failedct=`expr $failedct + 1` + fi + fi fi done -ct=`expr $failedct + $passedct + $errorct` +ct=`expr $failedct + $passedct` per=`expr 100 \* $passedct / $ct` -echo "$YT: $per%: Checks: $ct, Failures $failedct, Errors: $errorct" -#test $passedct -gt 0 && echo "$YT: PASSED $passedct: $passedlist" -#test $failedct -gt 0 && echo "$YT: FAILED $failedct: $failedlist" -#test $errorct -gt 0 && echo "$YT: ERRORED $errorct: $errorlist" +echo " +$passedct-$failedct/$ct $per%" +i=0 +while test $i -lt $failedct; do + eval "failure=\$failed$i" + echo " ** $failure" + i=`expr $i + 1` +done -exit `expr $failedct + $errorct` +exit $failedct diff --git a/modules/preprocs/yapp/yapp-preproc.c b/modules/preprocs/yapp/yapp-preproc.c index e8e647c0..57f47cfb 100644 --- a/modules/preprocs/yapp/yapp-preproc.c +++ b/modules/preprocs/yapp/yapp-preproc.c @@ -1,26 +1,31 @@ -/* $IdPath: yasm/modules/preprocs/yapp/yapp-preproc.c,v 1.23 2003/03/17 00:03:02 peter Exp $ +/* * YAPP preprocessor (mimics NASM's preprocessor) * - * Copyright (C) 2001 Michael Urman + * Copyright (C) 2001 Michael Urman * - * This file is part of YASM. + * 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. * - * YASM is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * YASM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 -/*@unused@*/ RCSID("$IdPath: yasm/modules/preprocs/yapp/yapp-preproc.c,v 1.23 2003/03/17 00:03:02 peter Exp $"); +/*@unused@*/ RCSID("$Id$"); #define YASM_LIB_INTERNAL #include @@ -30,7 +35,12 @@ #define ydebug(x) /* printf x */ -static int is_interactive; +typedef struct yasm_preproc_yapp { + yasm_preproc_base preproc; /* base structure */ +} yasm_preproc_yapp; + +yasm_preproc_module yasm_yapp_LTX_preproc; + static int saved_length; static HAMT *macro_table; @@ -38,9 +48,7 @@ static HAMT *macro_table; static YAPP_Output current_output; YYSTYPE yapp_preproc_lval; -/*@dependent@*/ yasm_linemgr *yapp_preproc_linemgr; - -int isatty(int); +/*@dependent@*/ yasm_linemap *yapp_preproc_linemap; /* Build source and macro representations */ static SLIST_HEAD(source_head, source_s) source_head, macro_head, param_head; @@ -117,13 +125,13 @@ yapp_macro_insert (char *name, int argc, int fillargs) void yapp_macro_error_exists (YAPP_Macro *v) { - if (v) yasm__error(cur_lindex, N_("Redefining macro of the same name %d:%d"), v->type, v->args); + if (v) yasm_error_set(YASM_ERROR_VALUE, N_("Redefining macro of the same name %d:%d"), v->type, v->args); } void yapp_macro_error_sameargname (YAPP_Macro *v) { - if (v) yasm__error(cur_lindex, N_("Duplicate argument names in macro")); + if (v) yasm_error_set(YASM_ERROR_VALUE, N_("Duplicate argument names in macro")); } YAPP_Macro * @@ -138,7 +146,7 @@ yapp_define_insert (char *name, int argc, int fillargs) if ((argc >= 0 && ym->args < 0) || (argc < 0 && ym->args >= 0)) { - yasm__warning(YASM_WARN_PREPROC, cur_lindex, N_("Attempted %%define both with and without parameters")); + yasm_warn_set(YASM_WARN_PREPROC, N_("Attempted %%define both with and without parameters")); return NULL; } } @@ -233,11 +241,15 @@ expand_macro(char *name, void expand_token_list(struct source_head *paramexp, struct source_head *to_head, source **to_tail); -static void -yapp_preproc_initialize(FILE *f, const char *in_filename, yasm_linemgr *lm) +static yasm_preproc * +yapp_preproc_create(FILE *f, const char *in_filename, yasm_linemap *lm, + yasm_errwarns *errwarns) { - is_interactive = f ? (isatty(fileno(f)) > 0) : 0; - yapp_preproc_linemgr = lm; + yasm_preproc_yapp *preproc_yapp = yasm_xmalloc(sizeof(yasm_preproc_yapp)); + + preproc_yapp->preproc.module = &yasm_yapp_LTX_preproc; + + yapp_preproc_linemap = lm; yapp_preproc_current_file = yasm__xstrdup(in_filename); yapp_preproc_line_number = 1; yapp_lex_initialize(f); @@ -249,19 +261,22 @@ yapp_preproc_initialize(FILE *f, const char *in_filename, yasm_linemgr *lm) out->out = current_output = YAPP_OUTPUT; SLIST_INSERT_HEAD(&output_head, out, next); - macro_table = HAMT_new(yasm_internal_error_); + macro_table = HAMT_create(yasm_internal_error_); source_tail = SLIST_FIRST(&source_head); macro_tail = SLIST_FIRST(¯o_head); param_tail = SLIST_FIRST(¶m_head); append_token(LINE, &source_head, &source_tail); + + return (yasm_preproc *)preproc_yapp; } static void -yapp_preproc_cleanup(void) +yapp_preproc_destroy(yasm_preproc *preproc) { /* TODO: clean up */ + yasm_xfree(preproc); } /* Generate a new level of if* context @@ -465,7 +480,8 @@ eat_through_return(struct source_head *to_head, source **to_tail) while ((token = yapp_preproc_lex()) != '\n') { if (token == 0) return 0; - yasm__error(cur_lindex, N_("Skipping possibly valid %%define stuff")); + yasm_error_set(YASM_ERROR_SYNTAX, + N_("Skipping possibly valid %%define stuff")); } append_token('\n', to_head, to_tail); return '\n'; @@ -478,7 +494,8 @@ yapp_get_ident(const char *synlvl) if (token == WHITESPACE) token = yapp_preproc_lex(); if (token != IDENT) { - yasm__error(cur_lindex, N_("Identifier expected after %%%s"), synlvl); + yasm_error_set(YASM_ERROR_SYNTAX, N_("Identifier expected after %%%s"), + synlvl); } return token; } @@ -587,7 +604,7 @@ expand_macro(char *name, if (token < 256) yasm_internal_error(N_("Unexpected character token in parameter expansion")); else - yasm__error(cur_lindex, N_("Cannot handle preprocessor items inside possible macro invocation")); + yasm_error_set(YASM_ERROR_SYNTAX, N_("Cannot handle preprocessor items inside possible macro invocation")); } } @@ -607,7 +624,7 @@ expand_macro(char *name, ym->expanding = 1; /* so the macro exists. build a HAMT parameter table */ - param_table = HAMT_new(yasm_internal_error_); + param_table = HAMT_create(yasm_internal_error_); /* fill the entries by walking the replay buffer and create * "macros". coincidentally, clear the replay buffer. */ @@ -747,7 +764,7 @@ expand_token_list(struct source_head *paramexp, struct source_head *to_head, sou } static size_t -yapp_preproc_input(char *buf, size_t max_size) +yapp_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size) { static YAPP_State state = YAPP_STATE_INITIAL; size_t n = 0; @@ -767,7 +784,7 @@ yapp_preproc_input(char *buf, size_t max_size) append_token(token, &source_head, &source_tail); /*if (append_to_return()==0) state=YAPP_STATE_EOF;*/ ydebug(("YAPP: default: '%c' \"%s\"\n", token, yapp_preproc_lval.str_val)); - /*yasm__error(cur_lindex, N_("YAPP got an unhandled token."));*/ + /*yasm_error_set(YASM_ERROR_SYNTAX, N_("YAPP got an unhandled token."));*/ break; case IDENT: @@ -789,8 +806,8 @@ yapp_preproc_input(char *buf, size_t max_size) break; case CLEAR: - HAMT_delete(macro_table, (void (*)(void *))yapp_macro_delete); - macro_table = HAMT_new(yasm_internal_error_); + HAMT_destroy(macro_table, (void (*)(void *))yapp_macro_delete); + macro_table = HAMT_create(yasm_internal_error_); break; case DEFINE: @@ -836,7 +853,7 @@ yapp_preproc_input(char *buf, size_t max_size) break; } else if (last_token == ',' || token != ',') - yasm__error(cur_lindex, N_("Unexpected token in %%define parameters")); + yasm_error_set(YASM_ERROR_SYNTAX, N_("Unexpected token in %%define parameters")); last_token = token; } if (token == ')') { @@ -916,7 +933,7 @@ yapp_preproc_input(char *buf, size_t max_size) } break; default: - yasm__error(cur_lindex, N_("YAPP got into a bad state")); + yasm_error_set(YASM_ERROR_PARSE, N_("YAPP got into a bad state")); } if (need_line_directive) { append_token(LINE, &source_head, &source_tail); @@ -942,11 +959,55 @@ yapp_preproc_input(char *buf, size_t max_size) return n; } +static size_t +yapp_preproc_get_included_file(yasm_preproc *preproc, /*@out@*/ char *buf, + size_t max_size) +{ + /* TODO */ + return 0; +} + +static void +yapp_preproc_add_include_path(yasm_preproc *preproc, const char *path) +{ + /* TODO */ +} + +static void +yapp_preproc_add_include_file(yasm_preproc *preproc, const char *filename) +{ + /* TODO */ +} + +static void +yapp_preproc_predefine_macro(yasm_preproc *preproc, const char *macronameval) +{ + /* TODO */ +} + +static void +yapp_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname) +{ + /* TODO */ +} + +static void +yapp_preproc_define_builtin(yasm_preproc *preproc, const char *macronameval) +{ + /* TODO */ +} + /* Define preproc structure -- see preproc.h for details */ -yasm_preproc yasm_yapp_LTX_preproc = { +yasm_preproc_module yasm_yapp_LTX_preproc = { "YAPP preprocessing (NASM style)", "yapp", - yapp_preproc_initialize, - yapp_preproc_cleanup, - yapp_preproc_input + yapp_preproc_create, + yapp_preproc_destroy, + yapp_preproc_input, + yapp_preproc_get_included_file, + yapp_preproc_add_include_path, + yapp_preproc_add_include_file, + yapp_preproc_predefine_macro, + yapp_preproc_undefine_macro, + yapp_preproc_define_builtin }; diff --git a/modules/preprocs/yapp/yapp-preproc.h b/modules/preprocs/yapp/yapp-preproc.h index 531d6b10..9e5366ae 100644 --- a/modules/preprocs/yapp/yapp-preproc.h +++ b/modules/preprocs/yapp/yapp-preproc.h @@ -1,24 +1,28 @@ -/* $IdPath$ +/* $Id$ * YAPP preprocessor (mimics NASM's preprocessor) header file * - * Copyright (C) 2001 Michael Urman + * Copyright (C) 2001 Michael Urman * - * This file is part of YASM. - * - * YASM is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * YASM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ /* Representation of tokenized file, both for straight source, and macros */ @@ -53,6 +57,6 @@ typedef enum { void yapp_lex_initialize(FILE *f); void set_inhibit(void); -extern /*@dependent@*/ yasm_linemgr *yapp_preproc_linemgr; -#define cur_lindex (yapp_preproc_linemgr->get_current()) +extern /*@dependent@*/ yasm_linemap *yapp_preproc_linemap; +#define cur_lindex yasm_linemap_get_current(yapp_preproc_linemap) diff --git a/modules/preprocs/yapp/yapp-token.l b/modules/preprocs/yapp/yapp-token.l index 7889ea3f..38a4c184 100644 --- a/modules/preprocs/yapp/yapp-token.l +++ b/modules/preprocs/yapp/yapp-token.l @@ -1,28 +1,35 @@ -/* $IdPath$ +/* * YAPP lexer * - * Copyright (C) 2001 Michael Urman + * Copyright (C) 2001 Michael Urman * - * This file is part of YASM. + * 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. * - * YASM is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * YASM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 +/*@unused@*/ RCSID("$Id$"); + #define YASM_LIB_INTERNAL -#include "libyasm.h" -/*@unused@*/ RCSID("$IdPath$"); +#include #include @@ -141,9 +148,9 @@ DIR %[ \t]* } if(inch == '\n') - yasm__error(cur_lindex, N_("unterminated string")); + yasm_error_set(YASM_ERROR_VALUE, N_("unterminated string")); else if(inch == EOF) - yasm__error(cur_lindex, N_("unexpected end of file in string")); + yasm_error_set(YASM_ERROR_VALUE, N_("unexpected end of file in string")); strbuf[count] = '\0'; @@ -174,7 +181,7 @@ DIR %[ \t]* /* FIXME: handle includes that aren't relative */ incfile = fopen (yytext, "r"); if(!incfile) { - yasm__error(cur_lindex, N_("include file `%s': %s"), + yasm_error_set(YASM_ERROR_VALUE, N_("include file `%s': %s"), yytext, strerror(errno)); yasm_xfree(inc); } @@ -332,11 +339,11 @@ DIR %[ \t]* [][+*/,()-] { return yytext[0]; } . { - yasm__warning(YASM_WARN_PREPROC, cur_lindex, N_("Unhandled character in `%s'"), yasm__conv_unprint(yytext[0])); + yasm_warn_set(YASM_WARN_PREPROC, N_("Unhandled character in `%s'"), yasm__conv_unprint(yytext[0])); } . { - yasm__warning(YASM_WARN_PREPROC, cur_lindex, N_("ignoring unrecognized character `%s'"), + yasm_warn_set(YASM_WARN_PREPROC, N_("ignoring unrecognized character `%s'"), yasm__conv_unprint(yytext[0])); }