From dff162c10c4fd2d8c083f95102cbf588c5bad86c Mon Sep 17 00:00:00 2001 From: pavalos Date: Thu, 5 Jul 2007 05:41:50 +0000 Subject: [PATCH] Modify assembler to ignore carriage returns in input. Obtained-from: FreeBSD --- sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l | 7 ++++--- sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l b/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l index 360c405a68..a265b9529c 100644 --- a/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l +++ b/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l @@ -38,10 +38,10 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_macro_scan.l#7 $ + * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_macro_scan.l#8 $ * - * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.1.2.3 2002/09/27 15:46:28 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.4 2006/04/22 16:15:26 dillon Exp $ + * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.5 2003/12/16 23:54:07 gibbs Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.5 2007/07/05 05:41:50 pavalos Exp $ */ #include @@ -81,6 +81,7 @@ MCARG [^(), \t]+ \n { ++yylineno; } +\r ; {SPACE} ; \( { parren_count++; diff --git a/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l b/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l index 7101be0517..8d02e6235e 100644 --- a/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l +++ b/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l @@ -38,10 +38,10 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#18 $ + * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#19 $ * - * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.13.2.6 2002/09/27 15:46:28 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l,v 1.4 2006/04/22 16:15:26 dillon Exp $ + * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.22 2003/12/16 23:54:07 gibbs Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aicasm/aicasm_scan.l,v 1.5 2007/07/05 05:41:50 pavalos Exp $ */ #include @@ -94,6 +94,7 @@ MBODY ((\\[^\n])*[^\n\\]*)+ %% \n { ++yylineno; } +\r ; "/*" { BEGIN COMMENT; /* Enter comment eating state */ } "/*" { fprintf(stderr, "Warning! Comment within comment."); } \n { ++yylineno; } @@ -121,6 +122,7 @@ if[ \t]*\( { } } \n { ++yylineno; } +\r ; [^()\n]+ { char *yptr; @@ -366,6 +368,7 @@ else { return T_ELSE; } /* Eat escaped newlines. */ ++yylineno; } +\r ; \n { /* Macros end on the first unescaped newline. */ BEGIN INITIAL; @@ -376,10 +379,17 @@ else { return T_ELSE; } } {MBODY} { char *yptr; + char c; yptr = yytext; - while (*yptr) - *string_buf_ptr++ = *yptr++; + while (c = *yptr++) { + /* + * Strip carriage returns. + */ + if (c == '\r') + continue; + *string_buf_ptr++ = c; + } } {WORD}\( { char *yptr; -- 2.11.4.GIT